## Automatically generated incremental diff
## From:   linux-2.5.67-bk5
## To:     linux-2.5.67-bk6
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.5.67-bk5/Documentation/arm/Porting linux-2.5.67-bk6/Documentation/arm/Porting
--- linux-2.5.67-bk5/Documentation/arm/Porting	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/Documentation/arm/Porting	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,135 @@
+Taken from list archive at http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2001-July/004064.html
+
+Initial definitions
+-------------------
+
+The following symbol definitions rely on you knowing the translation that
+__virt_to_phys() does for your machine.  This macro converts the passed
+virtual address to a physical address.  Normally, it is simply:
+
+		phys = virt - PAGE_OFFSET + PHYS_OFFSET
+
+
+Decompressor Symbols
+--------------------
+
+ZTEXTADDR
+	Start address of decompressor.  There's no point in talking about
+	virtual or physical addresses here, since the MMU will be off at
+	the time when you call the decompressor code.  You normally call
+	the kernel at this address to start it booting.  This doesn't have
+	to be located in RAM, it can be in flash or other read-only or
+	read-write addressable medium.
+
+ZBSSADDR
+	Start address of zero-initialised work area for the decompressor.
+	This must be pointing at RAM.  The decompressor will zero initialise
+	this for you.  Again, the MMU will be off.
+
+ZRELADDR
+	This is the address where the decompressed kernel will be written,
+	and eventually executed.  The following constraint must be valid:
+
+		__virt_to_phys(TEXTADDR) == ZRELADDR
+
+	The initial part of the kernel is carefully coded to be position
+	independent.
+
+INITRD_PHYS
+	Physical address to place the initial RAM disk.  Only relevant if
+	you are using the bootpImage stuff (which only works on the old
+	struct param_struct).
+
+INITRD_VIRT
+	Virtual address of the initial RAM disk.  The following  constraint
+	must be valid:
+
+		__virt_to_phys(INITRD_VIRT) == INITRD_PHYS
+
+PARAMS_PHYS
+	Physical address of the struct param_struct or tag list, giving the
+	kernel various parameters about its execution environment.
+
+
+Kernel Symbols
+--------------
+
+PHYS_OFFSET
+	Physical start address of the first bank of RAM.
+
+PAGE_OFFSET
+	Virtual start address of the first bank of RAM.  During the kernel
+	boot phase, virtual address PAGE_OFFSET will be mapped to physical
+	address PHYS_OFFSET, along with any other mappings you supply.
+	This should be the same value as TASK_SIZE.
+
+TASK_SIZE
+	The maximum size of a user process in bytes.  Since user space
+	always starts at zero, this is the maximum address that a user
+	process can access+1.  The user space stack grows down from this
+	address.
+
+	Any virtual address below TASK_SIZE is deemed to be user process
+	area, and therefore managed dynamically on a process by process
+	basis by the kernel.  I'll call this the user segment.
+
+	Anything above TASK_SIZE is common to all processes.  I'll call
+	this the kernel segment.
+
+	(In other words, you can't put IO mappings below TASK_SIZE, and
+	hence PAGE_OFFSET).
+
+TEXTADDR
+	Virtual start address of kernel, normally PAGE_OFFSET + 0x8000.
+	This is where the kernel image ends up.  With the latest kernels,
+	it must be located at 32768 bytes into a 128MB region.  Previous
+	kernels placed a restriction of 256MB here.
+
+DATAADDR
+	Virtual address for the kernel data segment.  Must not be defined
+	when using the decompressor.
+
+VMALLOC_START
+VMALLOC_END
+	Virtual addresses bounding the vmalloc() area.  There must not be
+	any static mappings in this area; vmalloc will overwrite them.
+	The addresses must also be in the kernel segment (see above).
+	Normally, the vmalloc() area starts VMALLOC_OFFSET bytes above the
+	last virtual RAM address (found using variable high_memory).
+
+VMALLOC_OFFSET
+	Offset normally incorporated into VMALLOC_START to provide a hole
+	between virtual RAM and the vmalloc area.  We do this to allow
+	out of bounds memory accesses (eg, something writing off the end
+	of the mapped memory map) to be caught.  Normally set to 8MB.
+
+Architecture Specific Macros
+----------------------------
+
+BOOT_MEM(pram,pio,vio)
+	`pram' specifies the physical start address of RAM.  Must always
+	be present, and should be the same as PHYS_OFFSET.
+
+	`pio' is the physical address of an 8MB region containing IO for
+	use with the debugging macros in arch/arm/kernel/debug-armv.S.
+
+	`vio' is the virtual address of the 8MB debugging region.
+
+	It is expected that the debugging region will be re-initialised
+	by the architecture specific code later in the code (via the
+	MAPIO function).
+
+BOOT_PARAMS
+	Same as, and see PARAMS_PHYS.
+
+FIXUP(func)
+	Machine specific fixups, run before memory subsystems have been
+	initialised.
+
+MAPIO(func)
+	Machine specific function to map IO areas (including the debug
+	region above).
+
+INITIRQ(func)
+	Machine specific function to initialise interrupts.
+
diff -urN linux-2.5.67-bk5/Documentation/devices.txt linux-2.5.67-bk6/Documentation/devices.txt
--- linux-2.5.67-bk5/Documentation/devices.txt	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/Documentation/devices.txt	2003-04-15 04:36:14.000000000 -0700
@@ -693,13 +693,6 @@
 		    ...
 		 31 = /dev/fb31		32nd frame buffer
 
-		For backwards compatibility {2.6} the following
-		progression is also handled by current kernels:
-		  0 = /dev/fb0
-		 32 = /dev/fb1
-		    ...
-		224 = /dev/fb7
-
     block	Aztech/Orchid/Okano/Wearnes CD-ROM
 		  0 = /dev/aztcd	Aztech CD-ROM
 
diff -urN linux-2.5.67-bk5/Documentation/scsi/st.txt linux-2.5.67-bk6/Documentation/scsi/st.txt
--- linux-2.5.67-bk5/Documentation/scsi/st.txt	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/Documentation/scsi/st.txt	2003-04-15 04:36:14.000000000 -0700
@@ -1,8 +1,8 @@
 This file contains brief information about the SCSI tape driver.
 The driver is currently maintained by Kai Mäkisara (email
-Kai.Makisara@metla.fi)
+Kai.Makisara@kolumbus.fi)
 
-Last modified: Sat Dec 14 14:35:30 2002 by makisara
+Last modified: Sat Apr 12 20:26:37 2003 by makisara
 
 
 BASICS
@@ -132,7 +132,7 @@
 Asynchronous writing. Writing the buffer contents to the tape is
 started and the write call returns immediately. The status is checked
 at the next tape operation. Asynchronous writes are not done with
-direct i/o.
+direct i/o and not in fixed block mode.
 
 Buffered writes and asynchronous writes may in some rare cases cause
 problems in multivolume operations if there is not enough space on the
@@ -143,11 +143,6 @@
 this read command. Should be disabled for those drives that don't like
 a filemark to truncate a read request or that don't like backspacing.
 
-The threshold for triggering asynchronous write in fixed block mode
-is defined by ST_WRITE_THRESHOLD. This may be optimized for each
-use pattern. The default triggers asynchronous write after three
-default sized writes (10 kB) from tar.
-
 Scatter/gather buffers (buffers that consist of chunks non-contiguous
 in the physical memory) are used if contiguous buffers can't be
 allocated. To support all SCSI adapters (including those not
@@ -206,11 +201,17 @@
 
 If the driver is compiled into the kernel, the same parameters can be
 also set using, e.g., the LILO command line. The preferred syntax is
-to use the same keywords as when loading the driver as module. If
-several parameters are set, the keyword-value pairs are separated with
-a comma (no spaces allowed). A colon can be used instead of the equal
-mark. The definition is prepended by the string st=. Here is an
-example:
+is to use the same keyword used when loading as module but prepended
+with 'st.'. For instance, to set the maximum number of scatter/gather
+segments, the parameter 'st.max_sg_segs=xx' should be used (xx is the
+number of scatter/gather segments).
+
+For compatibility, the old syntax from early 2.5 and 2.4 kernel
+versions is supported. The same keywords can be used as when loading
+the driver as module. If several parameters are set, the keyword-value
+pairs are separated with a comma (no spaces allowed). A colon can be
+used instead of the equal mark. The definition is prepended by the
+string st=. Here is an example:
 
 	st=buffer_kbs:64,write_threhold_kbs:60
 
diff -urN linux-2.5.67-bk5/Makefile linux-2.5.67-bk6/Makefile
--- linux-2.5.67-bk5/Makefile	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 67
-EXTRAVERSION = -bk5
+EXTRAVERSION = -bk6
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
@@ -33,7 +33,9 @@
 # then ARCH is assigned, getting whatever value it gets normally, and 
 # SUBARCH is subsequently ignored.
 
-SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
+				  -e s/arm.*/arm/ -e s/sa110/arm/ \
+				  -e s/s390x/s390/ )
 ARCH := $(SUBARCH)
 
 # Remove hyphens since they have special meaning in RPM filenames
diff -urN linux-2.5.67-bk5/arch/arm/Kconfig linux-2.5.67-bk6/arch/arm/Kconfig
--- linux-2.5.67-bk5/arch/arm/Kconfig	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/Kconfig	2003-04-15 04:36:14.000000000 -0700
@@ -175,7 +175,7 @@
 
 source "arch/arm/mach-footbridge/Kconfig"
 
-source "arch/arm/mach-iop310/Kconfig"
+source "arch/arm/mach-iop3xx/Kconfig"
 
 source "arch/arm/mach-pxa/Kconfig"
 
diff -urN linux-2.5.67-bk5/arch/arm/Makefile linux-2.5.67-bk6/arch/arm/Makefile
--- linux-2.5.67-bk5/arch/arm/Makefile	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -105,7 +105,7 @@
  machine-$(CONFIG_ARCH_CLPS711X)   := clps711x
 textaddr-$(CONFIG_ARCH_FORTUNET)   := 0xc0008000
  machine-$(CONFIG_ARCH_ANAKIN)	   := anakin
- machine-$(CONFIG_ARCH_IOP310)	   := iop310
+ machine-$(CONFIG_ARCH_IOP310)	   := iop3xx
  machine-$(CONFIG_ARCH_ADIFCC)	   := adifcc
 
 MACHINE  := $(machine-y)
diff -urN linux-2.5.67-bk5/arch/arm/boot/Makefile linux-2.5.67-bk6/arch/arm/boot/Makefile
--- linux-2.5.67-bk5/arch/arm/boot/Makefile	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/boot/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -13,9 +13,6 @@
 #   PARAMS_PHYS must be with 4MB of ZRELADDR
 #   INITRD_PHYS must be in RAM
 
-   zreladdr-$(CONFIG_CPU_26)		:= 0x02080000 
-params_phys-$(CONFIG_CPU_26)		:= 0x0207c000
-initrd_phys-$(CONFIG_CPU_26)		:= 0x02180000
    zreladdr-$(CONFIG_ARCH_RPC)		:= 0x10008000
 params_phys-$(CONFIG_ARCH_RPC)		:= 0x10000100
 initrd_phys-$(CONFIG_ARCH_RPC)		:= 0x18000000
diff -urN linux-2.5.67-bk5/arch/arm/common/sa1111.c linux-2.5.67-bk6/arch/arm/common/sa1111.c
--- linux-2.5.67-bk5/arch/arm/common/sa1111.c	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/common/sa1111.c	2003-04-15 04:36:14.000000000 -0700
@@ -60,6 +60,7 @@
 	},
 	.skpcr_mask	= SKPCR_UCLKEN,
 	.devid		= SA1111_DEVID_USB,
+	.dma_mask	= 0xffffffffLL,
 	.irq = {
 		IRQ_USBPWR,
 		IRQ_HCIM,
@@ -494,6 +495,7 @@
 
 	sadev->dev.parent = sachip->dev;
 	sadev->dev.bus    = &sa1111_bus_type;
+	sadev->dev.dma_mask = &sadev->dma_mask;
 	sadev->res.start  = sachip->res.start + offset;
 	sadev->res.end    = sadev->res.start + 511;
 	sadev->res.name   = sadev->dev.name;
diff -urN linux-2.5.67-bk5/arch/arm/def-configs/iq80310 linux-2.5.67-bk6/arch/arm/def-configs/iq80310
--- linux-2.5.67-bk5/arch/arm/def-configs/iq80310	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/def-configs/iq80310	2003-04-15 04:36:14.000000000 -0700
@@ -1,26 +1,31 @@
 #
-# Automatically generated by make menuconfig: don't edit
+# 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
-# CONFIG_GENERIC_BUST_SPINLOCK is not set
-# CONFIG_GENERIC_ISA_DMA is not set
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
-# CONFIG_OBSOLETE is not set
+
+#
+# General setup
+#
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+CONFIG_LOG_BUF_SHIFT=14
 
 #
 # Loadable module support
 #
 CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
 CONFIG_KMOD=y
 
@@ -33,6 +38,7 @@
 # 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
@@ -46,112 +52,71 @@
 #
 # Archimedes/A5000 Implementations
 #
-# CONFIG_ARCH_ARC is not set
-# CONFIG_ARCH_A5K is not set
 
 #
-# Footbridge Implementations
+# Archimedes/A5000 Implementations (select only ONE)
 #
-# 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
+# CLPS711X/EP721X Implementations
 #
-# CONFIG_SA1100_ASSABET is not set
-# CONFIG_ASSABET_NEPONSET is not set
-# CONFIG_SA1100_ADSBITSY is not set
-# CONFIG_SA1100_BRUTUS is not set
-# CONFIG_SA1100_CERF is not set
-# CONFIG_SA1100_H3600 is not set
-# CONFIG_SA1100_EXTENEX1 is not set
-# CONFIG_SA1100_FLEXANET is not set
-# CONFIG_SA1100_FREEBIRD is not set
-# CONFIG_SA1100_GRAPHICSCLIENT is not set
-# CONFIG_SA1100_GRAPHICSMASTER 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_SHANNON is not set
-# CONFIG_SA1100_SHERMAN is not set
-# CONFIG_SA1100_SIMPAD 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
-# CONFIG_SA1100_USB is not set
-# CONFIG_SA1100_USB_NETLINK is not set
-# CONFIG_SA1100_USB_CHAR is not set
 
 #
-# CLPS711X/EP721X Implementations
+# Epxa10db
+#
+
+#
+# Footbridge Implementations
 #
-# CONFIG_ARCH_AUTCPU12 is not set
-# CONFIG_ARCH_CDB89712 is not set
-# CONFIG_ARCH_CLEP7312 is not set
-# CONFIG_ARCH_EDB7211 is not set
-# CONFIG_ARCH_P720T is not set
-# CONFIG_ARCH_EP7211 is not set
-# CONFIG_ARCH_EP7212 is not set
 
 #
 # IOP310 Implementation Options
 #
 CONFIG_ARCH_IQ80310=y
+
+#
+# IOP310 Chipset Features
+#
 # CONFIG_IOP310_AAU is not set
 # CONFIG_IOP310_DMA is not set
 # CONFIG_IOP310_MU is not set
 # CONFIG_IOP310_PMON 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
+
+#
+# Intel PXA250/210 Implementations
+#
+
+#
+# SA11x0 Implementations
+#
+
+#
+# Processor Type
+#
 CONFIG_CPU_32=y
-# CONFIG_CPU_26 is not set
-# CONFIG_CPU_32v3 is not set
-# CONFIG_CPU_32v4 is not set
-# 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_ARM922T is not set
-# CONFIG_CPU_ARM926T is not set
-# CONFIG_CPU_ARM1020 is not set
-# CONFIG_CPU_SA110 is not set
-# CONFIG_CPU_SA1100 is not set
-CONFIG_CPU_32v4=y
 CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+
+#
+# Processor Features
+#
 CONFIG_ARM_THUMB=y
-# CONFIG_XSCALE_TOOLS is not set
-# CONFIG_XSCALE_CACHE_WRITE_ALLOC is not set
 CONFIG_XSCALE_PMU=y
-CONFIG_ARM_THUMB=y
-# CONFIG_DISCONTIGMEM is not set
 
 #
 # General setup
 #
-CONFIG_ZBOOT_ROM=y
+CONFIG_PCI=y
+# CONFIG_ZBOOT_ROM is not set
 CONFIG_ZBOOT_ROM_TEXT=0x00060000
 CONFIG_ZBOOT_ROM_BSS=0xa1008000
-CONFIG_PCI=y
-# CONFIG_ISA is not set
-# CONFIG_ISA_DMA is not set
+# CONFIG_PCI_LEGACY_PROC is not set
 CONFIG_PCI_NAMES=y
 # CONFIG_HOTPLUG is not set
-# CONFIG_PCMCIA is not set
-CONFIG_NET=y
-CONFIG_SYSVIPC=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
+
+#
+# At least one math emulation must be selected
+#
 CONFIG_FPE_NWFPE=y
 # CONFIG_FPE_FASTFPE is not set
 CONFIG_KCORE_ELF=y
@@ -160,6 +125,7 @@
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_PM is not set
+# CONFIG_PREEMPT is not set
 # CONFIG_ARTHUR is not set
 CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp mem=32M root=/dev/nfs initrd=0xc0800000,4M"
 CONFIG_ALIGNMENT_TRAP=y
@@ -175,9 +141,14 @@
 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_BOOTLDR_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
 # CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
 CONFIG_MTD_CHAR=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
@@ -196,9 +167,6 @@
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
 # CONFIG_MTD_OBSOLETE_CHIPS is not set
-# CONFIG_MTD_AMDSTD is not set
-# CONFIG_MTD_SHARP is not set
-# CONFIG_MTD_JEDEC is not set
 
 #
 # Mapping drivers for chip access
@@ -206,12 +174,10 @@
 # CONFIG_MTD_PHYSMAP is not set
 # CONFIG_MTD_NORA is not set
 # CONFIG_MTD_ARM_INTEGRATOR is not set
-# CONFIG_MTD_CDB89712 is not set
-# CONFIG_MTD_SA1100 is not set
-# CONFIG_MTD_DC21285 is not set
 CONFIG_MTD_IQ80310=y
-# CONFIG_MTD_EPXA10DB is not set
+# CONFIG_MTD_EDB7312 is not set
 # CONFIG_MTD_PCI is not set
+# CONFIG_MTD_UCLINUX is not set
 
 #
 # Self-contained MTD device drivers
@@ -220,10 +186,13 @@
 # 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_DOC1000 is not set
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOCPROBE is not set
 
 #
 # NAND Flash Device Drivers
@@ -231,20 +200,18 @@
 # CONFIG_MTD_NAND 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_UMEM is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
@@ -255,25 +222,22 @@
 # 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_MD_MULTIPATH is not set
-# CONFIG_BLK_DEV_LVM is not set
+
+#
+# Networking support
+#
+CONFIG_NET=y
 
 #
 # Networking options
 #
 # CONFIG_PACKET is not set
-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 is not set
 # CONFIG_IP_ADVANCED_ROUTER is not set
@@ -286,26 +250,33 @@
 # 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_XFRM_USER is not set
 
 #
-#   IP: Netfilter Configuration
+# 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
 # CONFIG_IPV6 is not set
-# CONFIG_KHTTPD 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_IPX is not set
-# CONFIG_ATALK is not set
+# CONFIG_LLC 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
@@ -318,8 +289,9 @@
 # CONFIG_NET_SCHED is not set
 
 #
-# Network device support
+# Network testing
 #
+# CONFIG_NET_PKTGEN is not set
 CONFIG_NETDEVICES=y
 
 #
@@ -336,62 +308,50 @@
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
-# CONFIG_ARM_AM79C961A is not set
-# CONFIG_SUNLANCE is not set
+CONFIG_MII=y
 # CONFIG_HAPPYMEAL is not set
-# CONFIG_SUNBMAC is not set
-# CONFIG_SUNQE is not set
-# CONFIG_SUNLANCE is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_LANCE is not set
-# CONFIG_NET_VENDOR_SMC is not set
-# CONFIG_NET_VENDOR_RACAL is not set
+
+#
+# Tulip family network device support
+#
+# CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
-# CONFIG_NET_ISA is not set
 CONFIG_NET_PCI=y
 # CONFIG_PCNET32 is not set
+# CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_APRICOT is not set
-# CONFIG_CS89x0 is not set
-# CONFIG_TULIP is not set
-# CONFIG_DE4X5 is not set
+# CONFIG_B44 is not set
 # CONFIG_DGRS is not set
-# CONFIG_DM9102 is not set
 CONFIG_EEPRO100=y
-# CONFIG_LNE390 is not set
+# 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_NE3210 is not set
-# CONFIG_ES3210 is not set
 # CONFIG_8139CP is not set
 # CONFIG_8139TOO is not set
-# CONFIG_8139TOO_PIO is not set
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-# CONFIG_8139TOO_8129 is not set
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_RHINE_MMIO is not set
-# CONFIG_WINBOND_840 is not set
-# CONFIG_NET_POCKET is not set
 
 #
 # Ethernet (1000 Mbit)
 #
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
-# CONFIG_MYRI_SBUS 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
 # 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
 
@@ -401,10 +361,8 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# Token Ring devices
+# Token Ring devices (depends on LLC=y)
 #
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
 # CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
 
@@ -414,17 +372,17 @@
 # CONFIG_WAN is not set
 
 #
-# Amateur Radio support
+# IrDA (infrared) support
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
 
 #
-# IrDA (infrared) support
+# Amateur Radio support
 #
-# CONFIG_IRDA is not set
+# CONFIG_HAMRADIO is not set
 
 #
-# ATA/IDE/MFM/RLL support
+# ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
 
@@ -432,54 +390,22 @@
 # IDE, ATA and ATAPI Block devices
 #
 CONFIG_BLK_DEV_IDE=y
-# CONFIG_BLK_DEV_HD_IDE is not set
+
+#
+# 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_BLK_DEV_IDECS is not set
+# CONFIG_IDEDISK_STROKE is not set
 CONFIG_BLK_DEV_IDECD=y
-# CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
-# CONFIG_BLK_DEV_ISAPNP is not set
-# CONFIG_BLK_DEV_RZ1000 is not set
-# CONFIG_IDEPCI_SHARE_IRQ is not set
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_IDEDMA_PCI_AUTO=y
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_NEW_DRIVE_LISTINGS is not set
-# CONFIG_BLK_DEV_AEC62XX is not set
-# CONFIG_AEC62XX_TUNING is not set
-# CONFIG_BLK_DEV_ALI15X3 is not set
-# CONFIG_WDC_ALI15X3 is not set
-# CONFIG_BLK_DEV_AMD74XX is not set
-# CONFIG_AMD74XX_OVERRIDE is not set
-CONFIG_BLK_DEV_CMD64X=y
-# CONFIG_BLK_DEV_CY82C693 is not set
-# CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_HPT34X is not set
-# CONFIG_HPT34X_AUTODMA is not set
-# CONFIG_BLK_DEV_HPT366 is not set
-# CONFIG_BLK_DEV_NS87415 is not set
-# CONFIG_BLK_DEV_OPTI621 is not set
-# CONFIG_BLK_DEV_PDC202XX is not set
-# CONFIG_PDC202XX_BURST is not set
-# CONFIG_PDC202XX_FORCE is not set
-# CONFIG_BLK_DEV_SVWKS is not set
-# CONFIG_BLK_DEV_SIS5513 is not set
-# CONFIG_BLK_DEV_TRM290 is not set
-# CONFIG_BLK_DEV_VIA82CXXX is not set
-# CONFIG_BLK_DEV_SL82C105 is not set
-# CONFIG_IDE_CHIPSETS is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_BLK_DEV_IDE_MODES=y
-# CONFIG_BLK_DEV_ATARAID is not set
-# CONFIG_BLK_DEV_ATARAID_PDC is not set
-# CONFIG_BLK_DEV_ATARAID_HPT is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+# CONFIG_BLK_DEV_IDEPCI is not set
 
 #
 # SCSI support
@@ -495,59 +421,50 @@
 # I2O device support
 #
 # CONFIG_I2O is not set
-# CONFIG_I2O_PCI 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
 #
-# CONFIG_ISDN is not set
+# CONFIG_ISDN_BOOL is not set
 
 #
-# Input core support
+# Input device support
 #
 # CONFIG_INPUT is not set
-# CONFIG_INPUT_KEYBDEV is not set
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_EVDEV is not set
+
+#
+# Userland interfaces
+#
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+# CONFIG_SERIO is not set
+
+#
+# Input Device Drivers
+#
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
-CONFIG_SERIAL=y
-CONFIG_SERIAL_CONSOLE=y
-# CONFIG_SERIAL_EXTENDED is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
 # Serial drivers
 #
-# CONFIG_SERIAL_ANAKIN is not set
-# CONFIG_SERIAL_ANAKIN_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_SERIAL_21285 is not set
-# CONFIG_SERIAL_21285_OLD is not set
-# CONFIG_SERIAL_21285_CONSOLE is not set
-# CONFIG_SERIAL_UART00 is not set
-# CONFIG_SERIAL_UART00_CONSOLE is not set
-# CONFIG_SERIAL_SA1100 is not set
-# CONFIG_SERIAL_SA1100_CONSOLE is not set
-# CONFIG_SERIAL_8250 is not set
-# CONFIG_SERIAL_8250_CONSOLE is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
 # CONFIG_SERIAL_8250_EXTENDED is not set
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-# CONFIG_SERIAL_8250_SHARE_IRQ is not set
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_MULTIPORT is not set
-# CONFIG_SERIAL_8250_HUB6 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_DZ is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_UNIX98_PTY_COUNT=256
 
@@ -557,36 +474,36 @@
 # CONFIG_I2C is not set
 
 #
+# I2C Hardware Sensors Mainboard support
+#
+
+#
+# I2C Hardware Sensors Chip support
+#
+
+#
 # L3 serial bus support
 #
 # CONFIG_L3 is not set
-# CONFIG_L3_ALGOBIT is not set
-# CONFIG_L3_BIT_SA1100_GPIO is not set
-# CONFIG_L3_SA1111 is not set
-# CONFIG_BIT_SA1100_GPIO is not set
 
 #
 # Mice
 #
 # CONFIG_BUSMOUSE is not set
-CONFIG_MOUSE=y
-CONFIG_PSMOUSE=y
-# CONFIG_82C710_MOUSE is not set
-# CONFIG_PC110_PAD is not set
+# CONFIG_QIC02_TAPE is not set
 
 #
-# Joysticks
+# IPMI
 #
-# CONFIG_INPUT_GAMEPORT 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
@@ -597,88 +514,130 @@
 # 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
 
 #
 # Multimedia devices
 #
-# CONFIG_VIDEO_DEV is not set
+CONFIG_VIDEO_DEV=y
+
+#
+# Video For Linux
+#
+# CONFIG_VIDEO_PROC_FS is not set
+
+#
+# Video Adapters
+#
+# CONFIG_VIDEO_PMS is not set
+# CONFIG_VIDEO_CPIA is not set
+# CONFIG_VIDEO_STRADIS is not set
+
+#
+# Radio Adapters
+#
+# CONFIG_RADIO_GEMTEK_PCI is not set
+# CONFIG_RADIO_MAXIRADIO is not set
+# CONFIG_RADIO_MAESTRO is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+CONFIG_DVB=y
+CONFIG_DVB_CORE=y
+
+#
+# Supported Frontend Modules
+#
+CONFIG_DVB_ALPS_BSRU6=y
+# CONFIG_DVB_ALPS_BSRV2 is not set
+# CONFIG_DVB_ALPS_TDLB7 is not set
+# CONFIG_DVB_ALPS_TDMB7 is not set
+# CONFIG_DVB_GRUNDIG_29504_491 is not set
+# CONFIG_DVB_GRUNDIG_29504_401 is not set
+# CONFIG_DVB_VES1820 is not set
+
+#
+# Supported DVB Adapters
+#
+# CONFIG_DVB_AV7110 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
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_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_TMPFS=y
+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_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
+# CONFIG_JFFS2_FS_NAND is not set
 # CONFIG_CRAMFS is not set
-CONFIG_TMPFS=y
-# CONFIG_RAMFS is not set
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_MINIX_FS is not set
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_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=y
 # CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 CONFIG_NFS_FS=y
 # CONFIG_NFS_V3 is not set
-CONFIG_ROOT_NFS=y
+# CONFIG_NFS_V4 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_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_ZISOFS_FS is not set
-# CONFIG_ZLIB_FS_INFLATE is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_INTERMEZZO_FS is not set
+CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_GSS is not set
+# CONFIG_AFS_FS is not set
 
 #
 # Partition Types
@@ -698,8 +657,19 @@
 # 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_NLS is not set
+# CONFIG_EFI_PARTITION 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
@@ -707,76 +677,23 @@
 # CONFIG_SOUND is not set
 
 #
+# Misc devices
+#
+
+#
 # Multimedia Capabilities Port drivers
 #
 # CONFIG_MCP is not set
-# CONFIG_MCP_SA1100 is not set
-# CONFIG_MCP_UCB1200 is not set
-# CONFIG_MCP_UCB1200_AUDIO is not set
-# CONFIG_MCP_UCB1200_TS is not set
+
+#
+# Console Switches
+#
+# CONFIG_SWITCHES is not set
 
 #
 # USB support
 #
 # CONFIG_USB is not set
-# CONFIG_USB_UHCI is not set
-# CONFIG_USB_UHCI_ALT is not set
-# CONFIG_USB_OHCI is not set
-# CONFIG_USB_OHCI_SA1111 is not set
-# CONFIG_USB_AUDIO is not set
-# CONFIG_USB_BLUETOOTH is not set
-# CONFIG_USB_STORAGE is not set
-# 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_JUMPSHOT is not set
-# CONFIG_USB_ACM is not set
-# CONFIG_USB_PRINTER is not set
-# CONFIG_USB_DC2XX is not set
-# CONFIG_USB_MDC800 is not set
-# CONFIG_USB_SCANNER is not set
-# CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_HPUSBSCSI is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_CDCETHER is not set
-# CONFIG_USB_USBNET is not set
-# CONFIG_USB_USS720 is not set
-
-#
-# USB Serial Converter support
-#
-# CONFIG_USB_SERIAL is not set
-# CONFIG_USB_SERIAL_GENERIC is not set
-# CONFIG_USB_SERIAL_BELKIN is not set
-# CONFIG_USB_SERIAL_WHITEHEAT is not set
-# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
-# CONFIG_USB_SERIAL_EMPEG is not set
-# CONFIG_USB_SERIAL_FTDI_SIO is not set
-# CONFIG_USB_SERIAL_VISOR is not set
-# CONFIG_USB_SERIAL_IR is not set
-# CONFIG_USB_SERIAL_EDGEPORT is not set
-# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
-# CONFIG_USB_SERIAL_KEYSPAN is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set
-# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set
-# CONFIG_USB_SERIAL_MCT_U232 is not set
-# CONFIG_USB_SERIAL_PL2303 is not set
-# CONFIG_USB_SERIAL_CYBERJACK is not set
-# CONFIG_USB_SERIAL_XIRCOM is not set
-# CONFIG_USB_SERIAL_OMNINET is not set
-# CONFIG_USB_RIO500 is not set
 
 #
 # Bluetooth support
@@ -789,7 +706,6 @@
 CONFIG_FRAME_POINTER=y
 CONFIG_DEBUG_USER=y
 # CONFIG_DEBUG_INFO is not set
-# CONFIG_NO_PGT_CACHE is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_MAGIC_SYSRQ is not set
@@ -797,6 +713,22 @@
 # CONFIG_DEBUG_WAITQ is not set
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_ERRORS=y
+CONFIG_KALLSYMS=y
 CONFIG_DEBUG_LL=y
-# CONFIG_DEBUG_DC21285_PORT is not set
-# CONFIG_DEBUG_CLPS711X_UART2 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_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -urN linux-2.5.67-bk5/arch/arm/kernel/Makefile linux-2.5.67-bk6/arch/arm/kernel/Makefile
--- linux-2.5.67-bk5/arch/arm/kernel/Makefile	2003-04-07 10:32:32.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -27,10 +27,8 @@
   obj-y		+= io.o
 endif
 
-ifeq ($(CONFIG_CPU_32),y)
 head-y			:= head.o
 obj-$(CONFIG_DEBUG_LL)	+= debug.o
-endif
 
 extra-y := $(head-y) init_task.o
 
diff -urN linux-2.5.67-bk5/arch/arm/kernel/armksyms.c linux-2.5.67-bk6/arch/arm/kernel/armksyms.c
--- linux-2.5.67-bk5/arch/arm/kernel/armksyms.c	2003-04-07 10:31:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/armksyms.c	2003-04-15 04:36:14.000000000 -0700
@@ -95,11 +95,6 @@
 EXPORT_SYMBOL_ALIAS(fp_printk,printk);
 EXPORT_SYMBOL_ALIAS(fp_send_sig,send_sig);
 
-#ifdef CONFIG_CPU_26
-EXPORT_SYMBOL(fpundefinstr);
-EXPORT_SYMBOL(ret_from_exception);
-#endif
-
 #ifdef CONFIG_VT
 EXPORT_SYMBOL(kd_mksound);
 #endif
@@ -111,10 +106,8 @@
 EXPORT_SYMBOL(dump_thread);
 EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(udelay);
-#ifdef CONFIG_CPU_32
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(__iounmap);
-#endif
 EXPORT_SYMBOL(kernel_thread);
 EXPORT_SYMBOL(system_rev);
 EXPORT_SYMBOL(system_serial_low);
@@ -196,7 +189,6 @@
 EXPORT_SYMBOL_NOVERS(__memzero);
 
 	/* user mem (segment) */
-#if defined(CONFIG_CPU_32)
 EXPORT_SYMBOL(__arch_copy_from_user);
 EXPORT_SYMBOL(__arch_copy_to_user);
 EXPORT_SYMBOL(__arch_clear_user);
@@ -207,11 +199,6 @@
 EXPORT_SYMBOL(consistent_free);
 EXPORT_SYMBOL(consistent_sync);
 
-#elif defined(CONFIG_CPU_26)
-EXPORT_SYMBOL(uaccess_kernel);
-EXPORT_SYMBOL(uaccess_user);
-#endif
-
 EXPORT_SYMBOL_NOVERS(__get_user_1);
 EXPORT_SYMBOL_NOVERS(__get_user_2);
 EXPORT_SYMBOL_NOVERS(__get_user_4);
diff -urN linux-2.5.67-bk5/arch/arm/kernel/asm-offsets.c linux-2.5.67-bk6/arch/arm/kernel/asm-offsets.c
--- linux-2.5.67-bk5/arch/arm/kernel/asm-offsets.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/asm-offsets.c	2003-04-15 04:36:14.000000000 -0700
@@ -21,10 +21,7 @@
 /*
  * Make sure that the compiler and target are compatible.
  */
-#if defined(__APCS_32__) && defined(CONFIG_CPU_26)
-#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
-#endif
-#if defined(__APCS_26__) && defined(CONFIG_CPU_32)
+#if defined(__APCS_26__)
 #error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
 #endif
 #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
@@ -52,7 +49,6 @@
   BLANK();
   DEFINE(VM_EXEC,	       	VM_EXEC);
   BLANK();
-#ifdef CONFIG_CPU_32
   DEFINE(HPTE_TYPE_SMALL,      	PTE_TYPE_SMALL);
   DEFINE(HPTE_AP_READ,		PTE_AP_READ);
   DEFINE(HPTE_AP_WRITE,		PTE_AP_WRITE);
@@ -65,15 +61,7 @@
   DEFINE(LPTE_WRITE,		L_PTE_WRITE);
   DEFINE(LPTE_EXEC,		L_PTE_EXEC);
   DEFINE(LPTE_DIRTY,		L_PTE_DIRTY);
-#endif
   BLANK();
-#ifdef CONFIG_CPU_26
-  DEFINE(PAGE_PRESENT,		_PAGE_PRESENT);
-  DEFINE(PAGE_READONLY,		_PAGE_READONLY);
-  DEFINE(PAGE_NOT_USER,		_PAGE_NOT_USER);
-  DEFINE(PAGE_OLD,		_PAGE_OLD);
-  DEFINE(PAGE_CLEAN,		_PAGE_CLEAN);
-#endif
   BLANK();
   DEFINE(PAGE_SZ,	       	PAGE_SIZE);
   BLANK();
diff -urN linux-2.5.67-bk5/arch/arm/kernel/ecard.c linux-2.5.67-bk6/arch/arm/kernel/ecard.c
--- linux-2.5.67-bk5/arch/arm/kernel/ecard.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/ecard.c	2003-04-15 04:36:14.000000000 -0700
@@ -220,7 +220,6 @@
 	}
 }
 
-#ifdef CONFIG_CPU_32
 #include <linux/completion.h>
 
 static pid_t ecard_pid;
@@ -341,13 +340,6 @@
 	 */
 	wait_for_completion(&ecard_completion);
 }
-#else
-/*
- * On 26-bit processors, we don't need the kcardd thread to access the
- * expansion card loaders.  We do it directly.
- */
-#define ecard_call(req)	ecard_do_request(req)
-#endif
 
 /* ======================= Mid-level card control ===================== */
 
@@ -1026,9 +1018,7 @@
 {
 	int slot, irqhw;
 
-#ifdef CONFIG_CPU_32
 	init_waitqueue_head(&ecard_wait);
-#endif
 
 	printk("Probing expansion cards\n");
 
diff -urN linux-2.5.67-bk5/arch/arm/kernel/entry-header.S linux-2.5.67-bk6/arch/arm/kernel/entry-header.S
--- linux-2.5.67-bk5/arch/arm/kernel/entry-header.S	2003-04-07 10:31:10.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/entry-header.S	2003-04-15 04:36:14.000000000 -0700
@@ -41,14 +41,8 @@
 @ Stack format (ensured by USER_* and SVC_*)
 @
 #define S_FRAME_SIZE	72
-#ifdef CONFIG_CPU_32
 #define S_OLD_R0	68
 #define S_PSR		64
-#else
-#define S_OLD_R0	64
-#define S_PSR		60
-#define S_PC		60
-#endif
 
 #define S_PC		60
 #define S_LR		56
@@ -68,8 +62,6 @@
 #define S_R0		0
 #define S_OFF		8
 
-#ifdef CONFIG_CPU_32
-
 	.macro	set_cpsr_c, reg, mode
 #if 1
 	/* broken binutils */
@@ -160,58 +152,6 @@
 #endif
 	.endm
 
-#else
-	.macro	save_user_regs
-	str	r0, [sp, #-4]!
-	str	lr, [sp, #-4]!
-	sub	sp, sp, #15*4
-	stmia	sp, {r0 - lr}^
-	mov	r0, r0
-	.endm
-
-	.macro	restore_user_regs
-	ldmia	sp, {r0 - lr}^
-	mov	r0, r0
-	ldr	lr, [sp, #15*4]
-	add	sp, sp, #15*4+8
-	movs	pc, lr
-	.endm
-
-	.macro	fast_restore_user_regs
-	add	sp, sp, #S_OFF
-	ldmib	sp, {r1 - lr}^
-	mov	r0, r0
-	ldr	lr, [sp, #15*4]
-	add	sp, sp, #15*4+8
-	movs	pc, lr
-	.endm
-
-	.macro	mask_pc, rd, rm
-	bic	\rd, \rm, #PCMASK
-	.endm
-
-	.macro	enable_irqs, temp
-	teqp	pc, #0x00000003
-	.endm
-
-	.macro	initialise_traps_extra
-	.endm
-
-	.macro	get_thread_info, rd
-	mov	\rd, sp, lsr #13
-	mov	\rd, \rd, lsl #13
-	.endm
-
-	/*
-	 * Like adr, but force SVC mode (if required)
-	 */
-	.macro	adrsvc, cond, reg, label
-	adr\cond	\reg, \label
-	orr\cond	\reg, \reg, #0x08000003
-	.endm
-
-#endif
-
 
 /*
  * These are the registers used in the syscall handler, and allow us to
diff -urN linux-2.5.67-bk5/arch/arm/kernel/fiq.c linux-2.5.67-bk6/arch/arm/kernel/fiq.c
--- linux-2.5.67-bk5/arch/arm/kernel/fiq.c	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/fiq.c	2003-04-15 04:36:14.000000000 -0700
@@ -54,7 +54,6 @@
 
 static unsigned long no_fiq_insn;
 
-#ifdef CONFIG_CPU_32
 static inline void unprotect_page_0(void)
 {
 	modify_domain(DOMAIN_USER, DOMAIN_MANAGER);
@@ -64,12 +63,6 @@
 {
 	modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
 }
-#else
-
-#define unprotect_page_0()
-#define protect_page_0()
-
-#endif
 
 /* Default reacquire function
  * - we always relinquish FIQ control
@@ -120,17 +113,6 @@
 {
 	register unsigned long tmp, tmp2;
 	__asm__ volatile (
-#ifdef CONFIG_CPU_26
-	"mov	%0, pc
-	bic	%1, %0, #0x3
-	orr	%1, %1, %3
-	teqp	%1, #0		@ select FIQ mode
-	mov	r0, r0
-	ldmia	%2, {r8 - r14}
-	teqp	%0, #0		@ return to SVC mode
-	mov	r0, r0"
-#endif
-#ifdef CONFIG_CPU_32
 	"mrs	%0, cpsr
 	mov	%1, %3
 	msr	cpsr_c, %1	@ select FIQ mode
@@ -138,7 +120,6 @@
 	ldmia	%2, {r8 - r14}
 	msr	cpsr_c, %0	@ return to SVC mode
 	mov	r0, r0"
-#endif
 	: "=&r" (tmp), "=&r" (tmp2)
 	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)
 	/* These registers aren't modified by the above code in a way
@@ -152,17 +133,6 @@
 {
 	register unsigned long tmp, tmp2;
 	__asm__ volatile (
-#ifdef CONFIG_CPU_26
-	"mov	%0, pc
-	bic	%1, %0, #0x3
-	orr	%1, %1, %3
-	teqp	%1, #0		@ select FIQ mode
-	mov	r0, r0
-	stmia	%2, {r8 - r14}
-	teqp	%0, #0		@ return to SVC mode
-	mov	r0, r0"
-#endif
-#ifdef CONFIG_CPU_32
 	"mrs	%0, cpsr
 	mov	%1, %3
 	msr	cpsr_c, %1	@ select FIQ mode
@@ -170,7 +140,6 @@
 	stmia	%2, {r8 - r14}
 	msr	cpsr_c, %0	@ return to SVC mode
 	mov	r0, r0"
-#endif
 	: "=&r" (tmp), "=&r" (tmp2)
 	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)
 	/* These registers aren't modified by the above code in a way
diff -urN linux-2.5.67-bk5/arch/arm/kernel/head.S linux-2.5.67-bk6/arch/arm/kernel/head.S
--- linux-2.5.67-bk5/arch/arm/kernel/head.S	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/head.S	2003-04-15 04:36:14.000000000 -0700
@@ -205,18 +205,6 @@
 	add	r3, r3, #1 << 20
 	str	r3, [r0], #4			@ KERNEL + 3MB
 
-	/*
-	 * Ensure that the first section of RAM is present.
-	 * we assume that:
-	 *  1. the RAM is aligned to a 32MB boundary
-	 *  2. the kernel is executing in the same 32MB chunk
-	 *     as the start of RAM.
-	 */
-	bic	r0, r0, #0x01f00000 >> 18	@ round down
-	and	r2, r5, #0xfe000000		@ round down
-	add	r3, r8, r2			@ flags + rambase
-	str	r3, [r0]
-
 	bic	r8, r8, #0x0c			@ turn off cacheable
 						@ and bufferable bits
 #ifdef CONFIG_DEBUG_LL
diff -urN linux-2.5.67-bk5/arch/arm/kernel/process.c linux-2.5.67-bk6/arch/arm/kernel/process.c
--- linux-2.5.67-bk5/arch/arm/kernel/process.c	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/process.c	2003-04-15 04:36:14.000000000 -0700
@@ -188,7 +188,6 @@
 		processor_modes[processor_mode(regs)],
 		thumb_mode(regs) ? " (T)" : "",
 		get_fs() == get_ds() ? "kernel" : "user");
-#if defined(CONFIG_CPU_32)
 	{
 		unsigned int ctrl, transbase, dac;
 		  __asm__ (
@@ -199,7 +198,6 @@
 		printk("Control: %04X  Table: %08X  DAC: %08X\n",
 		  	ctrl, transbase, dac);
 	}
-#endif
 }
 
 void show_fpregs(struct user_fp *regs)
@@ -237,18 +235,9 @@
 static unsigned long *thread_info_head;
 static unsigned int nr_thread_info;
 
-#ifdef CONFIG_CPU_32
 #define EXTRA_TASK_STRUCT	4
 #define ll_alloc_task_struct() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define ll_free_task_struct(p) free_pages((unsigned long)(p),1)
-#else
-extern unsigned long get_page_8k(int priority);
-extern void free_page_8k(unsigned long page);
-
-#define EXTRA_TASK_STRUCT	0
-#define ll_alloc_task_struct()	((struct task_struct *)get_page_8k(GFP_KERNEL))
-#define ll_free_task_struct(p)  free_page_8k((unsigned long)(p))
-#endif
 
 struct thread_info *alloc_thread_info(void)
 {
diff -urN linux-2.5.67-bk5/arch/arm/kernel/semaphore.c linux-2.5.67-bk6/arch/arm/kernel/semaphore.c
--- linux-2.5.67-bk5/arch/arm/kernel/semaphore.c	2003-04-07 10:31:08.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/semaphore.c	2003-04-15 04:36:14.000000000 -0700
@@ -177,44 +177,6 @@
  * registers (r0 to r3 and lr), but not ip, as we use it as a return
  * value in some cases..
  */
-#ifdef CONFIG_CPU_26
-asm("	.align	5				\n\
-	.globl	__down_failed			\n\
-__down_failed:					\n\
-	stmfd	sp!, {r0 - r3, lr}		\n\
-	mov	r0, ip				\n\
-	bl	__down				\n\
-	ldmfd	sp!, {r0 - r3, pc}^		\n\
-						\n\
-	.align	5				\n\
-	.globl	__down_interruptible_failed	\n\
-__down_interruptible_failed:			\n\
-	stmfd	sp!, {r0 - r3, lr}		\n\
-	mov	r0, ip				\n\
-	bl	__down_interruptible		\n\
-	mov	ip, r0				\n\
-	ldmfd	sp!, {r0 - r3, pc}^		\n\
-						\n\
-	.align	5				\n\
-	.globl	__down_trylock_failed		\n\
-__down_trylock_failed:				\n\
-	stmfd	sp!, {r0 - r3, lr}		\n\
-	mov	r0, ip				\n\
-	bl	__down_trylock			\n\
-	mov	ip, r0				\n\
-	ldmfd	sp!, {r0 - r3, pc}^		\n\
-						\n\
-	.align	5				\n\
-	.globl	__up_wakeup			\n\
-__up_wakeup:					\n\
-	stmfd	sp!, {r0 - r3, lr}		\n\
-	mov	r0, ip				\n\
-	bl	__up				\n\
-	ldmfd	sp!, {r0 - r3, pc}^		\n\
-	");
-
-#else
-/* 32 bit version */
 asm("	.align	5				\n\
 	.globl	__down_failed			\n\
 __down_failed:					\n\
@@ -250,4 +212,3 @@
 	ldmfd	sp!, {r0 - r3, pc}		\n\
 	");
 
-#endif
diff -urN linux-2.5.67-bk5/arch/arm/kernel/setup.c linux-2.5.67-bk6/arch/arm/kernel/setup.c
--- linux-2.5.67-bk5/arch/arm/kernel/setup.c	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/setup.c	2003-04-15 04:36:14.000000000 -0700
@@ -113,7 +113,6 @@
 #define lp1 io_res[1]
 #define lp2 io_res[2]
 
-#ifdef CONFIG_CPU_32
 static const char *cache_types[16] = {
 	"write-through",
 	"write-back",
@@ -231,10 +230,6 @@
 	}
 }
 
-#else
-#define dump_cpu_info() do { } while (0)
-#endif
-
 int cpu_architecture(void)
 {
 	int cpu_arch;
@@ -768,7 +763,6 @@
 	}
 	seq_printf(m, "CPU revision\t: %d\n", processor_id & 15);
 
-#ifdef CONFIG_CPU_32
 	{
 		unsigned int cache_info;
 
@@ -791,7 +785,6 @@
 			}
 		}
 	}
-#endif
 
 	seq_puts(m, "\n");
 
diff -urN linux-2.5.67-bk5/arch/arm/kernel/signal.c linux-2.5.67-bk6/arch/arm/kernel/signal.c
--- linux-2.5.67-bk5/arch/arm/kernel/signal.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/signal.c	2003-04-15 04:36:14.000000000 -0700
@@ -174,9 +174,7 @@
 	__get_user_error(regs->ARM_sp, &sc->arm_sp, err);
 	__get_user_error(regs->ARM_lr, &sc->arm_lr, err);
 	__get_user_error(regs->ARM_pc, &sc->arm_pc, err);
-#ifdef CONFIG_CPU_32
 	__get_user_error(regs->ARM_cpsr, &sc->arm_cpsr, err);
-#endif
 
 	err |= !valid_user_regs(regs);
 
@@ -292,9 +290,7 @@
 	__put_user_error(regs->ARM_sp, &sc->arm_sp, err);
 	__put_user_error(regs->ARM_lr, &sc->arm_lr, err);
 	__put_user_error(regs->ARM_pc, &sc->arm_pc, err);
-#ifdef CONFIG_CPU_32
 	__put_user_error(regs->ARM_cpsr, &sc->arm_cpsr, err);
-#endif
 
 	__put_user_error(current->thread.trap_no, &sc->trap_no, err);
 	__put_user_error(current->thread.error_code, &sc->error_code, err);
@@ -328,7 +324,6 @@
 	unsigned long handler = (unsigned long)ka->sa.sa_handler;
 	unsigned long retcode;
 	int thumb = 0;
-#ifdef CONFIG_CPU_32
 	unsigned long cpsr = regs->ARM_cpsr & ~PSR_f;
 
 	/*
@@ -351,7 +346,6 @@
 			cpsr &= ~PSR_T_BIT;
 	}
 #endif
-#endif
 
 	if (ka->sa.sa_flags & SA_RESTORER) {
 		retcode = (unsigned long)ka->sa.sa_restorer;
@@ -378,10 +372,7 @@
 	regs->ARM_sp = (unsigned long)frame;
 	regs->ARM_lr = retcode;
 	regs->ARM_pc = handler;
-
-#ifdef CONFIG_CPU_32
 	regs->ARM_cpsr = cpsr;
-#endif
 
 	return 0;
 }
diff -urN linux-2.5.67-bk5/arch/arm/kernel/sys_arm.c linux-2.5.67-bk6/arch/arm/kernel/sys_arm.c
--- linux-2.5.67-bk5/arch/arm/kernel/sys_arm.c	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/sys_arm.c	2003-04-15 04:36:14.000000000 -0700
@@ -229,7 +229,7 @@
 		return sys_shmctl (first, second,
 				   (struct shmid_ds *) ptr);
 	default:
-		return -EINVAL;
+		return -ENOSYS;
 	}
 }
 
diff -urN linux-2.5.67-bk5/arch/arm/kernel/traps.c linux-2.5.67-bk6/arch/arm/kernel/traps.c
--- linux-2.5.67-bk5/arch/arm/kernel/traps.c	2003-04-07 10:31:08.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/kernel/traps.c	2003-04-15 04:36:14.000000000 -0700
@@ -271,31 +271,6 @@
 	die_if_kernel("Oops - undefined instruction", regs, 0);
 }
 
-#ifdef CONFIG_CPU_26
-asmlinkage void do_excpt(unsigned long address, struct pt_regs *regs, int mode)
-{
-	siginfo_t info;
-
-#ifdef CONFIG_DEBUG_USER
-	printk(KERN_INFO "%s (%d): address exception: pc=%08lx\n",
-		current->comm, current->pid, instruction_pointer(regs));
-	dump_instr(regs);
-#endif
-
-	current->thread.error_code = 0;
-	current->thread.trap_no = 11;
-
-	info.si_signo = SIGBUS;
-	info.si_errno = 0;
-	info.si_code  = BUS_ADRERR;
-	info.si_addr  = (void *)address;
-
-	force_sig_info(SIGBUS, &info, current);
-
-	die_if_kernel("Oops - address exception", regs, mode);
-}
-#endif
-
 asmlinkage void do_unexp_fiq (struct pt_regs *regs)
 {
 #ifndef CONFIG_IGNORE_FIQ
@@ -405,7 +380,6 @@
 		ptrace_break(current, regs);
 		return regs->ARM_r0;
 
-#ifdef CONFIG_CPU_32
 	/*
 	 * Flush a region from virtual address 'r0' to virtual address 'r1'
 	 * _inclusive_.  There is no alignment requirement on either address;
@@ -435,14 +409,6 @@
 			break;
 		regs->ARM_cpsr |= MODE32_BIT;
 		return regs->ARM_r0;
-#else
-	case NR(cacheflush):
-		return 0;
-
-	case NR(usr26):
-	case NR(usr32):
-		break;
-#endif
 
 	default:
 		/* Calls 9f00xx..9f07ff are defined to return -ENOSYS
@@ -563,7 +529,5 @@
 	if (base != 0)
 		printk(KERN_DEBUG "Relocating machine vectors to 0x%08lx\n",
 			base);
-#ifdef CONFIG_CPU_32
 	modify_domain(DOMAIN_USER, DOMAIN_CLIENT);
-#endif
 }
diff -urN linux-2.5.67-bk5/arch/arm/lib/Makefile linux-2.5.67-bk6/arch/arm/lib/Makefile
--- linux-2.5.67-bk5/arch/arm/lib/Makefile	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -39,8 +39,6 @@
 obj-$(v4)	+= io-readsw-armv4.o io-writesw-armv4.o io-readsl-armv4.o
 obj-y		+= io-writesl.o
 
-obj-$(CONFIG_CPU_26) += uaccess-armo.o
-
 $(obj)/csumpartialcopy.o:	$(obj)/csumpartialcopygeneric.S
 $(obj)/csumpartialcopyuser.o:	$(obj)/csumpartialcopygeneric.S
 
diff -urN linux-2.5.67-bk5/arch/arm/lib/backtrace.S linux-2.5.67-bk6/arch/arm/lib/backtrace.S
--- linux-2.5.67-bk5/arch/arm/lib/backtrace.S	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/backtrace.S	2003-04-15 04:36:14.000000000 -0700
@@ -6,6 +6,9 @@
  * 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.
+ *
+ * 27/03/03 Ian Molton Clean up CONFIG_CPU
+ *
  */
 #include <linux/config.h>
 #include <linux/linkage.h>
@@ -31,13 +34,9 @@
 #else
 
 		stmfd	sp!, {r4 - r8, lr}	@ Save an extra register so we have a location...
-#ifdef CONFIG_CPU_32
 		tst	r1, #0x10		@ 26 or 32-bit?
 		moveq	mask, #0xfc000003
 		movne	mask, #0
-#else
-		mov	mask, #0xfc000003
-#endif
 		tst	mask, r0
 		movne	r0, #0
 		movs	frame, r0
diff -urN linux-2.5.67-bk5/arch/arm/lib/copy_page.S linux-2.5.67-bk6/arch/arm/lib/copy_page.S
--- linux-2.5.67-bk5/arch/arm/lib/copy_page.S	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/copy_page.S	2003-04-15 04:36:14.000000000 -0700
@@ -13,6 +13,12 @@
 #include <asm/assembler.h>
 #include <asm/constants.h>
 
+#ifndef PLD
+#define COPY_COUNT PAGE_SZ/64
+#else
+#define COPY_COUNT PAGE_SZ/64-1
+#endif
+
 		.text
 		.align	5
 /*
@@ -23,9 +29,13 @@
  */
 ENTRY(copy_page)
 		stmfd	sp!, {r4, lr}			@	2
-		mov	r2, #PAGE_SZ/64			@	1
+	PLD(	pld	[r1, #0]		)
+	PLD(	pld	[r1, #32]		)
+		mov	r2, #COPY_COUNT			@	1
 		ldmia	r1!, {r3, r4, ip, lr}		@	4+1
-1:		stmia	r0!, {r3, r4, ip, lr}		@	4
+1:	PLD(	pld	[r1, #64]		)
+	PLD(	pld	[r1, #96]		)
+2:		stmia	r0!, {r3, r4, ip, lr}		@	4
 		ldmia	r1!, {r3, r4, ip, lr}		@	4+1
 		stmia	r0!, {r3, r4, ip, lr}		@	4
 		ldmia	r1!, {r3, r4, ip, lr}		@	4+1
@@ -33,6 +43,8 @@
 		ldmia	r1!, {r3, r4, ip, lr}		@	4
 		subs	r2, r2, #1			@	1
 		stmia	r0!, {r3, r4, ip, lr}		@	4
-		ldmneia	r1!, {r3, r4, ip, lr}		@	4
-		bne	1b				@	1
+		ldmgtia	r1!, {r3, r4, ip, lr}		@	4
+		bgt	1b				@	1
+	PLD(	ldmeqia r1!, {r3, r4, ip, lr}	)
+	PLD(	beq	2b			)
 		LOADREGS(fd, sp!, {r4, pc})		@	3
diff -urN linux-2.5.67-bk5/arch/arm/lib/csumpartialcopyuser.S linux-2.5.67-bk6/arch/arm/lib/csumpartialcopyuser.S
--- linux-2.5.67-bk5/arch/arm/lib/csumpartialcopyuser.S	2003-04-07 10:31:52.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/csumpartialcopyuser.S	2003-04-15 04:36:14.000000000 -0700
@@ -6,8 +6,10 @@
  * 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.
+ *
+ * 27/03/03 Ian Molton Clean up CONFIG_CPU
+ *
  */
-#include <linux/config.h>
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 #include <asm/errno.h>
@@ -15,8 +17,6 @@
 
 		.text
 
-#if defined(CONFIG_CPU_32)
-
 		.macro	save_regs
 		stmfd	sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc}
 		.endm
@@ -72,82 +72,6 @@
 		.previous
 		.endm
 
-#elif defined(CONFIG_CPU_26)
-
-		.macro	save_regs
-		stmfd	sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
-		mov	r9, sp, lsr #13
-		mov	r9, r9, lsl #13
-		ldr	r9, [r9, #TSK_ADDR_LIMIT]
-		mov	r9, r9, lsr #24
-		.endm
-
-		.macro	load_regs,flags
-		ldm\flags	fp, {r1, r2, r4-r9, fp, sp, pc}^
-		.endm
-
-		.macro	load1b,	reg1
-		tst	r9, #0x01
-9999:		ldreqbt	\reg1, [r0], #1
-		ldrneb	\reg1, [r0], #1
-		.section __ex_table, "a"
-		.align	3
-		.long	9999b, 6001f
-		.previous
-		.endm
-
-		.macro	load2b, reg1, reg2
-		tst	r9, #0x01
-9999:		ldreqbt	\reg1, [r0], #1
-		ldrneb	\reg1, [r0], #1
-9998:		ldreqbt	\reg2, [r0], #1
-		ldrneb	\reg2, [r0], #1
-		.section __ex_table, "a"
-		.long	9999b, 6001f
-		.long	9998b, 6001f
-		.previous
-		.endm
-
-		.macro	load1l, reg1
-		tst	r9, #0x01
-9999:		ldreqt	\reg1, [r0], #4
-		ldrne	\reg1, [r0], #4
-		.section __ex_table, "a"
-		.align	3
-		.long	9999b, 6001f
-		.previous
-		.endm
-
-		.macro	load2l, reg1, reg2
-		tst	r9, #0x01
-		ldmneia	r0!, {\reg1, \reg2}
-9999:		ldreqt	\reg1, [r0], #4
-9998:		ldreqt	\reg2, [r0], #4
-		.section __ex_table, "a"
-		.long	9999b, 6001f
-		.long	9998b, 6001f
-		.previous
-		.endm
-
-		.macro	load4l, reg1, reg2, reg3, reg4
-		tst	r9, #0x01
-		ldmneia	r0!, {\reg1, \reg2, \reg3, \reg4}
-9999:		ldreqt	\reg1, [r0], #4
-9998:		ldreqt	\reg2, [r0], #4
-9997:		ldreqt	\reg3, [r0], #4
-9996:		ldreqt	\reg4, [r0], #4
-		.section __ex_table, "a"
-		.long	9999b, 6001f
-		.long	9998b, 6001f
-		.long	9997b, 6001f
-		.long	9996b, 6001f
-		.previous
-		.endm
-
-#else
-#error Unknown CPU architecture
-#endif
-
 /*
  * unsigned int
  * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
@@ -165,9 +89,7 @@
  * so properly, we would have to add in whatever registers were loaded before
  * the fault, which, with the current asm above is not predictable.
  */
-#if defined(CONFIG_CPU_32)
 		.section .fixup,"ax"
-#endif
 		.align	4
 6001:		mov	r4, #-EFAULT
 		ldr	r5, [fp, #4]		@ *err_ptr
@@ -179,6 +101,4 @@
 		strneb	r0, [r1], #1
 		bne	6002b
 		load_regs	ea
-#if defined(CONFIG_CPU_32)
 		.previous
-#endif
diff -urN linux-2.5.67-bk5/arch/arm/lib/ecard.S linux-2.5.67-bk6/arch/arm/lib/ecard.S
--- linux-2.5.67-bk5/arch/arm/lib/ecard.S	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/ecard.S	2003-04-15 04:36:14.000000000 -0700
@@ -6,19 +6,17 @@
  * 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.
+ *
+ * 27/03/03 Ian Molton Clean up CONFIG_CPU
+ *
  */
-#include <linux/config.h> /* for CONFIG_CPU_nn */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 #include <asm/hardware.h>
 
-#ifdef CONFIG_CPU_26
-#define CPSR2SPSR(rt)
-#else
 #define CPSR2SPSR(rt) \
 		mrs	rt, cpsr; \
 		msr	spsr, rt
-#endif
 
 @ Purpose: call an expansion card loader to read bytes.
 @ Proto  : char read_loader(int offset, char *card_base, char *loader);
diff -urN linux-2.5.67-bk5/arch/arm/lib/io-acorn.S linux-2.5.67-bk6/arch/arm/lib/io-acorn.S
--- linux-2.5.67-bk5/arch/arm/lib/io-acorn.S	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/io-acorn.S	2003-04-15 04:36:14.000000000 -0700
@@ -6,8 +6,10 @@
  * 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.
+ *
+ * 27/03/03 Ian Molton Clean up CONFIG_CPU
+ *
  */
-#include <linux/config.h> /* for CONFIG_CPU_nn */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 #include <asm/hardware.h>
@@ -53,21 +55,3 @@
 		adr	r0, .iosl_warning
 		mov	r1, lr
 		b	printk
-
-@ Purpose: write a memc register
-@ Proto  : void memc_write(int register, int value);
-@ Returns: nothing
-
-#ifdef CONFIG_CPU_26
-ENTRY(memc_write)
-		cmp	r0, #7
-		RETINSTR(movgt,pc,lr)
-		mov	r0, r0, lsl #17
-		mov	r1, r1, lsl #15
-		mov	r1, r1, lsr #17
-		orr	r0, r0, r1, lsl #2
-		add	r0, r0, #0x03600000
-		strb	r0, [r0]
-		RETINSTR(mov,pc,lr)
-#endif
-
diff -urN linux-2.5.67-bk5/arch/arm/lib/lib1funcs.S linux-2.5.67-bk6/arch/arm/lib/lib1funcs.S
--- linux-2.5.67-bk5/arch/arm/lib/lib1funcs.S	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/lib1funcs.S	2003-04-15 04:36:14.000000000 -0700
@@ -33,23 +33,19 @@
    This exception does not however invalidate any other reasons why
    the executable file might be covered by the GNU General Public License.
  */
-/* This code is derived from gcc 2.95.3 */
-/* I Molton     29/07/01 */
+/* This code is derived from gcc 2.95.3
+ * 29/07/01 Adapted for linux
+ * 27/03/03 Ian Molton Clean up CONFIG_CPU
+ */
 
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 #include <asm/hardware.h>
 #include <linux/config.h>
 
-#ifdef CONFIG_CPU_26
-#define RET	movs
-#define RETc(x)	mov##x##s
-#define RETCOND ^
-#else
 #define RET	mov
 #define RETc(x)	mov##x
 #define RETCOND
-#endif
 
 dividend	.req	r0
 divisor		.req	r1
diff -urN linux-2.5.67-bk5/arch/arm/lib/memcpy.S linux-2.5.67-bk6/arch/arm/lib/memcpy.S
--- linux-2.5.67-bk5/arch/arm/lib/memcpy.S	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/memcpy.S	2003-04-15 04:36:14.000000000 -0700
@@ -27,15 +27,15 @@
 
 /*
  * Prototype: void memcpy(void *to,const void *from,unsigned long n);
- * ARM3: cant use memcopy here!!!
  */
 ENTRY(memcpy)
 ENTRY(memmove)
 		ENTER
 		cmp	r1, r0
-		bcc	19f
+		bcc	23f
 		subs	r2, r2, #4
 		blt	6f
+	PLD(	pld	[r1, #0]		)
 		ands	ip, r0, #3
 		bne	7f
 		ands	ip, r1, #3
@@ -43,29 +43,42 @@
 
 1:		subs	r2, r2, #8
 		blt	5f
-		subs	r2, r2, #0x14
-		blt	3f
-2:		ldmia	r1!,{r3 - r9, ip}
-		stmia	r0!,{r3 - r9, ip}
+		subs	r2, r2, #20
+		blt	4f
+	PLD(	pld	[r1, #28]		)
+	PLD(	subs	r2, r2, #64		)
+	PLD(	blt	3f			)
+2:	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r1, #92]		)
+		ldmia	r1!, {r3 - r9, ip}
 		subs	r2, r2, #32
+		stmgeia	r0!, {r3 - r9, ip}
+		ldmgeia	r1!, {r3 - r9, ip}
+		subges	r2, r2, #32
+		stmia	r0!, {r3 - r9, ip}
 		bge	2b
-		cmn	r2, #16
+3:	PLD(	ldmia	r1!, {r3 - r9, ip}	)
+	PLD(	adds	r2, r2, #32		)
+	PLD(	stmgeia	r0!, {r3 - r9, ip}	)
+	PLD(	ldmgeia	r1!, {r3 - r9, ip}	)
+	PLD(	subges	r2, r2, #32		)
+	PLD(	stmia	r0!, {r3 - r9, ip}	)
+4:		cmn	r2, #16
 		ldmgeia	r1!, {r3 - r6}
+		subge	r2, r2, #16
 		stmgeia	r0!, {r3 - r6}
-		subge	r2, r2, #0x10
-3:		adds	r2, r2, #0x14
-4:		ldmgeia	r1!, {r3 - r5}
+		adds	r2, r2, #20
+		ldmgeia	r1!, {r3 - r5}
+		subge	r2, r2, #12
 		stmgeia	r0!, {r3 - r5}
-		subges	r2, r2, #12
-		bge	4b
 5:		adds	r2, r2, #8
 		blt	6f
 		subs	r2, r2, #4
 		ldrlt	r3, [r1], #4
 		ldmgeia	r1!, {r4, r5}
+		subge	r2, r2, #4
 		strlt	r3, [r0], #4
 		stmgeia	r0!, {r4, r5}
-		subge	r2, r2, #4
 
 6:		adds	r2, r2, #4
 		EXITEQ
@@ -94,13 +107,19 @@
 8:		bic	r1, r1, #3
 		ldr	r7, [r1], #4
 		cmp	ip, #2
-		bgt	15f
-		beq	11f
+		bgt	18f
+		beq	13f
 		cmp	r2, #12
-		blt	10f
+		blt	11f
+	PLD(	pld	[r1, #12]		)
 		sub	r2, r2, #12
-9:		mov	r3, r7, pull #8
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	10f			)
+	PLD(	pld	[r1, #28]		)
+9:	PLD(	pld	[r1, #44]		)
+10:		mov	r3, r7, pull #8
 		ldmia	r1!, {r4 - r7}
+		subs	r2, r2, #16
 		orr	r3, r3, r4, push #24
 		mov	r4, r4, pull #8
 		orr	r4, r4, r5, push #24
@@ -109,24 +128,32 @@
 		mov	r6, r6, pull #8
 		orr	r6, r6, r7, push #24
 		stmia	r0!, {r3 - r6}
-		subs	r2, r2, #16
 		bge	9b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	10b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	100f
-10:		mov	r3, r7, pull #8
+		blt	12f
+11:		mov	r3, r7, pull #8
 		ldr	r7, [r1], #4
 		subs	r2, r2, #4
 		orr	r3, r3, r7, push #24
 		str	r3, [r0], #4
-		bge	10b
-100:		sub	r1, r1, #3
+		bge	11b
+12:		sub	r1, r1, #3
 		b	6b
 
-11:		cmp	r2, #12
-		blt	13f		/* */
+13:		cmp	r2, #12
+		blt	16f
+	PLD(	pld	[r1, #12]		)
 		sub	r2, r2, #12
-12:		mov	r3, r7, pull #16
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	15f			)
+	PLD(	pld	[r1, #28]		)
+14:	PLD(	pld	[r1, #44]		)
+15:		mov	r3, r7, pull #16
 		ldmia	r1!, {r4 - r7}
+		subs	r2, r2, #16
 		orr	r3, r3, r4, push #16
 		mov	r4, r4, pull #16
 		orr	r4, r4, r5, push #16
@@ -135,24 +162,32 @@
 		mov	r6, r6, pull #16
 		orr	r6, r6, r7, push #16
 		stmia	r0!, {r3 - r6}
-		subs	r2, r2, #16
-		bge	12b
+		bge	14b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	15b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	14f
-13:		mov	r3, r7, pull #16
+		blt	17f
+16:		mov	r3, r7, pull #16
 		ldr	r7, [r1], #4
 		subs	r2, r2, #4
 		orr	r3, r3, r7, push #16
 		str	r3, [r0], #4
-		bge	13b
-14:		sub	r1, r1, #2
+		bge	16b
+17:		sub	r1, r1, #2
 		b	6b
 
-15:		cmp	r2, #12
-		blt	17f
+18:		cmp	r2, #12
+		blt	21f
+	PLD(	pld	[r1, #12]		)
 		sub	r2, r2, #12
-16:		mov	r3, r7, pull #24
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	20f			)
+	PLD(	pld	[r1, #28]		)
+19:	PLD(	pld	[r1, #44]		)
+20:		mov	r3, r7, pull #24
 		ldmia	r1!, {r4 - r7}
+		subs	r2, r2, #16
 		orr	r3, r3, r4, push #8
 		mov	r4, r4, pull #24
 		orr	r4, r4, r5, push #8
@@ -161,55 +196,72 @@
 		mov	r6, r6, pull #24
 		orr	r6, r6, r7, push #8
 		stmia	r0!, {r3 - r6}
-		subs	r2, r2, #16
-		bge	16b
+		bge	19b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	20b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	18f
-17:		mov	r3, r7, pull #24
+		blt	22f
+21:		mov	r3, r7, pull #24
 		ldr	r7, [r1], #4
 		subs	r2, r2, #4
 		orr	r3, r3, r7, push #8
 		str	r3, [r0], #4
-		bge	17b
-18:		sub	r1, r1, #1
+		bge	21b
+22:		sub	r1, r1, #1
 		b	6b
 
 
-19:		add	r1, r1, r2
+23:		add	r1, r1, r2
 		add	r0, r0, r2
 		subs	r2, r2, #4
-		blt	24f
+		blt	29f
+	PLD(	pld	[r1, #-4]		)
 		ands	ip, r0, #3
-		bne	25f
+		bne	30f
 		ands	ip, r1, #3
-		bne	26f
+		bne	31f
 
-20:		subs	r2, r2, #8
-		blt	23f
-		subs	r2, r2, #0x14
-		blt	22f
-21:		ldmdb	r1!, {r3 - r9, ip}
-		stmdb	r0!, {r3 - r9, ip}
+24:		subs	r2, r2, #8
+		blt	28f
+		subs	r2, r2, #20
+		blt	27f
+	PLD(	pld	[r1, #-32]		)
+	PLD(	subs	r2, r2, #64		)
+	PLD(	blt	26f			)
+25:	PLD(	pld	[r1, #-64]		)
+	PLD(	pld	[r1, #-96]		)
+		ldmdb	r1!, {r3 - r9, ip}
 		subs	r2, r2, #32
-		bge	21b
-22:		cmn	r2, #16
+		stmgedb	r0!, {r3 - r9, ip}
+		ldmgedb	r1!, {r3 - r9, ip}
+		subges	r2, r2, #32
+		stmdb	r0!, {r3 - r9, ip}
+		bge	25b
+26:	PLD(	ldmdb	r1!, {r3 - r9, ip}	)
+	PLD(	adds	r2, r2, #32		)
+	PLD(	stmgedb	r0!, {r3 - r9, ip}	)
+	PLD(	ldmgedb	r1!, {r3 - r9, ip}	)
+	PLD(	subges	r2, r2, #32		)
+	PLD(	stmdb	r0!, {r3 - r9, ip}	)
+27:		cmn	r2, #16
 		ldmgedb	r1!, {r3 - r6}
-		stmgedb	r0!, {r3 - r6}
 		subge	r2, r2, #16
+		stmgedb	r0!, {r3 - r6}
 		adds	r2, r2, #20
 		ldmgedb	r1!, {r3 - r5}
-		stmgedb	r0!, {r3 - r5}
 		subge	r2, r2, #12
-23:		adds	r2, r2, #8
-		blt	24f
+		stmgedb	r0!, {r3 - r5}
+28:		adds	r2, r2, #8
+		blt	29f
 		subs	r2, r2, #4
 		ldrlt	r3, [r1, #-4]!
 		ldmgedb	r1!, {r4, r5}
+		subge	r2, r2, #4
 		strlt	r3, [r0, #-4]!
 		stmgedb	r0!, {r4, r5}
-		subge	r2, r2, #4
 
-24:		adds	r2, r2, #4
+29:		adds	r2, r2, #4
 		EXITEQ
 		cmp	r2, #2
 		ldrb	r3, [r1, #-1]!
@@ -220,7 +272,7 @@
 		strgtb	r5, [r0, #-1]!
 		EXIT
 
-25:		cmp	ip, #2
+30:		cmp	ip, #2
 		ldrb	r3, [r1, #-1]!
 		ldrgeb	r4, [r1, #-1]!
 		ldrgtb	r5, [r1, #-1]!
@@ -228,20 +280,26 @@
 		strgeb	r4, [r0, #-1]!
 		strgtb	r5, [r0, #-1]!
 		subs	r2, r2, ip
-		blt	24b
+		blt	29b
 		ands	ip, r1, #3
-		beq	20b
+		beq	24b
 
-26:		bic	r1, r1, #3
+31:		bic	r1, r1, #3
 		ldr	r3, [r1], #0
 		cmp	ip, #2
-		blt	34f
-		beq	30f
+		blt	41f
+		beq	36f
 		cmp	r2, #12
-		blt	28f
+		blt	34f
+	PLD(	pld	[r1, #-16]		)
 		sub	r2, r2, #12
-27:		mov	r7, r3, push #8
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	33f			)
+	PLD(	pld	[r1, #-32]		)
+32:	PLD(	pld	[r1, #-48]		)
+33:		mov	r7, r3, push #8
 		ldmdb	r1!, {r3, r4, r5, r6}
+		subs	r2, r2, #16
 		orr	r7, r7, r6, pull #24
 		mov	r6, r6, push #8
 		orr	r6, r6, r5, pull #24
@@ -250,24 +308,32 @@
 		mov	r4, r4, push #8
 		orr	r4, r4, r3, pull #24
 		stmdb	r0!, {r4, r5, r6, r7}
-		subs	r2, r2, #16
-		bge	27b
+		bge	32b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	33b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	29f
-28:		mov	ip, r3, push #8
+		blt	35f
+34:		mov	ip, r3, push #8
 		ldr	r3, [r1, #-4]!
 		subs	r2, r2, #4
 		orr	ip, ip, r3, pull #24
 		str	ip, [r0, #-4]!
-		bge	28b
-29:		add	r1, r1, #3
-		b	24b
-
-30:		cmp	r2, #12
-		blt	32f
+		bge	34b
+35:		add	r1, r1, #3
+		b	29b
+
+36:		cmp	r2, #12
+		blt	39f
+	PLD(	pld	[r1, #-16]		)
 		sub	r2, r2, #12
-31:		mov	r7, r3, push #16
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	38f			)
+	PLD(	pld	[r1, #-32]		)
+37:	PLD(	pld	[r1, #-48]		)
+38:		mov	r7, r3, push #16
 		ldmdb	r1!, {r3, r4, r5, r6}
+		subs	r2, r2, #16
 		orr	r7, r7, r6, pull #16
 		mov	r6, r6, push #16
 		orr	r6, r6, r5, pull #16
@@ -276,24 +342,32 @@
 		mov	r4, r4, push #16
 		orr	r4, r4, r3, pull #16
 		stmdb	r0!, {r4, r5, r6, r7}
-		subs	r2, r2, #16
-		bge	31b
+		bge	37b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	38b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	33f
-32:		mov	ip, r3, push #16
+		blt	40f
+39:		mov	ip, r3, push #16
 		ldr	r3, [r1, #-4]!
 		subs	r2, r2, #4
 		orr	ip, ip, r3, pull #16
 		str	ip, [r0, #-4]!
-		bge	32b
-33:		add	r1, r1, #2
-		b	24b
-
-34:		cmp	r2, #12
-		blt	36f
+		bge	39b
+40:		add	r1, r1, #2
+		b	29b
+
+41:		cmp	r2, #12
+		blt	44f
+	PLD(	pld	[r1, #-16]		)
 		sub	r2, r2, #12
-35:		mov	r7, r3, push #24
+	PLD(	subs	r2, r2, #32		)
+	PLD(	blt	43f			)
+	PLD(	pld	[r1, #-32]		)
+42:	PLD(	pld	[r1, #-48]		)
+43:		mov	r7, r3, push #24
 		ldmdb	r1!, {r3, r4, r5, r6}
+		subs	r2, r2, #16
 		orr	r7, r7, r6, pull #8
 		mov	r6, r6, push #24
 		orr	r6, r6, r5, pull #8
@@ -302,17 +376,18 @@
 		mov	r4, r4, push #24
 		orr	r4, r4, r3, pull #8
 		stmdb	r0!, {r4, r5, r6, r7}
-		subs	r2, r2, #16
-		bge	35b
+		bge	42b
+	PLD(	cmn	r2, #32			)
+	PLD(	bge	43b			)
+	PLD(	add	r2, r2, #32		)
 		adds	r2, r2, #12
-		blt	37f
-36:		mov	ip, r3, push #24
+		blt	45f
+44:		mov	ip, r3, push #24
 		ldr	r3, [r1, #-4]!
 		subs	r2, r2, #4
 		orr	ip, ip, r3, pull #8
 		str	ip, [r0, #-4]!
-		bge	36b
-37:		add	r1, r1, #1
-		b	24b
+		bge	44b
+45:		add	r1, r1, #1
+		b	29b
 
-		.align
diff -urN linux-2.5.67-bk5/arch/arm/lib/uaccess-armo.S linux-2.5.67-bk6/arch/arm/lib/uaccess-armo.S
--- linux-2.5.67-bk5/arch/arm/lib/uaccess-armo.S	2003-04-07 10:31:53.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/uaccess-armo.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,231 +0,0 @@
-/*
- *  linux/arch/arm/lib/uaccess-armo.S
- *
- *  Copyright (C) 1998 Russell King
- *
- *  Note!  Some code fragments found in here have a special calling
- *  convention - they are not APCS compliant!
- *
- * 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/linkage.h>
-#include <asm/assembler.h>
-
-		.text
-
-		.globl	uaccess_user
-uaccess_user:
-		.word	uaccess_user_put_byte
-		.word	uaccess_user_get_byte
-		.word	uaccess_user_put_half
-		.word	uaccess_user_get_half
-		.word	uaccess_user_put_word
-		.word	uaccess_user_get_word
-		.word	__arch_copy_from_user
-		.word	__arch_copy_to_user
-		.word	__arch_clear_user
-		.word	__arch_strncpy_from_user
-		.word	__arch_strnlen_user
-
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_byte:
-		stmfd	sp!, {lr}
-USER(		strbt	r0, [r1])
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_half:
-		stmfd	sp!, {lr}
-USER(		strbt	r0, [r1], #1)
-		mov	r0, r0, lsr #8
-USER(		strbt	r0, [r1])
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_word:
-		stmfd	sp!, {lr}
-USER(		strt	r0, [r1])
-		ldmfd	sp!, {pc}^
-
-9001:		mov	r2, #-EFAULT
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_byte:
-		stmfd	sp!, {lr}
-USER(		ldrbt	r0, [r0])
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_half:
-		stmfd	sp!, {lr}
-USER(		ldrt	r0, [r0])
-		mov	r0, r0, lsl #16
-		mov	r0, r0, lsr #16
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_word:
-		stmfd	sp!, {lr}
-USER(		ldrt	r0, [r0])
-		ldmfd	sp!, {pc}^
-
-9001:		mov	r1, #-EFAULT
-		ldmfd	sp!, {pc}^
-
-
-
-		.globl	uaccess_kernel
-uaccess_kernel:
-		.word	uaccess_kernel_put_byte
-		.word	uaccess_kernel_get_byte
-		.word	uaccess_kernel_put_half
-		.word	uaccess_kernel_get_half
-		.word	uaccess_kernel_put_word
-		.word	uaccess_kernel_get_word
-		.word	uaccess_kernel_copy
-		.word	uaccess_kernel_copy
-		.word	uaccess_kernel_clear
-		.word	uaccess_kernel_strncpy_from
-		.word	uaccess_kernel_strnlen
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_byte:
-		stmfd	sp!, {lr}
-		strb	r0, [r1]
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_half:
-		stmfd	sp!, {lr}
-		strb	r0, [r1]
-		mov	r0, r0, lsr #8
-		strb	r0, [r1, #1]
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_word:
-		stmfd	sp!, {lr}
-		str	r0, [r1]
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_byte:
-		stmfd	sp!, {lr}
-		ldrb	r0, [r0]
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_half:
-		stmfd	sp!, {lr}
-		ldr	r0, [r0]
-		mov	r0, r0, lsl #16
-		mov	r0, r0, lsr #16
-		ldmfd	sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_word:
-		stmfd	sp!, {lr}
-		ldr	r0, [r0]
-		ldmfd	sp!, {pc}^
-
-
-/* Prototype: int uaccess_kernel_copy(void *to, const char *from, size_t n)
- * Purpose  : copy a block to kernel memory from kernel memory
- * Params   : to   - kernel memory
- *          : from - kernel memory
- *          : n    - number of bytes to copy
- * Returns  : Number of bytes NOT copied.
- */
-uaccess_kernel_copy:
-		stmfd	sp!, {lr}
-		bl	memcpy
-		mov	r0, #0
-		ldmfd	sp!, {pc}^
-
-/* Prototype: int uaccess_kernel_clear(void *addr, size_t sz)
- * Purpose  : clear some kernel memory
- * Params   : addr - kernel memory address to clear
- *          : sz   - number of bytes to clear
- * Returns  : number of bytes NOT cleared
- */
-uaccess_kernel_clear:
-		stmfd	sp!, {lr}
-		mov	r2, #0
-		cmp	r1, #4
-		blt	2f
-		ands	ip, r0, #3
-		beq	1f
-		cmp	ip, #1
-		strb	r2, [r0], #1
-		strleb	r2, [r0], #1
-		strltb	r2, [r0], #1
-		rsb	ip, ip, #4
-		sub	r1, r1, ip		@  7  6  5  4  3  2  1
-1:		subs	r1, r1, #8		@ -1 -2 -3 -4 -5 -6 -7
-		bmi	2f
-		str	r2, [r0], #4
-		str	r2, [r0], #4
-		b	1b
-2:		adds	r1, r1, #4		@  3  2  1  0 -1 -2 -3
-		strpl	r2, [r0], #4
-		tst	r1, #2			@ 1x 1x 0x 0x 1x 1x 0x
-		strneb	r2, [r0], #1
-		strneb	r2, [r0], #1
-		tst	r1, #1			@ x1 x0 x1 x0 x1 x0 x1
-		strneb	r2, [r0], #1
-		mov	r0, #0
-		ldmfd	sp!, {pc}^
-
-/* Prototype: size_t uaccess_kernel_strncpy_from(char *dst, char *src, size_t len)
- * Purpose  : copy a string from kernel memory to kernel memory
- * Params   : dst - kernel memory destination
- *          : src - kernel memory source
- *          : len - maximum length of string
- * Returns  : number of characters copied
- */
-uaccess_kernel_strncpy_from:
-		stmfd	sp!, {lr}
-		mov	ip, r2
-1:		subs	r2, r2, #1
-		bmi	2f
-		ldrb	r3, [r1], #1
-		strb	r3, [r0], #1
-		teq	r3, #0
-		bne	1b
-2:		subs	r0, ip, r2
-		ldmfd	sp!, {pc}^
-
-/* Prototype: int uaccess_kernel_strlen(char *str, long n)
- * Purpose  : get length of a string in kernel memory
- * Params   : str - address of string in kernel memory
- * Returns  : length of string *including terminator*,
- *            or zero on exception, or n + 1 if too long
- */
-uaccess_kernel_strnlen:
-		stmfd	sp!, {lr}
-		mov	r2, r0
-1:		ldrb	r1, [r0], #1
-		teq	r1, #0
-		beq	2f
-		subs	r1, r1, #1
-		bne	1b
-		add	r0, r0, #1
-2:		sub	r0, r0, r2
-		ldmfd	sp!, {pc}^
-
diff -urN linux-2.5.67-bk5/arch/arm/lib/uaccess.S linux-2.5.67-bk6/arch/arm/lib/uaccess.S
--- linux-2.5.67-bk5/arch/arm/lib/uaccess.S	2003-04-07 10:30:35.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/lib/uaccess.S	2003-04-15 04:36:14.000000000 -0700
@@ -43,6 +43,8 @@
 		stmfd	sp!, {r2, r4 - r7, lr}
 		cmp	r2, #4
 		blt	.c2u_not_enough
+	PLD(	pld	[r1, #0]		)
+	PLD(	pld	[r0, #0]		)
 		ands	ip, r0, #3
 		bne	.c2u_dest_not_aligned
 .c2u_dest_aligned:
@@ -71,13 +73,26 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #32
 		blt	.c2u_0rem8lp
-
-.c2u_0cpy8lp:	ldmia	r1!, {r3 - r6}
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+	PLD(	subs	ip, ip, #64			)
+	PLD(	blt	.c2u_0cpynopld		)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r0, #60]		)
+
+.c2u_0cpy8lp:
+	PLD(	pld	[r1, #92]		)
+	PLD(	pld	[r0, #92]		)
+.c2u_0cpynopld:	ldmia	r1!, {r3 - r6}
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		ldmia	r1!, {r3 - r6}
-		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		subs	ip, ip, #32
+		stmia	r0!, {r3 - r6}			@ Shouldnt fault
 		bpl	.c2u_0cpy8lp
+	PLD(	cmn	ip, #64			)
+	PLD(	bge	.c2u_0cpynopld		)
+	PLD(	add	ip, ip, #64		)
+
 .c2u_0rem8lp:	cmn	ip, #16
 		ldmgeia	r1!, {r3 - r6}
 		stmgeia	r0!, {r3 - r6}			@ Shouldnt fault
@@ -128,9 +143,19 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.c2u_1rem8lp
-
-.c2u_1cpy8lp:	mov	r3, r7, pull #8
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.c2u_1cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.c2u_1cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.c2u_1cpynopld:	mov	r3, r7, pull #8
 		ldmia	r1!, {r4 - r7}
+		subs	ip, ip, #16
 		orr	r3, r3, r4, push #24
 		mov	r4, r4, pull #8
 		orr	r4, r4, r5, push #24
@@ -139,8 +164,11 @@
 		mov	r6, r6, pull #8
 		orr	r6, r6, r7, push #24
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
-		subs	ip, ip, #16
 		bpl	.c2u_1cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.c2u_1cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .c2u_1rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #8
 		ldmneia	r1!, {r4, r7}
@@ -182,9 +210,19 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.c2u_2rem8lp
-
-.c2u_2cpy8lp:	mov	r3, r7, pull #16
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.c2u_2cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.c2u_2cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.c2u_2cpynopld:	mov	r3, r7, pull #16
 		ldmia	r1!, {r4 - r7}
+		subs	ip, ip, #16
 		orr	r3, r3, r4, push #16
 		mov	r4, r4, pull #16
 		orr	r4, r4, r5, push #16
@@ -193,8 +231,11 @@
 		mov	r6, r6, pull #16
 		orr	r6, r6, r7, push #16
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
-		subs	ip, ip, #16
 		bpl	.c2u_2cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.c2u_2cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .c2u_2rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #16
 		ldmneia	r1!, {r4, r7}
@@ -236,9 +277,19 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.c2u_3rem8lp
-
-.c2u_3cpy8lp:	mov	r3, r7, pull #24
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.c2u_3cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.c2u_3cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.c2u_3cpynopld:	mov	r3, r7, pull #24
 		ldmia	r1!, {r4 - r7}
+		subs	ip, ip, #16
 		orr	r3, r3, r4, push #8
 		mov	r4, r4, pull #24
 		orr	r4, r4, r5, push #8
@@ -247,8 +298,11 @@
 		mov	r6, r6, pull #24
 		orr	r6, r6, r7, push #8
 		stmia	r0!, {r3 - r6}			@ Shouldnt fault
-		subs	ip, ip, #16
 		bpl	.c2u_3cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.c2u_3cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .c2u_3rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #24
 		ldmneia	r1!, {r4, r7}
@@ -302,6 +356,8 @@
 		stmfd	sp!, {r0, r2, r4 - r7, lr}
 		cmp	r2, #4
 		blt	.cfu_not_enough
+	PLD(	pld	[r1, #0]		)
+	PLD(	pld	[r0, #0]		)
 		ands	ip, r0, #3
 		bne	.cfu_dest_not_aligned
 .cfu_dest_aligned:
@@ -329,13 +385,26 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #32
 		blt	.cfu_0rem8lp
-
-.cfu_0cpy8lp:	ldmia	r1!, {r3 - r6}			@ Shouldnt fault
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+	PLD(	subs	ip, ip, #64			)
+	PLD(	blt	.cfu_0cpynopld		)
+	PLD(	pld	[r1, #60]		)
+	PLD(	pld	[r0, #60]		)
+
+.cfu_0cpy8lp:
+	PLD(	pld	[r1, #92]		)
+	PLD(	pld	[r0, #92]		)
+.cfu_0cpynopld:	ldmia	r1!, {r3 - r6}			@ Shouldnt fault
 		stmia	r0!, {r3 - r6}
 		ldmia	r1!, {r3 - r6}			@ Shouldnt fault
-		stmia	r0!, {r3 - r6}
 		subs	ip, ip, #32
+		stmia	r0!, {r3 - r6}
 		bpl	.cfu_0cpy8lp
+	PLD(	cmn	ip, #64			)
+	PLD(	bge	.cfu_0cpynopld		)
+	PLD(	add	ip, ip, #64		)
+
 .cfu_0rem8lp:	cmn	ip, #16
 		ldmgeia	r1!, {r3 - r6}			@ Shouldnt fault
 		stmgeia	r0!, {r3 - r6}
@@ -387,9 +456,19 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.cfu_1rem8lp
-
-.cfu_1cpy8lp:	mov	r3, r7, pull #8
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.cfu_1cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.cfu_1cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.cfu_1cpynopld:	mov	r3, r7, pull #8
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
+		subs	ip, ip, #16
 		orr	r3, r3, r4, push #24
 		mov	r4, r4, pull #8
 		orr	r4, r4, r5, push #24
@@ -398,8 +477,11 @@
 		mov	r6, r6, pull #8
 		orr	r6, r6, r7, push #24
 		stmia	r0!, {r3 - r6}
-		subs	ip, ip, #16
 		bpl	.cfu_1cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.cfu_1cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .cfu_1rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #8
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
@@ -441,9 +523,19 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.cfu_2rem8lp
-
-.cfu_2cpy8lp:	mov	r3, r7, pull #16
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.cfu_2cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.cfu_2cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.cfu_2cpynopld:	mov	r3, r7, pull #16
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
+		subs	ip, ip, #16
 		orr	r3, r3, r4, push #16
 		mov	r4, r4, pull #16
 		orr	r4, r4, r5, push #16
@@ -452,8 +544,11 @@
 		mov	r6, r6, pull #16
 		orr	r6, r6, r7, push #16
 		stmia	r0!, {r3 - r6}
-		subs	ip, ip, #16
 		bpl	.cfu_2cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.cfu_2cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .cfu_2rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #16
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
@@ -495,8 +590,17 @@
 		sub	r2, r2, ip
 		subs	ip, ip, #16
 		blt	.cfu_3rem8lp
-
-.cfu_3cpy8lp:	mov	r3, r7, pull #24
+	PLD(	pld	[r1, #12]		)
+	PLD(	pld	[r0, #12]		)
+	PLD(	subs	ip, ip, #32		)
+	PLD(	blt	.cfu_3cpynopld		)
+	PLD(	pld	[r1, #28]		)
+	PLD(	pld	[r0, #28]		)
+
+.cfu_3cpy8lp:
+	PLD(	pld	[r1, #44]		)
+	PLD(	pld	[r0, #44]		)
+.cfu_3cpynopld:	mov	r3, r7, pull #24
 		ldmia	r1!, {r4 - r7}			@ Shouldnt fault
 		orr	r3, r3, r4, push #8
 		mov	r4, r4, pull #24
@@ -508,6 +612,10 @@
 		stmia	r0!, {r3 - r6}
 		subs	ip, ip, #16
 		bpl	.cfu_3cpy8lp
+	PLD(	cmn	ip, #32			)
+	PLD(	bge	.cfu_3cpynopld		)
+	PLD(	add	ip, ip, #32		)
+
 .cfu_3rem8lp:	tst	ip, #8
 		movne	r3, r7, pull #24
 		ldmneia	r1!, {r4, r7}			@ Shouldnt fault
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/Kconfig linux-2.5.67-bk6/arch/arm/mach-iop310/Kconfig
--- linux-2.5.67-bk5/arch/arm/mach-iop310/Kconfig	2003-04-07 10:32:53.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/Kconfig	1969-12-31 16:00:00.000000000 -0800
@@ -1,30 +0,0 @@
-
-menu "IOP310 Implementation Options"
-
-config ARCH_IQ80310
-	bool "IQ80310"
-	depends on ARCH_IOP310
-	help
-	  Say Y here if you want to run your kernel on the Intel IQ80310
-	  evaluation kit for the IOP310 chipset.
-
-comment "IOP310 Chipset Features"
-
-config IOP310_AAU
-	bool "Support Intel 80312 Application Accelerator Unit (EXPERIMENTAL)"
-	depends on ARCH_IOP310 && EXPERIMENTAL
-
-config IOP310_DMA
-	bool "Support Intel 80312 DMA (EXPERIMENTAL)"
-	depends on ARCH_IOP310 && EXPERIMENTAL
-
-config IOP310_MU
-	bool "Support Intel 80312 Messaging Unit (EXPERIMENTAL)"
-	depends on ARCH_IOP310 && EXPERIMENTAL
-
-config IOP310_PMON
-	bool "Support Intel 80312 Performance Monitor (EXPERIMENTAL)"
-	depends on ARCH_IOP310 && EXPERIMENTAL
-
-endmenu
-
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/Makefile linux-2.5.67-bk6/arch/arm/mach-iop310/Makefile
--- linux-2.5.67-bk5/arch/arm/mach-iop310/Makefile	2003-04-07 10:32:49.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,22 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-# Object file lists.
-
-obj-y			:= arch.o mm.o xs80200-irq.o iop310-irq.o \
-			   iop310-pci.o
-obj-m			:=
-obj-n			:=
-obj-			:=
-
-obj-$(CONFIG_ARCH_IQ80310) += iq80310-pci.o iq80310-irq.o
-
-ifneq ($(CONFIG_XSCALE_PMU_TIMER),y)
-obj-y			+= iq80310-time.o
-endif
-
-obj-$(CONFIG_IOP310_AAU) += aau.o
-obj-$(CONFIG_IOP310_DMA) += dma.o
-obj-$(CONFIG_IOP310_MU) += message.o
-obj-$(CONFIG_IOP310_PMON) += pmon.o
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/arch.c linux-2.5.67-bk6/arch/arm/mach-iop310/arch.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/arch.c	2003-04-07 10:31:45.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/arch.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,48 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/arch.c
- *
- * Author: Nicolas Pitre <nico@cam.org>
- * Copyright (C) 2001 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 <linux/major.h>
-#include <linux/fs.h>
-
-#include <asm/setup.h>
-#include <asm/system.h>
-#include <asm/memory.h>
-#include <asm/hardware.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#ifdef CONFIG_ARCH_IQ80310
-extern void iq80310_map_io(void);
-extern void iq80310_init_irq(void);
-
-static void __init
-fixup_iq80310(struct machine_desc *desc, struct tag *tags,
-	      char **cmdline, struct meminfo *mi)
-{
-	system_rev = (*(volatile unsigned int*)0xfe830000) & 0x0f;
-
-	if (system_rev)
-		system_rev = 0xF;
-}
-
-MACHINE_START(IQ80310, "Cyclone IQ80310")
-	MAINTAINER("MontaVista Software Inc.")
-	BOOT_MEM(0xa0000000, 0xfe000000, 0xfe000000)
-	FIXUP(fixup_iq80310)
-	MAPIO(iq80310_map_io)
-	INITIRQ(iq80310_init_irq)
-MACHINE_END
-
-#else
-#error No machine descriptor defined for this IOP310 implementation
-#endif
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/iop310-irq.c linux-2.5.67-bk6/arch/arm/mach-iop310/iop310-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/iop310-irq.c	2003-04-07 10:32:30.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/iop310-irq.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,113 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/iop310-irq.c
- *
- * Generic IOP310 IRQ handling functionality
- *
- * Author:  Nicolas Pitre
- * Copyright:   (C) 2001 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.
- *
- * Added IOP310 chipset and IQ80310 board demuxing, masking code. - DS
- *
- */
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/list.h>
-
-#include <asm/mach/irq.h>
-#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);
-
-extern void do_IRQ(int, struct pt_regs *);
-
-static u32 iop310_mask /* = 0 */;
-
-static void iop310_irq_mask (unsigned int irq)
-{
-	iop310_mask ++;
-
-	/*
-	 * No mask bits on the 80312, so we have to
-	 * mask everything from the outside!
-	 */
-	if (iop310_mask == 1) {
-		disable_irq(IRQ_XS80200_EXTIRQ);
-		irq_desc[IRQ_XS80200_EXTIRQ].chip->mask(IRQ_XS80200_EXTIRQ);
-	}
-}
-
-static void iop310_irq_unmask (unsigned int irq)
-{
-	if (iop310_mask)
-		iop310_mask --;
-
-	/*
-	 * Check if all 80312 sources are unmasked now
-	 */
-	if (iop310_mask == 0)
-		enable_irq(IRQ_XS80200_EXTIRQ);
-}
-
-struct irqchip ext_chip = {
-	.ack	= iop310_irq_mask,
-	.mask	= iop310_irq_mask,
-	.unmask = iop310_irq_unmask,
-};
-
-void
-iop310_irq_demux(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-	u32 fiq1isr = *((volatile u32*)IOP310_FIQ1ISR);
-	u32 fiq2isr = *((volatile u32*)IOP310_FIQ2ISR);
-	struct irqdesc *d;
-	unsigned int irqno = 0;
-
-	if(fiq1isr)
-	{
-		if(fiq1isr & 0x1)
-			irqno = IRQ_IOP310_DMA0;
-		if(fiq1isr & 0x2)
-			irqno = IRQ_IOP310_DMA1;
-		if(fiq1isr & 0x4)
-			irqno = IRQ_IOP310_DMA2;
-		if(fiq1isr & 0x10)
-			irqno = IRQ_IOP310_PMON;
-		if(fiq1isr & 0x20)
-			irqno = IRQ_IOP310_AAU;
-	}
-	else
-	{
-		if(fiq2isr & 0x2)
-			irqno = IRQ_IOP310_I2C;
-		if(fiq2isr & 0x4)
-			irqno = IRQ_IOP310_MU;
-	}
-
-	if (irqno) {
-		d = irq_desc + irqno;
-		d->handle(irqno, d, regs);
-	}
-}
-
-void __init iop310_init_irq(void)
-{
-	unsigned int i;
-
-	for(i = IOP310_IRQ_OFS; i < NR_IOP310_IRQS; i++)
-	{
-		set_irq_chip(i, &ext_chip);
-		set_irq_handler(i, do_level_IRQ);
-		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
-	}
-
-	xs80200_init_irq();
-}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/iop310-pci.c linux-2.5.67-bk6/arch/arm/mach-iop310/iop310-pci.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/iop310-pci.c	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/iop310-pci.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,434 +0,0 @@
-/*
- * arch/arm/mach-iop310/iop310-pci.c
- *
- * PCI support for the Intel IOP310 chipset
- *
- * Matt Porter <mporter@mvista.com>
- *
- * Copyright (C) 2001 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/kernel.h>
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/system.h>
-#include <asm/hardware.h>
-#include <asm/mach/pci.h>
-
-#include <asm/arch/iop310.h>
-
-/*
- *    *** Special note - why the IOP310 should NOT be used ***
- *
- * The PCI ATU is a brain dead implementation, only allowing 32-bit
- * accesses to PCI configuration space.  This is especially brain
- * dead for writes to this space.  A simple for-instance:
- *
- *  You want to modify the command register *without* corrupting the
- *  status register.
- *
- *  To perform this, you need to read *32* bits of data from offset 4,
- *  mask off the low 16, replace them with the new data, and write *32*
- *  bits back.
- *
- *  Writing the status register at offset 6 with status bits set *clears*
- *  the status.
- *
- * Hello?  Could we have a *SANE* implementation of a PCI ATU some day
- * *PLEASE*?
- */
-#undef DEBUG
-#ifdef DEBUG
-#define  DBG(x...) printk(x)
-#else
-#define  DBG(x...) do { } while (0)
-#endif
-
-/*
- * Calculate the address, etc from the bus, devfn and register
- * offset.  Note that we have two root buses, so we need some
- * method to determine whether we need config type 0 or 1 cycles.
- * We use a root bus number in our bus->sysdata structure for this.
- */
-static u32 iop310_cfg_address(struct pci_bus *bus, int devfn, int where)
-{
-	struct pci_sys_data *sys = bus->sysdata;
-	u32 addr;
-
-	if (sys->busnr == bus->number)
-		addr = 1 << (PCI_SLOT(devfn) + 16);
-	else
-		addr = bus->number << 16 | PCI_SLOT(devfn) << 11 | 1;
-
-	addr |=	PCI_FUNC(devfn) << 8 | (where & ~3);
-
-	return addr;
-}
-
-/*
- * Primary PCI interface support.
- */
-static int iop310_pri_pci_status(void)
-{
-	unsigned int status;
-	int ret = 0;
-
-	status = *IOP310_PATUSR;
-	if (status & 0xf900) {
-		*IOP310_PATUSR = status & 0xf900;
-		ret = 1;
-	}
-	status = *IOP310_PATUISR;
-	if (status & 0x0000018f) {
-		*IOP310_PATUISR = status & 0x0000018f;
-		ret = 1;
-	}
-	status = *IOP310_PSR;
-	if (status & 0xf900) {
-		*IOP310_PSR = status & 0xf900;
-		ret = 1;
-	}
-	status = *IOP310_PBISR;
-	if (status & 0x003f) {
-		*IOP310_PBISR = status & 0x003f;
-		ret = 1;
-	}
-	return ret;
-}
-
-/*
- * Simply write the address register and read the configuration
- * data.  Note that the 4 nop's ensure that we are able to handle
- * a delayed abort (in theory.)
- */
-static inline u32 iop310_pri_read(unsigned long addr)
-{
-	u32 val;
-
-	__asm__ __volatile__(
-		"str	%1, [%2]\n\t"
-		"ldr	%0, [%3]\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		: "=r" (val)
-		: "r" (addr), "r" (IOP310_POCCAR), "r" (IOP310_POCCDR));
-
-	return val;
-}
-
-static int
-iop310_pri_read_config(struct pci_bus *bus, unsigned int devfn, int where,
-		       int size, u32 *value)
-{
-	unsigned long addr = iop310_cfg_address(bus, devfn, where);
-	u32 val = iop310_pri_read(addr) >> ((where & 3) * 8);
-
-	if (iop310_pri_pci_status())
-		val = 0xffffffff;
-
-	*value = val;
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-iop310_pri_write_config(struct pci_bus *bus, unsigned int devfn, int where,
-			int size, u32 value)
-{
-	unsigned long addr = iop310_cfg_address(bus, devfn, where);
-	u32 val;
-
-	if (size != 4) {
-		val = iop310_pri_read(addr);
-		if (!iop310_pri_pci_status() == 0)
-			return PCIBIOS_SUCCESSFUL;
-
-		where = (where & 3) * 8;
-
-		if (size == 1)
-			val &= ~(0xff << where);
-		else
-			val &= ~(0xffff << where);
-
-		*IOP310_POCCDR = val | value << where;
-	} else {
-		asm volatile(
-			"str	%1, [%2]\n\t"
-			"str	%0, [%3]\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			:
-			: "r" (value), "r" (addr),
-			  "r" (IOP310_POCCAR), "r" (IOP310_POCCDR));
-	}
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static struct pci_ops iop310_primary_ops = {
-	.read	= iop310_pri_read_config,
-	.write	= iop310_pri_write_config,
-};
-
-/*
- * Secondary PCI interface support.
- */
-static int iop310_sec_pci_status(void)
-{
-	unsigned int usr, uisr;
-	int ret = 0;
-
-	usr = *IOP310_SATUSR;
-	uisr = *IOP310_SATUISR;
-	if (usr & 0xf900) {
-		*IOP310_SATUSR = usr & 0xf900;
-		ret = 1;
-	}
-	if (uisr & 0x0000069f) {
-		*IOP310_SATUISR = uisr & 0x0000069f;
-		ret = 1;
-	}
-	if (ret)
-		DBG("ERROR (%08x %08x)", usr, uisr);
-	return ret;
-}
-
-/*
- * Simply write the address register and read the configuration
- * data.  Note that the 4 nop's ensure that we are able to handle
- * a delayed abort (in theory.)
- */
-static inline u32 iop310_sec_read(unsigned long addr)
-{
-	u32 val;
-
-	__asm__ __volatile__(
-		"str	%1, [%2]\n\t"
-		"ldr	%0, [%3]\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		"nop\n\t"
-		: "=r" (val)
-		: "r" (addr), "r" (IOP310_SOCCAR), "r" (IOP310_SOCCDR));
-
-	return val;
-}
-
-static int
-iop310_sec_read_config(struct pci_bus *bus, unsigned int devfn, int where,
-		       int size, u32 *value)
-{
-	unsigned long addr = iop310_cfg_address(bus, devfn, where);
-	u32 val = iop310_sec_read(addr) >> ((where & 3) * 8);
-
-	if (iop310_sec_pci_status())
-		val = 0xffffffff;
-
-	*value = val;
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-iop310_sec_write_config(struct pci_bus *bus, unsigned int devfn, int where,
-			int size, u32 value)
-{
-	unsigned long addr = iop310_cfg_address(bus, devfn, where);
-	u32 val;
-
-	if (size != 4) {
-		val = iop310_sec_read(addr);
-
-		if (!iop310_sec_pci_status() == 0)
-			return PCIBIOS_SUCCESSFUL;
-
-		where = (where & 3) * 8;
-
-		if (size == 1)
-			val &= ~(0xff << where);
-		else
-			val &= ~(0xffff << where);
-
-		*IOP310_SOCCDR = val | value << where;
-	} else {
-		asm volatile(
-			"str	%1, [%2]\n\t"
-			"str	%0, [%3]\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			"nop\n\t"
-			:
-			: "r" (value), "r" (addr),
-			  "r" (IOP310_SOCCAR), "r" (IOP310_SOCCDR));
-	}
-
-	return PCIBIOS_SUCCESSFUL;
-}
-
-static struct pci_ops iop310_secondary_ops = {
-	.read	= iop310_sec_read_config,
-	.write	= iop310_sec_write_config,
-};
-
-/*
- * When a PCI device does not exist during config cycles, the 80200 gets
- * an external abort instead of returning 0xffffffff.  If it was an
- * imprecise abort, we need to correct the return address to point after
- * the instruction.  Also note that the Xscale manual says:
- *
- *  "if a stall-until-complete LD or ST instruction triggers an
- *  imprecise fault, then that fault will be seen by the program
- *  within 3 instructions."
- *
- * This does not appear to be the case.  With 8 NOPs after the load, we
- * see the imprecise abort occurring on the STM of iop310_sec_pci_status()
- * which is about 10 instructions away.
- *
- * Always trust reality!
- */
-static int
-iop310_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
-{
-	DBG("PCI abort: address = 0x%08lx fsr = 0x%03x PC = 0x%08lx LR = 0x%08lx\n",
-		addr, fsr, regs->ARM_pc, regs->ARM_lr);
-
-	/*
-	 * 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;
-}
-
-/*
- * Scan an IOP310 PCI bus.  sys->bus defines which bus we scan.
- */
-struct pci_bus *iop310_scan_bus(int nr, struct pci_sys_data *sys)
-{
-	struct pci_ops *ops;
-
-	if (nr)
-		ops = &iop310_secondary_ops;
-	else
-		ops = &iop310_primary_ops;
-
-	return pci_scan_bus(sys->busnr, ops, sys);
-}
-
-/*
- * Setup the system data for controller 'nr'.   Return 0 if none found,
- * 1 if found, or negative error.
- *
- * We can alter:
- *  io_offset   - offset between IO resources and PCI bus BARs
- *  mem_offset  - offset between mem resources and PCI bus BARs
- *  resource[0] - parent IO resource
- *  resource[1] - parent non-prefetchable memory resource
- *  resource[2] - parent prefetchable memory resource
- *  swizzle     - bridge swizzling function
- *  map_irq     - irq mapping function
- *
- * Note that 'io_offset' and 'mem_offset' are left as zero since
- * the IOP310 doesn't attempt to perform any address translation
- * on accesses from the host to the bus.
- */
-int iop310_setup(int nr, struct pci_sys_data *sys)
-{
-	struct resource *res;
-
-	if (nr >= 2)
-		return 0;
-
-	res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL);
-	if (!res)
-		panic("PCI: unable to alloc resources");
-
-	memset(res, 0, sizeof(struct resource) * 2);
-
-	switch (nr) {
-	case 0:
-		res[0].start = IOP310_PCIPRI_LOWER_IO + 0x6e000000;
-		res[0].end   = IOP310_PCIPRI_LOWER_IO + 0x6e00ffff;
-		res[0].name  = "PCI IO Primary";
-		res[0].flags = IORESOURCE_IO;
-
-		res[1].start = IOP310_PCIPRI_LOWER_MEM;
-		res[1].end   = IOP310_PCIPRI_LOWER_MEM + IOP310_PCI_WINDOW_SIZE;
-		res[1].name  = "PCI Memory Primary";
-		res[1].flags = IORESOURCE_MEM;
-		break;
-
-	case 1:
-		res[0].start = IOP310_PCISEC_LOWER_IO + 0x6e000000;
-		res[0].end   = IOP310_PCISEC_LOWER_IO + 0x6e00ffff;
-		res[0].name  = "PCI IO Secondary";
-		res[0].flags = IORESOURCE_IO;
-
-		res[1].start = IOP310_PCISEC_LOWER_MEM;
-		res[1].end   = IOP310_PCISEC_LOWER_MEM + IOP310_PCI_WINDOW_SIZE;
-		res[1].name  = "PCI Memory Secondary";
-		res[1].flags = IORESOURCE_MEM;
-		break;
-	}
-
-	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;
-	sys->io_offset   = 0x6e000000;
-
-	return 1;
-}
-
-void iop310_init(void)
-{
-	DBG("PCI:  Intel 80312 PCI-to-PCI init code.\n");
-	DBG("  ATU secondary: ATUCR =0x%08x\n", *IOP310_ATUCR);
-	DBG("  ATU secondary: SOMWVR=0x%08x  SOIOWVR=0x%08x\n",
-		*IOP310_SOMWVR,	*IOP310_SOIOWVR);
-	DBG("  ATU secondary: SIABAR=0x%08x  SIALR  =0x%08x SIATVR=%08x\n",
-		*IOP310_SIABAR, *IOP310_SIALR, *IOP310_SIATVR);
-	DBG("  ATU primary:   POMWVR=0x%08x  POIOWVR=0x%08x\n",
-		*IOP310_POMWVR,	*IOP310_POIOWVR);
-	DBG("  ATU primary:   PIABAR=0x%08x  PIALR  =0x%08x PIATVR=%08x\n",
-		*IOP310_PIABAR, *IOP310_PIALR, *IOP310_PIATVR);
-	DBG("  P2P: PCR=0x%04x BCR=0x%04x EBCR=0x%04x\n",
-		*IOP310_PCR, *IOP310_BCR, *IOP310_EBCR);
-
-	/*
-	 * Windows have to be carefully opened via a nice set of calls
-	 * here or just some direct register fiddling in the board
-	 * specific init when we want transactions to occur between the
-	 * two PCI hoses.
-	 *
-	 * To do this, we will have manage RETRY assertion between the
-	 * firmware and the kernel.  This will ensure that the host
-	 * system's enumeration code is held off until we have tweaked
-	 * the interrupt routing and public/private IDSELs.
-	 *
-	 * For now we will simply default to disabling the integrated type
-	 * 81 P2P bridge.
-	 */
-	*IOP310_PCR &= 0xfff8;
-
-	hook_fault_code(16+6, iop310_pci_abort, SIGBUS, "imprecise external abort");
-}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-irq.c linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-irq.c	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-irq.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,141 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/iq80310-irq.c
- *
- * IRQ hadling/demuxing for IQ80310 board
- *
- * Author:  Nicolas Pitre
- * Copyright:   (C) 2001 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.
- *
- * 2.4.7-rmk1-iop310.1
- *     Moved demux from asm to C - DS
- *     Fixes for various revision boards - DS
- */
-#include <linux/init.h>
-#include <linux/list.h>
-
-#include <asm/irq.h>
-#include <asm/mach/irq.h>
-#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 *);
-
-static void iq80310_irq_mask(unsigned int irq)
-{
-	*(volatile char *)IQ80310_INT_MASK |= (1 << (irq - IQ80310_IRQ_OFS));
-}
-
-static void iq80310_irq_unmask(unsigned int irq)
-{
-	*(volatile char *)IQ80310_INT_MASK &= ~(1 << (irq - IQ80310_IRQ_OFS));
-}
-
-static struct irqchip iq80310_irq_chip = {
-	.ack	= iq80310_irq_mask,
-	.mask	= iq80310_irq_mask,
-	.unmask = iq80310_irq_unmask,
-};
-
-extern struct irqchip ext_chip;
-
-static void
-iq80310_cpld_irq_handler(unsigned int irq, struct irqdesc *desc,
-			 struct pt_regs *regs)
-{
-	unsigned int irq_stat = *(volatile u8*)IQ80310_INT_STAT;
-	unsigned int irq_mask = *(volatile u8*)IQ80310_INT_MASK;
-	unsigned int i, handled = 0;
-	struct irqdesc *d;
-
-	desc->chip->ack(irq);
-
-	/*
-	 * Mask out the interrupts which aren't enabled.
-	 */
-	irq_stat &= 0x1f & ~irq_mask;
-
-	/*
-	 * Test each IQ80310 CPLD interrupt
-	 */
-	for (i = IRQ_IQ80310_TIMER, d = irq_desc + IRQ_IQ80310_TIMER;
-	     irq_stat; i++, d++, irq_stat >>= 1)
-		if (irq_stat & 1) {
-			d->handle(i, d, regs);
-			handled++;
-		}
-
-	/*
-	 * If running on a board later than REV D.1, we can
-	 * decode the PCI interrupt status.
-	 */
-	if (system_rev) {
-		irq_stat = *((volatile u8*)IQ80310_PCI_INT_STAT) & 7;
-
-		for (i = IRQ_IQ80310_INTA, d = irq_desc + IRQ_IQ80310_INTA;
-		     irq_stat; i++, d++, irq_stat >>= 1)
-			if (irq_stat & 0x1) {
-				d->handle(i, d, regs);
-				handled++;
-			}
-	}
-
-	/*
-	 * If on a REV D.1 or lower board, we just assumed INTA
-	 * since PCI is not routed, and it may actually be an
-	 * on-chip interrupt.
-	 *
-	 * Note that we're giving on-chip interrupts slightly
-	 * higher priority than PCI by handling them first.
-	 *
-	 * On boards later than REV D.1, if we didn't read a
-	 * CPLD interrupt, we assume it's from a device on the
-	 * chipset itself.
-	 */
-	if (system_rev == 0 || handled == 0)
-		iop310_irq_demux(irq, desc, regs);
-
-	desc->chip->unmask(irq);
-}
-
-void __init iq80310_init_irq(void)
-{
-	volatile char *mask = (volatile char *)IQ80310_INT_MASK;
-	unsigned int i;
-
-	iop310_init_irq();
-
-	/*
-	 * Setup PIRSR to route PCI interrupts into xs80200
-	 */
-	*IOP310_PIRSR = 0xff;
-
-	/*
-	 * Setup the IRQs in the FE820000/FE860000 registers
-	 */
-	for (i = IQ80310_IRQ_OFS; i <= IRQ_IQ80310_INTD; i++) {
-		set_irq_chip(i, &iq80310_irq_chip);
-		set_irq_handler(i, do_level_IRQ);
-		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
-	}
-
-	/*
-	 * Setup the PCI IRQs
-	 */
-	for (i = IRQ_IQ80310_INTA; i < IRQ_IQ80310_INTC; i++) {
-		set_irq_chip(i, &ext_chip);
-		set_irq_handler(i, do_level_IRQ);
-		set_irq_flags(i, IRQF_VALID);
-	}
-
-	*mask = 0xff;  /* mask all sources */
-
-	set_irq_chained_handler(IRQ_XS80200_EXTIRQ,
-				&iq80310_cpld_irq_handler);
-}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-pci.c linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-pci.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-pci.c	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-pci.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,164 +0,0 @@
-/*
- * arch/arm/mach-iop310/iq80310-pci.c
- *
- * PCI support for the Intel IQ80310 reference board
- *
- * Matt Porter <mporter@mvista.com>
- *
- * Copyright (C) 2001 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/kernel.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-
-#include <asm/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach/pci.h>
-#include <asm/mach-types.h>
-
-/*
- * The following macro is used to lookup irqs in a standard table
- * format for those systems that do not already have PCI
- * interrupts properly routed.  We assume 1 <= pin <= 4
- */
-#define PCI_IRQ_TABLE_LOOKUP(minid,maxid)	\
-({ int _ctl_ = -1;				\
-   unsigned int _idsel = idsel - minid;		\
-   if (_idsel <= maxid)				\
-      _ctl_ = pci_irq_table[_idsel][pin-1];	\
-   _ctl_; })
-
-#define INTA	IRQ_IQ80310_INTA
-#define INTB	IRQ_IQ80310_INTB
-#define INTC	IRQ_IQ80310_INTC
-#define INTD	IRQ_IQ80310_INTD
-
-#define INTE	IRQ_IQ80310_I82559
-
-typedef u8 irq_table[4];
-
-/*
- * IRQ tables for primary bus.
- *
- * On a Rev D.1 and older board, INT A-C are not routed, so we
- * just fake it as INTA and than we take care of handling it
- * correctly in the IRQ demux routine.
- */
-static irq_table pci_pri_d_irq_table[] = {
-/* Pin:    A     B     C     D */
-	{ INTA, INTD, INTA, INTA }, /*  PCI Slot J3 */
-	{ INTD, INTA, INTA, INTA }, /*  PCI Slot J4 */
-};
-
-static irq_table pci_pri_f_irq_table[] = {
-/* Pin:    A     B     C     D */
-	{ INTC, INTD, INTA, INTB }, /*  PCI Slot J3 */
-	{ INTD, INTA, INTB, INTC }, /*  PCI Slot J4 */
-};
-
-static int __init
-iq80310_pri_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
-{
-	irq_table *pci_irq_table;
-
-	BUG_ON(pin < 1 || pin > 4);
-
-	if (!system_rev) {
-		pci_irq_table = pci_pri_d_irq_table;
-	} else {
-		pci_irq_table = pci_pri_f_irq_table;
-	}
-
-	return PCI_IRQ_TABLE_LOOKUP(2, 3);
-}
-
-/*
- * IRQ tables for secondary bus.
- *
- * On a Rev D.1 and older board, INT A-C are not routed, so we
- * just fake it as INTA and than we take care of handling it
- * correctly in the IRQ demux routine.
- */
-static irq_table pci_sec_d_irq_table[] = {
-/* Pin:    A     B     C     D */
-	{ INTA, INTA, INTA, INTD }, /*  PCI Slot J1 */
-	{ INTA, INTA, INTD, INTA }, /*  PCI Slot J5 */
-	{ INTE, INTE, INTE, INTE }, /*  P2P Bridge */
-};
-
-static irq_table pci_sec_f_irq_table[] = {
-/* Pin:	   A     B     C     D */
-	{ INTA, INTB, INTC, INTD }, /* PCI Slot J1 */
-	{ INTB, INTC, INTD, INTA }, /* PCI Slot J5 */
-	{ INTE, INTE, INTE, INTE }, /* P2P Bridge */
-};
-
-static int __init
-iq80310_sec_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
-{
-	irq_table *pci_irq_table;
-
-	BUG_ON(pin < 1 || pin > 4);
-
-	if (!system_rev) {
-		pci_irq_table = pci_sec_d_irq_table;
-	} else {
-		pci_irq_table = pci_sec_f_irq_table;
-	}
-
-	return PCI_IRQ_TABLE_LOOKUP(0, 2);
-}
-
-static int iq80310_pri_host;
-
-static int iq80310_setup(int nr, struct pci_sys_data *sys)
-{
-	switch (nr) {
-	case 0:
-		if (!iq80310_pri_host)
-			return 0;
-
-		sys->map_irq = iq80310_pri_map_irq;
-		break;
-
-	case 1:
-		sys->map_irq = iq80310_sec_map_irq;
-		break;
-
-	default:
-		return 0;
-	}
-
-	return iop310_setup(nr, sys);
-}
-
-static void iq80310_preinit(void)
-{
-	iq80310_pri_host = *(volatile u32 *)IQ80310_BACKPLANE & 1;
-
-	printk(KERN_INFO "PCI: IQ80310 is a%s\n",
-		iq80310_pri_host ? " system controller" : "n agent");
-
-	iop310_init();
-}
-
-static struct hw_pci iq80310_pci __initdata = {
-	.swizzle	= pci_std_swizzle,
-	.nr_controllers = 2,
-	.setup		= iq80310_setup,
-	.scan		= iop310_scan_bus,
-	.preinit	= iq80310_preinit,
-};
-
-static int __init iq80310_pci_init(void)
-{
-	if (machine_is_iq80310())
-		pci_common_init(&iq80310_pci);
-	return 0;
-}
-
-subsys_initcall(iq80310_pci_init);
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-time.c linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-time.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/iq80310-time.c	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/iq80310-time.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,134 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/time-iq80310.c
- *
- * Timer functions for IQ80310 onboard timer
- *
- * Author:  Nicolas Pitre
- * Copyright:   (C) 2001 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/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
-#include <linux/init.h>
-#include <linux/timex.h>
-
-#include <asm/hardware.h>
-#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)
-{
-	volatile u_char *la0 = (volatile u_char *)IQ80310_TIMER_LA0;
-	volatile u_char *la1 = (volatile u_char *)IQ80310_TIMER_LA1;
-	volatile u_char *la2 = (volatile u_char *)IQ80310_TIMER_LA2;
-
-	*la0 = val;
-	*la1 = val >> 8;
-	*la2 = (val >> 16) & 0x3f;
-}
-
-static u_long iq80310_read_timer (void)
-{
-	volatile u_char *la0 = (volatile u_char *)IQ80310_TIMER_LA0;
-	volatile u_char *la1 = (volatile u_char *)IQ80310_TIMER_LA1;
-	volatile u_char *la2 = (volatile u_char *)IQ80310_TIMER_LA2;
-	volatile u_char *la3 = (volatile u_char *)IQ80310_TIMER_LA3;
-	u_long b0, b1, b2, b3, val;
-
-	b0 = *la0; b1 = *la1; b2 = *la2; b3 = *la3;
-	b0 = (((b0 & 0x40) >> 1) | (b0 & 0x1f));
-	b1 = (((b1 & 0x40) >> 1) | (b1 & 0x1f));
-	b2 = (((b2 & 0x40) >> 1) | (b2 & 0x1f));
-	b3 = (b3 & 0x0f);
-	val = ((b0 << 0) | (b1 << 6) | (b2 << 12) | (b3 << 18));
-	return val;
-}
-
-/*
- * IRQs are disabled before entering here from do_gettimeofday().
- * Note that the counter may wrap.  When it does, 'elapsed' will
- * be small, but we will have a pending interrupt.
- */
-static unsigned long iq80310_gettimeoffset (void)
-{
-	unsigned long elapsed, usec;
-	unsigned int stat1, stat2;
-
-	stat1 = *(volatile u8 *)IQ80310_INT_STAT;
-	elapsed = iq80310_read_timer();
-	stat2 = *(volatile u8 *)IQ80310_INT_STAT;
-
-	/*
-	 * If an interrupt was pending before we read the timer,
-	 * we've already wrapped.  Factor this into the time.
-	 * If an interrupt was pending after we read the timer,
-	 * it may have wrapped between checking the interrupt
-	 * status and reading the timer.  Re-read the timer to
-	 * be sure its value is after the wrap.
-	 */
-	if (stat1 & 1)
-		elapsed += LATCH;
-	else if (stat2 & 1)
-		elapsed = LATCH + iq80310_read_timer();
-
-	/*
-	 * Now convert them to usec.
-	 */
-	usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
-
-	return usec;
-}
-
-
-static void iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
-
-	/* clear timer interrupt */
-	*timer_en &= ~2;
-	*timer_en |= 2;
-
-	/*
-	 * AHEM..HACK
-	 *
-	 * Since the timer interrupt is cascaded through the CPLD and
-	 * the 80312 and the demux code calls do_IRQ, the irq count is
-	 * going to be atleast 2 when we get here and this will cause the
-	 * kernel to increment the system tick counter even if we're
-	 * idle. This causes it to look like there's always 100% system
-	 * time, which is not the case.  To get around it, we just decrement
-	 * the IRQ count before calling do_timer. We increment it again
-	 * b/c otherwise it will go negative and than bad things happen.
-	 *
-	 * -DS
-	 */
-	do_timer(regs);
-}
-
-extern unsigned long (*gettimeoffset)(void);
-
-static struct irqaction timer_irq = {
-	.name		= "timer",
-	.handler	= iq80310_timer_interrupt,
-};
-
-
-void __init time_init(void)
-{
-	volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
-
-	gettimeoffset = iq80310_gettimeoffset;
-	setup_irq(IRQ_IQ80310_TIMER, &timer_irq);
-	*timer_en = 0;
-	iq80310_write_timer(LATCH);
-	*timer_en |= 2;
-	*timer_en |= 1;
-}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/mm.c linux-2.5.67-bk6/arch/arm/mach-iop310/mm.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/mm.c	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/mm.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,70 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/mm.c
- *
- * Low level memory initialization for IOP310 based systems
- *
- * Author: Nicolas Pitre <npitre@mvista.com>
- *
- * Copyright 2000-2001 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.
- *
- */
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/page.h>
-
-#include <asm/mach/map.h>
-#include <asm/mach-types.h>
-
-#ifdef CONFIG_IOP310_MU
-#include "message.h"
-#endif
-
-/*
- * Standard IO mapping for all IOP310 based systems
- */
-static struct map_desc iop80310_std_desc[] __initdata = {
- /* virtual     physical      length       type */
- // IOP310 Memory Mapped Registers
- { 0xe8001000,  0x00001000,   0x00001000,  MT_DEVICE },
- // PCI I/O Space
- { 0xfe000000,  0x90000000,   0x00020000,  MT_DEVICE }
-};
-
-void __init iop310_map_io(void)
-{
-	iotable_init(iop80310_std_desc, ARRAY_SIZE(iop80310_std_desc));
-}
-
-/*
- * IQ80310 specific IO mappings
- */
-#ifdef CONFIG_ARCH_IQ80310
-static struct map_desc iq80310_io_desc[] __initdata = {
- /* virtual     physical      length        type */
- // IQ80310 On-Board Devices
- { 0xfe800000,  0xfe800000,   0x00100000,   MT_DEVICE }
-};
-
-void __init iq80310_map_io(void)
-{
-#ifdef CONFIG_IOP310_MU
-	/* acquiring 1MB of memory aligned on 1MB boundary for MU */
-	mu_mem = __alloc_bootmem(0x100000, 0x100000, 0);
-#endif
-
-	iop310_map_io();
-
-	iotable_init(iq80310_io_desc, ARRAY_SIZE(iq80310_io_desc));
-}
-#endif // CONFIG_ARCH_IQ80310
-
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop310/xs80200-irq.c linux-2.5.67-bk6/arch/arm/mach-iop310/xs80200-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop310/xs80200-irq.c	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-iop310/xs80200-irq.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,65 +0,0 @@
-/*
- * linux/arch/arm/mach-iop310/xs80200-irq.c
- *
- * Generic IRQ handling for the XS80200 XScale core.
- *
- * Author:  Nicolas Pitre
- * Copyright:   (C) 2001 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/list.h>
-
-#include <asm/mach/irq.h>
-#include <asm/irq.h>
-#include <asm/hardware.h>
-
-#include <asm/mach-types.h>
-
-static void xs80200_irq_mask (unsigned int irq)
-{
-	unsigned long intctl;
-	asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
-	switch (irq) {
-	    case IRQ_XS80200_BCU:     intctl &= ~(1<<3); break;
-	    case IRQ_XS80200_PMU:     intctl &= ~(1<<2); break;
-	    case IRQ_XS80200_EXTIRQ:  intctl &= ~(1<<1); break;
-	    case IRQ_XS80200_EXTFIQ:  intctl &= ~(1<<0); break;
-	}
-	asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
-}
-
-static void xs80200_irq_unmask (unsigned int irq)
-{
-	unsigned long intctl;
-	asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
-	switch (irq) {
-	    case IRQ_XS80200_BCU:	intctl |= (1<<3); break;
-	    case IRQ_XS80200_PMU:	intctl |= (1<<2); break;
-	    case IRQ_XS80200_EXTIRQ:	intctl |= (1<<1); break;
-	    case IRQ_XS80200_EXTFIQ:	intctl |= (1<<0); break;
-	}
-	asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
-}
-
-static struct irqchip xs80200_chip = {
-	.ack	= xs80200_irq_mask,
-	.mask	= xs80200_irq_mask,
-	.unmask = xs80200_irq_unmask,
-};
-
-void __init xs80200_init_irq(void)
-{
-	unsigned int i;
-
-	asm("mcr p13, 0, %0, c0, c0, 0" : : "r" (0));
-
-	for (i = 0; i < NR_XS80200_IRQS; i++) {
-		set_irq_chip(i, &xs80200_chip);
-		set_irq_handler(i, do_level_IRQ);
-		set_irq_flags(i, IRQF_VALID);
-	}
-}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/Kconfig linux-2.5.67-bk6/arch/arm/mach-iop3xx/Kconfig
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/Kconfig	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/Kconfig	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,30 @@
+
+menu "IOP310 Implementation Options"
+
+config ARCH_IQ80310
+	bool "IQ80310"
+	depends on ARCH_IOP310
+	help
+	  Say Y here if you want to run your kernel on the Intel IQ80310
+	  evaluation kit for the IOP310 chipset.
+
+comment "IOP310 Chipset Features"
+
+config IOP310_AAU
+	bool "Support Intel 80312 Application Accelerator Unit (EXPERIMENTAL)"
+	depends on ARCH_IOP310 && EXPERIMENTAL
+
+config IOP310_DMA
+	bool "Support Intel 80312 DMA (EXPERIMENTAL)"
+	depends on ARCH_IOP310 && EXPERIMENTAL
+
+config IOP310_MU
+	bool "Support Intel 80312 Messaging Unit (EXPERIMENTAL)"
+	depends on ARCH_IOP310 && EXPERIMENTAL
+
+config IOP310_PMON
+	bool "Support Intel 80312 Performance Monitor (EXPERIMENTAL)"
+	depends on ARCH_IOP310 && EXPERIMENTAL
+
+endmenu
+
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/Makefile linux-2.5.67-bk6/arch/arm/mach-iop3xx/Makefile
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/Makefile	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,22 @@
+#
+# Makefile for the linux kernel.
+#
+
+# Object file lists.
+
+obj-y			:= arch.o mm.o xs80200-irq.o iop310-irq.o \
+			   iop310-pci.o
+obj-m			:=
+obj-n			:=
+obj-			:=
+
+obj-$(CONFIG_ARCH_IQ80310) += iq80310-pci.o iq80310-irq.o
+
+ifneq ($(CONFIG_XSCALE_PMU_TIMER),y)
+obj-y			+= iq80310-time.o
+endif
+
+obj-$(CONFIG_IOP310_AAU) += aau.o
+obj-$(CONFIG_IOP310_DMA) += dma.o
+obj-$(CONFIG_IOP310_MU) += message.o
+obj-$(CONFIG_IOP310_PMON) += pmon.o
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/arch.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/arch.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/arch.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/arch.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,48 @@
+/*
+ * linux/arch/arm/mach-iop3xx/arch.c
+ *
+ * Author: Nicolas Pitre <nico@cam.org>
+ * Copyright (C) 2001 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 <linux/major.h>
+#include <linux/fs.h>
+
+#include <asm/setup.h>
+#include <asm/system.h>
+#include <asm/memory.h>
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#ifdef CONFIG_ARCH_IQ80310
+extern void iq80310_map_io(void);
+extern void iq80310_init_irq(void);
+
+static void __init
+fixup_iq80310(struct machine_desc *desc, struct tag *tags,
+	      char **cmdline, struct meminfo *mi)
+{
+	system_rev = (*(volatile unsigned int*)0xfe830000) & 0x0f;
+
+	if (system_rev)
+		system_rev = 0xF;
+}
+
+MACHINE_START(IQ80310, "Cyclone IQ80310")
+	MAINTAINER("MontaVista Software Inc.")
+	BOOT_MEM(0xa0000000, 0xfe000000, 0xfe000000)
+	FIXUP(fixup_iq80310)
+	MAPIO(iq80310_map_io)
+	INITIRQ(iq80310_init_irq)
+MACHINE_END
+
+#else
+#error No machine descriptor defined for this IOP310 implementation
+#endif
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/iop310-irq.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/iop310-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/iop310-irq.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/iop310-irq.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,113 @@
+/*
+ * linux/arch/arm/mach-iop3xx/iop310-irq.c
+ *
+ * Generic IOP310 IRQ handling functionality
+ *
+ * Author:  Nicolas Pitre
+ * Copyright:   (C) 2001 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.
+ *
+ * Added IOP310 chipset and IQ80310 board demuxing, masking code. - DS
+ *
+ */
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+
+#include <asm/mach/irq.h>
+#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);
+
+extern void do_IRQ(int, struct pt_regs *);
+
+static u32 iop310_mask /* = 0 */;
+
+static void iop310_irq_mask (unsigned int irq)
+{
+	iop310_mask ++;
+
+	/*
+	 * No mask bits on the 80312, so we have to
+	 * mask everything from the outside!
+	 */
+	if (iop310_mask == 1) {
+		disable_irq(IRQ_XS80200_EXTIRQ);
+		irq_desc[IRQ_XS80200_EXTIRQ].chip->mask(IRQ_XS80200_EXTIRQ);
+	}
+}
+
+static void iop310_irq_unmask (unsigned int irq)
+{
+	if (iop310_mask)
+		iop310_mask --;
+
+	/*
+	 * Check if all 80312 sources are unmasked now
+	 */
+	if (iop310_mask == 0)
+		enable_irq(IRQ_XS80200_EXTIRQ);
+}
+
+struct irqchip ext_chip = {
+	.ack	= iop310_irq_mask,
+	.mask	= iop310_irq_mask,
+	.unmask = iop310_irq_unmask,
+};
+
+void
+iop310_irq_demux(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
+{
+	u32 fiq1isr = *((volatile u32*)IOP310_FIQ1ISR);
+	u32 fiq2isr = *((volatile u32*)IOP310_FIQ2ISR);
+	struct irqdesc *d;
+	unsigned int irqno = 0;
+
+	if(fiq1isr)
+	{
+		if(fiq1isr & 0x1)
+			irqno = IRQ_IOP310_DMA0;
+		if(fiq1isr & 0x2)
+			irqno = IRQ_IOP310_DMA1;
+		if(fiq1isr & 0x4)
+			irqno = IRQ_IOP310_DMA2;
+		if(fiq1isr & 0x10)
+			irqno = IRQ_IOP310_PMON;
+		if(fiq1isr & 0x20)
+			irqno = IRQ_IOP310_AAU;
+	}
+	else
+	{
+		if(fiq2isr & 0x2)
+			irqno = IRQ_IOP310_I2C;
+		if(fiq2isr & 0x4)
+			irqno = IRQ_IOP310_MU;
+	}
+
+	if (irqno) {
+		d = irq_desc + irqno;
+		d->handle(irqno, d, regs);
+	}
+}
+
+void __init iop310_init_irq(void)
+{
+	unsigned int i;
+
+	for(i = IOP310_IRQ_OFS; i < NR_IOP310_IRQS; i++)
+	{
+		set_irq_chip(i, &ext_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
+	}
+
+	xs80200_init_irq();
+}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/iop310-pci.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/iop310-pci.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/iop310-pci.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/iop310-pci.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,434 @@
+/*
+ * arch/arm/mach-iop3xx/iop310-pci.c
+ *
+ * PCI support for the Intel IOP310 chipset
+ *
+ * Matt Porter <mporter@mvista.com>
+ *
+ * Copyright (C) 2001 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/kernel.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/system.h>
+#include <asm/hardware.h>
+#include <asm/mach/pci.h>
+
+#include <asm/arch/iop310.h>
+
+/*
+ *    *** Special note - why the IOP310 should NOT be used ***
+ *
+ * The PCI ATU is a brain dead implementation, only allowing 32-bit
+ * accesses to PCI configuration space.  This is especially brain
+ * dead for writes to this space.  A simple for-instance:
+ *
+ *  You want to modify the command register *without* corrupting the
+ *  status register.
+ *
+ *  To perform this, you need to read *32* bits of data from offset 4,
+ *  mask off the low 16, replace them with the new data, and write *32*
+ *  bits back.
+ *
+ *  Writing the status register at offset 6 with status bits set *clears*
+ *  the status.
+ *
+ * Hello?  Could we have a *SANE* implementation of a PCI ATU some day
+ * *PLEASE*?
+ */
+#undef DEBUG
+#ifdef DEBUG
+#define  DBG(x...) printk(x)
+#else
+#define  DBG(x...) do { } while (0)
+#endif
+
+/*
+ * Calculate the address, etc from the bus, devfn and register
+ * offset.  Note that we have two root buses, so we need some
+ * method to determine whether we need config type 0 or 1 cycles.
+ * We use a root bus number in our bus->sysdata structure for this.
+ */
+static u32 iop310_cfg_address(struct pci_bus *bus, int devfn, int where)
+{
+	struct pci_sys_data *sys = bus->sysdata;
+	u32 addr;
+
+	if (sys->busnr == bus->number)
+		addr = 1 << (PCI_SLOT(devfn) + 16);
+	else
+		addr = bus->number << 16 | PCI_SLOT(devfn) << 11 | 1;
+
+	addr |=	PCI_FUNC(devfn) << 8 | (where & ~3);
+
+	return addr;
+}
+
+/*
+ * Primary PCI interface support.
+ */
+static int iop310_pri_pci_status(void)
+{
+	unsigned int status;
+	int ret = 0;
+
+	status = *IOP310_PATUSR;
+	if (status & 0xf900) {
+		*IOP310_PATUSR = status & 0xf900;
+		ret = 1;
+	}
+	status = *IOP310_PATUISR;
+	if (status & 0x0000018f) {
+		*IOP310_PATUISR = status & 0x0000018f;
+		ret = 1;
+	}
+	status = *IOP310_PSR;
+	if (status & 0xf900) {
+		*IOP310_PSR = status & 0xf900;
+		ret = 1;
+	}
+	status = *IOP310_PBISR;
+	if (status & 0x003f) {
+		*IOP310_PBISR = status & 0x003f;
+		ret = 1;
+	}
+	return ret;
+}
+
+/*
+ * Simply write the address register and read the configuration
+ * data.  Note that the 4 nop's ensure that we are able to handle
+ * a delayed abort (in theory.)
+ */
+static inline u32 iop310_pri_read(unsigned long addr)
+{
+	u32 val;
+
+	__asm__ __volatile__(
+		"str	%1, [%2]\n\t"
+		"ldr	%0, [%3]\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		: "=r" (val)
+		: "r" (addr), "r" (IOP310_POCCAR), "r" (IOP310_POCCDR));
+
+	return val;
+}
+
+static int
+iop310_pri_read_config(struct pci_bus *bus, unsigned int devfn, int where,
+		       int size, u32 *value)
+{
+	unsigned long addr = iop310_cfg_address(bus, devfn, where);
+	u32 val = iop310_pri_read(addr) >> ((where & 3) * 8);
+
+	if (iop310_pri_pci_status())
+		val = 0xffffffff;
+
+	*value = val;
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static int
+iop310_pri_write_config(struct pci_bus *bus, unsigned int devfn, int where,
+			int size, u32 value)
+{
+	unsigned long addr = iop310_cfg_address(bus, devfn, where);
+	u32 val;
+
+	if (size != 4) {
+		val = iop310_pri_read(addr);
+		if (!iop310_pri_pci_status() == 0)
+			return PCIBIOS_SUCCESSFUL;
+
+		where = (where & 3) * 8;
+
+		if (size == 1)
+			val &= ~(0xff << where);
+		else
+			val &= ~(0xffff << where);
+
+		*IOP310_POCCDR = val | value << where;
+	} else {
+		asm volatile(
+			"str	%1, [%2]\n\t"
+			"str	%0, [%3]\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			:
+			: "r" (value), "r" (addr),
+			  "r" (IOP310_POCCAR), "r" (IOP310_POCCDR));
+	}
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static struct pci_ops iop310_primary_ops = {
+	.read	= iop310_pri_read_config,
+	.write	= iop310_pri_write_config,
+};
+
+/*
+ * Secondary PCI interface support.
+ */
+static int iop310_sec_pci_status(void)
+{
+	unsigned int usr, uisr;
+	int ret = 0;
+
+	usr = *IOP310_SATUSR;
+	uisr = *IOP310_SATUISR;
+	if (usr & 0xf900) {
+		*IOP310_SATUSR = usr & 0xf900;
+		ret = 1;
+	}
+	if (uisr & 0x0000069f) {
+		*IOP310_SATUISR = uisr & 0x0000069f;
+		ret = 1;
+	}
+	if (ret)
+		DBG("ERROR (%08x %08x)", usr, uisr);
+	return ret;
+}
+
+/*
+ * Simply write the address register and read the configuration
+ * data.  Note that the 4 nop's ensure that we are able to handle
+ * a delayed abort (in theory.)
+ */
+static inline u32 iop310_sec_read(unsigned long addr)
+{
+	u32 val;
+
+	__asm__ __volatile__(
+		"str	%1, [%2]\n\t"
+		"ldr	%0, [%3]\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		"nop\n\t"
+		: "=r" (val)
+		: "r" (addr), "r" (IOP310_SOCCAR), "r" (IOP310_SOCCDR));
+
+	return val;
+}
+
+static int
+iop310_sec_read_config(struct pci_bus *bus, unsigned int devfn, int where,
+		       int size, u32 *value)
+{
+	unsigned long addr = iop310_cfg_address(bus, devfn, where);
+	u32 val = iop310_sec_read(addr) >> ((where & 3) * 8);
+
+	if (iop310_sec_pci_status())
+		val = 0xffffffff;
+
+	*value = val;
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static int
+iop310_sec_write_config(struct pci_bus *bus, unsigned int devfn, int where,
+			int size, u32 value)
+{
+	unsigned long addr = iop310_cfg_address(bus, devfn, where);
+	u32 val;
+
+	if (size != 4) {
+		val = iop310_sec_read(addr);
+
+		if (!iop310_sec_pci_status() == 0)
+			return PCIBIOS_SUCCESSFUL;
+
+		where = (where & 3) * 8;
+
+		if (size == 1)
+			val &= ~(0xff << where);
+		else
+			val &= ~(0xffff << where);
+
+		*IOP310_SOCCDR = val | value << where;
+	} else {
+		asm volatile(
+			"str	%1, [%2]\n\t"
+			"str	%0, [%3]\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			"nop\n\t"
+			:
+			: "r" (value), "r" (addr),
+			  "r" (IOP310_SOCCAR), "r" (IOP310_SOCCDR));
+	}
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static struct pci_ops iop310_secondary_ops = {
+	.read	= iop310_sec_read_config,
+	.write	= iop310_sec_write_config,
+};
+
+/*
+ * When a PCI device does not exist during config cycles, the 80200 gets
+ * an external abort instead of returning 0xffffffff.  If it was an
+ * imprecise abort, we need to correct the return address to point after
+ * the instruction.  Also note that the Xscale manual says:
+ *
+ *  "if a stall-until-complete LD or ST instruction triggers an
+ *  imprecise fault, then that fault will be seen by the program
+ *  within 3 instructions."
+ *
+ * This does not appear to be the case.  With 8 NOPs after the load, we
+ * see the imprecise abort occurring on the STM of iop310_sec_pci_status()
+ * which is about 10 instructions away.
+ *
+ * Always trust reality!
+ */
+static int
+iop310_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+{
+	DBG("PCI abort: address = 0x%08lx fsr = 0x%03x PC = 0x%08lx LR = 0x%08lx\n",
+		addr, fsr, regs->ARM_pc, regs->ARM_lr);
+
+	/*
+	 * 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;
+}
+
+/*
+ * Scan an IOP310 PCI bus.  sys->bus defines which bus we scan.
+ */
+struct pci_bus *iop310_scan_bus(int nr, struct pci_sys_data *sys)
+{
+	struct pci_ops *ops;
+
+	if (nr)
+		ops = &iop310_secondary_ops;
+	else
+		ops = &iop310_primary_ops;
+
+	return pci_scan_bus(sys->busnr, ops, sys);
+}
+
+/*
+ * Setup the system data for controller 'nr'.   Return 0 if none found,
+ * 1 if found, or negative error.
+ *
+ * We can alter:
+ *  io_offset   - offset between IO resources and PCI bus BARs
+ *  mem_offset  - offset between mem resources and PCI bus BARs
+ *  resource[0] - parent IO resource
+ *  resource[1] - parent non-prefetchable memory resource
+ *  resource[2] - parent prefetchable memory resource
+ *  swizzle     - bridge swizzling function
+ *  map_irq     - irq mapping function
+ *
+ * Note that 'io_offset' and 'mem_offset' are left as zero since
+ * the IOP310 doesn't attempt to perform any address translation
+ * on accesses from the host to the bus.
+ */
+int iop310_setup(int nr, struct pci_sys_data *sys)
+{
+	struct resource *res;
+
+	if (nr >= 2)
+		return 0;
+
+	res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL);
+	if (!res)
+		panic("PCI: unable to alloc resources");
+
+	memset(res, 0, sizeof(struct resource) * 2);
+
+	switch (nr) {
+	case 0:
+		res[0].start = IOP310_PCIPRI_LOWER_IO + 0x6e000000;
+		res[0].end   = IOP310_PCIPRI_LOWER_IO + 0x6e00ffff;
+		res[0].name  = "PCI IO Primary";
+		res[0].flags = IORESOURCE_IO;
+
+		res[1].start = IOP310_PCIPRI_LOWER_MEM;
+		res[1].end   = IOP310_PCIPRI_LOWER_MEM + IOP310_PCI_WINDOW_SIZE;
+		res[1].name  = "PCI Memory Primary";
+		res[1].flags = IORESOURCE_MEM;
+		break;
+
+	case 1:
+		res[0].start = IOP310_PCISEC_LOWER_IO + 0x6e000000;
+		res[0].end   = IOP310_PCISEC_LOWER_IO + 0x6e00ffff;
+		res[0].name  = "PCI IO Secondary";
+		res[0].flags = IORESOURCE_IO;
+
+		res[1].start = IOP310_PCISEC_LOWER_MEM;
+		res[1].end   = IOP310_PCISEC_LOWER_MEM + IOP310_PCI_WINDOW_SIZE;
+		res[1].name  = "PCI Memory Secondary";
+		res[1].flags = IORESOURCE_MEM;
+		break;
+	}
+
+	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;
+	sys->io_offset   = 0x6e000000;
+
+	return 1;
+}
+
+void iop310_init(void)
+{
+	DBG("PCI:  Intel 80312 PCI-to-PCI init code.\n");
+	DBG("  ATU secondary: ATUCR =0x%08x\n", *IOP310_ATUCR);
+	DBG("  ATU secondary: SOMWVR=0x%08x  SOIOWVR=0x%08x\n",
+		*IOP310_SOMWVR,	*IOP310_SOIOWVR);
+	DBG("  ATU secondary: SIABAR=0x%08x  SIALR  =0x%08x SIATVR=%08x\n",
+		*IOP310_SIABAR, *IOP310_SIALR, *IOP310_SIATVR);
+	DBG("  ATU primary:   POMWVR=0x%08x  POIOWVR=0x%08x\n",
+		*IOP310_POMWVR,	*IOP310_POIOWVR);
+	DBG("  ATU primary:   PIABAR=0x%08x  PIALR  =0x%08x PIATVR=%08x\n",
+		*IOP310_PIABAR, *IOP310_PIALR, *IOP310_PIATVR);
+	DBG("  P2P: PCR=0x%04x BCR=0x%04x EBCR=0x%04x\n",
+		*IOP310_PCR, *IOP310_BCR, *IOP310_EBCR);
+
+	/*
+	 * Windows have to be carefully opened via a nice set of calls
+	 * here or just some direct register fiddling in the board
+	 * specific init when we want transactions to occur between the
+	 * two PCI hoses.
+	 *
+	 * To do this, we will have manage RETRY assertion between the
+	 * firmware and the kernel.  This will ensure that the host
+	 * system's enumeration code is held off until we have tweaked
+	 * the interrupt routing and public/private IDSELs.
+	 *
+	 * For now we will simply default to disabling the integrated type
+	 * 81 P2P bridge.
+	 */
+	*IOP310_PCR &= 0xfff8;
+
+	hook_fault_code(16+6, iop310_pci_abort, SIGBUS, "imprecise external abort");
+}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-irq.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-irq.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-irq.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,141 @@
+/*
+ * linux/arch/arm/mach-iop3xx/iq80310-irq.c
+ *
+ * IRQ hadling/demuxing for IQ80310 board
+ *
+ * Author:  Nicolas Pitre
+ * Copyright:   (C) 2001 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.
+ *
+ * 2.4.7-rmk1-iop310.1
+ *     Moved demux from asm to C - DS
+ *     Fixes for various revision boards - DS
+ */
+#include <linux/init.h>
+#include <linux/list.h>
+
+#include <asm/irq.h>
+#include <asm/mach/irq.h>
+#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 *);
+
+static void iq80310_irq_mask(unsigned int irq)
+{
+	*(volatile char *)IQ80310_INT_MASK |= (1 << (irq - IQ80310_IRQ_OFS));
+}
+
+static void iq80310_irq_unmask(unsigned int irq)
+{
+	*(volatile char *)IQ80310_INT_MASK &= ~(1 << (irq - IQ80310_IRQ_OFS));
+}
+
+static struct irqchip iq80310_irq_chip = {
+	.ack	= iq80310_irq_mask,
+	.mask	= iq80310_irq_mask,
+	.unmask = iq80310_irq_unmask,
+};
+
+extern struct irqchip ext_chip;
+
+static void
+iq80310_cpld_irq_handler(unsigned int irq, struct irqdesc *desc,
+			 struct pt_regs *regs)
+{
+	unsigned int irq_stat = *(volatile u8*)IQ80310_INT_STAT;
+	unsigned int irq_mask = *(volatile u8*)IQ80310_INT_MASK;
+	unsigned int i, handled = 0;
+	struct irqdesc *d;
+
+	desc->chip->ack(irq);
+
+	/*
+	 * Mask out the interrupts which aren't enabled.
+	 */
+	irq_stat &= 0x1f & ~irq_mask;
+
+	/*
+	 * Test each IQ80310 CPLD interrupt
+	 */
+	for (i = IRQ_IQ80310_TIMER, d = irq_desc + IRQ_IQ80310_TIMER;
+	     irq_stat; i++, d++, irq_stat >>= 1)
+		if (irq_stat & 1) {
+			d->handle(i, d, regs);
+			handled++;
+		}
+
+	/*
+	 * If running on a board later than REV D.1, we can
+	 * decode the PCI interrupt status.
+	 */
+	if (system_rev) {
+		irq_stat = *((volatile u8*)IQ80310_PCI_INT_STAT) & 7;
+
+		for (i = IRQ_IQ80310_INTA, d = irq_desc + IRQ_IQ80310_INTA;
+		     irq_stat; i++, d++, irq_stat >>= 1)
+			if (irq_stat & 0x1) {
+				d->handle(i, d, regs);
+				handled++;
+			}
+	}
+
+	/*
+	 * If on a REV D.1 or lower board, we just assumed INTA
+	 * since PCI is not routed, and it may actually be an
+	 * on-chip interrupt.
+	 *
+	 * Note that we're giving on-chip interrupts slightly
+	 * higher priority than PCI by handling them first.
+	 *
+	 * On boards later than REV D.1, if we didn't read a
+	 * CPLD interrupt, we assume it's from a device on the
+	 * chipset itself.
+	 */
+	if (system_rev == 0 || handled == 0)
+		iop310_irq_demux(irq, desc, regs);
+
+	desc->chip->unmask(irq);
+}
+
+void __init iq80310_init_irq(void)
+{
+	volatile char *mask = (volatile char *)IQ80310_INT_MASK;
+	unsigned int i;
+
+	iop310_init_irq();
+
+	/*
+	 * Setup PIRSR to route PCI interrupts into xs80200
+	 */
+	*IOP310_PIRSR = 0xff;
+
+	/*
+	 * Setup the IRQs in the FE820000/FE860000 registers
+	 */
+	for (i = IQ80310_IRQ_OFS; i <= IRQ_IQ80310_INTD; i++) {
+		set_irq_chip(i, &iq80310_irq_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
+	}
+
+	/*
+	 * Setup the PCI IRQs
+	 */
+	for (i = IRQ_IQ80310_INTA; i < IRQ_IQ80310_INTC; i++) {
+		set_irq_chip(i, &ext_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID);
+	}
+
+	*mask = 0xff;  /* mask all sources */
+
+	set_irq_chained_handler(IRQ_XS80200_EXTIRQ,
+				&iq80310_cpld_irq_handler);
+}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-pci.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-pci.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-pci.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-pci.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,164 @@
+/*
+ * arch/arm/mach-iop3xx/iq80310-pci.c
+ *
+ * PCI support for the Intel IQ80310 reference board
+ *
+ * Matt Porter <mporter@mvista.com>
+ *
+ * Copyright (C) 2001 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/kernel.h>
+#include <linux/pci.h>
+#include <linux/init.h>
+
+#include <asm/hardware.h>
+#include <asm/irq.h>
+#include <asm/mach/pci.h>
+#include <asm/mach-types.h>
+
+/*
+ * The following macro is used to lookup irqs in a standard table
+ * format for those systems that do not already have PCI
+ * interrupts properly routed.  We assume 1 <= pin <= 4
+ */
+#define PCI_IRQ_TABLE_LOOKUP(minid,maxid)	\
+({ int _ctl_ = -1;				\
+   unsigned int _idsel = idsel - minid;		\
+   if (_idsel <= maxid)				\
+      _ctl_ = pci_irq_table[_idsel][pin-1];	\
+   _ctl_; })
+
+#define INTA	IRQ_IQ80310_INTA
+#define INTB	IRQ_IQ80310_INTB
+#define INTC	IRQ_IQ80310_INTC
+#define INTD	IRQ_IQ80310_INTD
+
+#define INTE	IRQ_IQ80310_I82559
+
+typedef u8 irq_table[4];
+
+/*
+ * IRQ tables for primary bus.
+ *
+ * On a Rev D.1 and older board, INT A-C are not routed, so we
+ * just fake it as INTA and than we take care of handling it
+ * correctly in the IRQ demux routine.
+ */
+static irq_table pci_pri_d_irq_table[] = {
+/* Pin:    A     B     C     D */
+	{ INTA, INTD, INTA, INTA }, /*  PCI Slot J3 */
+	{ INTD, INTA, INTA, INTA }, /*  PCI Slot J4 */
+};
+
+static irq_table pci_pri_f_irq_table[] = {
+/* Pin:    A     B     C     D */
+	{ INTC, INTD, INTA, INTB }, /*  PCI Slot J3 */
+	{ INTD, INTA, INTB, INTC }, /*  PCI Slot J4 */
+};
+
+static int __init
+iq80310_pri_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
+{
+	irq_table *pci_irq_table;
+
+	BUG_ON(pin < 1 || pin > 4);
+
+	if (!system_rev) {
+		pci_irq_table = pci_pri_d_irq_table;
+	} else {
+		pci_irq_table = pci_pri_f_irq_table;
+	}
+
+	return PCI_IRQ_TABLE_LOOKUP(2, 3);
+}
+
+/*
+ * IRQ tables for secondary bus.
+ *
+ * On a Rev D.1 and older board, INT A-C are not routed, so we
+ * just fake it as INTA and than we take care of handling it
+ * correctly in the IRQ demux routine.
+ */
+static irq_table pci_sec_d_irq_table[] = {
+/* Pin:    A     B     C     D */
+	{ INTA, INTA, INTA, INTD }, /*  PCI Slot J1 */
+	{ INTA, INTA, INTD, INTA }, /*  PCI Slot J5 */
+	{ INTE, INTE, INTE, INTE }, /*  P2P Bridge */
+};
+
+static irq_table pci_sec_f_irq_table[] = {
+/* Pin:	   A     B     C     D */
+	{ INTA, INTB, INTC, INTD }, /* PCI Slot J1 */
+	{ INTB, INTC, INTD, INTA }, /* PCI Slot J5 */
+	{ INTE, INTE, INTE, INTE }, /* P2P Bridge */
+};
+
+static int __init
+iq80310_sec_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
+{
+	irq_table *pci_irq_table;
+
+	BUG_ON(pin < 1 || pin > 4);
+
+	if (!system_rev) {
+		pci_irq_table = pci_sec_d_irq_table;
+	} else {
+		pci_irq_table = pci_sec_f_irq_table;
+	}
+
+	return PCI_IRQ_TABLE_LOOKUP(0, 2);
+}
+
+static int iq80310_pri_host;
+
+static int iq80310_setup(int nr, struct pci_sys_data *sys)
+{
+	switch (nr) {
+	case 0:
+		if (!iq80310_pri_host)
+			return 0;
+
+		sys->map_irq = iq80310_pri_map_irq;
+		break;
+
+	case 1:
+		sys->map_irq = iq80310_sec_map_irq;
+		break;
+
+	default:
+		return 0;
+	}
+
+	return iop310_setup(nr, sys);
+}
+
+static void iq80310_preinit(void)
+{
+	iq80310_pri_host = *(volatile u32 *)IQ80310_BACKPLANE & 1;
+
+	printk(KERN_INFO "PCI: IQ80310 is a%s\n",
+		iq80310_pri_host ? " system controller" : "n agent");
+
+	iop310_init();
+}
+
+static struct hw_pci iq80310_pci __initdata = {
+	.swizzle	= pci_std_swizzle,
+	.nr_controllers = 2,
+	.setup		= iq80310_setup,
+	.scan		= iop310_scan_bus,
+	.preinit	= iq80310_preinit,
+};
+
+static int __init iq80310_pci_init(void)
+{
+	if (machine_is_iq80310())
+		pci_common_init(&iq80310_pci);
+	return 0;
+}
+
+subsys_initcall(iq80310_pci_init);
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-time.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-time.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/iq80310-time.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/iq80310-time.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,134 @@
+/*
+ * linux/arch/arm/mach-iop3xx/time-iq80310.c
+ *
+ * Timer functions for IQ80310 onboard timer
+ *
+ * Author:  Nicolas Pitre
+ * Copyright:   (C) 2001 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/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/time.h>
+#include <linux/init.h>
+#include <linux/timex.h>
+
+#include <asm/hardware.h>
+#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)
+{
+	volatile u_char *la0 = (volatile u_char *)IQ80310_TIMER_LA0;
+	volatile u_char *la1 = (volatile u_char *)IQ80310_TIMER_LA1;
+	volatile u_char *la2 = (volatile u_char *)IQ80310_TIMER_LA2;
+
+	*la0 = val;
+	*la1 = val >> 8;
+	*la2 = (val >> 16) & 0x3f;
+}
+
+static u_long iq80310_read_timer (void)
+{
+	volatile u_char *la0 = (volatile u_char *)IQ80310_TIMER_LA0;
+	volatile u_char *la1 = (volatile u_char *)IQ80310_TIMER_LA1;
+	volatile u_char *la2 = (volatile u_char *)IQ80310_TIMER_LA2;
+	volatile u_char *la3 = (volatile u_char *)IQ80310_TIMER_LA3;
+	u_long b0, b1, b2, b3, val;
+
+	b0 = *la0; b1 = *la1; b2 = *la2; b3 = *la3;
+	b0 = (((b0 & 0x40) >> 1) | (b0 & 0x1f));
+	b1 = (((b1 & 0x40) >> 1) | (b1 & 0x1f));
+	b2 = (((b2 & 0x40) >> 1) | (b2 & 0x1f));
+	b3 = (b3 & 0x0f);
+	val = ((b0 << 0) | (b1 << 6) | (b2 << 12) | (b3 << 18));
+	return val;
+}
+
+/*
+ * IRQs are disabled before entering here from do_gettimeofday().
+ * Note that the counter may wrap.  When it does, 'elapsed' will
+ * be small, but we will have a pending interrupt.
+ */
+static unsigned long iq80310_gettimeoffset (void)
+{
+	unsigned long elapsed, usec;
+	unsigned int stat1, stat2;
+
+	stat1 = *(volatile u8 *)IQ80310_INT_STAT;
+	elapsed = iq80310_read_timer();
+	stat2 = *(volatile u8 *)IQ80310_INT_STAT;
+
+	/*
+	 * If an interrupt was pending before we read the timer,
+	 * we've already wrapped.  Factor this into the time.
+	 * If an interrupt was pending after we read the timer,
+	 * it may have wrapped between checking the interrupt
+	 * status and reading the timer.  Re-read the timer to
+	 * be sure its value is after the wrap.
+	 */
+	if (stat1 & 1)
+		elapsed += LATCH;
+	else if (stat2 & 1)
+		elapsed = LATCH + iq80310_read_timer();
+
+	/*
+	 * Now convert them to usec.
+	 */
+	usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
+
+	return usec;
+}
+
+
+static void iq80310_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
+
+	/* clear timer interrupt */
+	*timer_en &= ~2;
+	*timer_en |= 2;
+
+	/*
+	 * AHEM..HACK
+	 *
+	 * Since the timer interrupt is cascaded through the CPLD and
+	 * the 80312 and the demux code calls do_IRQ, the irq count is
+	 * going to be atleast 2 when we get here and this will cause the
+	 * kernel to increment the system tick counter even if we're
+	 * idle. This causes it to look like there's always 100% system
+	 * time, which is not the case.  To get around it, we just decrement
+	 * the IRQ count before calling do_timer. We increment it again
+	 * b/c otherwise it will go negative and than bad things happen.
+	 *
+	 * -DS
+	 */
+	do_timer(regs);
+}
+
+extern unsigned long (*gettimeoffset)(void);
+
+static struct irqaction timer_irq = {
+	.name		= "timer",
+	.handler	= iq80310_timer_interrupt,
+};
+
+
+void __init time_init(void)
+{
+	volatile u_char *timer_en = (volatile u_char *)IQ80310_TIMER_EN;
+
+	gettimeoffset = iq80310_gettimeoffset;
+	setup_irq(IRQ_IQ80310_TIMER, &timer_irq);
+	*timer_en = 0;
+	iq80310_write_timer(LATCH);
+	*timer_en |= 2;
+	*timer_en |= 1;
+}
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/mm.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/mm.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/mm.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/mm.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,70 @@
+/*
+ * linux/arch/arm/mach-iop3xx/mm.c
+ *
+ * Low level memory initialization for IOP310 based systems
+ *
+ * Author: Nicolas Pitre <npitre@mvista.com>
+ *
+ * Copyright 2000-2001 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.
+ *
+ */
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+
+#include <asm/mach/map.h>
+#include <asm/mach-types.h>
+
+#ifdef CONFIG_IOP310_MU
+#include "message.h"
+#endif
+
+/*
+ * Standard IO mapping for all IOP310 based systems
+ */
+static struct map_desc iop80310_std_desc[] __initdata = {
+ /* virtual     physical      length       type */
+ // IOP310 Memory Mapped Registers
+ { 0xe8001000,  0x00001000,   0x00001000,  MT_DEVICE },
+ // PCI I/O Space
+ { 0xfe000000,  0x90000000,   0x00020000,  MT_DEVICE }
+};
+
+void __init iop310_map_io(void)
+{
+	iotable_init(iop80310_std_desc, ARRAY_SIZE(iop80310_std_desc));
+}
+
+/*
+ * IQ80310 specific IO mappings
+ */
+#ifdef CONFIG_ARCH_IQ80310
+static struct map_desc iq80310_io_desc[] __initdata = {
+ /* virtual     physical      length        type */
+ // IQ80310 On-Board Devices
+ { 0xfe800000,  0xfe800000,   0x00100000,   MT_DEVICE }
+};
+
+void __init iq80310_map_io(void)
+{
+#ifdef CONFIG_IOP310_MU
+	/* acquiring 1MB of memory aligned on 1MB boundary for MU */
+	mu_mem = __alloc_bootmem(0x100000, 0x100000, 0);
+#endif
+
+	iop310_map_io();
+
+	iotable_init(iq80310_io_desc, ARRAY_SIZE(iq80310_io_desc));
+}
+#endif // CONFIG_ARCH_IQ80310
+
diff -urN linux-2.5.67-bk5/arch/arm/mach-iop3xx/xs80200-irq.c linux-2.5.67-bk6/arch/arm/mach-iop3xx/xs80200-irq.c
--- linux-2.5.67-bk5/arch/arm/mach-iop3xx/xs80200-irq.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/arm/mach-iop3xx/xs80200-irq.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,65 @@
+/*
+ * linux/arch/arm/mach-iop3xx/xs80200-irq.c
+ *
+ * Generic IRQ handling for the XS80200 XScale core.
+ *
+ * Author:  Nicolas Pitre
+ * Copyright:   (C) 2001 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/list.h>
+
+#include <asm/mach/irq.h>
+#include <asm/irq.h>
+#include <asm/hardware.h>
+
+#include <asm/mach-types.h>
+
+static void xs80200_irq_mask (unsigned int irq)
+{
+	unsigned long intctl;
+	asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
+	switch (irq) {
+	    case IRQ_XS80200_BCU:     intctl &= ~(1<<3); break;
+	    case IRQ_XS80200_PMU:     intctl &= ~(1<<2); break;
+	    case IRQ_XS80200_EXTIRQ:  intctl &= ~(1<<1); break;
+	    case IRQ_XS80200_EXTFIQ:  intctl &= ~(1<<0); break;
+	}
+	asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
+}
+
+static void xs80200_irq_unmask (unsigned int irq)
+{
+	unsigned long intctl;
+	asm ("mrc p13, 0, %0, c0, c0, 0" : "=r" (intctl));
+	switch (irq) {
+	    case IRQ_XS80200_BCU:	intctl |= (1<<3); break;
+	    case IRQ_XS80200_PMU:	intctl |= (1<<2); break;
+	    case IRQ_XS80200_EXTIRQ:	intctl |= (1<<1); break;
+	    case IRQ_XS80200_EXTFIQ:	intctl |= (1<<0); break;
+	}
+	asm ("mcr p13, 0, %0, c0, c0, 0" : : "r" (intctl));
+}
+
+static struct irqchip xs80200_chip = {
+	.ack	= xs80200_irq_mask,
+	.mask	= xs80200_irq_mask,
+	.unmask = xs80200_irq_unmask,
+};
+
+void __init xs80200_init_irq(void)
+{
+	unsigned int i;
+
+	asm("mcr p13, 0, %0, c0, c0, 0" : : "r" (0));
+
+	for (i = 0; i < NR_XS80200_IRQS; i++) {
+		set_irq_chip(i, &xs80200_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID);
+	}
+}
diff -urN linux-2.5.67-bk5/arch/arm/mach-sa1100/badge4.c linux-2.5.67-bk6/arch/arm/mach-sa1100/badge4.c
--- linux-2.5.67-bk5/arch/arm/mach-sa1100/badge4.c	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mach-sa1100/badge4.c	2003-04-15 04:36:14.000000000 -0700
@@ -186,11 +186,26 @@
   {0xf4000000, 0x48000000, 0x00100000, MT_DEVICE } /* SA-1111      */
 };
 
+static void
+badge4_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
+{
+	if (!state) {
+		Ser1SDCR0 |= SDCR0_UART;
+	}
+}
+
+static struct sa1100_port_fns badge4_port_fns __initdata = {
+	//.get_mctrl	= badge4_get_mctrl,
+	//.set_mctrl	= badge4_set_mctrl,
+	.pm		= badge4_uart_pm,
+};
+
 static void __init badge4_map_io(void)
 {
 	sa1100_map_io();
 	iotable_init(badge4_io_desc, ARRAY_SIZE(badge4_io_desc));
 
+	sa1100_register_uart_fns(&badge4_port_fns);
 	sa1100_register_uart(0, 3);
 	sa1100_register_uart(1, 1);
 }
diff -urN linux-2.5.67-bk5/arch/arm/mm/copypage-xscale.S linux-2.5.67-bk6/arch/arm/mm/copypage-xscale.S
--- linux-2.5.67-bk5/arch/arm/mm/copypage-xscale.S	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mm/copypage-xscale.S	2003-04-15 04:36:14.000000000 -0700
@@ -39,11 +39,25 @@
 	mov	r0, r1
 	bl	map_page_minicache
 	mov	r1, r5
-	mov	lr, #PAGE_SZ/32
+	mov	lr, #PAGE_SZ/64-1
 
-1:	mov	ip, r1
-	ldrd	r2, [r0], #8
+	/*
+	 * Strangely enough, best performance is achieved
+	 * when prefetching destination as well.  (NP)
+	 */
+	pld	[r0, #0]
+	pld	[r0, #32]
+	pld	[r1, #0]
+	pld	[r1, #32]
+
+1:	pld	[r0, #64]
+	pld	[r0, #96]
+	pld	[r1, #64]
+	pld	[r1, #96]
+
+2:	ldrd	r2, [r0], #8
 	ldrd	r4, [r0], #8
+	mov	ip, r1
 	strd	r2, [r1], #8
 	ldrd	r2, [r0], #8
 	strd	r4, [r1], #8
@@ -51,9 +65,21 @@
 	strd	r2, [r1], #8
 	strd	r4, [r1], #8
 	mcr	p15, 0, ip, c7, c10, 1		@ clean D line
+	ldrd	r2, [r0], #8
 	mcr	p15, 0, ip, c7, c6, 1		@ invalidate D line
+	ldrd	r4, [r0], #8
+	mov	ip, r1
+	strd	r2, [r1], #8
+	ldrd	r2, [r0], #8
+	strd	r4, [r1], #8
+	ldrd	r4, [r0], #8
+	strd	r2, [r1], #8
+	strd	r4, [r1], #8
+	mcr	p15, 0, ip, c7, c10, 1		@ clean D line
 	subs	lr, lr, #1
-	bne	1b
+	mcr	p15, 0, ip, c7, c6, 1		@ invalidate D line
+	bgt	1b
+	beq	2b
 
 	ldmfd	sp!, {r4, r5, pc}
 
@@ -64,7 +90,6 @@
  *  r1 = virtual user address of ultimate destination page
  */
 ENTRY(xscale_mc_clear_user_page)
-	str	lr, [sp, #-4]!
 	mov	r1, #PAGE_SZ/32
 	mov	r2, #0
 	mov	r3, #0
@@ -74,10 +99,10 @@
 	strd	r2, [r0], #8
 	strd	r2, [r0], #8
 	mcr	p15, 0, ip, c7, c10, 1		@ clean D line
-	mcr	p15, 0, ip, c7, c6, 1		@ invalidate D line
 	subs	r1, r1, #1
+	mcr	p15, 0, ip, c7, c6, 1		@ invalidate D line
 	bne	1b
-	ldr	pc, [sp], #4
+	mov	pc, lr
 
 	__INIT
 
diff -urN linux-2.5.67-bk5/arch/arm/mm/extable.c linux-2.5.67-bk6/arch/arm/mm/extable.c
--- linux-2.5.67-bk5/arch/arm/mm/extable.c	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mm/extable.c	2003-04-15 04:36:14.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  linux/arch/arm/mm/extable.c
  */
-#include <linux/config.h>
+#include <linux/module.h>
 #include <asm/uaccess.h>
 
 const struct exception_table_entry *
@@ -24,3 +24,14 @@
         }
         return NULL;
 }
+
+int fixup_exception(struct pt_regs *regs)
+{
+	const struct exception_table_entry *fixup;
+
+	fixup = search_exception_tables(instruction_pointer(regs));
+	if (fixup)
+		regs->ARM_pc = fixup->fixup;
+
+	return fixup != NULL;
+}
diff -urN linux-2.5.67-bk5/arch/arm/mm/fault-common.c linux-2.5.67-bk6/arch/arm/mm/fault-common.c
--- linux-2.5.67-bk5/arch/arm/mm/fault-common.c	2003-04-07 10:31:47.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/mm/fault-common.c	2003-04-15 04:36:14.000000000 -0700
@@ -25,6 +25,7 @@
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
+#include <asm/uaccess.h>
 
 #include "fault.h"
 
@@ -103,20 +104,11 @@
 __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
 		  struct pt_regs *regs)
 {
-	const struct exception_table_entry *fixup;
-
 	/*
 	 * Are we prepared to handle this kernel fault?
 	 */
-	fixup = search_exception_tables(instruction_pointer(regs));
-	if (fixup) {
-#ifdef DEBUG
-		printk(KERN_DEBUG "%s: Exception at [<%lx>] addr=%lx (fixup: %lx)\n",
-			current->comm, regs->ARM_pc, addr, fixup->fixup);
-#endif
-		regs->ARM_pc = fixup->fixup;
+	if (fixup_exception(regs))
 		return;
-	}
 
 	/*
 	 * No handler, we'll have to terminate things with extreme prejudice.
diff -urN linux-2.5.67-bk5/arch/arm/nwfpe/fpmodule.h linux-2.5.67-bk6/arch/arm/nwfpe/fpmodule.h
--- linux-2.5.67-bk5/arch/arm/nwfpe/fpmodule.h	2003-04-07 10:32:20.000000000 -0700
+++ linux-2.5.67-bk6/arch/arm/nwfpe/fpmodule.h	2003-04-15 04:36:14.000000000 -0700
@@ -17,21 +17,15 @@
     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.
+
+    27/03/03 Ian Molton Clean up CONFIG_CPU
 */
 
 #ifndef __FPMODULE_H__
 #define __FPMODULE_H__
 
-#include <linux/config.h>
-
-#ifdef CONFIG_CPU_32
 #define REG_ORIG_R0	17
 #define REG_CPSR	16
-#else
-#define REG_ORIG_R0	16
-#define REG_CPSR	15
-#endif
-
 #define REG_PC		15
 #define REG_LR		14
 #define REG_SP		13
diff -urN linux-2.5.67-bk5/arch/i386/boot/compressed/misc.c linux-2.5.67-bk6/arch/i386/boot/compressed/misc.c
--- linux-2.5.67-bk5/arch/i386/boot/compressed/misc.c	2003-04-07 10:31:48.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/boot/compressed/misc.c	2003-04-15 04:36:14.000000000 -0700
@@ -12,6 +12,7 @@
 #include <linux/linkage.h>
 #include <linux/vmalloc.h>
 #include <linux/tty.h>
+#include <video/edid.h>
 #include <asm/io.h>
 
 /*
@@ -91,6 +92,7 @@
 #define ALT_MEM_K   (*(unsigned long *)(real_mode + 0x1e0))
 #endif
 #define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
+#define EDID_INFO   (*(struct edid_info *)(real_mode+0x440))
 
 extern char input_data[];
 extern int input_len;
diff -urN linux-2.5.67-bk5/arch/i386/boot/video.S linux-2.5.67-bk6/arch/i386/boot/video.S
--- linux-2.5.67-bk5/arch/i386/boot/video.S	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/boot/video.S	2003-04-15 04:36:14.000000000 -0700
@@ -133,6 +133,7 @@
 #ifdef CONFIG_VIDEO_RETAIN
 	call	restore_screen			# Restore screen contents
 #endif /* CONFIG_VIDEO_RETAIN */
+	call	store_edid
 #endif /* CONFIG_VIDEO_SELECT */
 	call	mode_params			# Store mode parameters
 	popw	%ds				# Restore original DS
@@ -1887,6 +1888,39 @@
 	popw	%ax
 	ret
 
+store_edid:
+	pushw	%es				# just save all registers 
+	pushw	%ax				
+	pushw	%bx
+	pushw   %cx
+	pushw	%dx
+	pushw   %di
+
+	pushw	%fs                             
+	popw    %es
+
+	movl	$0x13131313, %eax		# memset block with 0x13
+	movw    $32, %cx
+	movw	$0x440, %di
+	cld
+	rep 
+	stosl  
+
+	movw	$0x4f15, %ax                    # do VBE/DDC 
+	movw	$0x01, %bx
+	movw	$0x00, %cx
+	movw    $0x01, %dx
+	movw	$0x440, %di
+	int	$0x10	
+
+	popw	%di				# restore all registers        
+	popw	%dx
+	popw	%cx
+	popw	%bx
+	popw	%ax
+	popw	%es	
+	ret
+
 # VIDEO_SELECT-only variables
 mt_end:		.word	0	# End of video mode table if built
 edit_buf:	.space	6	# Line editor buffer
diff -urN linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/k7.c linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/k7.c
--- linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/k7.c	2003-04-07 10:31:46.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/k7.c	2003-04-15 04:36:14.000000000 -0700
@@ -92,8 +92,4 @@
 	set_in_cr4 (X86_CR4_MCE);
 	printk (KERN_INFO "Intel machine check reporting enabled on CPU#%d.\n",
 		smp_processor_id());
-
-#ifdef CONFIG_X86_MCE_NONFATAL
-	init_nonfatal_mce_checker();
-#endif
 }
diff -urN linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/mce.h linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/mce.h
--- linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/mce.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/mce.h	2003-04-15 04:36:14.000000000 -0700
@@ -6,8 +6,6 @@
 void intel_p6_mcheck_init(struct cpuinfo_x86 *c);
 void winchip_mcheck_init(struct cpuinfo_x86 *c);
 
-void init_nonfatal_mce_checker(void);
-
 /* Call the installed machine check handler for this CPU setup. */
 extern void (*machine_check_vector)(struct pt_regs *, long error_code);
 
diff -urN linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/non-fatal.c linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/non-fatal.c
--- linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/non-fatal.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/non-fatal.c	2003-04-15 04:36:14.000000000 -0700
@@ -11,6 +11,7 @@
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
 #include <linux/smp.h>
+#include <linux/module.h>
 
 #include <asm/processor.h> 
 #include <asm/system.h>
@@ -65,7 +66,7 @@
 	add_timer (&mce_timer);
 }	
 
-void init_nonfatal_mce_checker()
+static int __init init_nonfatal_mce_checker(void)
 {
 	if (timerset == 0) {
 		/* Set the timer to check for non-fatal
@@ -78,4 +79,6 @@
 		timerset = 1;
 		printk(KERN_INFO "Machine check exception polling timer started.\n");
 	}
+	return 0;
 }
+module_init(init_nonfatal_mce_checker);
diff -urN linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/p4.c linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/p4.c
--- linux-2.5.67-bk5/arch/i386/kernel/cpu/mcheck/p4.c	2003-04-07 10:31:52.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/cpu/mcheck/p4.c	2003-04-15 04:36:14.000000000 -0700
@@ -255,7 +255,4 @@
 		intel_init_thermal(c);
 #endif
 	}
-#ifdef CONFIG_X86_MCE_NONFATAL
-	init_nonfatal_mce_checker();
-#endif
 }
diff -urN linux-2.5.67-bk5/arch/i386/kernel/i386_ksyms.c linux-2.5.67-bk6/arch/i386/kernel/i386_ksyms.c
--- linux-2.5.67-bk5/arch/i386/kernel/i386_ksyms.c	2003-04-07 10:33:01.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/i386_ksyms.c	2003-04-15 04:36:14.000000000 -0700
@@ -79,6 +79,7 @@
 EXPORT_SYMBOL(dump_thread);
 EXPORT_SYMBOL(dump_fpu);
 EXPORT_SYMBOL(dump_extended_fpu);
+EXPORT_SYMBOL_GPL(kernel_fpu_begin);
 EXPORT_SYMBOL(__ioremap);
 EXPORT_SYMBOL(ioremap_nocache);
 EXPORT_SYMBOL(iounmap);
diff -urN linux-2.5.67-bk5/arch/i386/kernel/io_apic.c linux-2.5.67-bk6/arch/i386/kernel/io_apic.c
--- linux-2.5.67-bk5/arch/i386/kernel/io_apic.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/io_apic.c	2003-04-15 04:36:14.000000000 -0700
@@ -1479,7 +1479,8 @@
 void /*__init*/ print_PIC(void)
 {
 	extern spinlock_t i8259A_lock;
-	unsigned int v, flags;
+	unsigned int v;
+	unsigned long flags;
 
 	printk(KERN_DEBUG "\nprinting PIC contents\n");
 
diff -urN linux-2.5.67-bk5/arch/i386/kernel/nmi.c linux-2.5.67-bk6/arch/i386/kernel/nmi.c
--- linux-2.5.67-bk5/arch/i386/kernel/nmi.c	2003-04-07 10:31:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/nmi.c	2003-04-15 04:36:14.000000000 -0700
@@ -181,11 +181,13 @@
 #ifdef CONFIG_PM
 
 #include <linux/device.h>
+static int nmi_pm_active; /* nmi_active before suspend */
 
 static int lapic_nmi_suspend(struct device *dev, u32 state, u32 level)
 {
 	if (level != SUSPEND_POWER_DOWN)
 		return 0;
+	nmi_pm_active = nmi_active;
 	disable_lapic_nmi_watchdog();
 	return 0;
 }
@@ -194,7 +196,8 @@
 {
 	if (level != RESUME_POWER_ON)
 		return 0;
-	enable_lapic_nmi_watchdog();
+	if (nmi_pm_active > 0)
+		enable_lapic_nmi_watchdog();
 	return 0;
 }
 
diff -urN linux-2.5.67-bk5/arch/i386/kernel/setup.c linux-2.5.67-bk6/arch/i386/kernel/setup.c
--- linux-2.5.67-bk5/arch/i386/kernel/setup.c	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/kernel/setup.c	2003-04-15 04:36:14.000000000 -0700
@@ -37,6 +37,7 @@
 #include <linux/console.h>
 #include <linux/root_dev.h>
 #include <linux/highmem.h>
+#include <video/edid.h>
 #include <asm/e820.h>
 #include <asm/mpspec.h>
 #include <asm/edd.h>
@@ -85,7 +86,7 @@
 	unsigned short length;
 	unsigned char table[0];
 };
-
+struct edid_info edid_info;
 struct e820map e820;
 
 unsigned char aux_device_present;
@@ -883,6 +884,7 @@
  	ROOT_DEV = ORIG_ROOT_DEV;
  	drive_info = DRIVE_INFO;
  	screen_info = SCREEN_INFO;
+	edid_info = EDID_INFO;
 	apm_info.bios = APM_BIOS_INFO;
 	saved_videomode = VIDEO_MODE;
 	printk("Video mode to be used for restore is %lx\n", saved_videomode);
diff -urN linux-2.5.67-bk5/arch/i386/oprofile/op_model_p4.c linux-2.5.67-bk6/arch/i386/oprofile/op_model_p4.c
--- linux-2.5.67-bk5/arch/i386/oprofile/op_model_p4.c	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/arch/i386/oprofile/op_model_p4.c	2003-04-15 04:36:14.000000000 -0700
@@ -31,7 +31,6 @@
 #define NUM_CONTROLS_HT2 (NUM_ESCRS_HT2 + NUM_CCCRS_HT2)
 
 static unsigned int num_counters = NUM_COUNTERS_NON_HT;
-static unsigned int num_cccrs = NUM_CCCRS_NON_HT;
 
 
 /* this has to be checked dynamically since the
@@ -40,10 +39,17 @@
 static inline void setup_num_counters(void)
 {
 #ifdef CONFIG_SMP
-	if (smp_num_siblings == 2) {		
+	if (smp_num_siblings == 2)
 		num_counters = NUM_COUNTERS_HT2;
-		num_cccrs = NUM_CCCRS_HT2;
-	}
+#endif
+}
+
+static int inline addr_increment(void)
+{
+#ifdef CONFIG_SMP
+	return smp_num_siblings == 2 ? 2 : 1;
+#else
+	return 1;
 #endif
 }
 
@@ -65,7 +71,7 @@
 };
 
 /* nb: these CTR_* defines are a duplicate of defines in
-   libop/op_events.c. */
+   event/i386.p4*events. */
 
 
 #define CTR_BPU_0      (1 << 0)
@@ -88,6 +94,17 @@
 	{ CTR_IQ_5,    MSR_P4_IQ_PERFCTR5,    MSR_P4_IQ_CCCR5 }
 };
 
+#define NUM_UNUSED_CCCRS	NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT
+
+/* All cccr we don't use. */
+static int p4_unused_cccr[NUM_UNUSED_CCCRS] = {
+	MSR_P4_BPU_CCCR1,	MSR_P4_BPU_CCCR3,
+	MSR_P4_MS_CCCR1,	MSR_P4_MS_CCCR3,
+	MSR_P4_FLAME_CCCR1,	MSR_P4_FLAME_CCCR3,
+	MSR_P4_IQ_CCCR0,	MSR_P4_IQ_CCCR1,
+	MSR_P4_IQ_CCCR2,	MSR_P4_IQ_CCCR3
+};
+
 /* p4 event codes in libop/op_event.h are indices into this table. */
 
 static struct p4_event_binding p4_events[NUM_EVENTS] = {
@@ -167,13 +184,13 @@
 	{ /* IOQ_ALLOCATION */
 		0x06, 0x03, 
 		{ { CTR_BPU_0, MSR_P4_FSB_ESCR0},
-		  {-1,-1} }
+		  { 0, 0 } }
 	},
 
 	{ /* IOQ_ACTIVE_ENTRIES */
 		0x06, 0x1a, 
 		{ { CTR_BPU_2, MSR_P4_FSB_ESCR1},
-		  {-1,-1} }
+		  { 0, 0 } }
 	},
 
 	{ /* FSB_DATA_ACTIVITY */
@@ -185,13 +202,13 @@
 	{ /* BSQ_ALLOCATION */
 		0x07, 0x05, 
 		{ { CTR_BPU_0, MSR_P4_BSU_ESCR0},
-		  {-1,-1} }
+		  { 0, 0 } }
 	},
 
 	{ /* BSQ_ACTIVE_ENTRIES */
 		0x07, 0x06,
 		{ { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */},  
-		  {-1,-1} }
+		  { 0, 0 } }
 	},
 
 	{ /* X87_ASSIST */
@@ -336,7 +353,7 @@
 #define ESCR_SET_OS_0(escr, os) ((escr) |= (((os) & 1) << 3))
 #define ESCR_SET_USR_1(escr, usr) ((escr) |= (((usr) & 1)))
 #define ESCR_SET_OS_1(escr, os) ((escr) |= (((os) & 1) << 1))
-#define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x1f) << 25))
+#define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x3f) << 25))
 #define ESCR_SET_EVENT_MASK(escr, mask) ((escr) |= (((mask) & 0xffff) << 9))
 #define ESCR_READ(escr,high,ev,i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0);
 #define ESCR_WRITE(escr,high,ev,i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0);
@@ -358,15 +375,11 @@
 #define CTR_WRITE(l,i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1);} while (0);
 #define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000))
 
-/* these access the underlying cccrs 1-18, not the subset of 8 bound to "virtual counters" */
-#define RAW_CCCR_READ(low, high, i) do {rdmsr (MSR_P4_BPU_CCCR0 + (i), (low), (high));} while (0);
-#define RAW_CCCR_WRITE(low, high, i) do {wrmsr (MSR_P4_BPU_CCCR0 + (i), (low), (high));} while (0);
-
 
 /* this assigns a "stagger" to the current CPU, which is used throughout
    the code in this module as an extra array offset, to select the "even"
    or "odd" part of all the divided resources. */
-static inline unsigned int get_stagger(void)
+static unsigned int get_stagger(void)
 {
 #ifdef CONFIG_SMP
 	int cpu;
@@ -395,29 +408,33 @@
 	setup_num_counters();
 	stag = get_stagger();
 
-	/* the 8 counter registers we pay attention to */
-	for (i = 0; i < num_counters; ++i)
+	/* the counter registers we pay attention to */
+	for (i = 0; i < num_counters; ++i) {
 		msrs->counters.addrs[i] = 
 			p4_counters[VIRT_CTR(stag, i)].counter_address;
+	}
+
+	/* FIXME: bad feeling, we don't save the 10 counters we don't use. */
 
 	/* 18 CCCR registers */
-	for (i=stag, addr = MSR_P4_BPU_CCCR0;
-	     addr <= MSR_P4_IQ_CCCR5; ++i, addr += (1 + stag)) 
+	for (i = 0, addr = MSR_P4_BPU_CCCR0 + stag;
+	     addr <= MSR_P4_IQ_CCCR5; ++i, addr += addr_increment()) {
 		msrs->controls.addrs[i] = addr;
+	}
 	
-	/* 43 ESCR registers */
-	for (addr = MSR_P4_BSU_ESCR0;
-	     addr <= MSR_P4_SSU_ESCR0; ++i, addr += (1 + stag)){ 
+	/* 43 ESCR registers in three discontiguous group */
+	for (addr = MSR_P4_BSU_ESCR0 + stag;
+	     addr <= MSR_P4_SSU_ESCR0; ++i, addr += addr_increment()) { 
 		msrs->controls.addrs[i] = addr;
 	}
 	
-	for (addr = MSR_P4_MS_ESCR0;
-	     addr <= MSR_P4_TC_ESCR1; ++i, addr += (1 + stag)){ 
+	for (addr = MSR_P4_MS_ESCR0 + stag;
+	     addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { 
 		msrs->controls.addrs[i] = addr;
 	}
 	
-	for (addr = MSR_P4_IX_ESCR0;
-	     addr <= MSR_P4_CRU_ESCR3; ++i, addr += (1 + stag)){ 
+	for (addr = MSR_P4_IX_ESCR0 + stag;
+	     addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { 
 		msrs->controls.addrs[i] = addr;
 	}
 
@@ -435,7 +452,7 @@
 
 	} else {
 		/* and two copies of the second to the odd thread,
-		   for the 31st and 32nd control registers */
+		   for the 22st and 23nd control registers */
 		msrs->controls.addrs[i++] = MSR_P4_CRU_ESCR5;
 		msrs->controls.addrs[i++] = MSR_P4_CRU_ESCR5;
 	}
@@ -456,7 +473,7 @@
 	stag = get_stagger();
 	
 	/* convert from counter *number* to counter *bit* */
-	counter_bit = 1 << ctr;
+	counter_bit = 1 << VIRT_CTR(stag, ctr);
 	
 	/* find our event binding structure. */
 	if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) {
@@ -470,7 +487,7 @@
 	
 	for (i = 0; i < maxbind; i++) {
 		if (ev->bindings[i].virt_counter & counter_bit) {
-			
+
 			/* modify ESCR */
 			ESCR_READ(escr, high, ev, i);
 			ESCR_CLEAR(escr);
@@ -499,6 +516,10 @@
 			return;
 		}
 	}
+
+	printk(KERN_ERR 
+	       "oprofile: P4 event code 0x%lx no binding, stag %d ctr %d\n",
+	       counter_config[ctr].event, stag, ctr);
 }
 
 
@@ -517,27 +538,35 @@
 		return;
 	}
 
-	/* clear all cccrs (including those outside our concern) */
-	for (i = stag ; i < num_cccrs ; i += (1 + stag)) {
-		RAW_CCCR_READ(low, high, i);
+	/* clear the cccrs we will use */
+	for (i = 0 ; i < num_counters ; i++) {
+		rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high);
+		CCCR_CLEAR(low);
+		CCCR_SET_REQUIRED_BITS(low);
+		wrmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high);
+	}
+
+	/* clear cccrs outside our concern */
+	for (i = stag ; i < NUM_UNUSED_CCCRS ; i += addr_increment()) {
+		rdmsr(p4_unused_cccr[i], low, high);
 		CCCR_CLEAR(low);
 		CCCR_SET_REQUIRED_BITS(low);
-		RAW_CCCR_WRITE(low, high, i);
+		wrmsr(p4_unused_cccr[i], low, high);
 	}
 
-	/* clear all escrs (including those outside out concern) */
+	/* clear all escrs (including those outside our concern) */
 	for (addr = MSR_P4_BSU_ESCR0 + stag;
-	     addr <= MSR_P4_SSU_ESCR0; addr += (1 + stag)){ 
+	     addr <= MSR_P4_SSU_ESCR0; addr += addr_increment()) { 
 		wrmsr(addr, 0, 0);
 	}
 	
 	for (addr = MSR_P4_MS_ESCR0 + stag;
-	     addr <= MSR_P4_TC_ESCR1; addr += (1 + stag)){ 
+	     addr <= MSR_P4_TC_ESCR1; addr += addr_increment()){ 
 		wrmsr(addr, 0, 0);
 	}
 	
 	for (addr = MSR_P4_IX_ESCR0 + stag;
-	     addr <= MSR_P4_CRU_ESCR3; addr += (1 + stag)){ 
+	     addr <= MSR_P4_CRU_ESCR3; addr += addr_increment()){ 
 		wrmsr(addr, 0, 0);
 	}
 
@@ -576,7 +605,7 @@
 
 	for (i = 0; i < num_counters; ++i) {
 		
-		if (!counter_config[i].event) 
+		if (!reset_value[i]) 
 			continue;
 
 		/* 
@@ -606,8 +635,6 @@
 			CCCR_CLEAR_OVF(low);
 			CCCR_WRITE(low, high, real);
  			CTR_WRITE(reset_value[i], real);
-			/* P4 quirk: you have to re-unmask the apic vector */
-			apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
 		}
 	}
 
diff -urN linux-2.5.67-bk5/arch/ia64/ia32/ia32_entry.S linux-2.5.67-bk6/arch/ia64/ia32/ia32_entry.S
--- linux-2.5.67-bk5/arch/ia64/ia32/ia32_entry.S	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/ia64/ia32/ia32_entry.S	2003-04-15 04:36:14.000000000 -0700
@@ -439,8 +439,8 @@
 	data8 sys_ni_syscall
 	data8 sys_ni_syscall
 	data8 compat_sys_futex	/* 240 */
-	data8 sys_ni_syscall
-	data8 sys_ni_syscall
+	data8 compat_sys_setaffinity
+	data8 compat_sys_getaffinity
 	data8 sys_ni_syscall
 	data8 sys_ni_syscall
 	data8 sys_ni_syscall	/* 245 */
diff -urN linux-2.5.67-bk5/arch/m68k/kernel/Makefile linux-2.5.67-bk6/arch/m68k/kernel/Makefile
--- linux-2.5.67-bk5/arch/m68k/kernel/Makefile	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/arch/m68k/kernel/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -12,6 +12,7 @@
 			sys_m68k.o time.o semaphore.o setup.o m68k_ksyms.o
 
 obj-$(CONFIG_PCI)	+= bios32.o
+obj-$(CONFIG_MODULES)	+= module.o
 
 EXTRA_AFLAGS := -traditional
 
diff -urN linux-2.5.67-bk5/arch/m68k/kernel/module.c linux-2.5.67-bk6/arch/m68k/kernel/module.c
--- linux-2.5.67-bk5/arch/m68k/kernel/module.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/m68k/kernel/module.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,95 @@
+#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)
+{
+	unsigned int i;
+	Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
+	Elf32_Sym *sym;
+	uint32_t *location;
+
+	DEBUGP("Applying relocate section %u to %u\n", relsec,
+	       sechdrs[relsec].sh_info);
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+		/* This is where to make the change */
+		location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+			+ rel[i].r_offset;
+		/* This is the symbol it is referring to.  Note that all
+		   undefined symbols have been resolved.  */
+		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+			+ ELF32_R_SYM(rel[i].r_info);
+
+		switch (ELF32_R_TYPE(rel[i].r_info)) {
+		case R_68K_32:
+			/* We add the value into the location given */
+			*location += sym->st_value;
+			break;
+		case R_68K_PC32:
+			/* Add the value, subtract its postition */
+			*location += sym->st_value - (uint32_t)location;
+			break;
+		default:
+			printk(KERN_ERR "module %s: Unknown relocation: %u\n",
+			       me->name, ELF32_R_TYPE(rel[i].r_info));
+			return -ENOEXEC;
+		}
+	}
+	return 0;
+}
+
+int apply_relocate_add(Elf32_Shdr *sechdrs,
+		       const char *strtab,
+		       unsigned int symindex,
+		       unsigned int relsec,
+		       struct module *me)
+{
+	printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n",
+	       me->name);
+	return -ENOEXEC;
+}
+
+int module_finalize(const Elf_Ehdr *hdr,
+		    const Elf_Shdr *sechdrs,
+		    struct module *me)
+{
+	return 0;
+}
diff -urN linux-2.5.67-bk5/arch/mips/kernel/irixioctl.c linux-2.5.67-bk6/arch/mips/kernel/irixioctl.c
--- linux-2.5.67-bk5/arch/mips/kernel/irixioctl.c	2003-04-07 10:31:59.000000000 -0700
+++ linux-2.5.67-bk6/arch/mips/kernel/irixioctl.c	2003-04-15 04:36:14.000000000 -0700
@@ -34,7 +34,7 @@
 	struct file *filp;
 	struct tty_struct *ttyp = NULL;
 
-	read_lock(&current->files->file_lock);
+	spin_lock(&current->files->file_lock);
 	filp = fcheck(fd);
 	if(filp && filp->private_data) {
 		ttyp = (struct tty_struct *) filp->private_data;
@@ -42,7 +42,7 @@
 		if(ttyp->magic != TTY_MAGIC)
 			ttyp =NULL;
 	}
-	read_unlock(&current->files->file_lock);
+	spin_unlock(&current->files->file_lock);
 	return ttyp;
 }
 
diff -urN linux-2.5.67-bk5/arch/parisc/kernel/syscall.S linux-2.5.67-bk6/arch/parisc/kernel/syscall.S
--- linux-2.5.67-bk5/arch/parisc/kernel/syscall.S	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/parisc/kernel/syscall.S	2003-04-15 04:36:14.000000000 -0700
@@ -598,8 +598,8 @@
 
 	ENTRY_SAME(sendfile64)
 	ENTRY_COMP(futex)		/* 210 */
-	ENTRY_SAME(sched_setaffinity)
-	ENTRY_SAME(sched_getaffinity)
+	ENTRY_COMP(sched_setaffinity)
+	ENTRY_COMP(sched_getaffinity)
 	ENTRY_SAME(ni_syscall)
 	ENTRY_SAME(ni_syscall)
 	ENTRY_SAME(io_setup)		/* 215 */
diff -urN linux-2.5.67-bk5/arch/ppc64/kernel/misc.S linux-2.5.67-bk6/arch/ppc64/kernel/misc.S
--- linux-2.5.67-bk5/arch/ppc64/kernel/misc.S	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/arch/ppc64/kernel/misc.S	2003-04-15 04:36:14.000000000 -0700
@@ -724,8 +724,8 @@
 	.llong .sys_lremovexattr
 	.llong .sys_fremovexattr	/* 220 */
 	.llong .compat_sys_futex
-	.llong .sys32_sched_setaffinity
-	.llong .sys32_sched_getaffinity
+	.llong .compat_sys_sched_setaffinity
+	.llong .compat_sys_sched_getaffinity
 	.llong .sys_ni_syscall
 	.llong .sys_ni_syscall		/* 225 - reserved for tux */
 	.llong .sys32_sendfile64
diff -urN linux-2.5.67-bk5/arch/ppc64/kernel/sys_ppc32.c linux-2.5.67-bk6/arch/ppc64/kernel/sys_ppc32.c
--- linux-2.5.67-bk5/arch/ppc64/kernel/sys_ppc32.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/ppc64/kernel/sys_ppc32.c	2003-04-15 04:36:14.000000000 -0700
@@ -2780,56 +2780,6 @@
 	return secs;
 }
 
-extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage long sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	if (get_user(kernel_mask, user_mask_ptr))
-		return -EFAULT;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_setaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	return ret;
-}
-
-extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage long sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_getaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	if (ret > 0) {
-		if (put_user(kernel_mask, user_mask_ptr))
-			ret = -EFAULT;
-	}
-
-	return ret;
-}
-
 int sys32_olduname(struct oldold_utsname * name)
 {
 	int error;
diff -urN linux-2.5.67-bk5/arch/s390/Kconfig linux-2.5.67-bk6/arch/s390/Kconfig
--- linux-2.5.67-bk5/arch/s390/Kconfig	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/Kconfig	2003-04-15 04:36:14.000000000 -0700
@@ -7,10 +7,6 @@
 	bool
 	default y
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 
@@ -26,18 +22,29 @@
 config ARCH_S390
 	bool
 	default y
-	help
-	  Select this option, if you want to run the Kernel on one of IBM's
-	  mainframes of the S/390 generation. You should have installed the
-	  s390-compiler released by IBM (based on gcc-2.95.1) before.
 
-source "init/Kconfig"
+config UID16
+	bool
+	default y
+	depends on ARCH_S390X = 'n'
 
+source "init/Kconfig"
 
 menu "Base setup"
 
 comment "Processor type and features"
 
+config ARCH_S390X
+	bool "64 bit kernel"
+	help
+	  Select this option if you have a 64 bit IBM zSeries machine
+	  and want to use the 64 bit addressing mode.
+
+config ARCH_S390_31
+	bool
+	depends on ARCH_S390X = 'n'
+	default y
+
 config SMP
 	bool "Symmetric multi-processing support"
 	---help---
@@ -51,32 +58,15 @@
 	  singleprocessor machines. On a singleprocessor machine, the kernel
 	  will run faster if you say N here.
 
-	  Note that if you say Y here and choose architecture "586" or
-	  "Pentium" under "Processor family", the kernel will not work on 486
-	  architectures. Similarly, multiprocessor kernels for the "PPro"
-	  architecture may not work on all Pentium based boards.
-
-	  People using multiprocessor machines who say Y here should also say
-	  Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
-	  Management" code will be disabled if you say Y here.
-
 	  See also the <file:Documentation/smp.tex>,
-	  <file:Documentation/smp.txt>, <file:Documentation/i386/IO-APIC.txt>,
-	  <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
+	  <file:Documentation/smp.txt> and the SMP-HOWTO available at
 	  <http://www.linuxdoc.org/docs.html#howto>.
 
-	  If you don't know what to do here, say N.
-
-config MATHEMU
-	bool "IEEE FPU emulation"
-	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
-	  order to debug the code. Say Y unless you know what you are doing.
+	  Even if you don't know what to do here, say Y.
 
 config NR_CPUS
 	int "Maximum number of CPUs (2-32)"
-	depends on SMP
+	depends on SMP && ARCH_S390X = 'n'
 	default "32"
 	help
 	  This allows you to specify the maximum number of CPUs which this
@@ -85,13 +75,54 @@
 
 	  This is purely to save memory - each supported CPU adds
 	  approximately eight kilobytes to the kernel image.
+	
+config NR_CPUS
+	int "Maximum number of CPUs (2-64)"
+	depends on SMP && ARCH_S390X
+	default "64"
+	help
+	  This allows you to specify the maximum number of CPUs which this
+	  kernel will support.  The maximum supported value is 64 and the
+	  minimum value which makes sense is 2.
+
+	  This is purely to save memory - each supported CPU adds
+	  approximately sixteen kilobytes to the kernel image.
+
+config MATHEMU
+	bool "IEEE FPU emulation"
+	depends on ARCH_S390X = n
+	help
+	  This option is required for IEEE compliant floating point arithmetic
+	  on older S/390 machines. Say Y unless you know your machine doesn't 
+	  need this.
+
+config S390_SUPPORT
+	bool "Kernel support for 31 bit emulation"
+	depends on ARCH_S390X
+	help
+	  Select this option if you want to enable your system kernel to
+	  handle system-calls from ELF binaries for 31 bit ESA.  This option
+	  (and some other stuff like libraries and such) is needed for
+	  executing 31 bit applications.  It is safe to say "Y".
+
+config COMPAT
+	bool
+	depends on S390_SUPPORT
+	default y
+
+config BINFMT_ELF32
+	tristate "Kernel support for 31 bit ELF binaries"
+	depends on S390_SUPPORT
+	help
+	  This allows you to run 32-bit Linux/ELF binaries on your zSeries
+	  in 64 bit mode. Everybody wants this; say Y.
 
 comment "I/O subsystem configuration"
 
 config MACHCHK_WARNING
 	bool "Process warning machine checks"
 	help
-	  Select this option if you want the machine check handler on IBM S/390 or 
+	  Select this option if you want the machine check handler on IBM S/390 or
 	  zSeries to process warning machine checks (e.g. on power failures). 
 	  If unsure, say "Y".
 
@@ -144,15 +175,15 @@
 	prompt "IPL method generated into head.S"
 	depends on IPL
 	default IPL_TAPE
-
-config IPL_TAPE
-	bool "tape"
 	help
 	  Select "tape" if you want to IPL the image from a Tape.
 
 	  Select "vm_reader" if you are running under VM/ESA and want
 	  to IPL the image from the emulated card reader.
 
+config IPL_TAPE
+	bool "tape"
+
 config IPL_VM
 	bool "vm_reader"
 
diff -urN linux-2.5.67-bk5/arch/s390/Makefile linux-2.5.67-bk6/arch/s390/Makefile
--- linux-2.5.67-bk5/arch/s390/Makefile	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -13,14 +13,28 @@
 # Copyright (C) 1994 by Linus Torvalds
 #
 
+ifdef CONFIG_ARCH_S390_31
 LDFLAGS		:= -m elf_s390
-OBJCOPYFLAGS	:= -O binary
-LDFLAGS_vmlinux := -e start
 LDFLAGS_BLOB	:= --format binary --oformat elf32-s390
+CFLAGS		+= -m31
+UTS_MACHINE	:= s390
+endif
+
+ifdef CONFIG_ARCH_S390X
+LDFLAGS		:= -m elf64_s390
+MODFLAGS	+= -fpic -D__PIC__
+LDFLAGS_BLOB	:= --format binary --oformat elf64-s390
+CFLAGS		+= -m64
+UTS_MACHINE	:= s390x
+endif
 
-CFLAGS += -pipe -fno-strength-reduce -finline-limit=10000 -Wno-sign-compare
+OBJCOPYFLAGS	:= -O binary
+LDFLAGS_vmlinux := -e start
+CFLAGS 		+= -pipe -fno-strength-reduce -finline-limit-10000 -Wno-sign-compare 
 
-head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
+head-$(CONFIG_ARCH_S390_31)	+= arch/$(ARCH)/kernel/head.o
+head-$(CONFIG_ARCH_S390X)	+= arch/$(ARCH)/kernel/head64.o
+head-y				+= arch/$(ARCH)/kernel/init_task.o
 
 core-y		+= arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/
 libs-y		+= arch/$(ARCH)/lib/
diff -urN linux-2.5.67-bk5/arch/s390/boot/Makefile linux-2.5.67-bk6/arch/s390/boot/Makefile
--- linux-2.5.67-bk5/arch/s390/boot/Makefile	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/boot/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -2,18 +2,17 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-targets		:= image listing
-EXTRA_AFLAGS	:= -traditional
-quiet_cmd_listing = OBJDUMP $@
-      cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
-			       --disassemble-zeroes --reloc vmlinux > $@
+COMPILE_VERSION := __linux_compile_version_id__`hostname |  \
+			tr -c '[0-9A-Za-z]' '_'`__`date | \
+			tr -c '[0-9A-Za-z]' '_'`_t
 
-$(obj)/image: vmlinux FORCE
-	$(call if_changed,objcopy)
+EXTRA_CFLAGS  := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I .
+EXTRA_AFLAGS  := -traditional
 
-$(obj)/listing: vmlinux FORCE
-	$(call if_changed,listing)
+targets := image
 
+$(obj)/image: vmlinux FORCE
+	$(call if_changed,objcopy)
 
 install: $(CONFIGURE) $(obj)/image
 	sh -x $(obj)/install.sh $(KERNELRELEASE) $(obj)/image \
diff -urN linux-2.5.67-bk5/arch/s390/defconfig linux-2.5.67-bk6/arch/s390/defconfig
--- linux-2.5.67-bk5/arch/s390/defconfig	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/defconfig	2003-04-15 04:36:14.000000000 -0700
@@ -2,10 +2,9 @@
 # Automatically generated make config: don't edit
 #
 CONFIG_MMU=y
-CONFIG_SWAP=y
-CONFIG_UID16=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_S390=y
+CONFIG_UID16=y
 
 #
 # Code maturity level options
@@ -15,6 +14,7 @@
 #
 # General setup
 #
+CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
@@ -36,9 +36,11 @@
 #
 # Processor type and features
 #
+# CONFIG_ARCH_S390X is not set
+CONFIG_ARCH_S390_31=y
 CONFIG_SMP=y
-CONFIG_MATHEMU=y
 CONFIG_NR_CPUS=32
+CONFIG_MATHEMU=y
 
 #
 # I/O subsystem configuration
@@ -141,7 +143,6 @@
 # CONFIG_PACKET_MMAP is not set
 # CONFIG_NETLINK_DEV is not set
 # CONFIG_NETFILTER is not set
-# CONFIG_FILTER is not set
 CONFIG_UNIX=y
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
@@ -156,8 +157,12 @@
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
-# CONFIG_XFRM_USER is not set
+# CONFIG_INET_IPCOMP is not set
 CONFIG_IPV6=m
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_XFRM_USER is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
@@ -252,48 +257,63 @@
 #
 # 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_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
-# CONFIG_REISERFS_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_TMPFS 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_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-CONFIG_EXT3_FS=y
-CONFIG_EXT3_FS_XATTR=y
-# CONFIG_EXT3_FS_POSIX_ACL is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_MINIX_FS is not set
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
 # CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_XFS_FS is not set
 
 #
 # Network File Systems
 #
-# CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V4 is not set
@@ -301,16 +321,17 @@
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V4 is not set
 # CONFIG_NFSD_TCP is not set
-CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
-# CONFIG_CIFS 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
-CONFIG_FS_MBCACHE=y
 
 #
 # Partition Types
@@ -324,6 +345,7 @@
 # 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
@@ -359,6 +381,7 @@
 # CONFIG_CRYPTO_TWOFISH is not set
 # CONFIG_CRYPTO_SERPENT is not set
 # CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
diff -urN linux-2.5.67-bk5/arch/s390/kernel/Makefile linux-2.5.67-bk6/arch/s390/kernel/Makefile
--- linux-2.5.67-bk5/arch/s390/kernel/Makefile	2003-04-07 10:32:52.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -2,17 +2,33 @@
 # Makefile for the linux kernel.
 #
 
-extra-y		:= head.o init_task.o
 EXTRA_AFLAGS	:= -traditional
 
-obj-y	:= entry.o bitmap.o traps.o time.o process.o \
+obj-y	:=  bitmap.o traps.o time.o process.o \
             setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
-            semaphore.o reipl.o s390_ext.o debug.o
+            semaphore.o s390_ext.o debug.o
+
+extra-$(CONFIG_ARCH_S390_31)	+= head.o 
+extra-$(CONFIG_ARCH_S390X)	+= head64.o 
+extra-y				+= init_task.o
 
 obj-$(CONFIG_MODULES)		+= s390_ksyms.o module.o
 obj-$(CONFIG_SMP)		+= smp.o
 
+obj-$(CONFIG_S390_SUPPORT)	+= compat_linux.o compat_signal.o \
+					compat_ioctl.o compat_wrapper.o \
+					compat_exec.o compat_exec_domain.o
+obj-$(CONFIG_BINFMT_ELF32)	+= binfmt_elf32.o
+
+obj-$(CONFIG_ARCH_S390_31)	+= entry.o reipl.o
+obj-$(CONFIG_ARCH_S390X)	+= entry64.o reipl64.o
+
+ifdef CONFIG_ARCH_S390X
+$(obj)%.o: $(patsubst arch/s390/%,arch/s390x/%,$(src))%.c
+	$(call if_changed_dep,cc_o_c)
+endif
+
 #
-# Kernel debugging
+# This is just to get the dependencies...
 #
-obj-$(CONFIG_REMOTE_DEBUG)	+= gdb-stub.o #gdb-low.o 
+binfmt_elf32.o:	$(TOPDIR)/fs/binfmt_elf.c
diff -urN linux-2.5.67-bk5/arch/s390/kernel/binfmt_elf32.c linux-2.5.67-bk6/arch/s390/kernel/binfmt_elf32.c
--- linux-2.5.67-bk5/arch/s390/kernel/binfmt_elf32.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/binfmt_elf32.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,214 @@
+/*
+ * Support for 32-bit Linux for S390 ELF binaries.
+ *
+ * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Author(s): Gerhard Tonn (ton@de.ibm.com)
+ *
+ * Heavily inspired by the 32-bit Sparc compat code which is
+ * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
+ * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek   (jj@ultra.linux.cz)
+ */
+
+#define __ASMS390_ELF_H
+
+#include <linux/time.h>
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS	ELFCLASS32
+#define ELF_DATA	ELFDATA2MSB
+#define ELF_ARCH	EM_S390
+
+/*
+ * This is used to ensure we don't load something for the wrong architecture.
+ */
+#define elf_check_arch(x) \
+	(((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
+         && (x)->e_ident[EI_CLASS] == ELF_CLASS)
+
+/* ELF register definitions */
+#define NUM_GPRS      16
+#define NUM_FPRS      16
+#define NUM_ACRS      16    
+
+#define TASK31_SIZE		(0x80000000UL)
+
+/* For SVR4/S390 the function pointer to be registered with `atexit` is
+   passed in R14. */
+#define ELF_PLAT_INIT(_r, load_addr) \
+	do { \
+	_r->gprs[14] = 0; \
+	set_thread_flag(TIF_31BIT); \
+	} while(0)
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE       4096
+
+/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
+   use of this is to invoke "./ld.so someprog" to test out a new version of
+   the loader.  We need to make sure that it is out of the way of the program
+   that it will "exec", and that there is sufficient room for the brk.  */
+
+#define ELF_ET_DYN_BASE         (TASK31_SIZE / 3 * 2)
+
+/* Wow, the "main" arch needs arch dependent functions too.. :) */
+
+/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
+   now struct_user_regs, they are different) */
+
+#define ELF_CORE_COPY_REGS(pr_reg, regs)        \
+	{ \
+	int i; \
+	memcpy(&pr_reg.psw.mask, &regs->psw.mask, 4); \
+	memcpy(&pr_reg.psw.addr, ((char*)&regs->psw.addr)+4, 4); \
+	for(i=0; i<NUM_GPRS; i++) \
+		pr_reg.gprs[i] = regs->gprs[i]; \
+	for(i=0; i<NUM_ACRS; i++) \
+		pr_reg.acrs[i] = regs->acrs[i]; \
+	pr_reg.orig_gpr2 = regs->orig_gpr2; \
+	}
+
+
+
+/* This yields a mask that user programs can use to figure out what
+   instruction set this CPU supports. */
+
+#define ELF_HWCAP (0)
+
+/* This yields a string that ld.so will use to load implementation
+   specific libraries for optimization.  This is more specific in
+   intent than poking at uname or /proc/cpuinfo.
+
+   For the moment, we have only optimizations for the Intel generations,
+   but that could change... */
+
+#define ELF_PLATFORM (NULL)
+
+#define SET_PERSONALITY(ex, ibcs2)			\
+do {							\
+	if (ibcs2)                                      \
+		set_personality(PER_SVR4);              \
+	else if (current->personality != PER_LINUX32)   \
+		set_personality(PER_LINUX);             \
+} while (0)
+
+#include "compat_linux.h"
+
+typedef _s390_fp_regs32 elf_fpregset_t;
+
+typedef struct
+{
+	
+	_psw_t32	psw;
+	__u32		gprs[__NUM_GPRS]; 
+	__u32		acrs[__NUM_ACRS]; 
+	__u32		orig_gpr2;
+} s390_regs32;
+typedef s390_regs32 elf_gregset_t;
+
+#include <asm/processor.h>
+#include <linux/module.h>
+#include <linux/config.h>
+#include <linux/elfcore.h>
+#include <linux/binfmts.h>
+#include <linux/compat.h>
+
+int setup_arg_pages32(struct linux_binprm *bprm);
+
+#define elf_prstatus elf_prstatus32
+struct elf_prstatus32
+{
+	struct elf_siginfo pr_info;	/* Info associated with signal */
+	short	pr_cursig;		/* Current signal */
+	u32	pr_sigpend;	/* Set of pending signals */
+	u32	pr_sighold;	/* Set of held signals */
+	pid_t	pr_pid;
+	pid_t	pr_ppid;
+	pid_t	pr_pgrp;
+	pid_t	pr_sid;
+	struct compat_timeval pr_utime;	/* User time */
+	struct compat_timeval pr_stime;	/* System time */
+	struct compat_timeval pr_cutime;	/* Cumulative user time */
+	struct compat_timeval pr_cstime;	/* Cumulative system time */
+	elf_gregset_t pr_reg;	/* GP registers */
+	int pr_fpvalid;		/* True if math co-processor being used.  */
+};
+
+#define elf_prpsinfo elf_prpsinfo32
+struct elf_prpsinfo32
+{
+	char	pr_state;	/* numeric process state */
+	char	pr_sname;	/* char for pr_state */
+	char	pr_zomb;	/* zombie */
+	char	pr_nice;	/* nice val */
+	u32	pr_flag;	/* flags */
+	u16	pr_uid;
+	u16	pr_gid;
+	pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	/* Lots missing */
+	char	pr_fname[16];	/* filename of executable */
+	char	pr_psargs[ELF_PRARGSZ];	/* initial part of arg list */
+};
+
+#include <linux/highuid.h>
+
+#undef NEW_TO_OLD_UID
+#undef NEW_TO_OLD_GID
+#define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
+#define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) 
+
+#define elf_addr_t	u32
+/*
+#define init_elf_binfmt init_elf32_binfmt
+*/
+#undef CONFIG_BINFMT_ELF
+#ifdef CONFIG_BINFMT_ELF32
+#define CONFIG_BINFMT_ELF CONFIG_BINFMT_ELF32
+#endif
+#undef CONFIG_BINFMT_ELF_MODULE
+#ifdef CONFIG_BINFMT_ELF32_MODULE
+#define CONFIG_BINFMT_ELF_MODULE CONFIG_BINFMT_ELF32_MODULE
+#endif
+
+#undef start_thread
+#define start_thread                    start_thread31 
+#define setup_arg_pages(bprm)           setup_arg_pages32(bprm)
+#define elf_map				elf_map32
+
+MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries,"
+                   " Copyright 2000 IBM Corporation"); 
+MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>");
+
+#undef MODULE_DESCRIPTION
+#undef MODULE_AUTHOR
+
+#define jiffies_to_timeval jiffies_to_compat_timeval
+static __inline__ void
+jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
+{
+	value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
+	value->tv_sec = jiffies / HZ;
+}
+
+#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 = 0x40000000; 
+
+	if (prot & PROT_READ) 
+		prot |= PROT_EXEC; 
+
+	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 -urN linux-2.5.67-bk5/arch/s390/kernel/compat_exec.c linux-2.5.67-bk6/arch/s390/kernel/compat_exec.c
--- linux-2.5.67-bk5/arch/s390/kernel/compat_exec.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_exec.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,93 @@
+/*
+ * Support for 32-bit Linux for S390 ELF binaries.
+ *
+ * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Author(s): Gerhard Tonn (ton@de.ibm.com)
+ *
+ * Separated from binfmt_elf32.c to reduce exports for module enablement.
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/slab.h>
+#include <linux/file.h>
+#include <linux/mman.h>
+#include <linux/a.out.h>
+#include <linux/stat.h>
+#include <linux/fcntl.h>
+#include <linux/smp_lock.h>
+#include <linux/init.h>
+#include <linux/pagemap.h>
+#include <linux/highmem.h>
+#include <linux/spinlock.h>
+#include <linux/binfmts.h>
+#include <linux/module.h>
+
+#include <asm/uaccess.h>
+#include <asm/pgalloc.h>
+#include <asm/mmu_context.h>
+
+#ifdef CONFIG_KMOD
+#include <linux/kmod.h>
+#endif
+
+
+extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
+
+#undef STACK_TOP
+#define STACK_TOP TASK31_SIZE
+
+int setup_arg_pages32(struct linux_binprm *bprm)
+{
+	unsigned long stack_base;
+	struct vm_area_struct *mpnt;
+	struct mm_struct *mm = current->mm;
+	int i;
+
+	stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE;
+	mm->arg_start = bprm->p + stack_base;
+
+	bprm->p += stack_base;
+	if (bprm->loader)
+		bprm->loader += stack_base;
+	bprm->exec += stack_base;
+
+	mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
+	if (!mpnt) 
+		return -ENOMEM; 
+	
+	if (!vm_enough_memory((STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))>>PAGE_SHIFT)) {
+		kmem_cache_free(vm_area_cachep, mpnt);
+		return -ENOMEM;
+	}
+
+	down_write(&mm->mmap_sem);
+	{
+		mpnt->vm_mm = mm;
+		mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
+		mpnt->vm_end = STACK_TOP;
+		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;
+	} 
+
+	for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
+		struct page *page = bprm->page[i];
+		if (page) {
+			bprm->page[i] = NULL;
+			put_dirty_page(current,page,stack_base);
+		}
+		stack_base += PAGE_SIZE;
+	}
+	up_write(&mm->mmap_sem);
+	
+	return 0;
+}
+
+EXPORT_SYMBOL(setup_arg_pages32);
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_exec_domain.c linux-2.5.67-bk6/arch/s390/kernel/compat_exec_domain.c
--- linux-2.5.67-bk5/arch/s390/kernel/compat_exec_domain.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_exec_domain.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,30 @@
+/*
+ * Support for 32-bit Linux for S390 personality.
+ *
+ * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Author(s): Gerhard Tonn (ton@de.ibm.com)
+ *
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/personality.h>
+#include <linux/sched.h>
+
+struct exec_domain s390_exec_domain;
+
+static int __init
+s390_init (void)
+{
+	s390_exec_domain.name = "Linux/s390";
+	s390_exec_domain.handler = NULL;
+	s390_exec_domain.pers_low = PER_LINUX32;
+	s390_exec_domain.pers_high = PER_LINUX32;
+	s390_exec_domain.signal_map = default_exec_domain.signal_map;
+	s390_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
+	register_exec_domain(&s390_exec_domain);
+	return 0;
+}
+
+__initcall(s390_init);
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_ioctl.c linux-2.5.67-bk6/arch/s390/kernel/compat_ioctl.c
--- linux-2.5.67-bk5/arch/s390/kernel/compat_ioctl.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_ioctl.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,1084 @@
+/*
+ * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
+ *
+ *  S390 version
+ *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Gerhard Tonn (ton@de.ibm.com)
+ *
+ * Heavily inspired by the 32-bit Sparc compat code which is  
+ * Copyright (C) 2000 Silicon Graphics, Inc.
+ * Written by Ulf Carlsson (ulfc@engr.sgi.com) 
+ *
+ */
+
+#include <linux/types.h>
+#include <linux/compat.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/file.h>
+#include <linux/vt.h>
+#include <linux/kd.h>
+#include <linux/netdevice.h>
+#include <linux/route.h>
+#include <linux/ext2_fs.h>
+#include <linux/hdreg.h>
+#include <linux/if_bonding.h>
+#include <linux/blkpg.h>
+#include <linux/blk.h>
+#include <linux/dm-ioctl.h>
+#include <linux/loop.h>
+#include <linux/elevator.h>
+#include <asm/types.h>
+#include <asm/uaccess.h>
+#include <asm/dasd.h>
+#include <asm/tape390.h>
+#include <asm/sockios.h>
+#include <asm/ioctls.h>
+
+#include "compat_linux.h"
+
+long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
+
+struct hd_geometry32 {
+	unsigned char	heads;
+	unsigned char	sectors;
+	unsigned short	cylinders;
+	__u32		start;
+};  
+
+static inline int hd_geometry_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct hd_geometry32 *hg32 = (struct hd_geometry32 *) A(arg);
+	struct hd_geometry hg;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+	
+	set_fs (KERNEL_DS);
+	ret = sys_ioctl (fd, cmd, (long)&hg);
+	set_fs (old_fs);
+
+	if (ret)
+		return ret;
+
+	ret = put_user (hg.heads, &(hg32->heads));
+	ret |= __put_user (hg.sectors, &(hg32->sectors));
+	ret |= __put_user (hg.cylinders, &(hg32->cylinders));
+	ret |= __put_user (hg.start, &(hg32->start));
+
+	return ret;
+}
+
+#define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
+#define EXT2_IOC32_SETFLAGS               _IOW('f', 2, int)
+#define EXT2_IOC32_GETVERSION             _IOR('v', 1, int)
+#define EXT2_IOC32_SETVERSION             _IOW('v', 2, int)
+
+struct ifmap32 {
+	unsigned int mem_start;
+	unsigned int mem_end;
+	unsigned short base_addr;
+	unsigned char irq;
+	unsigned char dma;
+	unsigned char port;
+};
+
+struct ifreq32 {
+#define IFHWADDRLEN     6
+#define IFNAMSIZ        16
+        union {
+                char    ifrn_name[IFNAMSIZ];	/* if name, e.g. "en0" */
+        } ifr_ifrn;
+        union {
+                struct  sockaddr ifru_addr;
+                struct  sockaddr ifru_dstaddr;
+                struct  sockaddr ifru_broadaddr;
+                struct  sockaddr ifru_netmask;
+                struct  sockaddr ifru_hwaddr;
+                short   ifru_flags;
+                int     ifru_ivalue;
+                int     ifru_mtu;
+                struct  ifmap32 ifru_map;
+                char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
+		char	ifru_newname[IFNAMSIZ];
+                __u32	ifru_data;
+        } ifr_ifru;
+};
+
+struct ifconf32 {
+        int     ifc_len;                        /* size of buffer       */
+        __u32	ifcbuf;
+};
+
+static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct ireq32 *uir32 = (struct ireq32 *) A(arg);
+	struct net_device *dev;
+	struct ifreq32 ifr32;
+
+	if (copy_from_user(&ifr32, uir32, sizeof(struct ifreq32)))
+		return -EFAULT;
+
+	read_lock(&dev_base_lock);
+	dev = __dev_get_by_index(ifr32.ifr_ifindex);
+	if (!dev) {
+		read_unlock(&dev_base_lock);
+		return -ENODEV;
+	}
+
+	strcpy(ifr32.ifr_name, dev->name);
+	read_unlock(&dev_base_lock);
+
+	if (copy_to_user(uir32, &ifr32, sizeof(struct ifreq32)))
+	    return -EFAULT;
+
+	return 0;
+}
+
+static inline int dev_ifconf(unsigned int fd, unsigned int cmd,
+			     unsigned long arg)
+{
+	struct ioconf32 *uifc32 = (struct ioconf32 *) A(arg);
+	struct ifconf32 ifc32;
+	struct ifconf ifc;
+	struct ifreq32 *ifr32;
+	struct ifreq *ifr;
+	mm_segment_t old_fs;
+	int len;
+	int err;
+
+	if (copy_from_user(&ifc32, uifc32, sizeof(struct ifconf32)))
+		return -EFAULT;
+
+	if(ifc32.ifcbuf == 0) {
+		ifc32.ifc_len = 0;
+		ifc.ifc_len = 0;
+		ifc.ifc_buf = NULL;
+	} else {
+		ifc.ifc_len = ((ifc32.ifc_len / sizeof (struct ifreq32))) *
+			sizeof (struct ifreq);
+		ifc.ifc_buf = kmalloc (ifc.ifc_len, GFP_KERNEL);
+		if (!ifc.ifc_buf)
+			return -ENOMEM;
+	}
+	ifr = ifc.ifc_req;
+	ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf);
+	len = ifc32.ifc_len / sizeof (struct ifreq32);
+	while (len--) {
+		if (copy_from_user(ifr++, ifr32++, sizeof (struct ifreq32))) {
+			err = -EFAULT;
+			goto out;
+		}
+	}
+
+	old_fs = get_fs();
+	set_fs (KERNEL_DS);
+	err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)&ifc);	
+	set_fs (old_fs);
+	if (err)
+		goto out;
+
+	ifr = ifc.ifc_req;
+	ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf);
+	len = ifc.ifc_len / sizeof (struct ifreq);
+	ifc32.ifc_len = len * sizeof (struct ifreq32);
+
+	while (len--) {
+		if (copy_to_user(ifr32++, ifr++, sizeof (struct ifreq32))) {
+			err = -EFAULT;
+			goto out;
+		}
+	}
+
+	if (copy_to_user(uifc32, &ifc32, sizeof(struct ifconf32))) {
+		err = -EFAULT;
+		goto out;
+	}
+out:
+	if(ifc.ifc_buf != NULL)
+		kfree (ifc.ifc_buf);
+	return err;
+}
+
+static int bond_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg)
+{
+	struct ifreq ifr;
+	mm_segment_t old_fs;
+	int err, len;
+	u32 data;
+	
+	if (copy_from_user(&ifr, (struct ifreq32 *)arg, sizeof(struct ifreq32)))
+		return -EFAULT;
+	ifr.ifr_data = (__kernel_caddr_t)get_zeroed_page(GFP_KERNEL);
+	if (!ifr.ifr_data)
+		return -EAGAIN;
+
+	switch (cmd) {
+	case SIOCBONDENSLAVE:
+	case SIOCBONDRELEASE:
+	case SIOCBONDSETHWADDR:
+	case SIOCBONDCHANGEACTIVE:
+		len = IFNAMSIZ * sizeof(char);
+		break;
+	case SIOCBONDSLAVEINFOQUERY:
+		len = sizeof(struct ifslave);
+		break;
+	case SIOCBONDINFOQUERY:
+		len = sizeof(struct ifbond);
+		break;
+	default:
+		err = -EINVAL;
+		goto out;
+	};
+
+	__get_user(data, &(((struct ifreq32 *)arg)->ifr_ifru.ifru_data));
+	if (copy_from_user(ifr.ifr_data, (char *)A(data), len)) {
+		err = -EFAULT;
+		goto out;
+	}
+
+	old_fs = get_fs();
+	set_fs (KERNEL_DS);
+	err = sys_ioctl (fd, cmd, (unsigned long)&ifr);
+	set_fs (old_fs);
+	if (!err) {
+		len = copy_to_user((char *)A(data), ifr.ifr_data, len);
+		if (len)
+			err = -EFAULT;
+	}
+
+out:
+	free_page((unsigned long)ifr.ifr_data);
+	return err;
+}
+
+static inline int dev_ifsioc(unsigned int fd, unsigned int cmd,
+			     unsigned long arg)
+{
+	struct ifreq32 *uifr = (struct ifreq32 *) A(arg);
+	struct ifreq ifr;
+	mm_segment_t old_fs;
+	int err;
+	
+	switch (cmd) {
+	case SIOCSIFMAP:
+		err = copy_from_user(&ifr, uifr, sizeof(ifr.ifr_name));
+		err |= __get_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start));
+		err |= __get_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end));
+		err |= __get_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr));
+		err |= __get_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq));
+		err |= __get_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma));
+		err |= __get_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port));
+		if (err)
+			return -EFAULT;
+		break;
+	default:
+		if (copy_from_user(&ifr, uifr, sizeof(struct ifreq32)))
+			return -EFAULT;
+		break;
+	}
+	old_fs = get_fs();
+	set_fs (KERNEL_DS);
+	err = sys_ioctl (fd, cmd, (unsigned long)&ifr);
+	set_fs (old_fs);
+	if (!err) {
+		switch (cmd) {
+		case SIOCGIFFLAGS:
+		case SIOCGIFMETRIC:
+		case SIOCGIFMTU:
+		case SIOCGIFMEM:
+		case SIOCGIFHWADDR:
+		case SIOCGIFINDEX:
+		case SIOCGIFADDR:
+		case SIOCGIFBRDADDR:
+		case SIOCGIFDSTADDR:
+		case SIOCGIFNETMASK:
+		case SIOCGIFTXQLEN:
+			if (copy_to_user(uifr, &ifr, sizeof(struct ifreq32)))
+				return -EFAULT;
+			break;
+		case SIOCGIFMAP:
+			err = copy_to_user(uifr, &ifr, sizeof(ifr.ifr_name));
+			err |= __put_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start));
+			err |= __put_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end));
+			err |= __put_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr));
+			err |= __put_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq));
+			err |= __put_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma));
+			err |= __put_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port));
+			if (err)
+				err = -EFAULT;
+			break;
+		}
+	}
+	return err;
+}
+
+struct rtentry32
+{
+	unsigned int	rt_pad1;
+	struct sockaddr	rt_dst;		/* target address		*/
+	struct sockaddr	rt_gateway;	/* gateway addr (RTF_GATEWAY)	*/
+	struct sockaddr	rt_genmask;	/* target network mask (IP)	*/
+	unsigned short	rt_flags;
+	short		rt_pad2;
+	unsigned int	rt_pad3;
+	unsigned int	rt_pad4;
+	short		rt_metric;	/* +1 for binary compatibility!	*/
+	unsigned int	rt_dev;		/* forcing the device at add	*/
+	unsigned int	rt_mtu;		/* per route MTU/Window 	*/
+#ifndef __KERNEL__
+#define rt_mss	rt_mtu			/* Compatibility :-(            */
+#endif
+	unsigned int	rt_window;	/* Window clamping 		*/
+	unsigned short	rt_irtt;	/* Initial RTT			*/
+};
+
+static inline int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct rtentry32 *ur = (struct rtentry32 *) A(arg);
+	struct rtentry r;
+	char devname[16];
+	u32 rtdev;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+	
+	ret = copy_from_user (&r.rt_dst, &(ur->rt_dst), 3 * sizeof(struct sockaddr));
+	ret |= __get_user (r.rt_flags, &(ur->rt_flags));
+	ret |= __get_user (r.rt_metric, &(ur->rt_metric));
+	ret |= __get_user (r.rt_mtu, &(ur->rt_mtu));
+	ret |= __get_user (r.rt_window, &(ur->rt_window));
+	ret |= __get_user (r.rt_irtt, &(ur->rt_irtt));
+	ret |= __get_user (rtdev, &(ur->rt_dev));
+	if (rtdev) {
+		ret |= copy_from_user (devname, (char *) A(rtdev), 15);
+		r.rt_dev = devname; devname[15] = 0;
+	} else
+		r.rt_dev = 0;
+	if (ret)
+		return -EFAULT;
+	set_fs (KERNEL_DS);
+	ret = sys_ioctl (fd, cmd, (long)&r);
+	set_fs (old_fs);
+	return ret;
+}
+
+static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	/* These are just misnamed, they actually get/put from/to user an int */
+	switch (cmd) {
+	case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break;
+	case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break;
+	case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break;
+	case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break;
+	}
+	return sys_ioctl(fd, cmd, arg);
+}
+
+
+struct loop_info32 {
+	int			lo_number;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
+	unsigned int		lo_inode;       /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
+	int			lo_offset;
+	int			lo_encrypt_type;
+	int			lo_encrypt_key_size;    /* ioctl w/o */
+	int			lo_flags;       /* ioctl r/o */
+	char			lo_name[LO_NAME_SIZE];
+	unsigned char		lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
+	unsigned int		lo_init[2];
+	char			reserved[4];
+};
+
+static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	struct loop_info l;
+	int err = -EINVAL;
+
+	switch(cmd) {
+	case LOOP_SET_STATUS:
+		err = get_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number);
+		err |= __get_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device);
+		err |= __get_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode);
+		err |= __get_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice);
+		err |= __copy_from_user((char *)&l.lo_offset, (char *)&((struct loop_info32 *)arg)->lo_offset,
+					   8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
+		if (err) {
+			err = -EFAULT;
+		} else {
+			set_fs (KERNEL_DS);
+			err = sys_ioctl (fd, cmd, (unsigned long)&l);
+			set_fs (old_fs);
+		}
+		break;
+	case LOOP_GET_STATUS:
+		set_fs (KERNEL_DS);
+		err = sys_ioctl (fd, cmd, (unsigned long)&l);
+		set_fs (old_fs);
+		if (!err) {
+			err = put_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number);
+			err |= __put_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device);
+			err |= __put_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode);
+			err |= __put_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice);
+			err |= __copy_to_user((char *)&((struct loop_info32 *)arg)->lo_offset,
+					   (char *)&l.lo_offset, (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
+			if (err)
+				err = -EFAULT;
+		}
+		break;
+	default: {
+		static int count = 0;
+		if (++count <= 20)
+			printk("%s: Unknown loop ioctl cmd, fd(%d) "
+			       "cmd(%08x) arg(%08lx)\n",
+			       __FUNCTION__, fd, cmd, arg);
+	}
+	}
+	return err;
+}
+
+
+struct blkpg_ioctl_arg32 {
+	int op;
+	int flags;
+	int datalen;
+	u32 data;
+};
+                                
+static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, struct blkpg_ioctl_arg32 *arg)
+{
+	struct blkpg_ioctl_arg a;
+	struct blkpg_partition p;
+	int err;
+	mm_segment_t old_fs = get_fs();
+	
+	err = get_user(a.op, &arg->op);
+	err |= __get_user(a.flags, &arg->flags);
+	err |= __get_user(a.datalen, &arg->datalen);
+	err |= __get_user((long)a.data, &arg->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, a.data, 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);
+	default:
+		return -EINVAL;
+	}                                        
+	return err;
+}
+
+
+typedef struct ica_z90_status_t {
+  int totalcount;
+  int leedslitecount;
+  int leeds2count;
+  int requestqWaitCount;
+  int pendingqWaitCount;
+  int totalOpenCount;
+  int cryptoDomain;
+  unsigned char status[64];
+  unsigned char qdepth[64];
+} ica_z90_status;
+
+typedef struct _ica_rsa_modexpo {
+  char         *inputdata;
+  unsigned int  inputdatalength;
+  char         *outputdata;
+  unsigned int  outputdatalength;
+  char         *b_key;
+  char         *n_modulus;
+} ica_rsa_modexpo_t;
+
+typedef struct _ica_rsa_modexpo_32 {
+  u32          inputdata;
+  u32          inputdatalength;
+  u32          outputdata;
+  u32          outputdatalength;
+  u32          b_key;
+  u32          n_modulus;
+} ica_rsa_modexpo_32_t;
+
+typedef struct _ica_rsa_modexpo_crt {
+  char         *inputdata;
+  unsigned int  inputdatalength;
+  char         *outputdata;
+  unsigned int  outputdatalength;
+  char         *bp_key;
+  char         *bq_key;
+  char         *np_prime;
+  char         *nq_prime;
+  char         *u_mult_inv;
+} ica_rsa_modexpo_crt_t;
+
+typedef struct _ica_rsa_modexpo_crt_32 {
+  u32          inputdata;
+  u32          inputdatalength;
+  u32          outputdata;
+  u32          outputdatalength;
+  u32          bp_key;
+  u32          bq_key;
+  u32          np_prime;
+  u32          nq_prime;
+  u32          u_mult_inv;
+} ica_rsa_modexpo_crt_32_t;
+
+#define ICA_IOCTL_MAGIC 'z'
+#define ICARSAMODEXPO   _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x05, 0)
+#define ICARSACRT       _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x06, 0) 
+#define ICARSAMODMULT   _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x07, 0)
+#define ICAZ90STATUS    _IOC(_IOC_READ, ICA_IOCTL_MAGIC, 0x10, sizeof(ica_z90_status))
+#define ICAZ90QUIESCE   _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x11, 0)
+#define ICAZ90HARDRESET _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x12, 0)
+#define ICAZ90HARDERROR _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x13, 0)
+
+static int do_rsa_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	int err = 0;
+	ica_rsa_modexpo_t rsa;
+	ica_rsa_modexpo_32_t *rsa32 = (ica_rsa_modexpo_32_t *)arg;
+	u32 inputdata, outputdata, b_key, n_modulus;
+
+	memset (&rsa, 0, sizeof(rsa));
+
+	err |= __get_user (inputdata, &rsa32->inputdata);
+	err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength);
+	err |= __get_user (outputdata, &rsa32->outputdata);
+	err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength);
+	err |= __get_user (b_key, &rsa32->b_key);
+	err |= __get_user (n_modulus, &rsa32->n_modulus);
+	if (err)
+		return -EFAULT;
+
+	rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
+	if (!rsa.inputdata) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), 
+			   rsa.inputdatalength)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL);
+	if (!rsa.outputdata) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+
+	rsa.b_key = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
+	if (!rsa.b_key) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.b_key, (char *)(u64)(b_key & 0x7fffffff), 
+			   rsa.inputdatalength)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.n_modulus = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
+	if (!rsa.n_modulus) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.n_modulus, (char *)(u64)(n_modulus & 0x7fffffff), 
+			   rsa.inputdatalength)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&rsa);
+	set_fs(old_fs);
+	if (err < 0)
+		goto cleanup;
+
+	if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata,
+			 rsa.outputdatalength))
+		err = -EFAULT;
+
+cleanup:
+	if (rsa.inputdata)
+		kfree(rsa.inputdata);
+	if (rsa.outputdata)
+		kfree(rsa.outputdata);
+	if (rsa.b_key)
+		kfree(rsa.b_key);
+	if (rsa.n_modulus)
+		kfree(rsa.n_modulus);
+	
+	return err;
+}
+
+static int do_rsa_crt_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	int err = 0;
+	ica_rsa_modexpo_crt_t rsa;
+	ica_rsa_modexpo_crt_32_t *rsa32 = (ica_rsa_modexpo_crt_32_t *)arg;
+	u32 inputdata, outputdata, bp_key, bq_key, np_prime, nq_prime, u_mult_inv;
+
+	memset (&rsa, 0, sizeof(rsa));
+
+	err |= __get_user (inputdata, &rsa32->inputdata);
+	err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength);
+	err |= __get_user (outputdata, &rsa32->outputdata);
+	err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength);
+	err |= __get_user (bp_key, &rsa32->bp_key);
+	err |= __get_user (bq_key, &rsa32->bq_key);
+	err |= __get_user (np_prime, &rsa32->np_prime);
+	err |= __get_user (nq_prime, &rsa32->nq_prime);
+	err |= __get_user (u_mult_inv, &rsa32->u_mult_inv);
+	if (err)
+		return -EFAULT;
+
+	rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
+	if (!rsa.inputdata) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), 
+			   rsa.inputdatalength)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL);
+	if (!rsa.outputdata) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+
+	rsa.bp_key = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
+	if (!rsa.bp_key) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.bp_key, (char *)(u64)(bp_key & 0x7fffffff), 
+			   rsa.inputdatalength/2 + 8)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.bq_key = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL);
+	if (!rsa.bq_key) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.bq_key, (char *)(u64)(bq_key & 0x7fffffff), 
+			   rsa.inputdatalength/2)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.np_prime = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
+	if (!rsa.np_prime) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.np_prime, (char *)(u64)(np_prime & 0x7fffffff), 
+			   rsa.inputdatalength/2 + 8)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.nq_prime = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL);
+	if (!rsa.nq_prime) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.nq_prime, (char *)(u64)(nq_prime & 0x7fffffff), 
+			   rsa.inputdatalength/2)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	rsa.u_mult_inv = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
+	if (!rsa.u_mult_inv) {
+		err = -ENOMEM;
+		goto cleanup;
+	}
+	if (copy_from_user(rsa.u_mult_inv, (char *)(u64)(u_mult_inv & 0x7fffffff), 
+			   rsa.inputdatalength/2 + 8)) {
+		err = -EFAULT;
+		goto cleanup;
+	}
+
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&rsa);
+	set_fs(old_fs);
+	if (err < 0)
+		goto cleanup;
+
+	if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata,
+			 rsa.outputdatalength))
+		err = -EFAULT;
+
+cleanup:
+	if (rsa.inputdata)
+		kfree(rsa.inputdata);
+	if (rsa.outputdata)
+		kfree(rsa.outputdata);
+	if (rsa.bp_key)
+		kfree(rsa.bp_key);
+	if (rsa.bq_key)
+		kfree(rsa.bq_key);
+	if (rsa.np_prime)
+		kfree(rsa.np_prime);
+	if (rsa.nq_prime)
+		kfree(rsa.nq_prime);
+	if (rsa.u_mult_inv)
+		kfree(rsa.u_mult_inv);
+	
+	return err;
+}
+
+static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	int err;
+	unsigned long val;
+	
+	set_fs (KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&val);
+	set_fs (old_fs);
+	if (!err && put_user((unsigned int) val, (u32 *)arg))
+		return -EFAULT;
+	return err;
+}
+
+struct ioctl32_handler {
+	unsigned int cmd;
+	int (*function)(unsigned int, unsigned int, unsigned long);
+};
+
+struct ioctl32_list {
+	struct ioctl32_handler handler;
+	struct ioctl32_list *next;
+};
+
+#define IOCTL32_DEFAULT(cmd)		{ { cmd, (void *) sys_ioctl }, 0 }
+#define IOCTL32_HANDLER(cmd, handler)	{ { cmd, (void *) handler }, 0 }
+
+static struct ioctl32_list ioctl32_handler_table[] = {
+	IOCTL32_DEFAULT(FIBMAP),
+	IOCTL32_DEFAULT(FIGETBSZ),
+
+	IOCTL32_DEFAULT(DASDAPIVER),
+	IOCTL32_DEFAULT(BIODASDDISABLE),
+	IOCTL32_DEFAULT(BIODASDENABLE),
+	IOCTL32_DEFAULT(BIODASDRSRV),
+	IOCTL32_DEFAULT(BIODASDRLSE),
+	IOCTL32_DEFAULT(BIODASDSLCK),
+	IOCTL32_DEFAULT(BIODASDINFO),
+	IOCTL32_DEFAULT(BIODASDFMT),
+
+	IOCTL32_DEFAULT(TAPE390_DISPLAY),
+
+	IOCTL32_DEFAULT(BLKROSET),
+	IOCTL32_DEFAULT(BLKROGET),
+	IOCTL32_DEFAULT(BLKRRPART),
+	IOCTL32_DEFAULT(BLKFLSBUF),
+	IOCTL32_DEFAULT(BLKRASET),
+	IOCTL32_DEFAULT(BLKFRASET),
+	IOCTL32_DEFAULT(BLKSECTSET),
+	IOCTL32_DEFAULT(BLKSSZGET),
+	IOCTL32_DEFAULT(BLKBSZGET),
+	IOCTL32_DEFAULT(BLKGETSIZE64),
+
+	IOCTL32_HANDLER(HDIO_GETGEO, hd_geometry_ioctl),
+
+	IOCTL32_DEFAULT(TCGETA),
+	IOCTL32_DEFAULT(TCSETA),
+	IOCTL32_DEFAULT(TCSETAW),
+	IOCTL32_DEFAULT(TCSETAF),
+	IOCTL32_DEFAULT(TCSBRK),
+	IOCTL32_DEFAULT(TCSBRKP),
+	IOCTL32_DEFAULT(TCXONC),
+	IOCTL32_DEFAULT(TCFLSH),
+	IOCTL32_DEFAULT(TCGETS),
+	IOCTL32_DEFAULT(TCSETS),
+	IOCTL32_DEFAULT(TCSETSW),
+	IOCTL32_DEFAULT(TCSETSF),
+	IOCTL32_DEFAULT(TIOCLINUX),
+
+	IOCTL32_DEFAULT(TIOCGETD),
+	IOCTL32_DEFAULT(TIOCSETD),
+	IOCTL32_DEFAULT(TIOCEXCL),
+	IOCTL32_DEFAULT(TIOCNXCL),
+	IOCTL32_DEFAULT(TIOCCONS),
+	IOCTL32_DEFAULT(TIOCGSOFTCAR),
+	IOCTL32_DEFAULT(TIOCSSOFTCAR),
+	IOCTL32_DEFAULT(TIOCSWINSZ),
+	IOCTL32_DEFAULT(TIOCGWINSZ),
+	IOCTL32_DEFAULT(TIOCMGET),
+	IOCTL32_DEFAULT(TIOCMBIC),
+	IOCTL32_DEFAULT(TIOCMBIS),
+	IOCTL32_DEFAULT(TIOCMSET),
+	IOCTL32_DEFAULT(TIOCPKT),
+	IOCTL32_DEFAULT(TIOCNOTTY),
+	IOCTL32_DEFAULT(TIOCSTI),
+	IOCTL32_DEFAULT(TIOCOUTQ),
+	IOCTL32_DEFAULT(TIOCSPGRP),
+	IOCTL32_DEFAULT(TIOCGPGRP),
+	IOCTL32_DEFAULT(TIOCSCTTY),
+	IOCTL32_DEFAULT(TIOCGPTN),
+	IOCTL32_DEFAULT(TIOCSPTLCK),
+	IOCTL32_DEFAULT(TIOCGSERIAL),
+	IOCTL32_DEFAULT(TIOCSSERIAL),
+	IOCTL32_DEFAULT(TIOCSERGETLSR),
+
+	IOCTL32_DEFAULT(FIOCLEX),
+	IOCTL32_DEFAULT(FIONCLEX),
+	IOCTL32_DEFAULT(FIOASYNC),
+	IOCTL32_DEFAULT(FIONBIO),
+	IOCTL32_DEFAULT(FIONREAD),
+
+	IOCTL32_DEFAULT(PIO_FONT),
+	IOCTL32_DEFAULT(GIO_FONT),
+	IOCTL32_DEFAULT(KDSIGACCEPT),
+	IOCTL32_DEFAULT(KDGETKEYCODE),
+	IOCTL32_DEFAULT(KDSETKEYCODE),
+	IOCTL32_DEFAULT(KIOCSOUND),
+	IOCTL32_DEFAULT(KDMKTONE),
+	IOCTL32_DEFAULT(KDGKBTYPE),
+	IOCTL32_DEFAULT(KDSETMODE),
+	IOCTL32_DEFAULT(KDGETMODE),
+	IOCTL32_DEFAULT(KDSKBMODE),
+	IOCTL32_DEFAULT(KDGKBMODE),
+	IOCTL32_DEFAULT(KDSKBMETA),
+	IOCTL32_DEFAULT(KDGKBMETA),
+	IOCTL32_DEFAULT(KDGKBENT),
+	IOCTL32_DEFAULT(KDSKBENT),
+	IOCTL32_DEFAULT(KDGKBSENT),
+	IOCTL32_DEFAULT(KDSKBSENT),
+	IOCTL32_DEFAULT(KDGKBDIACR),
+	IOCTL32_DEFAULT(KDSKBDIACR),
+	IOCTL32_DEFAULT(KDGKBLED),
+	IOCTL32_DEFAULT(KDSKBLED),
+	IOCTL32_DEFAULT(KDGETLED),
+	IOCTL32_DEFAULT(KDSETLED),
+	IOCTL32_DEFAULT(GIO_SCRNMAP),
+	IOCTL32_DEFAULT(PIO_SCRNMAP),
+	IOCTL32_DEFAULT(GIO_UNISCRNMAP),
+	IOCTL32_DEFAULT(PIO_UNISCRNMAP),
+	IOCTL32_DEFAULT(PIO_FONTRESET),
+	IOCTL32_DEFAULT(PIO_UNIMAPCLR),
+
+	IOCTL32_DEFAULT(VT_SETMODE),
+	IOCTL32_DEFAULT(VT_GETMODE),
+	IOCTL32_DEFAULT(VT_GETSTATE),
+	IOCTL32_DEFAULT(VT_OPENQRY),
+	IOCTL32_DEFAULT(VT_ACTIVATE),
+	IOCTL32_DEFAULT(VT_WAITACTIVE),
+	IOCTL32_DEFAULT(VT_RELDISP),
+	IOCTL32_DEFAULT(VT_DISALLOCATE),
+	IOCTL32_DEFAULT(VT_RESIZE),
+	IOCTL32_DEFAULT(VT_RESIZEX),
+	IOCTL32_DEFAULT(VT_LOCKSWITCH),
+	IOCTL32_DEFAULT(VT_UNLOCKSWITCH),
+
+	IOCTL32_DEFAULT(SIOCGSTAMP),
+
+	IOCTL32_DEFAULT(DM_VERSION),
+	IOCTL32_DEFAULT(DM_REMOVE_ALL),
+	IOCTL32_DEFAULT(DM_DEV_CREATE),
+	IOCTL32_DEFAULT(DM_DEV_REMOVE),
+	IOCTL32_DEFAULT(DM_DEV_RELOAD),
+	IOCTL32_DEFAULT(DM_DEV_SUSPEND),
+	IOCTL32_DEFAULT(DM_DEV_RENAME),
+	IOCTL32_DEFAULT(DM_DEV_DEPS),
+	IOCTL32_DEFAULT(DM_DEV_STATUS),
+	IOCTL32_DEFAULT(DM_TARGET_STATUS),
+	IOCTL32_DEFAULT(DM_TARGET_WAIT),
+
+	IOCTL32_DEFAULT(LOOP_SET_FD),
+	IOCTL32_DEFAULT(LOOP_CLR_FD),
+
+	IOCTL32_HANDLER(SIOCGIFNAME, dev_ifname32),
+	IOCTL32_HANDLER(SIOCGIFCONF, dev_ifconf),
+	IOCTL32_HANDLER(SIOCGIFFLAGS, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFFLAGS, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFMETRIC, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFMETRIC, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFMTU, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFMTU, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFMEM, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFMEM, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFHWADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFHWADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCADDMULTI, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCDELMULTI, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFINDEX, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFMAP, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFMAP, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFBRDADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFBRDADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFDSTADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFDSTADDR, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFNETMASK, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFNETMASK, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFPFLAGS, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFPFLAGS, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCGIFTXQLEN, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCSIFTXQLEN, dev_ifsioc),
+	IOCTL32_HANDLER(SIOCADDRT, routing_ioctl),
+	IOCTL32_HANDLER(SIOCDELRT, routing_ioctl),
+
+	IOCTL32_HANDLER(SIOCBONDENSLAVE, bond_ioctl),
+	IOCTL32_HANDLER(SIOCBONDRELEASE, bond_ioctl),
+	IOCTL32_HANDLER(SIOCBONDSETHWADDR, bond_ioctl),
+	IOCTL32_HANDLER(SIOCBONDSLAVEINFOQUERY, bond_ioctl),
+	IOCTL32_HANDLER(SIOCBONDINFOQUERY, bond_ioctl),
+	IOCTL32_HANDLER(SIOCBONDCHANGEACTIVE, bond_ioctl),
+
+	IOCTL32_HANDLER(EXT2_IOC32_GETFLAGS, do_ext2_ioctl),
+	IOCTL32_HANDLER(EXT2_IOC32_SETFLAGS, do_ext2_ioctl),
+	IOCTL32_HANDLER(EXT2_IOC32_GETVERSION, do_ext2_ioctl),
+	IOCTL32_HANDLER(EXT2_IOC32_SETVERSION, do_ext2_ioctl),
+
+	IOCTL32_HANDLER(LOOP_SET_STATUS, loop_status),
+	IOCTL32_HANDLER(LOOP_GET_STATUS, loop_status),
+
+	IOCTL32_HANDLER(ICARSAMODEXPO, do_rsa_ioctl),
+	IOCTL32_HANDLER(ICARSACRT, do_rsa_crt_ioctl),
+	IOCTL32_HANDLER(ICARSAMODMULT, do_rsa_ioctl),
+	IOCTL32_DEFAULT(ICAZ90STATUS),
+	IOCTL32_DEFAULT(ICAZ90QUIESCE),
+	IOCTL32_DEFAULT(ICAZ90HARDRESET),
+	IOCTL32_DEFAULT(ICAZ90HARDERROR),
+
+	IOCTL32_HANDLER(BLKRAGET, w_long),
+	IOCTL32_HANDLER(BLKGETSIZE, w_long),
+	IOCTL32_HANDLER(BLKFRAGET, w_long),
+	IOCTL32_HANDLER(BLKSECTGET, w_long),
+	IOCTL32_HANDLER(BLKPG, blkpg_ioctl_trans)
+
+};
+
+#define NR_IOCTL32_HANDLERS	(sizeof(ioctl32_handler_table) /	\
+				 sizeof(ioctl32_handler_table[0]))
+
+static struct ioctl32_list *ioctl32_hash_table[1024];
+
+static inline int ioctl32_hash(unsigned int cmd)
+{
+	return ((cmd >> 6) ^ (cmd >> 4) ^ cmd) & 0x3ff;
+}
+
+int sys32_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	int (*handler)(unsigned int, unsigned int, unsigned long, struct file * filp);
+	struct file *filp;
+	struct ioctl32_list *l;
+	int error;
+
+	l = ioctl32_hash_table[ioctl32_hash(cmd)];
+
+	error = -EBADF;
+
+	filp = fget(fd);
+	if (!filp)
+		return error;
+
+	if (!filp->f_op || !filp->f_op->ioctl) {
+		error = sys_ioctl (fd, cmd, arg);
+		goto out;
+	}
+
+	while (l && l->handler.cmd != cmd)
+		l = l->next;
+
+	if (l) {
+		handler = (void *)l->handler.function;
+		error = handler(fd, cmd, arg, filp);
+	} else {
+		error = -EINVAL;
+		printk("unknown ioctl: %08x\n", cmd);
+	}
+out:
+	fput(filp);
+	return error;
+}
+
+static void ioctl32_insert(struct ioctl32_list *entry)
+{
+	int hash = ioctl32_hash(entry->handler.cmd);
+
+	entry->next = 0;
+	if (!ioctl32_hash_table[hash])
+		ioctl32_hash_table[hash] = entry;
+	else {
+		struct ioctl32_list *l;
+		l = ioctl32_hash_table[hash];
+		while (l->next)
+			l = l->next;
+		l->next = entry;
+	}
+}
+
+int register_ioctl32_conversion(unsigned int cmd,
+				int (*handler)(unsigned int, unsigned int,
+					       unsigned long, struct file *))
+{
+	struct ioctl32_list *l, *new;
+	int hash;
+
+	hash = ioctl32_hash(cmd);
+	for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next)
+		if (l->handler.cmd == cmd)
+			return -EBUSY;
+	new = kmalloc(sizeof(struct ioctl32_list), GFP_KERNEL);
+	if (new == NULL)
+		return -ENOMEM;
+	new->handler.cmd = cmd;
+	new->handler.function = (void *) handler;
+	ioctl32_insert(new);
+	return 0;
+}
+
+int unregister_ioctl32_conversion(unsigned int cmd)
+{
+	struct ioctl32_list *p, *l;
+	int hash;
+
+	hash = ioctl32_hash(cmd);
+	p = NULL;
+	for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next) {
+		if (l->handler.cmd == cmd)
+			break;
+		p = l;
+	}
+	if (l == NULL)
+		return -ENOENT;
+	if (p == NULL)
+		ioctl32_hash_table[hash] = l->next;
+	else
+		p->next = l->next;
+	kfree(l);
+	return 0;
+}
+
+static int __init init_ioctl32(void)
+{
+	int i;
+	for (i = 0; i < NR_IOCTL32_HANDLERS; i++)
+		ioctl32_insert(&ioctl32_handler_table[i]);
+	return 0;
+}
+
+__initcall(init_ioctl32);
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_linux.c linux-2.5.67-bk6/arch/s390/kernel/compat_linux.c
--- linux-2.5.67-bk5/arch/s390/kernel/compat_linux.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_linux.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,2863 @@
+/*
+ *  arch/s390x/kernel/linux32.c
+ *
+ *  S390 version
+ *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
+ *               Gerhard Tonn (ton@de.ibm.com)   
+ *
+ *  Conversion between 31bit and 64bit native syscalls.
+ *
+ * Heavily inspired by the 32-bit Sparc compat code which is 
+ * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
+ *
+ */
+
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/fs.h> 
+#include <linux/mm.h> 
+#include <linux/file.h> 
+#include <linux/signal.h>
+#include <linux/resource.h>
+#include <linux/times.h>
+#include <linux/utsname.h>
+#include <linux/timex.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/sem.h>
+#include <linux/msg.h>
+#include <linux/shm.h>
+#include <linux/slab.h>
+#include <linux/uio.h>
+#include <linux/nfs_fs.h>
+#include <linux/smb_fs.h>
+#include <linux/smb_mount.h>
+#include <linux/ncp_fs.h>
+#include <linux/quota.h>
+#include <linux/module.h>
+#include <linux/sunrpc/svc.h>
+#include <linux/nfsd/nfsd.h>
+#include <linux/nfsd/cache.h>
+#include <linux/nfsd/xdr.h>
+#include <linux/nfsd/syscall.h>
+#include <linux/poll.h>
+#include <linux/personality.h>
+#include <linux/stat.h>
+#include <linux/filter.h>
+#include <linux/highmem.h>
+#include <linux/highuid.h>
+#include <linux/mman.h>
+#include <linux/ipv6.h>
+#include <linux/in.h>
+#include <linux/icmpv6.h>
+#include <linux/sysctl.h>
+#include <linux/binfmts.h>
+#include <linux/compat.h>
+#include <linux/vfs.h>
+#include <linux/ptrace.h>
+
+#include <asm/types.h>
+#include <asm/ipc.h>
+#include <asm/uaccess.h>
+#include <asm/semaphore.h>
+
+#include <net/scm.h>
+#include <net/sock.h>
+
+#include "compat_linux.h"
+
+extern asmlinkage long sys_chown(const char *, uid_t,gid_t);
+extern asmlinkage long sys_lchown(const char *, uid_t,gid_t);
+extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t);
+extern asmlinkage long sys_setregid(gid_t, gid_t);
+extern asmlinkage long sys_setgid(gid_t);
+extern asmlinkage long sys_setreuid(uid_t, uid_t);
+extern asmlinkage long sys_setuid(uid_t);
+extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t);
+extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t);
+extern asmlinkage long sys_setfsuid(uid_t);
+extern asmlinkage long sys_setfsgid(gid_t);
+ 
+/* For this source file, we want overflow handling. */
+
+#undef high2lowuid
+#undef high2lowgid
+#undef low2highuid
+#undef low2highgid
+#undef SET_UID16
+#undef SET_GID16
+#undef NEW_TO_OLD_UID
+#undef NEW_TO_OLD_GID
+#undef SET_OLDSTAT_UID
+#undef SET_OLDSTAT_GID
+#undef SET_STAT_UID
+#undef SET_STAT_GID
+
+#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
+#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid)
+#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid)
+#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid)
+#define SET_UID16(var, uid)	var = high2lowuid(uid)
+#define SET_GID16(var, gid)	var = high2lowgid(gid)
+#define NEW_TO_OLD_UID(uid)	high2lowuid(uid)
+#define NEW_TO_OLD_GID(gid)	high2lowgid(gid)
+#define SET_OLDSTAT_UID(stat, uid)	(stat).st_uid = high2lowuid(uid)
+#define SET_OLDSTAT_GID(stat, gid)	(stat).st_gid = high2lowgid(gid)
+#define SET_STAT_UID(stat, uid)		(stat).st_uid = high2lowuid(uid)
+#define SET_STAT_GID(stat, gid)		(stat).st_gid = high2lowgid(gid)
+
+asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
+{
+	return sys_chown(filename, low2highuid(user), low2highgid(group));
+}
+
+asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
+{
+	return sys_lchown(filename, low2highuid(user), low2highgid(group));
+}
+
+asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group)
+{
+	return sys_fchown(fd, low2highuid(user), low2highgid(group));
+}
+
+asmlinkage long sys32_setregid16(u16 rgid, u16 egid)
+{
+	return sys_setregid(low2highgid(rgid), low2highgid(egid));
+}
+
+asmlinkage long sys32_setgid16(u16 gid)
+{
+	return sys_setgid((gid_t)gid);
+}
+
+asmlinkage long sys32_setreuid16(u16 ruid, u16 euid)
+{
+	return sys_setreuid(low2highuid(ruid), low2highuid(euid));
+}
+
+asmlinkage long sys32_setuid16(u16 uid)
+{
+	return sys_setuid((uid_t)uid);
+}
+
+asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
+{
+	return sys_setresuid(low2highuid(ruid), low2highuid(euid),
+		low2highuid(suid));
+}
+
+asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid)
+{
+	int retval;
+
+	if (!(retval = put_user(high2lowuid(current->uid), ruid)) &&
+	    !(retval = put_user(high2lowuid(current->euid), euid)))
+		retval = put_user(high2lowuid(current->suid), suid);
+
+	return retval;
+}
+
+asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
+{
+	return sys_setresgid(low2highgid(rgid), low2highgid(egid),
+		low2highgid(sgid));
+}
+
+asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid)
+{
+	int retval;
+
+	if (!(retval = put_user(high2lowgid(current->gid), rgid)) &&
+	    !(retval = put_user(high2lowgid(current->egid), egid)))
+		retval = put_user(high2lowgid(current->sgid), sgid);
+
+	return retval;
+}
+
+asmlinkage long sys32_setfsuid16(u16 uid)
+{
+	return sys_setfsuid((uid_t)uid);
+}
+
+asmlinkage long sys32_setfsgid16(u16 gid)
+{
+	return sys_setfsgid((gid_t)gid);
+}
+
+asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
+{
+	u16 groups[NGROUPS];
+	int i,j;
+
+	if (gidsetsize < 0)
+		return -EINVAL;
+	i = current->ngroups;
+	if (gidsetsize) {
+		if (i > gidsetsize)
+			return -EINVAL;
+		for(j=0;j<i;j++)
+			groups[j] = current->groups[j];
+		if (copy_to_user(grouplist, groups, sizeof(u16)*i))
+			return -EFAULT;
+	}
+	return i;
+}
+
+asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist)
+{
+	u16 groups[NGROUPS];
+	int i;
+
+	if (!capable(CAP_SETGID))
+		return -EPERM;
+	if ((unsigned) gidsetsize > NGROUPS)
+		return -EINVAL;
+	if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16)))
+		return -EFAULT;
+	for (i = 0 ; i < gidsetsize ; i++)
+		current->groups[i] = (gid_t)groups[i];
+	current->ngroups = gidsetsize;
+	return 0;
+}
+
+asmlinkage long sys32_getuid16(void)
+{
+	return high2lowuid(current->uid);
+}
+
+asmlinkage long sys32_geteuid16(void)
+{
+	return high2lowuid(current->euid);
+}
+
+asmlinkage long sys32_getgid16(void)
+{
+	return high2lowgid(current->gid);
+}
+
+asmlinkage long sys32_getegid16(void)
+{
+	return high2lowgid(current->egid);
+}
+
+/* 32-bit timeval and related flotsam.  */
+
+static inline long get_tv32(struct timeval *o, struct compat_timeval *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)
+{
+	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
+		(__put_user(i->tv_sec, &o->tv_sec) |
+		 __put_user(i->tv_usec, &o->tv_usec)));
+}
+
+struct msgbuf32 { s32 mtype; char mtext[1]; };
+
+struct ipc64_perm_ds32
+{
+        __kernel_key_t          key;
+        __kernel_uid32_t        uid;
+        __kernel_gid32_t        gid;
+        __kernel_uid32_t        cuid;
+        __kernel_gid32_t        cgid;
+        compat_mode_t       mode;
+        unsigned short          __pad1;
+        unsigned short          seq;
+        unsigned short          __pad2;
+        unsigned int            __unused1;
+        unsigned int            __unused2;
+};
+
+struct ipc_perm32
+{
+	key_t    	  key;
+        compat_uid_t  uid;
+        compat_gid_t  gid;
+        compat_uid_t  cuid;
+        compat_gid_t  cgid;
+        compat_mode_t mode;
+        unsigned short  seq;
+};
+
+struct semid_ds32 {
+        struct ipc_perm32 sem_perm;               /* permissions .. see ipc.h */
+        compat_time_t   sem_otime;              /* last semop time */
+        compat_time_t   sem_ctime;              /* last change time */
+        u32 sem_base;              /* ptr to first semaphore in array */
+        u32 sem_pending;          /* pending operations to be processed */
+        u32 sem_pending_last;    /* last pending operation */
+        u32 undo;                  /* undo requests on this array */
+        unsigned short  sem_nsems;              /* no. of semaphores in array */
+};
+
+struct semid64_ds32 {
+	struct ipc64_perm_ds32 sem_perm;
+	unsigned int	  __pad1;
+	compat_time_t   sem_otime;
+	unsigned int	  __pad2;
+	compat_time_t   sem_ctime;
+	u32 sem_nsems;
+	u32 __unused1;
+	u32 __unused2;
+};
+
+struct msqid_ds32
+{
+        struct ipc_perm32 msg_perm;
+        u32 msg_first;
+        u32 msg_last;
+        compat_time_t   msg_stime;
+        compat_time_t   msg_rtime;
+        compat_time_t   msg_ctime;
+        u32 wwait;
+        u32 rwait;
+        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_ds32 msg_perm;
+	unsigned int   __pad1;
+	compat_time_t msg_stime;
+	unsigned int   __pad2;
+	compat_time_t msg_rtime;
+	unsigned int   __pad3;
+	compat_time_t msg_ctime;
+	unsigned int  msg_cbytes;
+	unsigned int  msg_qnum;
+	unsigned int  msg_qbytes;
+	compat_pid_t msg_lspid;
+	compat_pid_t msg_lrpid;
+	unsigned int  __unused1;
+	unsigned int  __unused2;
+};
+
+
+struct shmid_ds32 {
+	struct ipc_perm32       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;
+};
+
+struct shmid64_ds32 {
+	struct ipc64_perm_ds32	shm_perm;
+	compat_size_t	shm_segsz;
+	compat_time_t  	shm_atime;
+	unsigned int		__unused1;
+	compat_time_t  	shm_dtime;
+	unsigned int		__unused2;
+	compat_time_t  	shm_ctime;
+	unsigned int		__unused3;
+	compat_pid_t	shm_cpid;
+	compat_pid_t	shm_lpid;
+	unsigned int		shm_nattch;
+	unsigned int		__unused4;
+	unsigned int		__unused5;
+};
+
+                                                        
+/*
+ * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation..
+ *
+ * This is really horribly ugly.
+ */
+#define IPCOP_MASK(__x)	(1UL << (__x))
+static int do_sys32_semctl(int first, int second, int third, void *uptr)
+{
+	union semun fourth;
+	u32 pad;
+	int err = -EINVAL;
+
+	if (!uptr)
+		goto out;
+	err = -EFAULT;
+	if (get_user (pad, (u32 *)uptr))
+		goto out;
+	if(third == SETVAL)
+		fourth.val = (int)pad;
+	else
+		fourth.__pad = (void *)A(pad);
+	if (IPCOP_MASK (third) &
+	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
+	     IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
+	     IPCOP_MASK (GETALL) | IPCOP_MASK (SETALL) | IPCOP_MASK (IPC_RMID))) {
+		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);
+		mm_segment_t old_fs;
+		int need_back_translation;
+
+		if (third == (IPC_SET|IPC_64)) {
+			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;
+		}
+		need_back_translation =
+			(IPCOP_MASK (third) &
+			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
+		if (need_back_translation)
+			fourth.__pad = &s;
+		old_fs = get_fs ();
+		set_fs (KERNEL_DS);
+		err = sys_semctl (first, second, third, fourth);
+		set_fs (old_fs);
+		if (need_back_translation) {
+			int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key);
+			err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid);
+			err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid);
+			err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid);
+			err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid);
+			err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode);
+			err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq);
+			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;
+		}
+	} else {
+		struct semid_ds s;
+		struct semid_ds32 *usp = (struct semid_ds32 *)A(pad);
+		mm_segment_t old_fs;
+		int need_back_translation;
+
+		if (third == IPC_SET) {
+			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;
+		}
+		need_back_translation =
+			(IPCOP_MASK (third) &
+			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
+		if (need_back_translation)
+			fourth.__pad = &s;
+		old_fs = get_fs ();
+		set_fs (KERNEL_DS);
+		err = sys_semctl (first, second, third, fourth);
+		set_fs (old_fs);
+		if (need_back_translation) {
+			int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key);
+			err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid);
+			err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid);
+			err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid);
+			err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid);
+			err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode);
+			err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq);
+			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;
+		}
+	}
+out:
+	return err;
+}
+
+static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
+{
+	struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
+	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
+	mm_segment_t old_fs;
+	int err;
+
+	if (!p)
+		return -ENOMEM;
+
+	err = -EINVAL;
+	if (second > MSGMAX || first < 0 || second < 0)
+		goto out;
+
+	err = -EFAULT;
+	if (!uptr)
+		goto out;
+        if (get_user (p->mtype, &up->mtype) ||
+	    __copy_from_user (p->mtext, &up->mtext, second))
+		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;
+}
+
+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 (first < 0 || second < 0)
+		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;
+
+	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);
+	} else if (second & IPC_64) {
+		struct msqid64_ds m;
+		struct msqid64_ds32 *up = (struct msqid64_ds32 *)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);
+			if (err)
+				goto out;
+		}
+		old_fs = get_fs ();
+		set_fs (KERNEL_DS);
+		err = sys_msgctl (first, second, (struct msqid_ds *)&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);
+			if (err2)
+				err = -EFAULT;
+		}
+	} else {
+		struct msqid_ds m;
+		struct msqid_ds32 *up = (struct msqid_ds32 *)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);
+			if (err)
+				goto out;
+		}
+		old_fs = get_fs ();
+		set_fs (KERNEL_DS);
+		err = sys_msgctl (first, second, &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);
+			if (err2)
+				err = -EFAULT;
+		}
+	}
+
+out:
+	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)
+		goto out;
+	err = sys_shmat (first, uptr, second, &raddr);
+	if (err)
+		goto out;
+	err = put_user (raddr, uaddr);
+out:
+	return err;
+}
+
+static int do_sys32_shmctl (int first, int second, void *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);
+	} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
+		struct shmid64_ds s;
+		struct shmid64_ds32 *up = (struct shmid64_ds32 *)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);
+			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);
+		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 = 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 (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid);
+			err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid);
+			err2 |= __put_user (high2lowgid(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;
+		}
+	} else {
+		struct shmid_ds s;
+		struct shmid_ds32 *up = (struct shmid_ds32 *)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);
+			if (err)
+				goto out;
+		}
+		old_fs = get_fs ();
+		set_fs (KERNEL_DS);
+		err = sys_shmctl (first, second, &s);
+		set_fs (old_fs);
+		if (err < 0)
+			goto out;
+
+		/* Mask it even in this case so it becomes a CSE. */
+		if (second == SHM_INFO) {
+			struct shm_info32 {
+				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);
+			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 (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid);
+			err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid);
+			err2 |= __put_user (high2lowgid(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;
+		}
+	}
+out:
+	return err;
+}
+
+asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
+{
+	int version, err;
+
+	version = call >> 16; /* hack for backward compatibility */
+	call &= 0xffff;
+
+	if(version)
+		return -EINVAL;
+
+	if (call <= SEMCTL)
+		switch (call) {
+		case SEMOP:
+			/* struct sembuf is the same on 32 and 64bit :)) */
+			err = sys_semop (first, (struct sembuf *)AA(ptr), second);
+			goto out;
+		case SEMGET:
+			err = sys_semget (first, second, third);
+			goto out;
+		case SEMCTL:
+			err = do_sys32_semctl (first, second, third, (void *)AA(ptr));
+			goto out;
+		default:
+			err = -EINVAL;
+			goto out;
+		};
+	if (call <= MSGCTL) 
+		switch (call) {
+		case MSGSND:
+			err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr));
+			goto out;
+		case MSGRCV:
+			err = do_sys32_msgrcv (first, second, 0, third,
+					       version, (void *)AA(ptr));
+			goto out;
+		case MSGGET:
+			err = sys_msgget ((key_t) first, second);
+			goto out;
+		case MSGCTL:
+			err = do_sys32_msgctl (first, second, (void *)AA(ptr));
+			goto out;
+		default:
+			err = -EINVAL;
+			goto out;
+		}
+	if (call <= SHMCTL) 
+		switch (call) {
+		case SHMAT:
+			err = do_sys32_shmat (first, second, third,
+					      version, (void *)AA(ptr));
+			goto out;
+		case SHMDT: 
+			err = sys_shmdt ((char *)AA(ptr));
+			goto out;
+		case SHMGET:
+			err = sys_shmget (first, second, third);
+			goto out;
+		case SHMCTL:
+			err = do_sys32_shmctl (first, second, (void *)AA(ptr));
+			goto out;
+		default:
+			err = -EINVAL;
+			goto out;
+		}
+
+	err = -EINVAL;
+
+out:
+	return err;
+}
+
+extern asmlinkage long sys_truncate(const char * path, unsigned long length);
+extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
+
+asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
+{
+	if ((int)high < 0)
+		return -EINVAL;
+	else
+		return sys_truncate(path, (high << 32) | low);
+}
+
+asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
+{
+	if ((int)high < 0)
+		return -EINVAL;
+	else
+		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;
+	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)
+		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, u32 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, u32 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)))
+#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
+
+struct old_linux_dirent32 {
+	u32		d_ino;
+	u32		d_offset;
+	unsigned short	d_namlen;
+	char		d_name[1];
+};
+
+struct readdir_callback32 {
+	struct old_linux_dirent32 * dirent;
+	int count;
+};
+
+static int fillonedir(void * __buf, const char * name, int namlen,
+		      loff_t offset, ino_t ino, unsigned int d_type)
+{
+	struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
+	struct old_linux_dirent32 * dirent;
+
+	if (buf->count)
+		return -EINVAL;
+	buf->count++;
+	dirent = buf->dirent;
+	put_user(ino, &dirent->d_ino);
+	put_user(offset, &dirent->d_offset);
+	put_user(namlen, &dirent->d_namlen);
+	copy_to_user(dirent->d_name, name, namlen);
+	put_user(0, dirent->d_name + namlen);
+	return 0;
+}
+
+asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
+{
+	int error = -EBADF;
+	struct file * file;
+	struct readdir_callback32 buf;
+
+	file = fget(fd);
+	if (!file)
+		goto out;
+
+	buf.count = 0;
+	buf.dirent = dirent;
+
+	error = vfs_readdir(file, fillonedir, &buf);
+	if (error < 0)
+		goto out_putf;
+	error = buf.count;
+
+out_putf:
+	fput(file);
+out:
+	return error;
+}
+
+struct linux_dirent32 {
+	u32		d_ino;
+	u32		d_off;
+	unsigned short	d_reclen;
+	char		d_name[1];
+};
+
+struct getdents_callback32 {
+	struct linux_dirent32 * current_dir;
+	struct linux_dirent32 * previous;
+	int count;
+	int error;
+};
+
+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 getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
+	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+
+	buf->error = -EINVAL;	/* only used if we fail.. */
+	if (reclen > buf->count)
+		return -EINVAL;
+	dirent = buf->previous;
+	if (dirent)
+		put_user(offset, &dirent->d_off);
+	dirent = buf->current_dir;
+	buf->previous = dirent;
+	put_user(ino, &dirent->d_ino);
+	put_user(reclen, &dirent->d_reclen);
+	copy_to_user(dirent->d_name, name, namlen);
+	put_user(0, dirent->d_name + namlen);
+	((char *) 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)
+{
+	struct file * file;
+	struct linux_dirent32 * lastdirent;
+	struct getdents_callback32 buf;
+	int error = -EBADF;
+
+	file = fget(fd);
+	if (!file)
+		goto out;
+
+	buf.current_dir = dirent;
+	buf.previous = NULL;
+	buf.count = count;
+	buf.error = 0;
+
+	error = vfs_readdir(file, filldir, &buf);
+	if (error < 0)
+		goto out_putf;
+	lastdirent = buf.previous;
+	error = buf.error;
+	if(lastdirent) {
+		put_user(file->f_pos, &lastdirent->d_off);
+		error = count - buf.count;
+	}
+out_putf:
+	fput(file);
+out:
+	return error;
+}
+
+/* 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 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) {
+		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;
+
+	err = put_user(stat->dev, &statbuf->st_dev);
+	err |= put_user(stat->ino, &statbuf->st_ino);
+	err |= put_user(stat->mode, &statbuf->st_mode);
+	err |= put_user(stat->nlink, &statbuf->st_nlink);
+	err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
+	err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
+	err |= put_user(stat->rdev, &statbuf->st_rdev);
+	err |= put_user(stat->size, &statbuf->st_size);
+	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
+	err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
+	err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
+	err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
+	err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
+	err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
+	err |= put_user(stat->blksize, &statbuf->st_blksize);
+	err |= put_user(stat->blocks, &statbuf->st_blocks);
+/* fixme
+	err |= put_user(0, &statbuf->__unused4[0]);
+	err |= put_user(0, &statbuf->__unused4[1]);
+*/
+	return err;
+}
+
+extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
+
+asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
+{
+	return sys_sysfs(option, arg1, arg2);
+}
+
+struct ncp_mount_data32 {
+        int version;
+        unsigned int ncp_fd;
+        compat_uid_t mounted_uid;
+        compat_pid_t wdog_pid;
+        unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
+        unsigned int time_out;
+        unsigned int retry_count;
+        unsigned int flags;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
+};
+
+static void *do_ncp_super_data_conv(void *raw_data)
+{
+	struct ncp_mount_data *n = (struct ncp_mount_data *)raw_data;
+	struct ncp_mount_data32 *n32 = (struct ncp_mount_data32 *)raw_data;
+
+	n->dir_mode = n32->dir_mode;
+	n->file_mode = n32->file_mode;
+	n->gid = low2highgid(n32->gid);
+	n->uid = low2highuid(n32->uid);
+	memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int)));
+	n->wdog_pid = n32->wdog_pid;
+	n->mounted_uid = low2highuid(n32->mounted_uid);
+	return raw_data;
+}
+
+struct smb_mount_data32 {
+        int version;
+        compat_uid_t mounted_uid;
+        compat_uid_t uid;
+        compat_gid_t gid;
+        compat_mode_t file_mode;
+        compat_mode_t dir_mode;
+};
+
+static void *do_smb_super_data_conv(void *raw_data)
+{
+	struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
+	struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
+
+	if (s32->version != SMB_MOUNT_OLDVERSION)
+		goto out;
+	s->version = s32->version;
+	s->mounted_uid = low2highuid(s32->mounted_uid);
+	s->uid = low2highuid(s32->uid);
+	s->gid = low2highgid(s32->gid);
+	s->file_mode = s32->file_mode;
+	s->dir_mode = s32->dir_mode;
+out:
+	return raw_data;
+}
+
+static int copy_mount_stuff_to_kernel(const void *user, unsigned long *kernel)
+{
+	int i;
+	unsigned long page;
+	struct vm_area_struct *vma;
+
+	*kernel = 0;
+	if(!user)
+		return 0;
+	vma = find_vma(current->mm, (unsigned long)user);
+	if(!vma || (unsigned long)user < vma->vm_start)
+		return -EFAULT;
+	if(!(vma->vm_flags & VM_READ))
+		return -EFAULT;
+	i = vma->vm_end - (unsigned long) user;
+	if(PAGE_SIZE <= (unsigned long) i)
+		i = PAGE_SIZE - 1;
+	if(!(page = __get_free_page(GFP_KERNEL)))
+		return -ENOMEM;
+	if(copy_from_user((void *) page, user, i)) {
+		free_page(page);
+		return -EFAULT;
+	}
+	*kernel = page;
+	return 0;
+}
+
+#define SMBFS_NAME	"smbfs"
+#define NCPFS_NAME	"ncpfs"
+
+asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned long new_flags, u32 data)
+{
+	unsigned long type_page = 0;
+	unsigned long data_page = 0;
+	unsigned long dev_page = 0;
+	unsigned long dir_page = 0;
+	int err, is_smb, is_ncp;
+
+	is_smb = is_ncp = 0;
+
+	err = copy_mount_stuff_to_kernel((const void *)type, &type_page);
+	if (err)
+		goto out;
+
+	if (!type_page) {
+		err = -EINVAL;
+		goto out;
+	}
+
+	is_smb = !strcmp((char *)type_page, SMBFS_NAME);
+	is_ncp = !strcmp((char *)type_page, NCPFS_NAME);
+
+	err = copy_mount_stuff_to_kernel((const void *)AA(data), &data_page);
+	if (err)
+		goto type_out;
+
+	err = copy_mount_stuff_to_kernel(dev_name, &dev_page);
+	if (err)
+		goto data_out;
+
+	err = copy_mount_stuff_to_kernel(dir_name, &dir_page);
+	if (err)
+		goto dev_out;
+
+	if (!is_smb && !is_ncp) {
+		lock_kernel();
+		err = do_mount((char*)dev_page, (char*)dir_page,
+				(char*)type_page, new_flags, (char*)data_page);
+		unlock_kernel();
+	} else {
+		if (is_ncp)
+			do_ncp_super_data_conv((void *)data_page);
+		else
+			do_smb_super_data_conv((void *)data_page);
+
+		lock_kernel();
+		err = do_mount((char*)dev_page, (char*)dir_page,
+				(char*)type_page, new_flags, (char*)data_page);
+		unlock_kernel();
+	}
+	free_page(dir_page);
+
+dev_out:
+	free_page(dev_page);
+
+data_out:
+	free_page(data_page);
+
+type_out:
+	free_page(type_page);
+
+out:
+	return err;
+}
+
+struct rusage32 {
+        struct compat_timeval ru_utime;
+        struct compat_timeval ru_stime;
+        s32    ru_maxrss;
+        s32    ru_ixrss;
+        s32    ru_idrss;
+        s32    ru_isrss;
+        s32    ru_minflt;
+        s32    ru_majflt;
+        s32    ru_nswap;
+        s32    ru_inblock;
+        s32    ru_oublock;
+        s32    ru_msgsnd; 
+        s32    ru_msgrcv; 
+        s32    ru_nsignals;
+        s32    ru_nvcsw;
+        s32    ru_nivcsw;
+};
+
+static int put_rusage (struct rusage32 *ru, struct rusage *r)
+{
+	int err;
+	
+	err = put_user (r->ru_utime.tv_sec, &ru->ru_utime.tv_sec);
+	err |= __put_user (r->ru_utime.tv_usec, &ru->ru_utime.tv_usec);
+	err |= __put_user (r->ru_stime.tv_sec, &ru->ru_stime.tv_sec);
+	err |= __put_user (r->ru_stime.tv_usec, &ru->ru_stime.tv_usec);
+	err |= __put_user (r->ru_maxrss, &ru->ru_maxrss);
+	err |= __put_user (r->ru_ixrss, &ru->ru_ixrss);
+	err |= __put_user (r->ru_idrss, &ru->ru_idrss);
+	err |= __put_user (r->ru_isrss, &ru->ru_isrss);
+	err |= __put_user (r->ru_minflt, &ru->ru_minflt);
+	err |= __put_user (r->ru_majflt, &ru->ru_majflt);
+	err |= __put_user (r->ru_nswap, &ru->ru_nswap);
+	err |= __put_user (r->ru_inblock, &ru->ru_inblock);
+	err |= __put_user (r->ru_oublock, &ru->ru_oublock);
+	err |= __put_user (r->ru_msgsnd, &ru->ru_msgsnd);
+	err |= __put_user (r->ru_msgrcv, &ru->ru_msgrcv);
+	err |= __put_user (r->ru_nsignals, &ru->ru_nsignals);
+	err |= __put_user (r->ru_nvcsw, &ru->ru_nvcsw);
+	err |= __put_user (r->ru_nivcsw, &ru->ru_nivcsw);
+	return err;
+}
+
+asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
+{
+	if (!ru)
+		return sys_wait4(pid, stat_addr, options, NULL);
+	else {
+		struct rusage r;
+		int ret;
+		unsigned int status;
+		mm_segment_t old_fs = get_fs();
+		
+		set_fs (KERNEL_DS);
+		ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r);
+		set_fs (old_fs);
+		if (put_rusage (ru, &r)) return -EFAULT;
+		if (stat_addr && put_user (status, stat_addr))
+			return -EFAULT;
+		return ret;
+	}
+}
+
+struct sysinfo32 {
+        s32 uptime;
+        u32 loads[3];
+        u32 totalram;
+        u32 freeram;
+        u32 sharedram;
+        u32 bufferram;
+        u32 totalswap;
+        u32 freeswap;
+        unsigned short procs;
+        char _f[22];
+};
+
+extern asmlinkage int sys_sysinfo(struct sysinfo *info);
+
+asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+{
+	struct sysinfo s;
+	int ret, err;
+	mm_segment_t old_fs = get_fs ();
+	
+	set_fs (KERNEL_DS);
+	ret = sys_sysinfo(&s);
+	set_fs (old_fs);
+	err = put_user (s.uptime, &info->uptime);
+	err |= __put_user (s.loads[0], &info->loads[0]);
+	err |= __put_user (s.loads[1], &info->loads[1]);
+	err |= __put_user (s.loads[2], &info->loads[2]);
+	err |= __put_user (s.totalram, &info->totalram);
+	err |= __put_user (s.freeram, &info->freeram);
+	err |= __put_user (s.sharedram, &info->sharedram);
+	err |= __put_user (s.bufferram, &info->bufferram);
+	err |= __put_user (s.totalswap, &info->totalswap);
+	err |= __put_user (s.freeswap, &info->freeswap);
+	err |= __put_user (s.procs, &info->procs);
+	if (err)
+		return -EFAULT;
+	return ret;
+}
+
+extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
+
+asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
+		struct compat_timespec *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);
+	set_fs (old_fs);
+	if (put_compat_timespec(&t, interval))
+		return -EFAULT;
+	return ret;
+}
+
+extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize);
+
+asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
+{
+	sigset_t s;
+	compat_sigset_t s32;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+	
+	if (set) {
+		if (copy_from_user (&s32, set, sizeof(compat_sigset_t)))
+			return -EFAULT;
+		switch (_NSIG_WORDS) {
+		case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
+		case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32);
+		case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
+		case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
+		}
+	}
+	set_fs (KERNEL_DS);
+	ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize);
+	set_fs (old_fs);
+	if (ret) return ret;
+	if (oset) {
+		switch (_NSIG_WORDS) {
+		case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
+		case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
+		case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
+		case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
+		}
+		if (copy_to_user (oset, &s32, sizeof(compat_sigset_t)))
+			return -EFAULT;
+	}
+	return 0;
+}
+
+extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
+
+asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
+{
+	sigset_t s;
+	compat_sigset_t s32;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+		
+	set_fs (KERNEL_DS);
+	ret = sys_rt_sigpending(&s, sigsetsize);
+	set_fs (old_fs);
+	if (!ret) {
+		switch (_NSIG_WORDS) {
+		case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
+		case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
+		case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
+		case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
+		}
+		if (copy_to_user (set, &s32, sizeof(compat_sigset_t)))
+			return -EFAULT;
+	}
+	return ret;
+}
+
+extern int
+copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
+
+asmlinkage int
+sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
+		      struct compat_timespec *uts, compat_size_t sigsetsize)
+{
+	int ret, sig;
+	sigset_t these;
+	compat_sigset_t these32;
+	struct timespec ts;
+	siginfo_t info;
+	long timeout = 0;
+
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
+	if (sigsetsize != sizeof(sigset_t))
+		return -EINVAL;
+
+	if (copy_from_user (&these32, uthese, sizeof(compat_sigset_t)))
+		return -EFAULT;
+
+	switch (_NSIG_WORDS) {
+	case 4: these.sig[3] = these32.sig[6] | (((long)these32.sig[7]) << 32);
+	case 3: these.sig[2] = these32.sig[4] | (((long)these32.sig[5]) << 32);
+	case 2: these.sig[1] = these32.sig[2] | (((long)these32.sig[3]) << 32);
+	case 1: these.sig[0] = these32.sig[0] | (((long)these32.sig[1]) << 32);
+	}
+		
+	/*
+	 * Invert the set of allowed signals to get those we
+	 * want to block.
+	 */
+	sigdelsetmask(&these, sigmask(SIGKILL)|sigmask(SIGSTOP));
+	signotset(&these);
+
+	if (uts) {
+		if (get_compat_timespec(&ts, uts))
+			return -EINVAL;
+		if (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0
+		    || ts.tv_sec < 0)
+			return -EINVAL;
+	}
+
+	spin_lock_irq(&current->sighand->siglock);
+	sig = dequeue_signal(current, &these, &info);
+	if (!sig) {
+		/* None ready -- temporarily unblock those we're interested
+		   in so that we'll be awakened when they arrive.  */
+		current->real_blocked = current->blocked;
+		sigandsets(&current->blocked, &current->blocked, &these);
+		recalc_sigpending();
+		spin_unlock_irq(&current->sighand->siglock);
+
+		timeout = MAX_SCHEDULE_TIMEOUT;
+		if (uts)
+			timeout = (timespec_to_jiffies(&ts)
+				   + (ts.tv_sec || ts.tv_nsec));
+
+		current->state = TASK_INTERRUPTIBLE;
+		timeout = schedule_timeout(timeout);
+
+		spin_lock_irq(&current->sighand->siglock);
+		sig = dequeue_signal(current, &these, &info);
+		current->blocked = current->real_blocked;
+		siginitset(&current->real_blocked, 0);
+		recalc_sigpending();
+	}
+	spin_unlock_irq(&current->sighand->siglock);
+
+	if (sig) {
+		ret = sig;
+		if (uinfo) {
+			if (copy_siginfo_to_user32(uinfo, &info))
+				ret = -EFAULT;
+		}
+	} else {
+		ret = -EAGAIN;
+		if (timeout)
+			ret = -EINTR;
+	}
+
+	return ret;
+}
+
+extern asmlinkage int
+sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo);
+
+asmlinkage int
+sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
+{
+	siginfo_t info;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+	
+	if (copy_from_user (&info, uinfo, 3*sizeof(int)) ||
+	    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);
+	set_fs (old_fs);
+	return ret;
+}
+
+#define RLIM_OLD_INFINITY32	0x7fffffff
+#define RLIM_INFINITY32		0xffffffff
+#define RESOURCE32_OLD(x)	((x > RLIM_OLD_INFINITY32) ? RLIM_OLD_INFINITY32 : x)
+#define RESOURCE32(x) 		((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
+
+struct rlimit32 {
+	u32	rlim_cur;
+	u32	rlim_max;
+};
+
+extern asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim);
+
+asmlinkage int sys32_old_getrlimit(unsigned int resource, struct rlimit32 *rlim)
+{
+	struct rlimit r;
+	int ret;
+	mm_segment_t old_fs = get_fs ();
+	
+	set_fs (KERNEL_DS);
+	ret = sys_getrlimit(resource, &r);
+	set_fs (old_fs);
+	if (!ret) {
+		ret = put_user (RESOURCE32_OLD(r.rlim_cur), &rlim->rlim_cur);
+		ret |= __put_user (RESOURCE32_OLD(r.rlim_max), &rlim->rlim_max);
+	}
+	return ret;
+}
+
+asmlinkage int sys32_getrlimit(unsigned int resource, struct rlimit32 *rlim)
+{
+	struct rlimit r;
+	int ret;
+	mm_segment_t old_fs = get_fs ();
+	
+	set_fs (KERNEL_DS);
+	ret = sys_getrlimit(resource, &r);
+	set_fs (old_fs);
+	if (!ret) {
+		ret = put_user (RESOURCE32(r.rlim_cur), &rlim->rlim_cur);
+		ret |= __put_user (RESOURCE32(r.rlim_max), &rlim->rlim_max);
+	}
+	return ret;
+}
+
+extern asmlinkage int sys_setrlimit(unsigned int resource, struct rlimit *rlim);
+
+asmlinkage int sys32_setrlimit(unsigned int resource, struct rlimit32 *rlim)
+{
+	struct rlimit r;
+	int ret;
+	mm_segment_t old_fs = get_fs ();
+
+	if (resource >= RLIM_NLIMITS) return -EINVAL;	
+	if (get_user (r.rlim_cur, &rlim->rlim_cur) ||
+	    __get_user (r.rlim_max, &rlim->rlim_max))
+		return -EFAULT;
+	if (r.rlim_cur == RLIM_INFINITY32)
+		r.rlim_cur = RLIM_INFINITY;
+	if (r.rlim_max == RLIM_INFINITY32)
+		r.rlim_max = RLIM_INFINITY;
+	set_fs (KERNEL_DS);
+	ret = sys_setrlimit(resource, &r);
+	set_fs (old_fs);
+	return ret;
+}
+
+extern asmlinkage int sys_getrusage(int who, struct rusage *ru);
+
+asmlinkage int sys32_getrusage(int who, struct rusage32 *ru)
+{
+	struct rusage r;
+	int ret;
+	mm_segment_t old_fs = get_fs();
+		
+	set_fs (KERNEL_DS);
+	ret = sys_getrusage(who, &r);
+	set_fs (old_fs);
+	if (put_rusage (ru, &r)) return -EFAULT;
+	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.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:
+	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.
+ */
+asmlinkage int
+sys32_execve(struct pt_regs regs)
+{
+        int error;
+        char * filename;
+
+        filename = getname((char *)A(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);
+	if (error == 0)
+	{
+		current->ptrace &= ~PT_DTRACE;
+		current->thread.fp_regs.fpc=0;
+		__asm__ __volatile__
+		        ("sr  0,0\n\t"
+		         "sfpc 0,0\n\t"
+			 : : :"0");
+	}
+        putname(filename);
+out:
+        return error;
+}
+
+
+#ifdef CONFIG_MODULES
+
+extern asmlinkage int sys_init_module(const char *name_user, struct module *mod_user);
+
+/* Hey, when you're trying to init module, take time and prepare us a nice 64bit
+ * module structure, even if from 32bit modutils... Why to pollute kernel... :))
+ */
+asmlinkage int sys32_init_module(const char *name_user, struct module *mod_user)
+{
+	return sys_init_module(name_user, mod_user);
+}
+
+extern asmlinkage int sys_delete_module(const char *name_user);
+
+asmlinkage int sys32_delete_module(const char *name_user)
+{
+	return sys_delete_module(name_user);
+}
+
+struct module_info32 {
+	u32 addr;
+	u32 size;
+	u32 flags;
+	s32 usecount;
+};
+
+#else /* CONFIG_MODULES */
+
+asmlinkage int
+sys32_init_module(const char *name_user, struct module *mod_user)
+{
+	return -ENOSYS;
+}
+
+asmlinkage int
+sys32_delete_module(const char *name_user)
+{
+	return -ENOSYS;
+}
+
+#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;
+}
+
+/*
+asmlinkage long sys_ni_syscall(void); 
+*/
+
+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;
+}
+
+/* Translations due to time_t size differences.  Which affects all
+   sorts of things, like timeval and itimerval.  */
+
+extern struct timezone sys_tz;
+extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
+
+asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+{
+	if (tv) {
+		struct timeval ktv;
+		do_gettimeofday(&ktv);
+		if (put_tv32(tv, &ktv))
+			return -EFAULT;
+	}
+	if (tz) {
+		if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
+			return -EFAULT;
+	}
+	return 0;
+}
+
+asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+{
+	struct timeval ktv;
+	struct timezone ktz;
+
+ 	if (tv) {
+		if (get_tv32(&ktv, tv))
+			return -EFAULT;
+	}
+	if (tz) {
+		if (copy_from_user(&ktz, tz, sizeof(ktz)))
+			return -EFAULT;
+	}
+
+	return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
+}
+
+asmlinkage int sys_utimes(char *, struct timeval *);
+
+asmlinkage int sys32_utimes(char *filename, struct compat_timeval *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 = sys_utimes(kfilename, &ktvs[0]);
+		set_fs(old_fs);
+
+		putname(kfilename);
+	}
+	return ret;
+}
+
+/* These are here just in case some old sparc32 binary calls it. */
+asmlinkage int sys32_pause(void)
+{
+	current->state = TASK_INTERRUPTIBLE;
+	schedule();
+	return -ERESTARTNOHAND;
+}
+
+extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3,
+				unsigned long arg4, unsigned long arg5);
+
+asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
+{
+	return sys_prctl(option,
+			 (unsigned long) arg2,
+			 (unsigned long) arg3,
+			 (unsigned long) arg4,
+			 (unsigned long) arg5);
+}
+
+
+extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
+				    size_t count, loff_t pos);
+
+extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
+				     size_t count, loff_t pos);
+
+asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
+				 compat_size_t count, u32 poshi, u32 poslo)
+{
+	if ((compat_ssize_t) count < 0)
+		return -EINVAL;
+	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+}
+
+asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
+				  compat_size_t count, u32 poshi, u32 poslo)
+{
+	if ((compat_ssize_t) count < 0)
+		return -EINVAL;
+	return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
+}
+
+extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
+
+asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
+{
+	return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
+}
+
+extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
+
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+{
+	mm_segment_t old_fs = get_fs();
+	int ret;
+	off_t of;
+	
+	if (offset && get_user(of, offset))
+		return -EFAULT;
+		
+	set_fs(KERNEL_DS);
+	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
+	set_fs(old_fs);
+	
+	if (!ret && offset && put_user(of, offset))
+		return -EFAULT;
+		
+	return ret;
+}
+
+extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, 
+					 loff_t *offset, size_t count);
+
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, 
+				compat_loff_t *offset, s32 count)
+{
+	mm_segment_t old_fs = get_fs();
+	int ret;
+	loff_t lof;
+	
+	if (offset && get_user(lof, offset))
+		return -EFAULT;
+		
+	set_fs(KERNEL_DS);
+	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
+	set_fs(old_fs);
+	
+	if (offset && put_user(lof, offset))
+		return -EFAULT;
+		
+	return ret;
+}
+
+/* Handle adjtimex compatibility. */
+
+struct timex32 {
+	u32 modes;
+	s32 offset, freq, maxerror, esterror;
+	s32 status, constant, precision, tolerance;
+	struct compat_timeval time;
+	s32 tick;
+	s32 ppsfreq, jitter, shift, stabil;
+	s32 jitcnt, calcnt, errcnt, stbcnt;
+	s32  :32; s32  :32; s32  :32; s32  :32;
+	s32  :32; s32  :32; s32  :32; s32  :32;
+	s32  :32; s32  :32; s32  :32; s32  :32;
+};
+
+extern int do_adjtimex(struct timex *);
+
+asmlinkage int sys32_adjtimex(struct timex32 *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))
+		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))
+		ret = -EFAULT;
+
+	return ret;
+}
+
+extern asmlinkage long sys_setpriority(int which, int who, int niceval);
+
+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;
+	u32 oldval;
+	u32 oldlenp;
+	u32 newval;
+	u32 newlen;
+	u32 __unused[4];
+};
+
+extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
+{
+	struct __sysctl_args32 tmp;
+	int error;
+	size_t oldlen, *oldlenp = NULL;
+	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+
+	if (copy_from_user(&tmp, args, sizeof(tmp)))
+		return -EFAULT;
+
+	if (tmp.oldval && tmp.oldlenp) {
+		/* Duh, this is ugly and might not work if sysctl_args
+		   is in read-only memory, but do_sysctl does indirectly
+		   a lot of uaccess in both directions and we'd have to
+		   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))
+			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);
+	unlock_kernel();
+	if (oldlenp) {
+		if (!error) {
+			if (get_user(oldlen, (size_t *)addr) ||
+			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
+				error = -EFAULT;
+		}
+		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
+	}
+	return error;
+}
+
+struct stat64_emu31 {
+	unsigned char   __pad0[6];
+	unsigned short  st_dev;
+	unsigned int    __pad1;
+#define STAT64_HAS_BROKEN_ST_INO        1
+	u32             __st_ino;
+	unsigned int    st_mode;
+	unsigned int    st_nlink;
+	u32             st_uid;
+	u32             st_gid;
+	unsigned char   __pad2[6];
+	unsigned short  st_rdev;
+	unsigned int    __pad3;
+	long            st_size;
+	u32             st_blksize;
+	unsigned char   __pad4[4];
+	u32             __pad5;     /* future possible st_blocks high bits */
+	u32             st_blocks;  /* Number 512-byte blocks allocated. */
+	u32             st_atime;
+	u32             __pad6;
+	u32             st_mtime;
+	u32             __pad7;
+	u32             st_ctime;
+	u32             __pad8;     /* will be high 32 bits of ctime someday */
+	unsigned long   st_ino;
+};	
+
+static inline int
+putstat64 (struct stat64_emu31 *ubuf, struct stat *kbuf)
+{
+    struct stat64_emu31 tmp;
+   
+    memset(&tmp, 0, sizeof(tmp));
+
+    tmp.st_dev = (unsigned short)kbuf->st_dev;
+    tmp.st_ino = kbuf->st_ino;
+    tmp.__st_ino = (u32)kbuf->st_ino;
+    tmp.st_mode = kbuf->st_mode;
+    tmp.st_nlink = (unsigned int)kbuf->st_nlink;
+    tmp.st_uid = kbuf->st_uid;
+    tmp.st_gid = kbuf->st_gid;
+    tmp.st_rdev = (unsigned short)kbuf->st_rdev;
+    tmp.st_size = kbuf->st_size;
+    tmp.st_blksize = (u32)kbuf->st_blksize;
+    tmp.st_blocks = (u32)kbuf->st_blocks;
+    tmp.st_atime = (u32)kbuf->st_atime;
+    tmp.st_mtime = (u32)kbuf->st_mtime;
+    tmp.st_ctime = (u32)kbuf->st_ctime;
+
+    return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 
+}
+
+extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf);
+
+asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf, long flags)
+{
+    int ret;
+    struct stat s;
+    char * tmp;
+    int err;
+    mm_segment_t old_fs = get_fs();
+    
+    tmp = getname(filename);
+    err = PTR_ERR(tmp);
+    if (IS_ERR(tmp))   
+	    return err;
+
+    set_fs (KERNEL_DS);
+    ret = sys_newstat(tmp, &s);
+    set_fs (old_fs);
+    putname(tmp);
+    if (putstat64 (statbuf, &s)) 
+	    return -EFAULT;
+    return ret;
+}
+
+extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf);
+
+asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf, long flags)
+{
+    int ret;
+    struct stat s;
+    char * tmp;
+    int err;
+    mm_segment_t old_fs = get_fs();
+    
+    tmp = getname(filename);
+    err = PTR_ERR(tmp);
+    if (IS_ERR(tmp))   
+	    return err;
+
+    set_fs (KERNEL_DS);
+    ret = sys_newlstat(tmp, &s);
+    set_fs (old_fs);
+    putname(tmp);
+    if (putstat64 (statbuf, &s)) 
+	    return -EFAULT;
+    return ret;
+}
+
+extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf);
+
+asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf, long flags)
+{
+    int ret;
+    struct stat s;
+    mm_segment_t old_fs = get_fs();
+    
+    set_fs (KERNEL_DS);
+    ret = sys_newfstat(fd, &s);
+    set_fs (old_fs);
+    if (putstat64 (statbuf, &s))
+	    return -EFAULT;
+    return ret;
+}
+
+/*
+ * Linux/i386 didn't use to be able to handle more than
+ * 4 system call parameters, so these system calls used a memory
+ * block for parameter passing..
+ */
+
+struct mmap_arg_struct_emu31 {
+	u32	addr;
+	u32	len;
+	u32	prot;
+	u32	flags;
+	u32	fd;
+	u32	offset;
+};
+
+/* common code for old and new mmaps */
+static inline long do_mmap2(
+	unsigned long addr, unsigned long len,
+	unsigned long prot, unsigned long flags,
+	unsigned long fd, unsigned long pgoff)
+{
+	struct file * file = NULL;
+	unsigned long error = -EBADF;
+
+	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+	if (!(flags & MAP_ANONYMOUS)) {
+		file = fget(fd);
+		if (!file)
+			goto out;
+	}
+
+	down_write(&current->mm->mmap_sem);
+	error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
+	if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
+		/* Result is out of bounds.  */
+		do_munmap(current->mm, addr, len);
+		error = -ENOMEM;
+	}
+	up_write(&current->mm->mmap_sem);
+
+	if (file)
+		fput(file);
+out:    
+	return error;
+}
+
+
+asmlinkage unsigned long
+old32_mmap(struct mmap_arg_struct_emu31 *arg)
+{
+	struct mmap_arg_struct_emu31 a;
+	int error = -EFAULT;
+
+	if (copy_from_user(&a, arg, sizeof(a)))
+		goto out;
+
+	error = -EINVAL;
+	if (a.offset & ~PAGE_MASK)
+		goto out;
+
+	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 
+out:
+	return error;
+}
+
+asmlinkage long 
+sys32_mmap2(struct mmap_arg_struct_emu31 *arg)
+{
+	struct mmap_arg_struct_emu31 a;
+	int error = -EFAULT;
+
+	if (copy_from_user(&a, arg, sizeof(a)))
+		goto out;
+	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
+out:
+	return error;
+}
+
+extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
+					    unsigned long *user_mask_ptr);
+
+asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
+				       u32 *user_mask_ptr)
+{
+	unsigned long kernel_mask;
+	mm_segment_t old_fs;
+	int ret;
+
+	if (get_user(kernel_mask, user_mask_ptr))
+		return -EFAULT;
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	ret = sys_sched_setaffinity(pid,
+				    /* XXX Nice api... */
+				    sizeof(kernel_mask),
+				    &kernel_mask);
+	set_fs(old_fs);
+
+	return ret;
+}
+
+extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
+					    unsigned long *user_mask_ptr);
+
+asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
+				       u32 *user_mask_ptr)
+{
+	unsigned long kernel_mask;
+	mm_segment_t old_fs;
+	int ret;
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	ret = sys_sched_getaffinity(pid,
+				    /* XXX Nice api... */
+				    sizeof(kernel_mask),
+				    &kernel_mask);
+	set_fs(old_fs);
+
+	if (ret == 0) {
+		if (put_user(kernel_mask, user_mask_ptr))
+			ret = -EFAULT;
+	}
+
+	return ret;
+}
+
+asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count);
+
+asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count)
+{
+	if ((compat_ssize_t) count < 0)
+		return -EINVAL; 
+
+	return sys_read(fd, buf, count);
+}
+
+asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count);
+
+asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count)
+{
+	if ((compat_ssize_t) count < 0)
+		return -EINVAL; 
+
+	return sys_write(fd, buf, count);
+}
+
+asmlinkage int sys32_clone(struct pt_regs regs)
+{
+        unsigned long clone_flags;
+        unsigned long newsp;
+	struct task_struct *p;
+	int *parent_tidptr, *child_tidptr;
+
+        clone_flags = regs.gprs[3] & 0xffffffffUL;
+        newsp = regs.orig_gpr2 & 0x7fffffffUL;
+	parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL);
+	child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL);
+        if (!newsp)
+                newsp = regs.gprs[15];
+        p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
+		    parent_tidptr, child_tidptr);
+	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
+}
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_linux.h linux-2.5.67-bk6/arch/s390/kernel/compat_linux.h
--- linux-2.5.67-bk5/arch/s390/kernel/compat_linux.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_linux.h	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,193 @@
+#ifndef _ASM_S390X_S390_H
+#define _ASM_S390X_S390_H
+
+#include <linux/config.h>
+#include <linux/compat.h>
+#include <linux/socket.h>
+#include <linux/nfs_fs.h>
+#include <linux/sunrpc/svc.h>
+#include <linux/nfsd/nfsd.h>
+#include <linux/nfsd/export.h>
+
+/* Macro that masks the high order bit of an 32 bit pointer and converts it*/
+/*       to a 64 bit pointer */
+#define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
+#define AA(__x)				\
+	((unsigned long)(__x))
+
+/* Now 32bit compatibility types */
+struct ipc_kludge_32 {
+        __u32   msgp;                           /* pointer              */
+        __s32   msgtyp;
+};
+
+struct old_sigaction32 {
+       __u32			sa_handler;	/* Really a pointer, but need to deal with 32 bits */
+       compat_old_sigset_t	sa_mask;	/* A 32 bit mask */
+       __u32			sa_flags;
+       __u32			sa_restorer;	/* Another 32 bit pointer */
+};
+ 
+typedef union sigval32 {
+        int     sival_int;
+        __u32   sival_ptr;
+} sigval_t32;
+                 
+typedef struct siginfo32 {
+	int	si_signo;
+	int	si_errno;
+	int	si_code;
+
+	union {
+		int _pad[((128/sizeof(int)) - 3)];
+
+		/* kill() */
+		struct {
+			pid_t	_pid;	/* sender's pid */
+			uid_t	_uid;	/* sender's uid */
+		} _kill;
+
+		/* POSIX.1b timers */
+		struct {
+			unsigned int	_timer1;
+			unsigned int	_timer2;
+                
+		} _timer;
+
+		/* POSIX.1b signals */
+		struct {
+			pid_t			_pid;	/* sender's pid */
+			uid_t			_uid;	/* sender's uid */
+			sigval_t32		_sigval;
+		} _rt;
+
+		/* SIGCHLD */
+		struct {
+			pid_t			_pid;	/* which child */
+			uid_t			_uid;	/* sender's uid */
+			int			_status;/* exit code */
+			compat_clock_t		_utime;
+			compat_clock_t		_stime;
+		} _sigchld;
+
+		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+		struct {
+			__u32	_addr;	/* faulting insn/memory ref. - pointer */
+		} _sigfault;
+                          
+		/* SIGPOLL */
+		struct {
+			int	_band;	/* POLL_IN, POLL_OUT, POLL_MSG */
+			int	_fd;
+		} _sigpoll;
+	} _sifields;
+} siginfo_t32;  
+
+/*
+ * How these fields are to be accessed.
+ */
+#define si_pid		_sifields._kill._pid
+#define si_uid		_sifields._kill._uid
+#define si_status	_sifields._sigchld._status
+#define si_utime	_sifields._sigchld._utime
+#define si_stime	_sifields._sigchld._stime
+#define si_value	_sifields._rt._sigval
+#define si_int		_sifields._rt._sigval.sival_int
+#define si_ptr		_sifields._rt._sigval.sival_ptr
+#define si_addr		_sifields._sigfault._addr
+#define si_band		_sifields._sigpoll._band
+#define si_fd		_sifields._sigpoll._fd    
+
+/* asm/sigcontext.h */
+typedef union
+{
+	__u64   d;
+	__u32   f; 
+} freg_t32;
+
+typedef struct
+{
+	unsigned int	fpc;
+	freg_t32	fprs[__NUM_FPRS];              
+} _s390_fp_regs32;
+
+typedef struct 
+{
+        __u32   mask;
+        __u32	addr;
+} _psw_t32 __attribute__ ((aligned(8)));
+
+#define PSW32_MASK_PER		0x40000000UL
+#define PSW32_MASK_DAT		0x04000000UL
+#define PSW32_MASK_IO		0x02000000UL
+#define PSW32_MASK_EXT		0x01000000UL
+#define PSW32_MASK_KEY		0x00F00000UL
+#define PSW32_MASK_MCHECK	0x00040000UL
+#define PSW32_MASK_WAIT		0x00020000UL
+#define PSW32_MASK_PSTATE	0x00010000UL
+#define PSW32_MASK_ASC		0x0000C000UL
+#define PSW32_MASK_CC		0x00003000UL
+#define PSW32_MASK_PM		0x00000f00UL
+
+#define PSW32_ADDR_AMODE31	0x80000000UL
+#define PSW32_ADDR_INSN		0x7FFFFFFFUL
+
+#define PSW32_BASE_BITS		0x00080000UL
+
+#define PSW32_ASC_PRIMARY	0x00000000UL
+#define PSW32_ASC_ACCREG	0x00004000UL
+#define PSW32_ASC_SECONDARY	0x00008000UL
+#define PSW32_ASC_HOME		0x0000C000UL
+
+#define PSW32_USER_BITS	(PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | \
+			 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | \
+			 PSW32_MASK_PSTATE)
+
+typedef struct
+{
+	_psw_t32	psw;
+	__u32		gprs[__NUM_GPRS];
+	__u32		acrs[__NUM_ACRS];
+} _s390_regs_common32;
+
+typedef struct
+{
+	_s390_regs_common32 regs;
+	_s390_fp_regs32     fpregs;
+} _sigregs32;
+
+#define _SIGCONTEXT_NSIG32	64
+#define _SIGCONTEXT_NSIG_BPW32	32
+#define __SIGNAL_FRAMESIZE32	96
+#define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
+
+struct sigcontext32
+{
+	__u32	oldmask[_COMPAT_NSIG_WORDS];
+	__u32	sregs;				/* pointer */
+};
+
+/* asm/signal.h */
+struct sigaction32 {
+	__u32		sa_handler;		/* pointer */
+	__u32		sa_flags;
+        __u32		sa_restorer;		/* pointer */
+	compat_sigset_t	sa_mask;        /* mask last for extensibility */
+};
+
+typedef struct {
+	__u32			ss_sp;		/* pointer */
+	int			ss_flags;
+	compat_size_t		ss_size;
+} stack_t32;
+
+/* asm/ucontext.h */
+struct ucontext32 {
+	__u32			uc_flags;
+	__u32			uc_link;	/* pointer */	
+	stack_t32		uc_stack;
+	_sigregs32		uc_mcontext;
+	compat_sigset_t		uc_sigmask;	/* mask last for extensibility */
+};
+
+#endif /* _ASM_S390X_S390_H */
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_ptrace.h linux-2.5.67-bk6/arch/s390/kernel/compat_ptrace.h
--- linux-2.5.67-bk5/arch/s390/kernel/compat_ptrace.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_ptrace.h	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,86 @@
+#ifndef _PTRACE32_H
+#define _PTRACE32_H
+
+#include "compat_linux.h"  /* needed for _psw_t32 */
+
+typedef struct
+{
+	__u32 cr[3];
+} per_cr_words32  __attribute__((packed));
+
+typedef struct
+{
+	__u16          perc_atmid;          /* 0x096 */
+	__u32          address;             /* 0x098 */
+	__u8           access_id;           /* 0x0a1 */
+} per_lowcore_words32  __attribute__((packed));
+
+typedef struct
+{
+	union {
+		per_cr_words32   words;
+	} control_regs  __attribute__((packed));
+	/*
+	 * Use these flags instead of setting em_instruction_fetch
+	 * directly they are used so that single stepping can be
+	 * switched on & off while not affecting other tracing
+	 */
+	unsigned  single_step       : 1;
+	unsigned  instruction_fetch : 1;
+	unsigned                    : 30;
+	/*
+	 * These addresses are copied into cr10 & cr11 if single
+	 * stepping is switched off
+	 */
+	__u32     starting_addr;
+	__u32     ending_addr;
+	union {
+		per_lowcore_words32 words;
+	} lowcore; 
+} per_struct32 __attribute__((packed));
+
+struct user_regs_struct32
+{
+	_psw_t32 psw;
+	u32 gprs[NUM_GPRS];
+	u32 acrs[NUM_ACRS];
+	u32 orig_gpr2;
+	s390_fp_regs fp_regs;
+	/*
+	 * These per registers are in here so that gdb can modify them
+	 * itself as there is no "official" ptrace interface for hardware
+	 * watchpoints. This is the way intel does it.
+	 */
+	per_struct32 per_info;
+	u32  ieee_instruction_pointer; 
+	/* Used to give failing instruction back to user for ieee exceptions */
+};
+
+struct user32 {
+	/* We start with the registers, to mimic the way that "memory"
+	   is returned from the ptrace(3,...) function.  */
+	struct user_regs_struct32 regs; /* Where the registers are actually stored */
+	/* The rest of this junk is to help gdb figure out what goes where */
+	u32 u_tsize;		/* Text segment size (pages). */
+	u32 u_dsize;	        /* Data segment size (pages). */
+	u32 u_ssize;	        /* Stack segment size (pages). */
+	u32 start_code;         /* Starting virtual address of text. */
+	u32 start_stack;	/* Starting virtual address of stack area.
+				   This is actually the bottom of the stack,
+				   the top of the stack is always found in the
+				   esp register.  */
+	s32 signal;     	 /* Signal that caused the core dump. */
+	u32 u_ar0;               /* Used by gdb to help find the values for */
+	                         /* the registers. */
+	u32 magic;		 /* To uniquely identify a core file */
+	char u_comm[32];	 /* User command that was responsible */
+};
+
+typedef struct
+{
+	__u32   len;
+	__u32   kernel_addr;
+	__u32   process_addr;
+} ptrace_area_emu31;
+
+#endif /* _PTRACE32_H */
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_signal.c linux-2.5.67-bk6/arch/s390/kernel/compat_signal.c
--- linux-2.5.67-bk5/arch/s390/kernel/compat_signal.c	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_signal.c	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,644 @@
+/*
+ *  arch/s390/kernel/signal32.c
+ *
+ *  S390 version
+ *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
+ *               Gerhard Tonn (ton@de.ibm.com)                  
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
+ */
+
+#include <linux/config.h>
+#include <linux/compat.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/errno.h>
+#include <linux/wait.h>
+#include <linux/ptrace.h>
+#include <linux/unistd.h>
+#include <linux/stddef.h>
+#include <linux/tty.h>
+#include <linux/personality.h>
+#include <linux/binfmts.h>
+#include <asm/ucontext.h>
+#include <asm/uaccess.h>
+#include <asm/lowcore.h>
+#include "compat_linux.h"
+#include "compat_ptrace.h"
+
+#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
+
+typedef struct 
+{
+	__u8 callee_used_stack[__SIGNAL_FRAMESIZE32];
+	struct sigcontext32 sc;
+	_sigregs32 sregs;
+	__u8 retcode[S390_SYSCALL_SIZE];
+} sigframe32;
+
+typedef struct 
+{
+	__u8 callee_used_stack[__SIGNAL_FRAMESIZE32];
+	__u8 retcode[S390_SYSCALL_SIZE];
+	struct siginfo32 info;
+	struct ucontext32 uc;
+} rt_sigframe32;
+
+asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
+
+int do_signal32(struct pt_regs *regs, sigset_t *oldset);
+
+int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
+{
+	int err;
+
+	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t32)))
+		return -EFAULT;
+
+	/* If you change siginfo_t structure, please be sure
+	   this code is fixed accordingly.
+	   It should never copy any pad contained in the structure
+	   to avoid security leaks, but must copy the generic
+	   3 ints plus the relevant union member.  
+	   This routine must convert siginfo from 64bit to 32bit as well
+	   at the same time.  */
+	err = __put_user(from->si_signo, &to->si_signo);
+	err |= __put_user(from->si_errno, &to->si_errno);
+	err |= __put_user((short)from->si_code, &to->si_code);
+	if (from->si_code < 0)
+		err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
+	else {
+		switch (from->si_code >> 16) {
+		case __SI_KILL >> 16:
+			err |= __put_user(from->si_pid, &to->si_pid);
+			err |= __put_user(from->si_uid, &to->si_uid);
+			break;
+		case __SI_CHLD >> 16:
+			err |= __put_user(from->si_pid, &to->si_pid);
+			err |= __put_user(from->si_uid, &to->si_uid);
+			err |= __put_user(from->si_utime, &to->si_utime);
+			err |= __put_user(from->si_stime, &to->si_stime);
+			err |= __put_user(from->si_status, &to->si_status);
+			break;
+		case __SI_FAULT >> 16:
+			err |= __put_user((unsigned long) from->si_addr,
+					  &to->si_addr);
+			break;
+		case __SI_POLL >> 16:
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_band, &to->si_band);
+			err |= __put_user(from->si_fd, &to->si_fd);
+			break;
+		default:
+			break;
+		/* case __SI_RT: This is not generated by the kernel as of now.  */
+		}
+	}
+	return err;
+}
+
+/*
+ * Atomically swap in the new signal mask, and wait for a signal.
+ */
+asmlinkage int
+sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask)
+{
+	sigset_t saveset;
+
+	mask &= _BLOCKABLE;
+	spin_lock_irq(&current->sighand->siglock);
+	saveset = current->blocked;
+	siginitset(&current->blocked, mask);
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+	regs->gprs[2] = -EINTR;
+
+	while (1) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule();
+		if (do_signal32(regs, &saveset))
+			return -EINTR;
+	}
+}
+
+asmlinkage int
+sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize)
+{
+	sigset_t saveset, newset;
+	compat_sigset_t set32;
+
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
+	if (sigsetsize != sizeof(sigset_t))
+		return -EINVAL;
+
+	if (copy_from_user(&set32, unewset, sizeof(set32)))
+		return -EFAULT;
+	switch (_NSIG_WORDS) {
+	case 4: newset.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32);
+	case 3: newset.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32);
+	case 2: newset.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32);
+	case 1: newset.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32);
+	}
+        sigdelsetmask(&newset, ~_BLOCKABLE);
+
+        spin_lock_irq(&current->sighand->siglock);
+        saveset = current->blocked;
+        current->blocked = newset;
+        recalc_sigpending();
+        spin_unlock_irq(&current->sighand->siglock);
+        regs->gprs[2] = -EINTR;
+
+        while (1) {
+                set_current_state(TASK_INTERRUPTIBLE);
+                schedule();
+                if (do_signal32(regs, &saveset))
+                        return -EINTR;
+        }
+}                                                         
+
+asmlinkage int
+sys32_sigaction(int sig, const struct old_sigaction32 *act,
+		 struct old_sigaction32 *oact)
+{
+        struct k_sigaction new_ka, old_ka;
+        int ret;
+
+        if (act) {
+		compat_old_sigset_t mask;
+		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
+		    __get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler) ||
+		    __get_user((unsigned long)new_ka.sa.sa_restorer, &act->sa_restorer))
+			return -EFAULT;
+		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
+		__get_user(mask, &act->sa_mask);
+		siginitset(&new_ka.sa.sa_mask, mask);
+        }
+
+        ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
+
+	if (!ret && oact) {
+		if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
+		    __put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler) ||
+		    __put_user((unsigned long)old_ka.sa.sa_restorer, &oact->sa_restorer))
+			return -EFAULT;
+		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
+		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
+        }
+
+	return ret;
+}
+
+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)
+{
+	struct k_sigaction new_ka, old_ka;
+	int ret;
+	compat_sigset_t set32;
+
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
+	if (sigsetsize != sizeof(compat_sigset_t))
+		return -EINVAL;
+
+	if (act) {
+		ret = get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler);
+		ret |= __copy_from_user(&set32, &act->sa_mask,
+					sizeof(compat_sigset_t));
+		switch (_NSIG_WORDS) {
+		case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6]
+				| (((long)set32.sig[7]) << 32);
+		case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4]
+				| (((long)set32.sig[5]) << 32);
+		case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2]
+				| (((long)set32.sig[3]) << 32);
+		case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0]
+				| (((long)set32.sig[1]) << 32);
+		}
+		ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
+		
+		if (ret)
+			return -EFAULT;
+	}
+
+	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
+
+	if (!ret && oact) {
+		switch (_NSIG_WORDS) {
+		case 4:
+			set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32);
+			set32.sig[6] = old_ka.sa.sa_mask.sig[3];
+		case 3:
+			set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32);
+			set32.sig[4] = old_ka.sa.sa_mask.sig[2];
+		case 2:
+			set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32);
+			set32.sig[2] = old_ka.sa.sa_mask.sig[1];
+		case 1:
+			set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32);
+			set32.sig[0] = old_ka.sa.sa_mask.sig[0];
+		}
+		ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler);
+		ret |= __copy_to_user(&oact->sa_mask, &set32,
+				      sizeof(compat_sigset_t));
+		ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
+	}
+
+	return ret;
+}
+
+asmlinkage int
+sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
+{
+	stack_t kss, koss;
+	int ret, err = 0;
+	mm_segment_t old_fs = get_fs();
+
+	if (uss) {
+		if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
+			return -EFAULT;
+		err |= __get_user((unsigned long) kss.ss_sp, &uss->ss_sp);
+		err |= __get_user(kss.ss_size, &uss->ss_size);
+		err |= __get_user(kss.ss_flags, &uss->ss_flags);
+		if (err)
+			return -EFAULT;
+	}
+
+	set_fs (KERNEL_DS);
+	ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]);
+	set_fs (old_fs);
+
+	if (!ret && uoss) {
+		if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
+			return -EFAULT;
+		err |= __put_user((unsigned long) koss.ss_sp, &uoss->ss_sp);
+		err |= __put_user(koss.ss_size, &uoss->ss_size);
+		err |= __put_user(koss.ss_flags, &uoss->ss_flags);
+		if (err)
+			return -EFAULT;
+	}
+	return ret;
+}
+
+static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+{
+	_s390_regs_common32 regs32;
+	int err, i;
+
+	regs32.psw.mask = PSW32_USER_BITS |
+		((__u32)(regs->psw.mask >> 32) & PSW32_MASK_CC);
+	regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr;
+	for (i = 0; i < NUM_GPRS; i++)
+		regs32.gprs[i] = (__u32) regs->gprs[i];
+	memcpy(regs32.acrs, regs->acrs, sizeof(regs32.acrs));
+	err = __copy_to_user(&sregs->regs, &regs32, sizeof(regs32));
+	if (err)
+		return err;
+	save_fp_regs(&current->thread.fp_regs);
+	/* s390_fp_regs and _s390_fp_regs32 are the same ! */
+	return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs,
+			      sizeof(_s390_fp_regs32));
+}
+
+static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
+{
+	_s390_regs_common32 regs32;
+	int err, i;
+
+	err = __copy_from_user(&regs32, &sregs->regs, sizeof(regs32));
+	if (err)
+		return err;
+	regs->psw.mask = PSW_USER32_BITS |
+		(__u64)(regs32.psw.mask & PSW32_MASK_CC) << 32;
+	regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN);
+	for (i = 0; i < NUM_GPRS; i++)
+		regs->gprs[i] = (__u64) regs32.gprs[i];
+	memcpy(regs->acrs, regs32.acrs, sizeof(regs32.acrs));
+
+	err = __copy_from_user(&current->thread.fp_regs, &sregs->fpregs,
+			       sizeof(_s390_fp_regs32));
+	current->thread.fp_regs.fpc &= FPC_VALID_MASK;
+	if (err)
+		return err;
+
+	restore_fp_regs(&current->thread.fp_regs);
+	regs->trap = -1;	/* disable syscall checks */
+	return 0;
+}
+
+asmlinkage long sys32_sigreturn(struct pt_regs *regs)
+{
+	sigframe32 *frame = (sigframe32 *)regs->gprs[15];
+	sigset_t set;
+
+	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
+		goto badframe;
+	if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
+		goto badframe;
+
+	sigdelsetmask(&set, ~_BLOCKABLE);
+	spin_lock_irq(&current->sighand->siglock);
+	current->blocked = set;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	if (restore_sigregs32(regs, &frame->sregs))
+		goto badframe;
+
+	return regs->gprs[2];
+
+badframe:
+	force_sig(SIGSEGV, current);
+	return 0;
+}	
+
+asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
+{
+	rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15];
+	sigset_t set;
+	stack_t st;
+	__u32 ss_sp;
+	int err;
+	mm_segment_t old_fs = get_fs();
+
+	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
+		goto badframe;
+	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
+		goto badframe;
+
+	sigdelsetmask(&set, ~_BLOCKABLE);
+	spin_lock_irq(&current->sighand->siglock);
+	current->blocked = set;
+	recalc_sigpending();
+	spin_unlock_irq(&current->sighand->siglock);
+
+	if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
+		goto badframe;
+
+	err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
+	st.ss_sp = (void *) A((unsigned long)ss_sp);
+	err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
+	err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
+	if (err)
+		goto badframe; 
+
+	/* 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 (old_fs);
+
+	return regs->gprs[2];
+
+badframe:
+        force_sig(SIGSEGV, current);
+        return 0;
+}	
+
+/*
+ * Set up a signal frame.
+ */
+
+
+/*
+ * Determine which stack to use..
+ */
+static inline void *
+get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
+{
+	unsigned long sp;
+
+	/* Default to using normal stack */
+	sp = (unsigned long) A(regs->gprs[15]);
+
+	/* This is the X/Open sanctioned signal stack switching.  */
+	if (ka->sa.sa_flags & SA_ONSTACK) {
+		if (! on_sig_stack(sp))
+			sp = current->sas_ss_sp + current->sas_ss_size;
+	}
+
+	/* This is the legacy signal stack switching. */
+	else if (!user_mode(regs) &&
+		 !(ka->sa.sa_flags & SA_RESTORER) &&
+		 ka->sa.sa_restorer) {
+		sp = (unsigned long) ka->sa.sa_restorer;
+	}
+
+	return (void *)((sp - frame_size) & -8ul);
+}
+
+static inline int map_signal(int sig)
+{
+	if (current_thread_info()->exec_domain
+	    && current_thread_info()->exec_domain->signal_invmap
+	    && sig < 32)
+		return current_thread_info()->exec_domain->signal_invmap[sig];
+        else
+		return sig;
+}
+
+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));
+	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
+		goto give_sigsegv;
+
+	if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32))
+		goto give_sigsegv;
+
+	if (save_sigregs32(regs, &frame->sregs))
+		goto give_sigsegv;
+	if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs))
+		goto give_sigsegv;
+
+	/* Set up to return from userspace.  If provided, use a stub
+	   already in userspace.  */
+	if (ka->sa.sa_flags & SA_RESTORER) {
+		regs->gprs[14] = (__u64) ka->sa.sa_restorer;
+	} else {
+		regs->gprs[14] = (__u64) frame->retcode;
+		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
+		               (u16 *)(frame->retcode)))
+			goto give_sigsegv;
+        }
+
+	/* Set up backchain. */
+	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+		goto give_sigsegv;
+
+	/* Set up registers for signal handler */
+	regs->gprs[15] = (__u64) frame;
+	regs->psw.addr = (__u64) ka->sa.sa_handler;
+	regs->psw.mask = PSW_USER32_BITS;
+
+	regs->gprs[2] = map_signal(sig);
+	regs->gprs[3] = (__u64) &frame->sc;
+
+	/* We forgot to include these in the sigcontext.
+	   To avoid breaking binary compatibility, they are passed as args. */
+	regs->gprs[4] = current->thread.trap_no;
+	regs->gprs[5] = current->thread.prot_addr;
+	return;
+
+give_sigsegv:
+	if (sig == SIGSEGV)
+		ka->sa.sa_handler = SIG_DFL;
+	force_sig(SIGSEGV, current);
+}
+
+static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
+			   sigset_t *set, struct pt_regs * regs)
+{
+	int err = 0;
+	rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
+	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
+		goto give_sigsegv;
+
+	if (copy_siginfo_to_user32(&frame->info, info))
+		goto give_sigsegv;
+
+	/* Create the ucontext.  */
+	err |= __put_user(0, &frame->uc.uc_flags);
+	err |= __put_user(0, &frame->uc.uc_link);
+	err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
+	err |= __put_user(sas_ss_flags(regs->gprs[15]),
+	                  &frame->uc.uc_stack.ss_flags);
+	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
+	err |= save_sigregs32(regs, &frame->uc.uc_mcontext);
+	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
+	if (err)
+		goto give_sigsegv;
+
+	/* Set up to return from userspace.  If provided, use a stub
+	   already in userspace.  */
+	if (ka->sa.sa_flags & SA_RESTORER) {
+		regs->gprs[14] = (__u64) ka->sa.sa_restorer;
+	} else {
+		regs->gprs[14] = (__u64) frame->retcode;
+		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
+		                  (u16 *)(frame->retcode));
+	}
+
+	/* Set up backchain. */
+	if (__put_user(regs->gprs[15], (unsigned int *) frame))
+		goto give_sigsegv;
+
+	/* Set up registers for signal handler */
+	regs->gprs[15] = (__u64) frame;
+	regs->psw.addr = (__u64) ka->sa.sa_handler;
+	regs->psw.mask = PSW_USER32_BITS;
+
+	regs->gprs[2] = map_signal(sig);
+	regs->gprs[3] = (__u64) &frame->info;
+	regs->gprs[4] = (__u64) &frame->uc;
+	return;
+
+give_sigsegv:
+	if (sig == SIGSEGV)
+		ka->sa.sa_handler = SIG_DFL;
+	force_sig(SIGSEGV, current);
+}
+
+/*
+ * OK, we're invoking a handler
+ */	
+
+static void
+handle_signal32(unsigned long sig, siginfo_t *info, sigset_t *oldset,
+	struct pt_regs * regs)
+{
+	struct k_sigaction *ka = &current->sighand->action[sig-1];
+
+	/* Are we from a system call? */
+	if (regs->trap == __LC_SVC_OLD_PSW) {
+		/* If so, check system call restarting.. */
+		switch (regs->gprs[2]) {
+			case -ERESTARTNOHAND:
+				regs->gprs[2] = -EINTR;
+				break;
+
+			case -ERESTARTSYS:
+				if (!(ka->sa.sa_flags & SA_RESTART)) {
+					regs->gprs[2] = -EINTR;
+					break;
+				}
+			/* fallthrough */
+			case -ERESTARTNOINTR:
+				regs->gprs[2] = regs->orig_gpr2;
+				regs->psw.addr -= 2;
+		}
+	}
+
+	/* Set up the stack frame */
+	if (ka->sa.sa_flags & SA_SIGINFO)
+		setup_rt_frame32(sig, ka, info, oldset, regs);
+	else
+		setup_frame32(sig, ka, oldset, regs);
+
+	if (ka->sa.sa_flags & SA_ONESHOT)
+		ka->sa.sa_handler = SIG_DFL;
+
+	if (!(ka->sa.sa_flags & SA_NODEFER)) {
+		spin_lock_irq(&current->sighand->siglock);
+		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
+		sigaddset(&current->blocked,sig);
+		recalc_sigpending();
+		spin_unlock_irq(&current->sighand->siglock);
+	}
+}
+
+/*
+ * Note that 'init' is a special process: it doesn't get signals it doesn't
+ * want to handle. Thus you cannot kill init even with a SIGKILL even by
+ * mistake.
+ *
+ * Note that we go through the signals twice: once to check the signals that
+ * the kernel can handle, and then we build all the user-level signal handling
+ * stack-frames in one go after that.
+ */
+int do_signal32(struct pt_regs *regs, sigset_t *oldset)
+{
+	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 (!oldset)
+		oldset = &current->blocked;
+
+	signr = get_signal_to_deliver(&info, regs, NULL);
+	if (signr > 0) {
+		/* Whee!  Actually deliver the signal.  */
+		handle_signal32(signr, &info, oldset, regs);
+		return 1;
+	}
+
+	/* Did we come from a system call? */
+	if ( regs->trap == __LC_SVC_OLD_PSW /* System Call! */ ) {
+		/* Restart the system call - no handlers present */
+		if (regs->gprs[2] == -ERESTARTNOHAND ||
+		    regs->gprs[2] == -ERESTARTSYS ||
+		    regs->gprs[2] == -ERESTARTNOINTR) {
+			regs->gprs[2] = regs->orig_gpr2;
+			regs->psw.addr -= 2;
+		}
+	}
+	return 0;
+}
diff -urN linux-2.5.67-bk5/arch/s390/kernel/compat_wrapper.S linux-2.5.67-bk6/arch/s390/kernel/compat_wrapper.S
--- linux-2.5.67-bk5/arch/s390/kernel/compat_wrapper.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/compat_wrapper.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,1211 @@
+/*
+*  arch/s390/kernel/sys_wrapper31.S
+*    wrapper for 31 bit compatible system calls.
+*
+*  S390 version
+*    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+*    Author(s): Gerhard Tonn (ton@de.ibm.com),
+*/ 
+
+	.globl  sys32_exit_wrapper 
+sys32_exit_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_exit		# branch to sys_exit
+    
+	.globl  sys32_read_wrapper 
+sys32_read_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# char *
+	llgfr	%r4,%r4			# size_t
+	jg	sys32_read		# branch to sys_read
+
+	.globl  sys32_write_wrapper 
+sys32_write_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# const char *
+	llgfr	%r4,%r4			# size_t
+	jg	sys32_write		# branch to system call
+
+	.globl  sys32_open_wrapper 
+sys32_open_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int
+	lgfr	%r4,%r4			# int
+	jg	sys_open		# branch to system call
+
+	.globl  sys32_close_wrapper 
+sys32_close_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	jg	sys_close		# branch to system call
+
+	.globl  sys32_creat_wrapper 
+sys32_creat_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int
+	jg	sys_creat		# branch to system call
+
+	.globl  sys32_link_wrapper 
+sys32_link_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	jg	sys_link		# branch to system call
+
+	.globl  sys32_unlink_wrapper 
+sys32_unlink_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys_unlink		# branch to system call
+
+	.globl  sys32_chdir_wrapper 
+sys32_chdir_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys_chdir		# branch to system call
+
+	.globl  sys32_time_wrapper 
+sys32_time_wrapper:
+	llgtr	%r2,%r2			# int *
+	jg	sys_time		# branch to system call
+
+	.globl  sys32_mknod_wrapper 
+sys32_mknod_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int 
+	llgfr	%r4,%r4			# dev
+	jg	sys_mknod		# branch to system call
+
+	.globl  sys32_chmod_wrapper 
+sys32_chmod_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# mode_t
+	jg	sys_chmod		# branch to system call
+
+	.globl  sys32_lchown16_wrapper 
+sys32_lchown16_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
+	llgfr	%r4,%r4			# __kernel_old_uid_emu31_t 
+	jg	sys32_lchown16		# branch to system call
+
+	.globl  sys32_lseek_wrapper 
+sys32_lseek_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	lgfr	%r3,%r3			# off_t
+	llgfr	%r4,%r4			# unsigned int
+	jg	sys_lseek		# branch to system call
+
+#sys32_getpid_wrapper				# void 
+
+	.globl  sys32_mount_wrapper 
+sys32_mount_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# char *
+	llgfr	%r5,%r5			# unsigned long
+	llgtr	%r6,%r6			# void *
+	jg	sys32_mount		# branch to system call
+
+	.globl  sys32_oldumount_wrapper 
+sys32_oldumount_wrapper:
+	llgtr	%r2,%r2			# char *
+	jg	sys_oldumount		# branch to system call
+
+	.globl  sys32_setuid16_wrapper 
+sys32_setuid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
+	jg	sys32_setuid16		# branch to system call
+
+#sys32_getuid16_wrapper			# void 
+
+	.globl  sys32_ptrace_wrapper 
+sys32_ptrace_wrapper:
+	lgfr	%r2,%r2			# long
+	lgfr	%r3,%r3			# long
+	llgtr	%r4,%r4			# long
+	llgfr	%r5,%r5			# long
+	jg	sys_ptrace		# branch to system call
+
+	.globl  sys32_alarm_wrapper 
+sys32_alarm_wrapper:
+	llgtr	%r2,%r2			# unsigned int
+	jg	sys_alarm		# branch to system call
+
+#sys32_pause_wrapper			# void 
+
+	.globl  compat_sys_utime_wrapper 
+compat_sys_utime_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct compat_utimbuf *
+	jg	compat_sys_utime		# branch to system call
+
+	.globl  sys32_access_wrapper 
+sys32_access_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int
+	jg	sys_access		# branch to system call
+
+	.globl  sys32_nice_wrapper 
+sys32_nice_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_nice		# branch to system call
+
+#sys32_sync_wrapper			# void 
+
+	.globl  sys32_kill_wrapper 
+sys32_kill_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	jg	sys_kill		# branch to system call
+
+	.globl  sys32_rename_wrapper 
+sys32_rename_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	jg	sys_rename		# branch to system call
+
+	.globl  sys32_mkdir_wrapper 
+sys32_mkdir_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int
+	jg	sys_mkdir		# branch to system call
+
+	.globl  sys32_rmdir_wrapper 
+sys32_rmdir_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys_rmdir		# branch to system call
+
+	.globl  sys32_dup_wrapper 
+sys32_dup_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	jg	sys_dup			# branch to system call
+
+	.globl  sys32_pipe_wrapper 
+sys32_pipe_wrapper:
+	llgtr	%r2,%r2			# u32 *
+	jg	sys_pipe		# branch to system call
+
+	.globl  compat_sys_times_wrapper 
+compat_sys_times_wrapper:
+	llgtr	%r2,%r2			# struct compat_tms *
+	jg	compat_sys_times	# branch to system call
+
+	.globl  sys32_brk_wrapper 
+sys32_brk_wrapper:
+	llgtr	%r2,%r2			# unsigned long
+	jg	sys_brk			# branch to system call
+
+	.globl  sys32_setgid16_wrapper 
+sys32_setgid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
+	jg	sys32_setgid16		# branch to system call
+
+#sys32_getgid16_wrapper			# void 
+
+	.globl sys32_signal_wrapper
+sys32_signal_wrapper:
+	lgfr	%r2,%r2			# int 
+	llgfr	%r3,%r3			# __sighandler_t 
+	jg	sys_signal
+
+#sys32_geteuid16_wrapper		# void 
+
+#sys32_getegid16_wrapper		# void 
+
+	.globl  sys32_acct_wrapper 
+sys32_acct_wrapper:
+	llgtr	%r2,%r2			# char *
+	jg	sys_acct		# branch to system call
+
+	.globl  sys32_umount_wrapper 
+sys32_umount_wrapper:
+	llgtr	%r2,%r2			# char *
+	lgfr	%r3,%r3			# int
+	jg	sys_umount		# branch to system call
+
+	.globl  sys32_ioctl_wrapper 
+sys32_ioctl_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned int
+	llgfr	%r4,%r4			# unsigned int
+	jg	sys32_ioctl		# branch to system call
+
+	.globl  compat_sys_fcntl_wrapper 
+compat_sys_fcntl_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned int 
+	llgfr	%r4,%r4			# unsigned long
+	jg	compat_sys_fcntl	# branch to system call
+
+	.globl  sys32_setpgid_wrapper 
+sys32_setpgid_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	lgfr	%r3,%r3			# pid_t
+	jg	sys_setpgid		# branch to system call
+
+	.globl  sys32_umask_wrapper 
+sys32_umask_wrapper:
+	lgfr	%r3,%r3			# int
+	jg	sys_umask		# branch to system call
+
+	.globl  sys32_chroot_wrapper 
+sys32_chroot_wrapper:
+	llgtr	%r2,%r2			# char *
+	jg	sys_chroot		# branch to system call
+
+	.globl sys32_ustat_wrapper
+sys32_ustat_wrapper:
+	llgfr	%r2,%r2			# dev_t 
+	llgtr	%r3,%r3			# struct ustat *
+	jg	sys_ustat
+
+	.globl  sys32_dup2_wrapper 
+sys32_dup2_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned int
+	jg	sys_dup2		# branch to system call
+
+#sys32_getppid_wrapper			# void 
+
+#sys32_getpgrp_wrapper			# void 
+
+#sys32_setsid_wrapper			# void 
+
+	.globl  sys32_sigaction_wrapper
+sys32_sigaction_wrapper:
+	lgfr	%r2,%r2			# int 
+	llgtr	%r3,%r3			# const struct old_sigaction *
+	jg	sys32_sigaction		# branch to system call
+
+	.globl  sys32_setreuid16_wrapper 
+sys32_setreuid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
+	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
+	jg	sys32_setreuid16	# branch to system call
+
+	.globl  sys32_setregid16_wrapper 
+sys32_setregid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
+	llgfr	%r3,%r3			# __kernel_old_gid_emu31_t 
+	jg	sys32_setregid16	# branch to system call
+
+#sys32_sigsuspend_wrapper		# done in sigsuspend_glue 
+
+	.globl  compat_sys_sigpending_wrapper 
+compat_sys_sigpending_wrapper:
+	llgtr	%r2,%r2			# compat_old_sigset_t *
+	jg	compat_sys_sigpending	# branch to system call
+
+	.globl  sys32_sethostname_wrapper 
+sys32_sethostname_wrapper:
+	llgtr	%r2,%r2			# char *
+	lgfr	%r3,%r3			# int
+	jg	sys_sethostname		# branch to system call
+
+	.globl  sys32_setrlimit_wrapper 
+sys32_setrlimit_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# struct rlimit_emu31 *
+	jg	sys32_setrlimit		# branch to system call
+
+	.globl  sys32_old_getrlimit_wrapper 
+sys32_old_getrlimit_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# struct rlimit_emu31 *
+	jg	sys32_old_getrlimit	# branch to system call
+
+	.globl  sys32_getrlimit_wrapper 
+sys32_getrlimit_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# struct rlimit_emu31 *
+	jg	sys32_getrlimit		# branch to system call
+
+	.globl  sys32_mmap2_wrapper 
+sys32_mmap2_wrapper:
+	llgtr	%r2,%r2			# struct mmap_arg_struct_emu31 *
+	jg	sys32_mmap2			# branch to system call
+
+	.globl  sys32_getrusage_wrapper 
+sys32_getrusage_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# struct rusage_emu31 *
+	jg	sys32_getrusage		# branch to system call
+
+	.globl  sys32_gettimeofday_wrapper 
+sys32_gettimeofday_wrapper:
+	llgtr	%r2,%r2			# struct timeval_emu31 *
+	llgtr	%r3,%r3			# struct timezone *
+	jg	sys32_gettimeofday	# branch to system call
+
+	.globl  sys32_settimeofday_wrapper 
+sys32_settimeofday_wrapper:
+	llgtr	%r2,%r2			# struct timeval_emu31 *
+	llgtr	%r3,%r3			# struct timezone *
+	jg	sys32_settimeofday	# branch to system call
+
+	.globl  sys32_getgroups16_wrapper 
+sys32_getgroups16_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
+	jg	sys32_getgroups16	# branch to system call
+
+	.globl  sys32_setgroups16_wrapper 
+sys32_setgroups16_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
+	jg	sys32_setgroups16	# branch to system call
+
+	.globl  sys32_symlink_wrapper 
+sys32_symlink_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	jg	sys_symlink		# branch to system call
+
+	.globl  sys32_readlink_wrapper 
+sys32_readlink_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# char *
+	lgfr	%r4,%r4			# int
+	jg	sys_readlink		# branch to system call
+
+	.globl  sys32_uselib_wrapper 
+sys32_uselib_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys_uselib		# branch to system call
+
+	.globl  sys32_swapon_wrapper 
+sys32_swapon_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# int
+	jg	sys_swapon		# branch to system call
+
+	.globl  sys32_reboot_wrapper 
+sys32_reboot_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	llgfr	%r4,%r4			# unsigned int
+	llgtr	%r5,%r5			# void *
+	jg	sys_reboot		# branch to system call
+
+	.globl  old32_readdir_wrapper 
+old32_readdir_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# void *
+	llgfr	%r4,%r4			# unsigned int
+	jg	old32_readdir		# branch to system call
+
+	.globl  old32_mmap_wrapper 
+old32_mmap_wrapper:
+	llgtr	%r2,%r2			# struct mmap_arg_struct_emu31 *
+	jg	old32_mmap		# branch to system call
+
+	.globl  sys32_munmap_wrapper 
+sys32_munmap_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t 
+	jg	sys_munmap		# branch to system call
+
+	.globl  sys32_truncate_wrapper 
+sys32_truncate_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# unsigned long
+	jg	sys_truncate		# branch to system call
+
+	.globl  sys32_ftruncate_wrapper 
+sys32_ftruncate_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned long
+	jg	sys_ftruncate		# branch to system call
+
+	.globl  sys32_fchmod_wrapper 
+sys32_fchmod_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# mode_t
+	jg	sys_fchmod		# branch to system call
+
+	.globl  sys32_fchown16_wrapper 
+sys32_fchown16_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# __kernel_old_uid_emu31_t *
+	llgtr	%r4,%r4			# __kernel_old_gid_emu31_t *
+	jg	sys32_fchown16		# branch to system call
+
+	.globl  sys32_getpriority_wrapper 
+sys32_getpriority_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	jg	sys_getpriority		# branch to system call
+
+	.globl  sys32_setpriority_wrapper 
+sys32_setpriority_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	lgfr	%r4,%r4			# int
+	jg	sys_setpriority		# branch to system call
+
+	.globl  compat_sys_statfs_wrapper 
+compat_sys_statfs_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct compat_statfs *
+	jg	compat_sys_statfs	# branch to system call
+
+	.globl  compat_sys_fstatfs_wrapper 
+compat_sys_fstatfs_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# struct compat_statfs *
+	jg	compat_sys_fstatfs	# branch to system call
+
+	.globl  compat_sys_socketcall_wrapper 
+compat_sys_socketcall_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# u32 *
+	jg	compat_sys_socketcall	# branch to system call
+
+	.globl  sys32_syslog_wrapper 
+sys32_syslog_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# char *
+	lgfr	%r4,%r4			# int
+	jg	sys_syslog		# branch to system call
+
+	.globl  compat_sys_setitimer_wrapper 
+compat_sys_setitimer_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# struct itimerval_emu31 *
+	llgtr	%r4,%r4			# struct itimerval_emu31 *
+	jg	compat_sys_setitimer	# branch to system call
+
+	.globl  compat_sys_getitimer_wrapper 
+compat_sys_getitimer_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# struct itimerval_emu31 *
+	jg	compat_sys_getitimer	# branch to system call
+
+	.globl  compat_sys_newstat_wrapper 
+compat_sys_newstat_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct stat_emu31 *
+	jg	compat_sys_newstat	# branch to system call
+
+	.globl  compat_sys_newlstat_wrapper 
+compat_sys_newlstat_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct stat_emu31 *
+	jg	compat_sys_newlstat	# branch to system call
+
+	.globl  compat_sys_newfstat_wrapper 
+compat_sys_newfstat_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# struct stat_emu31 *
+	jg	compat_sys_newfstat	# branch to system call
+
+#sys32_vhangup_wrapper			# void 
+
+	.globl  sys32_wait4_wrapper 
+sys32_wait4_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	llgtr	%r3,%r3			# unsigned int *
+	lgfr	%r4,%r4			# int
+	llgtr	%r5,%r5			# struct rusage *
+	jg	sys32_wait4		# branch to system call
+
+	.globl  sys32_swapoff_wrapper 
+sys32_swapoff_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys_swapoff		# branch to system call
+
+	.globl  sys32_sysinfo_wrapper 
+sys32_sysinfo_wrapper:
+	llgtr	%r2,%r2			# struct sysinfo_emu31 *
+	jg	sys32_sysinfo		# branch to system call
+
+	.globl  sys32_ipc_wrapper 
+sys32_ipc_wrapper:
+	llgfr	%r2,%r2			# uint
+	lgfr	%r3,%r3			# int
+	lgfr	%r4,%r4			# int
+	lgfr	%r5,%r5			# int
+	llgtr	%r6,%r6			# void *
+	jg	sys32_ipc		# branch to system call
+
+	.globl  sys32_fsync_wrapper 
+sys32_fsync_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	jg	sys_fsync		# branch to system call
+
+#sys32_sigreturn_wrapper		# done in sigreturn_glue 
+
+#sys32_clone_wrapper			# done in clone_glue 
+
+	.globl  sys32_setdomainname_wrapper 
+sys32_setdomainname_wrapper:
+	llgtr	%r2,%r2			# char *
+	lgfr	%r3,%r3			# int
+	jg	sys_setdomainname	# branch to system call
+
+	.globl  sys32_newuname_wrapper 
+sys32_newuname_wrapper:
+	llgtr	%r2,%r2			# struct new_utsname *
+	jg	s390x_newuname		# branch to system call
+
+	.globl  sys32_adjtimex_wrapper 
+sys32_adjtimex_wrapper:
+	llgtr	%r2,%r2			# struct timex_emu31 *
+	jg	sys32_adjtimex		# branch to system call
+
+	.globl  sys32_mprotect_wrapper 
+sys32_mprotect_wrapper:
+	llgtr	%r2,%r2			# unsigned long (actually pointer
+	llgfr	%r3,%r3			# size_t
+	llgfr	%r4,%r4			# unsigned long
+	jg	sys_mprotect		# branch to system call
+
+	.globl  compat_sys_sigprocmask_wrapper 
+compat_sys_sigprocmask_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# compat_old_sigset_t *
+	llgtr	%r4,%r4			# compat_old_sigset_t *
+	jg	compat_sys_sigprocmask		# branch to system call
+
+	.globl  sys32_init_module_wrapper 
+sys32_init_module_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# struct module *
+	jg	sys32_init_module	# branch to system call
+
+	.globl  sys32_delete_module_wrapper 
+sys32_delete_module_wrapper:
+	llgtr	%r2,%r2			# const char *
+	jg	sys32_delete_module	# branch to system call
+
+	.globl  sys32_quotactl_wrapper 
+sys32_quotactl_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# const char *
+	lgfr	%r4,%r4			# int
+	llgtr	%r5,%r5			# caddr_t
+	jg	sys_quotactl		# branch to system call
+
+	.globl  sys32_getpgid_wrapper 
+sys32_getpgid_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	jg	sys_getpgid		# branch to system call
+
+	.globl  sys32_fchdir_wrapper 
+sys32_fchdir_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	jg	sys_fchdir		# branch to system call
+
+	.globl  sys32_bdflush_wrapper 
+sys32_bdflush_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# long
+	jg	sys_bdflush		# branch to system call
+
+	.globl  sys32_sysfs_wrapper 
+sys32_sysfs_wrapper:
+	lgfr	%r2,%r2			# int
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
+	jg	sys_sysfs		# branch to system call
+
+	.globl  sys32_personality_wrapper 
+sys32_personality_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	jg	s390x_personality	# branch to system call
+
+	.globl  sys32_setfsuid16_wrapper 
+sys32_setfsuid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
+	jg	sys32_setfsuid16	# branch to system call
+
+	.globl  sys32_setfsgid16_wrapper 
+sys32_setfsgid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
+	jg	sys32_setfsgid16	# branch to system call
+
+	.globl  sys32_llseek_wrapper 
+sys32_llseek_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
+	llgtr	%r5,%r5			# loff_t *
+	llgfr	%r6,%r6			# unsigned int
+	jg	sys_llseek		# branch to system call
+
+	.globl  sys32_getdents_wrapper 
+sys32_getdents_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# void *
+	llgfr	%r4,%r4			# unsigned int
+	jg	sys32_getdents		# branch to system call
+
+	.globl  sys32_select_wrapper 
+sys32_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
+
+	.globl  sys32_flock_wrapper 
+sys32_flock_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned int
+	jg	sys_flock		# branch to system call
+
+	.globl  sys32_msync_wrapper 
+sys32_msync_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t
+	lgfr	%r4,%r4			# int
+	jg	sys_msync		# branch to system call
+
+	.globl  sys32_readv_wrapper 
+sys32_readv_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgtr	%r3,%r3			# const struct iovec_emu31 *
+	llgfr	%r4,%r4			# unsigned long
+	jg	sys32_readv		# branch to system call
+
+	.globl  sys32_writev_wrapper 
+sys32_writev_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgtr	%r3,%r3			# const struct iovec_emu31 *
+	llgfr	%r4,%r4			# unsigned long
+	jg	sys32_writev		# branch to system call
+
+	.globl  sys32_getsid_wrapper 
+sys32_getsid_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	jg	sys_getsid		# branch to system call
+
+	.globl  sys32_fdatasync_wrapper 
+sys32_fdatasync_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	jg	sys_fdatasync		# branch to system call
+
+#sys32_sysctl_wrapper			# tbd 
+
+	.globl  sys32_mlock_wrapper 
+sys32_mlock_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t
+	jg	sys_mlock		# branch to system call
+
+	.globl  sys32_munlock_wrapper 
+sys32_munlock_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t
+	jg	sys_munlock		# branch to system call
+
+	.globl  sys32_mlockall_wrapper 
+sys32_mlockall_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_mlockall		# branch to system call
+
+#sys32_munlockall_wrapper		# void 
+
+	.globl  sys32_sched_setparam_wrapper 
+sys32_sched_setparam_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	llgtr	%r3,%r3			# struct sched_param *
+	jg	sys_sched_setparam	# branch to system call
+
+	.globl  sys32_sched_getparam_wrapper 
+sys32_sched_getparam_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	llgtr	%r3,%r3			# struct sched_param *
+	jg	sys_sched_getparam	# branch to system call
+
+	.globl  sys32_sched_setscheduler_wrapper 
+sys32_sched_setscheduler_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	lgfr	%r3,%r3			# int
+	llgtr	%r4,%r4			# struct sched_param *
+	jg	sys_sched_setscheduler	# branch to system call
+
+	.globl  sys32_sched_getscheduler_wrapper 
+sys32_sched_getscheduler_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	jg	sys_sched_getscheduler	# branch to system call
+
+#sys32_sched_yield_wrapper		# void 
+
+	.globl  sys32_sched_get_priority_max_wrapper 
+sys32_sched_get_priority_max_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_sched_get_priority_max	# branch to system call
+
+	.globl  sys32_sched_get_priority_min_wrapper 
+sys32_sched_get_priority_min_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_sched_get_priority_min	# branch to system call
+
+	.globl  sys32_sched_rr_get_interval_wrapper 
+sys32_sched_rr_get_interval_wrapper:
+	lgfr	%r2,%r2			# pid_t
+	llgtr	%r3,%r3			# struct compat_timespec *
+	jg	sys32_sched_rr_get_interval	# branch to system call
+
+	.globl  compat_sys_nanosleep_wrapper 
+compat_sys_nanosleep_wrapper:
+	llgtr	%r2,%r2			# struct compat_timespec *
+	llgtr	%r3,%r3			# struct compat_timespec *
+	jg	compat_sys_nanosleep		# branch to system call
+
+	.globl  sys32_mremap_wrapper 
+sys32_mremap_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
+	llgfr	%r5,%r5			# unsigned long
+	llgfr	%r6,%r6			# unsigned long
+	jg	sys_mremap		# branch to system call
+
+	.globl  sys32_setresuid16_wrapper 
+sys32_setresuid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
+	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
+	llgfr	%r4,%r4			# __kernel_old_uid_emu31_t 
+	jg	sys32_setresuid16	# branch to system call
+
+	.globl  sys32_getresuid16_wrapper 
+sys32_getresuid16_wrapper:
+	llgtr	%r2,%r2			# __kernel_old_uid_emu31_t *
+	llgtr	%r3,%r3			# __kernel_old_uid_emu31_t *
+	llgtr	%r4,%r4			# __kernel_old_uid_emu31_t *
+	jg	sys32_getresuid16	# branch to system call
+
+	.globl  sys32_poll_wrapper 
+sys32_poll_wrapper:
+	llgtr	%r2,%r2			# struct pollfd * 
+	llgfr	%r3,%r3			# unsigned int 
+	lgfr	%r4,%r4			# long 
+	jg	sys_poll		# branch to system call
+
+	.globl  sys32_nfsservctl_wrapper 
+sys32_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
+
+	.globl  sys32_setresgid16_wrapper 
+sys32_setresgid16_wrapper:
+	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
+	llgfr	%r3,%r3			# __kernel_old_gid_emu31_t 
+	llgfr	%r4,%r4			# __kernel_old_gid_emu31_t 
+	jg	sys32_setresgid16	# branch to system call
+
+	.globl  sys32_getresgid16_wrapper 
+sys32_getresgid16_wrapper:
+	llgtr	%r2,%r2			# __kernel_old_gid_emu31_t *
+	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
+	llgtr	%r4,%r4			# __kernel_old_gid_emu31_t *
+	jg	sys32_getresgid16	# branch to system call
+
+	.globl  sys32_prctl_wrapper 
+sys32_prctl_wrapper:
+	lgfr	%r2,%r2			# int
+	llgfr	%r3,%r3			# unsigned long
+	llgfr	%r4,%r4			# unsigned long
+	llgfr	%r5,%r5			# unsigned long
+	llgfr	%r6,%r6			# unsigned long
+	jg	sys_prctl		# branch to system call
+
+#sys32_rt_sigreturn_wrapper		# done in rt_sigreturn_glue 
+
+	.globl  sys32_rt_sigaction_wrapper 
+sys32_rt_sigaction_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# const struct sigaction_emu31 *
+	llgtr	%r4,%r4			# const struct sigaction_emu31 *
+	llgfr	%r5,%r5			# size_t
+	jg	sys32_rt_sigaction	# branch to system call
+
+	.globl  sys32_rt_sigprocmask_wrapper 
+sys32_rt_sigprocmask_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# old_sigset_emu31 *
+	llgtr	%r4,%r4			# old_sigset_emu31 *
+	jg	sys32_rt_sigprocmask	# branch to system call
+
+	.globl  sys32_rt_sigpending_wrapper 
+sys32_rt_sigpending_wrapper:
+	llgtr	%r2,%r2			# sigset_emu31 *
+	llgfr	%r3,%r3			# size_t
+	jg	sys32_rt_sigpending	# branch to system call
+
+	.globl  sys32_rt_sigtimedwait_wrapper 
+sys32_rt_sigtimedwait_wrapper:
+	llgtr	%r2,%r2			# const sigset_emu31_t *
+	llgtr	%r3,%r3			# siginfo_emu31_t *
+	llgtr	%r4,%r4			# const struct compat_timespec *
+	llgfr	%r5,%r5			# size_t
+	jg	sys32_rt_sigtimedwait	# branch to system call
+
+	.globl  sys32_rt_sigqueueinfo_wrapper 
+sys32_rt_sigqueueinfo_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	llgtr	%r4,%r4			# siginfo_emu31_t *
+	jg	sys32_rt_sigqueueinfo	# branch to system call
+
+#sys32_rt_sigsuspend_wrapper		# done in rt_sigsuspend_glue 
+
+	.globl  sys32_pread64_wrapper 
+sys32_pread64_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# char *
+	llgfr	%r4,%r4			# size_t
+	llgfr	%r5,%r5			# u32
+	llgfr	%r6,%r6			# u32
+	jg	sys32_pread64		# branch to system call
+
+	.globl  sys32_pwrite64_wrapper 
+sys32_pwrite64_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# const char *
+	llgfr	%r4,%r4			# size_t
+	llgfr	%r5,%r5			# u32
+	llgfr	%r6,%r6			# u32
+	jg	sys32_pwrite64		# branch to system call
+
+	.globl  sys32_chown16_wrapper 
+sys32_chown16_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
+	llgfr	%r4,%r4			# __kernel_old_gid_emu31_t 
+	jg	sys32_chown16		# branch to system call
+
+	.globl  sys32_getcwd_wrapper 
+sys32_getcwd_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgfr	%r3,%r3			# unsigned long
+	jg	sys_getcwd		# branch to system call
+
+	.globl  sys32_capget_wrapper 
+sys32_capget_wrapper:
+	llgtr	%r2,%r2			# cap_user_header_t
+	llgtr	%r3,%r3			# cap_user_data_t
+	jg	sys_capget		# branch to system call
+
+	.globl  sys32_capset_wrapper 
+sys32_capset_wrapper:
+	llgtr	%r2,%r2			# cap_user_header_t
+	llgtr	%r3,%r3			# const cap_user_data_t
+	jg	sys_capset		# branch to system call
+
+	.globl sys32_sigaltstack_wrapper
+sys32_sigaltstack_wrapper:
+	llgtr	%r2,%r2			# const stack_emu31_t * 
+	llgtr	%r3,%r3			# stack_emu31_t * 
+	jg	sys32_sigaltstack
+
+	.globl  sys32_sendfile_wrapper 
+sys32_sendfile_wrapper:
+	lgfr	%r2,%r2			# int
+	lgfr	%r3,%r3			# int
+	llgtr	%r4,%r4			# __kernel_off_emu31_t *
+	llgfr	%r5,%r5			# size_t
+	jg	sys32_sendfile		# branch to system call
+
+#sys32_vfork_wrapper			# done in vfork_glue 
+
+	.globl  sys32_truncate64_wrapper 
+sys32_truncate64_wrapper:
+	llgtr	%r2,%r2			# const char *
+	lgfr	%r3,%r3			# s32 
+	llgfr	%r4,%r4			# u32 
+	jg	sys32_truncate64	# branch to system call
+
+	.globl  sys32_ftruncate64_wrapper 
+sys32_ftruncate64_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	lgfr	%r3,%r3			# s32 
+	llgfr	%r4,%r4			# u32 
+	jg	sys32_ftruncate64	# branch to system call
+
+	.globl sys32_lchown_wrapper	
+sys32_lchown_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# uid_t
+	llgfr	%r4,%r4			# gid_t
+	jg	sys_lchown		# branch to system call
+
+#sys32_getuid_wrapper			# void			 
+#sys32_getgid_wrapper			# void 
+#sys32_geteuid_wrapper			# void 
+#sys32_getegid_wrapper			# void 
+
+	.globl sys32_setreuid_wrapper
+sys32_setreuid_wrapper:
+	llgfr	%r2,%r2			# uid_t
+	llgfr	%r3,%r3			# uid_t
+	jg	sys_setreuid		# branch to system call
+
+	.globl sys32_setregid_wrapper
+sys32_setregid_wrapper:
+	llgfr	%r2,%r2			# gid_t
+	llgfr	%r3,%r3			# gid_t
+	jg	sys_setregid		# branch to system call
+
+	.globl  sys32_getgroups_wrapper 
+sys32_getgroups_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# gid_t *
+	jg	sys_getgroups		# branch to system call
+
+	.globl  sys32_setgroups_wrapper 
+sys32_setgroups_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# gid_t *
+	jg	sys_setgroups		# branch to system call
+
+	.globl sys32_fchown_wrapper	
+sys32_fchown_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# uid_t
+	llgfr	%r4,%r4			# gid_t
+	jg	sys_fchown		# branch to system call
+
+	.globl sys32_setresuid_wrapper	
+sys32_setresuid_wrapper:
+	llgfr	%r2,%r2			# uid_t
+	llgfr	%r3,%r3			# uid_t
+	llgfr	%r4,%r4			# uid_t
+	jg	sys_setresuid		# branch to system call
+
+	.globl sys32_getresuid_wrapper	
+sys32_getresuid_wrapper:
+	llgtr	%r2,%r2			# uid_t *
+	llgtr	%r3,%r3			# uid_t *
+	llgtr	%r4,%r4			# uid_t *
+	jg	sys_getresuid		# branch to system call
+
+	.globl sys32_setresgid_wrapper	
+sys32_setresgid_wrapper:
+	llgfr	%r2,%r2			# gid_t
+	llgfr	%r3,%r3			# gid_t
+	llgfr	%r4,%r4			# gid_t
+	jg	sys_setresgid		# branch to system call
+
+	.globl sys32_getresgid_wrapper	
+sys32_getresgid_wrapper:
+	llgtr	%r2,%r2			# gid_t *
+	llgtr	%r3,%r3			# gid_t *
+	llgtr	%r4,%r4			# gid_t *
+	jg	sys_getresgid		# branch to system call
+
+	.globl sys32_chown_wrapper	
+sys32_chown_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgfr	%r3,%r3			# uid_t
+	llgfr	%r4,%r4			# gid_t
+	jg	sys_chown		# branch to system call
+
+	.globl sys32_setuid_wrapper	
+sys32_setuid_wrapper:
+	llgfr	%r2,%r2			# uid_t
+	jg	sys_setuid		# branch to system call
+
+	.globl sys32_setgid_wrapper	
+sys32_setgid_wrapper:
+	llgfr	%r2,%r2			# gid_t
+	jg	sys_setgid		# branch to system call
+
+	.globl sys32_setfsuid_wrapper	
+sys32_setfsuid_wrapper:
+	llgfr	%r2,%r2			# uid_t
+	jg	sys_setfsuid		# branch to system call
+
+	.globl sys32_setfsgid_wrapper	
+sys32_setfsgid_wrapper:
+	llgfr	%r2,%r2			# gid_t
+	jg	sys_setfsgid		# branch to system call
+
+	.globl  sys32_pivot_root_wrapper 
+sys32_pivot_root_wrapper:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	jg	sys_pivot_root		# branch to system call
+
+	.globl  sys32_mincore_wrapper 
+sys32_mincore_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t
+	llgtr	%r4,%r4			# unsigned char *
+	jg	sys_mincore		# branch to system call
+
+	.globl  sys32_madvise_wrapper 
+sys32_madvise_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgfr	%r3,%r3			# size_t
+	lgfr	%r4,%r4			# int
+	jg	sys_madvise		# branch to system call
+
+	.globl  sys32_getdents64_wrapper 
+sys32_getdents64_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgtr	%r3,%r3			# void *
+	llgfr	%r4,%r4			# unsigned int
+	jg	sys_getdents64		# branch to system call
+
+	.globl  compat_sys_fcntl64_wrapper 
+compat_sys_fcntl64_wrapper:
+	llgfr	%r2,%r2			# unsigned int
+	llgfr	%r3,%r3			# unsigned int 
+	llgfr	%r4,%r4			# unsigned long
+	jg	compat_sys_fcntl64	# branch to system call
+
+	.globl	sys32_stat64_wrapper
+sys32_stat64_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct stat64 *
+	llgfr	%r4,%r4			# long
+	jg	sys32_stat64		# branch to system call
+
+	.globl	sys32_lstat64_wrapper
+sys32_lstat64_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# struct stat64 *
+	llgfr	%r4,%r4			# long
+	jg	sys32_lstat64		# branch to system call
+
+	.globl	sys32_stime_wrapper
+sys32_stime_wrapper:
+	llgtr	%r2,%r2			# int *
+	jg	sys_stime		# branch to system call
+
+	.globl  sys32_sysctl_wrapper
+sys32_sysctl_wrapper:
+	llgtr   %r2,%r2                 # struct __sysctl_args32 *
+	jg      sys32_sysctl
+
+	.globl	sys32_fstat64_wrapper
+sys32_fstat64_wrapper:
+	llgfr	%r2,%r2			# unsigned long
+	llgtr	%r3,%r3			# struct stat64 *
+	llgfr	%r4,%r4			# long
+	jg	sys32_fstat64		# branch to system call
+
+	.globl  compat_sys_futex_wrapper 
+compat_sys_futex_wrapper:
+	llgtr	%r2,%r2			# u32 *
+	lgfr	%r3,%r3			# int
+	lgfr	%r4,%r4			# int
+	llgtr	%r5,%r5			# struct compat_timespec *
+	jg	compat_sys_futex	# branch to system call
+
+	.globl	sys32_setxattr_wrapper
+sys32_setxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	lgfr	%r6,%r6			# int
+	jg	sys_setxattr
+
+	.globl	sys32_lsetxattr_wrapper
+sys32_lsetxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	lgfr	%r6,%r6			# int
+	jg	sys_lsetxattr
+
+	.globl	sys32_fsetxattr_wrapper
+sys32_fsetxattr_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	lgfr	%r6,%r6			# int
+	jg	sys_fsetxattr
+
+	.globl	sys32_getxattr_wrapper
+sys32_getxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	jg	sys_getxattr
+
+	.globl	sys32_lgetxattr_wrapper
+sys32_lgetxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	jg	sys_lgetxattr
+
+	.globl	sys32_fgetxattr_wrapper
+sys32_fgetxattr_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# char *
+	llgtr	%r4,%r4			# void *
+	llgfr	%r5,%r5			# size_t
+	jg	sys_fgetxattr
+
+	.globl	sys32_listxattr_wrapper
+sys32_listxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgfr	%r4,%r4			# size_t
+	jg	sys_listxattr
+
+	.globl	sys32_llistxattr_wrapper
+sys32_llistxattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	llgfr	%r4,%r4			# size_t
+	jg	sys_llistxattr
+
+	.globl	sys32_flistxattr_wrapper
+sys32_flistxattr_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# char *
+	llgfr	%r4,%r4			# size_t
+	jg	sys_flistxattr
+
+	.globl	sys32_removexattr_wrapper
+sys32_removexattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	jg	sys_removexattr
+
+	.globl	sys32_lremovexattr_wrapper
+sys32_lremovexattr_wrapper:
+	llgtr	%r2,%r2			# char *
+	llgtr	%r3,%r3			# char *
+	jg	sys_lremovexattr
+
+	.globl	sys32_fremovexattr_wrapper
+sys32_fremovexattr_wrapper:
+	lgfr	%r2,%r2			# int
+	llgtr	%r3,%r3			# char *
+	jg	sys_fremovexattr
+
+	.globl	sys32_sched_setaffinity_wrapper
+sys32_sched_setaffinity_wrapper:
+	lgfr	%r2,%r2			# int
+	llgfr	%r3,%r3			# unsigned int
+	llgtr	%r4,%r4			# unsigned long *
+	jg	sys32_sched_setaffinity
+
+	.globl	sys32_sched_getaffinity_wrapper
+sys32_sched_getaffinity_wrapper:
+	lgfr	%r2,%r2			# int
+	llgfr	%r3,%r3			# unsigned int
+	llgtr	%r4,%r4			# unsigned long *
+	jg	sys32_sched_getaffinity
+
+	.globl  sys32_exit_group_wrapper
+sys32_exit_group_wrapper:
+	lgfr	%r2,%r2			# int
+	jg	sys_exit_group		# branch to system call
+
+	.globl  sys32_set_tid_address_wrapper
+sys32_set_tid_address_wrapper:
+	llgtr	%r2,%r2			# int *
+	jg	sys_set_tid_address	# branch to system call
diff -urN linux-2.5.67-bk5/arch/s390/kernel/cpcmd.c linux-2.5.67-bk6/arch/s390/kernel/cpcmd.c
--- linux-2.5.67-bk5/arch/s390/kernel/cpcmd.c	2003-04-07 10:31:15.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/cpcmd.c	2003-04-15 04:36:14.000000000 -0700
@@ -10,19 +10,26 @@
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <asm/ebcdic.h>
+#include <linux/spinlock.h>
 #include <asm/cpcmd.h>
+#include <asm/system.h>
+
+static spinlock_t cpcmd_lock = SPIN_LOCK_UNLOCKED;
+static char cpcmd_buf[128];
 
 void cpcmd(char *cmd, char *response, int rlen)
 {
         const int mask = 0x40000000L;
-        char obuffer[128];
-        int olen;
+	unsigned long flags;
+        int cmdlen;
 
-        olen = strlen(cmd);
-        strcpy(obuffer, cmd);
-        ASCEBC(obuffer,olen);
+	spin_lock_irqsave(&cpcmd_lock, flags);
+        cmdlen = strlen(cmd);
+        strcpy(cpcmd_buf, cmd);
+        ASCEBC(cpcmd_buf, cmdlen);
 
         if (response != NULL && rlen > 0) {
+#ifndef CONFIG_ARCH_S390X
                 asm volatile ("LRA   2,0(%0)\n\t"
                               "LR    4,%1\n\t"
                               "O     4,%4\n\t"
@@ -30,17 +37,43 @@
                               "LR    5,%3\n\t"
                               ".long 0x83240008 # Diagnose 83\n\t"
                               : /* no output */
-                              : "a" (obuffer), "d" (olen),
+                              : "a" (cpcmd_buf), "d" (cmdlen),
+                                "a" (response), "d" (rlen), "m" (mask)
+                              : "2", "3", "4", "5" );
+#else /* CONFIG_ARCH_S390X */
+                asm volatile ("   lrag  2,0(%0)\n"
+                              "   lgr   4,%1\n"
+                              "   o     4,%4\n"
+                              "   lrag  3,0(%2)\n"
+                              "   lgr   5,%3\n"
+                              "   sam31\n"
+                              "   .long 0x83240008 # Diagnose 83\n"
+                              "   sam64"
+                              : /* no output */
+                              : "a" (cpcmd_buf), "d" (cmdlen),
                                 "a" (response), "d" (rlen), "m" (mask)
                               : "2", "3", "4", "5" );
+#endif /* CONFIG_ARCH_S390X */
                 EBCASC(response, rlen);
         } else {
+#ifndef CONFIG_ARCH_S390X
                 asm volatile ("LRA   2,0(%0)\n\t"
                               "LR    3,%1\n\t"
                               ".long 0x83230008 # Diagnose 83\n\t"
                               : /* no output */
-                              : "a" (obuffer), "d" (olen)
+                              : "a" (cpcmd_buf), "d" (cmdlen)
+                              : "2", "3"  );
+#else /* CONFIG_ARCH_S390X */
+                asm volatile ("   lrag  2,0(%0)\n"
+                              "   lgr   3,%1\n"
+                              "   sam31\n"
+                              "   .long 0x83230008 # Diagnose 83\n"
+                              "   sam64"
+                              : /* no output */
+                              : "a" (cpcmd_buf), "d" (cmdlen)
                               : "2", "3"  );
+#endif /* CONFIG_ARCH_S390X */
         }
+	spin_unlock_irqrestore(&cpcmd_lock, flags);
 }
 
diff -urN linux-2.5.67-bk5/arch/s390/kernel/debug.c linux-2.5.67-bk6/arch/s390/kernel/debug.c
--- linux-2.5.67-bk5/arch/s390/kernel/debug.c	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/debug.c	2003-04-15 04:36:14.000000000 -0700
@@ -16,7 +16,6 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/ctype.h>
-#include <linux/version.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 
@@ -1111,17 +1110,10 @@
 		except_str = "*";
 	else
 		except_str = "-";
-	caller = (unsigned long) entry->caller;
-#if defined(CONFIG_ARCH_S390X)
-	rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %016lx  ",
+	caller = ((unsigned long) entry->caller) & PSW_ADDR_INSN;
+	rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %p  ",
 		      area, time_val.tv_sec, time_val.tv_usec, level,
-		      except_str, entry->id.fields.cpuid, caller);
-#else
-	caller &= 0x7fffffff;
-	rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %08lx  ",
-		      area, time_val.tv_sec, time_val.tv_usec, level,
-		      except_str, entry->id.fields.cpuid, caller);
-#endif
+		      except_str, entry->id.fields.cpuid, (void *) caller);
 	return rc;
 }
 
diff -urN linux-2.5.67-bk5/arch/s390/kernel/entry.S linux-2.5.67-bk6/arch/s390/kernel/entry.S
--- linux-2.5.67-bk5/arch/s390/kernel/entry.S	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/entry.S	2003-04-15 04:36:14.000000000 -0700
@@ -18,6 +18,7 @@
 #include <asm/ptrace.h>
 #include <asm/thread_info.h>
 #include <asm/offsets.h>
+#include <asm/unistd.h>
 
 /*
  * Stack layout for the system_call stack entry.
@@ -97,8 +98,7 @@
         stam    %a0,%a15,SP_AREGS(%r15)   # store access registers to kst.
         mvc     SP_AREGS+8(12,%r15),__LC_SAVE_AREA+12 # store ac. regs
         mvc     SP_PSW(8,%r15),\psworg    # move user PSW to stack
-        la      %r0,\psworg               # store trap indication
-        st      %r0,SP_TRAP(%r15)
+	mvc	SP_TRAP(4,%r15),BASED(.L\psworg) # store trap indication
         xc      0(4,%r15),0(%r15)         # clear back chain
         .endm
 
@@ -179,12 +179,18 @@
 	SAVE_ALL_BASE
         SAVE_ALL __LC_SVC_OLD_PSW,1
 	lh	%r7,0x8a	  # get svc number from lowcore
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	sll	%r7,2
         stosm   24(%r15),0x03     # reenable interrupts
+        GET_THREAD_INFO           # load pointer to task_struct to R9
+	sla	%r7,2             # *4 and test for svc 0
+	bnz	BASED(sysc_do_restart)  # svc number > 0
+	# svc 0: system call number in %r1
+	cl	%r1,BASED(.Lnr_syscalls)
+	bnl	BASED(sysc_do_restart)
+	lr	%r7,%r1           # copy svc number to %r7
+	sla	%r7,2             # *4
 sysc_do_restart:
-        l       %r8,sys_call_table-entry_base(%r7,%r13) # get system call addr.
 	tm	__TI_flags+3(%r9),_TIF_SYSCALL_TRACE
+        l       %r8,sys_call_table-entry_base(%r7,%r13) # get system call addr.
         bo      BASED(sysc_tracesys)
         basr    %r14,%r8          # call sys_xxxx
         st      %r2,SP_R2(%r15)   # store return value (change R2 on stack)
@@ -247,7 +253,7 @@
 	ni	__TI_flags+3(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC
 	stosm	24(%r15),0x03          # reenable interrupts
 	l	%r7,SP_R2(%r15)        # load new svc number
-	sll	%r7,2
+	sla	%r2,2
 	mvc	SP_R2(4,%r15),SP_ORIG_R2(%r15) # restore first argument
 	lm	%r2,%r6,SP_R2(%r15)    # load svc arguments
 	b	BASED(sysc_do_restart) # restart svc
@@ -260,9 +266,10 @@
 	srl	%r7,2
 	st	%r7,SP_R2(%r15)
 	basr	%r14,%r1
+	clc	SP_R2(4,%r15),BASED(.Lnr_syscalls)
+	bl	BASED(sysc_tracego)
 	l	%r7,SP_R2(%r15)        # strace might have changed the 
-	n	%r7,BASED(.Lc256)      #  system call
-	sll	%r7,2
+	sll	%r7,2                  #  system call
 	l	%r8,sys_call_table-entry_base(%r7,%r13)
 sysc_tracego:
 	lm	%r3,%r6,SP_R3(%r15)
@@ -283,13 +290,9 @@
         basr    %r13,0
         l       %r13,.Lentry_base-.(%r13)  # setup base pointer to &entry_base
         GET_THREAD_INFO           # load pointer to task_struct to R9
-#if CONFIG_SMP || CONFIG_PREEMPT
         l       %r1,BASED(.Lschedtail)
 	la      %r14,BASED(sysc_return)
         br      %r1               # call schedule_tail, return to sysc_return
-#else
-	b	BASED(sysc_return)
-#endif
 
 #
 # clone, fork, vfork, exec and sigreturn need glue,
@@ -361,265 +364,12 @@
         l       %r1,BASED(.Lsigaltstack)
         br      %r1                   # branch to sys_sigreturn
 
-	.globl  sys_call_table	
+
+#define SYSCALL(esa,esame,emu)	.long esa
+	.globl  sys_call_table
 sys_call_table:
-        .long  sys_ni_syscall            /* 0 */
-        .long  sys_exit
-        .long  sys_fork_glue
-        .long  sys_read
-        .long  sys_write
-        .long  sys_open                  /* 5 */
-        .long  sys_close
-        .long  sys_restart_syscall
-        .long  sys_creat
-        .long  sys_link
-        .long  sys_unlink                /* 10 */
-        .long  sys_execve_glue
-        .long  sys_chdir
-        .long  sys_time
-        .long  sys_mknod
-        .long  sys_chmod                /* 15 */
-        .long  sys_lchown16
-        .long  sys_ni_syscall           /* old break syscall holder */
-        .long  sys_ni_syscall           /* old stat syscall holder */
-        .long  sys_lseek
-        .long  sys_getpid               /* 20 */
-        .long  sys_mount
-        .long  sys_oldumount
-        .long  sys_setuid16
-        .long  sys_getuid16
-        .long  sys_stime                /* 25 */
-        .long  sys_ptrace
-        .long  sys_alarm
-        .long  sys_ni_syscall           /* old fstat syscall holder */
-        .long  sys_pause
-        .long  sys_utime                /* 30 */
-        .long  sys_ni_syscall           /* old stty syscall holder */
-        .long  sys_ni_syscall           /* old gtty syscall holder */
-        .long  sys_access
-        .long  sys_nice
-        .long  sys_ni_syscall           /* 35 */  /* old ftime syscall holder */
-        .long  sys_sync
-        .long  sys_kill
-        .long  sys_rename
-        .long  sys_mkdir
-        .long  sys_rmdir                /* 40 */
-        .long  sys_dup
-        .long  sys_pipe
-        .long  sys_times
-        .long  sys_ni_syscall           /* old prof syscall holder */
-        .long  sys_brk                  /* 45 */
-        .long  sys_setgid16
-        .long  sys_getgid16
-        .long  sys_signal
-        .long  sys_geteuid16
-        .long  sys_getegid16            /* 50 */
-        .long  sys_acct
-        .long  sys_umount
-        .long  sys_ni_syscall           /* old lock syscall holder */
-        .long  sys_ioctl
-        .long  sys_fcntl                /* 55 */
-        .long  sys_ni_syscall           /* old mpx syscall holder */
-        .long  sys_setpgid
-        .long  sys_ni_syscall           /* old ulimit syscall holder */
-        .long  sys_ni_syscall           /* old uname syscall holder */
-        .long  sys_umask                /* 60 */
-        .long  sys_chroot
-        .long  sys_ustat
-        .long  sys_dup2
-        .long  sys_getppid
-        .long  sys_getpgrp              /* 65 */
-        .long  sys_setsid
-        .long  sys_sigaction
-        .long  sys_ni_syscall           /* old sgetmask syscall holder */
-        .long  sys_ni_syscall           /* old ssetmask syscall holder */
-        .long  sys_setreuid16           /* 70 */
-        .long  sys_setregid16
-        .long  sys_sigsuspend_glue
-        .long  sys_sigpending
-        .long  sys_sethostname
-        .long  sys_setrlimit            /* 75 */
-        .long  sys_old_getrlimit
-        .long  sys_getrusage
-        .long  sys_gettimeofday
-        .long  sys_settimeofday
-        .long  sys_getgroups16          /* 80 */
-        .long  sys_setgroups16
-        .long  sys_ni_syscall           /* old select syscall holder */
-        .long  sys_symlink
-        .long  sys_ni_syscall           /* old lstat syscall holder */
-        .long  sys_readlink             /* 85 */
-        .long  sys_uselib
-        .long  sys_swapon
-        .long  sys_reboot
-        .long  sys_ni_syscall           /* old readdir syscall holder */
-        .long  old_mmap                 /* 90 */
-        .long  sys_munmap
-        .long  sys_truncate
-        .long  sys_ftruncate
-        .long  sys_fchmod
-        .long  sys_fchown16              /* 95 */
-        .long  sys_getpriority
-        .long  sys_setpriority
-        .long  sys_ni_syscall            /* old profil syscall holder */
-        .long  sys_statfs
-        .long  sys_fstatfs               /* 100 */
-        .long  sys_ioperm
-        .long  sys_socketcall
-        .long  sys_syslog
-        .long  sys_setitimer
-        .long  sys_getitimer             /* 105 */
-        .long  sys_newstat
-        .long  sys_newlstat
-        .long  sys_newfstat
-        .long  sys_ni_syscall            /* old uname syscall holder */
-        .long  sys_ni_syscall            /* 110 */ /* iopl for i386 */
-        .long  sys_vhangup
-        .long  sys_ni_syscall            /* old "idle" system call */
-        .long  sys_ni_syscall            /* vm86old for i386 */
-        .long  sys_wait4
-        .long  sys_swapoff               /* 115 */
-        .long  sys_sysinfo
-        .long  sys_ipc
-        .long  sys_fsync
-        .long  sys_sigreturn_glue
-        .long  sys_clone_glue            /* 120 */
-        .long  sys_setdomainname
-        .long  sys_newuname
-        .long  sys_ni_syscall            /* modify_ldt for i386 */
-        .long  sys_adjtimex
-        .long  sys_mprotect              /* 125 */
-        .long  sys_sigprocmask
-        .long  sys_ni_syscall		 /* old "create module" */
-        .long  sys_init_module
-        .long  sys_delete_module
-        .long  sys_ni_syscall		 /* 130: old get_kernel_syms */
-        .long  sys_quotactl
-        .long  sys_getpgid
-        .long  sys_fchdir
-        .long  sys_bdflush
-        .long  sys_sysfs                 /* 135 */
-        .long  sys_personality
-        .long  sys_ni_syscall            /* for afs_syscall */
-        .long  sys_setfsuid16
-        .long  sys_setfsgid16
-        .long  sys_llseek                /* 140 */
-        .long  sys_getdents
-        .long  sys_select
-        .long  sys_flock
-        .long  sys_msync
-        .long  sys_readv                 /* 145 */
-        .long  sys_writev
-        .long  sys_getsid
-        .long  sys_fdatasync
-        .long  sys_sysctl
-        .long  sys_mlock                 /* 150 */
-        .long  sys_munlock
-        .long  sys_mlockall
-        .long  sys_munlockall
-        .long  sys_sched_setparam
-        .long  sys_sched_getparam        /* 155 */
-        .long  sys_sched_setscheduler
-        .long  sys_sched_getscheduler
-        .long  sys_sched_yield
-        .long  sys_sched_get_priority_max
-        .long  sys_sched_get_priority_min  /* 160 */
-        .long  sys_sched_rr_get_interval
-        .long  sys_nanosleep
-        .long  sys_mremap
-        .long  sys_setresuid16
-        .long  sys_getresuid16           /* 165 */
-        .long  sys_ni_syscall            /* for vm86 */
-        .long  sys_ni_syscall		 /* old sys_query_module */
-        .long  sys_poll
-        .long  sys_nfsservctl
-        .long  sys_setresgid16           /* 170 */
-        .long  sys_getresgid16
-        .long  sys_prctl
-        .long  sys_rt_sigreturn_glue
-        .long  sys_rt_sigaction
-        .long  sys_rt_sigprocmask        /* 175 */
-        .long  sys_rt_sigpending
-        .long  sys_rt_sigtimedwait
-        .long  sys_rt_sigqueueinfo
-        .long  sys_rt_sigsuspend_glue
-        .long  sys_pread64               /* 180 */
-        .long  sys_pwrite64
-        .long  sys_chown16
-        .long  sys_getcwd
-        .long  sys_capget
-        .long  sys_capset                /* 185 */
-        .long  sys_sigaltstack_glue
-        .long  sys_sendfile
-        .long  sys_ni_syscall            /* streams1 */
-        .long  sys_ni_syscall            /* streams2 */
-        .long  sys_vfork_glue            /* 190 */
-        .long  sys_getrlimit
-	.long  sys_mmap2
-        .long  sys_truncate64
-        .long  sys_ftruncate64
-        .long  sys_stat64                /* 195 */
-        .long  sys_lstat64
-        .long  sys_fstat64
-	.long  sys_lchown
-	.long  sys_getuid
-	.long  sys_getgid		 /* 200 */
-	.long  sys_geteuid
-	.long  sys_getegid
-	.long  sys_setreuid
-	.long  sys_setregid
-	.long  sys_getgroups             /* 205 */
-	.long  sys_setgroups
-	.long  sys_fchown
-	.long  sys_setresuid
-	.long  sys_getresuid
-	.long  sys_setresgid             /* 210 */
-	.long  sys_getresgid
-	.long  sys_chown
-	.long  sys_setuid
-	.long  sys_setgid
-	.long  sys_setfsuid              /* 215 */
-	.long  sys_setfsgid
-        .long  sys_pivot_root
-        .long  sys_mincore
-        .long  sys_madvise
-	.long  sys_getdents64		 /* 220 */
-        .long  sys_fcntl64 
-	.long  sys_readahead
-	.long  sys_sendfile64
-	.long  sys_setxattr
-	.long  sys_lsetxattr		 /* 225 */
-	.long  sys_fsetxattr
-	.long  sys_getxattr
-	.long  sys_lgetxattr
-	.long  sys_fgetxattr
-	.long  sys_listxattr		 /* 230 */
-	.long  sys_llistxattr
-	.long  sys_flistxattr
-	.long  sys_removexattr
-	.long  sys_lremovexattr
-	.long  sys_fremovexattr		 /* 235 */
-	.long  sys_gettid
-	.long  sys_tkill
-	.long  sys_futex
-	.long  sys_sched_setaffinity
-	.long  sys_sched_getaffinity	 /* 240 */
-	.long  sys_ni_syscall
-	.long  sys_ni_syscall		 /* reserved for TUX */
-	.long  sys_io_setup
-	.long  sys_io_destroy
-	.long  sys_io_getevents		 /* 245 */
-	.long  sys_io_submit
-	.long  sys_io_cancel
-	.long  sys_exit_group
-	.long  sys_epoll_create
-	.long  sys_epoll_ctl		 /* 250 */
-	.long  sys_epoll_wait
-	.long  sys_set_tid_address
-	.long  sys_fadvise64
-	.rept  255-253
-	.long  sys_ni_syscall
-	.endr
+#include "syscalls.S"
+#undef SYSCALL
 
 /*
  * Program check handler routine
@@ -644,13 +394,12 @@
         tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
         bnz     BASED(pgm_per)           # got per exception -> special case
 	SAVE_ALL __LC_PGM_OLD_PSW,1
-	la	%r8,0x7f
         l       %r3,__LC_PGM_ILC         # load program interruption code
+	la	%r8,0x7f
         l       %r7,BASED(.Ljump_table)
 	nr	%r8,%r3
         sll     %r8,2
 	GET_THREAD_INFO
-        stosm   24(%r15),0x03            # reenable interrupts
         l       %r7,0(%r8,%r7)		 # load address of handler routine
         la      %r2,SP_PTREGS(%r15)	 # address of register-save area
 	la      %r14,BASED(sysc_return)
@@ -677,7 +426,6 @@
 	GET_THREAD_INFO
 	la	%r4,0x7f
 	l	%r3,__LC_PGM_ILC	 # load program interruption code
-        stosm   24(%r15),0x03            # reenable interrupts
         nr      %r4,%r3                  # clear per-event-bit and ilc
         be      BASED(pgm_per_only)      # only per or per+check ?
         l       %r1,BASED(.Ljump_table)
@@ -696,12 +444,19 @@
 #
 pgm_svcper:
 	SAVE_ALL __LC_SVC_OLD_PSW,1
-        GET_THREAD_INFO           # load pointer to task_struct to R9
+	lh	%r7,0x8a	  # get svc number from lowcore
         stosm   24(%r15),0x03     # reenable interrupts
-	lh	%r8,0x8a	  # get svc number from lowcore
-        sll     %r8,2
-        l       %r8,sys_call_table-entry_base(%r8,%r13) # get system call addr.
+        GET_THREAD_INFO           # load pointer to task_struct to R9
+        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
+        l       %r8,sys_call_table-entry_base(%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)
@@ -727,13 +482,14 @@
 #
 pgm_tracesys:
         l       %r1,BASED(.Ltrace)
-	mvc	SP_R2(%r15),BASED(.Lc_ENOSYS)
+	srl	%r7,2
+	st	%r7,SP_R2(%r15)
         basr    %r14,%r1
-	clc	SP_R2(4,%r15),BASED(.Lc256)
-	bnl	BASED(pgm_svc_go)
-	l	%r8,SP_R2(%r15)   # strace changed the syscall
-	sll     %r8,2
-	l	%r8,sys_call_table-entry_base(%r8,%r13)
+	clc	SP_R2(4,%r15),BASED(.Lnr_syscalls)
+	bl	BASED(pgm_svc_go)
+	l	%r7,SP_R2(%r15)   # strace changed the syscall
+	sll     %r7,2
+	l	%r8,sys_call_table-entry_base(%r7,%r13)
 pgm_svc_go:
 	lm      %r3,%r6,SP_R3(%r15)
 	l       %r2,SP_ORIG_R2(%r15)
@@ -924,7 +680,12 @@
 .Lc_ENOSYS:    .long  -ENOSYS
 .Lc_pactive:   .long  PREEMPT_ACTIVE
 .Lc0xff:       .long  0xff
-.Lc256:        .long  256
+.Lnr_syscalls: .long  NR_syscalls
+.L0x018:       .long  0x018
+.L0x020:       .long  0x020
+.L0x028:       .long  0x028
+.L0x030:       .long  0x030
+.L0x038:       .long  0x038
 
 /*
  * Symbol constants
@@ -949,8 +710,6 @@
 .Lsigaltstack: .long  sys_sigaltstack
 .Ltrace:       .long  syscall_trace
 .Lvfork:       .long  sys_vfork
-#if CONFIG_SMP || CONFIG_PREEMPT
 .Lschedtail:   .long  schedule_tail
-#endif
 
 
diff -urN linux-2.5.67-bk5/arch/s390/kernel/entry64.S linux-2.5.67-bk6/arch/s390/kernel/entry64.S
--- linux-2.5.67-bk5/arch/s390/kernel/entry64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/entry64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,710 @@
+/*
+ *  arch/s390/kernel/entry.S
+ *    S390 low-level entry points.
+ *
+ *  S390 version
+ *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
+ *               Hartmut Penner (hp@de.ibm.com),
+ *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
+ */
+
+#include <linux/sys.h>
+#include <linux/linkage.h>
+#include <linux/config.h>
+#include <asm/cache.h>
+#include <asm/lowcore.h>
+#include <asm/errno.h>
+#include <asm/ptrace.h>
+#include <asm/thread_info.h>
+#include <asm/offsets.h>
+#include <asm/unistd.h>
+
+/*
+ * 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_PSW       =  STACK_FRAME_OVERHEAD + PT_PSWMASK
+SP_R0        =  STACK_FRAME_OVERHEAD + PT_GPR0
+SP_R1        =  STACK_FRAME_OVERHEAD + PT_GPR1
+SP_R2        =  STACK_FRAME_OVERHEAD + PT_GPR2
+SP_R3        =  STACK_FRAME_OVERHEAD + PT_GPR3
+SP_R4        =  STACK_FRAME_OVERHEAD + PT_GPR4
+SP_R5        =  STACK_FRAME_OVERHEAD + PT_GPR5
+SP_R6        =  STACK_FRAME_OVERHEAD + PT_GPR6
+SP_R7        =  STACK_FRAME_OVERHEAD + PT_GPR7
+SP_R8        =  STACK_FRAME_OVERHEAD + PT_GPR8
+SP_R9        =  STACK_FRAME_OVERHEAD + PT_GPR9
+SP_R10       =  STACK_FRAME_OVERHEAD + PT_GPR10
+SP_R11       =  STACK_FRAME_OVERHEAD + PT_GPR11
+SP_R12       =  STACK_FRAME_OVERHEAD + PT_GPR12
+SP_R13       =  STACK_FRAME_OVERHEAD + PT_GPR13
+SP_R14       =  STACK_FRAME_OVERHEAD + PT_GPR14
+SP_R15       =  STACK_FRAME_OVERHEAD + PT_GPR15
+SP_AREGS     =  STACK_FRAME_OVERHEAD + PT_ACR0
+SP_ORIG_R2   =  STACK_FRAME_OVERHEAD + PT_ORIGGPR2
+/* Now the additional entries */
+SP_TRAP      =  (SP_ORIG_R2+GPR_SIZE)
+SP_SIZE      =  (SP_TRAP+4)
+
+_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC)
+_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
+
+/*
+ * Register usage in interrupt handlers:
+ *    R9  - pointer to current task structure
+ *    R13 - pointer to literal pool
+ *    R14 - return register for function calls
+ *    R15 - kernel stack pointer
+ */
+
+        .macro  SAVE_ALL psworg,sync     # system entry macro
+        stmg    %r14,%r15,__LC_SAVE_AREA
+	stam    %a2,%a4,__LC_SAVE_AREA+16
+	larl	%r14,.Lconst
+        tm      \psworg+1,0x01           # test problem state bit
+	.if	\sync
+        jz      1f                       # skip stack setup save
+	.else
+	jnz	0f			 # from user -> load kernel stack
+	lg	%r14,__LC_ASYNC_STACK	 # are we already on the async. stack ?
+	slgr	%r14,%r15
+	srag	%r14,%r14,14
+	larl	%r14,.Lconst
+	jz	1f
+	lg	%r15,__LC_ASYNC_STACK	 # load async. stack
+	j	1f
+	.endif
+0:	lg      %r15,__LC_KERNEL_STACK   # problem state -> load ksp
+	lam	%a2,%a4,.Lc_ac-.Lconst(%r14)
+1:      aghi    %r15,-SP_SIZE            # make room for registers & psw
+        nill    %r15,0xfff8              # align stack pointer to 8
+        stmg    %r0,%r13,SP_R0(%r15)     # store gprs 0-13 to kernel stack
+        stg     %r2,SP_ORIG_R2(%r15)     # store original content of gpr 2
+        mvc     SP_R14(16,%r15),__LC_SAVE_AREA # move r14 and r15 to stack
+        stam    %a0,%a15,SP_AREGS(%r15)  # store access registers to kst.
+        mvc     SP_AREGS+8(12,%r15),__LC_SAVE_AREA+16 # store ac. regs
+        mvc     SP_PSW(16,%r15),\psworg  # move user PSW to stack
+	mvc	SP_TRAP(4,%r15),.L\psworg-.Lconst(%r14) # store trap ind.
+        xc      0(8,%r15),0(%r15)        # clear back chain
+        .endm
+
+        .macro  RESTORE_ALL sync         # system exit macro
+        mvc     __LC_RETURN_PSW(16),SP_PSW(%r15) # move user PSW to lowcore
+        lam     %a0,%a15,SP_AREGS(%r15)  # load the access registers
+        lmg     %r0,%r15,SP_R0(%r15)     # load gprs 0-15 of user
+        ni      __LC_RETURN_PSW+1,0xfd   # clear wait state bit
+        lpswe   __LC_RETURN_PSW          # back to caller
+        .endm
+
+        .macro  GET_THREAD_INFO
+	lg	%r9,__LC_KERNEL_STACK    # load pointer to task_struct to %r9
+	aghi	%r9,-16384
+        .endm
+
+
+/*
+ * Scheduler resume function, called by switch_to
+ *  gpr2 = (task_struct *) prev
+ *  gpr3 = (task_struct *) next
+ * Returns:
+ *  gpr2 = prev
+ */
+        .globl  resume
+resume:
+	tm	__THREAD_per+4(%r3),0xe8 # is the new process using per ?
+	jz	resume_noper		# if not we're fine
+        stctg   %c9,%c11,48(%r15)       # We are using per stuff
+        clc     __THREAD_per(24,%r3),48(%r15)
+        je      resume_noper            # we got away without bashing TLB's
+        lctlg   %c9,%c11,__THREAD_per(%r3)	# Nope we didn't
+resume_noper:
+        stmg    %r6,%r15,48(%r15)       # store resume registers of prev task
+	stg	%r15,__THREAD_ksp(%r2)	# store kernel stack to prev->tss.ksp
+	lg	%r15,__THREAD_ksp(%r3)	# load kernel stack from next->tss.ksp
+        stam    %a2,%a2,__THREAD_ar2(%r2)	# store kernel access reg. 2
+        stam    %a4,%a4,__THREAD_ar4(%r2)	# store kernel access reg. 4
+        lam     %a2,%a2,__THREAD_ar2(%r3)	# load kernel access reg. 2
+        lam     %a4,%a4,__THREAD_ar4(%r3)	# load kernel access reg. 4
+        lmg     %r6,%r15,48(%r15)       # load resume registers of next task
+	lg	%r3,__THREAD_info(%r3)  # load thread_info from task struct
+	aghi	%r3,16384
+	stg	%r3,__LC_KERNEL_STACK	# __LC_KERNEL_STACK = new kernel stack
+	br	%r14
+
+/*
+ * do_softirq calling function. We want to run the softirq functions on the
+ * asynchronous interrupt stack.
+ */
+	.global do_call_softirq
+do_call_softirq:
+	stmg	%r12,%r15,48(%r15)
+	lgr	%r12,%r15
+	lg	%r0,__LC_ASYNC_STACK
+	slgr    %r0,%r15
+	srag	%r0,%r0,14
+	je	0f
+	lg	%r15,__LC_ASYNC_STACK
+0:	aghi	%r15,-STACK_FRAME_OVERHEAD
+	stg	%r12,0(%r15)		# store back chain
+	brasl	%r14,do_softirq
+	lmg	%r12,%r15,48(%r12)
+	br	%r14
+	
+/*
+ * SVC interrupt handler routine. System calls are synchronous events and
+ * are executed with interrupts enabled.
+ */
+
+	.globl  system_call
+system_call:
+        SAVE_ALL __LC_SVC_OLD_PSW,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
+        slag    %r7,%r7,2         # *4 and test for svc 0
+	jnz	sysc_do_restart
+	# svc 0: system call number in %r1
+	clg	%r1,.Lnr_syscalls-.Lconst(%r14)
+	jnl	sysc_do_restart
+	slag    %r7,%r1,2         # svc 0: system call number in %r1
+sysc_do_restart:
+	larl    %r10,sys_call_table
+#ifdef CONFIG_S390_SUPPORT
+        tm      SP_PSW+3(%r15),0x01  # are we running in 31 bit mode ?
+        jo      sysc_noemu
+	larl    %r10,sys_call_table_emu  # use 31 bit emulation system calls
+sysc_noemu:
+#endif
+	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
+        lgf     %r8,0(%r7,%r10)   # load address of system call routine
+        jo      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
+                                  # changing anything here !!
+
+sysc_return:
+	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
+	tm	__TI_flags+7(%r9),_TIF_WORK_SVC
+	jnz	sysc_work         # there is work to do (signals etc.)
+sysc_leave:
+        RESTORE_ALL 1
+
+#
+# recheck if there is more work to do
+#
+sysc_work_loop:
+	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
+        GET_THREAD_INFO           # load pointer to task_struct to R9
+	tm	__TI_flags+7(%r9),_TIF_WORK_SVC
+	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
+	jo	sysc_reschedule
+	tm	__TI_flags+7(%r9),_TIF_SIGPENDING
+	jo	sysc_sigpending
+	tm	__TI_flags+7(%r9),_TIF_RESTART_SVC
+	jo	sysc_restart
+	j	sysc_leave
+
+#
+# _TIF_NEED_RESCHED is set, call schedule
+#	
+sysc_reschedule:        
+	stosm   48(%r15),0x03     # reenable interrupts
+	larl    %r14,sysc_work_loop
+        jg      schedule            # return point is sysc_return
+
+#
+# _TIF_SIGPENDING is set, call do_signal
+#
+sysc_sigpending:     
+	stosm   48(%r15),0x03     # reenable interrupts
+        la      %r2,SP_PTREGS(%r15) # load pt_regs
+        sgr     %r3,%r3           # clear *oldset
+	brasl	%r14,do_signal    # call do_signal
+	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
+	j	sysc_leave        # out of here, do NOT recheck
+
+#
+# _TIF_RESTART_SVC is set, set up registers and restart svc
+#
+sysc_restart:
+	ni	__TI_flags+3(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC
+	stosm	48(%r15),0x03          # reenable interrupts
+	lg	%r7,SP_R2(%r15)        # load new svc number
+        slag    %r7,%r7,3              # *8
+	mvc	SP_R2(8,%r15),SP_ORIG_R2(%r15) # restore first argument
+	lmg	%r2,%r6,SP_R2(%r15)    # load svc arguments
+	j	sysc_do_restart        # restart svc
+
+#
+# call syscall_trace before and after system call
+# special linkage: %r12 contains the return address for trace_svc
+#
+sysc_tracesys:
+	srl	%r7,3
+	stg     %r7,SP_R2(%r15)
+        brasl   %r14,syscall_trace
+	larl	%r1,.Lnr_syscalls
+	clc	SP_R2(8,%r15),0(%r1)
+	jl	sysc_tracego
+	lg	%r7,SP_R2(%r15)   # strace might have changed the
+	sll     %r7,3             #  system call
+	lgf	%r8,0(%r7,%r10)
+sysc_tracego:
+	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
+	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
+        jno     sysc_return
+	larl	%r14,sysc_return    # return point is sysc_return
+	jg	syscall_trace
+
+#
+# a new process exits the kernel with ret_from_fork
+#
+        .globl  ret_from_fork
+ret_from_fork:  
+        GET_THREAD_INFO           # load pointer to task_struct to R9
+	larl    %r14,sysc_return
+        jg      schedule_tail     # return to sysc_return
+
+#
+# clone, fork, vfork, exec and sigreturn need glue,
+# because they all expect pt_regs as parameter,
+# but are called with different parameter.
+# return-address is set up above
+#
+sys_clone_glue: 
+        la      %r2,SP_PTREGS(%r15)    # load pt_regs
+        jg      sys_clone              # branch to sys_clone
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_clone_glue: 
+        la      %r2,SP_PTREGS(%r15)    # load pt_regs
+        jg      sys32_clone            # branch to sys32_clone
+#endif
+
+sys_fork_glue:  
+        la      %r2,SP_PTREGS(%r15)    # load pt_regs
+        jg      sys_fork               # branch to sys_fork
+
+sys_vfork_glue: 
+        la      %r2,SP_PTREGS(%r15)    # load pt_regs
+        jg      sys_vfork              # branch to sys_vfork
+
+sys_execve_glue:        
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs
+	lgr     %r12,%r14             # save return address
+        brasl   %r14,sys_execve       # call sys_execve
+        ltgr    %r2,%r2               # check if execve failed
+        bnz     0(%r12)               # it did fail -> store result in gpr2
+        b       6(%r12)               # SKIP STG 2,SP_R2(15) in
+                                      # system_call/sysc_tracesys
+#ifdef CONFIG_S390_SUPPORT
+sys32_execve_glue:        
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs
+	lgr     %r12,%r14             # save return address
+        brasl   %r14,sys32_execve     # call sys32_execve
+        ltgr    %r2,%r2               # check if execve failed
+        bnz     0(%r12)               # it did fail -> store result in gpr2
+        b       6(%r12)               # SKIP STG 2,SP_R2(15) in
+                                      # system_call/sysc_tracesys
+#endif
+
+sys_sigreturn_glue:     
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys_sigreturn         # branch to sys_sigreturn
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_sigreturn_glue:     
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys32_sigreturn       # branch to sys32_sigreturn
+#endif
+
+sys_rt_sigreturn_glue:     
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys_rt_sigreturn      # branch to sys_sigreturn
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_rt_sigreturn_glue:     
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys32_rt_sigreturn    # branch to sys32_sigreturn
+#endif
+
+#
+# sigsuspend and rt_sigsuspend need pt_regs as an additional
+# parameter and they have to skip the store of %r2 into the
+# user register %r2 because the return value was set in 
+# sigsuspend and rt_sigsuspend already and must not be overwritten!
+#
+
+sys_sigsuspend_glue:    
+        lgr     %r5,%r4               # move mask back
+        lgr     %r4,%r3               # move history1 parameter
+        lgr     %r3,%r2               # move history0 parameter
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
+	la      %r14,6(%r14)          # skip store of return value
+        jg      sys_sigsuspend        # branch to sys_sigsuspend
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_sigsuspend_glue:    
+	llgfr	%r4,%r4               # unsigned long			
+        lgr     %r5,%r4               # move mask back
+	lgfr	%r3,%r3               # int			
+        lgr     %r4,%r3               # move history1 parameter
+	lgfr	%r2,%r2               # int			
+        lgr     %r3,%r2               # move history0 parameter
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
+	la      %r14,6(%r14)          # skip store of return value
+        jg      sys32_sigsuspend      # branch to sys32_sigsuspend
+#endif
+
+sys_rt_sigsuspend_glue: 
+        lgr     %r4,%r3               # move sigsetsize parameter
+        lgr     %r3,%r2               # move unewset parameter
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
+	la      %r14,6(%r14)          # skip store of return value
+        jg      sys_rt_sigsuspend     # branch to sys_rt_sigsuspend
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_rt_sigsuspend_glue: 
+	llgfr	%r3,%r3               # size_t			
+        lgr     %r4,%r3               # move sigsetsize parameter
+	llgtr	%r2,%r2               # sigset_emu31_t *
+        lgr     %r3,%r2               # move unewset parameter
+        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
+	la      %r14,6(%r14)          # skip store of return value
+        jg      sys32_rt_sigsuspend   # branch to sys32_rt_sigsuspend
+#endif
+
+sys_sigaltstack_glue:
+        la      %r4,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys_sigaltstack       # branch to sys_sigreturn
+
+#ifdef CONFIG_S390_SUPPORT
+sys32_sigaltstack_glue:
+        la      %r4,SP_PTREGS(%r15)   # load pt_regs as parameter
+        jg      sys32_sigaltstack_wrapper # branch to sys_sigreturn
+#endif
+
+#define SYSCALL(esa,esame,emu)	.long esame
+	.globl  sys_call_table	
+sys_call_table:
+#include "syscalls.S"
+#undef SYSCALL
+
+#ifdef CONFIG_S390_SUPPORT
+
+#define SYSCALL(esa,esame,emu)	.long emu
+	.globl  sys_call_table_emu
+sys_call_table_emu:
+#include "syscalls.S"
+#undef SYSCALL
+#endif
+
+/*
+ * Program check handler routine
+ */
+
+        .globl  pgm_check_handler
+pgm_check_handler:
+/*
+ * First we need to check for a special case:
+ * Single stepping an instruction that disables the PER event mask will
+ * cause a PER event AFTER the mask has been set. Example: SVC or LPSW.
+ * For a single stepped SVC the program check handler gets control after
+ * the SVC new PSW has been loaded. But we want to execute the SVC first and
+ * then handle the PER event. Therefore we update the SVC old PSW to point
+ * to the pgm_check_handler and branch to the SVC handler after we checked
+ * if we have to load the kernel stack register.
+ * For every other possible cause for PER event without the PER mask set
+ * we just ignore the PER event (FIXME: is there anything we have to do
+ * for LPSW?).
+ */
+        tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
+        jnz     pgm_per                  # got per exception -> special case
+	SAVE_ALL __LC_PGM_OLD_PSW,1
+	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
+	lghi	%r8,0x7f
+	ngr	%r8,%r3
+        sll     %r8,3
+	GET_THREAD_INFO
+        larl    %r1,pgm_check_table
+        lg      %r1,0(%r8,%r1)		 # load address of handler routine
+        la      %r2,SP_PTREGS(%r15)	 # address of register-save area
+	larl	%r14,sysc_return
+        br      %r1			 # branch to interrupt-handler
+
+#
+# handle per exception
+#
+pgm_per:
+        tm      __LC_PGM_OLD_PSW,0x40    # test if per event recording is on
+        jnz     pgm_per_std              # ok, normal per event from user space
+# ok its one of the special cases, now we need to find out which one
+        clc     __LC_PGM_OLD_PSW(16),__LC_SVC_NEW_PSW
+        je      pgm_svcper
+# no interesting special case, ignore PER event
+	lpswe   __LC_PGM_OLD_PSW
+
+#
+# Normal per exception
+#
+pgm_per_std:
+	SAVE_ALL __LC_PGM_OLD_PSW,1
+	GET_THREAD_INFO
+	lghi    %r4,0x7f
+	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
+        nr      %r4,%r3			 # clear per-event-bit and ilc
+        je      pgm_per_only		 # only per of per+check ?
+        sll     %r4,3
+        larl    %r1,pgm_check_table
+        lg      %r1,0(%r4,%r1)		 # load address of handler routine
+        la      %r2,SP_PTREGS(%r15)	 # address of register-save area
+        basr    %r14,%r1		 # branch to interrupt-handler
+pgm_per_only:
+        la      %r2,SP_PTREGS(15)	 # address of register-save area
+        larl    %r14,sysc_return	 # load adr. of system return
+        jg      handle_per_exception
+
+#
+# it was a single stepped SVC that is causing all the trouble
+#
+pgm_svcper:
+	SAVE_ALL __LC_SVC_OLD_PSW,1
+	llgh    %r8,__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
+	slag	%r7,%r7,2         # *4 and test for svc 0
+	jnz	pgm_svcstd
+	# svc 0: system call number in %r1
+	clg	%r1,.Lnr_syscalls-.Lconst(%r14)
+	slag	%r7,%r1,2
+pgm_svcstd:
+	larl    %r7,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    %r7,sys_call_table_emu # use 31 bit emulation system calls
+pgm_svcper_noemu:
+#endif
+	tm	__TI_flags+3(%r9),_TIF_SYSCALL_TRACE
+        lgf     %r8,0(%r8,%r7)    # 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+3(%r9),_TIF_SIGPENDING
+	jo	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      handle_per_exception
+#
+# call trace before and after sys_call
+#
+pgm_tracesys:
+	lgfr	%r7,%r7
+	stg	%r7,SP_R2(%r15)
+        brasl   %r14,syscall_trace
+	clc	SP_R2(8,%r15),.Lnr_syscalls
+	jnl     pgm_svc_go
+	lg      %r2,SP_R2(%r15)
+	sllg    %r2,%r2,3           # strace wants to change the syscall
+	lgf	%r8,0(%r2,%r7)
+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
+	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
+        jno     pgm_svcret
+	larl	%r14,pgm_svcret     # return point is sysc_return
+	jg	syscall_trace
+
+/*
+ * IO interrupt handler routine
+ */
+        .globl io_int_handler
+io_int_handler:
+        SAVE_ALL __LC_IO_OLD_PSW,0
+        GET_THREAD_INFO                # load pointer to task_struct to R9
+        la      %r2,SP_PTREGS(%r15)    # address of register-save area
+	llgh    %r3,__LC_SUBCHANNEL_NR # load subchannel number
+        llgf    %r4,__LC_IO_INT_PARM   # load interruption parm
+        llgf    %r5,__LC_IO_INT_WORD   # load interruption word
+	brasl   %r14,do_IRQ            # call standard irq handler
+
+io_return:
+        tm      SP_PSW+1(%r15),0x01    # returning to user ?
+#ifdef CONFIG_PREEMPT
+	jno     io_preempt             # no -> check for preemptive scheduling
+#else
+        jno     io_leave               # no-> skip resched & signal
+#endif
+	tm	__TI_flags+7(%r9),_TIF_WORK_INT
+	jnz	io_work                # there is work to do (signals etc.)
+io_leave:
+        RESTORE_ALL 0
+
+#ifdef CONFIG_PREEMPT
+io_preempt:
+	icm	%r0,15,__TI_precount(%r9)	
+	jnz     io_leave
+io_resume_loop:
+	tm	__TI_flags+7(%r9),_TIF_NEED_RESCHED
+	jno	io_leave
+	larl    %r1,.Lc_pactive
+	mvc     __TI_precount(4,%r9),0(%r1)
+	# hmpf, we are on the async. stack but to call schedule
+	# we have to move the interrupt frame to the process stack
+	lg	%r1,SP_R15(%r15)
+	aghi	%r1,-SP_SIZE
+	nill	%r1,0xfff8
+	mvc	SP_PTREGS(SP_SIZE-SP_PTREGS,%r1),SP_PTREGS(%r15)
+        xc      0(8,%r1),0(%r1)        # clear back chain
+	lgr	%r15,%r1
+        stosm   48(%r15),0x03          # reenable interrupts
+	brasl   %r14,schedule          # call schedule
+        stnsm   48(%r15),0xfc          # disable I/O and ext. interrupts
+        GET_THREAD_INFO                # load pointer to task_struct to R9
+	xc      __TI_precount(4,%r9),__TI_precount(%r9)
+	j	io_resume_loop
+#endif
+
+#
+# recheck if there is more work to do
+#
+io_work_loop:
+        stnsm   48(%r15),0xfc          # disable I/O and ext. interrupts
+        GET_THREAD_INFO                # load pointer to task_struct to R9
+	tm	__TI_flags+7(%r9),_TIF_WORK_INT
+	jz	io_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
+#
+io_work:
+	tm	__TI_flags+7(%r9),_TIF_NEED_RESCHED
+	jo	io_reschedule
+	tm	__TI_flags+7(%r9),_TIF_SIGPENDING
+	jo	io_sigpending
+	j	io_leave
+
+#
+# _TIF_NEED_RESCHED is set, call schedule
+#	
+io_reschedule:        
+        stosm   48(%r15),0x03       # reenable interrupts
+	larl    %r14,io_work_loop
+        jg      schedule            # call scheduler
+
+#
+# _TIF_SIGPENDING is set, call do_signal
+#
+io_sigpending:     
+        stosm   48(%r15),0x03       # reenable interrupts
+        la      %r2,SP_PTREGS(%r15) # load pt_regs
+        slgr    %r3,%r3             # clear *oldset
+	brasl	%r14,do_signal      # call do_signal
+        stnsm   48(%r15),0xfc       # disable I/O and ext. interrupts
+	j	sysc_leave          # out of here, do NOT recheck
+
+/*
+ * External interrupt handler routine
+ */
+        .globl  ext_int_handler
+ext_int_handler:
+        SAVE_ALL __LC_EXT_OLD_PSW,0
+        GET_THREAD_INFO                # load pointer to task_struct to R9
+	llgh	%r6,__LC_EXT_INT_CODE  # get interruption code
+	lgr	%r1,%r6		       # calculate index = code & 0xff
+	nill	%r1,0xff
+	sll	%r1,3
+	larl	%r7,ext_int_hash
+	lg	%r7,0(%r1,%r7)	       # get first list entry for hash value
+	ltgr	%r7,%r7		       # == NULL ?
+	jz	io_return	       # yes, nothing to do, exit
+ext_int_loop:
+	ch	%r6,16(%r7)	       # compare external interrupt code
+	jne	ext_int_next
+	lg	%r1,8(%r7)	       # get handler address
+	la	%r2,SP_PTREGS(%r15)    # address of register-save area
+	lgr	%r3,%r6		       # interruption code
+	basr	%r14,%r1	       # call handler
+ext_int_next:
+	lg	%r7,0(%r7)	       # next list entry
+	ltgr	%r7,%r7
+	jnz	ext_int_loop
+	j	io_return
+
+/*
+ * Machine check handler routines
+ */
+        .globl mcck_int_handler
+mcck_int_handler:
+        SAVE_ALL __LC_MCK_OLD_PSW,0
+	brasl   %r14,s390_do_machine_check
+mcck_return:
+        RESTORE_ALL 0
+
+#ifdef CONFIG_SMP
+/*
+ * Restart interruption handler, kick starter for additional CPUs
+ */
+        .globl restart_int_handler
+restart_int_handler:
+        lg      %r15,__LC_SAVE_AREA+120 # load ksp
+        lghi    %r10,__LC_CREGS_SAVE_AREA
+        lctlg   %c0,%c15,0(%r10) # get new ctl regs
+        lghi    %r10,__LC_AREGS_SAVE_AREA
+        lam     %a0,%a15,0(%r10)
+        stosm   0(%r15),0x04           # now we can turn dat on
+        lmg     %r6,%r15,48(%r15)      # load registers from clone
+	jg      start_secondary
+#else
+/*
+ * If we do not run with SMP enabled, let the new CPU crash ...
+ */
+        .globl restart_int_handler
+restart_int_handler:
+        basr    %r1,0
+restart_base:
+        lpswe   restart_crash-restart_base(%r1)
+        .align 8
+restart_crash:
+        .long  0x000a0000,0x00000000,0x00000000,0x00000000
+restart_go:
+#endif
+
+/*
+ * Integer constants
+ */
+               .align 4
+.Lconst:
+.Lc_ac:        .long  0,0,1
+.Lc_pactive:   .long  PREEMPT_ACTIVE
+.L0x0130:      .long  0x0130
+.L0x0140:      .long  0x0140
+.L0x0150:      .long  0x0150
+.L0x0160:      .long  0x0160
+.L0x0170:      .long  0x0170
+.Lnr_syscalls: .long  NR_syscalls
diff -urN linux-2.5.67-bk5/arch/s390/kernel/gdb-stub.c linux-2.5.67-bk6/arch/s390/kernel/gdb-stub.c
--- linux-2.5.67-bk5/arch/s390/kernel/gdb-stub.c	2003-04-07 10:32:59.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/gdb-stub.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,581 +0,0 @@
-/*
- *  arch/s390/kernel/gdb-stub.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *
- *  Originally written by Glenn Engel, Lake Stevens Instrument Division
- *
- *  Contributed by HP Systems
- *
- *  Modified for SPARC by Stu Grossman, Cygnus Support.
- *
- *  Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
- *  Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
- *
- *  Copyright (C) 1995 Andreas Busse
- */
-
-/*
- *  To enable debugger support, two things need to happen.  One, a
- *  call to set_debug_traps() is necessary in order to allow any breakpoints
- *  or error conditions to be properly intercepted and reported to gdb.
- *  Two, a breakpoint needs to be generated to begin communication.  This
- *  is most easily accomplished by a call to breakpoint().  Breakpoint()
- *  simulates a breakpoint by executing a BREAK instruction.
- *
- *
- *    The following gdb commands are supported:
- *
- * command          function                               Return value
- *
- *    g             return the value of the CPU registers  hex data or ENN
- *    G             set the value of the CPU registers     OK or ENN
- *
- *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
- *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
- *
- *    c             Resume at current address              SNN   ( signal NN)
- *    cAA..AA       Continue at address AA..AA             SNN
- *
- *    s             Step one instruction                   SNN
- *    sAA..AA       Step one instruction from AA..AA       SNN
- *
- *    k             kill
- *
- *    ?             What was the last sigval ?             SNN   (signal NN)
- *
- *
- * All commands and responses are sent with a packet which includes a
- * checksum.  A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum>    :: < two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer.  '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host:                  Reply:
- * $m0,10#2a               +$00010203040506070809101112131415#42
- *
- */
-#define TRUE 1
-#define FALSE 0
-#include <asm/gdb-stub.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <linux/stddef.h>
-
-#define S390_REGS_COMMON_SIZE offsetof(struct gdb_pt_regs,orig_gpr2)
-
-/*
- * external low-level support routines
- */
-
-
-extern void fltr_set_mem_err(void);
-extern void trap_low(void);
-
-/*
- * breakpoint and test functions
- */
-extern void breakpoint(void);
-extern void breakinst(void);
-
-/*
- * local prototypes
- */
-
-static void getpacket(char *buffer);
-static void putpacket(char *buffer);
-static int hex(unsigned char ch);
-static int hexToInt(char **ptr, int *intValue);
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
-
-
-/*
- * BUFMAX defines the maximum number of characters in inbound/outbound buffers
- * at least NUMREGBYTES*2 are needed for register packets
- */
-#define BUFMAX 2048
-
-static char input_buffer[BUFMAX];
-static char output_buffer[BUFMAX];
-int gdb_stub_initialised = FALSE;	
-static const char hexchars[]="0123456789abcdef";
-
-
-/*
- * Convert ch from a hex digit to an int
- */
-static int hex(unsigned char ch)
-{
-	if (ch >= 'a' && ch <= 'f')
-		return ch-'a'+10;
-	if (ch >= '0' && ch <= '9')
-		return ch-'0';
-	if (ch >= 'A' && ch <= 'F')
-		return ch-'A'+10;
-	return -1;
-}
-
-/*
- * scan for the sequence $<data>#<checksum>
- */
-static void getpacket(char *buffer)
-{
-	unsigned char checksum;
-	unsigned char xmitcsum;
-	int i;
-	int count;
-	unsigned char ch;
-
-	do {
-		/*
-		 * wait around for the start character,
-		 * ignore all other characters
-		 */
-		while ((ch = (getDebugChar() & 0x7f)) != '$') ;
-
-		checksum = 0;
-		xmitcsum = -1;
-		count = 0;
-	
-		/*
-		 * now, read until a # or end of buffer is found
-		 */
-		while (count < BUFMAX) {
-			ch = getDebugChar() & 0x7f;
-			if (ch == '#')
-				break;
-			checksum = checksum + ch;
-			buffer[count] = ch;
-			count = count + 1;
-		}
-
-		if (count >= BUFMAX)
-			continue;
-
-		buffer[count] = 0;
-
-		if (ch == '#') {
-			xmitcsum = hex(getDebugChar() & 0x7f) << 4;
-			xmitcsum |= hex(getDebugChar() & 0x7f);
-
-			if (checksum != xmitcsum)
-				putDebugChar('-');	/* failed checksum */
-			else {
-				putDebugChar('+'); /* successful transfer */
-
-				/*
-				 * if a sequence char is present,
-				 * reply the sequence ID
-				 */
-				if (buffer[2] == ':') {
-					putDebugChar(buffer[0]);
-					putDebugChar(buffer[1]);
-
-					/*
-					 * remove sequence chars from buffer
-					 */
-					count = strlen(buffer);
-					for (i=3; i <= count; i++)
-						buffer[i-3] = buffer[i];
-				}
-			}
-		}
-	}
-	while (checksum != xmitcsum);
-}
-
-/*
- * send the packet in buffer.
- */
-static void putpacket(char *buffer)
-{
-	unsigned char checksum;
-	int count;
-	unsigned char ch;
-
-	/*
-	 * $<packet info>#<checksum>.
-	 */
-
-	do {
-		putDebugChar('$');
-		checksum = 0;
-		count = 0;
-
-		while ((ch = buffer[count]) != 0) {
-			if (!(putDebugChar(ch)))
-				return;
-			checksum += ch;
-			count += 1;
-		}
-
-		putDebugChar('#');
-		putDebugChar(hexchars[checksum >> 4]);
-		putDebugChar(hexchars[checksum & 0xf]);
-
-	}
-	while ((getDebugChar() & 0x7f) != '+');
-}
-
-
-
-/*
- * Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null), in case of mem fault,
- * return 0.
- * If MAY_FAULT is non-zero, then we will handle memory faults by returning
- * a 0, else treat a fault like any other fault in the stub.
- */
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault)
-{
-	unsigned char ch;
-
-/*	set_mem_fault_trap(may_fault); */
-
-	while (count-- > 0) {
-		ch = *(mem++);
-#if 0
-		if (mem_err)
-			return 0;
-#endif
-		*buf++ = hexchars[ch >> 4];
-		*buf++ = hexchars[ch & 0xf];
-	}
-
-	*buf = 0;
-
-/*	set_mem_fault_trap(0); */
-
-	return buf;
-}
-
-/*
- * convert the hex array pointed to by buf into binary to be placed in mem
- * return a pointer to the character AFTER the last byte written
- */
-static char *hex2mem(char *buf, char *mem, int count, int may_fault)
-{
-	int i;
-	unsigned char ch;
-
-/*	set_mem_fault_trap(may_fault); */
-
-	for (i=0; i<count; i++)
-	{
-		ch = hex(*buf++) << 4;
-		ch |= hex(*buf++);
-		*(mem++) = ch;
-#if 0
-		if (mem_err)
-			return 0;
-#endif
-	}
-
-/*	set_mem_fault_trap(0); */
-
-	return mem;
-}
-
-
-
-/*
- * Set up exception handlers for tracing and breakpoints
- */
-void set_debug_traps(void)
-{
-//	unsigned long flags;
-	unsigned char c;
-
-//	save_and_cli(flags);
-	/*
-	 * In case GDB is started before us, ack any packets
-	 * (presumably "$?#xx") sitting there.
-	 */
-	while((c = getDebugChar()) != '$');
-	while((c = getDebugChar()) != '#');
-	c = getDebugChar(); /* eat first csum byte */
-	c = getDebugChar(); /* eat second csum byte */
-	putDebugChar('+'); /* ack it */
-
-	gdb_stub_initialised = TRUE;
-//	restore_flags(flags);
-}
-
-
-/*
- * Trap handler for memory errors.  This just sets mem_err to be non-zero.  It
- * assumes that %l1 is non-zero.  This should be safe, as it is doubtful that
- * 0 would ever contain code that could mem fault.  This routine will skip
- * past the faulting instruction after setting mem_err.
- */
-extern void fltr_set_mem_err(void)
-{
-  /* FIXME: Needs to be written... */
-}
-
-
-/*
- * While we find nice hex chars, build an int.
- * Return number of chars processed.
- */
-static int hexToInt(char **ptr, int *intValue)
-{
-	int numChars = 0;
-	int hexValue;
-
-	*intValue = 0;
-
-	while (**ptr)
-	{
-		hexValue = hex(**ptr);
-		if (hexValue < 0)
-			break;
-
-		*intValue = (*intValue << 4) | hexValue;
-		numChars ++;
-
-		(*ptr)++;
-	}
-
-	return (numChars);
-}
-
-void gdb_stub_get_non_pt_regs(struct gdb_pt_regs *regs)
-{
-	s390_fp_regs *fpregs=&regs->fp_regs;
-	int has_ieee=save_fp_regs1(fpregs);
-
-	if(!has_ieee)
-	{
-		fpregs->fpc=0;
-		fpregs->fprs[1].d=
-		fpregs->fprs[3].d=
-		fpregs->fprs[5].d=
-		fpregs->fprs[7].d=0;
-		memset(&fpregs->fprs[8].d,0,sizeof(freg_t)*8);
-	}
-}
-
-void gdb_stub_set_non_pt_regs(struct gdb_pt_regs *regs)
-{
-	restore_fp_regs1(&regs->fp_regs);
-}
-
-void gdb_stub_send_signal(int sigval)
-{
-	char *ptr;
-	ptr = output_buffer;
-
-	/*
-	 * Send trap type (converted to signal)
-	 */
-	*ptr++ = 'S';
-	*ptr++ = hexchars[sigval >> 4];
-	*ptr++ = hexchars[sigval & 0xf];
-	*ptr++ = 0;
-	putpacket(output_buffer);	/* send it off... */
-}
-
-/*
- * This function does all command processing for interfacing to gdb.  It
- * returns 1 if you should skip the instruction at the trap address, 0
- * otherwise.
- */
-void gdb_stub_handle_exception(struct gdb_pt_regs *regs,int sigval)
-{
-	int trap;			/* Trap type */
-	int addr;
-	int length;
-	char *ptr;
-	unsigned long *stack;
-
-	
-	/*
-	 * reply to host that an exception has occurred
-	 */
-#if 0
-	send_signal(sigval);
-#endif
-	/*
-	 * Wait for input from remote GDB
-	 */
-	while (1) 
-	{
-		output_buffer[0] = 0;
-		getpacket(input_buffer);
-
-		switch (input_buffer[0])
-		{
-		case '?':
-#if 0
-			send_signal(sigval);
-#endif
-			continue;
-
-		case 'd':
-			/* toggle debug flag */
-			break;
-
-		/*
-		 * Return the value of the CPU registers
-		 */
-		case 'g':
-			gdb_stub_get_non_pt_regs(regs);
-			ptr = output_buffer;
-			ptr=  mem2hex((char *)regs,ptr,S390_REGS_COMMON_SIZE,FALSE);
-			ptr=  mem2hex((char *)&regs->crs[0],ptr,NUM_CRS*CR_SIZE,FALSE);
-			ptr = mem2hex((char *)&regs->fp_regs, ptr,sizeof(s390_fp_regs),FALSE);
-			break;
-	  
-		/*
-		 * set the value of the CPU registers - return OK
-		 * FIXME: Needs to be written
-		 */
-		case 'G':
-			ptr=input_buffer;
-			hex2mem (ptr, (char *)regs,S390_REGS_COMMON_SIZE, FALSE);
-			ptr+=S390_REGS_COMMON_SIZE*2;
-			hex2mem (ptr, (char *)regs->crs[0],NUM_CRS*CR_SIZE, FALSE);
-			ptr+=NUM_CRS*CR_SIZE*2;
-			hex2mem (ptr, (char *)&regs->fp_regs,sizeof(s390_fp_regs), FALSE);
-			gdb_stub_set_non_pt_regs(regs);
-			strcpy(output_buffer,"OK");
-		break;
-
-		/*
-		 * mAA..AA,LLLL  Read LLLL bytes at address AA..AA
-		 */
-		case 'm':
-			ptr = &input_buffer[1];
-
-			if (hexToInt(&ptr, &addr)
-				&& *ptr++ == ','
-				&& hexToInt(&ptr, &length)) {
-				if (mem2hex((char *)addr, output_buffer, length, 1))
-					break;
-				strcpy (output_buffer, "E03");
-			} else
-				strcpy(output_buffer,"E01");
-			break;
-
-		/*
-		 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK
-		 */
-		case 'M': 
-			ptr = &input_buffer[1];
-
-			if (hexToInt(&ptr, &addr)
-				&& *ptr++ == ','
-				&& hexToInt(&ptr, &length)
-				&& *ptr++ == ':') 
-			{
-				if (hex2mem(ptr, (char *)addr, length, 1))
-					strcpy(output_buffer, "OK");
-				else
-					strcpy(output_buffer, "E03");
-			}
-			else
-				strcpy(output_buffer, "E02");
-			break;
-
-		/*
-		 * cAA..AA    Continue at address AA..AA(optional)
-		 */
-		case 'c':    
-			/* try to read optional parameter, pc unchanged if no parm */
-
-			ptr = &input_buffer[1];
-			if (hexToInt(&ptr, &addr))
-				regs->psw.addr = addr;
-			/*
-			 * Need to flush the instruction cache here, as we may
-			 * have deposited a breakpoint, and the icache probably
-			 * has no way of knowing that a data ref to some location
-			 * may have changed something that is in the instruction
-			 * cache.
-			 * NB: We flush both caches, just to be sure...
-			 */
-
-			flush_cache_all();
-			return;
-			/* NOTREACHED */
-			break;
-
-
-		/*
-		 * kill the program
-		 */
-		case 'k' :
-			break;		/* do nothing */
-
-
-		/*
-		 * Reset the whole machine (FIXME: system dependent)
-		 */
-		case 'r':
-			break;
-
-
-		/*
-		 * Step to next instruction
-		 */
-		case 's':
-			/*
-			 * There is no single step insn in the MIPS ISA, so we
-			 * use breakpoints and continue, instead.
-			 */
-#if 0
-			single_step(regs);
-#endif
-			flush_cache_all();
-			return;
-			/* NOTREACHED */
-			break;
-
-		}      /* switch */
-
-	/*
-	 * reply to the request
-	 */
-	
-		putpacket(output_buffer);
-	
-	} /* while */
-}
-
-/*
- * This function will generate a breakpoint exception.  It is used at the
- * beginning of a program to sync up with a debugger and can be used
- * otherwise as a quick means to stop program execution and "break" into
- * the debugger.
- */
-void breakpoint(void)
-{
-	if (!gdb_stub_initialised)
-		return;
-	asm volatile (".globl	breakinst\n"
-		"breakinst:\t.word   %0"
-		: : "i" (S390_BREAKPOINT_U16) );
-}
-
-
-
-
-
-
-
diff -urN linux-2.5.67-bk5/arch/s390/kernel/head64.S linux-2.5.67-bk6/arch/s390/kernel/head64.S
--- linux-2.5.67-bk5/arch/s390/kernel/head64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/head64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,664 @@
+/*
+ *  arch/s390/kernel/head.S
+ *
+ *  S390 version
+ *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Hartmut Penner (hp@de.ibm.com),
+ *               Martin Schwidefsky (schwidefsky@de.ibm.com),
+ *               Rob van der Heij (rvdhei@iae.nl)
+ *
+ * There are 5 different IPL methods
+ *  1) load the image directly into ram at address 0 and do an PSW restart
+ *  2) linload will load the image from address 0x10000 to memory 0x10000
+ *     and start the code thru LPSW 0x0008000080010000 (VM only, deprecated)
+ *  3) generate the tape ipl header, store the generated image on a tape
+ *     and ipl from it
+ *     In case of SL tape you need to IPL 5 times to get past VOL1 etc
+ *  4) generate the vm reader ipl header, move the generated image to the
+ *     VM reader (use option NOH!) and do a ipl from reader (VM only)
+ *  5) direct call of start by the SALIPL loader
+ *  We use the cpuid to distinguish between VM and native ipl
+ *  params for kernel are pushed to 0x10400 (see setup.h)
+
+    Changes: 
+    Okt 25 2000 <rvdheij@iae.nl>
+	added code to skip HDR and EOF to allow SL tape IPL (5 retries)
+	changed first CCW from rewind to backspace block
+
+ */
+
+#include <linux/config.h>
+#include <asm/setup.h>
+#include <asm/lowcore.h>
+
+#ifndef CONFIG_IPL
+        .org   0
+        .long  0x00080000,0x80000000+startup   # Just a restart PSW
+#else
+#ifdef CONFIG_IPL_TAPE
+#define IPL_BS 1024
+        .org   0
+        .long  0x00080000,0x80000000+iplstart  # The first 24 bytes are loaded
+        .long  0x27000000,0x60000001           # by ipl to addresses 0-23.
+        .long  0x02000000,0x20000000+IPL_BS    # (a PSW and two CCWs).
+        .long  0x00000000,0x00000000           # external old psw
+        .long  0x00000000,0x00000000           # svc old psw
+        .long  0x00000000,0x00000000           # program check old psw
+        .long  0x00000000,0x00000000           # machine check old psw
+        .long  0x00000000,0x00000000           # io old psw
+        .long  0x00000000,0x00000000
+        .long  0x00000000,0x00000000
+        .long  0x00000000,0x00000000
+        .long  0x000a0000,0x00000058           # external new psw
+        .long  0x000a0000,0x00000060           # svc new psw
+        .long  0x000a0000,0x00000068           # program check new psw
+        .long  0x000a0000,0x00000070           # machine check new psw
+        .long  0x00080000,0x80000000+.Lioint   # io new psw
+
+        .org   0x100
+#
+# subroutine for loading from tape
+# Paramters:	
+#  R1 = device number
+#  R2 = load address
+.Lloader:	
+        st    %r14,.Lldret
+        la    %r3,.Lorbread                    # r3 = address of orb 
+	la    %r5,.Lirb                        # r5 = address of irb
+        st    %r2,.Lccwread+4                  # initialize CCW data addresses
+        lctl  %c6,%c6,.Lcr6               
+        slr   %r2,%r2
+.Lldlp:
+        la    %r6,3                            # 3 retries
+.Lssch:
+        ssch  0(%r3)                           # load chunk of IPL_BS bytes
+        bnz   .Llderr
+.Lw4end:
+        bas   %r14,.Lwait4io
+        tm    8(%r5),0x82                      # do we have a problem ?
+        bnz   .Lrecov
+        slr   %r7,%r7
+        icm   %r7,3,10(%r5)                    # get residual count
+        lcr   %r7,%r7
+        la    %r7,IPL_BS(%r7)                  # IPL_BS-residual=#bytes read
+        ar    %r2,%r7                          # add to total size
+        tm    8(%r5),0x01                      # found a tape mark ?
+        bnz   .Ldone
+        l     %r0,.Lccwread+4                  # update CCW data addresses
+        ar    %r0,%r7
+        st    %r0,.Lccwread+4                
+        b     .Lldlp
+.Ldone:
+        l     %r14,.Lldret
+        br    %r14                             # r2 contains the total size
+.Lrecov:
+        bas   %r14,.Lsense                     # do the sensing
+        bct   %r6,.Lssch                       # dec. retry count & branch
+        b     .Llderr
+#
+# Sense subroutine
+#
+.Lsense:
+        st    %r14,.Lsnsret
+        la    %r7,.Lorbsense              
+        ssch  0(%r7)                           # start sense command
+        bnz   .Llderr
+        bas   %r14,.Lwait4io
+        l     %r14,.Lsnsret
+        tm    8(%r5),0x82                      # do we have a problem ?
+        bnz   .Llderr
+        br    %r14
+#
+# Wait for interrupt subroutine
+#
+.Lwait4io:
+        lpsw  .Lwaitpsw                 
+.Lioint:
+        c     %r1,0xb8                         # compare subchannel number
+        bne   .Lwait4io
+        tsch  0(%r5)
+        slr   %r0,%r0
+        tm    8(%r5),0x82                      # do we have a problem ?
+        bnz   .Lwtexit
+        tm    8(%r5),0x04                      # got device end ?
+        bz    .Lwait4io
+.Lwtexit:
+        br    %r14
+.Llderr:
+        lpsw  .Lcrash              
+
+        .align 8
+.Lorbread:
+	.long  0x00000000,0x0080ff00,.Lccwread
+        .align 8
+.Lorbsense:
+        .long  0x00000000,0x0080ff00,.Lccwsense
+        .align 8
+.Lccwread:
+        .long  0x02200000+IPL_BS,0x00000000
+.Lccwsense:
+        .long  0x04200001,0x00000000
+.Lwaitpsw:
+	.long  0x020a0000,0x80000000+.Lioint
+
+.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+.Lcr6:  .long  0xff000000
+        .align 8
+.Lcrash:.long  0x000a0000,0x00000000
+.Lldret:.long  0
+.Lsnsret: .long 0
+#endif  /* CONFIG_IPL_TAPE */
+
+#ifdef CONFIG_IPL_VM
+#define IPL_BS 0x730
+        .org   0
+        .long  0x00080000,0x80000000+iplstart  # The first 24 bytes are loaded
+        .long  0x02000018,0x60000050           # by ipl to addresses 0-23.
+        .long  0x02000068,0x60000050           # (a PSW and two CCWs).
+        .fill  80-24,1,0x40                    # bytes 24-79 are discarded !!
+        .long  0x020000f0,0x60000050           # The next 160 byte are loaded
+        .long  0x02000140,0x60000050           # to addresses 0x18-0xb7
+        .long  0x02000190,0x60000050           # They form the continuation
+        .long  0x020001e0,0x60000050           # of the CCW program started
+        .long  0x02000230,0x60000050           # by ipl and load the range
+        .long  0x02000280,0x60000050           # 0x0f0-0x730 from the image
+        .long  0x020002d0,0x60000050           # to the range 0x0f0-0x730
+        .long  0x02000320,0x60000050           # in memory. At the end of
+        .long  0x02000370,0x60000050           # the channel program the PSW
+        .long  0x020003c0,0x60000050           # at location 0 is loaded.
+        .long  0x02000410,0x60000050           # Initial processing starts
+        .long  0x02000460,0x60000050           # at 0xf0 = iplstart.
+        .long  0x020004b0,0x60000050
+        .long  0x02000500,0x60000050
+        .long  0x02000550,0x60000050
+        .long  0x020005a0,0x60000050
+        .long  0x020005f0,0x60000050
+        .long  0x02000640,0x60000050
+        .long  0x02000690,0x60000050
+        .long  0x020006e0,0x20000050
+
+        .org   0xf0
+#
+# subroutine for loading cards from the reader
+#
+.Lloader:	
+	la    %r3,.Lorb                        # r2 = address of orb into r2
+	la    %r5,.Lirb                        # r4 = address of irb
+        la    %r6,.Lccws              
+        la    %r7,20
+.Linit:
+        st    %r2,4(%r6)                       # initialize CCW data addresses
+        la    %r2,0x50(%r2)
+        la    %r6,8(%r6)
+        bct   7,.Linit
+
+        lctl  %c6,%c6,.Lcr6                    # set IO subclass mask
+	slr   %r2,%r2
+.Lldlp:
+        ssch  0(%r3)                           # load chunk of 1600 bytes
+        bnz   .Llderr
+.Lwait4irq:
+        mvc   0x78(8),.Lnewpsw                 # set up IO interrupt psw
+        lpsw  .Lwaitpsw              
+.Lioint:
+        c     %r1,0xb8                         # compare subchannel number
+	bne   .Lwait4irq
+	tsch  0(%r5)
+
+	slr   %r0,%r0
+	ic    %r0,8(%r5)                       # get device status
+	chi   %r0,8                            # channel end ?
+	be    .Lcont
+	chi   %r0,12                           # channel end + device end ?
+	be    .Lcont
+
+        l     %r0,4(%r5)
+        s     %r0,8(%r3)                       # r0/8 = number of ccws executed
+        mhi   %r0,10                           # *10 = number of bytes in ccws
+        lh    %r3,10(%r5)                      # get residual count
+        sr    %r0,%r3                          # #ccws*80-residual=#bytes read
+	ar    %r2,%r0
+	
+        br    %r14                             # r2 contains the total size
+
+.Lcont:
+	ahi   %r2,0x640                        # add 0x640 to total size
+        la    %r6,.Lccws             
+        la    %r7,20
+.Lincr:
+        l     %r0,4(%r6)                       # update CCW data addresses
+        ahi   %r0,0x640
+        st    %r0,4(%r6)
+        ahi   %r6,8
+        bct   7,.Lincr
+
+        b     .Lldlp
+.Llderr:
+        lpsw  .Lcrash              
+
+        .align 8
+.Lorb:	.long  0x00000000,0x0080ff00,.Lccws
+.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+.Lcr6:  .long  0xff000000
+.Lloadp:.long  0,0
+        .align 8
+.Lcrash:.long  0x000a0000,0x00000000
+.Lnewpsw:
+        .long  0x00080000,0x80000000+.Lioint
+.Lwaitpsw:
+        .long  0x020a0000,0x80000000+.Lioint
+
+        .align 8
+.Lccws: .rept  19
+        .long  0x02600050,0x00000000
+        .endr
+        .long  0x02200050,0x00000000
+#endif  /* CONFIG_IPL_VM */
+
+iplstart:
+        lh    %r1,0xb8                         # test if subchannel number
+        bct   %r1,.Lnoload                     #  is valid
+	l     %r1,0xb8                         # load ipl subchannel number
+        la    %r2,IPL_BS                       # load start address
+        bas   %r14,.Lloader                    # load rest of ipl image
+        larl  %r12,_pstart                     # pointer to parameter area
+        st    %r1,IPL_DEVICE+4-PARMAREA(%r12)  # store ipl device number
+
+#
+# load parameter file from ipl device
+#
+.Lagain1:
+ 	l     %r2,INITRD_START+4-PARMAREA(%r12)# use ramdisk location as temp
+        bas   %r14,.Lloader                    # load parameter file
+        ltr   %r2,%r2                          # got anything ?
+        bz    .Lnopf
+	chi   %r2,895
+	bnh   .Lnotrunc
+	la    %r2,895
+.Lnotrunc:
+	l     %r4,INITRD_START+4-PARMAREA(%r12)
+ 	clc   0(3,%r4),.L_hdr		       # if it is HDRx
+ 	bz    .Lagain1			       # skip dataset header
+ 	clc   0(3,%r4),.L_eof		       # if it is EOFx
+ 	bz    .Lagain1			       # skip dateset trailer
+        la    %r5,0(%r4,%r2)
+        lr    %r3,%r2
+.Lidebc:
+        tm    0(%r5),0x80                      # high order bit set ?
+        bo    .Ldocv                           #  yes -> convert from EBCDIC
+        ahi   %r5,-1
+        bct   %r3,.Lidebc
+        b     .Lnocv
+.Ldocv:
+        l     %r3,.Lcvtab
+        tr    0(256,%r4),0(%r3)                # convert parameters to ascii
+        tr    256(256,%r4),0(%r3)
+        tr    512(256,%r4),0(%r3)
+        tr    768(122,%r4),0(%r3)
+.Lnocv: la    %r3,COMMAND_LINE-PARMAREA(%r12)  # load adr. of command line
+	mvc   0(256,%r3),0(%r4)
+	mvc   256(256,%r3),256(%r4)
+	mvc   512(256,%r3),512(%r4)
+	mvc   768(122,%r3),768(%r4)
+        slr   %r0,%r0
+        b     .Lcntlp
+.Ldelspc:
+        ic    %r0,0(%r2,%r3)
+        chi   %r0,0x20                         # is it a space ?
+        be    .Lcntlp
+        ahi   %r2,1
+        b     .Leolp
+.Lcntlp:
+        brct  %r2,.Ldelspc
+.Leolp:
+        slr   %r0,%r0
+        stc   %r0,0(%r2,%r3)                   # terminate buffer
+.Lnopf:
+
+#
+# load ramdisk from ipl device
+#
+.Lagain2:
+ 	l     %r2,INITRD_START+4-PARMAREA(%r12)# load adr. of ramdisk
+        bas   %r14,.Lloader                    # load ramdisk
+ 	st    %r2,INITRD_SIZE+4-PARMAREA(%r12) # store size of ramdisk
+        ltr   %r2,%r2
+        bnz   .Lrdcont
+        st    %r2,INITRD_START+4-PARMAREA(%r12)# no ramdisk found, null it
+.Lrdcont:
+	l     %r2,INITRD_START+4-PARMAREA(%r12)
+	clc   0(3,%r2),.L_hdr		       # skip HDRx and EOFx 
+	bz    .Lagain2
+	clc   0(3,%r2),.L_eof
+	bz    .Lagain2
+
+#ifdef CONFIG_IPL_VM
+#
+# reset files in VM reader
+#
+        stidp __LC_CPUID                       # store cpuid
+	tm    __LC_CPUID,0xff                  # running VM ?
+	bno   .Lnoreset
+        la    %r2,.Lreset              
+        lhi   %r3,26
+        .long 0x83230008
+.Lnoreset:
+#endif
+	
+#
+# everything loaded, go for it
+#
+.Lnoload:
+        l     %r1,.Lstartup
+        br    %r1
+
+.Lstartup: .long startup
+.Lcvtab:.long  _ebcasc                         # ebcdic to ascii table
+.Lreset:.byte  0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
+        .byte  0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
+        .byte  0xc8,0xd6,0xd3,0xc4             # "change rdr all keep nohold"
+.L_eof: .long  0xc5d6c600       /* C'EOF' */
+.L_hdr: .long  0xc8c4d900       /* C'HDR' */
+#endif  /* CONFIG_IPL */
+
+#
+# SALIPL loader support. Based on a patch by Rob van der Heij.
+# This entry point is called directly from the SALIPL loader and
+# doesn't need a builtin ipl record.
+#
+        .org  0x800
+	.globl start
+start:
+	stm   %r0,%r15,0x07b0		# store registers
+	basr  %r12,%r0
+.base:
+	l     %r11,.parm
+	l     %r8,.cmd			# pointer to command buffer
+
+	ltr   %r9,%r9			# do we have SALIPL parameters?
+	bp    .sk8x8
+
+	mvc   0(64,%r8),0x00b0		# copy saved registers
+	xc    64(240-64,%r8),0(%r8)	# remainder of buffer
+	tr    0(64,%r8),.lowcase	
+	b     .gotr
+.sk8x8:
+	mvc   0(240,%r8),0(%r9)		# copy iplparms into buffer
+.gotr:
+	l     %r10,.tbl			# EBCDIC to ASCII table
+	tr    0(240,%r8),0(%r10)
+	stidp __LC_CPUID		# Are we running on VM maybe
+	cli   __LC_CPUID,0xff
+	bnz   .test
+	.long 0x83300060		# diag 3,0,x'0060' - storage size
+	b     .done
+.test:
+	mvc   0x68(8),.pgmnw		# set up pgm check handler
+	l     %r2,.fourmeg
+	lr    %r3,%r2
+	bctr  %r3,%r0			# 4M-1
+.loop:  iske  %r0,%r3
+	ar    %r3,%r2
+.pgmx:
+	sr    %r3,%r2
+	la    %r3,1(%r3)
+.done:
+	l     %r1,.memsize
+	st    %r3,4(%r1)
+	slr   %r0,%r0
+	st    %r0,INITRD_SIZE+4-PARMAREA(%r11)
+	st    %r0,INITRD_START+4-PARMAREA(%r11)
+	j     startup                   # continue with startup
+.tbl:	.long _ebcasc			# translate table
+.cmd:	.long COMMAND_LINE		# address of command line buffer
+.parm:	.long PARMAREA
+.fourmeg: .long 0x00400000      	# 4M
+.pgmnw:	.long 0x00080000,.pgmx
+.memsize: .long memory_size
+.lowcase:
+	.byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 
+	.byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
+	.byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 
+	.byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
+	.byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 
+	.byte 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f
+	.byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 
+	.byte 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f
+	.byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47 
+	.byte 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f
+	.byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 
+	.byte 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f
+	.byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67 
+	.byte 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f
+	.byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 
+	.byte 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f
+
+	.byte 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87 
+	.byte 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f
+	.byte 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97 
+	.byte 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f
+	.byte 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 
+	.byte 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf
+	.byte 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7 
+	.byte 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf
+	.byte 0xc0,0x81,0x82,0x83,0x84,0x85,0x86,0x87	# .abcdefg 
+	.byte 0x88,0x89,0xca,0xcb,0xcc,0xcd,0xce,0xcf	# hi
+	.byte 0xd0,0x91,0x92,0x93,0x94,0x95,0x96,0x97 	# .jklmnop
+	.byte 0x98,0x99,0xda,0xdb,0xdc,0xdd,0xde,0xdf	# qr
+	.byte 0xe0,0xe1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7	# ..stuvwx
+	.byte 0xa8,0xa9,0xea,0xeb,0xec,0xed,0xee,0xef	# yz
+	.byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 
+	.byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
+
+#
+# startup-code at 0x10000, running in real mode
+# this is called either by the ipl loader or directly by PSW restart
+# or linload or SALIPL
+#
+        .org  0x10000
+startup:basr  %r13,0                     # get base
+.LPG1:  sll   %r13,1                     # remove high order bit
+        srl   %r13,1
+        lhi   %r1,1                      # mode 1 = esame
+        slr   %r0,%r0                    # set cpuid to zero
+        sigp  %r1,%r0,0x12               # switch to esame mode
+	sam64				 # switch to 64 bit mode
+	lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
+	larl  %r12,_pstart               # pointer to parameter area
+					 # move IPL device to lowcore
+        mvc   __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12)
+
+#
+# clear bss memory
+#
+	larl  %r2,__bss_start           # start of bss segment
+        larl  %r3,_end                  # end of bss segment
+        sgr   %r3,%r2                   # length of bss
+        sgr   %r4,%r4                   #
+        sgr   %r5,%r5                   # set src,length and pad to zero
+        mvcle %r2,%r4,0                 # clear mem
+        jo    .-4                       # branch back, if not finish
+
+					 # set program check new psw mask
+	mvc   __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
+
+#
+# find memory chunks.
+#
+	larl  %r1,.Lchkmem               # set program check address
+	stg   %r1,__LC_PGM_NEW_PSW+8
+	la    %r1,1                      # test in increments of 128KB
+	sllg  %r1,%r1,17
+	larl  %r3,memory_chunk
+	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
+.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
+.Lsame:
+	algr  %r5,%r1			 # add 128KB to end of chunk
+	brc   12,.Lloop
+.Lchkmem:				 # > 16EB or tprot got a program check
+	clgr  %r4,%r5			 # chunk size > 0?
+	je    .Ldonemem
+	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.
+#
+	lghi  %r4,1
+	sllg  %r4,%r4,31
+	clgr  %r5,%r4
+	jhe   .Ldonemem
+	lgr   %r5,%r4
+	j     .Lloop
+.Ldonemem:		
+
+	larl  %r12,machine_flags
+#
+# find out if we are running under VM
+#
+        stidp  __LC_CPUID               # store cpuid
+	tm     __LC_CPUID,0xff          # running under VM ?
+	bno    0f-.LPG1(%r13)
+        oi     7(%r12),1                # set VM flag
+0:      lh     %r0,__LC_CPUID+4         # get cpu version
+        chi    %r0,0x7490               # running on a P/390 ?
+        bne    1f-.LPG1(%r13)
+        oi     7(%r12),4                # set P/390 flag
+1:
+
+#
+# find out if we have the MVPG instruction
+#
+	la     %r1,0f-.LPG1(%r13)       # set program check address
+	stg    %r1,__LC_PGM_NEW_PSW+8
+	sgr    %r0,%r0
+	lghi   %r1,0
+	lghi   %r2,0
+	mvpg   %r1,%r2                  # test MVPG instruction
+	oi     7(%r12),16               # set MVPG flag
+0:
+
+#
+# find out if the diag 0x44 works in 64 bit mode
+#
+	la     %r1,0f-.LPG1(%r13)	# set program check address
+	stg    %r1,__LC_PGM_NEW_PSW+8
+	mvc    __LC_DIAG44_OPCODE(8),.Lnop-.LPG1(%r13)
+	diag   0,0,0x44			# test diag 0x44
+	oi     7(%r12),32		# set diag44 flag
+	mvc    __LC_DIAG44_OPCODE(8),.Ldiag44-.LPG1(%r13)
+0:	
+
+        lpswe .Lentry-.LPG1(13)         # jump to _stext in primary-space,
+                                        # virtual and never return ...
+        .align 16
+.Lentry:.quad  0x0000000180000000,_stext
+.Lctl:  .quad  0x04b50002               # cr0: various things
+        .quad  0                        # cr1: primary space segment table
+        .quad  .Lduct                   # cr2: dispatchable unit control table
+        .quad  0                        # cr3: instruction authorization
+        .quad  0                        # cr4: instruction authorization
+        .quad  0                        # cr5:  various things
+        .quad  0                        # cr6:  I/O interrupts
+        .quad  0                        # cr7:  secondary space segment table
+        .quad  0                        # cr8:  access registers translation
+        .quad  0                        # cr9:  tracing off
+        .quad  0                        # cr10: tracing off
+        .quad  0                        # cr11: tracing off
+        .quad  0                        # cr12: tracing off
+        .quad  0                        # cr13: home space segment table
+        .quad  0xc0000000               # cr14: machine check handling off
+        .quad  0                        # cr15: linkage stack operations
+.Lpcmsk:.quad  0x0000000180000000
+.L4malign:.quad 0xffffffffffc00000
+.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
+.Lnop:	.long  0x07000700
+.Ldiag44:.long 0x83000044
+
+	.org PARMAREA-64
+.Lduct:	.long 0,0,0,0,0,0,0,0
+	.long 0,0,0,0,0,0,0,0
+
+#
+# params at 10400 (setup.h)
+#
+	.org   PARMAREA
+	.global _pstart
+_pstart:
+	.quad  0                        # IPL_DEVICE
+        .quad  RAMDISK_ORIGIN           # INITRD_START
+        .quad  RAMDISK_SIZE             # INITRD_SIZE
+
+        .org   COMMAND_LINE
+    	.byte  "root=/dev/ram0 ro"
+        .byte  0
+	.org   0x11000
+	.global _pend
+_pend:	
+
+#ifdef CONFIG_SHARED_KERNEL
+	.org   0x100000
+#endif
+	
+#
+# startup-code, running in virtual mode
+#
+        .globl _stext
+_stext:	basr  %r13,0                    # get base
+.LPG2:
+#
+# Setup stack
+#
+	larl  %r15,init_thread_union
+        aghi  %r15,16384                # init_task_union + 16384
+        stg   %r15,__LC_KERNEL_STACK    # set end of kernel stack
+        aghi  %r15,-160
+        xc    0(8,%r15),0(%r15)         # set backchain to zero
+
+# check control registers
+        stctg  %c0,%c15,0(%r15)
+	oi     6(%r15),0x20             # enable sigp external interrupts
+	oi     4(%r15),0x10             # switch on low address proctection
+        lctlg  %c0,%c15,0(%r15)
+
+#
+        lam    0,15,.Laregs-.LPG2(%r13) # load access regs needed by uaccess
+        brasl  %r14,start_kernel        # go to C code
+#
+# We returned from start_kernel ?!? PANIK
+#
+        basr  %r13,0
+	lpswe .Ldw-.(%r13)           # load disabled wait psw
+#
+            .align 8
+.Ldw:       .quad  0x0002000180000000,0x0000000000000000
+.Laregs:    .long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
diff -urN linux-2.5.67-bk5/arch/s390/kernel/module.c linux-2.5.67-bk6/arch/s390/kernel/module.c
--- linux-2.5.67-bk5/arch/s390/kernel/module.c	2003-04-07 10:32:29.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/module.c	2003-04-15 04:36:14.000000000 -0700
@@ -37,8 +37,11 @@
 #define DEBUGP(fmt , ...)
 #endif
 
-#define GOT_ENTRY_SIZE 4
+#ifndef CONFIG_ARCH_S390X
 #define PLT_ENTRY_SIZE 12
+#else /* CONFIG_ARCH_S390X */
+#define PLT_ENTRY_SIZE 20
+#endif /* CONFIG_ARCH_S390X */
 
 void *module_alloc(unsigned long size)
 {
@@ -56,30 +59,34 @@
 }
 
 static inline void
-check_rela(Elf32_Rela *rela, struct module *me)
+check_rela(Elf_Rela *rela, struct module *me)
 {
 	struct mod_arch_syminfo *info;
 
-	info = me->arch.syminfo + ELF32_R_SYM (rela->r_info);
-	switch (ELF32_R_TYPE (rela->r_info)) {
+	info = me->arch.syminfo + ELF_R_SYM (rela->r_info);
+	switch (ELF_R_TYPE (rela->r_info)) {
 	case R_390_GOT12:	/* 12 bit GOT offset.  */
 	case R_390_GOT16:	/* 16 bit GOT offset.  */
 	case R_390_GOT32:	/* 32 bit GOT offset.  */
+	case R_390_GOT64:	/* 64 bit GOT offset.  */
 	case R_390_GOTENT:	/* 32 bit PC rel. to GOT entry shifted by 1. */
 	case R_390_GOTPLT12:	/* 12 bit offset to jump slot.	*/
 	case R_390_GOTPLT16:	/* 16 bit offset to jump slot. */
 	case R_390_GOTPLT32:	/* 32 bit offset to jump slot. */
+	case R_390_GOTPLT64:	/* 64 bit offset to jump slot.	*/
 	case R_390_GOTPLTENT:	/* 32 bit rel. offset to jump slot >> 1. */
 		if (info->got_offset == -1UL) {
 			info->got_offset = me->arch.got_size;
-			me->arch.got_size += GOT_ENTRY_SIZE;
+			me->arch.got_size += sizeof(void*);
 		}
 		break;
 	case R_390_PLT16DBL:	/* 16 bit PC rel. PLT shifted by 1.  */
 	case R_390_PLT32DBL:	/* 32 bit PC rel. PLT shifted by 1.  */
 	case R_390_PLT32:	/* 32 bit PC relative PLT address.  */
+	case R_390_PLT64:	/* 64 bit PC relative PLT address.  */
 	case R_390_PLTOFF16:	/* 16 bit offset from GOT to PLT. */
 	case R_390_PLTOFF32:	/* 32 bit offset from GOT to PLT. */
+	case R_390_PLTOFF64:	/* 16 bit offset from GOT to PLT. */
 		if (info->plt_offset == -1UL) {
 			info->plt_offset = me->arch.plt_size;
 			me->arch.plt_size += PLT_ENTRY_SIZE;
@@ -100,12 +107,12 @@
  * got and plt but we can increase the core module size.
  */
 int
-module_frob_arch_sections(Elf32_Ehdr *hdr, Elf32_Shdr *sechdrs,
+module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
 			  char *secstrings, struct module *me)
 {
-	Elf32_Shdr *symtab;
-	Elf32_Sym *symbols;
-	Elf32_Rela *rela;
+	Elf_Shdr *symtab;
+	Elf_Sym *symbols;
+	Elf_Rela *rela;
 	char *strings;
 	int nrela, i, j;
 
@@ -123,7 +130,7 @@
 	}
 
 	/* Allocate one syminfo structure per symbol. */
-	me->arch.nsyms = symtab->sh_size / sizeof(Elf32_Sym);
+	me->arch.nsyms = symtab->sh_size / sizeof(Elf_Sym);
 	me->arch.syminfo = kmalloc(me->arch.nsyms *
 				   sizeof(struct mod_arch_syminfo),
 				   GFP_KERNEL);
@@ -148,7 +155,7 @@
 	for (i = 0; i < hdr->e_shnum; i++) {
 		if (sechdrs[i].sh_type != SHT_RELA)
 			continue;
-		nrela = sechdrs[i].sh_size / sizeof(Elf32_Rela);
+		nrela = sechdrs[i].sh_size / sizeof(Elf_Rela);
 		rela = (void *) hdr + sechdrs[i].sh_offset;
 		for (j = 0; j < nrela; j++)
 			check_rela(rela + j, me);
@@ -174,19 +181,19 @@
 }
 
 static inline int
-apply_rela(Elf32_Rela *rela, Elf32_Addr base, Elf32_Sym *symtab, 
+apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab, 
 	   struct module *me)
 {
 	struct mod_arch_syminfo *info;
-	Elf32_Addr loc, val;
+	Elf_Addr loc, val;
 	int r_type, r_sym;
 
 	/* This is where to make the change */
 	loc = base + rela->r_offset;
 	/* This is the symbol it is referring to.  Note that all
 	   undefined symbols have been resolved.  */
-	r_sym = ELF32_R_SYM(rela->r_info);
-	r_type = ELF32_R_TYPE(rela->r_info);
+	r_sym = ELF_R_SYM(rela->r_info);
+	r_type = ELF_R_TYPE(rela->r_info);
 	info = me->arch.syminfo + r_sym;
 	val = symtab[r_sym].st_value;
 
@@ -195,6 +202,7 @@
 	case R_390_12:		/* Direct 12 bit.  */
 	case R_390_16:		/* Direct 16 bit.  */
 	case R_390_32:		/* Direct 32 bit.  */
+	case R_390_64:		/* Direct 64 bit.  */
 		val += rela->r_addend;
 		if (r_type == R_390_8)
 			*(unsigned char *) loc = val;
@@ -205,11 +213,14 @@
 			*(unsigned short *) loc = val;
 		else if (r_type == R_390_32)
 			*(unsigned int *) loc = val;
+		else if (r_type == R_390_64)
+			*(unsigned long *) loc = val;
 		break;
 	case R_390_PC16:	/* PC relative 16 bit.  */
 	case R_390_PC16DBL:	/* PC relative 16 bit shifted by 1.  */
 	case R_390_PC32DBL:	/* PC relative 32 bit shifted by 1.  */
 	case R_390_PC32:	/* PC relative 32 bit.  */
+	case R_390_PC64:	/* PC relative 64 bit.	*/
 		val += rela->r_addend - loc;
 		if (r_type == R_390_PC16)
 			*(unsigned short *) loc = val;
@@ -219,17 +230,22 @@
 			*(unsigned int *) loc = val >> 1;
 		else if (r_type == R_390_PC32)
 			*(unsigned int *) loc = val;
+		else if (r_type == R_390_PC64)
+			*(unsigned long *) loc = val;
 		break;
 	case R_390_GOT12:	/* 12 bit GOT offset.  */
 	case R_390_GOT16:	/* 16 bit GOT offset.  */
 	case R_390_GOT32:	/* 32 bit GOT offset.  */
+	case R_390_GOT64:	/* 64 bit GOT offset.  */
 	case R_390_GOTENT:	/* 32 bit PC rel. to GOT entry shifted by 1. */
 	case R_390_GOTPLT12:	/* 12 bit offset to jump slot.	*/
 	case R_390_GOTPLT16:	/* 16 bit offset to jump slot. */
 	case R_390_GOTPLT32:	/* 32 bit offset to jump slot. */
+	case R_390_GOTPLT64:	/* 64 bit offset to jump slot.	*/
 	case R_390_GOTPLTENT:	/* 32 bit rel. offset to jump slot >> 1. */
 		if (info->got_initialized == 0) {
-			Elf32_Addr *gotent;
+			Elf_Addr *gotent;
+
 			gotent = me->module_core + me->arch.got_offset +
 				info->got_offset;
 			*gotent = val;
@@ -249,27 +265,42 @@
 		else if (r_type == R_390_GOTENT ||
 			 r_type == R_390_GOTPLTENT)
 			*(unsigned int *) loc = val >> 1;
+		else if (r_type == R_390_GOT64 ||
+			 r_type == R_390_GOTPLT64)
+			*(unsigned long *) loc = val;
 		break;
 	case R_390_PLT16DBL:	/* 16 bit PC rel. PLT shifted by 1.  */
 	case R_390_PLT32DBL:	/* 32 bit PC rel. PLT shifted by 1.  */
 	case R_390_PLT32:	/* 32 bit PC relative PLT address.  */
+	case R_390_PLT64:	/* 64 bit PC relative PLT address.  */
 	case R_390_PLTOFF16:	/* 16 bit offset from GOT to PLT. */
 	case R_390_PLTOFF32:	/* 32 bit offset from GOT to PLT. */
+	case R_390_PLTOFF64:	/* 16 bit offset from GOT to PLT. */
 		if (info->plt_initialized == 0) {
 			unsigned int *ip;
 			ip = me->module_core + me->arch.plt_offset +
 				info->plt_offset;
+#ifndef CONFIG_ARCH_S390X
 			ip[0] = 0x0d105810; /* basr 1,0; l 1,6(1); br 1 */
 			ip[1] = 0x100607f1;
 			ip[2] = val;
+#else /* CONFIG_ARCH_S390X */
+			ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */
+			ip[1] = 0x100a0004;
+			ip[2] = 0x07f10000;
+			ip[3] = (unsigned int) (val >> 32);
+			ip[4] = (unsigned int) val;
+#endif /* CONFIG_ARCH_S390X */
 			info->plt_initialized = 1;
 		}
 		if (r_type == R_390_PLTOFF16 ||
-		    r_type == R_390_PLTOFF32)
+		    r_type == R_390_PLTOFF32
+		    || r_type == R_390_PLTOFF64
+			)
 			val = me->arch.plt_offset - me->arch.got_offset +
 				info->plt_offset + rela->r_addend;
 		else
-			val =  (Elf32_Addr) me->module_core +
+			val =  (Elf_Addr) me->module_core +
 				me->arch.plt_offset + info->plt_offset + 
 				rela->r_addend - loc;
 		if (r_type == R_390_PLT16DBL)
@@ -281,19 +312,25 @@
 		else if (r_type == R_390_PLT32 ||
 			 r_type == R_390_PLTOFF32)
 			*(unsigned int *) loc = val;
+		else if (r_type == R_390_PLT64 ||
+			 r_type == R_390_PLTOFF64)
+			*(unsigned long *) loc = val;
 		break;
 	case R_390_GOTOFF16:	/* 16 bit offset to GOT.  */
 	case R_390_GOTOFF32:	/* 32 bit offset to GOT.  */
+	case R_390_GOTOFF64:	/* 64 bit offset to GOT. */
 		val = val + rela->r_addend -
-			((Elf32_Addr) me->module_core + me->arch.got_offset);
+			((Elf_Addr) me->module_core + me->arch.got_offset);
 		if (r_type == R_390_GOTOFF16)
 			*(unsigned short *) loc = val;
 		else if (r_type == R_390_GOTOFF32)
 			*(unsigned int *) loc = val;
+		else if (r_type == R_390_GOTOFF64)
+			*(unsigned long *) loc = val;
 		break;
 	case R_390_GOTPC:	/* 32 bit PC relative offset to GOT. */
 	case R_390_GOTPCDBL:	/* 32 bit PC rel. off. to GOT shifted by 1. */
-		val = (Elf32_Addr) me->module_core + me->arch.got_offset +
+		val = (Elf_Addr) me->module_core + me->arch.got_offset +
 			rela->r_addend - loc;
 		if (r_type == R_390_GOTPC)
 			*(unsigned int *) loc = val;
@@ -316,22 +353,23 @@
 }
 
 int
-apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
+apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
 		   unsigned int symindex, unsigned int relsec,
 		   struct module *me)
 {
-	Elf32_Addr base;
-	Elf32_Sym *symtab;
-	Elf32_Rela *rela;
+	Elf_Addr base;
+	Elf_Sym *symtab;
+	Elf_Rela *rela;
 	unsigned long i, n;
 	int rc;
 
 	DEBUGP("Applying relocate section %u to %u\n",
 	       relsec, sechdrs[relsec].sh_info);
 	base = sechdrs[sechdrs[relsec].sh_info].sh_addr;
-	symtab = (Elf32_Sym *) sechdrs[symindex].sh_addr;
-	rela = (Elf32_Rela *) sechdrs[relsec].sh_addr;
-	n = sechdrs[relsec].sh_size / sizeof(Elf32_Rela);
+	symtab = (Elf_Sym *) sechdrs[symindex].sh_addr;
+	rela = (Elf_Rela *) sechdrs[relsec].sh_addr;
+	n = sechdrs[relsec].sh_size / sizeof(Elf_Rela);
+
 	for (i = 0; i < n; i++, rela++) {
 		rc = apply_rela(rela, base, symtab, me);
 		if (rc)
diff -urN linux-2.5.67-bk5/arch/s390/kernel/process.c linux-2.5.67-bk6/arch/s390/kernel/process.c
--- linux-2.5.67-bk5/arch/s390/kernel/process.c	2003-04-07 10:32:19.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/process.c	2003-04-15 04:36:14.000000000 -0700
@@ -56,7 +56,11 @@
 	unsigned long bc;
 
 	bc = *((unsigned long *) tsk->thread.ksp);
+#ifndef CONFIG_ARCH_S390X
 	return *((unsigned long *) (bc+56));
+#else
+	return *((unsigned long *) (bc+112));
+#endif
 }
 
 /*
@@ -79,6 +83,7 @@
 	 */
 	wait_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK | PSW_MASK_WAIT |
 		PSW_MASK_IO | PSW_MASK_EXT;
+#ifndef CONFIG_ARCH_S390X
 	asm volatile (
 		"    basr %0,0\n"
 		"0:  la   %0,1f-0b(%0)\n"
@@ -92,6 +97,18 @@
 		"    lpsw 0(%1)\n"
 		"2:"
 		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
+#else /* CONFIG_ARCH_S390X */
+	asm volatile (
+		"    larl  %0,0f\n"
+		"    stg   %0,8(%1)\n"
+		"    lpswe 0(%1)\n"
+		"0:  larl  %0,1f\n"
+		"    stg   %0,8(%1)\n"
+		"    ni    1(%1),0xf9\n"
+		"    lpswe 0(%1)\n"
+		"1:"
+		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
+#endif /* CONFIG_ARCH_S390X */
 }
 
 int cpu_idle(void)
@@ -109,9 +126,9 @@
 	struct task_struct *tsk = current;
 
         printk("CPU:    %d    %s\n", tsk->thread_info->cpu, print_tainted());
-        printk("Process %s (pid: %d, task: %08lx, ksp: %08x)\n",
-	       current->comm, current->pid, (unsigned long) tsk,
-	       tsk->thread.ksp);
+        printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
+	       current->comm, current->pid, (void *) tsk,
+	       (void *) tsk->thread.ksp);
 
 	show_registers(regs);
 	/* Show stack backtrace if pt_regs is from kernel mode */
@@ -120,6 +137,9 @@
 }
 
 extern void kernel_thread_starter(void);
+
+#ifndef CONFIG_ARCH_S390X
+
 __asm__(".align 4\n"
 	"kernel_thread_starter:\n"
 	"    l     15,0(8)\n"
@@ -130,6 +150,20 @@
 	"    sr    2,2\n"
 	"    br    11\n");
 
+#else /* CONFIG_ARCH_S390X */
+
+__asm__(".align 4\n"
+	"kernel_thread_starter:\n"
+	"    lg    15,0(8)\n"
+	"    sgr   15,7\n"
+	"    stosm 48(15),3\n"
+	"    lgr   2,10\n"
+	"    basr  14,9\n"
+	"    sgr   2,2\n"
+	"    br    11\n");
+
+#endif /* CONFIG_ARCH_S390X */
+
 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 {
 	struct task_struct *p;
@@ -137,7 +171,7 @@
 
 	memset(&regs, 0, sizeof(regs));
 	regs.psw.mask = PSW_KERNEL_BITS;
-	regs.psw.addr = (__u32) kernel_thread_starter | PSW_ADDR_AMODE31;
+	regs.psw.addr = (unsigned long) kernel_thread_starter | PSW_ADDR_AMODE;
 	regs.gprs[7] = STACK_FRAME_OVERHEAD;
 	regs.gprs[8] = __LC_KERNEL_STACK;
 	regs.gprs[9] = (unsigned long) fn;
@@ -180,8 +214,8 @@
             unsigned long glue2;
             unsigned long scratch[2];
             unsigned long gprs[10];    /* gprs 6 -15                       */
-            unsigned long fprs[4];     /* fpr 4 and 6                      */
-            unsigned long empty[4];
+            unsigned int  fprs[4];     /* fpr 4 and 6                      */
+            unsigned int  empty[4];
             struct pt_regs childregs;
           } *frame;
 
@@ -198,7 +232,8 @@
         frame->gprs[8] = (unsigned long) ret_from_fork;
 
         /* fake return stack for resume(), don't go back to schedule */
-        frame->gprs[9]  = (unsigned long) frame;
+        frame->gprs[9] = (unsigned long) frame;
+#ifndef CONFIG_ARCH_S390X
         /*
 	 * save fprs to current->thread.fp_regs to merge them with
 	 * the emulated registers and then copy the result to the child.
@@ -207,14 +242,31 @@
 	memcpy(&p->thread.fp_regs, &current->thread.fp_regs,
 	       sizeof(s390_fp_regs));
         p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _SEGMENT_TABLE;
-	/* start process with ar4 pointing to the correct address space */
+	/* Set a new TLS ?  */
+	if (clone_flags & CLONE_SETTLS)
+		frame->childregs.acrs[0] = regs->gprs[6];
+#else /* CONFIG_ARCH_S390X */
+	/* Save the fpu registers to new thread structure. */
+	save_fp_regs(&p->thread.fp_regs);
+        p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE;
+	/* Set a new TLS ?  */
+	if (clone_flags & CLONE_SETTLS) {
+		if (test_thread_flag(TIF_31BIT)) {
+			frame->childregs.acrs[0] =
+				(unsigned int) regs->gprs[6];
+		} else {
+			frame->childregs.acrs[0] =
+				(unsigned int)(regs->gprs[6] >> 32);
+			frame->childregs.acrs[1] =
+				(unsigned int) regs->gprs[6];
+		}
+	}
+#endif /* CONFIG_ARCH_S390X */
+	/* start new process with ar4 pointing to the correct address space */
 	p->thread.ar4 = get_fs().ar4;
         /* Don't copy debug registers */
         memset(&p->thread.per_info,0,sizeof(p->thread.per_info));
 
-	/* Set a new TLS ?  */
-	if (clone_flags & CLONE_SETTLS)
-		frame->childregs.acrs[0] = regs->gprs[6];
         return 0;
 }
 
@@ -292,12 +344,16 @@
  */
 int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)
 {
+#ifndef CONFIG_ARCH_S390X
         /*
 	 * save fprs to current->thread.fp_regs to merge them with
 	 * the emulated registers and then copy the result to the dump.
 	 */
 	save_fp_regs(&current->thread.fp_regs);
 	memcpy(fpregs, &current->thread.fp_regs, sizeof(s390_fp_regs));
+#else /* CONFIG_ARCH_S390X */
+	save_fp_regs(fpregs);
+#endif /* CONFIG_ARCH_S390X */
 	return 1;
 }
 
@@ -339,16 +395,22 @@
 		return 0;
 	stack_page = (unsigned long) p->thread_info;
 	r15 = p->thread.ksp;
-        if (!stack_page || r15 < stack_page || r15 >= 8188+stack_page)
-                return 0;
-        bc = (*(unsigned long *) r15) & 0x7fffffff;
+	if (!stack_page || r15 < stack_page ||
+	    r15 >= THREAD_SIZE - sizeof(unsigned long) + stack_page)
+		return 0;
+	bc = (*(unsigned long *) r15) & PSW_ADDR_INSN;
 	do {
-                if (bc < stack_page || bc >= 8188+stack_page)
-                        return 0;
-		r14 = (*(unsigned long *) (bc+56)) & 0x7fffffff;
+		if (bc < stack_page ||
+		    bc >= THREAD_SIZE - sizeof(unsigned long) + stack_page)
+			return 0;
+#ifndef CONFIG_ARCH_S390X
+		r14 = (*(unsigned long *) (bc+56)) & PSW_ADDR_INSN;
+#else
+		r14 = *(unsigned long *) (bc+112);
+#endif
 		if (r14 < first_sched || r14 >= last_sched)
 			return r14;
-		bc = (*(unsigned long *) bc) & 0x7fffffff;
+		bc = (*(unsigned long *) bc) & PSW_ADDR_INSN;
 	} while (count++ < 16);
 	return 0;
 }
diff -urN linux-2.5.67-bk5/arch/s390/kernel/ptrace.c linux-2.5.67-bk6/arch/s390/kernel/ptrace.c
--- linux-2.5.67-bk5/arch/s390/kernel/ptrace.c	2003-04-07 10:32:31.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/ptrace.c	2003-04-15 04:36:14.000000000 -0700
@@ -39,8 +39,12 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
+#ifdef CONFIG_S390_SUPPORT
+#include "compat_ptrace.h"
+#endif
 
-static void FixPerRegisters(struct task_struct *task)
+static void
+FixPerRegisters(struct task_struct *task)
 {
 	struct pt_regs *regs;
 	per_struct *per_info;
@@ -52,7 +56,12 @@
 	
 	if (per_info->single_step) {
 		per_info->control_regs.bits.starting_addr = 0;
-		per_info->control_regs.bits.ending_addr = 0x7fffffffUL;
+#ifdef CONFIG_S390_SUPPORT
+		if (test_thread_flag(TIF_31BIT))
+			per_info->control_regs.bits.ending_addr = 0x7fffffffUL;
+		else
+#endif
+			per_info->control_regs.bits.ending_addr = PSW_ADDR_INSN;
 	} else {
 		per_info->control_regs.bits.starting_addr =
 			per_info->starting_addr;
@@ -74,13 +83,15 @@
 		per_info->control_regs.bits.storage_alt_space_ctl = 0;
 }
 
-void set_single_step(struct task_struct *task)
+void
+set_single_step(struct task_struct *task)
 {
 	task->thread.per_info.single_step = 1;
 	FixPerRegisters(task);
 }
 
-void clear_single_step(struct task_struct *task)
+void
+clear_single_step(struct task_struct *task)
 {
 	task->thread.per_info.single_step = 0;
 	FixPerRegisters(task);
@@ -91,12 +102,19 @@
  *
  * Make sure single step bits etc are not set.
  */
-void ptrace_disable(struct task_struct *child)
+void
+ptrace_disable(struct task_struct *child)
 {
 	/* make sure the single step bit is not set. */
 	clear_single_step(child);
 }
 
+#ifndef CONFIG_ARCH_S390X
+# define __ADDR_MASK 3
+#else
+# define __ADDR_MASK 7
+#endif
+
 /*
  * Read the word at offset addr from the user area of a process. The
  * trouble here is that the information is littered over different
@@ -106,20 +124,20 @@
  * struct user contain pad bytes that should be read as zeroes.
  * Lovely...
  */
-static int peek_user(struct task_struct *child, addr_t addr, addr_t data)
+static int
+peek_user(struct task_struct *child, addr_t addr, addr_t data)
 {
 	struct user *dummy = NULL;
-	addr_t offset;
-	__u32 tmp;
+	addr_t offset, tmp;
 
-	if ((addr & 3) || addr > sizeof(struct user) - 3)
+	if ((addr & __ADDR_MASK) || addr > sizeof(struct user) - __ADDR_MASK)
 		return -EIO;
 
 	if (addr <= (addr_t) &dummy->regs.orig_gpr2) {
 		/*
 		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
 		 */
-		tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + addr);
+		tmp = *(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr);
 
 	} else if (addr >= (addr_t) &dummy->regs.fp_regs &&
 		   addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
@@ -127,7 +145,7 @@
 		 * floating point regs. are stored in the thread structure
 		 */
 		offset = addr - (addr_t) &dummy->regs.fp_regs;
-		tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);
+		tmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset);
 
 	} else if (addr >= (addr_t) &dummy->regs.per_info &&
 		   addr < (addr_t) (&dummy->regs.per_info + 1)) {
@@ -135,12 +153,12 @@
 		 * per_info is found in the thread structure
 		 */
 		offset = addr - (addr_t) &dummy->regs.per_info;
-		tmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);
+		tmp = *(addr_t *)((addr_t) &child->thread.per_info + offset);
 
 	} else
 		tmp = 0;
 
-	return put_user(tmp, (__u32 *) data);
+	return put_user(tmp, (addr_t *) data);
 }
 
 /*
@@ -149,12 +167,13 @@
  * Stores to the program status word and on the floating point
  * control register needs to get checked for validity.
  */
-static int poke_user(struct task_struct *child, addr_t addr, addr_t data)
+static int
+poke_user(struct task_struct *child, addr_t addr, addr_t data)
 {
 	struct user *dummy = NULL;
 	addr_t offset;
 
-	if ((addr & 3) || addr > sizeof(struct user) - 3)
+	if ((addr & __ADDR_MASK) || addr > sizeof(struct user) - __ADDR_MASK)
 		return -EIO;
 
 	if (addr <= (addr_t) &dummy->regs.orig_gpr2) {
@@ -162,14 +181,19 @@
 		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
 		 */
 		if (addr == (addr_t) &dummy->regs.psw.mask &&
+#ifdef CONFIG_S390_SUPPORT
+		    (data & ~PSW_MASK_CC) != PSW_USER32_BITS &&
+#endif
 		    (data & ~PSW_MASK_CC) != PSW_USER_BITS)
 			/* Invalid psw mask. */
 			return -EINVAL;
+#ifndef CONFIG_ARCH_S390X
 		if (addr == (addr_t) &dummy->regs.psw.addr)
 			/* I'd like to reject addresses without the
 			   high order bit but older gdb's rely on it */
-			data |= PSW_ADDR_AMODE31;
-		*(__u32 *)((addr_t) __KSTK_PTREGS(child) + addr) = data;
+			data |= PSW_ADDR_AMODE;
+#endif
+		*(addr_t *)((addr_t) __KSTK_PTREGS(child) + addr) = data;
 
 	} else if (addr >= (addr_t) &dummy->regs.fp_regs &&
 		   addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
@@ -180,7 +204,7 @@
 		    (data & ~FPC_VALID_MASK) != 0)
 			return -EINVAL;
 		offset = addr - (addr_t) &dummy->regs.fp_regs;
-		*(__u32 *)((addr_t) &child->thread.fp_regs + offset) = data;
+		*(addr_t *)((addr_t) &child->thread.fp_regs + offset) = data;
 
 	} else if (addr >= (addr_t) &dummy->regs.per_info &&
 		   addr < (addr_t) (&dummy->regs.per_info + 1)) {
@@ -188,7 +212,7 @@
 		 * per_info is found in the thread structure 
 		 */
 		offset = addr - (addr_t) &dummy->regs.per_info;
-		*(__u32 *)((addr_t) &child->thread.per_info + offset) = data;
+		*(addr_t *)((addr_t) &child->thread.per_info + offset) = data;
 
 	}
 
@@ -197,31 +221,17 @@
 }
 
 static int
-do_ptrace(struct task_struct *child, long request, long addr, long data)
+do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
 {
 	unsigned long tmp;
 	ptrace_area parea; 
 	int copied, ret;
 
-	if (request == PTRACE_ATTACH)
-		return ptrace_attach(child);
-
-	/*
-	 * I added child != current line so we can get the
-	 * ieee_instruction_pointer from the user structure DJB
-	 */
-	if (child != current) {
-		ret = ptrace_check_attach(child, request == PTRACE_KILL);
-		if (ret < 0)
-			return ret;
-	}
-
-	/* Remove high order bit from address. */
-	addr &= PSW_ADDR_INSN;
-
 	switch (request) {
 	case PTRACE_PEEKTEXT:
 	case PTRACE_PEEKDATA:
+		/* Remove high order bit from address (only for 31 bit). */
+		addr &= PSW_ADDR_INSN;
 		/* read word at location addr. */
 		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
 		if (copied != sizeof(tmp))
@@ -234,6 +244,8 @@
 
 	case PTRACE_POKETEXT:
 	case PTRACE_POKEDATA:
+		/* Remove high order bit from address (only for 31 bit). */
+		addr &= PSW_ADDR_INSN;
 		/* write the word at location addr. */
 		copied = access_process_vm(child, addr, &data, sizeof(data),1);
 		if (copied != sizeof(data))
@@ -244,6 +256,272 @@
 		/* write the word at location addr in the USER area */
 		return poke_user(child, addr, data);
 
+	case PTRACE_PEEKUSR_AREA:
+	case PTRACE_POKEUSR_AREA:
+		if (!copy_from_user(&parea, (void *) addr, sizeof(parea)))
+			return -EFAULT;
+		addr = parea.kernel_addr;
+		data = parea.process_addr;
+		copied = 0;
+		while (copied < parea.len) {
+			if (request == PTRACE_PEEKUSR_AREA)
+				ret = peek_user(child, addr, data);
+			else
+				ret = poke_user(child, addr, data);
+			if (ret)
+				return ret;
+			addr += sizeof(unsigned long);
+			data += sizeof(unsigned long);
+			copied += sizeof(unsigned long);
+		}
+		return 0;
+	}
+	return ptrace_request(child, request, addr, data);
+}
+
+#ifdef CONFIG_S390_SUPPORT
+/*
+ * Now the fun part starts... a 31 bit program running in the
+ * 31 bit emulation tracing another program. PTRACE_PEEKTEXT,
+ * PTRACE_PEEKDATA, PTRACE_POKETEXT and PTRACE_POKEDATA are easy
+ * to handle, the difference to the 64 bit versions of the requests
+ * is that the access is done in multiples of 4 byte instead of
+ * 8 bytes (sizeof(unsigned long) on 31/64 bit).
+ * The ugly part are PTRACE_PEEKUSR, PTRACE_PEEKUSR_AREA,
+ * PTRACE_POKEUSR and PTRACE_POKEUSR_AREA. If the traced program
+ * is a 31 bit program too, the content of struct user can be
+ * emulated. A 31 bit program peeking into the struct user of
+ * a 64 bit program is a no-no.
+ */
+
+/*
+ * Same as peek_user but for a 31 bit program.
+ */
+static int
+peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
+{
+	struct user32 *dummy32 = NULL;
+	per_struct32 *dummy_per32 = NULL;
+	addr_t offset;
+	__u32 tmp;
+
+	if (!test_thread_flag(TIF_31BIT) ||
+	    (addr & 3) || addr > sizeof(struct user) - 3)
+		return -EIO;
+
+	if (addr <= (addr_t) &dummy32->regs.orig_gpr2) {
+		/*
+		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
+		 */
+		if (addr == (addr_t) &dummy32->regs.psw.mask) {
+			/* Fake a 31 bit psw mask. */
+			tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32);
+			tmp = (tmp & PSW32_MASK_CC) | PSW32_USER_BITS;
+		} else if (addr == (addr_t) &dummy32->regs.psw.addr) {
+			/* Fake a 31 bit psw address. */
+			tmp = (__u32) __KSTK_PTREGS(child)->psw.addr |
+				PSW32_ADDR_AMODE31;
+		} else
+			tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + 
+					 addr*2 + 4);
+	} else if (addr >= (addr_t) &dummy32->regs.fp_regs &&
+		   addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
+		/*
+		 * floating point regs. are stored in the thread structure 
+		 */
+	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
+		tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);
+
+	} else if (addr >= (addr_t) &dummy32->regs.per_info &&
+		   addr < (addr_t) (&dummy32->regs.per_info + 1)) {
+		/*
+		 * per_info is found in the thread structure
+		 */
+		offset = addr - (addr_t) &dummy32->regs.per_info;
+		/* This is magic. See per_struct and per_struct32. */
+		if ((offset >= (addr_t) &dummy_per32->control_regs &&
+		     offset < (addr_t) (&dummy_per32->control_regs + 1)) ||
+		    (offset >= (addr_t) &dummy_per32->starting_addr &&
+		     offset <= (addr_t) &dummy_per32->ending_addr) ||
+		    offset == (addr_t) &dummy_per32->lowcore.words.address)
+			offset = offset*2 + 4;
+		else
+			offset = offset*2;
+		tmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);
+
+	} else
+		tmp = 0;
+
+	return put_user(tmp, (__u32 *) data);
+}
+
+/*
+ * Same as poke_user but for a 31 bit program.
+ */
+static int
+poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
+{
+	struct user32 *dummy32 = NULL;
+	per_struct32 *dummy_per32 = NULL;
+	addr_t offset;
+	__u32 tmp;
+
+	if (!test_thread_flag(TIF_31BIT) ||
+	    (addr & 3) || addr > sizeof(struct user32) - 3)
+		return -EIO;
+
+	tmp = (__u32) data;
+
+	if (addr <= (addr_t) &dummy32->regs.orig_gpr2) {
+		/*
+		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
+		 */
+		if (addr == (addr_t) &dummy32->regs.psw.mask) {
+			/* Build a 64 bit psw mask from 31 bit mask. */
+			if ((tmp & ~PSW32_MASK_CC) != PSW32_USER_BITS)
+				/* Invalid psw mask. */
+				return -EINVAL;
+			__KSTK_PTREGS(child)->psw.mask = PSW_USER_BITS |
+				((tmp & PSW32_MASK_CC) << 32);
+		} else if (addr == (addr_t) &dummy32->regs.psw.addr) {
+			/* Build a 64 bit psw address from 31 bit address. */
+			__KSTK_PTREGS(child)->psw.addr = 
+				(__u64) tmp & PSW32_ADDR_INSN;
+		} else
+			*(__u32*)((addr_t) __KSTK_PTREGS(child) + addr*2 + 4) =
+				tmp;
+	} else if (addr >= (addr_t) &dummy32->regs.fp_regs &&
+		   addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
+		/*
+		 * floating point regs. are stored in the thread structure 
+		 */
+		if (addr == (addr_t) &dummy32->regs.fp_regs.fpc &&
+		    (tmp & ~FPC_VALID_MASK) != 0)
+			/* Invalid floating point control. */
+			return -EINVAL;
+	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
+		*(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp;
+
+	} else if (addr >= (addr_t) &dummy32->regs.per_info &&
+		   addr < (addr_t) (&dummy32->regs.per_info + 1)) {
+		/*
+		 * per_info is found in the thread structure.
+		 */
+		offset = addr - (addr_t) &dummy32->regs.per_info;
+		/*
+		 * This is magic. See per_struct and per_struct32.
+		 * By incident the offsets in per_struct are exactly
+		 * twice the offsets in per_struct32 for all fields.
+		 * The 8 byte fields need special handling though,
+		 * because the second half (bytes 4-7) is needed and
+		 * not the first half.
+		 */
+		if ((offset >= (addr_t) &dummy_per32->control_regs &&
+		     offset < (addr_t) (&dummy_per32->control_regs + 1)) ||
+		    (offset >= (addr_t) &dummy_per32->starting_addr &&
+		     offset <= (addr_t) &dummy_per32->ending_addr) ||
+		    offset == (addr_t) &dummy_per32->lowcore.words.address)
+			offset = offset*2 + 4;
+		else
+			offset = offset*2;
+		*(__u32 *)((addr_t) &child->thread.per_info + offset) = tmp;
+
+	}
+
+	FixPerRegisters(child);
+	return 0;
+}
+
+static int
+do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
+{
+	unsigned int tmp;  /* 4 bytes !! */
+	ptrace_area_emu31 parea; 
+	int copied, ret;
+
+	switch (request) {
+	case PTRACE_PEEKTEXT:
+	case PTRACE_PEEKDATA:
+		/* read word at location addr. */
+		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
+		if (copied != sizeof(tmp))
+			return -EIO;
+		return put_user(tmp, (unsigned int *) data);
+
+	case PTRACE_PEEKUSR:
+		/* read the word at location addr in the USER area. */
+		return peek_user_emu31(child, addr, data);
+
+	case PTRACE_POKETEXT:
+	case PTRACE_POKEDATA:
+		/* write the word at location addr. */
+		tmp = data;
+		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1);
+		if (copied != sizeof(tmp))
+			return -EIO;
+		return 0;
+
+	case PTRACE_POKEUSR:
+		/* write the word at location addr in the USER area */
+		return poke_user_emu31(child, addr, data);
+
+	case PTRACE_PEEKUSR_AREA:
+	case PTRACE_POKEUSR_AREA:
+		if (!copy_from_user(&parea, (void *) addr, sizeof(parea)))
+			return -EFAULT;
+		addr = parea.kernel_addr;
+		data = parea.process_addr;
+		copied = 0;
+		while (copied < parea.len) {
+			if (request == PTRACE_PEEKUSR_AREA)
+				ret = peek_user_emu31(child, addr, data);
+			else
+				ret = poke_user_emu31(child, addr, data);
+			if (ret)
+				return ret;
+			addr += sizeof(unsigned int);
+			data += sizeof(unsigned int);
+			copied += sizeof(unsigned int);
+		}
+		return 0;
+	}
+	return ptrace_request(child, request, addr, data);
+}
+#endif
+
+#define PT32_IEEE_IP 0x13c
+
+static int
+do_ptrace(struct task_struct *child, long request, long addr, long data)
+{
+	int ret;
+
+	if (request == PTRACE_ATTACH)
+		return ptrace_attach(child);
+
+	/*
+	 * Special cases to get/store the ieee instructions pointer.
+	 */
+	if (child == current) {
+		if (request == PTRACE_PEEKUSR && addr == PT_IEEE_IP)
+			return peek_user(child, addr, data);
+		if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
+			return poke_user(child, addr, data);
+#ifdef CONFIG_S390_SUPPORT
+		if (request == PTRACE_PEEKUSR &&
+		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
+			return peek_user_emu31(child, addr, data);
+		if (request == PTRACE_POKEUSR &&
+		    addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
+			return poke_user_emu31(child, addr, data);
+#endif
+	}
+
+	ret = ptrace_check_attach(child, request == PTRACE_KILL);
+	if (ret < 0)
+		return ret;
+
+	switch (request) {
 	case PTRACE_SYSCALL:
 		/* continue and stop at next (return from) syscall */
 	case PTRACE_CONT:
@@ -289,30 +567,21 @@
 		/* detach a process that was attached. */
 		return ptrace_detach(child, data);
 
-	case PTRACE_PEEKUSR_AREA:
-	case PTRACE_POKEUSR_AREA:
-		if (!copy_from_user(&parea, (void *) addr, sizeof(parea)))
-			return -EFAULT;
-		addr = parea.kernel_addr;
-		data = parea.process_addr;
-		copied = 0;
-		while (copied < parea.len) {
-			if (request == PTRACE_PEEKUSR_AREA)
-				ret = peek_user(child, addr, data);
-			else
-				ret = poke_user(child, addr, data);
-			if (ret)
-				return ret;
-			addr += sizeof(unsigned long);
-			data += sizeof(unsigned long);
-			copied += sizeof(unsigned long);
-		}
-		return 0;
+
+	/* Do requests that differ for 31/64 bit */
+	default:
+#ifdef CONFIG_S390_SUPPORT
+		if (test_thread_flag(TIF_31BIT))
+			return do_ptrace_emu31(child, request, addr, data);
+#endif
+		return do_ptrace_normal(child, request, addr, data);
 	}
-	return ptrace_request(child, request, addr, data);
+	/* Not reached.  */
+	return -EIO;
 }
 
-asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
+asmlinkage int
+sys_ptrace(long request, long pid, long addr, long data)
 {
 	struct task_struct *child;
 	int ret;
@@ -353,7 +622,8 @@
 	return ret;
 }
 
-asmlinkage void syscall_trace(void)
+asmlinkage void
+syscall_trace(void)
 {
 	if (!test_thread_flag(TIF_SYSCALL_TRACE))
 		return;
diff -urN linux-2.5.67-bk5/arch/s390/kernel/reipl64.S linux-2.5.67-bk6/arch/s390/kernel/reipl64.S
--- linux-2.5.67-bk5/arch/s390/kernel/reipl64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/reipl64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,96 @@
+/*
+ *  arch/s390/kernel/reipl.S
+ *
+ *  S390 version
+ *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
+	         Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
+ */
+
+#include <asm/lowcore.h>
+		.globl	do_reipl
+do_reipl:	basr	%r13,0
+.Lpg0:		lpswe   .Lnewpsw-.Lpg0(%r13)
+.Lpg1:		lctlg	%c6,%c6,.Lall-.Lpg0(%r13)
+                stctg   %c0,%c0,.Lctlsave-.Lpg0(%r13)
+                ni      .Lctlsave+4-.Lpg0(%r13),0xef
+                lctlg   %c0,%c0,.Lctlsave-.Lpg0(%r13)
+                lgr     %r1,%r2
+        	mvc     __LC_PGM_NEW_PSW(16),.Lpcnew-.Lpg0(%r13)
+                stsch   .Lschib-.Lpg0(%r13)                                    
+	        oi      .Lschib+5-.Lpg0(%r13),0x84 
+.Lecs:  	xi      .Lschib+27-.Lpg0(%r13),0x01 
+        	msch    .Lschib-.Lpg0(%r13) 
+	        lghi    %r0,5
+.Lssch:		ssch	.Liplorb-.Lpg0(%r13)           
+		jz	.L001
+		brct    %r0,.Lssch   
+		bas	%r14,.Ldisab-.Lpg0(%r13)
+.L001:		mvc	__LC_IO_NEW_PSW(16),.Lionew-.Lpg0(%r13)	
+.Ltpi:		lpswe	.Lwaitpsw-.Lpg0(%r13)          
+.Lcont:		c	%r1,__LC_SUBCHANNEL_ID
+		jnz	.Ltpi
+		clc	__LC_IO_INT_PARM(4),.Liplorb-.Lpg0(%r13)
+		jnz	.Ltpi
+		tsch	.Liplirb-.Lpg0(%r13)           
+		tm	.Liplirb+9-.Lpg0(%r13),0xbf
+                jz      .L002
+                bas     %r14,.Ldisab-.Lpg0(%r13)    
+.L002:		tm	.Liplirb+8-.Lpg0(%r13),0xf3    
+                jz      .L003
+                bas     %r14,.Ldisab-.Lpg0(%r13)	
+.L003:		spx	.Lnull-.Lpg0(%r13)
+		st 	%r1,__LC_SUBCHANNEL_ID
+                lhi     %r1,0            # mode 0 = esa
+                slr     %r0,%r0          # set cpuid to zero
+                sigp    %r1,%r0,0x12     # switch to esa mode
+                lpsw 	0
+.Ldisab:	sll    %r14,1
+		srl    %r14,1            # need to kill hi bit to avoid specification exceptions.
+		st     %r14,.Ldispsw+12-.Lpg0(%r13)
+		lpswe	.Ldispsw-.Lpg0(%r13)
+                .align 	8
+.Lall:		.quad	0x00000000ff000000
+.Lctlsave:      .quad   0x0000000000000000
+.Lnull:		.long   0x0000000000000000
+                .align 	16
+/*
+ * These addresses have to be 31 bit otherwise
+ * the sigp will throw a specifcation exception
+ * when switching to ESA mode as bit 31 be set
+ * in the ESA psw.
+ * Bit 31 of the addresses has to be 0 for the
+ * 31bit lpswe instruction a fact they appear to have
+ * ommited from the pop.
+ */
+.Lnewpsw:	.quad   0x0000000080000000
+		.quad   .Lpg1
+.Lpcnew:	.quad   0x0000000080000000
+	  	.quad   .Lecs
+.Lionew:	.quad   0x0000000080000000
+		.quad   .Lcont
+.Lwaitpsw:	.quad	0x0202000080000000
+		.quad   .Ltpi
+.Ldispsw:	.quad   0x0002000080000000
+		.quad   0x0000000000000000
+.Liplccws:	.long   0x02000000,0x60000018
+		.long   0x08000008,0x20000001
+.Liplorb:	.long	0x0049504c,0x0040ff80
+		.long	0x00000000+.Liplccws
+.Lschib:        .long   0x00000000,0x00000000
+		.long   0x00000000,0x00000000
+		.long   0x00000000,0x00000000
+		.long   0x00000000,0x00000000
+		.long   0x00000000,0x00000000
+		.long   0x00000000,0x00000000
+.Liplirb:	.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+		.long	0x00000000,0x00000000
+	
+
+	
diff -urN linux-2.5.67-bk5/arch/s390/kernel/s390_ksyms.c linux-2.5.67-bk6/arch/s390/kernel/s390_ksyms.c
--- linux-2.5.67-bk5/arch/s390/kernel/s390_ksyms.c	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/s390_ksyms.c	2003-04-15 04:36:14.000000000 -0700
@@ -4,11 +4,14 @@
  *  S390 version
  */
 #include <linux/config.h>
+#include <linux/highuid.h>
 #include <linux/module.h>
+#include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
 #include <asm/checksum.h>
 #include <asm/delay.h>
+#include <asm/pgalloc.h>
 #include <asm/setup.h>
 #if CONFIG_IP_MULTICAST
 #include <net/arp.h>
@@ -50,6 +53,28 @@
 EXPORT_SYMBOL_NOVERS(strpbrk);
 
 /*
+ * binfmt_elf loader 
+ */
+extern int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs);
+EXPORT_SYMBOL(dump_fpu);
+EXPORT_SYMBOL(overflowuid);
+EXPORT_SYMBOL(overflowgid);
+
+#ifdef CONFIG_S390_SUPPORT
+/*
+ * Dynamically add/remove 31 bit ioctl conversion functions.
+ */
+extern int register_ioctl32_conversion(unsigned int cmd,
+				       int (*handler)(unsigned int, 
+						      unsigned int,
+						      unsigned long,
+						      struct file *));
+int unregister_ioctl32_conversion(unsigned int cmd);
+EXPORT_SYMBOL(register_ioctl32_conversion);
+EXPORT_SYMBOL(unregister_ioctl32_conversion);
+#endif
+
+/*
  * misc.
  */
 EXPORT_SYMBOL(machine_flags);
diff -urN linux-2.5.67-bk5/arch/s390/kernel/setup.c linux-2.5.67-bk6/arch/s390/kernel/setup.c
--- linux-2.5.67-bk5/arch/s390/kernel/setup.c	2003-04-07 10:30:41.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/setup.c	2003-04-15 04:36:14.000000000 -0700
@@ -41,6 +41,7 @@
 #include <asm/smp.h>
 #include <asm/mmu_context.h>
 #include <asm/cpcmd.h>
+#include <asm/lowcore.h>
 
 /*
  * Machine setup..
@@ -323,15 +324,22 @@
         /*
          * print what head.S has found out about the machine 
          */
+#ifndef CONFIG_ARCH_S390X
 	printk((MACHINE_IS_VM) ?
 	       "We are running under VM (31 bit mode)\n" :
 	       "We are running native (31 bit mode)\n");
 	printk((MACHINE_HAS_IEEE) ?
 	       "This machine has an IEEE fpu\n" :
 	       "This machine has no IEEE fpu\n");
+#else /* CONFIG_ARCH_S390X */
+	printk((MACHINE_IS_VM) ?
+	       "We are running under VM (64 bit mode)\n" :
+	       "We are running native (64 bit mode)\n");
+#endif /* CONFIG_ARCH_S390X */
 
         ROOT_DEV = Root_RAM0;
         memory_start = (unsigned long) &_end;    /* fixit if use $CODELO etc*/
+#ifndef CONFIG_ARCH_S390X
 	memory_end = memory_size & ~0x400000UL;  /* align memory end to 4MB */
         /*
          * We need some free virtual space to be able to do vmalloc.
@@ -340,6 +348,9 @@
          */
         if (memory_end > 1920*1024*1024)
                 memory_end = 1920*1024*1024;
+#else /* CONFIG_ARCH_S390X */
+	memory_end = memory_size & ~0x200000UL;  /* detected in head.s */
+#endif /* CONFIG_ARCH_S390X */
         init_mm.start_code = PAGE_OFFSET;
         init_mm.end_code = (unsigned long) &_etext;
         init_mm.end_data = (unsigned long) &_edata;
@@ -460,26 +471,46 @@
         /*
          * Setup lowcore for boot cpu
          */
+#ifndef CONFIG_ARCH_S390X
 	lc = (struct _lowcore *) __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0);
 	memset(lc, 0, PAGE_SIZE);
+#else /* CONFIG_ARCH_S390X */
+	lc = (struct _lowcore *) __alloc_bootmem(2*PAGE_SIZE, 2*PAGE_SIZE, 0);
+	memset(lc, 0, 2*PAGE_SIZE);
+#endif /* CONFIG_ARCH_S390X */
 	lc->restart_psw.mask = PSW_BASE_BITS;
-	lc->restart_psw.addr = PSW_ADDR_AMODE31 + (__u32) restart_int_handler;
+	lc->restart_psw.addr =
+		PSW_ADDR_AMODE + (unsigned long) restart_int_handler;
 	lc->external_new_psw.mask = PSW_KERNEL_BITS;
-	lc->external_new_psw.addr = PSW_ADDR_AMODE31 + (__u32) ext_int_handler;
+	lc->external_new_psw.addr =
+		PSW_ADDR_AMODE + (unsigned long) ext_int_handler;
 	lc->svc_new_psw.mask = PSW_KERNEL_BITS;
-	lc->svc_new_psw.addr = PSW_ADDR_AMODE31 + (__u32) system_call;
+	lc->svc_new_psw.addr = PSW_ADDR_AMODE + (unsigned long) system_call;
 	lc->program_new_psw.mask = PSW_KERNEL_BITS;
-	lc->program_new_psw.addr = PSW_ADDR_AMODE31 + (__u32)pgm_check_handler;
-        lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
-	lc->mcck_new_psw.addr = PSW_ADDR_AMODE31 + (__u32) mcck_int_handler;
+	lc->program_new_psw.addr =
+		PSW_ADDR_AMODE + (unsigned long)pgm_check_handler;
+	lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
+	lc->mcck_new_psw.addr =
+		PSW_ADDR_AMODE + (unsigned long) mcck_int_handler;
 	lc->io_new_psw.mask = PSW_KERNEL_BITS;
-	lc->io_new_psw.addr = PSW_ADDR_AMODE31 + (__u32) io_int_handler;
+	lc->io_new_psw.addr = PSW_ADDR_AMODE + (unsigned long) io_int_handler;
 	lc->ipl_device = S390_lowcore.ipl_device;
+	lc->jiffy_timer = -1LL;
+#ifndef CONFIG_ARCH_S390X
 	lc->kernel_stack = ((__u32) &init_thread_union) + 8192;
 	lc->async_stack = (__u32)
 		__alloc_bootmem(2*PAGE_SIZE, 2*PAGE_SIZE, 0) + 8192;
-	lc->jiffy_timer = -1LL;
 	set_prefix((__u32) lc);
+#else /* CONFIG_ARCH_S390X */
+	lc->kernel_stack = ((__u64) &init_thread_union) + 16384;
+	lc->async_stack = (__u64)
+		__alloc_bootmem(4*PAGE_SIZE, 4*PAGE_SIZE, 0) + 16384;
+	if (MACHINE_HAS_DIAG44)
+		lc->diag44_opcode = 0x83000044;
+	else
+		lc->diag44_opcode = 0x07000700;
+	set_prefix((__u32)(__u64) lc);
+#endif /* CONFIG_ARCH_S390X */
         cpu_init();
         __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
 
@@ -534,10 +565,14 @@
 			       (loops_per_jiffy/(5000/HZ))%100);
 	}
 	if (cpu_online_map & (1 << n)) {
+#ifdef CONFIG_SMP
 		if (smp_processor_id() == n)
 			cpuinfo = &S390_lowcore.cpu_data;
 		else
 			cpuinfo = &lowcore_ptr[n]->cpu_data;
+#else
+		cpuinfo = &S390_lowcore.cpu_data;
+#endif
 		seq_printf(m, "processor %li: "
 			       "version = %02X,  "
 			       "identification = %06X,  "
diff -urN linux-2.5.67-bk5/arch/s390/kernel/signal.c linux-2.5.67-bk6/arch/s390/kernel/signal.c
--- linux-2.5.67-bk5/arch/s390/kernel/signal.c	2003-04-07 10:32:21.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/signal.c	2003-04-15 04:36:14.000000000 -0700
@@ -29,6 +29,7 @@
 #include <linux/binfmts.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
+#include <asm/lowcore.h>
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
@@ -145,7 +146,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 *sregs)
 {
 	int err;
   
@@ -157,18 +158,18 @@
 	 * to merge them with the emulated registers.
 	 */
 	save_fp_regs(&current->thread.fp_regs);
-	return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs, 
+	return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs,
 			      sizeof(s390_fp_regs));
 }
 
 /* Returns positive number on error */
-static int restore_sigregs(struct pt_regs *regs,_sigregs *sregs)
+static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
 {
 	int err;
 
 	err = __copy_from_user(regs, &sregs->regs, sizeof(_s390_regs_common));
 	regs->psw.mask = PSW_USER_BITS | (regs->psw.mask & PSW_MASK_CC);
-	regs->psw.addr |= PSW_ADDR_AMODE31;
+	regs->psw.addr |= PSW_ADDR_AMODE;
 	if (err)
 		return err;
 
@@ -298,9 +299,11 @@
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
 	if (ka->sa.sa_flags & SA_RESTORER) {
-                regs->gprs[14] = (__u32) ka->sa.sa_restorer | PSW_ADDR_AMODE31;
+                regs->gprs[14] = (unsigned long)
+			ka->sa.sa_restorer | PSW_ADDR_AMODE;
 	} else {
-                regs->gprs[14] = (__u32) frame->retcode | PSW_ADDR_AMODE31;
+                regs->gprs[14] = (unsigned long)
+			frame->retcode | PSW_ADDR_AMODE;
 		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 
 	                       (u16 *)(frame->retcode)))
 			goto give_sigsegv;
@@ -311,12 +314,12 @@
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u32) frame;
-	regs->psw.addr = (__u32) ka->sa.sa_handler | PSW_ADDR_AMODE31;
+	regs->gprs[15] = (unsigned long) frame;
+	regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
 	regs->psw.mask = PSW_USER_BITS;
 
 	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u32) &frame->sc;
+	regs->gprs[3] = (unsigned long) &frame->sc;
 
 	/* We forgot to include these in the sigcontext.
 	   To avoid breaking binary compatibility, they are passed as args. */
@@ -356,9 +359,11 @@
 	/* Set up to return from userspace.  If provided, use a stub
 	   already in userspace.  */
 	if (ka->sa.sa_flags & SA_RESTORER) {
-                regs->gprs[14] = (__u32) ka->sa.sa_restorer | PSW_ADDR_AMODE31;
+                regs->gprs[14] = (unsigned long)
+			ka->sa.sa_restorer | PSW_ADDR_AMODE;
 	} else {
-                regs->gprs[14] = (__u32) frame->retcode | PSW_ADDR_AMODE31;
+                regs->gprs[14] = (unsigned long)
+			frame->retcode | PSW_ADDR_AMODE;
 		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 
 	                          (u16 *)(frame->retcode));
 	}
@@ -368,13 +373,13 @@
 		goto give_sigsegv;
 
 	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u32) frame;
-	regs->psw.addr = (__u32) ka->sa.sa_handler | PSW_ADDR_AMODE31;
+	regs->gprs[15] = (unsigned long) frame;
+	regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
 	regs->psw.mask = PSW_USER_BITS;
 
 	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u32) &frame->info;
-	regs->gprs[4] = (__u32) &frame->uc;
+	regs->gprs[3] = (unsigned long) &frame->info;
+	regs->gprs[4] = (unsigned long) &frame->uc;
 	return;
 
 give_sigsegv:
@@ -460,6 +465,13 @@
 
 	if (!oldset)
 		oldset = &current->blocked;
+#ifdef CONFIG_S390_SUPPORT 
+	if (test_thread_flag(TIF_31BIT)) {
+		extern asmlinkage int do_signal32(struct pt_regs *regs,
+						  sigset_t *oldset); 
+		return do_signal32(regs, oldset);
+        }
+#endif 
 
 	signr = get_signal_to_deliver(&info, regs, NULL);
 	if (signr > 0) {
diff -urN linux-2.5.67-bk5/arch/s390/kernel/smp.c linux-2.5.67-bk6/arch/s390/kernel/smp.c
--- linux-2.5.67-bk5/arch/s390/kernel/smp.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/smp.c	2003-04-15 04:36:14.000000000 -0700
@@ -171,7 +171,7 @@
 
         /* store status of all processors in their lowcores (real 0) */
         for (i =  0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i)
+                if (!cpu_online(i) || smp_processor_id() == i) 
 			continue;
 		low_core_addr = (unsigned long) lowcore_ptr[i];
 		do {
@@ -310,13 +310,11 @@
  */
 static void smp_ext_bitcall_others(ec_bit_sig sig)
 {
-        struct _lowcore *lowcore;
         int i;
 
         for (i = 0; i < NR_CPUS; i++) {
                 if (!cpu_online(i) || smp_processor_id() == i)
                         continue;
-                lowcore = lowcore_ptr[i];
                 /*
                  * Set signaling bit in lowcore of target cpu and kick it
                  */
@@ -326,6 +324,7 @@
         }
 }
 
+#ifndef CONFIG_ARCH_S390X
 /*
  * this function sends a 'purge tlb' signal to another CPU.
  */
@@ -338,6 +337,7 @@
 {
         on_each_cpu(smp_ptlb_callback, NULL, 0, 1);
 }
+#endif /* ! CONFIG_ARCH_S390X */
 
 /*
  * this function sends a 'reschedule' IPI to another CPU.
@@ -356,8 +356,8 @@
 {
 	__u16 start_ctl;
 	__u16 end_ctl;
-	__u32 orvals[16];
-	__u32 andvals[16];
+	unsigned long orvals[16];
+	unsigned long andvals[16];
 } ec_creg_mask_parms;
 
 /*
@@ -365,25 +365,14 @@
  */
 void smp_ctl_bit_callback(void *info) {
 	ec_creg_mask_parms *pp;
-	u32 cregs[16];
+	unsigned long cregs[16];
 	int i;
 	
 	pp = (ec_creg_mask_parms *) info;
-	asm volatile ("   bras  1,0f\n"
-		      "   stctl 0,0,0(%0)\n"
-		      "0: ex    %1,0(1)\n"
-		      : : "a" (cregs+pp->start_ctl),
-		          "a" ((pp->start_ctl<<4) + pp->end_ctl)
-		      : "memory", "1" );
+	__ctl_store(cregs[pp->start_ctl], pp->start_ctl, pp->end_ctl);
 	for (i = pp->start_ctl; i <= pp->end_ctl; i++)
 		cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i];
-	asm volatile ("   bras  1,0f\n"
-		      "   lctl 0,0,0(%0)\n"
-		      "0: ex    %1,0(1)\n"
-		      : : "a" (cregs+pp->start_ctl),
-		          "a" ((pp->start_ctl<<4) + pp->end_ctl)
-		      : "memory", "1" );
-	return;
+	__ctl_load(cregs[pp->start_ctl], pp->start_ctl, pp->end_ctl);
 }
 
 /*
@@ -395,7 +384,7 @@
 	parms.start_ctl = cr;
 	parms.end_ctl = cr;
 	parms.orvals[cr] = 1 << bit;
-	parms.andvals[cr] = 0xFFFFFFFF;
+	parms.andvals[cr] = -1L;
 	preempt_disable();
 	smp_call_function(smp_ctl_bit_callback, &parms, 0, 1);
         __ctl_set_bit(cr, bit);
@@ -410,8 +399,8 @@
 
 	parms.start_ctl = cr;
 	parms.end_ctl = cr;
-	parms.orvals[cr] = 0x00000000;
-	parms.andvals[cr] = ~(1 << bit);
+	parms.orvals[cr] = 0;
+	parms.andvals[cr] = ~(1L << bit);
 	preempt_disable();
 	smp_call_function(smp_ctl_bit_callback, &parms, 0, 1);
         __ctl_clear_bit(cr, bit);
@@ -493,7 +482,7 @@
 	 *  Set prefix page for new cpu
 	 */
 
-	ccode = signal_processor_p((u32)(lowcore_ptr[cpu]),
+	ccode = signal_processor_p((unsigned long)(lowcore_ptr[cpu]),
 				   cpu, sigp_set_prefix);
 	if (ccode){
 		printk("sigp_set_prefix failed for cpu %d "
@@ -502,7 +491,6 @@
 		return -EIO;
 	}
 
-
         /* We can't use kernel_thread since we must _avoid_ to reschedule
            the child. */
         idle = fork_by_hand();
@@ -521,15 +509,13 @@
 
         cpu_lowcore = lowcore_ptr[cpu];
 	cpu_lowcore->save_area[15] = idle->thread.ksp;
-	cpu_lowcore->kernel_stack = (__u32) idle->thread_info + (2*PAGE_SIZE);
-        __asm__ __volatile__("la    1,%0\n\t"
-			     "stctl 0,15,0(1)\n\t"
-			     "la    1,%1\n\t"
-                             "stam  0,15,0(1)"
-                             : "=m" (cpu_lowcore->cregs_save_area[0]),
-                               "=m" (cpu_lowcore->access_regs_save_area[0])
-                             : : "1", "memory");
-
+	cpu_lowcore->kernel_stack = (unsigned long)
+		idle->thread_info + (THREAD_SIZE);
+	__ctl_store(cpu_lowcore->cregs_save_area[0], 0, 15);
+	__asm__ __volatile__("la    1,%0\n\t"
+			     "stam  0,15,0(1)"
+			     : "=m" (cpu_lowcore->access_regs_save_area[0])
+			     : : "1", "memory");
         eieio();
         signal_processor(cpu,sigp_restart);
 
@@ -551,7 +537,6 @@
                 panic("Couldn't request external interrupt 0x1202");
         smp_check_cpus(max_cpus);
         memset(lowcore_ptr,0,sizeof(lowcore_ptr));  
-
         /*
          *  Initialize prefix pages and stacks for all possible cpus
          */
@@ -561,15 +546,16 @@
 		if (!cpu_possible(i))
 			continue;
 		lowcore_ptr[i] = (struct _lowcore *)
-			__get_free_page(GFP_KERNEL|GFP_DMA);
-		async_stack = __get_free_pages(GFP_KERNEL,1);
-		if (lowcore_ptr[i] == NULL || async_stack == 0UL)
+			__get_free_pages(GFP_KERNEL|GFP_DMA, 
+					sizeof(void*) == 8 ? 1 : 0);
+		async_stack = __get_free_pages(GFP_KERNEL,ASYNC_ORDER);
+		if (lowcore_ptr[i] == NULL || async_stack == 0ULL)
 			panic("smp_boot_cpus failed to allocate memory\n");
 
                 memcpy(lowcore_ptr[i], &S390_lowcore, sizeof(struct _lowcore));
-		lowcore_ptr[i]->async_stack = async_stack + (2 * PAGE_SIZE);
+		lowcore_ptr[i]->async_stack = async_stack + (ASYNC_SIZE);
 	}
-	set_prefix((u32) lowcore_ptr[smp_processor_id()]);
+	set_prefix((u32)(unsigned long) lowcore_ptr[smp_processor_id()]);
 }
 
 void __devinit smp_prepare_boot_cpu(void)
diff -urN linux-2.5.67-bk5/arch/s390/kernel/sys_s390.c linux-2.5.67-bk6/arch/s390/kernel/sys_s390.c
--- linux-2.5.67-bk5/arch/s390/kernel/sys_s390.c	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/sys_s390.c	2003-04-15 04:36:14.000000000 -0700
@@ -24,15 +24,24 @@
 #include <linux/mman.h>
 #include <linux/file.h>
 #include <linux/utsname.h>
+#ifdef CONFIG_ARCH_S390X
+#include <linux/personality.h>
+#endif /* CONFIG_ARCH_S390X */
 
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
 
+#ifndef CONFIG_ARCH_S390X
+#define __SYS_RETTYPE int
+#else
+#define __SYS_RETTYPE long
+#endif /* CONFIG_ARCH_S390X */
+
 /*
  * sys_pipe() is the normal C calling standard for creating
  * a pipe. It's not the way Unix traditionally does this, though.
  */
-asmlinkage int sys_pipe(unsigned long * fildes)
+asmlinkage __SYS_RETTYPE sys_pipe(unsigned long * fildes)
 {
 	int fd[2];
 	int error;
@@ -51,7 +60,7 @@
 	unsigned long prot, unsigned long flags,
 	unsigned long fd, unsigned long pgoff)
 {
-	int error = -EBADF;
+	__SYS_RETTYPE error = -EBADF;
 	struct file * file = NULL;
 
 	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
@@ -99,10 +108,10 @@
 	return error;
 }
 
-asmlinkage int old_mmap(struct mmap_arg_struct *arg)
+asmlinkage __SYS_RETTYPE old_mmap(struct mmap_arg_struct *arg)
 {
 	struct mmap_arg_struct a;
-	int error = -EFAULT;
+	__SYS_RETTYPE error = -EFAULT;
 
 	if (copy_from_user(&a, arg, sizeof(a)))
 		goto out;
@@ -118,6 +127,7 @@
 
 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
+#ifndef CONFIG_ARCH_S390X
 struct sel_arg_struct {
 	unsigned long n;
 	fd_set *inp, *outp, *exp;
@@ -132,22 +142,61 @@
 		return -EFAULT;
 	/* sys_select() does the appropriate kernel locking */
 	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 */
 
 /*
  * sys_ipc() is the de-multiplexer for the SysV IPC calls..
  *
  * This is really horribly ugly.
  */
-asmlinkage int sys_ipc (uint call, int first, int second, 
-                        int third, void *ptr)
+asmlinkage __SYS_RETTYPE sys_ipc (uint call, int first, int second, 
+				  unsigned long third, void *ptr,
+				  unsigned long fifth)
 {
         struct ipc_kludge tmp;
 	int ret;
 
         switch (call) {
         case SEMOP:
-                return sys_semop (first, (struct sembuf *)ptr, second);
+		return sys_semtimedop (first, (struct sembuf *) ptr, second,
+				       NULL);
+	case SEMTIMEDOP:
+		return sys_semtimedop(first, (struct sembuf *) ptr, second,
+				      (const struct timespec *) fifth);
         case SEMGET:
                 return sys_semget (first, second, third);
         case SEMCTL: {
@@ -191,7 +240,7 @@
 		return sys_shmctl (first, second,
                                    (struct shmid_ds *) ptr);
 	default:
-		return -EINVAL;
+		return -ENOSYS;
 
 	}
         
@@ -212,6 +261,7 @@
 	return err?-EFAULT:0;
 }
 
+#ifndef CONFIG_ARCH_S390X
 asmlinkage int sys_olduname(struct oldold_utsname * name)
 {
 	int error;
@@ -243,6 +293,36 @@
 
 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
 {
-  return -ENOSYS;
+	return -ENOSYS;
+}
+
+#else /* CONFIG_ARCH_S390X */
+
+extern asmlinkage int sys_newuname(struct new_utsname * name);
+
+asmlinkage int s390x_newuname(struct new_utsname * name)
+{
+	int ret = sys_newuname(name);
+
+	if (current->personality == PER_LINUX32 && !ret) {
+		ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
+		if (ret) ret = -EFAULT;
+	}
+	return ret;
 }
 
+extern asmlinkage long sys_personality(unsigned long);
+
+asmlinkage int s390x_personality(unsigned long personality)
+{
+	int ret;
+
+	if (current->personality == PER_LINUX32 && personality == PER_LINUX)
+		personality = PER_LINUX32;
+	ret = sys_personality(personality);
+	if (ret == PER_LINUX32)
+		ret = PER_LINUX;
+
+	return ret;
+}
+#endif /* CONFIG_ARCH_S390X */
diff -urN linux-2.5.67-bk5/arch/s390/kernel/syscalls.S linux-2.5.67-bk6/arch/s390/kernel/syscalls.S
--- linux-2.5.67-bk5/arch/s390/kernel/syscalls.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/kernel/syscalls.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,273 @@
+/*
+ * definitions for sys_call_table, each line represents an
+ * entry in the table in the form 
+ * SYSCALL(31 bit syscall, 64 bit syscall, 31 bit emulated syscall)
+ *
+ * this file is meant to be included from entry.S and entry64.S
+ */
+
+#define NI_SYSCALL SYSCALL(sys_ni_syscall,sys_ni_syscall,sys_ni_syscall)
+
+NI_SYSCALL							/* 0 */
+SYSCALL(sys_exit,sys_exit,sys32_exit_wrapper)
+SYSCALL(sys_fork_glue,sys_fork_glue,sys_fork_glue)
+SYSCALL(sys_read,sys_read,sys32_read_wrapper)
+SYSCALL(sys_write,sys_write,sys32_write_wrapper)
+SYSCALL(sys_open,sys_open,sys32_open_wrapper)			/* 5 */
+SYSCALL(sys_close,sys_close,sys32_close_wrapper)
+SYSCALL(sys_restart_syscall,sys_restart_syscall,sys_ni_syscall)
+SYSCALL(sys_creat,sys_creat,sys32_creat_wrapper)
+SYSCALL(sys_link,sys_link,sys32_link_wrapper)
+SYSCALL(sys_unlink,sys_unlink,sys32_unlink_wrapper)		/* 10 */
+SYSCALL(sys_execve_glue,sys_execve_glue,sys32_execve_glue)
+SYSCALL(sys_chdir,sys_chdir,sys32_chdir_wrapper)
+SYSCALL(sys_time,sys_ni_syscall,sys32_time_wrapper)		/* old time syscall */
+SYSCALL(sys_mknod,sys_mknod,sys32_mknod_wrapper)
+SYSCALL(sys_chmod,sys_chmod,sys32_chmod_wrapper)		/* 15 */
+SYSCALL(sys_lchown16,sys_ni_syscall,sys32_lchown16_wrapper)	/* old lchown16 syscall*/
+NI_SYSCALL							/* old break syscall holder */
+NI_SYSCALL							/* old stat syscall holder */
+SYSCALL(sys_lseek,sys_lseek,sys32_lseek_wrapper)
+SYSCALL(sys_getpid,sys_getpid,sys_getpid)			/* 20 */
+SYSCALL(sys_mount,sys_mount,sys32_mount_wrapper)
+SYSCALL(sys_oldumount,sys_oldumount,sys32_oldumount_wrapper)
+SYSCALL(sys_setuid16,sys_ni_syscall,sys32_setuid16_wrapper)	/* old setuid16 syscall*/
+SYSCALL(sys_getuid16,sys_ni_syscall,sys32_getuid16)		/* old getuid16 syscall*/
+SYSCALL(sys_stime,sys_ni_syscall,sys32_stime_wrapper)		/* 25 old stime syscall */
+SYSCALL(sys_ptrace,sys_ptrace,sys32_ptrace_wrapper)
+SYSCALL(sys_alarm,sys_alarm,sys32_alarm_wrapper)
+NI_SYSCALL							/* old fstat syscall */
+SYSCALL(sys_pause,sys_pause,sys32_pause)
+SYSCALL(sys_utime,sys_utime,compat_sys_utime_wrapper)		/* 30 */
+NI_SYSCALL							/* old stty syscall */
+NI_SYSCALL							/* old gtty syscall */
+SYSCALL(sys_access,sys_access,sys32_access_wrapper)
+SYSCALL(sys_nice,sys_nice,sys32_nice_wrapper)
+NI_SYSCALL							/* 35 old ftime syscall */
+SYSCALL(sys_sync,sys_sync,sys_sync)
+SYSCALL(sys_kill,sys_kill,sys32_kill_wrapper)
+SYSCALL(sys_rename,sys_rename,sys32_rename_wrapper)
+SYSCALL(sys_mkdir,sys_mkdir,sys32_mkdir_wrapper)
+SYSCALL(sys_rmdir,sys_rmdir,sys32_rmdir_wrapper)		/* 40 */
+SYSCALL(sys_dup,sys_dup,sys32_dup_wrapper)
+SYSCALL(sys_pipe,sys_pipe,sys32_pipe_wrapper)
+SYSCALL(sys_times,sys_times,compat_sys_times_wrapper)
+NI_SYSCALL							/* old prof syscall */
+SYSCALL(sys_brk,sys_brk,sys32_brk_wrapper)			/* 45 */
+SYSCALL(sys_setgid16,sys_ni_syscall,sys32_setgid16)		/* old setgid16 syscall*/
+SYSCALL(sys_getgid16,sys_ni_syscall,sys32_getgid16)		/* old getgid16 syscall*/
+SYSCALL(sys_signal,sys_signal,sys32_signal_wrapper)
+SYSCALL(sys_geteuid16,sys_ni_syscall,sys32_geteuid16)		/* old geteuid16 syscall */
+SYSCALL(sys_getegid16,sys_ni_syscall,sys32_getegid16)		/* 50 old getegid16 syscall */
+SYSCALL(sys_acct,sys_acct,sys32_acct_wrapper)
+SYSCALL(sys_umount,sys_umount,sys32_umount_wrapper)
+NI_SYSCALL							/* old lock syscall */
+SYSCALL(sys_ioctl,sys_ioctl,sys32_ioctl_wrapper)
+SYSCALL(sys_fcntl,sys_fcntl,compat_sys_fcntl_wrapper)		/* 55 */
+NI_SYSCALL							/* intel mpx syscall */
+SYSCALL(sys_setpgid,sys_setpgid,sys32_setpgid_wrapper)
+NI_SYSCALL							/* old ulimit syscall */
+NI_SYSCALL							/* old uname syscall */
+SYSCALL(sys_umask,sys_umask,sys32_umask_wrapper)		/* 60 */
+SYSCALL(sys_chroot,sys_chroot,sys32_chroot_wrapper)
+SYSCALL(sys_ustat,sys_ustat,sys32_ustat_wrapper)
+SYSCALL(sys_dup2,sys_dup2,sys32_dup2_wrapper)
+SYSCALL(sys_getppid,sys_getppid,sys_getppid)
+SYSCALL(sys_getpgrp,sys_getpgrp,sys_getpgrp)			/* 65 */
+SYSCALL(sys_setsid,sys_setsid,sys_setsid)
+SYSCALL(sys_sigaction,sys_sigaction,sys32_sigaction_wrapper)
+NI_SYSCALL							/* old sgetmask syscall*/
+NI_SYSCALL							/* old ssetmask syscall*/
+SYSCALL(sys_setreuid16,sys_ni_syscall,sys32_setreuid16_wrapper)	/* old setreuid16 syscall */
+SYSCALL(sys_setregid16,sys_ni_syscall,sys32_setregid16_wrapper)	/* old setregid16 syscall */
+SYSCALL(sys_sigsuspend_glue,sys_sigsuspend_glue,sys32_sigsuspend_glue)
+SYSCALL(sys_sigpending,sys_sigpending,compat_sys_sigpending_wrapper)
+SYSCALL(sys_sethostname,sys_sethostname,sys32_sethostname_wrapper)
+SYSCALL(sys_setrlimit,sys_setrlimit,sys32_setrlimit_wrapper)	/* 75 */
+SYSCALL(sys_old_getrlimit,sys_getrlimit,sys32_old_getrlimit_wrapper)
+SYSCALL(sys_getrusage,sys_getrusage,sys32_getrusage_wrapper)
+SYSCALL(sys_gettimeofday,sys_gettimeofday,sys32_gettimeofday_wrapper)
+SYSCALL(sys_settimeofday,sys_settimeofday,sys32_settimeofday_wrapper)
+SYSCALL(sys_getgroups16,sys_ni_syscall,sys32_getgroups16_wrapper)	/* 80 old getgroups16 syscall */
+SYSCALL(sys_setgroups16,sys_ni_syscall,sys32_setgroups16_wrapper)	/* old setgroups16 syscall */
+NI_SYSCALL							/* old select syscall */
+SYSCALL(sys_symlink,sys_symlink,sys32_symlink_wrapper)
+NI_SYSCALL							/* old lstat syscall */
+SYSCALL(sys_readlink,sys_readlink,sys32_readlink_wrapper)	/* 85 */
+SYSCALL(sys_uselib,sys_uselib,sys32_uselib_wrapper)
+SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper)
+SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper)
+SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper)	/* old readdir syscall */
+SYSCALL(old_mmap,old_mmap,old32_mmap_wrapper)			/* 90 */
+SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper)
+SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper)
+SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper)
+SYSCALL(sys_fchmod,sys_fchmod,sys32_fchmod_wrapper)
+SYSCALL(sys_fchown16,sys_ni_syscall,sys32_fchown16_wrapper)	/* 95 old fchown16 syscall*/
+SYSCALL(sys_getpriority,sys_getpriority,sys32_getpriority_wrapper)
+SYSCALL(sys_setpriority,sys_setpriority,sys32_setpriority_wrapper)
+NI_SYSCALL							/* old profil syscall */
+SYSCALL(sys_statfs,sys_statfs,compat_sys_statfs_wrapper)
+SYSCALL(sys_fstatfs,sys_fstatfs,compat_sys_fstatfs_wrapper)	/* 100 */
+SYSCALL(sys_ioperm,sys_ni_syscall,sys_ni_syscall)
+SYSCALL(sys_socketcall,sys_socketcall,compat_sys_socketcall_wrapper)
+SYSCALL(sys_syslog,sys_syslog,sys32_syslog_wrapper)
+SYSCALL(sys_setitimer,sys_setitimer,compat_sys_setitimer_wrapper)
+SYSCALL(sys_getitimer,sys_getitimer,compat_sys_getitimer_wrapper)	/* 105 */
+SYSCALL(sys_newstat,sys_newstat,compat_sys_newstat_wrapper)
+SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper)
+SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper)
+NI_SYSCALL							/* old uname syscall */
+NI_SYSCALL							/* 110 iopl for i386 */
+SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
+NI_SYSCALL							/* old "idle" system call */
+NI_SYSCALL							/* vm86old for i386 */
+SYSCALL(sys_wait4,sys_wait4,sys32_wait4_wrapper)
+SYSCALL(sys_swapoff,sys_swapoff,sys32_swapoff_wrapper)		/* 115 */
+SYSCALL(sys_sysinfo,sys_sysinfo,sys32_sysinfo_wrapper)
+SYSCALL(sys_ipc,sys_ipc,sys32_ipc_wrapper)
+SYSCALL(sys_fsync,sys_fsync,sys32_fsync_wrapper)
+SYSCALL(sys_sigreturn_glue,sys_sigreturn_glue,sys32_sigreturn_glue)
+SYSCALL(sys_clone_glue,sys_clone_glue,sys32_clone_glue)		/* 120 */
+SYSCALL(sys_setdomainname,sys_setdomainname,sys32_setdomainname_wrapper)
+SYSCALL(sys_newuname,s390x_newuname,sys32_newuname_wrapper)
+NI_SYSCALL							/* modify_ldt for i386 */
+SYSCALL(sys_adjtimex,sys_adjtimex,sys32_adjtimex_wrapper)
+SYSCALL(sys_mprotect,sys_mprotect,sys32_mprotect_wrapper)	/* 125 */
+SYSCALL(sys_sigprocmask,sys_sigprocmask,compat_sys_sigprocmask_wrapper)
+NI_SYSCALL							/* old "create module" */
+SYSCALL(sys_init_module,sys_init_module,sys32_init_module_wrapper)
+SYSCALL(sys_delete_module,sys_delete_module,sys32_delete_module_wrapper)
+NI_SYSCALL							/* 130: old get_kernel_syms */
+SYSCALL(sys_quotactl,sys_quotactl,sys32_quotactl_wrapper)
+SYSCALL(sys_getpgid,sys_getpgid,sys32_getpgid_wrapper)
+SYSCALL(sys_fchdir,sys_fchdir,sys32_fchdir_wrapper)
+SYSCALL(sys_bdflush,sys_bdflush,sys32_bdflush_wrapper)
+SYSCALL(sys_sysfs,sys_sysfs,sys32_sysfs_wrapper)		/* 135 */
+SYSCALL(sys_personality,s390x_personality,sys32_personality_wrapper)
+NI_SYSCALL							/* for afs_syscall */
+SYSCALL(sys_setfsuid16,sys_ni_syscall,sys32_setfsuid16_wrapper)	/* old setfsuid16 syscall */
+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_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_getsid,sys_getsid,sys32_getsid_wrapper)
+SYSCALL(sys_fdatasync,sys_fdatasync,sys32_fdatasync_wrapper)
+SYSCALL(sys_sysctl,sys_sysctl,sys32_sysctl_wrapper)
+SYSCALL(sys_mlock,sys_mlock,sys32_mlock_wrapper)		/* 150 */
+SYSCALL(sys_munlock,sys_munlock,sys32_munlock_wrapper)
+SYSCALL(sys_mlockall,sys_mlockall,sys32_mlockall_wrapper)
+SYSCALL(sys_munlockall,sys_munlockall,sys_munlockall)
+SYSCALL(sys_sched_setparam,sys_sched_setparam,sys32_sched_setparam_wrapper)
+SYSCALL(sys_sched_getparam,sys_sched_getparam,sys32_sched_getparam_wrapper)	/* 155 */
+SYSCALL(sys_sched_setscheduler,sys_sched_setscheduler,sys32_sched_setscheduler_wrapper)
+SYSCALL(sys_sched_getscheduler,sys_sched_getscheduler,sys32_sched_getscheduler_wrapper)
+SYSCALL(sys_sched_yield,sys_sched_yield,sys_sched_yield)
+SYSCALL(sys_sched_get_priority_max,sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper)
+SYSCALL(sys_sched_get_priority_min,sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper)	/* 160 */
+SYSCALL(sys_sched_rr_get_interval,sys_sched_rr_get_interval,sys32_sched_rr_get_interval_wrapper)
+SYSCALL(sys_nanosleep,sys_nanosleep,compat_sys_nanosleep_wrapper)
+SYSCALL(sys_mremap,sys_mremap,sys32_mremap_wrapper)
+SYSCALL(sys_setresuid16,sys_ni_syscall,sys32_setresuid16_wrapper)	/* old setresuid16 syscall */
+SYSCALL(sys_getresuid16,sys_ni_syscall,sys32_getresuid16_wrapper)	/* 165 old getresuid16 syscall */
+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_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)
+SYSCALL(sys_rt_sigreturn_glue,sys_rt_sigreturn_glue,sys32_rt_sigreturn_glue)
+SYSCALL(sys_rt_sigaction,sys_rt_sigaction,sys32_rt_sigaction_wrapper)
+SYSCALL(sys_rt_sigprocmask,sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper)	/* 175 */
+SYSCALL(sys_rt_sigpending,sys_rt_sigpending,sys32_rt_sigpending_wrapper)
+SYSCALL(sys_rt_sigtimedwait,sys_rt_sigtimedwait,sys32_rt_sigtimedwait_wrapper)
+SYSCALL(sys_rt_sigqueueinfo,sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper)
+SYSCALL(sys_rt_sigsuspend_glue,sys_rt_sigsuspend_glue,sys32_rt_sigsuspend_glue)
+SYSCALL(sys_pread64,sys_pread64,sys32_pread64_wrapper)		/* 180 */
+SYSCALL(sys_pwrite64,sys_pwrite64,sys32_pwrite64_wrapper)
+SYSCALL(sys_chown16,sys_ni_syscall,sys32_chown16_wrapper)	/* old chown16 syscall */
+SYSCALL(sys_getcwd,sys_getcwd,sys32_getcwd_wrapper)
+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)
+NI_SYSCALL							/* streams1 */
+NI_SYSCALL							/* streams2 */
+SYSCALL(sys_vfork_glue,sys_vfork_glue,sys_vfork_glue)		/* 190 */
+SYSCALL(sys_getrlimit,sys_getrlimit,sys32_getrlimit_wrapper)
+SYSCALL(sys_mmap2,sys_mmap2,sys32_mmap2_wrapper)
+SYSCALL(sys_truncate64,sys_ni_syscall,sys32_truncate64_wrapper)
+SYSCALL(sys_ftruncate64,sys_ni_syscall,sys32_ftruncate64_wrapper)
+SYSCALL(sys_stat64,sys_ni_syscall,sys32_stat64_wrapper)		/* 195 */
+SYSCALL(sys_lstat64,sys_ni_syscall,sys32_lstat64_wrapper)
+SYSCALL(sys_fstat64,sys_ni_syscall,sys32_fstat64_wrapper)
+SYSCALL(sys_lchown,sys_lchown,sys32_lchown_wrapper)
+SYSCALL(sys_getuid,sys_getuid,sys_getuid)
+SYSCALL(sys_getgid,sys_getgid,sys_getgid)			/* 200 */
+SYSCALL(sys_geteuid,sys_geteuid,sys_geteuid)
+SYSCALL(sys_getegid,sys_getegid,sys_getegid)
+SYSCALL(sys_setreuid,sys_setreuid,sys32_setreuid_wrapper)
+SYSCALL(sys_setregid,sys_setregid,sys32_setregid_wrapper)
+SYSCALL(sys_getgroups,sys_getgroups,sys32_getgroups_wrapper)	/* 205 */
+SYSCALL(sys_setgroups,sys_setgroups,sys32_setgroups_wrapper)
+SYSCALL(sys_fchown,sys_fchown,sys32_fchown_wrapper)
+SYSCALL(sys_setresuid,sys_setresuid,sys32_setresuid_wrapper)
+SYSCALL(sys_getresuid,sys_getresuid,sys32_getresuid_wrapper)
+SYSCALL(sys_setresgid,sys_setresgid,sys32_setresgid_wrapper)	/* 210 */
+SYSCALL(sys_getresgid,sys_getresgid,sys32_getresgid_wrapper)
+SYSCALL(sys_chown,sys_chown,sys32_chown_wrapper)
+SYSCALL(sys_setuid,sys_setuid,sys32_setuid_wrapper)
+SYSCALL(sys_setgid,sys_setgid,sys32_setgid_wrapper)
+SYSCALL(sys_setfsuid,sys_setfsuid,sys32_setfsuid_wrapper)	/* 215 */
+SYSCALL(sys_setfsgid,sys_setfsgid,sys32_setfsgid_wrapper)
+SYSCALL(sys_pivot_root,sys_pivot_root,sys32_pivot_root_wrapper)
+SYSCALL(sys_mincore,sys_mincore,sys32_mincore_wrapper)
+SYSCALL(sys_madvise,sys_madvise,sys32_madvise_wrapper)
+SYSCALL(sys_getdents64,sys_getdents64,sys32_getdents64_wrapper)	/* 220 */
+SYSCALL(sys_fcntl64,sys_ni_syscall,compat_sys_fcntl64_wrapper)
+SYSCALL(sys_readahead,sys_readahead,sys32_readahead)
+SYSCALL(sys_sendfile64,sys_ni_syscall,sys32_sendfile64)
+SYSCALL(sys_setxattr,sys_setxattr,sys32_setxattr_wrapper)
+SYSCALL(sys_lsetxattr,sys_lsetxattr,sys32_lsetxattr_wrapper)	/* 225 */
+SYSCALL(sys_fsetxattr,sys_fsetxattr,sys32_fsetxattr_wrapper)
+SYSCALL(sys_getxattr,sys_getxattr,sys32_getxattr_wrapper)
+SYSCALL(sys_lgetxattr,sys_lgetxattr,sys32_lgetxattr_wrapper)
+SYSCALL(sys_fgetxattr,sys_fgetxattr,sys32_fgetxattr_wrapper)
+SYSCALL(sys_listxattr,sys_listxattr,sys32_listxattr_wrapper)	/* 230 */
+SYSCALL(sys_llistxattr,sys_llistxattr,sys32_llistxattr_wrapper)
+SYSCALL(sys_flistxattr,sys_flistxattr,sys32_flistxattr_wrapper)
+SYSCALL(sys_removexattr,sys_removexattr,sys32_removexattr_wrapper)
+SYSCALL(sys_lremovexattr,sys_lremovexattr,sys32_lremovexattr_wrapper)
+SYSCALL(sys_fremovexattr,sys_fremovexattr,sys32_fremovexattr_wrapper)	/* 235 */
+SYSCALL(sys_gettid,sys_gettid,sys_gettid)
+SYSCALL(sys_tkill,sys_tkill,sys_tkill)
+SYSCALL(sys_futex,sys_futex,compat_sys_futex_wrapper)
+SYSCALL(sys_sched_setaffinity,sys_sched_setaffinity,sys32_sched_setaffinity_wrapper)
+SYSCALL(sys_sched_getaffinity,sys_sched_getaffinity,sys32_sched_getaffinity_wrapper)	/* 240 */
+NI_SYSCALL					
+NI_SYSCALL							/* reserved for TUX */
+SYSCALL(sys_io_setup,sys_io_setup,sys_ni_syscall)
+SYSCALL(sys_io_destroy,sys_io_destroy,sys_ni_syscall)
+SYSCALL(sys_io_getevents,sys_io_getevents,sys_ni_syscall)	/* 245 */
+SYSCALL(sys_io_submit,sys_io_submit,sys_ni_syscall)
+SYSCALL(sys_io_cancel,sys_io_cancel,sys_ni_syscall)
+SYSCALL(sys_exit_group,sys_exit_group,sys32_exit_group_wrapper)
+SYSCALL(sys_epoll_create,sys_epoll_create,sys_ni_syscall)
+SYSCALL(sys_epoll_ctl,sys_epoll_ctl,sys_ni_syscall)		/* 250 */
+SYSCALL(sys_epoll_wait,sys_epoll_wait,sys_ni_syscall)
+SYSCALL(sys_set_tid_address,sys_set_tid_address,sys32_set_tid_address_wrapper)
+SYSCALL(sys_fadvise64,sys_fadvise64,sys_ni_syscall)
+SYSCALL(sys_timer_create,sys_timer_create,sys_ni_syscall)
+SYSCALL(sys_timer_settime,sys_timer_settime,sys_ni_syscall)	/* 255 */
+SYSCALL(sys_timer_gettime,sys_timer_gettime,sys_ni_syscall)
+SYSCALL(sys_timer_getoverrun,sys_timer_getoverrun,sys_ni_syscall)
+SYSCALL(sys_timer_delete,sys_timer_delete,sys_ni_syscall)
+SYSCALL(sys_clock_settime,sys_clock_settime,sys_ni_syscall)
+SYSCALL(sys_clock_gettime,sys_clock_gettime,sys_ni_syscall)
+SYSCALL(sys_clock_getres,sys_clock_getres,sys_ni_syscall)
+SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys_ni_syscall)
diff -urN linux-2.5.67-bk5/arch/s390/kernel/time.c linux-2.5.67-bk6/arch/s390/kernel/time.c
--- linux-2.5.67-bk5/arch/s390/kernel/time.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/time.c	2003-04-15 04:36:14.000000000 -0700
@@ -49,8 +49,9 @@
 u64 jiffies_64 = INITIAL_JIFFIES;
 
 static ext_int_info_t ext_int_info_timer;
-static uint64_t xtime_cc;
-static uint64_t init_timer_cc;
+static u64 init_timer_cc;
+static u64 jiffies_timer_cc;
+static u64 xtime_cc;
 
 extern unsigned long wall_jiffies;
 
@@ -70,7 +71,7 @@
 	__u64 now;
 
 	asm volatile ("STCK 0(%0)" : : "a" (&now) : "memory", "cc");
-        now = (now - init_timer_cc) >> 12;
+        now = (now - jiffies_timer_cc) >> 12;
 	/* We require the offset from the latest update of xtime */
 	now -= (__u64) wall_jiffies*USECS_PER_JIFFY;
 	return (unsigned long) now;
@@ -127,15 +128,28 @@
 	write_sequnlock_irq(&xtime_lock);
 }
 
-static inline __u32 div64_32(__u64 dividend, __u32 divisor)
+#ifndef CONFIG_ARCH_S390X
+
+static inline __u32
+__calculate_ticks(__u64 elapsed)
 {
 	register_pair rp;
 
-	rp.pair = dividend;
-	asm ("dr %0,%1" : "+d" (rp) : "d" (divisor));
+	rp.pair = elapsed >> 1;
+	asm ("dr %0,%1" : "+d" (rp) : "d" (CLK_TICKS_PER_JIFFY >> 1));
 	return rp.subreg.odd;
 }
 
+#else /* CONFIG_ARCH_S390X */
+
+static inline __u32
+__calculate_ticks(__u64 elapsed)
+{
+	return elapsed / CLK_TICKS_PER_JIFFY;
+}
+
+#endif /* CONFIG_ARCH_S390X */
+
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "do_timer()" routine every clocktick
@@ -149,7 +163,7 @@
 	asm volatile ("STCK 0(%0)" : : "a" (&tmp) : "memory", "cc");
 	tmp = tmp - S390_lowcore.jiffy_timer;
 	if (tmp >= 2*CLK_TICKS_PER_JIFFY) {  /* more than one tick ? */
-		ticks = div64_32(tmp >> 1, CLK_TICKS_PER_JIFFY >> 1);
+		ticks = __calculate_ticks(tmp);
 		S390_lowcore.jiffy_timer +=
 			CLK_TICKS_PER_JIFFY * (__u64) ticks;
 	} else {
@@ -174,7 +188,7 @@
 
 		tmp = S390_lowcore.jiffy_timer - xtime_cc;
 		if (tmp >= 2*CLK_TICKS_PER_JIFFY) {
-			xticks = div64_32(tmp >> 1, CLK_TICKS_PER_JIFFY >> 1);
+			xticks = __calculate_ticks(tmp);
 			xtime_cc += (__u64) xticks * CLK_TICKS_PER_JIFFY;
 		} else {
 			xticks = 1;
@@ -202,14 +216,14 @@
 	unsigned long cr0;
 	__u64 timer;
 
-        /* allow clock comparator timer interrupt */
-        asm volatile ("STCTL 0,0,%0" : "=m" (cr0) : : "memory");
-        cr0 |= 0x800;
-        asm volatile ("LCTL 0,0,%0" : : "m" (cr0) : "memory");
-	timer = init_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
+	timer = jiffies_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
 	S390_lowcore.jiffy_timer = timer;
 	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
 	asm volatile ("SCKC %0" : : "m" (timer));
+        /* allow clock comparator timer interrupt */
+	__ctl_store(cr0, 0, 0);
+        cr0 |= 0x800;
+	__ctl_load(cr0, 0, 0);
 }
 
 /*
@@ -239,6 +253,7 @@
                 printk("time_init: TOD clock stopped/non-operational\n");
                 break;
         }
+	jiffies_timer_cc = init_timer_cc - jiffies_64 * CLK_TICKS_PER_JIFFY;
 
 	/* set xtime */
 	xtime_cc = init_timer_cc;
diff -urN linux-2.5.67-bk5/arch/s390/kernel/traps.c linux-2.5.67-bk6/arch/s390/kernel/traps.c
--- linux-2.5.67-bk5/arch/s390/kernel/traps.c	2003-04-07 10:31:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/kernel/traps.c	2003-04-15 04:36:14.000000000 -0700
@@ -27,6 +27,7 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/module.h>
+#include <linux/kallsyms.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -35,6 +36,7 @@
 #include <asm/mathemu.h>
 #include <asm/cpcmd.h>
 #include <asm/s390_ext.h>
+#include <asm/lowcore.h>
 
 /* Called from entry.S only */
 extern void handle_per_exception(struct pt_regs *regs);
@@ -52,6 +54,7 @@
 
 extern pgm_check_handler_t do_protection_exception;
 extern pgm_check_handler_t do_segment_exception;
+extern pgm_check_handler_t do_region_exception;
 extern pgm_check_handler_t do_page_exception;
 extern pgm_check_handler_t do_pseudo_page_fault;
 #ifdef CONFIG_PFAULT
@@ -61,31 +64,37 @@
 static ext_int_info_t ext_int_pfault;
 #endif
 
+#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; })
+
+#ifndef CONFIG_ARCH_S390X
+#define RET_ADDR 56
+#define FOURLONG "%08lx %08lx %08lx %08lx\n"
 static int kstack_depth_to_print = 12;
 
+#else /* CONFIG_ARCH_S390X */
+#define RET_ADDR 112
+#define FOURLONG "%016lx %016lx %016lx %016lx\n"
+static int kstack_depth_to_print = 20;
+
+#endif /* CONFIG_ARCH_S390X */
+
 void show_trace(unsigned long * stack)
 {
 	unsigned long backchain, low_addr, high_addr, ret_addr;
-	int i;
 
 	if (!stack)
-		stack = (unsigned long*)&stack;
+		stack = *stack_pointer;
 
-	printk("Call Trace: ");
+	printk("Call Trace:\n");
 	low_addr = ((unsigned long) stack) & PSW_ADDR_INSN;
 	high_addr = (low_addr & (-THREAD_SIZE)) + THREAD_SIZE;
 	/* Skip the first frame (biased stack) */
 	backchain = *((unsigned long *) low_addr) & PSW_ADDR_INSN;
 	/* Print up to 8 lines */
-	for (i = 0; i < 8; i++) {
-		if (backchain < low_addr || backchain >= high_addr)
-			break;
-		ret_addr = *((unsigned long *) (backchain+56)) & PSW_ADDR_INSN;
-		if (!kernel_text_address(ret_addr))
-			break;
-		if (i && ((i % 6) == 0))
-			printk("\n   ");
-		printk("[<%08lx>] ", ret_addr);
+	while  (backchain > low_addr && backchain <= high_addr) {
+		ret_addr = *((unsigned long *) (backchain+RET_ADDR)) & PSW_ADDR_INSN;
+		printk(" [<%016lx>] ", ret_addr);
+		print_symbol("%s\n", ret_addr);
 		low_addr = backchain;
 		backchain = *((unsigned long *) backchain) & PSW_ADDR_INSN;
 	}
@@ -112,15 +121,15 @@
 	// back trace for this cpu.
 
 	if(sp == NULL)
-		sp = (unsigned long*) &sp;
+		sp = *stack_pointer;
 
 	stack = sp;
 	for (i = 0; i < kstack_depth_to_print; i++) {
 		if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
 			break;
-		if (i && ((i % 8) == 0))
+		if (i && ((i * sizeof (long) % 32) == 0))
 			printk("\n       ");
-		printk("%08lx ", *stack++);
+		printk("%p ", (void *)*stack++);
 	}
 	printk("\n");
 	show_trace(sp);
@@ -141,17 +150,18 @@
 	int i;
 
 	mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl";
-	printk("%s PSW : %08lx %08lx\n",
-	       mode, (unsigned long) regs->psw.mask,
-	       (unsigned long) regs->psw.addr);
-	printk("%s GPRS: %08x %08x %08x %08x\n", mode,
+	printk("%s PSW : %p %p\n",
+	       mode, (void *) regs->psw.mask,
+	       (void *) regs->psw.addr);
+	printk("%s GPRS: " FOURLONG, mode,
 	       regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
-	printk("           %08x %08x %08x %08x\n",
+	printk("           " FOURLONG,
 	       regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
-	printk("           %08x %08x %08x %08x\n",
+	printk("           " FOURLONG,
 	       regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]);
-	printk("           %08x %08x %08x %08x\n",
+	printk("           " FOURLONG,
 	       regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]);
+
 	printk("%s ACRS: %08x %08x %08x %08x\n", mode,
 	       regs->acrs[0], regs->acrs[1], regs->acrs[2], regs->acrs[3]);
 	printk("           %08x %08x %08x %08x\n",
@@ -190,21 +200,21 @@
 	struct pt_regs *regs;
 
 	regs = __KSTK_PTREGS(task);
-	buffer += sprintf(buffer, "task: %08lx, ksp: %08x\n",
-			  (unsigned long) task, task->thread.ksp);
-	buffer += sprintf(buffer, "User PSW : %08lx %08lx\n",
-			  (unsigned long) regs->psw.mask, 
-			  (unsigned long) regs->psw.addr);
-	buffer += sprintf(buffer, "User GPRS: %08x %08x %08x %08x\n",
+	buffer += sprintf(buffer, "task: %p, ksp: %p\n",
+		       task, (void *)task->thread.ksp);
+	buffer += sprintf(buffer, "User PSW : %p %p\n",
+		       (void *) regs->psw.mask, (void *)regs->psw.addr);
+
+	buffer += sprintf(buffer, "User GPRS: " FOURLONG,
 			  regs->gprs[0], regs->gprs[1],
 			  regs->gprs[2], regs->gprs[3]);
-	buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
+	buffer += sprintf(buffer, "           " FOURLONG,
 			  regs->gprs[4], regs->gprs[5],
 			  regs->gprs[6], regs->gprs[7]);
-	buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
+	buffer += sprintf(buffer, "           " FOURLONG,
 			  regs->gprs[8], regs->gprs[9],
 			  regs->gprs[10], regs->gprs[11]);
-	buffer += sprintf(buffer, "           %08x %08x %08x %08x\n",
+	buffer += sprintf(buffer, "           " FOURLONG,
 			  regs->gprs[12], regs->gprs[13],
 			  regs->gprs[14], regs->gprs[15]);
 	buffer += sprintf(buffer, "User ACRS: %08x %08x %08x %08x\n",
@@ -270,9 +280,9 @@
 #endif
         } else {
                 const struct exception_table_entry *fixup;
-                fixup = search_exception_tables(regs->psw.addr & 0x7fffffff);
+                fixup = search_exception_tables(regs->psw.addr & PSW_ADDR_INSN);
                 if (fixup)
-                        regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE31;
+                        regs->psw.addr = fixup->fixup | ~PSW_ADDR_INSN;
                 else
                         die(str, regs, interruption_code);
         }
@@ -375,7 +385,7 @@
 	__u16 *location;
 	int signal = 0;
 
-	location = (__u16 *)(regs->psw.addr-S390_lowcore.pgm_ilc);
+	location = (__u16 *) get_check_address(regs);
 
 	/*
 	 * We got all needed information from the lowcore and can
@@ -427,7 +437,6 @@
 }
 
 
-
 #ifdef CONFIG_MATHEMU
 asmlinkage void 
 specification_exception(struct pt_regs * regs, long interruption_code)
@@ -605,33 +614,40 @@
         pgm_check_table[9] = &divide_exception;
         pgm_check_table[0x10] = &do_segment_exception;
         pgm_check_table[0x11] = &do_page_exception;
+        pgm_check_table[0x10] = &do_segment_exception;
+        pgm_check_table[0x11] = &do_page_exception;
         pgm_check_table[0x12] = &translation_exception;
         pgm_check_table[0x13] = &special_op_exception;
+#ifndef CONFIG_ARCH_S390X
  	pgm_check_table[0x14] = &do_pseudo_page_fault;
+#else /* CONFIG_ARCH_S390X */
+        pgm_check_table[0x38] = &addressing_exception;
+        pgm_check_table[0x3B] = &do_region_exception;
+#endif /* CONFIG_ARCH_S390X */
         pgm_check_table[0x15] = &operand_exception;
         pgm_check_table[0x1C] = &privileged_op;
-#ifdef CONFIG_PFAULT
 	if (MACHINE_IS_VM) {
-		/* request the 0x2603 external interrupt */
-		if (register_early_external_interrupt(0x2603, pfault_interrupt,
-						      &ext_int_pfault) != 0)
-			panic("Couldn't request external interrupt 0x2603");
 		/*
 		 * First try to get pfault pseudo page faults going.
 		 * If this isn't available turn on pagex page faults.
 		 */
-		if (pfault_init() != 0) {
-			/* Tough luck, no pfault. */
-			unregister_early_external_interrupt(0x2603,
-							    pfault_interrupt,
-							    &ext_int_pfault);
-			cpcmd("SET PAGEX ON", NULL, 0);
-		}
-	}
-#else
-	if (MACHINE_IS_VM)
+#ifdef CONFIG_PFAULT
+		/* request the 0x2603 external interrupt */
+		if (register_early_external_interrupt(0x2603, pfault_interrupt,
+						      &ext_int_pfault) != 0)
+			panic("Couldn't request external interrupt 0x2603");
+
+		if (pfault_init() == 0) 
+			return;
+		
+		/* Tough luck, no pfault. */
+		unregister_early_external_interrupt(0x2603, pfault_interrupt,
+						    &ext_int_pfault);
+#endif
+#ifndef CONFIG_ARCH_S390X
 		cpcmd("SET PAGEX ON", NULL, 0);
 #endif
+	}
 }
 
 
diff -urN linux-2.5.67-bk5/arch/s390/lib/Makefile linux-2.5.67-bk6/arch/s390/lib/Makefile
--- linux-2.5.67-bk5/arch/s390/lib/Makefile	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/lib/Makefile	2003-04-15 04:36:14.000000000 -0700
@@ -6,4 +6,6 @@
 
 EXTRA_AFLAGS := -traditional
 
-obj-y = delay.o memset.o strcmp.o strncpy.o uaccess.o
+obj-y += delay.o 
+obj-$(CONFIG_ARCH_S390_31) += memset.o strcmp.o strncpy.o uaccess.o
+obj-$(CONFIG_ARCH_S390X) += memset64.o strcmp64.o strncpy64.o uaccess64.o
diff -urN linux-2.5.67-bk5/arch/s390/lib/memset64.S linux-2.5.67-bk6/arch/s390/lib/memset64.S
--- linux-2.5.67-bk5/arch/s390/lib/memset64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/lib/memset64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,30 @@
+/*
+ *  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 -urN linux-2.5.67-bk5/arch/s390/lib/strcmp64.S linux-2.5.67-bk6/arch/s390/lib/strcmp64.S
--- linux-2.5.67-bk5/arch/s390/lib/strcmp64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/lib/strcmp64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,27 @@
+/*
+ *  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 -urN linux-2.5.67-bk5/arch/s390/lib/strncpy64.S linux-2.5.67-bk6/arch/s390/lib/strncpy64.S
--- linux-2.5.67-bk5/arch/s390/lib/strncpy64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/lib/strncpy64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,30 @@
+/*
+ *  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_exit   # ICM inserted a 0x00
+        BRCTG   4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
+strncpy_exit:
+        BR      14
+
diff -urN linux-2.5.67-bk5/arch/s390/lib/uaccess64.S linux-2.5.67-bk6/arch/s390/lib/uaccess64.S
--- linux-2.5.67-bk5/arch/s390/lib/uaccess64.S	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/arch/s390/lib/uaccess64.S	2003-04-15 04:36:14.000000000 -0700
@@ -0,0 +1,107 @@
+/*
+ *  arch/s390x/lib/uaccess.S
+ *    __copy_{from|to}_user functions.
+ *
+ *  s390
+ *    Copyright (C) 2000,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Authors(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
+ *
+ *  These functions have standard call interface
+ */
+
+#include <asm/lowcore.h>
+
+        .text
+        .align 4
+        .globl __copy_from_user_asm
+__copy_from_user_asm:
+	lgr	%r5,%r3
+	sacf	512
+0:	mvcle	%r2,%r4,0
+	jo	0b
+1:	sacf	0
+	lgr	%r2,%r5
+	br	%r14
+2:	lghi	%r1,-4096
+	lgr	%r3,%r4
+	slgr	%r3,%r1      # %r3 = %r4 + 4096
+	ngr	%r3,%r1      # %r3 = (%r4 + 4096) & -4096
+	slgr	%r3,%r4      # %r3 = #bytes to next user page boundary
+	clgr	%r5,%r3      # copy crosses next page boundary ?
+	jnh	1b           # no, this page fauled
+	# The page after the current user page might have faulted.
+	# We cant't find out which page because the program check handler
+	# might have callled schedule, destroying all lowcore information.
+	# We retry with the shortened length.
+3:	mvcle	%r2,%r4,0
+	jo	3b
+	j	1b
+        .section __ex_table,"a"
+	.quad	0b,2b
+	.quad	3b,1b
+        .previous
+
+        .align 4
+        .text
+        .globl __copy_to_user_asm
+__copy_to_user_asm:
+	lgr	%r5,%r3
+	sacf	512
+0:	mvcle	%r4,%r2,0
+	jo	0b
+1:	sacf	0
+	lgr	%r2,%r3
+	br	%r14
+2:	lghi	%r1,-4096
+	lgr	%r5,%r4
+	slgr	%r5,%r1      # %r5 = %r4 + 4096
+	ngr	%r5,%r1      # %r5 = (%r4 + 4096) & -4096
+	slgr	%r5,%r4      # %r5 = #bytes to next user page boundary
+	clgr	%r3,%r5      # copy crosses next page boundary ?
+	jnh	1b           # no, the current page fauled
+	# The page after the current user page might have faulted.
+	# We cant't find out which page because the program check handler
+	# might have callled schedule, destroying all lowcore information.
+	# We retry with the shortened length.
+3:	mvcle	%r4,%r2,0
+	jo	3b
+	j	1b
+        .section __ex_table,"a"
+	.quad	0b,2b
+	.quad	3b,1b
+        .previous
+
+        .align 4
+        .text
+        .globl __clear_user_asm
+__clear_user_asm:
+	lgr	%r4,%r2
+	lgr	%r5,%r3
+	sgr	%r2,%r2
+	sgr	%r3,%r3
+	sacf	512
+0:	mvcle	%r4,%r2,0
+	jo	0b
+1:	sacf	0
+	br	%r14
+2:	lgr	%r2,%r5
+	lghi	%r1,-4096
+	slgr	%r5,%r1      # %r5 = %r4 + 4096
+	ngr	%r5,%r1      # %r5 = (%r4 + 4096) & -4096
+	slgr	%r5,%r4      # %r5 = #bytes to next user page boundary
+	clgr	%r2,%r5      # copy crosses next page boundary ?
+	jnh	1b           # no, the current page fauled
+	# The page after the current user page might have faulted.
+	# We cant't find out which page because the program check handler
+	# might have callled schedule, destroying all lowcore information.
+	# We retry with the shortened length.
+	slgr	%r2,%r5
+3:	mvcle	%r4,%r2,0
+	jo	3b
+	j	1b
+4:	algr	%r2,%r5
+	j	1b
+        .section __ex_table,"a"
+	.quad	0b,2b
+        .quad	3b,4b
+        .previous
diff -urN linux-2.5.67-bk5/arch/s390/math-emu/math.c linux-2.5.67-bk6/arch/s390/math-emu/math.c
--- linux-2.5.67-bk5/arch/s390/math-emu/math.c	2003-04-07 10:31:03.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/math-emu/math.c	2003-04-15 04:36:14.000000000 -0700
@@ -14,6 +14,7 @@
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <asm/uaccess.h>
+#include <asm/lowcore.h>
 
 #include "sfp-util.h"
 #include <math-emu/soft-fp.h>
diff -urN linux-2.5.67-bk5/arch/s390/mm/fault.c linux-2.5.67-bk6/arch/s390/mm/fault.c
--- linux-2.5.67-bk5/arch/s390/mm/fault.c	2003-04-07 10:32:20.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/mm/fault.c	2003-04-15 04:36:14.000000000 -0700
@@ -22,7 +22,6 @@
 #include <linux/mm.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
-#include <linux/compatmac.h>
 #include <linux/init.h>
 #include <linux/console.h>
 #include <linux/module.h>
@@ -32,6 +31,18 @@
 #include <asm/pgtable.h>
 #include <asm/hardirq.h>
 
+#ifndef CONFIG_ARCH_S390X
+#define __FAIL_ADDR_MASK 0x7ffff000
+#define __FIXUP_MASK 0x7fffffff
+#define __SUBCODE_MASK 0x0200
+#define __PF_RES_FIELD 0ULL
+#else /* CONFIG_ARCH_S390X */
+#define __FAIL_ADDR_MASK -4096L
+#define __FIXUP_MASK ~0L
+#define __SUBCODE_MASK 0x0600
+#define __PF_RES_FIELD 0x8000000000000000ULL
+#endif /* CONFIG_ARCH_S390X */
+
 #ifdef CONFIG_SYSCTL
 extern int sysctl_userprocess_debug;
 #endif
@@ -144,6 +155,7 @@
  *   04       Protection           ->  Write-Protection  (suprression)
  *   10       Segment translation  ->  Not present       (nullification)
  *   11       Page translation     ->  Not present       (nullification)
+ *   3b       Region third trans.  ->  Not present       (nullification)
  */
 extern inline void do_exception(struct pt_regs *regs, unsigned long error_code)
 {
@@ -183,7 +195,7 @@
          * more specific the segment and page table portion of 
          * the address 
          */
-        address = S390_lowcore.trans_exc_code&0x7ffff000;
+        address = S390_lowcore.trans_exc_code & __FAIL_ADDR_MASK;
 	user_address = check_user_space(regs, error_code);
 
 	/*
@@ -268,9 +280,9 @@
 
 no_context:
         /* Are we prepared to handle this kernel fault?  */
-	fixup = search_exception_tables(regs->psw.addr & 0x7fffffff);
+	fixup = search_exception_tables(regs->psw.addr & __FIXUP_MASK);
 	if (fixup) {
-		regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE31;
+		regs->psw.addr = fixup->fixup | PSW_ADDR_AMODE;
                 return;
         }
 
@@ -280,10 +292,10 @@
  */
         if (user_address == 0)
                 printk(KERN_ALERT "Unable to handle kernel pointer dereference"
-        	       " at virtual kernel address %08lx\n", address);
+        	       " at virtual kernel address %p\n", (void *)address);
         else
                 printk(KERN_ALERT "Unable to handle kernel paging request"
-		       " at virtual user address %08lx\n", address);
+		       " at virtual user address %p\n", (void *)address);
 
         die("Oops", regs, error_code);
         do_exit(SIGKILL);
@@ -336,6 +348,16 @@
 	do_exception(regs, 0x11);
 }
 
+#ifdef CONFIG_ARCH_S390X
+
+void
+do_region_exception(struct pt_regs *regs, unsigned long error_code)
+{
+	do_exception(regs, 0x3b);
+}
+
+#else /* CONFIG_ARCH_S390X */
+
 typedef struct _pseudo_wait_t {
        struct _pseudo_wait_t *next;
        wait_queue_head_t queue;
@@ -436,6 +458,7 @@
                 wait_event(wait_struct.queue, wait_struct.resolved);
         }
 }
+#endif /* CONFIG_ARCH_S390X */
 
 #ifdef CONFIG_PFAULT 
 /*
@@ -465,7 +488,8 @@
 int pfault_init(void)
 {
 	pfault_refbk_t refbk =
-	{ 0x258, 0, 5, 2, __LC_KERNEL_STACK, 1ULL << 48, 1ULL << 48, 0ULL };
+		{ 0x258, 0, 5, 2, __LC_KERNEL_STACK, 1ULL << 48, 1ULL << 48,
+		  __PF_RES_FIELD };
         int rc;
 
 	if (pfault_disable)
@@ -477,7 +501,11 @@
 		"2:\n"
 		".section __ex_table,\"a\"\n"
 		"   .align 4\n"
+#ifndef CONFIG_ARCH_S390X
 		"   .long  0b,1b\n"
+#else /* CONFIG_ARCH_S390X */
+		"   .quad  0b,1b\n"
+#endif /* CONFIG_ARCH_S390X */
 		".previous"
                 : "=d" (rc) : "a" (&refbk) : "cc" );
         __ctl_set_bit(0, 9);
@@ -497,7 +525,11 @@
 		"0:\n"
 		".section __ex_table,\"a\"\n"
 		"   .align 4\n"
+#ifndef CONFIG_ARCH_S390X
 		"   .long  0b,0b\n"
+#else /* CONFIG_ARCH_S390X */
+		"   .quad  0b,0b\n"
+#endif /* CONFIG_ARCH_S390X */
 		".previous"
 		: : "a" (&refbk) : "cc" );
 }
@@ -517,7 +549,7 @@
          * external interrupt. 
 	 */
 	subcode = S390_lowcore.cpu_addr;
-	if ((subcode & 0xff00) != 0x0200)
+	if ((subcode & 0xff00) != __SUBCODE_MASK)
 		return;
 
 	/*
@@ -525,7 +557,7 @@
 	 */
 	tsk = (struct task_struct *)
 		(*((unsigned long *) __LC_PFAULT_INTPARM) - THREAD_SIZE);
-	
+
 	/*
 	 * We got all needed information from the lowcore and can
 	 * now safely switch on interrupts.
diff -urN linux-2.5.67-bk5/arch/s390/mm/init.c linux-2.5.67-bk6/arch/s390/mm/init.c
--- linux-2.5.67-bk5/arch/s390/mm/init.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/mm/init.c	2003-04-15 04:36:14.000000000 -0700
@@ -79,13 +79,12 @@
 extern unsigned long __init_end;
 
 /*
- * paging_init() sets up the page tables - note that the first 4MB are
- * already mapped by head.S.
- * paging_init will erase this initial mapping
+ * paging_init() sets up the page tables
  */
 
 unsigned long last_valid_pfn;
 
+#ifndef CONFIG_ARCH_S390X
 void __init paging_init(void)
 {
         pgd_t * pg_dir;
@@ -98,12 +97,12 @@
         static const int ssm_mask = 0x04000000L;
 
 	/* unmap whole virtual address space */
-
+	
         pg_dir = swapper_pg_dir;
 
 	for (i=0;i<KERNEL_PGD_PTRS;i++) 
 	        pmd_clear((pmd_t*)pg_dir++);
-
+		
 	/*
 	 * map whole physical memory to virtual memory (identity mapping) 
 	 */
@@ -146,13 +145,92 @@
 		zones_size[ZONE_DMA] = max_low_pfn;
 		free_area_init(zones_size);
 	}
+        return;
+}
+
+#else /* CONFIG_ARCH_S390X */
+void __init paging_init(void)
+{
+        pgd_t * pg_dir;
+	pmd_t * pm_dir;
+        pte_t * pt_dir;
+        pte_t   pte;
+	int     i,j,k;
+        unsigned long pfn = 0;
+        unsigned long pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) |
+          _KERN_REGION_TABLE;
+	static const int ssm_mask = 0x04000000L;
+
+	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long dma_pfn, high_pfn;
+
+	dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT;
+	high_pfn = max_low_pfn;
+
+	if (dma_pfn > high_pfn)
+		zones_size[ZONE_DMA] = high_pfn;
+	else {
+		zones_size[ZONE_DMA] = dma_pfn;
+		zones_size[ZONE_NORMAL] = high_pfn - dma_pfn;
+	}
+
+	/* Initialize mem_map[].  */
+	free_area_init(zones_size);
+
+
+	/*
+	 * map whole physical memory to virtual memory (identity mapping) 
+	 */
+
+        pg_dir = swapper_pg_dir;
+	
+        for (i = 0 ; i < PTRS_PER_PGD ; i++,pg_dir++) {
+	
+                if (pfn >= max_low_pfn) {
+                        pgd_clear(pg_dir);
+                        continue;
+                }          
+        
+	        pm_dir = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE*4);
+                pgd_populate(&init_mm, pg_dir, pm_dir);
+
+                for (j = 0 ; j < PTRS_PER_PMD ; j++,pm_dir++) {
+                        if (pfn >= max_low_pfn) {
+                                pmd_clear(pm_dir);
+                                continue; 
+                        }          
+                        
+                        pt_dir = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
+                        pmd_populate_kernel(&init_mm, pm_dir, pt_dir);
+	
+                        for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) {
+                                pte = pfn_pte(pfn, PAGE_KERNEL);
+                                if (pfn >= max_low_pfn) {
+                                        pte_clear(&pte); 
+                                        continue;
+                                }
+                                set_pte(pt_dir, pte);
+                                pfn++;
+                        }
+                }
+        }
+
+        /* enable virtual mapping in kernel mode */
+        __asm__ __volatile__("lctlg 1,1,%0\n\t"
+                             "lctlg 7,7,%0\n\t"
+                             "lctlg 13,13,%0\n\t"
+                             "ssm   %1"
+			     : :"m" (pgdir_k), "m" (ssm_mask));
+
+        local_flush_tlb();
 
         return;
 }
+#endif /* CONFIG_ARCH_S390X */
 
 void __init mem_init(void)
 {
-	int codesize, reservedpages, datasize, initsize;
+	unsigned long codesize, reservedpages, datasize, initsize;
 
         max_mapnr = num_physpages = max_low_pfn;
         high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
@@ -168,7 +246,7 @@
 	codesize =  (unsigned long) &_etext - (unsigned long) &_text;
 	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, %dk init)\n",
+        printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
                 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
                 max_mapnr << (PAGE_SHIFT-10),
                 codesize >> 10,
diff -urN linux-2.5.67-bk5/arch/s390/mm/ioremap.c linux-2.5.67-bk6/arch/s390/mm/ioremap.c
--- linux-2.5.67-bk5/arch/s390/mm/ioremap.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/mm/ioremap.c	2003-04-15 04:36:14.000000000 -0700
@@ -38,7 +38,7 @@
                         printk("remap_area_pte: page already exists\n");
 			BUG();
 		}
-                set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | flags)));
+                set_pte(pte, pfn_pte(pfn, __pgprot(flags)));
                 address += PAGE_SIZE;
                 pfn++;
                 pte++;
diff -urN linux-2.5.67-bk5/arch/s390/vmlinux.lds.S linux-2.5.67-bk6/arch/s390/vmlinux.lds.S
--- linux-2.5.67-bk5/arch/s390/vmlinux.lds.S	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390/vmlinux.lds.S	2003-04-15 04:36:14.000000000 -0700
@@ -3,11 +3,20 @@
  */
 
 #include <asm-generic/vmlinux.lds.h>
+#include <linux/config.h>
 
+#ifndef CONFIG_ARCH_S390X
 OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
 OUTPUT_ARCH(s390)
 ENTRY(_start)
 jiffies = jiffies_64 + 4;
+#else
+OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
+OUTPUT_ARCH(s390)
+ENTRY(_start)
+jiffies = jiffies_64;
+#endif
+
 SECTIONS
 {
   . = 0x00000000;
diff -urN linux-2.5.67-bk5/arch/s390x/Kconfig linux-2.5.67-bk6/arch/s390x/Kconfig
--- linux-2.5.67-bk5/arch/s390x/Kconfig	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/Kconfig	1969-12-31 16:00:00.000000000 -0800
@@ -1,352 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
-#
-
-config MMU
-	bool
-	default y
-
-config RWSEM_GENERIC_SPINLOCK
-	bool
-
-config RWSEM_XCHGADD_ALGORITHM
-	bool
-	default y
-
-config GENERIC_BUST_SPINLOCK
-	bool
-
-
-mainmenu "Linux Kernel Configuration"
-
-config ARCH_S390
-	bool
-	default y
-	help
-	  Select this option, if you want to run the Kernel on one of IBM's
-	  mainframes of the S/390 generation. You should have installed the
-	  s390-compiler released by IBM (based on gcc-2.95.1) before.
-
-config ARCH_S390X
-	bool
-	default y
-
-source "init/Kconfig"
-
-
-menu "Base setup"
-
-comment "Processor type and features"
-
-config SMP
-	bool "Symmetric multi-processing support"
-	---help---
-	  This enables support for systems with more than one CPU. If you have
-	  a system with only one CPU, like most personal computers, say N. If
-	  you have a system with more than one CPU, say Y.
-
-	  If you say N here, the kernel will run on single and multiprocessor
-	  machines, but will use only one CPU of a multiprocessor machine. If
-	  you say Y here, the kernel will run on many, but not all,
-	  singleprocessor machines. On a singleprocessor machine, the kernel
-	  will run faster if you say N here.
-
-	  Note that if you say Y here and choose architecture "586" or
-	  "Pentium" under "Processor family", the kernel will not work on 486
-	  architectures. Similarly, multiprocessor kernels for the "PPro"
-	  architecture may not work on all Pentium based boards.
-
-	  People using multiprocessor machines who say Y here should also say
-	  Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
-	  Management" code will be disabled if you say Y here.
-
-	  See also the <file:Documentation/smp.tex>,
-	  <file:Documentation/smp.txt>, <file:Documentation/i386/IO-APIC.txt>,
-	  <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
-	  <http://www.linuxdoc.org/docs.html#howto>.
-
-	  If you don't know what to do here, say N.
-
-config NR_CPUS
-	int "Maximum number of CPUs (2-64)"
-	depends on SMP
-	default "64"
-	help
-	  This allows you to specify the maximum number of CPUs which this
-	  kernel will support.  The maximum supported value is 64 and the
-	  minimum value which makes sense is 2.
-
-	  This is purely to save memory - each supported CPU adds
-	  approximately sixteen kilobytes to the kernel image.
-
-config S390_SUPPORT
-	bool "Kernel support for 31 bit emulation"
-	help
-	  Select this option if you want to enable your system kernel to
-	  handle system-calls from ELF binaries for 31 bit ESA.  This option
-	  (and some other stuff like libraries and such) is needed for
-	  executing 31 bit applications.  It is safe to say "Y".
-
-config COMPAT
-	bool
-	depends on S390_SUPPORT
-	default y
-
-config BINFMT_ELF32
-	tristate "Kernel support for 31 bit ELF binaries"
-	depends on S390_SUPPORT
-	help
-	  This allows you to run 32-bit Linux/ELF binaries on your Ultra.
-	  Everybody wants this; say Y.
-
-comment "I/O subsystem configuration"
-
-config MACHCHK_WARNING
-	bool "Process warning machine checks"
-	help
-	  Select this option if you want the machine check handler on IBM S/390 or
-	  zSeries to process warning machine checks (e.g. on power failures). 
-	  If unsure, say "Y".
-
-config QDIO
-	tristate "QDIO support"
-	---help---
-	  This driver provides the Queued Direct I/O base support for the
-	  IBM S/390 (G5 and G6) and eServer zSeries (z800 and z900).
-
-	  For details please refer to the documentation provided by IBM at
-	  <http://www10.software.ibm.com/developerworks/opensource/linux390>
-
-	  This driver is also available as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want).
-	  The module will be called qdio. If you want to compile it as a
-	  module, say M here and read <file:Documentation/modules.txt>.
-
-	  If unsure, say Y.
-
-config QDIO_PERF_STATS
-	bool "Performance statistics in /proc"
-	depends on QDIO
-	help
-	  Say Y here to get performance statistics in /proc/qdio_perf
-
-	  If unsure, say N.
-
-comment "Misc"
-
-config PREEMPT
-	bool "Preemptible Kernel"
-	help
-	  This option reduces the latency of the kernel when reacting to
-	  real-time or interactive events by allowing a low priority process to
-	  be preempted even if it is in kernel mode executing a system call.
-	  This allows applications to run more reliably even when the system is
-	  under load.
-
-	  Say N if you are unsure.
-
-config IPL
-	bool "Builtin IPL record support"
-	help
-	  If you want to use the produced kernel to IPL directly from a
-	  device, you have to merge a bootsector specific to the device
-	  into the first bytes of the kernel. You will have to select the
-	  IPL device.
-
-choice
-	prompt "IPL method generated into head.S"
-	depends on IPL
-	default IPL_TAPE
-
-config IPL_TAPE
-	bool "tape"
-	help
-	  Select "tape" if you want to IPL the image from a Tape.
-
-	  Select "vm_reader" if you are running under VM/ESA and want
-	  to IPL the image from the emulated card reader.
-
-config IPL_VM
-	bool "vm_reader"
-
-endchoice
-
-config KCORE_ELF
-	bool
-	default y
-	---help---
-	  If you enabled support for /proc file system then the file
-	  /proc/kcore will contain the kernel core image. This can be used
-	  in gdb:
-
-	  $ cd /usr/src/linux ; gdb vmlinux /proc/kcore
-
-	  You have two choices here: ELF and A.OUT. Selecting ELF will make
-	  /proc/kcore appear in ELF core format as defined by the Executable
-	  and Linking Format specification. Selecting A.OUT will choose the
-	  old "a.out" format which may be necessary for some old versions
-	  of binutils or on some architectures.
-
-	  This is especially useful if you have compiled the kernel with the
-	  "-g" option to preserve debugging information. It is mainly used
-	  for examining kernel data structures on the live kernel so if you
-	  don't understand what this means or are not a kernel hacker, just
-	  leave it at its default value ELF.
-
-config BINFMT_ELF
-	tristate "Kernel support for ELF binaries"
-	---help---
-	  ELF (Executable and Linkable Format) is a format for libraries and
-	  executables used across different architectures and operating
-	  systems. Saying Y here will enable your kernel to run ELF binaries
-	  and enlarge it by about 13 KB. ELF support under Linux has now all
-	  but replaced the traditional Linux a.out formats (QMAGIC and ZMAGIC)
-	  because it is portable (this does *not* mean that you will be able
-	  to run executables from different architectures or operating systems
-	  however) and makes building run-time libraries very easy. Many new
-	  executables are distributed solely in ELF format. You definitely
-	  want to say Y here.
-
-	  Information about ELF is contained in the ELF HOWTO available from
-	  <http://www.linuxdoc.org/docs.html#howto>.
-
-	  If you find that after upgrading from Linux kernel 1.2 and saying Y
-	  here, you still can't run any ELF binaries (they just crash), then
-	  you'll have to install the newest ELF runtime libraries, including
-	  ld.so (check the file <file:Documentation/Changes> for location and
-	  latest version).
-
-	  If you want to compile this as a module ( = code which can be
-	  inserted in and removed from the running kernel whenever you want),
-	  say M here and read <file:Documentation/modules.txt>.  The module
-	  will be called binfmt_elf. Saying M or N here is dangerous because
-	  some crucial programs on your system might be in ELF format.
-
-config BINFMT_MISC
-	tristate "Kernel support for MISC binaries"
-	---help---
-	  If you say Y here, it will be possible to plug wrapper-driven binary
-	  formats into the kernel. You will like this especially when you use
-	  programs that need an interpreter to run like Java, Python or
-	  Emacs-Lisp. It's also useful if you often run DOS executables under
-	  the Linux DOS emulator DOSEMU (read the DOSEMU-HOWTO, available from
-	  <http://www.linuxdoc.org/docs.html#howto>). Once you have
-	  registered such a binary class with the kernel, you can start one of
-	  those programs simply by typing in its name at a shell prompt; Linux
-	  will automatically feed it to the correct interpreter.
-
-	  You can do other nice things, too. Read the file
-	  <file:Documentation/binfmt_misc.txt> to learn how to use this
-	  feature, and <file:Documentation/java.txt> for information about how
-	  to include Java support.
-
-	  You must say Y to "/proc file system support" (CONFIG_PROC_FS) to
-	  use this part of the kernel.
-
-	  You may say M here for module support and later load the module when
-	  you have use for it; the module is called binfmt_misc. If you
-	  don't know what to answer at this point, say Y.
-
-config PROCESS_DEBUG
-	bool "Show crashed user process info"
-	help
-	  Say Y to print all process fault locations to the console.  This is
-	  a debugging option; you probably do not want to set it unless you
-	  are an S390 port maintainer.
-
-config PFAULT
-	bool "Pseudo page fault support"
-	help
-	  Select this option, if you want to use PFAULT pseudo page fault
-	  handling under VM. If running native or in LPAR, this option
-	  has no effect. If your VM does not support PFAULT, PAGEEX
-	  pseudo page fault handling will be used.
-	  Note that VM 4.2 supports PFAULT but has a bug in its
-	  implementation that causes some problems.
-	  Everybody who wants to run Linux under VM != VM4.2 should select
-	  this option.
-
-config SHARED_KERNEL
-	bool "VM shared kernel support"
-	help
-	  Select this option, if you want to share the text segment of the
-	  Linux kernel between different VM guests. This reduces memory
-	  usage with lots of guests but greatly increases kernel size.
-	  You should only select this option if you know what you are
-	  doing and want to exploit this feature.
-
-endmenu
-
-config PCMCIA
-	bool
-	default n
-
-menu "SCSI support"
-
-config SCSI
-	tristate "SCSI support"
-
-source "drivers/scsi/Kconfig"
-
-endmenu
-
-source "drivers/s390/Kconfig"
-
-source "net/Kconfig"
-
-source "fs/Kconfig"
-
-
-menu "Kernel hacking"
-
-config DEBUG_KERNEL
-	bool "Kernel debugging"
-	help
-	  Say Y here if you are developing drivers or trying to debug and
-	  identify kernel problems.
-
-config MAGIC_SYSRQ
-	bool "Magic SysRq key"
-	depends on DEBUG_KERNEL
-	help
-	  If you say Y here, you will have some control over the system even
-	  if the system crashes for example during kernel debugging (e.g., you
-	  will be able to flush the buffer cache to disk, reboot the system
-	  immediately or dump some status information). This is accomplished
-	  by pressing various keys while holding SysRq (Alt+PrintScreen). It
-	  also works on a serial console (on PC hardware at least), if you
-	  send a BREAK and then within 5 seconds a command keypress. The
-	  keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
-	  unless you really know what this hack does.
-
-config DEBUG_SLAB
-	bool "Debug memory allocations"
-	depends on DEBUG_KERNEL
-	help
-	  Say Y here to have the kernel do limited verification on memory
-	  allocation as well as poisoning memory on free to catch use of freed
-	  memory.
-
-config KALLSYMS
-	bool "Load all symbols for debugging/kksymoops"
-	depends on DEBUG_KERNEL
-	help
-	  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 DEBUG_SPINLOCK_SLEEP
-	bool "Sleep-inside-spinlock checking"
-	help
-	  If you say Y here, various routines which may sleep will become very
-	  noisy if they are called with a spinlock held.	
-
-endmenu
-
-source "security/Kconfig"
-
-source "crypto/Kconfig"
-
-source "lib/Kconfig"
-
diff -urN linux-2.5.67-bk5/arch/s390x/Makefile linux-2.5.67-bk6/arch/s390x/Makefile
--- linux-2.5.67-bk5/arch/s390x/Makefile	2003-04-07 10:31:22.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,53 +0,0 @@
-
-# s390x/Makefile
-#
-# This file is included by the global makefile so that you can add your own
-# architecture-specific flags and dependencies. Remember to do have actions
-# for "archclean" and "archdep" for cleaning up and making dependencies for
-# this architecture
-#
-# 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) 1994 by Linus Torvalds
-#
-
-LDFLAGS		:= -m elf64_s390
-OBJCOPYFLAGS	:= -O binary
-LDFLAGS_vmlinux := -e start
-MODFLAGS += -fpic -D__PIC__
-LDFLAGS_BLOB	:= --format binary --oformat elf64-s390
-
-CFLAGS += -pipe -fno-strength-reduce -finline-limit=10000 -Wno-sign-compare
-
-head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
-
-core-y		+= arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/
-libs-y		+= arch/$(ARCH)/lib/
-drivers-y	+= drivers/s390/
-
-
-makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/$(ARCH)/boot $(1)
-
-all: image listing
-
-listing image: vmlinux
-	$(call makeboot,arch/$(ARCH)/boot/$@)
-
-install: vmlinux
-	$(call makeboot, $@)
-
-archclean:
-	$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/$(ARCH)/boot
-
-
-prepare: include/asm-$(ARCH)/offsets.h
-
-arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
-				   include/config/MARKER
-
-include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	$(call filechk,gen-asm-offsets)
-
-CLEAN_FILES += include/asm-$(ARCH)/offsets.h
diff -urN linux-2.5.67-bk5/arch/s390x/boot/Makefile linux-2.5.67-bk6/arch/s390x/boot/Makefile
--- linux-2.5.67-bk5/arch/s390x/boot/Makefile	2003-04-07 10:31:21.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/boot/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,21 +0,0 @@
-#
-# Makefile for the linux s390-specific parts of the memory manager.
-#
-
-targets		:= image listing
-EXTRA_AFLAGS	:= -traditional
-
-quiet_cmd_listing = OBJDUMP $@
-      cmd_listing = $(OBJDUMP) --disassemble --disassemble-all \
-			       --disassemble-zeroes --reloc vmlinux > $@
-
-$(obj)/image: vmlinux FORCE
-	$(call if_changed,objcopy)
-
-$(obj)/listing: vmlinux FORCE
-	$(call if_changed,listing)
-
-
-install: $(CONFIGURE) $(obj)/image
-	sh -x $(obj)/install.sh $(KERNELRELEASE) $(obj)/image \
-	      System.map Kerntypes "$(INSTALL_PATH)"
diff -urN linux-2.5.67-bk5/arch/s390x/boot/install.sh linux-2.5.67-bk6/arch/s390x/boot/install.sh
--- linux-2.5.67-bk5/arch/s390x/boot/install.sh	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/boot/install.sh	1969-12-31 16:00:00.000000000 -0800
@@ -1,38 +0,0 @@
-#!/bin/sh
-#
-# arch/s390x/boot/install.sh
-#
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "COPYING" in the main directory of this archive
-# for more details.
-#
-# Copyright (C) 1995 by Linus Torvalds
-#
-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
-#
-# "make install" script for s390 architecture
-#
-# Arguments:
-#   $1 - kernel version
-#   $2 - kernel image file
-#   $3 - kernel map file
-#   $4 - default install path (blank if root directory)
-#
-
-# User may have a custom install script
-
-if [ -x ~/bin/installkernel ]; then exec ~/bin/installkernel "$@"; fi
-if [ -x /sbin/installkernel ]; then exec /sbin/installkernel "$@"; fi
-
-# Default install - same as make zlilo
-
-if [ -f $4/vmlinuz ]; then
-	mv $4/vmlinuz $4/vmlinuz.old
-fi
-
-if [ -f $4/System.map ]; then
-	mv $4/System.map $4/System.old
-fi
-
-cat $2 > $4/vmlinuz
-cp $3 $4/System.map
diff -urN linux-2.5.67-bk5/arch/s390x/boot/ipldump.S linux-2.5.67-bk6/arch/s390x/boot/ipldump.S
--- linux-2.5.67-bk5/arch/s390x/boot/ipldump.S	2003-04-07 10:31:45.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/boot/ipldump.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,178 +0,0 @@
-/*
- *  arch/s390/boot/ipldump.S
- *
- *  S390 version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Tape dump ipl record. Put it on a tape and ipl from it and it will
- *  write a dump of the real storage after the ipl record on that tape.
- */
-
-#include <asm/setup.h>
-#include <asm/lowcore.h>
-
-#define IPL_BS 1024
-        .org   0
-        .long  0x00080000,0x80000000+_start    # The first 24 bytes are loaded
-        .long  0x07000000,0x60000001           # by ipl to addresses 0-23.
-        .long  0x02000000,0x20000000+IPL_BS    # (a PSW and two CCWs).
-        .long  0x00000000,0x00000000
-        .long  0x00000000,0x00000000           # svc old psw
-        .long  0x00000000,0x00000000           # program check old psw
-        .long  0x00000000,0x00000000           # machine check old psw
-        .long  0x00000000,0x00000000           # io old psw
-        .long  0x00000000,0x00000000
-        .long  0x00000000,0x00000000
-        .long  0x00000000,0x00000000
-        .long  0x000a0000,0x00000058           # external new psw
-        .long  0x000a0000,0x00000060           # svc new psw
-        .long  0x000a0000,0x00000068           # program check new psw
-        .long  0x000a0000,0x00000070           # machine check new psw
-        .long  0x00080000,0x80000000+.Lioint   # io new psw
-
-        .org   0x100
-        .globl _start
-_start:
-	l     %r1,0xb8                         # load ipl subchannel number
-#
-# find out memory size
-#
-        mvc   104(8),.Lpcmem0            # setup program check handler
-        slr   %r3,%r3
-        lhi   %r2,1
-        sll   %r2,20
-.Lloop0:
-        l     %r0,0(%r3)                 # test page
-        ar    %r3,%r2                    # add 1M
-        jnm   .Lloop0                    # r1 < 0x80000000 -> loop
-.Lchkmem0:
-        n     %r3,.L4malign0             # align to multiples of 4M
-        st    %r3,.Lmemsize              # store memory size
-.Lmemok:
-
-#
-# first write a tape mark
-#
-        bras  %r14,.Ltapemark
-#
-# write real storage to tape
-#	
- 	slr   %r2,%r2                          # start at address 0
-        bras  %r14,.Lwriter                    # load ramdisk
-#
-# write another tape mark
-#
-        bras  %r14,.Ltapemark
-#
-# everything written, stop processor
-#
-        lpsw  .Lstopped
-#
-# subroutine for writing to tape
-# Paramters:	
-#  R1 = device number
-#  R2 = start address
-#  R3 = length
-.Lwriter:	
-        st    %r14,.Lldret
-        la    %r12,.Lorbread                   # r12 = address of orb 
-	la    %r5,.Lirb                        # r5 = address of irb
-        st    %r2,.Lccwwrite+4                 # initialize CCW data addresses
-        lctl  %c6,%c6,.Lcr6               
-        slr   %r2,%r2
-.Lldlp:
-        lhi   %r6,3                            # 3 retries
-.Lssch:
-        ssch  0(%r12)                          # write chunk of IPL_BS bytes
-        jnz   .Llderr
-.Lw4end:
-        bras  %r14,.Lwait4io
-        tm    8(%r5),0x82                      # do we have a problem ?
-        jnz   .Lrecov
-        l     %r0,.Lccwwrite+4                 # update CCW data addresses
-        ahi   %r0,IPL_BS
-        st    %r0,.Lccwwrite+4
-        clr   %r0,%r3                          # enough ?
-        jl    .Lldlp
-.Ldone:
-        l     %r14,.Lldret
-        br    %r14                             # r2 contains the total size
-.Lrecov:
-        bras  %r14,.Lsense                     # do the sensing
-        brct  %r6,.Lssch                       # dec. retry count & branch
-        j     .Llderr
-.Ltapemark:
-        st    %r14,.Lldret
-        la    %r12,.Lorbmark                   # r12 = address of orb
-        la    %r5,.Lirb                        # r5 = address of irb
-        lctl  %c6,%c6,.Lcr6
-        ssch  0(%r12)                          # write a tape mark
-        jnz   .Llderr
-        bras  %r14,.Lwait4io
-        l     %r14,.Lldret
-        br    %r14
-#
-# Sense subroutine
-#
-.Lsense:
-        st    %r14,.Lsnsret
-        la    %r7,.Lorbsense              
-        ssch  0(%r7)                           # start sense command
-        jnz   .Llderr
-        bras  %r14,.Lwait4io
-        l     %r14,.Lsnsret
-        tm    8(%r5),0x82                      # do we have a problem ?
-        jnz   .Llderr
-        br    %r14
-#
-# Wait for interrupt subroutine
-#
-.Lwait4io:
-        lpsw  .Lwaitpsw                 
-.Lioint:
-        c     %r1,0xb8                         # compare subchannel number
-        jne   .Lwait4io
-        tsch  0(%r5)
-        slr   %r0,%r0
-        tm    8(%r5),0x82                      # do we have a problem ?
-        jnz   .Lwtexit
-        tm    8(%r5),0x04                      # got device end ?
-        jz    .Lwait4io
-.Lwtexit:
-        br    %r14
-.Llderr:
-        lpsw  .Lcrash              
-
-        .align 8
-.Lorbread:
-	.long  0x00000000,0x0080ff00,.Lccwwrite
-        .align 8
-.Lorbsense:
-        .long  0x00000000,0x0080ff00,.Lccwsense
-        .align 8
-.Lorbmark:
-        .long  0x00000000,0x0080ff00,.Lccwmark
-        .align 8
-.Lccwwrite:
-        .long  0x01200000+IPL_BS,0x00000000
-.Lccwsense:
-        .long  0x04200001,0x00000000
-.Lccwmark:
-        .long  0x1f200001,0x00000000
-.Lwaitpsw:
-	.long  0x020a0000,0x80000000+.Lioint
-
-.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-.Lcr6:  .long  0xff000000
-        .align 8
-.Lcrash:.long  0x000a0000,0x00000000
-.Lstopped: .long 0x000a0000,0x00001234
-.Lpcmem0:.long  0x00080000,0x80000000 + .Lchkmem0
-.L4malign0:.long 0xffc00000
-.Lmemsize:.long 0
-.Lldret:.long  0
-.Lsnsret: .long 0
-
-         .org IPL_BS
-
diff -urN linux-2.5.67-bk5/arch/s390x/boot/ipleckd.S linux-2.5.67-bk6/arch/s390x/boot/ipleckd.S
--- linux-2.5.67-bk5/arch/s390x/boot/ipleckd.S	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/boot/ipleckd.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,303 +0,0 @@
-#
-#  arch/s390/boot/ipleckd.S
-#    IPL record for 3380/3390 DASD
-#
-#  S390 version
-#    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
-#    Author(s): Holger Smolinski <Holger.Smolinski@de.ibm.com>
-#
-#
-# FIXME:	 should use the countarea to determine the blocksize
-# FIXME:	 should insert zeroes into memory when filling holes
-# FIXME:	 calculate blkpertrack from rdc data and blksize
-
-# change 09/20/00       removed obsolete store of ipldevice to textesegment
-
-# Usage of registers
-# r1:	ipl subchannel ( general use, dont overload without save/restore !)
-# r10:
-# r13:	base register 	index to 0x0000
-# r14:	callers address
-# r15:	temporary save register (we have no stack!)
-
-# storage layout:
-
-#include <asm/lowcore.h>
-	
-	.org 0
-.psw:	.long 0x00080000,0x80000000+_start
-.ccw1:	.long 0x06000000,0x00001000     # Re-Read enough of bootsector to start
-.ccw2:	.long 0x00000000,0x00000000	# read countarea of record 1 to s/w.
-
-	.org 0x58
-.Lextn:	.long	0x000a0000,0x00000000+.Lextn
-.Lsvcn:	.long	0x000a0000,0x00000000+.Lsvcn
-.Lprgn:	.long	0x00080000,0x00000000+.Lecs
-.Lmcn:	.long	0x000a0000,0x00000000+.Lmcn
-.Lion:	.long   0x00080000,0x80000000+.Lionewaddr
-
-	.org 0xe0
-.Llstad:.long 	0x00000000,0x00000000	# sectorno + ct of bootlist
-
-	.org 0xf0			# Lets start now...
-_start: .globl _start
-	l  	%r1,__LC_SUBCHANNEL_ID	# get IPL-subchannel from lowcore
-	st	%r1,__LC_IPLDEV         # keep it for reipl
-	stsch	.Lrdcdata
-	oi      .Lrdcdata+5,0x84        # enable ssch and multipath mode
-.Lecs:  xi	.Lrdcdata+27,0x01	# enable concurrent sense
-	msch	.Lrdcdata	
-        xi      .Lprgn,6                # restore Wait and d/a bit in PCnew PSW
-	l	%r2,.Lparm
-	mvc     0x0(8,%r2),.Lnull       # set parmarea to null
-	lctl	%c6,%c6,.Lc6     	# enable all interrupts
-.Lrdc:					# read device characteristics
-	la	%r6,.Lrdcccw     
-	st      %r6,.Lorb+8		# store cp-address to orb
-	bras    %r15,.Lssch		# start I/O
-	oi	.Llodata+1,0x80
-	lh	%r5,.Lcountarea+6	# init r5 from countarea
-	stcm	%r5,3,.Lrdccw+2		# and store into rd template *FIXME*
-	stcm	%r5,3,.Llodata+14	# and store into lodata *FIXME*
-.Lbootlist:	
-	l	%r2,.Llstad	
-	l	%r3,.Lblklst     
-	lhi	%r4,1
-	bras	%r14,.Lreadblks
-.Lloader:	
-	l	%r10,.Lblklst     	# r10 is index to bootlist
-	lhi	%r5,4			# r5:	skip 4 blocks = firstpage....
-.Lkloop:
-	clc	.Lnull(8),0(%r10)	# test blocklist	
-	jz	.Lchkparm		# end of list?
-	l	%r2,0(%r10)		# get startblock to r2
-	slr	%r4,%r4			# erase r4
-	icm	%r4,1,7(%r10)		# get blockcount
-	slr	%r3,%r3			# get address to r3
-	icm 	%r3,0xe,4(%r10)
-	chi	%r5,0			# still blocks to skip?
-	jz	.Ldoread		# no: start reading
-	cr	%r5,%r4			# #skipblocks >= blockct?
-	jm	.L007			# no: skip the blocks one by one
-.L006:	
-	sr	%r5,%r4			# decrease number of blocks to skip
-	j	.Lkcont			# advance to next entry
-.L007:	
-	ahi	%r2,1			# skip 1 block...
-	bctr    %r4,0                   # update blockct
-	ah	%r3,.Lcountarea+6       # increment address
-	bct	%r5,.L007		# 4 blocks skipped?
-.Ldoread:
-	ltr	%r2,%r2			# test startblock
-	jz	.Lzeroes		# startblocks is zero (hole)
-.Ldiskread:	
-	bras	%r14,.Lreadblks
-	j	.Lkcont
-.Lzeroes:
-	lr	%r2,%r3
-.L001:	slr	%r3,%r3
-	icm	%r3,3,.Lcountarea+6     # get blocksize
-	slr	%r5,%r5			# no bytes to move
-.L008:	mvcle	%r2,%r4,0   		# fill zeroes to storage
-	jo	.L008			# until block is filled
-	brct	%r4,.L001   		# skip to next block
-.Lkcont:	
-	ahi	%r10,8
-	j	.Lkloop
-.Lchkparm:
-	lm	%r3,%r4,.Lstart         # load .Lstart and .Lparm
-	clc	0x0(4,%r4),.Lnull     
-	je	.Lrunkern
-	mvc	0x480(128,%r3),0(%r4)	# move 1k-0x80 to parmarea
-	mvc	0x500(256,%r3),0x80(%r4)
-	mvc	0x600(256,%r3),0x180(%r4)
-	mvc	0x700(256,%r3),0x280(%r4)
-.Lrunkern:
-#	lhi	%r2,17
-#	sll	%r2,12
-#	st	%r1,0xc6c(%r2)		# store iplsubchannel to lowcore
-#	st	%r1,0xc6c		# store iplsubchannel to lowcore
-	br	%r3
-# This function does the start IO
-# r2:	number of first block to read ( input by caller )
-# r3:	address to read data to ( input by caller )
-# r4:	number of blocks to read ( input by caller )
-# r5:	destroyed
-# r6:	blocks per track ( input by caller )
-# r7:	number of heads 
-# r8:	
-# r9:	
-# r10:	
-# r11:	temporary register
-# r12:	local use for base address
-# r13:	base address for module
-# r14:	address of caller for subroutine
-# r15:	temporary save register (since we have no stack)
-.Lreadblks:
-	la	%r12,.Ldeccw     
-	st	%r12,8+.Lorb		# store cpaddr to orb
-	ahi	%r12,0x10		# increment r12 to point to rdccw
-	oi	1(%r12),0x40		# set CC in rd template
-	# first setup the read CCWs
-	lr	%r15,%r4		# save number or blocks
-	slr	%r7,%r7
-	icm	%r7,3,.Lrdcdata+14      # load heads to r7
-	lhi     %r6,9
-	clc     .Lrdcdata+3(2),.L9345
-	je	.L011
-	lhi	%r6,10
-	clc	.Lrdcdata+3(2),.L3380
-	je	.L011
-	lhi	%r6,12
-	clc	.Lrdcdata+3(2),.L3390     
-	je	.L011			
-        bras 	%r14,.Ldisab
-.L011:	
-	# loop for nbl times
-.Lrdloop:	
-	mvc	0(8,%r12),.Lrdccw     	# copy template to this ccw
-	st	%r3,4(%r12)		# store target address to this ccw
-	bct	%r4,.L005		# decrement no of blks still to do
-	ni	1(%r12),0x3f		# delete CC from last ccw
-	lr	%r4,%r15		# restore number of blocks
-	# read CCWs are setup now		
-	stcm	%r4,3,.Llodata+2     	# store blockno to lodata clears r4
-	ar	%r4,%r2			# r4 (clear): ebl = blk + nbl
-	bctr    %r4,0			# decrement r4 ( last blk touched 
-	srda	%r2,32			# trk = blk / bpt, bot = blk % bpt 
-	dr	%r2,%r6			# r3: trk, r2: bot
-	ahi	%r2,1			# bot++ ( we start counting at 1 )
-	stcm	%r2,1,.Llodata+12     	# store bot to lodata
-	xr 	%r2,%r2			# cy  = trk / heads, hd  = trk % heads
-	dr	%r2,%r7			# r3: cy, r2: hd
-	sll	%r3,16			# combine to CCHH in r3
-	or	%r3,%r2
-	st	%r3,.Ldedata+8     	# store cchh to dedata	
-	st	%r3,.Llodata+4     	# store cchh to lodata	
-	st	%r3,.Llodata+8     	# store cchh to lodata	
-	lr	%r15,%r5		# save r5
-	srda	%r4,32			# tr2 = ebl / bpt
-	dr	%r4,%r6			# r5: tr2, r4: bot2
-	xr 	%r4,%r4			# cy2 = tr2 / heads, hd2 = hd2 % heads
-	dr	%r4,%r7			# r5: cy2, r4: hd2 
-	stcm	%r5,3,.Ldedata+12     	# store cy2,hd2 to dedata
-	stcm	%r4,3,.Ldedata+14     	# store cy2,hd2 to dedata
-	lr	%r5,%r15		# restore r5
-	# CCWs are setup now, arent they?
-	bras	%r15,.Lssch		# start I/O
-	br	%r14			# return to caller
-.L005:	
-	ah 	%r3,.Lcountarea+6     	# add blocksize to target address
-	ahi	%r12,8			# add sizeof(ccw) to base address
-	j	.Lrdloop
-# end of function
-# This function does the start IO
-# r1:	Subchannel number
-# r8:	ORB address
-# r9:	IRB address
-.Lssch:
-	lhi     %r13,10			# initialize retries
-.L012:	
-	ssch	.Lorb			# start I/O
-	jz	.Ltpi			# ok?
-	bras	%r14,.Ldisab		# error
-.Ltpi:	
-	lpsw	.Lwaitpsw     		# load wait-PSW
-.Lionewaddr:	
-	c	%r1,0xb8     		# compare to ipl subhchannel
-	jnz	.Ltpi			# not equal: loop
-	clc	0xbc(4),.Lorb 		# cross check the intparm
-	jnz	.Ltpi               	# not equal:	loop 
-	tsch    .Lirb			# get status
-	tm	.Lirb+9,0xff		# channel status ?
-	jz	.L003			# CS == 0x00
-	bras	%r14,.Ldisab		# error
-.L003:
-	tm	.Lirb+8,0xf3		# DS different from CE/DE
-	jz	.L004			# ok ?
-	bct	%r13,.L012		# retries <= 5 ?
-	bras	%r14,.Ldisab		# error
-.L004:
-	tm	.Lirb+8,0x04		# DE set?
-	jz	.Ltpi			# DE not set, loop
-.Lsschend:
-	br	%r15			# return to caller
-# end of function
-# In case of error goto disabled wait with %r14 containing the caller
-.Ldisab:
-	st	%r14,.Ldisabpsw+4     
-	lpsw	.Ldisabpsw     
-
-# FIXME pre-initialized data should be listed first
-# NULLed storage can be taken from anywhere ;) 
-.Lblklst:	
-	.long   0x00002000     
-	.align 8
-.Ldisabpsw: 
-	.long 0x000a0000,0x00000000
-.Lwaitpsw:
-	.long 0x020a0000,0x00000000+.Ltpi
-.Lorb:	
-	.long 0x0049504c,0x0080ff00	# intparm is " IPL"
-.Lc6:	.long 0xff000000
-.Lstart:
-	.long	0x00010000              # do not separate .Lstart and .Lparm
-.Lparm:	
-	.long	0x00008000              # they are loaded with a LM
-.L3390:
-	.word 	0x3390
-.L9345:
-	.word	0x9345
-.L3380:
-	.word	0x3380
-.Lnull:	
-	.long 0x00000000,0x00000000
-	.align 4
-.Lrdcdata:
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-.Lirb:
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-	.long 0x00000000,0x00000000
-.Lcountarea:	
-	.word 0x0000			# cyl;
-	.word 0x0000			# head;
-	.byte 0x00			# record;
-	.byte 0x00			# key length;
-	.word 0x0000			# data length == blocksize;
-.Ldedata:
-	.long 0x40c00000,0x00000000
-	.long 0x00000000,0x00000000
-.Llodata:
-	.long 0x06000001,0x00000000
-	.long 0x00000000,0x01000000
-	.long 0x12345678
-	.org 0x7c8
-.Lrdcccw:				# CCW read device characteristics
-	.long 0x64400040,0x00000000+.Lrdcdata
-	.long 0x63400010,0x00000000+.Ldedata
-	.long 0x47400010,0x00000000+.Llodata
-	.long 0x12000008,0x00000000+.Lcountarea
-.Ldeccw:
-	.long 0x63400010,0x00000000+.Ldedata
-.Lloccw:
-	.long 0x47400010,0x00000000+.Llodata
-.Lrdccw:	
-	.long 0x86400000,0x00000000
-	.org 0x800
-# end of pre initialized data is here CCWarea follows
-# from here we load 1k blocklist 
-# end of function
-
diff -urN linux-2.5.67-bk5/arch/s390x/boot/iplfba.S linux-2.5.67-bk6/arch/s390x/boot/iplfba.S
--- linux-2.5.67-bk5/arch/s390x/boot/iplfba.S	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/boot/iplfba.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,131 +0,0 @@
-#
-#  Ipl block for fba devices
-#    Copyright (C) 1998 IBM Corporation
-#    Author(s): Martin Schwidefsky
-#
-#  startup for ipl at address 0
-#  start with restart
-
-# The first 24 byes are loaded by ipl to addresses 0-23 (a PSW and two CCWs).
-# The CCWs on 8-23 are used as a continuation of the implicit ipl channel
-# program. The fba ipl loader only uses the CCW on 8-15 to load the first 512
-# byte block to location 0-511 (the reading starts again at block 0, byte 0).
-# The second CCW is used to store the location of the load list.
-        .org   0
-        .long  0x00080000,0x80000000+_start    # The first 24 byte are loaded
-        .long  0x02000000,0x20000200           # by ipl to addresses 0-23.
-        .long  0x00000001,0x00000001           # (PSW, one CCW & loadlist info).
-
-        .globl _start
-_start:
-	basr  %r13,0
-.LPG0:	
-	l     %r1,0xb8                         # load ipl subchannel number
-        lhi   %r2,0x200                        # location for the loadlist
-        lm    %r3,%r4,0x10                     # blocknr and length of loadlist
-        bras  %r14,.Lloader                    # load loadlist
-
-        lhi   %r11,0x400
-        lhi   %r12,0x200                       # load address of loadlist
-        l     %r3,0(%r12)                      # get first block number
-        l     %r4,4(%r12)                      # get first block count
-        la    %r12,8(%r12)
-        j     .Llistloop
-        .org  0x50
-.Llistloop:
-        lr    %r2,%r11                         # load address
-        lr    %r5,%r4                          # block count
-        mhi   %r5,512
-        la    %r11,0(%r5,%r11)                 # update load address
-        bras  %r14,.Lloader                    # load chunk of the image
-        l     %r3,0(%r12)                      # get next block number
-        icm   %r4,15,4(%r12)                   # get next block count
-        la    %r12,8(%r12)
-        jnz   .Llistloop
-
-#
-# everything loaded, go for it
-#
-        l     %r1,.Lstart-.LPG0(%r13)
-	br    %r1
-
-#
-# subroutine for loading a sequence of block from fba
-# %r2: load address (24 bit address)
-# %r3: number of first block (unsigned long)
-# %r4: number of blocks to load (unsigned short)
-#
-        .org  0xC0
-.Lloader:
-        la    %r5,.Llo-.LPG0(%r13)
-        sth   %r4,2(%r5)                       # initialize block count
-        st    %r3,4(%r5)                       # initialize block number
-        la    %r5,.Lccws-.LPG0(%r13)
-        mhi   %r4,512
-        sth   %r4,22(%r5)                      # initialize byte count
-	icm   %r2,8,16(%r5)
-        st    %r2,16(%r5)                      # initialize CCW data address
-
-        slr   %r2,%r2
-        la    %r3,.Lorb-.LPG0(%r13)            # r2 = address of orb into r2
-        la    %r4,.Ltinfo-.LPG0(%r13)          # r3 = address of tpi info block
-        la    %r5,.Lirb-.LPG0(%r13)            # r4 = address of irb
-
-        lctl  %c6,%c6,.Lc6-.LPG0(%r13)
-.Lldlp:
-        ssch  0(%r3)                           # read blocks
-.Ltpi:
-        tpi   0(%r4)                           # test pending interrupt
-        jz    .Ltpi
-        c     %r1,0(%r4)                       # compare subchannel number
-        jne   .Ltpi
-        tsch  0(%r5)
-        slr   %r0,%r0
-        tm    8(%r5),0x82                      # do we have a problem ?
-        jnz   .Ldwpsw
-        tm    8(%r5),0x04                      # got device end ?
-        jz    .Ltpi
-.Lexit:
-        br    %r14
-
-        .align 8
-.Ldwpsw:.long  0x000a0000,0x00000000
-.Lorb:	.long  0x00000000,0x0000ff00,.Lccws
-.Ltinfo:.long  0
-.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-.Lc6:   .long  0xff000000
-.Lloadp:.long  0,0
-.Lparm:	.long  0x10400
-.Lstart:.long  0x10000
-        .align 8
-.Lccws: .long  0x63000000+.Lde,0x60000010      # define extent
-        .long  0x43000000+.Llo,0x60000008      # locate
-# offset 1 in read CCW: data address (24 bit)
-# offset 6 in read CCW: number of bytes (16 bit)
-        .long  0x42000000,0x20000000           # read
-.Lde:   .long  0x40000200,0x00000000
-        .long  0x00000000,0x00001000
-# offset 2 in .Llo: block count (unsigned short)
-# offset 4 in .Llo: block number (unsigned long)
-.Llo:   .long  0x06000000,0x00000000
-
-        .org   0x200
-        .long  0x00000002,0x0000007f
-        .long  0x00000081,0x0000007f
-        .long  0x00000100,0x0000007f
-        .long  0x0000017f,0x0000007f
-        .long  0x000001fe,0x0000007f
-        .long  0x0000027d,0x0000007f
-        .long  0x000002fc,0x0000007f
-        .long  0x0000037b,0x0000007f
-        .long  0x000003fa,0x0000007f
-        .long  0x00000479,0x0000007f
-        .long  0x000004f8,0x0000007f
-        .long  0x00000577,0x0000007f
-        .long  0x000005f6,0x0000007f
-        .long  0x00000675,0x0000007f
-        .long  0x000006f4,0x0000007f
-        .long  0x00000773,0x0000003f
-        .long  0x00000000,0x00000000
-        .org   0x400
-
diff -urN linux-2.5.67-bk5/arch/s390x/defconfig linux-2.5.67-bk6/arch/s390x/defconfig
--- linux-2.5.67-bk5/arch/s390x/defconfig	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/defconfig	1969-12-31 16:00:00.000000000 -0800
@@ -1,370 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_MMU=y
-CONFIG_SWAP=y
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_ARCH_S390=y
-CONFIG_ARCH_S390X=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-
-#
-# General setup
-#
-CONFIG_SYSVIPC=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
-CONFIG_LOG_BUF_SHIFT=17
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-# CONFIG_MODULE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-CONFIG_KMOD=y
-
-#
-# Base setup
-#
-
-#
-# Processor type and features
-#
-CONFIG_SMP=y
-CONFIG_NR_CPUS=64
-# CONFIG_S390_SUPPORT is not set
-
-#
-# I/O subsystem configuration
-#
-CONFIG_MACHCHK_WARNING=y
-CONFIG_QDIO=y
-# CONFIG_QDIO_PERF_STATS is not set
-
-#
-# Misc
-#
-# CONFIG_PREEMPT is not set
-CONFIG_IPL=y
-# CONFIG_IPL_TAPE is not set
-CONFIG_IPL_VM=y
-CONFIG_KCORE_ELF=y
-CONFIG_BINFMT_ELF=y
-CONFIG_BINFMT_MISC=m
-# CONFIG_PROCESS_DEBUG is not set
-CONFIG_PFAULT=y
-# CONFIG_SHARED_KERNEL is not set
-# CONFIG_PCMCIA is not set
-
-#
-# SCSI support
-#
-# CONFIG_SCSI is not set
-CONFIG_CCW=y
-
-#
-# Block device drivers
-#
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_NBD=m
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_BLK_DEV_XPRAM=m
-
-#
-# S/390 block device drivers
-#
-CONFIG_DASD=y
-# CONFIG_DASD_PROFILE is not set
-CONFIG_DASD_ECKD=y
-CONFIG_DASD_FBA=y
-# CONFIG_DASD_DIAG is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=m
-CONFIG_MD_RAID0=m
-CONFIG_MD_RAID1=m
-CONFIG_MD_RAID5=m
-CONFIG_MD_MULTIPATH=m
-# CONFIG_BLK_DEV_DM is not set
-
-#
-# Character device drivers
-#
-CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=2048
-
-#
-# S/390 character device drivers
-#
-# CONFIG_TN3270 is not set
-CONFIG_TN3215=y
-CONFIG_TN3215_CONSOLE=y
-CONFIG_CCW_CONSOLE=y
-CONFIG_SCLP=y
-CONFIG_SCLP_TTY=y
-CONFIG_SCLP_CONSOLE=y
-CONFIG_SCLP_CPI=m
-CONFIG_S390_TAPE=m
-
-#
-# S/390 tape interface support
-#
-CONFIG_S390_TAPE_BLOCK=y
-
-#
-# S/390 tape hardware support
-#
-CONFIG_S390_TAPE_34XX=m
-CONFIG_HOTPLUG=y
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
-# CONFIG_NETLINK_DEV is not set
-# CONFIG_NETFILTER 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 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_INET_ECN is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_XFRM_USER is not set
-CONFIG_IPV6=m
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-CONFIG_IPV6_SCTP__=m
-# 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_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=y
-CONFIG_NET_SCH_CBQ=m
-# CONFIG_NET_SCH_HTB is not set
-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_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 is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-CONFIG_EQUALIZER=m
-CONFIG_TUN=m
-# CONFIG_ETHERTAP is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_PPP 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_SHAPER is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# S/390 network device drivers
-#
-CONFIG_LCS=m
-CONFIG_CTC=m
-CONFIG_IUCV=m
-CONFIG_CCWGROUP=m
-
-#
-# File systems
-#
-CONFIG_QUOTA=y
-# CONFIG_QFMT_V1 is not set
-# CONFIG_QFMT_V2 is not set
-CONFIG_QUOTACTL=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_REISERFS_FS is not set
-# 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_EXT3_FS=y
-CONFIG_EXT3_FS_XATTR=y
-# CONFIG_EXT3_FS_POSIX_ACL is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UFS_FS is not set
-# CONFIG_XFS_FS is not set
-
-#
-# Network File Systems
-#
-# CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
-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_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=y
-# CONFIG_CIFS is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_AFS_FS is not set
-CONFIG_FS_MBCACHE=y
-
-#
-# 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_IBM_PARTITION=y
-# CONFIG_MAC_PARTITION is not set
-# CONFIG_MSDOS_PARTITION is not set
-# CONFIG_LDM_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SLAB is not set
-# CONFIG_KALLSYMS is not set
-# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
-
-#
-# Security options
-#
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-# CONFIG_CRYPTO_HMAC is not set
-# CONFIG_CRYPTO_NULL is not set
-# CONFIG_CRYPTO_MD4 is not set
-# CONFIG_CRYPTO_MD5 is not set
-# CONFIG_CRYPTO_SHA1 is not set
-# CONFIG_CRYPTO_SHA256 is not set
-# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Library routines
-#
-# CONFIG_CRC32 is not set
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/Makefile linux-2.5.67-bk6/arch/s390x/kernel/Makefile
--- linux-2.5.67-bk5/arch/s390x/kernel/Makefile	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,27 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-extra-y		:= head.o init_task.o
-EXTRA_AFLAGS	:= -traditional
-
-obj-y		:= entry.o bitmap.o traps.o time.o process.o \
-		   setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
-		   semaphore.o reipl.o s390_ext.o debug.o
-
-obj-$(CONFIG_MODULES)		+= s390_ksyms.o module.o
-obj-$(CONFIG_SMP)		+= smp.o
-
-#
-# Kernel debugging
-#
-obj-$(CONFIG_REMOTE_DEBUG)	+= gdb-stub.o #gdb-low.o 
-
-obj-$(CONFIG_S390_SUPPORT)	+= linux32.o signal32.o ioctl32.o wrapper32.o \
-					 exec32.o exec_domain32.o
-obj-$(CONFIG_BINFMT_ELF32)	+= binfmt_elf32.o
-
-#
-# This is just to get the dependencies...
-#
-binfmt_elf32.o:	$(TOPDIR)/fs/binfmt_elf.c
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/asm-offsets.c linux-2.5.67-bk6/arch/s390x/kernel/asm-offsets.c
--- linux-2.5.67-bk5/arch/s390x/kernel/asm-offsets.c	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/asm-offsets.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,31 +0,0 @@
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed to extract
- * and format the required data.
- */
-
-#include <linux/config.h>
-#include <linux/sched.h>
-
-/* Use marker if you need to separate the values later */
-
-#define DEFINE(sym, val, marker) \
-	asm volatile("\n->" #sym " %0 " #val " " #marker : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-int main(void)
-{
-	DEFINE(__THREAD_info, offsetof(struct task_struct, thread_info),);
-	DEFINE(__THREAD_ar2, offsetof(struct task_struct, thread.ar2),);
-	DEFINE(__THREAD_ar4, offsetof(struct task_struct, thread.ar4),);
-	DEFINE(__THREAD_ksp, offsetof(struct task_struct, thread.ksp),);
-	DEFINE(__THREAD_per, offsetof(struct task_struct, thread.per_info),);
-	BLANK();
-	DEFINE(__TI_task, offsetof(struct thread_info, task),);
-	DEFINE(__TI_domain, offsetof(struct thread_info, exec_domain),);
-	DEFINE(__TI_flags, offsetof(struct thread_info, flags),);
-	DEFINE(__TI_cpu, offsetof(struct thread_info, cpu),);
-	DEFINE(__TI_precount, offsetof(struct thread_info, preempt_count),);
-	return 0;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/binfmt_elf32.c linux-2.5.67-bk6/arch/s390x/kernel/binfmt_elf32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/binfmt_elf32.c	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/binfmt_elf32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,214 +0,0 @@
-/*
- * Support for 32-bit Linux for S390 ELF binaries.
- *
- * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Gerhard Tonn (ton@de.ibm.com)
- *
- * Heavily inspired by the 32-bit Sparc compat code which is
- * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com)
- * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek   (jj@ultra.linux.cz)
- */
-
-#define __ASMS390_ELF_H
-
-#include <linux/time.h>
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS	ELFCLASS32
-#define ELF_DATA	ELFDATA2MSB
-#define ELF_ARCH	EM_S390
-
-/*
- * This is used to ensure we don't load something for the wrong architecture.
- */
-#define elf_check_arch(x) \
-	(((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
-         && (x)->e_ident[EI_CLASS] == ELF_CLASS)
-
-/* ELF register definitions */
-#define NUM_GPRS      16
-#define NUM_FPRS      16
-#define NUM_ACRS      16    
-
-#define TASK31_SIZE		(0x80000000UL)
-
-/* For SVR4/S390 the function pointer to be registered with `atexit` is
-   passed in R14. */
-#define ELF_PLAT_INIT(_r, load_addr) \
-	do { \
-	_r->gprs[14] = 0; \
-	set_thread_flag(TIF_31BIT); \
-	} while(0)
-
-#define USE_ELF_CORE_DUMP
-#define ELF_EXEC_PAGESIZE       4096
-
-/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
-   use of this is to invoke "./ld.so someprog" to test out a new version of
-   the loader.  We need to make sure that it is out of the way of the program
-   that it will "exec", and that there is sufficient room for the brk.  */
-
-#define ELF_ET_DYN_BASE         (TASK31_SIZE / 3 * 2)
-
-/* Wow, the "main" arch needs arch dependent functions too.. :) */
-
-/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
-   now struct_user_regs, they are different) */
-
-#define ELF_CORE_COPY_REGS(pr_reg, regs)        \
-	{ \
-	int i; \
-	memcpy(&pr_reg.psw.mask, &regs->psw.mask, 4); \
-	memcpy(&pr_reg.psw.addr, ((char*)&regs->psw.addr)+4, 4); \
-	for(i=0; i<NUM_GPRS; i++) \
-		pr_reg.gprs[i] = regs->gprs[i]; \
-	for(i=0; i<NUM_ACRS; i++) \
-		pr_reg.acrs[i] = regs->acrs[i]; \
-	pr_reg.orig_gpr2 = regs->orig_gpr2; \
-	}
-
-
-
-/* This yields a mask that user programs can use to figure out what
-   instruction set this CPU supports. */
-
-#define ELF_HWCAP (0)
-
-/* This yields a string that ld.so will use to load implementation
-   specific libraries for optimization.  This is more specific in
-   intent than poking at uname or /proc/cpuinfo.
-
-   For the moment, we have only optimizations for the Intel generations,
-   but that could change... */
-
-#define ELF_PLATFORM (NULL)
-
-#define SET_PERSONALITY(ex, ibcs2)			\
-do {							\
-	if (ibcs2)                                      \
-		set_personality(PER_SVR4);              \
-	else if (current->personality != PER_LINUX32)   \
-		set_personality(PER_LINUX);             \
-} while (0)
-
-#include "linux32.h"
-
-typedef _s390_fp_regs32 elf_fpregset_t;
-
-typedef struct
-{
-	
-	_psw_t32	psw;
-	__u32		gprs[__NUM_GPRS]; 
-	__u32		acrs[__NUM_ACRS]; 
-	__u32		orig_gpr2;
-} s390_regs32;
-typedef s390_regs32 elf_gregset_t;
-
-#include <asm/processor.h>
-#include <linux/module.h>
-#include <linux/config.h>
-#include <linux/elfcore.h>
-#include <linux/binfmts.h>
-#include <linux/compat.h>
-
-int setup_arg_pages32(struct linux_binprm *bprm);
-
-#define elf_prstatus elf_prstatus32
-struct elf_prstatus32
-{
-	struct elf_siginfo pr_info;	/* Info associated with signal */
-	short	pr_cursig;		/* Current signal */
-	u32	pr_sigpend;	/* Set of pending signals */
-	u32	pr_sighold;	/* Set of held signals */
-	pid_t	pr_pid;
-	pid_t	pr_ppid;
-	pid_t	pr_pgrp;
-	pid_t	pr_sid;
-	struct compat_timeval pr_utime;	/* User time */
-	struct compat_timeval pr_stime;	/* System time */
-	struct compat_timeval pr_cutime;	/* Cumulative user time */
-	struct compat_timeval pr_cstime;	/* Cumulative system time */
-	elf_gregset_t pr_reg;	/* GP registers */
-	int pr_fpvalid;		/* True if math co-processor being used.  */
-};
-
-#define elf_prpsinfo elf_prpsinfo32
-struct elf_prpsinfo32
-{
-	char	pr_state;	/* numeric process state */
-	char	pr_sname;	/* char for pr_state */
-	char	pr_zomb;	/* zombie */
-	char	pr_nice;	/* nice val */
-	u32	pr_flag;	/* flags */
-	u16	pr_uid;
-	u16	pr_gid;
-	pid_t	pr_pid, pr_ppid, pr_pgrp, pr_sid;
-	/* Lots missing */
-	char	pr_fname[16];	/* filename of executable */
-	char	pr_psargs[ELF_PRARGSZ];	/* initial part of arg list */
-};
-
-#include <linux/highuid.h>
-
-#undef NEW_TO_OLD_UID
-#undef NEW_TO_OLD_GID
-#define NEW_TO_OLD_UID(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
-#define NEW_TO_OLD_GID(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid) 
-
-#define elf_addr_t	u32
-/*
-#define init_elf_binfmt init_elf32_binfmt
-*/
-#undef CONFIG_BINFMT_ELF
-#ifdef CONFIG_BINFMT_ELF32
-#define CONFIG_BINFMT_ELF CONFIG_BINFMT_ELF32
-#endif
-#undef CONFIG_BINFMT_ELF_MODULE
-#ifdef CONFIG_BINFMT_ELF32_MODULE
-#define CONFIG_BINFMT_ELF_MODULE CONFIG_BINFMT_ELF32_MODULE
-#endif
-
-#undef start_thread
-#define start_thread                    start_thread31 
-#define setup_arg_pages(bprm)           setup_arg_pages32(bprm)
-#define elf_map				elf_map32
-
-MODULE_DESCRIPTION("Binary format loader for compatibility with 32bit Linux for S390 binaries,"
-                   " Copyright 2000 IBM Corporation"); 
-MODULE_AUTHOR("Gerhard Tonn <ton@de.ibm.com>");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
-#define jiffies_to_timeval jiffies_to_compat_timeval
-static __inline__ void
-jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
-{
-	value->tv_usec = (jiffies % HZ) * (1000000L / HZ);
-	value->tv_sec = jiffies / HZ;
-}
-
-#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 = 0x40000000; 
-
-	if (prot & PROT_READ) 
-		prot |= PROT_EXEC; 
-
-	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 -urN linux-2.5.67-bk5/arch/s390x/kernel/bitmap.S linux-2.5.67-bk6/arch/s390x/kernel/bitmap.S
--- linux-2.5.67-bk5/arch/s390x/kernel/bitmap.S	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/bitmap.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,56 +0,0 @@
-/*
- *  arch/s390/kernel/bitmap.S
- *    Bitmaps for set_bit, clear_bit, test_and_set_bit, ...
- *    See include/asm-s390/{bitops.h|posix_types.h} for details
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-         .globl _oi_bitmap
-_oi_bitmap:
-         .byte  0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
-
-         .globl _ni_bitmap
-_ni_bitmap:
-         .byte  0xFE,0xFD,0xFB,0xF7,0xEF,0xDF,0xBF,0x7F
-
-         .globl _zb_findmap
-_zb_findmap:
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4 
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4
-         .byte  0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8
-
-         .globl _sb_findmap
-_sb_findmap:
-         .byte  8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-         .byte  4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/cpcmd.c linux-2.5.67-bk6/arch/s390x/kernel/cpcmd.c
--- linux-2.5.67-bk5/arch/s390x/kernel/cpcmd.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/cpcmd.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,55 +0,0 @@
-/*
- *  arch/s390/kernel/cpcmd.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-#include <linux/string.h>
-#include <linux/spinlock.h>
-#include <asm/cpcmd.h>
-#include <asm/ebcdic.h>
-#include <asm/system.h>
-
-static spinlock_t cpcmd_lock = SPIN_LOCK_UNLOCKED;
-static char cpcmd_buf[128];
-
-void cpcmd(char *cmd, char *response, int rlen)
-{
-        const int mask = 0x40000000L;
-	unsigned long flags;
-        int cmdlen;
-
-	spin_lock_irqsave(&cpcmd_lock, flags);
-        cmdlen = strlen(cmd);
-        strcpy(cpcmd_buf, cmd);
-        ASCEBC(cpcmd_buf, cmdlen);
-
-        if (response != NULL && rlen > 0) {
-                asm volatile ("   lrag  2,0(%0)\n"
-                              "   lgr   4,%1\n"
-                              "   o     4,%4\n"
-                              "   lrag  3,0(%2)\n"
-                              "   lgr   5,%3\n"
-                              "   sam31\n"
-                              "   .long 0x83240008 # Diagnose 83\n"
-                              "   sam64"
-                              : /* no output */
-                              : "a" (cpcmd_buf), "d" (cmdlen),
-                                "a" (response), "d" (rlen), "m" (mask)
-                              : "2", "3", "4", "5" );
-                EBCASC(response, rlen);
-        } else {
-                asm volatile ("   lrag  2,0(%0)\n"
-                              "   lgr   3,%1\n"
-                              "   sam31\n"
-                              "   .long 0x83230008 # Diagnose 83\n"
-                              "   sam64"
-                              : /* no output */
-                              : "a" (cpcmd_buf), "d" (cmdlen)
-                              : "2", "3"  );
-        }
-	spin_unlock_irqrestore(&cpcmd_lock, flags);
-}
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/debug.c linux-2.5.67-bk6/arch/s390x/kernel/debug.c
--- linux-2.5.67-bk5/arch/s390x/kernel/debug.c	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/debug.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,1206 +0,0 @@
-/*
- *  arch/s390/kernel/debug.c
- *   S/390 debug facility
- *
- *    Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH,
- *                             IBM Corporation
- *    Author(s): Michael Holzheu (holzheu@de.ibm.com),
- *               Holger Smolinski (Holger.Smolinski@de.ibm.com)
- *
- *    Bugreports to: <Linux390@de.ibm.com>
- */
-
-#include <linux/config.h>
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/ctype.h>
-#include <linux/version.h>
-#include <asm/uaccess.h>
-#include <asm/semaphore.h>
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <asm/debug.h>
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define DEBUG_PROLOG_ENTRY -1
-
-/* typedefs */
-
-typedef struct file_private_info {
-	loff_t offset;			/* offset of last read in file */
-	int    act_area;                /* number of last formated area */
-	int    act_entry;               /* last formated entry (offset */
-                                        /* relative to beginning of last */
-                                        /* formated area) */ 
-	size_t act_entry_offset;        /* up to this offset we copied */
-					/* in last read the last formated */
-					/* entry to userland */
-	char   temp_buf[2048];		/* buffer for output */
-	debug_info_t *debug_info_org;   /* original debug information */
-	debug_info_t *debug_info_snap;	/* snapshot of debug information */
-	struct debug_view *view;	/* used view of debug info */
-} file_private_info_t;
-
-typedef struct
-{
-	char *string;
-	/* 
-	 * This assumes that all args are converted into longs 
-	 * on L/390 this is the case for all types of parameter 
-	 * except of floats, and long long (32 bit) 
-         *
-         */
-	long args[0];
-} debug_sprintf_entry;
-
-
-extern void tod_to_timeval(uint64_t todval, struct timeval *xtime);
-
-/* internal function prototyes */
-
-static int debug_init(void);
-static ssize_t debug_output(struct file *file, char *user_buf,
-			    size_t user_len, loff_t * offset);
-static ssize_t debug_input(struct file *file, const char *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);
-static debug_info_t*  debug_info_create(char *name, int page_order, int nr_areas, int buf_size);
-static void debug_info_get(debug_info_t *);
-static void debug_info_put(debug_info_t *);
-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,
-				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,
-                                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);
-static int debug_raw_format_fn(debug_info_t * id,
-				 struct debug_view *view, char *out_buf,
-				 const char *in_buf);
-static int debug_raw_header_fn(debug_info_t * id, struct debug_view *view,
-                         int area, debug_entry_t * entry, char *out_buf);
-
-static int debug_sprintf_format_fn(debug_info_t * id, struct debug_view *view,
-				   char *out_buf, debug_sprintf_entry *curr_event);
-
-/* globals */
-
-struct debug_view debug_raw_view = {
-	"raw",
-	NULL,
-	&debug_raw_header_fn,
-	&debug_raw_format_fn,
-	NULL,
-	NULL
-};
-
-struct debug_view debug_hex_ascii_view = {
-	"hex_ascii",
-	NULL,
-	&debug_dflt_header_fn,
-	&debug_hex_ascii_format_fn,
-	NULL,
-	NULL
-};
-
-struct debug_view debug_level_view = {
-	"level",
-	&debug_prolog_level_fn,
-	NULL,
-	NULL,
-	&debug_input_level_fn,
-	NULL
-};
-
-struct debug_view debug_flush_view = {
-        "flush",
-        NULL,
-        NULL,
-        NULL,
-        &debug_input_flush_fn,
-        NULL
-};
-
-struct debug_view debug_sprintf_view = {
-	"sprintf",
-	NULL,
-	&debug_dflt_header_fn,
-	(debug_format_proc_t*)&debug_sprintf_format_fn,
-	NULL,
-	NULL
-};
-
-
-unsigned int debug_feature_version = __DEBUG_FEATURE_VERSION;
-
-/* static globals */
-
-static debug_info_t *debug_area_first = NULL;
-static debug_info_t *debug_area_last = NULL;
-DECLARE_MUTEX(debug_lock);
-
-static int initialized;
-
-static struct file_operations debug_file_ops = {
-	.owner	 = THIS_MODULE,
-	.read    = debug_output,
-	.write   = debug_input,	
-	.open    = debug_open,
-	.release = debug_close,
-};
-
-static struct proc_dir_entry *debug_proc_root_entry;
-
-/* functions */
-
-/*
- * debug_info_alloc
- * - alloc new debug-info
- */
-
-static debug_info_t*  debug_info_alloc(char *name, int page_order,
-                                        int nr_areas, int buf_size)
-{
-	debug_info_t* rc;
-	int i;
-
-	/* alloc everything */
-
-	rc = (debug_info_t*) kmalloc(sizeof(debug_info_t), GFP_ATOMIC);
-	if(!rc)
-		goto fail_malloc_rc;
-	rc->active_entry = (int*)kmalloc(nr_areas * sizeof(int), GFP_ATOMIC);
-	if(!rc->active_entry)
-		goto fail_malloc_active_entry;
-	memset(rc->active_entry, 0, nr_areas * sizeof(int));
-	rc->areas = (debug_entry_t **) kmalloc(nr_areas *
-						sizeof(debug_entry_t *),
-						GFP_ATOMIC);
-	if (!rc->areas)
-		goto fail_malloc_areas;
-	for (i = 0; i < nr_areas; i++) {
-		rc->areas[i] = (debug_entry_t *) __get_free_pages(GFP_ATOMIC,
-								page_order);
-		if (!rc->areas[i]) {
-			for (i--; i >= 0; i--) {
-				free_pages((unsigned long) rc->areas[i],
-						page_order);
-			}
-			goto fail_malloc_areas2;
-		} else {
-			memset(rc->areas[i], 0, PAGE_SIZE << page_order);
-		}
-	}
-
-	/* initialize members */
-
-	spin_lock_init(&rc->lock);
-	rc->page_order  = page_order;
-	rc->nr_areas    = nr_areas;
-	rc->active_area = 0;
-	rc->level       = DEBUG_DEFAULT_LEVEL;
-	rc->buf_size    = buf_size;
-	rc->entry_size  = sizeof(debug_entry_t) + buf_size;
-	strncpy(rc->name, name, MIN(strlen(name), (DEBUG_MAX_PROCF_LEN - 1)));
-	rc->name[MIN(strlen(name), (DEBUG_MAX_PROCF_LEN - 1))] = 0;
-	memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *));
-#ifdef CONFIG_PROC_FS
-	memset(rc->proc_entries, 0 ,DEBUG_MAX_VIEWS *
-		sizeof(struct proc_dir_entry*));
-#endif /* CONFIG_PROC_FS */
-	atomic_set(&(rc->ref_count), 0);
-
-	return rc;
-
-fail_malloc_areas2:
-	kfree(rc->areas);
-fail_malloc_areas:
-	kfree(rc->active_entry);
-fail_malloc_active_entry:
-	kfree(rc);
-fail_malloc_rc:
-	return NULL;
-}
-
-/*
- * debug_info_free
- * - free memory debug-info
- */
-
-static void debug_info_free(debug_info_t* db_info){
-	int i;
-	for (i = 0; i < db_info->nr_areas; i++) {
-		free_pages((unsigned long) db_info->areas[i],
-		db_info->page_order);
-	}
-	kfree(db_info->areas);
-	kfree(db_info->active_entry);
-	kfree(db_info);
-}
-
-/*
- * debug_info_create
- * - create new debug-info
- */
-
-static debug_info_t*  debug_info_create(char *name, int page_order, 
-                                        int nr_areas, int buf_size)
-{
-	debug_info_t* rc;
-
-        rc = debug_info_alloc(name, page_order, nr_areas, buf_size);
-        if(!rc) 
-		goto out;
-
-
-	/* create proc rood directory */
-        rc->proc_root_entry = proc_mkdir(rc->name, debug_proc_root_entry);
-
-	/* append new element to linked list */
-        if (debug_area_first == NULL) {
-                /* first element in list */
-                debug_area_first = rc;
-                rc->prev = NULL;
-        } else {
-                /* append element to end of list */
-                debug_area_last->next = rc;
-                rc->prev = debug_area_last;
-        }
-        debug_area_last = rc;
-        rc->next = NULL;
-
-	debug_info_get(rc);
-out:
-	return rc;
-}
-
-/*
- * debug_info_copy
- * - copy debug-info
- */
-
-static debug_info_t* debug_info_copy(debug_info_t* in)
-{
-        int i;
-        debug_info_t* rc;
-        rc = debug_info_alloc(in->name, in->page_order, 
-                                in->nr_areas, in->buf_size);
-        if(!rc)
-                goto out;
-
-        for(i = 0; i < in->nr_areas; i++){
-                memcpy(rc->areas[i],in->areas[i], PAGE_SIZE << in->page_order);
-        }
-out:
-        return rc;
-}
-
-/*
- * debug_info_get
- * - increments reference count for debug-info
- */
-
-static void debug_info_get(debug_info_t * db_info)
-{
-	if (db_info)
-		atomic_inc(&db_info->ref_count);
-}
-
-/*
- * debug_info_put:
- * - decreases reference count for debug-info and frees it if necessary
- */
-
-static void debug_info_put(debug_info_t *db_info)
-{
-	int i;
-
-	if (!db_info)
-		return;
-	if (atomic_dec_and_test(&db_info->ref_count)) {
-#ifdef DEBUG
-		printk(KERN_INFO "debug: freeing debug area %p (%s)\n",
-		       db_info, db_info->name);
-#endif
-		for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
-			if (db_info->views[i] == NULL)
-				continue;
-#ifdef CONFIG_PROC_FS
-			remove_proc_entry(db_info->proc_entries[i]->name,
-					  db_info->proc_root_entry);
-#endif
-		}
-#ifdef CONFIG_PROC_FS
-		remove_proc_entry(db_info->proc_root_entry->name,
-				  debug_proc_root_entry);
-#endif
-		if(db_info == debug_area_first)
-			debug_area_first = db_info->next;
-		if(db_info == debug_area_last)
-			debug_area_last = db_info->prev;
-		if(db_info->prev) db_info->prev->next = db_info->next;
-		if(db_info->next) db_info->next->prev = db_info->prev;
-		debug_info_free(db_info);
-	}
-}
-
-/*
- * debug_format_entry:
- * - format one debug entry and return size of formated data
- */
-
-static int debug_format_entry(file_private_info_t *p_info)
-{
-	debug_info_t *id_org    = p_info->debug_info_org;
-	debug_info_t *id_snap   = p_info->debug_info_snap;
-	struct debug_view *view = p_info->view;
-	debug_entry_t *act_entry;
-	size_t len = 0;
-	if(p_info->act_entry == DEBUG_PROLOG_ENTRY){
-		/* print prolog */
-        	if (view->prolog_proc)
-                	len += view->prolog_proc(id_org, view,p_info->temp_buf);
-		goto out;
-	}
-
-	act_entry = (debug_entry_t *) ((char*)id_snap->areas[p_info->act_area] +
-					p_info->act_entry);
-                        
-	if (act_entry->id.stck == 0LL)
-			goto out;  /* empty entry */
-	if (view->header_proc)
-		len += view->header_proc(id_org, view, p_info->act_area, 
-					act_entry, p_info->temp_buf + len);
-	if (view->format_proc)
-		len += view->format_proc(id_org, view, p_info->temp_buf + len,
-						DEBUG_DATA(act_entry));
-      out:
-        return len;
-}
-
-/*
- * debug_next_entry:
- * - goto next entry in p_info
- */
-
-extern inline int debug_next_entry(file_private_info_t *p_info)
-{
-	debug_info_t *id = p_info->debug_info_snap;
-	if(p_info->act_entry == DEBUG_PROLOG_ENTRY){
-		p_info->act_entry = 0;
-		goto out;
-	}
-	if ((p_info->act_entry += id->entry_size)
-		> ((PAGE_SIZE << (id->page_order)) 
-		- id->entry_size)){
-
-		/* next area */
-		p_info->act_entry = 0;
-        	p_info->act_area++;
-        	if(p_info->act_area >= id->nr_areas)
-			return 1;
-	}
-out:
-	return 0;	
-}
-
-/*
- * debug_output:
- * - called for user read()
- * - 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 */ )
-{
-	size_t count = 0;
-	size_t entry_offset, size = 0;
-	file_private_info_t *p_info;
-
-	p_info = ((file_private_info_t *) file->private_data);
-	if (*offset != p_info->offset) 
-		return -EPIPE;
-	if(p_info->act_area >= p_info->debug_info_snap->nr_areas)
-		return 0;
-
-	entry_offset = p_info->act_entry_offset;
-
-	while(count < len){
-		size = debug_format_entry(p_info);
-		size = MIN((len - count), (size - entry_offset));
-
-		if(size){
-			if (copy_to_user(user_buf + count, 
-					p_info->temp_buf + entry_offset, size))
-			return -EFAULT;
-		}
-		count += size;
-		entry_offset = 0;
-		if(count != len)
-			if(debug_next_entry(p_info)) 
-				goto out;
-	}
-out:
-	p_info->offset           = *offset + count;
-	p_info->act_entry_offset = size;	
-	*offset = p_info->offset;
-	return count;
-}
-
-/*
- * debug_input:
- * - called for user write()
- * - calls input function of view
- */
-
-static ssize_t debug_input(struct file *file,
-			   const char *user_buf, size_t length,
-			   loff_t *offset)
-{
-	int rc = 0;
-	file_private_info_t *p_info;
-
-	down(&debug_lock);
-	p_info = ((file_private_info_t *) file->private_data);
-	if (p_info->view->input_proc)
-		rc = p_info->view->input_proc(p_info->debug_info_org,
-					      p_info->view, file, user_buf,
-					      length, offset);
-	else
-		rc = -EPERM;
-	up(&debug_lock);
-	return rc;		/* number of input characters */
-}
-
-/*
- * debug_open:
- * - called for user open()
- * - copies formated output to private_data area of the file
- *   handle
- */
-
-static int debug_open(struct inode *inode, struct file *file)
-{
-	int i = 0, rc = 0;
-	file_private_info_t *p_info;
-	debug_info_t *debug_info, *debug_info_snapshot;
-
-#ifdef DEBUG
-	printk("debug_open\n");
-#endif
-	down(&debug_lock);
-
-	/* find debug log and view */
-
-	debug_info = debug_area_first;
-	while(debug_info != NULL){
-		for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
-			if (debug_info->views[i] == NULL)
-				continue;
-			else if (debug_info->proc_entries[i] ==
-				 PDE(file->f_dentry->d_inode)) {
-				goto found;	/* found view ! */
-			}
-		}
-		debug_info = debug_info->next;
-	}
-	/* no entry found */
-	rc = -EINVAL;
-	goto out;
-
-      found:
-
-	/* make snapshot of current debug areas to get it consistent */
-
-	debug_info_snapshot = debug_info_copy(debug_info);
-
-	if(!debug_info_snapshot){
-#ifdef DEBUG
-		printk(KERN_ERR "debug_open: debug_info_copy failed (out of mem)\n");
-#endif
-		rc = -ENOMEM;
-		goto out;
-	}
-
-	if ((file->private_data =
-	     kmalloc(sizeof(file_private_info_t), GFP_ATOMIC)) == 0) {
-#ifdef DEBUG
-		printk(KERN_ERR "debug_open: kmalloc failed\n");
-#endif
-		debug_info_free(debug_info_snapshot);	
-		rc = -ENOMEM;
-		goto out;
-	}
-	p_info = (file_private_info_t *) file->private_data;
-	p_info->offset = 0;
-	p_info->debug_info_snap = debug_info_snapshot;
-	p_info->debug_info_org  = debug_info;
-	p_info->view = debug_info->views[i];
-	p_info->act_area = 0;
-	p_info->act_entry = DEBUG_PROLOG_ENTRY;
-	p_info->act_entry_offset = 0;
-
-	debug_info_get(debug_info);
-
-      out:
-	up(&debug_lock);
-	return rc;
-}
-
-/*
- * debug_close:
- * - called for user close()
- * - deletes  private_data area of the file handle
- */
-
-static int debug_close(struct inode *inode, struct file *file)
-{
-	file_private_info_t *p_info;
-#ifdef DEBUG
-	printk("debug_close\n");
-#endif
-	p_info = (file_private_info_t *) file->private_data;
-	debug_info_free(p_info->debug_info_snap);
-	debug_info_put(p_info->debug_info_org);
-	kfree(file->private_data);
-	return 0;		/* success */
-}
-
-/*
- * debug_register:
- * - creates and initializes debug area for the caller
- * - returns handle for debug area
- */
-
-debug_info_t *debug_register
-    (char *name, int page_order, int nr_areas, int buf_size) 
-{
-	debug_info_t *rc = NULL;
-
-	MOD_INC_USE_COUNT;
-	if (!initialized)
-		BUG();
-	down(&debug_lock);
-
-        /* create new debug_info */
-
-	rc = debug_info_create(name, page_order, nr_areas, buf_size);
-	if(!rc) 
-		goto out;
-	debug_register_view(rc, &debug_level_view);
-        debug_register_view(rc, &debug_flush_view);
-#ifdef DEBUG
-	printk(KERN_INFO
-	       "debug: reserved %d areas of %d pages for debugging %s\n",
-	       nr_areas, 1 << page_order, rc->name);
-#endif
-      out:
-        if (rc == NULL){
-		printk(KERN_ERR "debug: debug_register failed for %s\n",name);
-		MOD_DEC_USE_COUNT;
-        }
-	up(&debug_lock);
-	return rc;
-}
-
-/*
- * debug_unregister:
- * - give back debug area
- */
-
-void debug_unregister(debug_info_t * id)
-{
-	if (!id)
-		goto out;
-	down(&debug_lock);
-#ifdef DEBUG
-	printk(KERN_INFO "debug: unregistering %s\n", id->name);
-#endif
-	debug_info_put(id);
-	up(&debug_lock);
-
-	MOD_DEC_USE_COUNT;
-      out:
-	return;
-}
-
-/*
- * debug_set_level:
- * - set actual debug level
- */
-
-void debug_set_level(debug_info_t* id, int new_level)
-{
-	unsigned long flags;
-	if(!id)
-		return;	
-	spin_lock_irqsave(&id->lock,flags);
-        if(new_level == DEBUG_OFF_LEVEL){
-                id->level = DEBUG_OFF_LEVEL;
-                printk(KERN_INFO "debug: %s: switched off\n",id->name);
-        } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) {
-                printk(KERN_INFO
-                        "debug: %s: level %i is out of range (%i - %i)\n",
-                        id->name, new_level, 0, DEBUG_MAX_LEVEL);
-        } else {
-                id->level = new_level;
-#ifdef DEBUG
-                printk(KERN_INFO 
-			"debug: %s: new level %i\n",id->name,id->level);
-#endif
-        }
-	spin_unlock_irqrestore(&id->lock,flags);
-}
-
-
-/*
- * proceed_active_entry:
- * - set active entry to next in the ring buffer
- */
-
-extern inline void proceed_active_entry(debug_info_t * id)
-{
-	if ((id->active_entry[id->active_area] += id->entry_size)
-	    > ((PAGE_SIZE << (id->page_order)) - id->entry_size))
-		id->active_entry[id->active_area] = 0;
-}
-
-/*
- * proceed_active_area:
- * - set active area to next in the ring buffer
- */
-
-extern inline void proceed_active_area(debug_info_t * id)
-{
-	id->active_area++;
-	id->active_area = id->active_area % id->nr_areas;
-}
-
-/*
- * get_active_entry:
- */
-
-extern inline debug_entry_t *get_active_entry(debug_info_t * id)
-{
-	return (debug_entry_t *) ((char *) id->areas[id->active_area] +
-				  id->active_entry[id->active_area]);
-}
-
-/*
- * debug_common:
- * - set timestamp, caller address, cpu number etc.
- */
-
-extern inline debug_entry_t *debug_common(debug_info_t * id, int level, 
-                                    const void *buf, int len, int exception)
-{
-	unsigned long flags;
-	debug_entry_t *active;
-
-	spin_lock_irqsave(&id->lock, flags);
-	active = get_active_entry(id);
-	STCK(active->id.stck);
-	active->id.fields.cpuid = smp_processor_id();
-	active->caller = __builtin_return_address(0);
-	active->id.fields.exception = exception;
-	active->id.fields.level     = level;
-	memset(DEBUG_DATA(active), 0, id->buf_size);
-	memcpy(DEBUG_DATA(active), buf, MIN(len, id->buf_size));
-	proceed_active_entry(id);
-	if(exception)
-		proceed_active_area(id);
-	spin_unlock_irqrestore(&id->lock, flags);
-
-	return active;
-}
-
-/*
- * debug_event_common:
- * - write debug entry with given size
- */
-
-debug_entry_t *debug_event_common(debug_info_t * id, int level, const void *buf,
-			          int len)
-{
-	return debug_common(id, level, buf, len, 0);
-}
-
-/*
- * debug_exception_common:
- * - write debug entry with given size and switch to next debug area
- */
-
-debug_entry_t *debug_exception_common(debug_info_t * id, int level, 
-                                      const void *buf, int len)
-{
-	return debug_common(id, level, buf, len, 1);
-}
-
-/*
- * counts arguments in format string for sprintf view
- */
-
-extern inline int debug_count_numargs(char *string)
-{
-	int numargs=0;
-
-	while(*string) {
-		if(*string++=='%')
-			numargs++;
-	}
-	return(numargs);
-}
-
-/*
- * debug_sprintf_event:
- */
-
-debug_entry_t *debug_sprintf_event(debug_info_t* id,
-                                   int level,char *string,...)
-{
-	va_list   ap;
-	int numargs,alloc_size,idx;
-	debug_sprintf_entry *curr_event;
-	debug_entry_t *retval = NULL;
-
-	if((!id) || (level > id->level))
-		return NULL;
-	else {
-		numargs=debug_count_numargs(string);
-		alloc_size=offsetof(debug_sprintf_entry,args[numargs]);
-		curr_event=alloca(alloc_size);
-
-		if(curr_event){
-			va_start(ap,string);
-			curr_event->string=string;
-			for(idx=0;idx<numargs;idx++)
-				curr_event->args[idx]=va_arg(ap,long);
-			retval=debug_common(id,level, curr_event,alloc_size,0);
-			va_end(ap);
-		}
-		return retval;
-	}
-}
-
-/*
- * debug_sprintf_exception:
- */
-
-debug_entry_t *debug_sprintf_exception(debug_info_t* id,
-                                       int level,char *string,...)
-{
-	va_list   ap;
-	int numargs,alloc_size,idx;
-	debug_sprintf_entry *curr_event;
-	debug_entry_t *retval = NULL;
-
-	if((!id) || (level > id->level))
-		return NULL;
-	else {
-		numargs=debug_count_numargs(string);
-		alloc_size=offsetof(debug_sprintf_entry,args[numargs]);
-		curr_event=alloca(alloc_size);
-
-		if(curr_event){
-			va_start(ap,string);
-			curr_event->string=string;
-			for(idx=0;idx<numargs;idx++)
-				curr_event->args[idx]=va_arg(ap,long);
-			retval=debug_common(id,level, curr_event,alloc_size,1);
-			va_end(ap);
-		}
-		return retval;
-	}
-}
-
-/*
- * debug_init:
- * - is called exactly once to initialize the debug feature
- */
-
-static int __init debug_init(void)
-{
-	int rc = 0;
-
-	down(&debug_lock);
-#ifdef CONFIG_PROC_FS
-	debug_proc_root_entry = proc_mkdir(DEBUG_DIR_ROOT, NULL);
-#endif /* CONFIG_PROC_FS */
-	printk(KERN_INFO "debug: Initialization complete\n");
-	initialized = 1;
-	up(&debug_lock);
-
-	return rc;
-}
-
-/*
- * debug_register_view:
- */
-
-int debug_register_view(debug_info_t * id, struct debug_view *view)
-{
-	int rc = 0;
-	int i;
-	unsigned long flags;
-	mode_t mode = S_IFREG;
-
-	if (!id)
-		goto out;
-	spin_lock_irqsave(&id->lock, flags);
-	for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
-		if (id->views[i] == NULL)
-			break;
-	}
-	if (i == DEBUG_MAX_VIEWS) {
-		printk(KERN_WARNING "debug: cannot register view %s/%s\n",
-			id->name,view->name);
-		printk(KERN_WARNING 
-			"debug: maximum number of views reached (%i)!\n", i);
-		rc = -1;
-	}
-	else {
-		id->views[i] = view;
-		if (view->prolog_proc || view->format_proc || view->header_proc)
-			mode |= S_IRUSR;
-		if (view->input_proc)
-			mode |= S_IWUSR;
-		id->proc_entries[i] = create_proc_entry(view->name, mode,
-							id->proc_root_entry);
-		if (id->proc_entries[i] != NULL)
-			id->proc_entries[i]->proc_fops = &debug_file_ops;
-		rc = 0;
-	}
-	spin_unlock_irqrestore(&id->lock, flags);
-      out:
-	return rc;
-}
-
-/*
- * debug_unregister_view:
- */
-
-int debug_unregister_view(debug_info_t * id, struct debug_view *view)
-{
-	int rc = 0;
-	int i;
-	unsigned long flags;
-
-	if (!id)
-		goto out;
-	spin_lock_irqsave(&id->lock, flags);
-	for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
-		if (id->views[i] == view)
-			break;
-	}
-	if (i == DEBUG_MAX_VIEWS)
-		rc = -1;
-	else {
-#ifdef CONFIG_PROC_FS
-		remove_proc_entry(id->proc_entries[i]->name,
-				  id->proc_root_entry);
-#endif
-		id->views[i] = NULL;
-		rc = 0;
-	}
-	spin_unlock_irqrestore(&id->lock, flags);
-      out:
-	return rc;
-}
-
-/*
- * functions for debug-views
- ***********************************
-*/
-
-/*
- * prints out actual debug level
- */
-
-static int debug_prolog_level_fn(debug_info_t * id,
-				 struct debug_view *view, char *out_buf)
-{
-	int rc = 0;
-
-	if(id->level == -1) rc = sprintf(out_buf,"-\n");
-	else rc = sprintf(out_buf, "%i\n", id->level);
-	return rc;
-}
-
-/*
- * reads new debug level
- */
-
-static int debug_input_level_fn(debug_info_t * id, struct debug_view *view,
-				struct file *file, const char *user_buf,
-				size_t in_buf_size, loff_t * offset)
-{
-	char input_buf[1];
-	int rc = in_buf_size;
-
-	if (*offset != 0)
-		goto out;
-	if (copy_from_user(input_buf, user_buf, 1)){
-		rc = -EFAULT;
-		goto out;
-	}
-	if (isdigit(input_buf[0])) {
-		int new_level = ((int) input_buf[0] - (int) '0');
-		debug_set_level(id, new_level);
-	} else if(input_buf[0] == '-') {
-		debug_set_level(id, DEBUG_OFF_LEVEL);
-	} else {
-		printk(KERN_INFO "debug: level `%c` is not valid\n",
-		       input_buf[0]);
-	}
-      out:
-	*offset += in_buf_size;
-	return rc;		/* number of input characters */
-}
-
-
-/*
- * flushes debug areas
- */
- 
-void debug_flush(debug_info_t* id, int area)
-{
-        unsigned long flags;
-        int i;
-
-        if(!id)
-                return;
-        spin_lock_irqsave(&id->lock,flags);
-        if(area == DEBUG_FLUSH_ALL){
-                id->active_area = 0;
-                memset(id->active_entry, 0, id->nr_areas * sizeof(int));
-                for (i = 0; i < id->nr_areas; i++) 
-                        memset(id->areas[i], 0, PAGE_SIZE << id->page_order);
-                printk(KERN_INFO "debug: %s: all areas flushed\n",id->name);
-        } else if(area >= 0 && area < id->nr_areas) {
-                id->active_entry[area] = 0;
-                memset(id->areas[area], 0, PAGE_SIZE << id->page_order);
-                printk(KERN_INFO
-                        "debug: %s: area %i has been flushed\n",
-                        id->name, area);
-        } else {
-                printk(KERN_INFO
-                        "debug: %s: area %i cannot be flushed (range: %i - %i)\n",
-                        id->name, area, 0, id->nr_areas-1);
-        }
-        spin_unlock_irqrestore(&id->lock,flags);
-}
-
-/*
- * 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,
-                                size_t in_buf_size, loff_t * offset)
-{
-        char input_buf[1];
-        int rc = in_buf_size;
- 
-        if (*offset != 0)
-                goto out;
-        if (copy_from_user(input_buf, user_buf, 1)){
-                rc = -EFAULT;
-                goto out;
-        }
-        if(input_buf[0] == '-') { 
-                debug_flush(id, DEBUG_FLUSH_ALL);
-                goto out;
-        }
-        if (isdigit(input_buf[0])) {
-                int area = ((int) input_buf[0] - (int) '0');
-                debug_flush(id, area);
-                goto out;
-        }
-
-        printk(KERN_INFO "debug: area `%c` is not valid\n", input_buf[0]);
-
-      out:
-        *offset += in_buf_size;
-        return rc;              /* number of input characters */
-}
-
-/*
- * prints debug header in raw format
- */
-
-int debug_raw_header_fn(debug_info_t * id, struct debug_view *view,
-                         int area, debug_entry_t * entry, char *out_buf)
-{
-        int rc;
-
-	rc = sizeof(debug_entry_t);
-	memcpy(out_buf,entry,sizeof(debug_entry_t));
-        return rc;
-}
-
-/*
- * prints debug data in raw format
- */
-
-static int debug_raw_format_fn(debug_info_t * id, struct debug_view *view,
-			       char *out_buf, const char *in_buf)
-{
-	int rc;
-
-	rc = id->buf_size;
-	memcpy(out_buf, in_buf, id->buf_size);
-	return rc;
-}
-
-/*
- * prints debug data in hex/ascii format
- */
-
-static int debug_hex_ascii_format_fn(debug_info_t * id, struct debug_view *view,
-		    		  char *out_buf, const char *in_buf)
-{
-	int i, rc = 0;
-
-	for (i = 0; i < id->buf_size; i++) {
-                rc += sprintf(out_buf + rc, "%02x ",
-                              ((unsigned char *) in_buf)[i]);
-        }
-	rc += sprintf(out_buf + rc, "| ");
-	for (i = 0; i < id->buf_size; i++) {
-		unsigned char c = in_buf[i];
-		if (!isprint(c))
-			rc += sprintf(out_buf + rc, ".");
-		else
-			rc += sprintf(out_buf + rc, "%c", c);
-	}
-	rc += sprintf(out_buf + rc, "\n");
-	return rc;
-}
-
-/*
- * prints header for debug entry
- */
-
-int debug_dflt_header_fn(debug_info_t * id, struct debug_view *view,
-			 int area, debug_entry_t * entry, char *out_buf)
-{
-	struct timeval time_val;
-	unsigned long long time;
-	char *except_str;
-	unsigned long caller;
-	int rc = 0;
-	unsigned int level;
-
-	level = entry->id.fields.level;
-	time = entry->id.stck;
-	/* adjust todclock to 1970 */
-	time -= 0x8126d60e46000000LL - (0x3c26700LL * 1000000 * 4096);
-	tod_to_timeval(time, &time_val);
-
-	if (entry->id.fields.exception)
-		except_str = "*";
-	else
-		except_str = "-";
-	caller = (unsigned long) entry->caller;
-#if defined(CONFIG_ARCH_S390X)
-	rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %016lx  ",
-		      area, time_val.tv_sec, time_val.tv_usec, level,
-		      except_str, entry->id.fields.cpuid, caller);
-#else
-	caller &= 0x7fffffff;
-	rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %08lx  ",
-		      area, time_val.tv_sec, time_val.tv_usec, level,
-		      except_str, entry->id.fields.cpuid, caller);
-#endif
-	return rc;
-}
-
-/*
- * prints debug data sprintf-formated:
- * debug_sprinf_event/exception calls must be used together with this view
- */
-
-#define DEBUG_SPRINTF_MAX_ARGS 10
-
-int debug_sprintf_format_fn(debug_info_t * id, struct debug_view *view,
-                            char *out_buf, debug_sprintf_entry *curr_event)
-{
-	int num_longs, num_used_args = 0,i, rc = 0;
-	int index[DEBUG_SPRINTF_MAX_ARGS];
-
-	/* count of longs fit into one entry */
-	num_longs = id->buf_size /  sizeof(long); 
-
-	if(num_longs < 1)
-		goto out; /* bufsize of entry too small */
-	if(num_longs == 1) {
-		/* no args, we use only the string */
-		strcpy(out_buf, curr_event->string);
-		rc = strlen(curr_event->string);
-		goto out;
-	}
-
-	/* number of arguments used for sprintf (without the format string) */
-	num_used_args   = MIN(DEBUG_SPRINTF_MAX_ARGS, (num_longs - 1));
-
-	memset(index,0, DEBUG_SPRINTF_MAX_ARGS * sizeof(int));
-
-	for(i = 0; i < num_used_args; i++)
-		index[i] = i;
-
-	rc =  sprintf(out_buf, curr_event->string, curr_event->args[index[0]],
-		curr_event->args[index[1]], curr_event->args[index[2]],
-		curr_event->args[index[3]], curr_event->args[index[4]],
-		curr_event->args[index[5]], curr_event->args[index[6]],
-		curr_event->args[index[7]], curr_event->args[index[8]],
-		curr_event->args[index[9]]);
-
-out:
-
-	return rc;
-}
-
-/*
- * clean up module
- */
-void __exit debug_exit(void)
-{
-#ifdef DEBUG
-	printk("debug_cleanup_module: \n");
-#endif
-#ifdef CONFIG_PROC_FS
-	remove_proc_entry(debug_proc_root_entry->name, NULL);
-#endif /* CONFIG_PROC_FS */
-	return;
-}
-
-/*
- * module definitions
- */
-core_initcall(debug_init);
-module_exit(debug_exit);
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(debug_register);
-EXPORT_SYMBOL(debug_unregister); 
-EXPORT_SYMBOL(debug_set_level);
-EXPORT_SYMBOL(debug_register_view);
-EXPORT_SYMBOL(debug_unregister_view);
-EXPORT_SYMBOL(debug_event_common);
-EXPORT_SYMBOL(debug_exception_common);
-EXPORT_SYMBOL(debug_hex_ascii_view);
-EXPORT_SYMBOL(debug_raw_view);
-EXPORT_SYMBOL(debug_dflt_header_fn);
-EXPORT_SYMBOL(debug_sprintf_view);
-EXPORT_SYMBOL(debug_sprintf_exception);
-EXPORT_SYMBOL(debug_sprintf_event);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/ebcdic.c linux-2.5.67-bk6/arch/s390x/kernel/ebcdic.c
--- linux-2.5.67-bk5/arch/s390x/kernel/ebcdic.c	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/ebcdic.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,400 +0,0 @@
-/*
- *  arch/s390/kernel/ebcdic.c
- *    ECBDIC -> ASCII, ASCII -> ECBDIC,
- *    upper to lower case (EBCDIC) conversion tables.
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
- *               Martin Peschke <peschke@fh-brandenburg.de>
- */
-
-#include <linux/module.h>
-#include <asm/types.h>
-
-/*
- * ASCII (IBM PC 437)  -> EBCDIC 037
- */
-__u8 _ascebc[256] =
-{
- /*00 NUL   SOH   STX   ETX   EOT   ENQ   ACK   BEL */
-     0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,
- /*08  BS    HT    LF    VT    FF    CR    SO    SI */
- /*              ->NL                               */
-     0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10 DLE   DC1   DC2   DC3   DC4   NAK   SYN   ETB */
-     0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,
- /*18 CAN    EM   SUB   ESC    FS    GS    RS    US */
- /*                               ->IGS ->IRS ->IUS */
-     0x18, 0x19, 0x3F, 0x27, 0x22, 0x1D, 0x1E, 0x1F,
- /*20  SP     !     "     #     $     %     &     ' */
-     0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,
- /*28   (     )     *     +     ,     -    .      / */
-     0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
- /*30   0     1     2     3     4     5     6     7 */
-     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- /*38   8     9     :     ;     <     =     >     ? */
-     0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
- /*40   @     A     B     C     D     E     F     G */
-     0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- /*48   H     I     J     K     L     M     N     O */
-     0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
- /*50   P     Q     R     S     T     U     V     W */
-     0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,
- /*58   X     Y     Z     [     \     ]     ^     _ */
-     0xE7, 0xE8, 0xE9, 0xBA, 0xE0, 0xBB, 0xB0, 0x6D,
- /*60   `     a     b     c     d     e     f     g */
-     0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- /*68   h     i     j     k     l     m     n     o */
-     0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- /*70   p     q     r     s     t     u     v     w */
-     0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- /*78   x     y     z     {     |     }     ~    DL */
-     0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
- /*80*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*88*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*90*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*98*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*A0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*A8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*B0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*B8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*C0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*C8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*D0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*D8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*E0        sz						*/
-     0x3F, 0x59, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*E8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*F0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*F8*/
-     0x90, 0x3F, 0x3F, 0x3F, 0x3F, 0xEA, 0x3F, 0xFF
-};
-
-/*
- * EBCDIC 037 -> ASCII (IBM PC 437)
- */
-__u8 _ebcasc[256] =
-{
- /* 0x00   NUL   SOH   STX   ETX  *SEL    HT  *RNL   DEL */
-          0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F,
- /* 0x08   -GE  -SPS  -RPT    VT    FF    CR    SO    SI */
-          0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /* 0x10   DLE   DC1   DC2   DC3  -RES   -NL    BS  -POC
-                                  -ENP  ->LF             */
-          0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07,
- /* 0x18   CAN    EM  -UBS  -CU1  -IFS  -IGS  -IRS  -ITB
-                                                    -IUS */
-          0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- /* 0x20   -DS  -SOS    FS  -WUS  -BYP    LF   ETB   ESC
-                                  -INP                   */
-          0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B,
- /* 0x28   -SA  -SFE   -SM  -CSP  -MFA   ENQ   ACK   BEL
-                       -SW                               */ 
-          0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07,
- /* 0x30  ----  ----   SYN   -IR   -PP  -TRN  -NBS   EOT */
-          0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04,
- /* 0x38  -SBS   -IT  -RFF  -CU3   DC4   NAK  ----   SUB */
-          0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A,
- /* 0x40    SP   RSP           �ä              ----       */
-          0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86,
- /* 0x48                       .     <     (     +     | */
-          0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
- /* 0x50     &                                      ---- */
-          0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07,
- /* 0x58           �ß     !     $     *     )     ;       */
-          0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA,
- /* 0x60     -     /  ----     �Ä  ----  ----  ----       */
-          0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F,
- /* 0x68              ----     ,     %     _     >     ? */ 
-          0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
- /* 0x70  ----        ----  ----  ----  ----  ----  ---- */
-          0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- /* 0x78     *     `     :     #     @     '     =     " */
-          0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
- /* 0x80     *     a     b     c     d     e     f     g */
-          0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- /* 0x88     h     i              ----  ----  ----       */
-          0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1,
- /* 0x90     �°     j     k     l     m     n     o     p */
-          0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
- /* 0x98     q     r                    ----        ---- */
-          0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07,
- /* 0xA0           ~     s     t     u     v     w     x */
-          0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- /* 0xA8     y     z              ----  ----  ----  ---- */
-          0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07,
- /* 0xB0     ^                    ----     �§  ----       */
-          0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC,
- /* 0xB8        ----     [     ]  ----  ----  ----  ---- */
-          0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07,
- /* 0xC0     {     A     B     C     D     E     F     G */
-          0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- /* 0xC8     H     I  ----           �ö              ---- */
-          0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07,
- /* 0xD0     }     J     K     L     M     N     O     P */
-          0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- /* 0xD8     Q     R  ----           �ü                   */
-          0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98,
- /* 0xE0     \           S     T     U     V     W     X */
-          0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- /* 0xE8     Y     Z        ----     �Ö  ----  ----  ---- */
-          0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07,
- /* 0xF0     0     1     2     3     4     5     6     7 */
-          0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- /* 0xF8     8     9  ----  ----     �Ü  ----  ----  ---- */
-          0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07
-};
-
-
-/*
- * ASCII (IBM PC 437)  -> EBCDIC 500
- */
-__u8 _ascebc_500[256] =
-{
- /*00 NUL   SOH   STX   ETX   EOT   ENQ   ACK   BEL */
-     0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,
- /*08  BS    HT    LF    VT    FF    CR    SO    SI */
- /*              ->NL                               */
-     0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /*10 DLE   DC1   DC2   DC3   DC4   NAK   SYN   ETB */
-     0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,
- /*18 CAN    EM   SUB   ESC    FS    GS    RS    US */
- /*                               ->IGS ->IRS ->IUS */
-     0x18, 0x19, 0x3F, 0x27, 0x22, 0x1D, 0x1E, 0x1F,
- /*20  SP     !     "     #     $     %     &     ' */
-     0x40, 0x4F, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,
- /*28   (     )     *     +     ,     -    .      / */
-     0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
- /*30   0     1     2     3     4     5     6     7 */
-     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- /*38   8     9     :     ;     <     =     >     ? */
-     0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
- /*40   @     A     B     C     D     E     F     G */
-     0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- /*48   H     I     J     K     L     M     N     O */
-     0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
- /*50   P     Q     R     S     T     U     V     W */
-     0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,
- /*58   X     Y     Z     [     \     ]     ^     _ */
-     0xE7, 0xE8, 0xE9, 0x4A, 0xE0, 0x5A, 0x5F, 0x6D,
- /*60   `     a     b     c     d     e     f     g */
-     0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- /*68   h     i     j     k     l     m     n     o */
-     0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- /*70   p     q     r     s     t     u     v     w */
-     0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,
- /*78   x     y     z     {     |     }     ~    DL */
-     0xA7, 0xA8, 0xA9, 0xC0, 0xBB, 0xD0, 0xA1, 0x07,
- /*80*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*88*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*90*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*98*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*A0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*A8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*B0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*B8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*C0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*C8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*D0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*D8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*E0        sz						*/
-     0x3F, 0x59, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*E8*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*F0*/
-     0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
- /*F8*/
-     0x90, 0x3F, 0x3F, 0x3F, 0x3F, 0xEA, 0x3F, 0xFF
-};
-
-/*
- * EBCDIC 500 -> ASCII (IBM PC 437)
- */
-__u8 _ebcasc_500[256] =
-{
- /* 0x00   NUL   SOH   STX   ETX  *SEL    HT  *RNL   DEL */
-          0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F,
- /* 0x08   -GE  -SPS  -RPT    VT    FF    CR    SO    SI */
-          0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- /* 0x10   DLE   DC1   DC2   DC3  -RES   -NL    BS  -POC
-                                  -ENP  ->LF             */
-          0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07,
- /* 0x18   CAN    EM  -UBS  -CU1  -IFS  -IGS  -IRS  -ITB
-                                                    -IUS */
-          0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- /* 0x20   -DS  -SOS    FS  -WUS  -BYP    LF   ETB   ESC
-                                  -INP                   */
-          0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B,
- /* 0x28   -SA  -SFE   -SM  -CSP  -MFA   ENQ   ACK   BEL
-                       -SW                               */ 
-          0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07,
- /* 0x30  ----  ----   SYN   -IR   -PP  -TRN  -NBS   EOT */
-          0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04,
- /* 0x38  -SBS   -IT  -RFF  -CU3   DC4   NAK  ----   SUB */
-          0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A,
- /* 0x40    SP   RSP           �ä              ----       */
-          0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86,
- /* 0x48                 [     .     <     (     +     ! */
-          0x87, 0xA4, 0x5B, 0x2E, 0x3C, 0x28, 0x2B, 0x21,
- /* 0x50     &                                      ---- */
-          0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07,
- /* 0x58           �ß     ]     $     *     )     ;     ^ */
-          0x8D, 0xE1, 0x5D, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
- /* 0x60     -     /  ----     �Ä  ----  ----  ----       */
-          0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F,
- /* 0x68              ----     ,     %     _     >     ? */ 
-          0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
- /* 0x70  ----        ----  ----  ----  ----  ----  ---- */
-          0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- /* 0x78     *     `     :     #     @     '     =     " */
-          0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
- /* 0x80     *     a     b     c     d     e     f     g */
-          0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
- /* 0x88     h     i              ----  ----  ----       */
-          0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1,
- /* 0x90     �°     j     k     l     m     n     o     p */
-          0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,
- /* 0x98     q     r                    ----        ---- */
-          0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07,
- /* 0xA0           ~     s     t     u     v     w     x */
-          0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- /* 0xA8     y     z              ----  ----  ----  ---- */
-          0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07,
- /* 0xB0                          ----     �§  ----       */
-          0x9B, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC,
- /* 0xB8        ----           |  ----  ----  ----  ---- */
-          0xAB, 0x07, 0xAA, 0x7C, 0x07, 0x07, 0x07, 0x07,
- /* 0xC0     {     A     B     C     D     E     F     G */
-          0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
- /* 0xC8     H     I  ----           �ö              ---- */
-          0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07,
- /* 0xD0     }     J     K     L     M     N     O     P */
-          0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
- /* 0xD8     Q     R  ----           �ü                   */
-          0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98,
- /* 0xE0     \           S     T     U     V     W     X */
-          0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- /* 0xE8     Y     Z        ----     �Ö  ----  ----  ---- */
-          0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07,
- /* 0xF0     0     1     2     3     4     5     6     7 */
-          0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
- /* 0xF8     8     9  ----  ----     �Ü  ----  ----  ---- */
-          0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07
-};
-
-
-/*
- * EBCDIC 037/500 conversion table:
- * from upper to lower case
- */
-__u8 _ebc_tolower[256] =
-{
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-	0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-	0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
-	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-	0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-	0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-	0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
-	0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
-	0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
-	0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
-	0x60, 0x61, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
-	0x48, 0x49, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
-	0x70, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
-	0x58, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-	0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
-	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
-	0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9C, 0x9F,
-	0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
-	0xA8, 0xA9, 0xAA, 0xAB, 0x8C, 0x8D, 0x8E, 0xAF,
-	0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
-	0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
-	0xC0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
-	0x88, 0x89, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
-	0xD0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
-	0x98, 0x99, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
-	0xE0, 0xE1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
-	0xA8, 0xA9, 0xEA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
-	0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-	0xF8, 0xF9, 0xFA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFF
-};
-
-
-/*
- * EBCDIC 037/500 conversion table:
- * from lower to upper case
- */
-__u8 _ebc_toupper[256] =
-{
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-	0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-	0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
-	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
-	0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
-	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
-	0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
-	0x40, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
-	0x68, 0x69, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
-	0x50, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
-	0x78, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
-	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
-	0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
-	0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
-	0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
-	0x80, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
-	0xC8, 0xC9, 0x8A, 0x8B, 0xAC, 0xAD, 0xAE, 0x8F,
-	0x90, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
-	0xD8, 0xD9, 0x9A, 0x9B, 0x9E, 0x9D, 0x9E, 0x9F,
-	0xA0, 0xA1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
-	0xE8, 0xE9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
-	0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
-	0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
-	0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
-	0xC8, 0xC9, 0xCA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
-	0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
-	0xD8, 0xD9, 0xDA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF,
-	0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
-	0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
-	0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-	0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
-};
-
-EXPORT_SYMBOL_NOVERS(_ascebc_500);
-EXPORT_SYMBOL_NOVERS(_ebcasc_500);
-EXPORT_SYMBOL_NOVERS(_ascebc);
-EXPORT_SYMBOL_NOVERS(_ebcasc);
-EXPORT_SYMBOL_NOVERS(_ebc_tolower);
-EXPORT_SYMBOL_NOVERS(_ebc_toupper);
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/entry.S linux-2.5.67-bk6/arch/s390x/kernel/entry.S
--- linux-2.5.67-bk5/arch/s390x/kernel/entry.S	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/entry.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,943 +0,0 @@
-/*
- *  arch/s390/kernel/entry.S
- *    S390 low-level entry points.
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Hartmut Penner (hp@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- */
-
-#include <linux/sys.h>
-#include <linux/linkage.h>
-#include <linux/config.h>
-#include <asm/cache.h>
-#include <asm/lowcore.h>
-#include <asm/errno.h>
-#include <asm/ptrace.h>
-#include <asm/thread_info.h>
-#include <asm/offsets.h>
-
-/*
- * 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_PSW       =  STACK_FRAME_OVERHEAD + PT_PSWMASK
-SP_R0        =  STACK_FRAME_OVERHEAD + PT_GPR0
-SP_R1        =  STACK_FRAME_OVERHEAD + PT_GPR1
-SP_R2        =  STACK_FRAME_OVERHEAD + PT_GPR2
-SP_R3        =  STACK_FRAME_OVERHEAD + PT_GPR3
-SP_R4        =  STACK_FRAME_OVERHEAD + PT_GPR4
-SP_R5        =  STACK_FRAME_OVERHEAD + PT_GPR5
-SP_R6        =  STACK_FRAME_OVERHEAD + PT_GPR6
-SP_R7        =  STACK_FRAME_OVERHEAD + PT_GPR7
-SP_R8        =  STACK_FRAME_OVERHEAD + PT_GPR8
-SP_R9        =  STACK_FRAME_OVERHEAD + PT_GPR9
-SP_R10       =  STACK_FRAME_OVERHEAD + PT_GPR10
-SP_R11       =  STACK_FRAME_OVERHEAD + PT_GPR11
-SP_R12       =  STACK_FRAME_OVERHEAD + PT_GPR12
-SP_R13       =  STACK_FRAME_OVERHEAD + PT_GPR13
-SP_R14       =  STACK_FRAME_OVERHEAD + PT_GPR14
-SP_R15       =  STACK_FRAME_OVERHEAD + PT_GPR15
-SP_AREGS     =  STACK_FRAME_OVERHEAD + PT_ACR0
-SP_ORIG_R2   =  STACK_FRAME_OVERHEAD + PT_ORIGGPR2
-/* Now the additional entries */
-SP_TRAP      =  (SP_ORIG_R2+GPR_SIZE)
-SP_SIZE      =  (SP_TRAP+4)
-
-_TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_RESTART_SVC)
-_TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
-
-/*
- * Register usage in interrupt handlers:
- *    R9  - pointer to current task structure
- *    R13 - pointer to literal pool
- *    R14 - return register for function calls
- *    R15 - kernel stack pointer
- */
-
-        .macro  SAVE_ALL psworg,sync     # system entry macro
-        stmg    %r14,%r15,__LC_SAVE_AREA
-        tm      \psworg+1,0x01           # test problem state bit
-	stam    %a2,%a4,__LC_SAVE_AREA+16
-	.if	\sync
-        jz      1f                       # skip stack setup save
-	.else
-	jnz	0f			 # from user -> load kernel stack
-	lg	%r14,__LC_ASYNC_STACK	 # are we already on the async. stack ?
-	slgr	%r14,%r15
-	srag	%r14,%r14,14
-	jz	1f
-	lg	%r15,__LC_ASYNC_STACK	 # load async. stack
-	j	1f
-	.endif
-0:	lg      %r15,__LC_KERNEL_STACK   # problem state -> load ksp
-	larl	%r14,.Lc_ac
-	lam	%a2,%a4,0(%r14)
-1:      aghi    %r15,-SP_SIZE            # make room for registers & psw
-        nill    %r15,0xfff8              # align stack pointer to 8
-        stmg    %r0,%r14,SP_R0(%r15)     # store gprs 0-14 to kernel stack
-        stg     %r2,SP_ORIG_R2(%r15)     # store original content of gpr 2
-        mvc     SP_R14(16,%r15),__LC_SAVE_AREA # move R15 to stack
-        stam    %a0,%a15,SP_AREGS(%r15)  # store access registers to kst.
-        mvc     SP_AREGS+8(12,%r15),__LC_SAVE_AREA+16 # store ac. regs
-        mvc     SP_PSW(16,%r15),\psworg  # move user PSW to stack
-        lhi     %r0,\psworg              # store trap indication
-        st      %r0,SP_TRAP(%r15)
-        xc      0(8,%r15),0(%r15)        # clear back chain
-        .endm
-
-        .macro  RESTORE_ALL sync         # system exit macro
-        mvc     __LC_RETURN_PSW(16),SP_PSW(%r15) # move user PSW to lowcore
-        lam     %a0,%a15,SP_AREGS(%r15)  # load the access registers
-        lmg     %r0,%r15,SP_R0(%r15)     # load gprs 0-15 of user
-        ni      __LC_RETURN_PSW+1,0xfd   # clear wait state bit
-        lpswe   __LC_RETURN_PSW          # back to caller
-        .endm
-
-        .macro  GET_THREAD_INFO
-	lg	%r9,__LC_KERNEL_STACK    # load pointer to task_struct to %r9
-	aghi	%r9,-16384
-        .endm
-
-
-/*
- * Scheduler resume function, called by switch_to
- *  gpr2 = (task_struct *) prev
- *  gpr3 = (task_struct *) next
- * Returns:
- *  gpr2 = prev
- */
-        .globl  resume
-resume:
-	tm	__THREAD_per+4(%r3),0xe8 # is the new process using per ?
-	jz	resume_noper		# if not we're fine
-        stctg   %c9,%c11,48(%r15)       # We are using per stuff
-        clc     __THREAD_per(24,%r3),48(%r15)
-        je      resume_noper            # we got away without bashing TLB's
-        lctlg   %c9,%c11,__THREAD_per(%r3)	# Nope we didn't
-resume_noper:
-        stmg    %r6,%r15,48(%r15)       # store resume registers of prev task
-	stg	%r15,__THREAD_ksp(%r2)	# store kernel stack to prev->tss.ksp
-	lg	%r15,__THREAD_ksp(%r3)	# load kernel stack from next->tss.ksp
-        stam    %a2,%a2,__THREAD_ar2(%r2)	# store kernel access reg. 2
-        stam    %a4,%a4,__THREAD_ar4(%r2)	# store kernel access reg. 4
-        lam     %a2,%a2,__THREAD_ar2(%r3)	# load kernel access reg. 2
-        lam     %a4,%a4,__THREAD_ar4(%r3)	# load kernel access reg. 4
-        lmg     %r6,%r15,48(%r15)       # load resume registers of next task
-	lg	%r3,__THREAD_info(%r3)  # load thread_info from task struct
-	aghi	%r3,16384
-	stg	%r3,__LC_KERNEL_STACK	# __LC_KERNEL_STACK = new kernel stack
-	br	%r14
-
-/*
- * do_softirq calling function. We want to run the softirq functions on the
- * asynchronous interrupt stack.
- */
-	.global do_call_softirq
-do_call_softirq:
-	stmg	%r12,%r15,48(%r15)
-	lgr	%r12,%r15
-	lg	%r0,__LC_ASYNC_STACK
-	slgr    %r0,%r15
-	srag	%r0,%r0,14
-	je	0f
-	lg	%r15,__LC_ASYNC_STACK
-0:	aghi	%r15,-STACK_FRAME_OVERHEAD
-	stg	%r12,0(%r15)		# store back chain
-	brasl	%r14,do_softirq
-	lmg	%r12,%r15,48(%r12)
-	br	%r14
-	
-/*
- * SVC interrupt handler routine. System calls are synchronous events and
- * are executed with interrupts enabled.
- */
-
-	.globl  system_call
-system_call:
-        SAVE_ALL __LC_SVC_OLD_PSW,1
-	llgh    %r7,__LC_SVC_INT_CODE # get svc number from lowcore
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	stosm   48(%r15),0x03     # reenable interrupts
-sysc_do_restart:
-	larl    %r10,sys_call_table
-        sll     %r7,3
-        tm      SP_PSW+3(%r15),0x01  # are we running in 31 bit mode ?
-        jo      sysc_noemu
-	la      %r10,4(%r10)      # use 31 bit emulation system calls
-sysc_noemu:
-        lgf     %r8,0(%r7,%r10)   # load address of system call routine
-	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
-        jo      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
-                                  # changing anything here !!
-
-sysc_return:
-	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
-	tm	__TI_flags+7(%r9),_TIF_WORK_SVC
-	jnz	sysc_work         # there is work to do (signals etc.)
-sysc_leave:
-        RESTORE_ALL 1
-
-#
-# recheck if there is more work to do
-#
-sysc_work_loop:
-	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	tm	__TI_flags+7(%r9),_TIF_WORK_SVC
-	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
-	jo	sysc_reschedule
-	tm	__TI_flags+7(%r9),_TIF_SIGPENDING
-	jo	sysc_sigpending
-	tm	__TI_flags+7(%r9),_TIF_RESTART_SVC
-	jo	sysc_restart
-	j	sysc_leave
-
-#
-# _TIF_NEED_RESCHED is set, call schedule
-#	
-sysc_reschedule:        
-	stosm   48(%r15),0x03     # reenable interrupts
-	larl    %r14,sysc_work_loop
-        jg      schedule            # return point is sysc_return
-
-#
-# _TIF_SIGPENDING is set, call do_signal
-#
-sysc_sigpending:     
-	stosm   48(%r15),0x03     # reenable interrupts
-        la      %r2,SP_PTREGS(%r15) # load pt_regs
-        sgr     %r3,%r3           # clear *oldset
-	brasl	%r14,do_signal    # call do_signal
-	stnsm   48(%r15),0xfc     # disable I/O and ext. interrupts
-	j	sysc_leave        # out of here, do NOT recheck
-
-#
-# _TIF_RESTART_SVC is set, set up registers and restart svc
-#
-sysc_restart:
-	ni	__TI_flags+3(%r9),255-_TIF_RESTART_SVC # clear TIF_RESTART_SVC
-	stosm	48(%r15),0x03          # reenable interrupts
-	lg	%r7,SP_R2(%r15)        # load new svc number
-	mvc	SP_R2(8,%r15),SP_ORIG_R2(%r15) # restore first argument
-	lmg	%r2,%r6,SP_R2(%r15)    # load svc arguments
-	j	sysc_do_restart        # restart svc
-
-#
-# call syscall_trace before and after system call
-# special linkage: %r12 contains the return address for trace_svc
-#
-sysc_tracesys:
-	srl	%r7,3
-	stg     %r7,SP_R2(%r15)
-        brasl   %r14,syscall_trace
-	lghi	%r7,255           # strace might have changed the
-	ng	%r7,SP_R2(%r15)   #  the system call
-	sll     %r7,3
-	lgf	%r8,0(%r7,%r10)
-sysc_tracego:
-	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
-	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
-        jno     sysc_return
-	larl	%r14,sysc_return    # return point is sysc_return
-	jg	syscall_trace
-
-#
-# a new process exits the kernel with ret_from_fork
-#
-        .globl  ret_from_fork
-ret_from_fork:  
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-#if CONFIG_SMP || CONFIG_PREEMPT
-	larl    %r14,sysc_return
-        jg      schedule_tail     # return to sysc_return
-#else
-	j	sysc_return
-#endif
-
-#
-# clone, fork, vfork, exec and sigreturn need glue,
-# because they all expect pt_regs as parameter,
-# but are called with different parameter.
-# return-address is set up above
-#
-sys_clone_glue: 
-        la      %r2,SP_PTREGS(%r15)    # load pt_regs
-        jg      sys_clone              # branch to sys_clone
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_clone_glue: 
-        la      %r2,SP_PTREGS(%r15)    # load pt_regs
-        jg      sys32_clone            # branch to sys32_clone
-#endif
-
-sys_fork_glue:  
-        la      %r2,SP_PTREGS(%r15)    # load pt_regs
-        jg      sys_fork               # branch to sys_fork
-
-sys_vfork_glue: 
-        la      %r2,SP_PTREGS(%r15)    # load pt_regs
-        jg      sys_vfork              # branch to sys_vfork
-
-sys_execve_glue:        
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs
-	lgr     %r12,%r14             # save return address
-        brasl   %r14,sys_execve       # call sys_execve
-        ltgr    %r2,%r2               # check if execve failed
-        bnz     0(%r12)               # it did fail -> store result in gpr2
-        b       6(%r12)               # SKIP STG 2,SP_R2(15) in
-                                      # system_call/sysc_tracesys
-#ifdef CONFIG_S390_SUPPORT
-sys32_execve_glue:        
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs
-	lgr     %r12,%r14             # save return address
-        brasl   %r14,sys32_execve     # call sys32_execve
-        ltgr    %r2,%r2               # check if execve failed
-        bnz     0(%r12)               # it did fail -> store result in gpr2
-        b       6(%r12)               # SKIP STG 2,SP_R2(15) in
-                                      # system_call/sysc_tracesys
-#endif
-
-sys_sigreturn_glue:     
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys_sigreturn         # branch to sys_sigreturn
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_sigreturn_glue:     
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys32_sigreturn       # branch to sys32_sigreturn
-#endif
-
-sys_rt_sigreturn_glue:     
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys_rt_sigreturn      # branch to sys_sigreturn
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_rt_sigreturn_glue:     
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys32_rt_sigreturn    # branch to sys32_sigreturn
-#endif
-
-#
-# sigsuspend and rt_sigsuspend need pt_regs as an additional
-# parameter and they have to skip the store of %r2 into the
-# user register %r2 because the return value was set in 
-# sigsuspend and rt_sigsuspend already and must not be overwritten!
-#
-
-sys_sigsuspend_glue:    
-        lgr     %r5,%r4               # move mask back
-        lgr     %r4,%r3               # move history1 parameter
-        lgr     %r3,%r2               # move history0 parameter
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
-	la      %r14,6(%r14)          # skip store of return value
-        jg      sys_sigsuspend        # branch to sys_sigsuspend
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_sigsuspend_glue:    
-	llgfr	%r4,%r4               # unsigned long			
-        lgr     %r5,%r4               # move mask back
-	lgfr	%r3,%r3               # int			
-        lgr     %r4,%r3               # move history1 parameter
-	lgfr	%r2,%r2               # int			
-        lgr     %r3,%r2               # move history0 parameter
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
-	la      %r14,6(%r14)          # skip store of return value
-        jg      sys32_sigsuspend      # branch to sys32_sigsuspend
-#endif
-
-sys_rt_sigsuspend_glue: 
-        lgr     %r4,%r3               # move sigsetsize parameter
-        lgr     %r3,%r2               # move unewset parameter
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
-	la      %r14,6(%r14)          # skip store of return value
-        jg      sys_rt_sigsuspend     # branch to sys_rt_sigsuspend
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_rt_sigsuspend_glue: 
-	llgfr	%r3,%r3               # size_t			
-        lgr     %r4,%r3               # move sigsetsize parameter
-	llgtr	%r2,%r2               # sigset_emu31_t *
-        lgr     %r3,%r2               # move unewset parameter
-        la      %r2,SP_PTREGS(%r15)   # load pt_regs as first parameter
-	la      %r14,6(%r14)          # skip store of return value
-        jg      sys32_rt_sigsuspend   # branch to sys32_rt_sigsuspend
-#endif
-
-sys_sigaltstack_glue:
-        la      %r4,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys_sigaltstack       # branch to sys_sigreturn
-
-#ifdef CONFIG_S390_SUPPORT
-sys32_sigaltstack_glue:
-        la      %r4,SP_PTREGS(%r15)   # load pt_regs as parameter
-        jg      sys32_sigaltstack_wrapper # branch to sys_sigreturn
-#endif
-
-#ifdef CONFIG_S390_SUPPORT
-#define SYSCALL(esame,esa) esame,esa
-#else
-#define SYSCALL(esame,esa) esame,sys_ni_syscall
-#endif
-
-	.globl  sys_call_table	
-sys_call_table:
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 0 */
-        .long  SYSCALL(sys_exit,sys32_exit_wrapper)
-        .long  SYSCALL(sys_fork_glue,sys_fork_glue)
-        .long  SYSCALL(sys_read,sys32_read_wrapper)
-        .long  SYSCALL(sys_write,sys32_write_wrapper)
-        .long  SYSCALL(sys_open,sys32_open_wrapper)             /* 5 */
-        .long  SYSCALL(sys_close,sys32_close_wrapper)
-        .long  SYSCALL(sys_restart_syscall,sys_ni_syscall)
-        .long  SYSCALL(sys_creat,sys32_creat_wrapper)
-        .long  SYSCALL(sys_link,sys32_link_wrapper)
-        .long  SYSCALL(sys_unlink,sys32_unlink_wrapper)         /* 10 */
-        .long  SYSCALL(sys_execve_glue,sys32_execve_glue)
-        .long  SYSCALL(sys_chdir,sys32_chdir_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_time_wrapper) /* old time syscall */
-        .long  SYSCALL(sys_mknod,sys32_mknod_wrapper)
-        .long  SYSCALL(sys_chmod,sys32_chmod_wrapper)           /* 15 */
-        .long  SYSCALL(sys_ni_syscall,sys32_lchown16_wrapper)   /* old lchown16 syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old break syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old stat syscall */
-        .long  SYSCALL(sys_lseek,sys32_lseek_wrapper)
-        .long  SYSCALL(sys_getpid,sys_getpid) /* 20 */
-        .long  SYSCALL(sys_mount,sys32_mount_wrapper)
-        .long  SYSCALL(sys_oldumount,sys32_oldumount_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_setuid16_wrapper)   /* old setuid16 syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys32_getuid16)   /* old getuid16 syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys32_stime_wrapper) /* 25 old stime syscall */
-        .long  SYSCALL(sys_ptrace,sys32_ptrace_wrapper)
-        .long  SYSCALL(sys_alarm,sys32_alarm_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old fstat syscall */
-        .long  SYSCALL(sys_pause,sys32_pause)
-        .long  SYSCALL(sys_utime,compat_sys_utime_wrapper)           /* 30 */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old stty syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old gtty syscall */
-        .long  SYSCALL(sys_access,sys32_access_wrapper)
-        .long  SYSCALL(sys_nice,sys32_nice_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ftime syscall */
-        .long  SYSCALL(sys_sync,sys_sync)
-        .long  SYSCALL(sys_kill,sys32_kill_wrapper)
-        .long  SYSCALL(sys_rename,sys32_rename_wrapper)
-        .long  SYSCALL(sys_mkdir,sys32_mkdir_wrapper)
-        .long  SYSCALL(sys_rmdir,sys32_rmdir_wrapper)           /* 40 */
-        .long  SYSCALL(sys_dup,sys32_dup_wrapper)
-        .long  SYSCALL(sys_pipe,sys32_pipe_wrapper)
-        .long  SYSCALL(sys_times,compat_sys_times_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old prof syscall */
-        .long  SYSCALL(sys_brk,sys32_brk_wrapper)               /* 45 */
-        .long  SYSCALL(sys_ni_syscall,sys32_setgid16)   /* old setgid16 syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys32_getgid16)   /* old getgid16 syscall*/
-        .long  SYSCALL(sys_signal,sys32_signal_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_geteuid16)  /* old geteuid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_getegid16)  /* old getegid16 syscall */
-        .long  SYSCALL(sys_acct,sys32_acct_wrapper)
-        .long  SYSCALL(sys_umount,sys32_umount_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old lock syscall */
-        .long  SYSCALL(sys_ioctl,sys32_ioctl_wrapper)
-        .long  SYSCALL(sys_fcntl,compat_sys_fcntl_wrapper)   /* 55 */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* intel mpx syscall */
-        .long  SYSCALL(sys_setpgid,sys32_setpgid_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ulimit syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */
-        .long  SYSCALL(sys_umask,sys32_umask_wrapper)           /* 60 */
-        .long  SYSCALL(sys_chroot,sys32_chroot_wrapper)
-        .long  SYSCALL(sys_ustat,sys32_ustat_wrapper)
-        .long  SYSCALL(sys_dup2,sys32_dup2_wrapper)
-        .long  SYSCALL(sys_getppid,sys_getppid)
-        .long  SYSCALL(sys_getpgrp,sys_getpgrp)       /* 65 */
-        .long  SYSCALL(sys_setsid,sys_setsid)
-        .long  SYSCALL(sys_sigaction,sys32_sigaction_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old sgetmask syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old ssetmask syscall*/
-        .long  SYSCALL(sys_ni_syscall,sys32_setreuid16_wrapper) /* old setreuid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_setregid16_wrapper) /* old setregid16 syscall */
-        .long  SYSCALL(sys_sigsuspend_glue,sys32_sigsuspend_glue)
-        .long  SYSCALL(sys_sigpending,compat_sys_sigpending_wrapper)
-        .long  SYSCALL(sys_sethostname,sys32_sethostname_wrapper)
-        .long  SYSCALL(sys_setrlimit,sys32_setrlimit_wrapper)   /* 75 */
-        .long  SYSCALL(sys_getrlimit,sys32_old_getrlimit_wrapper) 
-        .long  SYSCALL(sys_getrusage,sys32_getrusage_wrapper)
-        .long  SYSCALL(sys_gettimeofday,sys32_gettimeofday_wrapper)
-        .long  SYSCALL(sys_settimeofday,sys32_settimeofday_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_getgroups16_wrapper) /* old getgroups16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_setgroups16_wrapper) /* old setgroups16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old select syscall */
-        .long  SYSCALL(sys_symlink,sys32_symlink_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old lstat syscall */
-        .long  SYSCALL(sys_readlink,sys32_readlink_wrapper)     /* 85 */
-        .long  SYSCALL(sys_uselib,sys32_uselib_wrapper)
-        .long  SYSCALL(sys_swapon,sys32_swapon_wrapper)
-        .long  SYSCALL(sys_reboot,sys32_reboot_wrapper)
-        .long  SYSCALL(sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */
-        .long  SYSCALL(old_mmap,old32_mmap_wrapper)       /* 90 */
-        .long  SYSCALL(sys_munmap,sys32_munmap_wrapper)
-        .long  SYSCALL(sys_truncate,sys32_truncate_wrapper)
-        .long  SYSCALL(sys_ftruncate,sys32_ftruncate_wrapper)
-        .long  SYSCALL(sys_fchmod,sys32_fchmod_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_fchown16_wrapper)   /* old fchown16 syscall*/
-        .long  SYSCALL(sys_getpriority,sys32_getpriority_wrapper)
-        .long  SYSCALL(sys_setpriority,sys32_setpriority_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old profil syscall */
-        .long  SYSCALL(sys_statfs,compat_sys_statfs_wrapper)
-        .long  SYSCALL(sys_fstatfs,compat_sys_fstatfs_wrapper)   /* 100 */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall)
-        .long  SYSCALL(sys_socketcall,compat_sys_socketcall_wrapper)
-        .long  SYSCALL(sys_syslog,sys32_syslog_wrapper)
-        .long  SYSCALL(sys_setitimer,compat_sys_setitimer_wrapper)
-        .long  SYSCALL(sys_getitimer,compat_sys_getitimer_wrapper)   /* 105 */
-        .long  SYSCALL(sys_newstat,compat_sys_newstat_wrapper)
-        .long  SYSCALL(sys_newlstat,compat_sys_newlstat_wrapper)
-        .long  SYSCALL(sys_newfstat,compat_sys_newfstat_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old uname syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* iopl for i386 */
-        .long  SYSCALL(sys_vhangup,sys_vhangup)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old "idle" system call */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* vm86old for i386 */
-        .long  SYSCALL(sys_wait4,sys32_wait4_wrapper)
-        .long  SYSCALL(sys_swapoff,sys32_swapoff_wrapper)       /* 115 */
-        .long  SYSCALL(sys_sysinfo,sys32_sysinfo_wrapper)
-        .long  SYSCALL(sys_ipc,sys32_ipc_wrapper)
-        .long  SYSCALL(sys_fsync,sys32_fsync_wrapper)
-        .long  SYSCALL(sys_sigreturn_glue,sys32_sigreturn_glue)
-        .long  SYSCALL(sys_clone_glue,sys32_clone_glue) /* 120 */
-        .long  SYSCALL(sys_setdomainname,sys32_setdomainname_wrapper)
-        .long  SYSCALL(s390x_newuname,sys32_newuname_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* modify_ldt for i386 */
-        .long  SYSCALL(sys_adjtimex,sys32_adjtimex_wrapper)
-        .long  SYSCALL(sys_mprotect,sys32_mprotect_wrapper) /* 125 */
-        .long  SYSCALL(sys_sigprocmask,compat_sys_sigprocmask_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old "create module" */
-        .long  SYSCALL(sys_init_module,sys32_init_module_wrapper)
-        .long  SYSCALL(sys_delete_module,sys32_delete_module_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* 130: old get_kernel_syms */
-        .long  SYSCALL(sys_quotactl,sys32_quotactl_wrapper)
-        .long  SYSCALL(sys_getpgid,sys32_getpgid_wrapper)
-        .long  SYSCALL(sys_fchdir,sys32_fchdir_wrapper)
-        .long  SYSCALL(sys_bdflush,sys32_bdflush_wrapper)
-        .long  SYSCALL(sys_sysfs,sys32_sysfs_wrapper)           /* 135 */
-        .long  SYSCALL(s390x_personality,sys32_personality_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* for afs_syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_setfsuid16_wrapper) /* old setfsuid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_setfsgid16_wrapper) /* old setfsgid16 syscall */
-        .long  SYSCALL(sys_llseek,sys32_llseek_wrapper)         /* 140 */
-        .long  SYSCALL(sys_getdents,sys32_getdents_wrapper)
-        .long  SYSCALL(sys_select,sys32_select_wrapper)
-        .long  SYSCALL(sys_flock,sys32_flock_wrapper)
-        .long  SYSCALL(sys_msync,sys32_msync_wrapper)
-        .long  SYSCALL(sys_readv,sys32_readv_wrapper)           /* 145 */
-        .long  SYSCALL(sys_writev,sys32_writev_wrapper)
-        .long  SYSCALL(sys_getsid,sys32_getsid_wrapper)
-        .long  SYSCALL(sys_fdatasync,sys32_fdatasync_wrapper)
-        .long  SYSCALL(sys_sysctl,sys32_sysctl_wrapper)
-        .long  SYSCALL(sys_mlock,sys32_mlock_wrapper)           /* 150 */
-        .long  SYSCALL(sys_munlock,sys32_munlock_wrapper)
-        .long  SYSCALL(sys_mlockall,sys32_mlockall_wrapper)
-        .long  SYSCALL(sys_munlockall,sys_munlockall)
-        .long  SYSCALL(sys_sched_setparam,sys32_sched_setparam_wrapper)
-        .long  SYSCALL(sys_sched_getparam,sys32_sched_getparam_wrapper) /* 155 */
-        .long  SYSCALL(sys_sched_setscheduler,sys32_sched_setscheduler_wrapper)
-        .long  SYSCALL(sys_sched_getscheduler,sys32_sched_getscheduler_wrapper)
-        .long  SYSCALL(sys_sched_yield,sys_sched_yield)
-        .long  SYSCALL(sys_sched_get_priority_max,sys32_sched_get_priority_max_wrapper)
-        .long  SYSCALL(sys_sched_get_priority_min,sys32_sched_get_priority_min_wrapper)
-        .long  SYSCALL(sys_sched_rr_get_interval,sys32_sched_rr_get_interval_wrapper)
-        .long  SYSCALL(sys_nanosleep,compat_sys_nanosleep_wrapper)
-        .long  SYSCALL(sys_mremap,sys32_mremap_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_setresuid16_wrapper) /* old setresuid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_getresuid16_wrapper) /* old getresuid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* for vm86 */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* old sys_query_module */
-        .long  SYSCALL(sys_poll,sys32_poll_wrapper)
-        .long  SYSCALL(sys_nfsservctl,sys32_nfsservctl_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_setresgid16_wrapper) /* old setresgid16 syscall */
-        .long  SYSCALL(sys_ni_syscall,sys32_getresgid16_wrapper) /* old getresgid16 syscall */
-        .long  SYSCALL(sys_prctl,sys32_prctl_wrapper)
-        .long  SYSCALL(sys_rt_sigreturn_glue,sys32_rt_sigreturn_glue)
-        .long  SYSCALL(sys_rt_sigaction,sys32_rt_sigaction_wrapper)
-        .long  SYSCALL(sys_rt_sigprocmask,sys32_rt_sigprocmask_wrapper) /* 175 */
-        .long  SYSCALL(sys_rt_sigpending,sys32_rt_sigpending_wrapper)
-        .long  SYSCALL(sys_rt_sigtimedwait,sys32_rt_sigtimedwait_wrapper)
-        .long  SYSCALL(sys_rt_sigqueueinfo,sys32_rt_sigqueueinfo_wrapper)
-        .long  SYSCALL(sys_rt_sigsuspend_glue,sys32_rt_sigsuspend_glue)
-        .long  SYSCALL(sys_pread64,sys32_pread64_wrapper)           /* 180 */
-        .long  SYSCALL(sys_pwrite64,sys32_pwrite64_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_chown16_wrapper)    /* old chown16 syscall */
-        .long  SYSCALL(sys_getcwd,sys32_getcwd_wrapper)
-        .long  SYSCALL(sys_capget,sys32_capget_wrapper)
-        .long  SYSCALL(sys_capset,sys32_capset_wrapper)         /* 185 */
-        .long  SYSCALL(sys_sigaltstack_glue,sys32_sigaltstack_glue)
-        .long  SYSCALL(sys_sendfile,sys32_sendfile_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams1 */
-        .long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* streams2 */
-        .long  SYSCALL(sys_vfork_glue,sys_vfork_glue) /* 190 */
-        .long  SYSCALL(sys_getrlimit,sys32_getrlimit_wrapper)
-	.long  SYSCALL(sys_mmap2,sys32_mmap2_wrapper)
-	.long  SYSCALL(sys_ni_syscall,sys32_truncate64_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_ftruncate64_wrapper)
-        .long  SYSCALL(sys_ni_syscall,sys32_stat64_wrapper)     /* 195 */
-        .long  SYSCALL(sys_ni_syscall,sys32_lstat64_wrapper)   
-        .long  SYSCALL(sys_ni_syscall,sys32_fstat64_wrapper)    
-	.long  SYSCALL(sys_lchown,sys32_lchown_wrapper)
-	.long  SYSCALL(sys_getuid,sys_getuid)
-	.long  SYSCALL(sys_getgid,sys_getgid)         /* 200 */
-	.long  SYSCALL(sys_geteuid,sys_geteuid)
-	.long  SYSCALL(sys_getegid,sys_getegid)
-	.long  SYSCALL(sys_setreuid,sys32_setreuid_wrapper)
-	.long  SYSCALL(sys_setregid,sys32_setregid_wrapper)
-	.long  SYSCALL(sys_getgroups,sys32_getgroups_wrapper)  /* 205 */
-	.long  SYSCALL(sys_setgroups,sys32_setgroups_wrapper)
-	.long  SYSCALL(sys_fchown,sys32_fchown_wrapper)
-	.long  SYSCALL(sys_setresuid,sys32_setresuid_wrapper)
-	.long  SYSCALL(sys_getresuid,sys32_getresuid_wrapper)
-	.long  SYSCALL(sys_setresgid,sys32_setresgid_wrapper)  /* 210 */
-	.long  SYSCALL(sys_getresgid,sys32_getresgid_wrapper)
-	.long  SYSCALL(sys_chown,sys32_chown_wrapper)
-	.long  SYSCALL(sys_setuid,sys32_setuid_wrapper)
-	.long  SYSCALL(sys_setgid,sys32_setgid_wrapper)
-	.long  SYSCALL(sys_setfsuid,sys32_setfsuid_wrapper)   /* 215 */
-	.long  SYSCALL(sys_setfsgid,sys32_setfsgid_wrapper)
-        .long  SYSCALL(sys_pivot_root,sys32_pivot_root_wrapper)
-        .long  SYSCALL(sys_mincore,sys32_mincore_wrapper)
-        .long  SYSCALL(sys_madvise,sys32_madvise_wrapper)
-	.long  SYSCALL(sys_getdents64,sys32_getdents64_wrapper)/* 220 */
-	.long  SYSCALL(sys_ni_syscall,compat_sys_fcntl64_wrapper)
-	.long  SYSCALL(sys_readahead,sys32_readahead)
-	.long  SYSCALL(sys_ni_syscall,sys32_sendfile64)
-	.long  SYSCALL(sys_setxattr,sys32_setxattr_wrapper)
-	.long  SYSCALL(sys_lsetxattr,sys32_lsetxattr_wrapper)	/* 225 */
-	.long  SYSCALL(sys_fsetxattr,sys32_fsetxattr_wrapper)
-	.long  SYSCALL(sys_getxattr,sys32_getxattr_wrapper)
-	.long  SYSCALL(sys_lgetxattr,sys32_lgetxattr_wrapper)
-	.long  SYSCALL(sys_fgetxattr,sys32_fgetxattr_wrapper)
-	.long  SYSCALL(sys_listxattr,sys32_listxattr_wrapper)	/* 230 */
-	.long  SYSCALL(sys_llistxattr,sys32_llistxattr_wrapper)
-	.long  SYSCALL(sys_flistxattr,sys32_flistxattr_wrapper)
-	.long  SYSCALL(sys_removexattr,sys32_removexattr_wrapper)
-	.long  SYSCALL(sys_lremovexattr,sys32_lremovexattr_wrapper)
-	.long  SYSCALL(sys_fremovexattr,sys32_fremovexattr_wrapper) /* 235 */
-	.long  SYSCALL(sys_gettid,sys_gettid)
-	.long  SYSCALL(sys_tkill,sys_tkill)
-	.long  SYSCALL(sys_futex,compat_sys_futex_wrapper)
-	.long  SYSCALL(sys_sched_setaffinity,sys32_sched_setaffinity_wrapper)
-	.long  SYSCALL(sys_sched_getaffinity,sys32_sched_getaffinity_wrapper) /* 240 */
-	.long  SYSCALL(sys_ni_syscall,sys_ni_syscall)
-	.long  SYSCALL(sys_ni_syscall,sys_ni_syscall) /* reserved for TUX */
-	.long  SYSCALL(sys_io_setup,sys_ni_syscall)
-	.long  SYSCALL(sys_io_destroy,sys_ni_syscall)
-	.long  SYSCALL(sys_io_getevents,sys_ni_syscall)       /* 245 */
-	.long  SYSCALL(sys_io_submit,sys_ni_syscall)
-	.long  SYSCALL(sys_io_cancel,sys_ni_syscall)
-	.long  SYSCALL(sys_exit_group,sys32_exit_group_wrapper)
-	.long  SYSCALL(sys_epoll_create,sys_ni_syscall)
-	.long  SYSCALL(sys_epoll_ctl,sys_ni_syscall)
-	.long  SYSCALL(sys_epoll_wait,sys_ni_syscall)
-	.long  SYSCALL(sys_set_tid_address,sys32_set_tid_address_wrapper)
-	.long  SYSCALL(sys_fadvise64,sys_ni_syscall)
-        .rept  255-253
-	.long  SYSCALL(sys_ni_syscall,sys_ni_syscall)
-	.endr
-
-/*
- * Program check handler routine
- */
-
-        .globl  pgm_check_handler
-pgm_check_handler:
-/*
- * First we need to check for a special case:
- * Single stepping an instruction that disables the PER event mask will
- * cause a PER event AFTER the mask has been set. Example: SVC or LPSW.
- * For a single stepped SVC the program check handler gets control after
- * the SVC new PSW has been loaded. But we want to execute the SVC first and
- * then handle the PER event. Therefore we update the SVC old PSW to point
- * to the pgm_check_handler and branch to the SVC handler after we checked
- * if we have to load the kernel stack register.
- * For every other possible cause for PER event without the PER mask set
- * we just ignore the PER event (FIXME: is there anything we have to do
- * for LPSW?).
- */
-        tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
-        jnz     pgm_per                  # got per exception -> special case
-	SAVE_ALL __LC_PGM_OLD_PSW,1
-	lghi	%r8,0x7f
-	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
-	ngr	%r8,%r3
-        sll     %r8,3
-	GET_THREAD_INFO
-	stosm   48(%r15),0x03            # reenable interrupts
-        larl    %r1,pgm_check_table
-        lg      %r1,0(%r8,%r1)		 # load address of handler routine
-        la      %r2,SP_PTREGS(%r15)	 # address of register-save area
-	larl	%r14,sysc_return
-        br      %r1			 # branch to interrupt-handler
-
-#
-# handle per exception
-#
-pgm_per:
-        tm      __LC_PGM_OLD_PSW,0x40    # test if per event recording is on
-        jnz     pgm_per_std              # ok, normal per event from user space
-# ok its one of the special cases, now we need to find out which one
-        clc     __LC_PGM_OLD_PSW(16),__LC_SVC_NEW_PSW
-        je      pgm_svcper
-# no interesting special case, ignore PER event
-	lpswe   __LC_PGM_OLD_PSW
-
-#
-# Normal per exception
-#
-pgm_per_std:
-	SAVE_ALL __LC_PGM_OLD_PSW,1
-	GET_THREAD_INFO
-	lghi    %r4,0x7f
-	lgf     %r3,__LC_PGM_ILC	 # load program interruption code
-	stosm   48(%r15),0x03            # reenable interrupts
-        nr      %r4,%r3			 # clear per-event-bit and ilc
-        je      pgm_per_only		 # only per of per+check ?
-        sll     %r4,3
-        larl    %r1,pgm_check_table
-        lg      %r1,0(%r4,%r1)		 # load address of handler routine
-        la      %r2,SP_PTREGS(%r15)	 # address of register-save area
-        basr    %r14,%r1		 # branch to interrupt-handler
-pgm_per_only:
-        la      %r2,SP_PTREGS(15)	 # address of register-save area
-        larl    %r14,sysc_return	 # load adr. of system return
-        jg      handle_per_exception
-
-#
-# it was a single stepped SVC that is causing all the trouble
-#
-pgm_svcper:
-	SAVE_ALL __LC_SVC_OLD_PSW,1
-	llgh    %r8,__LC_SVC_INT_CODE # get svc number from lowcore
-        GET_THREAD_INFO           # load pointer to task_struct to R9
-	stosm   48(%r15),0x03     # reenable interrupts
-	larl    %r7,sys_call_table
-        sll     %r8,3
-        tm      SP_PSW+3(%r15),0x01  # are we running in 31 bit mode ?
-        jo      pgm_svcper_noemu
-	la      %r7,4(%r8)        # use 31 bit emulation system calls
-pgm_svcper_noemu:
-        lgf     %r8,0(%r8,%r7)    # load address of system call routine
-	tm	__TI_flags+3(%r9),_TIF_SYSCALL_TRACE
-        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+3(%r9),_TIF_SIGPENDING
-	jo	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      handle_per_exception
-#
-# call trace before and after sys_call
-#
-pgm_tracesys:
-	lghi    %r0,-ENOSYS
-	stg     %r0,SP_R2(%r15)     # give sysc_trace an -ENOSYS retval
-        brasl   %r14,syscall_trace
-	lg      %r2,SP_R2(%r15)
-	cghi	%r2,256
-	jnl     pgm_svc_go
-	sllg    %r2,%r2,3           # strace wants to change the syscall
-	lgf	%r8,0(%r2,%r7)
-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
-	tm	__TI_flags+7(%r9),_TIF_SYSCALL_TRACE
-        jno     pgm_svcret
-	larl	%r14,pgm_svcret     # return point is sysc_return
-	jg	syscall_trace
-
-/*
- * IO interrupt handler routine
- */
-        .globl io_int_handler
-io_int_handler:
-        SAVE_ALL __LC_IO_OLD_PSW,0
-        GET_THREAD_INFO                # load pointer to task_struct to R9
-        la      %r2,SP_PTREGS(%r15)    # address of register-save area
-	llgh    %r3,__LC_SUBCHANNEL_NR # load subchannel number
-        llgf    %r4,__LC_IO_INT_PARM   # load interruption parm
-        llgf    %r5,__LC_IO_INT_WORD   # load interruption word
-	brasl   %r14,do_IRQ            # call standard irq handler
-
-io_return:
-        tm      SP_PSW+1(%r15),0x01    # returning to user ?
-#ifdef CONFIG_PREEMPT
-	jno     io_preempt             # no -> check for preemptive scheduling
-#else
-        jno     io_leave               # no-> skip resched & signal
-#endif
-	tm	__TI_flags+7(%r9),_TIF_WORK_INT
-	jnz	io_work                # there is work to do (signals etc.)
-io_leave:
-        RESTORE_ALL 0
-
-#ifdef CONFIG_PREEMPT
-io_preempt:
-	icm	%r0,15,__TI_precount(%r9)	
-	jnz     io_leave
-io_resume_loop:
-	tm	__TI_flags+7(%r9),_TIF_NEED_RESCHED
-	jno	io_leave
-	larl    %r1,.Lc_pactive
-	mvc     __TI_precount(4,%r9),0(%r1)
-	# hmpf, we are on the async. stack but to call schedule
-	# we have to move the interrupt frame to the process stack
-	lg	%r1,SP_R15(%r15)
-	aghi	%r1,-SP_SIZE
-	nill	%r1,0xfff8
-	mvc	SP_PTREGS(SP_SIZE-SP_PTREGS,%r1),SP_PTREGS(%r15)
-        xc      0(8,%r1),0(%r1)        # clear back chain
-	lgr	%r15,%r1
-        stosm   48(%r15),0x03          # reenable interrupts
-	brasl   %r14,schedule          # call schedule
-        stnsm   48(%r15),0xfc          # disable I/O and ext. interrupts
-        GET_THREAD_INFO                # load pointer to task_struct to R9
-	xc      __TI_precount(4,%r9),__TI_precount(%r9)
-	j	io_resume_loop
-#endif
-
-#
-# recheck if there is more work to do
-#
-io_work_loop:
-        stnsm   48(%r15),0xfc          # disable I/O and ext. interrupts
-        GET_THREAD_INFO                # load pointer to task_struct to R9
-	tm	__TI_flags+7(%r9),_TIF_WORK_INT
-	jz	io_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
-#
-io_work:
-	tm	__TI_flags+7(%r9),_TIF_NEED_RESCHED
-	jo	io_reschedule
-	tm	__TI_flags+7(%r9),_TIF_SIGPENDING
-	jo	io_sigpending
-	j	io_leave
-
-#
-# _TIF_NEED_RESCHED is set, call schedule
-#	
-io_reschedule:        
-        stosm   48(%r15),0x03       # reenable interrupts
-	larl    %r14,io_work_loop
-        jg      schedule            # call scheduler
-
-#
-# _TIF_SIGPENDING is set, call do_signal
-#
-io_sigpending:     
-        stosm   48(%r15),0x03       # reenable interrupts
-        la      %r2,SP_PTREGS(%r15) # load pt_regs
-        slgr    %r3,%r3             # clear *oldset
-	brasl	%r14,do_signal      # call do_signal
-        stnsm   48(%r15),0xfc       # disable I/O and ext. interrupts
-	j	sysc_leave          # out of here, do NOT recheck
-
-/*
- * External interrupt handler routine
- */
-        .globl  ext_int_handler
-ext_int_handler:
-        SAVE_ALL __LC_EXT_OLD_PSW,0
-        GET_THREAD_INFO                # load pointer to task_struct to R9
-	llgh	%r6,__LC_EXT_INT_CODE  # get interruption code
-	lgr	%r1,%r6		       # calculate index = code & 0xff
-	nill	%r1,0xff
-	sll	%r1,3
-	larl	%r7,ext_int_hash
-	lg	%r7,0(%r1,%r7)	       # get first list entry for hash value
-	ltgr	%r7,%r7		       # == NULL ?
-	jz	io_return	       # yes, nothing to do, exit
-ext_int_loop:
-	ch	%r6,16(%r7)	       # compare external interrupt code
-	jne	ext_int_next
-	lg	%r1,8(%r7)	       # get handler address
-	la	%r2,SP_PTREGS(%r15)    # address of register-save area
-	lgr	%r3,%r6		       # interruption code
-	basr	%r14,%r1	       # call handler
-ext_int_next:
-	lg	%r7,0(%r7)	       # next list entry
-	ltgr	%r7,%r7
-	jnz	ext_int_loop
-	j	io_return
-
-/*
- * Machine check handler routines
- */
-        .globl mcck_int_handler
-mcck_int_handler:
-        SAVE_ALL __LC_MCK_OLD_PSW,0
-	brasl   %r14,s390_do_machine_check
-mcck_return:
-        RESTORE_ALL 0
-
-#ifdef CONFIG_SMP
-/*
- * Restart interruption handler, kick starter for additional CPUs
- */
-        .globl restart_int_handler
-restart_int_handler:
-        lg      %r15,__LC_SAVE_AREA+120 # load ksp
-        lghi    %r10,__LC_CREGS_SAVE_AREA
-        lctlg   %c0,%c15,0(%r10) # get new ctl regs
-        lghi    %r10,__LC_AREGS_SAVE_AREA
-        lam     %a0,%a15,0(%r10)
-        stosm   0(%r15),0x04           # now we can turn dat on
-        lmg     %r6,%r15,48(%r15)      # load registers from clone
-	jg      start_secondary
-#else
-/*
- * If we do not run with SMP enabled, let the new CPU crash ...
- */
-        .globl restart_int_handler
-restart_int_handler:
-        basr    %r1,0
-restart_base:
-        lpswe   restart_crash-restart_base(%r1)
-        .align 8
-restart_crash:
-        .long  0x000a0000,0x00000000,0x00000000,0x00000000
-restart_go:
-#endif
-
-/*
- * Integer constants
- */
-               .align 4
-.Lc_ac:        .long  0,0,1
-.Lc_pactive:   .long  PREEMPT_ACTIVE
-.Lc256:        .quad  256
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/exec32.c linux-2.5.67-bk6/arch/s390x/kernel/exec32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/exec32.c	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/exec32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,93 +0,0 @@
-/*
- * Support for 32-bit Linux for S390 ELF binaries.
- *
- * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Gerhard Tonn (ton@de.ibm.com)
- *
- * Separated from binfmt_elf32.c to reduce exports for module enablement.
- *
- */
-
-#include <linux/config.h>
-#include <linux/slab.h>
-#include <linux/file.h>
-#include <linux/mman.h>
-#include <linux/a.out.h>
-#include <linux/stat.h>
-#include <linux/fcntl.h>
-#include <linux/smp_lock.h>
-#include <linux/init.h>
-#include <linux/pagemap.h>
-#include <linux/highmem.h>
-#include <linux/spinlock.h>
-#include <linux/binfmts.h>
-#include <linux/module.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
-#include <asm/mmu_context.h>
-
-#ifdef CONFIG_KMOD
-#include <linux/kmod.h>
-#endif
-
-
-extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
-
-#undef STACK_TOP
-#define STACK_TOP TASK31_SIZE
-
-int setup_arg_pages32(struct linux_binprm *bprm)
-{
-	unsigned long stack_base;
-	struct vm_area_struct *mpnt;
-	struct mm_struct *mm = current->mm;
-	int i;
-
-	stack_base = STACK_TOP - MAX_ARG_PAGES*PAGE_SIZE;
-	mm->arg_start = bprm->p + stack_base;
-
-	bprm->p += stack_base;
-	if (bprm->loader)
-		bprm->loader += stack_base;
-	bprm->exec += stack_base;
-
-	mpnt = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
-	if (!mpnt) 
-		return -ENOMEM; 
-	
-	if (!vm_enough_memory((STACK_TOP - (PAGE_MASK & (unsigned long) bprm->p))>>PAGE_SHIFT)) {
-		kmem_cache_free(vm_area_cachep, mpnt);
-		return -ENOMEM;
-	}
-
-	down_write(&mm->mmap_sem);
-	{
-		mpnt->vm_mm = mm;
-		mpnt->vm_start = PAGE_MASK & (unsigned long) bprm->p;
-		mpnt->vm_end = STACK_TOP;
-		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;
-	} 
-
-	for (i = 0 ; i < MAX_ARG_PAGES ; i++) {
-		struct page *page = bprm->page[i];
-		if (page) {
-			bprm->page[i] = NULL;
-			put_dirty_page(current,page,stack_base);
-		}
-		stack_base += PAGE_SIZE;
-	}
-	up_write(&mm->mmap_sem);
-	
-	return 0;
-}
-
-EXPORT_SYMBOL(setup_arg_pages32);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/exec_domain32.c linux-2.5.67-bk6/arch/s390x/kernel/exec_domain32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/exec_domain32.c	2003-04-07 10:32:58.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/exec_domain32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,30 +0,0 @@
-/*
- * Support for 32-bit Linux for S390 personality.
- *
- * Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Gerhard Tonn (ton@de.ibm.com)
- *
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/personality.h>
-#include <linux/sched.h>
-
-struct exec_domain s390_exec_domain;
-
-static int __init
-s390_init (void)
-{
-	s390_exec_domain.name = "Linux/s390";
-	s390_exec_domain.handler = NULL;
-	s390_exec_domain.pers_low = PER_LINUX32;
-	s390_exec_domain.pers_high = PER_LINUX32;
-	s390_exec_domain.signal_map = default_exec_domain.signal_map;
-	s390_exec_domain.signal_invmap = default_exec_domain.signal_invmap;
-	register_exec_domain(&s390_exec_domain);
-	return 0;
-}
-
-__initcall(s390_init);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/gdb-stub.c linux-2.5.67-bk6/arch/s390x/kernel/gdb-stub.c
--- linux-2.5.67-bk5/arch/s390x/kernel/gdb-stub.c	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/gdb-stub.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,575 +0,0 @@
-/*
- *  arch/s390/kernel/gdb-stub.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *
- *  Originally written by Glenn Engel, Lake Stevens Instrument Division
- *
- *  Contributed by HP Systems
- *
- *  Modified for SPARC by Stu Grossman, Cygnus Support.
- *
- *  Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
- *  Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
- *
- *  Copyright (C) 1995 Andreas Busse
- */
-
-/*
- *  To enable debugger support, two things need to happen.  One, a
- *  call to set_debug_traps() is necessary in order to allow any breakpoints
- *  or error conditions to be properly intercepted and reported to gdb.
- *  Two, a breakpoint needs to be generated to begin communication.  This
- *  is most easily accomplished by a call to breakpoint().  Breakpoint()
- *  simulates a breakpoint by executing a BREAK instruction.
- *
- *
- *    The following gdb commands are supported:
- *
- * command          function                               Return value
- *
- *    g             return the value of the CPU registers  hex data or ENN
- *    G             set the value of the CPU registers     OK or ENN
- *
- *    mAA..AA,LLLL  Read LLLL bytes at address AA..AA      hex data or ENN
- *    MAA..AA,LLLL: Write LLLL bytes at address AA.AA      OK or ENN
- *
- *    c             Resume at current address              SNN   ( signal NN)
- *    cAA..AA       Continue at address AA..AA             SNN
- *
- *    s             Step one instruction                   SNN
- *    sAA..AA       Step one instruction from AA..AA       SNN
- *
- *    k             kill
- *
- *    ?             What was the last sigval ?             SNN   (signal NN)
- *
- *
- * All commands and responses are sent with a packet which includes a
- * checksum.  A packet consists of
- *
- * $<packet info>#<checksum>.
- *
- * where
- * <packet info> :: <characters representing the command or response>
- * <checksum>    :: < two hex digits computed as modulo 256 sum of <packetinfo>>
- *
- * When a packet is received, it is first acknowledged with either '+' or '-'.
- * '+' indicates a successful transfer.  '-' indicates a failed transfer.
- *
- * Example:
- *
- * Host:                  Reply:
- * $m0,10#2a               +$00010203040506070809101112131415#42
- *
- */
-
-#include <asm/gdb-stub.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-
-
-/*
- * external low-level support routines
- */
-
-extern int putDebugChar(char c);    /* write a single character      */
-extern char getDebugChar(void);     /* read and return a single char */
-extern void fltr_set_mem_err(void);
-extern void trap_low(void);
-
-/*
- * breakpoint and test functions
- */
-extern void breakpoint(void);
-extern void breakinst(void);
-
-/*
- * local prototypes
- */
-
-static void getpacket(char *buffer);
-static void putpacket(char *buffer);
-static int hex(unsigned char ch);
-static int hexToInt(char **ptr, int *intValue);
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault);
-
-
-/*
- * BUFMAX defines the maximum number of characters in inbound/outbound buffers
- * at least NUMREGBYTES*2 are needed for register packets
- */
-#define BUFMAX 2048
-
-static char input_buffer[BUFMAX];
-static char output_buffer[BUFMAX];
-int gdb_stub_initialised = FALSE;	
-static const char hexchars[]="0123456789abcdef";
-
-
-/*
- * Convert ch from a hex digit to an int
- */
-static int hex(unsigned char ch)
-{
-	if (ch >= 'a' && ch <= 'f')
-		return ch-'a'+10;
-	if (ch >= '0' && ch <= '9')
-		return ch-'0';
-	if (ch >= 'A' && ch <= 'F')
-		return ch-'A'+10;
-	return -1;
-}
-
-/*
- * scan for the sequence $<data>#<checksum>
- */
-static void getpacket(char *buffer)
-{
-	unsigned char checksum;
-	unsigned char xmitcsum;
-	int i;
-	int count;
-	unsigned char ch;
-
-	do {
-		/*
-		 * wait around for the start character,
-		 * ignore all other characters
-		 */
-		while ((ch = (getDebugChar() & 0x7f)) != '$') ;
-
-		checksum = 0;
-		xmitcsum = -1;
-		count = 0;
-	
-		/*
-		 * now, read until a # or end of buffer is found
-		 */
-		while (count < BUFMAX) {
-			ch = getDebugChar() & 0x7f;
-			if (ch == '#')
-				break;
-			checksum = checksum + ch;
-			buffer[count] = ch;
-			count = count + 1;
-		}
-
-		if (count >= BUFMAX)
-			continue;
-
-		buffer[count] = 0;
-
-		if (ch == '#') {
-			xmitcsum = hex(getDebugChar() & 0x7f) << 4;
-			xmitcsum |= hex(getDebugChar() & 0x7f);
-
-			if (checksum != xmitcsum)
-				putDebugChar('-');	/* failed checksum */
-			else {
-				putDebugChar('+'); /* successful transfer */
-
-				/*
-				 * if a sequence char is present,
-				 * reply the sequence ID
-				 */
-				if (buffer[2] == ':') {
-					putDebugChar(buffer[0]);
-					putDebugChar(buffer[1]);
-
-					/*
-					 * remove sequence chars from buffer
-					 */
-					count = strlen(buffer);
-					for (i=3; i <= count; i++)
-						buffer[i-3] = buffer[i];
-				}
-			}
-		}
-	}
-	while (checksum != xmitcsum);
-}
-
-/*
- * send the packet in buffer.
- */
-static void putpacket(char *buffer)
-{
-	unsigned char checksum;
-	int count;
-	unsigned char ch;
-
-	/*
-	 * $<packet info>#<checksum>.
-	 */
-
-	do {
-		putDebugChar('$');
-		checksum = 0;
-		count = 0;
-
-		while ((ch = buffer[count]) != 0) {
-			if (!(putDebugChar(ch)))
-				return;
-			checksum += ch;
-			count += 1;
-		}
-
-		putDebugChar('#');
-		putDebugChar(hexchars[checksum >> 4]);
-		putDebugChar(hexchars[checksum & 0xf]);
-
-	}
-	while ((getDebugChar() & 0x7f) != '+');
-}
-
-
-
-/*
- * Convert the memory pointed to by mem into hex, placing result in buf.
- * Return a pointer to the last char put in buf (null), in case of mem fault,
- * return 0.
- * If MAY_FAULT is non-zero, then we will handle memory faults by returning
- * a 0, else treat a fault like any other fault in the stub.
- */
-static unsigned char *mem2hex(char *mem, char *buf, int count, int may_fault)
-{
-	unsigned char ch;
-
-/*	set_mem_fault_trap(may_fault); */
-
-	while (count-- > 0) {
-		ch = *(mem++);
-		if (mem_err)
-			return 0;
-		*buf++ = hexchars[ch >> 4];
-		*buf++ = hexchars[ch & 0xf];
-	}
-
-	*buf = 0;
-
-/*	set_mem_fault_trap(0); */
-
-	return buf;
-}
-
-/*
- * convert the hex array pointed to by buf into binary to be placed in mem
- * return a pointer to the character AFTER the last byte written
- */
-static char *hex2mem(char *buf, char *mem, int count, int may_fault)
-{
-	int i;
-	unsigned char ch;
-
-/*	set_mem_fault_trap(may_fault); */
-
-	for (i=0; i<count; i++)
-	{
-		ch = hex(*buf++) << 4;
-		ch |= hex(*buf++);
-		*(mem++) = ch;
-		if (mem_err)
-			return 0;
-	}
-
-/*	set_mem_fault_trap(0); */
-
-	return mem;
-}
-
-
-
-/*
- * Set up exception handlers for tracing and breakpoints
- */
-void set_debug_traps(void)
-{
-//	unsigned long flags;
-	unsigned char c;
-
-//	save_and_cli(flags);
-	/*
-	 * In case GDB is started before us, ack any packets
-	 * (presumably "$?#xx") sitting there.
-	 */
-	while((c = getDebugChar()) != '$');
-	while((c = getDebugChar()) != '#');
-	c = getDebugChar(); /* eat first csum byte */
-	c = getDebugChar(); /* eat second csum byte */
-	putDebugChar('+'); /* ack it */
-
-	gdb_stub_initialised = TRUE;
-//	restore_flags(flags);
-}
-
-
-/*
- * Trap handler for memory errors.  This just sets mem_err to be non-zero.  It
- * assumes that %l1 is non-zero.  This should be safe, as it is doubtful that
- * 0 would ever contain code that could mem fault.  This routine will skip
- * past the faulting instruction after setting mem_err.
- */
-extern void fltr_set_mem_err(void)
-{
-  /* FIXME: Needs to be written... */
-}
-
-
-/*
- * While we find nice hex chars, build an int.
- * Return number of chars processed.
- */
-static int hexToInt(char **ptr, int *intValue)
-{
-	int numChars = 0;
-	int hexValue;
-
-	*intValue = 0;
-
-	while (**ptr)
-	{
-		hexValue = hex(**ptr);
-		if (hexValue < 0)
-			break;
-
-		*intValue = (*intValue << 4) | hexValue;
-		numChars ++;
-
-		(*ptr)++;
-	}
-
-	return (numChars);
-}
-
-void gdb_stub_get_non_pt_regs(gdb_pt_regs *regs)
-{
-	s390_fp_regs *fpregs=&regs->fp_regs;
-	int has_ieee=save_fp_regs1(fpregs);
-
-	if(!has_ieee)
-	{
-		fpregs->fpc=0;
-		fpregs->fprs[1].d=
-		fpregs->fprs[3].d=
-		fpregs->fprs[5].d=
-		fpregs->fprs[7].d=0;
-		memset(&fpregs->fprs[8].d,0,sizeof(freg_t)*8);
-	}
-}
-
-void gdb_stub_set_non_pt_regs(gdb_pt_regs *regs)
-{
-	restore_fp_regs1(&regs->fp_regs);
-}
-
-void gdb_stub_send_signal(int sigval)
-{
-	char *ptr;
-	ptr = output_buffer;
-
-	/*
-	 * Send trap type (converted to signal)
-	 */
-	*ptr++ = 'S';
-	*ptr++ = hexchars[sigval >> 4];
-	*ptr++ = hexchars[sigval & 0xf];
-	*ptr++ = 0;
-	putpacket(output_buffer);	/* send it off... */
-}
-
-/*
- * This function does all command processing for interfacing to gdb.  It
- * returns 1 if you should skip the instruction at the trap address, 0
- * otherwise.
- */
-void gdb_stub_handle_exception(gdb_pt_regs *regs,int sigval)
-{
-	int trap;			/* Trap type */
-	int addr;
-	int length;
-	char *ptr;
-	unsigned long *stack;
-
-	
-	/*
-	 * reply to host that an exception has occurred
-	 */
-	send_signal(sigval);
-
-	/*
-	 * Wait for input from remote GDB
-	 */
-	while (1) {
-		output_buffer[0] = 0;
-		getpacket(input_buffer);
-
-		switch (input_buffer[0])
-		{
-		case '?':
-			send_signal(sigval);
-			continue;
-
-		case 'd':
-			/* toggle debug flag */
-			break;
-
-		/*
-		 * Return the value of the CPU registers
-		 */
-		case 'g':
-			gdb_stub_get_non_pt_regs(regs);
-			ptr = output_buffer;
-			ptr=  mem2hex((char *)regs,ptr,sizeof(s390_regs_common),FALSE);
-			ptr=  mem2hex((char *)&regs->crs[0],ptr,NUM_CRS*CR_SIZE,FALSE);
-			ptr = mem2hex((char *)&regs->fp_regs, ptr,sizeof(s390_fp_regs));
-			break;
-	  
-		/*
-		 * set the value of the CPU registers - return OK
-		 * FIXME: Needs to be written
-		 */
-		case 'G':
-			ptr=input_buffer;
-			hex2mem (ptr, (char *)regs,sizeof(s390_regs_common), FALSE);
-			ptr+=sizeof(s390_regs_common)*2;
-			hex2mem (ptr, (char *)regs->crs[0],NUM_CRS*CR_SIZE, FALSE);
-			ptr+=NUM_CRS*CR_SIZE*2;
-			hex2mem (ptr, (char *)regs->fp_regs,sizeof(s390_fp_regs), FALSE);
-			gdb_stub_set_non_pt_regs(regs);
-			strcpy(output_buffer,"OK");
-		break;
-
-		/*
-		 * mAA..AA,LLLL  Read LLLL bytes at address AA..AA
-		 */
-		case 'm':
-			ptr = &input_buffer[1];
-
-			if (hexToInt(&ptr, &addr)
-				&& *ptr++ == ','
-				&& hexToInt(&ptr, &length)) {
-				if (mem2hex((char *)addr, output_buffer, length, 1))
-					break;
-				strcpy (output_buffer, "E03");
-			} else
-				strcpy(output_buffer,"E01");
-			break;
-
-		/*
-		 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK
-		 */
-		case 'M': 
-			ptr = &input_buffer[1];
-
-			if (hexToInt(&ptr, &addr)
-				&& *ptr++ == ','
-				&& hexToInt(&ptr, &length)
-				&& *ptr++ == ':') {
-				if (hex2mem(ptr, (char *)addr, length, 1))
-					strcpy(output_buffer, "OK");
-				else
-					strcpy(output_buffer, "E03");
-			}
-			else
-				strcpy(output_buffer, "E02");
-			break;
-
-		/*
-		 * cAA..AA    Continue at address AA..AA(optional)
-		 */
-		case 'c':    
-			/* try to read optional parameter, pc unchanged if no parm */
-
-			ptr = &input_buffer[1];
-			if (hexToInt(&ptr, &addr))
-				regs->cp0_epc = addr;
-	  
-			/*
-			 * Need to flush the instruction cache here, as we may
-			 * have deposited a breakpoint, and the icache probably
-			 * has no way of knowing that a data ref to some location
-			 * may have changed something that is in the instruction
-			 * cache.
-			 * NB: We flush both caches, just to be sure...
-			 */
-
-			flush_cache_all();
-			return;
-			/* NOTREACHED */
-			break;
-
-
-		/*
-		 * kill the program
-		 */
-		case 'k' :
-			break;		/* do nothing */
-
-
-		/*
-		 * Reset the whole machine (FIXME: system dependent)
-		 */
-		case 'r':
-			break;
-
-
-		/*
-		 * Step to next instruction
-		 */
-		case 's':
-			/*
-			 * There is no single step insn in the MIPS ISA, so we
-			 * use breakpoints and continue, instead.
-			 */
-			single_step(regs);
-			flush_cache_all();
-			return;
-			/* NOTREACHED */
-
-		}
-		break;
-
-		}			/* switch */
-
-		/*
-		 * reply to the request
-		 */
-
-		putpacket(output_buffer);
-
-	} /* while */
-}
-
-/*
- * This function will generate a breakpoint exception.  It is used at the
- * beginning of a program to sync up with a debugger and can be used
- * otherwise as a quick means to stop program execution and "break" into
- * the debugger.
- */
-void breakpoint(void)
-{
-	if (!gdb_stub_initialised)
-		return;
-	__asm__ __volatile__(
-			".globl	breakinst\n"
-			"breakinst:\t.word   %0\n\t"
-			:
-			: "i" (S390_BREAKPOINT_U16)
-				:
-				);
-}
-
-
-
-
-
-
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/head.S linux-2.5.67-bk6/arch/s390x/kernel/head.S
--- linux-2.5.67-bk5/arch/s390x/kernel/head.S	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/head.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,664 +0,0 @@
-/*
- *  arch/s390/kernel/head.S
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Rob van der Heij (rvdhei@iae.nl)
- *
- * There are 5 different IPL methods
- *  1) load the image directly into ram at address 0 and do an PSW restart
- *  2) linload will load the image from address 0x10000 to memory 0x10000
- *     and start the code thru LPSW 0x0008000080010000 (VM only, deprecated)
- *  3) generate the tape ipl header, store the generated image on a tape
- *     and ipl from it
- *     In case of SL tape you need to IPL 5 times to get past VOL1 etc
- *  4) generate the vm reader ipl header, move the generated image to the
- *     VM reader (use option NOH!) and do a ipl from reader (VM only)
- *  5) direct call of start by the SALIPL loader
- *  We use the cpuid to distinguish between VM and native ipl
- *  params for kernel are pushed to 0x10400 (see setup.h)
-
-    Changes: 
-    Okt 25 2000 <rvdheij@iae.nl>
-	added code to skip HDR and EOF to allow SL tape IPL (5 retries)
-	changed first CCW from rewind to backspace block
-
- */
-
-#include <linux/config.h>
-#include <asm/setup.h>
-#include <asm/lowcore.h>
-
-#ifndef CONFIG_IPL
-        .org   0
-        .long  0x00080000,0x80000000+startup   # Just a restart PSW
-#else
-#ifdef CONFIG_IPL_TAPE
-#define IPL_BS 1024
-        .org   0
-        .long  0x00080000,0x80000000+iplstart  # The first 24 bytes are loaded
-        .long  0x27000000,0x60000001           # by ipl to addresses 0-23.
-        .long  0x02000000,0x20000000+IPL_BS    # (a PSW and two CCWs).
-        .long  0x00000000,0x00000000           # external old psw
-        .long  0x00000000,0x00000000           # svc old psw
-        .long  0x00000000,0x00000000           # program check old psw
-        .long  0x00000000,0x00000000           # machine check old psw
-        .long  0x00000000,0x00000000           # io old psw
-        .long  0x00000000,0x00000000
-        .long  0x00000000,0x00000000
-        .long  0x00000000,0x00000000
-        .long  0x000a0000,0x00000058           # external new psw
-        .long  0x000a0000,0x00000060           # svc new psw
-        .long  0x000a0000,0x00000068           # program check new psw
-        .long  0x000a0000,0x00000070           # machine check new psw
-        .long  0x00080000,0x80000000+.Lioint   # io new psw
-
-        .org   0x100
-#
-# subroutine for loading from tape
-# Paramters:	
-#  R1 = device number
-#  R2 = load address
-.Lloader:	
-        st    %r14,.Lldret
-        la    %r3,.Lorbread                    # r3 = address of orb 
-	la    %r5,.Lirb                        # r5 = address of irb
-        st    %r2,.Lccwread+4                  # initialize CCW data addresses
-        lctl  %c6,%c6,.Lcr6               
-        slr   %r2,%r2
-.Lldlp:
-        la    %r6,3                            # 3 retries
-.Lssch:
-        ssch  0(%r3)                           # load chunk of IPL_BS bytes
-        bnz   .Llderr
-.Lw4end:
-        bas   %r14,.Lwait4io
-        tm    8(%r5),0x82                      # do we have a problem ?
-        bnz   .Lrecov
-        slr   %r7,%r7
-        icm   %r7,3,10(%r5)                    # get residual count
-        lcr   %r7,%r7
-        la    %r7,IPL_BS(%r7)                  # IPL_BS-residual=#bytes read
-        ar    %r2,%r7                          # add to total size
-        tm    8(%r5),0x01                      # found a tape mark ?
-        bnz   .Ldone
-        l     %r0,.Lccwread+4                  # update CCW data addresses
-        ar    %r0,%r7
-        st    %r0,.Lccwread+4                
-        b     .Lldlp
-.Ldone:
-        l     %r14,.Lldret
-        br    %r14                             # r2 contains the total size
-.Lrecov:
-        bas   %r14,.Lsense                     # do the sensing
-        bct   %r6,.Lssch                       # dec. retry count & branch
-        b     .Llderr
-#
-# Sense subroutine
-#
-.Lsense:
-        st    %r14,.Lsnsret
-        la    %r7,.Lorbsense              
-        ssch  0(%r7)                           # start sense command
-        bnz   .Llderr
-        bas   %r14,.Lwait4io
-        l     %r14,.Lsnsret
-        tm    8(%r5),0x82                      # do we have a problem ?
-        bnz   .Llderr
-        br    %r14
-#
-# Wait for interrupt subroutine
-#
-.Lwait4io:
-        lpsw  .Lwaitpsw                 
-.Lioint:
-        c     %r1,0xb8                         # compare subchannel number
-        bne   .Lwait4io
-        tsch  0(%r5)
-        slr   %r0,%r0
-        tm    8(%r5),0x82                      # do we have a problem ?
-        bnz   .Lwtexit
-        tm    8(%r5),0x04                      # got device end ?
-        bz    .Lwait4io
-.Lwtexit:
-        br    %r14
-.Llderr:
-        lpsw  .Lcrash              
-
-        .align 8
-.Lorbread:
-	.long  0x00000000,0x0080ff00,.Lccwread
-        .align 8
-.Lorbsense:
-        .long  0x00000000,0x0080ff00,.Lccwsense
-        .align 8
-.Lccwread:
-        .long  0x02200000+IPL_BS,0x00000000
-.Lccwsense:
-        .long  0x04200001,0x00000000
-.Lwaitpsw:
-	.long  0x020a0000,0x80000000+.Lioint
-
-.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-.Lcr6:  .long  0xff000000
-        .align 8
-.Lcrash:.long  0x000a0000,0x00000000
-.Lldret:.long  0
-.Lsnsret: .long 0
-#endif  /* CONFIG_IPL_TAPE */
-
-#ifdef CONFIG_IPL_VM
-#define IPL_BS 0x730
-        .org   0
-        .long  0x00080000,0x80000000+iplstart  # The first 24 bytes are loaded
-        .long  0x02000018,0x60000050           # by ipl to addresses 0-23.
-        .long  0x02000068,0x60000050           # (a PSW and two CCWs).
-        .fill  80-24,1,0x40                    # bytes 24-79 are discarded !!
-        .long  0x020000f0,0x60000050           # The next 160 byte are loaded
-        .long  0x02000140,0x60000050           # to addresses 0x18-0xb7
-        .long  0x02000190,0x60000050           # They form the continuation
-        .long  0x020001e0,0x60000050           # of the CCW program started
-        .long  0x02000230,0x60000050           # by ipl and load the range
-        .long  0x02000280,0x60000050           # 0x0f0-0x730 from the image
-        .long  0x020002d0,0x60000050           # to the range 0x0f0-0x730
-        .long  0x02000320,0x60000050           # in memory. At the end of
-        .long  0x02000370,0x60000050           # the channel program the PSW
-        .long  0x020003c0,0x60000050           # at location 0 is loaded.
-        .long  0x02000410,0x60000050           # Initial processing starts
-        .long  0x02000460,0x60000050           # at 0xf0 = iplstart.
-        .long  0x020004b0,0x60000050
-        .long  0x02000500,0x60000050
-        .long  0x02000550,0x60000050
-        .long  0x020005a0,0x60000050
-        .long  0x020005f0,0x60000050
-        .long  0x02000640,0x60000050
-        .long  0x02000690,0x60000050
-        .long  0x020006e0,0x20000050
-
-        .org   0xf0
-#
-# subroutine for loading cards from the reader
-#
-.Lloader:	
-	la    %r3,.Lorb                        # r2 = address of orb into r2
-	la    %r5,.Lirb                        # r4 = address of irb
-        la    %r6,.Lccws              
-        la    %r7,20
-.Linit:
-        st    %r2,4(%r6)                       # initialize CCW data addresses
-        la    %r2,0x50(%r2)
-        la    %r6,8(%r6)
-        bct   7,.Linit
-
-        lctl  %c6,%c6,.Lcr6                    # set IO subclass mask
-	slr   %r2,%r2
-.Lldlp:
-        ssch  0(%r3)                           # load chunk of 1600 bytes
-        bnz   .Llderr
-.Lwait4irq:
-        mvc   0x78(8),.Lnewpsw                 # set up IO interrupt psw
-        lpsw  .Lwaitpsw              
-.Lioint:
-        c     %r1,0xb8                         # compare subchannel number
-	bne   .Lwait4irq
-	tsch  0(%r5)
-
-	slr   %r0,%r0
-	ic    %r0,8(%r5)                       # get device status
-	chi   %r0,8                            # channel end ?
-	be    .Lcont
-	chi   %r0,12                           # channel end + device end ?
-	be    .Lcont
-
-        l     %r0,4(%r5)
-        s     %r0,8(%r3)                       # r0/8 = number of ccws executed
-        mhi   %r0,10                           # *10 = number of bytes in ccws
-        lh    %r3,10(%r5)                      # get residual count
-        sr    %r0,%r3                          # #ccws*80-residual=#bytes read
-	ar    %r2,%r0
-	
-        br    %r14                             # r2 contains the total size
-
-.Lcont:
-	ahi   %r2,0x640                        # add 0x640 to total size
-        la    %r6,.Lccws             
-        la    %r7,20
-.Lincr:
-        l     %r0,4(%r6)                       # update CCW data addresses
-        ahi   %r0,0x640
-        st    %r0,4(%r6)
-        ahi   %r6,8
-        bct   7,.Lincr
-
-        b     .Lldlp
-.Llderr:
-        lpsw  .Lcrash              
-
-        .align 8
-.Lorb:	.long  0x00000000,0x0080ff00,.Lccws
-.Lirb:	.long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-.Lcr6:  .long  0xff000000
-.Lloadp:.long  0,0
-        .align 8
-.Lcrash:.long  0x000a0000,0x00000000
-.Lnewpsw:
-        .long  0x00080000,0x80000000+.Lioint
-.Lwaitpsw:
-        .long  0x020a0000,0x80000000+.Lioint
-
-        .align 8
-.Lccws: .rept  19
-        .long  0x02600050,0x00000000
-        .endr
-        .long  0x02200050,0x00000000
-#endif  /* CONFIG_IPL_VM */
-
-iplstart:
-        lh    %r1,0xb8                         # test if subchannel number
-        bct   %r1,.Lnoload                     #  is valid
-	l     %r1,0xb8                         # load ipl subchannel number
-        la    %r2,IPL_BS                       # load start address
-        bas   %r14,.Lloader                    # load rest of ipl image
-        larl  %r12,_pstart                     # pointer to parameter area
-        st    %r1,IPL_DEVICE+4-PARMAREA(%r12)  # store ipl device number
-
-#
-# load parameter file from ipl device
-#
-.Lagain1:
- 	l     %r2,INITRD_START+4-PARMAREA(%r12)# use ramdisk location as temp
-        bas   %r14,.Lloader                    # load parameter file
-        ltr   %r2,%r2                          # got anything ?
-        bz    .Lnopf
-	chi   %r2,895
-	bnh   .Lnotrunc
-	la    %r2,895
-.Lnotrunc:
-	l     %r4,INITRD_START+4-PARMAREA(%r12)
- 	clc   0(3,%r4),.L_hdr		       # if it is HDRx
- 	bz    .Lagain1			       # skip dataset header
- 	clc   0(3,%r4),.L_eof		       # if it is EOFx
- 	bz    .Lagain1			       # skip dateset trailer
-        la    %r5,0(%r4,%r2)
-        lr    %r3,%r2
-.Lidebc:
-        tm    0(%r5),0x80                      # high order bit set ?
-        bo    .Ldocv                           #  yes -> convert from EBCDIC
-        ahi   %r5,-1
-        bct   %r3,.Lidebc
-        b     .Lnocv
-.Ldocv:
-        l     %r3,.Lcvtab
-        tr    0(256,%r4),0(%r3)                # convert parameters to ascii
-        tr    256(256,%r4),0(%r3)
-        tr    512(256,%r4),0(%r3)
-        tr    768(122,%r4),0(%r3)
-.Lnocv: la    %r3,COMMAND_LINE-PARMAREA(%r12)  # load adr. of command line
-	mvc   0(256,%r3),0(%r4)
-	mvc   256(256,%r3),256(%r4)
-	mvc   512(256,%r3),512(%r4)
-	mvc   768(122,%r3),768(%r4)
-        slr   %r0,%r0
-        b     .Lcntlp
-.Ldelspc:
-        ic    %r0,0(%r2,%r3)
-        chi   %r0,0x20                         # is it a space ?
-        be    .Lcntlp
-        ahi   %r2,1
-        b     .Leolp
-.Lcntlp:
-        brct  %r2,.Ldelspc
-.Leolp:
-        slr   %r0,%r0
-        stc   %r0,0(%r2,%r3)                   # terminate buffer
-.Lnopf:
-
-#
-# load ramdisk from ipl device
-#
-.Lagain2:
- 	l     %r2,INITRD_START+4-PARMAREA(%r12)# load adr. of ramdisk
-        bas   %r14,.Lloader                    # load ramdisk
- 	st    %r2,INITRD_SIZE+4-PARMAREA(%r12) # store size of ramdisk
-        ltr   %r2,%r2
-        bnz   .Lrdcont
-        st    %r2,INITRD_START+4-PARMAREA(%r12)# no ramdisk found, null it
-.Lrdcont:
-	l     %r2,INITRD_START+4-PARMAREA(%r12)
-	clc   0(3,%r2),.L_hdr		       # skip HDRx and EOFx 
-	bz    .Lagain2
-	clc   0(3,%r2),.L_eof
-	bz    .Lagain2
-
-#ifdef CONFIG_IPL_VM
-#
-# reset files in VM reader
-#
-        stidp __LC_CPUID                       # store cpuid
-	tm    __LC_CPUID,0xff                  # running VM ?
-	bno   .Lnoreset
-        la    %r2,.Lreset              
-        lhi   %r3,26
-        .long 0x83230008
-.Lnoreset:
-#endif
-	
-#
-# everything loaded, go for it
-#
-.Lnoload:
-        l     %r1,.Lstartup
-        br    %r1
-
-.Lstartup: .long startup
-.Lcvtab:.long  _ebcasc                         # ebcdic to ascii table
-.Lreset:.byte  0xc3,0xc8,0xc1,0xd5,0xc7,0xc5,0x40,0xd9,0xc4,0xd9,0x40
-        .byte  0xc1,0xd3,0xd3,0x40,0xd2,0xc5,0xc5,0xd7,0x40,0xd5,0xd6
-        .byte  0xc8,0xd6,0xd3,0xc4             # "change rdr all keep nohold"
-.L_eof: .long  0xc5d6c600       /* C'EOF' */
-.L_hdr: .long  0xc8c4d900       /* C'HDR' */
-#endif  /* CONFIG_IPL */
-
-#
-# SALIPL loader support. Based on a patch by Rob van der Heij.
-# This entry point is called directly from the SALIPL loader and
-# doesn't need a builtin ipl record.
-#
-        .org  0x800
-	.globl start
-start:
-	stm   %r0,%r15,0x07b0		# store registers
-	basr  %r12,%r0
-.base:
-	l     %r11,.parm
-	l     %r8,.cmd			# pointer to command buffer
-
-	ltr   %r9,%r9			# do we have SALIPL parameters?
-	bp    .sk8x8
-
-	mvc   0(64,%r8),0x00b0		# copy saved registers
-	xc    64(240-64,%r8),0(%r8)	# remainder of buffer
-	tr    0(64,%r8),.lowcase	
-	b     .gotr
-.sk8x8:
-	mvc   0(240,%r8),0(%r9)		# copy iplparms into buffer
-.gotr:
-	l     %r10,.tbl			# EBCDIC to ASCII table
-	tr    0(240,%r8),0(%r10)
-	stidp __LC_CPUID		# Are we running on VM maybe
-	cli   __LC_CPUID,0xff
-	bnz   .test
-	.long 0x83300060		# diag 3,0,x'0060' - storage size
-	b     .done
-.test:
-	mvc   0x68(8),.pgmnw		# set up pgm check handler
-	l     %r2,.fourmeg
-	lr    %r3,%r2
-	bctr  %r3,%r0			# 4M-1
-.loop:  iske  %r0,%r3
-	ar    %r3,%r2
-.pgmx:
-	sr    %r3,%r2
-	la    %r3,1(%r3)
-.done:
-	l     %r1,.memsize
-	st    %r3,4(%r1)
-	slr   %r0,%r0
-	st    %r0,INITRD_SIZE+4-PARMAREA(%r11)
-	st    %r0,INITRD_START+4-PARMAREA(%r11)
-	j     startup                   # continue with startup
-.tbl:	.long _ebcasc			# translate table
-.cmd:	.long COMMAND_LINE		# address of command line buffer
-.parm:	.long PARMAREA
-.fourmeg: .long 0x00400000      	# 4M
-.pgmnw:	.long 0x00080000,.pgmx
-.memsize: .long memory_size
-.lowcase:
-	.byte 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07 
-	.byte 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
-	.byte 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17 
-	.byte 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
-	.byte 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27 
-	.byte 0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f
-	.byte 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37 
-	.byte 0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f
-	.byte 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47 
-	.byte 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f
-	.byte 0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57 
-	.byte 0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f
-	.byte 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67 
-	.byte 0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f
-	.byte 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77 
-	.byte 0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f
-
-	.byte 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87 
-	.byte 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f
-	.byte 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97 
-	.byte 0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f
-	.byte 0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7 
-	.byte 0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf
-	.byte 0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7 
-	.byte 0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf
-	.byte 0xc0,0x81,0x82,0x83,0x84,0x85,0x86,0x87	# .abcdefg 
-	.byte 0x88,0x89,0xca,0xcb,0xcc,0xcd,0xce,0xcf	# hi
-	.byte 0xd0,0x91,0x92,0x93,0x94,0x95,0x96,0x97 	# .jklmnop
-	.byte 0x98,0x99,0xda,0xdb,0xdc,0xdd,0xde,0xdf	# qr
-	.byte 0xe0,0xe1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7	# ..stuvwx
-	.byte 0xa8,0xa9,0xea,0xeb,0xec,0xed,0xee,0xef	# yz
-	.byte 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7 
-	.byte 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
-
-#
-# startup-code at 0x10000, running in real mode
-# this is called either by the ipl loader or directly by PSW restart
-# or linload or SALIPL
-#
-        .org  0x10000
-startup:basr  %r13,0                     # get base
-.LPG1:  sll   %r13,1                     # remove high order bit
-        srl   %r13,1
-        lhi   %r1,1                      # mode 1 = esame
-        slr   %r0,%r0                    # set cpuid to zero
-        sigp  %r1,%r0,0x12               # switch to esame mode
-	sam64				 # switch to 64 bit mode
-	lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
-	larl  %r12,_pstart               # pointer to parameter area
-					 # move IPL device to lowcore
-        mvc   __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12)
-
-#
-# clear bss memory
-#
-	larl  %r2,__bss_start           # start of bss segment
-        larl  %r3,_end                  # end of bss segment
-        sgr   %r3,%r2                   # length of bss
-        sgr   %r4,%r4                   #
-        sgr   %r5,%r5                   # set src,length and pad to zero
-        mvcle %r2,%r4,0                 # clear mem
-        jo    .-4                       # branch back, if not finish
-
-					 # set program check new psw mask
-	mvc   __LC_PGM_NEW_PSW(8),.Lpcmsk-.LPG1(%r13)
-
-#
-# find memory chunks.
-#
-	larl  %r1,.Lchkmem               # set program check address
-	stg   %r1,__LC_PGM_NEW_PSW+8
-	la    %r1,1                      # test in increments of 128KB
-	sllg  %r1,%r1,17
-	larl  %r3,memory_chunk
-	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
-.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
-.Lsame:
-	algr  %r5,%r1			 # add 128KB to end of chunk
-	brc   12,.Lloop
-.Lchkmem:				 # > 16EB or tprot got a program check
-	clgr  %r4,%r5			 # chunk size > 0?
-	je    .Ldonemem
-	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.
-#
-	lghi  %r4,1
-	sllg  %r4,%r4,31
-	clgr  %r5,%r4
-	jhe   .Ldonemem
-	lgr   %r5,%r4
-	j     .Lloop
-.Ldonemem:		
-
-	larl  %r12,machine_flags
-#
-# find out if we are running under VM
-#
-        stidp  __LC_CPUID               # store cpuid
-	tm     __LC_CPUID,0xff          # running under VM ?
-	bno    0f-.LPG1(%r13)
-        oi     7(%r12),1                # set VM flag
-0:      lh     %r0,__LC_CPUID+4         # get cpu version
-        chi    %r0,0x7490               # running on a P/390 ?
-        bne    1f-.LPG1(%r13)
-        oi     7(%r12),4                # set P/390 flag
-1:
-
-#
-# find out if we have the MVPG instruction
-#
-	la     %r1,0f-.LPG1(%r13)       # set program check address
-	stg    %r1,__LC_PGM_NEW_PSW+8
-	sgr    %r0,%r0
-	lghi   %r1,0
-	lghi   %r2,0
-	mvpg   %r1,%r2                  # test MVPG instruction
-	oi     7(%r12),16               # set MVPG flag
-0:
-
-#
-# find out if the diag 0x44 works in 64 bit mode
-#
-	la     %r1,0f-.LPG1(%r13)	# set program check address
-	stg    %r1,__LC_PGM_NEW_PSW+8
-	mvc    __LC_DIAG44_OPCODE(8),.Lnop-.LPG1(%r13)
-	diag   0,0,0x44			# test diag 0x44
-	oi     7(%r12),32		# set diag44 flag
-	mvc    __LC_DIAG44_OPCODE(8),.Ldiag44-.LPG1(%r13)
-0:	
-
-        lpswe .Lentry-.LPG1(13)         # jump to _stext in primary-space,
-                                        # virtual and never return ...
-        .align 16
-.Lentry:.quad  0x0000000180000000,_stext
-.Lctl:  .quad  0x04b50002               # cr0: various things
-        .quad  0                        # cr1: primary space segment table
-        .quad  .Lduct                   # cr2: dispatchable unit control table
-        .quad  0                        # cr3: instruction authorization
-        .quad  0                        # cr4: instruction authorization
-        .quad  0                        # cr5:  various things
-        .quad  0                        # cr6:  I/O interrupts
-        .quad  0                        # cr7:  secondary space segment table
-        .quad  0                        # cr8:  access registers translation
-        .quad  0                        # cr9:  tracing off
-        .quad  0                        # cr10: tracing off
-        .quad  0                        # cr11: tracing off
-        .quad  0                        # cr12: tracing off
-        .quad  0                        # cr13: home space segment table
-        .quad  0xc0000000               # cr14: machine check handling off
-        .quad  0                        # cr15: linkage stack operations
-.Lpcmsk:.quad  0x0000000180000000
-.L4malign:.quad 0xffffffffffc00000
-.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
-.Lnop:	.long  0x07000700
-.Ldiag44:.long 0x83000044
-
-	.org PARMAREA-64
-.Lduct:	.long 0,0,0,0,0,0,0,0
-	.long 0,0,0,0,0,0,0,0
-
-#
-# params at 10400 (setup.h)
-#
-	.org   PARMAREA
-	.global _pstart
-_pstart:
-	.quad  0                        # IPL_DEVICE
-        .quad  RAMDISK_ORIGIN           # INITRD_START
-        .quad  RAMDISK_SIZE             # INITRD_SIZE
-
-        .org   COMMAND_LINE
-    	.byte  "root=/dev/ram0 ro"
-        .byte  0
-	.org   0x11000
-	.global _pend
-_pend:	
-
-#ifdef CONFIG_SHARED_KERNEL
-	.org   0x100000
-#endif
-	
-#
-# startup-code, running in virtual mode
-#
-        .globl _stext
-_stext:	basr  %r13,0                    # get base
-.LPG2:
-#
-# Setup stack
-#
-	larl  %r15,init_thread_union
-        aghi  %r15,16384                # init_task_union + 16384
-        stg   %r15,__LC_KERNEL_STACK    # set end of kernel stack
-        aghi  %r15,-160
-        xc    0(8,%r15),0(%r15)         # set backchain to zero
-
-# check control registers
-        stctg  %c0,%c15,0(%r15)
-	oi     6(%r15),0x20             # enable sigp external interrupts
-	oi     4(%r15),0x10             # switch on low address proctection
-        lctlg  %c0,%c15,0(%r15)
-
-#
-        lam    0,15,.Laregs-.LPG2(%r13) # load access regs needed by uaccess
-        brasl  %r14,start_kernel        # go to C code
-#
-# We returned from start_kernel ?!? PANIK
-#
-        basr  %r13,0
-	lpswe .Ldw-.(%r13)           # load disabled wait psw
-#
-            .align 8
-.Ldw:       .quad  0x0002000180000000,0x0000000000000000
-.Laregs:    .long  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/ieee.h linux-2.5.67-bk6/arch/s390x/kernel/ieee.h
--- linux-2.5.67-bk5/arch/s390x/kernel/ieee.h	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/ieee.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,90 +0,0 @@
-/*
- *  arch/s390/kernel/ieee.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-#include <linux/sched.h>
-
-static    inline void _adddf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = current->tss.fprs[R1].fd +
-                             current->tss.fprs[R2].fd;
-}
-
-static    inline void _subdf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = current->tss.fprs[R1].fd -
-                             current->tss.fprs[R2].fd;
-}
-
-static    inline void _muldf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = current->tss.fprs[R1].fd *
-                             current->tss.fprs[R2].fd;
-}
-
-static    inline void _divdf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = current->tss.fprs[R1].fd /
-                             current->tss.fprs[R2].fd;
-}
-
-static    inline void _negdf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = -current->tss.fprs[R1].fd;
-}
-
-static    inline void _fixdfsi(int R1,int R2)
-{
-  current->tss.regs->gprs[R1] = (__u32) current->tss.fprs[R2].fd;
-}
-
-static    inline void _extendsidf(int R1,int R2)
-{
-  current->tss.fprs[R1].fd = (double) current->tss.regs->gprs[R2];
-}
-
-
-static    inline  void _addsf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = current->tss.fprs[R1].ff +
-                             current->tss.fprs[R2].ff;
-}
-
-static    inline  void _subsf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = current->tss.fprs[R1].ff -
-                             current->tss.fprs[R2].ff;
-}
-
-static    inline void _mulsf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = current->tss.fprs[R1].ff *
-                             current->tss.fprs[R2].ff;
-}
-
-static    inline void _divsf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = current->tss.fprs[R1].ff /
-                             current->tss.fprs[R2].ff;
-}
-
-static    inline void _negsf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = -current->tss.fprs[R1].ff;
-}
-
-static    inline void _fixsfsi(int R1,int R2)
-{
-  current->tss.regs->gprs[R1] = (__u32) current->tss.fprs[R2].ff;
-}
-
-static    inline void _extendsisf(int R1,int R2)
-{
-  current->tss.fprs[R1].ff = (double) current->tss.regs->gprs[R2];
-}
-
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/init_task.c linux-2.5.67-bk6/arch/s390x/kernel/init_task.c
--- linux-2.5.67-bk5/arch/s390x/kernel/init_task.c	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/init_task.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,39 +0,0 @@
-/*
- *  arch/s390/kernel/init_task.c
- *
- *  S390 version
- *
- *  Derived from "arch/i386/kernel/init_task.c"
- */
-
-#include <linux/mm.h>
-#include <linux/sched.h>
-#include <linux/init_task.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-
-static struct fs_struct init_fs = INIT_FS;
-static struct files_struct init_files = INIT_FILES;
-static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
-static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-/*
- * Initial thread structure.
- *
- * We need to make sure that this is 8192-byte aligned due to the
- * way process stacks are handled. This is done by having a special
- * "init_task" linker map entry..
- */
-union thread_union init_thread_union 
-	__attribute__((__section__(".data.init_task"))) =
-		{ INIT_THREAD_INFO(init_task) };
-
-/*
- * Initial task structure.
- *
- * All other task structs will be allocated on slabs in fork.c
- */
-struct task_struct init_task = INIT_TASK(init_task);
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/ioctl32.c linux-2.5.67-bk6/arch/s390x/kernel/ioctl32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/ioctl32.c	2003-04-07 10:32:50.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/ioctl32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,1083 +0,0 @@
-/*
- * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
- *
- *  S390 version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Gerhard Tonn (ton@de.ibm.com)
- *
- * Heavily inspired by the 32-bit Sparc compat code which is  
- * Copyright (C) 2000 Silicon Graphics, Inc.
- * Written by Ulf Carlsson (ulfc@engr.sgi.com) 
- *
- */
-
-#include <linux/types.h>
-#include <linux/compat.h>
-#include <linux/kernel.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/file.h>
-#include <linux/vt.h>
-#include <linux/kd.h>
-#include <linux/netdevice.h>
-#include <linux/route.h>
-#include <linux/ext2_fs.h>
-#include <linux/hdreg.h>
-#include <linux/if_bonding.h>
-#include <linux/blkpg.h>
-#include <linux/blk.h>
-#include <linux/dm-ioctl.h>
-#include <linux/loop.h>
-#include <linux/elevator.h>
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <asm/dasd.h>
-#include <asm/tape390.h>
-#include <asm/sockios.h>
-#include <asm/ioctls.h>
-
-#include "linux32.h"
-
-long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
-
-struct hd_geometry32 {
-	unsigned char	heads;
-	unsigned char	sectors;
-	unsigned short	cylinders;
-	__u32		start;
-};  
-
-static inline int hd_geometry_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct hd_geometry32 *hg32 = (struct hd_geometry32 *) A(arg);
-	struct hd_geometry hg;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_ioctl (fd, cmd, (long)&hg);
-	set_fs (old_fs);
-
-	if (ret)
-		return ret;
-
-	ret = put_user (hg.heads, &(hg32->heads));
-	ret |= __put_user (hg.sectors, &(hg32->sectors));
-	ret |= __put_user (hg.cylinders, &(hg32->cylinders));
-	ret |= __put_user (hg.start, &(hg32->start));
-
-	return ret;
-}
-
-#define EXT2_IOC32_GETFLAGS               _IOR('f', 1, int)
-#define EXT2_IOC32_SETFLAGS               _IOW('f', 2, int)
-#define EXT2_IOC32_GETVERSION             _IOR('v', 1, int)
-#define EXT2_IOC32_SETVERSION             _IOW('v', 2, int)
-
-struct ifmap32 {
-	unsigned int mem_start;
-	unsigned int mem_end;
-	unsigned short base_addr;
-	unsigned char irq;
-	unsigned char dma;
-	unsigned char port;
-};
-
-struct ifreq32 {
-#define IFHWADDRLEN     6
-#define IFNAMSIZ        16
-        union {
-                char    ifrn_name[IFNAMSIZ];	/* if name, e.g. "en0" */
-        } ifr_ifrn;
-        union {
-                struct  sockaddr ifru_addr;
-                struct  sockaddr ifru_dstaddr;
-                struct  sockaddr ifru_broadaddr;
-                struct  sockaddr ifru_netmask;
-                struct  sockaddr ifru_hwaddr;
-                short   ifru_flags;
-                int     ifru_ivalue;
-                int     ifru_mtu;
-                struct  ifmap32 ifru_map;
-                char    ifru_slave[IFNAMSIZ];   /* Just fits the size */
-		char	ifru_newname[IFNAMSIZ];
-                __u32	ifru_data;
-        } ifr_ifru;
-};
-
-struct ifconf32 {
-        int     ifc_len;                        /* size of buffer       */
-        __u32	ifcbuf;
-};
-
-static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct ireq32 *uir32 = (struct ireq32 *) A(arg);
-	struct net_device *dev;
-	struct ifreq32 ifr32;
-
-	if (copy_from_user(&ifr32, uir32, sizeof(struct ifreq32)))
-		return -EFAULT;
-
-	read_lock(&dev_base_lock);
-	dev = __dev_get_by_index(ifr32.ifr_ifindex);
-	if (!dev) {
-		read_unlock(&dev_base_lock);
-		return -ENODEV;
-	}
-
-	strcpy(ifr32.ifr_name, dev->name);
-	read_unlock(&dev_base_lock);
-
-	if (copy_to_user(uir32, &ifr32, sizeof(struct ifreq32)))
-	    return -EFAULT;
-
-	return 0;
-}
-
-static inline int dev_ifconf(unsigned int fd, unsigned int cmd,
-			     unsigned long arg)
-{
-	struct ioconf32 *uifc32 = (struct ioconf32 *) A(arg);
-	struct ifconf32 ifc32;
-	struct ifconf ifc;
-	struct ifreq32 *ifr32;
-	struct ifreq *ifr;
-	mm_segment_t old_fs;
-	int len;
-	int err;
-
-	if (copy_from_user(&ifc32, uifc32, sizeof(struct ifconf32)))
-		return -EFAULT;
-
-	if(ifc32.ifcbuf == 0) {
-		ifc32.ifc_len = 0;
-		ifc.ifc_len = 0;
-		ifc.ifc_buf = NULL;
-	} else {
-		ifc.ifc_len = ((ifc32.ifc_len / sizeof (struct ifreq32))) *
-			sizeof (struct ifreq);
-		ifc.ifc_buf = kmalloc (ifc.ifc_len, GFP_KERNEL);
-		if (!ifc.ifc_buf)
-			return -ENOMEM;
-	}
-	ifr = ifc.ifc_req;
-	ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf);
-	len = ifc32.ifc_len / sizeof (struct ifreq32);
-	while (len--) {
-		if (copy_from_user(ifr++, ifr32++, sizeof (struct ifreq32))) {
-			err = -EFAULT;
-			goto out;
-		}
-	}
-
-	old_fs = get_fs();
-	set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, SIOCGIFCONF, (unsigned long)&ifc);	
-	set_fs (old_fs);
-	if (err)
-		goto out;
-
-	ifr = ifc.ifc_req;
-	ifr32 = (struct ifreq32 *) A(ifc32.ifcbuf);
-	len = ifc.ifc_len / sizeof (struct ifreq);
-	ifc32.ifc_len = len * sizeof (struct ifreq32);
-
-	while (len--) {
-		if (copy_to_user(ifr32++, ifr++, sizeof (struct ifreq32))) {
-			err = -EFAULT;
-			goto out;
-		}
-	}
-
-	if (copy_to_user(uifc32, &ifc32, sizeof(struct ifconf32))) {
-		err = -EFAULT;
-		goto out;
-	}
-out:
-	if(ifc.ifc_buf != NULL)
-		kfree (ifc.ifc_buf);
-	return err;
-}
-
-static int bond_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg)
-{
-	struct ifreq ifr;
-	mm_segment_t old_fs;
-	int err, len;
-	u32 data;
-	
-	if (copy_from_user(&ifr, (struct ifreq32 *)arg, sizeof(struct ifreq32)))
-		return -EFAULT;
-	ifr.ifr_data = (__kernel_caddr_t)get_zeroed_page(GFP_KERNEL);
-	if (!ifr.ifr_data)
-		return -EAGAIN;
-
-	switch (cmd) {
-	case SIOCBONDENSLAVE:
-	case SIOCBONDRELEASE:
-	case SIOCBONDSETHWADDR:
-	case SIOCBONDCHANGEACTIVE:
-		len = IFNAMSIZ * sizeof(char);
-		break;
-	case SIOCBONDSLAVEINFOQUERY:
-		len = sizeof(struct ifslave);
-		break;
-	case SIOCBONDINFOQUERY:
-		len = sizeof(struct ifbond);
-		break;
-	default:
-		err = -EINVAL;
-		goto out;
-	};
-
-	__get_user(data, &(((struct ifreq32 *)arg)->ifr_ifru.ifru_data));
-	if (copy_from_user(ifr.ifr_data, (char *)A(data), len)) {
-		err = -EFAULT;
-		goto out;
-	}
-
-	old_fs = get_fs();
-	set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, cmd, (unsigned long)&ifr);
-	set_fs (old_fs);
-	if (!err) {
-		len = copy_to_user((char *)A(data), ifr.ifr_data, len);
-		if (len)
-			err = -EFAULT;
-	}
-
-out:
-	free_page((unsigned long)ifr.ifr_data);
-	return err;
-}
-
-static inline int dev_ifsioc(unsigned int fd, unsigned int cmd,
-			     unsigned long arg)
-{
-	struct ifreq32 *uifr = (struct ifreq32 *) A(arg);
-	struct ifreq ifr;
-	mm_segment_t old_fs;
-	int err;
-	
-	switch (cmd) {
-	case SIOCSIFMAP:
-		err = copy_from_user(&ifr, uifr, sizeof(ifr.ifr_name));
-		err |= __get_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start));
-		err |= __get_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end));
-		err |= __get_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr));
-		err |= __get_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq));
-		err |= __get_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma));
-		err |= __get_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port));
-		if (err)
-			return -EFAULT;
-		break;
-	default:
-		if (copy_from_user(&ifr, uifr, sizeof(struct ifreq32)))
-			return -EFAULT;
-		break;
-	}
-	old_fs = get_fs();
-	set_fs (KERNEL_DS);
-	err = sys_ioctl (fd, cmd, (unsigned long)&ifr);
-	set_fs (old_fs);
-	if (!err) {
-		switch (cmd) {
-		case SIOCGIFFLAGS:
-		case SIOCGIFMETRIC:
-		case SIOCGIFMTU:
-		case SIOCGIFMEM:
-		case SIOCGIFHWADDR:
-		case SIOCGIFINDEX:
-		case SIOCGIFADDR:
-		case SIOCGIFBRDADDR:
-		case SIOCGIFDSTADDR:
-		case SIOCGIFNETMASK:
-		case SIOCGIFTXQLEN:
-			if (copy_to_user(uifr, &ifr, sizeof(struct ifreq32)))
-				return -EFAULT;
-			break;
-		case SIOCGIFMAP:
-			err = copy_to_user(uifr, &ifr, sizeof(ifr.ifr_name));
-			err |= __put_user(ifr.ifr_map.mem_start, &(uifr->ifr_ifru.ifru_map.mem_start));
-			err |= __put_user(ifr.ifr_map.mem_end, &(uifr->ifr_ifru.ifru_map.mem_end));
-			err |= __put_user(ifr.ifr_map.base_addr, &(uifr->ifr_ifru.ifru_map.base_addr));
-			err |= __put_user(ifr.ifr_map.irq, &(uifr->ifr_ifru.ifru_map.irq));
-			err |= __put_user(ifr.ifr_map.dma, &(uifr->ifr_ifru.ifru_map.dma));
-			err |= __put_user(ifr.ifr_map.port, &(uifr->ifr_ifru.ifru_map.port));
-			if (err)
-				err = -EFAULT;
-			break;
-		}
-	}
-	return err;
-}
-
-struct rtentry32
-{
-	unsigned int	rt_pad1;
-	struct sockaddr	rt_dst;		/* target address		*/
-	struct sockaddr	rt_gateway;	/* gateway addr (RTF_GATEWAY)	*/
-	struct sockaddr	rt_genmask;	/* target network mask (IP)	*/
-	unsigned short	rt_flags;
-	short		rt_pad2;
-	unsigned int	rt_pad3;
-	unsigned int	rt_pad4;
-	short		rt_metric;	/* +1 for binary compatibility!	*/
-	unsigned int	rt_dev;		/* forcing the device at add	*/
-	unsigned int	rt_mtu;		/* per route MTU/Window 	*/
-#ifndef __KERNEL__
-#define rt_mss	rt_mtu			/* Compatibility :-(            */
-#endif
-	unsigned int	rt_window;	/* Window clamping 		*/
-	unsigned short	rt_irtt;	/* Initial RTT			*/
-};
-
-static inline int routing_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct rtentry32 *ur = (struct rtentry32 *) A(arg);
-	struct rtentry r;
-	char devname[16];
-	u32 rtdev;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-	
-	ret = copy_from_user (&r.rt_dst, &(ur->rt_dst), 3 * sizeof(struct sockaddr));
-	ret |= __get_user (r.rt_flags, &(ur->rt_flags));
-	ret |= __get_user (r.rt_metric, &(ur->rt_metric));
-	ret |= __get_user (r.rt_mtu, &(ur->rt_mtu));
-	ret |= __get_user (r.rt_window, &(ur->rt_window));
-	ret |= __get_user (r.rt_irtt, &(ur->rt_irtt));
-	ret |= __get_user (rtdev, &(ur->rt_dev));
-	if (rtdev) {
-		ret |= copy_from_user (devname, (char *) A(rtdev), 15);
-		r.rt_dev = devname; devname[15] = 0;
-	} else
-		r.rt_dev = 0;
-	if (ret)
-		return -EFAULT;
-	set_fs (KERNEL_DS);
-	ret = sys_ioctl (fd, cmd, (long)&r);
-	set_fs (old_fs);
-	return ret;
-}
-
-static int do_ext2_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	/* These are just misnamed, they actually get/put from/to user an int */
-	switch (cmd) {
-	case EXT2_IOC32_GETFLAGS: cmd = EXT2_IOC_GETFLAGS; break;
-	case EXT2_IOC32_SETFLAGS: cmd = EXT2_IOC_SETFLAGS; break;
-	case EXT2_IOC32_GETVERSION: cmd = EXT2_IOC_GETVERSION; break;
-	case EXT2_IOC32_SETVERSION: cmd = EXT2_IOC_SETVERSION; break;
-	}
-	return sys_ioctl(fd, cmd, arg);
-}
-
-
-struct loop_info32 {
-	int			lo_number;      /* ioctl r/o */
-	compat_dev_t	lo_device;      /* ioctl r/o */
-	unsigned int		lo_inode;       /* ioctl r/o */
-	compat_dev_t	lo_rdevice;     /* ioctl r/o */
-	int			lo_offset;
-	int			lo_encrypt_type;
-	int			lo_encrypt_key_size;    /* ioctl w/o */
-	int			lo_flags;       /* ioctl r/o */
-	char			lo_name[LO_NAME_SIZE];
-	unsigned char		lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
-	unsigned int		lo_init[2];
-	char			reserved[4];
-};
-
-static int loop_status(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	struct loop_info l;
-	int err = -EINVAL;
-
-	switch(cmd) {
-	case LOOP_SET_STATUS:
-		err = get_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number);
-		err |= __get_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device);
-		err |= __get_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode);
-		err |= __get_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice);
-		err |= __copy_from_user((char *)&l.lo_offset, (char *)&((struct loop_info32 *)arg)->lo_offset,
-					   8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
-		if (err) {
-			err = -EFAULT;
-		} else {
-			set_fs (KERNEL_DS);
-			err = sys_ioctl (fd, cmd, (unsigned long)&l);
-			set_fs (old_fs);
-		}
-		break;
-	case LOOP_GET_STATUS:
-		set_fs (KERNEL_DS);
-		err = sys_ioctl (fd, cmd, (unsigned long)&l);
-		set_fs (old_fs);
-		if (!err) {
-			err = put_user(l.lo_number, &((struct loop_info32 *)arg)->lo_number);
-			err |= __put_user(l.lo_device, &((struct loop_info32 *)arg)->lo_device);
-			err |= __put_user(l.lo_inode, &((struct loop_info32 *)arg)->lo_inode);
-			err |= __put_user(l.lo_rdevice, &((struct loop_info32 *)arg)->lo_rdevice);
-			err |= __copy_to_user((char *)&((struct loop_info32 *)arg)->lo_offset,
-					   (char *)&l.lo_offset, (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
-			if (err)
-				err = -EFAULT;
-		}
-		break;
-	default: {
-		static int count = 0;
-		if (++count <= 20)
-			printk("%s: Unknown loop ioctl cmd, fd(%d) "
-			       "cmd(%08x) arg(%08lx)\n",
-			       __FUNCTION__, fd, cmd, arg);
-	}
-	}
-	return err;
-}
-
-
-struct blkpg_ioctl_arg32 {
-	int op;
-	int flags;
-	int datalen;
-	u32 data;
-};
-                                
-static int blkpg_ioctl_trans(unsigned int fd, unsigned int cmd, struct blkpg_ioctl_arg32 *arg)
-{
-	struct blkpg_ioctl_arg a;
-	struct blkpg_partition p;
-	int err;
-	mm_segment_t old_fs = get_fs();
-	
-	err = get_user(a.op, &arg->op);
-	err |= __get_user(a.flags, &arg->flags);
-	err |= __get_user(a.datalen, &arg->datalen);
-	err |= __get_user((long)a.data, &arg->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, a.data, 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);
-	default:
-		return -EINVAL;
-	}                                        
-	return err;
-}
-
-
-typedef struct ica_z90_status_t {
-  int totalcount;
-  int leedslitecount;
-  int leeds2count;
-  int requestqWaitCount;
-  int pendingqWaitCount;
-  int totalOpenCount;
-  int cryptoDomain;
-  unsigned char status[64];
-  unsigned char qdepth[64];
-} ica_z90_status;
-
-typedef struct _ica_rsa_modexpo {
-  char         *inputdata;
-  unsigned int  inputdatalength;
-  char         *outputdata;
-  unsigned int  outputdatalength;
-  char         *b_key;
-  char         *n_modulus;
-} ica_rsa_modexpo_t;
-
-typedef struct _ica_rsa_modexpo_32 {
-  u32          inputdata;
-  u32          inputdatalength;
-  u32          outputdata;
-  u32          outputdatalength;
-  u32          b_key;
-  u32          n_modulus;
-} ica_rsa_modexpo_32_t;
-
-typedef struct _ica_rsa_modexpo_crt {
-  char         *inputdata;
-  unsigned int  inputdatalength;
-  char         *outputdata;
-  unsigned int  outputdatalength;
-  char         *bp_key;
-  char         *bq_key;
-  char         *np_prime;
-  char         *nq_prime;
-  char         *u_mult_inv;
-} ica_rsa_modexpo_crt_t;
-
-typedef struct _ica_rsa_modexpo_crt_32 {
-  u32          inputdata;
-  u32          inputdatalength;
-  u32          outputdata;
-  u32          outputdatalength;
-  u32          bp_key;
-  u32          bq_key;
-  u32          np_prime;
-  u32          nq_prime;
-  u32          u_mult_inv;
-} ica_rsa_modexpo_crt_32_t;
-
-#define ICA_IOCTL_MAGIC 'z'
-#define ICARSAMODEXPO   _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x05, 0)
-#define ICARSACRT       _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x06, 0) 
-#define ICARSAMODMULT   _IOC(_IOC_READ|_IOC_WRITE, ICA_IOCTL_MAGIC, 0x07, 0)
-#define ICAZ90STATUS    _IOC(_IOC_READ, ICA_IOCTL_MAGIC, 0x10, sizeof(ica_z90_status))
-#define ICAZ90QUIESCE   _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x11, 0)
-#define ICAZ90HARDRESET _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x12, 0)
-#define ICAZ90HARDERROR _IOC(_IOC_NONE, ICA_IOCTL_MAGIC, 0x13, 0)
-
-static int do_rsa_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	int err = 0;
-	ica_rsa_modexpo_t rsa;
-	ica_rsa_modexpo_32_t *rsa32 = (ica_rsa_modexpo_32_t *)arg;
-	u32 inputdata, outputdata, b_key, n_modulus;
-
-	memset (&rsa, 0, sizeof(rsa));
-
-	err |= __get_user (inputdata, &rsa32->inputdata);
-	err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength);
-	err |= __get_user (outputdata, &rsa32->outputdata);
-	err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength);
-	err |= __get_user (b_key, &rsa32->b_key);
-	err |= __get_user (n_modulus, &rsa32->n_modulus);
-	if (err)
-		return -EFAULT;
-
-	rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
-	if (!rsa.inputdata) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), 
-			   rsa.inputdatalength)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL);
-	if (!rsa.outputdata) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-
-	rsa.b_key = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
-	if (!rsa.b_key) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.b_key, (char *)(u64)(b_key & 0x7fffffff), 
-			   rsa.inputdatalength)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.n_modulus = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
-	if (!rsa.n_modulus) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.n_modulus, (char *)(u64)(n_modulus & 0x7fffffff), 
-			   rsa.inputdatalength)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&rsa);
-	set_fs(old_fs);
-	if (err < 0)
-		goto cleanup;
-
-	if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata,
-			 rsa.outputdatalength))
-		err = -EFAULT;
-
-cleanup:
-	if (rsa.inputdata)
-		kfree(rsa.inputdata);
-	if (rsa.outputdata)
-		kfree(rsa.outputdata);
-	if (rsa.b_key)
-		kfree(rsa.b_key);
-	if (rsa.n_modulus)
-		kfree(rsa.n_modulus);
-	
-	return err;
-}
-
-static int do_rsa_crt_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	int err = 0;
-	ica_rsa_modexpo_crt_t rsa;
-	ica_rsa_modexpo_crt_32_t *rsa32 = (ica_rsa_modexpo_crt_32_t *)arg;
-	u32 inputdata, outputdata, bp_key, bq_key, np_prime, nq_prime, u_mult_inv;
-
-	memset (&rsa, 0, sizeof(rsa));
-
-	err |= __get_user (inputdata, &rsa32->inputdata);
-	err |= __get_user (rsa.inputdatalength, &rsa32->inputdatalength);
-	err |= __get_user (outputdata, &rsa32->outputdata);
-	err |= __get_user (rsa.outputdatalength, &rsa32->outputdatalength);
-	err |= __get_user (bp_key, &rsa32->bp_key);
-	err |= __get_user (bq_key, &rsa32->bq_key);
-	err |= __get_user (np_prime, &rsa32->np_prime);
-	err |= __get_user (nq_prime, &rsa32->nq_prime);
-	err |= __get_user (u_mult_inv, &rsa32->u_mult_inv);
-	if (err)
-		return -EFAULT;
-
-	rsa.inputdata = (char *)kmalloc(rsa.inputdatalength, GFP_KERNEL);
-	if (!rsa.inputdata) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.inputdata, (char *)(u64)(inputdata & 0x7fffffff), 
-			   rsa.inputdatalength)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.outputdata = (char *)kmalloc(rsa.outputdatalength, GFP_KERNEL);
-	if (!rsa.outputdata) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-
-	rsa.bp_key = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
-	if (!rsa.bp_key) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.bp_key, (char *)(u64)(bp_key & 0x7fffffff), 
-			   rsa.inputdatalength/2 + 8)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.bq_key = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL);
-	if (!rsa.bq_key) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.bq_key, (char *)(u64)(bq_key & 0x7fffffff), 
-			   rsa.inputdatalength/2)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.np_prime = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
-	if (!rsa.np_prime) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.np_prime, (char *)(u64)(np_prime & 0x7fffffff), 
-			   rsa.inputdatalength/2 + 8)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.nq_prime = (char *)kmalloc(rsa.inputdatalength/2, GFP_KERNEL);
-	if (!rsa.nq_prime) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.nq_prime, (char *)(u64)(nq_prime & 0x7fffffff), 
-			   rsa.inputdatalength/2)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	rsa.u_mult_inv = (char *)kmalloc(rsa.inputdatalength/2 + 8, GFP_KERNEL);
-	if (!rsa.u_mult_inv) {
-		err = -ENOMEM;
-		goto cleanup;
-	}
-	if (copy_from_user(rsa.u_mult_inv, (char *)(u64)(u_mult_inv & 0x7fffffff), 
-			   rsa.inputdatalength/2 + 8)) {
-		err = -EFAULT;
-		goto cleanup;
-	}
-
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&rsa);
-	set_fs(old_fs);
-	if (err < 0)
-		goto cleanup;
-
-	if (copy_to_user((char *)(u64)(outputdata & 0x7fffffff), rsa.outputdata,
-			 rsa.outputdatalength))
-		err = -EFAULT;
-
-cleanup:
-	if (rsa.inputdata)
-		kfree(rsa.inputdata);
-	if (rsa.outputdata)
-		kfree(rsa.outputdata);
-	if (rsa.bp_key)
-		kfree(rsa.bp_key);
-	if (rsa.bq_key)
-		kfree(rsa.bq_key);
-	if (rsa.np_prime)
-		kfree(rsa.np_prime);
-	if (rsa.nq_prime)
-		kfree(rsa.nq_prime);
-	if (rsa.u_mult_inv)
-		kfree(rsa.u_mult_inv);
-	
-	return err;
-}
-
-static int w_long(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	mm_segment_t old_fs = get_fs();
-	int err;
-	unsigned long val;
-	
-	set_fs (KERNEL_DS);
-	err = sys_ioctl(fd, cmd, (unsigned long)&val);
-	set_fs (old_fs);
-	if (!err && put_user((unsigned int) val, (u32 *)arg))
-		return -EFAULT;
-	return err;
-}
-
-struct ioctl32_handler {
-	unsigned int cmd;
-	int (*function)(unsigned int, unsigned int, unsigned long);
-};
-
-struct ioctl32_list {
-	struct ioctl32_handler handler;
-	struct ioctl32_list *next;
-};
-
-#define IOCTL32_DEFAULT(cmd)		{ { cmd, (void *) sys_ioctl }, 0 }
-#define IOCTL32_HANDLER(cmd, handler)	{ { cmd, (void *) handler }, 0 }
-
-static struct ioctl32_list ioctl32_handler_table[] = {
-	IOCTL32_DEFAULT(FIBMAP),
-	IOCTL32_DEFAULT(FIGETBSZ),
-
-	IOCTL32_DEFAULT(DASDAPIVER),
-	IOCTL32_DEFAULT(BIODASDDISABLE),
-	IOCTL32_DEFAULT(BIODASDENABLE),
-	IOCTL32_DEFAULT(BIODASDRSRV),
-	IOCTL32_DEFAULT(BIODASDRLSE),
-	IOCTL32_DEFAULT(BIODASDSLCK),
-	IOCTL32_DEFAULT(BIODASDINFO),
-	IOCTL32_DEFAULT(BIODASDFMT),
-
-	IOCTL32_DEFAULT(TAPE390_DISPLAY),
-
-	IOCTL32_DEFAULT(BLKROSET),
-	IOCTL32_DEFAULT(BLKROGET),
-	IOCTL32_DEFAULT(BLKRRPART),
-	IOCTL32_DEFAULT(BLKFLSBUF),
-	IOCTL32_DEFAULT(BLKRASET),
-	IOCTL32_DEFAULT(BLKFRASET),
-	IOCTL32_DEFAULT(BLKSECTSET),
-	IOCTL32_DEFAULT(BLKSSZGET),
-	IOCTL32_DEFAULT(BLKBSZGET),
-	IOCTL32_DEFAULT(BLKGETSIZE64),
-
-	IOCTL32_HANDLER(HDIO_GETGEO, hd_geometry_ioctl),
-
-	IOCTL32_DEFAULT(TCGETA),
-	IOCTL32_DEFAULT(TCSETA),
-	IOCTL32_DEFAULT(TCSETAW),
-	IOCTL32_DEFAULT(TCSETAF),
-	IOCTL32_DEFAULT(TCSBRK),
-	IOCTL32_DEFAULT(TCXONC),
-	IOCTL32_DEFAULT(TCFLSH),
-	IOCTL32_DEFAULT(TCGETS),
-	IOCTL32_DEFAULT(TCSETS),
-	IOCTL32_DEFAULT(TCSETSW),
-	IOCTL32_DEFAULT(TCSETSF),
-	IOCTL32_DEFAULT(TIOCLINUX),
-
-	IOCTL32_DEFAULT(TIOCGETD),
-	IOCTL32_DEFAULT(TIOCSETD),
-	IOCTL32_DEFAULT(TIOCEXCL),
-	IOCTL32_DEFAULT(TIOCNXCL),
-	IOCTL32_DEFAULT(TIOCCONS),
-	IOCTL32_DEFAULT(TIOCGSOFTCAR),
-	IOCTL32_DEFAULT(TIOCSSOFTCAR),
-	IOCTL32_DEFAULT(TIOCSWINSZ),
-	IOCTL32_DEFAULT(TIOCGWINSZ),
-	IOCTL32_DEFAULT(TIOCMGET),
-	IOCTL32_DEFAULT(TIOCMBIC),
-	IOCTL32_DEFAULT(TIOCMBIS),
-	IOCTL32_DEFAULT(TIOCMSET),
-	IOCTL32_DEFAULT(TIOCPKT),
-	IOCTL32_DEFAULT(TIOCNOTTY),
-	IOCTL32_DEFAULT(TIOCSTI),
-	IOCTL32_DEFAULT(TIOCOUTQ),
-	IOCTL32_DEFAULT(TIOCSPGRP),
-	IOCTL32_DEFAULT(TIOCGPGRP),
-	IOCTL32_DEFAULT(TIOCSCTTY),
-	IOCTL32_DEFAULT(TIOCGPTN),
-	IOCTL32_DEFAULT(TIOCSPTLCK),
-	IOCTL32_DEFAULT(TIOCGSERIAL),
-	IOCTL32_DEFAULT(TIOCSSERIAL),
-	IOCTL32_DEFAULT(TIOCSERGETLSR),
-
-	IOCTL32_DEFAULT(FIOCLEX),
-	IOCTL32_DEFAULT(FIONCLEX),
-	IOCTL32_DEFAULT(FIOASYNC),
-	IOCTL32_DEFAULT(FIONBIO),
-	IOCTL32_DEFAULT(FIONREAD),
-
-	IOCTL32_DEFAULT(PIO_FONT),
-	IOCTL32_DEFAULT(GIO_FONT),
-	IOCTL32_DEFAULT(KDSIGACCEPT),
-	IOCTL32_DEFAULT(KDGETKEYCODE),
-	IOCTL32_DEFAULT(KDSETKEYCODE),
-	IOCTL32_DEFAULT(KIOCSOUND),
-	IOCTL32_DEFAULT(KDMKTONE),
-	IOCTL32_DEFAULT(KDGKBTYPE),
-	IOCTL32_DEFAULT(KDSETMODE),
-	IOCTL32_DEFAULT(KDGETMODE),
-	IOCTL32_DEFAULT(KDSKBMODE),
-	IOCTL32_DEFAULT(KDGKBMODE),
-	IOCTL32_DEFAULT(KDSKBMETA),
-	IOCTL32_DEFAULT(KDGKBMETA),
-	IOCTL32_DEFAULT(KDGKBENT),
-	IOCTL32_DEFAULT(KDSKBENT),
-	IOCTL32_DEFAULT(KDGKBSENT),
-	IOCTL32_DEFAULT(KDSKBSENT),
-	IOCTL32_DEFAULT(KDGKBDIACR),
-	IOCTL32_DEFAULT(KDSKBDIACR),
-	IOCTL32_DEFAULT(KDGKBLED),
-	IOCTL32_DEFAULT(KDSKBLED),
-	IOCTL32_DEFAULT(KDGETLED),
-	IOCTL32_DEFAULT(KDSETLED),
-	IOCTL32_DEFAULT(GIO_SCRNMAP),
-	IOCTL32_DEFAULT(PIO_SCRNMAP),
-	IOCTL32_DEFAULT(GIO_UNISCRNMAP),
-	IOCTL32_DEFAULT(PIO_UNISCRNMAP),
-	IOCTL32_DEFAULT(PIO_FONTRESET),
-	IOCTL32_DEFAULT(PIO_UNIMAPCLR),
-
-	IOCTL32_DEFAULT(VT_SETMODE),
-	IOCTL32_DEFAULT(VT_GETMODE),
-	IOCTL32_DEFAULT(VT_GETSTATE),
-	IOCTL32_DEFAULT(VT_OPENQRY),
-	IOCTL32_DEFAULT(VT_ACTIVATE),
-	IOCTL32_DEFAULT(VT_WAITACTIVE),
-	IOCTL32_DEFAULT(VT_RELDISP),
-	IOCTL32_DEFAULT(VT_DISALLOCATE),
-	IOCTL32_DEFAULT(VT_RESIZE),
-	IOCTL32_DEFAULT(VT_RESIZEX),
-	IOCTL32_DEFAULT(VT_LOCKSWITCH),
-	IOCTL32_DEFAULT(VT_UNLOCKSWITCH),
-
-	IOCTL32_DEFAULT(SIOCGSTAMP),
-
-	IOCTL32_DEFAULT(DM_VERSION),
-	IOCTL32_DEFAULT(DM_REMOVE_ALL),
-	IOCTL32_DEFAULT(DM_DEV_CREATE),
-	IOCTL32_DEFAULT(DM_DEV_REMOVE),
-	IOCTL32_DEFAULT(DM_DEV_RELOAD),
-	IOCTL32_DEFAULT(DM_DEV_SUSPEND),
-	IOCTL32_DEFAULT(DM_DEV_RENAME),
-	IOCTL32_DEFAULT(DM_DEV_DEPS),
-	IOCTL32_DEFAULT(DM_DEV_STATUS),
-	IOCTL32_DEFAULT(DM_TARGET_STATUS),
-	IOCTL32_DEFAULT(DM_TARGET_WAIT),
-
-	IOCTL32_DEFAULT(LOOP_SET_FD),
-	IOCTL32_DEFAULT(LOOP_CLR_FD),
-
-	IOCTL32_HANDLER(SIOCGIFNAME, dev_ifname32),
-	IOCTL32_HANDLER(SIOCGIFCONF, dev_ifconf),
-	IOCTL32_HANDLER(SIOCGIFFLAGS, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFFLAGS, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFMETRIC, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFMETRIC, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFMTU, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFMTU, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFMEM, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFMEM, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFHWADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFHWADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCADDMULTI, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCDELMULTI, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFINDEX, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFMAP, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFMAP, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFBRDADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFBRDADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFDSTADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFDSTADDR, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFNETMASK, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFNETMASK, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFPFLAGS, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFPFLAGS, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCGIFTXQLEN, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCSIFTXQLEN, dev_ifsioc),
-	IOCTL32_HANDLER(SIOCADDRT, routing_ioctl),
-	IOCTL32_HANDLER(SIOCDELRT, routing_ioctl),
-
-	IOCTL32_HANDLER(SIOCBONDENSLAVE, bond_ioctl),
-	IOCTL32_HANDLER(SIOCBONDRELEASE, bond_ioctl),
-	IOCTL32_HANDLER(SIOCBONDSETHWADDR, bond_ioctl),
-	IOCTL32_HANDLER(SIOCBONDSLAVEINFOQUERY, bond_ioctl),
-	IOCTL32_HANDLER(SIOCBONDINFOQUERY, bond_ioctl),
-	IOCTL32_HANDLER(SIOCBONDCHANGEACTIVE, bond_ioctl),
-
-	IOCTL32_HANDLER(EXT2_IOC32_GETFLAGS, do_ext2_ioctl),
-	IOCTL32_HANDLER(EXT2_IOC32_SETFLAGS, do_ext2_ioctl),
-	IOCTL32_HANDLER(EXT2_IOC32_GETVERSION, do_ext2_ioctl),
-	IOCTL32_HANDLER(EXT2_IOC32_SETVERSION, do_ext2_ioctl),
-
-	IOCTL32_HANDLER(LOOP_SET_STATUS, loop_status),
-	IOCTL32_HANDLER(LOOP_GET_STATUS, loop_status),
-
-	IOCTL32_HANDLER(ICARSAMODEXPO, do_rsa_ioctl),
-	IOCTL32_HANDLER(ICARSACRT, do_rsa_crt_ioctl),
-	IOCTL32_HANDLER(ICARSAMODMULT, do_rsa_ioctl),
-	IOCTL32_DEFAULT(ICAZ90STATUS),
-	IOCTL32_DEFAULT(ICAZ90QUIESCE),
-	IOCTL32_DEFAULT(ICAZ90HARDRESET),
-	IOCTL32_DEFAULT(ICAZ90HARDERROR),
-
-	IOCTL32_HANDLER(BLKRAGET, w_long),
-	IOCTL32_HANDLER(BLKGETSIZE, w_long),
-	IOCTL32_HANDLER(BLKFRAGET, w_long),
-	IOCTL32_HANDLER(BLKSECTGET, w_long),
-	IOCTL32_HANDLER(BLKPG, blkpg_ioctl_trans)
-
-};
-
-#define NR_IOCTL32_HANDLERS	(sizeof(ioctl32_handler_table) /	\
-				 sizeof(ioctl32_handler_table[0]))
-
-static struct ioctl32_list *ioctl32_hash_table[1024];
-
-static inline int ioctl32_hash(unsigned int cmd)
-{
-	return ((cmd >> 6) ^ (cmd >> 4) ^ cmd) & 0x3ff;
-}
-
-int sys32_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	int (*handler)(unsigned int, unsigned int, unsigned long, struct file * filp);
-	struct file *filp;
-	struct ioctl32_list *l;
-	int error;
-
-	l = ioctl32_hash_table[ioctl32_hash(cmd)];
-
-	error = -EBADF;
-
-	filp = fget(fd);
-	if (!filp)
-		return error;
-
-	if (!filp->f_op || !filp->f_op->ioctl) {
-		error = sys_ioctl (fd, cmd, arg);
-		goto out;
-	}
-
-	while (l && l->handler.cmd != cmd)
-		l = l->next;
-
-	if (l) {
-		handler = (void *)l->handler.function;
-		error = handler(fd, cmd, arg, filp);
-	} else {
-		error = -EINVAL;
-		printk("unknown ioctl: %08x\n", cmd);
-	}
-out:
-	fput(filp);
-	return error;
-}
-
-static void ioctl32_insert(struct ioctl32_list *entry)
-{
-	int hash = ioctl32_hash(entry->handler.cmd);
-
-	entry->next = 0;
-	if (!ioctl32_hash_table[hash])
-		ioctl32_hash_table[hash] = entry;
-	else {
-		struct ioctl32_list *l;
-		l = ioctl32_hash_table[hash];
-		while (l->next)
-			l = l->next;
-		l->next = entry;
-	}
-}
-
-int register_ioctl32_conversion(unsigned int cmd,
-				int (*handler)(unsigned int, unsigned int,
-					       unsigned long, struct file *))
-{
-	struct ioctl32_list *l, *new;
-	int hash;
-
-	hash = ioctl32_hash(cmd);
-	for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next)
-		if (l->handler.cmd == cmd)
-			return -EBUSY;
-	new = kmalloc(sizeof(struct ioctl32_list), GFP_KERNEL);
-	if (new == NULL)
-		return -ENOMEM;
-	new->handler.cmd = cmd;
-	new->handler.function = (void *) handler;
-	ioctl32_insert(new);
-	return 0;
-}
-
-int unregister_ioctl32_conversion(unsigned int cmd)
-{
-	struct ioctl32_list *p, *l;
-	int hash;
-
-	hash = ioctl32_hash(cmd);
-	p = NULL;
-	for (l = ioctl32_hash_table[hash]; l != NULL; l = l->next) {
-		if (l->handler.cmd == cmd)
-			break;
-		p = l;
-	}
-	if (l == NULL)
-		return -ENOENT;
-	if (p == NULL)
-		ioctl32_hash_table[hash] = l->next;
-	else
-		p->next = l->next;
-	kfree(l);
-	return 0;
-}
-
-static int __init init_ioctl32(void)
-{
-	int i;
-	for (i = 0; i < NR_IOCTL32_HANDLERS; i++)
-		ioctl32_insert(&ioctl32_handler_table[i]);
-	return 0;
-}
-
-__initcall(init_ioctl32);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/linux32.c linux-2.5.67-bk6/arch/s390x/kernel/linux32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/linux32.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/linux32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,2863 +0,0 @@
-/*
- *  arch/s390x/kernel/linux32.c
- *
- *  S390 version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Gerhard Tonn (ton@de.ibm.com)   
- *
- *  Conversion between 31bit and 64bit native syscalls.
- *
- * Heavily inspired by the 32-bit Sparc compat code which is 
- * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
- *
- */
-
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/fs.h> 
-#include <linux/mm.h> 
-#include <linux/file.h> 
-#include <linux/signal.h>
-#include <linux/resource.h>
-#include <linux/times.h>
-#include <linux/utsname.h>
-#include <linux/timex.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/sem.h>
-#include <linux/msg.h>
-#include <linux/shm.h>
-#include <linux/slab.h>
-#include <linux/uio.h>
-#include <linux/nfs_fs.h>
-#include <linux/smb_fs.h>
-#include <linux/smb_mount.h>
-#include <linux/ncp_fs.h>
-#include <linux/quota.h>
-#include <linux/module.h>
-#include <linux/sunrpc/svc.h>
-#include <linux/nfsd/nfsd.h>
-#include <linux/nfsd/cache.h>
-#include <linux/nfsd/xdr.h>
-#include <linux/nfsd/syscall.h>
-#include <linux/poll.h>
-#include <linux/personality.h>
-#include <linux/stat.h>
-#include <linux/filter.h>
-#include <linux/highmem.h>
-#include <linux/highuid.h>
-#include <linux/mman.h>
-#include <linux/ipv6.h>
-#include <linux/in.h>
-#include <linux/icmpv6.h>
-#include <linux/sysctl.h>
-#include <linux/binfmts.h>
-#include <linux/compat.h>
-#include <linux/vfs.h>
-#include <linux/ptrace.h>
-
-#include <asm/types.h>
-#include <asm/ipc.h>
-#include <asm/uaccess.h>
-#include <asm/semaphore.h>
-
-#include <net/scm.h>
-#include <net/sock.h>
-
-#include "linux32.h"
-
-extern asmlinkage long sys_chown(const char *, uid_t,gid_t);
-extern asmlinkage long sys_lchown(const char *, uid_t,gid_t);
-extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t);
-extern asmlinkage long sys_setregid(gid_t, gid_t);
-extern asmlinkage long sys_setgid(gid_t);
-extern asmlinkage long sys_setreuid(uid_t, uid_t);
-extern asmlinkage long sys_setuid(uid_t);
-extern asmlinkage long sys_setresuid(uid_t, uid_t, uid_t);
-extern asmlinkage long sys_setresgid(gid_t, gid_t, gid_t);
-extern asmlinkage long sys_setfsuid(uid_t);
-extern asmlinkage long sys_setfsgid(gid_t);
- 
-/* For this source file, we want overflow handling. */
-
-#undef high2lowuid
-#undef high2lowgid
-#undef low2highuid
-#undef low2highgid
-#undef SET_UID16
-#undef SET_GID16
-#undef NEW_TO_OLD_UID
-#undef NEW_TO_OLD_GID
-#undef SET_OLDSTAT_UID
-#undef SET_OLDSTAT_GID
-#undef SET_STAT_UID
-#undef SET_STAT_GID
-
-#define high2lowuid(uid) ((uid) > 65535) ? (u16)overflowuid : (u16)(uid)
-#define high2lowgid(gid) ((gid) > 65535) ? (u16)overflowgid : (u16)(gid)
-#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid)
-#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid)
-#define SET_UID16(var, uid)	var = high2lowuid(uid)
-#define SET_GID16(var, gid)	var = high2lowgid(gid)
-#define NEW_TO_OLD_UID(uid)	high2lowuid(uid)
-#define NEW_TO_OLD_GID(gid)	high2lowgid(gid)
-#define SET_OLDSTAT_UID(stat, uid)	(stat).st_uid = high2lowuid(uid)
-#define SET_OLDSTAT_GID(stat, gid)	(stat).st_gid = high2lowgid(gid)
-#define SET_STAT_UID(stat, uid)		(stat).st_uid = high2lowuid(uid)
-#define SET_STAT_GID(stat, gid)		(stat).st_gid = high2lowgid(gid)
-
-asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
-{
-	return sys_chown(filename, low2highuid(user), low2highgid(group));
-}
-
-asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
-{
-	return sys_lchown(filename, low2highuid(user), low2highgid(group));
-}
-
-asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group)
-{
-	return sys_fchown(fd, low2highuid(user), low2highgid(group));
-}
-
-asmlinkage long sys32_setregid16(u16 rgid, u16 egid)
-{
-	return sys_setregid(low2highgid(rgid), low2highgid(egid));
-}
-
-asmlinkage long sys32_setgid16(u16 gid)
-{
-	return sys_setgid((gid_t)gid);
-}
-
-asmlinkage long sys32_setreuid16(u16 ruid, u16 euid)
-{
-	return sys_setreuid(low2highuid(ruid), low2highuid(euid));
-}
-
-asmlinkage long sys32_setuid16(u16 uid)
-{
-	return sys_setuid((uid_t)uid);
-}
-
-asmlinkage long sys32_setresuid16(u16 ruid, u16 euid, u16 suid)
-{
-	return sys_setresuid(low2highuid(ruid), low2highuid(euid),
-		low2highuid(suid));
-}
-
-asmlinkage long sys32_getresuid16(u16 *ruid, u16 *euid, u16 *suid)
-{
-	int retval;
-
-	if (!(retval = put_user(high2lowuid(current->uid), ruid)) &&
-	    !(retval = put_user(high2lowuid(current->euid), euid)))
-		retval = put_user(high2lowuid(current->suid), suid);
-
-	return retval;
-}
-
-asmlinkage long sys32_setresgid16(u16 rgid, u16 egid, u16 sgid)
-{
-	return sys_setresgid(low2highgid(rgid), low2highgid(egid),
-		low2highgid(sgid));
-}
-
-asmlinkage long sys32_getresgid16(u16 *rgid, u16 *egid, u16 *sgid)
-{
-	int retval;
-
-	if (!(retval = put_user(high2lowgid(current->gid), rgid)) &&
-	    !(retval = put_user(high2lowgid(current->egid), egid)))
-		retval = put_user(high2lowgid(current->sgid), sgid);
-
-	return retval;
-}
-
-asmlinkage long sys32_setfsuid16(u16 uid)
-{
-	return sys_setfsuid((uid_t)uid);
-}
-
-asmlinkage long sys32_setfsgid16(u16 gid)
-{
-	return sys_setfsgid((gid_t)gid);
-}
-
-asmlinkage long sys32_getgroups16(int gidsetsize, u16 *grouplist)
-{
-	u16 groups[NGROUPS];
-	int i,j;
-
-	if (gidsetsize < 0)
-		return -EINVAL;
-	i = current->ngroups;
-	if (gidsetsize) {
-		if (i > gidsetsize)
-			return -EINVAL;
-		for(j=0;j<i;j++)
-			groups[j] = current->groups[j];
-		if (copy_to_user(grouplist, groups, sizeof(u16)*i))
-			return -EFAULT;
-	}
-	return i;
-}
-
-asmlinkage long sys32_setgroups16(int gidsetsize, u16 *grouplist)
-{
-	u16 groups[NGROUPS];
-	int i;
-
-	if (!capable(CAP_SETGID))
-		return -EPERM;
-	if ((unsigned) gidsetsize > NGROUPS)
-		return -EINVAL;
-	if (copy_from_user(groups, grouplist, gidsetsize * sizeof(u16)))
-		return -EFAULT;
-	for (i = 0 ; i < gidsetsize ; i++)
-		current->groups[i] = (gid_t)groups[i];
-	current->ngroups = gidsetsize;
-	return 0;
-}
-
-asmlinkage long sys32_getuid16(void)
-{
-	return high2lowuid(current->uid);
-}
-
-asmlinkage long sys32_geteuid16(void)
-{
-	return high2lowuid(current->euid);
-}
-
-asmlinkage long sys32_getgid16(void)
-{
-	return high2lowgid(current->gid);
-}
-
-asmlinkage long sys32_getegid16(void)
-{
-	return high2lowgid(current->egid);
-}
-
-/* 32-bit timeval and related flotsam.  */
-
-static inline long get_tv32(struct timeval *o, struct compat_timeval *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)
-{
-	return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
-		(__put_user(i->tv_sec, &o->tv_sec) |
-		 __put_user(i->tv_usec, &o->tv_usec)));
-}
-
-struct msgbuf32 { s32 mtype; char mtext[1]; };
-
-struct ipc64_perm_ds32
-{
-        __kernel_key_t          key;
-        __kernel_uid32_t        uid;
-        __kernel_gid32_t        gid;
-        __kernel_uid32_t        cuid;
-        __kernel_gid32_t        cgid;
-        compat_mode_t       mode;
-        unsigned short          __pad1;
-        unsigned short          seq;
-        unsigned short          __pad2;
-        unsigned int            __unused1;
-        unsigned int            __unused2;
-};
-
-struct ipc_perm32
-{
-	key_t    	  key;
-        compat_uid_t  uid;
-        compat_gid_t  gid;
-        compat_uid_t  cuid;
-        compat_gid_t  cgid;
-        compat_mode_t mode;
-        unsigned short  seq;
-};
-
-struct semid_ds32 {
-        struct ipc_perm32 sem_perm;               /* permissions .. see ipc.h */
-        compat_time_t   sem_otime;              /* last semop time */
-        compat_time_t   sem_ctime;              /* last change time */
-        u32 sem_base;              /* ptr to first semaphore in array */
-        u32 sem_pending;          /* pending operations to be processed */
-        u32 sem_pending_last;    /* last pending operation */
-        u32 undo;                  /* undo requests on this array */
-        unsigned short  sem_nsems;              /* no. of semaphores in array */
-};
-
-struct semid64_ds32 {
-	struct ipc64_perm_ds32 sem_perm;
-	unsigned int	  __pad1;
-	compat_time_t   sem_otime;
-	unsigned int	  __pad2;
-	compat_time_t   sem_ctime;
-	u32 sem_nsems;
-	u32 __unused1;
-	u32 __unused2;
-};
-
-struct msqid_ds32
-{
-        struct ipc_perm32 msg_perm;
-        u32 msg_first;
-        u32 msg_last;
-        compat_time_t   msg_stime;
-        compat_time_t   msg_rtime;
-        compat_time_t   msg_ctime;
-        u32 wwait;
-        u32 rwait;
-        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_ds32 msg_perm;
-	unsigned int   __pad1;
-	compat_time_t msg_stime;
-	unsigned int   __pad2;
-	compat_time_t msg_rtime;
-	unsigned int   __pad3;
-	compat_time_t msg_ctime;
-	unsigned int  msg_cbytes;
-	unsigned int  msg_qnum;
-	unsigned int  msg_qbytes;
-	compat_pid_t msg_lspid;
-	compat_pid_t msg_lrpid;
-	unsigned int  __unused1;
-	unsigned int  __unused2;
-};
-
-
-struct shmid_ds32 {
-	struct ipc_perm32       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;
-};
-
-struct shmid64_ds32 {
-	struct ipc64_perm_ds32	shm_perm;
-	compat_size_t	shm_segsz;
-	compat_time_t  	shm_atime;
-	unsigned int		__unused1;
-	compat_time_t  	shm_dtime;
-	unsigned int		__unused2;
-	compat_time_t  	shm_ctime;
-	unsigned int		__unused3;
-	compat_pid_t	shm_cpid;
-	compat_pid_t	shm_lpid;
-	unsigned int		shm_nattch;
-	unsigned int		__unused4;
-	unsigned int		__unused5;
-};
-
-                                                        
-/*
- * sys32_ipc() is the de-multiplexer for the SysV IPC calls in 32bit emulation..
- *
- * This is really horribly ugly.
- */
-#define IPCOP_MASK(__x)	(1UL << (__x))
-static int do_sys32_semctl(int first, int second, int third, void *uptr)
-{
-	union semun fourth;
-	u32 pad;
-	int err = -EINVAL;
-
-	if (!uptr)
-		goto out;
-	err = -EFAULT;
-	if (get_user (pad, (u32 *)uptr))
-		goto out;
-	if(third == SETVAL)
-		fourth.val = (int)pad;
-	else
-		fourth.__pad = (void *)A(pad);
-	if (IPCOP_MASK (third) &
-	    (IPCOP_MASK (IPC_INFO) | IPCOP_MASK (SEM_INFO) | IPCOP_MASK (GETVAL) |
-	     IPCOP_MASK (GETPID) | IPCOP_MASK (GETNCNT) | IPCOP_MASK (GETZCNT) |
-	     IPCOP_MASK (GETALL) | IPCOP_MASK (SETALL) | IPCOP_MASK (IPC_RMID))) {
-		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);
-		mm_segment_t old_fs;
-		int need_back_translation;
-
-		if (third == (IPC_SET|IPC_64)) {
-			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;
-		}
-		need_back_translation =
-			(IPCOP_MASK (third) &
-			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
-		if (need_back_translation)
-			fourth.__pad = &s;
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_semctl (first, second, third, fourth);
-		set_fs (old_fs);
-		if (need_back_translation) {
-			int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key);
-			err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid);
-			err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid);
-			err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid);
-			err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid);
-			err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode);
-			err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq);
-			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;
-		}
-	} else {
-		struct semid_ds s;
-		struct semid_ds32 *usp = (struct semid_ds32 *)A(pad);
-		mm_segment_t old_fs;
-		int need_back_translation;
-
-		if (third == IPC_SET) {
-			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;
-		}
-		need_back_translation =
-			(IPCOP_MASK (third) &
-			 (IPCOP_MASK (SEM_STAT) | IPCOP_MASK (IPC_STAT))) != 0;
-		if (need_back_translation)
-			fourth.__pad = &s;
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_semctl (first, second, third, fourth);
-		set_fs (old_fs);
-		if (need_back_translation) {
-			int err2 = put_user (s.sem_perm.key, &usp->sem_perm.key);
-			err2 |= __put_user (high2lowuid(s.sem_perm.uid), &usp->sem_perm.uid);
-			err2 |= __put_user (high2lowgid(s.sem_perm.gid), &usp->sem_perm.gid);
-			err2 |= __put_user (high2lowuid(s.sem_perm.cuid), &usp->sem_perm.cuid);
-			err2 |= __put_user (high2lowgid(s.sem_perm.cgid), &usp->sem_perm.cgid);
-			err2 |= __put_user (s.sem_perm.mode, &usp->sem_perm.mode);
-			err2 |= __put_user (s.sem_perm.seq, &usp->sem_perm.seq);
-			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;
-		}
-	}
-out:
-	return err;
-}
-
-static int do_sys32_msgsnd (int first, int second, int third, void *uptr)
-{
-	struct msgbuf *p = kmalloc (second + sizeof (struct msgbuf), GFP_USER);
-	struct msgbuf32 *up = (struct msgbuf32 *)uptr;
-	mm_segment_t old_fs;
-	int err;
-
-	if (!p)
-		return -ENOMEM;
-
-	err = -EINVAL;
-	if (second > MSGMAX || first < 0 || second < 0)
-		goto out;
-
-	err = -EFAULT;
-	if (!uptr)
-		goto out;
-        if (get_user (p->mtype, &up->mtype) ||
-	    __copy_from_user (p->mtext, &up->mtext, second))
-		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;
-}
-
-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 (first < 0 || second < 0)
-		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;
-
-	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);
-	} else if (second & IPC_64) {
-		struct msqid64_ds m;
-		struct msqid64_ds32 *up = (struct msqid64_ds32 *)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);
-			if (err)
-				goto out;
-		}
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, (struct msqid_ds *)&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);
-			if (err2)
-				err = -EFAULT;
-		}
-	} else {
-		struct msqid_ds m;
-		struct msqid_ds32 *up = (struct msqid_ds32 *)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);
-			if (err)
-				goto out;
-		}
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, &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);
-			if (err2)
-				err = -EFAULT;
-		}
-	}
-
-out:
-	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)
-		goto out;
-	err = sys_shmat (first, uptr, second, &raddr);
-	if (err)
-		goto out;
-	err = put_user (raddr, uaddr);
-out:
-	return err;
-}
-
-static int do_sys32_shmctl (int first, int second, void *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);
-	} else if ((second & IPC_64) && second != (SHM_INFO|IPC_64)) {
-		struct shmid64_ds s;
-		struct shmid64_ds32 *up = (struct shmid64_ds32 *)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);
-			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);
-		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 = 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 (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid);
-			err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid);
-			err2 |= __put_user (high2lowgid(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;
-		}
-	} else {
-		struct shmid_ds s;
-		struct shmid_ds32 *up = (struct shmid_ds32 *)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);
-			if (err)
-				goto out;
-		}
-		old_fs = get_fs ();
-		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, &s);
-		set_fs (old_fs);
-		if (err < 0)
-			goto out;
-
-		/* Mask it even in this case so it becomes a CSE. */
-		if (second == SHM_INFO) {
-			struct shm_info32 {
-				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);
-			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 (high2lowgid(s.shm_perm.gid), &up->shm_perm.gid);
-			err2 |= __put_user (high2lowuid(s.shm_perm.cuid), &up->shm_perm.cuid);
-			err2 |= __put_user (high2lowgid(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;
-		}
-	}
-out:
-	return err;
-}
-
-asmlinkage int sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
-{
-	int version, err;
-
-	version = call >> 16; /* hack for backward compatibility */
-	call &= 0xffff;
-
-	if(version)
-		return -EINVAL;
-
-	if (call <= SEMCTL)
-		switch (call) {
-		case SEMOP:
-			/* struct sembuf is the same on 32 and 64bit :)) */
-			err = sys_semop (first, (struct sembuf *)AA(ptr), second);
-			goto out;
-		case SEMGET:
-			err = sys_semget (first, second, third);
-			goto out;
-		case SEMCTL:
-			err = do_sys32_semctl (first, second, third, (void *)AA(ptr));
-			goto out;
-		default:
-			err = -EINVAL;
-			goto out;
-		};
-	if (call <= MSGCTL) 
-		switch (call) {
-		case MSGSND:
-			err = do_sys32_msgsnd (first, second, third, (void *)AA(ptr));
-			goto out;
-		case MSGRCV:
-			err = do_sys32_msgrcv (first, second, 0, third,
-					       version, (void *)AA(ptr));
-			goto out;
-		case MSGGET:
-			err = sys_msgget ((key_t) first, second);
-			goto out;
-		case MSGCTL:
-			err = do_sys32_msgctl (first, second, (void *)AA(ptr));
-			goto out;
-		default:
-			err = -EINVAL;
-			goto out;
-		}
-	if (call <= SHMCTL) 
-		switch (call) {
-		case SHMAT:
-			err = do_sys32_shmat (first, second, third,
-					      version, (void *)AA(ptr));
-			goto out;
-		case SHMDT: 
-			err = sys_shmdt ((char *)AA(ptr));
-			goto out;
-		case SHMGET:
-			err = sys_shmget (first, second, third);
-			goto out;
-		case SHMCTL:
-			err = do_sys32_shmctl (first, second, (void *)AA(ptr));
-			goto out;
-		default:
-			err = -EINVAL;
-			goto out;
-		}
-
-	err = -EINVAL;
-
-out:
-	return err;
-}
-
-extern asmlinkage long sys_truncate(const char * path, unsigned long length);
-extern asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length);
-
-asmlinkage int sys32_truncate64(const char * path, unsigned long high, unsigned long low)
-{
-	if ((int)high < 0)
-		return -EINVAL;
-	else
-		return sys_truncate(path, (high << 32) | low);
-}
-
-asmlinkage int sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned long low)
-{
-	if ((int)high < 0)
-		return -EINVAL;
-	else
-		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;
-	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)
-		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, u32 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, u32 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)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
-
-struct old_linux_dirent32 {
-	u32		d_ino;
-	u32		d_offset;
-	unsigned short	d_namlen;
-	char		d_name[1];
-};
-
-struct readdir_callback32 {
-	struct old_linux_dirent32 * dirent;
-	int count;
-};
-
-static int fillonedir(void * __buf, const char * name, int namlen,
-		      loff_t offset, ino_t ino, unsigned int d_type)
-{
-	struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
-	struct old_linux_dirent32 * dirent;
-
-	if (buf->count)
-		return -EINVAL;
-	buf->count++;
-	dirent = buf->dirent;
-	put_user(ino, &dirent->d_ino);
-	put_user(offset, &dirent->d_offset);
-	put_user(namlen, &dirent->d_namlen);
-	copy_to_user(dirent->d_name, name, namlen);
-	put_user(0, dirent->d_name + namlen);
-	return 0;
-}
-
-asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, unsigned int count)
-{
-	int error = -EBADF;
-	struct file * file;
-	struct readdir_callback32 buf;
-
-	file = fget(fd);
-	if (!file)
-		goto out;
-
-	buf.count = 0;
-	buf.dirent = dirent;
-
-	error = vfs_readdir(file, fillonedir, &buf);
-	if (error < 0)
-		goto out_putf;
-	error = buf.count;
-
-out_putf:
-	fput(file);
-out:
-	return error;
-}
-
-struct linux_dirent32 {
-	u32		d_ino;
-	u32		d_off;
-	unsigned short	d_reclen;
-	char		d_name[1];
-};
-
-struct getdents_callback32 {
-	struct linux_dirent32 * current_dir;
-	struct linux_dirent32 * previous;
-	int count;
-	int error;
-};
-
-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 getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
-	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
-
-	buf->error = -EINVAL;	/* only used if we fail.. */
-	if (reclen > buf->count)
-		return -EINVAL;
-	dirent = buf->previous;
-	if (dirent)
-		put_user(offset, &dirent->d_off);
-	dirent = buf->current_dir;
-	buf->previous = dirent;
-	put_user(ino, &dirent->d_ino);
-	put_user(reclen, &dirent->d_reclen);
-	copy_to_user(dirent->d_name, name, namlen);
-	put_user(0, dirent->d_name + namlen);
-	((char *) 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)
-{
-	struct file * file;
-	struct linux_dirent32 * lastdirent;
-	struct getdents_callback32 buf;
-	int error = -EBADF;
-
-	file = fget(fd);
-	if (!file)
-		goto out;
-
-	buf.current_dir = dirent;
-	buf.previous = NULL;
-	buf.count = count;
-	buf.error = 0;
-
-	error = vfs_readdir(file, filldir, &buf);
-	if (error < 0)
-		goto out_putf;
-	lastdirent = buf.previous;
-	error = buf.error;
-	if(lastdirent) {
-		put_user(file->f_pos, &lastdirent->d_off);
-		error = count - buf.count;
-	}
-out_putf:
-	fput(file);
-out:
-	return error;
-}
-
-/* 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 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) {
-		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;
-
-	err = put_user(stat->dev, &statbuf->st_dev);
-	err |= put_user(stat->ino, &statbuf->st_ino);
-	err |= put_user(stat->mode, &statbuf->st_mode);
-	err |= put_user(stat->nlink, &statbuf->st_nlink);
-	err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
-	err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
-	err |= put_user(stat->rdev, &statbuf->st_rdev);
-	err |= put_user(stat->size, &statbuf->st_size);
-	err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
-	err |= put_user(stat->atime.tv_nsec, &statbuf->st_atime_nsec);
-	err |= put_user(stat->mtime.tv_sec, &statbuf->st_mtime);
-	err |= put_user(stat->mtime.tv_nsec, &statbuf->st_mtime_nsec);
-	err |= put_user(stat->ctime.tv_sec, &statbuf->st_ctime);
-	err |= put_user(stat->ctime.tv_nsec, &statbuf->st_ctime_nsec);
-	err |= put_user(stat->blksize, &statbuf->st_blksize);
-	err |= put_user(stat->blocks, &statbuf->st_blocks);
-/* fixme
-	err |= put_user(0, &statbuf->__unused4[0]);
-	err |= put_user(0, &statbuf->__unused4[1]);
-*/
-	return err;
-}
-
-extern asmlinkage int sys_sysfs(int option, unsigned long arg1, unsigned long arg2);
-
-asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
-{
-	return sys_sysfs(option, arg1, arg2);
-}
-
-struct ncp_mount_data32 {
-        int version;
-        unsigned int ncp_fd;
-        compat_uid_t mounted_uid;
-        compat_pid_t wdog_pid;
-        unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
-        unsigned int time_out;
-        unsigned int retry_count;
-        unsigned int flags;
-        compat_uid_t uid;
-        compat_gid_t gid;
-        compat_mode_t file_mode;
-        compat_mode_t dir_mode;
-};
-
-static void *do_ncp_super_data_conv(void *raw_data)
-{
-	struct ncp_mount_data *n = (struct ncp_mount_data *)raw_data;
-	struct ncp_mount_data32 *n32 = (struct ncp_mount_data32 *)raw_data;
-
-	n->dir_mode = n32->dir_mode;
-	n->file_mode = n32->file_mode;
-	n->gid = low2highgid(n32->gid);
-	n->uid = low2highuid(n32->uid);
-	memmove (n->mounted_vol, n32->mounted_vol, (sizeof (n32->mounted_vol) + 3 * sizeof (unsigned int)));
-	n->wdog_pid = n32->wdog_pid;
-	n->mounted_uid = low2highuid(n32->mounted_uid);
-	return raw_data;
-}
-
-struct smb_mount_data32 {
-        int version;
-        compat_uid_t mounted_uid;
-        compat_uid_t uid;
-        compat_gid_t gid;
-        compat_mode_t file_mode;
-        compat_mode_t dir_mode;
-};
-
-static void *do_smb_super_data_conv(void *raw_data)
-{
-	struct smb_mount_data *s = (struct smb_mount_data *)raw_data;
-	struct smb_mount_data32 *s32 = (struct smb_mount_data32 *)raw_data;
-
-	if (s32->version != SMB_MOUNT_OLDVERSION)
-		goto out;
-	s->version = s32->version;
-	s->mounted_uid = low2highuid(s32->mounted_uid);
-	s->uid = low2highuid(s32->uid);
-	s->gid = low2highgid(s32->gid);
-	s->file_mode = s32->file_mode;
-	s->dir_mode = s32->dir_mode;
-out:
-	return raw_data;
-}
-
-static int copy_mount_stuff_to_kernel(const void *user, unsigned long *kernel)
-{
-	int i;
-	unsigned long page;
-	struct vm_area_struct *vma;
-
-	*kernel = 0;
-	if(!user)
-		return 0;
-	vma = find_vma(current->mm, (unsigned long)user);
-	if(!vma || (unsigned long)user < vma->vm_start)
-		return -EFAULT;
-	if(!(vma->vm_flags & VM_READ))
-		return -EFAULT;
-	i = vma->vm_end - (unsigned long) user;
-	if(PAGE_SIZE <= (unsigned long) i)
-		i = PAGE_SIZE - 1;
-	if(!(page = __get_free_page(GFP_KERNEL)))
-		return -ENOMEM;
-	if(copy_from_user((void *) page, user, i)) {
-		free_page(page);
-		return -EFAULT;
-	}
-	*kernel = page;
-	return 0;
-}
-
-#define SMBFS_NAME	"smbfs"
-#define NCPFS_NAME	"ncpfs"
-
-asmlinkage int sys32_mount(char *dev_name, char *dir_name, char *type, unsigned long new_flags, u32 data)
-{
-	unsigned long type_page = 0;
-	unsigned long data_page = 0;
-	unsigned long dev_page = 0;
-	unsigned long dir_page = 0;
-	int err, is_smb, is_ncp;
-
-	is_smb = is_ncp = 0;
-
-	err = copy_mount_stuff_to_kernel((const void *)type, &type_page);
-	if (err)
-		goto out;
-
-	if (!type_page) {
-		err = -EINVAL;
-		goto out;
-	}
-
-	is_smb = !strcmp((char *)type_page, SMBFS_NAME);
-	is_ncp = !strcmp((char *)type_page, NCPFS_NAME);
-
-	err = copy_mount_stuff_to_kernel((const void *)AA(data), &data_page);
-	if (err)
-		goto type_out;
-
-	err = copy_mount_stuff_to_kernel(dev_name, &dev_page);
-	if (err)
-		goto data_out;
-
-	err = copy_mount_stuff_to_kernel(dir_name, &dir_page);
-	if (err)
-		goto dev_out;
-
-	if (!is_smb && !is_ncp) {
-		lock_kernel();
-		err = do_mount((char*)dev_page, (char*)dir_page,
-				(char*)type_page, new_flags, (char*)data_page);
-		unlock_kernel();
-	} else {
-		if (is_ncp)
-			do_ncp_super_data_conv((void *)data_page);
-		else
-			do_smb_super_data_conv((void *)data_page);
-
-		lock_kernel();
-		err = do_mount((char*)dev_page, (char*)dir_page,
-				(char*)type_page, new_flags, (char*)data_page);
-		unlock_kernel();
-	}
-	free_page(dir_page);
-
-dev_out:
-	free_page(dev_page);
-
-data_out:
-	free_page(data_page);
-
-type_out:
-	free_page(type_page);
-
-out:
-	return err;
-}
-
-struct rusage32 {
-        struct compat_timeval ru_utime;
-        struct compat_timeval ru_stime;
-        s32    ru_maxrss;
-        s32    ru_ixrss;
-        s32    ru_idrss;
-        s32    ru_isrss;
-        s32    ru_minflt;
-        s32    ru_majflt;
-        s32    ru_nswap;
-        s32    ru_inblock;
-        s32    ru_oublock;
-        s32    ru_msgsnd; 
-        s32    ru_msgrcv; 
-        s32    ru_nsignals;
-        s32    ru_nvcsw;
-        s32    ru_nivcsw;
-};
-
-static int put_rusage (struct rusage32 *ru, struct rusage *r)
-{
-	int err;
-	
-	err = put_user (r->ru_utime.tv_sec, &ru->ru_utime.tv_sec);
-	err |= __put_user (r->ru_utime.tv_usec, &ru->ru_utime.tv_usec);
-	err |= __put_user (r->ru_stime.tv_sec, &ru->ru_stime.tv_sec);
-	err |= __put_user (r->ru_stime.tv_usec, &ru->ru_stime.tv_usec);
-	err |= __put_user (r->ru_maxrss, &ru->ru_maxrss);
-	err |= __put_user (r->ru_ixrss, &ru->ru_ixrss);
-	err |= __put_user (r->ru_idrss, &ru->ru_idrss);
-	err |= __put_user (r->ru_isrss, &ru->ru_isrss);
-	err |= __put_user (r->ru_minflt, &ru->ru_minflt);
-	err |= __put_user (r->ru_majflt, &ru->ru_majflt);
-	err |= __put_user (r->ru_nswap, &ru->ru_nswap);
-	err |= __put_user (r->ru_inblock, &ru->ru_inblock);
-	err |= __put_user (r->ru_oublock, &ru->ru_oublock);
-	err |= __put_user (r->ru_msgsnd, &ru->ru_msgsnd);
-	err |= __put_user (r->ru_msgrcv, &ru->ru_msgrcv);
-	err |= __put_user (r->ru_nsignals, &ru->ru_nsignals);
-	err |= __put_user (r->ru_nvcsw, &ru->ru_nvcsw);
-	err |= __put_user (r->ru_nivcsw, &ru->ru_nivcsw);
-	return err;
-}
-
-asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
-{
-	if (!ru)
-		return sys_wait4(pid, stat_addr, options, NULL);
-	else {
-		struct rusage r;
-		int ret;
-		unsigned int status;
-		mm_segment_t old_fs = get_fs();
-		
-		set_fs (KERNEL_DS);
-		ret = sys_wait4(pid, stat_addr ? &status : NULL, options, &r);
-		set_fs (old_fs);
-		if (put_rusage (ru, &r)) return -EFAULT;
-		if (stat_addr && put_user (status, stat_addr))
-			return -EFAULT;
-		return ret;
-	}
-}
-
-struct sysinfo32 {
-        s32 uptime;
-        u32 loads[3];
-        u32 totalram;
-        u32 freeram;
-        u32 sharedram;
-        u32 bufferram;
-        u32 totalswap;
-        u32 freeswap;
-        unsigned short procs;
-        char _f[22];
-};
-
-extern asmlinkage int sys_sysinfo(struct sysinfo *info);
-
-asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
-{
-	struct sysinfo s;
-	int ret, err;
-	mm_segment_t old_fs = get_fs ();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_sysinfo(&s);
-	set_fs (old_fs);
-	err = put_user (s.uptime, &info->uptime);
-	err |= __put_user (s.loads[0], &info->loads[0]);
-	err |= __put_user (s.loads[1], &info->loads[1]);
-	err |= __put_user (s.loads[2], &info->loads[2]);
-	err |= __put_user (s.totalram, &info->totalram);
-	err |= __put_user (s.freeram, &info->freeram);
-	err |= __put_user (s.sharedram, &info->sharedram);
-	err |= __put_user (s.bufferram, &info->bufferram);
-	err |= __put_user (s.totalswap, &info->totalswap);
-	err |= __put_user (s.freeswap, &info->freeswap);
-	err |= __put_user (s.procs, &info->procs);
-	if (err)
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
-
-asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
-		struct compat_timespec *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);
-	set_fs (old_fs);
-	if (put_compat_timespec(&t, interval))
-		return -EFAULT;
-	return ret;
-}
-
-extern asmlinkage int sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, size_t sigsetsize);
-
-asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset, compat_size_t sigsetsize)
-{
-	sigset_t s;
-	compat_sigset_t s32;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-	
-	if (set) {
-		if (copy_from_user (&s32, set, sizeof(compat_sigset_t)))
-			return -EFAULT;
-		switch (_NSIG_WORDS) {
-		case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32);
-		case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32);
-		case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32);
-		case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32);
-		}
-	}
-	set_fs (KERNEL_DS);
-	ret = sys_rt_sigprocmask(how, set ? &s : NULL, oset ? &s : NULL, sigsetsize);
-	set_fs (old_fs);
-	if (ret) return ret;
-	if (oset) {
-		switch (_NSIG_WORDS) {
-		case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
-		case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
-		case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
-		case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
-		}
-		if (copy_to_user (oset, &s32, sizeof(compat_sigset_t)))
-			return -EFAULT;
-	}
-	return 0;
-}
-
-extern asmlinkage int sys_rt_sigpending(sigset_t *set, size_t sigsetsize);
-
-asmlinkage int sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize)
-{
-	sigset_t s;
-	compat_sigset_t s32;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-		
-	set_fs (KERNEL_DS);
-	ret = sys_rt_sigpending(&s, sigsetsize);
-	set_fs (old_fs);
-	if (!ret) {
-		switch (_NSIG_WORDS) {
-		case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3];
-		case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2];
-		case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1];
-		case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0];
-		}
-		if (copy_to_user (set, &s32, sizeof(compat_sigset_t)))
-			return -EFAULT;
-	}
-	return ret;
-}
-
-extern int
-copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from);
-
-asmlinkage int
-sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo,
-		      struct compat_timespec *uts, compat_size_t sigsetsize)
-{
-	int ret, sig;
-	sigset_t these;
-	compat_sigset_t these32;
-	struct timespec ts;
-	siginfo_t info;
-	long timeout = 0;
-
-	/* XXX: Don't preclude handling different sized sigset_t's.  */
-	if (sigsetsize != sizeof(sigset_t))
-		return -EINVAL;
-
-	if (copy_from_user (&these32, uthese, sizeof(compat_sigset_t)))
-		return -EFAULT;
-
-	switch (_NSIG_WORDS) {
-	case 4: these.sig[3] = these32.sig[6] | (((long)these32.sig[7]) << 32);
-	case 3: these.sig[2] = these32.sig[4] | (((long)these32.sig[5]) << 32);
-	case 2: these.sig[1] = these32.sig[2] | (((long)these32.sig[3]) << 32);
-	case 1: these.sig[0] = these32.sig[0] | (((long)these32.sig[1]) << 32);
-	}
-		
-	/*
-	 * Invert the set of allowed signals to get those we
-	 * want to block.
-	 */
-	sigdelsetmask(&these, sigmask(SIGKILL)|sigmask(SIGSTOP));
-	signotset(&these);
-
-	if (uts) {
-		if (get_compat_timespec(&ts, uts))
-			return -EINVAL;
-		if (ts.tv_nsec >= 1000000000L || ts.tv_nsec < 0
-		    || ts.tv_sec < 0)
-			return -EINVAL;
-	}
-
-	spin_lock_irq(&current->sighand->siglock);
-	sig = dequeue_signal(current, &these, &info);
-	if (!sig) {
-		/* None ready -- temporarily unblock those we're interested
-		   in so that we'll be awakened when they arrive.  */
-		current->real_blocked = current->blocked;
-		sigandsets(&current->blocked, &current->blocked, &these);
-		recalc_sigpending();
-		spin_unlock_irq(&current->sighand->siglock);
-
-		timeout = MAX_SCHEDULE_TIMEOUT;
-		if (uts)
-			timeout = (timespec_to_jiffies(&ts)
-				   + (ts.tv_sec || ts.tv_nsec));
-
-		current->state = TASK_INTERRUPTIBLE;
-		timeout = schedule_timeout(timeout);
-
-		spin_lock_irq(&current->sighand->siglock);
-		sig = dequeue_signal(current, &these, &info);
-		current->blocked = current->real_blocked;
-		siginitset(&current->real_blocked, 0);
-		recalc_sigpending();
-	}
-	spin_unlock_irq(&current->sighand->siglock);
-
-	if (sig) {
-		ret = sig;
-		if (uinfo) {
-			if (copy_siginfo_to_user32(uinfo, &info))
-				ret = -EFAULT;
-		}
-	} else {
-		ret = -EAGAIN;
-		if (timeout)
-			ret = -EINTR;
-	}
-
-	return ret;
-}
-
-extern asmlinkage int
-sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo);
-
-asmlinkage int
-sys32_rt_sigqueueinfo(int pid, int sig, siginfo_t32 *uinfo)
-{
-	siginfo_t info;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-	
-	if (copy_from_user (&info, uinfo, 3*sizeof(int)) ||
-	    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);
-	set_fs (old_fs);
-	return ret;
-}
-
-#define RLIM_OLD_INFINITY32	0x7fffffff
-#define RLIM_INFINITY32		0xffffffff
-#define RESOURCE32_OLD(x)	((x > RLIM_OLD_INFINITY32) ? RLIM_OLD_INFINITY32 : x)
-#define RESOURCE32(x) 		((x > RLIM_INFINITY32) ? RLIM_INFINITY32 : x)
-
-struct rlimit32 {
-	u32	rlim_cur;
-	u32	rlim_max;
-};
-
-extern asmlinkage long sys_getrlimit(unsigned int resource, struct rlimit *rlim);
-
-asmlinkage int sys32_old_getrlimit(unsigned int resource, struct rlimit32 *rlim)
-{
-	struct rlimit r;
-	int ret;
-	mm_segment_t old_fs = get_fs ();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_getrlimit(resource, &r);
-	set_fs (old_fs);
-	if (!ret) {
-		ret = put_user (RESOURCE32_OLD(r.rlim_cur), &rlim->rlim_cur);
-		ret |= __put_user (RESOURCE32_OLD(r.rlim_max), &rlim->rlim_max);
-	}
-	return ret;
-}
-
-asmlinkage int sys32_getrlimit(unsigned int resource, struct rlimit32 *rlim)
-{
-	struct rlimit r;
-	int ret;
-	mm_segment_t old_fs = get_fs ();
-	
-	set_fs (KERNEL_DS);
-	ret = sys_getrlimit(resource, &r);
-	set_fs (old_fs);
-	if (!ret) {
-		ret = put_user (RESOURCE32(r.rlim_cur), &rlim->rlim_cur);
-		ret |= __put_user (RESOURCE32(r.rlim_max), &rlim->rlim_max);
-	}
-	return ret;
-}
-
-extern asmlinkage int sys_setrlimit(unsigned int resource, struct rlimit *rlim);
-
-asmlinkage int sys32_setrlimit(unsigned int resource, struct rlimit32 *rlim)
-{
-	struct rlimit r;
-	int ret;
-	mm_segment_t old_fs = get_fs ();
-
-	if (resource >= RLIM_NLIMITS) return -EINVAL;	
-	if (get_user (r.rlim_cur, &rlim->rlim_cur) ||
-	    __get_user (r.rlim_max, &rlim->rlim_max))
-		return -EFAULT;
-	if (r.rlim_cur == RLIM_INFINITY32)
-		r.rlim_cur = RLIM_INFINITY;
-	if (r.rlim_max == RLIM_INFINITY32)
-		r.rlim_max = RLIM_INFINITY;
-	set_fs (KERNEL_DS);
-	ret = sys_setrlimit(resource, &r);
-	set_fs (old_fs);
-	return ret;
-}
-
-extern asmlinkage int sys_getrusage(int who, struct rusage *ru);
-
-asmlinkage int sys32_getrusage(int who, struct rusage32 *ru)
-{
-	struct rusage r;
-	int ret;
-	mm_segment_t old_fs = get_fs();
-		
-	set_fs (KERNEL_DS);
-	ret = sys_getrusage(who, &r);
-	set_fs (old_fs);
-	if (put_rusage (ru, &r)) return -EFAULT;
-	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.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:
-	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.
- */
-asmlinkage int
-sys32_execve(struct pt_regs regs)
-{
-        int error;
-        char * filename;
-
-        filename = getname((char *)A(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);
-	if (error == 0)
-	{
-		current->ptrace &= ~PT_DTRACE;
-		current->thread.fp_regs.fpc=0;
-		__asm__ __volatile__
-		        ("sr  0,0\n\t"
-		         "sfpc 0,0\n\t"
-			 : : :"0");
-	}
-        putname(filename);
-out:
-        return error;
-}
-
-
-#ifdef CONFIG_MODULES
-
-extern asmlinkage int sys_init_module(const char *name_user, struct module *mod_user);
-
-/* Hey, when you're trying to init module, take time and prepare us a nice 64bit
- * module structure, even if from 32bit modutils... Why to pollute kernel... :))
- */
-asmlinkage int sys32_init_module(const char *name_user, struct module *mod_user)
-{
-	return sys_init_module(name_user, mod_user);
-}
-
-extern asmlinkage int sys_delete_module(const char *name_user);
-
-asmlinkage int sys32_delete_module(const char *name_user)
-{
-	return sys_delete_module(name_user);
-}
-
-struct module_info32 {
-	u32 addr;
-	u32 size;
-	u32 flags;
-	s32 usecount;
-};
-
-#else /* CONFIG_MODULES */
-
-asmlinkage int
-sys32_init_module(const char *name_user, struct module *mod_user)
-{
-	return -ENOSYS;
-}
-
-asmlinkage int
-sys32_delete_module(const char *name_user)
-{
-	return -ENOSYS;
-}
-
-#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;
-}
-
-/*
-asmlinkage long sys_ni_syscall(void); 
-*/
-
-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;
-}
-
-/* Translations due to time_t size differences.  Which affects all
-   sorts of things, like timeval and itimerval.  */
-
-extern struct timezone sys_tz;
-extern int do_sys_settimeofday(struct timeval *tv, struct timezone *tz);
-
-asmlinkage int sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
-{
-	if (tv) {
-		struct timeval ktv;
-		do_gettimeofday(&ktv);
-		if (put_tv32(tv, &ktv))
-			return -EFAULT;
-	}
-	if (tz) {
-		if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
-			return -EFAULT;
-	}
-	return 0;
-}
-
-asmlinkage int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
-{
-	struct timeval ktv;
-	struct timezone ktz;
-
- 	if (tv) {
-		if (get_tv32(&ktv, tv))
-			return -EFAULT;
-	}
-	if (tz) {
-		if (copy_from_user(&ktz, tz, sizeof(ktz)))
-			return -EFAULT;
-	}
-
-	return do_sys_settimeofday(tv ? &ktv : NULL, tz ? &ktz : NULL);
-}
-
-asmlinkage int sys_utimes(char *, struct timeval *);
-
-asmlinkage int sys32_utimes(char *filename, struct compat_timeval *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 = sys_utimes(kfilename, &ktvs[0]);
-		set_fs(old_fs);
-
-		putname(kfilename);
-	}
-	return ret;
-}
-
-/* These are here just in case some old sparc32 binary calls it. */
-asmlinkage int sys32_pause(void)
-{
-	current->state = TASK_INTERRUPTIBLE;
-	schedule();
-	return -ERESTARTNOHAND;
-}
-
-extern asmlinkage int sys_prctl(int option, unsigned long arg2, unsigned long arg3,
-				unsigned long arg4, unsigned long arg5);
-
-asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
-{
-	return sys_prctl(option,
-			 (unsigned long) arg2,
-			 (unsigned long) arg3,
-			 (unsigned long) arg4,
-			 (unsigned long) arg5);
-}
-
-
-extern asmlinkage ssize_t sys_pread64(unsigned int fd, char * buf,
-				    size_t count, loff_t pos);
-
-extern asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char * buf,
-				     size_t count, loff_t pos);
-
-asmlinkage compat_ssize_t sys32_pread64(unsigned int fd, char *ubuf,
-				 compat_size_t count, u32 poshi, u32 poslo)
-{
-	if ((compat_ssize_t) count < 0)
-		return -EINVAL;
-	return sys_pread64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
-}
-
-asmlinkage compat_ssize_t sys32_pwrite64(unsigned int fd, char *ubuf,
-				  compat_size_t count, u32 poshi, u32 poslo)
-{
-	if ((compat_ssize_t) count < 0)
-		return -EINVAL;
-	return sys_pwrite64(fd, ubuf, count, ((loff_t)AA(poshi) << 32) | AA(poslo));
-}
-
-extern asmlinkage ssize_t sys_readahead(int fd, loff_t offset, size_t count);
-
-asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 count)
-{
-	return sys_readahead(fd, ((loff_t)AA(offhi) << 32) | AA(offlo), count);
-}
-
-extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
-
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
-{
-	mm_segment_t old_fs = get_fs();
-	int ret;
-	off_t of;
-	
-	if (offset && get_user(of, offset))
-		return -EFAULT;
-		
-	set_fs(KERNEL_DS);
-	ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
-	set_fs(old_fs);
-	
-	if (!ret && offset && put_user(of, offset))
-		return -EFAULT;
-		
-	return ret;
-}
-
-extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, 
-					 loff_t *offset, size_t count);
-
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, 
-				compat_loff_t *offset, s32 count)
-{
-	mm_segment_t old_fs = get_fs();
-	int ret;
-	loff_t lof;
-	
-	if (offset && get_user(lof, offset))
-		return -EFAULT;
-		
-	set_fs(KERNEL_DS);
-	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
-	set_fs(old_fs);
-	
-	if (offset && put_user(lof, offset))
-		return -EFAULT;
-		
-	return ret;
-}
-
-/* Handle adjtimex compatibility. */
-
-struct timex32 {
-	u32 modes;
-	s32 offset, freq, maxerror, esterror;
-	s32 status, constant, precision, tolerance;
-	struct compat_timeval time;
-	s32 tick;
-	s32 ppsfreq, jitter, shift, stabil;
-	s32 jitcnt, calcnt, errcnt, stbcnt;
-	s32  :32; s32  :32; s32  :32; s32  :32;
-	s32  :32; s32  :32; s32  :32; s32  :32;
-	s32  :32; s32  :32; s32  :32; s32  :32;
-};
-
-extern int do_adjtimex(struct timex *);
-
-asmlinkage int sys32_adjtimex(struct timex32 *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))
-		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))
-		ret = -EFAULT;
-
-	return ret;
-}
-
-extern asmlinkage long sys_setpriority(int which, int who, int niceval);
-
-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;
-	u32 oldval;
-	u32 oldlenp;
-	u32 newval;
-	u32 newlen;
-	u32 __unused[4];
-};
-
-extern asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
-{
-	struct __sysctl_args32 tmp;
-	int error;
-	size_t oldlen, *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
-
-	if (copy_from_user(&tmp, args, sizeof(tmp)))
-		return -EFAULT;
-
-	if (tmp.oldval && tmp.oldlenp) {
-		/* Duh, this is ugly and might not work if sysctl_args
-		   is in read-only memory, but do_sysctl does indirectly
-		   a lot of uaccess in both directions and we'd have to
-		   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))
-			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);
-	unlock_kernel();
-	if (oldlenp) {
-		if (!error) {
-			if (get_user(oldlen, (size_t *)addr) ||
-			    put_user(oldlen, (u32 *)A(tmp.oldlenp)))
-				error = -EFAULT;
-		}
-		copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused));
-	}
-	return error;
-}
-
-struct stat64_emu31 {
-	unsigned char   __pad0[6];
-	unsigned short  st_dev;
-	unsigned int    __pad1;
-#define STAT64_HAS_BROKEN_ST_INO        1
-	u32             __st_ino;
-	unsigned int    st_mode;
-	unsigned int    st_nlink;
-	u32             st_uid;
-	u32             st_gid;
-	unsigned char   __pad2[6];
-	unsigned short  st_rdev;
-	unsigned int    __pad3;
-	long            st_size;
-	u32             st_blksize;
-	unsigned char   __pad4[4];
-	u32             __pad5;     /* future possible st_blocks high bits */
-	u32             st_blocks;  /* Number 512-byte blocks allocated. */
-	u32             st_atime;
-	u32             __pad6;
-	u32             st_mtime;
-	u32             __pad7;
-	u32             st_ctime;
-	u32             __pad8;     /* will be high 32 bits of ctime someday */
-	unsigned long   st_ino;
-};	
-
-static inline int
-putstat64 (struct stat64_emu31 *ubuf, struct stat *kbuf)
-{
-    struct stat64_emu31 tmp;
-   
-    memset(&tmp, 0, sizeof(tmp));
-
-    tmp.st_dev = (unsigned short)kbuf->st_dev;
-    tmp.st_ino = kbuf->st_ino;
-    tmp.__st_ino = (u32)kbuf->st_ino;
-    tmp.st_mode = kbuf->st_mode;
-    tmp.st_nlink = (unsigned int)kbuf->st_nlink;
-    tmp.st_uid = kbuf->st_uid;
-    tmp.st_gid = kbuf->st_gid;
-    tmp.st_rdev = (unsigned short)kbuf->st_rdev;
-    tmp.st_size = kbuf->st_size;
-    tmp.st_blksize = (u32)kbuf->st_blksize;
-    tmp.st_blocks = (u32)kbuf->st_blocks;
-    tmp.st_atime = (u32)kbuf->st_atime;
-    tmp.st_mtime = (u32)kbuf->st_mtime;
-    tmp.st_ctime = (u32)kbuf->st_ctime;
-
-    return copy_to_user(ubuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 
-}
-
-extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf);
-
-asmlinkage long sys32_stat64(char * filename, struct stat64_emu31 * statbuf, long flags)
-{
-    int ret;
-    struct stat s;
-    char * tmp;
-    int err;
-    mm_segment_t old_fs = get_fs();
-    
-    tmp = getname(filename);
-    err = PTR_ERR(tmp);
-    if (IS_ERR(tmp))   
-	    return err;
-
-    set_fs (KERNEL_DS);
-    ret = sys_newstat(tmp, &s);
-    set_fs (old_fs);
-    putname(tmp);
-    if (putstat64 (statbuf, &s)) 
-	    return -EFAULT;
-    return ret;
-}
-
-extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf);
-
-asmlinkage long sys32_lstat64(char * filename, struct stat64_emu31 * statbuf, long flags)
-{
-    int ret;
-    struct stat s;
-    char * tmp;
-    int err;
-    mm_segment_t old_fs = get_fs();
-    
-    tmp = getname(filename);
-    err = PTR_ERR(tmp);
-    if (IS_ERR(tmp))   
-	    return err;
-
-    set_fs (KERNEL_DS);
-    ret = sys_newlstat(tmp, &s);
-    set_fs (old_fs);
-    putname(tmp);
-    if (putstat64 (statbuf, &s)) 
-	    return -EFAULT;
-    return ret;
-}
-
-extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf);
-
-asmlinkage long sys32_fstat64(unsigned long fd, struct stat64_emu31 * statbuf, long flags)
-{
-    int ret;
-    struct stat s;
-    mm_segment_t old_fs = get_fs();
-    
-    set_fs (KERNEL_DS);
-    ret = sys_newfstat(fd, &s);
-    set_fs (old_fs);
-    if (putstat64 (statbuf, &s))
-	    return -EFAULT;
-    return ret;
-}
-
-/*
- * Linux/i386 didn't use to be able to handle more than
- * 4 system call parameters, so these system calls used a memory
- * block for parameter passing..
- */
-
-struct mmap_arg_struct_emu31 {
-	u32	addr;
-	u32	len;
-	u32	prot;
-	u32	flags;
-	u32	fd;
-	u32	offset;
-};
-
-/* common code for old and new mmaps */
-static inline long do_mmap2(
-	unsigned long addr, unsigned long len,
-	unsigned long prot, unsigned long flags,
-	unsigned long fd, unsigned long pgoff)
-{
-	struct file * file = NULL;
-	unsigned long error = -EBADF;
-
-	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-	if (!(flags & MAP_ANONYMOUS)) {
-		file = fget(fd);
-		if (!file)
-			goto out;
-	}
-
-	down_write(&current->mm->mmap_sem);
-	error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
-	if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
-		/* Result is out of bounds.  */
-		do_munmap(current->mm, addr, len);
-		error = -ENOMEM;
-	}
-	up_write(&current->mm->mmap_sem);
-
-	if (file)
-		fput(file);
-out:    
-	return error;
-}
-
-
-asmlinkage unsigned long
-old32_mmap(struct mmap_arg_struct_emu31 *arg)
-{
-	struct mmap_arg_struct_emu31 a;
-	int error = -EFAULT;
-
-	if (copy_from_user(&a, arg, sizeof(a)))
-		goto out;
-
-	error = -EINVAL;
-	if (a.offset & ~PAGE_MASK)
-		goto out;
-
-	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 
-out:
-	return error;
-}
-
-asmlinkage long 
-sys32_mmap2(struct mmap_arg_struct_emu31 *arg)
-{
-	struct mmap_arg_struct_emu31 a;
-	int error = -EFAULT;
-
-	if (copy_from_user(&a, arg, sizeof(a)))
-		goto out;
-	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
-out:
-	return error;
-}
-
-extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	if (get_user(kernel_mask, user_mask_ptr))
-		return -EFAULT;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_setaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	return ret;
-}
-
-extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_getaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	if (ret == 0) {
-		if (put_user(kernel_mask, user_mask_ptr))
-			ret = -EFAULT;
-	}
-
-	return ret;
-}
-
-asmlinkage ssize_t sys_read(unsigned int fd, char * buf, size_t count);
-
-asmlinkage compat_ssize_t sys32_read(unsigned int fd, char * buf, size_t count)
-{
-	if ((compat_ssize_t) count < 0)
-		return -EINVAL; 
-
-	return sys_read(fd, buf, count);
-}
-
-asmlinkage ssize_t sys_write(unsigned int fd, const char * buf, size_t count);
-
-asmlinkage compat_ssize_t sys32_write(unsigned int fd, char * buf, size_t count)
-{
-	if ((compat_ssize_t) count < 0)
-		return -EINVAL; 
-
-	return sys_write(fd, buf, count);
-}
-
-asmlinkage int sys32_clone(struct pt_regs regs)
-{
-        unsigned long clone_flags;
-        unsigned long newsp;
-	struct task_struct *p;
-	int *parent_tidptr, *child_tidptr;
-
-        clone_flags = regs.gprs[3] & 0xffffffffUL;
-        newsp = regs.orig_gpr2 & 0x7fffffffUL;
-	parent_tidptr = (int *) (regs.gprs[4] & 0x7fffffffUL);
-	child_tidptr = (int *) (regs.gprs[5] & 0x7fffffffUL);
-        if (!newsp)
-                newsp = regs.gprs[15];
-        p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
-		    parent_tidptr, child_tidptr);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/linux32.h linux-2.5.67-bk6/arch/s390x/kernel/linux32.h
--- linux-2.5.67-bk5/arch/s390x/kernel/linux32.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/linux32.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,193 +0,0 @@
-#ifndef _ASM_S390X_S390_H
-#define _ASM_S390X_S390_H
-
-#include <linux/config.h>
-#include <linux/compat.h>
-#include <linux/socket.h>
-#include <linux/nfs_fs.h>
-#include <linux/sunrpc/svc.h>
-#include <linux/nfsd/nfsd.h>
-#include <linux/nfsd/export.h>
-
-/* Macro that masks the high order bit of an 32 bit pointer and converts it*/
-/*       to a 64 bit pointer */
-#define A(__x) ((unsigned long)((__x) & 0x7FFFFFFFUL))
-#define AA(__x)				\
-	((unsigned long)(__x))
-
-/* Now 32bit compatibility types */
-struct ipc_kludge_32 {
-        __u32   msgp;                           /* pointer              */
-        __s32   msgtyp;
-};
-
-struct old_sigaction32 {
-       __u32			sa_handler;	/* Really a pointer, but need to deal with 32 bits */
-       compat_old_sigset_t	sa_mask;	/* A 32 bit mask */
-       __u32			sa_flags;
-       __u32			sa_restorer;	/* Another 32 bit pointer */
-};
- 
-typedef union sigval32 {
-        int     sival_int;
-        __u32   sival_ptr;
-} sigval_t32;
-                 
-typedef struct siginfo32 {
-	int	si_signo;
-	int	si_errno;
-	int	si_code;
-
-	union {
-		int _pad[((128/sizeof(int)) - 3)];
-
-		/* kill() */
-		struct {
-			pid_t	_pid;	/* sender's pid */
-			uid_t	_uid;	/* sender's uid */
-		} _kill;
-
-		/* POSIX.1b timers */
-		struct {
-			unsigned int	_timer1;
-			unsigned int	_timer2;
-                
-		} _timer;
-
-		/* POSIX.1b signals */
-		struct {
-			pid_t			_pid;	/* sender's pid */
-			uid_t			_uid;	/* sender's uid */
-			sigval_t32		_sigval;
-		} _rt;
-
-		/* SIGCHLD */
-		struct {
-			pid_t			_pid;	/* which child */
-			uid_t			_uid;	/* sender's uid */
-			int			_status;/* exit code */
-			compat_clock_t		_utime;
-			compat_clock_t		_stime;
-		} _sigchld;
-
-		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-		struct {
-			__u32	_addr;	/* faulting insn/memory ref. - pointer */
-		} _sigfault;
-                          
-		/* SIGPOLL */
-		struct {
-			int	_band;	/* POLL_IN, POLL_OUT, POLL_MSG */
-			int	_fd;
-		} _sigpoll;
-	} _sifields;
-} siginfo_t32;  
-
-/*
- * How these fields are to be accessed.
- */
-#define si_pid		_sifields._kill._pid
-#define si_uid		_sifields._kill._uid
-#define si_status	_sifields._sigchld._status
-#define si_utime	_sifields._sigchld._utime
-#define si_stime	_sifields._sigchld._stime
-#define si_value	_sifields._rt._sigval
-#define si_int		_sifields._rt._sigval.sival_int
-#define si_ptr		_sifields._rt._sigval.sival_ptr
-#define si_addr		_sifields._sigfault._addr
-#define si_band		_sifields._sigpoll._band
-#define si_fd		_sifields._sigpoll._fd    
-
-/* asm/sigcontext.h */
-typedef union
-{
-	__u64   d;
-	__u32   f; 
-} freg_t32;
-
-typedef struct
-{
-	unsigned int	fpc;
-	freg_t32	fprs[__NUM_FPRS];              
-} _s390_fp_regs32;
-
-typedef struct 
-{
-        __u32   mask;
-        __u32	addr;
-} _psw_t32 __attribute__ ((aligned(8)));
-
-#define PSW32_MASK_PER		0x40000000UL
-#define PSW32_MASK_DAT		0x04000000UL
-#define PSW32_MASK_IO		0x02000000UL
-#define PSW32_MASK_EXT		0x01000000UL
-#define PSW32_MASK_KEY		0x00F00000UL
-#define PSW32_MASK_MCHECK	0x00040000UL
-#define PSW32_MASK_WAIT		0x00020000UL
-#define PSW32_MASK_PSTATE	0x00010000UL
-#define PSW32_MASK_ASC		0x0000C000UL
-#define PSW32_MASK_CC		0x00003000UL
-#define PSW32_MASK_PM		0x00000f00UL
-
-#define PSW32_ADDR_AMODE31	0x80000000UL
-#define PSW32_ADDR_INSN		0x7FFFFFFFUL
-
-#define PSW32_BASE_BITS		0x00080000UL
-
-#define PSW32_ASC_PRIMARY	0x00000000UL
-#define PSW32_ASC_ACCREG	0x00004000UL
-#define PSW32_ASC_SECONDARY	0x00008000UL
-#define PSW32_ASC_HOME		0x0000C000UL
-
-#define PSW32_USER_BITS	(PSW32_BASE_BITS | PSW32_MASK_DAT | PSW32_ASC_HOME | \
-			 PSW32_MASK_IO | PSW32_MASK_EXT | PSW32_MASK_MCHECK | \
-			 PSW32_MASK_PSTATE)
-
-typedef struct
-{
-	_psw_t32	psw;
-	__u32		gprs[__NUM_GPRS];
-	__u32		acrs[__NUM_ACRS];
-} _s390_regs_common32;
-
-typedef struct
-{
-	_s390_regs_common32 regs;
-	_s390_fp_regs32     fpregs;
-} _sigregs32;
-
-#define _SIGCONTEXT_NSIG32	64
-#define _SIGCONTEXT_NSIG_BPW32	32
-#define __SIGNAL_FRAMESIZE32	96
-#define _SIGMASK_COPY_SIZE32	(sizeof(u32)*2)
-
-struct sigcontext32
-{
-	__u32	oldmask[_COMPAT_NSIG_WORDS];
-	__u32	sregs;				/* pointer */
-};
-
-/* asm/signal.h */
-struct sigaction32 {
-	__u32		sa_handler;		/* pointer */
-	__u32		sa_flags;
-        __u32		sa_restorer;		/* pointer */
-	compat_sigset_t	sa_mask;        /* mask last for extensibility */
-};
-
-typedef struct {
-	__u32			ss_sp;		/* pointer */
-	int			ss_flags;
-	compat_size_t		ss_size;
-} stack_t32;
-
-/* asm/ucontext.h */
-struct ucontext32 {
-	__u32			uc_flags;
-	__u32			uc_link;	/* pointer */	
-	stack_t32		uc_stack;
-	_sigregs32		uc_mcontext;
-	compat_sigset_t		uc_sigmask;	/* mask last for extensibility */
-};
-
-#endif /* _ASM_S390X_S390_H */
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/module.c linux-2.5.67-bk6/arch/s390x/kernel/module.c
--- linux-2.5.67-bk5/arch/s390x/kernel/module.c	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/module.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,376 +0,0 @@
-/*
- *  arch/s390x/kernel/module.c - Kernel module help for s390x.
- *
- *  S390 version
- *    Copyright (C) 2002, 2003 IBM Deutschland Entwicklung GmbH,
- *			       IBM Corporation
- *    Author(s): Arnd Bergmann (arndb@de.ibm.com)
- *		 Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  based on i386 version
- *    Copyright (C) 2001 Rusty Russell.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/module.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
-
-#define GOT_ENTRY_SIZE 8
-#define PLT_ENTRY_SIZE 20
-
-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. */
-}
-
-static inline void
-check_rela(Elf64_Rela *rela, struct module *me)
-{
-	struct mod_arch_syminfo *info;
-
-	info = me->arch.syminfo + ELF64_R_SYM (rela->r_info);
-	switch (ELF64_R_TYPE (rela->r_info)) {
-	case R_390_GOT12:	/* 12 bit GOT offset.  */
-	case R_390_GOT16:	/* 16 bit GOT offset.  */
-	case R_390_GOT32:	/* 32 bit GOT offset.  */
-	case R_390_GOT64:	/* 64 bit GOT offset.  */
-	case R_390_GOTENT:	/* 32 bit PC rel. to GOT entry shifted by 1. */
-	case R_390_GOTPLT12:	/* 12 bit offset to jump slot.	*/
-	case R_390_GOTPLT16:	/* 16 bit offset to jump slot. */
-	case R_390_GOTPLT32:	/* 32 bit offset to jump slot. */
-	case R_390_GOTPLT64:	/* 64 bit offset to jump slot.	*/
-	case R_390_GOTPLTENT:	/* 32 bit rel. offset to jump slot >> 1. */
-		if (info->got_offset == -1UL) {
-			info->got_offset = me->arch.got_size;
-			me->arch.got_size += GOT_ENTRY_SIZE;
-		}
-		break;
-	case R_390_PLT16DBL:	/* 16 bit PC rel. PLT shifted by 1.  */
-	case R_390_PLT32DBL:	/* 32 bit PC rel. PLT shifted by 1.  */
-	case R_390_PLT32:	/* 32 bit PC relative PLT address.  */
-	case R_390_PLT64:	/* 64 bit PC relative PLT address.  */
-	case R_390_PLTOFF16:	/* 16 bit offset from GOT to PLT. */
-	case R_390_PLTOFF32:	/* 32 bit offset from GOT to PLT. */
-	case R_390_PLTOFF64:	/* 16 bit offset from GOT to PLT. */
-		if (info->plt_offset == -1UL) {
-			info->plt_offset = me->arch.plt_size;
-			me->arch.plt_size += PLT_ENTRY_SIZE;
-		}
-		break;
-	case R_390_COPY:
-	case R_390_GLOB_DAT:
-	case R_390_JMP_SLOT:
-	case R_390_RELATIVE:
-		/* Only needed if we want to support loading of 
-		   modules linked with -shared. */
-		break;
-	}
-}
-
-/*
- * Account for GOT and PLT relocations. We can't add sections for
- * got and plt but we can increase the core module size.
- */
-int
-module_frob_arch_sections(Elf64_Ehdr *hdr, Elf64_Shdr *sechdrs,
-			  char *secstrings, struct module *me)
-{
-	Elf64_Shdr *symtab;
-	Elf64_Sym *symbols;
-	Elf64_Rela *rela;
-	char *strings;
-	int nrela, i, j;
-
-	/* Find symbol table and string table. */
-	symtab = 0;
-	for (i = 0; i < hdr->e_shnum; i++)
-		switch (sechdrs[i].sh_type) {
-		case SHT_SYMTAB:
-			symtab = sechdrs + i;
-			break;
-		}
-	if (!symtab) {
-		printk(KERN_ERR "module %s: no symbol table\n", me->name);
-		return -ENOEXEC;
-	}
-
-	/* Allocate one syminfo structure per symbol. */
-	me->arch.nsyms = symtab->sh_size / sizeof(Elf64_Sym);
-	me->arch.syminfo = kmalloc(me->arch.nsyms *
-				   sizeof(struct mod_arch_syminfo),
-				   GFP_KERNEL);
-	if (!me->arch.syminfo)
-		return -ENOMEM;
-	symbols = (void *) hdr + symtab->sh_offset;
-	strings = (void *) hdr + sechdrs[symtab->sh_link].sh_offset;
-	for (i = 0; i < me->arch.nsyms; i++) {
-		if (symbols[i].st_shndx == SHN_UNDEF &&
-		    strcmp(strings + symbols[i].st_name,
-			   "_GLOBAL_OFFSET_TABLE_") == 0)
-			/* "Define" it as absolute. */
-			symbols[i].st_shndx = SHN_ABS;
-		me->arch.syminfo[i].got_offset = -1UL;
-		me->arch.syminfo[i].plt_offset = -1UL;
-		me->arch.syminfo[i].got_initialized = 0;
-		me->arch.syminfo[i].plt_initialized = 0;
-	}
-
-	/* Search for got/plt relocations. */
-	me->arch.got_size = me->arch.plt_size = 0;
-	for (i = 0; i < hdr->e_shnum; i++) {
-		if (sechdrs[i].sh_type != SHT_RELA)
-			continue;
-		nrela = sechdrs[i].sh_size / sizeof(Elf64_Rela);
-		rela = (void *) hdr + sechdrs[i].sh_offset;
-		for (j = 0; j < nrela; j++)
-			check_rela(rela + j, me);
-	}
-
-	/* Increase core size by size of got & plt and set start
-	   offsets for got and plt. */
-	me->core_size = ALIGN(me->core_size, 4);
-	me->arch.got_offset = me->core_size;
-	me->core_size += me->arch.got_size;
-	me->arch.plt_offset = me->core_size;
-	me->core_size += me->arch.plt_size;
-	return 0;
-}
-
-int
-apply_relocate(Elf_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;
-}
-
-static inline int
-apply_rela(Elf64_Rela *rela, Elf64_Addr base, Elf64_Sym *symtab, 
-	   struct module *me)
-{
-	struct mod_arch_syminfo *info;
-	Elf64_Addr loc, val;
-	int r_type, r_sym;
-
-	/* This is where to make the change */
-	loc = base + rela->r_offset;
-	/* This is the symbol it is referring to.  Note that all
-	   undefined symbols have been resolved.  */
-	r_sym = ELF64_R_SYM(rela->r_info);
-	r_type = ELF64_R_TYPE(rela->r_info);
-	info = me->arch.syminfo + r_sym;
-	val = symtab[r_sym].st_value;
-
-	switch (r_type) {
-	case R_390_8:		/* Direct 8 bit.   */
-	case R_390_12:		/* Direct 12 bit.  */
-	case R_390_16:		/* Direct 16 bit.  */
-	case R_390_32:		/* Direct 32 bit.  */
-	case R_390_64:		/* Direct 64 bit.  */
-		val += rela->r_addend;
-		if (r_type == R_390_8)
-			*(unsigned char *) loc = val;
-		else if (r_type == R_390_12)
-			*(unsigned short *) loc = (val & 0xfff) |
-				(*(unsigned short *) loc & 0xf000);
-		else if (r_type == R_390_16)
-			*(unsigned short *) loc = val;
-		else if (r_type == R_390_32)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_64)
-			*(unsigned long *) loc = val;
-		break;
-	case R_390_PC16:	/* PC relative 16 bit.  */
-	case R_390_PC16DBL:	/* PC relative 16 bit shifted by 1.  */
-	case R_390_PC32DBL:	/* PC relative 32 bit shifted by 1.  */
-	case R_390_PC32:	/* PC relative 32 bit.  */
-	case R_390_PC64:	/* PC relative 64 bit.	*/
-		val += rela->r_addend - loc;
-		if (r_type == R_390_PC16)
-			*(unsigned short *) loc = val;
-		else if (r_type == R_390_PC16DBL)
-			*(unsigned short *) loc = val >> 1;
-		else if (r_type == R_390_PC32DBL)
-			*(unsigned int *) loc = val >> 1;
-		else if (r_type == R_390_PC32)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_PC64)
-			*(unsigned long *) loc = val;
-		break;
-	case R_390_GOT12:	/* 12 bit GOT offset.  */
-	case R_390_GOT16:	/* 16 bit GOT offset.  */
-	case R_390_GOT32:	/* 32 bit GOT offset.  */
-	case R_390_GOT64:	/* 64 bit GOT offset.  */
-	case R_390_GOTENT:	/* 32 bit PC rel. to GOT entry shifted by 1. */
-	case R_390_GOTPLT12:	/* 12 bit offset to jump slot.	*/
-	case R_390_GOTPLT16:	/* 16 bit offset to jump slot. */
-	case R_390_GOTPLT32:	/* 32 bit offset to jump slot. */
-	case R_390_GOTPLT64:	/* 64 bit offset to jump slot.	*/
-	case R_390_GOTPLTENT:	/* 32 bit rel. offset to jump slot >> 1. */
-		if (info->got_initialized == 0) {
-			Elf64_Addr *gotent;
-			gotent = me->module_core + me->arch.got_offset +
-				info->got_offset;
-			*gotent = val;
-			info->got_initialized = 1;
-		}
-		val = info->got_offset + rela->r_addend;
-		if (r_type == R_390_GOT12 ||
-		    r_type == R_390_GOTPLT12)
-			*(unsigned short *) loc = (val & 0xfff) |
-				(*(unsigned short *) loc & 0xf000);
-		else if (r_type == R_390_GOT16 ||
-			 r_type == R_390_GOTPLT16)
-			*(unsigned short *) loc = val;
-		else if (r_type == R_390_GOT32 ||
-			 r_type == R_390_GOTPLT32)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_GOTENT ||
-			 r_type == R_390_GOTPLTENT)
-			*(unsigned int *) loc = val >> 1;
-		else if (r_type == R_390_GOT64 ||
-			 r_type == R_390_GOTPLT64)
-			*(unsigned long *) loc = val;
-		break;
-	case R_390_PLT16DBL:	/* 16 bit PC rel. PLT shifted by 1.  */
-	case R_390_PLT32DBL:	/* 32 bit PC rel. PLT shifted by 1.  */
-	case R_390_PLT32:	/* 32 bit PC relative PLT address.  */
-	case R_390_PLT64:	/* 64 bit PC relative PLT address.  */
-	case R_390_PLTOFF16:	/* 16 bit offset from GOT to PLT. */
-	case R_390_PLTOFF32:	/* 32 bit offset from GOT to PLT. */
-	case R_390_PLTOFF64:	/* 16 bit offset from GOT to PLT. */
-		if (info->plt_initialized == 0) {
-			unsigned int *ip;
-			ip = me->module_core + me->arch.plt_offset +
-				info->plt_offset;
-			ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */
-			ip[1] = 0x100a0004;
-			ip[2] = 0x07f10000;
-			ip[3] = (unsigned int) (val >> 32);
-			ip[4] = (unsigned int) val;
-			info->plt_initialized = 1;
-		}
-		if (r_type == R_390_PLTOFF16 ||
-		    r_type == R_390_PLTOFF32 ||
-		    r_type == R_390_PLTOFF64)
-			val = me->arch.plt_offset - me->arch.got_offset +
-				info->plt_offset + rela->r_addend;
-		else
-			val =  (Elf64_Addr) me->module_core +
-				me->arch.plt_offset + info->plt_offset + 
-				rela->r_addend - loc;
-		if (r_type == R_390_PLT16DBL)
-			*(unsigned short *) loc = val >> 1;
-		else if (r_type == R_390_PLTOFF16)
-			*(unsigned short *) loc = val;
-		else if (r_type == R_390_PLT32DBL)
-			*(unsigned int *) loc = val >> 1;
-		else if (r_type == R_390_PLT32 ||
-			 r_type == R_390_PLTOFF32)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_PLT64 ||
-			 r_type == R_390_PLTOFF64)
-			*(unsigned long *) loc = val;
-		break;
-	case R_390_GOTOFF16:	/* 16 bit offset to GOT.  */
-	case R_390_GOTOFF32:	/* 32 bit offset to GOT.  */
-	case R_390_GOTOFF64:	/* 64 bit offset to GOT. */
-		val = val + rela->r_addend -
-			((Elf64_Addr) me->module_core + me->arch.got_offset);
-		if (r_type == R_390_GOTOFF16)
-			*(unsigned short *) loc = val;
-		else if (r_type == R_390_GOTOFF32)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_GOTOFF64)
-			*(unsigned long *) loc = val;
-		break;
-	case R_390_GOTPC:	/* 32 bit PC relative offset to GOT. */
-	case R_390_GOTPCDBL:	/* 32 bit PC rel. off. to GOT shifted by 1. */
-		val = (Elf64_Addr) me->module_core + me->arch.got_offset +
-			rela->r_addend - loc;
-		if (r_type == R_390_GOTPC)
-			*(unsigned int *) loc = val;
-		else if (r_type == R_390_GOTPCDBL)
-			*(unsigned int *) loc = val >> 1;
-		break;
-	case R_390_COPY:
-	case R_390_GLOB_DAT:	/* Create GOT entry.  */
-	case R_390_JMP_SLOT:	/* Create PLT entry.  */
-	case R_390_RELATIVE:	/* Adjust by program base.  */
-		/* Only needed if we want to support loading of 
-		   modules linked with -shared. */
-		break;
-	default:
-		printk(KERN_ERR "module %s: Unknown relocation: %u\n",
-		       me->name, r_type);
-		return -ENOEXEC;
-	}
-	return 0;
-}
-
-int
-apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
-		   unsigned int symindex, unsigned int relsec,
-		   struct module *me)
-{
-	Elf64_Addr base;
-	Elf64_Sym *symtab;
-	Elf64_Rela *rela;
-	unsigned long i, n;
-	int rc;
-
-	DEBUGP("Applying relocate section %u to %u\n",
-	       relsec, sechdrs[relsec].sh_info);
-	base = sechdrs[sechdrs[relsec].sh_info].sh_addr;
-	symtab = (Elf64_Sym *) sechdrs[symindex].sh_addr;
-	rela = (Elf64_Rela *) sechdrs[relsec].sh_addr;
-	n = sechdrs[relsec].sh_size / sizeof(Elf64_Rela);
-	for (i = 0; i < n; i++, rela++) {
-		rc = apply_rela(rela, base, symtab, me);
-		if (rc)
-			return rc;
-	}
-	return 0;
-}
-
-int module_finalize(const Elf_Ehdr *hdr,
-		    const Elf_Shdr *sechdrs,
-		    struct module *me)
-{
-	if (me->arch.syminfo)
-		kfree(me->arch.syminfo);
-	return 0;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/process.c linux-2.5.67-bk6/arch/s390x/kernel/process.c
--- linux-2.5.67-bk5/arch/s390x/kernel/process.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/process.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,352 +0,0 @@
-/*
- *  arch/s390/kernel/process.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Hartmut Penner (hp@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *
- *  Derived from "arch/i386/kernel/process.c"
- *    Copyright (C) 1995, Linus Torvalds
- */
-
-/*
- * This file handles the architecture-dependent parts of process handling..
- */
-
-#include <linux/config.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/reboot.h>
-#include <linux/init.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/irq.h>
-
-asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-
-/*
- * Return saved PC of a blocked thread. used in kernel/sched
- * resume in entry.S does not create a new stack frame, it
- * just stores the registers %r6-%r15 to the frame given by
- * schedule. We want to return the address of the caller of
- * schedule, so we have to walk the backchain one time to
- * find the frame schedule() store its return address.
- */
-unsigned long thread_saved_pc(struct task_struct *tsk)
-{
-	unsigned long bc;
-
-	bc = *((unsigned long *) tsk->thread.ksp);
-	return *((unsigned long *) (bc+112));
-}
-
-/*
- * The idle loop on a S390...
- */
-
-void default_idle(void)
-{
-	psw_t wait_psw;
-	unsigned long reg;
-
-        if (need_resched()) {
-                schedule();
-                return;
-        }
-
-	/* 
-	 * Wait for external, I/O or machine check interrupt and
-	 * switch off machine check bit after the wait has ended.
-	 */
-	wait_psw.mask = PSW_KERNEL_BITS | PSW_MASK_MCHECK | PSW_MASK_WAIT |
-		PSW_MASK_IO | PSW_MASK_EXT;
-	asm volatile (
-		"    larl  %0,0f\n"
-		"    stg   %0,8(%1)\n"
-		"    lpswe 0(%1)\n"
-		"0:  larl  %0,1f\n"
-		"    stg   %0,8(%1)\n"
-		"    ni    1(%1),0xf9\n"
-		"    lpswe 0(%1)\n"
-		"1:"
-		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
-}
-
-int cpu_idle(void)
-{
-	for (;;)
-		default_idle();
-	return 0;
-}
-
-extern void show_registers(struct pt_regs *regs);
-extern void show_trace(unsigned long *sp);
-
-void show_regs(struct pt_regs *regs)
-{
-	struct task_struct *tsk = current;
-
-        printk("CPU:    %d    %s\n", tsk->thread_info->cpu, print_tainted());
-        printk("Process %s (pid: %d, task: %016lx, ksp: %016lx)\n",
-	       current->comm, current->pid, (unsigned long) tsk,
-	       tsk->thread.ksp);
-
-	show_registers(regs);
-	/* Show stack backtrace if pt_regs is from kernel mode */
-	if (!(regs->psw.mask & PSW_MASK_PSTATE))
-		show_trace((unsigned long *) regs->gprs[15]);
-}
-
-extern void kernel_thread_starter(void);
-__asm__(".align 4\n"
-	"kernel_thread_starter:\n"
-	"    lg    15,0(8)\n"
-	"    sgr   15,7\n"
-	"    stosm 48(15),3\n"
-	"    lgr   2,10\n"
-	"    basr  14,9\n"
-	"    sgr   2,2\n"
-	"    br    11\n");
-
-int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
-	struct task_struct *p;
-	struct pt_regs regs;
-
-	memset(&regs, 0, sizeof(regs));
-	regs.psw.mask = PSW_KERNEL_BITS;
-	regs.psw.addr = (__u64) kernel_thread_starter;
-	regs.gprs[7] = STACK_FRAME_OVERHEAD;
-	regs.gprs[8] = __LC_KERNEL_STACK;
-	regs.gprs[9] = (unsigned long) fn;
-	regs.gprs[10] = (unsigned long) arg;
-	regs.gprs[11] = (unsigned long) do_exit;
-	regs.orig_gpr2 = -1;
-
-	/* Ok, create the new process.. */
-	p = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
-}
-
-/*
- * Free current thread data structures etc..
- */
-void exit_thread(void)
-{
-}
-
-void flush_thread(void)
-{
-
-        current->used_math = 0;
-	clear_tsk_thread_flag(current, TIF_USEDFPU);
-}
-
-void release_thread(struct task_struct *dead_task)
-{
-}
-
-int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
-	unsigned long unused,
-        struct task_struct * p, struct pt_regs * regs)
-{
-        struct stack_frame
-          {
-            unsigned long back_chain;
-            unsigned long eos;
-            unsigned long glue1;
-            unsigned long glue2;
-            unsigned long scratch[2];
-            unsigned long gprs[10];    /* gprs 6 -15                       */
-            unsigned long fprs[2];     /* fpr 4 and 6                      */
-            unsigned long empty[2];
-            struct pt_regs childregs;
-          } *frame;
-
-        frame = ((struct stack_frame *)
-		 (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
-        p->thread.ksp = (unsigned long) frame;
-	p->set_child_tid = p->clear_child_tid = NULL;
-        frame->childregs = *regs;
-	frame->childregs.gprs[2] = 0;	/* child returns 0 on fork. */
-        frame->childregs.gprs[15] = new_stackp;
-        frame->back_chain = frame->eos = 0;
-
-        /* new return point is ret_from_fork */
-        frame->gprs[8] = (unsigned long) ret_from_fork;
-
-        /* fake return stack for resume(), don't go back to schedule */
-        frame->gprs[9] = (unsigned long) frame;
-        /* save fprs */
-	save_fp_regs(&p->thread.fp_regs);
-        p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE;
-	/* start new process with ar4 pointing to the correct address space */
-	p->thread.ar4 = get_fs().ar4;
-        /* Don't copy debug registers */
-        memset(&p->thread.per_info,0,sizeof(p->thread.per_info));
-
-	/* Set a new TLS ?  */
-	if (clone_flags & CLONE_SETTLS) {
-		if (test_thread_flag(TIF_31BIT)) {
-			frame->childregs.acrs[0] =
-				(unsigned int) regs->gprs[6];
-		} else {
-			frame->childregs.acrs[0] =
-				(unsigned int)(regs->gprs[6] >> 32);
-			frame->childregs.acrs[1] =
-				(unsigned int) regs->gprs[6];
-		}
-	}
-        return 0;
-}
-
-asmlinkage int sys_fork(struct pt_regs regs)
-{
-	struct task_struct *p;
-        p = do_fork(SIGCHLD, regs.gprs[15], &regs, 0, NULL, NULL);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
-}
-
-asmlinkage int sys_clone(struct pt_regs regs)
-{
-        unsigned long clone_flags;
-        unsigned long newsp;
-	struct task_struct *p;
-	int *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];
-        if (!newsp)
-                newsp = regs.gprs[15];
-        p = do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0,
-		    parent_tidptr, child_tidptr);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
-}
-
-/*
- * This is trivial, and on the face of it looks like it
- * could equally well be done in user mode.
- *
- * Not so, for quite unobvious reasons - register pressure.
- * In user mode vfork() cannot have a stack frame, and if
- * done by calling the "clone()" system call directly, you
- * do not have enough call-clobbered registers to hold all
- * the information you need.
- */
-asmlinkage int sys_vfork(struct pt_regs regs)
-{
-	struct task_struct *p;
-	p = do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD,
-		    regs.gprs[15], &regs, 0, NULL, NULL);
-	return IS_ERR(p) ? PTR_ERR(p) : p->pid;
-}
-
-/*
- * sys_execve() executes a new program.
- */
-asmlinkage int sys_execve(struct pt_regs regs)
-{
-        int error;
-        char * filename;
-
-        filename = getname((char *) 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);
-	if (error == 0) {
-		current->ptrace &= ~PT_DTRACE;
-		current->thread.fp_regs.fpc = 0;
-		asm volatile("sfpc %0,%0" : : "d" (0));
-	}
-        putname(filename);
-out:
-        return error;
-}
-
-
-/*
- * fill in the FPU structure for a core dump.
- */
-int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)
-{
-	save_fp_regs(fpregs);
-	return 1;
-}
-
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs * regs, struct user * dump)
-{
-
-/* changed the size calculations - should hopefully work better. lbt */
-	dump->magic = CMAGIC;
-	dump->start_code = 0;
-	dump->start_stack = regs->gprs[15] & ~(PAGE_SIZE - 1);
-	dump->u_tsize = current->mm->end_code >> PAGE_SHIFT;
-	dump->u_dsize = (current->mm->brk + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	dump->u_dsize -= dump->u_tsize;
-	dump->u_ssize = 0;
-	if (dump->start_stack < TASK_SIZE)
-		dump->u_ssize = (TASK_SIZE - dump->start_stack) >> PAGE_SHIFT;
-	memcpy(&dump->regs, regs, sizeof(s390_regs));
-	dump_fpu (regs, &dump->regs.fp_regs);
-	dump->regs.per_info = current->thread.per_info;
-}
-
-/*
- * These bracket the sleeping functions..
- */
-extern void scheduling_functions_start_here(void);
-extern void scheduling_functions_end_here(void);
-#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;
-        unsigned long stack_page;
-        int count = 0;
-        if (!p || p == current || p->state == TASK_RUNNING)
-                return 0;
-	stack_page = (unsigned long) p->thread_info;
-        r15 = p->thread.ksp;
-        if (!stack_page || r15 < stack_page || r15 >= 16380+stack_page)
-                return 0;
-        bc = *(unsigned long *) r15;
-        do {
-                if (bc < stack_page || bc >= 16380+stack_page)
-                        return 0;
-                r14 = *(unsigned long *) (bc+112);
-                if (r14 < first_sched || r14 >= last_sched)
-                        return r14;
-                bc = *(unsigned long *) bc;
-        } while (count++ < 16);
-        return 0;
-}
-#undef last_sched
-#undef first_sched
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/ptrace.c linux-2.5.67-bk6/arch/s390x/kernel/ptrace.c
--- linux-2.5.67-bk5/arch/s390x/kernel/ptrace.c	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/ptrace.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,612 +0,0 @@
-/*
- *  arch/s390/kernel/ptrace.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Based on PowerPC version 
- *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
- *
- *  Derived from "arch/m68k/kernel/ptrace.c"
- *  Copyright (C) 1994 by Hamish Macdonald
- *  Taken from linux/kernel/ptrace.c and modified for M680x0.
- *  linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
- *
- * Modified by Cort Dougan (cort@cs.nmt.edu) 
- *
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file README.legal in the main directory of
- * this archive for more details.
- */
-
-#include <stddef.h>
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/errno.h>
-#include <linux/ptrace.h>
-#include <linux/user.h>
-#include <linux/security.h>
-
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/pgtable.h>
-#include <asm/pgalloc.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#ifdef CONFIG_S390_SUPPORT
-#include "ptrace32.h"
-#endif
-
-static void FixPerRegisters(struct task_struct *task)
-{
-	struct pt_regs *regs;
-	per_struct *per_info;
-
-	regs = __KSTK_PTREGS(task);
-	per_info = (per_struct *) &task->thread.per_info;
-	per_info->control_regs.bits.em_instruction_fetch =
-		per_info->single_step | per_info->instruction_fetch;
-	
-	if (per_info->single_step) {
-		per_info->control_regs.bits.starting_addr = 0;
-#ifdef CONFIG_S390_SUPPORT
-		if (test_thread_flag(TIF_31BIT))
-			per_info->control_regs.bits.ending_addr = 0x7fffffffUL;
-		else
-#endif
-			per_info->control_regs.bits.ending_addr = -1;
-	} else {
-		per_info->control_regs.bits.starting_addr =
-			per_info->starting_addr;
-		per_info->control_regs.bits.ending_addr =
-			per_info->ending_addr;
-	}
-	/*
-	 * if any of the control reg tracing bits are on 
-	 * we switch on per in the psw
-	 */
-	if (per_info->control_regs.words.cr[0] & PER_EM_MASK)
-		regs->psw.mask |= PSW_MASK_PER;
-	else
-		regs->psw.mask &= ~PSW_MASK_PER;
-
-	if (per_info->control_regs.bits.em_storage_alteration)
-		per_info->control_regs.bits.storage_alt_space_ctl = 1;
-	else
-		per_info->control_regs.bits.storage_alt_space_ctl = 0;
-}
-
-void set_single_step(struct task_struct *task)
-{
-	per_struct *per_info= (per_struct *) &task->thread.per_info;	
-	
-	per_info->single_step = 1;  /* Single step */
-	FixPerRegisters (task);
-}
-
-void clear_single_step(struct task_struct *task)
-{
-	per_struct *per_info= (per_struct *) &task->thread.per_info;
-
-	per_info->single_step = 0;
-	FixPerRegisters (task);
-}
-
-/*
- * Called by kernel/ptrace.c when detaching..
- *
- * Make sure single step bits etc are not set.
- */
-void ptrace_disable(struct task_struct *child)
-{
-	/* make sure the single step bit is not set. */
-	clear_single_step(child);
-}
-
-/*
- * Read the word at offset addr from the user area of a process. The
- * trouble here is that the information is littered over different
- * locations. The process registers are found on the kernel stack,
- * the floating point stuff and the trace settings are stored in
- * the task structure. In addition the different structures in
- * struct user contain pad bytes that should be read as zeroes.
- * Lovely...
- */
-static int peek_user(struct task_struct *child, addr_t addr, addr_t data)
-{
-	struct user *dummy = NULL;
-	addr_t offset;
-	__u64 tmp;
-
-	if ((addr & 7) || addr > sizeof(struct user) - 7)
-		return -EIO;
-
-	if (addr <= (addr_t) &dummy->regs.orig_gpr2) {
-		/*
-		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
-		 */
-		tmp = *(__u64 *)((addr_t) __KSTK_PTREGS(child) + addr);
-
-	} else if (addr >= (addr_t) &dummy->regs.fp_regs &&
-		   addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
-		/*
-		 * floating point regs. are stored in the thread structure
-		 */
-		offset = addr - (addr_t) &dummy->regs.fp_regs;
-		tmp = *(__u64 *)((addr_t) &child->thread.fp_regs + offset);
-
-	} else if (addr >= (addr_t) &dummy->regs.per_info &&
-		   addr < (addr_t) (&dummy->regs.per_info + 1)) {
-		/*
-		 * per_info is found in the thread structure
-		 */
-		offset = addr - (addr_t) &dummy->regs.per_info;
-		tmp = *(__u64 *)((addr_t) &child->thread.per_info + offset);
-
-	} else
-		tmp = 0;
-
-	return put_user(tmp, (__u64 *) data);
-}
-
-/*
- * Write a word to the user area of a process at location addr. This
- * operation does have an additional problem compared to peek_user.
- * Stores to the program status word and on the floating point
- * control register needs to get checked for validity.
- */
-static int poke_user(struct task_struct *child, addr_t addr, addr_t data)
-{
-	struct user *dummy = NULL;
-	addr_t offset;
-
-	if ((addr & 7) || addr > sizeof(struct user) - 7)
-		return -EIO;
-
-	if (addr <= (addr_t) &dummy->regs.orig_gpr2) {
-		/*
-		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
-		 */
-		if (addr == (addr_t) &dummy->regs.psw.mask &&
-#ifdef CONFIG_S390_SUPPORT
-		    (data & ~PSW_MASK_CC) != PSW_USER32_BITS &&
-#endif
-		    (data & ~PSW_MASK_CC) != PSW_USER_BITS)
-			/* Invalid psw mask. */
-			return -EINVAL;
-		*(__u64 *)((addr_t) __KSTK_PTREGS(child) + addr) = data;
-
-	} else if (addr >= (addr_t) &dummy->regs.fp_regs &&
-		   addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
-		/*
-		 * floating point regs. are stored in the thread structure
-		 */
-		if (addr == (addr_t) &dummy->regs.fp_regs.fpc &&
-		    ((data >> 32) & ~FPC_VALID_MASK) != 0)
-			/* Invalid floating pointer control. */
-			return -EINVAL;
-		offset = addr - (addr_t) &dummy->regs.fp_regs;
-		*(__u64 *)((addr_t) &child->thread.fp_regs + offset) = data;
-
-	} else if (addr >= (addr_t) &dummy->regs.per_info &&
-		   addr < (addr_t) (&dummy->regs.per_info + 1)) {
-		/*
-		 * per_info is found in the thread structure
-		 */
-		offset = addr - (addr_t) &dummy->regs.per_info;
-		*(__u64 *)((addr_t) &child->thread.per_info + offset) = data;
-
-	}
-
-	FixPerRegisters(child);
-	return 0;
-}
-
-static int
-do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
-{
-	unsigned long tmp;
-	ptrace_area parea; 
-	int copied, ret;
-
-	switch (request) {
-	case PTRACE_PEEKTEXT:
-	case PTRACE_PEEKDATA:
-		/* read word at location addr. */
-		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
-		if (copied != sizeof(tmp))
-			return -EIO;
-		return put_user(tmp, (unsigned long *) data);
-
-	case PTRACE_PEEKUSR:
-		/* read the word at location addr in the USER area. */
-		return peek_user(child, addr, data);
-
-	case PTRACE_POKETEXT:
-	case PTRACE_POKEDATA:
-		/* write the word at location addr. */
-		copied = access_process_vm(child, addr, &data, sizeof(data),1);
-		if (copied != sizeof(data))
-			return -EIO;
-		return 0;
-
-	case PTRACE_POKEUSR:
-		/* write the word at location addr in the USER area */
-		return poke_user(child, addr, data);
-
-	case PTRACE_PEEKUSR_AREA:
-	case PTRACE_POKEUSR_AREA:
-		if (!copy_from_user(&parea, (void *) addr, sizeof(parea)))
-			return -EFAULT;
-		addr = parea.kernel_addr;
-		data = parea.process_addr;
-		copied = 0;
-		while (copied < parea.len) {
-			if (request == PTRACE_PEEKUSR_AREA)
-				ret = peek_user(child, addr, data);
-			else
-				ret = poke_user(child, addr, data);
-			if (ret)
-				return ret;
-			addr += sizeof(unsigned long);
-			data += sizeof(unsigned long);
-			copied += sizeof(unsigned long);
-		}
-		return 0;
-	}
-	return ptrace_request(child, request, addr, data);
-}
-
-#ifdef CONFIG_S390_SUPPORT
-/*
- * Now the fun part starts... a 31 bit program running in the
- * 31 bit emulation tracing another program. PTRACE_PEEKTEXT,
- * PTRACE_PEEKDATA, PTRACE_POKETEXT and PTRACE_POKEDATA are easy
- * to handle, the difference to the 64 bit versions of the requests
- * is that the access is done in multiples of 4 byte instead of
- * 8 bytes (sizeof(unsigned long) on 31/64 bit).
- * The ugly part are PTRACE_PEEKUSR, PTRACE_PEEKUSR_AREA,
- * PTRACE_POKEUSR and PTRACE_POKEUSR_AREA. If the traced program
- * is a 31 bit program too, the content of struct user can be
- * emulated. A 31 bit program peeking into the struct user of
- * a 64 bit program is a no-no.
- */
-
-/*
- * Same as peek_user but for a 31 bit program.
- */
-static int peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
-{
-	struct user32 *dummy32 = NULL;
-	per_struct32 *dummy_per32 = NULL;
-	addr_t offset;
-	__u32 tmp;
-
-	if (!test_thread_flag(TIF_31BIT) ||
-	    (addr & 3) || addr > sizeof(struct user) - 3)
-		return -EIO;
-
-	if (addr <= (addr_t) &dummy32->regs.orig_gpr2) {
-		/*
-		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
-		 */
-		if (addr == (addr_t) &dummy32->regs.psw.mask) {
-			/* Fake a 31 bit psw mask. */
-			tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32);
-			tmp = (tmp & PSW32_MASK_CC) | PSW32_USER_BITS;
-		} else if (addr == (addr_t) &dummy32->regs.psw.addr) {
-			/* Fake a 31 bit psw address. */
-			tmp = (__u32) __KSTK_PTREGS(child)->psw.addr |
-				PSW32_ADDR_AMODE31;
-		} else
-			tmp = *(__u32 *)((addr_t) __KSTK_PTREGS(child) + 
-					 addr*2 + 4);
-	} else if (addr >= (addr_t) &dummy32->regs.fp_regs &&
-		   addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
-		/*
-		 * floating point regs. are stored in the thread structure 
-		 */
-	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
-		tmp = *(__u32 *)((addr_t) &child->thread.fp_regs + offset);
-
-	} else if (addr >= (addr_t) &dummy32->regs.per_info &&
-		   addr < (addr_t) (&dummy32->regs.per_info + 1)) {
-		/*
-		 * per_info is found in the thread structure
-		 */
-		offset = addr - (addr_t) &dummy32->regs.per_info;
-		/* This is magic. See per_struct and per_struct32. */
-		if ((offset >= (addr_t) &dummy_per32->control_regs &&
-		     offset < (addr_t) (&dummy_per32->control_regs + 1)) ||
-		    (offset >= (addr_t) &dummy_per32->starting_addr &&
-		     offset <= (addr_t) &dummy_per32->ending_addr) ||
-		    offset == (addr_t) &dummy_per32->lowcore.words.address)
-			offset = offset*2 + 4;
-		else
-			offset = offset*2;
-		tmp = *(__u32 *)((addr_t) &child->thread.per_info + offset);
-
-	} else
-		tmp = 0;
-
-	return put_user(tmp, (__u32 *) data);
-}
-
-/*
- * Same as poke_user but for a 31 bit program.
- */
-static int poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
-{
-	struct user32 *dummy32 = NULL;
-	per_struct32 *dummy_per32 = NULL;
-	addr_t offset;
-	__u32 tmp;
-
-	if (!test_thread_flag(TIF_31BIT) ||
-	    (addr & 3) || addr > sizeof(struct user32) - 3)
-		return -EIO;
-
-	tmp = (__u32) data;
-
-	if (addr <= (addr_t) &dummy32->regs.orig_gpr2) {
-		/*
-		 * psw, gprs, acrs and orig_gpr2 are stored on the stack
-		 */
-		if (addr == (addr_t) &dummy32->regs.psw.mask) {
-			/* Build a 64 bit psw mask from 31 bit mask. */
-			if ((tmp & ~PSW32_MASK_CC) != PSW32_USER_BITS)
-				/* Invalid psw mask. */
-				return -EINVAL;
-			__KSTK_PTREGS(child)->psw.mask = PSW_USER_BITS |
-				((tmp & PSW32_MASK_CC) << 32);
-		} else if (addr == (addr_t) &dummy32->regs.psw.addr) {
-			/* Build a 64 bit psw address from 31 bit address. */
-			__KSTK_PTREGS(child)->psw.addr = 
-				(__u64) tmp & PSW32_ADDR_INSN;
-		} else
-			*(__u32*)((addr_t) __KSTK_PTREGS(child) + addr*2 + 4) =
-				tmp;
-	} else if (addr >= (addr_t) &dummy32->regs.fp_regs &&
-		   addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
-		/*
-		 * floating point regs. are stored in the thread structure 
-		 */
-		if (addr == (addr_t) &dummy32->regs.fp_regs.fpc &&
-		    (tmp & ~FPC_VALID_MASK) != 0)
-			/* Invalid floating point control. */
-			return -EINVAL;
-	        offset = addr - (addr_t) &dummy32->regs.fp_regs;
-		*(__u32 *)((addr_t) &child->thread.fp_regs + offset) = tmp;
-
-	} else if (addr >= (addr_t) &dummy32->regs.per_info &&
-		   addr < (addr_t) (&dummy32->regs.per_info + 1)) {
-		/*
-		 * per_info is found in the thread structure.
-		 */
-		offset = addr - (addr_t) &dummy32->regs.per_info;
-		/*
-		 * This is magic. See per_struct and per_struct32.
-		 * By incident the offsets in per_struct are exactly
-		 * twice the offsets in per_struct32 for all fields.
-		 * The 8 byte fields need special handling though,
-		 * because the second half (bytes 4-7) is needed and
-		 * not the first half.
-		 */
-		if ((offset >= (addr_t) &dummy_per32->control_regs &&
-		     offset < (addr_t) (&dummy_per32->control_regs + 1)) ||
-		    (offset >= (addr_t) &dummy_per32->starting_addr &&
-		     offset <= (addr_t) &dummy_per32->ending_addr) ||
-		    offset == (addr_t) &dummy_per32->lowcore.words.address)
-			offset = offset*2 + 4;
-		else
-			offset = offset*2;
-		*(__u32 *)((addr_t) &child->thread.per_info + offset) = tmp;
-
-	}
-
-	FixPerRegisters(child);
-	return 0;
-}
-
-static int
-do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
-{
-	unsigned int tmp;  /* 4 bytes !! */
-	ptrace_area_emu31 parea; 
-	int copied, ret;
-
-	switch (request) {
-	case PTRACE_PEEKTEXT:
-	case PTRACE_PEEKDATA:
-		/* read word at location addr. */
-		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
-		if (copied != sizeof(tmp))
-			return -EIO;
-		return put_user(tmp, (unsigned int *) data);
-
-	case PTRACE_PEEKUSR:
-		/* read the word at location addr in the USER area. */
-		return peek_user_emu31(child, addr, data);
-
-	case PTRACE_POKETEXT:
-	case PTRACE_POKEDATA:
-		/* write the word at location addr. */
-		tmp = data;
-		copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 1);
-		if (copied != sizeof(tmp))
-			return -EIO;
-		return 0;
-
-	case PTRACE_POKEUSR:
-		/* write the word at location addr in the USER area */
-		return poke_user_emu31(child, addr, data);
-
-	case PTRACE_PEEKUSR_AREA:
-	case PTRACE_POKEUSR_AREA:
-		if (!copy_from_user(&parea, (void *) addr, sizeof(parea)))
-			return -EFAULT;
-		addr = parea.kernel_addr;
-		data = parea.process_addr;
-		copied = 0;
-		while (copied < parea.len) {
-			if (request == PTRACE_PEEKUSR_AREA)
-				ret = peek_user_emu31(child, addr, data);
-			else
-				ret = poke_user_emu31(child, addr, data);
-			if (ret)
-				return ret;
-			addr += sizeof(unsigned int);
-			data += sizeof(unsigned int);
-			copied += sizeof(unsigned int);
-		}
-		return 0;
-	}
-	return ptrace_request(child, request, addr, data);
-}
-#endif
-
-static int
-do_ptrace(struct task_struct *child, long request, long addr, long data)
-{
-	int ret;
-
-	if (request == PTRACE_ATTACH)
-		return ptrace_attach(child);
-
-	/*
-	 * I added child != current line so we can get the
-	 * ieee_instruction_pointer from the user structure DJB
-	 */
-	if (child != current) {
-		ret = ptrace_check_attach(child, request == PTRACE_KILL);
-		if (ret < 0)
-			return ret;
-	}
-
-	switch (request) {
-	/* First the common request for 31/64 bit */
-	case PTRACE_SYSCALL:
-		/* continue and stop at next (return from) syscall */
-	case PTRACE_CONT:
-		/* restart after signal. */
-		if ((unsigned long) data >= _NSIG)
-			return -EIO;
-		if (request == PTRACE_SYSCALL)
-			set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		else
-			clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		child->exit_code = data;
-		/* make sure the single step bit is not set. */
-		clear_single_step(child);
-		wake_up_process(child);
-		return 0;
-
-	case PTRACE_KILL:
-		/*
-		 * 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.
-		 */
-		if (child->state == TASK_ZOMBIE) /* already dead */
-			return 0;
-		child->exit_code = SIGKILL;
-		/* make sure the single step bit is not set. */
-		clear_single_step(child);
-		wake_up_process(child);
-		return 0;
-
-	case PTRACE_SINGLESTEP:
-		/* set the trap flag. */
-		if ((unsigned long) data >= _NSIG)
-			return -EIO;
-		clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-		child->exit_code = data;
-		set_single_step(child);
-		/* give it a chance to run. */
-		wake_up_process(child);
-		return 0;
-
-	case PTRACE_DETACH:
-		/* detach a process that was attached. */
-		return ptrace_detach(child, data);
-
-	/* Do requests that differ for 31/64 bit */
-	default:
-#ifdef CONFIG_S390_SUPPORT
-		if (test_thread_flag(TIF_31BIT))
-			return do_ptrace_emu31(child, request, addr, data);
-#endif
-		return do_ptrace_normal(child, request, addr, data);
-	}
-	/* Not reached.  */
-	return -EIO;
-}
-
-asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
-{
-	struct task_struct *child;
-	int ret;
-
-	lock_kernel();
-
-	if (request == PTRACE_TRACEME) {
-		/* are we already being traced? */
-		ret = -EPERM;
-		if (current->ptrace & PT_PTRACED)
-			goto out;
-		ret = security_ptrace(current->parent, current);
-		if (ret)
-			goto out;
-		/* set the ptrace bit in the process flags. */
-		current->ptrace |= PT_PTRACED;
-		goto out;
-	}
-
-	ret = -EPERM;
-	if (pid == 1)		/* you may not mess with init */
-		goto out;
-
-	ret = -ESRCH;
-	read_lock(&tasklist_lock);
-	child = find_task_by_pid(pid);
-	if (child)
-		get_task_struct(child);
-	read_unlock(&tasklist_lock);
-	if (!child)
-		goto out;
-
-	ret = do_ptrace(child, request, addr, data);
-
-	put_task_struct(child);
-out:
-	unlock_kernel();
-	return ret;
-}
-
-asmlinkage void syscall_trace(void)
-{
-	if (!test_thread_flag(TIF_SYSCALL_TRACE))
-		return;
-	if (!(current->ptrace & PT_PTRACED))
-		return;
-	ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-				 ? 0x80 : 0));
-
-	/*
-	 * this isn't the same as continuing with a signal, but it will do
-	 * for normal use.  strace only continues with a signal if the
-	 * stopping signal is not SIGTRAP.  -brl
-	 */
-	if (current->exit_code) {
-		send_sig(current->exit_code, current, 1);
-		current->exit_code = 0;
-	}
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/ptrace32.h linux-2.5.67-bk6/arch/s390x/kernel/ptrace32.h
--- linux-2.5.67-bk5/arch/s390x/kernel/ptrace32.h	2003-04-07 10:31:10.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/ptrace32.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,86 +0,0 @@
-#ifndef _PTRACE32_H
-#define _PTRACE32_H
-
-#include "linux32.h"  /* needed for _psw_t32 */
-
-typedef struct
-{
-	__u32 cr[3];
-} per_cr_words32  __attribute__((packed));
-
-typedef struct
-{
-	__u16          perc_atmid;          /* 0x096 */
-	__u32          address;             /* 0x098 */
-	__u8           access_id;           /* 0x0a1 */
-} per_lowcore_words32  __attribute__((packed));
-
-typedef struct
-{
-	union {
-		per_cr_words32   words;
-	} control_regs  __attribute__((packed));
-	/*
-	 * Use these flags instead of setting em_instruction_fetch
-	 * directly they are used so that single stepping can be
-	 * switched on & off while not affecting other tracing
-	 */
-	unsigned  single_step       : 1;
-	unsigned  instruction_fetch : 1;
-	unsigned                    : 30;
-	/*
-	 * These addresses are copied into cr10 & cr11 if single
-	 * stepping is switched off
-	 */
-	__u32     starting_addr;
-	__u32     ending_addr;
-	union {
-		per_lowcore_words32 words;
-	} lowcore; 
-} per_struct32 __attribute__((packed));
-
-struct user_regs_struct32
-{
-	_psw_t32 psw;
-	u32 gprs[NUM_GPRS];
-	u32 acrs[NUM_ACRS];
-	u32 orig_gpr2;
-	s390_fp_regs fp_regs;
-	/*
-	 * These per registers are in here so that gdb can modify them
-	 * itself as there is no "official" ptrace interface for hardware
-	 * watchpoints. This is the way intel does it.
-	 */
-	per_struct32 per_info;
-	u32  ieee_instruction_pointer; 
-	/* Used to give failing instruction back to user for ieee exceptions */
-};
-
-struct user32 {
-	/* We start with the registers, to mimic the way that "memory"
-	   is returned from the ptrace(3,...) function.  */
-	struct user_regs_struct32 regs; /* Where the registers are actually stored */
-	/* The rest of this junk is to help gdb figure out what goes where */
-	u32 u_tsize;		/* Text segment size (pages). */
-	u32 u_dsize;	        /* Data segment size (pages). */
-	u32 u_ssize;	        /* Stack segment size (pages). */
-	u32 start_code;         /* Starting virtual address of text. */
-	u32 start_stack;	/* Starting virtual address of stack area.
-				   This is actually the bottom of the stack,
-				   the top of the stack is always found in the
-				   esp register.  */
-	s32 signal;     	 /* Signal that caused the core dump. */
-	u32 u_ar0;               /* Used by gdb to help find the values for */
-	                         /* the registers. */
-	u32 magic;		 /* To uniquely identify a core file */
-	char u_comm[32];	 /* User command that was responsible */
-};
-
-typedef struct
-{
-	__u32   len;
-	__u32   kernel_addr;
-	__u32   process_addr;
-} ptrace_area_emu31;
-
-#endif /* _PTRACE32_H */
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/reipl.S linux-2.5.67-bk6/arch/s390x/kernel/reipl.S
--- linux-2.5.67-bk5/arch/s390x/kernel/reipl.S	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/reipl.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,96 +0,0 @@
-/*
- *  arch/s390/kernel/reipl.S
- *
- *  S390 version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com)
-	         Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- */
-
-#include <asm/lowcore.h>
-		.globl	do_reipl
-do_reipl:	basr	%r13,0
-.Lpg0:		lpswe   .Lnewpsw-.Lpg0(%r13)
-.Lpg1:		lctlg	%c6,%c6,.Lall-.Lpg0(%r13)
-                stctg   %c0,%c0,.Lctlsave-.Lpg0(%r13)
-                ni      .Lctlsave+4-.Lpg0(%r13),0xef
-                lctlg   %c0,%c0,.Lctlsave-.Lpg0(%r13)
-                lgr     %r1,%r2
-        	mvc     __LC_PGM_NEW_PSW(16),.Lpcnew-.Lpg0(%r13)
-                stsch   .Lschib-.Lpg0(%r13)                                    
-	        oi      .Lschib+5-.Lpg0(%r13),0x84 
-.Lecs:  	xi      .Lschib+27-.Lpg0(%r13),0x01 
-        	msch    .Lschib-.Lpg0(%r13) 
-	        lghi    %r0,5
-.Lssch:		ssch	.Liplorb-.Lpg0(%r13)           
-		jz	.L001
-		brct    %r0,.Lssch   
-		bas	%r14,.Ldisab-.Lpg0(%r13)
-.L001:		mvc	__LC_IO_NEW_PSW(16),.Lionew-.Lpg0(%r13)	
-.Ltpi:		lpswe	.Lwaitpsw-.Lpg0(%r13)          
-.Lcont:		c	%r1,__LC_SUBCHANNEL_ID
-		jnz	.Ltpi
-		clc	__LC_IO_INT_PARM(4),.Liplorb-.Lpg0(%r13)
-		jnz	.Ltpi
-		tsch	.Liplirb-.Lpg0(%r13)           
-		tm	.Liplirb+9-.Lpg0(%r13),0xbf
-                jz      .L002
-                bas     %r14,.Ldisab-.Lpg0(%r13)    
-.L002:		tm	.Liplirb+8-.Lpg0(%r13),0xf3    
-                jz      .L003
-                bas     %r14,.Ldisab-.Lpg0(%r13)	
-.L003:		spx	.Lnull-.Lpg0(%r13)
-		st 	%r1,__LC_SUBCHANNEL_ID
-                lhi     %r1,0            # mode 0 = esa
-                slr     %r0,%r0          # set cpuid to zero
-                sigp    %r1,%r0,0x12     # switch to esa mode
-                lpsw 	0
-.Ldisab:	sll    %r14,1
-		srl    %r14,1            # need to kill hi bit to avoid specification exceptions.
-		st     %r14,.Ldispsw+12-.Lpg0(%r13)
-		lpswe	.Ldispsw-.Lpg0(%r13)
-                .align 	8
-.Lall:		.quad	0x00000000ff000000
-.Lctlsave:      .quad   0x0000000000000000
-.Lnull:		.long   0x0000000000000000
-                .align 	16
-/*
- * These addresses have to be 31 bit otherwise
- * the sigp will throw a specifcation exception
- * when switching to ESA mode as bit 31 be set
- * in the ESA psw.
- * Bit 31 of the addresses has to be 0 for the
- * 31bit lpswe instruction a fact they appear to have
- * ommited from the pop.
- */
-.Lnewpsw:	.quad   0x0000000080000000
-		.quad   .Lpg1
-.Lpcnew:	.quad   0x0000000080000000
-	  	.quad   .Lecs
-.Lionew:	.quad   0x0000000080000000
-		.quad   .Lcont
-.Lwaitpsw:	.quad	0x0202000080000000
-		.quad   .Ltpi
-.Ldispsw:	.quad   0x0002000080000000
-		.quad   0x0000000000000000
-.Liplccws:	.long   0x02000000,0x60000018
-		.long   0x08000008,0x20000001
-.Liplorb:	.long	0x0049504c,0x0040ff80
-		.long	0x00000000+.Liplccws
-.Lschib:        .long   0x00000000,0x00000000
-		.long   0x00000000,0x00000000
-		.long   0x00000000,0x00000000
-		.long   0x00000000,0x00000000
-		.long   0x00000000,0x00000000
-		.long   0x00000000,0x00000000
-.Liplirb:	.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-		.long	0x00000000,0x00000000
-	
-
-	
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/s390_ext.c linux-2.5.67-bk6/arch/s390x/kernel/s390_ext.c
--- linux-2.5.67-bk5/arch/s390x/kernel/s390_ext.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/s390_ext.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,103 +0,0 @@
-/*
- *  arch/s390/kernel/s390_ext.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/errno.h>
-#include <asm/lowcore.h>
-#include <asm/s390_ext.h>
-
-/*
- * Simple hash strategy: index = code & 0xff;
- * ext_int_hash[index] is the start of the list for all external interrupts
- * that hash to this index. With the current set of external interrupts 
- * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000
- * iucv and 0x2603 pfault) this is always the first element. 
- */
-ext_int_info_t *ext_int_hash[256] = { 0, };
-
-int register_external_interrupt(__u16 code, ext_int_handler_t handler) {
-        ext_int_info_t *p;
-        int index;
-
-	p = (ext_int_info_t *) kmalloc(sizeof(ext_int_info_t), GFP_ATOMIC);
-        if (p == NULL)
-                return -ENOMEM;
-        p->code = code;
-        p->handler = handler;
-        index = code & 0xff;
-        p->next = ext_int_hash[index];
-        ext_int_hash[index] = p;
-        return 0;
-}
-
-int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
-				      ext_int_info_t *p) {
-        int index;
-
-        if (p == NULL)
-                return -EINVAL;
-        p->code = code;
-        p->handler = handler;
-        index = code & 0xff;
-        p->next = ext_int_hash[index];
-        ext_int_hash[index] = p;
-        return 0;
-}
-
-int unregister_external_interrupt(__u16 code, ext_int_handler_t handler) {
-        ext_int_info_t *p, *q;
-        int index;
-
-        index = code & 0xff;
-        q = NULL;
-        p = ext_int_hash[index];
-        while (p != NULL) {
-                if (p->code == code && p->handler == handler)
-                        break;
-                q = p;
-                p = p->next;
-        }
-        if (p == NULL)
-                return -ENOENT;
-        if (q != NULL)
-                q->next = p->next;
-        else
-                ext_int_hash[index] = p->next;
-	kfree(p);
-        return 0;
-}
-
-int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
-					ext_int_info_t *p) {
-	ext_int_info_t *q;
-	int index;
-
-	if (p == NULL || p->code != code || p->handler != handler)
-		return -EINVAL;
-	index = code & 0xff;
-	q = ext_int_hash[index];
-	if (p != q) {
-		while (q != NULL) {
-			if (q->next == p)
-				break;
-			q = q->next;
-		}
-		if (q == NULL)
-			return -ENOENT;
-		q->next = p->next;
-	} else
-		ext_int_hash[index] = p->next;
-	return 0;
-}
-
-EXPORT_SYMBOL(register_external_interrupt);
-EXPORT_SYMBOL(unregister_external_interrupt);
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/s390_ksyms.c linux-2.5.67-bk6/arch/s390x/kernel/s390_ksyms.c
--- linux-2.5.67-bk5/arch/s390x/kernel/s390_ksyms.c	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/s390_ksyms.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,86 +0,0 @@
-/*
- *  arch/s390/kernel/s390_ksyms.c
- *
- *  S390 version
- */
-#include <linux/config.h>
-#include <linux/highuid.h>
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/interrupt.h>
-#include <asm/checksum.h>
-#include <asm/delay.h>
-#include <asm/pgalloc.h>
-#include <asm/setup.h>
-#if CONFIG_IP_MULTICAST
-#include <net/arp.h>
-#endif
-
-/*
- * memory management
- */
-EXPORT_SYMBOL_NOVERS(_oi_bitmap);
-EXPORT_SYMBOL_NOVERS(_ni_bitmap);
-EXPORT_SYMBOL_NOVERS(_zb_findmap);
-EXPORT_SYMBOL_NOVERS(__copy_from_user_asm);
-EXPORT_SYMBOL_NOVERS(__copy_to_user_asm);
-EXPORT_SYMBOL_NOVERS(__clear_user_asm);
-
-/*
- * semaphore ops
- */
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-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);
-
-/*
- * binfmt_elf loader 
- */
-extern int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs);
-EXPORT_SYMBOL(dump_fpu);
-EXPORT_SYMBOL(overflowuid);
-EXPORT_SYMBOL(overflowgid);
-
-#ifdef CONFIG_S390_SUPPORT
-/*
- * Dynamically add/remove 31 bit ioctl conversion functions.
- */
-extern int register_ioctl32_conversion(unsigned int cmd,
-				       int (*handler)(unsigned int, 
-						      unsigned int,
-						      unsigned long,
-						      struct file *));
-int unregister_ioctl32_conversion(unsigned int cmd);
-EXPORT_SYMBOL(register_ioctl32_conversion);
-EXPORT_SYMBOL(unregister_ioctl32_conversion);
-#endif
-
-/*
- * misc.
- */
-EXPORT_SYMBOL(machine_flags);
-EXPORT_SYMBOL(__udelay);
-EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(console_mode);
-EXPORT_SYMBOL(console_device);
-EXPORT_SYMBOL_NOVERS(do_call_softirq);
-EXPORT_SYMBOL(sys_wait4);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/semaphore.c linux-2.5.67-bk6/arch/s390x/kernel/semaphore.c
--- linux-2.5.67-bk5/arch/s390x/kernel/semaphore.c	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/semaphore.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,106 +0,0 @@
-/*
- *  linux/arch/s390x/kernel/semaphore.c
- *
- *  S390 version
- *    Copyright (C) 1998-2000 IBM Corporation
- *    Author(s): Martin Schwidefsky
- *
- *  Derived from "linux/arch/i386/kernel/semaphore.c
- *    Copyright (C) 1999, Linus Torvalds
- *
- */
-#include <linux/sched.h>
-#include <linux/errno.h>
-
-#include <asm/semaphore.h>
-
-/*
- * Atomically update sem->count. Equivalent to:
- *   old_val = sem->count.counter;
- *   new_val = ((old_val >= 0) ? old_val : 0) + incr;
- *   sem->count.counter = new_val;
- *   return old_val;
- */
-static inline int __sem_update_count(struct semaphore *sem, int incr)
-{
-	int old_val, new_val;
-
-        __asm__ __volatile__("   l     %0,0(%3)\n"
-                             "0: ltr   %1,%0\n"
-			     "   jhe   1f\n"
-			     "   lhi   %1,0\n"
-			     "1: ar    %1,%4\n"
-                             "   cs    %0,%1,0(%3)\n"
-                             "   jl    0b\n"
-                             : "=&d" (old_val), "=&d" (new_val),
-			       "+m" (sem->count)
-			     : "a" (&sem->count), "d" (incr) : "cc" );
-	return old_val;
-}
-
-/*
- * The inline function up() incremented count but the result
- * was <= 0. This indicates that some process is waiting on
- * the semaphore. The semaphore is free and we'll wake the
- * first sleeping process, so we set count to 1 unless some
- * other cpu has called up in the meantime in which case
- * we just increment count by 1.
- */
-void __up(struct semaphore *sem)
-{
-	__sem_update_count(sem, 1);
-	wake_up(&sem->wait);
-}
-
-/*
- * The inline function down() decremented count and the result
- * was < 0. The wait loop will atomically test and update the
- * semaphore counter following the rules:
- *   count > 0: decrement count, wake up queue and exit.
- *   count <= 0: set count to -1, go to sleep.
- */
-void __down(struct semaphore * sem)
-{
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	tsk->state = TASK_UNINTERRUPTIBLE;
-	add_wait_queue_exclusive(&sem->wait, &wait);
-	while (__sem_update_count(sem, -1) <= 0) {
-		schedule();
-		tsk->state = TASK_UNINTERRUPTIBLE;
-	}
-	remove_wait_queue(&sem->wait, &wait);
-	tsk->state = TASK_RUNNING;
-	wake_up(&sem->wait);
-}
-
-/*
- * Same as __down() with an additional test for signals.
- * If a signal is pending the count is updated as follows:
- *   count > 0: wake up queue and exit.
- *   count <= 0: set count to 0, wake up queue and exit.
- */
-int __down_interruptible(struct semaphore * sem)
-{
-	int retval = 0;
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	tsk->state = TASK_INTERRUPTIBLE;
-	add_wait_queue_exclusive(&sem->wait, &wait);
-	while (__sem_update_count(sem, -1) <= 0) {
-		if (signal_pending(current)) {
-			__sem_update_count(sem, 0);
-			retval = -EINTR;
-			break;
-		}
-		schedule();
-		tsk->state = TASK_INTERRUPTIBLE;
-	}
-	remove_wait_queue(&sem->wait, &wait);
-	tsk->state = TASK_RUNNING;
-	wake_up(&sem->wait);
-	return retval;
-}
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/setup.c linux-2.5.67-bk6/arch/s390x/kernel/setup.c
--- linux-2.5.67-bk5/arch/s390x/kernel/setup.c	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/setup.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,563 +0,0 @@
-/*
- *  arch/s390/kernel/setup.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "arch/i386/kernel/setup.c"
- *    Copyright (C) 1995, Linus Torvalds
- */
-
-/*
- * This file handles the architecture-dependent parts of initialization
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-#include <linux/tty.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/config.h>
-#include <linux/init.h>
-#ifdef CONFIG_BLK_DEV_RAM
-#include <linux/blk.h>
-#endif
-#include <linux/bootmem.h>
-#include <linux/root_dev.h>
-#include <linux/console.h>
-#include <linux/seq_file.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/smp.h>
-#include <asm/mmu_context.h>
-#include <asm/cpcmd.h>
-
-/*
- * Machine setup..
- */
-unsigned int console_mode = 0;
-unsigned int console_device = -1;
-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 } };
-#define CHUNK_READ_WRITE 0
-#define CHUNK_READ_ONLY 1
-int cpus_initialized = 0;
-unsigned long cpu_initialized = 0;
-volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
-
-/*
- * Setup options
- */
-extern int _text,_etext, _edata, _end;
-
-/*
- * This is set up by the setup-routine at boot-time
- * for S390 need to find out, what we have to setup
- * using address 0x10400 ...
- */
-
-#include <asm/setup.h>
-
-static char command_line[COMMAND_LINE_SIZE] = { 0, };
-       char saved_command_line[COMMAND_LINE_SIZE];
-
-static struct resource code_resource = { "Kernel code", 0x100000, 0 };
-static struct resource data_resource = { "Kernel data", 0, 0 };
-
-/*
- * cpu_init() initializes state that is per-CPU.
- */
-void __devinit cpu_init (void)
-{
-        int nr = smp_processor_id();
-        int addr = hard_smp_processor_id();
-
-        if (test_and_set_bit(nr,&cpu_initialized)) {
-                printk("CPU#%d ALREADY INITIALIZED!!!!!!!!!\n", nr);
-                for (;;) local_irq_enable();
-        }
-        cpus_initialized++;
-
-        /*
-         * Store processor id in lowcore (used e.g. in timer_interrupt)
-         */
-        asm volatile ("stidp %0": "=m" (S390_lowcore.cpu_data.cpu_id));
-        S390_lowcore.cpu_data.cpu_addr = addr;
-        S390_lowcore.cpu_data.cpu_nr = nr;
-
-        /*
-         * Force FPU initialization:
-         */
-        clear_thread_flag(TIF_USEDFPU);
-        current->used_math = 0;
-
-        /* Setup active_mm for idle_task  */
-        atomic_inc(&init_mm.mm_count);
-        current->active_mm = &init_mm;
-        if (current->mm)
-                BUG();
-        enter_lazy_tlb(&init_mm, current, nr);
-}
-
-/*
- * VM halt and poweroff setup routines
- */
-char vmhalt_cmd[128] = "";
-char vmpoff_cmd[128] = "";
-
-static inline void strncpy_skip_quote(char *dst, char *src, int n)
-{
-        int sx, dx;
-
-        dx = 0;
-        for (sx = 0; src[sx] != 0; sx++) {
-                if (src[sx] == '"') continue;
-                dst[dx++] = src[sx];
-                if (dx >= n) break;
-        }
-}
-
-static int __init vmhalt_setup(char *str)
-{
-        strncpy_skip_quote(vmhalt_cmd, str, 127);
-        vmhalt_cmd[127] = 0;
-        return 1;
-}
-
-__setup("vmhalt=", vmhalt_setup);
-
-static int __init vmpoff_setup(char *str)
-{
-        strncpy_skip_quote(vmpoff_cmd, str, 127);
-        vmpoff_cmd[127] = 0;
-        return 1;
-}
-
-__setup("vmpoff=", vmpoff_setup);
-
-/*
- * condev= and conmode= setup parameter.
- */
-
-static int __init condev_setup(char *str)
-{
-	int vdev;
-
-	vdev = simple_strtoul(str, &str, 0);
-	if (vdev >= 0 && vdev < 65536)
-		console_device = vdev;
-	return 1;
-}
-
-__setup("condev=", condev_setup);
-
-static int __init conmode_setup(char *str)
-{
-#if defined(CONFIG_SCLP_CONSOLE)
-	if (strncmp(str, "hwc", 4) == 0 || strncmp(str, "sclp", 5) == 0)
-                SET_CONSOLE_SCLP;
-#endif
-#if defined(CONFIG_TN3215_CONSOLE)
-	if (strncmp(str, "3215", 5) == 0)
-		SET_CONSOLE_3215;
-#endif
-#if defined(CONFIG_TN3270_CONSOLE)
-	if (strncmp(str, "3270", 5) == 0)
-		SET_CONSOLE_3270;
-#endif
-        return 1;
-}
-
-__setup("conmode=", conmode_setup);
-
-static void __init conmode_default(void)
-{
-	char query_buffer[1024];
-	char *ptr;
-
-        if (MACHINE_IS_VM) {
-		cpcmd("QUERY CONSOLE", query_buffer, 1024);
-		console_device = simple_strtoul(query_buffer + 5, NULL, 16);
-		ptr = strstr(query_buffer, "SUBCHANNEL =");
-		console_irq = simple_strtoul(ptr + 13, NULL, 16);
-		cpcmd("QUERY TERM", query_buffer, 1024);
-		ptr = strstr(query_buffer, "CONMODE");
-		/*
-		 * Set the conmode to 3215 so that the device recognition 
-		 * will set the cu_type of the console to 3215. If the
-		 * conmode is 3270 and we don't set it back then both
-		 * 3215 and the 3270 driver will try to access the console
-		 * device (3215 as console and 3270 as normal tty).
-		 */
-		cpcmd("TERM CONMODE 3215", NULL, 0);
-		if (ptr == NULL) {
-#if defined(CONFIG_SCLP_CONSOLE)
-			SET_CONSOLE_SCLP;
-#endif
-			return;
-		}
-		if (strncmp(ptr + 8, "3270", 4) == 0) {
-#if defined(CONFIG_TN3270_CONSOLE)
-			SET_CONSOLE_3270;
-#elif defined(CONFIG_TN3215_CONSOLE)
-			SET_CONSOLE_3215;
-#elif defined(CONFIG_SCLP_CONSOLE)
-			SET_CONSOLE_SCLP;
-#endif
-		} else if (strncmp(ptr + 8, "3215", 4) == 0) {
-#if defined(CONFIG_TN3215_CONSOLE)
-			SET_CONSOLE_3215;
-#elif defined(CONFIG_TN3270_CONSOLE)
-			SET_CONSOLE_3270;
-#elif defined(CONFIG_SCLP_CONSOLE)
-			SET_CONSOLE_SCLP;
-#endif
-		}
-        } else if (MACHINE_IS_P390) {
-#if defined(CONFIG_TN3215_CONSOLE)
-		SET_CONSOLE_3215;
-#elif defined(CONFIG_TN3270_CONSOLE)
-		SET_CONSOLE_3270;
-#endif
-	} else {
-#if defined(CONFIG_SCLP_CONSOLE)
-		SET_CONSOLE_SCLP;
-#endif
-	}
-}
-
-#ifdef CONFIG_SMP
-extern void machine_restart_smp(char *);
-extern void machine_halt_smp(void);
-extern void machine_power_off_smp(void);
-
-void (*_machine_restart)(char *command) = machine_restart_smp;
-void (*_machine_halt)(void) = machine_halt_smp;
-void (*_machine_power_off)(void) = machine_power_off_smp;
-#else
-/*
- * Reboot, halt and power_off routines for non SMP.
- */
-extern void do_reipl(unsigned long devno);
-static void do_machine_restart_nonsmp(char * __unused)
-{
-	if (MACHINE_IS_VM)
-		cpcmd ("IPL", NULL, 0);
-	else
-		do_reipl (0x10000 | S390_lowcore.ipl_device);
-}
-
-static void do_machine_halt_nonsmp(void)
-{
-        if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
-                cpcmd(vmhalt_cmd, NULL, 0);
-        signal_processor(smp_processor_id(), sigp_stop_and_store_status);
-}
-
-static void do_machine_power_off_nonsmp(void)
-{
-        if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
-                cpcmd(vmpoff_cmd, NULL, 0);
-        signal_processor(smp_processor_id(), sigp_stop_and_store_status);
-}
-
-void (*_machine_restart)(char *command) = do_machine_restart_nonsmp;
-void (*_machine_halt)(void) = do_machine_halt_nonsmp;
-void (*_machine_power_off)(void) = do_machine_power_off_nonsmp;
-#endif
-
-/*
- * Reboot, halt and power_off stubs. They just call _machine_restart,
- * _machine_halt or _machine_power_off. 
- */
-
-void machine_restart(char *command)
-{
-	_machine_restart(command);
-}
-
-void machine_halt(void)
-{
-	_machine_halt();
-}
-
-void machine_power_off(void)
-{
-	_machine_power_off();
-}
-
-/*
- * Setup function called from init/main.c just after the banner
- * was printed.
- */
-extern char _pstart, _pend, _stext;
-
-void __init setup_arch(char **cmdline_p)
-{
-        unsigned long bootmap_size;
-        unsigned long memory_start, memory_end;
-        char c = ' ', cn, *to = command_line, *from = COMMAND_LINE;
-	struct resource *res;
-	unsigned long start_pfn, end_pfn;
-        static unsigned int smptrap=0;
-        unsigned long delay = 0;
-	struct _lowcore *lc;
-	int i;
-
-        if (smptrap)
-                return;
-        smptrap=1;
-
-        /*
-         * print what head.S has found out about the machine 
-         */
-	printk((MACHINE_IS_VM) ?
-	       "We are running under VM (64 bit mode)\n" :
-	       "We are running native (64 bit mode)\n");
-
-        ROOT_DEV = Root_RAM0;
-        memory_start = (unsigned long) &_end;    /* fixit if use $CODELO etc*/
-	memory_end = memory_size & ~0x200000UL;  /* detected in head.s */
-        init_mm.start_code = PAGE_OFFSET;
-        init_mm.end_code = (unsigned long) &_etext;
-        init_mm.end_data = (unsigned long) &_edata;
-        init_mm.brk = (unsigned long) &_end;
-
-	code_resource.start = (unsigned long) &_text;
-	code_resource.end = (unsigned long) &_etext - 1;
-	data_resource.start = (unsigned long) &_etext;
-	data_resource.end = (unsigned long) &_edata - 1;
-
-        /* Save unparsed command line copy for /proc/cmdline */
-        memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
-        saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
-
-        for (;;) {
-                /*
-                 * "mem=XXX[kKmM]" sets memsize 
-                 */
-                if (c == ' ' && strncmp(from, "mem=", 4) == 0) {
-                        memory_end = simple_strtoul(from+4, &from, 0);
-                        if ( *from == 'K' || *from == 'k' ) {
-                                memory_end = memory_end << 10;
-                                from++;
-                        } else if ( *from == 'M' || *from == 'm' ) {
-                                memory_end = memory_end << 20;
-                                from++;
-                        }
-                }
-                /*
-                 * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes
-                 */
-                if (c == ' ' && strncmp(from, "ipldelay=", 9) == 0) {
-                        delay = simple_strtoul(from+9, &from, 0);
-			if (*from == 's' || *from == 'S') {
-				delay = delay*1000000;
-				from++;
-			} else if (*from == 'm' || *from == 'M') {
-				delay = delay*60*1000000;
-				from++;
-			}
-			/* now wait for the requested amount of time */
-			udelay(delay);
-                }
-                cn = *(from++);
-                if (!cn)
-                        break;
-                if (cn == '\n')
-                        cn = ' ';  /* replace newlines with space */
-		if (cn == 0x0d)
-			cn = ' ';  /* replace 0x0d with space */
-                if (cn == ' ' && c == ' ')
-                        continue;  /* remove additional spaces */
-                c = cn;
-                if (to - command_line >= COMMAND_LINE_SIZE)
-                        break;
-                *(to++) = c;
-        }
-        if (c == ' ' && to > command_line) to--;
-        *to = '\0';
-        *cmdline_p = command_line;
-
-	/*
-	 * partially used pages are not usable - thus
-	 * we are rounding upwards:
-	 */
-	start_pfn = (__pa(&_end) + PAGE_SIZE - 1) >> PAGE_SHIFT;
-	end_pfn = memory_end >> PAGE_SHIFT;
-
-	/*
-	 * Initialize the boot-time allocator
-	 */
-	bootmap_size = init_bootmem(start_pfn, end_pfn);
-
-	/*
-	 * Register RAM areas with the bootmem allocator.
-	 */
-	for (i = 0; i < 16 && memory_chunk[i].size > 0; i++) {
-		unsigned long start_chunk, end_chunk;
-
-		if (memory_chunk[i].type != CHUNK_READ_WRITE)
-			continue;
-		start_chunk = (memory_chunk[i].addr + PAGE_SIZE - 1);
-		start_chunk >>= PAGE_SHIFT;
-		end_chunk = (memory_chunk[i].addr + memory_chunk[i].size);
-		end_chunk >>= PAGE_SHIFT;
-		if (start_chunk < start_pfn)
-			start_chunk = start_pfn;
-		if (end_chunk > end_pfn)
-			end_chunk = end_pfn;
-		if (start_chunk < end_chunk)
-			free_bootmem(start_chunk << PAGE_SHIFT,
-				     (end_chunk - start_chunk) << PAGE_SHIFT);
-	}
-	
-        /*
-         * Reserve the bootmem bitmap itself as well. We do this in two
-         * steps (first step was init_bootmem()) because this catches
-         * the (very unlikely) case of us accidentally initializing the
-         * bootmem allocator with an invalid RAM area.
-         */
-        reserve_bootmem(start_pfn << PAGE_SHIFT, bootmap_size);
-
-#ifdef CONFIG_BLK_DEV_INITRD
-        if (INITRD_START) {
-		if (INITRD_START + INITRD_SIZE <= memory_end) {
-			reserve_bootmem(INITRD_START, INITRD_SIZE);
-			initrd_start = INITRD_START;
-			initrd_end = initrd_start + INITRD_SIZE;
-		} else {
-                        printk("initrd extends beyond end of memory "
-                               "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
-                               initrd_start + INITRD_SIZE, memory_end);
-                        initrd_start = initrd_end = 0;
-		}
-        }
-#endif
-
-        /*
-         * Setup lowcore for boot cpu
-         */
-	lc = (struct _lowcore *) __alloc_bootmem(2*PAGE_SIZE, 2*PAGE_SIZE, 0);
-	memset(lc, 0, 2*PAGE_SIZE);
-	lc->restart_psw.mask = PSW_BASE_BITS;
-	lc->restart_psw.addr = (addr_t) &restart_int_handler;
-	lc->external_new_psw.mask = PSW_KERNEL_BITS;
-	lc->external_new_psw.addr = (addr_t) &ext_int_handler;
-	lc->svc_new_psw.mask = PSW_KERNEL_BITS;
-	lc->svc_new_psw.addr = (addr_t) &system_call;
-	lc->program_new_psw.mask = PSW_KERNEL_BITS;
-	lc->program_new_psw.addr = (addr_t) &pgm_check_handler;
-	lc->mcck_new_psw.mask = PSW_KERNEL_BITS;
-	lc->mcck_new_psw.addr = (addr_t) &mcck_int_handler;
-	lc->io_new_psw.mask = PSW_KERNEL_BITS;
-	lc->io_new_psw.addr = (addr_t) &io_int_handler;
-	lc->ipl_device = S390_lowcore.ipl_device;
-	lc->kernel_stack = ((__u64) &init_thread_union) + 16384;
-	lc->async_stack = (__u64)
-		__alloc_bootmem(4*PAGE_SIZE, 4*PAGE_SIZE, 0) + 16384;
-	lc->jiffy_timer = -1LL;
-	if (MACHINE_HAS_DIAG44)
-		lc->diag44_opcode = 0x83000044;
-	else
-		lc->diag44_opcode = 0x07000700;
-	set_prefix((__u32)(__u64) lc);
-        cpu_init();
-        __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
-
-	/*
-	 * Create kernel page tables and switch to virtual addressing.
-	 */
-        paging_init();
-
-	res = alloc_bootmem_low(sizeof(struct resource));
-	res->start = 0;
-	res->end = memory_end;
-	res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-	request_resource(&iomem_resource, res);
-	request_resource(res, &code_resource);
-	request_resource(res, &data_resource);
-
-        /* Setup default console */
-	conmode_default();
-}
-
-void print_cpu_info(struct cpuinfo_S390 *cpuinfo)
-{
-   printk("cpu %d "
-#ifdef CONFIG_SMP
-           "phys_idx=%d "
-#endif
-           "vers=%02X ident=%06X machine=%04X unused=%04X\n",
-           cpuinfo->cpu_nr,
-#ifdef CONFIG_SMP
-           cpuinfo->cpu_addr,
-#endif
-           cpuinfo->cpu_id.version,
-           cpuinfo->cpu_id.ident,
-           cpuinfo->cpu_id.machine,
-           cpuinfo->cpu_id.unused);
-}
-
-/*
- * show_cpuinfo - Get information on one CPU for use by procfs.
- */
-
-static int show_cpuinfo(struct seq_file *m, void *v)
-{
-        struct cpuinfo_S390 *cpuinfo;
-	unsigned long n = (unsigned long) v - 1;
-
-	if (!n) {
-		seq_printf(m, "vendor_id       : IBM/S390\n"
-				"# processors    : %i\n"
-				"bogomips per cpu: %lu.%02lu\n",
-				num_online_cpus(), loops_per_jiffy/(500000/HZ),
-				(loops_per_jiffy/(5000/HZ))%100);
-	}
-	if (cpu_online_map & (1 << n)) {
-		if (smp_processor_id() == n)
-			cpuinfo = &S390_lowcore.cpu_data;
-		else
-			cpuinfo = &lowcore_ptr[n]->cpu_data;
-		seq_printf(m, "processor %li: "
-				"version = %02X,  "
-				"identification = %06X,  "
-				"machine = %04X\n",
-				n, cpuinfo->cpu_id.version,
-				cpuinfo->cpu_id.ident,
-				cpuinfo->cpu_id.machine);
-	}
-        return 0;
-}
-
-static void *c_start(struct seq_file *m, loff_t *pos)
-{
-	return *pos < NR_CPUS ? (void *)((unsigned long) *pos + 1) : NULL;
-}
-static void *c_next(struct seq_file *m, void *v, loff_t *pos)
-{
-	++*pos;
-	return c_start(m, pos);
-}
-static void c_stop(struct seq_file *m, void *v)
-{
-}
-struct seq_operations cpuinfo_op = {
-	.start	= c_start,
-	.next	= c_next,
-	.stop	= c_stop,
-	.show	= show_cpuinfo,
-};
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/signal.c linux-2.5.67-bk6/arch/s390x/kernel/signal.c
--- linux-2.5.67-bk5/arch/s390x/kernel/signal.c	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/signal.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,487 +0,0 @@
-/*
- *  arch/s390/kernel/signal.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *
- *    Based on Intel version
- * 
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
- */
-
-#include <linux/config.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/errno.h>
-#include <linux/wait.h>
-#include <linux/ptrace.h>
-#include <linux/unistd.h>
-#include <linux/stddef.h>
-#include <linux/tty.h>
-#include <linux/personality.h>
-#include <linux/binfmts.h>
-#include <asm/ucontext.h>
-#include <asm/uaccess.h>
-
-#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-
-typedef struct 
-{
-	__u8 callee_used_stack[__SIGNAL_FRAMESIZE];
-	struct sigcontext sc;
-	_sigregs sregs;
-	__u8 retcode[S390_SYSCALL_SIZE];
-} sigframe;
-
-typedef struct 
-{
-	__u8 callee_used_stack[__SIGNAL_FRAMESIZE];
-	__u8 retcode[S390_SYSCALL_SIZE];
-	struct siginfo info;
-	struct ucontext uc;
-} rt_sigframe;
-
-asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
-
-/*
- * Atomically swap in the new signal mask, and wait for a signal.
- */
-asmlinkage int
-sys_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask)
-{
-	sigset_t saveset;
-
-	mask &= _BLOCKABLE;
-	spin_lock_irq(&current->sighand->siglock);
-	saveset = current->blocked;
-	siginitset(&current->blocked, mask);
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-	regs->gprs[2] = -EINTR;
-
-	while (1) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule();
-		if (do_signal(regs, &saveset))
-			return -EINTR;
-	}
-}
-
-asmlinkage int
-sys_rt_sigsuspend(struct pt_regs * regs,sigset_t *unewset, size_t sigsetsize)
-{
-	sigset_t saveset, newset;
-
-	/* XXX: Don't preclude handling different sized sigset_t's.  */
-	if (sigsetsize != sizeof(sigset_t))
-		return -EINVAL;
-
-	if (copy_from_user(&newset, unewset, sizeof(newset)))
-		return -EFAULT;
-	sigdelsetmask(&newset, ~_BLOCKABLE);
-
-	spin_lock_irq(&current->sighand->siglock);
-	saveset = current->blocked;
-	current->blocked = newset;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-	regs->gprs[2] = -EINTR;
-
-	while (1) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule();
-		if (do_signal(regs, &saveset))
-			return -EINTR;
-	}
-}
-
-asmlinkage int 
-sys_sigaction(int sig, const struct old_sigaction *act,
-	      struct old_sigaction *oact)
-{
-	struct k_sigaction new_ka, old_ka;
-	int ret;
-
-	if (act) {
-		old_sigset_t mask;
-		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
-		    __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
-		    __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
-			return -EFAULT;
-		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
-		__get_user(mask, &act->sa_mask);
-		siginitset(&new_ka.sa.sa_mask, mask);
-	}
-
-	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-	if (!ret && oact) {
-		if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
-		    __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
-		    __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
-			return -EFAULT;
-		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-	}
-
-	return ret;
-}
-
-asmlinkage int
-sys_sigaltstack(const stack_t *uss, stack_t *uoss, struct pt_regs *regs)
-{
-	return do_sigaltstack(uss, uoss, regs->gprs[15]);
-}
-
-
-
-/* Returns non-zero on fault */
-static int save_sigregs(struct pt_regs *regs, _sigregs *sregs)
-{
-	int err;
-  
-	err = __copy_to_user(&sregs->regs, regs, sizeof(_s390_regs_common));
-	if (err != 0)
-		return err;
-	save_fp_regs(&current->thread.fp_regs);
-	return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs,
-			      sizeof(s390_fp_regs));
-}
-
-/* Returns positive number on error */
-static int restore_sigregs(struct pt_regs *regs, _sigregs *sregs)
-{
-	int err;
-
-	err = __copy_from_user(regs, &sregs->regs, sizeof(_s390_regs_common));
-	regs->psw.mask = PSW_USER_BITS | (regs->psw.mask & PSW_MASK_CC);
-	if (err)
-		return err;
-
-	err = __copy_from_user(&current->thread.fp_regs, &sregs->fpregs,
-			       sizeof(s390_fp_regs));
-	current->thread.fp_regs.fpc &= FPC_VALID_MASK;
-	if (err)
-		return err;
-
-	restore_fp_regs(&current->thread.fp_regs);
-	regs->trap = -1;	/* disable syscall checks */
-	return 0;
-}
-
-asmlinkage long sys_sigreturn(struct pt_regs *regs)
-{
-	sigframe *frame = (sigframe *)regs->gprs[15];
-	sigset_t set;
-
-	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
-		goto badframe;
-	if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE))
-		goto badframe;
-
-	sigdelsetmask(&set, ~_BLOCKABLE);
-	spin_lock_irq(&current->sighand->siglock);
-	current->blocked = set;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-
-	if (restore_sigregs(regs, &frame->sregs))
-		goto badframe;
-
-	return regs->gprs[2];
-
-badframe:
-	force_sig(SIGSEGV, current);
-	return 0;
-}
-
-asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
-{
-	rt_sigframe *frame = (rt_sigframe *)regs->gprs[15];
-	sigset_t set;
-
-	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
-		goto badframe;
-	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
-		goto badframe;
-
-	sigdelsetmask(&set, ~_BLOCKABLE);
-	spin_lock_irq(&current->sighand->siglock);
-	current->blocked = set;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-
-	if (restore_sigregs(regs, &frame->uc.uc_mcontext))
-		goto badframe;
-
-	/* It is more difficult to avoid calling this function than to
-	   call it and ignore errors.  */
-	do_sigaltstack(&frame->uc.uc_stack, NULL, regs->gprs[15]);
-	return regs->gprs[2];
-
-badframe:
-	force_sig(SIGSEGV, current);
-	return 0;
-}
-
-/*
- * Set up a signal frame.
- */
-
-
-/*
- * Determine which stack to use..
- */
-static inline void *
-get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
-{
-	unsigned long sp;
-
-	/* Default to using normal stack */
-	sp = regs->gprs[15];
-
-	/* This is the X/Open sanctioned signal stack switching.  */
-	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (! on_sig_stack(sp))
-			sp = current->sas_ss_sp + current->sas_ss_size;
-	}
-
-	/* This is the legacy signal stack switching. */
-	else if (!user_mode(regs) &&
-		 !(ka->sa.sa_flags & SA_RESTORER) &&
-		 ka->sa.sa_restorer) {
-		sp = (unsigned long) ka->sa.sa_restorer;
-	}
-
-	return (void *)((sp - frame_size) & -8ul);
-}
-
-static inline int map_signal(int sig)
-{
-	if (current_thread_info()->exec_domain
-	    && current_thread_info()->exec_domain->signal_invmap
-	    && sig < 32)
-		return current_thread_info()->exec_domain->signal_invmap[sig];
-	else
-		return sig;
-}
-
-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));
-	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe)))
-		goto give_sigsegv;
-
-	if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE))
-		goto give_sigsegv;
-
-	if (save_sigregs(regs, &frame->sregs))
-		goto give_sigsegv;
-	if (__put_user(&frame->sregs, &frame->sc.sregs))
-		goto give_sigsegv;
-
-	/* Set up to return from userspace.  If provided, use a stub
-	   already in userspace.  */
-	if (ka->sa.sa_flags & SA_RESTORER) {
-                regs->gprs[14] = (__u64) ka->sa.sa_restorer;
-	} else {
-                regs->gprs[14] = (__u64) frame->retcode;
-		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn, 
-	                       (u16 *)(frame->retcode)))
-			goto give_sigsegv;
-	}
-
-	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
-		goto give_sigsegv;
-
-	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u64) frame;
-	regs->psw.addr = (__u64) ka->sa.sa_handler;
-	regs->psw.mask = PSW_USER_BITS;
-
-	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u64) &frame->sc;
-
-	/* We forgot to include these in the sigcontext.
-	   To avoid breaking binary compatibility, they are passed as args. */
-	regs->gprs[4] = current->thread.trap_no;
-	regs->gprs[5] = current->thread.prot_addr;
-	return;
-
-give_sigsegv:
-	if (sig == SIGSEGV)
-		ka->sa.sa_handler = SIG_DFL;
-	force_sig(SIGSEGV, current);
-}
-
-static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-			   sigset_t *set, struct pt_regs * regs)
-{
-	int err = 0;
-	rt_sigframe *frame = get_sigframe(ka, regs, sizeof(rt_sigframe));
-	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe)))
-		goto give_sigsegv;
-
-	if (copy_siginfo_to_user(&frame->info, info))
-		goto give_sigsegv;
-
-	/* Create the ucontext.  */
-	err |= __put_user(0, &frame->uc.uc_flags);
-	err |= __put_user(0, &frame->uc.uc_link);
-	err |= __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
-	err |= __put_user(sas_ss_flags(regs->gprs[15]),
-			  &frame->uc.uc_stack.ss_flags);
-	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
-	err |= save_sigregs(regs, &frame->uc.uc_mcontext);
-	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
-	if (err)
-		goto give_sigsegv;
-
-	/* Set up to return from userspace.  If provided, use a stub
-	   already in userspace.  */
-	if (ka->sa.sa_flags & SA_RESTORER) {
-                regs->gprs[14] = (__u64) ka->sa.sa_restorer;
-	} else {
-                regs->gprs[14] = (__u64) frame->retcode;
-		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn, 
-	                          (u16 *)(frame->retcode));
-	}
-
-	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (addr_t *) frame))
-		goto give_sigsegv;
-
-	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u64) frame;
-	regs->psw.addr = (__u64) ka->sa.sa_handler;
-	regs->psw.mask = PSW_USER_BITS;
-
-	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u64) &frame->info;
-	regs->gprs[4] = (__u64) &frame->uc;
-	return;
-
-give_sigsegv:
-	if (sig == SIGSEGV)
-		ka->sa.sa_handler = SIG_DFL;
-	force_sig(SIGSEGV, current);
-}
-
-/*
- * OK, we're invoking a handler
- */	
-
-static void
-handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
-	struct pt_regs * regs)
-{
-	struct k_sigaction *ka = &current->sighand->action[sig-1];
-
-	/* Are we from a system call? */
-	if (regs->trap == __LC_SVC_OLD_PSW) {
-		/* If so, check system call restarting.. */
-		switch (regs->gprs[2]) {
-			case -ERESTART_RESTARTBLOCK:
-				current_thread_info()->restart_block.fn =
-					do_no_restart_syscall;
-				clear_thread_flag(TIF_RESTART_SVC);
-			case -ERESTARTNOHAND:
-				regs->gprs[2] = -EINTR;
-				break;
-
-			case -ERESTARTSYS:
-				if (!(ka->sa.sa_flags & SA_RESTART)) {
-					regs->gprs[2] = -EINTR;
-					break;
-				}
-			/* fallthrough */
-			case -ERESTARTNOINTR:
-				regs->gprs[2] = regs->orig_gpr2;
-				regs->psw.addr -= 2;
-		}
-	}
-
-	/* Set up the stack frame */
-	if (ka->sa.sa_flags & SA_SIGINFO)
-		setup_rt_frame(sig, ka, info, oldset, regs);
-	else
-		setup_frame(sig, ka, oldset, regs);
-
-	if (ka->sa.sa_flags & SA_ONESHOT)
-		ka->sa.sa_handler = SIG_DFL;
-
-	if (!(ka->sa.sa_flags & SA_NODEFER)) {
-		spin_lock_irq(&current->sighand->siglock);
-		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
-		sigaddset(&current->blocked,sig);
-		recalc_sigpending();
-		spin_unlock_irq(&current->sighand->siglock);
-	}
-}
-
-/*
- * Note that 'init' is a special process: it doesn't get signals it doesn't
- * want to handle. Thus you cannot kill init even with a SIGKILL even by
- * mistake.
- *
- * Note that we go through the signals twice: once to check the signals that
- * the kernel can handle, and then we build all the user-level signal handling
- * stack-frames in one go after that.
- */
-int do_signal(struct pt_regs *regs, sigset_t *oldset)
-{
-	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 (!oldset)
-		oldset = &current->blocked;
-#ifdef CONFIG_S390_SUPPORT 
-	if (test_thread_flag(TIF_31BIT)) {
-		extern asmlinkage int do_signal32(struct pt_regs *regs, sigset_t *oldset); 
-		return do_signal32(regs, oldset);
-        }
-#endif 
-
-	signr = get_signal_to_deliver(&info, regs, NULL);
-	if (signr > 0) {
-		/* Whee!  Actually deliver the signal.  */
-		handle_signal(signr, &info, oldset, regs);
-		return 1;
-	}
-
-	/* Did we come from a system call? */
-	if ( regs->trap == __LC_SVC_OLD_PSW /* System Call! */ ) {
-		/* Restart the system call - no handlers present */
-		if (regs->gprs[2] == -ERESTARTNOHAND ||
-		    regs->gprs[2] == -ERESTARTSYS ||
-		    regs->gprs[2] == -ERESTARTNOINTR) {
-			regs->gprs[2] = regs->orig_gpr2;
-			regs->psw.addr -= 2;
-		}
-		/* Restart the system call with a new system call number */
-		if (regs->gprs[2] == -ERESTART_RESTARTBLOCK) {
-			regs->gprs[2] = __NR_restart_syscall;
-			set_thread_flag(TIF_RESTART_SVC);
-		}
-	}
-	return 0;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/signal32.c linux-2.5.67-bk6/arch/s390x/kernel/signal32.c
--- linux-2.5.67-bk5/arch/s390x/kernel/signal32.c	2003-04-07 10:31:15.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/signal32.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,643 +0,0 @@
-/*
- *  arch/s390/kernel/signal32.c
- *
- *  S390 version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *               Gerhard Tonn (ton@de.ibm.com)                  
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *
- *  1997-11-28  Modified for POSIX.1b signals by Richard Henderson
- */
-
-#include <linux/config.h>
-#include <linux/compat.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/errno.h>
-#include <linux/wait.h>
-#include <linux/ptrace.h>
-#include <linux/unistd.h>
-#include <linux/stddef.h>
-#include <linux/tty.h>
-#include <linux/personality.h>
-#include <linux/binfmts.h>
-#include <asm/ucontext.h>
-#include <asm/uaccess.h>
-#include "linux32.h"
-#include "ptrace32.h"
-
-#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-typedef struct 
-{
-	__u8 callee_used_stack[__SIGNAL_FRAMESIZE32];
-	struct sigcontext32 sc;
-	_sigregs32 sregs;
-	__u8 retcode[S390_SYSCALL_SIZE];
-} sigframe32;
-
-typedef struct 
-{
-	__u8 callee_used_stack[__SIGNAL_FRAMESIZE32];
-	__u8 retcode[S390_SYSCALL_SIZE];
-	struct siginfo32 info;
-	struct ucontext32 uc;
-} rt_sigframe32;
-
-asmlinkage int FASTCALL(do_signal(struct pt_regs *regs, sigset_t *oldset));
-
-int do_signal32(struct pt_regs *regs, sigset_t *oldset);
-
-int copy_siginfo_to_user32(siginfo_t32 *to, siginfo_t *from)
-{
-	int err;
-
-	if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t32)))
-		return -EFAULT;
-
-	/* If you change siginfo_t structure, please be sure
-	   this code is fixed accordingly.
-	   It should never copy any pad contained in the structure
-	   to avoid security leaks, but must copy the generic
-	   3 ints plus the relevant union member.  
-	   This routine must convert siginfo from 64bit to 32bit as well
-	   at the same time.  */
-	err = __put_user(from->si_signo, &to->si_signo);
-	err |= __put_user(from->si_errno, &to->si_errno);
-	err |= __put_user((short)from->si_code, &to->si_code);
-	if (from->si_code < 0)
-		err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
-	else {
-		switch (from->si_code >> 16) {
-		case __SI_KILL >> 16:
-			err |= __put_user(from->si_pid, &to->si_pid);
-			err |= __put_user(from->si_uid, &to->si_uid);
-			break;
-		case __SI_CHLD >> 16:
-			err |= __put_user(from->si_pid, &to->si_pid);
-			err |= __put_user(from->si_uid, &to->si_uid);
-			err |= __put_user(from->si_utime, &to->si_utime);
-			err |= __put_user(from->si_stime, &to->si_stime);
-			err |= __put_user(from->si_status, &to->si_status);
-			break;
-		case __SI_FAULT >> 16:
-			err |= __put_user((unsigned long) from->si_addr,
-					  &to->si_addr);
-			break;
-		case __SI_POLL >> 16:
-		case __SI_TIMER >> 16:
-			err |= __put_user(from->si_band, &to->si_band);
-			err |= __put_user(from->si_fd, &to->si_fd);
-			break;
-		default:
-			break;
-		/* case __SI_RT: This is not generated by the kernel as of now.  */
-		}
-	}
-	return err;
-}
-
-/*
- * Atomically swap in the new signal mask, and wait for a signal.
- */
-asmlinkage int
-sys32_sigsuspend(struct pt_regs * regs,int history0, int history1, old_sigset_t mask)
-{
-	sigset_t saveset;
-
-	mask &= _BLOCKABLE;
-	spin_lock_irq(&current->sighand->siglock);
-	saveset = current->blocked;
-	siginitset(&current->blocked, mask);
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-	regs->gprs[2] = -EINTR;
-
-	while (1) {
-		set_current_state(TASK_INTERRUPTIBLE);
-		schedule();
-		if (do_signal32(regs, &saveset))
-			return -EINTR;
-	}
-}
-
-asmlinkage int
-sys32_rt_sigsuspend(struct pt_regs * regs,compat_sigset_t *unewset, size_t sigsetsize)
-{
-	sigset_t saveset, newset;
-	compat_sigset_t set32;
-
-	/* XXX: Don't preclude handling different sized sigset_t's.  */
-	if (sigsetsize != sizeof(sigset_t))
-		return -EINVAL;
-
-	if (copy_from_user(&set32, unewset, sizeof(set32)))
-		return -EFAULT;
-	switch (_NSIG_WORDS) {
-	case 4: newset.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32);
-	case 3: newset.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32);
-	case 2: newset.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32);
-	case 1: newset.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32);
-	}
-        sigdelsetmask(&newset, ~_BLOCKABLE);
-
-        spin_lock_irq(&current->sighand->siglock);
-        saveset = current->blocked;
-        current->blocked = newset;
-        recalc_sigpending();
-        spin_unlock_irq(&current->sighand->siglock);
-        regs->gprs[2] = -EINTR;
-
-        while (1) {
-                set_current_state(TASK_INTERRUPTIBLE);
-                schedule();
-                if (do_signal32(regs, &saveset))
-                        return -EINTR;
-        }
-}                                                         
-
-asmlinkage int
-sys32_sigaction(int sig, const struct old_sigaction32 *act,
-		 struct old_sigaction32 *oact)
-{
-        struct k_sigaction new_ka, old_ka;
-        int ret;
-
-        if (act) {
-		compat_old_sigset_t mask;
-		if (verify_area(VERIFY_READ, act, sizeof(*act)) ||
-		    __get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler) ||
-		    __get_user((unsigned long)new_ka.sa.sa_restorer, &act->sa_restorer))
-			return -EFAULT;
-		__get_user(new_ka.sa.sa_flags, &act->sa_flags);
-		__get_user(mask, &act->sa_mask);
-		siginitset(&new_ka.sa.sa_mask, mask);
-        }
-
-        ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-	if (!ret && oact) {
-		if (verify_area(VERIFY_WRITE, oact, sizeof(*oact)) ||
-		    __put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler) ||
-		    __put_user((unsigned long)old_ka.sa.sa_restorer, &oact->sa_restorer))
-			return -EFAULT;
-		__put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-		__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-        }
-
-	return ret;
-}
-
-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)
-{
-	struct k_sigaction new_ka, old_ka;
-	int ret;
-	compat_sigset_t set32;
-
-	/* XXX: Don't preclude handling different sized sigset_t's.  */
-	if (sigsetsize != sizeof(compat_sigset_t))
-		return -EINVAL;
-
-	if (act) {
-		ret = get_user((unsigned long)new_ka.sa.sa_handler, &act->sa_handler);
-		ret |= __copy_from_user(&set32, &act->sa_mask,
-					sizeof(compat_sigset_t));
-		switch (_NSIG_WORDS) {
-		case 4: new_ka.sa.sa_mask.sig[3] = set32.sig[6]
-				| (((long)set32.sig[7]) << 32);
-		case 3: new_ka.sa.sa_mask.sig[2] = set32.sig[4]
-				| (((long)set32.sig[5]) << 32);
-		case 2: new_ka.sa.sa_mask.sig[1] = set32.sig[2]
-				| (((long)set32.sig[3]) << 32);
-		case 1: new_ka.sa.sa_mask.sig[0] = set32.sig[0]
-				| (((long)set32.sig[1]) << 32);
-		}
-		ret |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
-		
-		if (ret)
-			return -EFAULT;
-	}
-
-	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-	if (!ret && oact) {
-		switch (_NSIG_WORDS) {
-		case 4:
-			set32.sig[7] = (old_ka.sa.sa_mask.sig[3] >> 32);
-			set32.sig[6] = old_ka.sa.sa_mask.sig[3];
-		case 3:
-			set32.sig[5] = (old_ka.sa.sa_mask.sig[2] >> 32);
-			set32.sig[4] = old_ka.sa.sa_mask.sig[2];
-		case 2:
-			set32.sig[3] = (old_ka.sa.sa_mask.sig[1] >> 32);
-			set32.sig[2] = old_ka.sa.sa_mask.sig[1];
-		case 1:
-			set32.sig[1] = (old_ka.sa.sa_mask.sig[0] >> 32);
-			set32.sig[0] = old_ka.sa.sa_mask.sig[0];
-		}
-		ret = put_user((unsigned long)old_ka.sa.sa_handler, &oact->sa_handler);
-		ret |= __copy_to_user(&oact->sa_mask, &set32,
-				      sizeof(compat_sigset_t));
-		ret |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-	}
-
-	return ret;
-}
-
-asmlinkage int
-sys32_sigaltstack(const stack_t32 *uss, stack_t32 *uoss, struct pt_regs *regs)
-{
-	stack_t kss, koss;
-	int ret, err = 0;
-	mm_segment_t old_fs = get_fs();
-
-	if (uss) {
-		if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
-			return -EFAULT;
-		err |= __get_user((unsigned long) kss.ss_sp, &uss->ss_sp);
-		err |= __get_user(kss.ss_size, &uss->ss_size);
-		err |= __get_user(kss.ss_flags, &uss->ss_flags);
-		if (err)
-			return -EFAULT;
-	}
-
-	set_fs (KERNEL_DS);
-	ret = do_sigaltstack(uss ? &kss : NULL , uoss ? &koss : NULL, regs->gprs[15]);
-	set_fs (old_fs);
-
-	if (!ret && uoss) {
-		if (!access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)))
-			return -EFAULT;
-		err |= __put_user((unsigned long) koss.ss_sp, &uoss->ss_sp);
-		err |= __put_user(koss.ss_size, &uoss->ss_size);
-		err |= __put_user(koss.ss_flags, &uoss->ss_flags);
-		if (err)
-			return -EFAULT;
-	}
-	return ret;
-}
-
-static int save_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
-{
-	_s390_regs_common32 regs32;
-	int err, i;
-
-	regs32.psw.mask = PSW32_USER_BITS |
-		((__u32)(regs->psw.mask >> 32) & PSW32_MASK_CC);
-	regs32.psw.addr = PSW32_ADDR_AMODE31 | (__u32) regs->psw.addr;
-	for (i = 0; i < NUM_GPRS; i++)
-		regs32.gprs[i] = (__u32) regs->gprs[i];
-	memcpy(regs32.acrs, regs->acrs, sizeof(regs32.acrs));
-	err = __copy_to_user(&sregs->regs, &regs32, sizeof(regs32));
-	if (err)
-		return err;
-	save_fp_regs(&current->thread.fp_regs);
-	/* s390_fp_regs and _s390_fp_regs32 are the same ! */
-	return __copy_to_user(&sregs->fpregs, &current->thread.fp_regs,
-			      sizeof(_s390_fp_regs32));
-}
-
-static int restore_sigregs32(struct pt_regs *regs,_sigregs32 *sregs)
-{
-	_s390_regs_common32 regs32;
-	int err, i;
-
-	err = __copy_from_user(&regs32, &sregs->regs, sizeof(regs32));
-	if (err)
-		return err;
-	regs->psw.mask = PSW_USER32_BITS |
-		(__u64)(regs32.psw.mask & PSW32_MASK_CC) << 32;
-	regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN);
-	for (i = 0; i < NUM_GPRS; i++)
-		regs->gprs[i] = (__u64) regs32.gprs[i];
-	memcpy(regs->acrs, regs32.acrs, sizeof(regs32.acrs));
-
-	err = __copy_from_user(&current->thread.fp_regs, &sregs->fpregs,
-			       sizeof(_s390_fp_regs32));
-	current->thread.fp_regs.fpc &= FPC_VALID_MASK;
-	if (err)
-		return err;
-
-	restore_fp_regs(&current->thread.fp_regs);
-	regs->trap = -1;	/* disable syscall checks */
-	return 0;
-}
-
-asmlinkage long sys32_sigreturn(struct pt_regs *regs)
-{
-	sigframe32 *frame = (sigframe32 *)regs->gprs[15];
-	sigset_t set;
-
-	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
-		goto badframe;
-	if (__copy_from_user(&set.sig, &frame->sc.oldmask, _SIGMASK_COPY_SIZE32))
-		goto badframe;
-
-	sigdelsetmask(&set, ~_BLOCKABLE);
-	spin_lock_irq(&current->sighand->siglock);
-	current->blocked = set;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-
-	if (restore_sigregs32(regs, &frame->sregs))
-		goto badframe;
-
-	return regs->gprs[2];
-
-badframe:
-	force_sig(SIGSEGV, current);
-	return 0;
-}	
-
-asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
-{
-	rt_sigframe32 *frame = (rt_sigframe32 *)regs->gprs[15];
-	sigset_t set;
-	stack_t st;
-	__u32 ss_sp;
-	int err;
-	mm_segment_t old_fs = get_fs();
-
-	if (verify_area(VERIFY_READ, frame, sizeof(*frame)))
-		goto badframe;
-	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
-		goto badframe;
-
-	sigdelsetmask(&set, ~_BLOCKABLE);
-	spin_lock_irq(&current->sighand->siglock);
-	current->blocked = set;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sighand->siglock);
-
-	if (restore_sigregs32(regs, &frame->uc.uc_mcontext))
-		goto badframe;
-
-	err = __get_user(ss_sp, &frame->uc.uc_stack.ss_sp);
-	st.ss_sp = (void *) A((unsigned long)ss_sp);
-	err |= __get_user(st.ss_size, &frame->uc.uc_stack.ss_size);
-	err |= __get_user(st.ss_flags, &frame->uc.uc_stack.ss_flags);
-	if (err)
-		goto badframe; 
-
-	/* 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 (old_fs);
-
-	return regs->gprs[2];
-
-badframe:
-        force_sig(SIGSEGV, current);
-        return 0;
-}	
-
-/*
- * Set up a signal frame.
- */
-
-
-/*
- * Determine which stack to use..
- */
-static inline void *
-get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
-{
-	unsigned long sp;
-
-	/* Default to using normal stack */
-	sp = (unsigned long) A(regs->gprs[15]);
-
-	/* This is the X/Open sanctioned signal stack switching.  */
-	if (ka->sa.sa_flags & SA_ONSTACK) {
-		if (! on_sig_stack(sp))
-			sp = current->sas_ss_sp + current->sas_ss_size;
-	}
-
-	/* This is the legacy signal stack switching. */
-	else if (!user_mode(regs) &&
-		 !(ka->sa.sa_flags & SA_RESTORER) &&
-		 ka->sa.sa_restorer) {
-		sp = (unsigned long) ka->sa.sa_restorer;
-	}
-
-	return (void *)((sp - frame_size) & -8ul);
-}
-
-static inline int map_signal(int sig)
-{
-	if (current_thread_info()->exec_domain
-	    && current_thread_info()->exec_domain->signal_invmap
-	    && sig < 32)
-		return current_thread_info()->exec_domain->signal_invmap[sig];
-        else
-		return sig;
-}
-
-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));
-	if (!access_ok(VERIFY_WRITE, frame, sizeof(sigframe32)))
-		goto give_sigsegv;
-
-	if (__copy_to_user(&frame->sc.oldmask, &set->sig, _SIGMASK_COPY_SIZE32))
-		goto give_sigsegv;
-
-	if (save_sigregs32(regs, &frame->sregs))
-		goto give_sigsegv;
-	if (__put_user((unsigned long) &frame->sregs, &frame->sc.sregs))
-		goto give_sigsegv;
-
-	/* Set up to return from userspace.  If provided, use a stub
-	   already in userspace.  */
-	if (ka->sa.sa_flags & SA_RESTORER) {
-		regs->gprs[14] = (__u64) ka->sa.sa_restorer;
-	} else {
-		regs->gprs[14] = (__u64) frame->retcode;
-		if (__put_user(S390_SYSCALL_OPCODE | __NR_sigreturn,
-		               (u16 *)(frame->retcode)))
-			goto give_sigsegv;
-        }
-
-	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
-		goto give_sigsegv;
-
-	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u64) frame;
-	regs->psw.addr = (__u64) ka->sa.sa_handler;
-	regs->psw.mask = PSW_USER32_BITS;
-
-	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u64) &frame->sc;
-
-	/* We forgot to include these in the sigcontext.
-	   To avoid breaking binary compatibility, they are passed as args. */
-	regs->gprs[4] = current->thread.trap_no;
-	regs->gprs[5] = current->thread.prot_addr;
-	return;
-
-give_sigsegv:
-	if (sig == SIGSEGV)
-		ka->sa.sa_handler = SIG_DFL;
-	force_sig(SIGSEGV, current);
-}
-
-static void setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info,
-			   sigset_t *set, struct pt_regs * regs)
-{
-	int err = 0;
-	rt_sigframe32 *frame = get_sigframe(ka, regs, sizeof(rt_sigframe32));
-	if (!access_ok(VERIFY_WRITE, frame, sizeof(rt_sigframe32)))
-		goto give_sigsegv;
-
-	if (copy_siginfo_to_user32(&frame->info, info))
-		goto give_sigsegv;
-
-	/* Create the ucontext.  */
-	err |= __put_user(0, &frame->uc.uc_flags);
-	err |= __put_user(0, &frame->uc.uc_link);
-	err |= __put_user(current->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
-	err |= __put_user(sas_ss_flags(regs->gprs[15]),
-	                  &frame->uc.uc_stack.ss_flags);
-	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
-	err |= save_sigregs32(regs, &frame->uc.uc_mcontext);
-	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
-	if (err)
-		goto give_sigsegv;
-
-	/* Set up to return from userspace.  If provided, use a stub
-	   already in userspace.  */
-	if (ka->sa.sa_flags & SA_RESTORER) {
-		regs->gprs[14] = (__u64) ka->sa.sa_restorer;
-	} else {
-		regs->gprs[14] = (__u64) frame->retcode;
-		err |= __put_user(S390_SYSCALL_OPCODE | __NR_rt_sigreturn,
-		                  (u16 *)(frame->retcode));
-	}
-
-	/* Set up backchain. */
-	if (__put_user(regs->gprs[15], (unsigned int *) frame))
-		goto give_sigsegv;
-
-	/* Set up registers for signal handler */
-	regs->gprs[15] = (__u64) frame;
-	regs->psw.addr = (__u64) ka->sa.sa_handler;
-	regs->psw.mask = PSW_USER32_BITS;
-
-	regs->gprs[2] = map_signal(sig);
-	regs->gprs[3] = (__u64) &frame->info;
-	regs->gprs[4] = (__u64) &frame->uc;
-	return;
-
-give_sigsegv:
-	if (sig == SIGSEGV)
-		ka->sa.sa_handler = SIG_DFL;
-	force_sig(SIGSEGV, current);
-}
-
-/*
- * OK, we're invoking a handler
- */	
-
-static void
-handle_signal32(unsigned long sig, siginfo_t *info, sigset_t *oldset,
-	struct pt_regs * regs)
-{
-	struct k_sigaction *ka = &current->sighand->action[sig-1];
-
-	/* Are we from a system call? */
-	if (regs->trap == __LC_SVC_OLD_PSW) {
-		/* If so, check system call restarting.. */
-		switch (regs->gprs[2]) {
-			case -ERESTARTNOHAND:
-				regs->gprs[2] = -EINTR;
-				break;
-
-			case -ERESTARTSYS:
-				if (!(ka->sa.sa_flags & SA_RESTART)) {
-					regs->gprs[2] = -EINTR;
-					break;
-				}
-			/* fallthrough */
-			case -ERESTARTNOINTR:
-				regs->gprs[2] = regs->orig_gpr2;
-				regs->psw.addr -= 2;
-		}
-	}
-
-	/* Set up the stack frame */
-	if (ka->sa.sa_flags & SA_SIGINFO)
-		setup_rt_frame32(sig, ka, info, oldset, regs);
-	else
-		setup_frame32(sig, ka, oldset, regs);
-
-	if (ka->sa.sa_flags & SA_ONESHOT)
-		ka->sa.sa_handler = SIG_DFL;
-
-	if (!(ka->sa.sa_flags & SA_NODEFER)) {
-		spin_lock_irq(&current->sighand->siglock);
-		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
-		sigaddset(&current->blocked,sig);
-		recalc_sigpending();
-		spin_unlock_irq(&current->sighand->siglock);
-	}
-}
-
-/*
- * Note that 'init' is a special process: it doesn't get signals it doesn't
- * want to handle. Thus you cannot kill init even with a SIGKILL even by
- * mistake.
- *
- * Note that we go through the signals twice: once to check the signals that
- * the kernel can handle, and then we build all the user-level signal handling
- * stack-frames in one go after that.
- */
-int do_signal32(struct pt_regs *regs, sigset_t *oldset)
-{
-	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 (!oldset)
-		oldset = &current->blocked;
-
-	signr = get_signal_to_deliver(&info, regs, NULL);
-	if (signr > 0) {
-		/* Whee!  Actually deliver the signal.  */
-		handle_signal32(signr, &info, oldset, regs);
-		return 1;
-	}
-
-	/* Did we come from a system call? */
-	if ( regs->trap == __LC_SVC_OLD_PSW /* System Call! */ ) {
-		/* Restart the system call - no handlers present */
-		if (regs->gprs[2] == -ERESTARTNOHAND ||
-		    regs->gprs[2] == -ERESTARTSYS ||
-		    regs->gprs[2] == -ERESTARTNOINTR) {
-			regs->gprs[2] = regs->orig_gpr2;
-			regs->psw.addr -= 2;
-		}
-	}
-	return 0;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/smp.c linux-2.5.67-bk6/arch/s390x/kernel/smp.c
--- linux-2.5.67-bk5/arch/s390x/kernel/smp.c	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/smp.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,582 +0,0 @@
-/*
- *  arch/s390/kernel/smp.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  based on other smp stuff by 
- *    (c) 1995 Alan Cox, CymruNET Ltd  <alan@cymru.net>
- *    (c) 1998 Ingo Molnar
- *
- * We work with logical cpu numbering everywhere we can. The only
- * functions using the real cpu address (got from STAP) are the sigp
- * functions. For all other functions we use the identity mapping.
- * That means that cpu_number_map[i] == i for every cpu. cpu_number_map is
- * used e.g. to find the idle task belonging to a logical cpu. Every array
- * in the kernel is sorted by the logical cpu number and not by the physical
- * one which is causing all the confusion with __cpu_logical_map and
- * cpu_number_map in other architectures.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <linux/mm.h>
-#include <linux/spinlock.h>
-#include <linux/kernel_stat.h>
-#include <linux/smp_lock.h>
-
-#include <linux/delay.h>
-#include <linux/cache.h>
-
-#include <asm/sigp.h>
-#include <asm/pgalloc.h>
-#include <asm/irq.h>
-#include <asm/s390_ext.h>
-#include <asm/cpcmd.h>
-
-/* prototypes */
-extern int cpu_idle(void * unused);
-
-extern volatile int __cpu_logical_map[];
-
-/*
- * An array with a pointer the lowcore of every CPU.
- */
-
-struct _lowcore *lowcore_ptr[NR_CPUS];
-cycles_t         cacheflush_time=0;
-int              smp_threads_ready=0;      /* Set when the idlers are all forked. */
-
-volatile unsigned long cpu_online_map;
-volatile unsigned long cpu_possible_map;
-unsigned long    cache_decay_ticks = 0;
-
-/*
- * Reboot, halt and power_off routines for SMP.
- */
-extern char vmhalt_cmd[];
-extern char vmpoff_cmd[];
-
-extern void do_reipl(unsigned long devno);
-
-static sigp_ccode smp_ext_bitcall(int, ec_bit_sig);
-static void smp_ext_bitcall_others(ec_bit_sig);
-
-/*
- * Structure and data for smp_call_function(). This is designed to minimise
- * static memory requirements. It also looks cleaner.
- */
-static spinlock_t call_lock = SPIN_LOCK_UNLOCKED;
-
-struct call_data_struct {
-	void (*func) (void *info);
-	void *info;
-	atomic_t started;
-	atomic_t finished;
-	int wait;
-};
-
-static struct call_data_struct * call_data;
-
-/*
- * 'Call function' interrupt callback
- */
-static void do_call_function(void)
-{
-	void (*func) (void *info) = call_data->func;
-	void *info = call_data->info;
-	int wait = call_data->wait;
-
-	atomic_inc(&call_data->started);
-	(*func)(info);
-	if (wait)
-		atomic_inc(&call_data->finished);
-}
-
-/*
- * this function sends a 'generic call function' IPI to all other CPUs
- * in the system.
- */
-
-int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
-			int wait)
-/*
- * [SUMMARY] Run a function on all other CPUs.
- * <func> The function to run. This must be fast and non-blocking.
- * <info> An arbitrary pointer to pass to the function.
- * <nonatomic> currently unused.
- * <wait> If true, wait (atomically) until function has completed on other CPUs.
- * [RETURNS] 0 on success, else a negative status code. Does not return until
- * remote CPUs are nearly ready to execute <<func>> or are or have executed.
- *
- * You must not call this function with disabled interrupts or from a
- * hardware interrupt handler or from a bottom half handler.
- */
-{
-	struct call_data_struct data;
-	int cpus = num_online_cpus()-1;
-
-	/* FIXME: get cpu lock -hc */
-	if (cpus <= 0)
-		return 0;
-
-	data.func = func;
-	data.info = info;
-	atomic_set(&data.started, 0);
-	data.wait = wait;
-	if (wait)
-		atomic_set(&data.finished, 0);
-
-	spin_lock(&call_lock);
-	call_data = &data;
-	/* Send a message to all other CPUs and wait for them to respond */
-        smp_ext_bitcall_others(ec_call_function);
-
-	/* Wait for response */
-	while (atomic_read(&data.started) != cpus)
-		barrier();
-
-	if (wait)
-		while (atomic_read(&data.finished) != cpus)
-			barrier();
-	spin_unlock(&call_lock);
-
-	return 0;
-}
-
-static inline void do_send_stop(void)
-{
-        u32 dummy;
-        int i, rc;
-
-        /* stop all processors */
-        for (i =  0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i)
-			continue;
-		do {
-			rc = signal_processor_ps(&dummy, 0, i, sigp_stop);
-		} while (rc == sigp_busy);
-        }
-}
-
-static inline void do_store_status(void)
-{
-        unsigned long low_core_addr;
-        u32 dummy;
-        int i, rc;
-
-        /* store status of all processors in their lowcores (real 0) */
-        for (i =  0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i) 
-			continue;
-		low_core_addr = (unsigned long) lowcore_ptr[i];
-		do {
-			rc = signal_processor_ps(&dummy, low_core_addr, i,
-						 sigp_store_status_at_address);
-		} while(rc == sigp_busy);
-	}
-}
-
-/*
- * this function sends a 'stop' sigp to all other CPUs in the system.
- * it goes straight through.
- */
-void smp_send_stop(void)
-{
-	/* write magic number to zero page (absolute 0) */
-	lowcore_ptr[smp_processor_id()]->panic_magic = __PANIC_MAGIC;
-
-	/* stop other processors. */
-	do_send_stop();
-
-	/* store status of other processors. */
-	do_store_status();
-}
-
-/*
- * Reboot, halt and power_off routines for SMP.
- */
-static volatile unsigned long cpu_restart_map;
-
-static void do_machine_restart(void * __unused)
-{
-	clear_bit(smp_processor_id(), &cpu_restart_map);
-	if (smp_processor_id() == 0) {
-		/* Wait for all other cpus to enter do_machine_restart. */
-		while (cpu_restart_map != 0);
-		/* Store status of other cpus. */
-		do_store_status();
-		/*
-		 * Finally call reipl. Because we waited for all other
-		 * cpus to enter this function we know that they do
-		 * not hold any s390irq-locks (the cpus have been
-		 * interrupted by an external interrupt and s390irq
-		 * locks are always held disabled).
-		 */
-		if (MACHINE_IS_VM)
-			cpcmd ("IPL", NULL, 0);
-		else
-			do_reipl (0x10000 | S390_lowcore.ipl_device);
-	}
-	signal_processor(smp_processor_id(), sigp_stop);
-}
-
-void machine_restart_smp(char * __unused) 
-{
-	cpu_restart_map = cpu_online_map;
-        on_each_cpu(do_machine_restart, NULL, 0, 0);
-}
-
-static void do_machine_halt(void * __unused)
-{
-	if (smp_processor_id() == 0) {
-		smp_send_stop();
-		if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
-			cpcmd(vmhalt_cmd, NULL, 0);
-		signal_processor(smp_processor_id(),
-				 sigp_stop_and_store_status);
-	}
-	for (;;)
-		enabled_wait();
-}
-
-void machine_halt_smp(void)
-{
-        on_each_cpu(do_machine_halt, NULL, 0, 0);
-}
-
-static void do_machine_power_off(void * __unused)
-{
-	if (smp_processor_id() == 0) {
-		smp_send_stop();
-		if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
-			cpcmd(vmpoff_cmd, NULL, 0);
-		signal_processor(smp_processor_id(),
-				 sigp_stop_and_store_status);
-	}
-	for (;;)
-		enabled_wait();
-}
-
-void machine_power_off_smp(void)
-{
-        on_each_cpu(do_machine_power_off, NULL, 0, 0);
-}
-
-/*
- * This is the main routine where commands issued by other
- * cpus are handled.
- */
-
-void do_ext_call_interrupt(struct pt_regs *regs, __u16 code)
-{
-        unsigned long bits;
-
-        /*
-         * handle bit signal external calls
-         *
-         * For the ec_schedule signal we have to do nothing. All the work
-         * is done automatically when we return from the interrupt.
-         */
-	bits = xchg(&S390_lowcore.ext_call_fast, 0);
-
-        if (test_bit(ec_call_function, &bits))
-		do_call_function();
-}
-
-/*
- * Send an external call sigp to another cpu and return without waiting
- * for its completion.
- */
-static sigp_ccode smp_ext_bitcall(int cpu, ec_bit_sig sig)
-{
-        sigp_ccode ccode;
-
-        /*
-         * Set signaling bit in lowcore of target cpu and kick it
-         */
-	set_bit(sig, &lowcore_ptr[cpu]->ext_call_fast);
-        ccode = signal_processor(cpu, sigp_external_call);
-        return ccode;
-}
-
-/*
- * Send an external call sigp to every other cpu in the system and
- * return without waiting for its completion.
- */
-static void smp_ext_bitcall_others(ec_bit_sig sig)
-{
-        int i;
-
-        for (i = 0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i)
-                        continue;
-                /*
-                 * Set signaling bit in lowcore of target cpu and kick it
-                 */
-		set_bit(sig, &lowcore_ptr[i]->ext_call_fast);
-                while (signal_processor(i, sigp_external_call) == sigp_busy)
-			udelay(10);
-        }
-}
-
-/*
- * this function sends a 'reschedule' IPI to another CPU.
- * it goes straight through and wastes no time serializing
- * anything. Worst case is that we lose a reschedule ...
- */
-
-void smp_send_reschedule(int cpu)
-{
-        smp_ext_bitcall(cpu, ec_schedule);
-}
-
-/*
- * parameter area for the set/clear control bit callbacks
- */
-typedef struct
-{
-	__u16 start_ctl;
-	__u16 end_ctl;
-	__u64 orvals[16];
-	__u64 andvals[16];
-} ec_creg_mask_parms;
-
-/*
- * callback for setting/clearing control bits
- */
-void smp_ctl_bit_callback(void *info) {
-	ec_creg_mask_parms *pp;
-	u64 cregs[16];
-	int i;
-	
-	pp = (ec_creg_mask_parms *) info;
-	asm volatile ("   bras  1,0f\n"
-		      "   stctg 0,0,0(%0)\n"
-		      "0: ex    %1,0(1)\n"
-		      : : "a" (cregs+pp->start_ctl),
-		          "a" ((pp->start_ctl<<4) + pp->end_ctl)
-		      : "memory", "1" );
-	for (i = pp->start_ctl; i <= pp->end_ctl; i++)
-		cregs[i] = (cregs[i] & pp->andvals[i]) | pp->orvals[i];
-	asm volatile ("   bras  1,0f\n"
-		      "   lctlg 0,0,0(%0)\n"
-		      "0: ex    %1,0(1)\n"
-		      : : "a" (cregs+pp->start_ctl),
-		          "a" ((pp->start_ctl<<4) + pp->end_ctl)
-		      : "memory", "1" );
-}
-
-/*
- * Set a bit in a control register of all cpus
- */
-void smp_ctl_set_bit(int cr, int bit) {
-        ec_creg_mask_parms parms;
-
-	parms.start_ctl = cr;
-	parms.end_ctl = cr;
-	parms.orvals[cr] = 1 << bit;
-	parms.andvals[cr] = -1L;
-	preempt_disable();
-	smp_call_function(smp_ctl_bit_callback, &parms, 0, 1);
-        __ctl_set_bit(cr, bit);
-	preempt_enable();
-}
-
-/*
- * Clear a bit in a control register of all cpus
- */
-void smp_ctl_clear_bit(int cr, int bit) {
-        ec_creg_mask_parms parms;
-
-	parms.start_ctl = cr;
-	parms.end_ctl = cr;
-	parms.orvals[cr] = 0;
-	parms.andvals[cr] = ~(1L << bit);
-	preempt_disable();
-	smp_call_function(smp_ctl_bit_callback, &parms, 0, 1);
-        __ctl_clear_bit(cr, bit);
-	preempt_enable();
-}
-
-
-/*
- * Lets check how many CPUs we have.
- */
-
-void __init smp_check_cpus(unsigned int max_cpus)
-{
-        int curr_cpu, num_cpus;
-	__u16 boot_cpu_addr;
-
-	boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
-        current_thread_info()->cpu = 0;
-        num_cpus = 1;
-	cpu_possible_map = 1;
-        cpu_online_map = 1;
-        for (curr_cpu = 0;
-             curr_cpu <= 65535 && num_cpus < max_cpus; curr_cpu++) {
-                if ((__u16) curr_cpu == boot_cpu_addr)
-                        continue;
-                __cpu_logical_map[num_cpus] = (__u16) curr_cpu;
-                if (signal_processor(num_cpus, sigp_sense) ==
-                    sigp_not_operational)
-                        continue;
-		set_bit(num_cpus, &cpu_possible_map);
-                num_cpus++;
-        }
-        printk("Detected %d CPU's\n",(int) num_cpus);
-        printk("Boot cpu address %2X\n", boot_cpu_addr);
-}
-
-
-/*
- *      Activate a secondary processor.
- */
-extern void init_cpu_timer(void);
-extern int pfault_init(void);
-
-int __devinit start_secondary(void *cpuvoid)
-{
-        /* Setup the cpu */
-        cpu_init();
-        /* init per CPU timer */
-        init_cpu_timer();
-#ifdef CONFIG_PFAULT
-	/* Enable pfault pseudo page faults on this cpu. */
-	pfault_init();
-#endif
-	/* Mark this cpu as online. */
-	set_bit(smp_processor_id(), &cpu_online_map);
-	/* Switch on interrupts */
-	local_irq_enable();
-        /* Print info about this processor */
-        print_cpu_info(&S390_lowcore.cpu_data);
-        /* cpu_idle will call schedule for us */
-        return cpu_idle(NULL);
-}
-
-static struct task_struct * __devinit fork_by_hand(void)
-{
-       struct pt_regs regs;
-       /* don't care about the psw and regs settings since we'll never
-          reschedule the forked task. */
-       memset(&regs,0,sizeof(struct pt_regs));
-       return do_fork(CLONE_VM|CLONE_IDLETASK, 0, &regs, 0, NULL, NULL);
-}
-
-int __cpu_up(unsigned int cpu)
-{
-        struct task_struct *idle;
-        struct _lowcore    *cpu_lowcore;
-	sigp_ccode          ccode;
-
-	/*
-	 * Set prefix page for new cpu
-	 */
-
-	ccode = signal_processor_p((u64) lowcore_ptr[cpu],
-				   cpu, sigp_set_prefix);
-	if(ccode){
-		printk("sigp_set_prefix failed for cpu %d "
-		       "with condition code %d\n",
-		       (int) cpu, (int) ccode);
-		return -EIO;
-	}
-
-        /* We can't use kernel_thread since we must _avoid_ to reschedule
-           the child. */
-        idle = fork_by_hand();
-	if (IS_ERR(idle)){
-                printk("failed fork for CPU %d", cpu);
-		return -EIO;
-	}
-
-        /*
-         * We remove it from the pidhash and the runqueue
-         * once we got the process:
-         */
-	init_idle(idle, cpu);
-
-        unhash_process(idle);
-
-        cpu_lowcore = lowcore_ptr[cpu];
-	cpu_lowcore->save_area[15] = idle->thread.ksp;
-	cpu_lowcore->kernel_stack = (__u64) idle->thread_info + (4*PAGE_SIZE);
-        __asm__ __volatile__("la    1,%0\n\t"
-			     "stctg 0,15,0(1)\n\t"
-			     "la    1,%1\n\t"
-                             "stam  0,15,0(1)"
-                             : "=m" (cpu_lowcore->cregs_save_area[0]),
-                               "=m" (cpu_lowcore->access_regs_save_area[0])
-                             : : "1", "memory");
-
-        eieio();
-        signal_processor(cpu,sigp_restart);
-
-	while (!cpu_online(cpu));
-	return 0;
-}
-
-/*
- *	Cycle through the processors and setup structures.
- */
-
-void __init smp_prepare_cpus(unsigned int max_cpus)
-{
-	unsigned long async_stack;
-        int i;
-
-        /* request the 0x1202 external interrupt */
-        if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0)
-                panic("Couldn't request external interrupt 0x1202");
-        smp_check_cpus(max_cpus);
-        memset(lowcore_ptr,0,sizeof(lowcore_ptr));  
-        
-        /*
-         *  Initialize prefix pages and stacks for all possible cpus
-         */
-        print_cpu_info(&S390_lowcore.cpu_data);
-
-        for(i = 0; i < NR_CPUS; i++) {
-		if (!cpu_possible(i))
-			continue;
-		lowcore_ptr[i] = (struct _lowcore *)
-			__get_free_pages(GFP_KERNEL|GFP_DMA, 1);
-		async_stack = __get_free_pages(GFP_KERNEL,2);
-		if (lowcore_ptr[i] == NULL || async_stack == 0ULL)
-			panic("smp_boot_cpus failed to allocate memory\n");
-                memcpy(lowcore_ptr[i], &S390_lowcore, sizeof(struct _lowcore));
-		lowcore_ptr[i]->async_stack = async_stack + (4 * PAGE_SIZE);
-	}
-	set_prefix((u32)(u64) lowcore_ptr[smp_processor_id()]);
-}
-
-void __devinit smp_prepare_boot_cpu(void)
-{
-	set_bit(smp_processor_id(), &cpu_online_map);
-	set_bit(smp_processor_id(), &cpu_possible_map);
-}
-
-void smp_cpus_done(unsigned int max_cpis)
-{
-}
-
-/*
- * the frequency of the profiling timer can be changed
- * by writing a multiplier value into /proc/profile.
- *
- * usually you want to run this on all CPUs ;)
- */
-int setup_profiling_timer(unsigned int multiplier)
-{
-        return 0;
-}
-
-EXPORT_SYMBOL(lowcore_ptr);
-EXPORT_SYMBOL(smp_ctl_set_bit);
-EXPORT_SYMBOL(smp_ctl_clear_bit);
-EXPORT_SYMBOL(smp_call_function);
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/sys_s390.c linux-2.5.67-bk6/arch/s390x/kernel/sys_s390.c
--- linux-2.5.67-bk5/arch/s390x/kernel/sys_s390.c	2003-04-07 10:32:29.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/sys_s390.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,258 +0,0 @@
-/*
- *  arch/s390/kernel/sys_s390.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Derived from "arch/i386/kernel/sys_i386.c"
- *
- *  This file contains various random system calls that
- *  have a non-standard calling sequence on the Linux/s390
- *  platform.
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/sem.h>
-#include <linux/msg.h>
-#include <linux/shm.h>
-#include <linux/stat.h>
-#include <linux/mman.h>
-#include <linux/file.h>
-#include <linux/utsname.h>
-#include <linux/personality.h>
-
-#include <asm/uaccess.h>
-#include <asm/ipc.h>
-
-/*
- * 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)
-{
-	int fd[2];
-	int error;
-
-	error = do_pipe(fd);
-	if (!error) {
-		if (copy_to_user(fildes, fd, 2*sizeof(int)))
-			error = -EFAULT;
-	}
-	return error;
-}
-
-/* common code for old and new mmaps */
-static inline long do_mmap2(
-	unsigned long addr, unsigned long len,
-	unsigned long prot, unsigned long flags,
-	unsigned long fd, unsigned long pgoff)
-{
-	long error = -EBADF;
-	struct file * file = NULL;
-
-	flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-	if (!(flags & MAP_ANONYMOUS)) {
-		file = fget(fd);
-		if (!file)
-			goto out;
-	}
-
-	down_write(&current->mm->mmap_sem);
-	error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
-	up_write(&current->mm->mmap_sem);
-
-	if (file)
-		fput(file);
-out:
-	return error;
-}
-
-/*
- * Perform the select(nd, in, out, ex, tv) and mmap() system
- * calls. Linux/i386 didn't use to be able to handle more than
- * 4 system call parameters, so these system calls used a memory
- * block for parameter passing..
- */
-
-struct mmap_arg_struct {
-	unsigned long addr;
-	unsigned long len;
-	unsigned long prot;
-	unsigned long flags;
-	unsigned long fd;
-	unsigned long offset;
-};
-
-asmlinkage long sys_mmap2(struct mmap_arg_struct *arg)
-{
-	struct mmap_arg_struct a;
-	int error = -EFAULT;
-
-	if (copy_from_user(&a, arg, sizeof(a)))
-		goto out;
-	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
-out:
-	return error;
-}
-
-asmlinkage long old_mmap(struct mmap_arg_struct *arg)
-{
-	struct mmap_arg_struct a;
-	long error = -EFAULT;
-
-	if (copy_from_user(&a, arg, sizeof(a)))
-		goto out;
-
-	error = -EINVAL;
-	if (a.offset & ~PAGE_MASK)
-		goto out;
-
-	error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
-out:
-	return error;
-}
-
-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;
-	}
-}
-
-extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc (uint call, int first, long second, 
-                        unsigned long third, void *ptr)
-{
-        struct ipc_kludge tmp;
-	int ret;
-
-        switch (call) {
-        case SEMOP:
-                return sys_semop (first, (struct sembuf *)ptr, second);
-        case SEMGET:
-                return sys_semget (first, second, third);
-        case SEMCTL: {
-                union semun fourth;
-                if (!ptr)
-                        return -EINVAL;
-                if (get_user(fourth.__pad, (void **) ptr))
-                        return -EFAULT;
-                return sys_semctl (first, second, third, fourth);
-        } 
-        case MSGSND:
-		return sys_msgsnd (first, (struct msgbuf *) ptr, 
-                                   second, third);
-		break;
-        case MSGRCV:
-                if (!ptr)
-                        return -EINVAL;
-                if (copy_from_user (&tmp, (struct ipc_kludge *) ptr,
-                                    sizeof (struct ipc_kludge)))
-                        return -EFAULT;
-                return sys_msgrcv (first, tmp.msgp,
-                                   second, tmp.msgtyp, third);
-        case MSGGET:
-                return sys_msgget ((key_t) first, second);
-        case MSGCTL:
-                return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-                
-	case SHMAT: {
-		ulong raddr;
-		ret = sys_shmat (first, (char *) ptr, second, &raddr);
-		if (ret)
-			return ret;
-		return put_user (raddr, (ulong *) third);
-		break;
-        }
-	case SHMDT: 
-		return sys_shmdt ((char *)ptr);
-	case SHMGET:
-		return sys_shmget (first, second, third);
-	case SHMCTL:
-		return sys_shmctl (first, second,
-                                   (struct shmid_ds *) ptr);
-	default:
-		return -EINVAL;
-
-	}
-        
-	return -EINVAL;
-}
-
-/*
- * Old cruft
- */
-asmlinkage int sys_uname(struct old_utsname * name)
-{
-	int err;
-	if (!name)
-		return -EFAULT;
-	down_read(&uts_sem);
-	err=copy_to_user(name, &system_utsname, sizeof (*name));
-	up_read(&uts_sem);
-	return err?-EFAULT:0;
-}
-
-extern asmlinkage int sys_newuname(struct new_utsname * name);
-
-asmlinkage int s390x_newuname(struct new_utsname * name)
-{
-	int ret = sys_newuname(name);
-
-	if (current->personality == PER_LINUX32 && !ret) {
-		ret = copy_to_user(name->machine, "s390\0\0\0\0", 8);
-		if (ret) ret = -EFAULT;
-	}
-	return ret;
-}
-
-extern asmlinkage long sys_personality(unsigned long);
-
-asmlinkage int s390x_personality(unsigned long personality)
-{
-	int ret;
-
-	if (current->personality == PER_LINUX32 && personality == PER_LINUX)
-		personality = PER_LINUX32;
-	ret = sys_personality(personality);
-	if (ret == PER_LINUX32)
-		ret = PER_LINUX;
-
-	return ret;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/time.c linux-2.5.67-bk6/arch/s390x/kernel/time.c
--- linux-2.5.67-bk5/arch/s390x/kernel/time.c	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/time.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,241 +0,0 @@
-/*
- *  arch/s390/kernel/time.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *
- *  Derived from "arch/i386/kernel/time.c"
- *    Copyright (C) 1991, 1992, 1995  Linus Torvalds
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/param.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <linux/types.h>
-
-#include <asm/uaccess.h>
-#include <asm/delay.h>
-
-#include <linux/timex.h>
-#include <linux/config.h>
-
-#include <asm/irq.h>
-#include <asm/s390_ext.h>
-
-/* change this if you have some constant time drift */
-#define USECS_PER_JIFFY     ((unsigned long) 1000000/HZ)
-#define CLK_TICKS_PER_JIFFY ((unsigned long) USECS_PER_JIFFY << 12)
-
-/*
- * Create a small time difference between the timer interrupts
- * on the different cpus to avoid lock contention.
- */
-#define CPU_DEVIATION       (smp_processor_id() << 12)
-
-#define TICK_SIZE tick
-
-u64 jiffies_64 = INITIAL_JIFFIES;
-
-static ext_int_info_t ext_int_info_timer;
-static uint64_t xtime_cc;
-static uint64_t init_timer_cc;
-
-extern unsigned long wall_jiffies;
-
-void tod_to_timeval(__u64 todval, struct timespec *xtime)
-{
-        xtime->tv_sec = (todval >> 12) / 1000000;
-	todval -= (xtime->tv_sec * 1000000) << 12;
-	xtime->tv_nsec = ((todval * 1000) >> 12);
-}
-
-static inline unsigned long do_gettimeoffset(void) 
-{
-	__u64 now;
-
-	asm volatile ("STCK 0(%0)" : : "a" (&now) : "memory", "cc");
-        now = (now - init_timer_cc) >> 12;
-	/* We require the offset from the latest update of xtime */
-	now -= (__u64) wall_jiffies*USECS_PER_JIFFY;
-	return (unsigned long) now;
-}
-
-/*
- * This version of gettimeofday has microsecond resolution.
- */
-void do_gettimeofday(struct timeval *tv)
-{
-	unsigned long flags;
-	unsigned long seq;
-	unsigned long usec, sec;
-
-	do {
-		seq = read_seqbegin_irqsave(&xtime_lock, flags);
-		sec = xtime.tv_sec;
-		usec = xtime.tv_nsec + do_gettimeoffset();
-	} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
-	while (usec >= 1000000) {
-		usec -= 1000000;
-		sec++;
-	}
-
-	tv->tv_sec = sec;
-	tv->tv_usec = usec;
-}
-
-void do_settimeofday(struct timeval *tv)
-{
-
-	write_seqlock_irq(&xtime_lock);
-	/* 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!
-	 */
-	tv->tv_usec -= do_gettimeoffset();
-
-	while (tv->tv_usec < 0) {
-		tv->tv_usec += 1000000;
-		tv->tv_sec--;
-	}
-
-	xtime.tv_sec = tv->tv_sec;
-	xtime.tv_nsec = tv->tv_usec * 1000;
-	time_adjust = 0;		/* stop active adjtime() */
-	time_status |= STA_UNSYNC;
-	time_maxerror = NTP_PHASE_LIMIT;
-	time_esterror = NTP_PHASE_LIMIT;
-	write_sequnlock_irq(&xtime_lock);
-}
-
-/*
- * timer_interrupt() needs to keep up the real-time clock,
- * as well as call the "do_timer()" routine every clocktick
- */
-static void do_comparator_interrupt(struct pt_regs *regs, __u16 error_code)
-{
-	__u64 tmp;
-	__u32 ticks;
-
-	/* Calculate how many ticks have passed. */
-	asm volatile ("STCK 0(%0)" : : "a" (&tmp) : "memory", "cc");
-	tmp = tmp - S390_lowcore.jiffy_timer;
-	if (tmp >= 2*CLK_TICKS_PER_JIFFY) {  /* more than one tick ? */
-		ticks = tmp / CLK_TICKS_PER_JIFFY;
-		S390_lowcore.jiffy_timer +=
-			CLK_TICKS_PER_JIFFY * (__u64) ticks;
-	} else {
-		ticks = 1;
-		S390_lowcore.jiffy_timer += CLK_TICKS_PER_JIFFY;
-	}
-
-	/* set clock comparator for next tick */
-	tmp = S390_lowcore.jiffy_timer + CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
-        asm volatile ("SCKC %0" : : "m" (tmp));
-
-	irq_enter();
-
-#ifdef CONFIG_SMP
-	/*
-	 * Do not rely on the boot cpu to do the calls to do_timer.
-	 * Spread it over all cpus instead.
-	 */
-	write_seqlock(&xtime_lock);
-	if (S390_lowcore.jiffy_timer > xtime_cc) {
-		__u32 xticks;
-
-		tmp = S390_lowcore.jiffy_timer - xtime_cc;
-		if (tmp >= 2*CLK_TICKS_PER_JIFFY) {
-			xticks = tmp / CLK_TICKS_PER_JIFFY;
-			xtime_cc += (__u64) xticks * CLK_TICKS_PER_JIFFY;
-		} else {
-			xticks = 1;
-			xtime_cc += CLK_TICKS_PER_JIFFY;
-		}
-		while (xticks--)
-			do_timer(regs);
-	}
-	write_sequnlock(&xtime_lock);
-	while (ticks--)
-		update_process_times(user_mode(regs));
-#else
-	while (ticks--)
-		do_timer(regs);
-#endif
-
-	irq_exit();
-}
-
-/*
- * Start the clock comparator on the current CPU.
- */
-void init_cpu_timer(void)
-{
-	unsigned long cr0;
-	__u64 timer;
-
-        /* allow clock comparator timer interrupt */
-        asm volatile ("STCTG 0,0,%0" : "=m" (cr0) : : "memory");
-        cr0 |= 0x800;
-        asm volatile ("LCTLG 0,0,%0" : : "m" (cr0) : "memory");
-	timer = init_timer_cc + jiffies_64 * CLK_TICKS_PER_JIFFY;
-	S390_lowcore.jiffy_timer = timer;
-	timer += CLK_TICKS_PER_JIFFY + CPU_DEVIATION;
-	asm volatile ("SCKC %0" : : "m" (timer));
-}
-
-/*
- * Initialize the TOD clock and the CPU timer of
- * the boot cpu.
- */
-void __init time_init(void)
-{
-	__u64 set_time_cc;
-	int cc;
-
-        /* kick the TOD clock */
-        asm volatile ("STCK 0(%1)\n\t"
-                      "IPM  %0\n\t"
-                      "SRL  %0,28" : "=r" (cc) : "a" (&init_timer_cc) 
-				   : "memory", "cc");
-        switch (cc) {
-        case 0: /* clock in set state: all is fine */
-                break;
-        case 1: /* clock in non-set state: FIXME */
-                printk("time_init: TOD clock in non-set state\n");
-                break;
-        case 2: /* clock in error state: FIXME */
-                printk("time_init: TOD clock in error state\n");
-                break;
-        case 3: /* clock in stopped or not-operational state: FIXME */
-                printk("time_init: TOD clock stopped/non-operational\n");
-                break;
-        }
-
-	/* set xtime */
-	xtime_cc = init_timer_cc;
-	set_time_cc = init_timer_cc - 0x8126d60e46000000LL +
-		(0x3c26700LL*1000000*4096);
-        tod_to_timeval(set_time_cc, &xtime);
-
-        /* request the 0x1004 external interrupt */
-        if (register_early_external_interrupt(0x1004, do_comparator_interrupt,
-					      &ext_int_info_timer) != 0)
-                panic("Couldn't request external interrupt 0x1004");
-
-        /* init CPU timer */
-        init_cpu_timer();
-}
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/traps.c linux-2.5.67-bk6/arch/s390x/kernel/traps.c
--- linux-2.5.67-bk5/arch/s390x/kernel/traps.c	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/traps.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,503 +0,0 @@
-/*
- *  arch/s390/kernel/traps.c
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *
- *  Derived from "arch/i386/kernel/traps.c"
- *    Copyright (C) 1991, 1992 Linus Torvalds
- */
-
-/*
- * 'Traps.c' handles hardware traps and faults after we have saved some
- * state in 'asm.s'.
- */
-#include <linux/config.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/ptrace.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/module.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/atomic.h>
-#if CONFIG_REMOTE_DEBUG
-#include <asm/gdb-stub.h>
-#endif
-#include <asm/cpcmd.h>
-#include <asm/s390_ext.h>
-
-/* Called from entry.S only */
-extern void handle_per_exception(struct pt_regs *regs);
-
-typedef void pgm_check_handler_t(struct pt_regs *, long);
-pgm_check_handler_t *pgm_check_table[128];
-
-#ifdef CONFIG_SYSCTL
-#ifdef CONFIG_PROCESS_DEBUG
-int sysctl_userprocess_debug = 1;
-#else
-int sysctl_userprocess_debug = 0;
-#endif
-#endif
-
-extern pgm_check_handler_t do_protection_exception;
-extern pgm_check_handler_t do_segment_exception;
-extern pgm_check_handler_t do_region_exception;
-extern pgm_check_handler_t do_page_exception;
-#ifdef CONFIG_PFAULT
-extern int pfault_init(void);
-extern void pfault_fini(void);
-extern void pfault_interrupt(struct pt_regs *regs, __u16 error_code);
-static ext_int_info_t ext_int_pfault;
-#endif
-
-static int kstack_depth_to_print = 20;
-
-void show_trace(unsigned long * stack)
-{
-	unsigned long backchain, low_addr, high_addr, ret_addr;
-	int i;
-
-	if (!stack)
-		stack = (unsigned long*)&stack;
-
-	printk("Call Trace: ");
-	low_addr = (unsigned long) stack;
-	high_addr = (low_addr & (-THREAD_SIZE)) + THREAD_SIZE;
-	/* Skip the first frame (biased stack) */
-	backchain = *(unsigned long *) low_addr;
-	/* Print up to 8 lines */
-	for (i = 0; i < 8; i++) {
-		if (backchain < low_addr || backchain >= high_addr)
-			break;
-		ret_addr = *(unsigned long *) (backchain+112);
-		if (!kernel_text_address(ret_addr))
-			break;
-		if (i && ((i % 3) == 0))
-			printk("\n   ");
-		printk("[<%016lx>] ", ret_addr);
-		low_addr = backchain;
-		backchain = *(unsigned long *) backchain;
-	}
-	printk("\n");
-}
-
-void show_trace_task(struct task_struct *tsk)
-{
-	/*
-	 * We can't print the backtrace of a running process. It is
-	 * unreliable at best and can cause kernel oopses.
-	 */
-	if (tsk->state == TASK_RUNNING)
-		return;
-	show_trace((unsigned long *) tsk->thread.ksp);
-}
-
-void show_stack(unsigned long *sp)
-{
-	unsigned long *stack;
-	int i;
-
-	// debugging aid: "show_stack(NULL);" prints the
-	// back trace for this cpu.
-
-	if (sp == NULL)
-		sp = (unsigned long*) &sp;
-
-	stack = sp;
-	for (i = 0; i < kstack_depth_to_print; i++) {
-		if (((addr_t) stack & (THREAD_SIZE-1)) == 0)
-			break;
-		if (i && ((i % 4) == 0))
-			printk("\n       ");
-		printk("%016lx ", *stack++);
-	}
-	printk("\n");
-	show_trace(sp);
-}
-
-/*
- * The architecture-independent dump_stack generator
- */
-void dump_stack(void)
-{
-	show_stack(0);
-}
-
-void show_registers(struct pt_regs *regs)
-{
-	mm_segment_t old_fs;
-	char *mode;
-	int i;
-
-	mode = (regs->psw.mask & PSW_MASK_PSTATE) ? "User" : "Krnl";
-	printk("%s PSW : %016lx %016lx\n",
-	       mode, (unsigned long) regs->psw.mask,
-	       (unsigned long) regs->psw.addr);
-	printk("%s GPRS: %016lx %016lx %016lx %016lx\n", mode,
-	       regs->gprs[0], regs->gprs[1], regs->gprs[2], regs->gprs[3]);
-	printk("           %016lx %016lx %016lx %016lx\n",
-	       regs->gprs[4], regs->gprs[5], regs->gprs[6], regs->gprs[7]);
-	printk("           %016lx %016lx %016lx %016lx\n",
-	       regs->gprs[8], regs->gprs[9], regs->gprs[10], regs->gprs[11]);
-	printk("           %016lx %016lx %016lx %016lx\n",
-	       regs->gprs[12], regs->gprs[13], regs->gprs[14], regs->gprs[15]);
-	printk("%s ACRS: %08x %08x %08x %08x\n", mode,
-	       regs->acrs[0], regs->acrs[1], regs->acrs[2], regs->acrs[3]);
-	printk("           %08x %08x %08x %08x\n",
-	       regs->acrs[4], regs->acrs[5], regs->acrs[6], regs->acrs[7]);
-	printk("           %08x %08x %08x %08x\n",
-	       regs->acrs[8], regs->acrs[9], regs->acrs[10], regs->acrs[11]);
-	printk("           %08x %08x %08x %08x\n",
-	       regs->acrs[12], regs->acrs[13], regs->acrs[14], regs->acrs[15]);
-
-	/*
-	 * Print the first 20 byte of the instruction stream at the
-	 * time of the fault.
-	 */
-	old_fs = get_fs();
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		set_fs(USER_DS);
-	else
-		set_fs(KERNEL_DS);
-	printk("%s Code: ", mode);
-	for (i = 0; i < 20; i++) {
-		unsigned char c;
-		if (__get_user(c, (char *)(regs->psw.addr + i))) {
-			printk(" Bad PSW.");
-			break;
-		}
-		printk("%02x ", c);
-	}
-	set_fs(old_fs);
-
-	printk("\n");
-}	
-
-/* This is called from fs/proc/array.c */
-char *task_show_regs(struct task_struct *task, char *buf)
-{
-	struct pt_regs *regs;
-
-	regs = __KSTK_PTREGS(task);
-	buf += sprintf(buf, "task: %016lx, ksp: %016lx\n",
-		       (unsigned long) task, task->thread.ksp);
-	buf += sprintf(buf, "User PSW : %016lx %016lx\n",
-		       (unsigned long) regs->psw.mask, 
-		       (unsigned long) regs->psw.addr);
-	buf += sprintf(buf, "User GPRS: %016lx %016lx %016lx %016lx\n",
-		       regs->gprs[0], regs->gprs[1],
-		       regs->gprs[2], regs->gprs[3]);
-	buf += sprintf(buf, "           %016lx %016lx %016lx %016lx\n",
-		       regs->gprs[4], regs->gprs[5], 
-		       regs->gprs[6], regs->gprs[7]);
-	buf += sprintf(buf, "           %016lx %016lx %016lx %016lx\n",
-		       regs->gprs[8], regs->gprs[9],
-		       regs->gprs[10], regs->gprs[11]);
-	buf += sprintf(buf, "           %016lx %016lx %016lx %016lx\n",
-		       regs->gprs[12], regs->gprs[13],
-		       regs->gprs[14], regs->gprs[15]);
-	buf += sprintf(buf, "User ACRS: %08x %08x %08x %08x\n",
-		       regs->acrs[0], regs->acrs[1],
-		       regs->acrs[2], regs->acrs[3]);
-	buf += sprintf(buf, "           %08x %08x %08x %08x\n",
-		       regs->acrs[4], regs->acrs[5],
-		       regs->acrs[6], regs->acrs[7]);
-	buf += sprintf(buf, "           %08x %08x %08x %08x\n",
-		       regs->acrs[8], regs->acrs[9],
-		       regs->acrs[10], regs->acrs[11]);
-	buf += sprintf(buf, "           %08x %08x %08x %08x\n",
-		       regs->acrs[12], regs->acrs[13],
-		       regs->acrs[14], regs->acrs[15]);
-	return buf;
-}
-
-spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
-
-void die(const char * str, struct pt_regs * regs, long err)
-{
-	static int die_counter;
-        console_verbose();
-        spin_lock_irq(&die_lock);
-	bust_spinlocks(1);
-	printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
-        show_regs(regs);
-	bust_spinlocks(0);
-        spin_unlock_irq(&die_lock);
-        do_exit(SIGSEGV);
-}
-
-static void inline do_trap(long interruption_code, int signr, char *str,
-                           struct pt_regs *regs, siginfo_t *info)
-{
-	/*
-	 * We got all needed information from the lowcore and can
-	 * now safely switch on interrupts.
-	 */
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		local_irq_enable();
-
-        if (regs->psw.mask & PSW_MASK_PSTATE) {
-                struct task_struct *tsk = current;
-                tsk->thread.trap_no = interruption_code & 0xffff;
-		if (info)
-			force_sig_info(signr, info, tsk);
-		else
-                	force_sig(signr, tsk);
-#ifndef CONFIG_SYSCTL
-#ifdef CONFIG_PROCESS_DEBUG
-                printk("User process fault: interruption code 0x%lX\n",
-                       interruption_code);
-                show_regs(regs);
-#endif
-#else
-		if (sysctl_userprocess_debug) {
-			printk("User process fault: interruption code 0x%lX\n",
-			       interruption_code);
-			show_regs(regs);
-		}
-#endif
-        } else {
-                const struct exception_table_entry *fixup;
-                fixup = search_exception_tables(regs->psw.addr);
-                if (fixup)
-                        regs->psw.addr = fixup->fixup;
-                else
-                        die(str, regs, interruption_code);
-        }
-}
-
-static inline void *get_check_address(struct pt_regs *regs)
-{
-	return (void *)(regs->psw.addr - S390_lowcore.pgm_ilc);
-}
-
-int do_debugger_trap(struct pt_regs *regs,int signal)
-{
-	if(regs->psw.mask&PSW_MASK_PSTATE)
-	{
-		if(current->ptrace & PT_PTRACED)
-			force_sig(signal,current);
-		else
-			return 1;
-	}
-	else
-	{
-#if CONFIG_REMOTE_DEBUG
-		if(gdb_stub_initialised)
-		{
-			gdb_stub_handle_exception(regs, signal);
-			return 0;
-		}
-#endif
-		return 1;
-	}
-	return 0;
-}
-
-#define DO_ERROR(signr, str, name) \
-asmlinkage void name(struct pt_regs * regs, long interruption_code) \
-{ \
-	do_trap(interruption_code, signr, str, regs, NULL); \
-}
-
-#define DO_ERROR_INFO(signr, str, name, sicode, siaddr) \
-asmlinkage void name(struct pt_regs * regs, long interruption_code) \
-{ \
-        siginfo_t info; \
-        info.si_signo = signr; \
-        info.si_errno = 0; \
-        info.si_code = sicode; \
-        info.si_addr = (void *)siaddr; \
-        do_trap(interruption_code, signr, str, regs, &info); \
-}
-
-DO_ERROR(SIGSEGV, "Unknown program exception", default_trap_handler)
-
-DO_ERROR_INFO(SIGBUS, "addressing exception", addressing_exception,
-	      BUS_ADRERR, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "execute exception", execute_exception,
-	      ILL_ILLOPN, get_check_address(regs))
-DO_ERROR_INFO(SIGFPE,  "fixpoint divide exception", divide_exception,
-	      FPE_INTDIV, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "operand exception", operand_exception,
-	      ILL_ILLOPN, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "privileged operation", privileged_op,
-	      ILL_PRVOPC, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "special operation exception", special_op_exception,
-	      ILL_ILLOPN, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "specification exception", specification_exception,
-	      ILL_ILLOPN, get_check_address(regs))
-DO_ERROR_INFO(SIGILL,  "translation exception", translation_exception,
-	      ILL_ILLOPN, get_check_address(regs))
-
-static inline void
-do_fp_trap(struct pt_regs *regs, void *location,
-           int fpc, long interruption_code)
-{
-	siginfo_t si;
-
-	si.si_signo = SIGFPE;
-	si.si_errno = 0;
-	si.si_addr = location;
-	si.si_code = 0;
-	/* FPC[2] is Data Exception Code */
-	if ((fpc & 0x00000300) == 0) {
-		/* bits 6 and 7 of DXC are 0 iff IEEE exception */
-		if (fpc & 0x8000) /* invalid fp operation */
-			si.si_code = FPE_FLTINV;
-		else if (fpc & 0x4000) /* div by 0 */
-			si.si_code = FPE_FLTDIV;
-		else if (fpc & 0x2000) /* overflow */
-			si.si_code = FPE_FLTOVF;
-		else if (fpc & 0x1000) /* underflow */
-			si.si_code = FPE_FLTUND;
-		else if (fpc & 0x0800) /* inexact */
-			si.si_code = FPE_FLTRES;
-	}
-	current->thread.ieee_instruction_pointer = (addr_t) location;
-	do_trap(interruption_code, SIGFPE,
-		"floating point exception", regs, &si);
-}
-
-asmlinkage void illegal_op(struct pt_regs * regs, long interruption_code)
-{
-        __u8 opcode[6];
-	__u16 *location;
-	int do_sig = 0;
-
-	location = (__u16 *) get_check_address(regs);
-
-	/*
-	 * We got all needed information from the lowcore and can
-	 * now safely switch on interrupts.
-	 */
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		local_irq_enable();
-
-	/* WARNING don't change this check back to */
-	/* int problem_state=(regs->psw.mask & PSW_MASK_PSTATE); */
-	/* & then doing if(problem_state) an int is too small for this */
-	/* check on 64 bit. */
-	if(regs->psw.mask & PSW_MASK_PSTATE)
-		get_user(*((__u16 *) opcode), location);
-	else
-		*((__u16 *)opcode)=*((__u16 *)location);
-	if(*((__u16 *)opcode)==S390_BREAKPOINT_U16)
-        {
-		if(do_debugger_trap(regs,SIGTRAP))
-			do_sig=1;
-	}
-	else
-		do_sig = 1;
-	if (do_sig)
-		do_trap(interruption_code, SIGILL,
-			"illegal operation", regs, NULL);
-}
-
-asmlinkage void data_exception(struct pt_regs * regs, long interruption_code)
-{
-	__u16 *location;
-
-	location = (__u16 *) get_check_address(regs);
-
-	/*
-	 * We got all needed information from the lowcore and can
-	 * now safely switch on interrupts.
-	 */
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		local_irq_enable();
-
-	__asm__ volatile ("stfpc %0\n\t" 
-			  : "=m" (current->thread.fp_regs.fpc));
-
-	if (current->thread.fp_regs.fpc & FPC_DXC_MASK)
-		do_fp_trap(regs, location,
-                           current->thread.fp_regs.fpc, interruption_code);
-        else {
-		siginfo_t info;
-		info.si_signo = SIGILL;
-		info.si_errno = 0;
-		info.si_code = ILL_ILLOPN;
-		info.si_addr = location;
-		do_trap(interruption_code, SIGILL, 
-			"data exception", regs, &info);
-	}
-}
-
-
-
-/* init is done in lowcore.S and head.S */
-
-void __init trap_init(void)
-{
-        int i;
-
-        for (i = 0; i < 128; i++)
-          pgm_check_table[i] = &default_trap_handler;
-        pgm_check_table[1] = &illegal_op;
-        pgm_check_table[2] = &privileged_op;
-        pgm_check_table[3] = &execute_exception;
-        pgm_check_table[4] = &do_protection_exception;
-        pgm_check_table[5] = &addressing_exception;
-        pgm_check_table[6] = &specification_exception;
-        pgm_check_table[7] = &data_exception;
-        pgm_check_table[9] = &divide_exception;
-        pgm_check_table[0x12] = &translation_exception;
-        pgm_check_table[0x13] = &special_op_exception;
-        pgm_check_table[0x15] = &operand_exception;
-        pgm_check_table[0x10] = &do_segment_exception;
-        pgm_check_table[0x11] = &do_page_exception;
-        pgm_check_table[0x1C] = &privileged_op;
-        pgm_check_table[0x38] = &addressing_exception;
-        pgm_check_table[0x3B] = &do_region_exception;
-#ifdef CONFIG_PFAULT
-	if (MACHINE_IS_VM) {
-		/* request the 0x2603 external interrupt */
-		if (register_early_external_interrupt(0x2603, pfault_interrupt,
-						      &ext_int_pfault) != 0)
-			panic("Couldn't request external interrupt 0x2603");
-		/*
-		 * Try to get pfault pseudo page faults going.
-		 */
-		if (pfault_init() != 0) {
-			/* Tough luck, no pfault. */
-			unregister_early_external_interrupt(0x2603,
-							    pfault_interrupt,
-							    &ext_int_pfault);
-		}
-	}
-#endif
-}
-
-
-void handle_per_exception(struct pt_regs *regs)
-{
-	if (regs->psw.mask&PSW_MASK_PSTATE) {
-		per_struct *per_info=&current->thread.per_info;
-		per_info->lowcore.words.perc_atmid=S390_lowcore.per_perc_atmid;
-		per_info->lowcore.words.address=S390_lowcore.per_address;
-		per_info->lowcore.words.access_id=S390_lowcore.per_access_id;
-	}
-	if (do_debugger_trap(regs,SIGTRAP)) {
-		/* I've seen this possibly a task structure being reused ? */
-		printk("Spurious per exception detected\n");
-		printk("switching off per tracing for this task.\n");
-		show_regs(regs);
-		/* Hopefully switching off per tracing will help us survive */
-		regs->psw.mask &= ~PSW_MASK_PER;
-	}
-}
-
diff -urN linux-2.5.67-bk5/arch/s390x/kernel/wrapper32.S linux-2.5.67-bk6/arch/s390x/kernel/wrapper32.S
--- linux-2.5.67-bk5/arch/s390x/kernel/wrapper32.S	2003-04-07 10:32:54.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/kernel/wrapper32.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,1211 +0,0 @@
-/*
-*  arch/s390/kernel/sys_wrapper31.S
-*    wrapper for 31 bit compatible system calls.
-*
-*  S390 version
-*    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
-*    Author(s): Gerhard Tonn (ton@de.ibm.com),
-*/ 
-
-	.globl  sys32_exit_wrapper 
-sys32_exit_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_exit		# branch to sys_exit
-    
-	.globl  sys32_read_wrapper 
-sys32_read_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# char *
-	llgfr	%r4,%r4			# size_t
-	jg	sys32_read		# branch to sys_read
-
-	.globl  sys32_write_wrapper 
-sys32_write_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# const char *
-	llgfr	%r4,%r4			# size_t
-	jg	sys32_write		# branch to system call
-
-	.globl  sys32_open_wrapper 
-sys32_open_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int
-	lgfr	%r4,%r4			# int
-	jg	sys_open		# branch to system call
-
-	.globl  sys32_close_wrapper 
-sys32_close_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	jg	sys_close		# branch to system call
-
-	.globl  sys32_creat_wrapper 
-sys32_creat_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int
-	jg	sys_creat		# branch to system call
-
-	.globl  sys32_link_wrapper 
-sys32_link_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# const char *
-	jg	sys_link		# branch to system call
-
-	.globl  sys32_unlink_wrapper 
-sys32_unlink_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys_unlink		# branch to system call
-
-	.globl  sys32_chdir_wrapper 
-sys32_chdir_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys_chdir		# branch to system call
-
-	.globl  sys32_time_wrapper 
-sys32_time_wrapper:
-	llgtr	%r2,%r2			# int *
-	jg	sys_time		# branch to system call
-
-	.globl  sys32_mknod_wrapper 
-sys32_mknod_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int 
-	llgfr	%r4,%r4			# dev
-	jg	sys_mknod		# branch to system call
-
-	.globl  sys32_chmod_wrapper 
-sys32_chmod_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# mode_t
-	jg	sys_chmod		# branch to system call
-
-	.globl  sys32_lchown16_wrapper 
-sys32_lchown16_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
-	llgfr	%r4,%r4			# __kernel_old_uid_emu31_t 
-	jg	sys32_lchown16		# branch to system call
-
-	.globl  sys32_lseek_wrapper 
-sys32_lseek_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	lgfr	%r3,%r3			# off_t
-	llgfr	%r4,%r4			# unsigned int
-	jg	sys_lseek		# branch to system call
-
-#sys32_getpid_wrapper				# void 
-
-	.globl  sys32_mount_wrapper 
-sys32_mount_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# char *
-	llgfr	%r5,%r5			# unsigned long
-	llgtr	%r6,%r6			# void *
-	jg	sys32_mount		# branch to system call
-
-	.globl  sys32_oldumount_wrapper 
-sys32_oldumount_wrapper:
-	llgtr	%r2,%r2			# char *
-	jg	sys_oldumount		# branch to system call
-
-	.globl  sys32_setuid16_wrapper 
-sys32_setuid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
-	jg	sys32_setuid16		# branch to system call
-
-#sys32_getuid16_wrapper			# void 
-
-	.globl  sys32_ptrace_wrapper 
-sys32_ptrace_wrapper:
-	lgfr	%r2,%r2			# long
-	lgfr	%r3,%r3			# long
-	llgtr	%r4,%r4			# long
-	llgfr	%r5,%r5			# long
-	jg	sys_ptrace		# branch to system call
-
-	.globl  sys32_alarm_wrapper 
-sys32_alarm_wrapper:
-	llgtr	%r2,%r2			# unsigned int
-	jg	sys_alarm		# branch to system call
-
-#sys32_pause_wrapper			# void 
-
-	.globl  compat_sys_utime_wrapper 
-compat_sys_utime_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct compat_utimbuf *
-	jg	compat_sys_utime		# branch to system call
-
-	.globl  sys32_access_wrapper 
-sys32_access_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int
-	jg	sys_access		# branch to system call
-
-	.globl  sys32_nice_wrapper 
-sys32_nice_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_nice		# branch to system call
-
-#sys32_sync_wrapper			# void 
-
-	.globl  sys32_kill_wrapper 
-sys32_kill_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	jg	sys_kill		# branch to system call
-
-	.globl  sys32_rename_wrapper 
-sys32_rename_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# const char *
-	jg	sys_rename		# branch to system call
-
-	.globl  sys32_mkdir_wrapper 
-sys32_mkdir_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int
-	jg	sys_mkdir		# branch to system call
-
-	.globl  sys32_rmdir_wrapper 
-sys32_rmdir_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys_rmdir		# branch to system call
-
-	.globl  sys32_dup_wrapper 
-sys32_dup_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	jg	sys_dup			# branch to system call
-
-	.globl  sys32_pipe_wrapper 
-sys32_pipe_wrapper:
-	llgtr	%r2,%r2			# u32 *
-	jg	sys_pipe		# branch to system call
-
-	.globl  compat_sys_times_wrapper 
-compat_sys_times_wrapper:
-	llgtr	%r2,%r2			# struct compat_tms *
-	jg	compat_sys_times	# branch to system call
-
-	.globl  sys32_brk_wrapper 
-sys32_brk_wrapper:
-	llgtr	%r2,%r2			# unsigned long
-	jg	sys_brk			# branch to system call
-
-	.globl  sys32_setgid16_wrapper 
-sys32_setgid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
-	jg	sys32_setgid16		# branch to system call
-
-#sys32_getgid16_wrapper			# void 
-
-	.globl sys32_signal_wrapper
-sys32_signal_wrapper:
-	lgfr	%r2,%r2			# int 
-	llgfr	%r3,%r3			# __sighandler_t 
-	jg	sys_signal
-
-#sys32_geteuid16_wrapper		# void 
-
-#sys32_getegid16_wrapper		# void 
-
-	.globl  sys32_acct_wrapper 
-sys32_acct_wrapper:
-	llgtr	%r2,%r2			# char *
-	jg	sys_acct		# branch to system call
-
-	.globl  sys32_umount_wrapper 
-sys32_umount_wrapper:
-	llgtr	%r2,%r2			# char *
-	lgfr	%r3,%r3			# int
-	jg	sys_umount		# branch to system call
-
-	.globl  sys32_ioctl_wrapper 
-sys32_ioctl_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned int
-	llgfr	%r4,%r4			# unsigned int
-	jg	sys32_ioctl		# branch to system call
-
-	.globl  compat_sys_fcntl_wrapper 
-compat_sys_fcntl_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned int 
-	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_fcntl	# branch to system call
-
-	.globl  sys32_setpgid_wrapper 
-sys32_setpgid_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	lgfr	%r3,%r3			# pid_t
-	jg	sys_setpgid		# branch to system call
-
-	.globl  sys32_umask_wrapper 
-sys32_umask_wrapper:
-	lgfr	%r3,%r3			# int
-	jg	sys_umask		# branch to system call
-
-	.globl  sys32_chroot_wrapper 
-sys32_chroot_wrapper:
-	llgtr	%r2,%r2			# char *
-	jg	sys_chroot		# branch to system call
-
-	.globl sys32_ustat_wrapper
-sys32_ustat_wrapper:
-	llgfr	%r2,%r2			# dev_t 
-	llgtr	%r3,%r3			# struct ustat *
-	jg	sys_ustat
-
-	.globl  sys32_dup2_wrapper 
-sys32_dup2_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned int
-	jg	sys_dup2		# branch to system call
-
-#sys32_getppid_wrapper			# void 
-
-#sys32_getpgrp_wrapper			# void 
-
-#sys32_setsid_wrapper			# void 
-
-	.globl  sys32_sigaction_wrapper
-sys32_sigaction_wrapper:
-	lgfr	%r2,%r2			# int 
-	llgtr	%r3,%r3			# const struct old_sigaction *
-	jg	sys32_sigaction		# branch to system call
-
-	.globl  sys32_setreuid16_wrapper 
-sys32_setreuid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
-	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
-	jg	sys32_setreuid16	# branch to system call
-
-	.globl  sys32_setregid16_wrapper 
-sys32_setregid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
-	llgfr	%r3,%r3			# __kernel_old_gid_emu31_t 
-	jg	sys32_setregid16	# branch to system call
-
-#sys32_sigsuspend_wrapper		# done in sigsuspend_glue 
-
-	.globl  compat_sys_sigpending_wrapper 
-compat_sys_sigpending_wrapper:
-	llgtr	%r2,%r2			# compat_old_sigset_t *
-	jg	compat_sys_sigpending	# branch to system call
-
-	.globl  sys32_sethostname_wrapper 
-sys32_sethostname_wrapper:
-	llgtr	%r2,%r2			# char *
-	lgfr	%r3,%r3			# int
-	jg	sys_sethostname		# branch to system call
-
-	.globl  sys32_setrlimit_wrapper 
-sys32_setrlimit_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# struct rlimit_emu31 *
-	jg	sys32_setrlimit		# branch to system call
-
-	.globl  sys32_old_getrlimit_wrapper 
-sys32_old_getrlimit_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# struct rlimit_emu31 *
-	jg	sys32_old_getrlimit	# branch to system call
-
-	.globl  sys32_getrlimit_wrapper 
-sys32_getrlimit_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# struct rlimit_emu31 *
-	jg	sys32_getrlimit		# branch to system call
-
-	.globl  sys32_mmap2_wrapper 
-sys32_mmap2_wrapper:
-	llgtr	%r2,%r2			# struct mmap_arg_struct_emu31 *
-	jg	sys32_mmap2			# branch to system call
-
-	.globl  sys32_getrusage_wrapper 
-sys32_getrusage_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# struct rusage_emu31 *
-	jg	sys32_getrusage		# branch to system call
-
-	.globl  sys32_gettimeofday_wrapper 
-sys32_gettimeofday_wrapper:
-	llgtr	%r2,%r2			# struct timeval_emu31 *
-	llgtr	%r3,%r3			# struct timezone *
-	jg	sys32_gettimeofday	# branch to system call
-
-	.globl  sys32_settimeofday_wrapper 
-sys32_settimeofday_wrapper:
-	llgtr	%r2,%r2			# struct timeval_emu31 *
-	llgtr	%r3,%r3			# struct timezone *
-	jg	sys32_settimeofday	# branch to system call
-
-	.globl  sys32_getgroups16_wrapper 
-sys32_getgroups16_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
-	jg	sys32_getgroups16	# branch to system call
-
-	.globl  sys32_setgroups16_wrapper 
-sys32_setgroups16_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
-	jg	sys32_setgroups16	# branch to system call
-
-	.globl  sys32_symlink_wrapper 
-sys32_symlink_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# const char *
-	jg	sys_symlink		# branch to system call
-
-	.globl  sys32_readlink_wrapper 
-sys32_readlink_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# char *
-	lgfr	%r4,%r4			# int
-	jg	sys_readlink		# branch to system call
-
-	.globl  sys32_uselib_wrapper 
-sys32_uselib_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys_uselib		# branch to system call
-
-	.globl  sys32_swapon_wrapper 
-sys32_swapon_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# int
-	jg	sys_swapon		# branch to system call
-
-	.globl  sys32_reboot_wrapper 
-sys32_reboot_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	llgfr	%r4,%r4			# unsigned int
-	llgtr	%r5,%r5			# void *
-	jg	sys_reboot		# branch to system call
-
-	.globl  old32_readdir_wrapper 
-old32_readdir_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# void *
-	llgfr	%r4,%r4			# unsigned int
-	jg	old32_readdir		# branch to system call
-
-	.globl  old32_mmap_wrapper 
-old32_mmap_wrapper:
-	llgtr	%r2,%r2			# struct mmap_arg_struct_emu31 *
-	jg	old32_mmap		# branch to system call
-
-	.globl  sys32_munmap_wrapper 
-sys32_munmap_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t 
-	jg	sys_munmap		# branch to system call
-
-	.globl  sys32_truncate_wrapper 
-sys32_truncate_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# unsigned long
-	jg	sys_truncate		# branch to system call
-
-	.globl  sys32_ftruncate_wrapper 
-sys32_ftruncate_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned long
-	jg	sys_ftruncate		# branch to system call
-
-	.globl  sys32_fchmod_wrapper 
-sys32_fchmod_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# mode_t
-	jg	sys_fchmod		# branch to system call
-
-	.globl  sys32_fchown16_wrapper 
-sys32_fchown16_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# __kernel_old_uid_emu31_t *
-	llgtr	%r4,%r4			# __kernel_old_gid_emu31_t *
-	jg	sys32_fchown16		# branch to system call
-
-	.globl  sys32_getpriority_wrapper 
-sys32_getpriority_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	jg	sys_getpriority		# branch to system call
-
-	.globl  sys32_setpriority_wrapper 
-sys32_setpriority_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	lgfr	%r4,%r4			# int
-	jg	sys_setpriority		# branch to system call
-
-	.globl  compat_sys_statfs_wrapper 
-compat_sys_statfs_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct compat_statfs *
-	jg	compat_sys_statfs	# branch to system call
-
-	.globl  compat_sys_fstatfs_wrapper 
-compat_sys_fstatfs_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# struct compat_statfs *
-	jg	compat_sys_fstatfs	# branch to system call
-
-	.globl  compat_sys_socketcall_wrapper 
-compat_sys_socketcall_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# u32 *
-	jg	compat_sys_socketcall	# branch to system call
-
-	.globl  sys32_syslog_wrapper 
-sys32_syslog_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# char *
-	lgfr	%r4,%r4			# int
-	jg	sys_syslog		# branch to system call
-
-	.globl  compat_sys_setitimer_wrapper 
-compat_sys_setitimer_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# struct itimerval_emu31 *
-	llgtr	%r4,%r4			# struct itimerval_emu31 *
-	jg	compat_sys_setitimer	# branch to system call
-
-	.globl  compat_sys_getitimer_wrapper 
-compat_sys_getitimer_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# struct itimerval_emu31 *
-	jg	compat_sys_getitimer	# branch to system call
-
-	.globl  compat_sys_newstat_wrapper 
-compat_sys_newstat_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	compat_sys_newstat	# branch to system call
-
-	.globl  compat_sys_newlstat_wrapper 
-compat_sys_newlstat_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	compat_sys_newlstat	# branch to system call
-
-	.globl  compat_sys_newfstat_wrapper 
-compat_sys_newfstat_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# struct stat_emu31 *
-	jg	compat_sys_newfstat	# branch to system call
-
-#sys32_vhangup_wrapper			# void 
-
-	.globl  sys32_wait4_wrapper 
-sys32_wait4_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	llgtr	%r3,%r3			# unsigned int *
-	lgfr	%r4,%r4			# int
-	llgtr	%r5,%r5			# struct rusage *
-	jg	sys32_wait4		# branch to system call
-
-	.globl  sys32_swapoff_wrapper 
-sys32_swapoff_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys_swapoff		# branch to system call
-
-	.globl  sys32_sysinfo_wrapper 
-sys32_sysinfo_wrapper:
-	llgtr	%r2,%r2			# struct sysinfo_emu31 *
-	jg	sys32_sysinfo		# branch to system call
-
-	.globl  sys32_ipc_wrapper 
-sys32_ipc_wrapper:
-	llgfr	%r2,%r2			# uint
-	lgfr	%r3,%r3			# int
-	lgfr	%r4,%r4			# int
-	lgfr	%r5,%r5			# int
-	llgtr	%r6,%r6			# void *
-	jg	sys32_ipc		# branch to system call
-
-	.globl  sys32_fsync_wrapper 
-sys32_fsync_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	jg	sys_fsync		# branch to system call
-
-#sys32_sigreturn_wrapper		# done in sigreturn_glue 
-
-#sys32_clone_wrapper			# done in clone_glue 
-
-	.globl  sys32_setdomainname_wrapper 
-sys32_setdomainname_wrapper:
-	llgtr	%r2,%r2			# char *
-	lgfr	%r3,%r3			# int
-	jg	sys_setdomainname	# branch to system call
-
-	.globl  sys32_newuname_wrapper 
-sys32_newuname_wrapper:
-	llgtr	%r2,%r2			# struct new_utsname *
-	jg	s390x_newuname		# branch to system call
-
-	.globl  sys32_adjtimex_wrapper 
-sys32_adjtimex_wrapper:
-	llgtr	%r2,%r2			# struct timex_emu31 *
-	jg	sys32_adjtimex		# branch to system call
-
-	.globl  sys32_mprotect_wrapper 
-sys32_mprotect_wrapper:
-	llgtr	%r2,%r2			# unsigned long (actually pointer
-	llgfr	%r3,%r3			# size_t
-	llgfr	%r4,%r4			# unsigned long
-	jg	sys_mprotect		# branch to system call
-
-	.globl  compat_sys_sigprocmask_wrapper 
-compat_sys_sigprocmask_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# compat_old_sigset_t *
-	llgtr	%r4,%r4			# compat_old_sigset_t *
-	jg	compat_sys_sigprocmask		# branch to system call
-
-	.globl  sys32_init_module_wrapper 
-sys32_init_module_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# struct module *
-	jg	sys32_init_module	# branch to system call
-
-	.globl  sys32_delete_module_wrapper 
-sys32_delete_module_wrapper:
-	llgtr	%r2,%r2			# const char *
-	jg	sys32_delete_module	# branch to system call
-
-	.globl  sys32_quotactl_wrapper 
-sys32_quotactl_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# const char *
-	lgfr	%r4,%r4			# int
-	llgtr	%r5,%r5			# caddr_t
-	jg	sys_quotactl		# branch to system call
-
-	.globl  sys32_getpgid_wrapper 
-sys32_getpgid_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	jg	sys_getpgid		# branch to system call
-
-	.globl  sys32_fchdir_wrapper 
-sys32_fchdir_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	jg	sys_fchdir		# branch to system call
-
-	.globl  sys32_bdflush_wrapper 
-sys32_bdflush_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# long
-	jg	sys_bdflush		# branch to system call
-
-	.globl  sys32_sysfs_wrapper 
-sys32_sysfs_wrapper:
-	lgfr	%r2,%r2			# int
-	llgfr	%r3,%r3			# unsigned long
-	llgfr	%r4,%r4			# unsigned long
-	jg	sys_sysfs		# branch to system call
-
-	.globl  sys32_personality_wrapper 
-sys32_personality_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	jg	s390x_personality	# branch to system call
-
-	.globl  sys32_setfsuid16_wrapper 
-sys32_setfsuid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
-	jg	sys32_setfsuid16	# branch to system call
-
-	.globl  sys32_setfsgid16_wrapper 
-sys32_setfsgid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
-	jg	sys32_setfsgid16	# branch to system call
-
-	.globl  sys32_llseek_wrapper 
-sys32_llseek_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned long
-	llgfr	%r4,%r4			# unsigned long
-	llgtr	%r5,%r5			# loff_t *
-	llgfr	%r6,%r6			# unsigned int
-	jg	sys_llseek		# branch to system call
-
-	.globl  sys32_getdents_wrapper 
-sys32_getdents_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# void *
-	llgfr	%r4,%r4			# unsigned int
-	jg	sys32_getdents		# branch to system call
-
-	.globl  sys32_select_wrapper 
-sys32_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
-
-	.globl  sys32_flock_wrapper 
-sys32_flock_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned int
-	jg	sys_flock		# branch to system call
-
-	.globl  sys32_msync_wrapper 
-sys32_msync_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t
-	lgfr	%r4,%r4			# int
-	jg	sys_msync		# branch to system call
-
-	.globl  sys32_readv_wrapper 
-sys32_readv_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgtr	%r3,%r3			# const struct iovec_emu31 *
-	llgfr	%r4,%r4			# unsigned long
-	jg	sys32_readv		# branch to system call
-
-	.globl  sys32_writev_wrapper 
-sys32_writev_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgtr	%r3,%r3			# const struct iovec_emu31 *
-	llgfr	%r4,%r4			# unsigned long
-	jg	sys32_writev		# branch to system call
-
-	.globl  sys32_getsid_wrapper 
-sys32_getsid_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	jg	sys_getsid		# branch to system call
-
-	.globl  sys32_fdatasync_wrapper 
-sys32_fdatasync_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	jg	sys_fdatasync		# branch to system call
-
-#sys32_sysctl_wrapper			# tbd 
-
-	.globl  sys32_mlock_wrapper 
-sys32_mlock_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t
-	jg	sys_mlock		# branch to system call
-
-	.globl  sys32_munlock_wrapper 
-sys32_munlock_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t
-	jg	sys_munlock		# branch to system call
-
-	.globl  sys32_mlockall_wrapper 
-sys32_mlockall_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_mlockall		# branch to system call
-
-#sys32_munlockall_wrapper		# void 
-
-	.globl  sys32_sched_setparam_wrapper 
-sys32_sched_setparam_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	llgtr	%r3,%r3			# struct sched_param *
-	jg	sys_sched_setparam	# branch to system call
-
-	.globl  sys32_sched_getparam_wrapper 
-sys32_sched_getparam_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	llgtr	%r3,%r3			# struct sched_param *
-	jg	sys_sched_getparam	# branch to system call
-
-	.globl  sys32_sched_setscheduler_wrapper 
-sys32_sched_setscheduler_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	lgfr	%r3,%r3			# int
-	llgtr	%r4,%r4			# struct sched_param *
-	jg	sys_sched_setscheduler	# branch to system call
-
-	.globl  sys32_sched_getscheduler_wrapper 
-sys32_sched_getscheduler_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	jg	sys_sched_getscheduler	# branch to system call
-
-#sys32_sched_yield_wrapper		# void 
-
-	.globl  sys32_sched_get_priority_max_wrapper 
-sys32_sched_get_priority_max_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_sched_get_priority_max	# branch to system call
-
-	.globl  sys32_sched_get_priority_min_wrapper 
-sys32_sched_get_priority_min_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_sched_get_priority_min	# branch to system call
-
-	.globl  sys32_sched_rr_get_interval_wrapper 
-sys32_sched_rr_get_interval_wrapper:
-	lgfr	%r2,%r2			# pid_t
-	llgtr	%r3,%r3			# struct compat_timespec *
-	jg	sys32_sched_rr_get_interval	# branch to system call
-
-	.globl  compat_sys_nanosleep_wrapper 
-compat_sys_nanosleep_wrapper:
-	llgtr	%r2,%r2			# struct compat_timespec *
-	llgtr	%r3,%r3			# struct compat_timespec *
-	jg	compat_sys_nanosleep		# branch to system call
-
-	.globl  sys32_mremap_wrapper 
-sys32_mremap_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# unsigned long
-	llgfr	%r4,%r4			# unsigned long
-	llgfr	%r5,%r5			# unsigned long
-	llgfr	%r6,%r6			# unsigned long
-	jg	sys_mremap		# branch to system call
-
-	.globl  sys32_setresuid16_wrapper 
-sys32_setresuid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_uid_emu31_t 
-	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
-	llgfr	%r4,%r4			# __kernel_old_uid_emu31_t 
-	jg	sys32_setresuid16	# branch to system call
-
-	.globl  sys32_getresuid16_wrapper 
-sys32_getresuid16_wrapper:
-	llgtr	%r2,%r2			# __kernel_old_uid_emu31_t *
-	llgtr	%r3,%r3			# __kernel_old_uid_emu31_t *
-	llgtr	%r4,%r4			# __kernel_old_uid_emu31_t *
-	jg	sys32_getresuid16	# branch to system call
-
-	.globl  sys32_poll_wrapper 
-sys32_poll_wrapper:
-	llgtr	%r2,%r2			# struct pollfd * 
-	llgfr	%r3,%r3			# unsigned int 
-	lgfr	%r4,%r4			# long 
-	jg	sys_poll		# branch to system call
-
-	.globl  sys32_nfsservctl_wrapper 
-sys32_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
-
-	.globl  sys32_setresgid16_wrapper 
-sys32_setresgid16_wrapper:
-	llgfr	%r2,%r2			# __kernel_old_gid_emu31_t 
-	llgfr	%r3,%r3			# __kernel_old_gid_emu31_t 
-	llgfr	%r4,%r4			# __kernel_old_gid_emu31_t 
-	jg	sys32_setresgid16	# branch to system call
-
-	.globl  sys32_getresgid16_wrapper 
-sys32_getresgid16_wrapper:
-	llgtr	%r2,%r2			# __kernel_old_gid_emu31_t *
-	llgtr	%r3,%r3			# __kernel_old_gid_emu31_t *
-	llgtr	%r4,%r4			# __kernel_old_gid_emu31_t *
-	jg	sys32_getresgid16	# branch to system call
-
-	.globl  sys32_prctl_wrapper 
-sys32_prctl_wrapper:
-	lgfr	%r2,%r2			# int
-	llgfr	%r3,%r3			# unsigned long
-	llgfr	%r4,%r4			# unsigned long
-	llgfr	%r5,%r5			# unsigned long
-	llgfr	%r6,%r6			# unsigned long
-	jg	sys_prctl		# branch to system call
-
-#sys32_rt_sigreturn_wrapper		# done in rt_sigreturn_glue 
-
-	.globl  sys32_rt_sigaction_wrapper 
-sys32_rt_sigaction_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# const struct sigaction_emu31 *
-	llgtr	%r4,%r4			# const struct sigaction_emu31 *
-	llgfr	%r5,%r5			# size_t
-	jg	sys32_rt_sigaction	# branch to system call
-
-	.globl  sys32_rt_sigprocmask_wrapper 
-sys32_rt_sigprocmask_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# old_sigset_emu31 *
-	llgtr	%r4,%r4			# old_sigset_emu31 *
-	jg	sys32_rt_sigprocmask	# branch to system call
-
-	.globl  sys32_rt_sigpending_wrapper 
-sys32_rt_sigpending_wrapper:
-	llgtr	%r2,%r2			# sigset_emu31 *
-	llgfr	%r3,%r3			# size_t
-	jg	sys32_rt_sigpending	# branch to system call
-
-	.globl  sys32_rt_sigtimedwait_wrapper 
-sys32_rt_sigtimedwait_wrapper:
-	llgtr	%r2,%r2			# const sigset_emu31_t *
-	llgtr	%r3,%r3			# siginfo_emu31_t *
-	llgtr	%r4,%r4			# const struct compat_timespec *
-	llgfr	%r5,%r5			# size_t
-	jg	sys32_rt_sigtimedwait	# branch to system call
-
-	.globl  sys32_rt_sigqueueinfo_wrapper 
-sys32_rt_sigqueueinfo_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	llgtr	%r4,%r4			# siginfo_emu31_t *
-	jg	sys32_rt_sigqueueinfo	# branch to system call
-
-#sys32_rt_sigsuspend_wrapper		# done in rt_sigsuspend_glue 
-
-	.globl  sys32_pread64_wrapper 
-sys32_pread64_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# char *
-	llgfr	%r4,%r4			# size_t
-	llgfr	%r5,%r5			# u32
-	llgfr	%r6,%r6			# u32
-	jg	sys32_pread64		# branch to system call
-
-	.globl  sys32_pwrite64_wrapper 
-sys32_pwrite64_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# const char *
-	llgfr	%r4,%r4			# size_t
-	llgfr	%r5,%r5			# u32
-	llgfr	%r6,%r6			# u32
-	jg	sys32_pwrite64		# branch to system call
-
-	.globl  sys32_chown16_wrapper 
-sys32_chown16_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# __kernel_old_uid_emu31_t 
-	llgfr	%r4,%r4			# __kernel_old_gid_emu31_t 
-	jg	sys32_chown16		# branch to system call
-
-	.globl  sys32_getcwd_wrapper 
-sys32_getcwd_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgfr	%r3,%r3			# unsigned long
-	jg	sys_getcwd		# branch to system call
-
-	.globl  sys32_capget_wrapper 
-sys32_capget_wrapper:
-	llgtr	%r2,%r2			# cap_user_header_t
-	llgtr	%r3,%r3			# cap_user_data_t
-	jg	sys_capget		# branch to system call
-
-	.globl  sys32_capset_wrapper 
-sys32_capset_wrapper:
-	llgtr	%r2,%r2			# cap_user_header_t
-	llgtr	%r3,%r3			# const cap_user_data_t
-	jg	sys_capset		# branch to system call
-
-	.globl sys32_sigaltstack_wrapper
-sys32_sigaltstack_wrapper:
-	llgtr	%r2,%r2			# const stack_emu31_t * 
-	llgtr	%r3,%r3			# stack_emu31_t * 
-	jg	sys32_sigaltstack
-
-	.globl  sys32_sendfile_wrapper 
-sys32_sendfile_wrapper:
-	lgfr	%r2,%r2			# int
-	lgfr	%r3,%r3			# int
-	llgtr	%r4,%r4			# __kernel_off_emu31_t *
-	llgfr	%r5,%r5			# size_t
-	jg	sys32_sendfile		# branch to system call
-
-#sys32_vfork_wrapper			# done in vfork_glue 
-
-	.globl  sys32_truncate64_wrapper 
-sys32_truncate64_wrapper:
-	llgtr	%r2,%r2			# const char *
-	lgfr	%r3,%r3			# s32 
-	llgfr	%r4,%r4			# u32 
-	jg	sys32_truncate64	# branch to system call
-
-	.globl  sys32_ftruncate64_wrapper 
-sys32_ftruncate64_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	lgfr	%r3,%r3			# s32 
-	llgfr	%r4,%r4			# u32 
-	jg	sys32_ftruncate64	# branch to system call
-
-	.globl sys32_lchown_wrapper	
-sys32_lchown_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# uid_t
-	llgfr	%r4,%r4			# gid_t
-	jg	sys_lchown		# branch to system call
-
-#sys32_getuid_wrapper			# void			 
-#sys32_getgid_wrapper			# void 
-#sys32_geteuid_wrapper			# void 
-#sys32_getegid_wrapper			# void 
-
-	.globl sys32_setreuid_wrapper
-sys32_setreuid_wrapper:
-	llgfr	%r2,%r2			# uid_t
-	llgfr	%r3,%r3			# uid_t
-	jg	sys_setreuid		# branch to system call
-
-	.globl sys32_setregid_wrapper
-sys32_setregid_wrapper:
-	llgfr	%r2,%r2			# gid_t
-	llgfr	%r3,%r3			# gid_t
-	jg	sys_setregid		# branch to system call
-
-	.globl  sys32_getgroups_wrapper 
-sys32_getgroups_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# gid_t *
-	jg	sys_getgroups		# branch to system call
-
-	.globl  sys32_setgroups_wrapper 
-sys32_setgroups_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# gid_t *
-	jg	sys_setgroups		# branch to system call
-
-	.globl sys32_fchown_wrapper	
-sys32_fchown_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# uid_t
-	llgfr	%r4,%r4			# gid_t
-	jg	sys_fchown		# branch to system call
-
-	.globl sys32_setresuid_wrapper	
-sys32_setresuid_wrapper:
-	llgfr	%r2,%r2			# uid_t
-	llgfr	%r3,%r3			# uid_t
-	llgfr	%r4,%r4			# uid_t
-	jg	sys_setresuid		# branch to system call
-
-	.globl sys32_getresuid_wrapper	
-sys32_getresuid_wrapper:
-	llgtr	%r2,%r2			# uid_t *
-	llgtr	%r3,%r3			# uid_t *
-	llgtr	%r4,%r4			# uid_t *
-	jg	sys_getresuid		# branch to system call
-
-	.globl sys32_setresgid_wrapper	
-sys32_setresgid_wrapper:
-	llgfr	%r2,%r2			# gid_t
-	llgfr	%r3,%r3			# gid_t
-	llgfr	%r4,%r4			# gid_t
-	jg	sys_setresgid		# branch to system call
-
-	.globl sys32_getresgid_wrapper	
-sys32_getresgid_wrapper:
-	llgtr	%r2,%r2			# gid_t *
-	llgtr	%r3,%r3			# gid_t *
-	llgtr	%r4,%r4			# gid_t *
-	jg	sys_getresgid		# branch to system call
-
-	.globl sys32_chown_wrapper	
-sys32_chown_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgfr	%r3,%r3			# uid_t
-	llgfr	%r4,%r4			# gid_t
-	jg	sys_chown		# branch to system call
-
-	.globl sys32_setuid_wrapper	
-sys32_setuid_wrapper:
-	llgfr	%r2,%r2			# uid_t
-	jg	sys_setuid		# branch to system call
-
-	.globl sys32_setgid_wrapper	
-sys32_setgid_wrapper:
-	llgfr	%r2,%r2			# gid_t
-	jg	sys_setgid		# branch to system call
-
-	.globl sys32_setfsuid_wrapper	
-sys32_setfsuid_wrapper:
-	llgfr	%r2,%r2			# uid_t
-	jg	sys_setfsuid		# branch to system call
-
-	.globl sys32_setfsgid_wrapper	
-sys32_setfsgid_wrapper:
-	llgfr	%r2,%r2			# gid_t
-	jg	sys_setfsgid		# branch to system call
-
-	.globl  sys32_pivot_root_wrapper 
-sys32_pivot_root_wrapper:
-	llgtr	%r2,%r2			# const char *
-	llgtr	%r3,%r3			# const char *
-	jg	sys_pivot_root		# branch to system call
-
-	.globl  sys32_mincore_wrapper 
-sys32_mincore_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t
-	llgtr	%r4,%r4			# unsigned char *
-	jg	sys_mincore		# branch to system call
-
-	.globl  sys32_madvise_wrapper 
-sys32_madvise_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgfr	%r3,%r3			# size_t
-	lgfr	%r4,%r4			# int
-	jg	sys_madvise		# branch to system call
-
-	.globl  sys32_getdents64_wrapper 
-sys32_getdents64_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgtr	%r3,%r3			# void *
-	llgfr	%r4,%r4			# unsigned int
-	jg	sys_getdents64		# branch to system call
-
-	.globl  compat_sys_fcntl64_wrapper 
-compat_sys_fcntl64_wrapper:
-	llgfr	%r2,%r2			# unsigned int
-	llgfr	%r3,%r3			# unsigned int 
-	llgfr	%r4,%r4			# unsigned long
-	jg	compat_sys_fcntl64	# branch to system call
-
-	.globl	sys32_stat64_wrapper
-sys32_stat64_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
-	jg	sys32_stat64		# branch to system call
-
-	.globl	sys32_lstat64_wrapper
-sys32_lstat64_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
-	jg	sys32_lstat64		# branch to system call
-
-	.globl	sys32_stime_wrapper
-sys32_stime_wrapper:
-	llgtr	%r2,%r2			# int *
-	jg	sys_stime		# branch to system call
-
-	.globl  sys32_sysctl_wrapper
-sys32_sysctl_wrapper:
-	llgtr   %r2,%r2                 # struct __sysctl_args32 *
-	jg      sys32_sysctl
-
-	.globl	sys32_fstat64_wrapper
-sys32_fstat64_wrapper:
-	llgfr	%r2,%r2			# unsigned long
-	llgtr	%r3,%r3			# struct stat64 *
-	llgfr	%r4,%r4			# long
-	jg	sys32_fstat64		# branch to system call
-
-	.globl  compat_sys_futex_wrapper 
-compat_sys_futex_wrapper:
-	llgtr	%r2,%r2			# u32 *
-	lgfr	%r3,%r3			# int
-	lgfr	%r4,%r4			# int
-	llgtr	%r5,%r5			# struct compat_timespec *
-	jg	compat_sys_futex	# branch to system call
-
-	.globl	sys32_setxattr_wrapper
-sys32_setxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	lgfr	%r6,%r6			# int
-	jg	sys_setxattr
-
-	.globl	sys32_lsetxattr_wrapper
-sys32_lsetxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	lgfr	%r6,%r6			# int
-	jg	sys_lsetxattr
-
-	.globl	sys32_fsetxattr_wrapper
-sys32_fsetxattr_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	lgfr	%r6,%r6			# int
-	jg	sys_fsetxattr
-
-	.globl	sys32_getxattr_wrapper
-sys32_getxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	jg	sys_getxattr
-
-	.globl	sys32_lgetxattr_wrapper
-sys32_lgetxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	jg	sys_lgetxattr
-
-	.globl	sys32_fgetxattr_wrapper
-sys32_fgetxattr_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# char *
-	llgtr	%r4,%r4			# void *
-	llgfr	%r5,%r5			# size_t
-	jg	sys_fgetxattr
-
-	.globl	sys32_listxattr_wrapper
-sys32_listxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgfr	%r4,%r4			# size_t
-	jg	sys_listxattr
-
-	.globl	sys32_llistxattr_wrapper
-sys32_llistxattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	llgfr	%r4,%r4			# size_t
-	jg	sys_llistxattr
-
-	.globl	sys32_flistxattr_wrapper
-sys32_flistxattr_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# char *
-	llgfr	%r4,%r4			# size_t
-	jg	sys_flistxattr
-
-	.globl	sys32_removexattr_wrapper
-sys32_removexattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	jg	sys_removexattr
-
-	.globl	sys32_lremovexattr_wrapper
-sys32_lremovexattr_wrapper:
-	llgtr	%r2,%r2			# char *
-	llgtr	%r3,%r3			# char *
-	jg	sys_lremovexattr
-
-	.globl	sys32_fremovexattr_wrapper
-sys32_fremovexattr_wrapper:
-	lgfr	%r2,%r2			# int
-	llgtr	%r3,%r3			# char *
-	jg	sys_fremovexattr
-
-	.globl	sys32_sched_setaffinity_wrapper
-sys32_sched_setaffinity_wrapper:
-	lgfr	%r2,%r2			# int
-	llgfr	%r3,%r3			# unsigned int
-	llgtr	%r4,%r4			# unsigned long *
-	jg	sys32_sched_setaffinity
-
-	.globl	sys32_sched_getaffinity_wrapper
-sys32_sched_getaffinity_wrapper:
-	lgfr	%r2,%r2			# int
-	llgfr	%r3,%r3			# unsigned int
-	llgtr	%r4,%r4			# unsigned long *
-	jg	sys32_sched_getaffinity
-
-	.globl  sys32_exit_group_wrapper
-sys32_exit_group_wrapper:
-	lgfr	%r2,%r2			# int
-	jg	sys_exit_group		# branch to system call
-
-	.globl  sys32_set_tid_address_wrapper
-sys32_set_tid_address_wrapper:
-	llgtr	%r2,%r2			# int *
-	jg	sys_set_tid_address	# branch to system call
diff -urN linux-2.5.67-bk5/arch/s390x/lib/Makefile linux-2.5.67-bk6/arch/s390x/lib/Makefile
--- linux-2.5.67-bk5/arch/s390x/lib/Makefile	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,9 +0,0 @@
-#
-# Makefile for s390-specific library files..
-#
-
-L_TARGET = lib.a
-
-EXTRA_AFLAGS := -traditional
-
-obj-y = delay.o memset.o strcmp.o strncpy.o uaccess.o
diff -urN linux-2.5.67-bk5/arch/s390x/lib/delay.c linux-2.5.67-bk6/arch/s390x/lib/delay.c
--- linux-2.5.67-bk5/arch/s390x/lib/delay.c	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/delay.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,50 +0,0 @@
-/*
- *  arch/s390x/kernel/delay.c
- *    Precise Delay Loops for S390
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Derived from "arch/i386/lib/delay.c"
- *    Copyright (C) 1993 Linus Torvalds
- *    Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
- */
-
-#include <linux/config.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-
-#ifdef CONFIG_SMP
-#include <asm/smp.h>
-#endif
-
-void __delay(unsigned long loops)
-{
-        /*
-         * To end the bloody studid and useless discussion about the
-         * BogoMips number I took the liberty to define the __delay
-         * function in a way that that resulting BogoMips number will
-         * yield the megahertz number of the cpu. The important function
-         * is udelay and that is done using the tod clock. -- martin.
-         */
-        __asm__ __volatile__(
-                "0: brct %0,0b"
-                : /* no outputs */ : "r" (loops/2) );
-}
-
-/*
- * Waits for 'usecs' microseconds using the tod clock
- */
-void __udelay(unsigned long usecs)
-{
-        uint64_t start_cc, end_cc;
-
-        if (usecs == 0)
-                return;
-        asm volatile ("STCK %0" : "=m" (start_cc));
-        do {
-                asm volatile ("STCK %0" : "=m" (end_cc));
-        } while (((end_cc - start_cc)/4096) < usecs);
-}
-
diff -urN linux-2.5.67-bk5/arch/s390x/lib/memset.S linux-2.5.67-bk6/arch/s390x/lib/memset.S
--- linux-2.5.67-bk5/arch/s390x/lib/memset.S	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/memset.S	1969-12-31 16:00:00.000000000 -0800
@@ -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 -urN linux-2.5.67-bk5/arch/s390x/lib/strcmp.S linux-2.5.67-bk6/arch/s390x/lib/strcmp.S
--- linux-2.5.67-bk5/arch/s390x/lib/strcmp.S	2003-04-07 10:31:45.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/strcmp.S	1969-12-31 16:00:00.000000000 -0800
@@ -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 -urN linux-2.5.67-bk5/arch/s390x/lib/strncpy.S linux-2.5.67-bk6/arch/s390x/lib/strncpy.S
--- linux-2.5.67-bk5/arch/s390x/lib/strncpy.S	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/strncpy.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,30 +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_exit   # ICM inserted a 0x00
-        BRCTG   4,strncpy_loop # R4 -= 1, jump to strncpy_loop if > 0
-strncpy_exit:
-        BR      14
-
diff -urN linux-2.5.67-bk5/arch/s390x/lib/uaccess.S linux-2.5.67-bk6/arch/s390x/lib/uaccess.S
--- linux-2.5.67-bk5/arch/s390x/lib/uaccess.S	2003-04-07 10:32:20.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/lib/uaccess.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,107 +0,0 @@
-/*
- *  arch/s390x/lib/uaccess.S
- *    __copy_{from|to}_user functions.
- *
- *  s390
- *    Copyright (C) 2000,2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Authors(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  These functions have standard call interface
- */
-
-#include <asm/lowcore.h>
-
-        .text
-        .align 4
-        .globl __copy_from_user_asm
-__copy_from_user_asm:
-	lgr	%r5,%r3
-	sacf	512
-0:	mvcle	%r2,%r4,0
-	jo	0b
-1:	sacf	0
-	lgr	%r2,%r5
-	br	%r14
-2:	lghi	%r1,-4096
-	lgr	%r3,%r4
-	slgr	%r3,%r1      # %r3 = %r4 + 4096
-	ngr	%r3,%r1      # %r3 = (%r4 + 4096) & -4096
-	slgr	%r3,%r4      # %r3 = #bytes to next user page boundary
-	clgr	%r5,%r3      # copy crosses next page boundary ?
-	jnh	1b           # no, this page fauled
-	# The page after the current user page might have faulted.
-	# We cant't find out which page because the program check handler
-	# might have callled schedule, destroying all lowcore information.
-	# We retry with the shortened length.
-3:	mvcle	%r2,%r4,0
-	jo	3b
-	j	1b
-        .section __ex_table,"a"
-	.quad	0b,2b
-	.quad	3b,1b
-        .previous
-
-        .align 4
-        .text
-        .globl __copy_to_user_asm
-__copy_to_user_asm:
-	lgr	%r5,%r3
-	sacf	512
-0:	mvcle	%r4,%r2,0
-	jo	0b
-1:	sacf	0
-	lgr	%r2,%r3
-	br	%r14
-2:	lghi	%r1,-4096
-	lgr	%r5,%r4
-	slgr	%r5,%r1      # %r5 = %r4 + 4096
-	ngr	%r5,%r1      # %r5 = (%r4 + 4096) & -4096
-	slgr	%r5,%r4      # %r5 = #bytes to next user page boundary
-	clgr	%r3,%r5      # copy crosses next page boundary ?
-	jnh	1b           # no, the current page fauled
-	# The page after the current user page might have faulted.
-	# We cant't find out which page because the program check handler
-	# might have callled schedule, destroying all lowcore information.
-	# We retry with the shortened length.
-3:	mvcle	%r4,%r2,0
-	jo	3b
-	j	1b
-        .section __ex_table,"a"
-	.quad	0b,2b
-	.quad	3b,1b
-        .previous
-
-        .align 4
-        .text
-        .globl __clear_user_asm
-__clear_user_asm:
-	lgr	%r4,%r2
-	lgr	%r5,%r3
-	sgr	%r2,%r2
-	sgr	%r3,%r3
-	sacf	512
-0:	mvcle	%r4,%r2,0
-	jo	0b
-1:	sacf	0
-	br	%r14
-2:	lgr	%r2,%r5
-	lghi	%r1,-4096
-	slgr	%r5,%r1      # %r5 = %r4 + 4096
-	ngr	%r5,%r1      # %r5 = (%r4 + 4096) & -4096
-	slgr	%r5,%r4      # %r5 = #bytes to next user page boundary
-	clgr	%r2,%r5      # copy crosses next page boundary ?
-	jnh	1b           # no, the current page fauled
-	# The page after the current user page might have faulted.
-	# We cant't find out which page because the program check handler
-	# might have callled schedule, destroying all lowcore information.
-	# We retry with the shortened length.
-	slgr	%r2,%r5
-3:	mvcle	%r4,%r2,0
-	jo	3b
-	j	1b
-4:	algr	%r2,%r5
-	j	1b
-        .section __ex_table,"a"
-	.quad	0b,2b
-        .quad	3b,4b
-        .previous
diff -urN linux-2.5.67-bk5/arch/s390x/mm/Makefile linux-2.5.67-bk6/arch/s390x/mm/Makefile
--- linux-2.5.67-bk5/arch/s390x/mm/Makefile	2003-04-07 10:31:44.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/mm/Makefile	1969-12-31 16:00:00.000000000 -0800
@@ -1,5 +0,0 @@
-#
-# Makefile for the linux s390-specific parts of the memory manager.
-#
-
-obj-y	 := init.o fault.o ioremap.o extable.o
diff -urN linux-2.5.67-bk5/arch/s390x/mm/extable.c linux-2.5.67-bk6/arch/s390x/mm/extable.c
--- linux-2.5.67-bk5/arch/s390x/mm/extable.c	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/mm/extable.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-/*
- *  arch/s390/mm/extable.c
- *
- *  S390 version
- *
- *  identical to arch/i386/mm/extable.c
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/spinlock.h>
-#include <asm/uaccess.h>
-
-/* Simple binary search */
-const struct exception_table_entry *
-search_extable(const struct exception_table_entry *first,
-	       const struct exception_table_entry *last,
-	       unsigned long value)
-{
-	while (first <= last) {
-		const struct exception_table_entry *mid;
-		long diff;
-
-		mid = (last - first) / 2 + first;
-		diff = mid->insn - value;
-		if (diff == 0)
-			return mid;
-		else if (diff < 0)
-			first = mid+1;
-		else
-			last = mid-1;
-	}
-	return NULL;
-}
diff -urN linux-2.5.67-bk5/arch/s390x/mm/fault.c linux-2.5.67-bk6/arch/s390x/mm/fault.c
--- linux-2.5.67-bk5/arch/s390x/mm/fault.c	2003-04-07 10:31:02.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/mm/fault.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,480 +0,0 @@
-/*
- *  arch/s390/mm/fault.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com)
- *               Ulrich Weigand (uweigand@de.ibm.com)
- *
- *  Derived from "arch/i386/mm/fault.c"
- *    Copyright (C) 1995  Linus Torvalds
- */
-
-#include <linux/config.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/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/module.h>
-
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/hardirq.h>
-
-#ifdef CONFIG_SYSCTL
-extern int sysctl_userprocess_debug;
-#endif
-
-extern void die(const char *,struct pt_regs *,long);
-
-extern spinlock_t timerlist_lock;
-
-/*
- * Unlock any spinlocks which will prevent us from getting the
- * message out (timerlist_lock is acquired through the
- * console unblank code)
- */
-void bust_spinlocks(int yes)
-{
-	if (yes) {
-		oops_in_progress = 1;
-	} else {
-		int loglevel_save = console_loglevel;
-		oops_in_progress = 0;
-		console_unblank();
-		/*
-		 * OK, the message is on the console.  Now we call printk()
-		 * without oops_in_progress set so that printk will give klogd
-		 * a poke.  Hold onto your hats...
-		 */
-		console_loglevel = 15;
-		printk(" ");
-		console_loglevel = loglevel_save;
-	}
-}
-
-/*
- * Check which address space is addressed by the access
- * register in S390_lowcore.exc_access_id.
- * Returns 1 for user space and 0 for kernel space.
- */
-static int __check_access_register(struct pt_regs *regs, int error_code)
-{
-	int areg = S390_lowcore.exc_access_id;
-
-	if (areg == 0)
-		/* Access via access register 0 -> kernel address */
-		return 0;
-	if (regs && areg < NUM_ACRS && regs->acrs[areg] <= 1)
-		/*
-		 * access register contains 0 -> kernel address,
-		 * access register contains 1 -> user space address
-		 */
-		return regs->acrs[areg];
-
-	/* Something unhealthy was done with the access registers... */
-	die("page fault via unknown access register", regs, error_code);
-	do_exit(SIGKILL);
-	return 0;
-}
-
-/*
- * Check which address space the address belongs to.
- * Returns 1 for user space and 0 for kernel space.
- */
-static inline int check_user_space(struct pt_regs *regs, int error_code)
-{
-	/*
-	 * The lowest two bits of S390_lowcore.trans_exc_code indicate
-	 * which paging table was used:
-	 *   0: Primary Segment Table Descriptor
-	 *   1: STD determined via access register
-	 *   2: Secondary Segment Table Descriptor
-	 *   3: Home Segment Table Descriptor
-	 */
-	int descriptor = S390_lowcore.trans_exc_code & 3;
-	if (descriptor == 1)
-		return __check_access_register(regs, error_code);
-	return descriptor >> 1;
-}
-		
-/*
- * Send SIGSEGV to task.  This is an external routine
- * to keep the stack usage of do_page_fault small.
- */
-static void force_sigsegv(struct pt_regs *regs, unsigned long error_code,
-			  int si_code, unsigned long address)
-{
-	struct siginfo si;
-
-#if defined(CONFIG_SYSCTL) || defined(CONFIG_PROCESS_DEBUG)
-#if defined(CONFIG_SYSCTL)
-	if (sysctl_userprocess_debug)
-#endif
-	{
-		printk("User process fault: interruption code 0x%lX\n",
-		       error_code);
-		printk("failing address: %lX\n", address);
-		show_regs(regs);
-	}
-#endif
-	si.si_signo = SIGSEGV;
-	si.si_code = si_code;
-	si.si_addr = (void *) address;
-	force_sig_info(SIGSEGV, &si, current);
-}
-
-/*
- * This routine handles page faults.  It determines the address,
- * and the problem, and then passes it off to one of the appropriate
- * routines.
- *
- * error_code:
- *   04       Protection           ->  Write-Protection  (suprression)
- *   10       Segment translation  ->  Not present       (nullification)
- *   11       Page translation     ->  Not present       (nullification)
- *   3b       Region third trans.  ->  Not present       (nullification)
- */
-extern inline void do_exception(struct pt_regs *regs, unsigned long error_code)
-{
-        struct task_struct *tsk;
-        struct mm_struct *mm;
-        struct vm_area_struct * vma;
-        unsigned long address;
-	int user_address;
-	const struct exception_table_entry *fixup;
-	int si_code = SEGV_MAPERR;
-
-        tsk = current;
-        mm = tsk->mm;
-	
-	/* 
-         * Check for low-address protection.  This needs to be treated
-	 * as a special case because the translation exception code 
-	 * field is not guaranteed to contain valid data in this case.
-	 */
-	if (error_code == 4 && !(S390_lowcore.trans_exc_code & 4)) {
-
-		/* Low-address protection hit in kernel mode means 
-		   NULL pointer write access in kernel mode.  */
- 		if (!(regs->psw.mask & PSW_MASK_PSTATE)) {
-			address = 0;
-			user_address = 0;
-			goto no_context;
-		}
-
-		/* Low-address protection hit in user mode 'cannot happen'.  */
-		die ("Low-address protection", regs, error_code);
-        	do_exit(SIGKILL);
-	}
-
-        /* 
-         * get the failing address 
-         * more specific the segment and page table portion of 
-         * the address 
-         */
-        address = S390_lowcore.trans_exc_code & -4096L;
-	user_address = check_user_space(regs, error_code);
-
-	/*
-	 * Verify that the fault happened in user space, that
-	 * we are not in an interrupt and that there is a 
-	 * user context.
-	 */
-        if (user_address == 0 || in_interrupt() || !mm)
-                goto no_context;
-
-	/*
-	 * When we get here, the fault happened in the current
-	 * task's user address space, so we can switch on the
-	 * interrupts again and then search the VMAs
-	 */
-	local_irq_enable();
-
-        down_read(&mm->mmap_sem);
-
-        vma = find_vma(mm, address);
-        if (!vma)
-                goto bad_area;
-        if (vma->vm_start <= address) 
-                goto good_area;
-        if (!(vma->vm_flags & VM_GROWSDOWN))
-                goto bad_area;
-        if (expand_stack(vma, address))
-                goto bad_area;
-/*
- * Ok, we have a good vm_area for this memory access, so
- * we can handle it..
- */
-good_area:
-	si_code = SEGV_ACCERR;
-	if (error_code != 4) {
-		/* page not present, check vm flags */
-		if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
-			goto bad_area;
-	} else {
-		if (!(vma->vm_flags & VM_WRITE))
-			goto bad_area;
-	}
-
-survive:
-	/*
-	 * If for any reason at all we couldn't handle the fault,
-	 * make sure we exit gracefully rather than endlessly redo
-	 * the fault.
-	 */
-	switch (handle_mm_fault(mm, vma, address, error_code == 4)) {
-	case VM_FAULT_MINOR:
-		tsk->min_flt++;
-		break;
-	case VM_FAULT_MAJOR:
-		tsk->maj_flt++;
-		break;
-	case VM_FAULT_SIGBUS:
-		goto do_sigbus;
-	case VM_FAULT_OOM:
-		goto out_of_memory;
-	default:
-		BUG();
-	}
-
-        up_read(&mm->mmap_sem);
-        return;
-
-/*
- * Something tried to access memory that isn't in our memory map..
- * Fix it, but check if it's kernel or user first..
- */
-bad_area:
-        up_read(&mm->mmap_sem);
-
-        /* User mode accesses just cause a SIGSEGV */
-        if (regs->psw.mask & PSW_MASK_PSTATE) {
-                tsk->thread.prot_addr = address;
-                tsk->thread.trap_no = error_code;
-		force_sigsegv(regs, error_code, si_code, address);
-                return;
-	}
-
-no_context:
-        /* Are we prepared to handle this kernel fault?  */
-	fixup = search_exception_tables(regs->psw.addr);
-	if (fixup) {
-		regs->psw.addr = fixup->fixup;
-                return;
-        }
-
-/*
- * Oops. The kernel tried to access some bad page. We'll have to
- * terminate things with extreme prejudice.
- */
-        if (user_address == 0)
-                printk(KERN_ALERT "Unable to handle kernel pointer dereference"
-        	       " at virtual kernel address %016lx\n", address);
-        else
-                printk(KERN_ALERT "Unable to handle kernel paging request"
-		       " at virtual user address %016lx\n", address);
-
-        die("Oops", regs, error_code);
-        do_exit(SIGKILL);
-
-
-/*
- * We ran out of memory, or some other thing happened to us that made
- * us unable to handle the page fault gracefully.
-*/
-out_of_memory:
-	up_read(&mm->mmap_sem);
-	if (tsk->pid == 1) {
-		yield();
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		do_exit(SIGKILL);
-	goto no_context;
-
-do_sigbus:
-	up_read(&mm->mmap_sem);
-
-	/*
-	 * Send a sigbus, regardless of whether we were in kernel
-	 * or user mode.
-	 */
-        tsk->thread.prot_addr = address;
-        tsk->thread.trap_no = error_code;
-	force_sig(SIGBUS, tsk);
-
-	/* Kernel mode? Handle exceptions or die */
-	if (!(regs->psw.mask & PSW_MASK_PSTATE))
-		goto no_context;
-}
-
-void do_protection_exception(struct pt_regs *regs, unsigned long error_code)
-{
-	regs->psw.addr -= (error_code >> 16);
-	do_exception(regs, 4);
-}
-
-void do_segment_exception(struct pt_regs *regs, unsigned long error_code)
-{
-	do_exception(regs, 0x10);
-}
-
-void do_page_exception(struct pt_regs *regs, unsigned long error_code)
-{
-	do_exception(regs, 0x11);
-}
-
-void do_region_exception(struct pt_regs *regs, unsigned long error_code)
-{
-	do_exception(regs, 0x3b);
-}
-
-#ifdef CONFIG_PFAULT
-/*
- * 'pfault' pseudo page faults routines.
- */
-static int pfault_disable = 0;
-
-static int __init nopfault(char *str)
-{
-	pfault_disable = 1;
-	return 1;
-}
-
-__setup("nopfault", nopfault);
-
-typedef struct {
-	__u16 refdiagc;
-	__u16 reffcode;
-	__u16 refdwlen;
-	__u16 refversn;
-	__u64 refgaddr;
-	__u64 refselmk;
-	__u64 refcmpmk;
-	__u64 reserved;
-} __attribute__ ((packed)) pfault_refbk_t;
-
-typedef struct _pseudo_wait_t {
-       struct _pseudo_wait_t *next;
-       wait_queue_head_t queue;
-       unsigned long address;
-       int resolved;
-} pseudo_wait_t;
-
-int pfault_init(void)
-{
-	pfault_refbk_t refbk =
-	{ 0x258, 0, 5, 2, __LC_KERNEL_STACK, 1ULL << 48, 1ULL << 48,
-          0x8000000000000000ULL };
-        int rc;
-
-	if (pfault_disable)
-		return -1;
-        __asm__ __volatile__(
-                "    diag  %1,%0,0x258\n"
-		"0:  j     2f\n"
-		"1:  la    %0,8\n"
-		"2:\n"
-		".section __ex_table,\"a\"\n"
-		"   .align 4\n"
-		"   .quad  0b,1b\n"
-		".previous"
-                : "=d" (rc) : "a" (&refbk) : "cc" );
-	__ctl_set_bit(0, 9);
-        return rc;
-}
-
-void pfault_fini(void)
-{
-	pfault_refbk_t refbk =
-	{ 0x258, 1, 5, 2, 0ULL, 0ULL, 0ULL, 0ULL };
-
-	if (pfault_disable)
-		return;
-	__ctl_clear_bit(0, 9);
-        __asm__ __volatile__(
-                "    diag  %0,0,0x258\n"
-		"0:\n"
-		".section __ex_table,\"a\"\n"
-		"   .align 4\n"
-		"   .quad  0b,0b\n"
-		".previous"
-		: : "a" (&refbk) : "cc" );
-}
-
-asmlinkage void
-pfault_interrupt(struct pt_regs *regs, __u16 error_code)
-{
-	struct task_struct *tsk;
-	wait_queue_head_t queue;
-	wait_queue_head_t *qp;
-	__u16 subcode;
-
-	/*
-	 * Get the external interruption subcode & pfault
-	 * initial/completion signal bit. VM stores this 
-	 * in the 'cpu address' field associated with the
-         * external interrupt. 
-	 */
-	subcode = S390_lowcore.cpu_addr;
-	if ((subcode & 0xff00) != 0x0600)
-		return;
-
-	/*
-	 * Get the token (= address of kernel stack of affected task).
-	 */
-	tsk = (struct task_struct *)
-		(*((unsigned long *) __LC_PFAULT_INTPARM) - THREAD_SIZE);
-
-	/*
-	 * We got all needed information from the lowcore and can
-	 * now safely switch on interrupts.
-	 */
-	if (regs->psw.mask & PSW_MASK_PSTATE)
-		local_irq_enable();
-
-	if (subcode & 0x0080) {
-		/* signal bit is set -> a page has been swapped in by VM */
-		qp = (wait_queue_head_t *)
-			xchg(&tsk->thread.pfault_wait, -1);
-		if (qp != NULL) {
-			/* Initial interrupt was faster than the completion
-			 * interrupt. pfault_wait is valid. Set pfault_wait
-			 * back to zero and wake up the process. This can
-			 * safely be done because the task is still sleeping
-			 * and can't procude new pfaults. */
-			tsk->thread.pfault_wait = 0ULL;
-			wake_up(qp);
-		}
-	} else {
-		/* signal bit not set -> a real page is missing. */
-                init_waitqueue_head (&queue);
-		qp = (wait_queue_head_t *)
-			xchg(&tsk->thread.pfault_wait, (addr_t) &queue);
-		if (qp != NULL) {
-			/* Completion interrupt was faster than the initial
-			 * interrupt (swapped in a -1 for pfault_wait). Set
-			 * pfault_wait back to zero and exit. This can be
-			 * done safely because tsk is running in kernel 
-			 * mode and can't produce new pfaults. */
-			tsk->thread.pfault_wait = 0ULL;
-		}
-
-                /* go to sleep */
-                wait_event(queue, tsk->thread.pfault_wait == 0ULL);
-	}
-}
-#endif
-
diff -urN linux-2.5.67-bk5/arch/s390x/mm/init.c linux-2.5.67-bk6/arch/s390x/mm/init.c
--- linux-2.5.67-bk5/arch/s390x/mm/init.c	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/mm/init.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,238 +0,0 @@
-/*
- *  arch/s390/mm/init.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hpenner@de.ibm.com)
- *
- *  Derived from "arch/i386/mm/init.c"
- *    Copyright (C) 1995  Linus Torvalds
- */
-
-#include <linux/config.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/smp.h>
-#include <linux/init.h>
-#ifdef CONFIG_BLK_DEV_INITRD
-#include <linux/blk.h>
-#endif
-#include <linux/pagemap.h>
-#include <linux/bootmem.h>
-
-#include <asm/processor.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/pgalloc.h>
-#include <asm/dma.h>
-#include <asm/lowcore.h>
-#include <asm/tlb.h>
-#include <asm/tlbflush.h>
-
-struct mmu_gather mmu_gathers[NR_CPUS];
-
-pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((__aligned__(PAGE_SIZE)));
-char  empty_zero_page[PAGE_SIZE] __attribute__((__aligned__(PAGE_SIZE)));
-
-void show_mem(void)
-{
-        int i, total = 0,reserved = 0;
-        int shared = 0, cached = 0;
-
-        printk("Mem-info:\n");
-        show_free_areas();
-        printk("Free swap:       %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
-        i = max_mapnr;
-        while (i-- > 0) {
-                total++;
-                if (PageReserved(mem_map+i))
-                        reserved++;
-                else if (PageSwapCache(mem_map+i))
-                        cached++;
-                else if (page_count(mem_map+i))
-                        shared += atomic_read(&mem_map[i].count) - 1;
-        }
-        printk("%d pages of RAM\n",total);
-        printk("%d reserved pages\n",reserved);
-        printk("%d pages shared\n",shared);
-        printk("%d pages swap cached\n",cached);
-}
-
-/* References to section boundaries */
-
-extern unsigned long _text;
-extern unsigned long _etext;
-extern unsigned long _edata;
-extern unsigned long __bss_start;
-extern unsigned long _end;
-
-extern unsigned long __init_begin;
-extern unsigned long __init_end;
-
-/*
- * paging_init() sets up the page tables
- */
-
-unsigned long last_valid_pfn;
-
-void __init paging_init(void)
-{
-        pgd_t * pg_dir;
-	pmd_t * pm_dir;
-        pte_t * pt_dir;
-        pte_t   pte;
-	int     i,j,k;
-        unsigned long pfn = 0;
-        unsigned long pgdir_k = (__pa(swapper_pg_dir) & PAGE_MASK) |
-          _KERN_REGION_TABLE;
-	static const int ssm_mask = 0x04000000L;
-
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
-	unsigned long dma_pfn, high_pfn;
-
-	dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT;
-	high_pfn = max_low_pfn;
-
-	if (dma_pfn > high_pfn)
-		zones_size[ZONE_DMA] = high_pfn;
-	else {
-		zones_size[ZONE_DMA] = dma_pfn;
-		zones_size[ZONE_NORMAL] = high_pfn - dma_pfn;
-	}
-
-	/* Initialize mem_map[].  */
-	free_area_init(zones_size);
-
-
-	/*
-	 * map whole physical memory to virtual memory (identity mapping) 
-	 */
-
-        pg_dir = swapper_pg_dir;
-	
-        for (i = 0 ; i < PTRS_PER_PGD ; i++,pg_dir++) {
-
-                if (pfn >= max_low_pfn) {
-                        pgd_clear(pg_dir);
-                        continue;
-                }          
-        
-	        pm_dir = (pmd_t *) alloc_bootmem_low_pages(PAGE_SIZE*4);
-                pgd_populate(&init_mm, pg_dir, pm_dir);
-
-                for (j = 0 ; j < PTRS_PER_PMD ; j++,pm_dir++) {
-                        if (pfn >= max_low_pfn) {
-                                pmd_clear(pm_dir);
-                                continue; 
-                        }          
-                        
-                        pt_dir = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
-                        pmd_populate_kernel(&init_mm, pm_dir, pt_dir);
-	
-                        for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) {
-                                pte = pfn_pte(pfn, PAGE_KERNEL);
-                                if (pfn >= max_low_pfn) {
-                                        pte_clear(&pte); 
-                                        continue;
-                                }
-                                set_pte(pt_dir, pte);
-                                pfn++;
-                        }
-                }
-        }
-        
-        /* enable virtual mapping in kernel mode */
-        __asm__ __volatile__("lctlg 1,1,%0\n\t"
-                             "lctlg 7,7,%0\n\t"
-                             "lctlg 13,13,%0\n\t"
-                             "ssm   %1"
-			     : :"m" (pgdir_k), "m" (ssm_mask));
-
-        local_flush_tlb();
-
-        return;
-}
-
-void __init mem_init(void)
-{
-	unsigned long codesize, reservedpages, datasize, initsize;
-
-        max_mapnr = num_physpages = max_low_pfn;
-        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
-
-        /* clear the zero-page */
-        memset(empty_zero_page, 0, PAGE_SIZE);
-
-	/* this will put all low memory onto the freelists */
-	totalram_pages += free_all_bootmem();
-
-	reservedpages = 0;
-
-	codesize =  (unsigned long) &_etext - (unsigned long) &_text;
-	datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
-	initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
-        printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
-                (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
-                max_mapnr << (PAGE_SHIFT-10),
-                codesize >> 10,
-                reservedpages << (PAGE_SHIFT-10),
-                datasize >>10,
-                initsize >> 10);
-}
-
-void free_initmem(void)
-{
-        unsigned long addr;
-
-        addr = (unsigned long)(&__init_begin);
-        for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
-		ClearPageReserved(virt_to_page(addr));
-		set_page_count(virt_to_page(addr), 1);
-		free_page(addr);
-		totalram_pages++;
-        }
-        printk ("Freeing unused kernel memory: %ldk freed\n",
-		((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10);
-}
-
-#ifdef CONFIG_BLK_DEV_INITRD
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-        if (start < end)
-                printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
-	for (; start < end; start += PAGE_SIZE) {
-                ClearPageReserved(virt_to_page(start));
-                set_page_count(virt_to_page(start), 1);
-		free_page(start);
-		totalram_pages++;
-	}
-}
-#endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4 
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
diff -urN linux-2.5.67-bk5/arch/s390x/mm/ioremap.c linux-2.5.67-bk6/arch/s390x/mm/ioremap.c
--- linux-2.5.67-bk5/arch/s390x/mm/ioremap.c	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/mm/ioremap.c	1969-12-31 16:00:00.000000000 -0800
@@ -1,138 +0,0 @@
-/*
- *  arch/s390/mm/ioremap.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com)
- *
- *  Derived from "arch/i386/mm/extable.c"
- *    (C) Copyright 1995 1996 Linus Torvalds
- *
- * Re-map IO memory to kernel address space so that we can access it.
- * This is needed for high PCI addresses that aren't mapped in the
- * 640k-1MB IO memory area on PC's
- */
-
-#include <linux/vmalloc.h>
-#include <linux/mm.h>
-#include <asm/io.h>
-#include <asm/pgalloc.h>
-#include <asm/cacheflush.h>
-#include <asm/tlbflush.h>
-
-static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
-        unsigned long phys_addr, unsigned long flags)
-{
-        unsigned long end;
-        unsigned long pfn;
-
-        address &= ~PMD_MASK;
-        end = address + size;
-        if (end > PMD_SIZE)
-                end = PMD_SIZE;
-	if (address >= end)
-		BUG();
-        pfn = phys_addr >> PAGE_SHIFT;
-        do {
-                if (!pte_none(*pte)) {
-                        printk("remap_area_pte: page already exists\n");
-			BUG();
-		}
-                set_pte(pte, pfn_pte(pfn, __pgprot(_PAGE_PRESENT | flags)));
-                address += PAGE_SIZE;
-                pfn++;
-                pte++;
-        } while (address && (address < end));
-}
-
-static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
-        unsigned long phys_addr, unsigned long flags)
-{
-	unsigned long end;
-
-	address &= ~PGDIR_MASK;
-	end = address + size;
-	if (end > PGDIR_SIZE)
-		end = PGDIR_SIZE;
-	phys_addr -= address;
-	if (address >= end)
-		BUG();
-	do {
-		pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
-		if (!pte)
-			return -ENOMEM;
-		remap_area_pte(pte, address, end - address, address + phys_addr, flags);
-		address = (address + PMD_SIZE) & PMD_MASK;
-		pmd++;
-	} while (address && (address < end));
-	return 0;
-}
-
-static int remap_area_pages(unsigned long address, unsigned long phys_addr,
-				 unsigned long size, unsigned long flags)
-{
-	int error;
-	pgd_t * dir;
-	unsigned long end = address + size;
-
-	phys_addr -= address;
-	dir = pgd_offset(&init_mm, address);
-	flush_cache_all();
-	if (address >= end)
-		BUG();
-	spin_lock(&init_mm.page_table_lock);
-	do {
-		pmd_t *pmd;
-		pmd = pmd_alloc(&init_mm, dir, address);
-		error = -ENOMEM;
-		if (!pmd)
-			break;
-		if (remap_area_pmd(pmd, address, end - address,
-					 phys_addr + address, flags))
-			break;
-		error = 0;
-		address = (address + PGDIR_SIZE) & PGDIR_MASK;
-		dir++;
-	} while (address && (address < end));
-	spin_unlock(&init_mm.page_table_lock);
-	flush_tlb_all();
-	return 0;
-}
-
-/*
- * Generic mapping function (not visible outside):
- */
-
-/*
- * Remap an arbitrary physical address space into the kernel virtual
- * address space. Needed when the kernel wants to access high addresses
- * directly.
- */
-void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
-{
-	void * addr;
-	struct vm_struct * area;
-
-	if (phys_addr < virt_to_phys(high_memory))
-		return phys_to_virt(phys_addr);
-	if (phys_addr & ~PAGE_MASK)
-		return NULL;
-	size = PAGE_ALIGN(size);
-	if (!size || size > phys_addr + size)
-		return NULL;
-	area = get_vm_area(size, VM_IOREMAP);
-	if (!area)
-		return NULL;
-	addr = area->addr;
-	if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) {
-		vfree(addr);
-		return NULL;
-	}
-	return addr;
-}
-
-void iounmap(void *addr)
-{
-	if (addr > high_memory)
-		return vfree(addr);
-}
diff -urN linux-2.5.67-bk5/arch/s390x/vmlinux.lds.S linux-2.5.67-bk6/arch/s390x/vmlinux.lds.S
--- linux-2.5.67-bk5/arch/s390x/vmlinux.lds.S	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/s390x/vmlinux.lds.S	1969-12-31 16:00:00.000000000 -0800
@@ -1,122 +0,0 @@
-/*	
- * Written by Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-#include <asm-generic/vmlinux.lds.h>
-
-OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
-OUTPUT_ARCH(s390:64-bit)
-ENTRY(_start)
-jiffies = jiffies_64;
-SECTIONS
-{
-  . = 0x00000000;
-  _text = .;			/* Text and read-only data */
-  .text : {
-	*(.text)
-	*(.fixup)
-	*(.gnu.warning)
-	} = 0x0700
-
-  _etext = .;			/* End of text section */
-
-  . = ALIGN(16);		/* Exception table */
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  RODATA
-	
-#ifdef CONFIG_SHARED_KERNEL
-  . = ALIGN(1048576);		/* VM shared segments are 1MB aligned */
-
-  _eshared = .;			/* End of shareable data */
-#endif
-
-  .data : {			/* Data */
-	*(.data)
-	CONSTRUCTORS
-	}
-
-  . = ALIGN(4096);
-  __nosave_begin = .;
-  .data_nosave : { *(.data.nosave) }
-  . = ALIGN(4096);
-  __nosave_end = .;
-
-  . = ALIGN(4096);
-  .data.page_aligned : { *(.data.idt) }
-
-  . = ALIGN(32);
-  .data.cacheline_aligned : { *(.data.cacheline_aligned) }
-
-  _edata = .;			/* End of data section */
-
-  . = ALIGN(8192);		/* init_task */
-  .data.init_task : { *(.data.init_task) }
-
-  /* will be freed after init */
-  . = ALIGN(4096);		/* Init code and data */
-  __init_begin = .;
-  .init.text : { 
-	_sinittext = .;
-	*(.init.text)
-	_einittext = .;
-  }
-  .init.data : { *(.init.data) }
-  . = ALIGN(256);
-  __setup_start = .;
-  .init.setup : { *(.init.setup) }
-  __setup_end = .;
-  __start___param = .;
-  __param : { *(__param) }
-  __stop___param = .;
-  __initcall_start = .;
-  .initcall.init : {
-	*(.initcall1.init) 
-	*(.initcall2.init) 
-	*(.initcall3.init) 
-	*(.initcall4.init) 
-	*(.initcall5.init) 
-	*(.initcall6.init) 
-	*(.initcall7.init)
-  }
-  __initcall_end = .;
-  __con_initcall_start = .;
-  .con_initcall.init : { *(.con_initcall.init) }
-  __con_initcall_end = .;
-  . = ALIGN(256);
-  __initramfs_start = .;
-  .init.ramfs : { *(.init.initramfs) }
-  __initramfs_end = .;
-  . = ALIGN(256);
-  __per_cpu_start = .;
-  .data.percpu  : { *(.data.percpu) }
-  __per_cpu_end = .;
-  . = ALIGN(4096);
-  __init_end = .;
-  /* freed after init ends here */
-
-  __bss_start = .;		/* BSS */
-  .bss : { *(.bss) }
-  __bss_stop = .;
-
-  _end = . ;
-
-  /* Sections to be discarded */
-  /DISCARD/ : {
-	*(.exit.text)
-	*(.exit.data)
-	*(.exitcall.exit)
-	*(.eh_frame)
-	}
-
-  /* Stabs debugging sections.  */
-  .stab 0 : { *(.stab) }
-  .stabstr 0 : { *(.stabstr) }
-  .stab.excl 0 : { *(.stab.excl) }
-  .stab.exclstr 0 : { *(.stab.exclstr) }
-  .stab.index 0 : { *(.stab.index) }
-  .stab.indexstr 0 : { *(.stab.indexstr) }
-  .comment 0 : { *(.comment) }
-}
diff -urN linux-2.5.67-bk5/arch/sparc/kernel/traps.c linux-2.5.67-bk6/arch/sparc/kernel/traps.c
--- linux-2.5.67-bk5/arch/sparc/kernel/traps.c	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc/kernel/traps.c	2003-04-15 04:36:14.000000000 -0700
@@ -153,6 +153,7 @@
 void do_illegal_instruction(struct pt_regs *regs, unsigned long pc, unsigned long npc,
 			    unsigned long psr)
 {
+	extern int do_user_muldiv (struct pt_regs *, unsigned long);
 	siginfo_t info;
 
 	if(psr & PSR_PS)
@@ -161,11 +162,9 @@
 	printk("Ill instr. at pc=%08lx instruction is %08lx\n",
 	       regs->pc, *(unsigned long *)regs->pc);
 #endif
-	if (sparc_cpu_model == sun4c || sparc_cpu_model == sun4) {
-		extern int do_user_muldiv (struct pt_regs *, unsigned long);
-		if (!do_user_muldiv (regs, pc))
-			return;
-	}
+	if (!do_user_muldiv (regs, pc))
+		return;
+
 	info.si_signo = SIGILL;
 	info.si_errno = 0;
 	info.si_code = ILL_ILLOPC;
diff -urN linux-2.5.67-bk5/arch/sparc/mm/srmmu.c linux-2.5.67-bk6/arch/sparc/mm/srmmu.c
--- linux-2.5.67-bk5/arch/sparc/mm/srmmu.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc/mm/srmmu.c	2003-04-15 04:36:14.000000000 -0700
@@ -108,7 +108,7 @@
 ctxd_t *srmmu_context_table;
 
 int viking_mxcc_present;
-spinlock_t srmmu_context_spinlock = SPIN_LOCK_UNLOCKED;
+static spinlock_t srmmu_context_spinlock = SPIN_LOCK_UNLOCKED;
 
 int is_hypersparc;
 
@@ -152,7 +152,7 @@
 void *srmmu_nocache_bitmap;
 int srmmu_nocache_low;
 int srmmu_nocache_used;
-spinlock_t srmmu_nocache_spinlock;
+static spinlock_t srmmu_nocache_spinlock = SPIN_LOCK_UNLOCKED;
 
 /* This makes sense. Honest it does - Anton */
 #define __nocache_pa(VADDR) (((unsigned long)VADDR) - SRMMU_NOCACHE_VADDR + __pa((unsigned long)srmmu_nocache_pool))
@@ -2199,8 +2199,6 @@
 	page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
 	pg_iobits = SRMMU_VALID | SRMMU_WRITE | SRMMU_REF;
 
-	BTFIXUPSET_SIMM13(pte_file_max_bits, SRMMU_PTE_FILE_MAX_BITS);
-
 	/* Functions */
 #ifndef CONFIG_SMP	
 	BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2);
diff -urN linux-2.5.67-bk5/arch/sparc/mm/sun4c.c linux-2.5.67-bk6/arch/sparc/mm/sun4c.c
--- linux-2.5.67-bk5/arch/sparc/mm/sun4c.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc/mm/sun4c.c	2003-04-15 04:36:14.000000000 -0700
@@ -1808,7 +1808,7 @@
 
 static unsigned long sun4c_pte_to_pgoff(pte_t pte)
 {
-	return pte_val(pte) & ((1UL << SUN4C_PTE_FILE_MAX_BITS) - 1);
+	return pte_val(pte) & ((1UL << PTE_FILE_MAX_BITS) - 1);
 }
 
 
@@ -2127,8 +2127,6 @@
 	pg_iobits = _SUN4C_PAGE_PRESENT | _SUN4C_READABLE | _SUN4C_WRITEABLE |
 		    _SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE;
 
-	BTFIXUPSET_SIMM13(pte_file_max_bits, SUN4C_PTE_FILE_MAX_BITS);
-
 	/* Functions */
 	BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4c, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(do_check_pgt_cache, sun4c_check_pgt_cache, BTFIXUPCALL_NORM);
diff -urN linux-2.5.67-bk5/arch/sparc64/defconfig linux-2.5.67-bk6/arch/sparc64/defconfig
--- linux-2.5.67-bk5/arch/sparc64/defconfig	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc64/defconfig	2003-04-15 04:36:14.000000000 -0700
@@ -361,6 +361,7 @@
 # CONFIG_SYN_COOKIES is not set
 CONFIG_INET_AH=y
 CONFIG_INET_ESP=y
+CONFIG_INET_IPCOMP=y
 CONFIG_IPV6=m
 CONFIG_IPV6_PRIVACY=y
 CONFIG_INET6_AH=m
diff -urN linux-2.5.67-bk5/arch/sparc64/kernel/sys_sparc32.c linux-2.5.67-bk6/arch/sparc64/kernel/sys_sparc32.c
--- linux-2.5.67-bk5/arch/sparc64/kernel/sys_sparc32.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc64/kernel/sys_sparc32.c	2003-04-15 04:36:14.000000000 -0700
@@ -2831,56 +2831,6 @@
 	return error;
 }
 
-extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage long sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	if (get_user(kernel_mask, user_mask_ptr))
-		return -EFAULT;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_setaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	return ret;
-}
-
-extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
-					    unsigned long *user_mask_ptr);
-
-asmlinkage long sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
-				       u32 *user_mask_ptr)
-{
-	unsigned long kernel_mask;
-	mm_segment_t old_fs;
-	int ret;
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	ret = sys_sched_getaffinity(pid,
-				    /* XXX Nice api... */
-				    sizeof(kernel_mask),
-				    &kernel_mask);
-	set_fs(old_fs);
-
-	if (ret > 0) {
-		if (put_user(kernel_mask, user_mask_ptr))
-			ret = -EFAULT;
-	}
-
-	return ret;
-}
-
 extern long sys_lookup_dcookie(u64 cookie64, char *buf, size_t len);
 
 long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf, size_t len)
diff -urN linux-2.5.67-bk5/arch/sparc64/kernel/systbls.S linux-2.5.67-bk6/arch/sparc64/kernel/systbls.S
--- linux-2.5.67-bk5/arch/sparc64/kernel/systbls.S	2003-04-07 10:31:09.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc64/kernel/systbls.S	2003-04-15 04:36:14.000000000 -0700
@@ -51,7 +51,7 @@
 	.word sys32_setrlimit, sys_pivot_root, sys32_prctl, sys32_pciconfig_read, sys32_pciconfig_write
 /*150*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 	.word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
-/*160*/	.word sys32_sched_setaffinity, sys32_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
+/*160*/	.word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
 	.word sys_quotactl, sys_set_tid_address, sys32_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
diff -urN linux-2.5.67-bk5/arch/sparc64/solaris/ioctl.c linux-2.5.67-bk6/arch/sparc64/solaris/ioctl.c
--- linux-2.5.67-bk5/arch/sparc64/solaris/ioctl.c	2003-04-07 10:31:45.000000000 -0700
+++ linux-2.5.67-bk6/arch/sparc64/solaris/ioctl.c	2003-04-15 04:36:14.000000000 -0700
@@ -291,15 +291,15 @@
 {
 	struct inode *ino;
 	/* I wonder which of these tests are superfluous... --patrik */
-	read_lock(&current->files->file_lock);
+	spin_lock(&current->files->file_lock);
 	if (! current->files->fd[fd] ||
 	    ! current->files->fd[fd]->f_dentry ||
 	    ! (ino = current->files->fd[fd]->f_dentry->d_inode) ||
 	    ! ino->i_sock) {
-		read_unlock(&current->files->file_lock);
+		spin_unlock(&current->files->file_lock);
 		return TBADF;
 	}
-	read_unlock(&current->files->file_lock);
+	spin_unlock(&current->files->file_lock);
 	
 	switch (cmd & 0xff) {
 	case 109: /* SI_SOCKPARAMS */
diff -urN linux-2.5.67-bk5/arch/x86_64/ia32/ia32entry.S linux-2.5.67-bk6/arch/x86_64/ia32/ia32entry.S
--- linux-2.5.67-bk5/arch/x86_64/ia32/ia32entry.S	2003-04-07 10:31:13.000000000 -0700
+++ linux-2.5.67-bk6/arch/x86_64/ia32/ia32entry.S	2003-04-15 04:36:14.000000000 -0700
@@ -445,8 +445,8 @@
 	.quad sys_tkill		/* 238 */ 
 	.quad sys_sendfile64 
 	.quad compat_sys_futex		/* 240 */
-        .quad sys32_sched_setaffinity
-        .quad sys32_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
diff -urN linux-2.5.67-bk5/arch/x86_64/ia32/sys_ia32.c linux-2.5.67-bk6/arch/x86_64/ia32/sys_ia32.c
--- linux-2.5.67-bk5/arch/x86_64/ia32/sys_ia32.c	2003-04-07 10:31:09.000000000 -0700
+++ linux-2.5.67-bk6/arch/x86_64/ia32/sys_ia32.c	2003-04-15 04:36:14.000000000 -0700
@@ -2038,41 +2038,6 @@
 	return -ENOSYS ;
 } 
 
-long sys_sched_getaffinity(pid_t pid, unsigned int len, unsigned long *new_mask_ptr); 
-long sys_sched_setaffinity(pid_t pid, unsigned int len, unsigned long *new_mask_ptr); 
-
-/* only works on LE */
-long sys32_sched_setaffinity(pid_t pid, unsigned int len,
-			    unsigned int *new_mask_ptr)
-{
-	mm_segment_t oldfs = get_fs(); 
-	unsigned long mask; 
-	int err;
-	if (get_user(mask, new_mask_ptr)) 
-		return -EFAULT;	
-	set_fs(KERNEL_DS); 
-	err = sys_sched_setaffinity(pid,sizeof(mask),&mask); 	
-	set_fs(oldfs); 
-	return err;
-}
-
-/* only works on LE */ 
-long sys32_sched_getaffinity(pid_t pid, unsigned int len,
-			    unsigned int *new_mask_ptr)
-{
-	mm_segment_t oldfs = get_fs(); 
-	unsigned long mask; 
-	int err;
-	mask = 0; 
-	set_fs(KERNEL_DS); 
-	err = sys_sched_getaffinity(pid,sizeof(mask),&mask); 	
-	set_fs(oldfs); 
-	if (err > 0) 
-		err = put_user((u32)mask, new_mask_ptr); 
-	return err;
-}
-
-
 extern long sys_io_setup(unsigned nr_reqs, aio_context_t *ctx);
 
 long sys32_io_setup(unsigned nr_reqs, u32 *ctx32p)
diff -urN linux-2.5.67-bk5/drivers/acpi/bus.c linux-2.5.67-bk6/drivers/acpi/bus.c
--- linux-2.5.67-bk5/drivers/acpi/bus.c	2003-04-15 04:36:07.000000000 -0700
+++ linux-2.5.67-bk6/drivers/acpi/bus.c	2003-04-15 04:36:14.000000000 -0700
@@ -281,7 +281,7 @@
 	int			data)
 {
 	struct acpi_bus_event	*event = NULL;
-	u32			flags = 0;
+	unsigned long		flags = 0;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
 
@@ -314,7 +314,7 @@
 acpi_bus_receive_event (
 	struct acpi_bus_event	*event)
 {
-	u32			flags = 0;
+	unsigned long		flags = 0;
 	struct acpi_bus_event	*entry = NULL;
 
 	DECLARE_WAITQUEUE(wait, current);
diff -urN linux-2.5.67-bk5/drivers/char/genrtc.c linux-2.5.67-bk6/drivers/char/genrtc.c
--- linux-2.5.67-bk5/drivers/char/genrtc.c	2003-04-07 10:32:49.000000000 -0700
+++ linux-2.5.67-bk6/drivers/char/genrtc.c	2003-04-15 04:36:14.000000000 -0700
@@ -88,7 +88,7 @@
 
 static unsigned int oldsecs;
 static int lostint;
-static int tt_exp;
+static unsigned long tt_exp;
 
 static void gen_rtc_timer(unsigned long data);
 
diff -urN linux-2.5.67-bk5/drivers/char/sx.c linux-2.5.67-bk6/drivers/char/sx.c
--- linux-2.5.67-bk5/drivers/char/sx.c	2003-04-15 04:36:08.000000000 -0700
+++ linux-2.5.67-bk6/drivers/char/sx.c	2003-04-15 04:36:14.000000000 -0700
@@ -207,7 +207,6 @@
 #include <linux/module.h>
 #include <linux/config.h> 
 #include <linux/kdev_t.h>
-#include <asm/io.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/ioport.h>
@@ -227,6 +226,9 @@
 #include <linux/miscdevice.h>
 #include <linux/bitops.h>
 
+#include <asm/io.h>
+#include <asm/uaccess.h>
+
 /* The 3.0.0 version of sxboards/sxwindow.h  uses BYTE and WORD.... */
 #define BYTE u8
 #define WORD u16
diff -urN linux-2.5.67-bk5/drivers/char/tty_io.c linux-2.5.67-bk6/drivers/char/tty_io.c
--- linux-2.5.67-bk5/drivers/char/tty_io.c	2003-04-15 04:36:08.000000000 -0700
+++ linux-2.5.67-bk6/drivers/char/tty_io.c	2003-04-15 04:36:14.000000000 -0700
@@ -151,7 +151,7 @@
 extern int vme_scc_init (void);
 extern int serial167_init(void);
 extern int rs_8xx_init(void);
-extern void hwc_tty_init(void);
+extern void sclp_tty_init(void);
 extern void tty3215_init(void);
 extern void tub3270_init(void);
 extern void rs_360_init(void);
@@ -1286,7 +1286,14 @@
 	}
 	
 	/*
-	 * Make sure that the tty's task queue isn't activated. 
+	 * 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();
 
diff -urN linux-2.5.67-bk5/drivers/ide/ide-probe.c linux-2.5.67-bk6/drivers/ide/ide-probe.c
--- linux-2.5.67-bk5/drivers/ide/ide-probe.c	2003-04-15 04:36:08.000000000 -0700
+++ linux-2.5.67-bk6/drivers/ide/ide-probe.c	2003-04-15 04:36:14.000000000 -0700
@@ -1183,7 +1183,7 @@
 		hwif->io_ports[IDE_DATA_OFFSET]+7,
 		hwif->io_ports[IDE_CONTROL_OFFSET], __irq_itoa(hwif->irq));
 #else
-	printk("%s at %x on irq 0x%08x", hwif->name,
+	printk("%s at 0x%08lx on irq %d", hwif->name,
 		hwif->io_ports[IDE_DATA_OFFSET], hwif->irq);
 #endif /* __mc68000__ && CONFIG_APUS */
 	if (match)
diff -urN linux-2.5.67-bk5/drivers/ide/legacy/gayle.c linux-2.5.67-bk6/drivers/ide/legacy/gayle.c
--- linux-2.5.67-bk5/drivers/ide/legacy/gayle.c	2003-04-07 10:32:21.000000000 -0700
+++ linux-2.5.67-bk6/drivers/ide/legacy/gayle.c	2003-04-15 04:36:14.000000000 -0700
@@ -125,6 +125,7 @@
 	unsigned long base, ctrlport, irqport;
 	ide_ack_intr_t *ack_intr;
 	hw_regs_t hw;
+	ide_hwif_t *hwif;
 	int index;
 	unsigned long phys_base, res_start, res_n;
 
@@ -154,11 +155,12 @@
 
 	ide_setup_ports(&hw, base, gayle_offsets,
 			ctrlport, irqport, ack_intr,
-//			gaule_iops,
+//			&gayle_iops,
 			IRQ_AMIGA_PORTS);
 
-	index = ide_register_hw(&hw, NULL);
+	index = ide_register_hw(&hw, &hwif);
 	if (index != -1) {
+	    hwif->mmio = 2;
 	    switch (i) {
 		case 0:
 		    printk("ide%d: Gayle IDE interface (A%d style)\n", index,
diff -urN linux-2.5.67-bk5/drivers/ieee1394/nodemgr.c linux-2.5.67-bk6/drivers/ieee1394/nodemgr.c
--- linux-2.5.67-bk5/drivers/ieee1394/nodemgr.c	2003-04-15 04:36:08.000000000 -0700
+++ linux-2.5.67-bk6/drivers/ieee1394/nodemgr.c	2003-04-15 04:36:14.000000000 -0700
@@ -1010,33 +1010,6 @@
 		kfree(ud);
 }
 
-static void dump_directories (struct node_entry *ne)
-{
-#ifdef CONFIG_IEEE1394_VERBOSEDEBUG
-	struct list_head *l;
-
-	HPSB_DEBUG("vendor_id=0x%06x [%s], capabilities=0x%06x",
-		   ne->vendor_id, ne->vendor_name ?: "Unknown",
-		   ne->capabilities);
-	list_for_each (l, &ne->unit_directories) {
-		struct unit_directory *ud = list_entry (l, struct unit_directory, node_list);
-		HPSB_DEBUG("unit directory:");
-		if (ud->flags & UNIT_DIRECTORY_VENDOR_ID)
-			HPSB_DEBUG("  vendor_id=0x%06x [%s]",
-				   ud->vendor_id,
-				   ud->vendor_name ?: "Unknown");
-		if (ud->flags & UNIT_DIRECTORY_MODEL_ID)
-			HPSB_DEBUG("  model_id=0x%06x [%s]",
-				   ud->model_id,
-				   ud->model_name ?: "Unknown");
-		if (ud->flags & UNIT_DIRECTORY_SPECIFIER_ID)
-			HPSB_DEBUG("  sw_specifier_id=0x%06x ", ud->specifier_id);
-		if (ud->flags & UNIT_DIRECTORY_VERSION)
-			HPSB_DEBUG("  sw_version=0x%06x ", ud->version);
-	}
-#endif
-	return;
-}
 
 static void nodemgr_process_root_directory(struct host_info *hi, struct node_entry *ne)
 {
@@ -1104,8 +1077,6 @@
 			break;
 		}
 	}
-
-	dump_directories(ne);
 }
 
 #ifdef CONFIG_HOTPLUG
diff -urN linux-2.5.67-bk5/drivers/input/input.c linux-2.5.67-bk6/drivers/input/input.c
--- linux-2.5.67-bk5/drivers/input/input.c	2003-04-07 10:31:42.000000000 -0700
+++ linux-2.5.67-bk6/drivers/input/input.c	2003-04-15 04:36:14.000000000 -0700
@@ -717,5 +717,5 @@
 	devclass_unregister(&input_devclass);
 }
 
-module_init(input_init);
+subsys_initcall(input_init);
 module_exit(input_exit);
diff -urN linux-2.5.67-bk5/drivers/input/keyboard/amikbd.c linux-2.5.67-bk6/drivers/input/keyboard/amikbd.c
--- linux-2.5.67-bk5/drivers/input/keyboard/amikbd.c	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/drivers/input/keyboard/amikbd.c	2003-04-15 04:36:14.000000000 -0700
@@ -51,8 +51,8 @@
 	 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,  0,  0, 75, 76, 77,
 	  0, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,  0, 83, 71, 72, 73,
 	 57, 14, 15, 96, 28,  1,111,  0,  0,  0, 74,  0,103,108,106,105,
-	 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 98, 55, 78, 87,
-	 42, 54, 58, 29, 56,100
+	 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,179,180, 98, 55, 78,138,
+	 42, 54, 58, 29, 56,100,125,126
 };
 
 static const char *amikbd_messages[8] = {
diff -urN linux-2.5.67-bk5/drivers/mtd/maps/sa1100-flash.c linux-2.5.67-bk6/drivers/mtd/maps/sa1100-flash.c
--- linux-2.5.67-bk5/drivers/mtd/maps/sa1100-flash.c	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/drivers/mtd/maps/sa1100-flash.c	2003-04-15 04:36:15.000000000 -0700
@@ -174,9 +174,15 @@
 
 #ifdef CONFIG_SA1100_BADGE4
 /*
- * 1 x Intel 28F320C3BA100 Advanced+ Boot Block Flash (32 Mi bit)
+ * 1 x Intel 28F320C3 Advanced+ Boot Block Flash (32 Mi bit)
  *   Eight 4 KiW Parameter Bottom Blocks (64 KiB)
  *   Sixty-three 32 KiW Main Blocks (4032 Ki b)
+ *
+ * <or>
+ *
+ * 1 x Intel 28F640C3 Advanced+ Boot Block Flash (64 Mi bit)
+ *   Eight 4 KiW Parameter Bottom Blocks (64 KiB)
+ *   One-hundred-twenty-seven 32 KiW Main Blocks (8128 Ki b)
  */
 static struct mtd_partition badge4_partitions[] = {
 	{
@@ -188,10 +194,6 @@
 		.offset		= MTDPART_OFS_APPEND,
 		.size		= 0x00006000
 	}, {
-		.name		= "kernel",
-		.offset		= MTDPART_OFS_APPEND,
-		.size		= 0x00100000
-	}, {
 		.name		= "root",
 		.offset		= MTDPART_OFS_APPEND,
 		.size		= MTDPART_SIZ_FULL
@@ -1087,8 +1089,10 @@
 
 	del_mtd_partitions(mtd);
 
+#ifdef CONFIG_MTD_CONCAT
 	if (mtd != sa[0].mtd)
 		mtd_concat_destroy(mtd);
+#endif
 
 	for (i = NR_SUBMTD; i >= 0; i--) {
 		if (sa[i].mtd)
@@ -1119,7 +1123,7 @@
 	}
 	if (machine_is_badge4()) {
 		info[0].base = SA1100_CS0_PHYS;
-		info[0].size = SZ_4M;
+		info[0].size = SZ_64M;
 		nr = 1;
 	}
 	if (machine_is_cerf()) {
diff -urN linux-2.5.67-bk5/drivers/pcmcia/sa1111_generic.h linux-2.5.67-bk6/drivers/pcmcia/sa1111_generic.h
--- linux-2.5.67-bk5/drivers/pcmcia/sa1111_generic.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/drivers/pcmcia/sa1111_generic.h	2003-04-15 04:36:15.000000000 -0700
@@ -7,6 +7,7 @@
 extern void sa1111_pcmcia_socket_init(struct sa1100_pcmcia_socket *);
 extern void sa1111_pcmcia_socket_suspend(struct sa1100_pcmcia_socket *);
 
+extern int pcmcia_badge4_init(struct device *);
 extern int pcmcia_jornada720_init(struct device *);
 extern int pcmcia_neponset_init(struct device *);
 
diff -urN linux-2.5.67-bk5/drivers/s390/Kconfig linux-2.5.67-bk6/drivers/s390/Kconfig
--- linux-2.5.67-bk5/drivers/s390/Kconfig	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/Kconfig	2003-04-15 04:36:15.000000000 -0700
@@ -164,7 +164,7 @@
 
 config DASD_DIAG
 	tristate "Support for DIAG access to CMS reserved Disks"
-	depends on DASD
+	depends on DASD && ARCH_S390X = 'n'
 	help
 	  Select this option if you want to use CMS reserved Disks under VM
 	  with the Diagnose250 command.  If you are not running under VM or
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd.c linux-2.5.67-bk6/drivers/s390/block/dasd.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd.c	2003-04-07 10:31:14.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd.c	2003-04-15 04:36:16.000000000 -0700
@@ -7,43 +7,12 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
- * $Revision: 1.74 $
- *
- * History of changes (starts July 2000)
- * 11/09/00 complete redesign after code review
- * 02/01/01 added dynamic registration of ioctls
- *	    fixed bug in registration of new majors
- *	    fixed handling of request during dasd_end_request
- *	    fixed handling of plugged queues
- *	    fixed partition handling and HDIO_GETGEO
- *	    fixed traditional naming scheme for devices beyond 702
- *	    fixed some race conditions related to modules
- *	    added devfs suupport
- * 03/06/01 refined dynamic attach/detach for leaving devices which are online.
- * 03/09/01 refined dynamic modifiaction of devices
- * 03/12/01 moved policy in dasd_format to dasdfmt (renamed BIODASDFORMAT)
- * 03/19/01 added BIODASDINFO-ioctl
- *	    removed 2.2 compatibility
- * 04/27/01 fixed PL030119COT (dasd_disciplines does not work)
- * 04/30/01 fixed PL030146HSM (module locking with dynamic ioctls)
- *	    fixed PL030130SBA (handling of invalid ranges)
- * 05/02/01 fixed PL030145SBA (killing dasdmt)
- *	    fixed PL030149SBA (status of 'accepted' devices)
- *	    fixed PL030146SBA (BUG in ibm.c after adding device)
- *	    added BIODASDPRRD ioctl interface
- * 05/11/01 fixed  PL030164MVE (trap in probeonly mode)
- * 05/15/01 fixed devfs support for unformatted devices
- * 06/26/01 hopefully fixed PL030172SBA,PL030234SBA
- * 07/09/01 fixed PL030324MSH (wrong statistics output)
- * 07/16/01 merged in new fixes for handling low-mem situations
- * 01/22/01 fixed PL030579KBE (wrong statistics)
- * 05/04/02 code restructuring.
+ * $Revision: 1.94 $
  */
 
 #define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/kmod.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -83,12 +52,12 @@
 /*
  * SECTION: prototypes for static functions of dasd.c
  */
-static int  dasd_setup_blkdev(dasd_device_t * device);
-static void dasd_disable_blkdev(dasd_device_t * device);
-static void dasd_flush_request_queue(dasd_device_t *);
+static int  dasd_setup_blkdev(struct dasd_device * device);
+static void dasd_disable_blkdev(struct dasd_device * device);
+static void dasd_flush_request_queue(struct dasd_device *);
 static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *);
-static void dasd_flush_ccw_queue(dasd_device_t *, int);
-static void dasd_tasklet(dasd_device_t *);
+static void dasd_flush_ccw_queue(struct dasd_device *, int);
+static void dasd_tasklet(struct dasd_device *);
 static void do_kick_device(void *data);
 static int  dasd_add_sysfs_files(struct ccw_device *cdev);
 
@@ -100,18 +69,16 @@
 /*
  * Allocate memory for a new device structure.
  */
-dasd_device_t *
-dasd_alloc_device(dasd_devmap_t *devmap)
+struct dasd_device *
+dasd_alloc_device(unsigned int devindex)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	struct gendisk *gdp;
 
-	device = kmalloc(sizeof (dasd_device_t), GFP_ATOMIC);
+	device = kmalloc(sizeof (struct dasd_device), GFP_ATOMIC);
 	if (device == NULL)
 		return ERR_PTR(-ENOMEM);
-	memset(device, 0, sizeof (dasd_device_t));
-
-	device->devno = devmap->devno;
+	memset(device, 0, sizeof (struct dasd_device));
 
 	/* Get two pages for normal block device operations. */
 	device->ccw_mem = (void *) __get_free_pages(GFP_ATOMIC | GFP_DMA, 1);
@@ -128,12 +95,12 @@
 	}
 
 	/* Allocate gendisk structure for device. */
-	gdp = dasd_gendisk_alloc(devmap->devindex);
+	gdp = dasd_gendisk_alloc(devindex);
 	if (IS_ERR(gdp)) {
 		free_page((unsigned long) device->erp_mem);
 		free_pages((unsigned long) device->ccw_mem, 1);
 		kfree(device);
-		return (dasd_device_t *) gdp;
+		return (struct dasd_device *) gdp;
 	}
 	gdp->private_data = device;
 	device->gdp = gdp;
@@ -147,7 +114,7 @@
 		     (unsigned long) device);
 	INIT_LIST_HEAD(&device->ccw_queue);
 	init_timer(&device->timer);
-	INIT_WORK(&device->kick_work, do_kick_device, (void *) (addr_t) device->devno);
+	INIT_WORK(&device->kick_work, do_kick_device, device);
 	device->state = DASD_STATE_NEW;
 	device->target = DASD_STATE_NEW;
 
@@ -158,7 +125,7 @@
  * Free memory of a device structure.
  */
 void
-dasd_free_device(dasd_device_t *device)
+dasd_free_device(struct dasd_device *device)
 {
 	if (device->private)
 		kfree(device->private);
@@ -172,37 +139,37 @@
  * Make a new device known to the system.
  */
 static inline int
-dasd_state_new_to_known(dasd_device_t *device)
+dasd_state_new_to_known(struct dasd_device *device)
 {
-	dasd_devmap_t *devmap;
 	umode_t devfs_perm;
-	devfs_handle_t dir;
-	int major, minor;
+	kdev_t kdev;
 	char buf[20];
 
-	/* Increase reference count of bdev. */
-	if (bdget(MKDEV(device->gdp->major, device->gdp->first_minor)) == NULL)
+	kdev = dasd_get_kdev(device);
+	if (kdev_none(kdev))
 		return -ENODEV;
 
-	devmap = dasd_devmap_from_devno(device->devno);
-	if (devmap == NULL)
-		return -ENODEV;
-	major = dasd_gendisk_index_major(devmap->devindex);
-	if (major < 0)
-		return -ENODEV;
-	minor = devmap->devindex % DASD_PER_MAJOR;
+	/*
+	 * As long as the device is not in state DASD_STATE_NEW we want to 
+	 * keep the reference count > 0.
+	 */
+	dasd_get_device(device);
 
+#ifdef CONFIG_DEVFS_FS
 	/* Add a proc directory and the dasd device entry to devfs. */
- 	dir = devfs_mk_dir("dasd/%04x", device->devno);
-	device->gdp->de = dir;
+ 	device->gdp->de = devfs_mk_dir("dasd/%04x",
+		_ccw_device_get_device_number(device->cdev));
+#endif
 	if (device->ro_flag)
 		devfs_perm = S_IFBLK | S_IRUSR;
 	else
 		devfs_perm = S_IFBLK | S_IRUSR | S_IWUSR;
 
-	snprintf(buf, sizeof(buf), "dasd/%04x/device", device->devno);
+	snprintf(buf, sizeof(buf), "dasd/%04x/device",
+		 _ccw_device_get_device_number(device->cdev));
 	device->devfs_entry = devfs_register(NULL, buf, 0,
-					     major, minor << DASD_PARTN_BITS,
+					     major(kdev),
+					     minor(kdev) << DASD_PARTN_BITS,
 					     devfs_perm,
 					     &dasd_device_operations, NULL);
 	device->state = DASD_STATE_KNOWN;
@@ -213,10 +180,8 @@
  * Let the system forget about a device.
  */
 static inline void
-dasd_state_known_to_new(dasd_device_t * device)
+dasd_state_known_to_new(struct dasd_device * device)
 {
-	struct block_device *bdev;
-
 	/* Remove device entry and devfs directory. */
 	devfs_unregister(device->devfs_entry);
 	devfs_unregister(device->gdp->de);
@@ -225,17 +190,15 @@
 	device->discipline = NULL;
 	device->state = DASD_STATE_NEW;
 
-	/* Decrease reference count of bdev. */
-	bdev = bdget(MKDEV(device->gdp->major, device->gdp->first_minor));
-	bdput(bdev);
-	bdput(bdev);
+	/* Give up reference we took in dasd_state_new_to_known. */
+	dasd_put_device(device);
 }
 
 /*
  * Request the irq line for the device.
  */
 static inline int
-dasd_state_known_to_basic(dasd_device_t * device)
+dasd_state_known_to_basic(struct dasd_device * device)
 {
 	/* register 'device' debug area, used for all DBF_DEV_XXX calls */
 	device->debug_area = debug_register(device->gdp->disk_name, 0, 2,
@@ -252,7 +215,7 @@
  * Release the irq line for the device. Terminate any running i/o.
  */
 static inline void
-dasd_state_basic_to_known(dasd_device_t * device)
+dasd_state_basic_to_known(struct dasd_device * device)
 {
 	dasd_flush_ccw_queue(device, 1);
 	DBF_DEV_EVENT(DBF_EMERG, device, "%p debug area deleted", device);
@@ -274,7 +237,7 @@
  * discipline code, see dasd_eckd.c.
  */
 static inline int
-dasd_state_basic_to_accept(dasd_device_t * device)
+dasd_state_basic_to_accept(struct dasd_device * device)
 {
 	int rc;
 
@@ -290,7 +253,7 @@
  * Forget everything the initial analysis found out.
  */
 static inline void
-dasd_state_accept_to_basic(dasd_device_t * device)
+dasd_state_accept_to_basic(struct dasd_device * device)
 {
 	device->blocks = 0;
 	device->bp_block = 0;
@@ -302,7 +265,7 @@
  * Setup block device.
  */
 static inline int
-dasd_state_accept_to_ready(dasd_device_t * device)
+dasd_state_accept_to_ready(struct dasd_device * device)
 {
 	int rc;
 
@@ -318,7 +281,7 @@
  * Remove device from block device layer. Destroy dirty buffers.
  */
 static inline void
-dasd_state_ready_to_accept(dasd_device_t * device)
+dasd_state_ready_to_accept(struct dasd_device * device)
 {
 	dasd_flush_ccw_queue(device, 0);
 	dasd_destroy_partitions(device);
@@ -333,7 +296,7 @@
  * ccw queue.
  */
 static inline int
-dasd_state_ready_to_online(dasd_device_t * device)
+dasd_state_ready_to_online(struct dasd_device * device)
 {
 	device->state = DASD_STATE_ONLINE;
 	dasd_schedule_bh(device);
@@ -344,7 +307,7 @@
  * Stop the requeueing of requests again.
  */
 static inline void
-dasd_state_online_to_ready(dasd_device_t * device)
+dasd_state_online_to_ready(struct dasd_device * device)
 {
 	device->state = DASD_STATE_READY;
 }
@@ -353,7 +316,7 @@
  * Device startup state changes.
  */
 static inline int
-dasd_increase_state(dasd_device_t *device)
+dasd_increase_state(struct dasd_device *device)
 {
 	int rc;
 
@@ -385,7 +348,7 @@
  * Device shutdown state changes.
  */
 static inline int
-dasd_decrease_state(dasd_device_t *device)
+dasd_decrease_state(struct dasd_device *device)
 {
 	if (device->state == DASD_STATE_ONLINE &&
 	    device->target <= DASD_STATE_READY)
@@ -414,7 +377,7 @@
  * This is the main startup/shutdown routine.
  */
 static void
-dasd_change_state(dasd_device_t *device)
+dasd_change_state(struct dasd_device *device)
 {
         int rc;
 
@@ -428,7 +391,8 @@
         if (rc && rc != -EAGAIN) {
 		if (rc != -ENODEV)
 			MESSAGE (KERN_INFO, "giving up on dasd device with "
-				 "devno %04x", device->devno);
+				 "devno %04x",
+				 _ccw_device_get_device_number(device->cdev));
                 device->target = device->state;
         }
 
@@ -445,26 +409,18 @@
 static void
 do_kick_device(void *data)
 {
-	int devno;
-	dasd_devmap_t *devmap;
-	dasd_device_t *device;
+	struct dasd_device *device;
 
-	devno = (long) data;
-	devmap = dasd_devmap_from_devno(devno);
-	device = (devmap != NULL) ?
-		dasd_get_device(devmap) : ERR_PTR(-ENODEV);
-	if (IS_ERR(device))
-		return;
-	atomic_dec(&device->ref_count);
+	device = (struct dasd_device *) data;
 	dasd_change_state(device);
 	dasd_schedule_bh(device);
-	dasd_put_device(devmap);
+	dasd_put_device(device);
 }
 
 void
-dasd_kick_device(dasd_device_t *device)
+dasd_kick_device(struct dasd_device *device)
 {
-	atomic_inc(&device->ref_count);
+	dasd_get_device(device);
 	/* queue call to dasd_kick_device to the kernel event daemon. */
 	schedule_work(&device->kick_work);
 }
@@ -473,7 +429,7 @@
  * Set the target state for a device and starts the state change.
  */
 void
-dasd_set_target_state(dasd_device_t *device, int target)
+dasd_set_target_state(struct dasd_device *device, int target)
 {
 	/* If we are in probeonly mode stop at DASD_STATE_ACCEPT. */
 	if (dasd_probeonly && target > DASD_STATE_ACCEPT)
@@ -491,14 +447,14 @@
  * Enable devices with device numbers in [from..to].
  */
 static inline int
-_wait_for_device(dasd_device_t *device)
+_wait_for_device(struct dasd_device *device)
 {
 	return (device->state == device->target);
 }
 
 // FIXME: if called from dasd_devices_write discpline is not set -> oops.
 void
-dasd_enable_device(dasd_device_t *device)
+dasd_enable_device(struct dasd_device *device)
 {
 	dasd_set_target_state(device, DASD_STATE_ONLINE);
 	if (device->state <= DASD_STATE_KNOWN)
@@ -513,7 +469,7 @@
  */
 #ifdef CONFIG_DASD_PROFILE
 
-dasd_profile_info_t dasd_global_profile;
+struct dasd_profile_info_t dasd_global_profile;
 unsigned int dasd_profile_level = DASD_PROFILE_OFF;
 
 /*
@@ -531,7 +487,7 @@
  * Add profiling information for cqr before execution.
  */
 static inline void
-dasd_profile_start(dasd_device_t *device, dasd_ccw_req_t * cqr,
+dasd_profile_start(struct dasd_device *device, struct dasd_ccw_req * cqr,
 		   struct request *req)
 {
 	struct list_head *l;
@@ -553,7 +509,7 @@
  * Add profiling information for cqr after execution.
  */
 static inline void
-dasd_profile_end(dasd_device_t *device, dasd_ccw_req_t * cqr,
+dasd_profile_end(struct dasd_device *device, struct dasd_ccw_req * cqr,
 		 struct request *req)
 {
 	long strtime, irqtime, endtime, tottime;	/* in microseconds */
@@ -575,12 +531,14 @@
 	tottimeps = tottime / sectors;
 
 	if (!dasd_global_profile.dasd_io_reqs)
-		memset(&dasd_global_profile, 0, sizeof (dasd_profile_info_t));
+		memset(&dasd_global_profile, 0,
+		       sizeof (struct dasd_profile_info_t));
 	dasd_global_profile.dasd_io_reqs++;
 	dasd_global_profile.dasd_io_sects += sectors;
 
 	if (!device->profile.dasd_io_reqs)
-		memset(&device->profile, 0, sizeof (dasd_profile_info_t));
+		memset(&device->profile, 0,
+		       sizeof (struct dasd_profile_info_t));
 	device->profile.dasd_io_reqs++;
 	device->profile.dasd_io_sects += sectors;
 
@@ -604,11 +562,11 @@
  * memory and 2) dasd_smalloc_request uses the static ccw memory
  * that gets allocated for each device.
  */
-dasd_ccw_req_t *
+struct dasd_ccw_req *
 dasd_kmalloc_request(char *magic, int cplength, int datasize,
-		   dasd_device_t * device)
+		   struct dasd_device * device)
 {
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 
 	/* Sanity checks */
 	if ( magic == NULL || datasize > PAGE_SIZE ||
@@ -619,10 +577,10 @@
 	debug_int_event ( dasd_debug_area, 1, cplength);
 	debug_int_event ( dasd_debug_area, 1, datasize);
 
-	cqr = kmalloc(sizeof(dasd_ccw_req_t), GFP_ATOMIC);
+	cqr = kmalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
 	if (cqr == NULL)
 		return ERR_PTR(-ENOMEM);
-	memset(cqr, 0, sizeof(dasd_ccw_req_t));
+	memset(cqr, 0, sizeof(struct dasd_ccw_req));
 	cqr->cpaddr = NULL;
 	if (cplength > 0) {
 		cqr->cpaddr = kmalloc(cplength*sizeof(struct ccw1),
@@ -646,16 +604,16 @@
 	}
 	strncpy((char *) &cqr->magic, magic, 4);
 	ASCEBC((char *) &cqr->magic, 4);
-	atomic_inc(&device->ref_count);
+	dasd_get_device(device);
 	return cqr;
 }
 
-dasd_ccw_req_t *
+struct dasd_ccw_req *
 dasd_smalloc_request(char *magic, int cplength, int datasize,
-		   dasd_device_t * device)
+		   struct dasd_device * device)
 {
 	unsigned long flags;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	char *data;
 	int size;
 
@@ -668,18 +626,19 @@
 	debug_int_event ( dasd_debug_area, 1, cplength);
 	debug_int_event ( dasd_debug_area, 1, datasize);
 
-	size = (sizeof(dasd_ccw_req_t) + 7L) & -8L;
+	size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
 	if (cplength > 0)
 		size += cplength * sizeof(struct ccw1);
 	if (datasize > 0)
 		size += datasize;
 	spin_lock_irqsave(&device->mem_lock, flags);
-	cqr = (dasd_ccw_req_t *) dasd_alloc_chunk(&device->ccw_chunks, size);
+	cqr = (struct dasd_ccw_req *)
+		dasd_alloc_chunk(&device->ccw_chunks, size);
 	spin_unlock_irqrestore(&device->mem_lock, flags);
 	if (cqr == NULL)
 		return ERR_PTR(-ENOMEM);
-	memset(cqr, 0, sizeof(dasd_ccw_req_t));
-	data = (char *) cqr + ((sizeof(dasd_ccw_req_t) + 7L) & -8L);
+	memset(cqr, 0, sizeof(struct dasd_ccw_req));
+	data = (char *) cqr + ((sizeof(struct dasd_ccw_req) + 7L) & -8L);
 	cqr->cpaddr = NULL;
 	if (cplength > 0) {
 		cqr->cpaddr = (struct ccw1 *) data;
@@ -693,17 +652,17 @@
 	}
 	strncpy((char *) &cqr->magic, magic, 4);
 	ASCEBC((char *) &cqr->magic, 4);
-	atomic_inc(&device->ref_count);
+	dasd_get_device(device);
 	return cqr;
 }
 
 /*
  * Free memory of a channel program. This function needs to free all the
  * idal lists that might have been created by dasd_set_cda and the
- * dasd_ccw_req_t itself.
+ * struct dasd_ccw_req itself.
  */
 void
-dasd_kfree_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
+dasd_kfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
 {
 #ifdef CONFIG_ARCH_S390X
 	struct ccw1 *ccw;
@@ -723,11 +682,11 @@
 	if (cqr->data != NULL)
 		kfree(cqr->data);
 	kfree(cqr);
-	atomic_dec(&device->ref_count);
+	dasd_put_device(device);
 }
 
 void
-dasd_sfree_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
+dasd_sfree_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
 {
 	unsigned long flags;
 
@@ -738,23 +697,23 @@
 	spin_lock_irqsave(&device->mem_lock, flags);
 	dasd_free_chunk(&device->ccw_chunks, cqr);
 	spin_unlock_irqrestore(&device->mem_lock, flags);
-	atomic_dec(&device->ref_count);
+	dasd_put_device(device);
 }
 
 /*
  * Check discipline magic in cqr.
  */
 static inline int
-dasd_check_cqr(dasd_ccw_req_t *cqr)
+dasd_check_cqr(struct dasd_ccw_req *cqr)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	if (cqr == NULL)
 		return -EINVAL;
 	device = cqr->device;
 	if (strncmp((char *) &cqr->magic, device->discipline->ebcname, 4)) {
 		DEV_MESSAGE(KERN_WARNING, device,
-			    " dasd_ccw_req_t 0x%08x magic doesn't match"
+			    " dasd_ccw_req 0x%08x magic doesn't match"
 			    " discipline 0x%08x",
 			    cqr->magic,
 			    *(unsigned int *) device->discipline->name);
@@ -769,9 +728,9 @@
  * is in a bad mood.
  */
 int
-dasd_term_IO(dasd_ccw_req_t * cqr)
+dasd_term_IO(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int retries, rc;
 
 	/* Check the cqr */
@@ -779,7 +738,7 @@
 	if (rc)
 		return rc;
 	retries = 0;
-	device = (dasd_device_t *) cqr->device;
+	device = (struct dasd_device *) cqr->device;
 	while ((retries < 5) && (cqr->status == DASD_CQR_IN_IO)) {
 		if (retries < 2)
 			rc = ccw_device_halt(device->cdev, (long) cqr);
@@ -821,16 +780,16 @@
  * In that case set up a timer to start the request later.
  */
 int
-dasd_start_IO(dasd_ccw_req_t * cqr)
+dasd_start_IO(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 
 	/* Check the cqr */
 	rc = dasd_check_cqr(cqr);
 	if (rc)
 		return rc;
-	device = (dasd_device_t *) cqr->device;
+	device = (struct dasd_device *) cqr->device;
 	cqr->startclk = get_clock();
 	rc = ccw_device_start(device->cdev, cqr->cpaddr, (long) cqr,
 			      cqr->lpm, 0);
@@ -873,14 +832,15 @@
 dasd_timeout_device(unsigned long ptr)
 {
 	unsigned long flags;
-	dasd_device_t *device;
-	dasd_ccw_req_t *cqr;
+	struct dasd_device *device;
+	struct dasd_ccw_req *cqr;
 
-	device = (dasd_device_t *) ptr;
+	device = (struct dasd_device *) ptr;
 	spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
 	/* re-activate first request in queue */
 	if (!list_empty(&device->ccw_queue)) {
-		cqr = list_entry(device->ccw_queue.next, dasd_ccw_req_t, list);
+		cqr = list_entry(device->ccw_queue.next,
+				 struct dasd_ccw_req, list);
 		if (cqr->status == DASD_CQR_PENDING)
 			cqr->status = DASD_CQR_QUEUED;
 	}
@@ -892,7 +852,7 @@
  * Setup timeout for a device.
  */
 void
-dasd_set_timer(dasd_device_t *device, int expires)
+dasd_set_timer(struct dasd_device *device, int expires)
 {
 	/* FIXME: timeouts are based on jiffies but the timeout
 	 * comparision in __dasd_check_expire is based on the
@@ -916,7 +876,7 @@
  * Clear timeout for a device.
  */
 void
-dasd_clear_timer(dasd_device_t *device)
+dasd_clear_timer(struct dasd_device *device)
 {
 	if (timer_pending(&device->timer))
 		del_timer(&device->timer);
@@ -934,25 +894,21 @@
 {
 	struct {
 		struct work_struct work;
-		dasd_device_t *device;
+		struct dasd_device *device;
 	} *p;
-	dasd_devmap_t *devmap;
-	dasd_device_t *device;
-	dasd_ccw_req_t *cqr;
-	int devno;
+	struct dasd_device *device;
+	struct dasd_ccw_req *cqr;
 
 	p = data;
 	device = p->device;
 	DBF_EVENT(DBF_NOTICE, "State change Interrupt for bus_id %s",
 		  device->cdev->dev.bus_id);
 
-	// FIXME: get rid of devmap.
-	devno = _ccw_device_get_device_number(device->cdev);
-	devmap = dasd_devmap_from_devno(devno);
 	spin_lock_irq(get_ccwdev_lock(device->cdev));
 	/* re-activate first request in queue */
 	if (!list_empty(&device->ccw_queue)) {
-		cqr = list_entry(device->ccw_queue.next, dasd_ccw_req_t, list);
+		cqr = list_entry(device->ccw_queue.next,
+				 struct dasd_ccw_req, list);
 		if (cqr == NULL) {
 			MESSAGE (KERN_DEBUG,
 				 "got state change pending interrupt on"
@@ -965,17 +921,46 @@
 	}
 	spin_unlock_irq(get_ccwdev_lock(device->cdev));
 	dasd_schedule_bh(device);
-	dasd_put_device(devmap);
+	dasd_put_device(device);
 	kfree(p);
 }
 
+static void
+dasd_handle_killed_request(struct ccw_device *cdev, unsigned long intparm)
+{
+	struct dasd_ccw_req *cqr;
+	struct dasd_device *device;
+
+	cqr = (struct dasd_ccw_req *) intparm;
+	if (cqr->status != DASD_CQR_IN_IO) {
+		MESSAGE(KERN_DEBUG,
+			"invalid status: bus_id %s, status %02x",
+			cdev->dev.bus_id, cqr->status);
+		return;
+	}
+
+	device = (struct dasd_device *) cqr->device;
+	if (device == NULL ||
+	    device != cdev->dev.driver_data ||
+	    strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
+		MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s",
+			cdev->dev.bus_id);
+		return;
+	}
+
+	/* Schedule request to be retried. */
+	cqr->status = DASD_CQR_QUEUED;
+
+	dasd_clear_timer(device);
+	dasd_schedule_bh(device);
+}
 
 static void
-dasd_handle_state_change_pending(dasd_device_t *device)
+dasd_handle_state_change_pending(struct dasd_device *device)
 {
 	struct {
 		struct work_struct work;
-		dasd_device_t *device;
+		struct dasd_device *device;
 	} *p;
 
 	p = kmalloc(sizeof(*p), GFP_ATOMIC);
@@ -984,8 +969,7 @@
 		return;
 	INIT_WORK(&p->work, (void *) do_state_change_pending, p);
 	p->device = device;
-	atomic_inc(&device->ref_count);
-	/* queue call to do_state_change_pending to the kernel event daemon. */
+	dasd_get_device(device);
 	schedule_work(&p->work);
 }
 
@@ -996,13 +980,30 @@
 dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
 		 struct irb *irb)
 {
-	dasd_ccw_req_t *cqr, *next;
-	dasd_device_t *device;
+	struct dasd_ccw_req *cqr, *next;
+	struct dasd_device *device;
 	unsigned long long now;
 	int expires;
 	dasd_era_t era;
 	char mask;
 
+	if (IS_ERR(irb)) {
+		switch (PTR_ERR(irb)) {
+		case -EIO:
+			dasd_handle_killed_request(cdev, intparm);
+			break;
+		case -ETIMEDOUT:
+			printk(KERN_WARNING"%s(%s): request timed out\n",
+			       __FUNCTION__, cdev->dev.bus_id);
+			//FIXME - dasd uses own timeout interface...
+			break;
+		default:
+			printk(KERN_WARNING"%s(%s): unknown error %ld\n",
+			       __FUNCTION__, cdev->dev.bus_id, PTR_ERR(irb));
+		}
+		return;
+	}
+
 	now = get_clock();
 
 	DBF_EVENT(DBF_DEBUG, "Interrupt: stat %02x, bus_id %s",
@@ -1015,7 +1016,7 @@
 		return;
 	}
 
-	cqr = (dasd_ccw_req_t *) intparm;
+	cqr = (struct dasd_ccw_req *) intparm;
 	/*
 	 * check status - the request might have been killed
 	 * because of dyn detach
@@ -1027,7 +1028,7 @@
 		return;
 	}
 
-	device = (dasd_device_t *) cqr->device;
+	device = (struct dasd_device *) cqr->device;
 	if (device == NULL ||
 	    device != cdev->dev.driver_data ||
 	    strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
@@ -1057,7 +1058,7 @@
 		/* Start first request on queue if possible -> fast_io. */
 		if (cqr->list.next != &device->ccw_queue) {
 			next = list_entry(cqr->list.next,
-					  dasd_ccw_req_t, list);
+					  struct dasd_ccw_req, list);
 			if (next->status == DASD_CQR_QUEUED) {
 				if (device->discipline->start_IO(next) == 0)
 					expires = next->expires;
@@ -1108,14 +1109,13 @@
 		BUG();
 	add_disk_randomness(req->rq_disk);
 	end_that_request_last(req);
-	return;
 }
 
 /*
  * Process finished error recovery ccw.
  */
 static inline void
-__dasd_process_erp(dasd_device_t *device, dasd_ccw_req_t *cqr)
+__dasd_process_erp(struct dasd_device *device, struct dasd_ccw_req *cqr)
 {
 	dasd_erp_fn_t erp_fn;
 
@@ -1131,16 +1131,17 @@
  * Process ccw request queue.
  */
 static inline void
-__dasd_process_ccw_queue(dasd_device_t * device, struct list_head *final_queue)
+__dasd_process_ccw_queue(struct dasd_device * device,
+			 struct list_head *final_queue)
 {
 	struct list_head *l, *n;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	dasd_erp_fn_t erp_fn;
 
 restart:
 	/* Process request with final status. */
 	list_for_each_safe(l, n, &device->ccw_queue) {
-		cqr = list_entry(l, dasd_ccw_req_t, list);
+		cqr = list_entry(l, struct dasd_ccw_req, list);
 		/* Stop list processing at the first non-final request. */
 		if (cqr->status != DASD_CQR_DONE &&
 		    cqr->status != DASD_CQR_FAILED &&
@@ -1171,13 +1172,15 @@
 }
 
 static void
-dasd_end_request_cb(dasd_ccw_req_t * cqr, void *data)
+dasd_end_request_cb(struct dasd_ccw_req * cqr, void *data)
 {
 	struct request *req;
 
 	req = (struct request *) data;
 	dasd_profile_end(cqr->device, cqr, req);
+	spin_lock_irq(&cqr->device->request_queue_lock);
 	dasd_end_request(req, (cqr->status == DASD_CQR_DONE));
+	spin_unlock_irq(&cqr->device->request_queue_lock);
 	dasd_sfree_request(cqr, cqr->device);
 }
 
@@ -1186,12 +1189,11 @@
  * Fetch requests from the block device queue.
  */
 static inline void
-__dasd_process_blk_queue(dasd_device_t * device)
+__dasd_process_blk_queue(struct dasd_device * device)
 {
 	request_queue_t *queue;
-	struct list_head *l;
 	struct request *req;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	int nr_queued;
 
 	queue = device->request_queue;
@@ -1211,11 +1213,9 @@
 		return;
 	nr_queued = 0;
 	/* Now we try to fetch requests from the request queue */
-	list_for_each(l, &device->ccw_queue) {
-		cqr = list_entry(l, dasd_ccw_req_t, list);
+	list_for_each_entry(cqr, &device->ccw_queue, list)
 		if (cqr->status == DASD_CQR_QUEUED)
 			nr_queued++;
-	}
 	while (!blk_queue_plugged(queue) &&
 	       elv_next_request(queue) &&
 		nr_queued < DASD_CHANQ_MAX_SIZE) {
@@ -1223,7 +1223,8 @@
 		if (device->ro_flag && rq_data_dir(req) == WRITE) {
 			DBF_EVENT(DBF_ERR,
 				  "(%04x) Rejecting write request %p",
-				  device->devno, req);
+				  _ccw_device_get_device_number(device->cdev),
+				  req);
 			blkdev_dequeue_request(req);
 			dasd_end_request(req, 0);
 			continue;
@@ -1234,7 +1235,8 @@
 				break;	/* terminate request queue loop */
 			DBF_EVENT(DBF_ERR,
 				  "(%04x) CCW creation failed on request %p",
-				  device->devno, req);
+				  _ccw_device_get_device_number(device->cdev),
+				  req);
 			blkdev_dequeue_request(req);
 			dasd_end_request(req, 0);
 			continue;
@@ -1254,14 +1256,14 @@
  * if it reached its expire time. If so, terminate the IO.
  */
 static inline void
-__dasd_check_expire(dasd_device_t * device)
+__dasd_check_expire(struct dasd_device * device)
 {
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	unsigned long long now;
 
 	if (list_empty(&device->ccw_queue))
 		return;
-	cqr = list_entry(device->ccw_queue.next, dasd_ccw_req_t, list);
+	cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
 	if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) {
 		now = get_clock();
 		if (cqr->expires * (TOD_SEC / HZ) + cqr->startclk < now) {
@@ -1277,14 +1279,14 @@
  * if it needs to be started.
  */
 static inline void
-__dasd_start_head(dasd_device_t * device)
+__dasd_start_head(struct dasd_device * device)
 {
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (list_empty(&device->ccw_queue))
 		return;
-	cqr = list_entry(device->ccw_queue.next, dasd_ccw_req_t, list);
+	cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
 	if (cqr->status == DASD_CQR_QUEUED) {
 		/* try to start the first I/O that can be started */
 		rc = device->discipline->start_IO(cqr);
@@ -1300,16 +1302,16 @@
  * Remove requests from the ccw queue. 
  */
 static void
-dasd_flush_ccw_queue(dasd_device_t * device, int all)
+dasd_flush_ccw_queue(struct dasd_device * device, int all)
 {
 	struct list_head flush_queue;
 	struct list_head *l, *n;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 
 	INIT_LIST_HEAD(&flush_queue);
 	spin_lock_irq(get_ccwdev_lock(device->cdev));
 	list_for_each_safe(l, n, &device->ccw_queue) {
-		cqr = list_entry(l, dasd_ccw_req_t, list);
+		cqr = list_entry(l, struct dasd_ccw_req, list);
 		/* Flush all request or only block device requests? */
 		if (all == 0 && cqr->callback == dasd_end_request_cb)
 			continue;
@@ -1332,7 +1334,7 @@
 	spin_unlock_irq(get_ccwdev_lock(device->cdev));
 	/* Now call the callback function of flushed requests */
 	list_for_each_safe(l, n, &flush_queue) {
-		cqr = list_entry(l, dasd_ccw_req_t, list);
+		cqr = list_entry(l, struct dasd_ccw_req, list);
 		if (cqr->callback != NULL)
 			(cqr->callback)(cqr, cqr->callback_data);
 	}
@@ -1342,11 +1344,11 @@
  * Acquire the device lock and process queues for the device.
  */
 static void
-dasd_tasklet(dasd_device_t * device)
+dasd_tasklet(struct dasd_device * device)
 {
 	struct list_head final_queue;
 	struct list_head *l, *n;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 
 	atomic_set (&device->tasklet_scheduled, 0);
 	INIT_LIST_HEAD(&final_queue);
@@ -1358,7 +1360,7 @@
 	spin_unlock_irq(get_ccwdev_lock(device->cdev));
 	/* Now call the callback function of requests with final status */
 	list_for_each_safe(l, n, &final_queue) {
-		cqr = list_entry(l, dasd_ccw_req_t, list);
+		cqr = list_entry(l, struct dasd_ccw_req, list);
 		list_del(&cqr->list);
 		if (cqr->callback != NULL)
 			(cqr->callback)(cqr, cqr->callback_data);
@@ -1371,20 +1373,19 @@
 	__dasd_start_head(device);
 	spin_unlock(get_ccwdev_lock(device->cdev));
 	spin_unlock_irq(&device->request_queue_lock);
-	/* FIXME: what if ref_count == 0 && state == DASD_STATE_NEW ?? */
-	atomic_dec(&device->ref_count);
+	dasd_put_device(device);
 }
 
 /*
  * Schedules a call to dasd_tasklet over the device tasklet.
  */
 void
-dasd_schedule_bh(dasd_device_t * device)
+dasd_schedule_bh(struct dasd_device * device)
 {
 	/* Protect against rescheduling. */
 	if (atomic_compare_and_swap (0, 1, &device->tasklet_scheduled))
 		return;
-	atomic_inc(&device->ref_count);
+	dasd_get_device(device);
 	tasklet_hi_schedule(&device->tasklet);
 }
 
@@ -1393,9 +1394,9 @@
  * possible.
  */
 void
-dasd_add_request_head(dasd_ccw_req_t *req)
+dasd_add_request_head(struct dasd_ccw_req *req)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	unsigned long flags;
 
 	device = req->device;
@@ -1413,9 +1414,9 @@
  * possible.
  */
 void
-dasd_add_request_tail(dasd_ccw_req_t *req)
+dasd_add_request_tail(struct dasd_ccw_req *req)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	unsigned long flags;
 
 	device = req->device;
@@ -1432,15 +1433,15 @@
  * Wakeup callback.
  */
 static void
-dasd_wakeup_cb(dasd_ccw_req_t *cqr, void *data)
+dasd_wakeup_cb(struct dasd_ccw_req *cqr, void *data)
 {
 	wake_up((wait_queue_head_t *) data);
 }
 
 static inline int
-_wait_for_wakeup(dasd_ccw_req_t *cqr)
+_wait_for_wakeup(struct dasd_ccw_req *cqr)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 
 	device = cqr->device;
@@ -1454,10 +1455,10 @@
  * Attempts to start a special ccw queue and waits for its completion.
  */
 int
-dasd_sleep_on(dasd_ccw_req_t * cqr)
+dasd_sleep_on(struct dasd_ccw_req * cqr)
 {
 	wait_queue_head_t wait_q;
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 	
 	device = cqr->device;
@@ -1486,10 +1487,10 @@
  * for its completion.
  */
 int
-dasd_sleep_on_interruptible(dasd_ccw_req_t * cqr)
+dasd_sleep_on_interruptible(struct dasd_ccw_req * cqr)
 {
 	wait_queue_head_t wait_q;
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc, finished;
 
 	device = cqr->device;
@@ -1531,14 +1532,14 @@
  * to the head of the queue. Then the special request is waited on normally.
  */
 static inline int
-_dasd_term_running_cqr(dasd_device_t *device)
+_dasd_term_running_cqr(struct dasd_device *device)
 {
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (list_empty(&device->ccw_queue))
 		return 0;
-	cqr = list_entry(device->ccw_queue.next, dasd_ccw_req_t, list);
+	cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list);
 	rc = device->discipline->term_IO(cqr);
 	if (rc == 0) {
 		/* termination successful */
@@ -1549,10 +1550,10 @@
 }
 
 int
-dasd_sleep_on_immediatly(dasd_ccw_req_t * cqr)
+dasd_sleep_on_immediatly(struct dasd_ccw_req * cqr)
 {
 	wait_queue_head_t wait_q;
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 	
 	device = cqr->device;
@@ -1587,9 +1588,9 @@
  * terminated if it is currently in i/o.
  * Returns 1 if the request has been terminated.
  */
-int dasd_cancel_req(dasd_ccw_req_t *cqr)
+int dasd_cancel_req(struct dasd_ccw_req *cqr)
 {
-	dasd_device_t *device = cqr->device;
+	struct dasd_device *device = cqr->device;
 	unsigned long flags;
 	int rc;
 
@@ -1635,9 +1636,9 @@
 static void
 do_dasd_request(request_queue_t * queue)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
-	device = (dasd_device_t *) queue->queuedata;
+	device = (struct dasd_device *) queue->queuedata;
 	spin_lock(get_ccwdev_lock(device->cdev));
 	/* Get new request from the block device request queue */
 	__dasd_process_blk_queue(device);
@@ -1650,7 +1651,7 @@
  * Allocate request queue and initialize gendisk info for device.
  */
 static int
-dasd_setup_blkdev(dasd_device_t * device)
+dasd_setup_blkdev(struct dasd_device * device)
 {
 	int max, rc;
 
@@ -1685,7 +1686,7 @@
  * Deactivate and free request queue.
  */
 static void
-dasd_disable_blkdev(dasd_device_t * device)
+dasd_disable_blkdev(struct dasd_device * device)
 {
 	if (device->request_queue) {
 		blk_cleanup_queue(device->request_queue);
@@ -1698,7 +1699,7 @@
  * Flush request on the request queue.
  */
 static void
-dasd_flush_request_queue(dasd_device_t * device)
+dasd_flush_request_queue(struct dasd_device * device)
 {
 	struct request *req;
 
@@ -1719,7 +1720,7 @@
 static int
 dasd_open(struct inode *inp, struct file *filp)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 	
 	if (dasd_probeonly) {
@@ -1750,7 +1751,7 @@
 static int
 dasd_release(struct inode *inp, struct file *filp)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = inp->i_bdev->bd_disk->private_data;
 
@@ -1766,8 +1767,8 @@
 	return 0;
 }
 
-struct
-block_device_operations dasd_device_operations = {
+struct block_device_operations
+dasd_device_operations = {
 	.owner		= THIS_MODULE,
 	.open		= dasd_open,
 	.release	= dasd_release,
@@ -1798,7 +1799,8 @@
 /* initial attempt at a probe function. this can be simplified once
  * the other detection code is gone */
 int
-dasd_generic_probe (struct ccw_device *cdev, dasd_discipline_t *discipline)
+dasd_generic_probe (struct ccw_device *cdev,
+		    struct dasd_discipline *discipline)
 {
 	int devno;
 	int ret = 0;
@@ -1823,12 +1825,6 @@
 
 	cdev->handler = &dasd_int_handler;
 
-	if (dasd_autodetect ||
-	    dasd_devmap_from_devno(devno) != 0) {
-		/* => device was in dasd parameter line */
-		ccw_device_set_online(cdev);
-	}
-
 	return ret;
 }
 
@@ -1837,7 +1833,7 @@
 int
 dasd_generic_remove (struct ccw_device *cdev)
 {
-	struct dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = cdev->dev.driver_data;
 	cdev->dev.driver_data = NULL;
@@ -1851,33 +1847,15 @@
  * or the user has started activation through sysfs */
 int
 dasd_generic_set_online (struct ccw_device *cdev,
-			 dasd_discipline_t *discipline)
+			 struct dasd_discipline *discipline)
 
 {
-	int devno;
-	dasd_devmap_t *devmap;
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int rc;
 
-	if (cdev->dev.driver_data != NULL) /* already enabled */
-		return 0;
-
-	devno = _ccw_device_get_device_number(cdev);
-	rc = dasd_add_range(devno, devno, DASD_FEATURE_DEFAULT);
-	if (rc)
-		return rc;
-
-	if (!(devmap = dasd_devmap_from_devno (devno)))
-		return 0; /* device is still disabled -> ignore it */
-
-	if (IS_ERR(device = dasd_get_device(devmap))) {
-		printk (KERN_WARNING "dasd_generic could not get %s\n",
-				cdev->dev.bus_id);
+	device = dasd_create_device(cdev);
+	if (IS_ERR(device))
 		return PTR_ERR(device);
-	}
-
-	device->gdp->driverfs_dev = &cdev->dev;
-	device->cdev = cdev;
 
 	if (device->use_diag_flag)
 		device->discipline = dasd_diag_discipline_pointer;
@@ -1898,7 +1876,7 @@
 	if (rc) {
 		printk (KERN_WARNING "dasd_generic found a bad device %s\n", 
 			cdev->dev.bus_id);
-		dasd_put_device(devmap);
+		dasd_delete_device(device);
 		return rc;
 	}
 
@@ -1909,43 +1887,70 @@
 			cdev->dev.bus_id);
 		rc = -ENODEV;
 		dasd_set_target_state(device, DASD_STATE_NEW);
+		dasd_delete_device(device);
 	} else {
 		pr_debug("dasd_generic device %s found\n",
 				cdev->dev.bus_id);
 		cdev->dev.driver_data = device;
 	}
 
-	dasd_put_device(devmap);
 	/* FIXME: we have to wait for the root device but we don't want
 	 * to wait for each single device but for all at once. */
 	wait_event(dasd_init_waitq, _wait_for_device(device));
+
 	return rc;
 }
 
 int
 dasd_generic_set_offline (struct ccw_device *cdev)
 {
-	dasd_device_t *device;
-	dasd_devmap_t *devmap;
-	int devno;
+	struct dasd_device *device;
 
-	devno = _ccw_device_get_device_number(cdev);
 	device = cdev->dev.driver_data;
-	devmap = dasd_devmap_from_devno(devno);
-	if (device == NULL || devmap == NULL)
-		return -ENODEV;
-
-	device = dasd_get_device(devmap);
-	if (IS_ERR(device))
-		return PTR_ERR(device);
-
+	if (atomic_read(&device->open_count) > 0) {
+		printk (KERN_WARNING "Can't offline dasd device with open"
+			" count = %i.\n",
+			atomic_read(&device->open_count));
+		return -EBUSY;
+	}
 	dasd_set_target_state(device, DASD_STATE_NEW);
-	dasd_put_device(devmap);
+	dasd_delete_device(device);
 	
 	return 0;
 }
 
 /*
+ * Automatically online either all dasd devices (dasd_autodetect) or
+ * all devices specified with dasd= parameters. For dasd_autodetect
+ * dasd_generic_probe has added devmaps for all dasd devices. We
+ * scan all present dasd devmaps and call ccw_device_set_online.
+ */
+void
+dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver)
+{
+	struct device_driver *drv;
+	struct device *d, *dev;
+	struct ccw_device *cdev;
+	int devno;
+
+	drv = get_driver(&dasd_discipline_driver->driver);
+	down_read(&drv->bus->subsys.rwsem);
+	dev = NULL;
+	list_for_each_entry(d, &drv->devices, driver_list) {
+		dev = get_device(d);
+		if (!dev)
+			continue;
+		cdev = to_ccwdev(dev);
+		devno = _ccw_device_get_device_number(cdev);
+		if (dasd_autodetect || dasd_devno_in_range(devno) == 0)
+			ccw_device_set_online(cdev);
+		put_device(dev);
+	}
+	up_read(&drv->bus->subsys.rwsem);
+	put_driver(drv);
+}
+
+/*
  * SECTION: files in sysfs
  */
 
@@ -1955,7 +1960,7 @@
 static ssize_t
 dasd_ro_show(struct device *dev, char *buf)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = dev->driver_data;
 	if (!device)
@@ -1967,7 +1972,7 @@
 static ssize_t
 dasd_ro_store(struct device *dev, const char *buf, size_t count)
 {
-	dasd_device_t *device = dev->driver_data;
+	struct dasd_device *device = dev->driver_data;
 
 	if (device)
 		device->ro_flag = (buf[0] == '1') ? 1 : 0;
@@ -1984,7 +1989,7 @@
 static ssize_t 
 dasd_use_diag_show(struct device *dev, char *buf)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = dev->driver_data;
 	if (!device)
@@ -1996,7 +2001,7 @@
 static ssize_t
 dasd_use_diag_store(struct device *dev, const char *buf, size_t count)
 {
-	dasd_device_t *device = dev->driver_data;
+	struct dasd_device *device = dev->driver_data;
 
 	if (device)
 		device->use_diag_flag = (buf[0] == '1') ? 1 : 0;
@@ -2014,7 +2019,7 @@
 dasd_devices_show(struct device *dev, char *buf)
 {
 	
-	dasd_device_t *device;
+	struct dasd_device *device;
 	dasd_devmap_t *devmap;
 
 	devmap = NULL;
@@ -2034,7 +2039,7 @@
 static ssize_t
 dasd_discipline_show(struct device *dev, char *buf)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = dev->driver_data;
 	if (!device || !device->discipline)
@@ -2078,11 +2083,13 @@
 
 	DBF_EVENT(DBF_EMERG, "%s", "debug area created");
 
-	if (devfs_mk_dir("dasd")) {
+#ifdef CONFIG_DEVFS_FS
+	if (!devfs_mk_dir("dasd")) {
 		DBF_EVENT(DBF_ALERT, "%s", "no devfs");
 		rc = -ENOSYS;
 		goto failed;
 	}
+#endif
 	rc = dasd_devmap_init();
 	if (rc)
 		goto failed;
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_3370_erp.c linux-2.5.67-bk6/drivers/s390/block/dasd_3370_erp.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_3370_erp.c	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_3370_erp.c	2003-04-15 04:36:16.000000000 -0700
@@ -4,10 +4,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000
  *
- * $Revision: 1.7 $
- *
- * History of changes 
- *
+ * $Revision: 1.9 $
  */
 
 #define PRINTK_HEADER "dasd_erp(3370)"
@@ -32,7 +29,7 @@
  *   dasd_era_recover	for all others.
  */
 dasd_era_t
-dasd_3370_erp_examine(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_3370_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
 {
 	char *sense = irb->ecw;
 
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_3990_erp.c linux-2.5.67-bk6/drivers/s390/block/dasd_3990_erp.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_3990_erp.c	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_3990_erp.c	2003-04-15 04:36:16.000000000 -0700
@@ -5,11 +5,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000, 2001
  *
- * $Revision: 1.20 $
- *
- * History of changes:
- * 05/14/01 fixed PL030160GTO (BUG() in erp_action_5)
- * 05/04/02 code restructuring.
+ * $Revision: 1.24 $
  */
 
 #include <linux/timer.h>
@@ -23,11 +19,11 @@
 #include "dasd_eckd.h"
 
 
-typedef struct DCTL_data_t {
+struct DCTL_data {
 	unsigned char subcommand;	/* e.g Inhibit Write, Enable Write,... */
 	unsigned char modifier;	/* Subcommand modifier		       */
 	unsigned short res;	/* reserved */
-} __attribute__ ((packed)) DCTL_data_t;
+} __attribute__ ((packed));
 
 /*
  ***************************************************************************** 
@@ -54,10 +50,10 @@
  *   dasd_era_recover	for all others.
  */
 static dasd_era_t
-dasd_3990_erp_examine_24(dasd_ccw_req_t * cqr, char *sense)
+dasd_3990_erp_examine_24(struct dasd_ccw_req * cqr, char *sense)
 {
 
-	dasd_device_t *device = cqr->device;
+	struct dasd_device *device = cqr->device;
 
 	/* check for 'Command Reject' */
 	if ((sense[0] & SNS0_CMD_REJECT) &&
@@ -111,10 +107,10 @@
  *   dasd_era_recover	for recoverable others.
  */
 static dasd_era_t
-dasd_3990_erp_examine_32(dasd_ccw_req_t * cqr, char *sense)
+dasd_3990_erp_examine_32(struct dasd_ccw_req * cqr, char *sense)
 {
 
-	dasd_device_t *device = cqr->device;
+	struct dasd_device *device = cqr->device;
 
 	switch (sense[25]) {
 	case 0x00:
@@ -149,12 +145,12 @@
  *   dasd_era_recover	for all others.
  */
 dasd_era_t
-dasd_3990_erp_examine(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_3990_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
 {
 
 	char *sense = irb->ecw;
 	dasd_era_t era = dasd_era_recover;
-	dasd_device_t *device = cqr->device;
+	struct dasd_device *device = cqr->device;
 
 	/* check for successful execution first */
 	if (irb->scsw.cstat == 0x00 &&
@@ -207,10 +203,10 @@
  * RETURN VALUES
  *   cqr		original cqr		   
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_cleanup(dasd_ccw_req_t * erp, char final_status)
+static struct dasd_ccw_req *
+dasd_3990_erp_cleanup(struct dasd_ccw_req * erp, char final_status)
 {
-	dasd_ccw_req_t *cqr = erp->refers;
+	struct dasd_ccw_req *cqr = erp->refers;
 
 	dasd_free_erp_request(erp, erp->device);
 	cqr->status = final_status;
@@ -234,10 +230,10 @@
  *   void		
  */
 static void
-dasd_3990_erp_block_queue(dasd_ccw_req_t * erp, int expires)
+dasd_3990_erp_block_queue(struct dasd_ccw_req * erp, int expires)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	DEV_MESSAGE(KERN_INFO, device,
 		    "blocking request queue for %is", expires);
@@ -258,11 +254,11 @@
  * RETURN VALUES
  *   erp		modified erp
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_int_req(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_int_req(struct dasd_ccw_req * erp)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	/* first time set initial retry counter and erp_function */
 	/* and retry once without blocking queue		 */
@@ -301,9 +297,9 @@
  *   erp		modified pointer to the ERP
  */
 static void
-dasd_3990_erp_alternate_path(dasd_ccw_req_t * erp)
+dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp)
 {
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 	__u8 opm;
 
 	/* try alternate valid path */
@@ -349,17 +345,18 @@
  *   dctl_cqr		pointer to NEW dctl_cqr 
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_DCTL(dasd_ccw_req_t * erp, char modifier)
+static struct dasd_ccw_req *
+dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier)
 {
 
-	dasd_device_t *device = erp->device;
-	DCTL_data_t *DCTL_data;
+	struct dasd_device *device = erp->device;
+	struct DCTL_data *DCTL_data;
 	struct ccw1 *ccw;
-	dasd_ccw_req_t *dctl_cqr;
+	struct dasd_ccw_req *dctl_cqr;
 
 	dctl_cqr = dasd_alloc_erp_request((char *) &erp->magic, 1,
-					  sizeof (DCTL_data_t), erp->device);
+					  sizeof (struct DCTL_data),
+					  erp->device);
 	if (IS_ERR(dctl_cqr)) {
 		DEV_MESSAGE(KERN_ERR, device, "%s",
 			    "Unable to allocate DCTL-CQR");
@@ -409,8 +406,8 @@
  *   erp		pointer to the ERP
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_action_1(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_action_1(struct dasd_ccw_req * erp)
 {
 
 	erp->function = dasd_3990_erp_action_1;
@@ -438,11 +435,11 @@
  *   erp		pointer to the ERP
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_action_4(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	/* first time set initial retry counter and erp_function    */
 	/* and retry once without waiting for state change pending  */
@@ -496,8 +493,8 @@
  *   erp		pointer to the ERP
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_action_5(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_action_5(struct dasd_ccw_req * erp)
 {
 
 	/* first of all retry */
@@ -523,10 +520,10 @@
  *   void
  */
 static void
-dasd_3990_handle_env_data(dasd_ccw_req_t * erp, char *sense)
+dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 	char msg_format = (sense[7] & 0xF0);
 	char msg_no = (sense[7] & 0x0F);
 
@@ -1146,11 +1143,11 @@
  * RETURN VALUES
  *   erp		'new' erp_head - pointer to new ERP 
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_com_rej(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_com_rej;
 
@@ -1187,11 +1184,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_bus_out(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_bus_out(struct dasd_ccw_req * erp)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	/* first time set initial retry counter and erp_function */
 	/* and retry once without blocking queue		 */
@@ -1226,11 +1223,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_equip_check(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_equip_check;
 
@@ -1288,11 +1285,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_data_check(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_data_check;
 
@@ -1347,11 +1344,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_overrun(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_overrun(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_overrun;
 
@@ -1376,11 +1373,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_inv_format(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_inv_format(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_inv_format;
 
@@ -1417,11 +1414,11 @@
  * RETURN VALUES
  *   erp		pointer to original (failed) cqr.
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_EOC(dasd_ccw_req_t * default_erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_EOC(struct dasd_ccw_req * default_erp, char *sense)
 {
 
-	dasd_device_t *device = default_erp->device;
+	struct dasd_device *device = default_erp->device;
 
 	DEV_MESSAGE(KERN_ERR, device, "%s",
 		    "End-of-Cylinder - must never happen");
@@ -1442,11 +1439,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_env_data(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_env_data(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_env_data;
 
@@ -1479,11 +1476,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_no_rec(dasd_ccw_req_t * default_erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_no_rec(struct dasd_ccw_req * default_erp, char *sense)
 {
 
-	dasd_device_t *device = default_erp->device;
+	struct dasd_device *device = default_erp->device;
 
 	DEV_MESSAGE(KERN_ERR, device, "%s",
 		    "No Record Found - Fatal error should "
@@ -1506,11 +1503,11 @@
  * RETURN VALUES
  *   erp		new erp_head - pointer to new ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_file_prot(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_file_prot(struct dasd_ccw_req * erp)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	DEV_MESSAGE(KERN_ERR, device, "%s", "File Protected");
 
@@ -1532,11 +1529,11 @@
  * RETURN VALUES
  *   erp		pointer to the (addtitional) ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_inspect_24(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_inspect_24(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_ccw_req_t *erp_filled = NULL;
+	struct dasd_ccw_req *erp_filled = NULL;
 
 	/* Check sense for ....	   */
 	/* 'Command Reject'	   */
@@ -1612,11 +1609,11 @@
  * RETURN VALUES
  *   erp		modified erp_head
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_action_10_32(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_action_10_32(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->retries = 256;
 	erp->function = dasd_3990_erp_action_10_32;
@@ -1646,15 +1643,15 @@
  *   erp		new erp or 
  *			default_erp in case of imprecise ending or error
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_action_1B_32(dasd_ccw_req_t * default_erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense)
 {
 
-	dasd_device_t *device = default_erp->device;
+	struct dasd_device *device = default_erp->device;
 	__u32 cpa = 0;
-	dasd_ccw_req_t *cqr;
-	dasd_ccw_req_t *erp;
-	DE_eckd_data_t *DE_data;
+	struct dasd_ccw_req *cqr;
+	struct dasd_ccw_req *erp;
+	struct DE_eckd_data *DE_data;
 	char *LO_data;		/* LO_eckd_data_t */
 	struct ccw1 *ccw;
 
@@ -1695,8 +1692,8 @@
 	/* Build new ERP request including DE/LO */
 	erp = dasd_alloc_erp_request((char *) &cqr->magic,
 				     2 + 1,/* DE/LO + TIC */
-				     sizeof (DE_eckd_data_t) +
-				     sizeof (LO_eckd_data_t), device);
+				     sizeof (struct DE_eckd_data) +
+				     sizeof (struct LO_eckd_data), device);
 
 	if (IS_ERR(erp)) {
 		DEV_MESSAGE(KERN_ERR, device, "%s", "Unable to allocate ERP");
@@ -1705,10 +1702,10 @@
 
 	/* use original DE */
 	DE_data = erp->data;
-	memcpy(DE_data, cqr->data, sizeof (DE_eckd_data_t));
+	memcpy(DE_data, cqr->data, sizeof (struct DE_eckd_data));
 
 	/* create LO */
-	LO_data = erp->data + sizeof (DE_eckd_data_t);
+	LO_data = erp->data + sizeof (struct DE_eckd_data);
 
 	if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) {
 
@@ -1791,15 +1788,15 @@
  * RETURN VALUES
  *   erp		modified erp 
  */
-static dasd_ccw_req_t *
-dasd_3990_update_1B(dasd_ccw_req_t * previous_erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense)
 {
 
-	dasd_device_t *device = previous_erp->device;
+	struct dasd_device *device = previous_erp->device;
 	__u32 cpa = 0;
-	dasd_ccw_req_t *cqr;
-	dasd_ccw_req_t *erp;
-	char *LO_data;		/* LO_eckd_data_t */
+	struct dasd_ccw_req *cqr;
+	struct dasd_ccw_req *erp;
+	char *LO_data;		/* struct LO_eckd_data */
 	struct ccw1 *ccw;
 
 	DEV_MESSAGE(KERN_DEBUG, device, "%s",
@@ -1842,7 +1839,7 @@
 	erp = previous_erp;
 
 	/* update the LO with the new returned sense data  */
-	LO_data = erp->data + sizeof (DE_eckd_data_t);
+	LO_data = erp->data + sizeof (struct DE_eckd_data);
 
 	if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) {
 
@@ -1905,7 +1902,7 @@
  *
  */
 static void
-dasd_3990_erp_compound_retry(dasd_ccw_req_t * erp, char *sense)
+dasd_3990_erp_compound_retry(struct dasd_ccw_req * erp, char *sense)
 {
 
 	switch (sense[25] & 0x03) {
@@ -1949,7 +1946,7 @@
  *
  */
 static void
-dasd_3990_erp_compound_path(dasd_ccw_req_t * erp, char *sense)
+dasd_3990_erp_compound_path(struct dasd_ccw_req * erp, char *sense)
 {
 
 	if (sense[25] & DASD_SENSE_BIT_3) {
@@ -1984,8 +1981,8 @@
  *   erp		NEW ERP pointer
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_compound_code(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_compound_code(struct dasd_ccw_req * erp, char *sense)
 {
 
 	if (sense[25] & DASD_SENSE_BIT_2) {
@@ -2033,13 +2030,13 @@
  *
  */
 static void
-dasd_3990_erp_compound_config(dasd_ccw_req_t * erp, char *sense)
+dasd_3990_erp_compound_config(struct dasd_ccw_req * erp, char *sense)
 {
 
 	if ((sense[25] & DASD_SENSE_BIT_1) && (sense[26] & DASD_SENSE_BIT_2)) {
 
 		/* set to suspended duplex state then restart */
-		dasd_device_t *device = erp->device;
+		struct dasd_device *device = erp->device;
 
 		DEV_MESSAGE(KERN_ERR, device, "%s",
 			    "Set device to suspended duplex state should be "
@@ -2068,8 +2065,8 @@
  *   erp		(additional) ERP pointer
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_compound(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_compound(struct dasd_ccw_req * erp, char *sense)
 {
 
 	if ((erp->function == dasd_3990_erp_compound_retry) &&
@@ -2115,11 +2112,11 @@
  *   erp_filled		pointer to the ERP
  *
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_inspect_32(dasd_ccw_req_t * erp, char *sense)
+static struct dasd_ccw_req *
+dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 
 	erp->function = dasd_3990_erp_inspect_32;
 
@@ -2232,11 +2229,11 @@
  * RETURN VALUES
  *   erp_new		contens was possibly modified 
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_inspect(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_inspect(struct dasd_ccw_req * erp)
 {
 
-	dasd_ccw_req_t *erp_new = NULL;
+	struct dasd_ccw_req *erp_new = NULL;
 	/* sense data are located in the refers record of the */
 	/* already set up new ERP !			      */
 	char *sense = erp->refers->dstat->ecw;
@@ -2272,15 +2269,15 @@
  * RETURN VALUES
  *   erp		pointer to new ERP-chain head
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_add_erp(dasd_ccw_req_t * cqr)
+static struct dasd_ccw_req *
+dasd_3990_erp_add_erp(struct dasd_ccw_req * cqr)
 {
 
-	dasd_device_t *device = cqr->device;
+	struct dasd_device *device = cqr->device;
 	struct ccw1 *ccw;
 
 	/* allocate additional request block */
-	dasd_ccw_req_t *erp;
+	struct dasd_ccw_req *erp;
 
 	erp = dasd_alloc_erp_request((char *) &cqr->magic, 2, 0, cqr->device);
 	if (IS_ERR(erp)) {
@@ -2333,11 +2330,11 @@
  * RETURN VALUES
  *   erp		pointer to new ERP-chain head
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_additional_erp(dasd_ccw_req_t * cqr)
+static struct dasd_ccw_req *
+dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr)
 {
 
-	dasd_ccw_req_t *erp = NULL;
+	struct dasd_ccw_req *erp = NULL;
 
 	/* add erp and initialize with default TIC */
 	erp = dasd_3990_erp_add_erp(cqr);
@@ -2371,7 +2368,7 @@
  *			returns 1 if match found, otherwise 0.
  */
 static int
-dasd_3990_erp_error_match(dasd_ccw_req_t * cqr1, dasd_ccw_req_t * cqr2)
+dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1, struct dasd_ccw_req *cqr2)
 {
 
 	/* check failed CCW */
@@ -2406,11 +2403,11 @@
  *			recovery procedure OR
  *			NULL if a 'new' error occurred.
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_in_erp(dasd_ccw_req_t * cqr)
+static struct dasd_ccw_req *
+dasd_3990_erp_in_erp(struct dasd_ccw_req *cqr)
 {
 
-	dasd_ccw_req_t *erp_head = cqr,	/* save erp chain head */
+	struct dasd_ccw_req *erp_head = cqr,	/* save erp chain head */
 	*erp_match = NULL;	/* save erp chain head */
 	int match = 0;		/* 'boolean' for matching error found */
 
@@ -2450,11 +2447,11 @@
  * RETURN VALUES
  *   erp		modified/additional ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_further_erp(dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_further_erp(struct dasd_ccw_req *erp)
 {
 
-	dasd_device_t *device = erp->device;
+	struct dasd_device *device = erp->device;
 	char *sense = erp->dstat->ecw;
 
 	/* check for 24 byte sense ERP */
@@ -2539,13 +2536,14 @@
  * RETURN VALUES
  *   erp		modified/additional ERP
  */
-static dasd_ccw_req_t *
-dasd_3990_erp_handle_match_erp(dasd_ccw_req_t * erp_head, dasd_ccw_req_t * erp)
+static struct dasd_ccw_req *
+dasd_3990_erp_handle_match_erp(struct dasd_ccw_req *erp_head,
+			       struct dasd_ccw_req *erp)
 {
 
-	dasd_device_t *device = erp_head->device;
-	dasd_ccw_req_t *erp_done = erp_head;	/* finished req */
-	dasd_ccw_req_t *erp_free = NULL;	/* req to be freed */
+	struct dasd_device *device = erp_head->device;
+	struct dasd_ccw_req *erp_done = erp_head;	/* finished req */
+	struct dasd_ccw_req *erp_free = NULL;	/* req to be freed */
 
 	/* loop over successful ERPs and remove them from chanq */
 	while (erp_done != erp) {
@@ -2619,12 +2617,12 @@
  *			 - the original given cqr (which's status might 
  *			   be modified)
  */
-dasd_ccw_req_t *
-dasd_3990_erp_action(dasd_ccw_req_t * cqr)
+struct dasd_ccw_req *
+dasd_3990_erp_action(struct dasd_ccw_req * cqr)
 {
 
-	dasd_ccw_req_t *erp = NULL;
-	dasd_device_t *device = cqr->device;
+	struct dasd_ccw_req *erp = NULL;
+	struct dasd_device *device = cqr->device;
 	__u32 cpa = cqr->dstat->scsw.cpa;
 
 #ifdef ERP_DEBUG
@@ -2632,7 +2630,7 @@
 	DEV_MESSAGE(KERN_DEBUG, device, "%s",
 		    "ERP chain at BEGINNING of ERP-ACTION");
 	{
-		dasd_ccw_req_t *temp_erp = NULL;
+		struct dasd_ccw_req *temp_erp = NULL;
 
 		for (temp_erp = cqr;
 		     temp_erp != NULL; temp_erp = temp_erp->refers) {
@@ -2683,7 +2681,7 @@
 	/* print current erp_chain */
 	DEV_MESSAGE(KERN_DEBUG, device, "%s", "ERP chain at END of ERP-ACTION");
 	{
-		dasd_ccw_req_t *temp_erp = NULL;
+		struct dasd_ccw_req *temp_erp = NULL;
 		for (temp_erp = erp;
 		     temp_erp != NULL; temp_erp = temp_erp->refers) {
 
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_9336_erp.c linux-2.5.67-bk6/drivers/s390/block/dasd_9336_erp.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_9336_erp.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_9336_erp.c	2003-04-15 04:36:16.000000000 -0700
@@ -4,10 +4,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000
  *
- * $Revision: 1.6 $
- *
- * History of changes 
- *
+ * $Revision: 1.8 $
  */
 
 #define PRINTK_HEADER "dasd_erp(9336)"
@@ -32,7 +29,7 @@
  *   dasd_era_recover	for all others.
  */
 dasd_era_t
-dasd_9336_erp_examine(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_9336_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
 {
 	/* check for successful execution first */
 	if (irb->scsw.cstat == 0x00 &&
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_9343_erp.c linux-2.5.67-bk6/drivers/s390/block/dasd_9343_erp.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_9343_erp.c	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_9343_erp.c	2003-04-15 04:36:16.000000000 -0700
@@ -4,10 +4,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000
  *
- * $Revision: 1.11 $
- *
- * History of changes 
- * 
+ * $Revision: 1.13 $
  */
 
 #define PRINTK_HEADER "dasd_erp(9343)"
@@ -15,7 +12,7 @@
 #include "dasd_int.h"
 
 dasd_era_t
-dasd_9343_erp_examine(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_9343_erp_examine(struct dasd_ccw_req * cqr, struct irb * irb)
 {
 	if (irb->scsw.cstat == 0x00 &&
 	    irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_devmap.c linux-2.5.67-bk6/drivers/s390/block/dasd_devmap.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_devmap.c	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_devmap.c	2003-04-15 04:36:16.000000000 -0700
@@ -11,14 +11,10 @@
  * functions may not be called from interrupt context. In particular
  * dasd_get_device is a no-no from interrupt context.
  *
- * $Revision: 1.11 $
- *
- * History of changes 
- * 05/04/02 split from dasd.c, code restructuring.
+ * $Revision: 1.15 $
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
 
@@ -31,6 +27,25 @@
 #include "dasd_int.h"
 
 /*
+ * dasd_devmap_t is used to store the features and the relation
+ * between device number and device index. To find a dasd_devmap_t
+ * that corresponds to a device number of a device index each
+ * dasd_devmap_t is added to two linked lists, one to search by
+ * the device number and one to search by the device index. As
+ * soon as big minor numbers are available the device index list
+ * can be removed since the device number will then be identical
+ * to the device index.
+ */
+struct dasd_devmap {
+	struct list_head devindex_list;
+	struct list_head devno_list;
+        unsigned int devindex;
+        unsigned short devno;
+        unsigned short features;
+	struct dasd_device *device;
+};
+
+/*
  * Parameter parsing functions for dasd= parameter. The syntax is:
  *   <devno>		: (0x)?[0-9a-fA-F]+
  *   <feature>		: ro
@@ -245,13 +260,12 @@
 	}
 	spin_lock(&dasd_devmap_lock);
 	for (devno = from; devno <= to; devno++) {
-		dasd_devmap_t *devmap, *tmp;
-		struct list_head *l;
+		struct dasd_devmap *devmap, *tmp;
 
 		devmap = NULL;
 		/* Find previous devmap for device number i */
-		list_for_each(l, &dasd_devno_hashlists[devno & 255]) {
-			tmp = list_entry(l, dasd_devmap_t, devno_list);
+		list_for_each_entry(tmp, &dasd_devno_hashlists[devno & 255],
+				    devno_list) {
 			if (tmp->devno == devno) {
 				devmap = tmp;
 				break;
@@ -259,8 +273,8 @@
 		}
 		if (devmap == NULL) {
 			/* This devno is new. */
-			devmap = (dasd_devmap_t *)
-				kmalloc(sizeof(dasd_devmap_t), GFP_KERNEL);
+			devmap = (struct dasd_devmap *)
+				kmalloc(sizeof(struct dasd_devmap),GFP_KERNEL);
 			if (devmap == NULL)
 				return -ENOMEM;
 			devindex = dasd_max_devindex++;
@@ -279,6 +293,30 @@
 }
 
 /*
+ * Check if devno has been added to the list of dasd ranges.
+ */
+int
+dasd_devno_in_range(int devno)
+{
+	struct dasd_devmap *devmap;
+	int ret;
+		
+	ret = -ENOENT;
+	spin_lock(&dasd_devmap_lock);
+	/* Find devmap for device with device number devno */
+	list_for_each_entry(devmap, &dasd_devno_hashlists[devno&255],
+			    devno_list) {
+		if (devmap->devno == devno) {
+			/* Found the device. */
+			ret = 0;
+			break;
+		}
+	}
+	spin_unlock(&dasd_devmap_lock);
+	return ret;
+}
+
+/*
  * Forget all about the device numbers added so far.
  * This may only be called at module unload or system shutdown.
  */
@@ -290,9 +328,9 @@
 	spin_lock(&dasd_devmap_lock);
 	for (i = 0; i < 256; i++) {
 		struct list_head *l, *next;
-		dasd_devmap_t *devmap;
+		struct dasd_devmap *devmap;
 		list_for_each_safe(l, next, &dasd_devno_hashlists[i]) {
-			devmap = list_entry(l, dasd_devmap_t, devno_list);
+			devmap = list_entry(l, struct dasd_devmap, devno_list);
 			if (devmap->device != NULL)
 				BUG();
 			list_del(&devmap->devindex_list);
@@ -307,17 +345,15 @@
  * Find the devmap structure from a devno. Can be removed as soon
  * as big minors are available.
  */
-dasd_devmap_t *
+static struct dasd_devmap *
 dasd_devmap_from_devno(int devno)
 {
-	struct list_head *l;
-	dasd_devmap_t *devmap, *tmp;
+	struct dasd_devmap *devmap, *tmp;
 		
 	devmap = NULL;
 	spin_lock(&dasd_devmap_lock);
 	/* Find devmap for device with device number devno */
-	list_for_each(l, &dasd_devno_hashlists[devno&255]) {
-		tmp = list_entry(l, dasd_devmap_t, devno_list);
+	list_for_each_entry(tmp, &dasd_devno_hashlists[devno&255], devno_list) {
 		if (tmp->devno == devno) {
 			/* Found the device, return devmap */
 			devmap = tmp;
@@ -332,17 +368,16 @@
  * Find the devmap for a device by its device index. Can be removed
  * as soon as big minors are available.
  */
-dasd_devmap_t *
+static struct dasd_devmap *
 dasd_devmap_from_devindex(int devindex)
 {
-	struct list_head *l;
-	dasd_devmap_t *devmap, *tmp;
+	struct dasd_devmap *devmap, *tmp;
 		
 	devmap = NULL;
 	spin_lock(&dasd_devmap_lock);
 	/* Find devmap for device with device index devindex */
-	list_for_each(l, &dasd_devindex_hashlists[devindex & 255]) {
-		tmp = list_entry(l, dasd_devmap_t, devindex_list);
+	list_for_each_entry(tmp, &dasd_devindex_hashlists[devindex & 255],
+			    devindex_list) {
 		if (tmp->devindex == devindex) {
 			/* Found the device, return devno */
 			devmap = tmp;
@@ -353,60 +388,140 @@
 	return devmap;
 }
 
-/*
- * Find the device structure for device number devno. If it does not
- * exists yet, allocate it. Increase the reference counter in the device
- * structure and return a pointer to it.
- */
-dasd_device_t *
-dasd_get_device(dasd_devmap_t *devmap)
+struct dasd_device *
+dasd_device_from_devindex(int devindex)
 {
-	dasd_device_t *device;
+	struct dasd_devmap *devmap;
+	struct dasd_device *device;
 
+	devmap = dasd_devmap_from_devindex(devindex);
 	spin_lock(&dasd_devmap_lock);
 	device = devmap->device;
-	if (device != NULL)
-		atomic_inc(&device->ref_count);
+	if (device)
+		dasd_get_device(device);
+	else
+		device = ERR_PTR(-ENODEV);
 	spin_unlock(&dasd_devmap_lock);
-	if (device != NULL)
-		return device;
+	return device;
+}
+
+/*
+ * Return kdev for a dasd device.
+ */
+kdev_t
+dasd_get_kdev(struct dasd_device *device)
+{
+	struct dasd_devmap *devmap;
+	int major, minor;
+	int devno;
+
+	devno = _ccw_device_get_device_number(device->cdev);
+	devmap = dasd_devmap_from_devno(devno);
+	if (devmap == NULL)
+		return NODEV;
+	major = dasd_gendisk_index_major(devmap->devindex);
+	if (major < 0)
+		return NODEV;
+	minor = devmap->devindex % DASD_PER_MAJOR;
+	return mk_kdev(major, minor);
+}
+
+/*
+ * Create a dasd device structure for cdev.
+ */
+struct dasd_device *
+dasd_create_device(struct ccw_device *cdev)
+{
+	struct dasd_devmap *devmap;
+	struct dasd_device *device;
+	int devno;
+	int rc;
+
+	devno = _ccw_device_get_device_number(cdev);
+	rc = dasd_add_range(devno, devno, DASD_FEATURE_DEFAULT);
+	if (rc)
+		return ERR_PTR(rc);
+
+	if (!(devmap = dasd_devmap_from_devno (devno)))
+		return ERR_PTR(-ENODEV);
 
-	device = dasd_alloc_device(devmap);
+	device = dasd_alloc_device(devmap->devindex);
 	if (IS_ERR(device))
 		return device;
+	atomic_set(&device->ref_count, 1);
+	device->ro_flag = (devmap->features & DASD_FEATURE_READONLY) ? 1 : 0;
+	device->use_diag_flag = 1;
 
-	spin_lock(&dasd_devmap_lock);
-	if (devmap->device != NULL) {
+	spin_lock_irq(get_ccwdev_lock(cdev));
+	if (cdev->dev.driver_data == NULL) {
+		get_device(&cdev->dev);
+		cdev->dev.driver_data = device;
+		device->gdp->driverfs_dev = &cdev->dev;
+		device->cdev = cdev;
+		rc = 0;
+	} else
 		/* Someone else was faster. */
+		rc = -EBUSY;
+	spin_unlock_irq(get_ccwdev_lock(cdev));
+	if (rc) {
 		dasd_free_device(device);
-		device = devmap->device;
-	} else
-		devmap->device = device;
-	atomic_inc(&device->ref_count);
-	device->ro_flag = (devmap->features & DASD_FEATURE_READONLY) ? 1 : 0;
-	device->use_diag_flag = 1;
+		return ERR_PTR(rc);
+	}
+	/* Device created successfully. Make it known via devmap. */
+	spin_lock(&dasd_devmap_lock);
+	devmap->device = device;
 	spin_unlock(&dasd_devmap_lock);
+
 	return device;
 }
 
 /*
- * Decrease the reference counter of a devices structure. If the
- * reference counter reaches zero and the device status is
- * DASD_STATE_NEW the device structure is freed. 
+ * Wait queue for dasd_delete_device waits.
+ */
+static DECLARE_WAIT_QUEUE_HEAD(dasd_delete_wq);
+
+/*
+ * Remove a dasd device structure.
  */
 void
-dasd_put_device(dasd_devmap_t *devmap)
+dasd_delete_device(struct dasd_device *device)
 {
-	dasd_device_t *device;
+	struct ccw_device *cdev;
+	struct dasd_devmap *devmap;
+	int devno;
 
+	/* First remove device pointer from devmap. */
+	devno = _ccw_device_get_device_number(device->cdev);
+	devmap = dasd_devmap_from_devno (devno);
 	spin_lock(&dasd_devmap_lock);
-	device = devmap->device;
-	if (atomic_dec_return(&device->ref_count) == 0 &&
-	    device->state == DASD_STATE_NEW) {
-		devmap->device = NULL;
-		dasd_free_device(device);
-	}
+	devmap->device = NULL;
 	spin_unlock(&dasd_devmap_lock);
+
+	/* Wait for reference counter to drop to zero. */
+	atomic_dec(&device->ref_count);
+	wait_event(dasd_delete_wq, atomic_read(&device->ref_count) == 0);
+
+	/* Disconnect dasd_device structure from ccw_device structure. */
+	cdev = device->cdev;
+	device->cdev = NULL;
+	device->gdp->driverfs_dev = NULL;
+	cdev->dev.driver_data = NULL;
+
+	/* Put ccw_device structure. */
+	put_device(&cdev->dev);
+
+	/* Now the device structure can be freed. */
+	dasd_free_device(device);
+}
+
+/*
+ * Reference counter dropped to zero. Wake up waiter
+ * in dasd_delete_device.
+ */
+void
+dasd_put_device_wake(struct dasd_device *device)
+{
+	wake_up(&dasd_delete_wq);
 }
 
 int
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_diag.c linux-2.5.67-bk6/drivers/s390/block/dasd_diag.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_diag.c	2003-04-07 10:30:35.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_diag.c	2003-04-15 04:36:16.000000000 -0700
@@ -6,16 +6,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.27 $
- *
- * History of changes
- * 07/13/00 Added fixup sections for diagnoses ans saved some registers
- * 07/14/00 fixed constraints in newly generated inline asm
- * 10/05/00 adapted to 'new' DASD driver
- *	    fixed return codes of dia250()
- *	    fixed partition handling and HDIO_GETGEO
- * 2002/01/04 Created 2.4-2.5 compatibility mode
- * 05/04/02 code restructuring.
+ * $Revision: 1.31 $
  */
 
 #include <linux/config.h>
@@ -44,17 +35,17 @@
 
 MODULE_LICENSE("GPL");
 
-typedef struct dasd_diag_private_t {
-	dasd_diag_characteristics_t rdc_data;
-	diag_rw_io_t iob;
-	diag_init_io_t iib;
+struct dasd_diag_private {
+	struct dasd_diag_characteristics rdc_data;
+	struct dasd_diag_rw_io iob;
+	struct dasd_diag_init_io iib;
 	unsigned int pt_block;
-} dasd_diag_private_t;
+};
 
-typedef struct dasd_diag_req_t {
+struct dasd_diag_req {
 	int block_count;
-	diag_bio_t bio[0];
-} dasd_diag_req_t;
+	struct dasd_diag_bio bio[0];
+};
 
 static __inline__ int
 dia250(void *iob, int cmd)
@@ -86,17 +77,17 @@
 }
 
 static __inline__ int
-mdsk_init_io(dasd_device_t * device, int blocksize, int offset, int size)
+mdsk_init_io(struct dasd_device * device, int blocksize, int offset, int size)
 {
-	dasd_diag_private_t *private;
-	diag_init_io_t *iib;
+	struct dasd_diag_private *private;
+	struct dasd_diag_init_io *iib;
 	int rc;
 
-	private = (dasd_diag_private_t *) device->private;
+	private = (struct dasd_diag_private *) device->private;
 	iib = &private->iib;
-	memset(iib, 0, sizeof (diag_init_io_t));
+	memset(iib, 0, sizeof (struct dasd_diag_init_io));
 
-	iib->dev_nr = device->devno;
+	iib->dev_nr = _ccw_device_get_device_number(device->cdev);
 	iib->block_size = blocksize;
 	iib->offset = offset;
 	iib->start_block = 0;
@@ -108,33 +99,33 @@
 }
 
 static __inline__ int
-mdsk_term_io(dasd_device_t * device)
+mdsk_term_io(struct dasd_device * device)
 {
-	dasd_diag_private_t *private;
-	diag_init_io_t *iib;
+	struct dasd_diag_private *private;
+	struct dasd_diag_init_io *iib;
 	int rc;
 
-	private = (dasd_diag_private_t *) device->private;
+	private = (struct dasd_diag_private *) device->private;
 	iib = &private->iib;
-	memset(iib, 0, sizeof (diag_init_io_t));
-	iib->dev_nr = device->devno;
+	memset(iib, 0, sizeof (struct dasd_diag_init_io));
+	iib->dev_nr = _ccw_device_get_device_number(device->cdev);
 	rc = dia250(iib, TERM_BIO);
 	return rc & 3;
 }
 
 static int
-dasd_start_diag(dasd_ccw_req_t * cqr)
+dasd_start_diag(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device;
-	dasd_diag_private_t *private;
-	dasd_diag_req_t *dreq;
+	struct dasd_device *device;
+	struct dasd_diag_private *private;
+	struct dasd_diag_req *dreq;
 	int rc;
 
 	device = cqr->device;
-	private = (dasd_diag_private_t *) device->private;
-	dreq = (dasd_diag_req_t *) cqr->data;
+	private = (struct dasd_diag_private *) device->private;
+	dreq = (struct dasd_diag_req *) cqr->data;
 
-	private->iob.dev_nr = device->devno;
+	private->iob.dev_nr = _ccw_device_get_device_number(device->cdev);
 	private->iob.key = 0;
 	private->iob.flags = 2;	/* do asynchronous io */
 	private->iob.block_count = dreq->block_count;
@@ -160,8 +151,8 @@
 static void
 dasd_ext_handler(struct pt_regs *regs, __u16 code)
 {
-	dasd_ccw_req_t *cqr, *next;
-	dasd_device_t *device;
+	struct dasd_ccw_req *cqr, *next;
+	struct dasd_device *device;
 	unsigned long long expires;
 	unsigned long flags;
 	char status;
@@ -186,11 +177,11 @@
 		irq_exit();
 		return;
 	}
-	cqr = (dasd_ccw_req_t *)(addr_t) ip;
-	device = (dasd_device_t *) cqr->device;
+	cqr = (struct dasd_ccw_req *)(addr_t) ip;
+	device = (struct dasd_device *) cqr->device;
 	if (strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
 		DEV_MESSAGE(KERN_WARNING, device,
-			    " magic number of dasd_ccw_req_t 0x%08X doesn't"
+			    " magic number of dasd_ccw_req 0x%08X doesn't"
 			    " match discipline 0x%08X",
 			    cqr->magic, *(int *) (&device->discipline->name));
 		irq_exit();
@@ -208,7 +199,7 @@
 		/* Start first request on queue if possible -> fast_io. */
 		if (!list_empty(&device->ccw_queue)) {
 			next = list_entry(device->ccw_queue.next,
-					  dasd_ccw_req_t, list);
+					  struct dasd_ccw_req, list);
 			if (next->status == DASD_CQR_QUEUED) {
 				if (dasd_start_diag(next) == 0)
 					expires = next->expires;
@@ -231,18 +222,18 @@
 }
 
 static int
-dasd_diag_check_device(dasd_device_t *device)
+dasd_diag_check_device(struct dasd_device *device)
 {
-	dasd_diag_private_t *private;
-	dasd_diag_characteristics_t *rdc_data;
-	diag_bio_t bio;
+	struct dasd_diag_private *private;
+	struct dasd_diag_characteristics *rdc_data;
+	struct dasd_diag_bio bio;
 	long *label;
 	int sb, bsize;
 	int rc;
 
-	private = (dasd_diag_private_t *) device->private;
+	private = (struct dasd_diag_private *) device->private;
 	if (private == NULL) {
-		private = kmalloc(sizeof(dasd_diag_private_t), GFP_KERNEL);
+		private = kmalloc(sizeof(struct dasd_diag_private),GFP_KERNEL);
 		if (private == NULL) {
 			MESSAGE(KERN_WARNING, "%s",
 				"memory allocation failed for private data");
@@ -252,8 +243,8 @@
 	}
 	/* Read Device Characteristics */
 	rdc_data = (void *) &(private->rdc_data);
-	rdc_data->dev_nr = device->devno;
-	rdc_data->rdc_len = sizeof (dasd_diag_characteristics_t);
+	rdc_data->dev_nr = _ccw_device_get_device_number(device->cdev);
+	rdc_data->rdc_len = sizeof (struct dasd_diag_characteristics);
 
 	rc = diag210((struct diag210 *) rdc_data);
 	if (rc)
@@ -289,11 +280,11 @@
 	}
 	for (bsize = 512; bsize <= PAGE_SIZE; bsize <<= 1) {
 		mdsk_init_io(device, bsize, 0, 64);
-		memset(&bio, 0, sizeof (diag_bio_t));
+		memset(&bio, 0, sizeof (struct dasd_diag_bio));
 		bio.type = MDSK_READ_REQ;
 		bio.block_number = private->pt_block + 1;
 		bio.buffer = __pa(label);
-		memset(&private->iob, 0, sizeof (diag_rw_io_t));
+		memset(&private->iob, 0, sizeof (struct dasd_diag_rw_io));
 		private->iob.dev_nr = rdc_data->dev_nr;
 		private->iob.key = 0;
 		private->iob.flags = 0;	/* do synchronous io */
@@ -324,7 +315,7 @@
 }
 
 static int
-dasd_diag_fill_geometry(dasd_device_t *device, struct hd_geometry *geo)
+dasd_diag_fill_geometry(struct dasd_device *device, struct hd_geometry *geo)
 {
 	if (dasd_check_blocksize(device->bp_block) != 0)
 		return -EINVAL;
@@ -335,29 +326,29 @@
 }
 
 static dasd_era_t
-dasd_diag_examine_error(dasd_ccw_req_t * cqr, struct irb * stat)
+dasd_diag_examine_error(struct dasd_ccw_req * cqr, struct irb * stat)
 {
 	return dasd_era_fatal;
 }
 
 static dasd_erp_fn_t
-dasd_diag_erp_action(dasd_ccw_req_t * cqr)
+dasd_diag_erp_action(struct dasd_ccw_req * cqr)
 {
 	return dasd_default_erp_action;
 }
 
 static dasd_erp_fn_t
-dasd_diag_erp_postaction(dasd_ccw_req_t * cqr)
+dasd_diag_erp_postaction(struct dasd_ccw_req * cqr)
 {
 	return dasd_default_erp_postaction;
 }
 
-static dasd_ccw_req_t *
-dasd_diag_build_cp(dasd_device_t * device, struct request *req)
+static struct dasd_ccw_req *
+dasd_diag_build_cp(struct dasd_device * device, struct request *req)
 {
-	dasd_ccw_req_t *cqr;
-	dasd_diag_req_t *dreq;
-	diag_bio_t *dbio;
+	struct dasd_ccw_req *cqr;
+	struct dasd_diag_req *dreq;
+	struct dasd_diag_bio *dbio;
 	struct bio *bio;
 	struct bio_vec *bv;
 	char *dst;
@@ -391,13 +382,14 @@
 	if (count != last_rec - first_rec + 1)
 		return ERR_PTR(-EINVAL);
 	/* Build the request */
-	datasize = sizeof(dasd_diag_req_t) + count*sizeof(diag_bio_t);
+	datasize = sizeof(struct dasd_diag_req) +
+		count*sizeof(struct dasd_diag_bio);
 	cqr = dasd_smalloc_request(dasd_diag_discipline.name, 0,
 				   datasize, device);
 	if (IS_ERR(cqr))
 		return cqr;
 	
-	dreq = (dasd_diag_req_t *) cqr->data;
+	dreq = (struct dasd_diag_req *) cqr->data;
 	dreq->block_count = count;
 	dbio = dreq->bio;
 	recid = first_rec;
@@ -405,7 +397,7 @@
 		bio_for_each_segment(bv, bio, i) {
 			dst = kmap(bv->bv_page) + bv->bv_offset;
 			for (off = 0; off < bv->bv_len; off += blksize) {
-				memset(dbio, 0, sizeof (diag_bio_t));
+				memset(dbio, 0, sizeof (struct dasd_diag_bio));
 				dbio->type = rw_cmd;
 				dbio->block_number = recid + 1;
 				dbio->buffer = __pa(dst);
@@ -423,24 +415,25 @@
 }
 
 static int
-dasd_diag_fill_info(dasd_device_t * device, dasd_information2_t * info)
+dasd_diag_fill_info(struct dasd_device * device,
+		    struct dasd_information2_t * info)
 {
-	dasd_diag_private_t *private;
+	struct dasd_diag_private *private;
 
-	private = (dasd_diag_private_t *) device->private;
+	private = (struct dasd_diag_private *) device->private;
 	info->label_block = private->pt_block;
 	info->FBA_layout = 1;
 	info->format = DASD_FORMAT_LDL;
-	info->characteristics_size = sizeof (dasd_diag_characteristics_t);
+	info->characteristics_size = sizeof (struct dasd_diag_characteristics);
 	memcpy(info->characteristics,
-	       &((dasd_diag_private_t *) device->private)->rdc_data,
-	       sizeof (dasd_diag_characteristics_t));
+	       &((struct dasd_diag_private *) device->private)->rdc_data,
+	       sizeof (struct dasd_diag_characteristics));
 	info->confdata_size = 0;
 	return 0;
 }
 
 static void
-dasd_diag_dump_sense(dasd_device_t *device, dasd_ccw_req_t * req,
+dasd_diag_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 		     struct irb *stat)
 {
 	char *page;
@@ -463,15 +456,15 @@
  * max_blocks is dependent on the amount of storage that is available
  * in the static io buffer for each device. Currently each device has
  * 8192 bytes (=2 pages). dasd diag is only relevant for 31 bit.
- * The dasd_ccw_req_t has 96 bytes, the dasd_diag_req_t has 8 bytes and
- * the diag_bio_t for each block has 16 bytes. 
+ * The struct dasd_ccw_req has 96 bytes, the struct dasd_diag_req has
+ * 8 bytes and the struct dasd_diag_bio for each block has 16 bytes. 
  * That makes:
  * (8192 - 96 - 8) / 16 = 505.5 blocks at maximum.
  * We want to fit two into the available memory so that we can immediately
  * start the next request if one finishes off. That makes 252.75 blocks
  * for one request. Give a little safety and the result is 240.
  */
-dasd_discipline_t dasd_diag_discipline = {
+struct dasd_discipline dasd_diag_discipline = {
 	.owner = THIS_MODULE,
 	.name = "DIAG",
 	.ebcname = "DIAG",
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_diag.h linux-2.5.67-bk6/drivers/s390/block/dasd_diag.h
--- linux-2.5.67-bk5/drivers/s390/block/dasd_diag.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_diag.h	2003-04-15 04:36:16.000000000 -0700
@@ -6,10 +6,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.4 $
- *
- * History of changes
- *
+ * $Revision: 1.6 $
  */
 
 #define MDSK_WRITE_REQ 0x01
@@ -22,7 +19,7 @@
 #define DEV_CLASS_FBA	0x01
 #define DEV_CLASS_ECKD	0x04
 
-typedef struct dasd_diag_characteristics_t {
+struct dasd_diag_characteristics {
 	u16 dev_nr;
 	u16 rdc_len;
 	u8 vdev_class;
@@ -33,22 +30,18 @@
 	u8 rdev_type;
 	u8 rdev_model;
 	u8 rdev_features;
-} __attribute__ ((packed, aligned(4)))
-
-    dasd_diag_characteristics_t;
+} __attribute__ ((packed, aligned(4)));
 
-typedef struct diag_bio_t {
+struct dasd_diag_bio {
 	u8 type;
 	u8 status;
 	u16 spare1;
 	u32 block_number;
 	u32 alet;
 	u32 buffer;
-} __attribute__ ((packed, aligned(8)))
+} __attribute__ ((packed, aligned(8)));
 
-    diag_bio_t;
-
-typedef struct diag_init_io_t {
+struct dasd_diag_init_io {
 	u16 dev_nr;
 	u16 spare1[11];
 	u32 block_size;
@@ -56,11 +49,9 @@
 	u32 start_block;
 	u32 end_block;
 	u32 spare2[6];
-} __attribute__ ((packed, aligned(8)))
-
-    diag_init_io_t;
+} __attribute__ ((packed, aligned(8)));
 
-typedef struct diag_rw_io_t {
+struct dasd_diag_rw_io {
 	u16 dev_nr;
 	u16 spare1[11];
 	u8 key;
@@ -71,7 +62,5 @@
 	u32 bio_list;
 	u32 interrupt_params;
 	u32 spare3[5];
-} __attribute__ ((packed, aligned(8)))
-
-    diag_rw_io_t;
+} __attribute__ ((packed, aligned(8)));
 
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_eckd.c linux-2.5.67-bk6/drivers/s390/block/dasd_eckd.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_eckd.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_eckd.c	2003-04-15 04:36:16.000000000 -0700
@@ -7,23 +7,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.36 $
- *
- * History of changes (starts July 2000)
- * 07/11/00 Enabled rotational position sensing
- * 07/14/00 Reorganized the format process for better ERP
- * 07/20/00 added experimental support for 2105 control unit (ESS)
- * 07/24/00 increased expiration time and added the missing zero
- * 08/07/00 added some bits to define_extent for ESS support
- * 09/20/00 added reserve and release ioctls
- * 10/04/00 changed RW-CCWS to R/W Key and Data
- * 10/10/00 reverted last change according to ESS exploitation
- * 10/10/00 now dequeuing init_cqr before freeing *ouch*
- * 26/10/00 fixed ITPM20144ASC (problems when accessing a device formatted by VIF)
- * 01/23/01 fixed kmalloc statement in dump_sense to be GFP_ATOMIC
- *	    fixed partition handling and HDIO_GETGEO
- * 2002/01/04 Created 2.4-2.5 compatibility mode
- * 05/04/02 code restructuring.
+ * $Revision: 1.42 $
  */
 
 #include <linux/config.h>
@@ -64,16 +48,16 @@
 
 MODULE_LICENSE("GPL");
 
-static dasd_discipline_t dasd_eckd_discipline;
+static struct dasd_discipline dasd_eckd_discipline;
 
-typedef struct dasd_eckd_private_t {
-	dasd_eckd_characteristics_t rdc_data;
-	dasd_eckd_confdata_t conf_data;
-	eckd_count_t count_area[5];
+struct dasd_eckd_private {
+	struct dasd_eckd_characteristics rdc_data;
+	struct dasd_eckd_confdata conf_data;
+	struct eckd_count count_area[5];
 	int init_cqr_status;
 	int uses_cdl;
-	attrib_data_t attrib;	/* e.g. cache operations */
-} dasd_eckd_private_t;
+	struct attrib_data_t attrib;	/* e.g. cache operations */
+};
 
 /* The ccw bus type uses this table to find devices that it sends to
  * dasd_eckd_probe */
@@ -132,7 +116,7 @@
 }
 
 static inline int
-bytes_per_record(dasd_eckd_characteristics_t *rdc, int kl, int dl)
+bytes_per_record(struct dasd_eckd_characteristics *rdc, int kl, int dl)
 {
 	unsigned int fl1, fl2, int1, int2;
 	int bpr;
@@ -164,13 +148,13 @@
 }
 
 static inline unsigned int
-bytes_per_track(dasd_eckd_characteristics_t *rdc)
+bytes_per_track(struct dasd_eckd_characteristics *rdc)
 {
 	return *(unsigned int *) (rdc->byte_per_track) >> 8;
 }
 
 static inline unsigned int
-recs_per_track(dasd_eckd_characteristics_t * rdc,
+recs_per_track(struct dasd_eckd_characteristics * rdc,
 	       unsigned int kl, unsigned int dl)
 {
 	int dn, kn;
@@ -204,12 +188,12 @@
 
 static inline void
 check_XRC (struct ccw1         *de_ccw,
-           DE_eckd_data_t *data,
-           dasd_device_t  *device)
+           struct DE_eckd_data *data,
+           struct dasd_device  *device)
 {
-        dasd_eckd_private_t *private;
+        struct dasd_eckd_private *private;
 
-        private = (dasd_eckd_private_t *) device->private;
+        private = (struct dasd_eckd_private *) device->private;
 
         /* switch on System Time Stamp - needed for XRC Support */
         if (private->rdc_data.facilities.XRC_supported) {
@@ -219,7 +203,7 @@
                 
                 data->ep_sys_time = get_clock ();
                 
-                de_ccw->count = sizeof (DE_eckd_data_t);
+                de_ccw->count = sizeof (struct DE_eckd_data);
                 de_ccw->flags = CCW_FLAG_SLI;  
         }
 
@@ -228,20 +212,20 @@
 } /* end check_XRC */
 
 static inline void
-define_extent(struct ccw1 * ccw, DE_eckd_data_t * data, int trk, int totrk,
-	      int cmd, dasd_device_t * device)
+define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk,
+	      int totrk, int cmd, struct dasd_device * device)
 {
-	dasd_eckd_private_t *private;
-	ch_t geo, beg, end;
+	struct dasd_eckd_private *private;
+	struct ch_t geo, beg, end;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 
 	ccw->cmd_code = DASD_ECKD_CCW_DEFINE_EXTENT;
 	ccw->flags = 0;
 	ccw->count = 16;
 	ccw->cda = (__u32) __pa(data);
 
-	memset(data, 0, sizeof (DE_eckd_data_t));
+	memset(data, 0, sizeof (struct DE_eckd_data));
 	switch (cmd) {
 	case DASD_ECKD_CCW_READ_HOME_ADDRESS:
 	case DASD_ECKD_CCW_READ_RECORD_ZERO:
@@ -319,15 +303,15 @@
 }
 
 static inline void
-locate_record(struct ccw1 *ccw, LO_eckd_data_t *data, int trk,
+locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk,
 	      int rec_on_trk, int no_rec, int cmd,
-	      dasd_device_t * device, int reclen)
+	      struct dasd_device * device, int reclen)
 {
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 	int sector;
 	int dn, d;
 				
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 
 	DBF_EVENT(DBF_INFO,
 		  "Locate: trk %d, rec %d, no_rec %d, cmd %d, reclen %d",
@@ -338,7 +322,7 @@
 	ccw->count = 16;
 	ccw->cda = (__u32) __pa(data);
 
-	memset(data, 0, sizeof (LO_eckd_data_t));
+	memset(data, 0, sizeof (struct LO_eckd_data));
 	sector = 0;
 	if (rec_on_trk) {
 		switch (private->rdc_data.dev_type) {
@@ -456,17 +440,17 @@
 }
 
 static int
-dasd_eckd_check_characteristics(dasd_device_t *device)
+dasd_eckd_check_characteristics(struct dasd_device *device)
 {
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 	void *rdc_data;
 	void *conf_data;
 	int conf_len;
 	int rc;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	if (private == NULL) {
-		private = kmalloc(sizeof(dasd_eckd_private_t),
+		private = kmalloc(sizeof(struct dasd_eckd_private),
 				  GFP_KERNEL | GFP_DMA);
 		if (private == NULL) {
 			MESSAGE(KERN_WARNING, "%s",
@@ -511,14 +495,15 @@
 		MESSAGE(KERN_WARNING, "%s", "No configuration data retrieved");
 		return 0;	/* no errror */
 	}
-	if (conf_len != sizeof (dasd_eckd_confdata_t)) {
+	if (conf_len != sizeof (struct dasd_eckd_confdata)) {
 		MESSAGE(KERN_WARNING,
 			"sizes of configuration data mismatch"
 			"%d (read) vs %ld (expected)",
-			conf_len, sizeof (dasd_eckd_confdata_t));
+			conf_len, sizeof (struct dasd_eckd_confdata));
 		return 0;	/* no errror */
 	}
-	memcpy(&private->conf_data, conf_data, sizeof (dasd_eckd_confdata_t));
+	memcpy(&private->conf_data, conf_data,
+	       sizeof (struct dasd_eckd_confdata));
 
 	DEV_MESSAGE(KERN_INFO, device,
 		    "%04X/%02X(CU:%04X/%02X): Configuration data read",
@@ -528,27 +513,28 @@
 		    private->rdc_data.cu_model.model);
 	return 0;
 
-        /* get characteristis via diag to determine the kind of minidisk under VM */
-        /* needed beacause XRC is not support by VM (jet)                         */
-        /* Can be removed as soon as VM supports XRC                              */
-	// TBD ??? HUM
+        /* get characteristis via diag to determine the kind of
+	 * minidisk under VM needed beacause XRC is not support
+	 * by VM (jet). Can be removed as soon as VM supports XRC
+	 * FIXME: TBD ??? HUM
+	 */
 }
 
-static dasd_ccw_req_t *
-dasd_eckd_analysis_ccw(struct dasd_device_t *device)
-{
-	dasd_eckd_private_t *private;
-	eckd_count_t *count_data;
-	LO_eckd_data_t *LO_data;
-	dasd_ccw_req_t *cqr;
+static struct dasd_ccw_req *
+dasd_eckd_analysis_ccw(struct dasd_device *device)
+{
+	struct dasd_eckd_private *private;
+	struct eckd_count *count_data;
+	struct LO_eckd_data *LO_data;
+	struct dasd_ccw_req *cqr;
 	struct ccw1 *ccw;
 	int cplength, datasize;
 	int i;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 
 	cplength = 8;
-	datasize = sizeof(DE_eckd_data_t) + 2*sizeof(LO_eckd_data_t);
+	datasize = sizeof(struct DE_eckd_data) + 2*sizeof(struct LO_eckd_data);
 	cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
 				   cplength, datasize, device);
 	if (IS_ERR(cqr))
@@ -557,7 +543,7 @@
 	/* Define extent for the first 3 tracks. */
 	define_extent(ccw++, cqr->data, 0, 2,
 		      DASD_ECKD_CCW_READ_COUNT, device);
-	LO_data = cqr->data + sizeof (DE_eckd_data_t);
+	LO_data = cqr->data + sizeof (struct DE_eckd_data);
 	/* Locate record for the first 4 records on track 0. */
 	ccw[-1].flags |= CCW_FLAG_CC;
 	locate_record(ccw++, LO_data++, 0, 0, 4,
@@ -600,25 +586,25 @@
  * for deletion in the meantime).
  */
 static void
-dasd_eckd_analysis_callback(dasd_ccw_req_t *init_cqr, void *data)
+dasd_eckd_analysis_callback(struct dasd_ccw_req *init_cqr, void *data)
 {
-	dasd_eckd_private_t *private;
-	dasd_device_t *device;
+	struct dasd_eckd_private *private;
+	struct dasd_device *device;
 
 	device = init_cqr->device;
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	private->init_cqr_status = init_cqr->status;
 	dasd_sfree_request(init_cqr, device);
 	dasd_kick_device(device);
 }
 
 static int
-dasd_eckd_start_analysis(struct dasd_device_t *device)
+dasd_eckd_start_analysis(struct dasd_device *device)
 {
-	dasd_eckd_private_t *private;
-	dasd_ccw_req_t *init_cqr;
+	struct dasd_eckd_private *private;
+	struct dasd_ccw_req *init_cqr;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	init_cqr = dasd_eckd_analysis_ccw(device);
 	if (IS_ERR(init_cqr))
 		return PTR_ERR(init_cqr);
@@ -630,14 +616,14 @@
 }
 
 static int
-dasd_eckd_end_analysis(struct dasd_device_t *device)
+dasd_eckd_end_analysis(struct dasd_device *device)
 {
-	dasd_eckd_private_t *private;
-	eckd_count_t *count_area;
+	struct dasd_eckd_private *private;
+	struct eckd_count *count_area;
 	unsigned int sb, blk_per_trk;
 	int status, i;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	status = private->init_cqr_status;
 	private->init_cqr_status = -1;
 	if (status != DASD_CQR_DONE) {
@@ -708,11 +694,11 @@
 }
 
 static int
-dasd_eckd_do_analysis(struct dasd_device_t *device)
+dasd_eckd_do_analysis(struct dasd_device *device)
 {
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	if (private->init_cqr_status < 0)
 		return dasd_eckd_start_analysis(device);
 	else
@@ -720,34 +706,34 @@
 }
 
 static int
-dasd_eckd_fill_geometry(struct dasd_device_t *device, struct hd_geometry *geo)
+dasd_eckd_fill_geometry(struct dasd_device *device, struct hd_geometry *geo)
 {
-	int rc = 0;
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	if (dasd_check_blocksize(device->bp_block) == 0) {
 		geo->sectors = recs_per_track(&private->rdc_data,
 					      0, device->bp_block);
 	}
 	geo->cylinders = private->rdc_data.no_cyl;
 	geo->heads = private->rdc_data.trk_per_cyl;
-	return rc;
+	return 0;
 }
 
-static dasd_ccw_req_t *
-dasd_eckd_format_device(dasd_device_t * device, format_data_t * fdata)
-{
-	dasd_eckd_private_t *private;
-	dasd_ccw_req_t *fcp;
-	eckd_count_t *ect;
+static struct dasd_ccw_req *
+dasd_eckd_format_device(struct dasd_device * device,
+			struct format_data_t * fdata)
+{
+	struct dasd_eckd_private *private;
+	struct dasd_ccw_req *fcp;
+	struct eckd_count *ect;
 	struct ccw1 *ccw;
 	void *data;
 	int rpt, cyl, head;
 	int cplength, datasize;
 	int i;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	rpt = recs_per_track(&private->rdc_data, 0, fdata->blksize);
 	cyl = fdata->start_unit / private->rdc_data.trk_per_cyl;
 	head = fdata->start_unit % private->rdc_data.trk_per_cyl;
@@ -782,20 +768,24 @@
 	case 0x00:	/* Normal format */
 	case 0x08:	/* Normal format, use cdl. */
 		cplength = 2 + rpt;
-		datasize = sizeof(DE_eckd_data_t) + sizeof(LO_eckd_data_t) +
-			rpt * sizeof(eckd_count_t);
+		datasize = sizeof(struct DE_eckd_data) +
+			sizeof(struct LO_eckd_data) +
+			rpt * sizeof(struct eckd_count);
 		break;
 	case 0x01:	/* Write record zero and format track. */
 	case 0x09:	/* Write record zero and format track, use cdl. */
 		cplength = 3 + rpt;
-		datasize = sizeof(DE_eckd_data_t) + sizeof(LO_eckd_data_t) +
-			sizeof(eckd_count_t) + rpt * sizeof(eckd_count_t);
+		datasize = sizeof(struct DE_eckd_data) +
+			sizeof(struct LO_eckd_data) +
+			sizeof(struct eckd_count) +
+			rpt * sizeof(struct eckd_count);
 		break;
 	case 0x04:	/* Invalidate track. */
 	case 0x0c:	/* Invalidate track, use cdl. */
 		cplength = 3;
-		datasize = sizeof(DE_eckd_data_t) + sizeof(LO_eckd_data_t) +
-			sizeof(eckd_count_t);
+		datasize = sizeof(struct DE_eckd_data) +
+			sizeof(struct LO_eckd_data) +
+			sizeof(struct eckd_count);
 		break;
 	default:
 		MESSAGE(KERN_WARNING, "Invalid flags 0x%x.", fdata->intensity);
@@ -812,45 +802,45 @@
 
 	switch (fdata->intensity & ~0x08) {
 	case 0x00: /* Normal format. */
-		define_extent(ccw++, (DE_eckd_data_t *) data,
+		define_extent(ccw++, (struct DE_eckd_data *) data,
 			      fdata->start_unit, fdata->start_unit,
 			      DASD_ECKD_CCW_WRITE_CKD, device);
-		data += sizeof(DE_eckd_data_t);
+		data += sizeof(struct DE_eckd_data);
 		ccw[-1].flags |= CCW_FLAG_CC;
-		locate_record(ccw++, (LO_eckd_data_t *) data,
+		locate_record(ccw++, (struct LO_eckd_data *) data,
 			      fdata->start_unit, 0, rpt,
 			      DASD_ECKD_CCW_WRITE_CKD, device,
 			      fdata->blksize);
-		data += sizeof(LO_eckd_data_t);
+		data += sizeof(struct LO_eckd_data);
 		break;
 	case 0x01: /* Write record zero + format track. */
-		define_extent(ccw++, (DE_eckd_data_t *) data,
+		define_extent(ccw++, (struct DE_eckd_data *) data,
 			      fdata->start_unit, fdata->start_unit,
 			      DASD_ECKD_CCW_WRITE_RECORD_ZERO,
 			      device);
-		data += sizeof(DE_eckd_data_t);
+		data += sizeof(struct DE_eckd_data);
 		ccw[-1].flags |= CCW_FLAG_CC;
-		locate_record(ccw++, (LO_eckd_data_t *) data,
+		locate_record(ccw++, (struct LO_eckd_data *) data,
 			      fdata->start_unit, 0, rpt + 1,
 			      DASD_ECKD_CCW_WRITE_RECORD_ZERO, device,
 			      device->bp_block);
-		data += sizeof(LO_eckd_data_t);
+		data += sizeof(struct LO_eckd_data);
 		break;
 	case 0x04: /* Invalidate track. */
-		define_extent(ccw++, (DE_eckd_data_t *) data,
+		define_extent(ccw++, (struct DE_eckd_data *) data,
 			      fdata->start_unit, fdata->start_unit,
 			      DASD_ECKD_CCW_WRITE_CKD, device);
-		data += sizeof(DE_eckd_data_t);
+		data += sizeof(struct DE_eckd_data);
 		ccw[-1].flags |= CCW_FLAG_CC;
-		locate_record(ccw++, (LO_eckd_data_t *) data,
+		locate_record(ccw++, (struct LO_eckd_data *) data,
 			      fdata->start_unit, 0, 1,
 			      DASD_ECKD_CCW_WRITE_CKD, device, 8);
-		data += sizeof(LO_eckd_data_t);
+		data += sizeof(struct LO_eckd_data);
 		break;
 	}
 	if (fdata->intensity & 0x01) {	/* write record zero */
-		ect = (eckd_count_t *) data;
-		data += sizeof(eckd_count_t);
+		ect = (struct eckd_count *) data;
+		data += sizeof(struct eckd_count);
 		ect->cyl = cyl;
 		ect->head = head;
 		ect->record = 0;
@@ -863,8 +853,8 @@
 		ccw->cda = (__u32)(addr_t) ect;
 	}
 	if (fdata->intensity & 0x04) {	/* erase track */
-		ect = (eckd_count_t *) data;
-		data += sizeof(eckd_count_t);
+		ect = (struct eckd_count *) data;
+		data += sizeof(struct eckd_count);
 		ect->cyl = cyl;
 		ect->head = head;
 		ect->record = 1;
@@ -877,8 +867,8 @@
 		ccw->cda = (__u32)(addr_t) ect;
 	} else {		/* write remaining records */
 		for (i = 0; i < rpt; i++) {
-			ect = (eckd_count_t *) data;
-			data += sizeof(eckd_count_t);
+			ect = (struct eckd_count *) data;
+			data += sizeof(struct eckd_count);
 			ect->cyl = cyl;
 			ect->head = head;
 			ect->record = i + 1;
@@ -912,9 +902,9 @@
 }
 
 static dasd_era_t
-dasd_eckd_examine_error(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_eckd_examine_error(struct dasd_ccw_req * cqr, struct irb * irb)
 {
-	dasd_device_t *device = (dasd_device_t *) cqr->device;
+	struct dasd_device *device = (struct dasd_device *) cqr->device;
 	struct ccw_device *cdev = device->cdev;
 
 	if (irb->scsw.cstat == 0x00 &&
@@ -936,9 +926,9 @@
 }
 
 static dasd_erp_fn_t
-dasd_eckd_erp_action(dasd_ccw_req_t * cqr)
+dasd_eckd_erp_action(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device = (dasd_device_t *) cqr->device;
+	struct dasd_device *device = (struct dasd_device *) cqr->device;
 	struct ccw_device *cdev = device->cdev;
 
 	switch (cdev->id.cu_type) {
@@ -954,18 +944,18 @@
 }
 
 static dasd_erp_fn_t
-dasd_eckd_erp_postaction(dasd_ccw_req_t * cqr)
+dasd_eckd_erp_postaction(struct dasd_ccw_req * cqr)
 {
 	return dasd_default_erp_postaction;
 }
 
-static dasd_ccw_req_t *
-dasd_eckd_build_cp(dasd_device_t * device, struct request *req)
+static struct dasd_ccw_req *
+dasd_eckd_build_cp(struct dasd_device * device, struct request *req)
 {
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 	unsigned long *idaws;
-	LO_eckd_data_t *LO_data;
-	dasd_ccw_req_t *cqr;
+	struct LO_eckd_data *LO_data;
+	struct dasd_ccw_req *cqr;
 	struct ccw1 *ccw;
 	struct bio *bio;
 	struct bio_vec *bv;
@@ -978,7 +968,7 @@
 	unsigned char cmd, rcmd;
 	int i;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	if (rq_data_dir(req) == READ)
 		cmd = DASD_ECKD_CCW_READ_MT;
 	else if (rq_data_dir(req) == WRITE)
@@ -991,7 +981,8 @@
 	/* Calculate record id of first and last block. */
 	first_rec = first_trk = req->sector >> device->s2b_shift;
 	first_offs = sector_div(first_trk, blk_per_trk);
-	last_rec = last_trk = (req->sector + req->nr_sectors - 1) >> device->s2b_shift;
+	last_rec = last_trk =
+		(req->sector + req->nr_sectors - 1) >> device->s2b_shift;
 	last_offs = sector_div(last_trk, blk_per_trk);
 	/* Check struct bio and count the number of blocks for the request. */
 	count = 0;
@@ -1003,7 +994,7 @@
 				return ERR_PTR(-EINVAL);
 			count += bv->bv_len >> (device->s2b_shift + 9);
 #if defined(CONFIG_ARCH_S390X)
-			cidaw += idal_nr_words(kmap(bv->bv_page) +
+			cidaw += idal_nr_words(page_address(bv->bv_page) +
 					       bv->bv_offset, bv->bv_len);
 #endif
 		}
@@ -1014,14 +1005,14 @@
 	/* 1x define extent + 1x locate record + number of blocks */
 	cplength = 2 + count;
 	/* 1x define extent + 1x locate record + cidaws*sizeof(long) */
-	datasize = sizeof(DE_eckd_data_t) + sizeof(LO_eckd_data_t) +
+	datasize = sizeof(struct DE_eckd_data) + sizeof(struct LO_eckd_data) +
 		cidaw * sizeof(unsigned long);
 	/* Find out the number of additional locate record ccws for cdl. */
 	if (private->uses_cdl && first_rec < 2*blk_per_trk) {
 		if (last_rec >= 2*blk_per_trk)
 			count = 2*blk_per_trk - first_rec;
 		cplength += count;
-		datasize += count*sizeof(LO_eckd_data_t);
+		datasize += count*sizeof(struct LO_eckd_data);
 	}
 	/* Allocate the ccw request. */
 	cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
@@ -1032,8 +1023,8 @@
 	/* First ccw is define extent. */
 	define_extent(ccw++, cqr->data, first_trk, last_trk, cmd, device);
 	/* Build locate_record+read/write/ccws. */
-	idaws = (unsigned long *) (cqr->data + sizeof(DE_eckd_data_t));
-	LO_data = (LO_eckd_data_t *) (idaws + cidaw);
+	idaws = (unsigned long *) (cqr->data + sizeof(struct DE_eckd_data));
+	LO_data = (struct LO_eckd_data *) (idaws + cidaw);
 	recid = first_rec;
 	if (private->uses_cdl == 0 || recid > 2*blk_per_trk) {
 		/* Only standard blocks so there is just one locate record. */
@@ -1042,7 +1033,7 @@
 			      last_rec - recid + 1, cmd, device, blksize);
 	}
 	rq_for_each_bio(bio, req) bio_for_each_segment(bv, bio, i) {
-		dst = kmap(bv->bv_page) + bv->bv_offset;
+		dst = page_address(bv->bv_page) + bv->bv_offset;
 		for (off = 0; off < bv->bv_len; off += blksize) {
 			sector_t trkid = recid;
 			unsigned int recoffs = sector_div(trkid, blk_per_trk);
@@ -1097,20 +1088,21 @@
 }
 
 static int
-dasd_eckd_fill_info(dasd_device_t * device, dasd_information2_t * info)
+dasd_eckd_fill_info(struct dasd_device * device,
+		    struct dasd_information2_t * info)
 {
-	dasd_eckd_private_t *private;
+	struct dasd_eckd_private *private;
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 	info->label_block = 2;
 	info->FBA_layout = private->uses_cdl ? 0 : 1;
 	info->format = private->uses_cdl ? DASD_FORMAT_CDL : DASD_FORMAT_LDL;
-	info->characteristics_size = sizeof(dasd_eckd_characteristics_t);
+	info->characteristics_size = sizeof(struct dasd_eckd_characteristics);
 	memcpy(info->characteristics, &private->rdc_data,
-	       sizeof(dasd_eckd_characteristics_t));
-	info->confdata_size = sizeof (dasd_eckd_confdata_t);
+	       sizeof(struct dasd_eckd_characteristics));
+	info->confdata_size = sizeof (struct dasd_eckd_confdata);
 	memcpy(info->configuration_data, &private->conf_data,
-	       sizeof (dasd_eckd_confdata_t));
+	       sizeof (struct dasd_eckd_confdata));
 	return 0;
 }
 
@@ -1126,8 +1118,8 @@
 static int
 dasd_eckd_release(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_ccw_req_t *cqr;
+	struct dasd_device *device;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -1166,8 +1158,8 @@
 static int
 dasd_eckd_reserve(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_ccw_req_t *cqr;
+	struct dasd_device *device;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -1210,8 +1202,8 @@
 static int
 dasd_eckd_steal_lock(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_ccw_req_t *cqr;
+	struct dasd_device *device;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -1251,10 +1243,10 @@
 static int
 dasd_eckd_performance(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_psf_prssd_data_t *prssdp;
-	dasd_rssd_perf_stats_t *stats;
-	dasd_ccw_req_t *cqr;
+	struct dasd_device *device;
+	struct dasd_psf_prssd_data *prssdp;
+	struct dasd_rssd_perf_stats_t *stats;
+	struct dasd_ccw_req *cqr;
 	struct ccw1 *ccw;
 	int rc;
 
@@ -1264,8 +1256,9 @@
 
 	cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
 				   1 /* PSF */  + 1 /* RSSD */ ,
-				   (sizeof (dasd_psf_prssd_data_t) +
-				    sizeof (dasd_rssd_perf_stats_t)), device);
+				   (sizeof (struct dasd_psf_prssd_data) +
+				    sizeof (struct dasd_rssd_perf_stats_t)),
+				   device);
 	if (cqr == NULL) {
 		MESSAGE(KERN_WARNING, "%s",
 			"No memory to allocate initialization request");
@@ -1276,24 +1269,24 @@
 	cqr->expires = 10 * HZ;
 
 	/* Prepare for Read Subsystem Data */
-	prssdp = (dasd_psf_prssd_data_t *) cqr->data;
-	memset(prssdp, 0, sizeof (dasd_psf_prssd_data_t));
+	prssdp = (struct dasd_psf_prssd_data *) cqr->data;
+	memset(prssdp, 0, sizeof (struct dasd_psf_prssd_data));
 	prssdp->order = PSF_ORDER_PRSSD;
 	prssdp->suborder = 0x01;	/* Perfomance Statistics */
 	prssdp->varies[1] = 0x01;	/* Perf Statistics for the Subsystem */
 
 	ccw = cqr->cpaddr;
 	ccw->cmd_code = DASD_ECKD_CCW_PSF;
-	ccw->count = sizeof (dasd_psf_prssd_data_t);
+	ccw->count = sizeof (struct dasd_psf_prssd_data);
 	ccw->flags |= CCW_FLAG_CC;
 	ccw->cda = (__u32)(addr_t) prssdp;
 
 	/* Read Subsystem Data - Performance Statistics */
-	stats = (dasd_rssd_perf_stats_t *) (prssdp + 1);
-	memset(stats, 0, sizeof (dasd_rssd_perf_stats_t));
+	stats = (struct dasd_rssd_perf_stats_t *) (prssdp + 1);
+	memset(stats, 0, sizeof (struct dasd_rssd_perf_stats_t));
 
 	ccw->cmd_code = DASD_ECKD_CCW_RSSD;
-	ccw->count = sizeof (dasd_rssd_perf_stats_t);
+	ccw->count = sizeof (struct dasd_rssd_perf_stats_t);
 	ccw->cda = (__u32)(addr_t) stats;
 
 	cqr->buildclk = get_clock();
@@ -1301,10 +1294,10 @@
 	rc = dasd_sleep_on(cqr);
 	if (rc == 0) {
 		/* Prepare for Read Subsystem Data */
-		prssdp = (dasd_psf_prssd_data_t *) cqr->data;
-		stats = (dasd_rssd_perf_stats_t *) (prssdp + 1);
+		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,
-				  sizeof(dasd_rssd_perf_stats_t));
+				  sizeof(struct dasd_rssd_perf_stats_t));
 	}
 	dasd_sfree_request(cqr, cqr->device);
 	return rc;
@@ -1317,9 +1310,9 @@
 static int
 dasd_eckd_set_attrib(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_eckd_private_t *private;
-	attrib_data_t attrib;
+	struct dasd_device *device;
+	struct dasd_eckd_private *private;
+	struct attrib_data_t attrib;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -1330,11 +1323,12 @@
 	if (device == NULL)
 		return -ENODEV;
 
-	if (copy_from_user(&attrib, (void *) args, sizeof (attrib_data_t))) {
+	if (copy_from_user(&attrib, (void *) args,
+			   sizeof (struct attrib_data_t))) {
 		return -EFAULT;
 	}
 
-	private = (dasd_eckd_private_t *) device->private;
+	private = (struct dasd_eckd_private *) device->private;
 
 	DBF_DEV_EVENT(DBF_ERR, device,
 		      "cache operation mode got "
@@ -1351,7 +1345,7 @@
 }
 
 static void
-dasd_eckd_dump_sense(struct dasd_device_t *device, dasd_ccw_req_t * req,
+dasd_eckd_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 		     struct irb *irb)
 {
 
@@ -1422,7 +1416,7 @@
  * max_blocks is dependent on the amount of storage that is available
  * in the static io buffer for each device. Currently each device has
  * 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has
- * 24 bytes, the dasd_ccw_req_t has 136 bytes and each block can use
+ * 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use
  * up to 16 bytes (8 for the ccw and 8 for the idal pointer). In
  * addition we have one define extent ccw + 16 bytes of data and one
  * locate record ccw + 16 bytes of data. That makes:
@@ -1431,7 +1425,7 @@
  * start the next request if one finishes off. That makes 249.5 blocks
  * for one request. Give a little safety and the result is 240.
  */
-static dasd_discipline_t dasd_eckd_discipline = {
+static struct dasd_discipline dasd_eckd_discipline = {
 	.owner = THIS_MODULE,
 	.name = "ECKD",
 	.ebcname = "ECKD",
@@ -1453,6 +1447,8 @@
 static int __init
 dasd_eckd_init(void)
 {
+	int ret;
+
 	dasd_ioctl_no_register(THIS_MODULE, BIODASDSATTR,
 			       dasd_eckd_set_attrib);
 	dasd_ioctl_no_register(THIS_MODULE, BIODASDPSRD,
@@ -1466,7 +1462,22 @@
 
 	ASCEBC(dasd_eckd_discipline.ebcname, 4);
 
-	ccw_driver_register(&dasd_eckd_driver);
+	ret = ccw_driver_register(&dasd_eckd_driver);
+	if (ret) {
+		dasd_ioctl_no_unregister(THIS_MODULE, BIODASDSATTR,
+					 dasd_eckd_set_attrib);
+		dasd_ioctl_no_unregister(THIS_MODULE, BIODASDPSRD,
+					 dasd_eckd_performance);
+		dasd_ioctl_no_unregister(THIS_MODULE, BIODASDRLSE,
+					 dasd_eckd_release);
+		dasd_ioctl_no_unregister(THIS_MODULE, BIODASDRSRV,
+					 dasd_eckd_reserve);
+		dasd_ioctl_no_unregister(THIS_MODULE, BIODASDSLCK,
+					 dasd_eckd_steal_lock);
+		return ret;
+	}
+
+	dasd_generic_auto_online(&dasd_eckd_driver);
 	return 0;
 }
 
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_eckd.h linux-2.5.67-bk6/drivers/s390/block/dasd_eckd.h
--- linux-2.5.67-bk5/drivers/s390/block/dasd_eckd.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_eckd.h	2003-04-15 04:36:16.000000000 -0700
@@ -5,10 +5,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.6 $
- *
- * History of changes 
- * 
+ * $Revision: 1.8 $
  */
 
 #ifndef DASD_ECKD_H
@@ -52,49 +49,49 @@
  * SECTION: Type Definitions
  ******************************************************************************/
 
-typedef struct eckd_count_t {
+struct eckd_count {
 	__u16 cyl;
 	__u16 head;
 	__u8 record;
 	__u8 kl;
 	__u16 dl;
-} __attribute__ ((packed)) eckd_count_t;
+} __attribute__ ((packed));
 
-typedef struct ch_t {
+struct ch_t {
 	__u16 cyl;
 	__u16 head;
-} __attribute__ ((packed)) ch_t;
+} __attribute__ ((packed));
 
-typedef struct chs_t {
+struct chs_t {
 	__u16 cyl;
 	__u16 head;
 	__u32 sector;
-} __attribute__ ((packed)) chs_t;
+} __attribute__ ((packed));
 
-typedef struct chr_t {
+struct chr_t {
 	__u16 cyl;
 	__u16 head;
 	__u8 record;
-} __attribute__ ((packed)) chr_t;
+} __attribute__ ((packed));
 
-typedef struct geom_t {
+struct geom_t {
 	__u16 cyl;
 	__u16 head;
 	__u32 sector;
-} __attribute__ ((packed)) geom_t;
+} __attribute__ ((packed));
 
-typedef struct eckd_home_t {
+struct eckd_home {
 	__u8 skip_control[14];
 	__u16 cell_number;
 	__u8 physical_addr[3];
 	__u8 flag;
-	ch_t track_addr;
+	struct ch_t track_addr;
 	__u8 reserved;
 	__u8 key_length;
 	__u8 reserved2[2];
-} __attribute__ ((packed)) eckd_home_t;
+} __attribute__ ((packed));
 
-typedef struct DE_eckd_data_t {
+struct DE_eckd_data {
 	struct {
 		unsigned char perm:2;	/* Permissions on this extent */
 		unsigned char reserved:1;
@@ -113,15 +110,15 @@
 	__u16 fast_write_id;
 	__u8 ga_additional;	/* Global Attributes Additional */
 	__u8 ga_extended;	/* Global Attributes Extended	*/
-	ch_t beg_ext;
-	ch_t end_ext;
+	struct ch_t beg_ext;
+	struct ch_t end_ext;
 	unsigned long long ep_sys_time; /* Extended Parameter - System Time Stamp */
 	__u8 ep_format;        /* Extended Parameter format byte       */
 	__u8 ep_prio;          /* Extended Parameter priority I/O byte */
 	__u8 ep_reserved[6];   /* Extended Parameter Reserved          */
-} __attribute__ ((packed)) DE_eckd_data_t;
+} __attribute__ ((packed));
 
-typedef struct LO_eckd_data_t {
+struct LO_eckd_data {
 	struct {
 		unsigned char orientation:2;
 		unsigned char operation:6;
@@ -133,13 +130,13 @@
 	} __attribute__ ((packed)) auxiliary;
 	__u8 unused;
 	__u8 count;
-	ch_t seek_addr;
-	chr_t search_arg;
+	struct ch_t seek_addr;
+	struct chr_t search_arg;
 	__u8 sector;
 	__u16 length;
-} __attribute__ ((packed)) LO_eckd_data_t;
+} __attribute__ ((packed));
 
-typedef struct dasd_eckd_characteristics_t {
+struct dasd_eckd_characteristics {
 	__u16 cu_type;
 	struct {
 		unsigned char support:2;
@@ -210,9 +207,9 @@
 	__u8 factor8;
 	__u8 reserved2[3];
 	__u8 reserved3[10];
-} __attribute__ ((packed)) dasd_eckd_characteristics_t;
+} __attribute__ ((packed));
 
-typedef struct dasd_eckd_confdata_t {
+struct dasd_eckd_confdata {
 	struct {
 		struct {
 			unsigned char identifier:2;
@@ -327,17 +324,17 @@
 		__u8 log_dev_address;
 		unsigned char reserved2[12];
 	} __attribute__ ((packed)) neq;
-} __attribute__ ((packed)) dasd_eckd_confdata_t;
+} __attribute__ ((packed));
 
 /*
  * Perform Subsystem Function - Prepare for Read Subsystem Data	 
  */
-typedef struct dasd_psf_prssd_data_t {
+struct dasd_psf_prssd_data {
 	unsigned char order;
 	unsigned char flags;
 	unsigned char reserved[4];
 	unsigned char suborder;
 	unsigned char varies[9];
-} __attribute__ ((packed)) dasd_psf_prssd_data_t;
+} __attribute__ ((packed));
 
 #endif				/* DASD_ECKD_H */
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_erp.c linux-2.5.67-bk6/drivers/s390/block/dasd_erp.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_erp.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_erp.c	2003-04-15 04:36:16.000000000 -0700
@@ -7,14 +7,10 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
- * $Revision: 1.6 $
- *
- * History of changes
- * 05/04/02 split from dasd.c, code restructuring.
+ * $Revision: 1.9 $
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
 
@@ -27,12 +23,12 @@
 
 #include "dasd_int.h"
 
-dasd_ccw_req_t *
+struct dasd_ccw_req *
 dasd_alloc_erp_request(char *magic, int cplength, int datasize,
-		       dasd_device_t * device)
+		       struct dasd_device * device)
 {
 	unsigned long flags;
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	char *data;
 	int size;
 
@@ -45,18 +41,19 @@
 	debug_int_event ( dasd_debug_area, 1, cplength);
 	debug_int_event ( dasd_debug_area, 1, datasize);
 
-	size = (sizeof(dasd_ccw_req_t) + 7L) & -8L;
+	size = (sizeof(struct dasd_ccw_req) + 7L) & -8L;
 	if (cplength > 0)
 		size += cplength * sizeof(struct ccw1);
 	if (datasize > 0)
 		size += datasize;
 	spin_lock_irqsave(&device->mem_lock, flags);
-	cqr = (dasd_ccw_req_t *) dasd_alloc_chunk(&device->erp_chunks, size);
+	cqr = (struct dasd_ccw_req *)
+		dasd_alloc_chunk(&device->erp_chunks, size);
 	spin_unlock_irqrestore(&device->mem_lock, flags);
 	if (cqr == NULL)
 		return ERR_PTR(-ENOMEM);
-	memset(cqr, 0, sizeof(dasd_ccw_req_t));
-	data = (char *) cqr + ((sizeof(dasd_ccw_req_t) + 7L) & -8L);
+	memset(cqr, 0, sizeof(struct dasd_ccw_req));
+	data = (char *) cqr + ((sizeof(struct dasd_ccw_req) + 7L) & -8L);
 	cqr->cpaddr = NULL;
 	if (cplength > 0) {
 		cqr->cpaddr = (struct ccw1 *) data;
@@ -75,7 +72,7 @@
 }
 
 void
-dasd_free_erp_request(dasd_ccw_req_t * cqr, dasd_device_t * device)
+dasd_free_erp_request(struct dasd_ccw_req * cqr, struct dasd_device * device)
 {
 	unsigned long flags;
 
@@ -91,8 +88,8 @@
 
 /*
  * DESCRIPTION
- *   sets up the default-ERP dasd_ccw_req_t, namely one, which performs a TIC
- *   to the original channel program with a retry counter of 16
+ *   sets up the default-ERP struct dasd_ccw_req, namely one, which performs
+ *   a TIC to the original channel program with a retry counter of 16
  *
  * PARAMETER
  *   cqr		failed CQR
@@ -100,11 +97,11 @@
  * RETURN VALUES
  *   erp		CQR performing the ERP
  */
-dasd_ccw_req_t *
-dasd_default_erp_action(dasd_ccw_req_t * cqr)
+struct dasd_ccw_req *
+dasd_default_erp_action(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device;
-	dasd_ccw_req_t *erp;
+	struct dasd_device *device;
+	struct dasd_ccw_req *erp;
 
 	MESSAGE(KERN_DEBUG, "%s", "Default ERP called... ");
 	device = cqr->device;
@@ -147,10 +144,10 @@
  * RETURN VALUES
  *   cqr		pointer to the original CQR
  */
-dasd_ccw_req_t *
-dasd_default_erp_postaction(dasd_ccw_req_t * cqr)
+struct dasd_ccw_req *
+dasd_default_erp_postaction(struct dasd_ccw_req * cqr)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int success;
 
 	if (cqr->refers == NULL || cqr->function == NULL)
@@ -161,7 +158,7 @@
 
 	/* free all ERPs - but NOT the original cqr */
 	while (cqr->refers != NULL) {
-		dasd_ccw_req_t *refers;
+		struct dasd_ccw_req *refers;
 
 		refers = cqr->refers;
 		/* remove the request from the device queue */
@@ -189,7 +186,7 @@
  * real request.
  */
 static inline void
-hex_dump_memory(dasd_device_t *device, void *data, int len)
+hex_dump_memory(struct dasd_device *device, void *data, int len)
 {
 	int *pint;
 
@@ -203,9 +200,9 @@
 }
 
 void
-dasd_log_sense(dasd_ccw_req_t *cqr, struct irb *irb)
+dasd_log_sense(struct dasd_ccw_req *cqr, struct irb *irb)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = cqr->device;
 	/* dump sense data */
@@ -214,10 +211,10 @@
 }
 
 void
-dasd_log_ccw(dasd_ccw_req_t * cqr, int caller, __u32 cpa)
+dasd_log_ccw(struct dasd_ccw_req * cqr, int caller, __u32 cpa)
 {
-	dasd_device_t *device;
-	dasd_ccw_req_t *lcqr;
+	struct dasd_device *device;
+	struct dasd_ccw_req *lcqr;
 	struct ccw1 *ccw;
 	int cplength;
 
@@ -227,7 +224,7 @@
 		DEV_MESSAGE(KERN_ERR, device,
 			    "(%s) ERP chain report for req: %p",
 			    caller == 0 ? "EXAMINE" : "ACTION", lcqr);
-		hex_dump_memory(device, lcqr, sizeof(dasd_ccw_req_t));
+		hex_dump_memory(device, lcqr, sizeof(struct dasd_ccw_req));
 
 		cplength = 1;
 		ccw = lcqr->cpaddr;
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_fba.c linux-2.5.67-bk6/drivers/s390/block/dasd_fba.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_fba.c	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_fba.c	2003-04-15 04:36:16.000000000 -0700
@@ -4,12 +4,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.25 $
- *
- * History of changes
- *	    fixed partition handling and HDIO_GETGEO
- * 2002/01/04 Created 2.4-2.5 compatibility mode
- * 05/04/02 code restructuring.
+ * $Revision: 1.29 $
  */
 
 #include <linux/config.h>
@@ -44,11 +39,11 @@
 
 MODULE_LICENSE("GPL");
 
-static dasd_discipline_t dasd_fba_discipline;
+static struct dasd_discipline dasd_fba_discipline;
 
-typedef struct dasd_fba_private_t {
-	dasd_fba_characteristics_t rdc_data;
-} dasd_fba_private_t;
+struct dasd_fba_private {
+	struct dasd_fba_characteristics rdc_data;
+};
 
 static struct ccw_device_id dasd_fba_ids[] = {
 	{ CCW_DEVICE_DEVTYPE (0x6310, 0, 0x9336, 0), driver_info: 0x1},
@@ -82,14 +77,14 @@
 };
 
 static inline void
-define_extent(struct ccw1 * ccw, DE_fba_data_t *data, int rw,
+define_extent(struct ccw1 * ccw, struct DE_fba_data *data, int rw,
 	      int blksize, int beg, int nr)
 {
 	ccw->cmd_code = DASD_FBA_CCW_DEFINE_EXTENT;
 	ccw->flags = 0;
 	ccw->count = 16;
 	ccw->cda = (__u32) __pa(data);
-	memset(data, 0, sizeof (DE_fba_data_t));
+	memset(data, 0, sizeof (struct DE_fba_data));
 	if (rw == WRITE)
 		(data->mask).perm = 0x0;
 	else if (rw == READ)
@@ -102,14 +97,14 @@
 }
 
 static inline void
-locate_record(struct ccw1 * ccw, LO_fba_data_t *data, int rw,
+locate_record(struct ccw1 * ccw, struct LO_fba_data *data, int rw,
 	      int block_nr, int block_ct)
 {
 	ccw->cmd_code = DASD_FBA_CCW_LOCATE;
 	ccw->flags = 0;
 	ccw->count = 8;
 	ccw->cda = (__u32) __pa(data);
-	memset(data, 0, sizeof (LO_fba_data_t));
+	memset(data, 0, sizeof (struct LO_fba_data));
 	if (rw == WRITE)
 		data->operation.cmd = 0x5;
 	else if (rw == READ)
@@ -121,16 +116,16 @@
 }
 
 static int
-dasd_fba_check_characteristics(struct dasd_device_t *device)
+dasd_fba_check_characteristics(struct dasd_device *device)
 {
-	dasd_fba_private_t *private;
+	struct dasd_fba_private *private;
 	struct ccw_device *cdev = device->cdev;	
 	void *rdc_data;
 	int rc;
 
-	private = (dasd_fba_private_t *) device->private;
+	private = (struct dasd_fba_private *) device->private;
 	if (private == NULL) {
-		private = kmalloc(sizeof(dasd_fba_private_t), GFP_KERNEL);
+		private = kmalloc(sizeof(struct dasd_fba_private), GFP_KERNEL);
 		if (private == NULL) {
 			MESSAGE(KERN_WARNING, "%s",
 				"memory allocation failed for private data");
@@ -160,12 +155,12 @@
 }
 
 static int
-dasd_fba_do_analysis(struct dasd_device_t *device)
+dasd_fba_do_analysis(struct dasd_device *device)
 {
-	dasd_fba_private_t *private;
+	struct dasd_fba_private *private;
 	int sb, rc;
 
-	private = (dasd_fba_private_t *) device->private;
+	private = (struct dasd_fba_private *) device->private;
 	rc = dasd_check_blocksize(private->rdc_data.blk_size);
 	if (rc) {
 		DEV_MESSAGE(KERN_INFO, device, "unknown blocksize %d",
@@ -181,7 +176,7 @@
 }
 
 static int
-dasd_fba_fill_geometry(struct dasd_device_t *device, struct hd_geometry *geo)
+dasd_fba_fill_geometry(struct dasd_device *device, struct hd_geometry *geo)
 {
 	if (dasd_check_blocksize(device->bp_block) != 0)
 		return -EINVAL;
@@ -192,12 +187,12 @@
 }
 
 static dasd_era_t
-dasd_fba_examine_error(dasd_ccw_req_t * cqr, struct irb * irb)
+dasd_fba_examine_error(struct dasd_ccw_req * cqr, struct irb * irb)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	struct ccw_device *cdev;
 
-	device = (dasd_device_t *) cqr->device;
+	device = (struct dasd_device *) cqr->device;
 	if (irb->scsw.cstat == 0x00 &&
 	    irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))
 		return dasd_era_none;
@@ -214,13 +209,13 @@
 }
 
 static dasd_erp_fn_t
-dasd_fba_erp_action(dasd_ccw_req_t * cqr)
+dasd_fba_erp_action(struct dasd_ccw_req * cqr)
 {
 	return dasd_default_erp_action;
 }
 
 static dasd_erp_fn_t
-dasd_fba_erp_postaction(dasd_ccw_req_t * cqr)
+dasd_fba_erp_postaction(struct dasd_ccw_req * cqr)
 {
 	if (cqr->function == dasd_default_erp_action)
 		return dasd_default_erp_postaction;
@@ -230,13 +225,13 @@
 	return NULL;
 }
 
-static dasd_ccw_req_t *
-dasd_fba_build_cp(dasd_device_t * device, struct request *req)
+static struct dasd_ccw_req *
+dasd_fba_build_cp(struct dasd_device * device, struct request *req)
 {
-	dasd_fba_private_t *private;
+	struct dasd_fba_private *private;
 	unsigned long *idaws;
-	LO_fba_data_t *LO_data;
-	dasd_ccw_req_t *cqr;
+	struct LO_fba_data *LO_data;
+	struct dasd_ccw_req *cqr;
 	struct ccw1 *ccw;
 	struct bio *bio;
 	struct bio_vec *bv;
@@ -247,7 +242,7 @@
 	unsigned char cmd;
 	int i;
 
-	private = (dasd_fba_private_t *) device->private;
+	private = (struct dasd_fba_private *) device->private;
 	if (rq_data_dir(req) == READ) {
 		cmd = DASD_FBA_CCW_READ;
 	} else if (rq_data_dir(req) == WRITE) {
@@ -279,7 +274,7 @@
 	/* 1x define extent + 1x locate record + number of blocks */
 	cplength = 2 + count;
 	/* 1x define extent + 1x locate record */
-	datasize = sizeof(DE_fba_data_t) + sizeof(LO_fba_data_t) +
+	datasize = sizeof(struct DE_fba_data) + sizeof(struct LO_fba_data) +
 		cidaw * sizeof(unsigned long);
 	/*
 	 * Find out number of additional locate record ccws if the device
@@ -287,7 +282,7 @@
 	 */
 	if (private->rdc_data.mode.bits.data_chain == 0) {
 		cplength += count - 1;
-		datasize += (count - 1)*sizeof(LO_fba_data_t);
+		datasize += (count - 1)*sizeof(struct LO_fba_data);
 	}
 	/* Allocate the ccw request. */
 	cqr = dasd_smalloc_request(dasd_fba_discipline.name,
@@ -299,8 +294,8 @@
 	define_extent(ccw++, cqr->data, rq_data_dir(req),
 		      device->bp_block, req->sector, req->nr_sectors);
 	/* Build locate_record + read/write ccws. */
-	idaws = (unsigned long *) (cqr->data + sizeof(DE_fba_data_t));
-	LO_data = (LO_fba_data_t *) (idaws + cidaw);
+	idaws = (unsigned long *) (cqr->data + sizeof(struct DE_fba_data));
+	LO_data = (struct LO_fba_data *) (idaws + cidaw);
 	/* Locate record for all blocks for smart devices. */
 	if (private->rdc_data.mode.bits.data_chain != 0) {
 		ccw[-1].flags |= CCW_FLAG_CC;
@@ -346,21 +341,22 @@
 }
 
 static int
-dasd_fba_fill_info(dasd_device_t * device, dasd_information2_t * info)
+dasd_fba_fill_info(struct dasd_device * device,
+		   struct dasd_information2_t * info)
 {
 	info->label_block = 1;
 	info->FBA_layout = 1;
 	info->format = DASD_FORMAT_LDL;
-	info->characteristics_size = sizeof(dasd_fba_characteristics_t);
+	info->characteristics_size = sizeof(struct dasd_fba_characteristics);
 	memcpy(info->characteristics,
-	       &((dasd_fba_private_t *) device->private)->rdc_data,
-	       sizeof (dasd_fba_characteristics_t));
+	       &((struct dasd_fba_private *) device->private)->rdc_data,
+	       sizeof (struct dasd_fba_characteristics));
 	info->confdata_size = 0;
 	return 0;
 }
 
 static void
-dasd_fba_dump_sense(struct dasd_device_t *device, dasd_ccw_req_t * req,
+dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req,
 		    struct irb *irb)
 {
 	char *page;
@@ -383,7 +379,7 @@
  * max_blocks is dependent on the amount of storage that is available
  * in the static io buffer for each device. Currently each device has
  * 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has
- * 24 bytes, the dasd_ccw_req_t has 136 bytes and each block can use
+ * 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use
  * up to 16 bytes (8 for the ccw and 8 for the idal pointer). In
  * addition we have one define extent ccw + 16 bytes of data and a 
  * locate record ccw for each block (stupid devices!) + 16 bytes of data.
@@ -393,7 +389,7 @@
  * start the next request if one finishes off. That makes 100.1 blocks
  * for one request. Give a little safety and the result is 96.
  */
-static dasd_discipline_t dasd_fba_discipline = {
+static struct dasd_discipline dasd_fba_discipline = {
 	.owner = THIS_MODULE,
 	.name = "FBA ",
 	.ebcname = "FBA ",
@@ -414,9 +410,16 @@
 static int __init
 dasd_fba_init(void)
 {
+	int ret;
+
 	ASCEBC(dasd_fba_discipline.ebcname, 4);
 
-	return ccw_driver_register(&dasd_fba_driver);
+	ret = ccw_driver_register(&dasd_fba_driver);
+	if (ret)
+		return ret;
+
+	dasd_generic_auto_online(&dasd_fba_driver);
+	return 0;
 }
 
 static void __exit
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_fba.h linux-2.5.67-bk6/drivers/s390/block/dasd_fba.h
--- linux-2.5.67-bk5/drivers/s390/block/dasd_fba.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_fba.h	2003-04-15 04:36:16.000000000 -0700
@@ -4,17 +4,13 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.4 $
- *
- * History of changes 
- * 
+ * $Revision: 1.6 $
  */
 
 #ifndef DASD_FBA_H
 #define DASD_FBA_H
 
-typedef
-    struct DE_fba_data_t {
+struct DE_fba_data {
 	struct {
 		unsigned char perm:2;	/* Permissions on this extent */
 		unsigned char zero:2;	/* Must be zero */
@@ -27,12 +23,9 @@
 	__u32 ext_loc;		/* Extent locator */
 	__u32 ext_beg;		/* logical number of block 0 in extent */
 	__u32 ext_end;		/* logocal number of last block in extent */
-} __attribute__ ((packed))
-
-    DE_fba_data_t;
+} __attribute__ ((packed));
 
-typedef
-    struct LO_fba_data_t {
+struct LO_fba_data {
 	struct {
 		unsigned char zero:4;
 		unsigned char cmd:4;
@@ -40,12 +33,9 @@
 	__u8 auxiliary;
 	__u16 blk_ct;
 	__u32 blk_nr;
-} __attribute__ ((packed))
+} __attribute__ ((packed));
 
-    LO_fba_data_t;
-
-typedef
-    struct dasd_fba_characteristics_t {
+struct dasd_fba_characteristics {
 	union {
 		__u8 c;
 		struct {
@@ -78,8 +68,6 @@
 	__u16 blk_ce;
 	__u32 reserved2;
 	__u16 reserved3;
-} __attribute__ ((packed))
-
-    dasd_fba_characteristics_t;
+} __attribute__ ((packed));
 
 #endif				/* DASD_FBA_H */
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_genhd.c linux-2.5.67-bk6/drivers/s390/block/dasd_genhd.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_genhd.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_genhd.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,10 +9,7 @@
  *
  * Dealing with devices registered to multiple major numbers.
  *
- * $Revision: 1.23 $
- *
- * History of changes
- * 05/04/02 split from dasd.c, code restructuring.
+ * $Revision: 1.29 $
  */
 
 #include <linux/config.h>
@@ -108,7 +105,6 @@
 struct gendisk *
 dasd_gendisk_alloc(int devindex)
 {
-	struct list_head *l;
 	struct major_info *mi;
 	struct gendisk *gdp;
 	int index, len, rc;
@@ -118,8 +114,7 @@
 	while (1) {
 		spin_lock(&dasd_major_lock);
 		index = devindex;
-		list_for_each(l, &dasd_major_info) {
-			mi = list_entry(l, struct major_info, list);
+		list_for_each_entry(mi, &dasd_major_info, list) {
 			if (index < DASD_PER_MAJOR)
 				break;
 			index -= DASD_PER_MAJOR;
@@ -142,6 +137,7 @@
 	gdp->major = mi->major;
 	gdp->first_minor = index << DASD_PARTN_BITS;
 	gdp->fops = &dasd_device_operations;
+	gdp->flags |= GENHD_FL_DEVFS;
 
 	/*
 	 * Set device name.
@@ -163,42 +159,16 @@
 }
 
 /*
- * Return devindex of first device using a specific major number.
- */
-static int dasd_gendisk_major_index(int major)
-{
-	struct list_head *l;
-	struct major_info *mi;
-	int devindex, rc;
-
-	spin_lock(&dasd_major_lock);
-	rc = -EINVAL;
-	devindex = 0;
-	list_for_each(l, &dasd_major_info) {
-		mi = list_entry(l, struct major_info, list);
-		if (mi->major == major) {
-			rc = devindex;
-			break;
-		}
-		devindex += DASD_PER_MAJOR;
-	}
-	spin_unlock(&dasd_major_lock);
-	return rc;
-}
-
-/*
  * Return major number for device with device index devindex.
  */
 int dasd_gendisk_index_major(int devindex)
 {
-	struct list_head *l;
 	struct major_info *mi;
 	int rc;
 
 	spin_lock(&dasd_major_lock);
 	rc = -ENODEV;
-	list_for_each(l, &dasd_major_info) {
-		mi = list_entry(l, struct major_info, list);
+	list_for_each_entry(mi, &dasd_major_info, list) {
 		if (devindex < DASD_PER_MAJOR) {
 			rc = mi->major;
 			break;
@@ -213,7 +183,7 @@
  * Register disk to genhd. This will trigger a partition detection.
  */
 void
-dasd_setup_partitions(dasd_device_t * device)
+dasd_setup_partitions(struct dasd_device * device)
 {
 	/* Make the disk known. */
 	set_capacity(device->gdp, device->blocks << device->s2b_shift);
@@ -228,9 +198,10 @@
  * partitions unusable by setting their size to zero.
  */
 void
-dasd_destroy_partitions(dasd_device_t * device)
+dasd_destroy_partitions(struct dasd_device * device)
 {
 	del_gendisk(device->gdp);
+	put_disk(device->gdp);
 }
 
 int
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_int.h linux-2.5.67-bk6/drivers/s390/block/dasd_int.h
--- linux-2.5.67-bk5/drivers/s390/block/dasd_int.h	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_int.h	2003-04-15 04:36:16.000000000 -0700
@@ -6,12 +6,7 @@
  * Bugreports.to..: <Linux390@de.ibm.com>
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
  *
- * $Revision: 1.36 $
- *
- * History of changes (starts July 2000)
- * 02/01/01 added dynamic registration of ioctls
- * 2002/01/04 Created 2.4-2.5 compatibility mode
- * 05/04/02 code restructuring.
+ * $Revision: 1.40 $
  */
 
 #ifndef DASD_INT_H
@@ -24,7 +19,7 @@
 
 /*
  * States a dasd device can have:
- *   new: the dasd_device_t structure is allocated.
+ *   new: the dasd_device structure is allocated.
  *   known: the discipline for the device is identified.
  *   basic: the device can do basic i/o.
  *   accept: the device is analysed (format is known).
@@ -70,16 +65,16 @@
 /*
  * SECTION: Type definitions
  */
-struct dasd_device_t;
+struct dasd_device;
 
 typedef int (*dasd_ioctl_fn_t) (struct block_device *bdev, int no, long args);
 
-typedef struct {
+struct dasd_ioctl {
 	struct list_head list;
 	struct module *owner;
 	int no;
 	dasd_ioctl_fn_t handler;
-} dasd_ioctl_list_t;
+};
 
 typedef enum {
 	dasd_era_fatal = -1,	/* no chance to recover		     */
@@ -154,12 +149,12 @@
 	DBF_EVENT(DBF_ALERT, d_string, d_args); \
 } while(0)
 
-typedef struct dasd_ccw_req_t {
+struct dasd_ccw_req {
 	unsigned int magic;		/* Eye catcher */
         struct list_head list;		/* list_head for request queueing. */
 
 	/* Where to execute what... */
-	struct dasd_device_t *device;	/* device the request is for */
+	struct dasd_device *device;	/* device the request is for */
 	struct ccw1 *cpaddr;		/* address of channel program */
 	char status;	        	/* status of this request */
 	short retries;			/* A retry counter */
@@ -171,7 +166,7 @@
 
 	/* these are important for recovering erroneous requests          */
 	struct irb *dstat;		/* device status in case of an error */
-	struct dasd_ccw_req_t *refers;	/* ERP-chain queueing. */
+	struct dasd_ccw_req *refers;	/* ERP-chain queueing. */
 	void *function; 		/* originating ERP action */
 
 	unsigned long long buildclk;	/* TOD-clock of request generation */
@@ -180,12 +175,12 @@
 	unsigned long long endclk;	/* TOD-clock of request termination */
 
         /* Callback that is called after reaching final status. */
-        void (*callback)(struct dasd_ccw_req_t *, void *data);
+        void (*callback)(struct dasd_ccw_req *, void *data);
         void *callback_data;
-} dasd_ccw_req_t;
+};
 
 /* 
- * dasd_ccw_req_t -> status can be:
+ * dasd_ccw_req -> status can be:
  */
 #define DASD_CQR_FILLED   0x00	/* request is ready to be processed */
 #define DASD_CQR_QUEUED   0x01	/* request is queued to be processed */
@@ -196,15 +191,15 @@
 #define DASD_CQR_PENDING  0x06  /* request is waiting for interrupt - ERP only */ 
 
 /* Signature for error recovery functions. */
-typedef dasd_ccw_req_t *(*dasd_erp_fn_t) (dasd_ccw_req_t * cqr);
+typedef struct dasd_ccw_req *(*dasd_erp_fn_t) (struct dasd_ccw_req *);
 
 /*
- * the dasd_discipline_t is
+ * the struct dasd_discipline is
  * sth like a table of virtual functions, if you think of dasd_eckd
  * inheriting dasd...
  * no, currently we are not planning to reimplement the driver in C++
  */
-typedef struct dasd_discipline_t {
+struct dasd_discipline {
 	struct module *owner;
 	char ebcname[8];	/* a name used for tagging and printks */
 	char name[8];		/* a name used for tagging and printks */
@@ -223,8 +218,8 @@
          * -EAGAIN if do_analysis started a ccw that needs to complete
          * before the analysis may be repeated.
          */
-        int (*check_device)(struct dasd_device_t *);
-	int (*do_analysis) (struct dasd_device_t *);
+        int (*check_device)(struct dasd_device *);
+	int (*do_analysis) (struct dasd_device *);
 
         /*
          * Device operation functions. build_cp creates a ccw chain for
@@ -232,11 +227,12 @@
          * term_IO cancels it (e.g. in case of a timeout). format_device
          * returns a ccw chain to be used to format the device.
          */
-	dasd_ccw_req_t *(*build_cp) (struct dasd_device_t *, struct request *);
-	int (*start_IO) (dasd_ccw_req_t *);
-	int (*term_IO) (dasd_ccw_req_t *);
-	dasd_ccw_req_t *(*format_device) (struct dasd_device_t *,
-                                          struct format_data_t *);
+	struct dasd_ccw_req *(*build_cp) (struct dasd_device *,
+					  struct request *);
+	int (*start_IO) (struct dasd_ccw_req *);
+	int (*term_IO) (struct dasd_ccw_req *);
+	struct dasd_ccw_req *(*format_device) (struct dasd_device *,
+					       struct format_data_t *);
 
         /*
          * Error recovery functions. examine_error() returns a value that
@@ -247,25 +243,25 @@
          * is called for every error condition to print the sense data
          * to the console.
          */
-	dasd_era_t(*examine_error) (dasd_ccw_req_t *, struct irb *);
-	dasd_erp_fn_t(*erp_action) (dasd_ccw_req_t *);
-	dasd_erp_fn_t(*erp_postaction) (dasd_ccw_req_t *);
-	void (*dump_sense) (struct dasd_device_t *, dasd_ccw_req_t *,
+	dasd_era_t(*examine_error) (struct dasd_ccw_req *, struct irb *);
+	dasd_erp_fn_t(*erp_action) (struct dasd_ccw_req *);
+	dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *);
+	void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *,
 			    struct irb *);
 
         /* i/o control functions. */
-	int (*fill_geometry) (struct dasd_device_t *, struct hd_geometry *);
-	int (*fill_info) (struct dasd_device_t *, dasd_information2_t *);
-} dasd_discipline_t;
+	int (*fill_geometry) (struct dasd_device *, struct hd_geometry *);
+	int (*fill_info) (struct dasd_device *, struct dasd_information2_t *);
+};
 
-extern dasd_discipline_t dasd_diag_discipline;
+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
 
-typedef struct dasd_device_t {
+struct dasd_device {
 	/* Block device stuff. */
 	struct gendisk *gdp;
 	devfs_handle_t devfs_entry;
@@ -279,7 +275,7 @@
 
 
 	/* Device discipline stuff. */
-	dasd_discipline_t *discipline;
+	struct dasd_discipline *discipline;
 	char *private;
 
 	/* Device state and target state. */
@@ -297,10 +293,6 @@
 	struct list_head ccw_chunks;
 	struct list_head erp_chunks;
 
-	/* Common i/o stuff. */
-	/* FIXME: remove the next */
-	int devno;
-
 	atomic_t tasklet_scheduled;
         struct tasklet_struct tasklet;
 	struct work_struct kick_work;
@@ -311,67 +303,64 @@
 	struct ccw_device *cdev;
 
 #ifdef CONFIG_DASD_PROFILE
-	dasd_profile_info_t profile;
+	struct dasd_profile_info_t profile;
 #endif
-} dasd_device_t;
+};
+
+void dasd_put_device_wake(struct dasd_device *);
 
 /*
- * dasd_devmap_t is used to store the features and the relation
- * between device number and device index. To find a dasd_devmap_t
- * that corresponds to a device number of a device index each
- * dasd_devmap_t is added to two linked lists, one to search by
- * the device number and one to search by the device index. As
- * soon as big minor numbers are available the device index list
- * can be removed since the device number will then be identical
- * to the device index.
+ * Reference count inliners
  */
-typedef struct {
-	struct list_head devindex_list;
-	struct list_head devno_list;
-        unsigned int devindex;
-        unsigned short devno;
-        unsigned short features;
-        dasd_device_t *device;
-} dasd_devmap_t;
+static inline void
+dasd_get_device(struct dasd_device *device)
+{
+	atomic_inc(&device->ref_count);
+}
+
+static inline void
+dasd_put_device(struct dasd_device *device)
+{
+	if (atomic_dec_return(&device->ref_count) == 0)
+		dasd_put_device_wake(device);
+}
 
 /*
  * The static memory in ccw_mem and erp_mem is managed by a sorted
  * list of free memory chunks.
  */
-typedef struct dasd_mchunk_t
+struct dasd_mchunk
 {
 	struct list_head list;
 	unsigned long size;
-} __attribute__ ((aligned(8))) dasd_mchunk_t;
+} __attribute__ ((aligned(8)));
 
 static inline void
 dasd_init_chunklist(struct list_head *chunk_list, void *mem,
 		    unsigned long size)
 {
-	dasd_mchunk_t *chunk;
+	struct dasd_mchunk *chunk;
 
 	INIT_LIST_HEAD(chunk_list);
-	chunk = (dasd_mchunk_t *) mem;
-	chunk->size = size - sizeof(dasd_mchunk_t);
+	chunk = (struct dasd_mchunk *) mem;
+	chunk->size = size - sizeof(struct dasd_mchunk);
 	list_add(&chunk->list, chunk_list);
 }
 
 static inline void *
 dasd_alloc_chunk(struct list_head *chunk_list, unsigned long size)
 {
-	dasd_mchunk_t *chunk, *tmp;
-	struct list_head *l;
+	struct dasd_mchunk *chunk, *tmp;
 
 	size = (size + 7L) & -8L;
-	list_for_each(l, chunk_list) {
-		chunk = list_entry(l, dasd_mchunk_t, list);
+	list_for_each_entry(chunk, chunk_list, list) {
 		if (chunk->size < size)
 			continue;
-		if (chunk->size > size + sizeof(dasd_mchunk_t)) {
+		if (chunk->size > size + sizeof(struct dasd_mchunk)) {
 			char *endaddr = (char *) (chunk + 1) + chunk->size;
-			tmp = (dasd_mchunk_t *) (endaddr - size) - 1;
+			tmp = (struct dasd_mchunk *) (endaddr - size) - 1;
 			tmp->size = size;
-			chunk->size -= size + sizeof(dasd_mchunk_t);
+			chunk->size -= size + sizeof(struct dasd_mchunk);
 			chunk = tmp;
 		} else
 			list_del(&chunk->list);
@@ -383,30 +372,31 @@
 static inline void
 dasd_free_chunk(struct list_head *chunk_list, void *mem)
 {
-	dasd_mchunk_t *chunk, *tmp;
+	struct dasd_mchunk *chunk, *tmp;
 	struct list_head *p, *left;
 
-	chunk = (dasd_mchunk_t *)((char *) mem - sizeof(dasd_mchunk_t));
+	chunk = (struct dasd_mchunk *)
+		((char *) mem - sizeof(struct dasd_mchunk));
 	/* Find out the left neighbour in chunk_list. */
 	left = chunk_list;
 	list_for_each(p, chunk_list) {
-		if (list_entry(p, dasd_mchunk_t, list) > chunk)
+		if (list_entry(p, struct dasd_mchunk, list) > chunk)
 			break;
 		left = p;
 	}
 	/* Try to merge with right neighbour = next element from left. */
 	if (left->next != chunk_list) {
-		tmp = list_entry(left->next, dasd_mchunk_t, list);
+		tmp = list_entry(left->next, struct dasd_mchunk, list);
 		if ((char *) (chunk + 1) + chunk->size == (char *) tmp) {
 			list_del(&tmp->list);
-			chunk->size += tmp->size + sizeof(dasd_mchunk_t);
+			chunk->size += tmp->size + sizeof(struct dasd_mchunk);
 		}
 	}
 	/* Try to merge with left neighbour. */
 	if (left != chunk_list) {
-		tmp = list_entry(left, dasd_mchunk_t, list);
+		tmp = list_entry(left, struct dasd_mchunk, list);
 		if ((char *) (tmp + 1) + tmp->size == (char *) chunk) {
-			tmp->size += chunk->size + sizeof(dasd_mchunk_t);
+			tmp->size += chunk->size + sizeof(struct dasd_mchunk);
 			return;
 		}
 	}
@@ -429,44 +419,46 @@
 #define DASD_PROFILE_OFF 0
 
 extern debug_info_t *dasd_debug_area;
-extern dasd_profile_info_t dasd_global_profile;
+extern struct dasd_profile_info_t dasd_global_profile;
 extern unsigned int dasd_profile_level;
 extern struct block_device_operations dasd_device_operations;
 
-dasd_ccw_req_t *dasd_kmalloc_request(char *, int, int, dasd_device_t *); /* unused */
-dasd_ccw_req_t *dasd_smalloc_request(char *, int, int, dasd_device_t *);
-void dasd_kfree_request(dasd_ccw_req_t *, dasd_device_t *);
-void dasd_sfree_request(dasd_ccw_req_t *, dasd_device_t *);
+struct dasd_ccw_req *
+dasd_kmalloc_request(char *, int, int, struct dasd_device *);
+struct dasd_ccw_req *
+dasd_smalloc_request(char *, int, int, struct dasd_device *);
+void dasd_kfree_request(struct dasd_ccw_req *, struct dasd_device *);
+void dasd_sfree_request(struct dasd_ccw_req *, struct dasd_device *);
 
 static inline int
-dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, dasd_device_t *device)
+dasd_kmalloc_set_cda(struct ccw1 *ccw, void *cda, struct dasd_device *device)
 {
 	return set_normalized_cda(ccw, cda);
 }
 
-dasd_device_t *dasd_alloc_device(dasd_devmap_t *);
-void dasd_free_device(dasd_device_t *);
-void dasd_enable_device(dasd_device_t *);
-void dasd_set_target_state(dasd_device_t *, int);
-void dasd_kick_device(dasd_device_t *);
-
-void dasd_add_request_head(dasd_ccw_req_t *);
-void dasd_add_request_tail(dasd_ccw_req_t *); /* unused */
-int  dasd_start_IO(dasd_ccw_req_t *);
-int  dasd_term_IO(dasd_ccw_req_t *);
-void dasd_schedule_bh(dasd_device_t *);
-int  dasd_sleep_on(dasd_ccw_req_t *);
-int  dasd_sleep_on_immediatly(dasd_ccw_req_t *);
-int  dasd_sleep_on_interruptible(dasd_ccw_req_t *);
-void dasd_set_timer(dasd_device_t *, int);
-void dasd_clear_timer(dasd_device_t *);
-int  dasd_cancel_req(dasd_ccw_req_t *); /* unused */
-int dasd_generic_probe (struct ccw_device *cdev, 
-			dasd_discipline_t *discipline);
+struct dasd_device *dasd_alloc_device(unsigned int devindex);
+void dasd_free_device(struct dasd_device *);
+
+void dasd_enable_device(struct dasd_device *);
+void dasd_set_target_state(struct dasd_device *, int);
+void dasd_kick_device(struct dasd_device *);
+
+void dasd_add_request_head(struct dasd_ccw_req *);
+void dasd_add_request_tail(struct dasd_ccw_req *);
+int  dasd_start_IO(struct dasd_ccw_req *);
+int  dasd_term_IO(struct dasd_ccw_req *);
+void dasd_schedule_bh(struct dasd_device *);
+int  dasd_sleep_on(struct dasd_ccw_req *);
+int  dasd_sleep_on_immediatly(struct dasd_ccw_req *);
+int  dasd_sleep_on_interruptible(struct dasd_ccw_req *);
+void dasd_set_timer(struct dasd_device *, int);
+void dasd_clear_timer(struct dasd_device *);
+int  dasd_cancel_req(struct dasd_ccw_req *);
+int dasd_generic_probe (struct ccw_device *, struct dasd_discipline *);
 int dasd_generic_remove (struct ccw_device *cdev);
-int dasd_generic_set_online(struct ccw_device *cdev, 
-			    dasd_discipline_t *discipline);
+int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *);
 int dasd_generic_set_offline (struct ccw_device *cdev);
+void dasd_generic_auto_online (struct ccw_driver *);
 
 /* externals in dasd_devmap.c */
 extern int dasd_max_devindex;
@@ -475,21 +467,24 @@
 
 int dasd_devmap_init(void);
 void dasd_devmap_exit(void);
-dasd_devmap_t *dasd_devmap_from_devno(int);
-dasd_devmap_t *dasd_devmap_from_devindex(int);
-dasd_device_t *dasd_get_device(dasd_devmap_t *);
-void dasd_put_device(dasd_devmap_t *);
+
+struct dasd_device *dasd_create_device(struct ccw_device *);
+void dasd_delete_device(struct dasd_device *);
+
+kdev_t dasd_get_kdev(struct dasd_device *);
+struct dasd_device *dasd_device_from_devindex(int);
 
 int dasd_parse(void);
 int dasd_add_range(int, int, int);
+int dasd_devno_in_range(int);
 
 /* externals in dasd_gendisk.c */
 int  dasd_gendisk_init(void);
 void dasd_gendisk_exit(void);
 int  dasd_gendisk_index_major(int);
 struct gendisk *dasd_gendisk_alloc(int);
-void dasd_setup_partitions(dasd_device_t *);
-void dasd_destroy_partitions(dasd_device_t *);
+void dasd_setup_partitions(struct dasd_device *);
+void dasd_destroy_partitions(struct dasd_device *);
 
 /* externals in dasd_ioctl.c */
 int  dasd_ioctl_init(void);
@@ -503,26 +498,26 @@
 void dasd_proc_exit(void);
 
 /* externals in dasd_erp.c */
-dasd_ccw_req_t *dasd_default_erp_action(dasd_ccw_req_t *);
-dasd_ccw_req_t *dasd_default_erp_postaction(dasd_ccw_req_t *);
-dasd_ccw_req_t *dasd_alloc_erp_request(char *, int, int, dasd_device_t *);
-void dasd_free_erp_request(dasd_ccw_req_t *, dasd_device_t *);
-void dasd_log_sense(dasd_ccw_req_t *, struct irb *);
-void dasd_log_ccw(dasd_ccw_req_t *, int, __u32);
+struct dasd_ccw_req *dasd_default_erp_action(struct dasd_ccw_req *);
+struct dasd_ccw_req *dasd_default_erp_postaction(struct dasd_ccw_req *);
+struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int, struct dasd_device *);
+void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *);
+void dasd_log_sense(struct dasd_ccw_req *, struct irb *);
+void dasd_log_ccw(struct dasd_ccw_req *, int, __u32);
 
 /* externals in dasd_3370_erp.c */
-dasd_era_t dasd_3370_erp_examine(dasd_ccw_req_t *, struct irb *);
+dasd_era_t dasd_3370_erp_examine(struct dasd_ccw_req *, struct irb *);
 
 /* externals in dasd_3990_erp.c */
-dasd_era_t dasd_3990_erp_examine(dasd_ccw_req_t *, struct irb *);
-dasd_ccw_req_t *dasd_3990_erp_action(dasd_ccw_req_t *);
+dasd_era_t dasd_3990_erp_examine(struct dasd_ccw_req *, struct irb *);
+struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *);
 
 /* externals in dasd_9336_erp.c */
-dasd_era_t dasd_9336_erp_examine(dasd_ccw_req_t *, struct irb *);
+dasd_era_t dasd_9336_erp_examine(struct dasd_ccw_req *, struct irb *);
 
 /* externals in dasd_9336_erp.c */
-dasd_era_t dasd_9343_erp_examine(dasd_ccw_req_t *, struct irb *);
-dasd_ccw_req_t *dasd_9343_erp_action(dasd_ccw_req_t *);
+dasd_era_t dasd_9343_erp_examine(struct dasd_ccw_req *, struct irb *);
+struct dasd_ccw_req *dasd_9343_erp_action(struct dasd_ccw_req *);
 
 #endif				/* __KERNEL__ */
 
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_ioctl.c linux-2.5.67-bk6/drivers/s390/block/dasd_ioctl.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_ioctl.c	2003-04-07 10:31:46.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_ioctl.c	2003-04-15 04:36:16.000000000 -0700
@@ -8,11 +8,8 @@
  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999-2001
  *
  * i/o controls for the dasd driver.
- *
- * 05/04/02 split from dasd.c, code restructuring.
  */
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/interrupt.h>
 #include <linux/major.h>
 #include <linux/fs.h>
@@ -35,15 +32,14 @@
 /*
  * Find the ioctl with number no.
  */
-static dasd_ioctl_list_t *
+static struct dasd_ioctl *
 dasd_find_ioctl(int no)
 {
-	struct list_head *curr;
-	list_for_each (curr, &dasd_ioctl_list) {
-		if (list_entry (curr, dasd_ioctl_list_t, list)->no == no) {
-			return list_entry (curr, dasd_ioctl_list_t, list);
-		}
-	}
+	struct dasd_ioctl *ioctl;
+
+	list_for_each_entry (ioctl, &dasd_ioctl_list, list)
+		if (ioctl->no == no)
+			return ioctl;
 	return NULL;
 }
 
@@ -53,10 +49,10 @@
 int
 dasd_ioctl_no_register(struct module *owner, int no, dasd_ioctl_fn_t handler)
 {
-	dasd_ioctl_list_t *new;
+	struct dasd_ioctl *new;
 	if (dasd_find_ioctl(no))
 		return -EBUSY;
-	new = kmalloc(sizeof (dasd_ioctl_list_t), GFP_KERNEL);
+	new = kmalloc(sizeof (struct dasd_ioctl), GFP_KERNEL);
 	if (new == NULL)
 		return -ENOMEM;
 	new->owner = owner;
@@ -73,7 +69,7 @@
 int
 dasd_ioctl_no_unregister(struct module *owner, int no, dasd_ioctl_fn_t handler)
 {
-	dasd_ioctl_list_t *old = dasd_find_ioctl(no);
+	struct dasd_ioctl *old = dasd_find_ioctl(no);
 	if (old == NULL)
 		return -ENOENT;
 	if (old->no != no || old->handler != handler || owner != old->owner)
@@ -89,9 +85,8 @@
 	   unsigned int no, unsigned long data)
 {
 	struct block_device *bdev = inp->i_bdev;
-	dasd_device_t *device = bdev->bd_disk->private_data;
-	dasd_ioctl_list_t *ioctl;
-	struct list_head *l;
+	struct dasd_device *device = bdev->bd_disk->private_data;
+	struct dasd_ioctl *ioctl;
 	const char *dir;
 	int rc;
 
@@ -107,8 +102,7 @@
 		      "ioctl 0x%08x %s'0x%x'%d(%d) with data %8lx", no,
 		      dir, _IOC_TYPE(no), _IOC_NR(no), _IOC_SIZE(no), data);
 	/* Search for ioctl no in the ioctl list. */
-	list_for_each(l, &dasd_ioctl_list) {
-		ioctl = list_entry(l, dasd_ioctl_list_t, list);
+	list_for_each_entry(ioctl, &dasd_ioctl_list, list) {
 		if (ioctl->no == no) {
 			/* Found a matching ioctl. Call it. */
 			if (!try_module_get(ioctl->owner))
@@ -140,7 +134,7 @@
 static int
 dasd_ioctl_enable(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -157,7 +151,7 @@
 static int
 dasd_ioctl_disable(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -183,9 +177,9 @@
  * devices this means CCWs are generated to format a single track.
  */
 static int
-dasd_format(dasd_device_t * device, format_data_t * fdata)
+dasd_format(struct dasd_device * device, struct format_data_t * fdata)
 {
-	dasd_ccw_req_t *cqr;
+	struct dasd_ccw_req *cqr;
 	int rc;
 
 	if (device->discipline->format_device == NULL)
@@ -227,8 +221,8 @@
 static int
 dasd_ioctl_format(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	format_data_t fdata;
+	struct dasd_device *device;
+	struct format_data_t fdata;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -241,7 +235,8 @@
 		return -ENODEV;
 	if (device->ro_flag)
 		return -EROFS;
-	if (copy_from_user(&fdata, (void *) args, sizeof (format_data_t)))
+	if (copy_from_user(&fdata, (void *) args,
+			   sizeof (struct format_data_t)))
 		return -EFAULT;
 	if (bdev != bdev->bd_contains) {
 		DEV_MESSAGE(KERN_WARNING, device, "%s",
@@ -258,7 +253,7 @@
 static int
 dasd_ioctl_reset_profile(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -267,7 +262,7 @@
 	if (device == NULL)
 		return -ENODEV;
 
-	memset(&device->profile, 0, sizeof (dasd_profile_info_t));
+	memset(&device->profile, 0, sizeof (struct dasd_profile_info_t));
 	return 0;
 }
 
@@ -277,14 +272,14 @@
 static int
 dasd_ioctl_read_profile(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device = bdev->bd_disk->private_data;
 	if (device == NULL)
 		return -ENODEV;
 
 	if (copy_to_user((long *) args, (long *) &device->profile,
-			 sizeof (dasd_profile_info_t)))
+			 sizeof (struct dasd_profile_info_t)))
 		return -EFAULT;
 	return 0;
 }
@@ -308,8 +303,8 @@
 static int
 dasd_ioctl_information(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
-	dasd_information2_t *dasd_info;
+	struct dasd_device *device;
+	struct dasd_information2_t *dasd_info;
 	unsigned long flags;
 	int rc;
 	struct ccw_device *cdev;
@@ -321,7 +316,7 @@
 	if (!device->discipline->fill_info)
 		return -EINVAL;
 
-	dasd_info = kmalloc(sizeof(dasd_information2_t), GFP_KERNEL);
+	dasd_info = kmalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
 	if (dasd_info == NULL)
 		return -ENOMEM;
 
@@ -333,7 +328,7 @@
 
 	cdev = device->cdev;
 
-	dasd_info->devno = device->devno;
+	dasd_info->devno = _ccw_device_get_device_number(device->cdev);
 	dasd_info->schid = _ccw_device_get_subchannel_number(device->cdev);
 	dasd_info->cu_type = cdev->id.cu_type;
 	dasd_info->cu_model = cdev->id.cu_model;
@@ -380,8 +375,8 @@
 	rc = 0;
 	if (copy_to_user((long *) args, (long *) dasd_info,
 			 ((no == (unsigned int) BIODASDINFO2) ?
-			  sizeof (dasd_information2_t) :
-			  sizeof (dasd_information_t))))
+			  sizeof (struct dasd_information2_t) :
+			  sizeof (struct dasd_information_t))))
 		rc = -EFAULT;
 	kfree(dasd_info);
 	return rc;
@@ -393,7 +388,7 @@
 static int
 dasd_ioctl_set_ro(struct block_device *bdev, int no, long args)
 {
-	dasd_device_t *device;
+	struct dasd_device *device;
 	int intval;
 
 	if (!capable(CAP_SYS_ADMIN))
@@ -418,7 +413,7 @@
 dasd_ioctl_getgeo(struct block_device *bdev, int no, long args)
 {
 	struct hd_geometry geo = { 0, };
-	dasd_device_t *device;
+	struct dasd_device *device;
 
 	device =  bdev->bd_disk->private_data;
 	if (device == NULL)
diff -urN linux-2.5.67-bk5/drivers/s390/block/dasd_proc.c linux-2.5.67-bk6/drivers/s390/block/dasd_proc.c
--- linux-2.5.67-bk5/drivers/s390/block/dasd_proc.c	2003-04-07 10:30:45.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/block/dasd_proc.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,14 +9,10 @@
  *
  * /proc interface for the dasd driver.
  *
- * $Revision: 1.17 $
- *
- * History of changes
- * 05/04/02 split from dasd.c, code restructuring.
+ * $Revision: 1.21 $
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/ctype.h>
 #include <linux/seq_file.h>
 #include <linux/vmalloc.h>
@@ -56,17 +52,14 @@
 static int
 dasd_devices_show(struct seq_file *m, void *v)
 {
-	dasd_devmap_t *devmap;
-	dasd_device_t *device;
+	struct dasd_device *device;
 	char *substr;
 
-	devmap = dasd_devmap_from_devindex((unsigned long) v - 1);
-	device = (devmap != NULL) ?
-		dasd_get_device(devmap) : ERR_PTR(-ENODEV);
+	device = dasd_device_from_devindex((unsigned long) v - 1);
 	if (IS_ERR(device))
 		return 0;
 	/* Print device number. */
-	seq_printf(m, "%04x", devmap->devno);
+	seq_printf(m, "%04x", _ccw_device_get_device_number(device->cdev));
 	/* Print discipline string. */
 	if (device != NULL && device->discipline != NULL)
 		seq_printf(m, "(%s)", device->discipline->name);
@@ -113,7 +106,7 @@
 		seq_printf(m, "no stat");
 		break;
 	}
-	dasd_put_device(devmap);
+	dasd_put_device(device);
 	if (dasd_probeonly)
 		seq_printf(m, "(probeonly)");
 	seq_printf(m, "\n");
@@ -189,7 +182,7 @@
 {
 	unsigned long len;
 #ifdef CONFIG_DASD_PROFILE
-	dasd_profile_info_t *prof;
+	struct dasd_profile_info_t *prof;
 	char *str;
 	int shift;
 
@@ -266,14 +259,15 @@
 		} else if (strcmp(str, "off") == 0) {
 			/* switch off and reset statistics profiling */
 			memset(&dasd_global_profile,
-			       0, sizeof (dasd_profile_info_t));
+			       0, sizeof (struct dasd_profile_info_t));
 			dasd_profile_level = DASD_PROFILE_OFF;
 			MESSAGE(KERN_INFO, "%s", "Statictics switched off");
 		} else
 			goto out_error;
 	} else if (strncmp(str, "reset", 5) == 0) {
 		/* reset the statistics */
-		memset(&dasd_global_profile, 0, sizeof (dasd_profile_info_t));
+		memset(&dasd_global_profile, 0,
+		       sizeof (struct dasd_profile_info_t));
 		MESSAGE(KERN_INFO, "%s", "Statictics reset");
 	} else
 		goto out_error;
diff -urN linux-2.5.67-bk5/drivers/s390/char/con3215.c linux-2.5.67-bk6/drivers/s390/char/con3215.c
--- linux-2.5.67-bk5/drivers/s390/char/con3215.c	2003-04-07 10:32:13.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/con3215.c	2003-04-15 04:36:16.000000000 -0700
@@ -872,7 +872,7 @@
  *  The console structure for the 3215 console
  */
 static struct console con3215 = {
-	.name	 = "tty3215",
+	.name	 = "ttyS",
 	.write	 = con3215_write,
 	.device	 = con3215_device,
 	.unblank = con3215_unblank,
@@ -884,7 +884,7 @@
  * 3215 console initialization code called from console_init().
  * NOTE: This is called before kmalloc is available.
  */
-static void __init
+static int __init
 con3215_init(void)
 {
 	struct ccw_device *cdev;
@@ -894,7 +894,7 @@
 
 	/* Check if 3215 is to be the console */
 	if (!CONSOLE_IS_3215)
-		return;
+		return -ENODEV;
 
 	/* Set the console mode for VM */
 	if (MACHINE_IS_VM) {
@@ -913,7 +913,7 @@
 
 	cdev = ccw_device_probe_console();
 	if (!cdev)
-		return;
+		return -ENODEV;
 
 	raw3215[0] = raw = (struct raw3215_info *)
 		alloc_bootmem_low(sizeof(struct raw3215_info));
@@ -938,10 +938,12 @@
 		free_bootmem((unsigned long) raw, sizeof(struct raw3215_info));
 		raw3215[0] = NULL;
 		printk("Couldn't find a 3215 console device\n");
-		return;
+		return -ENODEV;
 	}
 	register_console(&con3215);
+	return 0;
 }
+console_initcall(con3215_init);
 #endif
 
 /*
@@ -1122,7 +1124,6 @@
 		spin_unlock_irqrestore(raw->lock, flags);
 	}
 }
-console_initcall(con3215_init);
 
 /*
  * Disable writing to a 3215 tty
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp.c linux-2.5.67-bk6/drivers/s390/char/sclp.c
--- linux-2.5.67-bk5/drivers/s390/char/sclp.c	2003-04-07 10:31:52.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,7 +9,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/bootmem.h>
@@ -25,14 +24,6 @@
 
 #define SCLP_CORE_PRINT_HEADER "sclp low level driver: "
 
-/*
- * decides whether we make use of the macro MACHINE_IS_VM to
- * configure the driver for VM at run time (a little bit
- * different behaviour); otherwise we use the default
- * settings in sclp_data.init_ioctls
- */
-#define USE_VM_DETECTION
-
 /* Structure for register_early_external_interrupt. */
 static ext_int_info_t ext_int_info_hwc;
 
@@ -111,30 +102,32 @@
 }
 
 static int
-__sclp_start_request(void)
+sclp_start_request(void)
 {
 	struct sclp_req *req;
 	int rc;
+	unsigned long flags;
 
 	/* quick exit if sclp is already in use */
 	if (test_bit(SCLP_RUNNING, &sclp_status))
 		return -EBUSY;
-	/* quick exit if queue is empty */
-	if (list_empty(&sclp_req_queue))
-		return -EINVAL;
-	/* try to start the first request on the request queue. */
-	req = list_entry(sclp_req_queue.next, struct sclp_req, list);
-	rc = __service_call(req->command, req->sccb);
-	switch (rc) {
-	case 0:
-		req->status = SCLP_REQ_RUNNING;
-		break;
-	case -EIO:
-		req->status = SCLP_REQ_FAILED;
-		if (req->callback != NULL)
-			req->callback(req, req->callback_data);
-		break;
-	}
+	spin_lock_irqsave(&sclp_lock, flags);
+	/* Get first request on queue if available */
+	req = NULL;
+	if (!list_empty(&sclp_req_queue))
+		req = list_entry(sclp_req_queue.next, struct sclp_req, list);
+	if (req) {
+		rc = __service_call(req->command, req->sccb);
+		if (rc) {
+			req->status = SCLP_REQ_FAILED;
+			list_del(&req->list);
+		} else
+			req->status = SCLP_REQ_RUNNING;
+	} else
+		rc = -EINVAL;
+	spin_unlock_irqrestore(&sclp_lock, flags);
+	if (rc == -EIO && req->callback != NULL)
+		req->callback(req, req->callback_data);
 	return rc;
 }
 
@@ -156,8 +149,12 @@
 		list_for_each(l, &sclp_reg_list) {
 			t = list_entry(l, struct sclp_register, list);
 			if (t->receive_mask & (1 << (32 - evbuf->type))) {
-				if (t->receiver_fn != NULL)
+				if (t->receiver_fn != NULL) {
+					spin_unlock_irqrestore(&sclp_lock,
+							       flags);
 					t->receiver_fn(evbuf);
+					spin_lock_irqsave(&sclp_lock, flags);
+				}
 				break;
 			}
 			else
@@ -230,7 +227,7 @@
 }
 
 /*
- * Function to issue Read Event Data/Unconditional Read
+ * Function to queue Read Event Data/Unconditional Read
  */
 static void
 __sclp_unconditional_read(void)
@@ -278,45 +275,44 @@
 	struct list_head *l;
 	struct sclp_req *req, *tmp;
 
+	/*
+	 * Only process interrupt if sclp is initialized.
+	 * This avoids strange effects for a pending request
+	 * from before the last re-ipl.
+	 */
+	if (!test_bit(SCLP_INIT, &sclp_status))
+		return;
 	ext_int_param = S390_lowcore.ext_params;
 	finished_sccb = ext_int_param & EXT_INT_SCCB_MASK;
 	evbuf_pending = ext_int_param & (EXT_INT_EVBUF_PENDING |
 					 EXT_INT_STATECHANGE_PENDING);
 	irq_enter();
-	/*
-	 * Only do request callbacks if sclp is initialized.
-	 * This avoids strange effects for a pending request
-	 * from before the last re-ipl.
-	 */
-	if (test_bit(SCLP_INIT, &sclp_status)) {
-		spin_lock(&sclp_lock);
-		req = NULL;
-		if (finished_sccb != 0U) {
-			list_for_each(l, &sclp_req_queue) {
-				tmp = list_entry(l, struct sclp_req, list);
-				if (finished_sccb == (u32)(addr_t) tmp->sccb) {
-					list_del(&tmp->list);
-					req = tmp;
-					break;
-				}
+	req = NULL;
+	spin_lock(&sclp_lock);
+	if (finished_sccb != 0U) {
+		list_for_each(l, &sclp_req_queue) {
+			tmp = list_entry(l, struct sclp_req, list);
+			if (finished_sccb == (u32)(addr_t) tmp->sccb) {
+				list_del(&tmp->list);
+				req = tmp;
+				break;
 			}
 		}
-		spin_unlock(&sclp_lock);
-		if (req != NULL) {
-			req->status = SCLP_REQ_DONE;
-			if (req->callback != NULL)
-				req->callback(req, req->callback_data);
-		}
 	}
-	spin_lock(&sclp_lock);
 	/* Head queue a read sccb if an event buffer is pending */
 	if (evbuf_pending)
 		__sclp_unconditional_read();
+	spin_unlock(&sclp_lock);
+	/* Perform callback */
+	if (req != NULL) {
+		req->status = SCLP_REQ_DONE;
+		if (req->callback != NULL)
+			req->callback(req, req->callback_data);
+	}
 	/* Now clear the running bit */
 	clear_bit(SCLP_RUNNING, &sclp_status);
 	/* and start next request on the queue */
-	__sclp_start_request();
-	spin_unlock(&sclp_lock);
+	sclp_start_request();
 	irq_exit();
 }
 
@@ -368,15 +364,19 @@
 {
 	unsigned long flags;
 
-	if (!test_bit(SCLP_INIT, &sclp_status))
+	if (!test_bit(SCLP_INIT, &sclp_status)) {
+		req->status = SCLP_REQ_FAILED;
+		if (req->callback != NULL)
+			req->callback(req, req->callback_data);
 		return;
+	}
 	spin_lock_irqsave(&sclp_lock, flags);
 	/* queue the request */
 	req->status = SCLP_REQ_QUEUED;
 	list_add_tail(&req->list, &sclp_req_queue);
-	/* try to start the first request on the queue */
-	__sclp_start_request();
 	spin_unlock_irqrestore(&sclp_lock, flags);
+	/* try to start the first request on the queue */
+	sclp_start_request();
 }
 
 /* state change notification */
@@ -489,8 +489,8 @@
 {
 	psw_t quiesce_psw;
 
-	quiesce_psw.mask = _DW_PSW_MASK;
-	queisce_psw.addr = 0xfff;
+	quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT;
+	quiesce_psw.addr = 0xfff;
 	__load_psw(quiesce_psw);
 }
 #endif
@@ -566,10 +566,9 @@
 	if (test_bit(SCLP_INIT, &sclp_status)) {
 		/* add request to sclp queue */
 		list_add_tail(&req->list, &sclp_req_queue);
-		/* and start if SCLP is idle */
-		if (!test_bit(SCLP_RUNNING, &sclp_status))
-			__sclp_start_request();
 		spin_unlock_irqrestore(&sclp_lock, flags);
+		/* and start if SCLP is idle */
+		sclp_start_request();
 		/* now wait for completion */
 		while (req->status != SCLP_REQ_DONE &&
 		       req->status != SCLP_REQ_FAILED)
@@ -730,7 +729,41 @@
 	sclp_init_mask();
 }
 
+#define	SCLP_EVBUF_PROCESSED	0x80
+
+/*
+ * Traverse array of event buffers contained in SCCB and remove all buffers
+ * with a set "processed" flag. Return the number of unprocessed buffers.
+ */
+int
+sclp_remove_processed(struct sccb_header *sccb)
+{
+	struct evbuf_header *evbuf;
+	int unprocessed;
+	u16 remaining;
+
+	evbuf = (struct evbuf_header *) (sccb + 1);
+	unprocessed = 0;
+	remaining = sccb->length - sizeof(struct sccb_header);
+	while (remaining > 0) {
+		remaining -= evbuf->length;
+		if (evbuf->flags & SCLP_EVBUF_PROCESSED) {
+			sccb->length -= evbuf->length;
+			memcpy((void *) evbuf,
+			       (void *) ((addr_t) evbuf + evbuf->length),
+			       remaining);
+		} else {
+			unprocessed++;
+			evbuf = (struct evbuf_header *)
+					((addr_t) evbuf + evbuf->length);
+		}
+	}
+
+	return unprocessed;
+}
+
 EXPORT_SYMBOL(sclp_add_request);
 EXPORT_SYMBOL(sclp_sync_wait);
 EXPORT_SYMBOL(sclp_register);
 EXPORT_SYMBOL(sclp_unregister);
+EXPORT_SYMBOL(sclp_error_message);
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp.h linux-2.5.67-bk6/drivers/s390/char/sclp.h
--- linux-2.5.67-bk5/drivers/s390/char/sclp.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp.h	2003-04-15 04:36:16.000000000 -0700
@@ -126,6 +126,7 @@
 int sclp_register(struct sclp_register *reg);
 void sclp_unregister(struct sclp_register *reg);
 char *sclp_error_message(u16 response_code);
+int sclp_remove_processed(struct sccb_header *sccb);
 
 /* useful inlines */
 
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp_con.c linux-2.5.67-bk6/drivers/s390/char/sclp_con.c
--- linux-2.5.67-bk5/drivers/s390/char/sclp_con.c	2003-04-07 10:31:21.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp_con.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,7 +9,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/kmod.h>
 #include <linux/console.h>
 #include <linux/init.h>
@@ -24,7 +23,7 @@
 
 #define sclp_console_major 4		/* TTYAUX_MAJOR */
 #define sclp_console_minor 64
-#define sclp_console_name  "console"
+#define sclp_console_name  "ttyS"
 
 /* Lock to guard over changes to global variables */
 static spinlock_t sclp_con_lock;
@@ -193,28 +192,29 @@
 	.write = sclp_console_write,
 	.device = sclp_console_device,
 	.unblank = sclp_console_unblank,
-	.flags = CON_PRINTBUFFER
+	.flags = CON_PRINTBUFFER,
+	.index = 0 /* ttyS0 */
 };
 
 /*
  * called by console_init() in drivers/char/tty_io.c at boot-time.
  */
-void __init
+static int __init
 sclp_console_init(void)
 {
 	void *page;
 	int i;
 
 	if (!CONSOLE_IS_SCLP)
-		return;
+		return 0;
 	if (sclp_rw_init() != 0)
-		return;
+		return 0;
 	/* Allocate pages for output buffering */
 	INIT_LIST_HEAD(&sclp_con_pages);
 	for (i = 0; i < MAX_CONSOLE_PAGES; i++) {
 		page = alloc_bootmem_low_pages(PAGE_SIZE);
 		if (page == NULL)
-			return;
+			return 0;
 		list_add_tail((struct list_head *) page, &sclp_con_pages);
 	}
 	INIT_LIST_HEAD(&sclp_con_outqueue);
@@ -236,6 +236,7 @@
 
 	/* enable printk-access to this driver */
 	register_console(&sclp_console);
+	return 0;
 }
 
 console_initcall(sclp_console_init);
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp_cpi.c linux-2.5.67-bk6/drivers/s390/char/sclp_cpi.c
--- linux-2.5.67-bk5/drivers/s390/char/sclp_cpi.c	2003-04-07 10:31:24.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp_cpi.c	2003-04-15 04:36:16.000000000 -0700
@@ -130,7 +130,7 @@
 	req = (struct sclp_req *) kmalloc(sizeof(struct sclp_req), GFP_KERNEL);
 	if (req == NULL)
 		return ERR_PTR(-ENOMEM);
-	sccb = (struct cpi_sccb *) __get_free_page(GFP_KERNEL);
+	sccb = (struct cpi_sccb *) __get_free_page(GFP_KERNEL | GFP_DMA);
 	if (sccb == NULL) {
 		kfree(req);
 		return ERR_PTR(-ENOMEM);
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp_rw.c linux-2.5.67-bk6/drivers/s390/char/sclp_rw.c
--- linux-2.5.67-bk5/drivers/s390/char/sclp_rw.c	2003-04-07 10:31:15.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp_rw.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,7 +9,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
 #include <linux/kmod.h>
 #include <linux/types.h>
 #include <linux/err.h>
@@ -374,39 +373,6 @@
 	return rc;
 }
 
-#define	SCLP_EVBUF_PROCESSED	0x80
-
-/*
- * Traverse array of event buffers contained in SCCB and remove all buffers
- * with a set "processed" flag. Return the number of unprocessed buffers.
- */
-static int
-sclp_remove_processed(struct sccb_header *sccb)
-{
-	struct evbuf_header *evbuf;
-	int unprocessed;
-	u16 remaining;
-
-	evbuf = (struct evbuf_header *) (sccb + 1);
-	unprocessed = 0;
-	remaining = sccb->length - sizeof(struct sccb_header);
-	while (remaining > 0) {
-		remaining -= evbuf->length;
-		if (evbuf->flags & SCLP_EVBUF_PROCESSED) {
-			sccb->length -= evbuf->length;
-			memcpy((void *) evbuf,
-			       (void *) ((addr_t) evbuf + evbuf->length),
-			       remaining);
-		} else {
-			unprocessed++;
-			evbuf = (struct evbuf_header *)
-					((addr_t) evbuf + evbuf->length);
-		}
-	}
-
-	return unprocessed;
-}
-
 static void
 sclp_buffer_retry(unsigned long data)
 {
@@ -480,10 +446,6 @@
 			rc = -ENOMEM;
 		else
 			rc = -EINVAL;
-		printk(KERN_WARNING SCLP_RW_PRINT_HEADER
-		       "sclp_writedata_callback: %s (response code=0x%x).\n",
-		       sclp_error_message(sccb->header.response_code),
-		       sccb->header.response_code);
 		break;
 	}
 	if (buffer->callback != NULL)
@@ -505,8 +467,11 @@
 		sclp_finalize_mto(buffer);
 
 	/* Are there messages in the output buffer ? */
-	if (buffer->mto_number == 0)
+	if (buffer->mto_number == 0) {
+		if (callback != NULL)
+			callback(buffer, 0);
 		return;
+	}
 
 	sccb = buffer->sccb;
 	if (sclp_rw_event.sclp_send_mask & EvTyp_Msg_Mask)
@@ -516,7 +481,8 @@
 		/* Use write priority message */
 		sccb->msg_buf.header.type = EvTyp_PMsgCmd;
 	else {
-		callback(buffer, -ENOSYS);
+		if (callback != NULL)
+			callback(buffer, -ENOSYS);
 		return;
 	}
 	buffer->request.command = SCLP_CMDW_WRITEDATA;
diff -urN linux-2.5.67-bk5/drivers/s390/char/sclp_tty.c linux-2.5.67-bk6/drivers/s390/char/sclp_tty.c
--- linux-2.5.67-bk5/drivers/s390/char/sclp_tty.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/char/sclp_tty.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,7 +9,7 @@
  */
 
 #include <linux/config.h>
-#include <linux/version.h>
+#include <linux/module.h>
 #include <linux/kmod.h>
 #include <linux/tty.h>
 #include <linux/tty_driver.h>
@@ -81,9 +81,6 @@
 static int
 sclp_tty_open(struct tty_struct *tty, struct file *filp)
 {
-	/* only 1 SCLP terminal supported */
-	if (minor(tty->device) != tty->driver.minor_start)
-		return -ENODEV;
 	sclp_tty = tty;
 	tty->driver_data = NULL;
 	tty->low_latency = 0;
@@ -94,9 +91,6 @@
 static void
 sclp_tty_close(struct tty_struct *tty, struct file *filp)
 {
-	/* only 1 SCLP terminal supported */
-	if (minor(tty->device) != tty->driver.minor_start)
-		return;
 	if (tty->count > 1)
 		return;
 	sclp_tty = NULL;
@@ -294,8 +288,15 @@
 static inline void
 __sclp_ttybuf_emit(struct sclp_buffer *buffer)
 {
+	unsigned long flags;
+	int count;
+
+	spin_lock_irqsave(&sclp_tty_lock, flags);
 	list_add_tail(&buffer->list, &sclp_tty_outqueue);
-	if (sclp_tty_buffer_count++ == 0)
+	count = sclp_tty_buffer_count++;
+	spin_unlock_irqrestore(&sclp_tty_lock, flags);
+
+	if (count == 0)
 		sclp_emit_buffer(buffer, sclp_ttybuf_callback);
 }
 
@@ -307,13 +308,16 @@
 sclp_tty_timeout(unsigned long data)
 {
 	unsigned long flags;
+	struct sclp_buffer *buf;
 
 	spin_lock_irqsave(&sclp_tty_lock, flags);
-	if (sclp_ttybuf != NULL) {
-		__sclp_ttybuf_emit(sclp_ttybuf);
-		sclp_ttybuf = NULL;
-	}
+	buf = sclp_ttybuf;
+	sclp_ttybuf = NULL;
 	spin_unlock_irqrestore(&sclp_tty_lock, flags);
+
+	if (buf != NULL) {
+		__sclp_ttybuf_emit(buf);
+	}
 }
 
 /*
@@ -325,6 +329,7 @@
 	unsigned long flags;
 	void *page;
 	int written;
+	struct sclp_buffer *buf;
 
 	if (count <= 0)
 		return;
@@ -353,8 +358,11 @@
 		 * output buffer. Emit the buffer, create a new buffer
 		 * and then output the rest of the string.
 		 */
-		__sclp_ttybuf_emit(sclp_ttybuf);
+		buf = sclp_ttybuf;
 		sclp_ttybuf = NULL;
+		spin_unlock_irqrestore(&sclp_tty_lock, flags);
+		__sclp_ttybuf_emit(buf);
+		spin_lock_irqsave(&sclp_tty_lock, flags);
 		str += written;
 		count -= written;
 	} while (count > 0);
@@ -466,7 +474,8 @@
 /*
  * push input to tty
  */
-static void sclp_tty_input(unsigned char* buf, unsigned int count)
+static void
+sclp_tty_input(unsigned char* buf, unsigned int count)
 {
 	unsigned int cchar;
 
@@ -706,15 +715,21 @@
 {
 	void *page;
 	int i;
+	int rc;
 
 	if (!CONSOLE_IS_SCLP)
 		return;
-	if (sclp_rw_init() != 0)
+	rc = sclp_rw_init();
+	if (rc != 0) {
+		printk(KERN_ERR SCLP_TTY_PRINT_HEADER
+		       "could not register tty - "
+		       "sclp_rw_init returned %d\n", rc);
 		return;
+	}
 	/* Allocate pages for output buffering */
 	INIT_LIST_HEAD(&sclp_tty_pages);
 	for (i = 0; i < MAX_KMEM_PAGES; i++) {
-		page = (void *) get_zeroed_page(GFP_KERNEL);
+		page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 		if (page == NULL)
 			return;
 		list_add_tail((struct list_head *) page, &sclp_tty_pages);
@@ -744,7 +759,7 @@
 	memset (&sclp_tty_driver, 0, sizeof(struct tty_driver));
 	sclp_tty_driver.magic = TTY_DRIVER_MAGIC;
 	sclp_tty_driver.owner = THIS_MODULE;
-	sclp_tty_driver.driver_name = "tty_sclp";
+	sclp_tty_driver.driver_name = "sclp_line";
 	sclp_tty_driver.name = "ttyS";
 	sclp_tty_driver.name_base = 0;
 	sclp_tty_driver.major = TTY_MAJOR;
@@ -795,9 +810,9 @@
 	sclp_tty_driver.read_proc = NULL;
 	sclp_tty_driver.write_proc = NULL;
 
-	if (tty_register_driver(&sclp_tty_driver))
-		panic("Couldn't register sclp_tty driver\n");
+	rc = tty_register_driver(&sclp_tty_driver);
+	if (rc != 0)
+		printk(KERN_ERR SCLP_TTY_PRINT_HEADER
+		       "could not register tty - "
+		       "sclp_drv_register returned %d\n", rc);
 }
-
-console_initcall(sclp_tty_init);
-
diff -urN linux-2.5.67-bk5/drivers/s390/cio/airq.c linux-2.5.67-bk6/drivers/s390/cio/airq.c
--- linux-2.5.67-bk5/drivers/s390/cio/airq.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/airq.c	2003-04-15 04:36:16.000000000 -0700
@@ -2,7 +2,7 @@
  *  drivers/s390/cio/airq.c
  *   S/390 common I/O routines -- support for adapter interruptions
  *
- *   $Revision: 1.10 $
+ *   $Revision: 1.11 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -87,14 +87,14 @@
 }
 
 void
-do_adapter_IO (__u32 intparm)
+do_adapter_IO (void)
 {
 	CIO_TRACE_EVENT (4, "doaio");
 
 	spin_lock (&adapter_lock);
 
 	if (adapter_handler)
-		(*adapter_handler) (intparm);
+		(*adapter_handler) ();
 
 	spin_unlock (&adapter_lock);
 
diff -urN linux-2.5.67-bk5/drivers/s390/cio/airq.h linux-2.5.67-bk6/drivers/s390/cio/airq.h
--- linux-2.5.67-bk5/drivers/s390/cio/airq.h	2003-04-07 10:32:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/airq.h	2003-04-15 04:36:16.000000000 -0700
@@ -1,10 +1,10 @@
 #ifndef S390_AINTERRUPT_H
 #define S390_AINTERRUPT_H
 
-typedef	int (*adapter_int_handler_t)(__u32 intparm);
+typedef	int (*adapter_int_handler_t)(void);
 
 extern int s390_register_adapter_interrupt(adapter_int_handler_t handler);
 extern int s390_unregister_adapter_interrupt(adapter_int_handler_t handler);
-extern void do_adapter_IO (__u32 intparm);
+extern void do_adapter_IO (void);
 
 #endif
diff -urN linux-2.5.67-bk5/drivers/s390/cio/chsc.c linux-2.5.67-bk6/drivers/s390/cio/chsc.c
--- linux-2.5.67-bk5/drivers/s390/cio/chsc.c	2003-04-07 10:31:43.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/chsc.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/chsc.c
  *   S/390 common I/O routines -- channel subsystem call
- *   $Revision: 1.57 $
+ *   $Revision: 1.67 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -76,53 +76,77 @@
 chsc_get_sch_desc_irq(int irq)
 {
 	int ccode, chpid, j;
+	int ret;
 
-	/* FIXME: chsc_area_sei cannot be on the stack since it needs to
-	 * be page-aligned. Implement proper locking or dynamic
-	 * allocation or prove that this function does not have to be
-	 * reentrant! */
-	static struct ssd_area chsc_area_ssd 
-		__attribute__ ((aligned(PAGE_SIZE)));
-
-	typeof (chsc_area_ssd.response_block)
-		*ssd_res = &chsc_area_ssd.response_block;
-
-	chsc_area_ssd = (struct ssd_area) {
-		.request_block = {
-			.command_code1 = 0x0010,
-			.command_code2 = 0x0004,
-			.f_sch = irq,
-			.l_sch = irq,
-		}
+	struct {
+		struct chsc_header request;
+		u16 reserved1;
+		u16 f_sch;	  /* first subchannel */
+		u16 reserved2;
+		u16 l_sch;	  /* last subchannel */
+		u32 reserved3;
+		struct chsc_header response;
+		u32 reserved4;
+		u8 sch_valid : 1;
+		u8 dev_valid : 1;
+		u8 st	     : 3; /* subchannel type */
+		u8 zeroes    : 3;
+		u8  unit_addr;	  /* unit address */
+		u16 devno;	  /* device number */
+		u8 path_mask;
+		u8 fla_valid_mask;
+		u16 sch;	  /* subchannel */
+		u8 chpid[8];	  /* chpids 0-7 */
+		u16 fla[8];	  /* full link addresses 0-7 */
+	} *ssd_area;
+
+	ssd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	if (!ssd_area) {
+		CIO_CRW_EVENT(0, "No memory for ssd area!\n");
+		return -ENOMEM;
+	}
+
+	ssd_area->request = (struct chsc_header) {
+		.length = 0x0010,
+		.code   = 0x0004,
 	};
 
-	ccode = chsc(&chsc_area_ssd);
+	ssd_area->f_sch = irq;
+	ssd_area->l_sch = irq;
+
+	ccode = chsc(ssd_area);
 	if (ccode > 0) {
 		pr_debug("chsc returned with ccode = %d\n", ccode);
-		if (ccode == 3)
-			return -ENODEV;
-		return -EBUSY;
+		ret = (ccode == 3) ? -ENODEV : -EBUSY;
+		goto out;
 	}
 
-	switch (chsc_area_ssd.response_block.response_code) {
+	switch (ssd_area->response.code) {
 	case 0x0001: /* everything ok */
+		ret = 0;
 		break;
 	case 0x0002:
 		CIO_CRW_EVENT(2, "Invalid command!\n");
 	case 0x0003:
 		CIO_CRW_EVENT(2, "Error in chsc request block!\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		break;
 	case 0x0004:
 		CIO_CRW_EVENT(2, "Model does not provide ssd\n");
-		return -EOPNOTSUPP;
+		ret = -EOPNOTSUPP;
+		break;
 	default:
 		CIO_CRW_EVENT(2, "Unknown CHSC response %d\n",
-			      chsc_area_ssd.response_block.response_code);
-		return -EIO;
+			      ssd_area->response.code);
+		ret = -EIO;
+		break;
 	}
 
+	if (ret != 0)
+		goto out;
+
 	/*
-	 * ssd_res->st stores the type of the detected
+	 * ssd_area->st stores the type of the detected
 	 * subchannel, with the following definitions:
 	 *
 	 * 0: I/O subchannel:	  All fields have meaning
@@ -135,43 +159,45 @@
 	 *
 	 * Other types are currently undefined.
 	 */
-	if (ssd_res->st > 3) { /* uhm, that looks strange... */
+	if (ssd_area->st > 3) { /* uhm, that looks strange... */
 		CIO_CRW_EVENT(0, "Strange subchannel type %d"
-			      " for sch %x\n", ssd_res->st, irq);
+			      " for sch %x\n", ssd_area->st, irq);
 		/*
 		 * There may have been a new subchannel type defined in the
 		 * time since this code was written; since we don't know which
 		 * fields have meaning and what to do with it we just jump out
 		 */
-		return 0;
+		goto out;
 	} else {
-		const char type[4][8] = {"I/O", "chsc", "message", "ADM"};
+		const char *type[4] = {"I/O", "chsc", "message", "ADM"};
 		CIO_CRW_EVENT(6, "ssd: sch %x is %s subchannel\n",
-			      irq, type[ssd_res->st]);
+			      irq, type[ssd_area->st]);
 		if (ioinfo[irq] == NULL)
 			/* FIXME: we should do device rec. here... */
-			return 0;
+			goto out;
 
 		ioinfo[irq]->ssd_info.valid = 1;
-		ioinfo[irq]->ssd_info.type = ssd_res->st;
+		ioinfo[irq]->ssd_info.type = ssd_area->st;
 	}
 
-	if (ssd_res->st == 0 || ssd_res->st == 2) {
+	if (ssd_area->st == 0 || ssd_area->st == 2) {
 		for (j = 0; j < 8; j++) {
-			if (!((0x80 >> j) & ssd_res->path_mask &
-			      ssd_res->fla_valid_mask))
+			if (!((0x80 >> j) & ssd_area->path_mask &
+			      ssd_area->fla_valid_mask))
 				continue;
-			chpid = ssd_res->chpid[j];
+			chpid = ssd_area->chpid[j];
 			if (chpid
 			    && (!test_and_set_bit (chpid, chpids_known))
 			    && (test_bit (chpid, chpids_logical)))
 				set_bit	 (chpid, chpids);
 
 			ioinfo[irq]->ssd_info.chpid[j] = chpid;
-			ioinfo[irq]->ssd_info.fla[j]   = ssd_res->fla[j];
+			ioinfo[irq]->ssd_info.fla[j]   = ssd_area->fla[j];
 		}
 	}
-	return 0;
+out:
+	free_page ((unsigned long) ssd_area);
+	return ret;
 }
 
 static int
@@ -216,6 +242,7 @@
 s390_subchannel_remove_chpid(struct subchannel *sch, __u8 chpid)
 {
 	int j;
+	int mask;
 
 	for (j = 0; j < 8; j++)
 		if (sch->schib.pmcw.chpid[j] == chpid)
@@ -223,16 +250,68 @@
 	if (j >= 8)
 		return;
 
+	mask = 0x80 >> j;
 	spin_lock(&sch->lock);
 
 	chsc_validate_chpids(sch);
 
-	/* just to be sure... */
-	sch->lpm &= ~(0x80>>j);
+	stsch(sch->irq, &sch->schib);
+	if (sch->vpm == mask) {
+		dev_fsm_event(sch->dev.driver_data, DEV_EVENT_NOTOPER);
+		goto out_unlock;
+	}
+	if ((sch->schib.scsw.actl & (SCSW_ACTL_CLEAR_PEND |
+				     SCSW_ACTL_HALT_PEND |
+				     SCSW_ACTL_START_PEND |
+				     SCSW_ACTL_RESUME_PEND)) &&
+	    (sch->schib.pmcw.lpum == mask)) {
+		int cc = cio_cancel(sch);
+		
+		if (cc == -ENODEV) {
+			dev_fsm_event(sch->dev.driver_data, DEV_EVENT_NOTOPER);
+			goto out_unlock;
+		}
+
+		if (cc == -EINVAL) {
+			struct ccw_device *cdev;
+
+			cc = cio_clear(sch);
+			if (cc == -ENODEV) {
+				dev_fsm_event(sch->dev.driver_data,
+					      DEV_EVENT_NOTOPER);
+				goto out_unlock;
+			}
+			/* Call handler. */
+			cdev = sch->dev.driver_data;
+			cdev->private->state = DEV_STATE_CLEAR_VERIFY;
+			if (cdev->handler)
+				cdev->handler(cdev, cdev->private->intparm,
+					      ERR_PTR(-EIO));
+			goto out_unlock;
+		}
+	} else if ((sch->schib.scsw.actl & SCSW_ACTL_DEVACT) &&
+		   (sch->schib.scsw.actl & SCSW_ACTL_SCHACT) &&
+		   (sch->schib.pmcw.lpum == mask)) {
+		struct ccw_device *cdev;
+		int cc;
+
+		cc = cio_clear(sch);
+		if (cc == -ENODEV) {
+			dev_fsm_event(sch->dev.driver_data, DEV_EVENT_NOTOPER);
+			goto out_unlock;
+		}
+		/* Call handler. */
+		cdev = sch->dev.driver_data;
+		cdev->private->state = DEV_STATE_CLEAR_VERIFY;
+		if (cdev->handler)
+			cdev->handler(cdev, cdev->private->intparm,
+				      ERR_PTR(-EIO));
+		goto out_unlock;
+	}
 
 	/* trigger path verification. */
 	dev_fsm_event(sch->dev.driver_data, DEV_EVENT_VERIFY);
-
+out_unlock:
 	spin_unlock(&sch->lock);
 }
 
@@ -265,7 +344,7 @@
 		sch = ioinfo[irq];
 		if (sch == NULL)
 			continue;  /* we don't know the device anyway */
-		/* FIXME: Kill pending I/O. */
+
 		s390_subchannel_remove_chpid(sch, chpid);
 	}
 #endif
@@ -349,7 +428,7 @@
 	if (!test_bit(chpid, chpids_logical))
 		return; /* no need to do the rest */
 
-	for (irq = 0; irq <= __MAX_SUBCHANNELS; irq++) {
+	for (irq = 0; irq < __MAX_SUBCHANNELS; irq++) {
 		int chp_mask;
 
 		sch = ioinfo[irq];
@@ -369,7 +448,6 @@
 			continue;
 		}
 	
-		/* FIXME: Kill pending I/O. */
 		spin_lock_irq(&sch->lock);
 
 		chp_mask = s390_process_res_acc_sch(chpid, fla, fla_mask, sch);
@@ -402,92 +480,97 @@
 static void
 do_process_crw(void *ignore)
 {
-	int do_sei;
+	struct {
+		struct chsc_header request;
+		u32 reserved1;
+		u32 reserved2;
+		u32 reserved3;
+		struct chsc_header response;
+		u32 reserved4;
+		u8  flags;
+		u8  vf;		/* validity flags */
+		u8  rs;		/* reporting source */
+		u8  cc;		/* content code */
+		u16 fla;	/* full link address */
+		u16 rsid;	/* reporting source id */
+		u32 reserved5;
+		u32 reserved6;
+		u32 ccdf;	/* content-code dependent field */
+		u32 reserved7;
+		u32 reserved8;
+		u32 reserved9;
+	} *sei_area;
 
 	/*
 	 * build the chsc request block for store event information
 	 * and do the call
 	 */
+	sei_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
 
-	/* FIXME: chsc_area_sei cannot be on the stack since it needs to
-	 * be page-aligned. Implement proper locking or dynamic
-	 * allocation or prove that this function does not have to be
-	 * reentrant! */
-	static struct sei_area chsc_area_sei
-		__attribute__ ((aligned(PAGE_SIZE))) = {
-			.request_block = {
-				.command_code1 = 0x0010,
-				.command_code2 = 0x000e
-			}
-		};
-
-	typeof (chsc_area_sei.response_block)
-		*sei_res = &chsc_area_sei.response_block;
-
+	if (!sei_area) {
+		CIO_CRW_EVENT(0, "No memory for sei area!\n");
+		return;
+	}
 
 	CIO_TRACE_EVENT( 2, "prcss");
 
-	do_sei = 1;
-
-	while (do_sei) {
+	do {
 		int ccode;
+		memset(sei_area, 0, sizeof(*sei_area));
 
-		ccode = chsc(&chsc_area_sei);
+		sei_area->request = (struct chsc_header) {
+			.length = 0x0010,
+			.code   = 0x000e,
+		};
+
+		ccode = chsc(sei_area);
 		if (ccode > 0)
-			return;
+			goto out;
 
-		switch (sei_res->response_code) {
+		switch (sei_area->response.code) {
 			/* for debug purposes, check for problems */
 		case 0x0001:
+			CIO_CRW_EVENT(4, "chsc_process_crw: event information "
+					"successfully stored\n");
 			break; /* everything ok */
 		case 0x0002:
 			CIO_CRW_EVENT(2,
 				      "chsc_process_crw: invalid command!\n");
-			return;
+			goto out;
 		case 0x0003:
 			CIO_CRW_EVENT(2, "chsc_process_crw: error in chsc "
 				      "request block!\n");
-			return;
+			goto out;
 		case 0x0005:
 			CIO_CRW_EVENT(2, "chsc_process_crw: no event "
 				      "information stored\n");
-			return;
+			goto out;
 		default:
 			CIO_CRW_EVENT(2, "chsc_process_crw: chsc response %d\n",
-				      sei_res->response_code);
-			return;
+				      sei_area->response.code);
+			goto out;
 		}
-		
-		CIO_CRW_EVENT(4, "chsc_process_crw: event information "
-			      "successfully stored\n");
-
-		/* Check if there is more event information pending. */
-		if (sei_res->flags & 0x80)
-			CIO_CRW_EVENT( 2, "chsc_process_crw: "
-				       "further event information pending\n");
-		else
-			do_sei = 0;
 
 		/* Check if we might have lost some information. */
-		if (sei_res->flags & 0x40)
-			CIO_CRW_EVENT( 2, "chsc_process_crw: Event information "
+		if (sei_area->flags & 0x40)
+			CIO_CRW_EVENT(2, "chsc_process_crw: Event information "
 				       "has been lost due to overflow!\n");
 
-		if (sei_res->rs != 4) {
+		if (sei_area->rs != 4) {
 			CIO_CRW_EVENT(2, "chsc_process_crw: reporting source "
 				      "(%04X) isn't a chpid!\n",
-				      sei_res->rsid);
+				      sei_area->rsid);
 			continue;
 		}
-		
+
 		/* which kind of information was stored? */
-		switch (sei_res->cc) {
+		switch (sei_area->cc) {
 		case 1: /* link incident*/
 			CIO_CRW_EVENT(4, "chsc_process_crw: "
 				      "channel subsystem reports link incident,"
-				      " source is chpid %x\n", sei_res->rsid);
+				      " source is chpid %x\n", sei_area->rsid);
 			
-			s390_set_chpid_offline(sei_res->rsid);
+			s390_set_chpid_offline(sei_area->rsid);
 			break;
 			
 		case 2: /* i/o resource accessibiliy */
@@ -495,27 +578,27 @@
 				      "channel subsystem reports some I/O "
 				      "devices may have become accessible\n");
 			pr_debug("Data received after sei: \n");
-			pr_debug("Validity flags: %x\n", sei_res->vf);
+			pr_debug("Validity flags: %x\n", sei_area->vf);
 			
 			/* allocate a new channel path structure, if needed */
-			if (chps[sei_res->rsid] == NULL)
-				new_channel_path(sei_res->rsid, CHP_ONLINE);
+			if (chps[sei_area->rsid] == NULL)
+				new_channel_path(sei_area->rsid, CHP_ONLINE);
 			else
-				set_chp_status(sei_res->rsid, CHP_ONLINE);
+				set_chp_status(sei_area->rsid, CHP_ONLINE);
 			
-			if ((sei_res->vf & 0x80) == 0) {
-				pr_debug("chpid: %x\n", sei_res->rsid);
-				s390_process_res_acc(sei_res->rsid, 0, 0);
-			} else if ((sei_res->vf & 0xc0) == 0x80) {
+			if ((sei_area->vf & 0x80) == 0) {
+				pr_debug("chpid: %x\n", sei_area->rsid);
+				s390_process_res_acc(sei_area->rsid, 0, 0);
+			} else if ((sei_area->vf & 0xc0) == 0x80) {
 				pr_debug("chpid: %x link addr: %x\n",
-					 sei_res->rsid, sei_res->fla);
-				s390_process_res_acc(sei_res->rsid,
-						     sei_res->fla, 0xff00);
-			} else if ((sei_res->vf & 0xc0) == 0xc0) {
+					 sei_area->rsid, sei_area->fla);
+				s390_process_res_acc(sei_area->rsid,
+						     sei_area->fla, 0xff00);
+			} else if ((sei_area->vf & 0xc0) == 0xc0) {
 				pr_debug("chpid: %x full link addr: %x\n",
-					 sei_res->rsid, sei_res->fla);
-				s390_process_res_acc(sei_res->rsid,
-						     sei_res->fla, 0xffff);
+					 sei_area->rsid, sei_area->fla);
+				s390_process_res_acc(sei_area->rsid,
+						     sei_area->fla, 0xffff);
 			}
 			pr_debug("\n");
 			
@@ -523,15 +606,13 @@
 			
 		default: /* other stuff */
 			CIO_CRW_EVENT(4, "chsc_process_crw: event %d\n",
-				      sei_res->cc);
+				      sei_area->cc);
 			break;
 		}
-		if (do_sei) {
-			memset(&chsc_area_sei, 0, sizeof(struct sei_area));
-			chsc_area_sei.request_block.command_code1 = 0x0010;
-			chsc_area_sei.request_block.command_code2 = 0x000e;
-		}
-	}
+	} while (sei_area->flags & 0x80);
+
+out:
+	free_page((unsigned long)sei_area);
 }
 
 void
@@ -539,7 +620,7 @@
 {
 	static DECLARE_WORK(work, do_process_crw, 0);
 
-	schedule_work(&work);
+	queue_work(ccw_device_work, &work);
 }
 
 static void
@@ -555,7 +636,7 @@
 	sprintf(dbf_txt, "cadd%x", chpid);
 	CIO_TRACE_EVENT(2, dbf_txt);
 
-	for (irq = 0; irq <= __MAX_SUBCHANNELS; irq++) {
+	for (irq = 0; irq < __MAX_SUBCHANNELS; irq++) {
 		int i;
 
 		sch = ioinfo[irq];
@@ -567,7 +648,6 @@
 			continue;
 		}
 	
-		/* FIXME: Kill pending I/O. */
 		spin_lock(&sch->lock);
 		for (i=0; i<8; i++)
 			if (sch->schib.pmcw.chpid[i] == chpid) {
@@ -599,26 +679,9 @@
  * Handling of crw machine checks with channel path source.
  */
 void
-chp_process_crw(int chpid)
+chp_process_crw(int chpid, int on)
 {
-	/*
-	 * Update our descriptions. We need this since we don't always
-	 * get machine checks for path come and can't rely on our information
-	 * being consistent otherwise.
-	 */
-	chsc_get_sch_descriptions();
-	if (!cio_chsc_desc_avail) {
-		/*
-		 * Something went wrong...
-		 * We can't reliably say whether a path was there before.
-		 */
-		CIO_CRW_EVENT(0, "Error: Could not retrieve "
-			      "subchannel descriptions, will not process chp"
-			      "machine check...\n");
-		return;
-	}
-
-	if (!test_bit(chpid, chpids)) {
+	if (on == 0) {
 		/* Path has gone. We use the link incident routine.*/
 		s390_set_chpid_offline(chpid);
 	} else {
@@ -646,9 +709,6 @@
 	struct subchannel *sch;
 	int irq;
 
-	if (chpid <=0 || chpid >= NR_CHPIDS)
-		return -EINVAL;
-
 	sprintf(dbf_text, on?"varyon%x":"varyoff%x", chpid);
 	CIO_TRACE_EVENT( 2, dbf_text);
 
diff -urN linux-2.5.67-bk5/drivers/s390/cio/chsc.h linux-2.5.67-bk6/drivers/s390/cio/chsc.h
--- linux-2.5.67-bk5/drivers/s390/cio/chsc.h	2003-04-07 10:32:24.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/chsc.h	2003-04-15 04:36:16.000000000 -0700
@@ -12,85 +12,10 @@
 #define CHSC_SEI_ACC_LINKADDR     2
 #define CHSC_SEI_ACC_FULLLINKADDR 3
 
-struct sei_area {
-	struct {
-		/* word 0 */
-		__u16 command_code1;
-		__u16 command_code2;
-		/* word 1 */
-		__u32 reserved1;
-		/* word 2 */
-		__u32 reserved2;
-		/* word 3 */
-		__u32 reserved3;
-	} __attribute__ ((packed,aligned(8))) request_block;
-	struct {
-		/* word 0 */
-		__u16 length;
-		__u16 response_code;
-		/* word 1 */
-		__u32 reserved1;
-		/* word 2 */
-		__u8  flags;
-		__u8  vf;	  /* validity flags */
-		__u8  rs;	  /* reporting source */
-		__u8  cc;	  /* content code */
-		/* word 3 */
-		__u16 fla;	  /* full link address */
-		__u16 rsid;	  /* reporting source id */
-		/* word 4 */
-		__u32 reserved2;
-		/* word 5 */
-		__u32 reserved3;
-		/* word 6 */
-		__u32 ccdf;	  /* content-code dependent field */
-		/* word 7 */
-		__u32 reserved4;
-		/* word 8 */
-		__u32 reserved5;
-		/* word 9 */
-		__u32 reserved6;
-	} __attribute__ ((packed,aligned(8))) response_block;
-} __attribute__ ((packed,aligned(PAGE_SIZE)));
-
-struct ssd_area {
-	struct {
-		/* word 0 */
-		__u16 command_code1;
-		__u16 command_code2;
-		/* word 1 */
-		__u16 reserved1;
-		__u16 f_sch;	 /* first subchannel */
-		/* word 2 */
-		__u16 reserved2;
-		__u16 l_sch;	/* last subchannel */
-		/* word 3 */
-		__u32 reserved3;
-	} __attribute__ ((packed,aligned(8))) request_block;
-	struct {
-		/* word 0 */
-		__u16 length;
-		__u16 response_code;
-		/* word 1 */
-		__u32 reserved1;
-		/* word 2 */
-		__u8 sch_valid : 1;
-		__u8 dev_valid : 1;
-		__u8 st	       : 3; /* subchannel type */
-		__u8 zeroes    : 3;
-		__u8  unit_addr;  /* unit address */
-		__u16 devno;	  /* device number */
-		/* word 3 */
-		__u8 path_mask;
-		__u8 fla_valid_mask;
-		__u16 sch;	  /* subchannel */
-		/* words 4-5 */
-		__u8 chpid[8];	  /* chpids 0-7 */
-		/* words 6-9 */
-		__u16 fla[8];	  /* full link addresses 0-7 */
-	} __attribute__ ((packed,aligned(8))) response_block;
-} __attribute__ ((packed,aligned(PAGE_SIZE)));
-
+struct chsc_header {
+	u16 length;
+	u16 code;
+};
 
 struct channel_path {
 	int id;
diff -urN linux-2.5.67-bk5/drivers/s390/cio/cio.c linux-2.5.67-bk6/drivers/s390/cio/cio.c
--- linux-2.5.67-bk5/drivers/s390/cio/cio.c	2003-04-07 10:32:55.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/cio.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/cio.c
  *   S/390 common I/O routines -- low level i/o calls
- *   $Revision: 1.91 $
+ *   $Revision: 1.97 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -176,13 +176,13 @@
 	CIO_TRACE_EVENT(0, dbf_text);
 	CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
 
-	return -ENODEV;
+	return (sch->lpm ? -EACCES : -ENODEV);
 }
 
 int
 cio_start (struct subchannel *sch,	/* subchannel structure */
 	   struct ccw1 * cpa,		/* logical channel prog addr */
-	   unsigned long intparm,	/* interruption parameter */
+	   unsigned int intparm,	/* interruption parameter */
 	   __u8 lpm)			/* logical path mask */
 {
 	char dbf_txt[15];
@@ -191,7 +191,7 @@
 	sprintf (dbf_txt, "stIO%x", sch->irq);
 	CIO_TRACE_EVENT (4, dbf_txt);
 
-	sch->orb.intparm = (__u32) (long) &sch->u_intparm;
+	sch->orb.intparm = intparm;
 	sch->orb.fmt = 1;
 
 	sch->orb.pfch = sch->options.prefetch == 0;
@@ -219,7 +219,6 @@
 		/*
 		 * initialize device status information
 		 */
-		sch->u_intparm = intparm;
 		sch->schib.scsw.actl |= SCSW_ACTL_START_PEND;
 		return 0;
 	case 1:		/* status pending */
@@ -265,13 +264,10 @@
 }
 
 /*
- * Note: The "intparm" parameter is not used by the halt_IO() function
- *	 itself, as no ORB is built for the HSCH instruction. However,
- *	 it allows the device interrupt handler to associate the upcoming
- *	 interrupt with the halt_IO() request.
+ * halt I/O operation
  */
 int
-cio_halt(struct subchannel *sch, unsigned long intparm)
+cio_halt(struct subchannel *sch)
 {
 	char dbf_txt[15];
 	int ccode;
@@ -297,7 +293,6 @@
 
 	switch (ccode) {
 	case 0:
-		sch->u_intparm = intparm;
 		sch->schib.scsw.actl |= SCSW_ACTL_HALT_PEND;
 		return 0;
 	case 1:		/* status pending */
@@ -309,13 +304,10 @@
 }
 
 /*
- * Note: The "intparm" parameter is not used by the clear_IO() function
- *	 itself, as no ORB is built for the CSCH instruction. However,
- *	 it allows the device interrupt handler to associate the upcoming
- *	 interrupt with the clear_IO() request.
+ * Clear I/O operation
  */
 int
-cio_clear(struct subchannel *sch, unsigned long intparm)
+cio_clear(struct subchannel *sch)
 {
 	char dbf_txt[15];
 	int ccode;
@@ -340,7 +332,6 @@
 
 	switch (ccode) {
 	case 0:
-		sch->u_intparm = intparm;
 		sch->schib.scsw.actl |= SCSW_ACTL_CLEAR_PEND;
 		return 0;
 	default:		/* device not operational */
@@ -374,6 +365,8 @@
 
 	switch (ccode) {
 	case 0:		/* success */
+		/* Update information in scsw. */
+		stsch (sch->irq, &sch->schib);
 		return 0;
 	case 1:		/* status pending */
 		return -EBUSY;
@@ -620,7 +613,7 @@
 		 */
 		if (tpi_info->adapter_IO == 1 &&
 		    tpi_info->int_type == IO_INTERRUPT_TYPE) {
-			do_adapter_IO (tpi_info->intparm);
+			do_adapter_IO();
 			continue;
 		}
 		sch = ioinfo[tpi_info->irq];
diff -urN linux-2.5.67-bk5/drivers/s390/cio/cio.h linux-2.5.67-bk6/drivers/s390/cio/cio.h
--- linux-2.5.67-bk5/drivers/s390/cio/cio.h	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/cio.h	2003-04-15 04:36:16.000000000 -0700
@@ -98,8 +98,6 @@
 
 	__u8 vpm;		/* verified path mask */
 	__u8 lpm;		/* logical path mask */
-	// TODO: intparm for second start i/o
-	unsigned long u_intparm;	/* user interruption parameter */
 	struct schib schib;	/* subchannel information block */
 	struct orb orb;		/* operation request block */
 	struct ccw1 sense_ccw;	/* static ccw for sense command */
@@ -116,11 +114,10 @@
 extern int cio_enable_subchannel (struct subchannel *, unsigned int);
 extern int cio_disable_subchannel (struct subchannel *);
 extern int cio_cancel (struct subchannel *);
-extern int cio_clear (struct subchannel *, unsigned long);
-extern int cio_do_io (struct subchannel *, struct ccw1 *, unsigned long, __u8);
+extern int cio_clear (struct subchannel *);
 extern int cio_resume (struct subchannel *);
-extern int cio_halt (struct subchannel *, unsigned long);
-extern int cio_start (struct subchannel *, struct ccw1 *, unsigned long, __u8);
+extern int cio_halt (struct subchannel *);
+extern int cio_start (struct subchannel *, struct ccw1 *, unsigned int, __u8);
 extern int cio_cancel (struct subchannel *);
 extern int cio_set_options (struct subchannel *, int);
 extern int cio_get_options (struct subchannel *);
diff -urN linux-2.5.67-bk5/drivers/s390/cio/css.c linux-2.5.67-bk6/drivers/s390/cio/css.c
--- linux-2.5.67-bk5/drivers/s390/cio/css.c	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/css.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/css.c
  *  driver for channel subsystem
- *   $Revision: 1.40 $
+ *   $Revision: 1.43 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -41,7 +41,7 @@
 		/* There already is a struct subchannel for this irq. */
 		return -EBUSY;
 
-	sch = kmalloc (sizeof (*sch), GFP_DMA);
+	sch = kmalloc (sizeof (*sch), GFP_KERNEL | GFP_DMA);
 	if (sch == NULL)
 		return -ENOMEM;
 	ret = cio_validate_subchannel (sch, irq);
@@ -161,7 +161,7 @@
 
 	sch = ioinfo[irq];
 	if (sch == NULL) {
-		schedule_work(&work);
+		queue_work(ccw_device_work, &work);
 		return;
 	}
 	if (!sch->dev.driver_data)
@@ -172,7 +172,7 @@
 	ccode = stsch(irq, &sch->schib);
 	if (!ccode)
 		if (devno != sch->schib.pmcw.dev)
-			schedule_work(&work);
+			queue_work(ccw_device_work, &work);
 }
 
 /*
diff -urN linux-2.5.67-bk5/drivers/s390/cio/css.h linux-2.5.67-bk6/drivers/s390/cio/css.h
--- linux-2.5.67-bk5/drivers/s390/cio/css.h	2003-04-07 10:33:04.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/css.h	2003-04-15 04:36:16.000000000 -0700
@@ -79,6 +79,7 @@
 		unsigned int esid:1;        /* Ext. SenseID supported by HW */
 		unsigned int dosense:1;	    /* delayed SENSE required */
 	} __attribute__((packed)) flags;
+	unsigned long intparm;	/* user interruption parameter */
 	struct qdio_irq *qdio_data;
 	struct irb irb;		/* device status */
 	struct senseid senseid;	/* SenseID info */
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device.c linux-2.5.67-bk6/drivers/s390/cio/device.c
--- linux-2.5.67-bk5/drivers/s390/cio/device.c	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/device.c
  *  bus driver for ccw devices
- *   $Revision: 1.50 $
+ *   $Revision: 1.53 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/device.h>
+#include <linux/workqueue.h>
 
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
@@ -126,14 +127,32 @@
 	.irq = io_subchannel_irq,
 };
 
+struct workqueue_struct *ccw_device_work;
+static wait_queue_head_t ccw_device_init_wq;
+static atomic_t ccw_device_init_count;
+
 static int __init
 init_ccw_bus_type (void)
 {
 	int ret;
+
+	init_waitqueue_head(&ccw_device_init_wq);
+	atomic_set(&ccw_device_init_count, 0);
+
+	ccw_device_work = create_workqueue("cio");
+	if (!ccw_device_work)
+		return -ENOMEM; /* FIXME: better errno ? */
+
 	if ((ret = bus_register (&ccw_bus_type)))
 		return ret;
 
-	return driver_register(&io_subchannel_driver.drv);
+	if ((ret = driver_register(&io_subchannel_driver.drv)))
+		return ret;
+
+	wait_event(ccw_device_init_wq,
+		   atomic_read(&ccw_device_init_count) == 0);
+	flush_workqueue(ccw_device_work);
+	return 0;
 }
 
 static void __exit
@@ -141,6 +160,7 @@
 {
 	driver_unregister(&io_subchannel_driver.drv);
 	bus_unregister(&ccw_bus_type);
+	destroy_workqueue(ccw_device_work);
 }
 
 subsys_initcall(init_ccw_bus_type);
@@ -360,7 +380,7 @@
 /*
  * Register recognized device.
  */
-void
+static void
 io_subchannel_register(void *data)
 {
 	struct ccw_device *cdev;
@@ -389,6 +409,42 @@
 	put_device(&sch->dev);
 }
 
+/*
+ * subchannel recognition done. Called from the state machine.
+ */
+void
+io_subchannel_recog_done(struct ccw_device *cdev)
+{
+	struct subchannel *sch;
+
+	if (css_init_done == 0)
+		return;
+	switch (cdev->private->state) {
+	case DEV_STATE_NOT_OPER:
+		/* Remove device found not operational. */
+		sch = to_subchannel(cdev->dev.parent);
+		sch->dev.driver_data = 0;
+		put_device(&sch->dev);
+		if (cdev->dev.release)
+			cdev->dev.release(&cdev->dev);
+		break;
+	case DEV_STATE_OFFLINE:
+		/* 
+		 * We can't register the device in interrupt context so
+		 * we schedule a work item.
+		 */
+		INIT_WORK(&cdev->private->kick_work,
+			  io_subchannel_register, (void *) cdev);
+		queue_work(ccw_device_work, &cdev->private->kick_work);
+		break;
+	case DEV_STATE_BOXED:
+		/* Device did not respond in time. */
+		break;
+	}
+	if (atomic_dec_and_test(&ccw_device_init_count))
+		wake_up(&ccw_device_init_wq);
+}
+
 static void
 io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
 {
@@ -419,6 +475,9 @@
 	/* Do first half of device_register. */
 	device_initialize(&cdev->dev);
 
+	/* Increase counter of devices currently in recognition. */
+	atomic_inc(&ccw_device_init_count);
+
 	/* Start async. device sensing. */
 	spin_lock_irq(cdev->ccwlock);
 	rc = ccw_device_recognition(cdev);
@@ -428,6 +487,8 @@
 		put_device(&sch->dev);
 		if (cdev->dev.release)
 			cdev->dev.release(&cdev->dev);
+		if (atomic_dec_and_test(&ccw_device_init_count))
+			wake_up(&ccw_device_init_wq);
 	}
 }
 
@@ -452,7 +513,8 @@
 	if (!cdev)
 		return -ENOMEM;
 	memset(cdev, 0, sizeof(struct ccw_device));
-	cdev->private = kmalloc(sizeof(struct ccw_device_private), GFP_DMA);
+	cdev->private = kmalloc(sizeof(struct ccw_device_private), 
+				GFP_KERNEL | GFP_DMA);
 	if (!cdev->private) {
 		kfree(cdev);
 		return -ENOMEM;
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device.h linux-2.5.67-bk6/drivers/s390/cio/device.h
--- linux-2.5.67-bk5/drivers/s390/cio/device.h	2003-04-07 10:32:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device.h	2003-04-15 04:36:16.000000000 -0700
@@ -14,13 +14,11 @@
 	DEV_STATE_W4SENSE,
 	DEV_STATE_DISBAND_PGID,
 	DEV_STATE_BOXED,
-	/* special states for qdio */
-	DEV_STATE_QDIO_INIT,
-	DEV_STATE_QDIO_ACTIVE,
-	DEV_STATE_QDIO_CLEANUP,
 	/* states to wait for i/o completion before doing something */
 	DEV_STATE_ONLINE_VERIFY,
 	DEV_STATE_W4SENSE_VERIFY,
+	DEV_STATE_CLEAR_VERIFY,
+	DEV_STATE_TIMEOUT_KILL,
 	/* last element! */
 	NR_DEV_STATES
 };
@@ -63,7 +61,9 @@
 		cdev->private->state == DEV_STATE_BOXED);
 }
 
-void io_subchannel_register(void *data);
+extern struct workqueue_struct *ccw_device_work;
+
+void io_subchannel_recog_done(struct ccw_device *cdev);
 
 int ccw_device_recognition(struct ccw_device *);
 int ccw_device_online(struct ccw_device *);
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device_fsm.c linux-2.5.67-bk6/drivers/s390/cio/device_fsm.c
--- linux-2.5.67-bk5/drivers/s390/cio/device_fsm.c	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device_fsm.c	2003-04-15 04:36:16.000000000 -0700
@@ -81,14 +81,14 @@
 	if (!(sch->schib.scsw.actl & SCSW_ACTL_CLEAR_PEND)) {
 		/* Stage 2: halt io. */
 		while (cdev->private->iretry-- > 0)
-			if (cio_halt (sch, 0xC8C1D3E3) == 0)
+			if (cio_halt (sch) == 0)
 				return -EBUSY;
 		/* halt io unsuccessful. */
 		cdev->private->iretry = 255;	/* 255 clear retries. */
 	}
 	/* Stage 3: clear io. */
 	while (cdev->private->iretry-- > 0)
-		if (cio_clear (sch, 0x40C3D3D9) == 0)
+		if (cio_clear (sch) == 0)
 			return -EBUSY;
 	panic("Can't stop i/o on subchannel.\n");
 }
@@ -112,10 +112,6 @@
 		CIO_DEBUG(KERN_WARNING, 2,
 			  "SenseID : unknown device %04X on subchannel %04X\n",
 			  sch->schib.pmcw.dev, sch->irq);
-		sch->dev.driver_data = 0;
-		put_device(&sch->dev);
-		if (cdev->dev.release)
-			cdev->dev.release(&cdev->dev);
 		break;
 	case DEV_STATE_OFFLINE:
 		/* fill out sense information */
@@ -131,11 +127,6 @@
 			  "%04X/%02X\n", sch->schib.pmcw.dev,
 			  cdev->id.cu_type, cdev->id.cu_model,
 			  cdev->id.dev_type, cdev->id.dev_model);
-		if (css_init_done == 0)
-			break;
-		INIT_WORK(&cdev->private->kick_work,
-			  io_subchannel_register, (void *) cdev);
-		schedule_work(&cdev->private->kick_work);
 		break;
 	case DEV_STATE_BOXED:
 		CIO_DEBUG(KERN_WARNING, 2,
@@ -143,6 +134,7 @@
 			  sch->schib.pmcw.dev, sch->irq);
 		break;
 	}
+	io_subchannel_recog_done(cdev);
 	wake_up(&cdev->private->wait_q);
 }
 
@@ -219,9 +211,6 @@
 static void
 ccw_device_recog_timeout(struct ccw_device *cdev, enum dev_event dev_event)
 {
-	struct subchannel *sch;
-
-	sch = to_subchannel(cdev->dev.parent);
 	if (ccw_device_cancel_halt_clear(cdev) == 0)
 		ccw_device_recog_done(cdev, DEV_STATE_BOXED);
 	else
@@ -349,9 +338,6 @@
 static void
 ccw_device_onoff_timeout(struct ccw_device *cdev, enum dev_event dev_event)
 {
-	struct subchannel *sch;
-
-	sch = to_subchannel(cdev->dev.parent);
 	if (ccw_device_cancel_halt_clear(cdev) == 0)
 		ccw_device_done(cdev, DEV_STATE_BOXED);
 	else
@@ -393,8 +379,8 @@
 		// FIXME: not-oper indication to device driver ?
 		ccw_device_call_handler(cdev);
 	}
-	device_unregister(&cdev->dev);
 	wake_up(&cdev->private->wait_q);
+	device_unregister(&cdev->dev);
 }
 
 /*
@@ -438,14 +424,39 @@
 	/* Accumulate status and find out if a basic sense is needed. */
 	ccw_device_accumulate_irb(cdev, irb);
 	if (cdev->private->flags.dosense) {
-		if (ccw_device_do_sense(cdev, irb) == 0)
-			cdev->private->state = DEV_STATE_W4SENSE;
+		if (ccw_device_do_sense(cdev, irb) == 0) {
+			/* Check if we have to trigger path verification. */
+			if (irb->esw.esw0.erw.pvrf)
+				cdev->private->state = DEV_STATE_W4SENSE_VERIFY;
+			else
+				cdev->private->state = DEV_STATE_W4SENSE;
+		}
 		return;
 	}
+	if (irb->esw.esw0.erw.pvrf)
+		/* Try to start path verification. */
+		ccw_device_online_verify(cdev, 0);
 	/* No basic sense required, call the handler. */
 	ccw_device_call_handler(cdev);
 }
 
+/*
+ * Got an timeout in online state.
+ */
+static void
+ccw_device_online_timeout(struct ccw_device *cdev, enum dev_event dev_event)
+{
+	ccw_device_set_timeout(cdev, 0);
+	if (ccw_device_cancel_halt_clear(cdev) != 0) {
+		ccw_device_set_timeout(cdev, 3*HZ);
+		cdev->private->state = DEV_STATE_TIMEOUT_KILL;
+		return;
+	}
+	if (cdev->handler)
+		cdev->handler(cdev, cdev->private->intparm,
+			      ERR_PTR(-ETIMEDOUT));
+}
+
 static void
 ccw_device_irq_verify(struct ccw_device *cdev, enum dev_event dev_event)
 {
@@ -491,11 +502,17 @@
 	/* Add basic sense info to irb. */
 	ccw_device_accumulate_basic_sense(cdev, irb);
 	if (cdev->private->flags.dosense) {
+		/* Check if we have to trigger path verification. */
+		if (irb->esw.esw0.erw.pvrf)
+			cdev->private->state = DEV_STATE_W4SENSE_VERIFY;
 		/* Another basic sense is needed. */
 		ccw_device_do_sense(cdev, irb);
 		return;
 	}
 	cdev->private->state = DEV_STATE_ONLINE;
+	if (irb->esw.esw0.erw.pvrf)
+		/* Try to start path verification. */
+		ccw_device_online_verify(cdev, 0);
 	/* Call the handler. */
 	ccw_device_call_handler(cdev);
 }
@@ -527,103 +544,68 @@
 	ccw_device_call_handler(cdev);
 }
 
-/*
- * No operation action. This is used e.g. to ignore a timeout event in
- * state offline.
- */
 static void
-ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
-{
-}
-
-/*
- * Bug operation action. 
- */
-static void
-ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
-{
-	printk(KERN_EMERG "dev_jumptable[%i][%i] == NULL\n",
-	       cdev->private->state, dev_event);
-	BUG();
-}
-
-/*
- * We've got an interrupt on establish queues. Check for errors and
- * accordingly retry or move on.
- */
-static void
-ccw_device_qdio_init_irq(struct ccw_device *cdev, enum dev_event dev_event)
+ccw_device_clear_verify(struct ccw_device *cdev, enum dev_event dev_event)
 {
 	struct irb *irb;
-	struct subchannel *sch;
 
 	irb = (struct irb *) __LC_IRB;
 	/* Check for unsolicited interrupt. */
 	if (irb->scsw.stctl ==
 	    		(SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
-		if (cdev->private->qdio_data && 
-		    cdev->private->qdio_data->establish_irq)
-			cdev->private->qdio_data->establish_irq(cdev, 0, irb);
-		wake_up(&cdev->private->wait_q);
+		if (cdev->handler)
+			cdev->handler (cdev, 0, irb);
 		return;
 	}
+	/* Accumulate status. We don't do basic sense. */
 	ccw_device_accumulate_irb(cdev, irb);
-	//FIXME: Basic sense?
-	sch = to_subchannel(cdev->dev.parent);
-	if (cdev->private->qdio_data && cdev->private->qdio_data->establish_irq)
-		cdev->private->qdio_data->establish_irq(cdev, sch->u_intparm,
-							&cdev->private->irb);
-	wake_up(&cdev->private->wait_q);
+	/* Try to start delayed device verification. */
+	ccw_device_online_verify(cdev, 0);
+	/* Note: Don't call handler for cio initiated clear! */
 }
 
-/*
- * Run into a timeout after establish queues, retry if needed.
- */
 static void
-ccw_device_qdio_init_timeout(struct ccw_device *cdev, enum dev_event dev_event)
+ccw_device_killing_irq(struct ccw_device *cdev, enum dev_event dev_event)
 {
-	ccw_device_set_timeout(cdev, 0);
-	if (cdev->private->qdio_data &&
-	    cdev->private->qdio_data->establish_timeout)
-		cdev->private->qdio_data->establish_timeout(cdev);
-	wake_up(&cdev->private->wait_q);
+	/* OK, i/o is dead now. Call interrupt handler. */
+	cdev->private->state = DEV_STATE_ONLINE;
+	if (cdev->handler)
+		cdev->handler(cdev, cdev->private->intparm,
+			      ERR_PTR(-ETIMEDOUT));
 }
 
 static void
-ccw_device_qdio_cleanup_irq(struct ccw_device *cdev,
-			    enum dev_event dev_event)
+ccw_device_killing_timeout(struct ccw_device *cdev, enum dev_event dev_event)
 {
-	struct irb *irb;
-	struct subchannel *sch;
-
-	irb = (struct irb *) __LC_IRB;
-	/* Check for unsolicited interrupt. */
-	if (irb->scsw.stctl ==
-	    		(SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
-		if (cdev->private->qdio_data && 
-		    cdev->private->qdio_data->cleanup_irq)
-			cdev->private->qdio_data->cleanup_irq(cdev, 0, irb);
-		wake_up(&cdev->private->wait_q);
+	if (ccw_device_cancel_halt_clear(cdev) != 0) {
+		ccw_device_set_timeout(cdev, 3*HZ);
 		return;
 	}
-	ccw_device_accumulate_irb(cdev, irb);
-	//FIXME: Basic sense?
-	sch = to_subchannel(cdev->dev.parent);
-	if (cdev->private->qdio_data && cdev->private->qdio_data->cleanup_irq)
-		cdev->private->qdio_data->cleanup_irq(cdev, sch->u_intparm,
-						      &cdev->private->irb);
-	wake_up(&cdev->private->wait_q);
+	//FIXME: Can we get here?
+	cdev->private->state = DEV_STATE_ONLINE;
+	if (cdev->handler)
+		cdev->handler(cdev, cdev->private->intparm,
+			      ERR_PTR(-ETIMEDOUT));
 }
 
+/*
+ * No operation action. This is used e.g. to ignore a timeout event in
+ * state offline.
+ */
 static void
-ccw_device_qdio_cleanup_timeout(struct ccw_device *cdev,
-				enum dev_event dev_event)
+ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
 {
-	ccw_device_set_timeout(cdev, 0);
-	if (cdev->private->qdio_data &&
-	    cdev->private->qdio_data->cleanup_timeout)
-		cdev->private->qdio_data->cleanup_timeout(cdev);
-	wake_up(&cdev->private->wait_q);
+}
+
+/*
+ * Bug operation action. 
+ */
+static void
+ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
+{
+	printk(KERN_EMERG "dev_jumptable[%i][%i] == NULL\n",
+	       cdev->private->state, dev_event);
+	BUG();
 }
 
 /*
@@ -663,7 +645,7 @@
 	[DEV_STATE_ONLINE] {
 		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
 		[DEV_EVENT_INTERRUPT]	ccw_device_irq,
-		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
+		[DEV_EVENT_TIMEOUT]	ccw_device_online_timeout,
 		[DEV_EVENT_VERIFY]	ccw_device_online_verify,
 	},
 	[DEV_STATE_W4SENSE] {
@@ -684,25 +666,6 @@
 		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
 		[DEV_EVENT_VERIFY]	ccw_device_nop,
 	},
-	/* special states for qdio */
-	[DEV_STATE_QDIO_INIT] {
-		[DEV_EVENT_NOTOPER]     ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]   ccw_device_qdio_init_irq,
-		[DEV_EVENT_TIMEOUT]     ccw_device_qdio_init_timeout,
-		[DEV_EVENT_VERIFY]      ccw_device_nop,
-	},
-	[DEV_STATE_QDIO_ACTIVE] {
-		[DEV_EVENT_NOTOPER]     ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]   ccw_device_irq,
-		[DEV_EVENT_TIMEOUT]     ccw_device_nop,
-		[DEV_EVENT_VERIFY]      ccw_device_nop,
-	},
-	[DEV_STATE_QDIO_CLEANUP] {
-		[DEV_EVENT_NOTOPER]     ccw_device_online_notoper,
-		[DEV_EVENT_INTERRUPT]   ccw_device_qdio_cleanup_irq,
-		[DEV_EVENT_TIMEOUT]     ccw_device_qdio_cleanup_timeout,
-		[DEV_EVENT_VERIFY]      ccw_device_nop,
-	},
 	/* states to wait for i/o completion before doing something */
 	[DEV_STATE_ONLINE_VERIFY] {
 		[DEV_EVENT_NOTOPER]	ccw_device_online_notoper,
@@ -716,6 +679,18 @@
 		[DEV_EVENT_TIMEOUT]	ccw_device_nop,
 		[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
+	},
 };
 
 /*
@@ -736,3 +711,4 @@
 	dev_fsm_event(cdev, DEV_EVENT_INTERRUPT);
 }
 
+EXPORT_SYMBOL_GPL(ccw_device_set_timeout);
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device_id.c linux-2.5.67-bk6/drivers/s390/cio/device_id.c
--- linux-2.5.67-bk5/drivers/s390/cio/device_id.c	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device_id.c	2003-04-15 04:36:16.000000000 -0700
@@ -16,6 +16,7 @@
 #include <asm/ccwdev.h>
 #include <asm/delay.h>
 #include <asm/cio.h>
+#include <asm/lowcore.h>
 
 #include "cio.h"
 #include "cio_debug.h"
@@ -198,11 +199,13 @@
 			/* 0x00E2C9C4 == ebcdic "SID" */
 			ret = cio_start (sch, cdev->private->iccws,
 					 0x00E2C9C4, cdev->private->imask);
-			/* ret is 0, -EBUSY or -ENODEV */
-			if (ret != -EBUSY)
+			/* ret is 0, -EBUSY, -EACCES or -ENODEV */
+			if (ret == -EBUSY) {
+				udelay(100);
+				continue;
+			}
+			if (ret != -EACCES)
 				return ret;
-			udelay(100);
-			continue;
 		}
 		cdev->private->imask >>= 1;
 		cdev->private->iretry = 5;
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device_ops.c linux-2.5.67-bk6/drivers/s390/cio/device_ops.c
--- linux-2.5.67-bk5/drivers/s390/cio/device_ops.c	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device_ops.c	2003-04-15 04:36:16.000000000 -0700
@@ -49,12 +49,15 @@
 		return -ENODEV;
 	if (cdev->private->state != DEV_STATE_ONLINE &&
 	    cdev->private->state != DEV_STATE_W4SENSE &&
-	    cdev->private->state != DEV_STATE_QDIO_ACTIVE)
+	    cdev->private->state != DEV_STATE_ONLINE_VERIFY &&
+	    cdev->private->state != DEV_STATE_W4SENSE_VERIFY)
 		return -EINVAL;
 	sch = to_subchannel(cdev->dev.parent);
 	if (!sch)
 		return -ENODEV;
-	ret = cio_clear(sch, intparm);
+	ret = cio_clear(sch);
+	if (ret == 0)
+		cdev->private->intparm = intparm;
 	return ret;
 }
 
@@ -67,17 +70,35 @@
 
 	if (!cdev)
 		return -ENODEV;
-	if (cdev->private->state != DEV_STATE_ONLINE &&
-	    cdev->private->state != DEV_STATE_W4SENSE &&
-	    cdev->private->state != DEV_STATE_QDIO_INIT)
-		return -EINVAL;
 	sch = to_subchannel(cdev->dev.parent);
 	if (!sch)
 		return -ENODEV;
+	if (cdev->private->state != DEV_STATE_ONLINE ||
+	    sch->schib.scsw.actl != 0)
+		return -EBUSY;
 	ret = cio_set_options (sch, flags);
 	if (ret)
 		return ret;
-	ret = cio_start (sch, cpa, intparm, lpm);
+	/* 0xe4e2c5d9 == ebcdic "USER" */
+	ret = cio_start (sch, cpa, 0xe4e2c5d9, lpm);
+	if (ret == 0)
+		cdev->private->intparm = intparm;
+	return ret;
+}
+
+int
+ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa,
+			 unsigned long intparm, __u8 lpm, unsigned long flags,
+			 int expires)
+{
+	int ret;
+
+	if (!cdev)
+		return -ENODEV;
+	ccw_device_set_timeout(cdev, expires);
+	ret = ccw_device_start(cdev, cpa, intparm, lpm, flags);
+	if (ret != 0)
+		ccw_device_set_timeout(cdev, 0);
 	return ret;
 }
 
@@ -90,12 +111,16 @@
 	if (!cdev)
 		return -ENODEV;
 	if (cdev->private->state != DEV_STATE_ONLINE &&
-	    cdev->private->state != DEV_STATE_W4SENSE)
+	    cdev->private->state != DEV_STATE_W4SENSE &&
+	    cdev->private->state != DEV_STATE_ONLINE_VERIFY &&
+	    cdev->private->state != DEV_STATE_W4SENSE_VERIFY)
 		return -EINVAL;
 	sch = to_subchannel(cdev->dev.parent);
 	if (!sch)
 		return -ENODEV;
-	ret = cio_halt(sch, intparm);
+	ret = cio_halt(sch);
+	if (ret == 0)
+		cdev->private->intparm = intparm;
 	return ret;
 }
 
@@ -106,12 +131,12 @@
 
 	if (!cdev)
 		return -ENODEV;
-	if (cdev->private->state != DEV_STATE_ONLINE &&
-	    cdev->private->state != DEV_STATE_W4SENSE)
-		return -EINVAL;
 	sch = to_subchannel(cdev->dev.parent);
 	if (!sch)
 		return -ENODEV;
+	if (cdev->private->state != DEV_STATE_ONLINE ||
+	    !(sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED))
+		return -EINVAL;
 	return cio_resume(sch);
 }
 
@@ -123,15 +148,6 @@
 {
 	struct subchannel *sch;
 	unsigned int stctl;
-	void (*handler)(struct ccw_device *, unsigned long, struct irb *);
-
-	if (cdev->private->state == DEV_STATE_QDIO_ACTIVE) {
-		if (cdev->private->qdio_data)
-			handler = cdev->private->qdio_data->handler;
-		else
-			handler = NULL;
-	} else
-		handler = cdev->handler;
 
 	sch = to_subchannel(cdev->dev.parent);
 
@@ -154,8 +170,9 @@
 	/*
 	 * Now we are ready to call the device driver interrupt handler.
 	 */
-	if (handler)
-		handler(cdev, sch->u_intparm, &cdev->private->irb);
+	if (cdev->handler)
+		cdev->handler(cdev, cdev->private->intparm,
+			      &cdev->private->irb);
 
 	/*
 	 * Clear the old and now useless interrupt response block.
@@ -192,6 +209,11 @@
 static void
 ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb)
 {
+	struct subchannel *sch;
+
+	sch = to_subchannel(cdev->dev.parent);
+	if (!IS_ERR(irb))
+		memcpy(&sch->schib.scsw, &irb->scsw, sizeof(struct scsw));
 	wake_up(&cdev->private->wait_q);
 }
 
@@ -218,8 +240,7 @@
 
 	if (!cdev)
 		return -ENODEV;
-	if (cdev->private->state != DEV_STATE_ONLINE &&
-	    cdev->private->state != DEV_STATE_W4SENSE)
+	if (cdev->private->state != DEV_STATE_ONLINE)
 		return -EINVAL;
 	if (!buffer || !length)
 		return -EINVAL;
@@ -251,7 +272,13 @@
 			wait_event(cdev->private->wait_q,
 				   sch->schib.scsw.actl == 0);
 			spin_lock_irqsave(&sch->lock, flags);
-			/* FIXME: Check if we got sensible stuff. */
+			/* Check at least for channel end / device end */
+			if ((sch->schib.scsw.dstat !=
+			     (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
+			    (sch->schib.scsw.cstat != 0)) {
+				ret = -EIO;
+				continue;
+			}
 			break;
 		}
 	}
@@ -281,8 +308,7 @@
 
 	if (!cdev)
 		return -ENODEV;
-	if (cdev->private->state != DEV_STATE_ONLINE &&
-	    cdev->private->state != DEV_STATE_W4SENSE)
+	if (cdev->private->state != DEV_STATE_ONLINE)
 		return -EINVAL;
 	if (cdev->private->flags.esid == 0)
 		return -EOPNOTSUPP;
@@ -300,7 +326,7 @@
 	if (!ciw || ciw->cmd == 0)
 		return -EOPNOTSUPP;
 
-	rcd_buf = kmalloc(ciw->count, GFP_DMA);
+	rcd_buf = kmalloc(ciw->count, GFP_KERNEL | GFP_DMA);
  	if (!rcd_buf)
 		return -ENOMEM;
  	memset (rcd_buf, 0, ciw->count);
@@ -325,7 +351,13 @@
 		spin_unlock_irqrestore(&sch->lock, flags);
 		wait_event(cdev->private->wait_q, sch->schib.scsw.actl == 0);
 		spin_lock_irqsave(&sch->lock, flags);
-		/* FIXME: Check if we got sensible stuff. */
+		/* Check at least for channel end / device end */
+		if ((sch->schib.scsw.dstat != 
+		     (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
+		    (sch->schib.scsw.cstat != 0)) {
+			ret = -EIO;
+			continue;
+		}
 		break;
 	}
 	/* Restore interrupt handler. */
@@ -363,13 +395,15 @@
 
 
 MODULE_LICENSE("GPL");
+EXPORT_SYMBOL(ccw_device_set_options);
 EXPORT_SYMBOL(ccw_device_clear);
 EXPORT_SYMBOL(ccw_device_halt);
 EXPORT_SYMBOL(ccw_device_resume);
+EXPORT_SYMBOL(ccw_device_start_timeout);
 EXPORT_SYMBOL(ccw_device_start);
 EXPORT_SYMBOL(ccw_device_get_ciw);
 EXPORT_SYMBOL(ccw_device_get_path_mask);
-EXPORT_SYMBOL (read_conf_data);
-EXPORT_SYMBOL (read_dev_chars);
+EXPORT_SYMBOL(read_conf_data);
+EXPORT_SYMBOL(read_dev_chars);
 EXPORT_SYMBOL(_ccw_device_get_subchannel_number);
 EXPORT_SYMBOL(_ccw_device_get_device_number);
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device_pgid.c linux-2.5.67-bk6/drivers/s390/cio/device_pgid.c
--- linux-2.5.67-bk5/drivers/s390/cio/device_pgid.c	2003-04-07 10:31:42.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device_pgid.c	2003-04-15 04:36:16.000000000 -0700
@@ -16,6 +16,7 @@
 #include <asm/ccwdev.h>
 #include <asm/cio.h>
 #include <asm/delay.h>
+#include <asm/lowcore.h>
 
 #include "cio.h"
 #include "cio_debug.h"
@@ -51,14 +52,23 @@
 			/* 0xe2d5c9c4 == ebcdic "SNID" */
 			ret = cio_start (sch, cdev->private->iccws, 
 					 0xE2D5C9C4, cdev->private->imask);
-			/* ret is 0, -EBUSY or -ENODEV */
-			if (ret != -EBUSY)
+			/* ret is 0, -EBUSY, -EACCES or -ENODEV */
+			if (ret == -EBUSY) {
+				CIO_MSG_EVENT(2, 
+					      "SNID - device %04X, start_io() "
+					      "reports rc : %d, retrying ...\n",
+					      sch->schib.pmcw.dev, ret);
+				udelay(100);
+				continue;
+			}
+			if (ret != -EACCES)
 				return ret;
-			CIO_MSG_EVENT(2, "SNID - device %04X, start_io() "
-				      "reports rc : %d, retrying ...\n",
-				      sch->schib.pmcw.dev, ret);
-			udelay(100);
-			continue;
+			CIO_MSG_EVENT(2, "SNID - Device %04X on Subchannel "
+				      "%04X, lpm %02X, became 'not "
+				      "operational'\n",
+				      sch->schib.pmcw.dev, sch->irq,
+				      cdev->private->imask);
+
 		}
 		cdev->private->imask >>= 1;
 		cdev->private->iretry = 5;
@@ -231,7 +241,9 @@
 		/* 0xE2D7C9C4 == ebcdic "SPID" */
 		ret = cio_start (sch, cdev->private->iccws,
 				 0xE2D7C9C4, cdev->private->imask);
-		/* ret is 0, -EBUSY or -ENODEV */
+		/* ret is 0, -EBUSY, -EACCES or -ENODEV */
+		if (ret == -EACCES)
+			break;
 		if (ret != -EBUSY)
 			return ret;
 		udelay(100);
diff -urN linux-2.5.67-bk5/drivers/s390/cio/device_status.c linux-2.5.67-bk6/drivers/s390/cio/device_status.c
--- linux-2.5.67-bk5/drivers/s390/cio/device_status.c	2003-04-07 10:31:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/device_status.c	2003-04-15 04:36:16.000000000 -0700
@@ -167,7 +167,7 @@
 
 	/* Copy authorization bit. */
 	cdev_irb->esw.esw0.erw.auth = irb->esw.esw0.erw.auth;
-	/* Copy path verification required flag. FIXME: how to verify ?? */
+	/* Copy path verification required flag. */
 	cdev_irb->esw.esw0.erw.pvrf = irb->esw.esw0.erw.pvrf;
 	/* Copy concurrent sense bit. */
 	cdev_irb->esw.esw0.erw.cons = irb->esw.esw0.erw.cons;
@@ -309,7 +309,7 @@
 	sch->sense_ccw.flags = CCW_FLAG_SLI;
 
 	/* 0xe2C5D5E2 == "SENS" in ebcdic */
-	return cio_start (sch, &sch->sense_ccw, 0xE2C5D5E2, 0);
+	return cio_start (sch, &sch->sense_ccw, 0xE2C5D5E2, 0xff);
 }
 
 /*
diff -urN linux-2.5.67-bk5/drivers/s390/cio/qdio.c linux-2.5.67-bk6/drivers/s390/cio/qdio.c
--- linux-2.5.67-bk5/drivers/s390/cio/qdio.c	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/qdio.c	2003-04-15 04:36:16.000000000 -0700
@@ -34,7 +34,6 @@
 #include <linux/module.h>
 #include <linux/init.h>
 
-#include <linux/version.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
 #include <linux/proc_fs.h>
@@ -54,8 +53,9 @@
 #include "airq.h"
 #include "qdio.h"
 #include "ioasm.h"
+#include "chsc.h"
 
-#define VERSION_QDIO_C "$Revision: 1.34 $"
+#define VERSION_QDIO_C "$Revision: 1.48 $"
 
 /****************** MODULE PARAMETER VARIABLES ********************/
 MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>");
@@ -87,7 +87,6 @@
 static debug_info_t *qdio_dbf_slsb_in;
 #endif /* QDIO_DBF_LIKE_HELL */
 
-static struct qdio_chsc_area *chsc_area;
 /* iQDIO stuff: */
 static volatile struct qdio_q *iq_list=NULL; /* volatile as it could change
 						  during a while loop */
@@ -611,16 +610,13 @@
 iqdio_is_inbound_q_done(struct qdio_q *q)
 {
 	int no_used;
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[15];
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	no_used=atomic_read(&q->number_of_buffers_used);
 
 	/* propagate the change from 82 to 80 through VM */
 	SYNC_MEMORY;
 
-#ifdef QDIO_DBF_LIKE_HELL
 	if (no_used) {
 		sprintf(dbf_text,"iqisnt%02x",no_used);
 		QDIO_DBF_TEXT4(0,trace,dbf_text);
@@ -628,7 +624,6 @@
 		QDIO_DBF_TEXT4(0,trace,"iniqisdo");
 	}
 	QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	if (!no_used)
 		return 1;
@@ -664,9 +659,7 @@
 qdio_is_inbound_q_done(struct qdio_q *q)
 {
 	int no_used;
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[15];
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	no_used=atomic_read(&q->number_of_buffers_used);
 
@@ -677,11 +670,9 @@
 	SYNC_MEMORY;
 
 	if (!no_used) {
-#ifdef QDIO_DBF_LIKE_HELL
 		QDIO_DBF_TEXT4(0,trace,"inqisdnA");
 		QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
 		QDIO_DBF_TEXT4(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 		return 1;
 	}
 
@@ -703,20 +694,16 @@
 	 * has (probably) not moved (see qdio_inbound_processing) 
 	 */
 	if (NOW>GET_SAVED_TIMESTAMP(q)+q->timing.threshold) {
-#ifdef QDIO_DBF_LIKE_HELL
 		QDIO_DBF_TEXT4(0,trace,"inqisdon");
 		QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
 		sprintf(dbf_text,"pf%02xcn%02x",q->first_to_check,no_used);
 		QDIO_DBF_TEXT4(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 		return 1;
 	} else {
-#ifdef QDIO_DBF_LIKE_HELL
 		QDIO_DBF_TEXT4(0,trace,"inqisntd");
 		QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
 		sprintf(dbf_text,"pf%02xcn%02x",q->first_to_check,no_used);
 		QDIO_DBF_TEXT4(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 		return 0;
 	}
 }
@@ -725,12 +712,10 @@
 qdio_kick_inbound_handler(struct qdio_q *q)
 {
 	int count, start, end, real_end, i;
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[15];
 
 	QDIO_DBF_TEXT4(0,trace,"kickinh");
 	QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
-#endif /* QDIO_DBF_LIKE_HELL */
 
   	start=q->first_element_to_kick;
  	real_end=q->first_to_check;
@@ -744,10 +729,8 @@
  		i=(i+1)&(QDIO_MAX_BUFFERS_PER_Q-1);
  	}
 
-#ifdef QDIO_DBF_LIKE_HELL
 	sprintf(dbf_text,"s=%2xc=%2x",start,count);
 	QDIO_DBF_TEXT4(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	if (q->state==QDIO_IRQ_STATE_ACTIVE)
 		q->handler(q->cdev,
@@ -950,13 +933,10 @@
 qdio_is_outbound_q_done(struct qdio_q *q)
 {
 	int no_used;
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[15];
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	no_used=atomic_read(&q->number_of_buffers_used);
 
-#ifdef QDIO_DBF_LIKE_HELL
 	if (no_used) {
 		sprintf(dbf_text,"oqisnt%02x",no_used);
 		QDIO_DBF_TEXT4(0,trace,dbf_text);
@@ -964,7 +944,6 @@
 		QDIO_DBF_TEXT4(0,trace,"oqisdone");
 	}
 	QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
-#endif /* QDIO_DBF_LIKE_HELL */
 	return (no_used==0);
 }
 
@@ -1015,10 +994,7 @@
 qdio_kick_outbound_handler(struct qdio_q *q)
 {
 	int start, end, real_end, count;
-	
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[15];
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	start = q->first_element_to_kick;
 	/* last_move_ftc was just updated */
@@ -1031,10 +1007,8 @@
 	QDIO_DBF_TEXT4(0,trace,"kickouth");
 	QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
 
-#ifdef QDIO_DBF_LIKE_HELL
 	sprintf(dbf_text,"s=%2xc=%2x",start,count);
 	QDIO_DBF_TEXT4(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	if (q->state==QDIO_IRQ_STATE_ACTIVE)
 		q->handler(q->cdev,QDIO_STATUS_OUTBOUND_INT|
@@ -1239,8 +1213,6 @@
 	if (irq_ptr->qdr)
 		kfree(irq_ptr->qdr);
 	kfree(irq_ptr);
-	QDIO_DBF_TEXT3(0,setup,"MOD_DEC_");
-	MOD_DEC_USE_COUNT;
 }
 
 static void
@@ -1482,7 +1454,7 @@
 }
 
 static int
-iqdio_thinint_handler(__u32 intparm)
+iqdio_thinint_handler(void)
 {
 	QDIO_DBF_TEXT4(0,trace,"thin_int");
 
@@ -1500,7 +1472,7 @@
 }
 
 static void
-qdio_set_state(struct qdio_irq *irq_ptr,int state)
+qdio_set_state(struct qdio_irq *irq_ptr, enum qdio_irq_states state)
 {
 	int i;
 	char dbf_text[15];
@@ -1570,23 +1542,90 @@
 	}
 }
 
+static void qdio_establish_handle_irq(struct ccw_device*, int, int);
+
+static inline void
+qdio_handle_activate_check(struct ccw_device *cdev, unsigned long intparm,
+			   int cstat, int dstat)
+{
+	struct qdio_irq *irq_ptr;
+	struct qdio_q *q;
+	char dbf_text[15];
+
+	irq_ptr = cdev->private->qdio_data;
+
+	QDIO_DBF_TEXT2(1, trace, "ick2");
+	sprintf(dbf_text,"%s", cdev->dev.bus_id);
+	QDIO_DBF_TEXT2(1,trace,dbf_text);
+	QDIO_DBF_HEX2(0,trace,&intparm,sizeof(int));
+	QDIO_DBF_HEX2(0,trace,&dstat,sizeof(int));
+	QDIO_DBF_HEX2(0,trace,&cstat,sizeof(int));
+	QDIO_PRINT_ERR("received check condition on activate " \
+		       "queues on device %s (cs=x%x, ds=x%x).\n",
+		       cdev->dev.bus_id, cstat, dstat);
+	if (irq_ptr->no_input_qs) {
+		q=irq_ptr->input_qs[0];
+	} else if (irq_ptr->no_output_qs) {
+		q=irq_ptr->output_qs[0];
+	} else {
+		QDIO_PRINT_ERR("oops... no queue registered for device %s!?\n",
+			       cdev->dev.bus_id);
+		goto omit_handler_call;
+	}
+	q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION|
+		   QDIO_STATUS_LOOK_FOR_ERROR,
+		   0,0,0,-1,-1,q->int_parm);
+omit_handler_call:
+	qdio_set_state(irq_ptr,QDIO_IRQ_STATE_STOPPED);
+
+}
+
+static void
+qdio_timeout_handler(struct ccw_device *cdev)
+{
+	struct qdio_irq *irq_ptr;
+	char dbf_text[15];
+
+	QDIO_DBF_TEXT2(0, trace, "qtoh");
+	sprintf(dbf_text, "%s", cdev->dev.bus_id);
+	QDIO_DBF_TEXT2(0, trace, dbf_text);
+
+	irq_ptr = cdev->private->qdio_data;
+	sprintf(dbf_text, "state:%d", irq_ptr->state);
+	QDIO_DBF_TEXT2(0, trace, dbf_text);
+
+	switch (irq_ptr->state) {
+	case QDIO_IRQ_STATE_INACTIVE:
+		QDIO_PRINT_ERR("establish queues on irq %04x: timed out\n",
+			       irq_ptr->irq);
+		QDIO_DBF_TEXT2(1,setup,"eq:timeo");
+		qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
+		break;
+	case QDIO_IRQ_STATE_CLEANUP:
+		QDIO_PRINT_INFO("Did not get interrupt on cleanup, irq=0x%x.\n",
+				irq_ptr->irq);
+		qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
+		break;
+	default:
+		BUG();
+	}
+	wake_up(&cdev->private->wait_q);
+
+}
+
 static void
 qdio_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
 {
 	struct qdio_irq *irq_ptr;
-	struct qdio_q *q;
 	int cstat,dstat;
 	char dbf_text[15];
 
-        cstat = irb->scsw.cstat;
-        dstat = irb->scsw.dstat;
-
 	QDIO_DBF_TEXT4(0, trace, "qint");
 	sprintf(dbf_text, "%s", cdev->dev.bus_id);
 	QDIO_DBF_TEXT4(0, trace, dbf_text);
 	
-	if (!intparm || !cdev) {
-		QDIO_PRINT_STUPID("got unsolicited interrupt in qdio " \
+	if (!intparm) {
+		QDIO_PRINT_ERR("got unsolicited interrupt in qdio " \
 				  "handler, device %s\n", cdev->dev.bus_id);
 		return;
 	}
@@ -1601,39 +1640,58 @@
 		return;
 	}
 
+	if (IS_ERR(irb)) {
+		/* Currently running i/o is in error. */
+		switch (PTR_ERR(irb)) {
+		case -EIO:
+			QDIO_PRINT_ERR("i/o error on device %s\n",
+				       cdev->dev.bus_id);
+			//FIXME: hm?
+			return;
+		case -ETIMEDOUT:
+			qdio_timeout_handler(cdev);
+			return;
+		default:
+			QDIO_PRINT_ERR("unknown error state %ld on device %s\n",
+				       PTR_ERR(irb), cdev->dev.bus_id);
+			return;
+		}
+	}
+
 	qdio_irq_check_sense(irq_ptr->irq, irb);
 
-	if (cstat & SCHN_STAT_PCI) {
-		qdio_handle_pci(irq_ptr);
-		return;
-	}
+	sprintf(dbf_text, "state:%d", irq_ptr->state);
+	QDIO_DBF_TEXT4(0, trace, dbf_text);
 
-	if ((cstat&~SCHN_STAT_PCI)||dstat) {
-		QDIO_DBF_TEXT2(1, trace, "ick2");
-		sprintf(dbf_text,"%s", cdev->dev.bus_id);
-		QDIO_DBF_TEXT2(1,trace,dbf_text);
-		QDIO_DBF_HEX2(0,trace,&intparm,sizeof(int));
-		QDIO_DBF_HEX2(0,trace,&dstat,sizeof(int));
-		QDIO_DBF_HEX2(0,trace,&cstat,sizeof(int));
-		QDIO_PRINT_ERR("received check condition on activate " \
-			       "queues on device %s (cs=x%x, ds=x%x).\n",
-			       cdev->dev.bus_id, cstat, dstat);
-		if (irq_ptr->no_input_qs) {
-			q=irq_ptr->input_qs[0];
-		} else if (irq_ptr->no_output_qs) {
-			q=irq_ptr->output_qs[0];
-		} else {
-			QDIO_PRINT_ERR("oops... no queue registered for " \
-				       "device %s!?\n", cdev->dev.bus_id);
-			goto omit_handler_call;
-		}
-		q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION|
-			   QDIO_STATUS_LOOK_FOR_ERROR,
-			   0,0,0,-1,-1,q->int_parm);
-	omit_handler_call:
-		qdio_set_state(irq_ptr,QDIO_IRQ_STATE_STOPPED);
-		return;
+        cstat = irb->scsw.cstat;
+        dstat = irb->scsw.dstat;
+
+	switch (irq_ptr->state) {
+	case QDIO_IRQ_STATE_INACTIVE:
+		qdio_establish_handle_irq(cdev, cstat, dstat);
+		break;
+
+	case QDIO_IRQ_STATE_CLEANUP:
+		qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
+		break;
+
+	case QDIO_IRQ_STATE_ESTABLISHED:
+	case QDIO_IRQ_STATE_ACTIVE:
+		if (cstat & SCHN_STAT_PCI) {
+			qdio_handle_pci(irq_ptr);
+			break;
+		}
+
+		if ((cstat&~SCHN_STAT_PCI)||dstat) {
+			qdio_handle_activate_check(cdev, intparm, cstat, dstat);
+			break;
+		}
+	default:
+		QDIO_PRINT_ERR("got interrupt for queues in state %d on " \
+			       "device %s?!\n",
+			       irq_ptr->state, cdev->dev.bus_id);
 	}
+	wake_up(&cdev->private->wait_q);
 
 }
 
@@ -1680,60 +1738,108 @@
 static unsigned char
 qdio_check_siga_needs(int sch)
 {
-	int resp_code,result;
+	int result;
+	unsigned char qdioac;
+
+	struct {
+		struct chsc_header request;
+		u16 reserved1;
+		u16 first_sch;
+		u16 reserved2;
+		u16 last_sch;
+		u32 reserved3;
+		struct chsc_header response;
+		u32 reserved4;
+		u8  flags;
+		u8  reserved5;
+		u16 sch;
+		u8  qfmt;
+		u8  reserved6;
+		u8  qdioac;
+		u8  sch_class;
+		u8  reserved7;
+		u8  icnt;
+		u8  reserved8;
+		u8  ocnt;
+	} *ssqd_area;
+
+	ssqd_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	if (!ssqd_area) {
+	        QDIO_PRINT_WARN("Could not get memory for chsc. Using all " \
+				"SIGAs for sch x%x.\n", sch);
+		return -1; /* all flags set */
+	}
+	ssqd_area->request = (struct chsc_header) {
+		.length = 0x0010,
+		.code   = 0x0024,
+	};
 
-	memset(chsc_area,0,sizeof(struct qdio_chsc_area));
-	chsc_area->request_block.command_code1=0x0010; /* length */
-	chsc_area->request_block.command_code2=0x0024; /* op code */
-	chsc_area->request_block.first_sch=sch;
-	chsc_area->request_block.last_sch=sch;
+	ssqd_area->first_sch = sch;
+	ssqd_area->last_sch = sch;
 
-	result=chsc(chsc_area);
+	result=chsc(ssqd_area);
 
 	if (result) {
 		QDIO_PRINT_WARN("CHSC returned cc %i. Using all " \
 				"SIGAs for sch x%x.\n",
 				result,sch);
-		return -1; /* all flags set */
+		qdioac = -1; /* all flags set */
+		goto out;
 	}
 
-	resp_code=chsc_area->request_block.operation_data_area.
-		store_qdio_data_response.response_code;
-	if (resp_code!=QDIO_CHSC_RESPONSE_CODE_OK) {
+	if (ssqd_area->response.code != QDIO_CHSC_RESPONSE_CODE_OK) {
 		QDIO_PRINT_WARN("response upon checking SIGA needs " \
 				"is 0x%x. Using all SIGAs for sch x%x.\n",
-				resp_code,sch);
-		return -1; /* all flags set */
+				ssqd_area->response.code, sch);
+		qdioac = -1; /* all flags set */
+		goto out;
 	}
-	if (
-	    (!(chsc_area->request_block.operation_data_area.
-	       store_qdio_data_response.flags&CHSC_FLAG_QDIO_CAPABILITY)) ||
-	    (!(chsc_area->request_block.operation_data_area.
-	       store_qdio_data_response.flags&CHSC_FLAG_VALIDITY)) ||
-	    (chsc_area->request_block.operation_data_area.
-	     store_qdio_data_response.sch!=sch)
-	    ) {
+	if (!(ssqd_area->flags & CHSC_FLAG_QDIO_CAPABILITY) ||
+	    !(ssqd_area->flags & CHSC_FLAG_VALIDITY) ||
+	    (ssqd_area->sch != sch)) {
 		QDIO_PRINT_WARN("huh? problems checking out sch x%x... " \
 				"using all SIGAs.\n",sch);
-		return CHSC_FLAG_SIGA_INPUT_NECESSARY |
+		qdioac = CHSC_FLAG_SIGA_INPUT_NECESSARY |
 			CHSC_FLAG_SIGA_OUTPUT_NECESSARY |
 			CHSC_FLAG_SIGA_SYNC_NECESSARY; /* worst case */
+		goto out;
 	}
 
-	return chsc_area->request_block.operation_data_area.
-		store_qdio_data_response.qdioac;
+	qdioac = ssqd_area->qdioac;
+out:
+	free_page ((unsigned long) ssqd_area);
+	return qdioac;
 }
 
-/* the chsc_area is locked by the lock in qdio_activate */
 static unsigned int
-iqdio_check_chsc_availability(void) {
+iqdio_check_chsc_availability(void)
+{
 	int result;
-	int i;
 
-	memset(chsc_area,0,sizeof(struct qdio_chsc_area));
-	chsc_area->request_block.command_code1=0x0010;
-	chsc_area->request_block.command_code2=0x0010;
-	result=chsc(chsc_area);
+	struct {
+		struct chsc_header request;
+		u32 reserved1;
+		u32 reserved2;
+		u32 reserved3;
+		struct chsc_header response;
+		u32 reserved4;
+		u32 general_char[510];
+		u32 chsc_char[518];
+	} *scsc_area;
+		
+	scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	if (!scsc_area) {
+	        QDIO_PRINT_WARN("Was not able to determine available" \
+				"CHSCs due to no memory.\n");
+		return -ENOMEM;
+	}
+
+	scsc_area->request = (struct chsc_header) {
+		.length = 0x0010,
+		.code   = 0x0010,
+	};
+
+	result=chsc(scsc_area);
 	if (result) {
 		QDIO_PRINT_WARN("Was not able to determine " \
 				"available CHSCs, cc=%i.\n",
@@ -1741,10 +1847,8 @@
 		result=-EIO;
 		goto exit;
 	}
-	result=0;
-	i=chsc_area->request_block.operation_data_area.
-		store_qdio_data_response.response_code;
-	if (i!=1) {
+
+	if (scsc_area->response.code != 1) {
 		QDIO_PRINT_WARN("Was not able to determine " \
 				"available CHSCs.\n");
 		result=-EIO;
@@ -1753,24 +1857,24 @@
 	/* 4: request block
 	 * 2: general char
 	 * 512: chsc char */
-	if ( (*(((unsigned int*)(chsc_area))+4+2+1)&0x00800000)!=0x00800000) {
+	if ((scsc_area->general_char[1] & 0x00800000) != 0x00800000) {
 		QDIO_PRINT_WARN("Adapter interruption facility not " \
 				"installed.\n");
 		result=-ENOENT;
 		goto exit;
 	}
-	if ( (*(((unsigned int*)(chsc_area))+4+512+3)&0x00180000)!=
-	     0x00180000 ) {
+	if ((scsc_area->chsc_char[2] & 0x00180000) != 0x00180000) {
 		QDIO_PRINT_WARN("Set Chan Subsys. Char. & Fast-CHSCs " \
 				"not available.\n");
 		result=-ENOENT;
 		goto exit;
 	}
 exit:
+	free_page ((unsigned long) scsc_area);
 	return result;
 }
 
-/* the chsc_area is locked by the lock in qdio_activate */
+
 static unsigned int
 iqdio_set_subchannel_ind(struct qdio_irq *irq_ptr, int reset_to_zero)
 {
@@ -1782,7 +1886,27 @@
 	unsigned int resp_code;
 	int result;
 
-	if (!irq_ptr->is_iqdio_irq) return -ENODEV;
+	struct {
+		struct chsc_header request;
+		u16 operation_code;
+		u16 reserved1;
+		u32 reserved2;
+		u32 reserved3;
+		u64 summary_indicator_addr;
+		u64 subchannel_indicator_addr;
+		u32 ks:4;
+		u32 kc:4;
+		u32 reserved4:21;
+		u32 isc:3;
+		u32 reserved5[2];
+		u32 subsystem_id;
+		u32 reserved6[1004];
+		struct chsc_header response;
+		u32 reserved7;
+	} *scssc_area;
+
+	if (!irq_ptr->is_iqdio_irq)
+		return -ENODEV;
 
 	if (reset_to_zero) {
 		real_addr_local_summary_bit=0;
@@ -1794,52 +1918,57 @@
 			virt_to_phys((volatile void *)irq_ptr->dev_st_chg_ind);
 	}
 
-	memset(chsc_area,0,sizeof(struct qdio_chsc_area));
-	chsc_area->request_block.command_code1=0x0fe0;
-	chsc_area->request_block.command_code2=0x0021;
-	chsc_area->request_block.operation_code=0;
-	chsc_area->request_block.image_id=0;
-
-	chsc_area->request_block.operation_data_area.set_chsc.
-		summary_indicator_addr=real_addr_local_summary_bit;
-	chsc_area->request_block.operation_data_area.set_chsc.
-		subchannel_indicator_addr=real_addr_dev_st_chg_ind;
-	chsc_area->request_block.operation_data_area.set_chsc.
-		ks=QDIO_STORAGE_KEY;
-	chsc_area->request_block.operation_data_area.set_chsc.
-		kc=QDIO_STORAGE_KEY;
-	chsc_area->request_block.operation_data_area.set_chsc.
-		isc=IQDIO_THININT_ISC;
-	chsc_area->request_block.operation_data_area.set_chsc.
-		subsystem_id=(1<<16)+irq_ptr->irq;
+	scssc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	if (!scssc_area) {
+		QDIO_PRINT_WARN("No memory for setting indicators on " \
+				"subchannel x%x.\n", irq_ptr->irq);
+		return -ENOMEM;
+	}
+	scssc_area->request = (struct chsc_header) {
+		.length = 0x0fe0,
+		.code   = 0x0021,
+	};
+	scssc_area->operation_code = 0;
+
+        scssc_area->summary_indicator_addr = real_addr_local_summary_bit;
+	scssc_area->subchannel_indicator_addr = real_addr_dev_st_chg_ind;
+	scssc_area->ks = QDIO_STORAGE_KEY;
+	scssc_area->kc = QDIO_STORAGE_KEY;
+	scssc_area->isc = IQDIO_THININT_ISC;
+	scssc_area->subsystem_id = (1<<16) + irq_ptr->irq;
 
-	result=chsc(chsc_area);
+	result = chsc(scssc_area);
 	if (result) {
 		QDIO_PRINT_WARN("could not set indicators on irq x%x, " \
 				"cc=%i.\n",irq_ptr->irq,result);
-		return -EIO;
+		result = -EIO;
+		goto out;
 	}
 
-	resp_code=chsc_area->response_block.response_code;
+	resp_code = scssc_area->response.code;
 	if (resp_code!=QDIO_CHSC_RESPONSE_CODE_OK) {
 		QDIO_PRINT_WARN("response upon setting indicators " \
 				"is 0x%x.\n",resp_code);
 		sprintf(dbf_text,"sidR%4x",resp_code);
 		QDIO_DBF_TEXT1(0,trace,dbf_text);
 		QDIO_DBF_TEXT1(0,setup,dbf_text);
-		ptr=&chsc_area->response_block;
+		ptr=&scssc_area->response;
 		QDIO_DBF_HEX2(1,setup,&ptr,QDIO_DBF_SETUP_LEN);
-		return -EIO;
+		result = -EIO;
+		goto out;
 	}
 
 	QDIO_DBF_TEXT2(0,setup,"setscind");
 	QDIO_DBF_HEX2(0,setup,&real_addr_local_summary_bit,
 		      sizeof(unsigned long));
 	QDIO_DBF_HEX2(0,setup,&real_addr_dev_st_chg_ind,sizeof(unsigned long));
-	return 0;
+	result = 0;
+out:
+	free_page ((unsigned long) scssc_area);
+	return result;
+
 }
 
-/* chsc_area would have to be locked if called from outside qdio_activate */
 static unsigned int
 iqdio_set_delay_target(struct qdio_irq *irq_ptr, unsigned long delay_target)
 {
@@ -1848,34 +1977,59 @@
 	void *ptr;
 	char dbf_text[15];
 
-	if (!irq_ptr->is_iqdio_irq) return -ENODEV;
+	struct {
+		struct chsc_header request;
+		u16 operation_code;
+		u16 reserved1;
+		u32 reserved2;
+		u32 reserved3;
+		u32 reserved4[2];
+		u32 delay_target;
+		u32 reserved5[1009];
+		struct chsc_header response;
+		u32 reserved6;
+	} *scsscf_area;
 
-	memset(chsc_area,0,sizeof(struct qdio_chsc_area));
-	chsc_area->request_block.command_code1=0x0fe0;
-	chsc_area->request_block.command_code2=0x1027;
-	chsc_area->request_block.operation_data_area.set_chsc_fast.
-		delay_target=delay_target<<16;
+	if (!irq_ptr->is_iqdio_irq)
+		return -ENODEV;
+
+	scsscf_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+	if (!scsscf_area) {
+		QDIO_PRINT_WARN("No memory for setting delay target on " \
+				"subchannel x%x.\n", irq_ptr->irq);
+		return -ENOMEM;
+	}
+	scsscf_area->request = (struct chsc_header) {
+		.length = 0x0fe0,
+		.code   = 0x1027,
+	};
 
-	result=chsc(chsc_area);
+	scsscf_area->delay_target = delay_target<<16;
+
+	result=chsc(scsscf_area);
 	if (result) {
 		QDIO_PRINT_WARN("could not set delay target on irq x%x, " \
 				"cc=%i. Continuing.\n",irq_ptr->irq,result);
-		return -EIO;
+		result = -EIO;
+		goto out;
 	}
 
-	resp_code=chsc_area->response_block.response_code;
+	resp_code = scsscf_area->response.code;
 	if (resp_code!=QDIO_CHSC_RESPONSE_CODE_OK) {
 		QDIO_PRINT_WARN("response upon setting delay target " \
 				"is 0x%x. Continuing.\n",resp_code);
 		sprintf(dbf_text,"sdtR%4x",resp_code);
 		QDIO_DBF_TEXT1(0,trace,dbf_text);
 		QDIO_DBF_TEXT1(0,setup,dbf_text);
-		ptr=&chsc_area->response_block;
+		ptr=&scsscf_area->response;
 		QDIO_DBF_HEX2(1,trace,&ptr,QDIO_DBF_TRACE_LEN);
 	}
 	QDIO_DBF_TEXT2(0,trace,"delytrgt");
 	QDIO_DBF_HEX2(0,trace,&delay_target,sizeof(unsigned long));
-	return 0;
+	result = 0; /* not critical */
+out:
+	free_page ((unsigned long) scsscf_area);
+	return result;
 }
 
 int
@@ -1972,19 +2126,22 @@
 		ccw_device_halt(cdev, QDIO_DOING_CLEANUP);
 		timeout=QDIO_CLEANUP_HALT_TIMEOUT;
 	}
-	cdev->private->state = DEV_STATE_QDIO_CLEANUP;
+	qdio_set_state(irq_ptr, QDIO_IRQ_STATE_CLEANUP);
 	ccw_device_set_timeout(cdev, timeout);
 	spin_unlock_irqrestore(get_ccwdev_lock(cdev),flags);
 
-	wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
-
+	wait_event(cdev->private->wait_q,
+		   irq_ptr->state == QDIO_IRQ_STATE_INACTIVE ||
+		   irq_ptr->state == QDIO_IRQ_STATE_ERR);
+	/* Ignore errors. */
+	qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
 out:
 	up(&irq_ptr->setting_up_sema);
 	return result;
 }
 
 static inline void
-qdio_cleanup_finish(struct qdio_irq *irq_ptr)
+qdio_cleanup_finish(struct ccw_device *cdev, struct qdio_irq *irq_ptr)
 {
 	if (irq_ptr->is_iqdio_irq) {
 		qdio_put_indicator((__u32*)irq_ptr->dev_st_chg_ind);
@@ -1992,6 +2149,10 @@
                 /* reset adapter interrupt indicators */
 	}
 
+ 	/* exchange int handlers, if necessary */
+ 	if ((void*)cdev->handler == (void*)qdio_handler)
+ 		cdev->handler=irq_ptr->original_int_handler;
+
 	qdio_set_state(irq_ptr,QDIO_IRQ_STATE_INACTIVE);
 }
 
@@ -2014,51 +2175,16 @@
 	if (cdev->private->state != DEV_STATE_ONLINE)
 		return -EINVAL;
 
-	qdio_cleanup_finish(irq_ptr);
+	qdio_cleanup_finish(cdev, irq_ptr);
 	cdev->private->qdio_data = 0;
 
 	up(&irq_ptr->setting_up_sema);
 
 	qdio_release_irq_memory(irq_ptr);
+	module_put(THIS_MODULE);
 	return 0;
 }
 
-static void
-qdio_cleanup_handle_timeout(struct ccw_device *cdev)
-{
-	unsigned long flags;
-	struct qdio_irq *irq_ptr;
-
-	irq_ptr = cdev->private->qdio_data;
-
-	spin_lock_irqsave(get_ccwdev_lock(cdev),flags);
-	QDIO_PRINT_INFO("Did not get interrupt on cleanup, irq=0x%x.\n",
-			irq_ptr->irq);
-
-	spin_unlock_irqrestore(get_ccwdev_lock(cdev),flags);
-
-	cdev->private->state = DEV_STATE_ONLINE;
-	wake_up(&cdev->private->wait_q);
-}
-
-static void
-qdio_cleanup_handle_irq(struct ccw_device *cdev, unsigned long intparm,
-			struct irb *irb)
-{
-	struct qdio_irq *irq_ptr;
-
-	if (intparm == 0)
-		QDIO_PRINT_WARN("Got unsolicited interrupt on cleanup "
-				"(irq 0x%x).\n", cdev->private->irq);
-
-	irq_ptr = cdev->private->qdio_data;
-
-	qdio_irq_check_sense(irq_ptr->irq, irb);
-
-	cdev->private->state = DEV_STATE_ONLINE;
-	wake_up(&cdev->private->wait_q);
-}
-
 static inline void
 qdio_allocate_do_dbf(struct qdio_initialize *init_data)
 {
@@ -2134,24 +2260,6 @@
 	irq_ptr->qdr->qdf0[i+j].dkey=QDIO_STORAGE_KEY;
 }
 
-void
-qdio_establish_handle_timeout(struct ccw_device *cdev)
-{
-	struct qdio_irq *irq_ptr;
-
-	irq_ptr = cdev->private->qdio_data;
-
-	QDIO_PRINT_ERR("establish queues on irq %04x: timed out\n",
-		       irq_ptr->irq);
-	QDIO_DBF_TEXT2(1,setup,"eq:timeo");
-	/*
-	 * FIXME:
-	 * this is broken,
-	 * we are in the context of a timer interrupt and
-	 * qdio_shutdown calls schedule
-	 */
-	qdio_shutdown(cdev,QDIO_FLAG_CLEANUP_USING_CLEAR);
-}
 
 static inline void
 qdio_initialize_set_siga_flags_input(struct qdio_irq *irq_ptr)
@@ -2208,7 +2316,7 @@
 		QDIO_PRINT_ERR("received check condition on establish " \
 			       "queues on irq 0x%x (cs=x%x, ds=x%x).\n",
 			       irq_ptr->irq,cstat,dstat);
-		qdio_set_state(irq_ptr,QDIO_IRQ_STATE_STOPPED);
+		qdio_set_state(irq_ptr,QDIO_IRQ_STATE_ERR);
 	}
 	
 	if (!(dstat & DEV_STAT_DEV_END)) {
@@ -2218,13 +2326,7 @@
 		QDIO_PRINT_ERR("establish queues on irq %04x: didn't get "
 			       "device end: dstat=%02x, cstat=%02x\n",
 			       irq_ptr->irq, dstat, cstat);
-		/*
-		 * FIXME:
-		 * this is broken,
-		 * we are probably in the context of an i/o interrupt and
-		 * qdio_shutdown calls schedule
-		 */
-		qdio_shutdown(cdev,QDIO_FLAG_CLEANUP_USING_CLEAR);
+		qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
 		return 1;
 	}
 
@@ -2236,36 +2338,27 @@
 			       "the following devstat: dstat=%02x, "
 			       "cstat=%02x\n",
 			       irq_ptr->irq, dstat, cstat);
-		cdev->private->state = DEV_STATE_ONLINE;
+		qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
 		return 1;
 	}
 	return 0;
 }
 
 static void
-qdio_establish_handle_irq(struct ccw_device *cdev, unsigned long intparm,
-			  struct irb *irb)
+qdio_establish_handle_irq(struct ccw_device *cdev, int cstat, int dstat)
 {
 	struct qdio_irq *irq_ptr;
-	int cstat, dstat;
 	char dbf_text[15];
 
-        cstat = irb->scsw.cstat;
-        dstat = irb->scsw.dstat;
-
-	irq_ptr = cdev->private->qdio_data;
-
-	if (intparm == 0) {
-		QDIO_PRINT_WARN("Got unsolicited interrupt on establish "
-				"queues (irq 0x%x).\n", cdev->private->irq);
-		return;
-	}
-
-	qdio_irq_check_sense(irq_ptr->irq, irb);
+	sprintf(dbf_text,"qehi%4x",cdev->private->irq);
+	QDIO_DBF_TEXT0(0,setup,dbf_text);
+	QDIO_DBF_TEXT0(0,trace,dbf_text);
 
 	if (qdio_establish_irq_check_for_errors(cdev, cstat, dstat))
 		return;
 
+	irq_ptr = cdev->private->qdio_data;
+
 	if (MACHINE_IS_VM)
 		irq_ptr->qdioac=qdio_check_siga_needs(irq_ptr->irq);
 	else
@@ -2287,6 +2380,7 @@
 	qdio_initialize_set_siga_flags_output(irq_ptr);
 
 	qdio_set_state(irq_ptr,QDIO_IRQ_STATE_ESTABLISHED);
+
 }
 
 int
@@ -2334,7 +2428,7 @@
 	qdio_allocate_do_dbf(init_data);
 
 	/* create irq */
-	irq_ptr=kmalloc(sizeof(struct qdio_irq),GFP_DMA);
+	irq_ptr=kmalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA);
 
 	QDIO_DBF_TEXT0(0,setup,"irq_ptr:");
 	QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
@@ -2347,7 +2441,7 @@
 	memset(irq_ptr,0,sizeof(struct qdio_irq));
         /* wipes qib.ac, required by ar7063 */
 
-	irq_ptr->qdr=kmalloc(sizeof(struct qdr),GFP_DMA);
+	irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA);
   	if (!(irq_ptr->qdr)) {
    		kfree(irq_ptr->qdr);
    		kfree(irq_ptr);
@@ -2372,11 +2466,6 @@
 		if (!irq_ptr->dev_st_chg_ind) {
 			QDIO_PRINT_WARN("no indicator location available " \
 					"for irq 0x%x\n",irq_ptr->irq);
-			/*
-			 * FIXME:
-			 * qdio_release_irq_memory does MOD_DEC_USE_COUNT
-			 * in an unbalanced fashion (see 30 lines farther down)
-			 */
 			qdio_release_irq_memory(irq_ptr);
 			return -ENOBUFS;
 		}
@@ -2396,19 +2485,17 @@
 			   init_data->q_format,init_data->flags,
 			   init_data->input_sbal_addr_array,
 			   init_data->output_sbal_addr_array)) {
-		/*
-		 * FIXME:
-		 * qdio_release_irq_memory does MOD_DEC_USE_COUNT
-		 * in an unbalanced fashion (see 10 lines farther down)
-		 */
 		qdio_release_irq_memory(irq_ptr);
 		return -ENOMEM;
 	}
 
 	qdio_set_state(irq_ptr,QDIO_IRQ_STATE_INACTIVE);
 
-	MOD_INC_USE_COUNT;
-	QDIO_DBF_TEXT3(0,setup,"MOD_INC_");
+	if (!try_module_get(THIS_MODULE)) {
+		QDIO_PRINT_CRIT("try_module_get() failed!\n");
+		qdio_release_irq_memory(irq_ptr);
+		return -EINVAL;
+	}
 
 	init_MUTEX_LOCKED(&irq_ptr->setting_up_sema);
 
@@ -2474,6 +2561,10 @@
 	} else
 		irq_ptr->aqueue = *ciw;
 
+	/* Set new interrupt handler. */
+	irq_ptr->original_int_handler = init_data->cdev->handler;
+	init_data->cdev->handler = qdio_handler;
+
 	/* the iqdio CHSC stuff */
 	if (irq_ptr->is_iqdio_irq) {
 /*		iqdio_enable_adapter_int_facility(irq_ptr);*/
@@ -2485,25 +2576,12 @@
 		result=iqdio_set_subchannel_ind(irq_ptr,0);
 		if (result) {
 			up(&irq_ptr->setting_up_sema);
-			/*
-			 * FIXME:
-			 * need some callback pointers to be set already,
-			 * i.e. irq_ptr->cleanup_irq and irq_ptr->cleanup_timeout?
-			 * (see 10 lines farther down)
-			 */
 			qdio_cleanup(init_data->cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);
 			return result;
 		}
 		iqdio_set_delay_target(irq_ptr,IQDIO_DELAY_TARGET);
 	}
 
-	/* Set callback functions. */
-	irq_ptr->cleanup_irq = qdio_cleanup_handle_irq;
-	irq_ptr->cleanup_timeout = qdio_cleanup_handle_timeout;
-	irq_ptr->establish_irq = qdio_establish_handle_irq;
-	irq_ptr->establish_timeout = qdio_establish_handle_timeout;
-	irq_ptr->handler = qdio_handler;
-
 	up(&irq_ptr->setting_up_sema);
 
 	return 0;
@@ -2538,13 +2616,14 @@
 
 	spin_lock_irqsave(get_ccwdev_lock(cdev),saveflags);
 
-	ccw_device_set_timeout(cdev, QDIO_ESTABLISH_TIMEOUT);
 	ccw_device_set_options(cdev, 0);
-	result=ccw_device_start(cdev,&irq_ptr->ccw,
-				QDIO_DOING_ESTABLISH,0,0);
+	result=ccw_device_start_timeout(cdev,&irq_ptr->ccw,
+					QDIO_DOING_ESTABLISH,0,0,
+					QDIO_ESTABLISH_TIMEOUT);
 	if (result) {
-		result2=ccw_device_start(cdev,&irq_ptr->ccw,
-					 QDIO_DOING_ESTABLISH,0,0);
+		result2=ccw_device_start_timeout(cdev,&irq_ptr->ccw,
+						 QDIO_DOING_ESTABLISH,0,0,
+						 QDIO_ESTABLISH_TIMEOUT);
 		sprintf(dbf_text,"eq:io%4x",result);
 		QDIO_DBF_TEXT2(1,setup,dbf_text);
 		if (result2) {
@@ -2556,8 +2635,7 @@
                            irq_ptr->irq,result,result2);
 		result=result2;
 	}
-	if (result == 0)
-		cdev->private->state = DEV_STATE_QDIO_INIT;
+
 	spin_unlock_irqrestore(get_ccwdev_lock(cdev),saveflags);
 
 	if (result) {
@@ -2567,13 +2645,15 @@
 	}
 	
 	wait_event(cdev->private->wait_q,
-		   dev_fsm_final_state(cdev) ||
-		   (irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED));
+		   irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED ||
+		   irq_ptr->state == QDIO_IRQ_STATE_ERR);
 
-	if (cdev->private->state == DEV_STATE_QDIO_INIT)
+	if (irq_ptr->state == QDIO_IRQ_STATE_ESTABLISHED)
 		result = 0;
-	else 
+	else {
+		qdio_shutdown(cdev, QDIO_FLAG_CLEANUP_USING_CLEAR);
 		result = -EIO;
+	}
 
 	up(&irq_ptr->setting_up_sema);
 
@@ -2593,7 +2673,7 @@
 	if (!irq_ptr)
 		return -ENODEV;
 
-	if (cdev->private->state != DEV_STATE_QDIO_INIT)
+	if (cdev->private->state != DEV_STATE_ONLINE)
 		return -EINVAL;
 
 	down(&irq_ptr->setting_up_sema);
@@ -2637,8 +2717,6 @@
 	if (result)
 		goto out;
 
-	cdev->private->state = DEV_STATE_QDIO_ACTIVE;
-
 	for (i=0;i<irq_ptr->no_input_qs;i++) {
 		if (irq_ptr->is_iqdio_irq) {
 			/* 
@@ -2659,9 +2737,9 @@
 		}
 	}
 
-	qdio_wait_nonbusy(QDIO_ACTIVATE_DELAY);
+	qdio_wait_nonbusy(QDIO_ACTIVATE_TIMEOUT);
 
-	qdio_set_state(irq_ptr,QDIO_IRQ_STATE_ACTIVE);
+	qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ACTIVE);
 
  out:
 	up(&irq_ptr->setting_up_sema);
@@ -2807,12 +2885,10 @@
 {
 	struct qdio_irq *irq_ptr;
 
-#ifdef QDIO_DBF_LIKE_HELL
 	char dbf_text[20];
 
-	sprintf(dbf_text,"doQD%04x",irq);
+	sprintf(dbf_text,"doQD%04x",cdev->private->irq);
 	QDIO_DBF_TEXT3(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	if ( (qidx>QDIO_MAX_BUFFERS_PER_Q) ||
 	     (count>QDIO_MAX_BUFFERS_PER_Q) ||
@@ -2826,7 +2902,6 @@
 	if (!irq_ptr)
 		return -ENODEV;
 
-#ifdef QDIO_DBF_LIKE_HELL
 	if (callflags&QDIO_FLAG_SYNC_INPUT)
 		QDIO_DBF_HEX3(0,trace,&irq_ptr->input_qs[queue_number],
 			      sizeof(void*));
@@ -2837,7 +2912,6 @@
 	QDIO_DBF_TEXT3(0,trace,dbf_text);
 	sprintf(dbf_text,"qi%02xct%02x",qidx,count);
 	QDIO_DBF_TEXT3(0,trace,dbf_text);
-#endif /* QDIO_DBF_LIKE_HELL */
 
 	if (irq_ptr->state!=QDIO_IRQ_STATE_ACTIVE)
 		return -EBUSY;
@@ -2989,25 +3063,12 @@
 				   GFP_KERNEL);
        	if (!indicators) return -ENOMEM;
 	memset(indicators,0,sizeof(__u32)*(INDICATORS_PER_CACHELINE));
-
-	chsc_area=(struct qdio_chsc_area *)
-		kmalloc(sizeof(struct qdio_chsc_area),GFP_KERNEL);
-	QDIO_DBF_TEXT3(0,trace,"chscarea"); \
-	QDIO_DBF_HEX3(0,trace,&chsc_area,sizeof(void*)); \
-	if (!chsc_area) {
-		QDIO_PRINT_ERR("not enough memory for chsc area. Cannot " \
-			       "initialize QDIO.\n");
-		kfree(indicators);
-		return -ENOMEM;
-	}
-	memset(chsc_area,0,sizeof(struct qdio_chsc_area));
 	return 0;
 }
 
 static void
 qdio_release_qdio_memory(void)
 {
-	kfree(chsc_area);
 	if (indicators)
 		kfree(indicators);
 }
diff -urN linux-2.5.67-bk5/drivers/s390/cio/qdio.h linux-2.5.67-bk6/drivers/s390/cio/qdio.h
--- linux-2.5.67-bk5/drivers/s390/cio/qdio.h	2003-04-07 10:30:45.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/qdio.h	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 #ifndef _CIO_QDIO_H
 #define _CIO_QDIO_H
 
-#define VERSION_CIO_QDIO_H "$Revision: 1.11 $"
+#define VERSION_CIO_QDIO_H "$Revision: 1.16 $"
 
 //#define QDIO_DBF_LIKE_HELL
 
@@ -48,25 +48,25 @@
 #define QDIO_STATS_CLASSES 2
 #define QDIO_STATS_COUNT_NEEDED 2*/
 
-#define QDIO_ACTIVATE_DELAY 5 /* according to brenton belmar and paul
-				 gioquindo it can take up to 5ms before
-				 queues are really active */
-
 #define QDIO_NO_USE_COUNT_TIME 10
 #define QDIO_NO_USE_COUNT_TIMEOUT 1000 /* wait for 1 sec on each q before
 					  exiting without having use_count
 					  of the queue to 0 */
 
 #define QDIO_ESTABLISH_TIMEOUT 1000
-#define QDIO_ACTIVATE_TIMEOUT 100
+#define QDIO_ACTIVATE_TIMEOUT 5
 #define QDIO_CLEANUP_CLEAR_TIMEOUT 20000
 #define QDIO_CLEANUP_HALT_TIMEOUT 10000
 
-#define QDIO_IRQ_STATE_FRESH 0 /* must be 0 -> memset has set it to 0 */
-#define QDIO_IRQ_STATE_INACTIVE 1
-#define QDIO_IRQ_STATE_ESTABLISHED 2
-#define QDIO_IRQ_STATE_ACTIVE 3
-#define QDIO_IRQ_STATE_STOPPED 4
+enum qdio_irq_states {
+	QDIO_IRQ_STATE_INACTIVE,
+	QDIO_IRQ_STATE_ESTABLISHED,
+	QDIO_IRQ_STATE_ACTIVE,
+	QDIO_IRQ_STATE_STOPPED,
+	QDIO_IRQ_STATE_CLEANUP,
+	QDIO_IRQ_STATE_ERR,
+	NR_QDIO_IRQ_STATES,
+};
 
 /* used as intparm in do_IO: */
 #define QDIO_DOING_SENSEID 0
@@ -443,81 +443,6 @@
 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_THININTS 0x08
 #define CHSC_FLAG_SIGA_SYNC_DONE_ON_OUTB_PCIS 0x04
 
-struct qdio_chsc_area {
-	struct {
-		/* word 0 */
-		__u16 command_code1;
-		__u16 command_code2;
-		/* word 1 */
-		__u16 operation_code;
-		__u16 first_sch;
-		/* word 2 */
-		__u8 reserved1;
-		__u8 image_id;
-		__u16 last_sch;
-		/* word 3 */
-		__u32 reserved2;
-
-		/* word 4 */
-		union {
-			struct {
-				/* word 4&5 */
-				__u64 summary_indicator_addr;
-				/* word 6&7 */
-				__u64 subchannel_indicator_addr;
-				/* word 8 */
-				int ks:4;
-				int kc:4;
-				int reserved1:21;
-				int isc:3;
-				/* word 9&10 */
-				__u32 reserved2[2];
-				/* word 11 */
-				__u32 subsystem_id;
-				/* word 12-1015 */
-				__u32 reserved3[1004];
-			} __attribute__ ((packed,aligned(4))) set_chsc;
-			struct {
-				/* word 4&5 */
-				__u32 reserved1[2];	
-				/* word 6 */
-				__u32 delay_target;
-				/* word 7-1015 */
-				__u32 reserved4[1009];
-			} __attribute__ ((packed,aligned(4))) set_chsc_fast;
-			struct {
-				/* word 0 */
-				__u16 length;
-				__u16 response_code;
-				/* word 1 */
-				__u32 reserved1;
-				/* words 2 to 9 for st sch qdio data */
-				__u8 flags;
-				__u8 reserved2;
-				__u16 sch;
-				__u8 qfmt;
-				__u8 reserved3;
-				__u8 qdioac;
-				__u8 sch_class;
-				__u8 reserved4;
-				__u8 icnt;
-				__u8 reserved5;
-				__u8 ocnt;
-				/* plus 5 words of reserved fields */
-			} __attribute__ ((packed,aligned(8)))
-			store_qdio_data_response;
-		} operation_data_area;
-	} __attribute__ ((packed,aligned(8))) request_block;
-	struct {
-		/* word 0 */
-		__u16 length;
-		__u16 response_code;
-		/* word 1 */
-		__u32 reserved1;
-	} __attribute__ ((packed,aligned(8))) response_block;
-} __attribute__ ((packed,aligned(PAGE_SIZE)));
-
-
 #ifdef QDIO_PERFORMANCE_STATS
 struct qdio_perf_stats {
 	unsigned int tl_runs;
@@ -623,7 +548,7 @@
 	struct tasklet_struct tasklet;
 #endif /* QDIO_USE_TIMERS_FOR_POLLING */
 
-	unsigned int state;
+	enum qdio_irq_states state;
 
 	/* used to store the error condition during a data transfer */
 	unsigned int qdio_error;
@@ -674,7 +599,7 @@
 	unsigned int hydra_gives_outbound_pcis;
 	unsigned int sync_done_on_outb_pcis;
 
-	unsigned int state;
+	enum qdio_irq_states state;
 	struct semaphore setting_up_sema;
 
 	unsigned int no_input_qs;
@@ -694,13 +619,8 @@
 
 	struct qib qib;
 	
-	/* Functions called via the generic cio layer */
-	void (*cleanup_irq) (struct ccw_device *, unsigned long, struct irb *);
-	void (*cleanup_timeout) (struct ccw_device *);
-	void (*establish_irq) (struct ccw_device *, unsigned long,
-			       struct irb *);
-	void (*establish_timeout) (struct ccw_device *);
-	void (*handler) (struct ccw_device *, unsigned long, struct irb *);
+ 	void (*original_int_handler) (struct ccw_device *,
+ 				      unsigned long, struct irb *);
 
 };
 #endif
diff -urN linux-2.5.67-bk5/drivers/s390/cio/requestirq.c linux-2.5.67-bk6/drivers/s390/cio/requestirq.c
--- linux-2.5.67-bk5/drivers/s390/cio/requestirq.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/cio/requestirq.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/requestirq.c
  *   S/390 common I/O routines -- enabling and disabling of devices
- *   $Revision: 1.42 $
+ *   $Revision: 1.44 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -14,6 +14,7 @@
 #include <linux/config.h>
 #include <linux/device.h>
 #include <linux/init.h>
+#include <asm/lowcore.h>
 
 #include "css.h"
 
@@ -44,7 +45,11 @@
 	/*
 	 * Let's build our path group ID here.
 	 */
-	global_pgid.cpu_addr = *(__u16 *) __LC_CPUADDR;
+#ifdef CONFIG_SMP
+	global_pgid.cpu_addr = hard_smp_processor_id();
+#else
+	global_pgid.cpu_addr = 0;
+#endif
 	global_pgid.cpu_id = ((cpuid_t *) __LC_CPUID)->ident;
 	global_pgid.cpu_model = ((cpuid_t *) __LC_CPUID)->machine;
 	global_pgid.tod_high = (__u32) (get_clock() >> 32);
diff -urN linux-2.5.67-bk5/drivers/s390/s390mach.c linux-2.5.67-bk6/drivers/s390/s390mach.c
--- linux-2.5.67-bk5/drivers/s390/s390mach.c	2003-04-07 10:32:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/s390/s390mach.c	2003-04-15 04:36:16.000000000 -0700
@@ -21,7 +21,7 @@
 
 extern void css_process_crw(int);
 extern void chsc_process_crw(void);
-extern void chp_process_crw(int);
+extern void chp_process_crw(int, int);
 
 static void
 s390_handle_damage(char *msg)
@@ -62,7 +62,17 @@
 			break;
 		case CRW_RSC_CPATH:
 			pr_debug("source is channel path %02X\n", crw.rsid);
-			chp_process_crw(crw.rsid);
+			switch (crw.erc) {
+			case CRW_ERC_IPARM: /* Path has come. */
+				chp_process_crw(crw.rsid, 1);
+				break;
+			case CRW_ERC_PERRI: /* Path has gone. */
+				chp_process_crw(crw.rsid, 0);
+				break;
+			default:
+				pr_debug("Don't know how to handle erc=%x\n",
+					 crw.erc);
+			}
 			break;
 		case CRW_RSC_CONFIG:
 			pr_debug("source is configuration-alert facility\n");
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/Kconfig.aic79xx linux-2.5.67-bk6/drivers/scsi/aic7xxx/Kconfig.aic79xx
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/Kconfig.aic79xx	2003-04-07 10:31:09.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/Kconfig.aic79xx	2003-04-15 04:36:16.000000000 -0700
@@ -1,6 +1,6 @@
 #
 # AIC79XX 2.5.X Kernel configuration File.
-# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#3 $
+# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic79xx#4 $
 #
 config SCSI_AIC79XX
 	tristate "Adaptec AIC79xx U320 support"
@@ -59,6 +59,7 @@
 config AIC79XX_ENABLE_RD_STRM
 	bool "Enable Read Streaming for All Targets"
 	depends on SCSI_AIC79XX
+	default n
 	help
 	Read Streaming is a U320 protocol option that should enhance
 	performance.  Early U320 drive firmware actually performs slower
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/Kconfig.aic7xxx linux-2.5.67-bk6/drivers/scsi/aic7xxx/Kconfig.aic7xxx
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/Kconfig.aic7xxx	2003-04-07 10:31:02.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/Kconfig.aic7xxx	2003-04-15 04:36:16.000000000 -0700
@@ -1,6 +1,6 @@
 #
 # AIC7XXX and AIC79XX 2.5.X Kernel configuration File.
-# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#5 $
+# $Id: //depot/linux-aic79xx-2.5.0/drivers/scsi/aic7xxx/Kconfig.aic7xxx#6 $
 #
 config SCSI_AIC7XXX
 	tristate "Adaptec AIC7xxx Fast -> U160 support (New Driver)"
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7770.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7770.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7770.c	2003-04-07 10:33:00.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7770.c	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7770.c#27 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7770.c#29 $
  *
  * $FreeBSD$
  */
@@ -59,6 +59,9 @@
 #define	ID_OLV_274x	0x04907782 /* Olivetti OEM */
 #define	ID_OLV_274xD	0x04907783 /* Olivetti OEM (Differential) */
 
+static int aic7770_chip_init(struct ahc_softc *ahc);
+static int aic7770_suspend(struct ahc_softc *ahc);
+static int aic7770_resume(struct ahc_softc *ahc);
 static int aha2840_load_seeprom(struct ahc_softc *ahc);
 static ahc_device_setup_t ahc_aic7770_VL_setup;
 static ahc_device_setup_t ahc_aic7770_EISA_setup;;
@@ -144,6 +147,12 @@
 
 	ahc->description = entry->name;
 	error = ahc_softc_init(ahc);
+	if (error != 0)
+		return (error);
+
+	ahc->bus_chip_init = aic7770_chip_init;
+	ahc->bus_suspend = aic7770_suspend;
+	ahc->bus_resume = aic7770_resume;
 
 	error = ahc_reset(ahc);
 	if (error != 0)
@@ -226,6 +235,9 @@
 	ahc_outb(ahc, BUSSPD, hostconf & DFTHRSH);
 	ahc_outb(ahc, BUSTIME, (hostconf << 2) & BOFF);
 
+	ahc->bus_softc.aic7770_softc.busspd = hostconf & DFTHRSH;
+	ahc->bus_softc.aic7770_softc.bustime = (hostconf << 2) & BOFF;
+
 	/*
 	 * Generic aic7xxx initialization.
 	 */
@@ -253,6 +265,28 @@
 	return (0);
 }
 
+static int
+aic7770_chip_init(struct ahc_softc *ahc)
+{
+	ahc_outb(ahc, BUSSPD, ahc->bus_softc.aic7770_softc.busspd);
+	ahc_outb(ahc, BUSTIME, ahc->bus_softc.aic7770_softc.bustime);
+	ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~AUTOFLUSHDIS);
+	ahc_outb(ahc, BCTL, ENABLE);
+	return (ahc_chip_init(ahc));
+}
+
+static int
+aic7770_suspend(struct ahc_softc *ahc)
+{
+	return (ahc_suspend(ahc));
+}
+
+static int
+aic7770_resume(struct ahc_softc *ahc)
+{
+	return (ahc_resume(ahc));
+}
+
 /*
  * Read the 284x SEEPROM.
  */
@@ -371,5 +405,6 @@
 	ahc->features = AHC_AIC7770_FE;
 	ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
 	ahc->flags |= AHC_PAGESCBS;
+	ahc->instruction_ram_size = 448;
 	return (0);
 }
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7770_osm.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7770_osm.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7770_osm.c	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7770_osm.c	2003-04-15 04:36:16.000000000 -0700
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#12 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#13 $
  */
 
 #include "aic7xxx_osm.h"
@@ -66,7 +66,7 @@
 			continue;
 		request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx");
 #else
-		if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") != 0)
+		if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") == 0)
 			continue;
 #endif
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.h	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.h	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#78 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#88 $
  *
  * $FreeBSD$
  */
@@ -258,27 +258,30 @@
 	AHD_PCIX_CHIPRST_BUG	= 0x0040,
 	/* MMAPIO is not functional in PCI-X mode.  */
 	AHD_PCIX_MMAPIO_BUG	= 0x0080,
+	/* Reads to SCBRAM fail to reset the discard timer. */
+	AHD_PCIX_SCBRAM_RD_BUG  = 0x0100,
 	/* Bug workarounds that can be disabled on non-PCIX busses. */
 	AHD_PCIX_BUG_MASK	= AHD_PCIX_CHIPRST_BUG
-				| AHD_PCIX_MMAPIO_BUG,
+				| AHD_PCIX_MMAPIO_BUG
+				| AHD_PCIX_SCBRAM_RD_BUG,
 	/*
 	 * LQOSTOP0 status set even for forced selections with ATN
 	 * to perform non-packetized message delivery.
 	 */
-	AHD_LQO_ATNO_BUG	= 0x0100,
+	AHD_LQO_ATNO_BUG	= 0x0200,
 	/* FIFO auto-flush does not always trigger.  */
-	AHD_AUTOFLUSH_BUG	= 0x0200,
+	AHD_AUTOFLUSH_BUG	= 0x0400,
 	/* The CLRLQO registers are not self-clearing. */
-	AHD_CLRLQO_AUTOCLR_BUG	= 0x0400,
+	AHD_CLRLQO_AUTOCLR_BUG	= 0x0800,
 	/* The PACKETIZED status bit refers to the previous connection. */
-	AHD_PKTIZED_STATUS_BUG  = 0x0800,
+	AHD_PKTIZED_STATUS_BUG  = 0x1000,
 	/* "Short Luns" are not placed into outgoing LQ packets correctly. */
-	AHD_PKT_LUN_BUG		= 0x1000,
+	AHD_PKT_LUN_BUG		= 0x2000,
 	/*
 	 * Only the FIFO allocated to the non-packetized connection may
 	 * be in use during a non-packetzied connection.
 	 */
-	AHD_NONPACKFIFO_BUG	= 0x2000,
+	AHD_NONPACKFIFO_BUG	= 0x4000,
 	/*
 	 * Writing to a DFF SCBPTR register may fail if concurent with
 	 * a hardware write to the other DFF SCBPTR register.  This is
@@ -286,30 +289,44 @@
 	 * this bug have the AHD_NONPACKFIFO_BUG and all writes of concern
 	 * occur in non-packetized connections.
 	 */
-	AHD_MDFF_WSCBPTR_BUG	= 0x4000,
+	AHD_MDFF_WSCBPTR_BUG	= 0x8000,
 	/* SGHADDR updates are slow. */
-	AHD_REG_SLOW_SETTLE_BUG	= 0x8000,
+	AHD_REG_SLOW_SETTLE_BUG	= 0x10000,
 	/*
 	 * Changing the MODE_PTR coincident with an interrupt that
 	 * switches to a different mode will cause the interrupt to
 	 * be in the mode written outside of interrupt context.
 	 */
-	AHD_SET_MODE_BUG	= 0x10000,
+	AHD_SET_MODE_BUG	= 0x20000,
 	/* Non-packetized busfree revision does not work. */
-	AHD_BUSFREEREV_BUG	= 0x20000,
+	AHD_BUSFREEREV_BUG	= 0x40000,
 	/*
 	 * Paced transfers are indicated with a non-standard PPR
 	 * option bit in the neg table, 160MHz is indicated by
 	 * sync factor 0x7, and the offset if off by a factor of 2.
 	 */
-	AHD_PACED_NEGTABLE_BUG	= 0x40000,
+	AHD_PACED_NEGTABLE_BUG	= 0x80000,
 	/* LQOOVERRUN false positives. */
-	AHD_LQOOVERRUN_BUG	= 0x80000,
+	AHD_LQOOVERRUN_BUG	= 0x100000,
 	/*
 	 * Controller write to INTSTAT will lose to a host
 	 * write to CLRINT.
 	 */
-	AHD_INTCOLLISION_BUG	= 0x100000
+	AHD_INTCOLLISION_BUG	= 0x200000,
+	/*
+	 * The GEM318 violates the SCSI spec by not waiting
+	 * the mandated bus settle delay between phase changes
+	 * in some situations.  Some aic79xx chip revs. are more
+	 * strict in this regard and will treat REQ assertions
+	 * that fall within the bus settle delay window as
+	 * glitches.  This flag tells the firmware to tolerate
+	 * early REQ assertions.
+	 */
+	AHD_EARLY_REQ_BUG	= 0x400000,
+	/*
+	 * The LED does not stay on long enough in packetized modes.
+	 */
+	AHD_FAINT_LED_BUG	= 0x800000
 } ahd_bug;
 
 /*
@@ -319,10 +336,7 @@
  */
 typedef enum {
 	AHD_FNONE	      = 0x00000,
-	AHD_PRIMARY_CHANNEL   = 0x00003,/*
-					 * The channel that should
-					 * be probed first.
-					 */
+	AHD_BOOT_CHANNEL      = 0x00001,/* We were set as the boot channel. */
 	AHD_USEDEFAULTS	      = 0x00004,/*
 					 * For cards without an seeprom
 					 * or a BIOS to initialize the chip's
@@ -411,7 +425,10 @@
 #define MAX_CDB_LEN 16
 #define MAX_CDB_LEN_WITH_SENSE_ADDR (MAX_CDB_LEN - sizeof(sense_addr_t))
 union initiator_data {
-	uint64_t cdbptr;
+	struct {
+		uint64_t cdbptr;
+		uint8_t  cdblen;
+	} cdb_from_host;
 	uint8_t	 cdb[MAX_CDB_LEN];
 	struct {
 		uint8_t	 cdb[MAX_CDB_LEN_WITH_SENSE_ADDR];
@@ -727,7 +744,7 @@
 
 #define AHD_WIDTH_UNKNOWN	0xFF
 #define AHD_PERIOD_UNKNOWN	0xFF
-#define AHD_OFFSET_UNKNOWN	0x0
+#define AHD_OFFSET_UNKNOWN	0xFF
 #define AHD_PPR_OPTS_UNKNOWN	0xFF
 
 /*
@@ -884,6 +901,40 @@
 	uint16_t checksum;		/* word 31 */
 };
 
+/*
+ * Vital Product Data used during POST and by the BIOS.
+ */
+struct vpd_config {
+	uint8_t  bios_flags;
+#define		VPDMASTERBIOS	0x0001
+#define		VPDBOOTHOST	0x0002
+	uint8_t  reserved_1[21];
+	uint8_t  resource_type;
+	uint8_t  resource_len[2];
+	uint8_t  resource_data[8];
+	uint8_t  vpd_tag;
+	uint16_t vpd_len;
+	uint8_t  vpd_keyword[2];
+	uint8_t  length;
+	uint8_t  revision;
+	uint8_t  device_flags;
+	uint8_t  termnation_menus[2];
+	uint8_t  fifo_threshold;
+	uint8_t  end_tag;
+	uint8_t  vpd_checksum;
+	uint16_t default_target_flags;
+	uint16_t default_bios_flags;
+	uint16_t default_ctrl_flags;
+	uint8_t  default_irq;
+	uint8_t  pci_lattime;
+	uint8_t  max_target;
+	uint8_t  boot_lun;
+	uint16_t signature;
+	uint8_t  reserved_2;
+	uint8_t  checksum;
+	uint8_t	 reserved_3[4];
+};
+
 /****************************** Flexport Logic ********************************/
 #define FLXADDR_TERMCTL			0x0
 #define		FLX_TERMCTL_ENSECHIGH	0x8
@@ -916,11 +967,12 @@
 #define		FLX_CSTAT_INVALID	0x3
 
 int		ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
-				 u_int start_addr, u_int count);
+				 u_int start_addr, u_int count, int bstream);
 
 int		ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf,
 				  u_int start_addr, u_int count);
 int		ahd_wait_seeprom(struct ahd_softc *ahd);
+int		ahd_verify_vpd_cksum(struct vpd_config *vpd);
 int		ahd_verify_cksum(struct seeprom_config *sc);
 int		ahd_acquire_seeprom(struct ahd_softc *ahd);
 void		ahd_release_seeprom(struct ahd_softc *ahd);
@@ -1305,6 +1357,8 @@
 void			 ahd_controller_info(struct ahd_softc *ahd, char *buf);
 int			 ahd_init(struct ahd_softc *ahd);
 int			 ahd_default_config(struct ahd_softc *ahd);
+int			 ahd_parse_vpddata(struct ahd_softc *ahd,
+					   struct vpd_config *vpd);
 int			 ahd_parse_cfgdata(struct ahd_softc *ahd,
 					   struct seeprom_config *sc);
 void			 ahd_intr_enable(struct ahd_softc *ahd, int enable);
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.reg linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.reg
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.reg	2003-04-07 10:32:49.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.reg	2003-04-15 04:36:16.000000000 -0700
@@ -39,7 +39,7 @@
  *
  * $FreeBSD$
  */
-VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $"
+VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#65 $"
 
 /*
  * This file is processed by the aic7xxx_asm utility for use in assembling
@@ -2071,14 +2071,14 @@
 	address			0x051
 	access_mode	RW
 	modes		M_CFG
-	field	ENLQIPHASE_LQ	0x80
-	field	ENLQIPHASE_NLQ	0x40
+	field	ENLQIPHASE_LQ	0x80	/* LQIPHASE1 */
+	field	ENLQIPHASE_NLQ	0x40	/* LQIPHASE2 */
 	field	ENLIQABORT	0x20
-	field	ENLQICRCI_LQ	0x10
-	field	ENLQICRCI_NLQ	0x08
+	field	ENLQICRCI_LQ	0x10	/* LQICRCI1 */
+	field	ENLQICRCI_NLQ	0x08	/* LQICRCI2 */
 	field	ENLQIBADLQI	0x04
-	field	ENLQIOVERI_LQ	0x02
-	field	ENLQIOVERI_NLQ	0x01
+	field	ENLQIOVERI_LQ	0x02	/* LQIOVERI1 */
+	field	ENLQIOVERI_NLQ	0x01	/* LQIOVERI2 */
 }
 
 /*
@@ -2545,10 +2545,10 @@
 const	AHD_SLEWRATE_MASK	0x78
 const	AHD_SLEWRATE_SHIFT	3
 /*
- * Rev A has only a single bit of slew adjustment.
- * Rev B has 4 bits.
+ * Rev A has only a single bit (high bit of field) of slew adjustment.
+ * Rev B has 4 bits.  The current default happens to be the same for both.
  */
-const	AHD_SLEWRATE_DEF_REVA	0x01
+const	AHD_SLEWRATE_DEF_REVA	0x08
 const	AHD_SLEWRATE_DEF_REVB	0x08
 
 /* Rev A does not have any amplitude setting. */
@@ -3769,16 +3769,17 @@
 	SCB_RESIDUAL_DATACNT {
 		size	4
 		alias	SCB_CDB_STORE
+		alias	SCB_HOST_CDB_PTR
 	}
 	SCB_RESIDUAL_SGPTR {
 		size	4
-		alias	SCB_CDB_PTR
 		field	SG_ADDR_MASK		0xf8	/* In the last byte */
 		field	SG_OVERRUN_RESID	0x02	/* In the first byte */
 		field	SG_LIST_NULL		0x01	/* In the first byte */
 	}
 	SCB_SCSI_STATUS {
 		size	1
+		alias	SCB_HOST_CDB_LEN
 	}
 	SCB_TARGET_PHASES {
 		size	1
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.seq linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.seq
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx.seq	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx.seq	2003-04-15 04:36:16.000000000 -0700
@@ -40,7 +40,7 @@
  * $FreeBSD$
  */
 
-VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $"
+VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#89 $"
 PATCH_ARG_LIST = "struct ahd_softc *ahd"
 PREFIX = "ahd_"
 
@@ -89,6 +89,13 @@
 idle_loop_check_nonpackreq:
 	test	SSTAT2, NONPACKREQ jz . + 2;
 	call	unexpected_nonpkt_phase_find_ctxt;
+	if ((ahd->bugs & AHD_FAINT_LED_BUG) != 0) {
+		and	A, FIFO0FREE|FIFO1FREE, DFFSTAT;
+		cmp	A, FIFO0FREE|FIFO1FREE jne . + 3;
+		and	SBLKCTL, ~DIAGLEDEN|DIAGLEDON;
+		jmp	. + 2;
+		or	SBLKCTL, DIAGLEDEN|DIAGLEDON;
+	}
 	call	idle_loop_gsfifo_in_scsi_mode;
 	call	idle_loop_service_fifos;
 	call	idle_loop_cchan;
@@ -122,22 +129,24 @@
 	/*
 	 * Since this status did not consume a FIFO, we have to
 	 * be a bit more dilligent in how we check for FIFOs pertaining
-	 * to this transaction.  There are three states that a FIFO still
+	 * to this transaction.  There are two states that a FIFO still
 	 * transferring data may be in.
 	 *
-	 * 1) Configured and draining to the host, with a pending CLRCHN.
-	 * 2) Configured and draining to the host, no pending CLRCHN.
-	 * 3) Pending cfg4data, fifo not empty.
+	 * 1) Configured and draining to the host, with a FIFO handler.
+	 * 2) Pending cfg4data, fifo not empty.
 	 *
-	 * Cases 1 and 2 can be detected by noticing that a longjmp is
-	 * active for the FIFO and LONGJMP_SCB matches our SCB.  In this
-	 * case, we allow the routine servicing the FIFO to complete the SCB.
+	 * Case 1 can be detected by noticing that a longjmp is active for
+	 * the FIFO and LONGJMP_SCB matches our SCB.  In this case, we allow
+	 * the routine servicing the FIFO to complete the SCB.
 	 * 
-	 * Case 3 implies either a pending or yet to occur save data
+	 * Case 2 implies either a pending or yet to occur save data
 	 * pointers for this same context in the other FIFO.  So, if
-	 * we detect case 2, we will properly defer the post of the SCB
+	 * we detect case 1, we will properly defer the post of the SCB
 	 * and achieve the desired result.  The pending cfg4data will
 	 * notice that status has been received and complete the SCB.
+	 *
+	 * If the data-transfer has been completed, or no data transfer
+	 * was needed for this SCB, it is safe to complete the command.
 	 */
 	test	SCB_SGPTR, SG_LIST_NULL jz good_status_check_fifos;
 	/*
@@ -519,7 +528,7 @@
 		/*
 		 * For packetized, the LQO manager clears ENSELO on
 		 * the assertion of SELDO.  If we are non-packetized,
-		 * LASTSCB and CURRSCB are acuate.
+		 * LASTSCB and CURRSCB are accurate.
 		 */
 		test	SCSISEQ0, ENSELO jnz use_lastscb;
 
@@ -706,7 +715,7 @@
 	add	NONE, -17, SCB_CDB_LEN;
 	jnc	p_command_embedded;
 p_command_from_host:
-	bmov	HADDR[0], SCB_CDB_PTR, 11;
+	bmov	HADDR[0], SCB_HOST_CDB_PTR, 9;
 	mvi	SG_CACHE_PRE, LAST_SEG;
 	mvi	DFCNTRL, (PRELOADEN|SCSIEN|HDMAEN);
 	jmp	p_command_xfer;
@@ -1030,14 +1039,6 @@
 	SET_MODE(M_SCSI, M_SCSI)
 	bmov	SCBPTR, ARG_1, 2;
 queue_scb_completion:
-	if ((ahd->bugs & AHD_ABORT_LQI_BUG) == 0) {
-		/*
-		 * Set MK_MESSAGE to trigger an abort should this SCB
-		 * be referenced by a target even though it is not currently
-		 * active.
-		 */
-		or	SCB_CONTROL, MK_MESSAGE;
-	}
 	test	SCB_SCSI_STATUS,0xff	jnz bad_status;
 	/*
 	 * Check for residuals
@@ -1163,7 +1164,28 @@
 	mvi	SEQ_FLAGS, NOT_IDENTIFIED|NO_CDB_SENT ret;
 
 phase_lock:     
-	test	SCSIPHASE, 0xFF jz .;
+	if ((ahd->bugs & AHD_EARLY_REQ_BUG) != 0) {
+		/*
+		 * Don't ignore persistent REQ assertions just because
+		 * they were asserted within the bus settle delay window.
+		 * This allows us to tolerate devices like the GEM318
+		 * that violate the SCSI spec.  We are careful not to
+		 * count REQ while we are waiting for it to fall during
+		 * an async phase due to our asserted ACK.  Each
+		 * sequencer instruction takes ~25ns, so the REQ must
+		 * last at least 100ns in order to be counted as a true
+		 * REQ.
+		 */
+		test	SCSIPHASE, 0xFF jnz phase_locked;
+		test	SCSISIGI, ACKI jnz phase_lock;
+		test	SCSISIGI, REQI jz phase_lock;
+		test	SCSIPHASE, 0xFF jnz phase_locked;
+		test	SCSISIGI, ACKI jnz phase_lock;
+		test	SCSISIGI, REQI jz phase_lock;
+phase_locked:
+	} else {
+		test	SCSIPHASE, 0xFF jz .;
+	}
 	test	SSTAT1, SCSIPERR jnz phase_lock;
 phase_lock_latch_phase:
 	and	LASTPHASE, PHASE_MASK, SCSISIGI ret;
@@ -1247,7 +1269,7 @@
 		nop;
 	}
 	and	SGHADDR[0], SG_PREFETCH_ALIGN_MASK, SCB_RESIDUAL_SGPTR;
-	mvi	CCSGCTL, CCSGEN|SG_CACHE_AVAIL|CCSGRESET;
+	mvi	CCSGCTL, CCSGEN|CCSGRESET;
 	or	SG_STATE, FETCH_INPROG ret;
 idle_sgfetch_complete:
 	/*
@@ -1261,6 +1283,15 @@
 idle_sg_avail:
 	/* Does the hardware have space for another SG entry? */
 	test	DFSTATUS, PRELOAD_AVAIL jz return;
+	/*
+	 * On the A, preloading a segment before HDMAENACK
+	 * comes true can clobber the shaddow address of the
+	 * first segment in the S/G FIFO.  Wait until it is
+	 * safe to proceed.
+	 */
+	if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) == 0) {
+		test	DFCNTRL, HDMAENACK jz return;
+	}
 	if ((ahd->flags & AHD_64BIT_ADDRESSING) != 0) {
 		bmov	HADDR, CCSGRAM, 8;
 	} else {
@@ -1290,22 +1321,12 @@
 	or	SINDEX, LAST_SEG;
 	clr	SG_STATE;
 	mov	SG_CACHE_PRE, SINDEX;
-	/*
-	 * Load the segment.  Or in HDMAEN here too
-	 * just in case HDMAENACK has not come true
-	 * by the time this segment is loaded.  If
-	 * HDMAENACK is not true, this or will disable
-	 * HDMAEN mid-transfer.  We do not want to simply
-	 * mvi our original settings as SCSIEN automatically
-	 * de-asserts and we don't want to accidentally
-	 * re-enable it.
-	 */
 	if ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0) {
 		/*
 		 * Use SCSIENWRDIS so that SCSIEN is never
 		 * modified by this operation.
 		 */
-		or	DFCNTRL, PRELOADEN|SCSIENWRDIS|HDMAEN;
+		or	DFCNTRL, PRELOADEN|HDMAEN|SCSIENWRDIS;
 	} else {
 		or	DFCNTRL, PRELOADEN|HDMAEN;
 	}
@@ -1510,12 +1531,6 @@
  * the idle loop and there is no need to perform
  * any fixups.
  */
-calc_residual:
-	test	SG_CACHE_SHADOW, LAST_SEG jz residual_before_last_seg;
-	/* Record if we've consumed all S/G entries */
-	test	MDFFSTAT, SHVALID	jz . + 2;
-	bmov	SCB_RESIDUAL_DATACNT, SHCNT, 3 ret;
-	or	SCB_RESIDUAL_SGPTR[0], SG_LIST_NULL ret;
 residual_before_last_seg:
 	test    MDFFSTAT, SHVALID	jnz sgptr_fixup;
 	/*
@@ -1525,7 +1540,13 @@
 	 */
 	call	idle_loop_service_fifos;
 	RESTORE_MODE(SAVED_MODE)
-	jmp	calc_residual;
+	/* FALLTHROUGH */
+calc_residual:
+	test	SG_CACHE_SHADOW, LAST_SEG jz residual_before_last_seg;
+	/* Record if we've consumed all S/G entries */
+	test	MDFFSTAT, SHVALID	jz . + 2;
+	bmov	SCB_RESIDUAL_DATACNT, SHCNT, 3 ret;
+	or	SCB_RESIDUAL_SGPTR[0], SG_LIST_NULL ret;
 
 sgptr_fixup:
 	/*
@@ -1570,7 +1591,51 @@
 	}
 
 export seq_isr:
-	nop;	/* Jumps in the first ISR instruction fail on Rev A. */
+	if ((ahd->features & AHD_RTI) == 0) {
+		/*
+		 * On RevA Silicon, if the target returns us to data-out
+		 * after we have already trained for data-out, it is
+		 * possible for us to transition the free running clock to
+		 * data-valid before the required 100ns P1 setup time (8 P1
+		 * assertions in fast-160 mode).  This will only happen if
+		 * this L-Q is a continuation of a data transfer for which
+		 * we have already prefetched data into our FIFO (LQ/Data
+		 * followed by LQ/Data for the same write transaction).
+		 * This can cause some target implementations to miss the
+		 * first few data transfers on the bus.  We detect this
+		 * situation by noticing that this is the first data transfer
+		 * after an LQ (LQIWORKONLQ true), that the data transfer is
+		 * a continuation of a transfer already setup in our FIFO
+		 * (SAVEPTRS interrupt), and that the transaction is a write
+		 * (DIRECTION set in DFCNTRL). The delay is performed by
+		 * disabling SCSIEN until we see the first REQ from the
+		 * target.
+		 * 
+		 * First instruction in an ISR cannot be a branch on
+		 * Rev A.  Snapshot LQISTAT2 so the status is not missed
+		 * and deffer the test by one instruction.
+		 */
+		mov	REG_ISR, LQISTAT2;
+		test	REG_ISR, LQIWORKONLQ jz data_valid;
+		test	SEQINTSRC, SAVEPTRS  jz data_valid;
+		test	LONGJMP_ADDR[1], INVALID_ADDR jz saveptr_active_fifo;
+		/*
+		 * Switch to the active FIFO.
+		 */
+		xor	MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
+		test	DFCNTRL, DIRECTION jz snapshot_other_fifo;
+		and	DFCNTRL, ~SCSIEN;
+		test	SSTAT1, REQINIT	jz .;
+		or	DFCNTRL, SCSIEN;
+		/* FALLTHROUGH */
+snapshot_other_fifo:
+		xor	MODE_PTR, MK_MODE(M_DFF1, M_DFF1);
+		/* FALLTHROUGH */
+snapshot_saveptr:
+		mvi	DFFSXFRCTL, CLRCHN;
+		or	SEQINTCTL, IRET ret;
+data_valid:
+	}
 	test	SEQINTSRC, CFG4DATA	jnz cfg4data_intr;
 	test	SEQINTSRC, CFG4ISTAT	jnz cfg4istat_intr;
 	test	SEQINTSRC, SAVEPTRS	jnz saveptr_intr;
@@ -1583,21 +1648,23 @@
  * active and contains a snapshot of the current poniter information.
  * This happens between packets in a stream for a single L_Q.  Since we
  * are not performing a pointer save, we can safely clear the channel
- * so it can be used for other transactions.
+ * so it can be used for other transactions.  On RTI capable controllers,
+ * where snapshots can, and are, disabled, the code to handle this type
+ * of snapshot is not active.
  *
  * The second case is a save pointers on an active FIFO which occurs
- * if the target changes to a new L_Q or busfrees/QAS' and the transfer
+ * if the target changes to a new L_Q or busfrees/QASes and the transfer
  * has a residual.  This should occur coincident with a ctxtdone.  We
  * disable the interrupt and allow our active routine to handle the
  * save.
  */
 saveptr_intr:
-	test	DFCNTRL, HDMAENACK jz snapshot_saveptr;
+	if ((ahd->features & AHD_RTI) == 0) {
+		test	LONGJMP_ADDR[1], INVALID_ADDR jnz snapshot_saveptr;
+	}
+saveptr_active_fifo:
 	and	SEQIMODE, ~ENSAVEPTRS;
 	or	SEQINTCTL, IRET ret;
-snapshot_saveptr:
-	mvi	DFFSXFRCTL, CLRCHN;
-	or	SEQINTCTL, IRET ret;
 
 cfg4data_intr:
 	test	SCB_SGPTR[0], SG_LIST_NULL jnz pkt_handle_overrun;
@@ -1633,6 +1700,18 @@
 	call	pkt_handle_status;
 	or	SEQINTCTL, IRET ret;
 
+cfg4icmd_intr:
+	/*
+	 * In the case of DMAing a CDB from the host, the normal
+	 * CDB buffer is formatted with an 8 byte address followed
+	 * by a 1 byte count.
+	 */
+	bmov	HADDR[0], SCB_HOST_CDB_PTR, 9;
+	mvi	SG_CACHE_PRE, LAST_SEG;
+	mvi	DFCNTRL, (PRELOADEN|SCSIEN|HDMAEN);
+	call	pkt_handle_cdb;
+	or	SEQINTCTL, IRET ret;
+
 /*
  * See if the target has gone on in this context creating an
  * overrun condition.  For the write case, the hardware cannot
@@ -1672,7 +1751,7 @@
 pkt_last_seg:
 	call	setjmp;
 	test	SEQINTSRC, SAVEPTRS jnz pkt_saveptrs;
-	test	SG_CACHE_SHADOW, LAST_SEG_DONE jnz last_pkt_done;
+	test	SG_CACHE_SHADOW, LAST_SEG_DONE jnz last_pkt_xfer_done;
 	test	SCSIPHASE, ~DATA_PHASE_MASK jz . + 2;
 	test	SCSISIGO, ATNO jnz . + 2;
 	test	SSTAT2, NONPACKREQ jz return;
@@ -1716,7 +1795,7 @@
 	mvi	DFFSXFRCTL, CLRCHN ret;
 END_CRITICAL;
 
-last_pkt_done:
+last_pkt_xfer_done:
 BEGIN_CRITICAL;
 	if ((ahd->bugs & AHD_AUTOFLUSH_BUG) != 0) {
 		or	DFCNTRL, FIFOFLUSH;
@@ -1765,13 +1844,15 @@
 	mvi	DFFSXFRCTL, CLRCHN ret;
 END_CRITICAL;
 
-check_status_overrun:
-	test	SHCNT[2], 0xFF jz status_IU_done;
-	SET_SEQINTCODE(STATUS_OVERRUN)
-	jmp	status_IU_done;
+/*
+ * Watch over the status transfer.  Our host sense buffer is
+ * large enough to take the maximum allowed status packet.
+ * None-the-less, we must still catch and report overruns to
+ * the host.
+ */
 pkt_handle_status:
 	call	setjmp_setscb;
-	test	MDFFSTAT, LASTSDONE jnz check_status_overrun;
+	test	SG_CACHE_SHADOW, LAST_SEG_DONE jz check_status_overrun;
 	test	SEQINTSRC, CTXTDONE jz return;
 status_IU_done:
 BEGIN_CRITICAL;
@@ -1783,6 +1864,21 @@
 	or	SCB_CONTROL, STATUS_RCVD;
 	jmp	last_pkt_complete;
 END_CRITICAL;
+check_status_overrun:
+	/*
+	 * We've filled the entire sense buffer.
+	 * Wait for either context done or a negative
+	 * shaddow count.  If the context completes without
+	 * causing the shaddow count to go negative, then
+	 * this was a successful transfer up to the status
+	 * limit.  Otherwise we report the error.
+	 */
+	test	SHCNT[2], 0xFF jnz report_status_overrun;
+	test	SEQINTSRC, CTXTDONE jz return;
+	test	SHCNT[2], 0xFF jz status_IU_done;
+report_status_overrun:
+	SET_SEQINTCODE(STATUS_OVERRUN)
+	jmp	status_IU_done;
 
 SET_SRC_MODE	M_DFF0;
 SET_DST_MODE	M_DFF0;
@@ -1797,6 +1893,16 @@
 END_CRITICAL;
 
 /*
+ * Must wait until CDB xfer is over before issuing the
+ * clear channel.
+ */
+pkt_handle_cdb:
+	call	setjmp_setscb;
+	test	SG_CACHE_SHADOW, LAST_SEG_DONE jz return;
+	or	LONGJMP_ADDR[1], INVALID_ADDR;
+	mvi	DFFSXFRCTL, CLRCHN ret;
+
+/*
  * Nonpackreq is a polled status.  It can come true in three situations:
  * we have received an L_Q, we have sent one or more L_Qs, or there is no
  * L_Q context associated with this REQ (REQ occurs immediately after a
@@ -1865,6 +1971,7 @@
 	or	SCB_RESIDUAL_SGPTR, SG_OVERRUN_RESID;
 	test	SEQINTSRC, CTXTDONE jz unexpected_nonpkt_phase;
 	test	SCB_CONTROL, STATUS_RCVD jnz last_pkt_queue_scb;
+	or	LONGJMP_ADDR[1], INVALID_ADDR;
 	mvi	DFFSXFRCTL, CLRCHN ret;
 
 if ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) != 0) {
@@ -1885,5 +1992,3 @@
 	mvi	HCNT[1], ((PKT_OVERRUN_BUFSIZE >> 8) & 0xFF);
 	clr	HCNT[2] ret;
 }
-
-cfg4icmd_intr:
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_core.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_core.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_core.c	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_core.c	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#156 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#178 $
  *
  * $FreeBSD$
  */
@@ -406,7 +406,7 @@
 		u_int	 i;
 		
 		ahd_set_scbptr(ahd, scbid);
-		next_scbid = ahd_inw(ahd, SCB_NEXT_COMPLETE);
+		next_scbid = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 		scb = ahd_lookup_scb(ahd, scbid);
 		if (scb == NULL) {
 			printf("%s: Warning - DMA-up and complete "
@@ -415,7 +415,7 @@
 		}
 		hscb_ptr = (uint8_t *)scb->hscb;
 		for (i = 0; i < sizeof(struct hardware_scb); i++)
-			*hscb_ptr++ = ahd_inb(ahd, SCB_BASE + i);
+			*hscb_ptr++ = ahd_inb_scbram(ahd, SCB_BASE + i);
 
 		ahd_complete_scb(ahd, scb);
 		scbid = next_scbid;
@@ -426,7 +426,7 @@
 	while (!SCBID_IS_NULL(scbid)) {
 
 		ahd_set_scbptr(ahd, scbid);
-		next_scbid = ahd_inw(ahd, SCB_NEXT_COMPLETE);
+		next_scbid = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE);
 		scb = ahd_lookup_scb(ahd, scbid);
 		if (scb == NULL) {
 			printf("%s: Warning - Complete SCB %d invalid\n",
@@ -1249,6 +1249,14 @@
 		ahd_outb(ahd, CLRSINT3, status3);
 	} else if ((lqistat1 & (LQIPHASE_LQ|LQIPHASE_NLQ)) != 0) {
 		ahd_handle_lqiphase_error(ahd, lqistat1);
+	} else if ((lqistat1 & LQICRCI_NLQ) != 0) {
+		/*
+		 * This status can be delayed during some
+		 * streaming operations.  The SCSIPHASE
+		 * handler has already dealt with this case
+		 * so just clear the error.
+		 */
+		ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ);
 	} else if ((status & BUSFREE) != 0) {
 		u_int lqostat1;
 		int   restart;
@@ -1284,9 +1292,9 @@
 			scbid = ahd_get_scbptr(ahd);
 			scb = ahd_lookup_scb(ahd, scbid);
 			if (scb == NULL) {
-				printf("%s: Invalid SCB in DFF%d "
+				printf("%s: Invalid SCB %d in DFF%d "
 				       "during unexpected busfree\n",
-				       ahd_name(ahd), mode);
+				       ahd_name(ahd), scbid, mode);
 				packetized = 0;
 			} else
 				packetized = (scb->flags & SCB_PACKETIZED) != 0;
@@ -1627,23 +1635,24 @@
 		if (scb == NULL)
 		       panic("SCB not valid during LQOBUSFREE");
 		/*
-		 * Return the LQO manager to its idle loop.  It will
-		 * not do this automatically if the busfree occurs
-		 * after the first REQ of either the LQ or command
-		 * packet or between the LQ and command packet.
-		 */
-		ahd_outb(ahd, LQCTL2, ahd_inb(ahd, LQCTL2) | LQOTOIDLE);
-
-		/*
 		 * Clear the status.
 		 */
 		ahd_outb(ahd, CLRLQOINT1, CLRLQOBUSFREE);
 		if ((ahd->bugs & AHD_CLRLQO_AUTOCLR_BUG) != 0)
 			ahd_outb(ahd, CLRLQOINT1, 0);
 		ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
+		ahd_flush_device_writes(ahd);
 		ahd_outb(ahd, CLRSINT0, CLRSELDO);
 
 		/*
+		 * Return the LQO manager to its idle loop.  It will
+		 * not do this automatically if the busfree occurs
+		 * after the first REQ of either the LQ or command
+		 * packet or between the LQ and command packet.
+		 */
+		ahd_outb(ahd, LQCTL2, ahd_inb(ahd, LQCTL2) | LQOTOIDLE);
+
+		/*
 		 * Update the waiting for selection queue so
 		 * we restart on the correct SCB.
 		 */
@@ -1653,12 +1662,12 @@
 
 			ahd_outw(ahd, WAITING_TID_HEAD, scbid);
 			waiting_t = ahd_inw(ahd, WAITING_TID_TAIL);
-			next = SCB_LIST_NULL;
 			if (waiting_t == waiting_h) {
 				ahd_outw(ahd, WAITING_TID_TAIL, scbid);
+				next = SCB_LIST_NULL;
 			} else {
 				ahd_set_scbptr(ahd, waiting_h);
-				next = ahd_inw(ahd, SCB_NEXT2);
+				next = ahd_inw_scbram(ahd, SCB_NEXT2);
 			}
 			ahd_set_scbptr(ahd, scbid);
 			ahd_outw(ahd, SCB_NEXT2, next);
@@ -1704,6 +1713,7 @@
 		scb = ahd_lookup_scb(ahd, scbid);
 		ahd_print_path(ahd, scb);
 		printf("Unexpected PKT busfree condition\n");
+		ahd_dump_card_state(ahd);
 		ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A',
 			       SCB_GET_LUN(scb), SCB_GET_TAG(scb),
 			       ROLE_INITIATOR, CAM_UNEXP_BUSFREE);
@@ -1988,7 +1998,8 @@
 		if ((seq_flags & NO_CDB_SENT) != 0) {
 			ahd_print_path(ahd, scb);
 			printf("No or incomplete CDB sent to device.\n");
-		} else if ((ahd_inb(ahd, SCB_CONTROL) & STATUS_RCVD) == 0) {
+		} else if ((ahd_inb_scbram(ahd, SCB_CONTROL)
+			  & STATUS_RCVD) == 0) {
 			/*
 			 * The target never bothered to provide status to
 			 * us prior to completing the command.  Since we don't
@@ -2605,8 +2616,12 @@
 				       ahd_name(ahd), devinfo->target,
 				       period, offset);
 				options = 0;
+				if ((ppr_options & MSG_EXT_PPR_RD_STRM) != 0) {
+					printf("(RDSTRM");
+					options++;
+				}
 				if ((ppr_options & MSG_EXT_PPR_DT_REQ) != 0) {
-					printf("(DT");
+					printf("%s", options ? "|DT" : "(DT");
 					options++;
 				}
 				if ((ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
@@ -4817,9 +4832,6 @@
 				slave->flags &= ~AHD_BIOS_ENABLED; 
 				slave->flags |=
 				    master->flags & AHD_BIOS_ENABLED;
-				slave->flags &= ~AHD_PRIMARY_CHANNEL; 
-				slave->flags |=
-				    master->flags & AHD_PRIMARY_CHANNEL;
 				break;
 			}
 		}
@@ -4831,7 +4843,7 @@
 	 */
 	list_ahd = TAILQ_FIRST(&ahd_tailq);
 	while (list_ahd != NULL
-	    && ahd_softc_comp(list_ahd, ahd) <= 0)
+	    && ahd_softc_comp(ahd, list_ahd) <= 0)
 		list_ahd = TAILQ_NEXT(list_ahd, links);
 	if (list_ahd != NULL)
 		TAILQ_INSERT_BEFORE(list_ahd, ahd, links);
@@ -4980,6 +4992,8 @@
 	 * to disturb the integrity of the bus.
 	 */
 	ahd_pause(ahd);
+	ahd_update_modes(ahd);
+	ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
 	sxfrctl1 = ahd_inb(ahd, SXFRCTL1);
 
 	cmd = ahd_pci_read_config(ahd->dev_softc, PCIR_COMMAND, /*bytes*/2);
@@ -5028,13 +5042,16 @@
 		ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND,
 				     cmd, /*bytes*/2);
 	}
-	/* After a reset, we know the state of the mode register. */
-	ahd_known_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
 
-	/* Determine chip configuration */
-	ahd->features &= ~AHD_WIDE;
-	if ((ahd_inb(ahd, SBLKCTL) & SELWIDE) != 0)
-		ahd->features |= AHD_WIDE;
+	/*
+	 * Mode should be SCSI after a chip reset, but lets
+	 * set it just to be safe.  We touch the MODE_PTR
+	 * register directly so as to bypass the lazy update
+	 * code in ahd_set_modes().
+	 */
+	ahd_known_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
+	ahd_outb(ahd, MODE_PTR,
+		 ahd_build_mode_state(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI));
 
 	/*
 	 * Restore SXFRCTL1.
@@ -5047,9 +5064,14 @@
 	ahd_outb(ahd, SXFRCTL1, sxfrctl1|STPWEN);
 	ahd_outb(ahd, SXFRCTL1, sxfrctl1);
 
+	/* Determine chip configuration */
+	ahd->features &= ~AHD_WIDE;
+	if ((ahd_inb(ahd, SBLKCTL) & SELWIDE) != 0)
+		ahd->features |= AHD_WIDE;
+
 	/*
 	 * If a recovery action has forced a chip reset,
-	 * re-initialize the chip to our likeing.
+	 * re-initialize the chip to our liking.
 	 */
 	if (ahd->init_level > 0)
 		ahd_chip_init(ahd);
@@ -5158,7 +5180,7 @@
 	scb_data->init_level++;
 
 	/* DMA tag for our S/G structures. */
-	if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1,
+	if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/8,
 			       /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1,
 			       /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
 			       /*highaddr*/BUS_SPACE_MAXADDR,
@@ -5793,7 +5815,9 @@
 	/* DMA tag for mapping buffers into device visible space. */
 	if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1,
 			       /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1,
-			       /*lowaddr*/BUS_SPACE_MAXADDR,
+			       /*lowaddr*/ahd->flags & AHD_39BIT_ADDRESSING
+					? (bus_addr_t)0x7FFFFFFFFFULL
+					: BUS_SPACE_MAXADDR_32BIT,
 			       /*highaddr*/BUS_SPACE_MAXADDR,
 			       /*filter*/NULL, /*filterarg*/NULL,
 			       /*maxsize*/(AHD_NSEG - 1) * PAGE_SIZE,
@@ -6050,7 +6074,7 @@
 	} else {
 		ahd_outb(ahd, OPTIONMODE, AUTOACKEN|BUSFREEREV|AUTO_MSGOUT_DE);
 	}
-	ahd_outb(ahd, SCSCHKN, CURRFIFODEF|WIDERESEN);
+	ahd_outb(ahd, SCSCHKN, CURRFIFODEF|WIDERESEN|SHVALIDSTDIS);
 	if ((ahd->chip & AHD_BUS_MASK) == AHD_PCIX)
 		/*
 		 * Do not issue a target abort when a split completion
@@ -6341,7 +6365,7 @@
 #else
 		tinfo->user.period = AHD_SYNCRATE_160;
 #endif
-		tinfo->user.offset= ~0;
+		tinfo->user.offset = MAX_OFFSET;
 		tinfo->user.ppr_options = MSG_EXT_PPR_RD_STRM
 					| MSG_EXT_PPR_WR_FLOW
 					| MSG_EXT_PPR_HOLD_MCS
@@ -6508,6 +6532,22 @@
 	return (0);
 }
 
+/*
+ * Parse device configuration information.
+ */
+int
+ahd_parse_vpddata(struct ahd_softc *ahd, struct vpd_config *vpd)
+{
+	int error;
+
+	error = ahd_verify_vpd_cksum(vpd);
+	if (error == 0)
+		return (EINVAL);
+	if ((vpd->bios_flags & VPDBOOTHOST) != 0)
+		ahd->flags |= AHD_BOOT_CHANNEL;
+	return (0);
+}
+
 void
 ahd_intr_enable(struct ahd_softc *ahd, int enable)
 {
@@ -6565,13 +6605,13 @@
 void
 ahd_pause_and_flushwork(struct ahd_softc *ahd)
 {
-	u_int intstat;
-	u_int maxloops;
-	int   paused;
+	ahd_mode_state	saved_modes;
+	u_int		intstat;
+	u_int		maxloops;
+	int		paused;
 
 	maxloops = 1000;
 	ahd->flags |= AHD_ALL_INTERRUPTS;
-	intstat = 0;
 	paused = FALSE;
 	do {
 		struct scb *waiting_scb;
@@ -6582,6 +6622,8 @@
 		ahd_pause(ahd);
 		paused = TRUE;
 		ahd_clear_critical_section(ahd);
+		saved_modes = ahd_save_modes(ahd);
+		ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
 		if ((ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO)) == 0)
 			ahd_outb(ahd, SCSISEQ0,
 				 ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
@@ -6598,10 +6640,10 @@
 			ahd_outb(ahd, SCSISEQ0,
 				 ahd_inb(ahd, SCSISEQ0) | ENSELO);
 
-		if (intstat == 0xFF && (ahd->features & AHD_REMOVABLE) != 0)
-			break;
+		intstat = ahd_inb(ahd, INTSTAT);
 	} while (--maxloops
-	      && (((intstat = ahd_inb(ahd, INTSTAT)) & INT_PEND) != 0
+	      && (intstat != 0xFF || (ahd->features & AHD_REMOVABLE) == 0)
+	      && ((intstat & INT_PEND) != 0
 	       || (ahd_inb(ahd, SSTAT0) & (SELDO|SELINGO))));
 	if (maxloops == 0) {
 		printf("Infinite interrupt loop, INTSTAT = %x",
@@ -6612,6 +6654,7 @@
 
 	ahd_platform_flushwork(ahd);
 	ahd->flags &= ~AHD_ALL_INTERRUPTS;
+	ahd_restore_modes(ahd, saved_modes);
 }
 
 int
@@ -6785,7 +6828,6 @@
 
 /*
  * Return the untagged transaction id for a given target/channel lun.
- * Optionally, clear the entry.
  */
 u_int
 ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl)
@@ -7295,7 +7337,6 @@
 {
 	struct		scb *scbp;
 	struct		scb *scbp_next;
-	u_int		active_scb;
 	u_int		i, j;
 	u_int		maxtarget;
 	u_int		minlun;
@@ -7303,11 +7344,10 @@
 	int		found;
 	ahd_mode_state	saved_modes;
 
-	/* restore these when we're done */
-	active_scb = ahd_get_scbptr(ahd);
+	/* restore this when we're done */
 	saved_modes = ahd_save_modes(ahd);
-
 	ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
+
 	found = ahd_search_qinfifo(ahd, target, channel, lun, SCB_LIST_NULL,
 				   role, CAM_REQUEUE_REQ, SEARCH_COMPLETE);
 
@@ -7381,7 +7421,6 @@
 			found++;
 		}
 	}
-	ahd_set_scbptr(ahd, active_scb);
 	ahd_restore_modes(ahd, saved_modes);
 	ahd_platform_abort_scbs(ahd, target, channel, lun, tag, role, status);
 	ahd->flags |= AHD_UPDATE_PEND_CMDS;
@@ -7670,7 +7709,6 @@
 {
 	struct hardware_scb *hscb;
 	u_int  qfreeze_cnt;
-	ahd_mode_state saved_modes;
 
 	/*
 	 * The sequencer freezes its select-out queue
@@ -7682,7 +7720,6 @@
 
 	/* Freeze the queue until the client sees the error. */
 	ahd_pause(ahd);
-	saved_modes = ahd_save_modes(ahd);
 	ahd_clear_critical_section(ahd);
 	ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
 	ahd_freeze_devq(ahd, scb);
@@ -8148,7 +8185,7 @@
 	/* Start by aligning to the nearest cacheline. */
 	sg_prefetch_align = ahd->pci_cachesize;
 	if (sg_prefetch_align == 0)
-		sg_prefetch_cnt = 8;
+		sg_prefetch_align = 8;
 	/* Round down to the nearest power of 2. */
 	while (powerof2(sg_prefetch_align) == 0)
 		sg_prefetch_align--;
@@ -8744,11 +8781,12 @@
 /*
  * Read count 16bit words from 16bit word address start_addr from the
  * SEEPROM attached to the controller, into buf, using the controller's
- * SEEPROM reading state machine.
+ * SEEPROM reading state machine.  Optionally treat the data as a byte
+ * stream in terms of byte order.
  */
 int
 ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf,
-		 u_int start_addr, u_int count)
+		 u_int start_addr, u_int count, int bytestream)
 {
 	u_int cur_addr;
 	u_int end_addr;
@@ -8762,13 +8800,26 @@
 	AHD_ASSERT_MODES(ahd, AHD_MODE_SCSI_MSK, AHD_MODE_SCSI_MSK);
 	end_addr = start_addr + count;
 	for (cur_addr = start_addr; cur_addr < end_addr; cur_addr++) {
+
 		ahd_outb(ahd, SEEADR, cur_addr);
 		ahd_outb(ahd, SEECTL, SEEOP_READ | SEESTART);
 		
 		error = ahd_wait_seeprom(ahd);
 		if (error)
 			break;
-		*buf++ = ahd_inw(ahd, SEEDAT);
+		if (bytestream != 0) {
+			uint8_t *bytestream_ptr;
+
+			bytestream_ptr = (uint8_t *)buf;
+			*bytestream_ptr++ = ahd_inb(ahd, SEEDAT);
+			*bytestream_ptr = ahd_inb(ahd, SEEDAT+1);
+		} else {
+			/*
+			 * ahd_inw() already handles machine byte order.
+			 */
+			*buf = ahd_inw(ahd, SEEDAT);
+		}
+		buf++;
 	}
 	return (error);
 }
@@ -8841,6 +8892,38 @@
 	return (0);
 }
 
+/*
+ * Validate the two checksums in the per_channel
+ * vital product data struct.
+ */
+int
+ahd_verify_vpd_cksum(struct vpd_config *vpd)
+{
+	int i;
+	int maxaddr;
+	uint32_t checksum;
+	uint8_t *vpdarray;
+
+	vpdarray = (uint8_t *)vpd;
+	maxaddr = offsetof(struct vpd_config, vpd_checksum);
+	checksum = 0;
+	for (i = offsetof(struct vpd_config, resource_type); i < maxaddr; i++)
+		checksum = checksum + vpdarray[i];
+	if (checksum == 0
+	 || (-checksum & 0xFF) != vpd->vpd_checksum)
+		return (0);
+
+	checksum = 0;
+	maxaddr = offsetof(struct vpd_config, checksum);
+	for (i = offsetof(struct vpd_config, default_target_flags);
+	     i < maxaddr; i++)
+		checksum = checksum + vpdarray[i];
+	if (checksum == 0
+	 || (-checksum & 0xFF) != vpd->checksum)
+		return (0);
+	return (1);
+}
+
 int
 ahd_verify_cksum(struct seeprom_config *sc)
 {
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_inline.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_inline.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_inline.h	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_inline.h	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#41 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#44 $
  *
  * $FreeBSD$
  */
@@ -678,7 +678,8 @@
 	 * Razor #528
 	 */
 	value = ahd_inb(ahd, offset);
-	ahd_inb(ahd, MODE_PTR);
+	if ((ahd->flags & AHD_PCIX_SCBRAM_RD_BUG) != 0)
+		ahd_inb(ahd, MODE_PTR);
 	return (value);
 }
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm.c	2003-04-07 10:31:44.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  * Adaptec AIC79xx device driver for Linux.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#115 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#141 $
  *
  * --------------------------------------------------------------------------
  * Copyright (c) 1994-2000 Justin T. Gibbs.
@@ -460,12 +460,12 @@
 "		Set tag depth on Controller 2/Target 2 to 10 tags\n"
 "		Shorten the selection timeout to 128ms\n"
 "\n"
-"	options aic79xx='\"verbose.tag_info:{{}.{}.{..10}}.seltime:1\"'\n"
+"	options aic79xx 'aic79xx=verbose.tag_info:{{}.{}.{..10}}.seltime:1'\n"
 "\n"
 "	Sample /etc/modules.conf line:\n"
 "		Change Read Streaming for Controller's 2 and 3\n"
 "\n"
-"	options aic79xx='\"rd_strm:{..0xFFF0.0xC0F0}\"'");
+"	options aic79xx 'aic79xx=rd_strm:{..0xFFF0.0xC0F0}'");
 #endif
 
 static void ahd_linux_handle_scsi_status(struct ahd_softc *,
@@ -482,6 +482,7 @@
 static void ahd_linux_start_dv(struct ahd_softc *ahd);
 static void ahd_linux_dv_timeout(struct scsi_cmnd *cmd);
 static int  ahd_linux_dv_thread(void *data);
+static void ahd_linux_kill_dv_thread(struct ahd_softc *ahd);
 static void ahd_linux_dv_target(struct ahd_softc *ahd, u_int target);
 static void ahd_linux_dv_transition(struct ahd_softc *ahd,
 				    struct scsi_cmnd *cmd,
@@ -526,6 +527,7 @@
 static u_int ahd_linux_user_tagdepth(struct ahd_softc *ahd,
 				     struct ahd_devinfo *devinfo);
 static u_int ahd_linux_user_dv_setting(struct ahd_softc *ahd);
+static void ahd_linux_setup_user_rd_strm_settings(struct ahd_softc *ahd);
 static void ahd_linux_device_queue_depth(struct ahd_softc *ahd,
 					 struct ahd_linux_device *dev);
 static struct ahd_linux_target*	ahd_linux_alloc_target(struct ahd_softc*,
@@ -539,11 +541,11 @@
 						      struct ahd_linux_device*);
 static void ahd_linux_run_device_queue(struct ahd_softc*,
 				       struct ahd_linux_device*);
-static void ahd_linux_setup_tag_info(char *p, char *end, char *s);
 static void ahd_linux_setup_tag_info_global(char *p);
-static void ahd_linux_setup_rd_strm_info(char *p, char *end, char *s);
-static void ahd_linux_setup_dv(char *p, char *end, char *s);
-static void ahd_linux_setup_iocell_info(char *p, char *end, char *s, int index);
+static aic_option_callback_t ahd_linux_setup_tag_info;
+static aic_option_callback_t ahd_linux_setup_rd_strm_info;
+static aic_option_callback_t ahd_linux_setup_dv;
+static aic_option_callback_t ahd_linux_setup_iocell_info;
 static int ahd_linux_next_unit(void);
 static void ahd_runq_tasklet(unsigned long data);
 static int ahd_linux_halt(struct notifier_block *nb, u_long event, void *buf);
@@ -599,6 +601,9 @@
 	}
 }
 
+/*
+ * Must be called with our lock held.
+ */
 static __inline void
 ahd_schedule_runq(struct ahd_softc *ahd)
 {
@@ -662,8 +667,8 @@
 	u_long	done_flags;
 	int	with_errors;
 
-	ahd_done_lock(ahd, &done_flags);
 	with_errors = 0;
+	ahd_done_lock(ahd, &done_flags);
 	while (acmd != NULL) {
 		Scsi_Cmnd *cmd;
 
@@ -994,9 +999,13 @@
 				   cmd->device->id, cmd->device->lun,
 				   /*alloc*/TRUE);
 	if (dev == NULL) {
+		ahd_cmd_set_transaction_status(cmd, CAM_RESRC_UNAVAIL);
+		ahd_linux_queue_cmd_complete(ahd, cmd);
+		ahd_schedule_completeq(ahd, NULL);
 		ahd_midlayer_entrypoint_unlock(ahd, &flags);
-		printf("aic79xx_linux_queue: Unable to allocate device!\n");
-		return (-ENOMEM);
+		printf("%s: aic79xx_linux_queue - Unable to allocate device!\n",
+		       ahd_name(ahd));
+		return (0);
 	}
 	if (cmd->cmd_len > MAX_CDB_LEN)
 		return (-EINVAL);
@@ -1098,7 +1107,7 @@
 	int	scbnum;
 
 	ahd = *((struct ahd_softc **)host->hostdata);
-	ahd_midlayer_entrypoint_lock(ahd, &flags);
+	ahd_lock(ahd, &flags);
 	scbnum = 0;
 	for (device = scsi_devs; device != NULL; device = device->next) {
 
@@ -1133,7 +1142,7 @@
 			}
 		}
 	}
-	ahd_midlayer_entrypoint_unlock(ahd, &flags);
+	ahd_unlock(ahd, &flags);
 }
 #endif
 
@@ -1215,6 +1224,7 @@
 	u_int  saved_scbptr;
 	u_int  active_scbptr;
 	u_int  last_phase;
+	u_int  cdb_byte;
 	int    retval;
 	int    paused;
 	int    wait;
@@ -1227,9 +1237,12 @@
 	ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
 	acmd = (struct ahd_cmd *)cmd;
 
-	printf("%s:%d:%d:%d: Attempting to abort cmd %p\n",
+	printf("%s:%d:%d:%d: Attempting to abort cmd %p:",
 	       ahd_name(ahd), cmd->device->channel, cmd->device->id,
 	       cmd->device->lun, cmd);
+	for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++)
+		printf(" 0x%x", cmd->cmnd[cdb_byte]);
+	printf("\n");
 
 	/*
 	 * In all versions of Linux, we have to work around
@@ -1245,9 +1258,6 @@
 	 * by acquiring either the io_request_lock or our own
 	 * lock, this *should* be safe.
 	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irq(&io_request_lock);
-#endif
 	ahd_midlayer_entrypoint_lock(ahd, &s);
 
 	/*
@@ -1456,14 +1466,10 @@
 		struct timer_list timer;
 		int ret;
 
-		ahd->platform_data->flags |= AHD_UP_EH_SEMAPHORE;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-		ahd_unlock(ahd, &s);
-#else
-		spin_unlock_irq(ahd->platform_data->host->host_lock);
-#endif
+		pending_scb->platform_data->flags |= AHD_SCB_UP_EH_SEM;
+		spin_unlock_irq(&ahd->platform_data->spin_lock);
 		init_timer(&timer);
-		timer.data = (u_long)ahd;
+		timer.data = (u_long)pending_scb;
 		timer.expires = jiffies + (5 * HZ);
 		timer.function = ahd_linux_sem_timeout;
 		add_timer(&timer);
@@ -1475,27 +1481,17 @@
 			printf("Timer Expired\n");
 			retval = FAILED;
 		}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-		ahd_lock(ahd, &s);
-#else
-		spin_lock_irq(ahd->platform_data->host->host_lock);
-#endif
+		spin_lock_irq(&ahd->platform_data->spin_lock);
 	}
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-	ahd_midlayer_entrypoint_unlock(ahd, &s);
+	ahd_schedule_runq(ahd);
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
-		if (acmd != NULL) {
-			ahd_midlayer_entrypoint_lock(ahd, &s);
+		if (acmd != NULL)
 			ahd_schedule_completeq(ahd, acmd);
-			ahd_midlayer_entrypoint_unlock(ahd, &s);
-		}
 	}
-	ahd_schedule_runq(ahd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_lock_irq(&io_request_lock);
-#endif
+	ahd_midlayer_entrypoint_unlock(ahd, &s);
 	return (retval);
 }
 
@@ -1524,9 +1520,6 @@
 	struct	timer_list timer;
 	int	retval;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irq(&io_request_lock);
-#endif
 	ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
 	recovery_cmd = malloc(sizeof(struct scsi_cmnd), M_DEVBUF, M_WAITOK);
 	memset(recovery_cmd, 0, sizeof(struct scsi_cmnd));
@@ -1577,14 +1570,10 @@
 	LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links);
 	ahd_queue_scb(ahd, scb);
 
-	ahd->platform_data->flags |= AHD_UP_EH_SEMAPHORE;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_unlock(ahd, &s);
-#else
-	spin_unlock_irq(ahd->platform_data->host->host_lock);
-#endif
+	scb->platform_data->flags |= AHD_SCB_UP_EH_SEM;
+	spin_unlock_irq(&ahd->platform_data->spin_lock);
 	init_timer(&timer);
-	timer.data = (u_long)ahd;
+	timer.data = (u_long)scb;
 	timer.expires = jiffies + (5 * HZ);
 	timer.function = ahd_linux_sem_timeout;
 	add_timer(&timer);
@@ -1596,26 +1585,16 @@
 		printf("Timer Expired\n");
 		retval = FAILED;
 	}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_lock(ahd, &s);
-#else
-	spin_lock_irq(ahd->platform_data->host->host_lock);
-#endif
+	spin_lock_irq(&ahd->platform_data->spin_lock);
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-	ahd_midlayer_entrypoint_unlock(ahd, &s);
+	ahd_schedule_runq(ahd);
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
-		if (acmd != NULL) {
-			ahd_midlayer_entrypoint_lock(ahd, &s);
+		if (acmd != NULL)
 			ahd_schedule_completeq(ahd, acmd);
-			ahd_midlayer_entrypoint_unlock(ahd, &s);
-		}
 	}
-	ahd_schedule_runq(ahd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_lock_irq(&io_request_lock);
-#endif
+	ahd_midlayer_entrypoint_unlock(ahd, &s);
 	printf("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval);
 	return (retval);
 }
@@ -1631,9 +1610,6 @@
 	u_long s;
 	int    found;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irq(&io_request_lock);
-#endif
 	ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
 #ifdef AHD_DEBUG
 	if ((ahd_debug & AHD_SHOW_RECOVERY) != 0)
@@ -1645,23 +1621,18 @@
 				  /*initiate reset*/TRUE);
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-	ahd_midlayer_entrypoint_unlock(ahd, &s);
-	if (bootverbose)
-		printf("%s: SCSI bus reset delivered. "
-		       "%d SCBs aborted.\n", ahd_name(ahd), found);
 
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
-		if (acmd != NULL) {
-			ahd_midlayer_entrypoint_lock(ahd, &s);
+		if (acmd != NULL)
 			ahd_schedule_completeq(ahd, acmd);
-			ahd_midlayer_entrypoint_unlock(ahd, &s);
-		}
 	}
+	ahd_midlayer_entrypoint_unlock(ahd, &s);
+
+	if (bootverbose)
+		printf("%s: SCSI bus reset delivered. "
+		       "%d SCBs aborted.\n", ahd_name(ahd), found);
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_lock_irq(&io_request_lock);
-#endif
 	return (SUCCESS);
 }
 
@@ -1691,7 +1662,7 @@
 	.max_sectors		= 8192,
 #endif
 #if defined CONFIG_HIGHIO || LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
 /* Assume RedHat Distribution with its different HIGHIO conventions. */
 	.can_dma_32		= 1,
 	.single_sg_okay		= 1,
@@ -1713,15 +1684,25 @@
 
 /**************************** Tasklet Handler *********************************/
 
+/*
+ * In 2.4.X and above, this routine is called from a tasklet,
+ * so we must re-acquire our lock prior to executing this code.
+ * In all prior kernels, ahd_schedule_runq() calls this routine
+ * directly and ahd_schedule_runq() is called with our lock held.
+ */
 static void
 ahd_runq_tasklet(unsigned long data)
 {
 	struct ahd_softc* ahd;
 	struct ahd_linux_device *dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	u_long flags;
+#endif
 
 	ahd = (struct ahd_softc *)data;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	ahd_lock(ahd, &flags);
+#endif
 	while ((dev = ahd_linux_next_device_to_run(ahd)) != NULL) {
 	
 		TAILQ_REMOVE(&ahd->platform_data->device_runq, dev, links);
@@ -1731,7 +1712,9 @@
 		ahd_unlock(ahd, &flags);
 		ahd_lock(ahd, &flags);
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	ahd_unlock(ahd, &flags);
+#endif
 }
 
 /************************ Shutdown/halt/reboot hook ***************************/
@@ -1890,361 +1873,109 @@
 }
 
 /********************* Platform Dependent Functions ***************************/
+/*
+ * Compare "left hand" softc with "right hand" softc, returning:
+ * < 0 - lahd has a lower priority than rahd
+ *   0 - Softcs are equal
+ * > 0 - lahd has a higher priority than rahd
+ */
 int
 ahd_softc_comp(struct ahd_softc *lahd, struct ahd_softc *rahd)
 {
 	int	value;
-	char	primary_channel;
 
 	/*
 	 * Under Linux, cards are ordered as follows:
-	 *	1) PCI devices with BIOS enabled sorted by bus/slot/func.
-	 *	2) All remaining PCI devices sorted by bus/slot/func.
-	 */
+	 *	1) PCI devices that are marked as the boot controller.
+	 *	2) PCI devices with BIOS enabled sorted by bus/slot/func.
+	 *	3) All remaining PCI devices sorted by bus/slot/func.
+	 */
+#if 0
+	value = (lahd->flags & AHD_BOOT_CHANNEL)
+	      - (rahd->flags & AHD_BOOT_CHANNEL);
+	if (value != 0)
+		/* Controllers set for boot have a *higher* priority */
+		return (value);
+#endif
+
 	value = (lahd->flags & AHD_BIOS_ENABLED)
 	      - (rahd->flags & AHD_BIOS_ENABLED);
 	if (value != 0)
 		/* Controllers with BIOS enabled have a *higher* priority */
-		return (-value);
+		return (value);
 
 	/* Still equal.  Sort by bus/slot/func. */
 	if (aic79xx_reverse_scan != 0)
-		value = ahd_get_pci_bus(rahd->dev_softc)
-		      - ahd_get_pci_bus(lahd->dev_softc);
-	else
 		value = ahd_get_pci_bus(lahd->dev_softc)
 		      - ahd_get_pci_bus(rahd->dev_softc);
+	else
+		value = ahd_get_pci_bus(rahd->dev_softc)
+		      - ahd_get_pci_bus(lahd->dev_softc);
 	if (value != 0)
 		return (value);
 	if (aic79xx_reverse_scan != 0)
-		value = ahd_get_pci_slot(rahd->dev_softc)
-		      - ahd_get_pci_slot(lahd->dev_softc);
-	else
 		value = ahd_get_pci_slot(lahd->dev_softc)
 		      - ahd_get_pci_slot(rahd->dev_softc);
+	else
+		value = ahd_get_pci_slot(rahd->dev_softc)
+		      - ahd_get_pci_slot(lahd->dev_softc);
 	if (value != 0)
 		return (value);
 
-	/*
-	 * On multi-function devices, the user can choose
-	 * to have function 1 probed before function 0.
-	 * Give whichever channel is the primary channel
-	 * the lowest priority.
-	 */
-	primary_channel = (lahd->flags & AHD_PRIMARY_CHANNEL) + 'A';
-	value = 1;
-	if (lahd->channel == primary_channel)
-		value = -1;
+	value = rahd->channel - lahd->channel;
 	return (value);
 }
 
 static void
-ahd_linux_setup_tag_info(char *p, char *end, char *s)
+ahd_linux_setup_tag_info(void *arg, int instance, int targ, int32_t value)
 {
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	int      i;
-	int      instance;
-	int	 targ;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
 
-	if (*p != ':')
-		return;
-
-	instance = -1;
-	targ = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			else if (targ == -1)
-				targ = 0;
-			tok++;
-			break;
-		case '}':
-			if (targ != -1)
-				targ = -1;
-			else if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (targ >= 0)
-				targ++;
-			else if (instance >= 0)
-				instance++;
-			if ((targ >= AHD_NUM_TARGETS) ||
-			    (instance >= NUM_ELEMENTS(aic79xx_tag_info)))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0) && (targ >= 0)
-			 && (instance < NUM_ELEMENTS(aic79xx_tag_info))
-			 && (targ < AHD_NUM_TARGETS)) {
-				aic79xx_tag_info[instance].tag_commands[targ] =
-				    simple_strtoul(tok, NULL, 0) & 0xff;
-			}
-			tok = tok_end;
-			break;
-		}
+	if ((instance >= 0) && (targ >= 0)
+	 && (instance < NUM_ELEMENTS(aic79xx_tag_info))
+	 && (targ < AHD_NUM_TARGETS)) {
+		aic79xx_tag_info[instance].tag_commands[targ] = value & 0x1FF;
+		if (bootverbose)
+			printf("tag_info[%d:%d] = %d\n", instance, targ, value);
 	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
 }
 
 static void
-ahd_linux_setup_rd_strm_info(char *p, char *end, char *s)
+ahd_linux_setup_rd_strm_info(void *arg, int instance, int targ, int32_t value)
 {
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	int      i;
-	int      instance;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
-
-	if (*p != ':')
-		return;
-
-	instance = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			tok++;
-			break;
-		case '}':
-			if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (instance >= 0)
-				instance++;
-			if (instance >= NUM_ELEMENTS(aic79xx_rd_strm_info))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0)
-			 && (instance < NUM_ELEMENTS(aic79xx_rd_strm_info))) {
-				aic79xx_rd_strm_info[instance] =
-				    simple_strtoul(tok, NULL, 0) & 0xffff;
-			}
-			tok = tok_end;
-			break;
-		}
+	if ((instance >= 0)
+	 && (instance < NUM_ELEMENTS(aic79xx_rd_strm_info))) {
+		aic79xx_rd_strm_info[instance] = value * 0xFFFF;
+		if (bootverbose)
+			printf("rd_strm[%d] = 0x%x\n", instance, value);
 	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
 }
 
 static void
-ahd_linux_setup_dv(char *p, char *end, char *s)
+ahd_linux_setup_dv(void *arg, int instance, int targ, int32_t value)
 {
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	int      i;
-	int      instance;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
-
-	if (*p != ':')
-		return;
-
-	instance = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			tok++;
-			break;
-		case '}':
-			if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (instance >= 0)
-				instance++;
-			if (instance >= NUM_ELEMENTS(aic79xx_dv_settings))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0)
-			 && (instance < NUM_ELEMENTS(aic79xx_dv_settings))) {
-				aic79xx_dv_settings[instance] =
-				    simple_strtol(tok, NULL, 0);
-			}
-			tok = tok_end;
-			break;
-		}
+	if ((instance >= 0)
+	 && (instance < NUM_ELEMENTS(aic79xx_dv_settings))) {
+		aic79xx_dv_settings[instance] = value;
+		if (bootverbose)
+			printf("dv[%d] = %d\n", instance, value);
 	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
 }
 
 static void
-ahd_linux_setup_iocell_info(char *p, char *end, char *s, int index)
+ahd_linux_setup_iocell_info(void *arg, int instance, int targ, int32_t value)
 {
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	uint8_t	*iocell_info;
-	int      i;
-	int      instance;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
-
-	if (*p != ':')
-		return;
+	u_int index;
 
-	instance = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			tok++;
-			break;
-		case '}':
-			if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (instance >= 0)
-				instance++;
-			if (instance >= NUM_ELEMENTS(aic79xx_iocell_info))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0)
-			 && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) {
-				iocell_info =
-				    (uint8_t*)&aic79xx_iocell_info[instance];
-				iocell_info[index] = 
-				    simple_strtoul(tok, NULL, 0) & 0xffff;
-			}
-			tok = tok_end;
-			break;
-		}
+	index = (u_int)arg;
+	if ((instance >= 0)
+	 && (instance < NUM_ELEMENTS(aic79xx_iocell_info))) {
+		uint8_t *iocell_info;
+
+		iocell_info = (uint8_t*)&aic79xx_iocell_info[instance];
+		iocell_info[index] = value & 0xFFFF;
+		if (bootverbose)
+			printf("iocell[%d:%d] = %d\n", instance, index, value);
 	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
 }
 
 static void
@@ -2300,41 +2031,54 @@
 
 	end = strchr(s, '\0');
 
+	/*
+	 * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS
+	 * will never be 0 in this case.
+	 */      
+	n = 0;  
+
 	while ((p = strsep(&s, ",.")) != NULL) {
 		if (*p == '\0')
 			continue;
 		for (i = 0; i < NUM_ELEMENTS(options); i++) {
-			n = strlen(options[i].name);
 
-			if (strncmp(options[i].name, p, n) != 0)
-				continue;
+			n = strlen(options[i].name);
+			if (strncmp(options[i].name, p, n) == 0)
+				break;
+		}
+		if (i == NUM_ELEMENTS(options))
+			continue;
 
-			if (!strncmp(p, "global_tag_depth", n)) {
-				ahd_linux_setup_tag_info_global(p + n);
-			} else if (!strncmp(p, "tag_info", n)) {
-				ahd_linux_setup_tag_info(p + n, end, s);
-			} else if (strncmp(p, "rd_strm", n) == 0) {
-				ahd_linux_setup_rd_strm_info(p + n, end, s);
-			} else if (strncmp(p, "dv", n) == 0) {
-				ahd_linux_setup_dv(p + n, end, s);
-			} else if (strncmp(p, "slewrate", n) == 0) {
-				ahd_linux_setup_iocell_info(p + n, end, s,
-				    AIC79XX_SLEWRATE_INDEX);
-			} else if (strncmp(p, "precomp", n) == 0) {
-				ahd_linux_setup_iocell_info(p + n, end, s,
-				    AIC79XX_PRECOMP_INDEX);
-			} else if (strncmp(p, "amplitude", n) == 0) {
-				ahd_linux_setup_iocell_info(p + n, end, s,
-				    AIC79XX_AMPLITUDE_INDEX);
-			} else if (p[n] == ':') {
-				*(options[i].flag) =
-				    simple_strtoul(p + n + 1, NULL, 0);
-			} else if (!strncmp(p, "verbose", n)) {
-				*(options[i].flag) = 1;
-			} else {
-				*(options[i].flag) = ~(*(options[i].flag));
-			}
-			break;
+		if (strncmp(p, "global_tag_depth", n) == 0) {
+			ahd_linux_setup_tag_info_global(p + n);
+		} else if (strncmp(p, "tag_info", n) == 0) {
+			s = aic_parse_brace_option("tag_info", p + n, end,
+			    2, ahd_linux_setup_tag_info, NULL);
+		} else if (strncmp(p, "rd_strm", n) == 0) {
+			printf("Calling brace parse for %s\n", p);
+			s = aic_parse_brace_option("rd_strm", p + n, end,
+			    1, ahd_linux_setup_rd_strm_info, NULL);
+		} else if (strncmp(p, "dv", n) == 0) {
+			s = aic_parse_brace_option("dv", p + n, end, 1,
+			    ahd_linux_setup_dv, NULL);
+		} else if (strncmp(p, "slewrate", n) == 0) {
+			s = aic_parse_brace_option("slewrate",
+			    p + n, end, 1, ahd_linux_setup_iocell_info,
+			    (void *)AIC79XX_SLEWRATE_INDEX);
+		} else if (strncmp(p, "precomp", n) == 0) {
+			s = aic_parse_brace_option("precomp",
+			    p + n, end, 1, ahd_linux_setup_iocell_info,
+			    (void *)AIC79XX_PRECOMP_INDEX);
+		} else if (strncmp(p, "amplitude", n) == 0) {
+			s = aic_parse_brace_option("amplitude",
+			    p + n, end, 1, ahd_linux_setup_iocell_info,
+			    (void *)AIC79XX_AMPLITUDE_INDEX);
+		} else if (p[n] == ':') {
+			*(options[i].flag) = simple_strtoul(p + n + 1, NULL, 0);
+		} else if (!strncmp(p, "verbose", n)) {
+			*(options[i].flag) = 1;
+		} else {
+			*(options[i].flag) = ~(*(options[i].flag));
 		}
 	}
 	return 1;
@@ -2364,6 +2108,8 @@
 	ahd_lock(ahd, &s);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	scsi_assign_lock(host, &ahd->platform_data->spin_lock);
+#elif AHD_SCSI_HAS_HOST_LOCK != 0
+	host->lock = &ahd->platform_data->spin_lock;
 #endif
 	ahd->platform_data->host = host;
 	host->can_queue = AHD_MAX_QUEUE;
@@ -2383,9 +2129,10 @@
 	}
 	host->unique_id = ahd->unit;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) && \
-    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+    LINUX_VERSION_CODE  < KERNEL_VERSION(2,5,0)
 	scsi_set_pci_device(host, ahd->dev_softc);
 #endif
+	ahd_linux_setup_user_rd_strm_settings(ahd);
 	ahd_linux_initialize_scsi_bus(ahd);
 	ahd_unlock(ahd, &s);
 	ahd->platform_data->dv_pid = kernel_thread(ahd_linux_dv_thread, ahd, 0);
@@ -2405,13 +2152,28 @@
 	 * negotiation will occur for the first command, and DV
 	 * will comence should that first command be successful.
 	 */
-	for (target = 0; target < host->max_id; target++)
+	for (target = 0; target < host->max_id; target++) {
+
+		/*
+		 * Skip our own ID.  Some Compaq/HP storage devices
+		 * have enclosure management devices that respond to
+		 * single bit selection (i.e. selecting ourselves).
+		 * It is expected that either an external application
+		 * or a modified kernel will be used to probe this
+		 * ID if it is appropriate.  To accommodate these
+		 * installations, ahc_linux_alloc_target() will allocate
+		 * for our ID if asked to do so.
+		 */
+		if (target == ahd->our_id) 
+			continue;
+
 		ahd_linux_alloc_target(ahd, 0, target);
+	}
 	ahd_intr_enable(ahd, TRUE);
 	ahd_linux_start_dv(ahd);
 	ahd_unlock(ahd, &s);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	scsi_add_host(host, &ahd->dev_softc->dev);
 #endif
 	return (0);
@@ -2539,29 +2301,13 @@
 {
 	struct ahd_linux_target *targ;
 	struct ahd_linux_device *dev;
-	u_long s;
 	int i, j;
 
 	if (ahd->platform_data != NULL) {
-		/* Kill the DV kthread */
-		if (ahd->platform_data->dv_pid != 0) {
-			ahd_lock(ahd, &s);
-			ahd->platform_data->flags |= AHD_DV_SHUTDOWN;
-			ahd_unlock(ahd, &s);
-			up(&ahd->platform_data->dv_sem);
-			do {
-#ifdef AHD_DEBUG
-				if (ahd_debug & AHD_SHOW_DV) {
-					printf("%s: Waiting for DV thread to "
-					       "exit\n", ahd_name(ahd));
-				}
-#endif
-			} while (waitpid(ahd->platform_data->dv_pid, NULL,
-					 __WCLONE) == -ERESTARTSYS);
-		}
+		ahd_linux_kill_dv_thread(ahd);
 		ahd_teardown_runq_tasklet(ahd);
 		if (ahd->platform_data->host != NULL) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 			scsi_remove_host(ahd->platform_data->host);
 #endif
 			scsi_unregister(ahd->platform_data->host);
@@ -2604,10 +2350,12 @@
 #endif
 		}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) && \
-    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+    LINUX_VERSION_CODE  < KERNEL_VERSION(2,5,0)
     		/*
 		 * In 2.4 we detach from the scsi midlayer before the PCI
-		 * layer invokes our remove callback.
+		 * layer invokes our remove callback.  No per-instance
+		 * detach is provided, so we must reach inside the PCI
+		 * subsystem's internals and detach our driver manually.
 		 */
 		if (ahd->dev_softc != NULL)
 			ahd->dev_softc->driver = NULL;
@@ -2659,7 +2407,18 @@
 	if (dev == NULL)
 		return;
 	was_queuing = dev->flags & (AHD_DEV_Q_BASIC|AHD_DEV_Q_TAGGED);
-	now_queuing = alg != AHD_QUEUE_NONE;
+	switch (alg) {
+	default:
+	case AHD_QUEUE_NONE:
+		now_queuing = 0;
+		break; 
+	case AHD_QUEUE_BASIC:
+		now_queuing = AHD_DEV_Q_BASIC;
+		break;
+	case AHD_QUEUE_TAGGED:
+		now_queuing = AHD_DEV_Q_TAGGED;
+		break;
+	}
 	if ((dev->flags & AHD_DEV_FREEZE_TIL_EMPTY) == 0
 	 && (was_queuing != now_queuing)
 	 && (dev->active != 0)) {
@@ -2795,24 +2554,12 @@
 	ahd->platform_data->flags &= ~AHD_RUN_CMPLT_Q_TIMER;
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_unlock(ahd, &flags);
-#endif
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
-		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_lock(ahd, &flags);
-#endif
+		if (acmd != NULL)
 			ahd_schedule_completeq(ahd, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_unlock(ahd, &flags);
-#endif
-		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahd_unlock(ahd, &flags);
-#endif
 }
 
 static void
@@ -2852,15 +2599,20 @@
 #endif
 
 	/*
+	 * Complete thread creation.
+	 */
+	lock_kernel();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,60)
+	/*
 	 * Don't care about any signals.
 	 */
 	siginitsetinv(&current->blocked, 0);
 
-	/*
-	 * Complete thread creation.
-	 */
-	lock_kernel();
+	daemonize();
+	sprintf(current->comm, "ahd_dv_%d", ahd->unit);
+#else
 	daemonize("ahd_dv_%d", ahd->unit);
+#endif
 	unlock_kernel();
 
 	while (1) {
@@ -2874,7 +2626,7 @@
 		ahd_lock(ahd, &s);
 		if ((ahd->platform_data->flags & AHD_DV_SHUTDOWN) != 0) {
 			ahd_unlock(ahd, &s);
-			return (0);
+			break;
 		}
 		ahd_unlock(ahd, &s);
 
@@ -2920,10 +2672,52 @@
 		 */
 		ahd_release_simq(ahd);
 	}
-
+	up(&ahd->platform_data->eh_sem);
 	return (0);
 }
 
+static void
+ahd_linux_kill_dv_thread(struct ahd_softc *ahd)
+{
+	u_long s;
+
+	ahd_lock(ahd, &s);
+	if (ahd->platform_data->dv_pid != 0) {
+		ahd->platform_data->flags |= AHD_DV_SHUTDOWN;
+		ahd_unlock(ahd, &s);
+		up(&ahd->platform_data->dv_sem);
+
+		/*
+		 * Use the eh_sem as an indicator that the
+		 * dv thread is exiting.  Note that the dv
+		 * thread must still return after performing
+		 * the up on our semaphore before it has
+		 * completely exited this module.  Unfortunately,
+		 * there seems to be no easy way to wait for the
+		 * exit of a thread for which you are not the
+		 * parent (dv threads are parented by init).
+		 * Cross your fingers...
+		 */
+		down(&ahd->platform_data->eh_sem);
+
+		/*
+		 * Mark the dv thread as already dead.  This
+		 * avoids attempting to kill it a second time.
+		 * This is necessary because we must kill the
+		 * DV thread before calling ahd_free() in the
+		 * module shutdown case to avoid bogus locking
+		 * in the SCSI mid-layer, but we ahd_free() is
+		 * called without killing the DV thread in the
+		 * instance detach case, so ahd_platform_free()
+		 * calls us again to verify that the DV thread
+		 * is dead.
+		 */
+		ahd->platform_data->dv_pid = 0;
+	} else {
+		ahd_unlock(ahd, &s);
+	}
+}
+
 #define AHD_LINUX_DV_INQ_SHORT_LEN	36
 #define AHD_LINUX_DV_INQ_LEN		256
 #define AHD_LINUX_DV_TIMEOUT		(HZ / 4)
@@ -3026,6 +2820,7 @@
 		}
 		case AHD_DV_STATE_TUR:
 		case AHD_DV_STATE_BUSY:
+			timeout = 5 * HZ;
 			ahd_linux_dv_tur(ahd, cmd, &devinfo);
 			break;
 		case AHD_DV_STATE_REBD:
@@ -3066,14 +2861,19 @@
 		/*
 		 * In 2.5.X, it is assumed that all calls from the
 		 * "midlayer" (which we are emulating) will have the
-		 * ahd host lock held.
+		 * ahd host lock held.  For other kernels, the
+		 * io_request_lock must be held.
 		 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#if AHD_SCSI_HAS_HOST_LOCK != 0
 		ahd_lock(ahd, &s);
+#else
+		spin_lock_irqsave(&io_request_lock, s);
 #endif
 		ahd_linux_queue(cmd, ahd_linux_dv_complete);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#if AHD_SCSI_HAS_HOST_LOCK != 0
 		ahd_unlock(ahd, &s);
+#else
+		spin_unlock_irqrestore(&io_request_lock, s);
 #endif
 		down_interruptible(&ahd->platform_data->dv_cmd_sem);
 		/*
@@ -3961,7 +3761,6 @@
 {
 	struct	ahd_softc *ahd;
 	struct	ahd_cmd *acmd;
-	struct	ahd_linux_device *next_dev;
 	struct	scb *scb;
 	u_long	flags;
 
@@ -4008,36 +3807,17 @@
 	ahd->platform_data->reset_timer.function =
 	    (ahd_linux_callback_t *)ahd_release_simq;
 	add_timer(&ahd->platform_data->reset_timer);
-	/*
-	 * In 2.5.X, the "done lock" is the ahd_lock.
-	 * Instead of dropping and re-acquiring the same
-	 * lock in the 2.5.X case, just hold our ahd_lock
-	 * the whole time.  ahd_done_lock() has been
-	 * made a no-op for 2.5.X too.
-	 */
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-	next_dev = ahd_linux_next_device_to_run(ahd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_unlock(ahd, &flags);
-#endif
-	if (next_dev)
+	if (ahd_linux_next_device_to_run(ahd) != NULL)
 		ahd_schedule_runq(ahd);
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
 		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_lock(ahd, &flags);
-#endif
 			ahd_schedule_completeq(ahd, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_unlock(ahd, &flags);
-#endif
 		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahd_unlock(ahd, &flags);
-#endif
 }
 
 static void
@@ -4126,17 +3906,17 @@
 
 	tags = 0;
 	if ((ahd->user_discenable & devinfo->target_mask) != 0) {
-		if (warned_user == 0
-		 && ahd->unit >= NUM_ELEMENTS(aic79xx_tag_info)) {
+		if (ahd->unit >= NUM_ELEMENTS(aic79xx_tag_info)) {
 
-			printf("aic79xx: WARNING, insufficient "
-			       "tag_info instances for installed "
-			       "controllers. Using defaults\n");
-			printf("aic79xx: Please update the "
-			       "aic79xx_tag_info array in the "
-			       "aic79xx.c source file.\n");
+			if (warned_user == 0) {
+				printf(KERN_WARNING
+"aic79xx: WARNING: Insufficient tag_info instances\n"
+"aic79xx: for installed controllers.  Using defaults\n"
+"aic79xx: Please update the aic79xx_tag_info array in\n"
+"aic79xx: the aic79xx_osm.c source file.\n");
+				warned_user++;
+			}
 			tags = AHD_MAX_QUEUE;
-			warned_user++;
 		} else {
 			adapter_tag_info_t *tag_info;
 
@@ -4155,17 +3935,17 @@
 	static int warned_user;
 	int dv;
 
-	if (warned_user == 0
-	 && ahd->unit >= NUM_ELEMENTS(aic79xx_dv_settings)) {
+	if (ahd->unit >= NUM_ELEMENTS(aic79xx_dv_settings)) {
 
-		printf("aic79xx: WARNING, insufficient "
-		       "dv settings instances for installed "
-		       "controllers. Using defaults\n");
-		printf("aic79xx: Please update the "
-		       "aic79xx_dv_settings array in the "
-		       "aic79xx.c source file.\n");
+		if (warned_user == 0) {
+			printf(KERN_WARNING
+"aic79xx: WARNING: Insufficient dv settings instances\n"
+"aic79xx: for installed controllers. Using defaults\n"
+"aic79xx: Please update the aic79xx_dv_settings array in"
+"aic79xx: the aic79xx_osm.c source file.\n");
+			warned_user++;
+		}
 		dv = -1;
-		warned_user++;
 	} else {
 
 		dv = aic79xx_dv_settings[ahd->unit];
@@ -4182,6 +3962,48 @@
 	return (dv);
 }
 
+static void
+ahd_linux_setup_user_rd_strm_settings(struct ahd_softc *ahd)
+{
+	static	int warned_user;
+	u_int	rd_strm_mask;
+	u_int	target_id;
+
+	/*
+	 * If we have specific read streaming info for this controller,
+	 * apply it.  Otherwise use the defaults.
+	 */
+	 if (ahd->unit >= NUM_ELEMENTS(aic79xx_rd_strm_info)) {
+
+		if (warned_user == 0) {
+
+			printf(KERN_WARNING
+"aic79xx: WARNING: Insufficient rd_strm instances\n"
+"aic79xx: for installed controllers. Using defaults\n"
+"aic79xx: Please update the aic79xx_rd_strm_info array\n"
+"aic79xx: in the aic79xx_osm.c source file.\n");
+			warned_user++;
+		}
+		rd_strm_mask = AIC79XX_CONFIGED_RD_STRM;
+	} else {
+
+		rd_strm_mask = aic79xx_rd_strm_info[ahd->unit];
+	}
+	for (target_id = 0; target_id < 16; target_id++) {
+		struct ahd_devinfo devinfo;
+		struct ahd_initiator_tinfo *tinfo;
+		struct ahd_tmode_tstate *tstate;
+
+		tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
+					    target_id, &tstate);
+		ahd_compile_devinfo(&devinfo, ahd->our_id, target_id,
+				    CAM_LUN_WILDCARD, 'A', ROLE_INITIATOR);
+		tinfo->user.ppr_options &= ~MSG_EXT_PPR_RD_STRM;
+		if ((rd_strm_mask & devinfo.target_mask) != 0)
+			tinfo->user.ppr_options |= MSG_EXT_PPR_RD_STRM;
+	}
+}
+
 /*
  * Determines the queue depth for a given device.
  */
@@ -4385,41 +4207,21 @@
 	struct	ahd_softc *ahd;
 	struct	ahd_cmd *acmd;
 	u_long	flags;
-	struct	ahd_linux_device *next_dev;
 
 	ahd = (struct ahd_softc *) dev_id;
 	ahd_lock(ahd, &flags); 
 	ahd_intr(ahd);
 	acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
 	TAILQ_INIT(&ahd->platform_data->completeq);
-	next_dev = ahd_linux_next_device_to_run(ahd);
-	/*
-	 * In 2.5.X, the "done lock" is the ahd_lock.
-	 * Instead of dropping and re-acquiring the same
-	 * lock in the 2.5.X case, just hold our ahd_lock
-	 * the whole time.  ahd_done_lock() has been
-	 * made a no-op for 2.5.X too.
-	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_unlock(ahd, &flags);
-#endif
-	if (next_dev)
+	if (ahd_linux_next_device_to_run(ahd) != NULL)
 		ahd_schedule_runq(ahd);
 	if (acmd != NULL) {
 		acmd = ahd_linux_run_complete_queue(ahd, acmd);
 		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_lock(ahd, &flags);
-#endif
 			ahd_schedule_completeq(ahd, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahd_unlock(ahd, &flags);
-#endif
 		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahd_unlock(ahd, &flags);
-#endif
 }
 
 void
@@ -4437,17 +4239,6 @@
 ahd_linux_alloc_target(struct ahd_softc *ahd, u_int channel, u_int target)
 {
 	struct ahd_linux_target *targ;
-	u_int target_offset;
-
-	target_offset = target;
-	/*
-	 * Never allow allocation of a target object for
-	 * our own SCSIID.
-	 */
-	if (target == ahd->our_id) {
-		ahd->platform_data->targets[target_offset] = NULL;
-		return (NULL);
-	}
 
 	targ = malloc(sizeof(*targ), M_DEVBUF, M_NOWAIT);
 	if (targ == NULL)
@@ -4457,7 +4248,7 @@
 	targ->target = target;
 	targ->ahd = ahd;
 	targ->flags = AHD_DV_REQUIRED;
-	ahd->platform_data->targets[target_offset] = targ;
+	ahd->platform_data->targets[target] = targ;
 	return (targ);
 }
 
@@ -4699,6 +4490,14 @@
 #endif
 			ahd_set_transaction_status(scb, CAM_UNCOR_PARITY);
 		} else if (amount_xferred < scb->io_ctx->underflow) {
+			u_int i;
+
+			ahd_print_path(ahd, scb);
+			printf("CDB:");
+			for (i = 0; i < scb->io_ctx->cmd_len; i++)
+				printf(" 0x%x", scb->io_ctx->cmnd[i]);
+			printf("\n");
+			ahd_print_path(ahd, scb);
 			printf("Saw underflow (%ld of %ld bytes). "
 			       "Treated as error\n",
 				ahd_get_residual(scb),
@@ -4755,8 +4554,8 @@
 		if (ahd_get_transaction_status(scb) == CAM_BDR_SENT
 		 || ahd_get_transaction_status(scb) == CAM_REQ_ABORTED)
 			ahd_set_transaction_status(scb, CAM_CMD_TIMEOUT);
-		if ((ahd->platform_data->flags & AHD_UP_EH_SEMAPHORE) != 0) {
-			ahd->platform_data->flags &= ~AHD_UP_EH_SEMAPHORE;
+		if ((scb->platform_data->flags & AHD_SCB_UP_EH_SEM) != 0) {
+			scb->platform_data->flags &= ~AHD_SCB_UP_EH_SEM;
 			up(&ahd->platform_data->eh_sem);
 		}
 	}
@@ -4869,7 +4668,7 @@
 			 */
 			dev->openings = 0;
 #ifdef AHD_DEBUG
-			if (ahd_debug & AHD_SHOW_QFULL) {
+			if ((ahd_debug & AHD_SHOW_QFULL) != 0) {
 				ahd_print_path(ahd, scb);
 				printf("Dropping tag count to %d\n",
 				       dev->active);
@@ -4899,7 +4698,7 @@
 			}
 			ahd_set_transaction_status(scb, CAM_REQUEUE_REQ);
 			ahd_set_scsi_status(scb, SCSI_STATUS_OK);
-			ahd_set_tags(ahd, &devinfo,
+			ahd_platform_set_tags(ahd, &devinfo,
 				     (dev->flags & AHD_DEV_Q_BASIC)
 				   ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED);
 			break;
@@ -4909,7 +4708,7 @@
 		 * as if the target returned BUSY SCSI status.
 		 */
 		dev->openings = 1;
-		ahd_set_tags(ahd, &devinfo,
+		ahd_platform_set_tags(ahd, &devinfo,
 			     (dev->flags & AHD_DEV_Q_BASIC)
 			   ? AHD_QUEUE_BASIC : AHD_QUEUE_TAGGED);
 		ahd_set_scsi_status(scb, SCSI_STATUS_BUSY);
@@ -5108,7 +4907,6 @@
 	u_int	ppr_options;
 	u_int	trans_version;
 	u_int	prot_version;
-	static	int warned_user;
 
 	/*
 	 * Determine if this lun actually exists.  If so,
@@ -5148,26 +4946,6 @@
 	prot_version = MIN(user->protocol_version, SID_ANSI_REV(sid));
 
 	/*
-	 * If we have read streaming info for this controller,
-	 * apply it to this target.
-	 */
-	if (warned_user == 0
-	 && ahd->unit >= NUM_ELEMENTS(aic79xx_rd_strm_info)) {
-
-		printf("aic79xx: WARNING, insufficient rd_strm instances "
-		       "for installed controllers. Using defaults\n");
-		printf("aic79xx: Please update the aic79xx_rd_strm_info "
-		       "array in the aic79xx_osm.c source file.\n");
-		warned_user++;
-	} else {
-		uint16_t rd_strm_mask;
-
-		rd_strm_mask = aic79xx_rd_strm_info[ahd->unit];
-		if ((rd_strm_mask & devinfo->target_mask) == 0)
-			ppr_options &= ~MSG_EXT_PPR_RD_STRM;
-	}
-	
-	/*
 	 * Only attempt SPI3/4 once we've verified that
 	 * the device claims to support SPI3/4 features.
 	 */
@@ -5242,6 +5020,7 @@
 		ahd->platform_data->flags &= ~AHD_DV_WAIT_SIMQ_RELEASE;
 		up(&ahd->platform_data->dv_sem);
 	}
+	ahd_schedule_runq(ahd);
 	ahd_unlock(ahd, &s);
 	/*
 	 * There is still a race here.  The mid-layer
@@ -5251,20 +5030,20 @@
 	 */
 	if (unblock_reqs)
 		scsi_unblock_requests(ahd->platform_data->host);
-
-	ahd_schedule_runq(ahd);
 }
 
 static void
 ahd_linux_sem_timeout(u_long arg)
 {
+	struct	scb *scb;
 	struct	ahd_softc *ahd;
 	u_long	s;
 
-	ahd = (struct ahd_softc *)arg;
+	scb = (struct scb *)arg;
+	ahd = scb->ahd_softc;
 	ahd_lock(ahd, &s);
-	if ((ahd->platform_data->flags & AHD_UP_EH_SEMAPHORE) != 0) {
-		ahd->platform_data->flags &= ~AHD_UP_EH_SEMAPHORE;
+	if ((scb->platform_data->flags & AHD_SCB_UP_EH_SEM) != 0) {
+		scb->platform_data->flags &= ~AHD_SCB_UP_EH_SEM;
 		up(&ahd->platform_data->eh_sem);
 	}
 	ahd_unlock(ahd, &s);
@@ -5320,13 +5099,14 @@
 	}
 }
 
-static int __init ahd_linux_init(void)
+static int __init
+ahd_linux_init(void)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
        return (ahd_linux_detect(&aic79xx_driver_template) ? 0 : -ENODEV);
 #else
 	scsi_register_module(MODULE_SCSI_HA, &aic79xx_driver_template);
-	if (!driver_template.present) {
+	if (aic79xx_driver_template.present == 0) {
 		scsi_unregister_module(MODULE_SCSI_HA,
 				       &aic79xx_driver_template);
 		return (-ENODEV);
@@ -5336,12 +5116,35 @@
 #endif
 }
 
-static void __exit ahd_linux_exit(void)
+static void __exit
+ahd_linux_exit(void)
 {
+	struct ahd_softc *ahd;
+	u_long l;
+
+	/*
+	 * Shutdown DV threads before going into the SCSI mid-layer.
+	 * This avoids situations where the mid-layer locks the entire
+	 * kernel so that waiting for our DV threads to exit leads
+	 * to deadlock.
+	 */
+	ahd_list_lock(&l);
+	TAILQ_FOREACH(ahd, &ahd_tailq, links) {
+
+		ahd_linux_kill_dv_thread(ahd);
+	}
+	ahd_list_unlock(&l);
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+	/*
+	 * In 2.4 we have to unregister from the PCI core _after_
+	 * unregistering from the scsi midlayer to avoid dangling
+	 * references.
+	 */
 	scsi_unregister_module(MODULE_SCSI_HA, &aic79xx_driver_template);
 #endif
 	ahd_linux_pci_exit();
+
+	unregister_reboot_notifier(&ahd_linux_notifier);
 }
 
 module_init(ahd_linux_init);
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm.h	2003-04-15 04:36:16.000000000 -0700
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#108 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#121 $
  *
  */
 #ifndef _AIC79XX_LINUX_H_
@@ -92,6 +92,7 @@
  * Compile in debugging code, but do not enable any printfs.
  */
 #define AHD_DEBUG 1
+#define AHD_DEBUG_OPTS 0
 #endif
 /* No debugging code. */
 #endif
@@ -286,7 +287,13 @@
 #include <linux/smp.h>
 #endif
 
-#define AIC79XX_DRIVER_VERSION "1.3.0"
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK))
+#define AHD_SCSI_HAS_HOST_LOCK 1
+#else
+#define AHD_SCSI_HAS_HOST_LOCK 0
+#endif
+
+#define AIC79XX_DRIVER_VERSION "1.3.5"
 
 /**************************** Front End Queues ********************************/
 /*
@@ -487,7 +494,7 @@
  * Per-SCB OSM storage.
  */
 typedef enum {
-	AHD_UP_EH_SEMAPHORE = 0x1
+	AHD_SCB_UP_EH_SEM = 0x1
 } ahd_linux_scb_flags;
 
 struct scb_platform_data {
@@ -733,7 +740,6 @@
 static __inline void
 ahd_lock(struct ahd_softc *ahd, unsigned long *flags)
 {
-	*flags = 0;
 	spin_lock_irqsave(&ahd->platform_data->spin_lock, *flags);
 }
 
@@ -747,23 +753,24 @@
 ahd_midlayer_entrypoint_lock(struct ahd_softc *ahd, unsigned long *flags)
 {
 	/*
-	 * In 2.5.X, the midlayer takes our lock just before
-	 * calling us, so avoid locking again.
-	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_lock(ahd, flags);
+	 * In 2.5.X and some 2.4.X versions, the midlayer takes our
+	 * lock just before calling us, so we avoid locking again.
+	 * For other kernel versions, the io_request_lock is taken
+	 * just before our entry point is called.  In this case, we
+	 * trade the io_request_lock for our per-softc lock.
+	 */
+#if AHD_SCSI_HAS_HOST_LOCK == 0
+	spin_unlock(&io_request_lock);
+	spin_lock(&ahd->platform_data->spin_lock);
 #endif
 }
 
 static __inline void
 ahd_midlayer_entrypoint_unlock(struct ahd_softc *ahd, unsigned long *flags)
 {
-	/*
-	 * In 2.5.X, the midlayer takes our lock just before
-	 * calling us and unlocks when we return, so let it do the unlock.
-	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahd_unlock(ahd, flags);
+#if AHD_SCSI_HAS_HOST_LOCK == 0
+	spin_unlock(&ahd->platform_data->spin_lock);
+	spin_lock(&io_request_lock);
 #endif
 }
 
@@ -780,17 +787,16 @@
 static __inline void
 ahd_done_lock(struct ahd_softc *ahd, unsigned long *flags)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	*flags = 0;
-	spin_lock_irqsave(&io_request_lock, *flags);
+#if AHD_SCSI_HAS_HOST_LOCK == 0
+	spin_lock(&io_request_lock);
 #endif
 }
 
 static __inline void
 ahd_done_unlock(struct ahd_softc *ahd, unsigned long *flags)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irqrestore(&io_request_lock, *flags);
+#if AHD_SCSI_HAS_HOST_LOCK == 0
+	spin_unlock(&io_request_lock);
 #endif
 }
 
@@ -803,7 +809,6 @@
 static __inline void
 ahd_list_lock(unsigned long *flags)
 {
-	*flags = 0;
 	spin_lock_irqsave(&ahd_list_spinlock, *flags);
 }
 
@@ -822,7 +827,6 @@
 static __inline void
 ahd_lock(struct ahd_softc *ahd, unsigned long *flags)
 {
-	*flags = 0;
 	save_flags(*flags);
 	cli();
 }
@@ -860,7 +864,6 @@
 static __inline void
 ahd_list_lock(unsigned long *flags)
 {
-	*flags = 0;
 	save_flags(*flags);
 	cli();
 }
@@ -947,7 +950,7 @@
  */
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,1,92)
 #if defined(__sparc_v9__) || defined(__powerpc__)
-#error "PPC and Sparc platforms are only support under 2.1.92 and above"
+#error "PPC and Sparc platforms are only supported under 2.1.92 and above"
 #endif
 #include <linux/bios32.h>
 #endif
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm_pci.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_osm_pci.c	2003-04-15 04:36:16.000000000 -0700
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#20 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#21 $
  */
 
 #include "aic79xx_osm.h"
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_pci.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_pci.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_pci.c	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_pci.c	2003-04-15 04:36:16.000000000 -0700
@@ -38,7 +38,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#61 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#70 $
  *
  * $FreeBSD$
  */
@@ -80,6 +80,7 @@
 #define ID_AIC7902_B			0x801D9005FFFF9005ull
 #define ID_AIC7902_B_IROC		0x809D9005FFFF9005ull
 #define ID_AHA_39320			0x8010900500409005ull
+#define ID_AHA_39320A			0x8016900500409005ull
 #define ID_AHA_39320D			0x8011900500419005ull
 #define ID_AHA_39320D_B			0x801C900500419005ull
 #define ID_AHA_39320D_HP		0x8011900500AC0E11ull
@@ -138,6 +139,12 @@
 		ahd_aic7902_setup
 	},
 	{
+		ID_AHA_39320A,
+		ID_ALL_MASK,
+		"Adaptec 39320A Ultra320 SCSI adapter",
+		ahd_aic7902_setup
+	},
+	{
 		ID_AHA_39320D,
 		ID_ALL_MASK,
 		"Adaptec 39320D Ultra320 SCSI adapter",
@@ -378,12 +385,10 @@
 int
 ahd_pci_test_register_access(struct ahd_softc *ahd)
 {
-	ahd_mode_state	saved_modes;
 	uint32_t	cmd;
 	int		error;
 	uint8_t		hcntrl;
 
-	saved_modes = ahd_save_modes(ahd);
 	error = EIO;
 
 	/*
@@ -449,7 +454,6 @@
 		ahd_outb(ahd, CLRINT, CLRPCIINT);
 	}
 
-	ahd_restore_modes(ahd, saved_modes);
 	ahd_outb(ahd, SEQCTL0, PERRORDIS|FAILDIS);
 	ahd_pci_write_config(ahd->dev_softc, PCIR_COMMAND, cmd, /*bytes*/2);
 	return (error);
@@ -462,6 +466,7 @@
 static int
 ahd_check_extport(struct ahd_softc *ahd)
 {
+	struct	vpd_config vpd;
 	struct	seeprom_config *sc;
 	u_int	adapter_control;
 	int	have_seeprom;
@@ -472,6 +477,27 @@
 	if (have_seeprom) {
 		u_int start_addr;
 
+		/*
+		 * Fetch VPD for this function and parse it.
+		 */
+		if (bootverbose) 
+			printf("%s: Reading VPD from SEEPROM...",
+			       ahd_name(ahd));
+
+		/* Address is always in units of 16bit words */
+		start_addr = ((2 * sizeof(*sc))
+			    + (sizeof(vpd) * (ahd->channel - 'A'))) / 2;
+
+		error = ahd_read_seeprom(ahd, (uint16_t *)&vpd,
+					 start_addr, sizeof(vpd)/2,
+					 /*bytestream*/TRUE);
+		if (error == 0)
+			error = ahd_parse_vpddata(ahd, &vpd);
+		if (bootverbose) 
+			printf("%s: VPD parsing %s\n",
+			       ahd_name(ahd),
+			       error == 0 ? "successful" : "failed");
+
 		if (bootverbose) 
 			printf("%s: Reading SEEPROM...", ahd_name(ahd));
 
@@ -479,7 +505,8 @@
 		start_addr = (sizeof(*sc) / 2) * (ahd->channel - 'A');
 
 		error = ahd_read_seeprom(ahd, (uint16_t *)sc,
-					 start_addr, sizeof(*sc)/2);
+					 start_addr, sizeof(*sc)/2,
+					 /*bytestream*/FALSE);
 
 		if (error != 0) {
 			printf("Unable to read SEEPROM\n");
@@ -698,7 +725,7 @@
 	"%s: Split completion data bucket in %s\n",
 	"%s: Split completion address error in %s\n",
 	"%s: Split completion byte count error in %s\n",
-	"%s: Signaled Target-abort to early terminate a split in %s\n",
+	"%s: Signaled Target-abort to early terminate a split in %s\n"
 };
 
 static const char *pci_status_strings[] =
@@ -799,7 +826,7 @@
 		/* Clear latched errors.  So our interrupt deasserts. */
 		ahd_outb(ahd, DCHSPLTSTAT0, split_status[i]);
 		ahd_outb(ahd, DCHSPLTSTAT1, split_status1[i]);
-		if (i != 0)
+		if (i > 1)
 			continue;
 		sg_split_status[i] = ahd_inb(ahd, SGSPLTSTAT0);
 		sg_split_status1[i] = ahd_inb(ahd, SGSPLTSTAT1);
@@ -821,7 +848,7 @@
 				       split_status_source[i]);
 			}
 
-			if (i != 0)
+			if (i > 1)
 				continue;
 
 			if ((sg_split_status[i] & (0x1 << bit)) != 0) {
@@ -879,11 +906,12 @@
 			  |  AHD_NLQICRC_DELAYED_BUG|AHD_SCSIRST_BUG
 			  |  AHD_LQO_ATNO_BUG|AHD_AUTOFLUSH_BUG
 			  |  AHD_CLRLQO_AUTOCLR_BUG|AHD_PCIX_MMAPIO_BUG
-			  |  AHD_PCIX_CHIPRST_BUG|AHD_PKTIZED_STATUS_BUG
-			  |  AHD_PKT_LUN_BUG|AHD_MDFF_WSCBPTR_BUG
-			  |  AHD_REG_SLOW_SETTLE_BUG|AHD_SET_MODE_BUG
-			  |  AHD_BUSFREEREV_BUG|AHD_NONPACKFIFO_BUG
-			  |  AHD_PACED_NEGTABLE_BUG;
+			  |  AHD_PCIX_CHIPRST_BUG|AHD_PCIX_SCBRAM_RD_BUG
+			  |  AHD_PKTIZED_STATUS_BUG|AHD_PKT_LUN_BUG
+			  |  AHD_MDFF_WSCBPTR_BUG|AHD_REG_SLOW_SETTLE_BUG
+			  |  AHD_SET_MODE_BUG|AHD_BUSFREEREV_BUG
+			  |  AHD_NONPACKFIFO_BUG|AHD_PACED_NEGTABLE_BUG
+			  |  AHD_FAINT_LED_BUG;
 
 		/*
 		 * IO Cell paramter setup.
@@ -898,7 +926,7 @@
 		ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS
 			      |  AHD_NEW_DFCNTRL_OPTS;
 		ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_ABORT_LQI_BUG
-			  |  AHD_INTCOLLISION_BUG;
+			  |  AHD_INTCOLLISION_BUG|AHD_EARLY_REQ_BUG;
 
 		/*
 		 * IO Cell paramter setup.
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_proc.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_proc.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_proc.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_proc.c	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr>
  * sym driver.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_proc.c#11 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_proc.c#14 $
  */
 #include "aic79xx_osm.h"
 #include "aic79xx_inline.h"
@@ -124,8 +124,12 @@
 
 		printed_options = 0;
 		copy_info(info, " (%d.%03dMHz", freq / 1000, freq % 1000);
+		if ((tinfo->ppr_options & MSG_EXT_PPR_RD_STRM) != 0) {
+			copy_info(info, " RDSTRM");
+			printed_options++;
+		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_DT_REQ) != 0) {
-			copy_info(info, " DT");
+			copy_info(info, "%s", printed_options ? "|DT" : " DT");
 			printed_options++;
 		}
 		if ((tinfo->ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
@@ -258,7 +262,8 @@
 		ahd_write_seeprom(ahd, (u_int16_t *)buffer, start_addr,
 				  sizeof(struct seeprom_config)/2);
 		ahd_read_seeprom(ahd, (uint16_t *)ahd->seep_config,
-				 start_addr, sizeof(struct seeprom_config)/2);
+				 start_addr, sizeof(struct seeprom_config)/2,
+				 /*ByteStream*/FALSE);
 		ahd_release_seeprom(ahd);
 		written = length;
 	}
@@ -311,6 +316,7 @@
 
 	copy_info(&info, "Adaptec AIC79xx driver version: %s\n",
 		  AIC79XX_DRIVER_VERSION);
+	copy_info(&info, "%s\n", ahd->description);
 	ahd_controller_info(ahd, ahd_info);
 	copy_info(&info, "%s\n\n", ahd_info);
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped	2003-04-07 10:33:00.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -2,8 +2,8 @@
  * DO NOT EDIT - This file is automatically generated
  *		 from the following source files:
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#89 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#65 $
  */
 typedef int (ahd_reg_print_t)(u_int, u_int *, u_int);
 typedef struct ahd_reg_parse_entry {
@@ -3638,13 +3638,14 @@
 
 #define	SCB_RESIDUAL_DATACNT		0x180
 #define	SCB_CDB_STORE   		0x180
+#define	SCB_HOST_CDB_PTR		0x180
 
 #define	SCB_RESIDUAL_SGPTR		0x184
-#define	SCB_CDB_PTR     		0x184
 #define		SG_ADDR_MASK    	0xf8
 #define		SG_OVERRUN_RESID	0x02
 
 #define	SCB_SCSI_STATUS 		0x188
+#define	SCB_HOST_CDB_LEN		0x188
 
 #define	SCB_TARGET_PHASES		0x189
 
@@ -3719,7 +3720,7 @@
 #define	AHD_AMPLITUDE_SHIFT	0x00
 #define	AHD_AMPLITUDE_MASK	0x07
 #define	AHD_ANNEXCOL_AMPLITUDE	0x06
-#define	AHD_SLEWRATE_DEF_REVA	0x01
+#define	AHD_SLEWRATE_DEF_REVA	0x08
 #define	AHD_SLEWRATE_SHIFT	0x03
 #define	AHD_SLEWRATE_MASK	0x78
 #define	AHD_PRECOMP_CUTBACK_29	0x06
@@ -3774,5 +3775,5 @@
 
 
 /* Exported Labels */
-#define	LABEL_seq_isr 	0x263
-#define	LABEL_timer_isr	0x25f
+#define	LABEL_seq_isr 	0x26d
+#define	LABEL_timer_isr	0x269
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -2,8 +2,8 @@
  * DO NOT EDIT - This file is automatically generated
  *		 from the following source files:
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#89 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#65 $
  */
 
 #include "aic79xx_osm.h"
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped	2003-04-07 10:32:55.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -2,97 +2,102 @@
  * DO NOT EDIT - This file is automatically generated
  *		 from the following source files:
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#78 $
- * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#60 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#89 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#65 $
  */
 static uint8_t seqprog[] = {
 	0xff, 0x02, 0x06, 0x78,
-	0x00, 0xea, 0x46, 0x59,
+	0x00, 0xea, 0x50, 0x59,
 	0x01, 0xea, 0x04, 0x30,
 	0xff, 0x04, 0x0c, 0x78,
-	0x19, 0xea, 0x46, 0x59,
+	0x19, 0xea, 0x50, 0x59,
 	0x19, 0xea, 0x04, 0x00,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x60, 0x3a, 0x1a, 0x68,
 	0x04, 0x47, 0x1b, 0x68,
 	0xff, 0x21, 0x1b, 0x70,
-	0x40, 0x4b, 0x88, 0x69,
-	0x00, 0xe2, 0x4a, 0x59,
-	0x40, 0x4b, 0x88, 0x69,
-	0x20, 0x4b, 0x78, 0x69,
+	0x40, 0x4b, 0x92, 0x69,
+	0x00, 0xe2, 0x54, 0x59,
+	0x40, 0x4b, 0x92, 0x69,
+	0x20, 0x4b, 0x82, 0x69,
 	0xfc, 0x42, 0x24, 0x78,
 	0x10, 0x40, 0x24, 0x78,
-	0x00, 0xe2, 0xa4, 0x5d,
+	0x00, 0xe2, 0xe0, 0x5d,
 	0x20, 0x4d, 0x28, 0x78,
-	0x00, 0xe2, 0xa4, 0x5d,
-	0x00, 0xe2, 0x34, 0x58,
-	0x00, 0xe2, 0x66, 0x58,
-	0x00, 0xe2, 0x76, 0x58,
+	0x00, 0xe2, 0xe0, 0x5d,
+	0x30, 0x3f, 0xc0, 0x09,
+	0x30, 0xe0, 0x30, 0x60,
+	0x7f, 0x4a, 0x94, 0x08,
+	0x00, 0xe2, 0x32, 0x40,
+	0xc0, 0x4a, 0x94, 0x00,
+	0x00, 0xe2, 0x3e, 0x58,
+	0x00, 0xe2, 0x70, 0x58,
+	0x00, 0xe2, 0x80, 0x58,
 	0x00, 0xe2, 0x06, 0x40,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
-	0x01, 0x52, 0x66, 0x7d,
+	0x01, 0x52, 0x96, 0x7d,
 	0x02, 0x58, 0x50, 0x31,
 	0xff, 0xea, 0x10, 0x0b,
-	0xff, 0x93, 0x45, 0x78,
-	0x50, 0x4b, 0x40, 0x68,
+	0xff, 0x93, 0x4f, 0x78,
+	0x50, 0x4b, 0x4a, 0x68,
 	0xbf, 0x3a, 0x74, 0x08,
-	0x14, 0xea, 0x46, 0x59,
+	0x14, 0xea, 0x50, 0x59,
 	0x14, 0xea, 0x04, 0x00,
 	0x08, 0xa8, 0x51, 0x03,
-	0x01, 0xa4, 0x4d, 0x78,
-	0x00, 0xe2, 0x44, 0x5b,
-	0x00, 0xe2, 0x34, 0x40,
+	0x01, 0xa4, 0x57, 0x78,
+	0x00, 0xe2, 0x4c, 0x5b,
+	0x00, 0xe2, 0x3e, 0x40,
 	0xff, 0xea, 0xd4, 0x19,
 	0x02, 0xa8, 0x84, 0x32,
-	0x00, 0xea, 0x3a, 0x59,
+	0x00, 0xea, 0x44, 0x59,
 	0x01, 0xea, 0x00, 0x30,
-	0x00, 0xe2, 0x98, 0x5d,
-	0x00, 0xe2, 0x66, 0x4d,
-	0x11, 0xea, 0x3a, 0x59,
+	0x00, 0xe2, 0xcc, 0x5d,
+	0x00, 0xe2, 0x96, 0x4d,
+	0x11, 0xea, 0x44, 0x59,
 	0x11, 0xea, 0x00, 0x00,
-	0x00, 0xe2, 0x98, 0x5d,
-	0x00, 0xe2, 0x66, 0x4d,
-	0x33, 0xea, 0x3a, 0x59,
+	0x00, 0xe2, 0xcc, 0x5d,
+	0x00, 0xe2, 0x96, 0x4d,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
-	0x00, 0xe2, 0x3a, 0x43,
-	0x00, 0xea, 0x3a, 0x59,
+	0x00, 0xe2, 0x44, 0x43,
+	0x00, 0xea, 0x44, 0x59,
 	0x01, 0xea, 0x00, 0x30,
-	0x80, 0xf9, 0x6e, 0x68,
-	0x00, 0xe2, 0x38, 0x59,
-	0x11, 0xea, 0x3a, 0x59,
+	0x80, 0xf9, 0x78, 0x68,
+	0x00, 0xe2, 0x42, 0x59,
+	0x11, 0xea, 0x44, 0x59,
 	0x11, 0xea, 0x00, 0x00,
-	0x80, 0xf9, 0x38, 0x79,
+	0x80, 0xf9, 0x42, 0x79,
 	0xff, 0xea, 0xd4, 0x0d,
-	0x22, 0xea, 0x3a, 0x59,
+	0x22, 0xea, 0x44, 0x59,
 	0x22, 0xea, 0x00, 0x00,
-	0x10, 0x16, 0x80, 0x78,
+	0x10, 0x16, 0x8a, 0x78,
 	0x01, 0x0b, 0xa2, 0x32,
 	0x10, 0x16, 0x2c, 0x00,
-	0x18, 0xad, 0xee, 0x78,
-	0x04, 0xad, 0xbc, 0x68,
-	0x80, 0xad, 0x66, 0x7d,
-	0x10, 0xad, 0x8a, 0x78,
+	0x18, 0xad, 0xf8, 0x78,
+	0x04, 0xad, 0xc6, 0x68,
+	0x80, 0xad, 0x96, 0x7d,
+	0x10, 0xad, 0x94, 0x78,
 	0xe7, 0xad, 0x5a, 0x0d,
 	0xe7, 0xad, 0x5a, 0x09,
-	0x00, 0xe2, 0x98, 0x58,
+	0x00, 0xe2, 0xa2, 0x58,
 	0xff, 0xea, 0x56, 0x02,
 	0x04, 0x7c, 0x78, 0x32,
-	0x20, 0x16, 0x66, 0x7d,
+	0x20, 0x16, 0x96, 0x7d,
 	0x04, 0x38, 0x79, 0x32,
 	0x80, 0x37, 0x6f, 0x16,
-	0xff, 0x2d, 0xa7, 0x60,
-	0xff, 0x29, 0xa7, 0x60,
-	0x40, 0x51, 0xb7, 0x78,
-	0xff, 0x4f, 0xa7, 0x68,
+	0xff, 0x2d, 0xb1, 0x60,
+	0xff, 0x29, 0xb1, 0x60,
+	0x40, 0x51, 0xc1, 0x78,
+	0xff, 0x4f, 0xb1, 0x68,
 	0xff, 0x4d, 0xc1, 0x19,
 	0x00, 0x4e, 0xd5, 0x19,
-	0x00, 0xe2, 0xb6, 0x50,
+	0x00, 0xe2, 0xc0, 0x50,
 	0x01, 0x4c, 0xc1, 0x31,
 	0x00, 0x50, 0xd5, 0x19,
-	0x00, 0xe2, 0xb6, 0x48,
-	0x80, 0x18, 0x66, 0x7d,
+	0x00, 0xe2, 0xc0, 0x48,
+	0x80, 0x18, 0x96, 0x7d,
 	0x02, 0x4a, 0x1d, 0x30,
 	0x10, 0xea, 0x18, 0x00,
 	0x60, 0x18, 0x30, 0x00,
@@ -100,7 +105,7 @@
 	0x02, 0xea, 0x02, 0x00,
 	0xff, 0xea, 0xa0, 0x0a,
 	0x80, 0x18, 0x30, 0x04,
-	0x40, 0xad, 0x66, 0x7d,
+	0x40, 0xad, 0x96, 0x7d,
 	0xe7, 0xad, 0x5a, 0x09,
 	0x02, 0xa8, 0x40, 0x31,
 	0xff, 0xea, 0xc0, 0x09,
@@ -110,25 +115,25 @@
 	0xff, 0xea, 0x2a, 0x03,
 	0xff, 0xea, 0x2e, 0x03,
 	0x01, 0x10, 0xd4, 0x31,
-	0x10, 0xa8, 0xe3, 0x68,
+	0x10, 0xa8, 0xed, 0x68,
 	0x3d, 0xa9, 0xc5, 0x29,
 	0xfe, 0xe2, 0xc4, 0x09,
 	0x01, 0xea, 0xc6, 0x01,
 	0x02, 0xe2, 0xc8, 0x31,
 	0x02, 0xec, 0x50, 0x31,
 	0x02, 0xa0, 0xda, 0x31,
-	0xff, 0xa9, 0xe2, 0x70,
+	0xff, 0xa9, 0xec, 0x70,
 	0x02, 0xa0, 0x28, 0x37,
-	0xff, 0x21, 0xeb, 0x70,
+	0xff, 0x21, 0xf5, 0x70,
 	0x02, 0x22, 0x51, 0x31,
 	0x02, 0xa0, 0x2c, 0x33,
 	0x02, 0xa0, 0x44, 0x36,
 	0x02, 0xa0, 0x40, 0x32,
 	0x02, 0xa0, 0x44, 0x36,
-	0x04, 0x47, 0xf3, 0x68,
-	0x40, 0x16, 0x1e, 0x69,
-	0xff, 0x2d, 0x23, 0x61,
-	0xff, 0x29, 0x67, 0x75,
+	0x04, 0x47, 0xfd, 0x68,
+	0x40, 0x16, 0x28, 0x69,
+	0xff, 0x2d, 0x2d, 0x61,
+	0xff, 0x29, 0x97, 0x75,
 	0x01, 0x37, 0xc1, 0x31,
 	0x02, 0x28, 0x55, 0x32,
 	0x01, 0xea, 0x5a, 0x01,
@@ -140,20 +145,20 @@
 	0x01, 0x50, 0xa1, 0x1a,
 	0xff, 0x4e, 0x9d, 0x1a,
 	0xff, 0x4f, 0x9f, 0x22,
-	0xff, 0x8d, 0x17, 0x71,
-	0x80, 0xac, 0x16, 0x71,
-	0x20, 0x16, 0x16, 0x69,
+	0xff, 0x8d, 0x21, 0x71,
+	0x80, 0xac, 0x20, 0x71,
+	0x20, 0x16, 0x20, 0x69,
 	0x02, 0x8c, 0x51, 0x31,
-	0x00, 0xe2, 0x00, 0x41,
+	0x00, 0xe2, 0x0a, 0x41,
 	0x01, 0xac, 0x08, 0x31,
 	0x09, 0xea, 0x5a, 0x01,
 	0x02, 0x8c, 0x51, 0x32,
 	0xff, 0xea, 0x1a, 0x07,
 	0x04, 0x24, 0xf9, 0x30,
-	0x1d, 0xea, 0x2e, 0x41,
+	0x1d, 0xea, 0x38, 0x41,
 	0x02, 0x2c, 0x51, 0x31,
 	0x04, 0xac, 0xf9, 0x30,
-	0x19, 0xea, 0x2e, 0x59,
+	0x19, 0xea, 0x38, 0x59,
 	0x02, 0x8c, 0x59, 0x32,
 	0x02, 0x28, 0x19, 0x33,
 	0x02, 0xa8, 0x50, 0x36,
@@ -175,23 +180,23 @@
 	0x02, 0x20, 0xb9, 0x30,
 	0x02, 0x20, 0x51, 0x31,
 	0x4c, 0xa9, 0xd7, 0x28,
-	0x10, 0xa8, 0x59, 0x79,
+	0x10, 0xa8, 0x63, 0x79,
 	0x01, 0x6b, 0xc0, 0x30,
 	0x02, 0x64, 0xc8, 0x00,
 	0x40, 0x3a, 0x74, 0x04,
-	0x00, 0xe2, 0x66, 0x58,
-	0x33, 0xea, 0x3a, 0x59,
+	0x00, 0xe2, 0x70, 0x58,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x30, 0x3f, 0xc0, 0x09,
-	0x30, 0xe0, 0x5a, 0x61,
-	0x20, 0x3f, 0x70, 0x69,
-	0x10, 0x3f, 0x5a, 0x79,
+	0x30, 0xe0, 0x64, 0x61,
+	0x20, 0x3f, 0x7a, 0x69,
+	0x10, 0x3f, 0x64, 0x79,
 	0x02, 0xea, 0x7e, 0x00,
-	0x00, 0xea, 0x3a, 0x59,
+	0x00, 0xea, 0x44, 0x59,
 	0x01, 0xea, 0x00, 0x30,
 	0x02, 0x48, 0x51, 0x35,
 	0x01, 0xea, 0x7e, 0x00,
-	0x11, 0xea, 0x3a, 0x59,
+	0x11, 0xea, 0x44, 0x59,
 	0x11, 0xea, 0x00, 0x00,
 	0x02, 0x48, 0x51, 0x35,
 	0x08, 0xea, 0x98, 0x00,
@@ -201,11 +206,11 @@
 	0x0f, 0x67, 0xc0, 0x09,
 	0x00, 0x34, 0x69, 0x02,
 	0x20, 0xea, 0x96, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x40, 0x3a, 0xa4, 0x69,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x40, 0x3a, 0xae, 0x69,
 	0x02, 0x55, 0x06, 0x68,
-	0x02, 0x56, 0xa4, 0x69,
-	0xff, 0x5b, 0xa4, 0x61,
+	0x02, 0x56, 0xae, 0x69,
+	0xff, 0x5b, 0xae, 0x61,
 	0x02, 0x20, 0x51, 0x31,
 	0x80, 0xea, 0xb2, 0x01,
 	0x44, 0xea, 0x00, 0x00,
@@ -213,36 +218,36 @@
 	0x33, 0xea, 0x00, 0x00,
 	0xff, 0xea, 0xb2, 0x09,
 	0xff, 0xe0, 0xc0, 0x19,
-	0xff, 0xe0, 0xa6, 0x79,
+	0xff, 0xe0, 0xb0, 0x79,
 	0x02, 0x94, 0x51, 0x31,
-	0x00, 0xe2, 0x9c, 0x41,
+	0x00, 0xe2, 0xa6, 0x41,
 	0x02, 0x5e, 0x50, 0x31,
 	0x02, 0xa8, 0xb8, 0x30,
 	0x02, 0x5c, 0x50, 0x31,
-	0xff, 0x95, 0xb7, 0x71,
+	0xff, 0x95, 0xc1, 0x71,
 	0x02, 0x94, 0x41, 0x31,
 	0x02, 0x22, 0x51, 0x31,
 	0x02, 0xa0, 0x2c, 0x33,
 	0x02, 0xa0, 0x44, 0x32,
-	0x00, 0xe2, 0xc0, 0x41,
-	0x10, 0xa8, 0xc1, 0x69,
+	0x00, 0xe2, 0xca, 0x41,
+	0x10, 0xa8, 0xcb, 0x69,
 	0x3d, 0xa9, 0xc9, 0x29,
 	0x01, 0xe4, 0xc8, 0x01,
 	0x01, 0xea, 0xca, 0x01,
 	0xff, 0xea, 0xda, 0x01,
 	0x02, 0x20, 0x51, 0x31,
 	0x02, 0x96, 0x41, 0x32,
-	0xff, 0x21, 0xc9, 0x61,
+	0xff, 0x21, 0xd3, 0x61,
 	0xff, 0xea, 0x46, 0x02,
 	0x02, 0x5c, 0x50, 0x31,
 	0x40, 0xea, 0x96, 0x00,
-	0x02, 0x56, 0xac, 0x6d,
-	0x01, 0x55, 0xac, 0x6d,
-	0x10, 0xa8, 0xd5, 0x79,
-	0x10, 0x40, 0xde, 0x69,
-	0x01, 0x56, 0xde, 0x79,
+	0x02, 0x56, 0xe8, 0x6d,
+	0x01, 0x55, 0xe8, 0x6d,
+	0x10, 0xa8, 0xdf, 0x79,
+	0x10, 0x40, 0xe8, 0x69,
+	0x01, 0x56, 0xe8, 0x79,
 	0xff, 0x93, 0x07, 0x78,
-	0x13, 0xea, 0x46, 0x59,
+	0x13, 0xea, 0x50, 0x59,
 	0x13, 0xea, 0x04, 0x00,
 	0x00, 0xe2, 0x06, 0x40,
 	0xbf, 0x3a, 0x74, 0x08,
@@ -253,104 +258,104 @@
 	0x40, 0xea, 0x66, 0x02,
 	0x08, 0x3c, 0x78, 0x00,
 	0x80, 0xea, 0x62, 0x02,
-	0x00, 0xe2, 0xa4, 0x5b,
+	0x00, 0xe2, 0xac, 0x5b,
 	0x01, 0x36, 0xc1, 0x31,
-	0x9f, 0xe0, 0x38, 0x7c,
-	0x80, 0xe0, 0x02, 0x72,
-	0xa0, 0xe0, 0x3a, 0x72,
-	0xc0, 0xe0, 0x30, 0x72,
-	0xe0, 0xe0, 0x6a, 0x72,
-	0x01, 0xea, 0x46, 0x59,
+	0x9f, 0xe0, 0x4e, 0x7c,
+	0x80, 0xe0, 0x0c, 0x72,
+	0xa0, 0xe0, 0x44, 0x72,
+	0xc0, 0xe0, 0x3a, 0x72,
+	0xe0, 0xe0, 0x74, 0x72,
+	0x01, 0xea, 0x50, 0x59,
 	0x01, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x80, 0x33, 0x09, 0x7a,
-	0x03, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x80, 0x33, 0x13, 0x7a,
+	0x03, 0xea, 0x50, 0x59,
 	0x03, 0xea, 0x04, 0x00,
-	0xee, 0x00, 0x10, 0x6a,
+	0xee, 0x00, 0x1a, 0x6a,
 	0x05, 0xea, 0xb4, 0x00,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x02, 0xa8, 0x90, 0x32,
-	0x00, 0xe2, 0x60, 0x59,
+	0x00, 0xe2, 0x6a, 0x59,
 	0xef, 0x92, 0xd5, 0x19,
-	0x00, 0xe2, 0x20, 0x52,
-	0x0b, 0x84, 0xe1, 0x30,
+	0x00, 0xe2, 0x2a, 0x52,
+	0x09, 0x80, 0xe1, 0x30,
 	0x02, 0xea, 0x36, 0x00,
 	0xa8, 0xea, 0x32, 0x00,
-	0x00, 0xe2, 0x26, 0x42,
+	0x00, 0xe2, 0x30, 0x42,
 	0x01, 0x92, 0xd1, 0x30,
 	0x10, 0x80, 0x89, 0x31,
 	0x20, 0xea, 0x32, 0x00,
 	0xbf, 0x33, 0x67, 0x0a,
-	0x20, 0x19, 0x28, 0x6a,
-	0x02, 0x4d, 0xee, 0x69,
+	0x20, 0x19, 0x32, 0x6a,
+	0x02, 0x4d, 0xf8, 0x69,
 	0x40, 0x33, 0x67, 0x02,
-	0x00, 0xe2, 0xee, 0x41,
-	0x80, 0x33, 0xa7, 0x6a,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x80, 0x33, 0xb1, 0x6a,
 	0x01, 0x44, 0x10, 0x33,
 	0x08, 0xa8, 0x51, 0x03,
-	0x00, 0xe2, 0xee, 0x41,
+	0x00, 0xe2, 0xf8, 0x41,
 	0x10, 0xea, 0x80, 0x00,
 	0x01, 0x31, 0xc5, 0x31,
-	0x80, 0xe2, 0x56, 0x62,
-	0x10, 0xa8, 0x7b, 0x6a,
+	0x80, 0xe2, 0x60, 0x62,
+	0x10, 0xa8, 0x85, 0x6a,
 	0xc0, 0xaa, 0xc5, 0x01,
-	0x40, 0xa8, 0x47, 0x6a,
+	0x40, 0xa8, 0x51, 0x6a,
 	0xbf, 0xe2, 0xc4, 0x09,
-	0x20, 0xa8, 0x5b, 0x7a,
+	0x20, 0xa8, 0x65, 0x7a,
 	0x01, 0xe2, 0x88, 0x30,
-	0x00, 0xe2, 0xa4, 0x5b,
-	0xa0, 0x36, 0x63, 0x62,
+	0x00, 0xe2, 0xac, 0x5b,
+	0xa0, 0x36, 0x6d, 0x62,
 	0x23, 0xa8, 0x89, 0x08,
-	0x00, 0xe2, 0xa4, 0x5b,
-	0xa0, 0x36, 0x63, 0x62,
-	0x00, 0xa8, 0x5a, 0x42,
-	0xff, 0xe2, 0x5a, 0x62,
-	0x00, 0xe2, 0x7a, 0x42,
+	0x00, 0xe2, 0xac, 0x5b,
+	0xa0, 0x36, 0x6d, 0x62,
+	0x00, 0xa8, 0x64, 0x42,
+	0xff, 0xe2, 0x64, 0x62,
+	0x00, 0xe2, 0x84, 0x42,
 	0x40, 0xea, 0x98, 0x00,
 	0x01, 0xe2, 0x88, 0x30,
-	0x00, 0xe2, 0xa4, 0x5b,
-	0xa0, 0x36, 0x39, 0x72,
+	0x00, 0xe2, 0xac, 0x5b,
+	0xa0, 0x36, 0x43, 0x72,
 	0x40, 0xea, 0x98, 0x00,
 	0x01, 0x31, 0x89, 0x32,
 	0x08, 0xea, 0x62, 0x02,
-	0x00, 0xe2, 0xee, 0x41,
-	0xe0, 0xea, 0xb4, 0x5b,
-	0x80, 0xe0, 0xb2, 0x6a,
-	0x04, 0xe0, 0x52, 0x73,
-	0x02, 0xe0, 0x82, 0x73,
-	0x00, 0xea, 0x10, 0x73,
-	0x03, 0xe0, 0x92, 0x73,
-	0x23, 0xe0, 0x8c, 0x72,
-	0x08, 0xe0, 0xae, 0x72,
-	0x00, 0xe2, 0xa4, 0x5b,
-	0x07, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xf8, 0x41,
+	0xe0, 0xea, 0xc8, 0x5b,
+	0x80, 0xe0, 0xbc, 0x6a,
+	0x04, 0xe0, 0x5a, 0x73,
+	0x02, 0xe0, 0x8a, 0x73,
+	0x00, 0xea, 0x1a, 0x73,
+	0x03, 0xe0, 0x9a, 0x73,
+	0x23, 0xe0, 0x96, 0x72,
+	0x08, 0xe0, 0xb8, 0x72,
+	0x00, 0xe2, 0xac, 0x5b,
+	0x07, 0xea, 0x50, 0x59,
 	0x07, 0xea, 0x04, 0x00,
-	0x08, 0x42, 0xef, 0x71,
-	0x04, 0x42, 0x89, 0x62,
+	0x08, 0x42, 0xf9, 0x71,
+	0x04, 0x42, 0x93, 0x62,
 	0x01, 0x43, 0x89, 0x30,
-	0x00, 0xe2, 0x7a, 0x42,
+	0x00, 0xe2, 0x84, 0x42,
 	0x01, 0x44, 0xd4, 0x31,
-	0x00, 0xe2, 0x7a, 0x42,
+	0x00, 0xe2, 0x84, 0x42,
 	0x01, 0x00, 0x60, 0x32,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x4c, 0x34, 0xc1, 0x28,
 	0x01, 0x64, 0xc0, 0x31,
-	0x00, 0x30, 0x3b, 0x59,
+	0x00, 0x30, 0x45, 0x59,
 	0x01, 0x30, 0x01, 0x30,
-	0x01, 0xe0, 0xac, 0x7a,
-	0xa0, 0xea, 0xaa, 0x5b,
-	0x01, 0xa0, 0xac, 0x62,
-	0x01, 0x84, 0xa5, 0x7a,
-	0x01, 0xa7, 0xae, 0x7a,
-	0x00, 0xe2, 0xae, 0x42,
-	0x03, 0xea, 0x46, 0x59,
+	0x01, 0xe0, 0xb6, 0x7a,
+	0xa0, 0xea, 0xbe, 0x5b,
+	0x01, 0xa0, 0xb6, 0x62,
+	0x01, 0x84, 0xaf, 0x7a,
+	0x01, 0xa7, 0xb8, 0x7a,
+	0x00, 0xe2, 0xb8, 0x42,
+	0x03, 0xea, 0x50, 0x59,
 	0x03, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xae, 0x42,
-	0x07, 0xea, 0xbc, 0x5b,
+	0x00, 0xe2, 0xb8, 0x42,
+	0x07, 0xea, 0xd0, 0x5b,
 	0x01, 0x44, 0xd4, 0x31,
-	0x00, 0xe2, 0xee, 0x41,
+	0x00, 0xe2, 0xf8, 0x41,
 	0x3f, 0xe0, 0x6a, 0x0a,
 	0xc0, 0x34, 0xc1, 0x09,
 	0x00, 0x35, 0x51, 0x01,
@@ -361,54 +366,54 @@
 	0x01, 0xea, 0xc6, 0x01,
 	0x02, 0xe2, 0xc8, 0x31,
 	0x02, 0xec, 0x40, 0x31,
-	0xff, 0xa1, 0xce, 0x72,
+	0xff, 0xa1, 0xd8, 0x72,
 	0x02, 0xe8, 0xda, 0x31,
 	0x02, 0xa0, 0x50, 0x31,
-	0x00, 0xe2, 0xf0, 0x42,
+	0x00, 0xe2, 0xfa, 0x42,
 	0x80, 0x33, 0x67, 0x02,
 	0x01, 0x44, 0xd4, 0x31,
-	0x00, 0xe2, 0xa4, 0x5b,
+	0x00, 0xe2, 0xac, 0x5b,
 	0x01, 0x33, 0x67, 0x02,
-	0xe0, 0x36, 0x0b, 0x63,
+	0xe0, 0x36, 0x15, 0x63,
 	0x02, 0x33, 0x67, 0x02,
-	0x20, 0x46, 0x04, 0x63,
+	0x20, 0x46, 0x0e, 0x63,
 	0xff, 0xea, 0x52, 0x09,
-	0xa8, 0xea, 0xaa, 0x5b,
-	0x04, 0xa8, 0xeb, 0x7a,
+	0xa8, 0xea, 0xbe, 0x5b,
+	0x04, 0xa8, 0xf5, 0x7a,
 	0x01, 0x34, 0xc1, 0x31,
-	0x00, 0xa9, 0xeb, 0x62,
+	0x00, 0xa9, 0xf5, 0x62,
 	0x01, 0x35, 0xc1, 0x31,
-	0x00, 0xaa, 0xf5, 0x72,
+	0x00, 0xaa, 0xff, 0x72,
 	0x01, 0xa9, 0x52, 0x11,
-	0xff, 0xa9, 0xe0, 0x6a,
-	0x00, 0xe2, 0x04, 0x43,
+	0xff, 0xa9, 0xea, 0x6a,
+	0x00, 0xe2, 0x0e, 0x43,
 	0x10, 0x33, 0x67, 0x02,
-	0x04, 0xa8, 0x05, 0x7b,
+	0x04, 0xa8, 0x0f, 0x7b,
 	0xfb, 0xa8, 0x51, 0x0b,
 	0xff, 0xea, 0x66, 0x0a,
-	0x01, 0xa4, 0xff, 0x6a,
+	0x01, 0xa4, 0x09, 0x6b,
 	0x02, 0xa8, 0x90, 0x32,
-	0x00, 0xe2, 0x60, 0x59,
-	0x10, 0xa8, 0xaf, 0x7a,
-	0xff, 0xea, 0xbc, 0x5b,
-	0x00, 0xe2, 0xae, 0x42,
-	0x04, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0x6a, 0x59,
+	0x10, 0xa8, 0xb9, 0x7a,
+	0xff, 0xea, 0xd0, 0x5b,
+	0x00, 0xe2, 0xb8, 0x42,
+	0x04, 0xea, 0x50, 0x59,
 	0x04, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xae, 0x42,
-	0x04, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xb8, 0x42,
+	0x04, 0xea, 0x50, 0x59,
 	0x04, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x08, 0xa8, 0xa7, 0x7a,
-	0xc0, 0x33, 0x1b, 0x7b,
-	0x80, 0x33, 0xa7, 0x6a,
-	0xff, 0x88, 0x1b, 0x6b,
-	0x40, 0x33, 0xa7, 0x6a,
-	0x10, 0xa8, 0x21, 0x7b,
-	0x0a, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x08, 0xa8, 0xb1, 0x7a,
+	0xc0, 0x33, 0x25, 0x7b,
+	0x80, 0x33, 0xb1, 0x6a,
+	0xff, 0x88, 0x25, 0x6b,
+	0x40, 0x33, 0xb1, 0x6a,
+	0x10, 0xa8, 0x2b, 0x7b,
+	0x0a, 0xea, 0x50, 0x59,
 	0x0a, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0x3a, 0x5b,
-	0x00, 0xe2, 0x6e, 0x43,
-	0x50, 0x4b, 0x28, 0x6b,
+	0x00, 0xe2, 0x44, 0x5b,
+	0x00, 0xe2, 0x76, 0x43,
+	0x50, 0x4b, 0x32, 0x6b,
 	0xbf, 0x3a, 0x74, 0x08,
 	0x01, 0xe0, 0xf8, 0x31,
 	0xff, 0xea, 0xc0, 0x09,
@@ -416,24 +421,23 @@
 	0x00, 0x2f, 0x5f, 0x22,
 	0x04, 0x47, 0x8f, 0x02,
 	0x01, 0xfc, 0xc0, 0x35,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x02, 0x42, 0x51, 0x31,
-	0x10, 0xa8, 0x51, 0x03,
-	0xff, 0x88, 0x49, 0x6b,
-	0x01, 0xa4, 0x45, 0x6b,
-	0x02, 0xa4, 0x4d, 0x6b,
-	0x01, 0x84, 0x4d, 0x7b,
+	0xff, 0x88, 0x51, 0x6b,
+	0x01, 0xa4, 0x4d, 0x6b,
+	0x02, 0xa4, 0x55, 0x6b,
+	0x01, 0x84, 0x55, 0x7b,
 	0x02, 0x28, 0x19, 0x33,
 	0x02, 0xa8, 0x50, 0x36,
-	0xff, 0x88, 0x4d, 0x73,
-	0x00, 0xe2, 0x24, 0x5b,
+	0xff, 0x88, 0x55, 0x73,
+	0x00, 0xe2, 0x2e, 0x5b,
 	0x02, 0x2c, 0x19, 0x33,
 	0x02, 0xa8, 0x58, 0x32,
 	0x04, 0xa4, 0x49, 0x07,
-	0xc0, 0x33, 0xa7, 0x6a,
+	0xc0, 0x33, 0xb1, 0x6a,
 	0x04, 0xa8, 0x51, 0x03,
-	0x20, 0xa8, 0x6f, 0x6b,
+	0x20, 0xa8, 0x77, 0x6b,
 	0x02, 0xa8, 0x40, 0x31,
 	0xc0, 0x34, 0xc1, 0x09,
 	0x00, 0x35, 0x51, 0x01,
@@ -448,66 +452,73 @@
 	0xf7, 0x57, 0xae, 0x08,
 	0x08, 0xea, 0x98, 0x00,
 	0x01, 0x44, 0xd4, 0x31,
-	0xee, 0x00, 0x78, 0x6b,
+	0xee, 0x00, 0x80, 0x6b,
 	0x02, 0xea, 0xb4, 0x00,
-	0x00, 0xe2, 0xa0, 0x5b,
-	0x09, 0x4c, 0x7a, 0x7b,
+	0x00, 0xe2, 0xa8, 0x5b,
+	0x09, 0x4c, 0x82, 0x7b,
 	0x08, 0x4c, 0x06, 0x68,
-	0x0b, 0xea, 0x46, 0x59,
+	0x0b, 0xea, 0x50, 0x59,
 	0x0b, 0xea, 0x04, 0x00,
 	0x01, 0x44, 0xd4, 0x31,
-	0x20, 0x33, 0xef, 0x79,
-	0x00, 0xe2, 0x8a, 0x5b,
-	0x00, 0xe2, 0xee, 0x41,
-	0x01, 0x84, 0x8f, 0x7b,
+	0x20, 0x33, 0xf9, 0x79,
+	0x00, 0xe2, 0x92, 0x5b,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x01, 0x84, 0x97, 0x7b,
 	0x01, 0xa4, 0x49, 0x07,
 	0x08, 0x60, 0x30, 0x33,
 	0x08, 0x80, 0x41, 0x37,
 	0xdf, 0x33, 0x67, 0x0a,
-	0xee, 0x00, 0x9c, 0x6b,
+	0xee, 0x00, 0xa4, 0x6b,
 	0x05, 0xea, 0xb4, 0x00,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
-	0x00, 0xe2, 0x60, 0x59,
-	0x00, 0xe2, 0xae, 0x42,
+	0x00, 0xe2, 0x6a, 0x59,
+	0x00, 0xe2, 0xb8, 0x42,
 	0x01, 0xea, 0x6c, 0x02,
 	0xc0, 0xea, 0x66, 0x06,
-	0xff, 0x42, 0xa4, 0x7b,
-	0x04, 0x4c, 0xa4, 0x6b,
+	0xff, 0x42, 0xb8, 0x6b,
+	0x01, 0x41, 0xac, 0x6b,
+	0x02, 0x41, 0xac, 0x7b,
+	0xff, 0x42, 0xb8, 0x6b,
+	0x01, 0x41, 0xac, 0x6b,
+	0x02, 0x41, 0xac, 0x7b,
+	0xff, 0x42, 0xb8, 0x7b,
+	0x04, 0x4c, 0xac, 0x6b,
 	0xe0, 0x41, 0x6c, 0x0e,
 	0x01, 0x44, 0xd4, 0x31,
-	0xff, 0x42, 0xac, 0x7b,
-	0x04, 0x4c, 0xac, 0x6b,
+	0xff, 0x42, 0xc0, 0x7b,
+	0x04, 0x4c, 0xc0, 0x6b,
 	0xe0, 0x41, 0x6c, 0x0a,
-	0xe0, 0x36, 0xef, 0x61,
+	0xe0, 0x36, 0xf9, 0x61,
 	0xff, 0xea, 0xca, 0x09,
 	0x01, 0xe2, 0xc8, 0x31,
 	0x01, 0x46, 0xda, 0x35,
 	0x01, 0x44, 0xd4, 0x35,
 	0x10, 0xea, 0x80, 0x00,
 	0x01, 0xe2, 0x62, 0x36,
-	0x04, 0xa6, 0xc4, 0x7b,
+	0x04, 0xa6, 0xd8, 0x7b,
 	0xff, 0xea, 0x5a, 0x09,
 	0xff, 0xea, 0x4c, 0x0d,
-	0x01, 0xa6, 0xe2, 0x6b,
-	0x10, 0xad, 0x66, 0x7d,
-	0x80, 0xad, 0xda, 0x6b,
-	0x08, 0xad, 0x66, 0x6d,
+	0x01, 0xa6, 0xf6, 0x6b,
+	0x10, 0xad, 0x96, 0x7d,
+	0x80, 0xad, 0xee, 0x6b,
+	0x08, 0xad, 0x96, 0x6d,
 	0x04, 0x84, 0xf9, 0x30,
 	0x00, 0xea, 0x08, 0x81,
 	0xff, 0xea, 0xd4, 0x09,
 	0x02, 0x84, 0xf9, 0x88,
-	0x1d, 0xea, 0x5a, 0x01,
+	0x0d, 0xea, 0x5a, 0x01,
 	0x04, 0xa6, 0x4c, 0x05,
-	0x04, 0xa6, 0x66, 0x7d,
+	0x04, 0xa6, 0x96, 0x7d,
 	0xff, 0xea, 0x5a, 0x09,
 	0x03, 0x84, 0x59, 0x89,
 	0x03, 0xea, 0x4c, 0x01,
-	0x80, 0x1a, 0x66, 0x7d,
+	0x80, 0x1a, 0x96, 0x7d,
+	0x08, 0x19, 0x96, 0x7d,
 	0x08, 0xb0, 0xe0, 0x30,
 	0x04, 0xb0, 0xe0, 0x30,
 	0x03, 0xb0, 0xf0, 0x30,
-	0x01, 0x78, 0xee, 0x7b,
+	0x01, 0x78, 0x04, 0x7c,
 	0x01, 0xa7, 0x4e, 0x11,
 	0x01, 0xb0, 0x06, 0x33,
 	0x7f, 0x83, 0xe9, 0x08,
@@ -518,247 +529,267 @@
 	0x00, 0x86, 0x0d, 0x23,
 	0x00, 0x87, 0x0f, 0x23,
 	0x01, 0x84, 0xc5, 0x31,
-	0x01, 0xa7, 0x04, 0x7c,
+	0x01, 0xa7, 0x1a, 0x7c,
 	0x04, 0xe2, 0xc4, 0x01,
-	0x80, 0x83, 0x0b, 0x7c,
+	0x80, 0x83, 0x21, 0x7c,
 	0x02, 0xe2, 0xc4, 0x01,
 	0xff, 0xea, 0x4c, 0x09,
 	0x01, 0xe2, 0x36, 0x30,
 	0xc8, 0x19, 0x32, 0x00,
 	0x88, 0x19, 0x32, 0x00,
 	0x01, 0xac, 0xd4, 0x99,
-	0x00, 0xe2, 0x66, 0x55,
+	0x00, 0xe2, 0x96, 0x55,
 	0xfe, 0xa6, 0x4c, 0x0d,
 	0x0b, 0x98, 0xe1, 0x30,
 	0x01, 0xa0, 0x4f, 0x09,
 	0xfd, 0xa4, 0x49, 0x09,
-	0x80, 0xa3, 0x21, 0x7c,
+	0x80, 0xa3, 0x37, 0x7c,
 	0x02, 0xa4, 0x48, 0x01,
-	0x01, 0xa7, 0x24, 0x7c,
+	0x01, 0xa7, 0x3a, 0x7c,
 	0x04, 0xa4, 0x48, 0x01,
 	0x01, 0xa4, 0x36, 0x30,
 	0xa8, 0xea, 0x32, 0x00,
 	0xfd, 0xa4, 0x49, 0x0b,
 	0x05, 0xa3, 0x07, 0x33,
-	0x80, 0x83, 0x31, 0x6c,
+	0x80, 0x83, 0x47, 0x6c,
 	0x02, 0xea, 0x4c, 0x05,
 	0xff, 0xea, 0x4c, 0x0d,
-	0x00, 0xe2, 0x32, 0x59,
-	0x02, 0xa6, 0xc6, 0x6b,
+	0x00, 0xe2, 0x3c, 0x59,
+	0x02, 0xa6, 0xda, 0x6b,
 	0x80, 0xf9, 0xf2, 0x05,
-	0xc0, 0x33, 0x3f, 0x7c,
-	0x03, 0xea, 0x46, 0x59,
+	0xc0, 0x33, 0x55, 0x7c,
+	0x03, 0xea, 0x50, 0x59,
 	0x03, 0xea, 0x04, 0x00,
-	0x20, 0x33, 0x63, 0x7c,
-	0x01, 0x84, 0x49, 0x6c,
-	0x06, 0xea, 0x46, 0x59,
+	0x20, 0x33, 0x79, 0x7c,
+	0x01, 0x84, 0x5f, 0x6c,
+	0x06, 0xea, 0x50, 0x59,
 	0x06, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0x66, 0x44,
+	0x00, 0xe2, 0x7c, 0x44,
 	0x01, 0x00, 0x60, 0x32,
-	0xee, 0x00, 0x52, 0x6c,
+	0xee, 0x00, 0x68, 0x6c,
 	0x05, 0xea, 0xb4, 0x00,
-	0x33, 0xea, 0x3a, 0x59,
+	0x33, 0xea, 0x44, 0x59,
 	0x33, 0xea, 0x00, 0x00,
 	0x80, 0x3d, 0x7a, 0x00,
-	0xfc, 0x42, 0x54, 0x7c,
+	0xfc, 0x42, 0x6a, 0x7c,
 	0x7f, 0x3d, 0x7a, 0x08,
-	0x00, 0x30, 0x3b, 0x59,
+	0x00, 0x30, 0x45, 0x59,
 	0x01, 0x30, 0x01, 0x30,
-	0x09, 0xea, 0x46, 0x59,
+	0x09, 0xea, 0x50, 0x59,
 	0x09, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x01, 0xa4, 0x49, 0x6c,
-	0x00, 0xe2, 0x16, 0x5c,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x01, 0xa4, 0x5f, 0x6c,
+	0x00, 0xe2, 0x2c, 0x5c,
 	0x20, 0x33, 0x67, 0x02,
 	0x01, 0x00, 0x60, 0x32,
-	0x02, 0xa6, 0x6e, 0x7c,
-	0x00, 0xe2, 0x32, 0x5c,
-	0x00, 0xe2, 0x66, 0x58,
-	0x00, 0xe2, 0x76, 0x58,
-	0x00, 0xe2, 0x30, 0x58,
-	0x00, 0x30, 0x3b, 0x59,
+	0x02, 0xa6, 0x84, 0x7c,
+	0x00, 0xe2, 0x48, 0x5c,
+	0x00, 0xe2, 0x70, 0x58,
+	0x00, 0xe2, 0x80, 0x58,
+	0x00, 0xe2, 0x3a, 0x58,
+	0x00, 0x30, 0x45, 0x59,
 	0x01, 0x30, 0x01, 0x30,
-	0x20, 0x19, 0x6e, 0x6c,
-	0x00, 0xe2, 0x96, 0x5c,
-	0x04, 0x19, 0x88, 0x6c,
+	0x20, 0x19, 0x84, 0x6c,
+	0x00, 0xe2, 0xb4, 0x5c,
+	0x04, 0x19, 0x9e, 0x6c,
 	0x02, 0x19, 0x32, 0x00,
-	0x01, 0x84, 0x89, 0x7c,
-	0x01, 0x1b, 0x82, 0x7c,
-	0x01, 0x1a, 0x88, 0x6c,
-	0x00, 0xe2, 0x38, 0x44,
-	0x80, 0x4b, 0x8e, 0x6c,
-	0x01, 0x4c, 0x8a, 0x7c,
-	0x03, 0x42, 0x38, 0x6c,
-	0x00, 0xe2, 0xc0, 0x5b,
+	0x01, 0x84, 0x9f, 0x7c,
+	0x01, 0x1b, 0x98, 0x7c,
+	0x01, 0x1a, 0x9e, 0x6c,
+	0x00, 0xe2, 0x4e, 0x44,
+	0x80, 0x4b, 0xa4, 0x6c,
+	0x01, 0x4c, 0xa0, 0x7c,
+	0x03, 0x42, 0x4e, 0x6c,
+	0x00, 0xe2, 0xd4, 0x5b,
 	0x80, 0xf9, 0xf2, 0x01,
-	0x04, 0x33, 0xef, 0x79,
-	0x00, 0xe2, 0xee, 0x41,
-	0x02, 0x1b, 0x9e, 0x7c,
-	0x08, 0x5d, 0x9c, 0x7c,
+	0x04, 0x33, 0xf9, 0x79,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x08, 0x5d, 0xbc, 0x6c,
+	0x00, 0xe2, 0x70, 0x58,
+	0x00, 0x30, 0x45, 0x59,
+	0x01, 0x30, 0x01, 0x30,
+	0x02, 0x1b, 0xac, 0x7c,
+	0x08, 0x5d, 0xba, 0x7c,
 	0x03, 0x68, 0x00, 0x37,
 	0x01, 0x84, 0x09, 0x07,
-	0x08, 0x5d, 0xa8, 0x6c,
-	0x00, 0xe2, 0x66, 0x58,
-	0x00, 0x30, 0x3b, 0x59,
-	0x01, 0x30, 0x01, 0x30,
-	0x00, 0xe2, 0x96, 0x44,
-	0x80, 0x1b, 0xb2, 0x7c,
-	0x80, 0x84, 0xb3, 0x6c,
+	0x80, 0x1b, 0xc6, 0x7c,
+	0x80, 0x84, 0xc7, 0x6c,
 	0xff, 0x85, 0x0b, 0x1b,
 	0xff, 0x86, 0x0d, 0x23,
 	0xff, 0x87, 0x0f, 0x23,
 	0xf8, 0x1b, 0x08, 0x0b,
 	0xff, 0xea, 0x4e, 0x09,
-	0x04, 0x1b, 0xba, 0x7c,
+	0x04, 0x1b, 0xce, 0x7c,
 	0x01, 0xa7, 0x4e, 0x01,
 	0xff, 0xea, 0x06, 0x0b,
 	0x03, 0x68, 0x00, 0x37,
-	0x00, 0xe2, 0xb6, 0x58,
+	0x00, 0xe2, 0xc0, 0x58,
 	0x10, 0xea, 0x18, 0x00,
 	0xf9, 0xd9, 0xb2, 0x0d,
 	0x01, 0xd9, 0xb2, 0x05,
-	0xff, 0xea, 0xd4, 0x09,
-	0x10, 0x5b, 0xde, 0x6c,
-	0x08, 0x5b, 0xe6, 0x6c,
-	0x20, 0x5b, 0xd4, 0x6c,
-	0x02, 0x5b, 0xfa, 0x6d,
-	0x0e, 0xea, 0x46, 0x59,
+	0x01, 0x52, 0x48, 0x31,
+	0x20, 0xa4, 0xf2, 0x7c,
+	0x20, 0x5b, 0xf2, 0x7c,
+	0x80, 0xf9, 0x00, 0x7d,
+	0x11, 0x00, 0x00, 0x10,
+	0x04, 0x19, 0xec, 0x7c,
+	0xdf, 0x19, 0x32, 0x08,
+	0x01, 0x4c, 0xe8, 0x7c,
+	0x20, 0x19, 0x32, 0x00,
+	0x11, 0x00, 0x00, 0x10,
+	0x02, 0xea, 0xb4, 0x00,
+	0x01, 0xd9, 0xb2, 0x05,
+	0x10, 0x5b, 0x04, 0x6d,
+	0x08, 0x5b, 0x0c, 0x6d,
+	0x20, 0x5b, 0xfe, 0x6c,
+	0x02, 0x5b, 0x2c, 0x6d,
+	0x0e, 0xea, 0x50, 0x59,
 	0x0e, 0xea, 0x04, 0x00,
-	0x08, 0x19, 0xda, 0x7c,
+	0x80, 0xf9, 0xee, 0x6c,
 	0xdf, 0x5c, 0xb8, 0x08,
 	0x01, 0xd9, 0xb2, 0x05,
-	0x02, 0xea, 0xb4, 0x00,
-	0x01, 0xd9, 0xb2, 0x05,
-	0x01, 0xa4, 0xc3, 0x6d,
-	0x00, 0xe2, 0x16, 0x5c,
-	0x00, 0xe2, 0x06, 0x5d,
+	0x01, 0xa4, 0xff, 0x6d,
+	0x00, 0xe2, 0x2c, 0x5c,
+	0x00, 0xe2, 0x36, 0x5d,
 	0x01, 0xd9, 0xb2, 0x05,
-	0x00, 0xe2, 0x24, 0x5b,
+	0x00, 0xe2, 0x2e, 0x5b,
 	0xf3, 0x92, 0xd5, 0x19,
-	0x00, 0xe2, 0xf4, 0x54,
-	0x80, 0x92, 0xf5, 0x6c,
-	0x0f, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0x1a, 0x55,
+	0x80, 0x92, 0x1b, 0x6d,
+	0x0f, 0xea, 0x50, 0x59,
 	0x0f, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xfc, 0x44,
+	0x00, 0xe2, 0x22, 0x45,
 	0x04, 0x8c, 0xe1, 0x30,
 	0x01, 0xea, 0xf2, 0x00,
 	0x02, 0xea, 0x36, 0x00,
 	0xa8, 0xea, 0x32, 0x00,
-	0xff, 0x93, 0x03, 0x7d,
-	0x14, 0xea, 0x46, 0x59,
+	0xff, 0x93, 0x29, 0x7d,
+	0x14, 0xea, 0x50, 0x59,
 	0x14, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0x88, 0x5d,
+	0x00, 0xe2, 0xb0, 0x5d,
+	0x01, 0xd9, 0xb2, 0x05,
+	0x09, 0x80, 0xe1, 0x30,
+	0x02, 0xea, 0x36, 0x00,
+	0xa8, 0xea, 0x32, 0x00,
+	0x00, 0xe2, 0xd8, 0x5d,
 	0x01, 0xd9, 0xb2, 0x05,
 	0x02, 0xa8, 0xf4, 0x31,
-	0x02, 0xa6, 0x18, 0x7d,
-	0x00, 0xe2, 0x34, 0x59,
-	0x20, 0x5b, 0x26, 0x6d,
-	0xfc, 0x42, 0x12, 0x7d,
-	0x10, 0x40, 0x14, 0x6d,
-	0x20, 0x4d, 0x16, 0x7d,
-	0x08, 0x5d, 0x26, 0x6d,
-	0x02, 0xa6, 0xc6, 0x6b,
-	0x00, 0xe2, 0x34, 0x59,
-	0x20, 0x5b, 0x26, 0x6d,
-	0x01, 0x1b, 0x46, 0x6d,
-	0xfc, 0x42, 0x22, 0x7d,
-	0x10, 0x40, 0x24, 0x6d,
-	0x20, 0x4d, 0x66, 0x7d,
-	0x08, 0x5d, 0x66, 0x7d,
+	0x02, 0xa6, 0x48, 0x7d,
+	0x00, 0xe2, 0x3e, 0x59,
+	0x20, 0x5b, 0x56, 0x6d,
+	0xfc, 0x42, 0x42, 0x7d,
+	0x10, 0x40, 0x44, 0x6d,
+	0x20, 0x4d, 0x46, 0x7d,
+	0x08, 0x5d, 0x56, 0x6d,
+	0x02, 0xa6, 0xda, 0x6b,
+	0x00, 0xe2, 0x3e, 0x59,
+	0x20, 0x5b, 0x56, 0x6d,
+	0x01, 0x1b, 0x76, 0x6d,
+	0xfc, 0x42, 0x52, 0x7d,
+	0x10, 0x40, 0x54, 0x6d,
+	0x20, 0x4d, 0x96, 0x7d,
+	0x08, 0x5d, 0x96, 0x7d,
 	0x02, 0x19, 0x32, 0x00,
 	0x01, 0x5b, 0x40, 0x31,
-	0x00, 0xe2, 0x96, 0x5c,
-	0x00, 0xe2, 0x8a, 0x5b,
+	0x00, 0xe2, 0xb4, 0x5c,
+	0x00, 0xe2, 0x92, 0x5b,
 	0x20, 0xea, 0xb6, 0x00,
-	0x00, 0xe2, 0xc0, 0x5b,
+	0x00, 0xe2, 0xd4, 0x5b,
 	0x20, 0x5c, 0xb8, 0x00,
-	0x04, 0x19, 0x3c, 0x6d,
-	0x01, 0x1a, 0x3c, 0x6d,
-	0x00, 0xe2, 0x34, 0x59,
-	0x01, 0x1a, 0x66, 0x7d,
+	0x04, 0x19, 0x6c, 0x6d,
+	0x01, 0x1a, 0x6c, 0x6d,
+	0x00, 0xe2, 0x3e, 0x59,
+	0x01, 0x1a, 0x96, 0x7d,
 	0x80, 0xf9, 0xf2, 0x01,
-	0x20, 0xa0, 0xac, 0x7d,
-	0x08, 0xa8, 0x45, 0x7d,
-	0x00, 0xe2, 0x58, 0x45,
+	0x20, 0xa0, 0xe8, 0x7d,
+	0x08, 0xa8, 0x75, 0x7d,
+	0x00, 0xe2, 0x88, 0x45,
 	0x02, 0xea, 0xb4, 0x04,
 	0x02, 0x19, 0x32, 0x00,
-	0x08, 0xa8, 0x69, 0x7d,
-	0x04, 0x5d, 0xc2, 0x7d,
-	0x01, 0x1a, 0xc2, 0x7d,
+	0x08, 0xa8, 0x99, 0x7d,
+	0x04, 0x5d, 0xfe, 0x7d,
+	0x01, 0x1a, 0xfe, 0x7d,
 	0x01, 0xa4, 0x49, 0x03,
 	0x80, 0xf9, 0xf2, 0x01,
 	0x02, 0xa8, 0x84, 0x32,
 	0x02, 0xea, 0xb4, 0x00,
-	0x00, 0xe2, 0x34, 0x43,
+	0x00, 0xe2, 0x3e, 0x43,
 	0x02, 0xa8, 0x84, 0x32,
 	0x02, 0xea, 0xb4, 0x00,
 	0xff, 0xea, 0xd4, 0x19,
-	0x00, 0xe2, 0x40, 0x59,
+	0x00, 0xe2, 0x4a, 0x59,
 	0x11, 0x00, 0x00, 0x10,
-	0x00, 0xe2, 0x98, 0x5d,
-	0x00, 0xe2, 0x34, 0x53,
+	0x00, 0xe2, 0xcc, 0x5d,
+	0x00, 0xe2, 0x3e, 0x53,
 	0xff, 0xea, 0xd4, 0x0d,
-	0x00, 0xe2, 0x34, 0x59,
-	0x40, 0x5b, 0x74, 0x6d,
-	0x04, 0x5d, 0xc2, 0x7d,
-	0x01, 0x1a, 0xc2, 0x7d,
-	0x20, 0x4d, 0x66, 0x7d,
-	0x40, 0x5b, 0xac, 0x7d,
-	0x04, 0x5d, 0xc2, 0x7d,
-	0x01, 0x1a, 0xc2, 0x7d,
+	0x00, 0xe2, 0x3e, 0x59,
+	0x40, 0x5b, 0xa4, 0x6d,
+	0x04, 0x5d, 0xfe, 0x7d,
+	0x01, 0x1a, 0xfe, 0x7d,
+	0x20, 0x4d, 0x96, 0x7d,
+	0x40, 0x5b, 0xe8, 0x7d,
+	0x04, 0x5d, 0xfe, 0x7d,
+	0x01, 0x1a, 0xfe, 0x7d,
 	0x80, 0xf9, 0xf2, 0x01,
 	0x01, 0xa4, 0x49, 0x03,
-	0x08, 0xa8, 0x59, 0x6d,
+	0x08, 0xa8, 0x89, 0x6d,
 	0x02, 0xea, 0xb4, 0x04,
-	0xff, 0x6a, 0x8e, 0x7d,
-	0x10, 0xea, 0x46, 0x59,
-	0x10, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0x8e, 0x45,
-	0x00, 0xe2, 0x32, 0x59,
-	0x10, 0x5d, 0x80, 0x6d,
-	0x40, 0x5b, 0x66, 0x7d,
+	0x00, 0xe2, 0x3c, 0x59,
+	0x01, 0x1b, 0xc0, 0x7d,
+	0x40, 0x5b, 0x96, 0x7d,
 	0x02, 0x19, 0x32, 0x00,
 	0x80, 0xf9, 0xf2, 0x01,
 	0xff, 0xea, 0x10, 0x03,
 	0x08, 0xa8, 0x51, 0x03,
-	0x00, 0xe2, 0x58, 0x45,
-	0x80, 0xf9, 0x66, 0x6d,
+	0x00, 0xe2, 0x88, 0x45,
+	0xff, 0x6a, 0xc6, 0x6d,
+	0x40, 0x5b, 0x96, 0x7d,
+	0xff, 0x6a, 0xb6, 0x7d,
+	0x10, 0xea, 0x50, 0x59,
+	0x10, 0xea, 0x04, 0x00,
+	0x00, 0xe2, 0xb6, 0x45,
+	0x80, 0xf9, 0x96, 0x6d,
 	0x01, 0x43, 0xc1, 0x31,
-	0x00, 0xfb, 0x66, 0x65,
+	0x00, 0xfb, 0x96, 0x65,
 	0x01, 0x42, 0xc1, 0x31,
-	0x00, 0xfa, 0x66, 0x65,
+	0x00, 0xfa, 0x96, 0x65,
 	0x01, 0xe8, 0xd4, 0x1d,
+	0x00, 0xe2, 0x3c, 0x59,
+	0x01, 0x1b, 0x96, 0x7d,
+	0x80, 0xf9, 0xf2, 0x01,
+	0x02, 0xea, 0xb4, 0x04,
 	0x30, 0x3f, 0xc0, 0x09,
-	0x30, 0xe0, 0x66, 0x65,
-	0x40, 0x4b, 0x66, 0x6d,
+	0x30, 0xe0, 0x96, 0x65,
+	0x40, 0x4b, 0x96, 0x6d,
 	0xff, 0xea, 0x52, 0x01,
-	0xee, 0x00, 0xb2, 0x6d,
+	0xee, 0x00, 0xee, 0x6d,
 	0x80, 0xf9, 0xf2, 0x01,
 	0x02, 0xea, 0xb4, 0x00,
 	0x20, 0xea, 0x9a, 0x00,
-	0xf3, 0x42, 0xbc, 0x6d,
-	0x12, 0xea, 0x46, 0x59,
+	0xf3, 0x42, 0xf8, 0x6d,
+	0x12, 0xea, 0x50, 0x59,
 	0x12, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x0d, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x0d, 0xea, 0x50, 0x59,
 	0x0d, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0xee, 0x41,
-	0x11, 0xea, 0x46, 0x59,
+	0x00, 0xe2, 0xf8, 0x41,
+	0x11, 0xea, 0x50, 0x59,
 	0x11, 0xea, 0x04, 0x00,
-	0x00, 0xe2, 0x24, 0x5b,
+	0x00, 0xe2, 0x2e, 0x5b,
 	0x08, 0x5a, 0xb4, 0x00,
-	0x00, 0xe2, 0xe4, 0x5d,
+	0x00, 0xe2, 0x22, 0x5e,
 	0xa8, 0xea, 0x32, 0x00,
-	0x00, 0xe2, 0x34, 0x59,
-	0x80, 0x1a, 0xd6, 0x7d,
-	0x00, 0xe2, 0xe4, 0x5d,
+	0x00, 0xe2, 0x3e, 0x59,
+	0x80, 0x1a, 0x12, 0x7e,
+	0x00, 0xe2, 0x22, 0x5e,
 	0x80, 0x19, 0x32, 0x00,
-	0x40, 0x5b, 0xdc, 0x6d,
-	0x08, 0x5a, 0xdc, 0x7d,
-	0x20, 0x4d, 0x66, 0x7d,
+	0x40, 0x5b, 0x18, 0x6e,
+	0x08, 0x5a, 0x18, 0x7e,
+	0x20, 0x4d, 0x96, 0x7d,
 	0x02, 0x84, 0x09, 0x03,
-	0x40, 0x5b, 0xac, 0x7d,
-	0x08, 0xa8, 0x51, 0x6d,
+	0x40, 0x5b, 0xe8, 0x7d,
+	0x08, 0xa8, 0x81, 0x6d,
+	0x80, 0xf9, 0xf2, 0x01,
 	0x02, 0xea, 0xb4, 0x04,
 	0x01, 0x38, 0xe1, 0x30,
 	0x05, 0x39, 0xe3, 0x98,
@@ -774,12 +805,36 @@
 };
 
 typedef int ahd_patch_func_t (struct ahd_softc *ahd);
+static ahd_patch_func_t ahd_patch21_func;
+
+static int
+ahd_patch21_func(struct ahd_softc *ahd)
+{
+	return ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) != 0);
+}
+
+static ahd_patch_func_t ahd_patch20_func;
+
+static int
+ahd_patch20_func(struct ahd_softc *ahd)
+{
+	return ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) == 0);
+}
+
+static ahd_patch_func_t ahd_patch19_func;
+
+static int
+ahd_patch19_func(struct ahd_softc *ahd)
+{
+	return ((ahd->features & AHD_RTI) == 0);
+}
+
 static ahd_patch_func_t ahd_patch18_func;
 
 static int
 ahd_patch18_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) != 0);
+	return ((ahd->flags & AHD_INITIATORROLE) != 0);
 }
 
 static ahd_patch_func_t ahd_patch17_func;
@@ -787,7 +842,7 @@
 static int
 ahd_patch17_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_PKT_BITBUCKET_BUG) == 0);
+	return ((ahd->flags & AHD_TARGETROLE) != 0);
 }
 
 static ahd_patch_func_t ahd_patch16_func;
@@ -795,7 +850,7 @@
 static int
 ahd_patch16_func(struct ahd_softc *ahd)
 {
-	return ((ahd->flags & AHD_INITIATORROLE) != 0);
+	return ((ahd->bugs & AHD_AUTOFLUSH_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch15_func;
@@ -803,7 +858,7 @@
 static int
 ahd_patch15_func(struct ahd_softc *ahd)
 {
-	return ((ahd->flags & AHD_TARGETROLE) != 0);
+	return ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0);
 }
 
 static ahd_patch_func_t ahd_patch14_func;
@@ -811,7 +866,7 @@
 static int
 ahd_patch14_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_AUTOFLUSH_BUG) != 0);
+	return ((ahd->flags & AHD_39BIT_ADDRESSING) != 0);
 }
 
 static ahd_patch_func_t ahd_patch13_func;
@@ -819,7 +874,7 @@
 static int
 ahd_patch13_func(struct ahd_softc *ahd)
 {
-	return ((ahd->features & AHD_NEW_DFCNTRL_OPTS) != 0);
+	return ((ahd->flags & AHD_64BIT_ADDRESSING) != 0);
 }
 
 static ahd_patch_func_t ahd_patch12_func;
@@ -827,7 +882,7 @@
 static int
 ahd_patch12_func(struct ahd_softc *ahd)
 {
-	return ((ahd->flags & AHD_39BIT_ADDRESSING) != 0);
+	return ((ahd->features & AHD_NEW_DFCNTRL_OPTS) == 0);
 }
 
 static ahd_patch_func_t ahd_patch11_func;
@@ -835,7 +890,7 @@
 static int
 ahd_patch11_func(struct ahd_softc *ahd)
 {
-	return ((ahd->flags & AHD_64BIT_ADDRESSING) != 0);
+	return ((ahd->bugs & AHD_REG_SLOW_SETTLE_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch10_func;
@@ -843,7 +898,7 @@
 static int
 ahd_patch10_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_REG_SLOW_SETTLE_BUG) != 0);
+	return ((ahd->bugs & AHD_EARLY_REQ_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch9_func;
@@ -859,7 +914,7 @@
 static int
 ahd_patch8_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_ABORT_LQI_BUG) == 0);
+	return ((ahd->flags & AHD_SEQUENCER_DEBUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch7_func;
@@ -867,7 +922,7 @@
 static int
 ahd_patch7_func(struct ahd_softc *ahd)
 {
-	return ((ahd->flags & AHD_SEQUENCER_DEBUG) != 0);
+	return ((ahd->bugs & AHD_LQO_ATNO_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch6_func;
@@ -875,7 +930,7 @@
 static int
 ahd_patch6_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_LQO_ATNO_BUG) != 0);
+	return ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch5_func;
@@ -883,7 +938,7 @@
 static int
 ahd_patch5_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0);
+	return ((ahd->bugs & AHD_NONPACKFIFO_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch4_func;
@@ -891,7 +946,7 @@
 static int
 ahd_patch4_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_NONPACKFIFO_BUG) != 0);
+	return ((ahd->bugs & AHD_SENT_SCB_UPDATE_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch3_func;
@@ -899,7 +954,7 @@
 static int
 ahd_patch3_func(struct ahd_softc *ahd)
 {
-	return ((ahd->bugs & AHD_SENT_SCB_UPDATE_BUG) != 0);
+	return ((ahd->bugs & AHD_FAINT_LED_BUG) != 0);
 }
 
 static ahd_patch_func_t ahd_patch2_func;
@@ -940,124 +995,129 @@
 	{ ahd_patch0_func, 5, 1, 1 },
 	{ ahd_patch2_func, 6, 1, 2 },
 	{ ahd_patch0_func, 7, 1, 1 },
-	{ ahd_patch2_func, 24, 1, 2 },
-	{ ahd_patch0_func, 25, 1, 1 },
-	{ ahd_patch1_func, 32, 1, 2 },
-	{ ahd_patch0_func, 33, 1, 1 },
-	{ ahd_patch2_func, 40, 1, 2 },
-	{ ahd_patch0_func, 41, 1, 1 },
-	{ ahd_patch2_func, 44, 1, 2 },
-	{ ahd_patch0_func, 45, 1, 1 },
-	{ ahd_patch2_func, 48, 1, 2 },
-	{ ahd_patch0_func, 49, 1, 1 },
-	{ ahd_patch2_func, 51, 1, 2 },
-	{ ahd_patch0_func, 52, 1, 1 },
-	{ ahd_patch2_func, 55, 1, 2 },
-	{ ahd_patch0_func, 56, 1, 1 },
-	{ ahd_patch2_func, 59, 1, 2 },
-	{ ahd_patch0_func, 60, 1, 1 },
-	{ ahd_patch2_func, 157, 6, 1 },
-	{ ahd_patch1_func, 163, 2, 1 },
-	{ ahd_patch3_func, 165, 1, 1 },
-	{ ahd_patch2_func, 174, 1, 2 },
-	{ ahd_patch0_func, 175, 1, 1 },
-	{ ahd_patch4_func, 176, 2, 2 },
-	{ ahd_patch0_func, 178, 6, 3 },
-	{ ahd_patch2_func, 181, 1, 2 },
-	{ ahd_patch0_func, 182, 1, 1 },
-	{ ahd_patch2_func, 185, 1, 2 },
-	{ ahd_patch0_func, 186, 1, 1 },
-	{ ahd_patch5_func, 188, 2, 1 },
-	{ ahd_patch3_func, 196, 16, 2 },
-	{ ahd_patch0_func, 212, 1, 1 },
-	{ ahd_patch6_func, 232, 2, 1 },
-	{ ahd_patch1_func, 236, 1, 2 },
-	{ ahd_patch0_func, 237, 1, 1 },
-	{ ahd_patch5_func, 240, 2, 1 },
-	{ ahd_patch1_func, 254, 1, 2 },
-	{ ahd_patch0_func, 255, 1, 1 },
-	{ ahd_patch1_func, 258, 1, 2 },
-	{ ahd_patch0_func, 259, 1, 1 },
-	{ ahd_patch2_func, 262, 1, 2 },
-	{ ahd_patch0_func, 263, 1, 1 },
-	{ ahd_patch1_func, 318, 1, 2 },
-	{ ahd_patch0_func, 319, 1, 1 },
-	{ ahd_patch2_func, 327, 1, 2 },
-	{ ahd_patch0_func, 328, 1, 1 },
-	{ ahd_patch2_func, 331, 1, 2 },
-	{ ahd_patch0_func, 332, 1, 1 },
-	{ ahd_patch1_func, 339, 1, 2 },
-	{ ahd_patch0_func, 340, 1, 1 },
-	{ ahd_patch7_func, 359, 1, 1 },
-	{ ahd_patch7_func, 362, 1, 1 },
-	{ ahd_patch7_func, 364, 1, 1 },
-	{ ahd_patch7_func, 376, 1, 1 },
-	{ ahd_patch1_func, 386, 1, 2 },
-	{ ahd_patch0_func, 387, 1, 1 },
-	{ ahd_patch1_func, 389, 1, 2 },
-	{ ahd_patch0_func, 390, 1, 1 },
-	{ ahd_patch1_func, 398, 1, 2 },
-	{ ahd_patch0_func, 399, 1, 1 },
-	{ ahd_patch2_func, 410, 1, 2 },
-	{ ahd_patch0_func, 411, 1, 1 },
-	{ ahd_patch8_func, 413, 1, 1 },
-	{ ahd_patch9_func, 440, 1, 1 },
-	{ ahd_patch1_func, 447, 1, 2 },
-	{ ahd_patch0_func, 448, 1, 1 },
-	{ ahd_patch2_func, 460, 1, 2 },
-	{ ahd_patch0_func, 461, 1, 1 },
-	{ ahd_patch10_func, 489, 1, 1 },
-	{ ahd_patch11_func, 498, 1, 2 },
-	{ ahd_patch0_func, 499, 1, 1 },
-	{ ahd_patch12_func, 504, 1, 1 },
-	{ ahd_patch11_func, 505, 1, 1 },
-	{ ahd_patch13_func, 518, 1, 2 },
-	{ ahd_patch0_func, 519, 1, 1 },
-	{ ahd_patch1_func, 541, 1, 2 },
-	{ ahd_patch0_func, 542, 1, 1 },
-	{ ahd_patch1_func, 545, 1, 2 },
-	{ ahd_patch0_func, 546, 1, 1 },
-	{ ahd_patch2_func, 551, 1, 2 },
-	{ ahd_patch0_func, 552, 1, 1 },
-	{ ahd_patch2_func, 556, 1, 2 },
+	{ ahd_patch3_func, 20, 5, 1 },
+	{ ahd_patch2_func, 29, 1, 2 },
+	{ ahd_patch0_func, 30, 1, 1 },
+	{ ahd_patch1_func, 37, 1, 2 },
+	{ ahd_patch0_func, 38, 1, 1 },
+	{ ahd_patch2_func, 45, 1, 2 },
+	{ ahd_patch0_func, 46, 1, 1 },
+	{ ahd_patch2_func, 49, 1, 2 },
+	{ ahd_patch0_func, 50, 1, 1 },
+	{ ahd_patch2_func, 53, 1, 2 },
+	{ ahd_patch0_func, 54, 1, 1 },
+	{ ahd_patch2_func, 56, 1, 2 },
+	{ ahd_patch0_func, 57, 1, 1 },
+	{ ahd_patch2_func, 60, 1, 2 },
+	{ ahd_patch0_func, 61, 1, 1 },
+	{ ahd_patch2_func, 64, 1, 2 },
+	{ ahd_patch0_func, 65, 1, 1 },
+	{ ahd_patch2_func, 162, 6, 1 },
+	{ ahd_patch1_func, 168, 2, 1 },
+	{ ahd_patch4_func, 170, 1, 1 },
+	{ ahd_patch2_func, 179, 1, 2 },
+	{ ahd_patch0_func, 180, 1, 1 },
+	{ ahd_patch5_func, 181, 2, 2 },
+	{ ahd_patch0_func, 183, 6, 3 },
+	{ ahd_patch2_func, 186, 1, 2 },
+	{ ahd_patch0_func, 187, 1, 1 },
+	{ ahd_patch2_func, 190, 1, 2 },
+	{ ahd_patch0_func, 191, 1, 1 },
+	{ ahd_patch6_func, 193, 2, 1 },
+	{ ahd_patch4_func, 201, 16, 2 },
+	{ ahd_patch0_func, 217, 1, 1 },
+	{ ahd_patch7_func, 237, 2, 1 },
+	{ ahd_patch1_func, 241, 1, 2 },
+	{ ahd_patch0_func, 242, 1, 1 },
+	{ ahd_patch6_func, 245, 2, 1 },
+	{ ahd_patch1_func, 259, 1, 2 },
+	{ ahd_patch0_func, 260, 1, 1 },
+	{ ahd_patch1_func, 263, 1, 2 },
+	{ ahd_patch0_func, 264, 1, 1 },
+	{ ahd_patch2_func, 267, 1, 2 },
+	{ ahd_patch0_func, 268, 1, 1 },
+	{ ahd_patch1_func, 323, 1, 2 },
+	{ ahd_patch0_func, 324, 1, 1 },
+	{ ahd_patch2_func, 332, 1, 2 },
+	{ ahd_patch0_func, 333, 1, 1 },
+	{ ahd_patch2_func, 336, 1, 2 },
+	{ ahd_patch0_func, 337, 1, 1 },
+	{ ahd_patch1_func, 344, 1, 2 },
+	{ ahd_patch0_func, 345, 1, 1 },
+	{ ahd_patch8_func, 364, 1, 1 },
+	{ ahd_patch8_func, 367, 1, 1 },
+	{ ahd_patch8_func, 369, 1, 1 },
+	{ ahd_patch8_func, 381, 1, 1 },
+	{ ahd_patch1_func, 391, 1, 2 },
+	{ ahd_patch0_func, 392, 1, 1 },
+	{ ahd_patch1_func, 394, 1, 2 },
+	{ ahd_patch0_func, 395, 1, 1 },
+	{ ahd_patch1_func, 403, 1, 2 },
+	{ ahd_patch0_func, 404, 1, 1 },
+	{ ahd_patch2_func, 415, 1, 2 },
+	{ ahd_patch0_func, 416, 1, 1 },
+	{ ahd_patch9_func, 444, 1, 1 },
+	{ ahd_patch1_func, 451, 1, 2 },
+	{ ahd_patch0_func, 452, 1, 1 },
+	{ ahd_patch2_func, 464, 1, 2 },
+	{ ahd_patch0_func, 465, 1, 1 },
+	{ ahd_patch10_func, 470, 6, 2 },
+	{ ahd_patch0_func, 476, 1, 1 },
+	{ ahd_patch11_func, 499, 1, 1 },
+	{ ahd_patch12_func, 508, 1, 1 },
+	{ ahd_patch13_func, 509, 1, 2 },
+	{ ahd_patch0_func, 510, 1, 1 },
+	{ ahd_patch14_func, 515, 1, 1 },
+	{ ahd_patch13_func, 516, 1, 1 },
+	{ ahd_patch15_func, 529, 1, 2 },
+	{ ahd_patch0_func, 530, 1, 1 },
+	{ ahd_patch1_func, 552, 1, 2 },
+	{ ahd_patch0_func, 553, 1, 1 },
+	{ ahd_patch1_func, 556, 1, 2 },
 	{ ahd_patch0_func, 557, 1, 1 },
-	{ ahd_patch1_func, 558, 1, 2 },
-	{ ahd_patch0_func, 559, 1, 1 },
-	{ ahd_patch2_func, 570, 1, 2 },
-	{ ahd_patch0_func, 571, 1, 1 },
-	{ ahd_patch14_func, 575, 1, 1 },
-	{ ahd_patch15_func, 580, 1, 1 },
-	{ ahd_patch16_func, 581, 2, 1 },
-	{ ahd_patch15_func, 585, 1, 2 },
-	{ ahd_patch0_func, 586, 1, 1 },
-	{ ahd_patch2_func, 593, 1, 2 },
-	{ ahd_patch0_func, 594, 1, 1 },
-	{ ahd_patch2_func, 609, 1, 2 },
-	{ ahd_patch0_func, 610, 1, 1 },
-	{ ahd_patch1_func, 616, 1, 2 },
-	{ ahd_patch0_func, 617, 1, 1 },
-	{ ahd_patch1_func, 631, 1, 2 },
-	{ ahd_patch0_func, 632, 1, 1 },
-	{ ahd_patch1_func, 639, 1, 2 },
-	{ ahd_patch0_func, 640, 1, 1 },
-	{ ahd_patch14_func, 659, 1, 1 },
-	{ ahd_patch14_func, 675, 1, 1 },
-	{ ahd_patch2_func, 687, 1, 2 },
-	{ ahd_patch0_func, 688, 1, 1 },
-	{ ahd_patch1_func, 705, 1, 2 },
-	{ ahd_patch0_func, 706, 1, 1 },
-	{ ahd_patch14_func, 711, 1, 1 },
-	{ ahd_patch1_func, 731, 1, 2 },
-	{ ahd_patch0_func, 732, 1, 1 },
-	{ ahd_patch1_func, 734, 1, 2 },
-	{ ahd_patch0_func, 735, 1, 1 },
-	{ ahd_patch1_func, 737, 1, 2 },
-	{ ahd_patch0_func, 738, 1, 1 },
-	{ ahd_patch17_func, 740, 1, 2 },
-	{ ahd_patch0_func, 741, 2, 1 },
-	{ ahd_patch18_func, 744, 4, 2 },
-	{ ahd_patch0_func, 748, 1, 1 },
-	{ ahd_patch18_func, 754, 11, 1 }
+	{ ahd_patch2_func, 562, 1, 2 },
+	{ ahd_patch0_func, 563, 1, 1 },
+	{ ahd_patch2_func, 567, 1, 2 },
+	{ ahd_patch0_func, 568, 1, 1 },
+	{ ahd_patch1_func, 569, 1, 2 },
+	{ ahd_patch0_func, 570, 1, 1 },
+	{ ahd_patch2_func, 581, 1, 2 },
+	{ ahd_patch0_func, 582, 1, 1 },
+	{ ahd_patch16_func, 586, 1, 1 },
+	{ ahd_patch17_func, 591, 1, 1 },
+	{ ahd_patch18_func, 592, 2, 1 },
+	{ ahd_patch17_func, 596, 1, 2 },
+	{ ahd_patch0_func, 597, 1, 1 },
+	{ ahd_patch2_func, 600, 1, 2 },
+	{ ahd_patch0_func, 601, 1, 1 },
+	{ ahd_patch2_func, 619, 1, 2 },
+	{ ahd_patch0_func, 620, 1, 1 },
+	{ ahd_patch19_func, 621, 12, 1 },
+	{ ahd_patch1_func, 637, 1, 2 },
+	{ ahd_patch0_func, 638, 1, 1 },
+	{ ahd_patch19_func, 639, 1, 1 },
+	{ ahd_patch1_func, 650, 1, 2 },
+	{ ahd_patch0_func, 651, 1, 1 },
+	{ ahd_patch1_func, 658, 1, 2 },
+	{ ahd_patch0_func, 659, 1, 1 },
+	{ ahd_patch16_func, 683, 1, 1 },
+	{ ahd_patch16_func, 699, 1, 1 },
+	{ ahd_patch2_func, 711, 1, 2 },
+	{ ahd_patch0_func, 712, 1, 1 },
+	{ ahd_patch16_func, 731, 1, 1 },
+	{ ahd_patch1_func, 739, 1, 2 },
+	{ ahd_patch0_func, 740, 1, 1 },
+	{ ahd_patch1_func, 761, 1, 2 },
+	{ ahd_patch0_func, 762, 1, 1 },
+	{ ahd_patch1_func, 764, 1, 2 },
+	{ ahd_patch0_func, 765, 1, 1 },
+	{ ahd_patch1_func, 767, 1, 2 },
+	{ ahd_patch0_func, 768, 1, 1 },
+	{ ahd_patch20_func, 770, 1, 2 },
+	{ ahd_patch0_func, 771, 2, 1 },
+	{ ahd_patch21_func, 774, 4, 2 },
+	{ ahd_patch0_func, 778, 1, 1 },
+	{ ahd_patch21_func, 785, 11, 1 }
 };
 
 static struct cs {
@@ -1066,19 +1126,19 @@
 } critical_sections[] = {
 	{ 11, 12 },
 	{ 13, 14 },
-	{ 24, 37 },
-	{ 38, 51 },
-	{ 64, 67 },
-	{ 94, 119 },
-	{ 120, 151 },
-	{ 153, 157 },
-	{ 165, 173 },
-	{ 196, 245 },
-	{ 659, 675 },
-	{ 675, 693 },
-	{ 698, 704 },
-	{ 711, 716 },
-	{ 716, 722 }
+	{ 29, 42 },
+	{ 43, 56 },
+	{ 69, 72 },
+	{ 99, 124 },
+	{ 125, 156 },
+	{ 158, 162 },
+	{ 170, 178 },
+	{ 201, 250 },
+	{ 683, 699 },
+	{ 699, 717 },
+	{ 722, 728 },
+	{ 731, 736 },
+	{ 742, 748 }
 };
 
 static const int num_critical_sections = sizeof(critical_sections)
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx.h	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx.h	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#70 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.h#74 $
  *
  * $FreeBSD$
  */
@@ -365,7 +365,8 @@
 	AHC_LSCBS_ENABLED     = 0x2000000, /* 64Byte SCBs enabled */
 	AHC_SCB_CONFIG_USED   = 0x4000000, /* No SEEPROM but SCB2 had info. */
 	AHC_NO_BIOS_INIT      = 0x8000000, /* No BIOS left over settings. */
-	AHC_DISABLE_PCI_PERR  = 0x10000000
+	AHC_DISABLE_PCI_PERR  = 0x10000000,
+	AHC_HAS_TERM_LOGIC    = 0x20000000
 } ahc_flag;
 
 /************************* Hardware  SCB Definition ***************************/
@@ -691,7 +692,7 @@
 
 #define AHC_WIDTH_UNKNOWN	0xFF
 #define AHC_PERIOD_UNKNOWN	0xFF
-#define AHC_OFFSET_UNKNOWN	0x0
+#define AHC_OFFSET_UNKNOWN	0xFF
 #define AHC_PPR_OPTS_UNKNOWN	0xFF
 
 /*
@@ -877,31 +878,39 @@
 /*********************** Software Configuration Structure *********************/
 TAILQ_HEAD(scb_tailq, scb);
 
-struct ahc_suspend_channel_state {
-	uint8_t	scsiseq;
-	uint8_t	sxfrctl0;
-	uint8_t	sxfrctl1;
-	uint8_t	simode0;
-	uint8_t	simode1;
-	uint8_t	seltimer;
-	uint8_t	seqctl;
-};
-
-struct ahc_suspend_state {
-	struct	ahc_suspend_channel_state channel[2];
-	uint8_t	optionmode;
-	uint8_t	dscommand0;
-	uint8_t	dspcistatus;
-	/* hsmailbox */
-	uint8_t	crccontrol1;
-	uint8_t	scbbaddr;
-	/* Host and sequencer SCB counts */
-	uint8_t	dff_thrsh;
-	uint8_t	*scratch_ram;
-	uint8_t	*btt;
+struct ahc_aic7770_softc {
+	/*
+	 * Saved register state used for chip_init().
+	 */
+	uint8_t busspd;
+	uint8_t bustime;
+};
+
+struct ahc_pci_softc {
+	/*
+	 * Saved register state used for chip_init().
+	 */
+	uint32_t  devconfig;
+	uint16_t  targcrccnt;
+	uint8_t   command;
+	uint8_t   csize_lattime;
+	uint8_t   optionmode;
+	uint8_t   crccontrol1;
+	uint8_t   dscommand0;
+	uint8_t   dspcistatus;
+	uint8_t   scbbaddr;
+	uint8_t   dff_thrsh;
+};
+
+union ahc_bus_softc {
+	struct ahc_aic7770_softc aic7770_softc;
+	struct ahc_pci_softc pci_softc;
 };
 
 typedef void (*ahc_bus_intr_t)(struct ahc_softc *);
+typedef int (*ahc_bus_chip_init_t)(struct ahc_softc *);
+typedef int (*ahc_bus_suspend_t)(struct ahc_softc *);
+typedef int (*ahc_bus_resume_t)(struct ahc_softc *);
 typedef void ahc_callback_t (void *);
 
 struct ahc_softc {
@@ -937,6 +946,11 @@
 	struct scb_tailq	  untagged_queues[AHC_NUM_TARGETS];
 
 	/*
+	 * Bus attachment specific data.
+	 */
+	union ahc_bus_softc	  bus_softc;
+
+	/*
 	 * Platform specific data.
 	 */
 	struct ahc_platform_data *platform_data;
@@ -952,6 +966,22 @@
 	ahc_bus_intr_t		  bus_intr;
 
 	/*
+	 * Bus specific initialization required
+	 * after a chip reset.
+	 */
+	ahc_bus_chip_init_t	  bus_chip_init;
+
+	/*
+	 * Bus specific suspend routine.
+	 */
+	ahc_bus_suspend_t	  bus_suspend;
+
+	/*
+	 * Bus specific resume routine.
+	 */
+	ahc_bus_resume_t	  bus_resume;
+
+	/*
 	 * Target mode related state kept on a per enabled lun basis.
 	 * Targets that are not enabled will have null entries.
 	 * As an initiator, we keep one target entry for our initiator
@@ -1043,9 +1073,6 @@
 	 */
 	bus_addr_t		  dma_bug_buf;
 
-	/* Information saved through suspend/resume cycles */
-	struct ahc_suspend_state  suspend_state;
-
 	/* Number of enabled target mode device on this card */
 	u_int			  enabled_luns;
 
@@ -1055,7 +1082,8 @@
 	/* PCI cacheline size. */
 	u_int			  pci_cachesize;
 
-	u_int			  stack_size;
+	/* Maximum number of sequencer instructions supported. */
+	u_int			  instruction_ram_size;
 
 	/* Per-Unit descriptive information */
 	const char		 *description;
@@ -1152,6 +1180,7 @@
 struct ahc_softc	*ahc_alloc(void *platform_arg, char *name);
 int			 ahc_softc_init(struct ahc_softc *);
 void			 ahc_controller_info(struct ahc_softc *ahc, char *buf);
+int			 ahc_chip_init(struct ahc_softc *ahc);
 int			 ahc_init(struct ahc_softc *ahc);
 void			 ahc_intr_enable(struct ahc_softc *ahc, int enable);
 void			 ahc_pause_and_flushwork(struct ahc_softc *ahc);
@@ -1167,7 +1196,6 @@
 void			 ahc_shutdown(void *arg);
 
 /*************************** Interrupt Services *******************************/
-void			ahc_pci_intr(struct ahc_softc *ahc);
 void			ahc_clear_intstat(struct ahc_softc *ahc);
 void			ahc_run_qoutfifo(struct ahc_softc *ahc);
 #ifdef AHC_TARGET_MODE
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx.reg linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx.reg
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx.reg	2003-04-07 10:33:00.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx.reg	2003-04-15 04:36:16.000000000 -0700
@@ -39,7 +39,7 @@
  *
  * $FreeBSD$
  */
-VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $"
+VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#38 $"
 
 /*
  * This file is processed by the aic7xxx_asm utility for use in assembling
@@ -1580,7 +1580,7 @@
 const MAX_OFFSET_8BIT		0x0f
 const MAX_OFFSET_16BIT		0x08
 const MAX_OFFSET_ULTRA2		0x7f
-const MAX_OFFSET		0xff
+const MAX_OFFSET		0x7f
 const HOST_MSG			0xff
 
 /* Target mode command processing constants */
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_core.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_core.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_core.c	2003-04-07 10:31:15.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_core.c	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#112 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.c#124 $
  *
  * $FreeBSD$
  */
@@ -144,7 +144,8 @@
 #include "aic7xxx_seq.h"
 
 /**************************** Function Declarations ***************************/
-static void		ahc_force_renegotiation(struct ahc_softc *ahc);
+static void		ahc_force_renegotiation(struct ahc_softc *ahc,
+						struct ahc_devinfo *devinfo);
 static struct ahc_tmode_tstate*
 			ahc_alloc_tstate(struct ahc_softc *ahc,
 					 u_int scsi_id, char channel);
@@ -224,7 +225,7 @@
 #ifdef AHC_DUMP_SEQ
 static void		ahc_dumpseq(struct ahc_softc *ahc);
 #endif
-static void		ahc_loadseq(struct ahc_softc *ahc);
+static int		ahc_loadseq(struct ahc_softc *ahc);
 static int		ahc_check_patch(struct ahc_softc *ahc,
 					struct patch **start_patch,
 					u_int start_instr, u_int *skip_addr);
@@ -1032,14 +1033,15 @@
 		 * we should look at the last phase the sequencer recorded,
 		 * or the current phase presented on the bus.
 		 */
-		u_int mesg_out;
-		u_int curphase;
-		u_int errorphase;
-		u_int lastphase;
-		u_int scsirate;
-		u_int i;
-		u_int sstat2;
-		int   silent;
+		struct	ahc_devinfo devinfo;
+		u_int	mesg_out;
+		u_int	curphase;
+		u_int	errorphase;
+		u_int	lastphase;
+		u_int	scsirate;
+		u_int	i;
+		u_int	sstat2;
+		int	silent;
 
 		lastphase = ahc_inb(ahc, LASTPHASE);
 		curphase = ahc_inb(ahc, SCSISIGI) & PHASE_MASK;
@@ -1128,7 +1130,9 @@
 		 * case we are out of sync for some external reason
 		 * unknown (or unreported) by the target.
 		 */
-		ahc_force_renegotiation(ahc);
+		ahc_fetch_devinfo(ahc, &devinfo);
+		ahc_force_renegotiation(ahc, &devinfo);
+
 		ahc_outb(ahc, CLRINT, CLRSCSIINT);
 		ahc_unpause(ahc);
 	} else if ((status & SELTO) != 0) {
@@ -1165,6 +1169,7 @@
 			       ahc_name(ahc), scbptr, scb_index);
 			ahc_dump_card_state(ahc);
 		} else {
+			struct ahc_devinfo devinfo;
 #ifdef AHC_DEBUG
 			if ((ahc_debug & AHC_SHOW_SELTO) != 0) {
 				ahc_print_path(ahc, scb);
@@ -1181,7 +1186,8 @@
 			 * a unit attention in this case, so we must always
 			 * renegotiate.
 			 */
-			ahc_force_renegotiation(ahc);
+			ahc_scb_devinfo(ahc, &devinfo, scb);
+			ahc_force_renegotiation(ahc, &devinfo);
 			ahc_set_transaction_status(scb, CAM_SEL_TIMEOUT);
 			ahc_freeze_devq(ahc, scb);
 		}
@@ -1189,13 +1195,14 @@
 		ahc_restart(ahc);
 	} else if ((status & BUSFREE) != 0
 		&& (ahc_inb(ahc, SIMODE1) & ENBUSFREE) != 0) {
-		u_int lastphase;
-		u_int saved_scsiid;
-		u_int saved_lun;
-		u_int target;
-		u_int initiator_role_id;
-		char channel;
-		int printerror;
+		struct	ahc_devinfo devinfo;
+		u_int	lastphase;
+		u_int	saved_scsiid;
+		u_int	saved_lun;
+		u_int	target;
+		u_int	initiator_role_id;
+		char	channel;
+		int	printerror;
 
 		/*
 		 * Clear our selection hardware as soon as possible.
@@ -1227,13 +1234,13 @@
 		target = SCSIID_TARGET(ahc, saved_scsiid);
 		initiator_role_id = SCSIID_OUR_ID(saved_scsiid);
 		channel = SCSIID_CHANNEL(ahc, saved_scsiid);
+		ahc_compile_devinfo(&devinfo, initiator_role_id,
+				    target, saved_lun, channel, ROLE_INITIATOR);
 		printerror = 1;
 
 		if (lastphase == P_MESGOUT) {
-			struct ahc_devinfo devinfo;
 			u_int tag;
 
-			ahc_fetch_devinfo(ahc, &devinfo);
 			tag = SCB_LIST_NULL;
 			if (ahc_sent_msg(ahc, AHCMSG_1B, MSG_ABORT_TAG, TRUE)
 			 || ahc_sent_msg(ahc, AHCMSG_1B, MSG_ABORT, TRUE)) {
@@ -1344,13 +1351,15 @@
 				if (lastphase == ahc_phase_table[i].phase)
 					break;
 			}
-			/*
-			 * Renegotiate with this device at the
-			 * next oportunity just in case this busfree
-			 * is due to a negotiation mismatch with the
-			 * device.
-			 */
-			ahc_force_renegotiation(ahc);
+			if (lastphase != P_BUSFREE) {
+				/*
+				 * Renegotiate with this device at the
+				 * next oportunity just in case this busfree
+				 * is due to a negotiation mismatch with the
+				 * device.
+				 */
+				ahc_force_renegotiation(ahc, &devinfo);
+			}
 			printf("Unexpected busfree %s\n"
 			       "SEQADDR == 0x%x\n",
 			       ahc_phase_table[i].phasemsg,
@@ -1371,19 +1380,17 @@
  * a command to the current device.
  */
 static void
-ahc_force_renegotiation(struct ahc_softc *ahc)
+ahc_force_renegotiation(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
 {
-	struct	ahc_devinfo devinfo;
 	struct	ahc_initiator_tinfo *targ_info;
 	struct	ahc_tmode_tstate *tstate;
 
-	ahc_fetch_devinfo(ahc, &devinfo);
 	targ_info = ahc_fetch_transinfo(ahc,
-					devinfo.channel,
-					devinfo.our_scsiid,
-					devinfo.target,
+					devinfo->channel,
+					devinfo->our_scsiid,
+					devinfo->target,
 					&tstate);
-	ahc_update_neg_request(ahc, &devinfo, tstate,
+	ahc_update_neg_request(ahc, devinfo, tstate,
 			       targ_info, AHC_NEG_IF_NON_ASYNC);
 }
 
@@ -3898,7 +3905,7 @@
 	 */
 	list_ahc = TAILQ_FIRST(&ahc_tailq);
 	while (list_ahc != NULL
-	    && ahc_softc_comp(list_ahc, ahc) <= 0)
+	    && ahc_softc_comp(ahc, list_ahc) <= 0)
 		list_ahc = TAILQ_NEXT(list_ahc, links);
 	if (list_ahc != NULL)
 		TAILQ_INSERT_BEFORE(list_ahc, ahc, links);
@@ -4038,6 +4045,7 @@
 {
 	u_int	sblkctl;
 	u_int	sxfrctl1_a, sxfrctl1_b;
+	int	error;
 	int	wait;
 	
 	/*
@@ -4128,12 +4136,19 @@
 	}
 	ahc_outb(ahc, SXFRCTL1, sxfrctl1_a);
 
+	error = 0;
+	if (ahc->init_level > 0)
+		/*
+		 * If a recovery action has forced a chip reset,
+		 * re-initialize the chip to our liking.
+		 */
+		error = ahc->bus_chip_init(ahc);
 #ifdef AHC_DUMP_SEQ
-	if (ahc->init_level == 0)
+	else 
 		ahc_dumpseq(ahc);
 #endif
 
-	return (0);
+	return (error);
 }
 
 /*
@@ -4203,6 +4218,14 @@
 		ahc_outb(ahc, SCB_LUN, 0xFF);
 	}
 
+	if ((ahc->flags & AHC_PAGESCBS) != 0) {
+		/* SCB 0 heads the free list. */
+		ahc_outb(ahc, FREE_SCBH, 0);
+	} else {
+		/* No free list. */
+		ahc_outb(ahc, FREE_SCBH, SCB_LIST_NULL);
+	}
+
 	/* Make sure that the last SCB terminates the free list */
 	ahc_outb(ahc, SCBPTR, i-1);
 	ahc_outb(ahc, SCB_NEXT, SCB_LIST_NULL);
@@ -4228,20 +4251,11 @@
 	/* Determine the number of hardware SCBs and initialize them */
 
 	scb_data->maxhscbs = ahc_probe_scbs(ahc);
-	if ((ahc->flags & AHC_PAGESCBS) != 0) {
-		/* SCB 0 heads the free list */
-		ahc_outb(ahc, FREE_SCBH, 0);
-	} else {
-		ahc_outb(ahc, FREE_SCBH, SCB_LIST_NULL);
-	}
-
 	if (ahc->scb_data->maxhscbs == 0) {
 		printf("%s: No SCB space found\n", ahc_name(ahc));
 		return (ENXIO);
 	}
 
-	ahc_build_free_scb_list(ahc);
-
 	/*
 	 * Create our DMA tags.  These tags define the kinds of device
 	 * accessible memory allocations and memory mappings we will
@@ -4343,10 +4357,9 @@
 	}
 
 	/*
-	 * Tell the sequencer which SCB will be the next one it receives.
+	 * Reserve the next queued SCB.
 	 */
 	ahc->next_queued_scb = ahc_get_scb(ahc);
-	ahc_outb(ahc, NEXT_QUEUED_SCB, ahc->next_queued_scb->hscb->tag);
 
 	/*
 	 * Note that we were successfull
@@ -4531,6 +4544,192 @@
 		sprintf(buf, "%d SCBs", ahc->scb_data->maxhscbs);
 }
 
+int
+ahc_chip_init(struct ahc_softc *ahc)
+{
+	int	 term;
+	int	 error;
+	u_int	 i;
+	u_int	 scsi_conf;
+	u_int	 scsiseq_template;
+	uint32_t physaddr;
+
+	ahc_outb(ahc, SEQ_FLAGS, 0);
+	ahc_outb(ahc, SEQ_FLAGS2, 0);
+
+	/* Set the SCSI Id, SXFRCTL0, SXFRCTL1, and SIMODE1, for both channels*/
+	if (ahc->features & AHC_TWIN) {
+
+		/*
+		 * Setup Channel B first.
+		 */
+		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) | SELBUSB);
+		term = (ahc->flags & AHC_TERM_ENB_B) != 0 ? STPWEN : 0;
+		ahc_outb(ahc, SCSIID, ahc->our_id_b);
+		scsi_conf = ahc_inb(ahc, SCSICONF + 1);
+		ahc_outb(ahc, SXFRCTL1, (scsi_conf & (ENSPCHK|STIMESEL))
+					|term|ahc->seltime_b|ENSTIMER|ACTNEGEN);
+		if ((ahc->features & AHC_ULTRA2) != 0)
+			ahc_outb(ahc, SIMODE0, ahc_inb(ahc, SIMODE0)|ENIOERR);
+		ahc_outb(ahc, SIMODE1, ENSELTIMO|ENSCSIRST|ENSCSIPERR);
+		ahc_outb(ahc, SXFRCTL0, DFON|SPIOEN);
+
+		/* Select Channel A */
+		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~SELBUSB);
+	}
+	term = (ahc->flags & AHC_TERM_ENB_A) != 0 ? STPWEN : 0;
+	if ((ahc->features & AHC_ULTRA2) != 0)
+		ahc_outb(ahc, SCSIID_ULTRA2, ahc->our_id);
+	else
+		ahc_outb(ahc, SCSIID, ahc->our_id);
+	scsi_conf = ahc_inb(ahc, SCSICONF);
+	ahc_outb(ahc, SXFRCTL1, (scsi_conf & (ENSPCHK|STIMESEL))
+				|term|ahc->seltime
+				|ENSTIMER|ACTNEGEN);
+	if ((ahc->features & AHC_ULTRA2) != 0)
+		ahc_outb(ahc, SIMODE0, ahc_inb(ahc, SIMODE0)|ENIOERR);
+	ahc_outb(ahc, SIMODE1, ENSELTIMO|ENSCSIRST|ENSCSIPERR);
+	ahc_outb(ahc, SXFRCTL0, DFON|SPIOEN);
+
+	/* There are no untagged SCBs active yet. */
+	for (i = 0; i < 16; i++) {
+		ahc_unbusy_tcl(ahc, BUILD_TCL(i << 4, 0));
+		if ((ahc->flags & AHC_SCB_BTT) != 0) {
+			int lun;
+
+			/*
+			 * The SCB based BTT allows an entry per
+			 * target and lun pair.
+			 */
+			for (lun = 1; lun < AHC_NUM_LUNS; lun++)
+				ahc_unbusy_tcl(ahc, BUILD_TCL(i << 4, lun));
+		}
+	}
+
+	/* All of our queues are empty */
+	for (i = 0; i < 256; i++)
+		ahc->qoutfifo[i] = SCB_LIST_NULL;
+	ahc_sync_qoutfifo(ahc, BUS_DMASYNC_PREREAD);
+
+	for (i = 0; i < 256; i++)
+		ahc->qinfifo[i] = SCB_LIST_NULL;
+
+	if ((ahc->features & AHC_MULTI_TID) != 0) {
+		ahc_outb(ahc, TARGID, 0);
+		ahc_outb(ahc, TARGID + 1, 0);
+	}
+
+	/*
+	 * Tell the sequencer where it can find our arrays in memory.
+	 */
+	physaddr = ahc->scb_data->hscb_busaddr;
+	ahc_outb(ahc, HSCB_ADDR, physaddr & 0xFF);
+	ahc_outb(ahc, HSCB_ADDR + 1, (physaddr >> 8) & 0xFF);
+	ahc_outb(ahc, HSCB_ADDR + 2, (physaddr >> 16) & 0xFF);
+	ahc_outb(ahc, HSCB_ADDR + 3, (physaddr >> 24) & 0xFF);
+
+	physaddr = ahc->shared_data_busaddr;
+	ahc_outb(ahc, SHARED_DATA_ADDR, physaddr & 0xFF);
+	ahc_outb(ahc, SHARED_DATA_ADDR + 1, (physaddr >> 8) & 0xFF);
+	ahc_outb(ahc, SHARED_DATA_ADDR + 2, (physaddr >> 16) & 0xFF);
+	ahc_outb(ahc, SHARED_DATA_ADDR + 3, (physaddr >> 24) & 0xFF);
+
+	/*
+	 * Initialize the group code to command length table.
+	 * This overrides the values in TARG_SCSIRATE, so only
+	 * setup the table after we have processed that information.
+	 */
+	ahc_outb(ahc, CMDSIZE_TABLE, 5);
+	ahc_outb(ahc, CMDSIZE_TABLE + 1, 9);
+	ahc_outb(ahc, CMDSIZE_TABLE + 2, 9);
+	ahc_outb(ahc, CMDSIZE_TABLE + 3, 0);
+	ahc_outb(ahc, CMDSIZE_TABLE + 4, 15);
+	ahc_outb(ahc, CMDSIZE_TABLE + 5, 11);
+	ahc_outb(ahc, CMDSIZE_TABLE + 6, 0);
+	ahc_outb(ahc, CMDSIZE_TABLE + 7, 0);
+		
+	if ((ahc->features & AHC_HS_MAILBOX) != 0)
+		ahc_outb(ahc, HS_MAILBOX, 0);
+
+	/* Tell the sequencer of our initial queue positions */
+	if ((ahc->features & AHC_TARGETMODE) != 0) {
+		ahc->tqinfifonext = 1;
+		ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext - 1);
+		ahc_outb(ahc, TQINPOS, ahc->tqinfifonext);
+	}
+	ahc->qinfifonext = 0;
+	ahc->qoutfifonext = 0;
+	if ((ahc->features & AHC_QUEUE_REGS) != 0) {
+		ahc_outb(ahc, QOFF_CTLSTA, SCB_QSIZE_256);
+		ahc_outb(ahc, HNSCB_QOFF, ahc->qinfifonext);
+		ahc_outb(ahc, SNSCB_QOFF, ahc->qinfifonext);
+		ahc_outb(ahc, SDSCB_QOFF, 0);
+	} else {
+		ahc_outb(ahc, KERNEL_QINPOS, ahc->qinfifonext);
+		ahc_outb(ahc, QINPOS, ahc->qinfifonext);
+		ahc_outb(ahc, QOUTPOS, ahc->qoutfifonext);
+	}
+
+	/* We don't have any waiting selections */
+	ahc_outb(ahc, WAITING_SCBH, SCB_LIST_NULL);
+
+	/* Our disconnection list is empty too */
+	ahc_outb(ahc, DISCONNECTED_SCBH, SCB_LIST_NULL);
+
+	/* Message out buffer starts empty */
+	ahc_outb(ahc, MSG_OUT, MSG_NOOP);
+
+	/*
+	 * Setup the allowed SCSI Sequences based on operational mode.
+	 * If we are a target, we'll enalbe select in operations once
+	 * we've had a lun enabled.
+	 */
+	scsiseq_template = ENSELO|ENAUTOATNO|ENAUTOATNP;
+	if ((ahc->flags & AHC_INITIATORROLE) != 0)
+		scsiseq_template |= ENRSELI;
+	ahc_outb(ahc, SCSISEQ_TEMPLATE, scsiseq_template);
+
+	/* Initialize our list of free SCBs. */
+	ahc_build_free_scb_list(ahc);
+
+	/*
+	 * Tell the sequencer which SCB will be the next one it receives.
+	 */
+	ahc_outb(ahc, NEXT_QUEUED_SCB, ahc->next_queued_scb->hscb->tag);
+
+	/*
+	 * Load the Sequencer program and Enable the adapter
+	 * in "fast" mode.
+	 */
+	if (bootverbose)
+		printf("%s: Downloading Sequencer Program...",
+		       ahc_name(ahc));
+
+	error = ahc_loadseq(ahc);
+	if (error != 0)
+		return (error);
+
+	if ((ahc->features & AHC_ULTRA2) != 0) {
+		int wait;
+
+		/*
+		 * Wait for up to 500ms for our transceivers
+		 * to settle.  If the adapter does not have
+		 * a cable attached, the transceivers may
+		 * never settle, so don't complain if we
+		 * fail here.
+		 */
+		ahc_pause(ahc);
+		for (wait = 5000;
+		     (ahc_inb(ahc, SBLKCTL) & (ENAB40|ENAB20)) == 0 && wait;
+		     wait--)
+			ahc_delay(100);
+		ahc_unpause(ahc);
+	}
+
+	return (0);
+}
+
 /*
  * Start the board, ready for normal operation
  */
@@ -4538,15 +4737,12 @@
 ahc_init(struct ahc_softc *ahc)
 {
 	int	 max_targ;
-	int	 i;
-	int	 term;
+	u_int	 i;
 	u_int	 scsi_conf;
-	u_int	 scsiseq_template;
 	u_int	 ultraenb;
 	u_int	 discenable;
 	u_int	 tagenable;
 	size_t	 driver_data_size;
-	uint32_t physaddr;
 
 #ifdef AHC_DEBUG
 	if ((ahc_debug & AHC_DEBUG_SEQUENCER) != 0)
@@ -4600,7 +4796,9 @@
 	/* DMA tag for mapping buffers into device visible space. */
 	if (ahc_dma_tag_create(ahc, ahc->parent_dmat, /*alignment*/1,
 			       /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1,
-			       /*lowaddr*/BUS_SPACE_MAXADDR,
+			       /*lowaddr*/ahc->flags & AHC_39BIT_ADDRESSING
+					? (bus_addr_t)0x7FFFFFFFFFULL
+					: BUS_SPACE_MAXADDR_32BIT,
 			       /*highaddr*/BUS_SPACE_MAXADDR,
 			       /*filter*/NULL, /*filterarg*/NULL,
 			       /*maxsize*/(AHC_NSEG - 1) * PAGE_SIZE,
@@ -4664,9 +4862,6 @@
 		for (i = 0; i < AHC_TMODE_CMDS; i++)
 			ahc->targetcmds[i].cmd_valid = 0;
 		ahc_sync_tqinfifo(ahc, BUS_DMASYNC_PREREAD);
-		ahc->tqinfifonext = 1;
-		ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext - 1);
-		ahc_outb(ahc, TQINPOS, ahc->tqinfifonext);
 		ahc->qoutfifo = (uint8_t *)&ahc->targetcmds[256];
 	}
 	ahc->qinfifo = &ahc->qoutfifo[256];
@@ -4697,9 +4892,6 @@
 		}
 	}
 
-	ahc_outb(ahc, SEQ_FLAGS, 0);
-	ahc_outb(ahc, SEQ_FLAGS2, 0);
-
 	if (ahc->scb_data->maxhscbs < AHC_SCB_MAX_ALLOC) {
 		ahc->flags |= AHC_PAGESCBS;
 	} else {
@@ -4708,62 +4900,31 @@
 
 #ifdef AHC_DEBUG
 	if (ahc_debug & AHC_SHOW_MISC) {
-		printf("%s: hardware scb %Zu bytes; kernel scb %Zu bytes; "
-		       "ahc_dma %Zu bytes\n",
+		printf("%s: hardware scb %u bytes; kernel scb %u bytes; "
+		       "ahc_dma %u bytes\n",
 			ahc_name(ahc),
-			sizeof(struct hardware_scb),
-			sizeof(struct scb),
-			sizeof(struct ahc_dma_seg));
+			(u_int)sizeof(struct hardware_scb),
+			(u_int)sizeof(struct scb),
+			(u_int)sizeof(struct ahc_dma_seg));
 	}
 #endif /* AHC_DEBUG */
 
-	/* Set the SCSI Id, SXFRCTL0, SXFRCTL1, and SIMODE1, for both channels*/
+	/*
+	 * Look at the information that board initialization or
+	 * the board bios has left us.
+	 */
 	if (ahc->features & AHC_TWIN) {
-
-		/*
-		 * The device is gated to channel B after a chip reset,
-		 * so set those values first
-		 */
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) | SELBUSB);
-		term = (ahc->flags & AHC_TERM_ENB_B) != 0 ? STPWEN : 0;
-		ahc_outb(ahc, SCSIID, ahc->our_id_b);
 		scsi_conf = ahc_inb(ahc, SCSICONF + 1);
-		ahc_outb(ahc, SXFRCTL1, (scsi_conf & (ENSPCHK|STIMESEL))
-					|term|ahc->seltime_b|ENSTIMER|ACTNEGEN);
-		if ((ahc->features & AHC_ULTRA2) != 0)
-			ahc_outb(ahc, SIMODE0, ahc_inb(ahc, SIMODE0)|ENIOERR);
-		ahc_outb(ahc, SIMODE1, ENSELTIMO|ENSCSIRST|ENSCSIPERR);
-		ahc_outb(ahc, SXFRCTL0, DFON|SPIOEN);
-
 		if ((scsi_conf & RESET_SCSI) != 0
 		 && (ahc->flags & AHC_INITIATORROLE) != 0)
 			ahc->flags |= AHC_RESET_BUS_B;
-
-		/* Select Channel A */
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~SELBUSB);
 	}
-	term = (ahc->flags & AHC_TERM_ENB_A) != 0 ? STPWEN : 0;
-	if ((ahc->features & AHC_ULTRA2) != 0)
-		ahc_outb(ahc, SCSIID_ULTRA2, ahc->our_id);
-	else
-		ahc_outb(ahc, SCSIID, ahc->our_id);
-	scsi_conf = ahc_inb(ahc, SCSICONF);
-	ahc_outb(ahc, SXFRCTL1, (scsi_conf & (ENSPCHK|STIMESEL))
-				|term|ahc->seltime
-				|ENSTIMER|ACTNEGEN);
-	if ((ahc->features & AHC_ULTRA2) != 0)
-		ahc_outb(ahc, SIMODE0, ahc_inb(ahc, SIMODE0)|ENIOERR);
-	ahc_outb(ahc, SIMODE1, ENSELTIMO|ENSCSIRST|ENSCSIPERR);
-	ahc_outb(ahc, SXFRCTL0, DFON|SPIOEN);
 
+	scsi_conf = ahc_inb(ahc, SCSICONF);
 	if ((scsi_conf & RESET_SCSI) != 0
 	 && (ahc->flags & AHC_INITIATORROLE) != 0)
 		ahc->flags |= AHC_RESET_BUS_A;
 
-	/*
-	 * Look at the information that board initialization or
-	 * the board bios has left us.
-	 */
 	ultraenb = 0;	
 	tagenable = ALL_TARGETS_MASK;
 
@@ -4815,7 +4976,7 @@
 			 * connection type we have with the target.
 			 */
 			tinfo->user.period = ahc_syncrates->period;
-			tinfo->user.offset = ~0;
+			tinfo->user.offset = MAX_OFFSET;
 		} else {
 			u_int scsirate;
 			uint16_t mask;
@@ -4850,7 +5011,7 @@
 				if (offset == 0)
 					tinfo->user.period = 0;
 				else
-					tinfo->user.offset = ~0;
+					tinfo->user.offset = MAX_OFFSET;
 				if ((scsirate & SXFR_ULTRA2) <= 8/*10MHz*/
 				 && (ahc->features & AHC_DT) != 0)
 					tinfo->user.ppr_options =
@@ -4868,7 +5029,7 @@
 						   ? AHC_SYNCRATE_ULTRA
 						   : AHC_SYNCRATE_FAST);
 				if (tinfo->user.period != 0)
-					tinfo->user.offset = ~0;
+					tinfo->user.offset = MAX_OFFSET;
 			}
 			if (tinfo->user.period == 0)
 				tinfo->user.offset = 0;
@@ -4890,127 +5051,7 @@
 	ahc->user_discenable = discenable;
 	ahc->user_tagenable = tagenable;
 
-	/* There are no untagged SCBs active yet. */
-	for (i = 0; i < 16; i++) {
-		ahc_unbusy_tcl(ahc, BUILD_TCL(i << 4, 0));
-		if ((ahc->flags & AHC_SCB_BTT) != 0) {
-			int lun;
-
-			/*
-			 * The SCB based BTT allows an entry per
-			 * target and lun pair.
-			 */
-			for (lun = 1; lun < AHC_NUM_LUNS; lun++)
-				ahc_unbusy_tcl(ahc, BUILD_TCL(i << 4, lun));
-		}
-	}
-
-	/* All of our queues are empty */
-	for (i = 0; i < 256; i++)
-		ahc->qoutfifo[i] = SCB_LIST_NULL;
-	ahc_sync_qoutfifo(ahc, BUS_DMASYNC_PREREAD);
-
-	for (i = 0; i < 256; i++)
-		ahc->qinfifo[i] = SCB_LIST_NULL;
-
-	if ((ahc->features & AHC_MULTI_TID) != 0) {
-		ahc_outb(ahc, TARGID, 0);
-		ahc_outb(ahc, TARGID + 1, 0);
-	}
-
-	/*
-	 * Tell the sequencer where it can find our arrays in memory.
-	 */
-	physaddr = ahc->scb_data->hscb_busaddr;
-	ahc_outb(ahc, HSCB_ADDR, physaddr & 0xFF);
-	ahc_outb(ahc, HSCB_ADDR + 1, (physaddr >> 8) & 0xFF);
-	ahc_outb(ahc, HSCB_ADDR + 2, (physaddr >> 16) & 0xFF);
-	ahc_outb(ahc, HSCB_ADDR + 3, (physaddr >> 24) & 0xFF);
-
-	physaddr = ahc->shared_data_busaddr;
-	ahc_outb(ahc, SHARED_DATA_ADDR, physaddr & 0xFF);
-	ahc_outb(ahc, SHARED_DATA_ADDR + 1, (physaddr >> 8) & 0xFF);
-	ahc_outb(ahc, SHARED_DATA_ADDR + 2, (physaddr >> 16) & 0xFF);
-	ahc_outb(ahc, SHARED_DATA_ADDR + 3, (physaddr >> 24) & 0xFF);
-
-	/*
-	 * Initialize the group code to command length table.
-	 * This overrides the values in TARG_SCSIRATE, so only
-	 * setup the table after we have processed that information.
-	 */
-	ahc_outb(ahc, CMDSIZE_TABLE, 5);
-	ahc_outb(ahc, CMDSIZE_TABLE + 1, 9);
-	ahc_outb(ahc, CMDSIZE_TABLE + 2, 9);
-	ahc_outb(ahc, CMDSIZE_TABLE + 3, 0);
-	ahc_outb(ahc, CMDSIZE_TABLE + 4, 15);
-	ahc_outb(ahc, CMDSIZE_TABLE + 5, 11);
-	ahc_outb(ahc, CMDSIZE_TABLE + 6, 0);
-	ahc_outb(ahc, CMDSIZE_TABLE + 7, 0);
-		
-	/* Tell the sequencer of our initial queue positions */
-	ahc_outb(ahc, KERNEL_QINPOS, 0);
-	ahc_outb(ahc, QINPOS, 0);
-	ahc_outb(ahc, QOUTPOS, 0);
-
-	/*
-	 * Use the built in queue management registers
-	 * if they are available.
-	 */
-	if ((ahc->features & AHC_QUEUE_REGS) != 0) {
-		ahc_outb(ahc, QOFF_CTLSTA, SCB_QSIZE_256);
-		ahc_outb(ahc, SDSCB_QOFF, 0);
-		ahc_outb(ahc, SNSCB_QOFF, 0);
-		ahc_outb(ahc, HNSCB_QOFF, 0);
-	}
-
-
-	/* We don't have any waiting selections */
-	ahc_outb(ahc, WAITING_SCBH, SCB_LIST_NULL);
-
-	/* Our disconnection list is empty too */
-	ahc_outb(ahc, DISCONNECTED_SCBH, SCB_LIST_NULL);
-
-	/* Message out buffer starts empty */
-	ahc_outb(ahc, MSG_OUT, MSG_NOOP);
-
-	/*
-	 * Setup the allowed SCSI Sequences based on operational mode.
-	 * If we are a target, we'll enalbe select in operations once
-	 * we've had a lun enabled.
-	 */
-	scsiseq_template = ENSELO|ENAUTOATNO|ENAUTOATNP;
-	if ((ahc->flags & AHC_INITIATORROLE) != 0)
-		scsiseq_template |= ENRSELI;
-	ahc_outb(ahc, SCSISEQ_TEMPLATE, scsiseq_template);
-
-	/*
-	 * Load the Sequencer program and Enable the adapter
-	 * in "fast" mode.
-	 */
-	if (bootverbose)
-		printf("%s: Downloading Sequencer Program...",
-		       ahc_name(ahc));
-
-	ahc_loadseq(ahc);
-
-	if ((ahc->features & AHC_ULTRA2) != 0) {
-		int wait;
-
-		/*
-		 * Wait for up to 500ms for our transceivers
-		 * to settle.  If the adapter does not have
-		 * a cable attached, the transceivers may
-		 * never settle, so don't complain if we
-		 * fail here.
-		 */
-		ahc_pause(ahc);
-		for (wait = 5000;
-		     (ahc_inb(ahc, SBLKCTL) & (ENAB40|ENAB20)) == 0 && wait;
-		     wait--)
-			ahc_delay(100);
-		ahc_unpause(ahc);
-	}
-	return (0);
+	return (ahc->bus_chip_init(ahc));
 }
 
 void
@@ -5046,7 +5087,6 @@
 
 	maxloops = 1000;
 	ahc->flags |= AHC_ALL_INTERRUPTS;
-	intstat = 0;
 	paused = FALSE;
 	do {
 		if (paused)
@@ -5056,10 +5096,10 @@
 		paused = TRUE;
 		ahc_outb(ahc, SCSISEQ, ahc_inb(ahc, SCSISEQ) & ~ENSELO);
 		ahc_clear_critical_section(ahc);
-		if (intstat == 0xFF && (ahc->features & AHC_REMOVABLE) != 0)
-			break;
+		intstat = ahc_inb(ahc, INTSTAT);
 	} while (--maxloops
-	      && (((intstat = ahc_inb(ahc, INTSTAT)) & INT_PEND) != 0
+	      && (intstat != 0xFF || (ahc->features & AHC_REMOVABLE) == 0)
+	      && ((intstat & INT_PEND) != 0
 	       || (ahc_inb(ahc, SSTAT0) & (SELDO|SELINGO))));
 	if (maxloops == 0) {
 		printf("Infinite interrupt loop, INTSTAT = %x",
@@ -5072,13 +5112,13 @@
 int
 ahc_suspend(struct ahc_softc *ahc)
 {
-	uint8_t *ptr;
-	int	 i;
 
 	ahc_pause_and_flushwork(ahc);
 
-	if (LIST_FIRST(&ahc->pending_scbs) != NULL)
+	if (LIST_FIRST(&ahc->pending_scbs) != NULL) {
+		ahc_unpause(ahc);
 		return (EBUSY);
+	}
 
 #if AHC_TARGET_MODE
 	/*
@@ -5086,73 +5126,11 @@
 	 * Perhaps we should just refuse to be suspended if we
 	 * are acting in a target role.
 	 */
-	if (ahc->pending_device != NULL)
+	if (ahc->pending_device != NULL) {
+		ahc_unpause(ahc);
 		return (EBUSY);
-#endif
-
-	/* Save volatile registers */
-	if ((ahc->features & AHC_TWIN) != 0) {
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) | SELBUSB);
-		ahc->suspend_state.channel[1].scsiseq = ahc_inb(ahc, SCSISEQ);
-		ahc->suspend_state.channel[1].sxfrctl0 = ahc_inb(ahc, SXFRCTL0);
-		ahc->suspend_state.channel[1].sxfrctl1 = ahc_inb(ahc, SXFRCTL1);
-		ahc->suspend_state.channel[1].simode0 = ahc_inb(ahc, SIMODE0);
-		ahc->suspend_state.channel[1].simode1 = ahc_inb(ahc, SIMODE1);
-		ahc->suspend_state.channel[1].seltimer = ahc_inb(ahc, SELTIMER);
-		ahc->suspend_state.channel[1].seqctl = ahc_inb(ahc, SEQCTL);
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~SELBUSB);
-	}
-	ahc->suspend_state.channel[0].scsiseq = ahc_inb(ahc, SCSISEQ);
-	ahc->suspend_state.channel[0].sxfrctl0 = ahc_inb(ahc, SXFRCTL0);
-	ahc->suspend_state.channel[0].sxfrctl1 = ahc_inb(ahc, SXFRCTL1);
-	ahc->suspend_state.channel[0].simode0 = ahc_inb(ahc, SIMODE0);
-	ahc->suspend_state.channel[0].simode1 = ahc_inb(ahc, SIMODE1);
-	ahc->suspend_state.channel[0].seltimer = ahc_inb(ahc, SELTIMER);
-	ahc->suspend_state.channel[0].seqctl = ahc_inb(ahc, SEQCTL);
-
-	if ((ahc->chip & AHC_PCI) != 0) {
-		ahc->suspend_state.dscommand0 = ahc_inb(ahc, DSCOMMAND0);
-		ahc->suspend_state.dspcistatus = ahc_inb(ahc, DSPCISTATUS);
-	}
-
-	if ((ahc->features & AHC_DT) != 0) {
-		u_int sfunct;
-
-		sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
-		ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
-		ahc->suspend_state.optionmode = ahc_inb(ahc, OPTIONMODE);
-		ahc_outb(ahc, SFUNCT, sfunct);
-		ahc->suspend_state.crccontrol1 = ahc_inb(ahc, CRCCONTROL1);
-	}
-
-	if ((ahc->features & AHC_MULTI_FUNC) != 0)
-		ahc->suspend_state.scbbaddr = ahc_inb(ahc, SCBBADDR);
-
-	if ((ahc->features & AHC_ULTRA2) != 0)
-		ahc->suspend_state.dff_thrsh = ahc_inb(ahc, DFF_THRSH);
-
-	ptr = ahc->suspend_state.scratch_ram;
-	for (i = 0; i < 64; i++)
-		*ptr++ = ahc_inb(ahc, SRAM_BASE + i);
-
-	if ((ahc->features & AHC_MORE_SRAM) != 0) {
-		for (i = 0; i < 16; i++)
-			*ptr++ = ahc_inb(ahc, TARG_OFFSET + i);
-	}
-
-	ptr = ahc->suspend_state.btt;
-	if ((ahc->flags & AHC_SCB_BTT) != 0) {
-		for (i = 0;i < AHC_NUM_TARGETS; i++) {
-			int j;
-
-			for (j = 0;j < AHC_NUM_LUNS; j++) {
-				u_int tcl;
-
-				tcl = BUILD_TCL(i << 4, j);
-				*ptr = ahc_index_busy_tcl(ahc, tcl);
-			}
-		}
 	}
+#endif
 	ahc_shutdown(ahc);
 	return (0);
 }
@@ -5160,81 +5138,8 @@
 int
 ahc_resume(struct ahc_softc *ahc)
 {
-	uint8_t *ptr;
-	int	 i;
 
 	ahc_reset(ahc);
-
-	ahc_build_free_scb_list(ahc);
-
-	/* Restore volatile registers */
-	if ((ahc->features & AHC_TWIN) != 0) {
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) | SELBUSB);
-		ahc_outb(ahc, SCSIID, ahc->our_id);
-		ahc_outb(ahc, SCSISEQ, ahc->suspend_state.channel[1].scsiseq);
-		ahc_outb(ahc, SXFRCTL0, ahc->suspend_state.channel[1].sxfrctl0);
-		ahc_outb(ahc, SXFRCTL1, ahc->suspend_state.channel[1].sxfrctl1);
-		ahc_outb(ahc, SIMODE0, ahc->suspend_state.channel[1].simode0);
-		ahc_outb(ahc, SIMODE1, ahc->suspend_state.channel[1].simode1);
-		ahc_outb(ahc, SELTIMER, ahc->suspend_state.channel[1].seltimer);
-		ahc_outb(ahc, SEQCTL, ahc->suspend_state.channel[1].seqctl);
-		ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) & ~SELBUSB);
-	}
-	ahc_outb(ahc, SCSISEQ, ahc->suspend_state.channel[0].scsiseq);
-	ahc_outb(ahc, SXFRCTL0, ahc->suspend_state.channel[0].sxfrctl0);
-	ahc_outb(ahc, SXFRCTL1, ahc->suspend_state.channel[0].sxfrctl1);
-	ahc_outb(ahc, SIMODE0, ahc->suspend_state.channel[0].simode0);
-	ahc_outb(ahc, SIMODE1, ahc->suspend_state.channel[0].simode1);
-	ahc_outb(ahc, SELTIMER, ahc->suspend_state.channel[0].seltimer);
-	ahc_outb(ahc, SEQCTL, ahc->suspend_state.channel[0].seqctl);
-	if ((ahc->features & AHC_ULTRA2) != 0)
-		ahc_outb(ahc, SCSIID_ULTRA2, ahc->our_id);
-	else
-		ahc_outb(ahc, SCSIID, ahc->our_id);
-
-	if ((ahc->chip & AHC_PCI) != 0) {
-		ahc_outb(ahc, DSCOMMAND0, ahc->suspend_state.dscommand0);
-		ahc_outb(ahc, DSPCISTATUS, ahc->suspend_state.dspcistatus);
-	}
-
-	if ((ahc->features & AHC_DT) != 0) {
-		u_int sfunct;
-
-		sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
-		ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
-		ahc_outb(ahc, OPTIONMODE, ahc->suspend_state.optionmode);
-		ahc_outb(ahc, SFUNCT, sfunct);
-		ahc_outb(ahc, CRCCONTROL1, ahc->suspend_state.crccontrol1);
-	}
-
-	if ((ahc->features & AHC_MULTI_FUNC) != 0)
-		ahc_outb(ahc, SCBBADDR, ahc->suspend_state.scbbaddr);
-
-	if ((ahc->features & AHC_ULTRA2) != 0)
-		ahc_outb(ahc, DFF_THRSH, ahc->suspend_state.dff_thrsh);
-
-	ptr = ahc->suspend_state.scratch_ram;
-	for (i = 0; i < 64; i++)
-		ahc_outb(ahc, SRAM_BASE + i, *ptr++);
-
-	if ((ahc->features & AHC_MORE_SRAM) != 0) {
-		for (i = 0; i < 16; i++)
-			ahc_outb(ahc, TARG_OFFSET + i, *ptr++);
-	}
-
-	ptr = ahc->suspend_state.btt;
-	if ((ahc->flags & AHC_SCB_BTT) != 0) {
-		for (i = 0;i < AHC_NUM_TARGETS; i++) {
-			int j;
-
-			for (j = 0;j < AHC_NUM_LUNS; j++) {
-				u_int tcl;
-
-				tcl = BUILD_TCL(i << 4, j);
-				ahc_busy_tcl(ahc, tcl, *ptr);
-			}
-		}
-	}
 	return (0);
 }
 
@@ -6379,19 +6284,11 @@
 ahc_dumpseq(struct ahc_softc* ahc)
 {
 	int i;
-	int max_prog;
-
-	if ((ahc->chip & AHC_BUS_MASK) < AHC_PCI)
-		max_prog = 448;
-	else if ((ahc->features & AHC_ULTRA2) != 0)
-		max_prog = 768;
-	else
-		max_prog = 512;
 
 	ahc_outb(ahc, SEQCTL, PERRORDIS|FAILDIS|FASTMODE|LOADRAM);
 	ahc_outb(ahc, SEQADDR0, 0);
 	ahc_outb(ahc, SEQADDR1, 0);
-	for (i = 0; i < max_prog; i++) {
+	for (i = 0; i < ahc->instruction_ram_size; i++) {
 		uint8_t ins_bytes[4];
 
 		ahc_insb(ahc, SEQRAM, ins_bytes, 4);
@@ -6403,7 +6300,7 @@
 }
 #endif
 
-static void
+static int
 ahc_loadseq(struct ahc_softc *ahc)
 {
 	struct	cs cs_table[num_critical_sections];
@@ -6413,9 +6310,9 @@
 	u_int	cs_count;
 	u_int	cur_cs;
 	u_int	i;
-	int	downloaded;
 	u_int	skip_addr;
 	u_int	sg_prefetch_cnt;
+	int	downloaded;
 	uint8_t	download_consts[7];
 
 	/*
@@ -6456,6 +6353,19 @@
 			 */
 			continue;
 		}
+
+		if (downloaded == ahc->instruction_ram_size) {
+			/*
+			 * We're about to exceed the instruction
+			 * storage capacity for this chip.  Fail
+			 * the load.
+			 */
+			printf("\n%s: Program too large for instruction memory "
+			       "size of %d!\n", ahc_name(ahc),
+			       ahc->instruction_ram_size);
+			return (ENOMEM);
+		}
+
 		/*
 		 * Move through the CS table until we find a CS
 		 * that might apply to this instruction.
@@ -6498,6 +6408,7 @@
 		printf("%s: Features 0x%x, Bugs 0x%x, Flags 0x%x\n",
 		       ahc_name(ahc), ahc->features, ahc->bugs, ahc->flags);
 	}
+	return (0);
 }
 
 static int
@@ -6942,11 +6853,12 @@
 	struct	   ahc_tmode_lstate *lstate;
 	struct	   ccb_en_lun *cel;
 	cam_status status;
+	u_long	   s;
 	u_int	   target;
 	u_int	   lun;
 	u_int	   target_mask;
 	u_int	   our_id;
-	u_long	   s;
+	int	   error;
 	char	   channel;
 
 	status = ahc_find_tmode_devs(ahc, sim, ccb, &tstate, &lstate,
@@ -7023,7 +6935,8 @@
 	 */
 	if ((ahc->flags & AHC_TARGETROLE) == 0
 	 && ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
-		u_long	s;
+		u_long	 s;
+		ahc_flag saved_flags;
 
 		printf("Configuring Target Mode\n");
 		ahc_lock(ahc, &s);
@@ -7032,11 +6945,28 @@
 			ahc_unlock(ahc, &s);
 			return;
 		}
+		saved_flags = ahc->flags;
 		ahc->flags |= AHC_TARGETROLE;
 		if ((ahc->features & AHC_MULTIROLE) == 0)
 			ahc->flags &= ~AHC_INITIATORROLE;
 		ahc_pause(ahc);
-		ahc_loadseq(ahc);
+		error = ahc_loadseq(ahc);
+		if (error != 0) {
+			/*
+			 * Restore original configuration and notify
+			 * the caller that we cannot support target mode.
+			 * Since the adapter started out in this
+			 * configuration, the firmware load will succeed,
+			 * so there is no point in checking ahc_loadseq's
+			 * return value.
+			 */
+			ahc->flags = saved_flags;
+			(void)ahc_loadseq(ahc);
+			ahc_unpause(ahc);
+			ahc_unlock(ahc, &s);
+			ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
+			return;
+		}
 		ahc_unlock(ahc, &s);
 	}
 	cel = &ccb->cel;
@@ -7272,7 +7202,11 @@
 				ahc->flags &= ~AHC_TARGETROLE;
 				ahc->flags |= AHC_INITIATORROLE;
 				ahc_pause(ahc);
-				ahc_loadseq(ahc);
+				/*
+				 * Returning to a configuration that
+				 * fit previously will always succeed.
+				 */
+				(void)ahc_loadseq(ahc);
 			}
 		}
 		ahc_unpause(ahc);
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_inline.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_inline.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_inline.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_inline.h	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_inline.h#39 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_inline.h#40 $
  *
  * $FreeBSD$
  */
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm.c	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  * Adaptec AIC7xxx device driver for Linux.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#179 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#206 $
  *
  * Copyright (c) 1994 John Aycock
  *   The University of Calgary Department of Computer Science.
@@ -488,12 +488,11 @@
 "				(0/256ms,1/128ms,2/64ms,3/32ms)\n"
 "\n"
 "	Sample /etc/modules.conf line:\n"
-"		Enable verbose logging\n"
-"		Disable EISA/VLB probing\n"
+"		Toggle EISA/VLB probing\n"
 "		Set tag depth on Controller 1/Target 2 to 10 tags\n"
 "		Shorten the selection timeout to 128ms\n"
 "\n"
-"	options aic7xxx='\"verbose.no_probe.tag_info:{{}.{..10}}.seltime:1\"'\n"
+"	options aic7xxx 'aic7xxx=no_probe.tag_info:{{}.{..10}}.seltime:1'\n"
 );
 #endif
 
@@ -513,6 +512,7 @@
 static void ahc_linux_start_dv(struct ahc_softc *ahc);
 static void ahc_linux_dv_timeout(struct scsi_cmnd *cmd);
 static int  ahc_linux_dv_thread(void *data);
+static void ahc_linux_kill_dv_thread(struct ahc_softc *ahc);
 static void ahc_linux_dv_target(struct ahc_softc *ahc, u_int target);
 static void ahc_linux_dv_transition(struct ahc_softc *ahc,
 				    struct scsi_cmnd *cmd,
@@ -565,9 +565,9 @@
 						      struct ahc_linux_device*);
 static void ahc_linux_run_device_queue(struct ahc_softc*,
 				       struct ahc_linux_device*);
-static void ahc_linux_setup_tag_info(char *p, char *end, char *s);
 static void ahc_linux_setup_tag_info_global(char *p);
-static void ahc_linux_setup_dv(char *p, char *end, char *s);
+static aic_option_callback_t ahc_linux_setup_tag_info;
+static aic_option_callback_t ahc_linux_setup_dv;
 static int  aic7xxx_setup(char *s);
 static int  ahc_linux_next_unit(void);
 static void ahc_runq_tasklet(unsigned long data);
@@ -620,6 +620,9 @@
 	}
 }
 
+/*
+ * Must be called with our lock held.
+ */
 static __inline void
 ahc_schedule_runq(struct ahc_softc *ahc)
 {
@@ -666,8 +669,8 @@
 	u_long	done_flags;
 	int	with_errors;
 
-	ahc_done_lock(ahc, &done_flags);
 	with_errors = 0;
+	ahc_done_lock(ahc, &done_flags);
 	while (acmd != NULL) {
 		Scsi_Cmnd *cmd;
 
@@ -995,9 +998,13 @@
 	dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id,
 				   cmd->device->lun, /*alloc*/TRUE);
 	if (dev == NULL) {
+		ahc_cmd_set_transaction_status(cmd, CAM_RESRC_UNAVAIL);
+		ahc_linux_queue_cmd_complete(ahc, cmd);
+		ahc_schedule_completeq(ahc, NULL);
 		ahc_midlayer_entrypoint_unlock(ahc, &flags);
-		printf("aic7xxx_linux_queue: Unable to allocate device!\n");
-		return (-ENOMEM);
+		printf("%s: aic7xxx_linux_queue - Unable to allocate device!\n",
+		       ahc_name(ahc));
+		return (0);
 	}
 	cmd->result = CAM_REQ_INPROG << 16;
 	TAILQ_INSERT_TAIL(&dev->busyq, (struct ahc_cmd *)cmd, acmd_links.tqe);
@@ -1094,7 +1101,7 @@
 	u_long	flags;
 
 	ahc = *((struct ahc_softc **)host->hostdata);
-	ahc_midlayer_entrypoint_lock(ahc, &flags);
+	ahc_lock(ahc, &flags);
 	for (device = scsi_devs; device != NULL; device = device->next) {
 		if (device->host == host) {
 			struct	 ahc_linux_device *dev;
@@ -1127,7 +1134,7 @@
 			}
 		}
 	}
-	ahc_midlayer_entrypoint_unlock(ahc, &flags);
+	ahc_unlock(ahc, &flags);
 }
 #endif
 
@@ -1238,30 +1245,23 @@
 	int    found;
 
 	ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irq(&io_request_lock);
-#endif
 	ahc_midlayer_entrypoint_lock(ahc, &s);
 	found = ahc_reset_channel(ahc, cmd->device->channel + 'A',
 				  /*initiate reset*/TRUE);
 	acmd = TAILQ_FIRST(&ahc->platform_data->completeq);
 	TAILQ_INIT(&ahc->platform_data->completeq);
-	ahc_midlayer_entrypoint_unlock(ahc, &s);
-	if (bootverbose)
-		printf("%s: SCSI bus reset delivered. "
-		       "%d SCBs aborted.\n", ahc_name(ahc), found);
 
 	if (acmd != NULL) {
 		acmd = ahc_linux_run_complete_queue(ahc, acmd);
-		if (acmd != NULL) {
-			ahc_midlayer_entrypoint_lock(ahc, &s);
+		if (acmd != NULL)
 			ahc_schedule_completeq(ahc, acmd);
-			ahc_midlayer_entrypoint_unlock(ahc, &s);
-		}
 	}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_lock_irq(&io_request_lock);
-#endif
+	ahc_midlayer_entrypoint_unlock(ahc, &s);
+
+	if (bootverbose)
+		printf("%s: SCSI bus reset delivered. "
+		       "%d SCBs aborted.\n", ahc_name(ahc), found);
+
 	return SUCCESS;
 }
 
@@ -1291,7 +1291,7 @@
 	.max_sectors		= 8192,
 #endif
 #if defined CONFIG_HIGHIO || LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
 /* Assume RedHat Distribution with its different HIGHIO conventions. */
 	.can_dma_32		= 1,
 	.single_sg_okay		= 1,
@@ -1313,15 +1313,25 @@
 
 /**************************** Tasklet Handler *********************************/
 
+/*
+ * In 2.4.X and above, this routine is called from a tasklet,
+ * so we must re-acquire our lock prior to executing this code.
+ * In all prior kernels, ahc_schedule_runq() calls this routine
+ * directly and ahc_schedule_runq() is called with our lock held.
+ */
 static void
 ahc_runq_tasklet(unsigned long data)
 {
 	struct ahc_softc* ahc;
 	struct ahc_linux_device *dev;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	u_long flags;
+#endif
 
 	ahc = (struct ahc_softc *)data;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	ahc_lock(ahc, &flags);
+#endif
 	while ((dev = ahc_linux_next_device_to_run(ahc)) != NULL) {
 	
 		TAILQ_REMOVE(&ahc->platform_data->device_runq, dev, links);
@@ -1331,7 +1341,9 @@
 		ahc_unlock(ahc, &flags);
 		ahc_lock(ahc, &flags);
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	ahc_unlock(ahc, &flags);
+#endif
 }
 
 /************************ Shutdown/halt/reboot hook ***************************/
@@ -1495,6 +1507,12 @@
 }
 
 /********************* Platform Dependent Functions ***************************/
+/*
+ * Compare "left hand" softc with "right hand" softc, returning:
+ * < 0 - lahc has a lower priority than rahc
+ *   0 - Softcs are equal
+ * > 0 - lahc has a higher priority than rahc
+ */
 int
 ahc_softc_comp(struct ahc_softc *lahc, struct ahc_softc *rahc)
 {
@@ -1513,7 +1531,7 @@
 	      - (rahc->flags & AHC_BIOS_ENABLED);
 	if (value != 0)
 		/* Controllers with BIOS enabled have a *higher* priority */
-		return (-value);
+		return (value);
 
 	/*
 	 * Same BIOS setting, now sort based on bus type.
@@ -1526,7 +1544,7 @@
 	lvalue = (lahc->chip & AHC_BUS_MASK);
  	if (lvalue == AHC_VL)
 		lvalue = AHC_EISA;
-	value = lvalue - rvalue;
+	value = rvalue - lvalue;
 	if (value != 0)
 		return (value);
 
@@ -1537,40 +1555,40 @@
 		char primary_channel;
 
 		if (aic7xxx_reverse_scan != 0)
-			value = ahc_get_pci_bus(rahc->dev_softc)
-			      - ahc_get_pci_bus(lahc->dev_softc);
-		else
 			value = ahc_get_pci_bus(lahc->dev_softc)
 			      - ahc_get_pci_bus(rahc->dev_softc);
+		else
+			value = ahc_get_pci_bus(rahc->dev_softc)
+			      - ahc_get_pci_bus(lahc->dev_softc);
 		if (value != 0)
 			break;
 		if (aic7xxx_reverse_scan != 0)
-			value = ahc_get_pci_slot(rahc->dev_softc)
-			      - ahc_get_pci_slot(lahc->dev_softc);
-		else
 			value = ahc_get_pci_slot(lahc->dev_softc)
 			      - ahc_get_pci_slot(rahc->dev_softc);
+		else
+			value = ahc_get_pci_slot(rahc->dev_softc)
+			      - ahc_get_pci_slot(lahc->dev_softc);
 		if (value != 0)
 			break;
 		/*
 		 * On multi-function devices, the user can choose
 		 * to have function 1 probed before function 0.
 		 * Give whichever channel is the primary channel
-		 * the lowest priority.
+		 * the highest priority.
 		 */
 		primary_channel = (lahc->flags & AHC_PRIMARY_CHANNEL) + 'A';
-		value = 1;
+		value = -1;
 		if (lahc->channel == primary_channel)
-			value = -1;
+			value = 1;
 		break;
 	}
 	case AHC_EISA:
 		if ((rahc->flags & AHC_BIOS_ENABLED) != 0) {
-			value = lahc->platform_data->bios_address
-			      - rahc->platform_data->bios_address; 
+			value = rahc->platform_data->bios_address
+			      - lahc->platform_data->bios_address; 
 		} else {
-			value = lahc->bsh.ioport
-			      - rahc->bsh.ioport; 
+			value = rahc->bsh.ioport
+			      - lahc->bsh.ioport; 
 		}
 		break;
 	default:
@@ -1580,90 +1598,6 @@
 }
 
 static void
-ahc_linux_setup_tag_info(char *p, char *end, char *s)
-{
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	int      i;
-	int      instance;
-	int	 targ;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
-
-	if (*p != ':')
-		return;
-
-	instance = -1;
-	targ = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			else if (targ == -1)
-				targ = 0;
-			tok++;
-			break;
-		case '}':
-			if (targ != -1)
-				targ = -1;
-			else if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (targ >= 0)
-				targ++;
-			else if (instance >= 0)
-				instance++;
-			if ((targ >= AHC_NUM_TARGETS) ||
-			    (instance >= NUM_ELEMENTS(aic7xxx_tag_info)))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0) && (targ >= 0)
-			 && (instance < NUM_ELEMENTS(aic7xxx_tag_info))
-			 && (targ < AHC_NUM_TARGETS)) {
-				aic7xxx_tag_info[instance].tag_commands[targ] =
-				    simple_strtoul(tok, NULL, 0) & 0xff;
-			}
-			tok = tok_end;
-			break;
-		}
-	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
-}
-
-static void
 ahc_linux_setup_tag_info_global(char *p)
 {
 	int tags, i, j;
@@ -1679,77 +1613,28 @@
 }
 
 static void
-ahc_linux_setup_dv(char *p, char *end, char *s)
+ahc_linux_setup_tag_info(void *arg, int instance, int targ, int32_t value)
 {
-	char	*base;
-	char	*tok;
-	char	*tok_end;
-	char	*tok_end2;
-	int      i;
-	int      instance;
-	int	 done;
-	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
 
-	if (*p != ':')
-		return;
+	if ((instance >= 0) && (targ >= 0)
+	 && (instance < NUM_ELEMENTS(aic7xxx_tag_info))
+	 && (targ < AHC_NUM_TARGETS)) {
+		aic7xxx_tag_info[instance].tag_commands[targ] = value & 0xff;
+		if (bootverbose)
+			printf("tag_info[%d:%d] = %d\n", instance, targ, value);
+	}
+}
 
-	instance = -1;
-	done = FALSE;
-	base = p;
-	/* Forward us just past the ':' */
-	tok = base + 1;
-	tok_end = strchr(tok, '\0');
-	if (tok_end < end)
-		*tok_end = ',';
-	while (!done) {
-		switch (*tok) {
-		case '{':
-			if (instance == -1)
-				instance = 0;
-			tok++;
-			break;
-		case '}':
-			if (instance != -1)
-				instance = -1;
-			tok++;
-			break;
-		case ',':
-		case '.':
-			if (instance == -1)
-				done = TRUE;
-			else if (instance >= 0)
-				instance++;
-			if (instance >= NUM_ELEMENTS(aic7xxx_dv_settings))
-				done = TRUE;
-			tok++;
-			if (!done) {
-				base = tok;
-			}
-			break;
-		case '\0':
-			done = TRUE;
-			break;
-		default:
-			done = TRUE;
-			tok_end = strchr(tok, '\0');
-			for (i = 0; tok_list[i]; i++) {
-				tok_end2 = strchr(tok, tok_list[i]);
-				if ((tok_end2) && (tok_end2 < tok_end)) {
-					tok_end = tok_end2;
-					done = FALSE;
-				}
-			}
-			if ((instance >= 0)
-			 && (instance < NUM_ELEMENTS(aic7xxx_dv_settings))) {
-				aic7xxx_dv_settings[instance] =
-				    simple_strtol(tok, NULL, 0);
-			}
-			tok = tok_end;
-			break;
-		}
+static void
+ahc_linux_setup_dv(void *arg, int instance, int targ, int32_t value)
+{
+
+	if ((instance >= 0)
+	 && (instance < NUM_ELEMENTS(aic7xxx_dv_settings))) {
+		aic7xxx_dv_settings[instance] = value;
+		if (bootverbose)
+			printf("dv[%d] = %d\n", instance, value);
 	}
-	while ((p != base) && (p != NULL))
-		p = strsep(&s, ",.");
 }
 
 /*
@@ -1787,30 +1672,38 @@
 
 	end = strchr(s, '\0');
 
+	/*
+	 * XXX ia64 gcc isn't smart enough to know that NUM_ELEMENTS
+	 * will never be 0 in this case.
+	 */
+	n = 0;
+
 	while ((p = strsep(&s, ",.")) != NULL) {
 		if (*p == '\0')
 			continue;
 		for (i = 0; i < NUM_ELEMENTS(options); i++) {
-			n = strlen(options[i].name);
 
-			if (strncmp(options[i].name, p, n) != 0)
-				continue;
+			n = strlen(options[i].name);
+			if (strncmp(options[i].name, p, n) == 0)
+				break;
+		}
+		if (i == NUM_ELEMENTS(options))
+			continue;
 
-			if (!strncmp(p, "global_tag_depth", n)) {
-				ahc_linux_setup_tag_info_global(p + n);
-			} else if (!strncmp(p, "tag_info", n)) {
-				ahc_linux_setup_tag_info(p + n, end, s);
-			} else if (strncmp(p, "dv", n) == 0) {
-				ahc_linux_setup_dv(p + n, end, s);
-			} else if (p[n] == ':') {
-				*(options[i].flag) =
-				    simple_strtoul(p + n + 1, NULL, 0);
-			} else if (!strncmp(p, "verbose", n)) {
-				*(options[i].flag) = 1;
-			} else {
-				*(options[i].flag) = ~(*(options[i].flag));
-			}
-			break;
+		if (strncmp(p, "global_tag_depth", n) == 0) {
+			ahc_linux_setup_tag_info_global(p + n);
+		} else if (strncmp(p, "tag_info", n) == 0) {
+			s = aic_parse_brace_option("tag_info", p + n, end,
+			    2, ahc_linux_setup_tag_info, NULL);
+		} else if (strncmp(p, "dv", n) == 0) {
+			s = aic_parse_brace_option("dv", p + n, end, 1,
+			    ahc_linux_setup_dv, NULL);
+		} else if (p[n] == ':') {
+			*(options[i].flag) = simple_strtoul(p + n + 1, NULL, 0);
+		} else if (strncmp(p, "verbose", n) == 0) {
+			*(options[i].flag) = 1;
+		} else {
+			*(options[i].flag) = ~(*(options[i].flag));
 		}
 	}
 	return 1;
@@ -1840,6 +1733,8 @@
 	ahc_lock(ahc, &s);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	scsi_assign_lock(host, &ahc->platform_data->spin_lock);
+#elif AHC_SCSI_HAS_HOST_LOCK != 0
+	host->lock = &ahc->platform_data->spin_lock;
 #endif
 	ahc->platform_data->host = host;
 	host->can_queue = AHC_MAX_QUEUE;
@@ -1860,7 +1755,7 @@
 	}
 	host->unique_id = ahc->unit;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) && \
-    LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
+    LINUX_VERSION_CODE  < KERNEL_VERSION(2,5,0)
 	scsi_set_pci_device(host, ahc->dev_softc);
 #endif
 	ahc_linux_initialize_scsi_bus(ahc);
@@ -1882,20 +1777,35 @@
 	 * negotiation will occur for the first command, and DV
 	 * will comence should that first command be successful.
 	 */
-	for (target = 0; target < host->max_id*host->max_channel+1; target++) {
+	for (target = 0;
+	     target < host->max_id * (host->max_channel + 1); target++) {
 		u_int channel;
 
 		channel = 0;
 		if (target > 7
 		 && (ahc->features & AHC_TWIN) != 0)
 			channel = 1;
+		/*
+		 * Skip our own ID.  Some Compaq/HP storage devices
+		 * have enclosure management devices that respond to
+		 * single bit selection (i.e. selecting ourselves).
+		 * It is expected that either an external application
+		 * or a modified kernel will be used to probe this
+		 * ID if it is appropriate.  To accommodate these
+		 * installations, ahc_linux_alloc_target() will allocate
+		 * for our ID if asked to do so.
+		 */
+		if ((channel == 0 && target == ahc->our_id)
+		 || (channel == 1 && target == ahc->our_id_b))
+			continue;
+
 		ahc_linux_alloc_target(ahc, channel, target);
 	}
 	ahc_intr_enable(ahc, TRUE);
 	ahc_linux_start_dv(ahc);
 	ahc_unlock(ahc, &s);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	scsi_add_host(host, (ahc->dev_softc ? &ahc->dev_softc->dev : NULL));
 #endif
 	return (0);
@@ -2053,31 +1963,15 @@
 {
 	struct ahc_linux_target *targ;
 	struct ahc_linux_device *dev;
-	u_long s;
 	int i, j;
 
 	if (ahc->platform_data != NULL) {
-		/* Kill the DV kthread */
-		if (ahc->platform_data->dv_pid > 0) {
-			ahc_lock(ahc, &s);
-			ahc->platform_data->flags |= AHC_DV_SHUTDOWN;
-			ahc_unlock(ahc, &s);
-			up(&ahc->platform_data->dv_sem);
-			do {
-#ifdef AHC_DEBUG
-				if (ahc_debug & AHC_SHOW_DV) {
-					printf("%s: Waiting for DV thread to "
-					       "exit\n", ahc_name(ahc));
-				}
-#endif
-			} while (waitpid(ahc->platform_data->dv_pid, NULL,
-					 __WCLONE) == -ERESTARTSYS);
-		}
+		ahc_linux_kill_dv_thread(ahc);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 		tasklet_kill(&ahc->platform_data->runq_tasklet);
 #endif
 		if (ahc->platform_data->host != NULL) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 			scsi_remove_host(ahc->platform_data->host);
 #endif
 			scsi_unregister(ahc->platform_data->host);
@@ -2116,16 +2010,17 @@
 					   0x1000);
 #endif
 		}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) && \
+    LINUX_VERSION_CODE  < KERNEL_VERSION(2,5,0)
 		/*
 		 * In 2.4 we detach from the scsi midlayer before the PCI
-		 * layer invokes our remove callback.
+		 * layer invokes our remove callback.  No per-instance
+		 * detach is provided, so we must reach inside the PCI
+		 * subsystem's internals and detach our driver manually.
 		 */
 		if (ahc->dev_softc != NULL)
 			ahc->dev_softc->driver = NULL;
 #endif
-#endif
 		free(ahc->platform_data, M_DEVBUF);
 	}
 }
@@ -2153,7 +2048,18 @@
 	if (dev == NULL)
 		return;
 	was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED);
-	now_queuing = alg != AHC_QUEUE_NONE;
+	switch (alg) {
+	default:
+	case AHC_QUEUE_NONE:
+		now_queuing = 0;
+		break; 
+	case AHC_QUEUE_BASIC:
+		now_queuing = AHC_DEV_Q_BASIC;
+		break;
+	case AHC_QUEUE_TAGGED:
+		now_queuing = AHC_DEV_Q_TAGGED;
+		break;
+	}
 	if ((dev->flags & AHC_DEV_FREEZE_TIL_EMPTY) == 0
 	 && (was_queuing != now_queuing)
 	 && (dev->active != 0)) {
@@ -2302,24 +2208,12 @@
 	ahc->platform_data->flags &= ~AHC_RUN_CMPLT_Q_TIMER;
 	acmd = TAILQ_FIRST(&ahc->platform_data->completeq);
 	TAILQ_INIT(&ahc->platform_data->completeq);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahc_unlock(ahc, &flags);
-#endif
 	if (acmd != NULL) {
 		acmd = ahc_linux_run_complete_queue(ahc, acmd);
-		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_lock(ahc, &flags);
-#endif
+		if (acmd != NULL)
 			ahc_schedule_completeq(ahc, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_unlock(ahc, &flags);
-#endif
-		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahc_unlock(ahc, &flags);
-#endif
 }
 
 static void
@@ -2328,7 +2222,7 @@
 
 	/*
 	 * Freeze the simq and signal ahc_linux_queue to not let any
-	 * more commands through
+	 * more commands through.
 	 */
 	if ((ahc->platform_data->flags & AHC_DV_ACTIVE) == 0) {
 #ifdef AHC_DEBUG
@@ -2344,6 +2238,48 @@
 	}
 }
 
+static void
+ahc_linux_kill_dv_thread(struct ahc_softc *ahc)
+{
+	u_long s;
+
+	ahc_lock(ahc, &s);
+	if (ahc->platform_data->dv_pid != 0) {
+		ahc->platform_data->flags |= AHC_DV_SHUTDOWN;
+		ahc_unlock(ahc, &s);
+		up(&ahc->platform_data->dv_sem);
+
+		/*
+		 * Use the eh_sem as an indicator that the
+		 * dv thread is exiting.  Note that the dv
+		 * thread must still return after performing
+		 * the up on our semaphore before it has
+		 * completely exited this module.  Unfortunately,
+		 * there seems to be no easy way to wait for the
+		 * exit of a thread for which you are not the
+		 * parent (dv threads are parented by init).
+		 * Cross your fingers...
+		 */
+		down(&ahc->platform_data->eh_sem);
+
+		/*
+		 * Mark the dv thread as already dead.  This
+		 * avoids attempting to kill it a second time.
+		 * This is necessary because we must kill the
+		 * DV thread before calling ahc_free() in the
+		 * module shutdown case to avoid bogus locking
+		 * in the SCSI mid-layer, but we ahc_free() is
+		 * called without killing the DV thread in the
+		 * instance detach case, so ahc_platform_free()
+		 * calls us again to verify that the DV thread
+		 * is dead.
+		 */
+		ahc->platform_data->dv_pid = 0;
+	} else {
+		ahc_unlock(ahc, &s);
+	}
+}
+
 static int
 ahc_linux_dv_thread(void *data)
 {
@@ -2362,7 +2298,17 @@
 	 * Complete thread creation.
 	 */
 	lock_kernel();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+	/*
+	 * Don't care about any signals.
+	 */
+	siginitsetinv(&current->blocked, 0);
+
+	daemonize();
+	sprintf(current->comm, "ahc_dv_%d", ahc->unit);
+#else
 	daemonize("ahc_dv_%d", ahc->unit);
+#endif
 	unlock_kernel();
 
 	while (1) {
@@ -2376,7 +2322,7 @@
 		ahc_lock(ahc, &s);
 		if ((ahc->platform_data->flags & AHC_DV_SHUTDOWN) != 0) {
 			ahc_unlock(ahc, &s);
-			return (0);
+			break;
 		}
 		ahc_unlock(ahc, &s);
 
@@ -2422,7 +2368,7 @@
 		 */
 		ahc_linux_release_simq((u_long)ahc);
 	}
-
+	up(&ahc->platform_data->eh_sem);
 	return (0);
 }
 
@@ -2528,6 +2474,7 @@
 		}
 		case AHC_DV_STATE_TUR:
 		case AHC_DV_STATE_BUSY:
+			timeout = 5 * HZ;
 			ahc_linux_dv_tur(ahc, cmd, &devinfo);
 			break;
 		case AHC_DV_STATE_REBD:
@@ -2568,14 +2515,19 @@
 		/*
 		 * In 2.5.X, it is assumed that all calls from the
 		 * "midlayer" (which we are emulating) will have the
-		 * ahc host lock held.
+		 * ahc host lock held.  For other kernels, the
+		 * io_request_lock must be held.
 		 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#if AHC_SCSI_HAS_HOST_LOCK != 0
 		ahc_lock(ahc, &s);
+#else
+		spin_lock_irqsave(&io_request_lock, s);
 #endif
 		ahc_linux_queue(cmd, ahc_linux_dv_complete);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+#if AHC_SCSI_HAS_HOST_LOCK != 0
 		ahc_unlock(ahc, &s);
+#else
+		spin_unlock_irqrestore(&io_request_lock, s);
 #endif
 		down_interruptible(&ahc->platform_data->dv_cmd_sem);
 		/*
@@ -3457,7 +3409,6 @@
 {
 	struct	ahc_softc *ahc;
 	struct	ahc_cmd *acmd;
-	struct	ahc_linux_device *next_dev;
 	struct	scb *scb;
 	u_long	flags;
 
@@ -3504,36 +3455,16 @@
 	ahc->platform_data->reset_timer.function =
 	    (ahc_linux_callback_t *)ahc_linux_release_simq;
 	add_timer(&ahc->platform_data->reset_timer);
-	/*
-	 * In 2.5.X, the "done lock" is the ahc_lock.
-	 * Instead of dropping and re-acquiring the same
-	 * lock in the 2.5.X case, just hold our ahc_lock
-	 * the whole time.  ahc_done_lock() has been
-	 * made a no-op for 2.5.X too.
-	 */
 	acmd = TAILQ_FIRST(&ahc->platform_data->completeq);
 	TAILQ_INIT(&ahc->platform_data->completeq);
-	next_dev = ahc_linux_next_device_to_run(ahc);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahc_unlock(ahc, &flags);
-#endif
-	if (next_dev)
+	if (ahc_linux_next_device_to_run(ahc) != NULL)
 		ahc_schedule_runq(ahc);
 	if (acmd != NULL) {
 		acmd = ahc_linux_run_complete_queue(ahc, acmd);
-		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_lock(ahc, &flags);
-#endif
+		if (acmd != NULL)
 			ahc_schedule_completeq(ahc, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_unlock(ahc, &flags);
-#endif
-		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahc_unlock(ahc, &flags);
-#endif
 }
 
 static void
@@ -3621,17 +3552,17 @@
 
 	tags = 0;
 	if ((ahc->user_discenable & devinfo->target_mask) != 0) {
-		if (warned_user == 0
-		 && ahc->unit >= NUM_ELEMENTS(aic7xxx_tag_info)) {
+		if (ahc->unit >= NUM_ELEMENTS(aic7xxx_tag_info)) {
+			if (warned_user == 0) {
 
-			printf("aic7xxx: WARNING, insufficient "
-			       "tag_info instances for installed "
-			       "controllers. Using defaults\n");
-			printf("aic7xxx: Please update the "
-			       "aic7xxx_tag_info array in the "
-			       "aic7xxx.c source file.\n");
+				printf(KERN_WARNING
+"aic7xxx: WARNING: Insufficient tag_info instances\n"
+"aic7xxx: for installed controllers. Using defaults\n"
+"aic7xxx: Please update the aic7xxx_tag_info array in\n"
+"aic7xxx: the aic7xxx_osm..c source file.\n");
+				warned_user++;
+			}
 			tags = AHC_MAX_QUEUE;
-			warned_user++;
 		} else {
 			adapter_tag_info_t *tag_info;
 
@@ -3650,17 +3581,17 @@
 	static int warned_user;
 	int dv;
 
-	if (warned_user == 0
-	 && ahc->unit >= NUM_ELEMENTS(aic7xxx_dv_settings)) {
+	if (ahc->unit >= NUM_ELEMENTS(aic7xxx_dv_settings)) {
+		if (warned_user == 0) {
 
-		printf("aic7xxx: WARNING, insufficient "
-		       "dv settings instances for installed "
-		       "controllers. Using defaults\n");
-		printf("aic7xxx: Please update the "
-		       "aic7xxx_dv_settings array in the "
-		       "aic7xxx.c source file.\n");
+			printf(KERN_WARNING
+"aic7xxx: WARNING: Insufficient dv settings instances\n"
+"aic7xxx: for installed controllers. Using defaults\n"
+"aic7xxx: Please update the aic7xxx_dv_settings array\n"
+"aic7xxx: in the aic7xxx_osm.c source file.\n");
+			warned_user++;
+		}
 		dv = -1;
-		warned_user++;
 	} else {
 
 		dv = aic7xxx_dv_settings[ahc->unit];
@@ -3938,41 +3869,20 @@
 	struct	ahc_softc *ahc;
 	struct	ahc_cmd *acmd;
 	u_long	flags;
-	struct	ahc_linux_device *next_dev;
 
 	ahc = (struct ahc_softc *) dev_id;
 	ahc_lock(ahc, &flags); 
 	ahc_intr(ahc);
 	acmd = TAILQ_FIRST(&ahc->platform_data->completeq);
 	TAILQ_INIT(&ahc->platform_data->completeq);
-	next_dev = ahc_linux_next_device_to_run(ahc);
-	/*
-	 * In 2.5.X, the "done lock" is the ahc_lock.
-	 * Instead of dropping and re-acquiring the same
-	 * lock in the 2.5.X case, just hold our ahc_lock
-	 * the whole time.  ahc_done_lock() has been
-	 * made a no-op for 2.5.X too.
-	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	ahc_unlock(ahc, &flags);
-#endif
-	if (next_dev)
+	if (ahc_linux_next_device_to_run(ahc) != NULL)
 		ahc_schedule_runq(ahc);
 	if (acmd != NULL) {
 		acmd = ahc_linux_run_complete_queue(ahc, acmd);
-		if (acmd != NULL) {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_lock(ahc, &flags);
-#endif
+		if (acmd != NULL)
 			ahc_schedule_completeq(ahc, acmd);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-			ahc_unlock(ahc, &flags);
-#endif
-		}
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	ahc_unlock(ahc, &flags);
-#endif
 }
 
 void
@@ -3995,15 +3905,6 @@
 	target_offset = target;
 	if (channel != 0)
 		target_offset += 8;
-	/*
-	 * Never allow allocation of a target object for
-	 * our own SCSIID.
-	 */
-	if ((channel == 0 && target == ahc->our_id)
-	 || (channel == 1 && target == ahc->our_id_b)) {
-		ahc->platform_data->targets[target_offset] = NULL;
-		return (NULL);
-	}
 
 	targ = malloc(sizeof(*targ), M_DEVBUG, M_NOWAIT);
 	if (targ == NULL)
@@ -4274,6 +4175,14 @@
 #endif
 			ahc_set_transaction_status(scb, CAM_UNCOR_PARITY);
 		} else if (amount_xferred < scb->io_ctx->underflow) {
+			u_int i;
+
+			ahc_print_path(ahc, scb);
+			printf("CDB:");
+			for (i = 0; i < scb->io_ctx->cmd_len; i++)
+				printf(" 0x%x", scb->io_ctx->cmnd[i]);
+			printf("\n");
+			ahc_print_path(ahc, scb);
 			printf("Saw underflow (%ld of %ld bytes). "
 			       "Treated as error\n",
 				ahc_get_residual(scb),
@@ -4456,7 +4365,7 @@
 			}
 			ahc_set_transaction_status(scb, CAM_REQUEUE_REQ);
 			ahc_set_scsi_status(scb, SCSI_STATUS_OK);
-			ahc_set_tags(ahc, &devinfo,
+			ahc_platform_set_tags(ahc, &devinfo,
 				     (dev->flags & AHC_DEV_Q_BASIC)
 				   ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
 			break;
@@ -4467,7 +4376,7 @@
 		 */
 		dev->openings = 1;
 		ahc_set_scsi_status(scb, SCSI_STATUS_BUSY);
-		ahc_set_tags(ahc, &devinfo,
+		ahc_platform_set_tags(ahc, &devinfo,
 			     (dev->flags & AHC_DEV_Q_BASIC)
 			   ? AHC_QUEUE_BASIC : AHC_QUEUE_TAGGED);
 		/* FALLTHROUGH */
@@ -4770,6 +4679,7 @@
 		ahc->platform_data->flags &= ~AHC_DV_WAIT_SIMQ_RELEASE;
 		up(&ahc->platform_data->dv_sem);
 	}
+	ahc_schedule_runq(ahc);
 	ahc_unlock(ahc, &s);
 	/*
 	 * There is still a race here.  The mid-layer
@@ -4779,8 +4689,6 @@
 	 */
 	if (unblock_reqs)
 		scsi_unblock_requests(ahc->platform_data->host);
-
-	ahc_schedule_runq(ahc);
 }
 
 static void
@@ -4815,6 +4723,7 @@
 	u_int  active_scb_index;
 	u_int  last_phase;
 	u_int  saved_scsiid;
+	u_int  cdb_byte;
 	int    retval;
 	int    paused;
 	int    wait;
@@ -4831,6 +4740,11 @@
 	       cmd->device->id, cmd->device->lun,
 	       flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
 
+	printf("CDB:");
+	for (cdb_byte = 0; cdb_byte < cmd->cmd_len; cdb_byte++)
+		printf(" 0x%x", cmd->cmnd[cdb_byte]);
+	printf("\n");
+
 	/*
 	 * In all versions of Linux, we have to work around
 	 * a major flaw in how the mid-layer is locked down
@@ -4845,9 +4759,6 @@
 	 * by acquiring either the io_request_lock or our own
 	 * lock, this *should* be safe.
 	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_unlock_irq(&io_request_lock);
-#endif
 	ahc_midlayer_entrypoint_lock(ahc, &s);
 
 	/*
@@ -5104,11 +5015,7 @@
 		int ret;
 
 		ahc->platform_data->flags |= AHC_UP_EH_SEMAPHORE;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-		ahc_unlock(ahc, &s);
-#else
-		spin_unlock_irq(ahc->platform_data->host->host_lock);
-#endif
+		spin_unlock_irq(&ahc->platform_data->spin_lock);
 		init_timer(&timer);
 		timer.data = (u_long)ahc;
 		timer.expires = jiffies + (5 * HZ);
@@ -5122,27 +5029,17 @@
 			printf("Timer Expired\n");
 			retval = FAILED;
 		}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-		ahc_lock(ahc, &s);
-#else
-		spin_lock_irq(ahc->platform_data->host->host_lock);
-#endif
+		spin_lock_irq(&ahc->platform_data->spin_lock);
 	}
 	acmd = TAILQ_FIRST(&ahc->platform_data->completeq);
 	TAILQ_INIT(&ahc->platform_data->completeq);
-	ahc_midlayer_entrypoint_unlock(ahc, &s);
+	ahc_schedule_runq(ahc);
 	if (acmd != NULL) {
 		acmd = ahc_linux_run_complete_queue(ahc, acmd);
-		if (acmd != NULL) {
-			ahc_midlayer_entrypoint_lock(ahc, &s);
+		if (acmd != NULL)
 			ahc_schedule_completeq(ahc, acmd);
-			ahc_midlayer_entrypoint_unlock(ahc, &s);
-		}
 	}
-	ahc_schedule_runq(ahc);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	spin_lock_irq(&io_request_lock);
-#endif
+	ahc_midlayer_entrypoint_unlock(ahc, &s);
 	return (retval);
 }
 
@@ -5185,13 +5082,14 @@
 	}
 }
 
-static int __init ahc_linux_init(void)
+static int __init
+ahc_linux_init(void)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	return (ahc_linux_detect(&aic7xxx_driver_template) ? 0 : -ENODEV);
 #else
 	scsi_register_module(MODULE_SCSI_HA, &aic7xxx_driver_template);
-	if (!driver_template.present) {
+	if (aic7xxx_driver_template.present == 0) {
 		scsi_unregister_module(MODULE_SCSI_HA,
 				       &aic7xxx_driver_template);
 		return (-ENODEV);
@@ -5201,10 +5099,25 @@
 #endif
 }
 
-static void __exit ahc_linux_exit(void)
+static void __exit
+ahc_linux_exit(void)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-	struct	ahc_softc *ahc;
+	struct ahc_softc *ahc;
+	u_long l;
+
+	/*
+	 * Shutdown DV threads before going into the SCSI mid-layer.
+	 * This avoids situations where the mid-layer locks the entire
+	 * kernel so that waiting for our DV threads to exit leads
+	 * to deadlock.
+	 */
+	ahc_list_lock(&l);
+	TAILQ_FOREACH(ahc, &ahc_tailq, links) {
+
+		ahc_linux_kill_dv_thread(ahc);
+	}
+	ahc_list_unlock(&l);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 
 	ahc_linux_pci_exit();
 
@@ -5220,9 +5133,8 @@
 
 	/*
 	 * In 2.4 we have to unregister from the PCI core _after_
-	 * unregistering from the scsi midlayer to avoid danling references.
-	 *
-	 * The 2.4 scsi midlayer is so f***ed..
+	 * unregistering from the scsi midlayer to avoid dangling
+	 * references.
 	 */
 	ahc_linux_pci_exit();
 #endif
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm.h	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm.h	2003-04-15 04:36:16.000000000 -0700
@@ -53,7 +53,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#123 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#131 $
  *
  */
 #ifndef _AIC7XXX_LINUX_H_
@@ -299,7 +299,13 @@
 #include <linux/smp.h>
 #endif
 
-#define AIC7XXX_DRIVER_VERSION "6.2.28"
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK))
+#define AHC_SCSI_HAS_HOST_LOCK 1
+#else
+#define AHC_SCSI_HAS_HOST_LOCK 0
+#endif
+
+#define AIC7XXX_DRIVER_VERSION "6.2.31"
 
 /**************************** Front End Queues ********************************/
 /*
@@ -703,7 +709,6 @@
 static __inline void
 ahc_lock(struct ahc_softc *ahc, unsigned long *flags)
 {
-	*flags = 0;
 	spin_lock_irqsave(&ahc->platform_data->spin_lock, *flags);
 }
 
@@ -717,10 +722,13 @@
 ahc_midlayer_entrypoint_lock(struct ahc_softc *ahc, unsigned long *flags)
 {
 	/*
-	 * In 2.5.X, the midlayer takes our lock just before
-	 * calling us, so avoid locking again.
+	 * In 2.5.X and some 2.4.X versions, the midlayer takes our
+	 * lock just before calling us, so we avoid locking again.
+	 * For other kernel versions, the io_request_lock is taken
+	 * just before our entry point is called.  In this case, we
+	 * trade the io_request_lock for our per-softc lock.
 	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if AHC_SCSI_HAS_HOST_LOCK == 0
 	ahc_lock(ahc, flags);
 #endif
 }
@@ -728,11 +736,7 @@
 static __inline void
 ahc_midlayer_entrypoint_unlock(struct ahc_softc *ahc, unsigned long *flags)
 {
-	/*
-	 * In 2.5.X, the midlayer takes our lock just before
-	 * calling us and unlocks when we return, so let it do the unlock.
-	 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if AHC_SCSI_HAS_HOST_LOCK == 0
 	ahc_unlock(ahc, flags);
 #endif
 }
@@ -750,8 +754,7 @@
 static __inline void
 ahc_done_lock(struct ahc_softc *ahc, unsigned long *flags)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	*flags = 0;
+#if AHC_SCSI_HAS_HOST_LOCK == 0
 	spin_lock_irqsave(&io_request_lock, *flags);
 #endif
 }
@@ -759,7 +762,7 @@
 static __inline void
 ahc_done_unlock(struct ahc_softc *ahc, unsigned long *flags)
 {
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+#if AHC_SCSI_HAS_HOST_LOCK == 0
 	spin_unlock_irqrestore(&io_request_lock, *flags);
 #endif
 }
@@ -773,7 +776,6 @@
 static __inline void
 ahc_list_lock(unsigned long *flags)
 {
-	*flags = 0;
 	spin_lock_irqsave(&ahc_list_spinlock, *flags);
 }
 
@@ -793,7 +795,6 @@
 static __inline void
 ahc_lock(struct ahc_softc *ahc, unsigned long *flags)
 {
-	*flags = 0;
 	save_flags(*flags);
 	cli();
 }
@@ -832,7 +833,6 @@
 static __inline void
 ahc_list_lock(unsigned long *flags)
 {
-	*flags = 0;
 	save_flags(*flags);
 	cli();
 }
@@ -907,7 +907,7 @@
  */
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,1,92)
 #if defined(__sparc_v9__) || defined(__powerpc__)
-#error "PPC and Sparc platforms are only support under 2.1.92 and above"
+#error "PPC and Sparc platforms are only supported under 2.1.92 and above"
 #endif
 #include <linux/bios32.h>
 #endif
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	2003-04-07 10:30:59.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c	2003-04-15 04:36:16.000000000 -0700
@@ -36,7 +36,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#43 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#44 $
  */
 
 #include "aic7xxx_osm.h"
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_pci.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_pci.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_pci.c	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_pci.c	2003-04-15 04:36:16.000000000 -0700
@@ -39,7 +39,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#62 $
  *
  * $FreeBSD$
  */
@@ -696,8 +696,12 @@
 static void aic785X_cable_detect(struct ahc_softc *ahc, int *internal50_present,
 				 int *externalcable_present,
 				 int *eeprom_present);
-static void write_brdctl(struct ahc_softc *ahc, uint8_t value);
+static void    write_brdctl(struct ahc_softc *ahc, uint8_t value);
 static uint8_t read_brdctl(struct ahc_softc *ahc);
+static void ahc_pci_intr(struct ahc_softc *ahc);
+static int  ahc_pci_chip_init(struct ahc_softc *ahc);
+static int  ahc_pci_suspend(struct ahc_softc *ahc);
+static int  ahc_pci_resume(struct ahc_softc *ahc);
 
 static int
 ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor,
@@ -748,10 +752,7 @@
 	device = ahc_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2);
 	subvendor = ahc_pci_read_config(pci, PCIR_SUBVEND_0, /*bytes*/2);
 	subdevice = ahc_pci_read_config(pci, PCIR_SUBDEV_0, /*bytes*/2);
-	full_id = ahc_compose_id(device,
-				 vendor,
-				 subdevice,
-				 subvendor);
+	full_id = ahc_compose_id(device, vendor, subdevice, subvendor);
 
 	/*
 	 * If the second function is not hooked up, ignore it.
@@ -854,6 +855,9 @@
 		return (error);
 
 	ahc->bus_intr = ahc_pci_intr;
+	ahc->bus_chip_init = ahc_pci_chip_init;
+	ahc->bus_suspend = ahc_pci_suspend;
+	ahc->bus_resume = ahc_pci_resume;
 
 	/* Remeber how the card was setup in case there is no SEEPROM */
 	if ((ahc_inb(ahc, HCNTRL) & POWRDN) == 0) {
@@ -993,6 +997,35 @@
 	if ((sxfrctl1 & STPWEN) != 0)
 		ahc->flags |= AHC_TERM_ENB_A;
 
+	/*
+	 * Save chip register configuration data for chip resets
+	 * that occur during runtime and resume events.
+	 */
+	ahc->bus_softc.pci_softc.devconfig =
+	    ahc_pci_read_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4);
+	ahc->bus_softc.pci_softc.command =
+	    ahc_pci_read_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1);
+	ahc->bus_softc.pci_softc.csize_lattime =
+	    ahc_pci_read_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1);
+	ahc->bus_softc.pci_softc.dscommand0 = ahc_inb(ahc, DSCOMMAND0);
+	ahc->bus_softc.pci_softc.dspcistatus = ahc_inb(ahc, DSPCISTATUS);
+	if ((ahc->features & AHC_DT) != 0) {
+		u_int sfunct;
+
+		sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
+		ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
+		ahc->bus_softc.pci_softc.optionmode = ahc_inb(ahc, OPTIONMODE);
+		ahc->bus_softc.pci_softc.targcrccnt = ahc_inw(ahc, TARGCRCCNT);
+		ahc_outb(ahc, SFUNCT, sfunct);
+		ahc->bus_softc.pci_softc.crccontrol1 =
+		    ahc_inb(ahc, CRCCONTROL1);
+	}
+	if ((ahc->features & AHC_MULTI_FUNC) != 0)
+		ahc->bus_softc.pci_softc.scbbaddr = ahc_inb(ahc, SCBBADDR);
+
+	if ((ahc->features & AHC_ULTRA2) != 0)
+		ahc->bus_softc.pci_softc.dff_thrsh = ahc_inb(ahc, DFF_THRSH);
+
 	/* Core initialization */
 	error = ahc_init(ahc);
 	if (error != 0)
@@ -1412,6 +1445,7 @@
 	}
 
 	if (have_autoterm) {
+		ahc->flags |= AHC_HAS_TERM_LOGIC;
 		ahc_acquire_seeprom(ahc, &sd);
 		configure_termination(ahc, &sd, sc->adapter_control, sxfrctl1);
 		ahc_release_seeprom(&sd);
@@ -1845,11 +1879,14 @@
 	spiocap |= EXT_BRDCTL;
 	ahc_outb(ahc, SPIOCAP, spiocap);
 	ahc_outb(ahc, BRDCTL, BRDRW|BRDCS);
+	ahc_flush_device_writes(ahc);
+	ahc_delay(500);
 	ahc_outb(ahc, BRDCTL, 0);
+	ahc_flush_device_writes(ahc);
+	ahc_delay(500);
 	brdctl = ahc_inb(ahc, BRDCTL);
 	*internal50_present = (brdctl & BRDDAT5) ? 0 : 1;
 	*externalcable_present = (brdctl & BRDDAT6) ? 0 : 1;
-
 	*eeprom_present = (ahc_inb(ahc, SPIOCAP) & EEPROM) ? 1 : 0;
 }
 	
@@ -1943,7 +1980,7 @@
 	return (value);
 }
 
-void
+static void
 ahc_pci_intr(struct ahc_softc *ahc)
 {
 	u_int error;
@@ -1996,6 +2033,73 @@
 }
 
 static int
+ahc_pci_chip_init(struct ahc_softc *ahc)
+{
+	ahc_outb(ahc, DSCOMMAND0, ahc->bus_softc.pci_softc.dscommand0);
+	ahc_outb(ahc, DSPCISTATUS, ahc->bus_softc.pci_softc.dspcistatus);
+	if ((ahc->features & AHC_DT) != 0) {
+		u_int sfunct;
+
+		sfunct = ahc_inb(ahc, SFUNCT) & ~ALT_MODE;
+		ahc_outb(ahc, SFUNCT, sfunct | ALT_MODE);
+		ahc_outb(ahc, OPTIONMODE, ahc->bus_softc.pci_softc.optionmode);
+		ahc_outw(ahc, TARGCRCCNT, ahc->bus_softc.pci_softc.targcrccnt);
+		ahc_outb(ahc, SFUNCT, sfunct);
+		ahc_outb(ahc, CRCCONTROL1,
+			 ahc->bus_softc.pci_softc.crccontrol1);
+	}
+	if ((ahc->features & AHC_MULTI_FUNC) != 0)
+		ahc_outb(ahc, SCBBADDR, ahc->bus_softc.pci_softc.scbbaddr);
+
+	if ((ahc->features & AHC_ULTRA2) != 0)
+		ahc_outb(ahc, DFF_THRSH, ahc->bus_softc.pci_softc.dff_thrsh);
+
+	return (ahc_chip_init(ahc));
+}
+
+static int
+ahc_pci_suspend(struct ahc_softc *ahc)
+{
+	return (ahc_suspend(ahc));
+}
+
+static int
+ahc_pci_resume(struct ahc_softc *ahc)
+{
+
+	ahc_power_state_change(ahc, AHC_POWER_STATE_D0);
+
+	/*
+	 * We assume that the OS has restored our register
+	 * mappings, etc.  Just update the config space registers
+	 * that the OS doesn't know about and rely on our chip
+	 * reset handler to handle the rest.
+	 */
+	ahc_pci_write_config(ahc->dev_softc, DEVCONFIG, /*bytes*/4,
+			     ahc->bus_softc.pci_softc.devconfig);
+	ahc_pci_write_config(ahc->dev_softc, PCIR_COMMAND, /*bytes*/1,
+			     ahc->bus_softc.pci_softc.command);
+	ahc_pci_write_config(ahc->dev_softc, CSIZE_LATTIME, /*bytes*/1,
+			     ahc->bus_softc.pci_softc.csize_lattime);
+	if ((ahc->flags & AHC_HAS_TERM_LOGIC) != 0) {
+		struct	seeprom_descriptor sd;
+		u_int	sxfrctl1;
+
+		sd.sd_ahc = ahc;
+		sd.sd_control_offset = SEECTL;		
+		sd.sd_status_offset = SEECTL;		
+		sd.sd_dataout_offset = SEECTL;		
+
+		ahc_acquire_seeprom(ahc, &sd);
+		configure_termination(ahc, &sd,
+				      ahc->seep_config->adapter_control,
+				      &sxfrctl1);
+		ahc_release_seeprom(&sd);
+	}
+	return (ahc_resume(ahc));
+}
+
+static int
 ahc_aic785X_setup(struct ahc_softc *ahc)
 {
 	ahc_dev_softc_t pci;
@@ -2009,6 +2113,7 @@
 	rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
 	if (rev >= 1)
 		ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
+	ahc->instruction_ram_size = 512;
 	return (0);
 }
 
@@ -2026,6 +2131,7 @@
 	rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
 	if (rev >= 1)
 		ahc->bugs |= AHC_PCI_2_1_RETRY_BUG;
+	ahc->instruction_ram_size = 512;
 	return (0);
 }
 
@@ -2049,6 +2155,7 @@
 	ahc->chip = AHC_AIC7870;
 	ahc->features = AHC_AIC7870_FE;
 	ahc->bugs |= AHC_TMODE_WIDEODD_BUG|AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
+	ahc->instruction_ram_size = 512;
 	return (0);
 }
 
@@ -2102,6 +2209,7 @@
 	} else {
 		ahc->bugs |= AHC_CACHETHEN_BUG|AHC_PCI_MWI_BUG;
 	}
+	ahc->instruction_ram_size = 512;
 	return (0);
 }
 
@@ -2149,6 +2257,7 @@
 	rev = ahc_pci_read_config(pci, PCIR_REVID, /*bytes*/1);
 	if (rev == 0)
 		ahc->bugs |= AHC_AUTOFLUSH_BUG|AHC_CACHETHEN_BUG;
+	ahc->instruction_ram_size = 768;
 	return (0);
 }
 
@@ -2161,6 +2270,7 @@
 	ahc->features = AHC_AIC7892_FE;
 	ahc->flags |= AHC_NEWEEPROM_FMT;
 	ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
+	ahc->instruction_ram_size = 1024;
 	return (0);
 }
 
@@ -2216,6 +2326,7 @@
 	ahc_pci_write_config(pci, DEVCONFIG, devconfig, /*bytes*/1);
 #endif
 	ahc->flags |= AHC_NEWEEPROM_FMT;
+	ahc->instruction_ram_size = 512;
 	return (0);
 }
 
@@ -2230,6 +2341,7 @@
 	ahc->features = AHC_AIC7896_FE;
 	ahc->flags |= AHC_NEWEEPROM_FMT;
 	ahc->bugs |= AHC_CACHETHEN_DIS_BUG;
+	ahc->instruction_ram_size = 768;
 	return (0);
 }
 
@@ -2244,6 +2356,7 @@
 	ahc->features = AHC_AIC7899_FE;
 	ahc->flags |= AHC_NEWEEPROM_FMT;
 	ahc->bugs |= AHC_SCBCHAN_UPLOAD_BUG;
+	ahc->instruction_ram_size = 1024;
 	return (0);
 }
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_proc.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_proc.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_proc.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_proc.c	2003-04-15 04:36:16.000000000 -0700
@@ -37,7 +37,7 @@
  * String handling code courtesy of Gerard Roudier's <groudier@club-internet.fr>
  * sym driver.
  *
- * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_proc.c#23 $
+ * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_proc.c#24 $
  */
 #include "aic7xxx_osm.h"
 #include "aic7xxx_inline.h"
@@ -325,6 +325,7 @@
 
 	copy_info(&info, "Adaptec AIC7xxx driver version: %s\n",
 		  AIC7XXX_DRIVER_VERSION);
+	copy_info(&info, "%s\n", ahc->description);
 	ahc_controller_info(ahc, ahc_info);
 	copy_info(&info, "%s\n\n", ahc_info);
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_reg.h_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -3,7 +3,7 @@
  *		 from the following source files:
  *
  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#54 $
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#38 $
  */
 typedef int (ahc_reg_print_t)(u_int, u_int *, u_int);
 typedef struct ahc_reg_parse_entry {
@@ -1776,7 +1776,7 @@
 #define	SEQ_MAILBOX_SHIFT	0x00
 #define	TARGET_DATA_IN	0x01
 #define	HOST_MSG	0xff
-#define	MAX_OFFSET	0xff
+#define	MAX_OFFSET	0x7f
 #define	BUS_16_BIT	0x01
 #define	SCB_UPLOAD_SIZE	0x20
 #define	STACK_SIZE	0x04
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_reg_print.c_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -3,7 +3,7 @@
  *		 from the following source files:
  *
  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#54 $
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#38 $
  */
 
 #include "aic7xxx_osm.h"
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped	2003-04-07 10:33:04.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aic7xxx_seq.h_shipped	2003-04-15 04:36:16.000000000 -0700
@@ -3,7 +3,7 @@
  *		 from the following source files:
  *
  * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.seq#54 $
- * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#37 $
+ * $Id: //depot/aic7xxx/aic7xxx/aic7xxx.reg#38 $
  */
 static uint8_t seqprog[] = {
 	0xb2, 0x00, 0x00, 0x08,
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aicasm/Makefile linux-2.5.67-bk6/drivers/scsi/aic7xxx/aicasm/Makefile
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aicasm/Makefile	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aicasm/Makefile	2003-04-15 04:36:16.000000000 -0700
@@ -11,7 +11,7 @@
 
 SRCS=	${CSRCS} ${GENSRCS}
 LIBS=	-ldb
-CLEANFILES= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output)
+clean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG)
 # Override default kernel CFLAGS.  This is a userland app.
 AICASM_CFLAGS:= -I/usr/include -I.
 YFLAGS= -d
@@ -46,7 +46,6 @@
 		echo "*** Install db development libraries";	\
 	 fi
 
-clean-files := $(CLEANFILES) $(PROG)
 clean:
 	rm -f $(clean-files)
 
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aiclib.c linux-2.5.67-bk6/drivers/scsi/aic7xxx/aiclib.c
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aiclib.c	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aiclib.c	2003-04-15 04:36:16.000000000 -0700
@@ -1333,3 +1333,81 @@
 	return (err_action);
 }
 
+char *
+aic_parse_brace_option(char *opt_name, char *opt_arg, char *end, int depth,
+		       aic_option_callback_t *callback, void *callback_arg)
+{
+	char	*tok_end;
+	char	*tok_end2;
+	int      i;
+	int      instance;
+	int	 targ;
+	int	 done;
+	char	 tok_list[] = {'.', ',', '{', '}', '\0'};
+
+	/* All options use a ':' name/arg separator */
+	if (*opt_arg != ':')
+		return (opt_arg);
+	opt_arg++;
+	instance = -1;
+	targ = -1;
+	done = FALSE;
+	/*
+	 * Restore separator that may be in
+	 * the middle of our option argument.
+	 */
+	tok_end = strchr(opt_arg, '\0');
+	if (tok_end < end)
+		*tok_end = ',';
+	while (!done) {
+		switch (*opt_arg) {
+		case '{':
+			if (instance == -1) {
+				instance = 0;
+			} else {
+				if (depth > 1) {
+					if (targ == -1)
+						targ = 0;
+				} else {
+					printf("Malformed Option %s\n",
+					       opt_name);
+					done = TRUE;
+				}
+			}
+			opt_arg++;
+			break;
+		case '}':
+			if (targ != -1)
+				targ = -1;
+			else if (instance != -1)
+				instance = -1;
+			opt_arg++;
+			break;
+		case ',':
+		case '.':
+			if (instance == -1)
+				done = TRUE;
+			else if (targ >= 0)
+				targ++;
+			else if (instance >= 0)
+				instance++;
+			opt_arg++;
+			break;
+		case '\0':
+			done = TRUE;
+			break;
+		default:
+			tok_end = end;
+			for (i = 0; tok_list[i]; i++) {
+				tok_end2 = strchr(opt_arg, tok_list[i]);
+				if ((tok_end2) && (tok_end2 < tok_end))
+					tok_end = tok_end2;
+			}
+			callback(callback_arg, instance, targ,
+				 simple_strtol(opt_arg, NULL, 0));
+			opt_arg = tok_end;
+			break;
+		}
+	}
+	return (opt_arg);
+}
diff -urN linux-2.5.67-bk5/drivers/scsi/aic7xxx/aiclib.h linux-2.5.67-bk6/drivers/scsi/aic7xxx/aiclib.h
--- linux-2.5.67-bk5/drivers/scsi/aic7xxx/aiclib.h	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/aic7xxx/aiclib.h	2003-04-15 04:36:16.000000000 -0700
@@ -870,6 +870,7 @@
 #define	aic_calc_speed			AIC_LIB_ENTRY(_calc_speed)
 #define	aic_inquiry_match		AIC_LIB_ENTRY(_inquiry_match)
 #define	aic_static_inquiry_match	AIC_LIB_ENTRY(_static_inquiry_match)
+#define	aic_parse_brace_option		AIC_LIB_ENTRY(_parse_brace_option)
 
 /******************************************************************************/
 
@@ -905,6 +906,10 @@
 int		aic_static_inquiry_match(caddr_t /*inqbuffer*/,
 					 caddr_t /*table_entry*/);
 
+typedef void aic_option_callback_t(void *, int, int, int32_t);
+char *		aic_parse_brace_option(char *opt_name, char *opt_arg,
+				       char *end, int depth,
+				       aic_option_callback_t *, void *);
 
 static __inline void	 scsi_extract_sense(struct scsi_sense_data *sense,
 					    int *error_code, int *sense_key,
diff -urN linux-2.5.67-bk5/drivers/scsi/hosts.c linux-2.5.67-bk6/drivers/scsi/hosts.c
--- linux-2.5.67-bk5/drivers/scsi/hosts.c	2003-04-07 10:30:38.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/hosts.c	2003-04-15 04:36:16.000000000 -0700
@@ -383,6 +383,7 @@
 	scsi_assign_lock(shost, &shost->default_lock);
 	INIT_LIST_HEAD(&shost->my_devices);
 	INIT_LIST_HEAD(&shost->eh_cmd_q);
+	INIT_LIST_HEAD(&shost->starved_list);
 
 	init_waitqueue_head(&shost->host_wait);
 	shost->dma_channel = 0xff;
@@ -619,7 +620,6 @@
 
 	spin_lock_irqsave(shost->host_lock, flags);
 	shost->host_busy--;
-	sdev->device_busy--;
 	if (shost->in_recovery && shost->host_failed &&
 	    (shost->host_busy == shost->host_failed))
 	{
diff -urN linux-2.5.67-bk5/drivers/scsi/hosts.h linux-2.5.67-bk6/drivers/scsi/hosts.h
--- linux-2.5.67-bk5/drivers/scsi/hosts.h	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/hosts.h	2003-04-15 04:36:16.000000000 -0700
@@ -380,6 +380,7 @@
     struct scsi_host_cmd_pool *cmd_pool;
     spinlock_t            free_list_lock;
     struct list_head      free_list;   /* backup store of cmd structs */
+    struct list_head      starved_list;
 
     spinlock_t		  default_lock;
     spinlock_t		  *host_lock;
@@ -471,12 +472,6 @@
     unsigned reverse_ordering:1;
 
     /*
-     * Indicates that one or more devices on this host were starved, and
-     * when the device becomes less busy that we need to feed them.
-     */
-    unsigned some_device_starved:1;
-   
-    /*
      * Host has rejected a command because it was busy.
      */
     unsigned int host_blocked;
diff -urN linux-2.5.67-bk5/drivers/scsi/lasi700.c linux-2.5.67-bk6/drivers/scsi/lasi700.c
--- linux-2.5.67-bk5/drivers/scsi/lasi700.c	2003-04-07 10:30:41.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/lasi700.c	2003-04-15 04:36:16.000000000 -0700
@@ -45,6 +45,7 @@
 #include <linux/version.h>
 #include <linux/config.h>
 #include <linux/ioport.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi.c linux-2.5.67-bk6/drivers/scsi/scsi.c
--- linux-2.5.67-bk5/drivers/scsi/scsi.c	2003-04-07 10:31:22.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi.c	2003-04-15 04:36:16.000000000 -0700
@@ -447,8 +447,6 @@
 
 	host = SCpnt->device->host;
 
-	ASSERT_LOCK(host->host_lock, 0);
-
 	/* Assign a unique nonzero serial_number. */
 	if (++serial_number == 0)
 		serial_number = 1;
@@ -574,8 +572,6 @@
 {
 	struct Scsi_Host *host = SCpnt->device->host;
 
-	ASSERT_LOCK(host->host_lock, 0);
-
 	SCpnt->owner = SCSI_OWNER_MIDLEVEL;
 	SRpnt->sr_command = SCpnt;
 
@@ -819,12 +815,11 @@
 	struct Scsi_Host *host;
 	Scsi_Device *device;
 	Scsi_Request * SRpnt;
+	unsigned long flags;
 
 	host = SCpnt->device->host;
 	device = SCpnt->device;
 
-	ASSERT_LOCK(host->host_lock, 0);
-
         /*
          * We need to protect the decrement, as otherwise a race condition
          * would exist.  Fiddling with SCpnt isn't a problem as the
@@ -833,6 +828,9 @@
          * shared.
          */
 	scsi_host_busy_dec_and_test(host, device);
+	spin_lock_irqsave(SCpnt->device->request_queue->queue_lock, flags);
+	SCpnt->device->device_busy--;
+	spin_unlock_irqrestore(SCpnt->device->request_queue->queue_lock, flags);
 
         /*
          * Clear the flags which say that the device/host is no longer
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi.h linux-2.5.67-bk6/drivers/scsi/scsi.h
--- linux-2.5.67-bk5/drivers/scsi/scsi.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi.h	2003-04-15 04:36:16.000000000 -0700
@@ -417,7 +417,8 @@
 extern void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
 			       int block_sectors);
 extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
-extern request_queue_t *scsi_alloc_queue(struct Scsi_Host *shost);
+extern void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd);
+extern request_queue_t *scsi_alloc_queue(struct scsi_device *sdev);
 extern void scsi_free_queue(request_queue_t *q);
 extern int scsi_init_queue(void);
 extern void scsi_exit_queue(void);
@@ -531,6 +532,16 @@
 extern int scsi_dev_info_list_add_str(char *);
 
 /*
+ * scsi_target: representation of a scsi target, for now, this is only
+ * used for single_lun devices. If no one has active IO to the target,
+ * starget_sdev_user is NULL, else it points to the active sdev.
+ */
+struct scsi_target {
+	struct scsi_device *starget_sdev_user;
+	unsigned int starget_refcnt;
+};
+
+/*
  *  The scsi_device struct contains what we know about each given scsi
  *  device.
  *
@@ -554,8 +565,10 @@
 	struct Scsi_Host *host;
 	request_queue_t *request_queue;
 	volatile unsigned short device_busy;	/* commands actually active on low-level */
+	spinlock_t sdev_lock;           /* also the request queue_lock */
 	spinlock_t list_lock;
 	struct list_head cmd_list;	/* queue of in use SCSI Command structures */
+	struct list_head starved_entry;
         Scsi_Cmnd *current_cmnd;	/* currently active command */
 	unsigned short queue_depth;	/* How deep of a queue we want */
 	unsigned short last_queue_full_depth; /* These two are used by */
@@ -586,6 +599,7 @@
 	unsigned char current_tag;	/* current tag */
 //	unsigned char sync_min_period;	/* Not less than this period */
 //	unsigned char sync_max_offset;	/* Not greater than this offset */
+	struct scsi_target      *sdev_target;   /* used only for single_lun */
 
 	unsigned online:1;
 	unsigned writeable:1;
@@ -616,8 +630,6 @@
 					 * because we did a bus reset. */
 	unsigned ten:1;		/* support ten byte read / write */
 	unsigned remap:1;	/* support remapping  */
-	unsigned starved:1;	/* unable to process commands because
-				   host busy */
 //	unsigned sync:1;	/* Sync transfer state, managed by host */
 //	unsigned wide:1;	/* WIDE transfer state, managed by host */
 
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi_error.c linux-2.5.67-bk6/drivers/scsi/scsi_error.c
--- linux-2.5.67-bk5/drivers/scsi/scsi_error.c	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi_error.c	2003-04-15 04:36:16.000000000 -0700
@@ -431,8 +431,6 @@
 	unsigned long flags;
 	int rtn = SUCCESS;
 
-	ASSERT_LOCK(host->host_lock, 0);
-
 	/*
 	 * we will use a queued command if possible, otherwise we will
 	 * emulate the queuing and calling of completion function ourselves.
@@ -1405,8 +1403,6 @@
 	struct scsi_device *sdev;
 	unsigned long flags;
 
-	ASSERT_LOCK(shost->host_lock, 0);
-
 	/*
 	 * If the door was locked, we need to insert a door lock request
 	 * onto the head of the SCSI request queue for the device.  There
@@ -1434,18 +1430,11 @@
 	 * now that error recovery is done, we will need to ensure that these
 	 * requests are started.
 	 */
-	spin_lock_irqsave(shost->host_lock, flags);
 	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		if ((shost->can_queue > 0 &&
-		     (shost->host_busy >= shost->can_queue))
-		    || (shost->host_blocked)
-		    || (shost->host_self_blocked)) {
-			break;
-		}
-
+		spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
 		__blk_run_queue(sdev->request_queue);
+		spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
 	}
-	spin_unlock_irqrestore(shost->host_lock, flags);
 }
 
 /**
@@ -1681,6 +1670,7 @@
 	struct scsi_cmnd *scmd = scsi_get_command(dev, GFP_KERNEL);
 	struct request req;
 	int rtn;
+	struct request_queue *q;
 
 	scmd->request = &req;
 	memset(&scmd->eh_timeout, 0, sizeof(scmd->eh_timeout));
@@ -1735,6 +1725,8 @@
 	}
 
 	scsi_delete_timer(scmd);
+	q = scmd->device->request_queue;
 	scsi_put_command(scmd);
+	scsi_queue_next_request(q, NULL);
 	return rtn;
 }
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi_lib.c linux-2.5.67-bk6/drivers/scsi/scsi_lib.c
--- linux-2.5.67-bk5/drivers/scsi/scsi_lib.c	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi_lib.c	2003-04-15 04:36:16.000000000 -0700
@@ -92,6 +92,7 @@
 {
 	struct Scsi_Host *host = cmd->device->host;
 	struct scsi_device *device = cmd->device;
+	unsigned long flags;
 
 	SCSI_LOG_MLQUEUE(1,
 		 printk("Inserting command %p into mlqueue\n", cmd));
@@ -130,6 +131,9 @@
 	 * Decrement the counters, since these commands are no longer
 	 * active on the host/device.
 	 */
+	spin_lock_irqsave(device->request_queue->queue_lock, flags);
+	device->device_busy--;
+	spin_unlock_irqrestore(device->request_queue->queue_lock, flags);
 	scsi_host_busy_dec_and_test(host, device);
 
 	/*
@@ -174,14 +178,18 @@
 		 void (*done)(struct scsi_cmnd *),
 		 int timeout, int retries)
 {
+	struct request_queue *q;
+
 	/*
 	 * If the upper level driver is reusing these things, then
 	 * we should release the low-level block now.  Another one will
 	 * be allocated later when this request is getting queued.
 	 */
 	if (sreq->sr_command) {
+		q = sreq->sr_command->device->request_queue;
 		scsi_put_command(sreq->sr_command);
 		sreq->sr_command = NULL;
+		scsi_queue_next_request(q, NULL);
 	}
 
 	/*
@@ -228,6 +236,7 @@
 void scsi_wait_req(struct scsi_request *sreq, const void *cmnd, void *buffer,
 		   unsigned bufflen, int timeout, int retries)
 {
+	struct request_queue *q;
 	DECLARE_COMPLETION(wait);
 	
 	sreq->sr_request->waiting = &wait;
@@ -239,7 +248,9 @@
 	sreq->sr_request->waiting = NULL;
 
 	if (sreq->sr_command) {
+		q = sreq->sr_command->device->request_queue;
 		scsi_put_command(sreq->sr_command);
+		scsi_queue_next_request(q, NULL);
 		sreq->sr_command = NULL;
 	}
 }
@@ -316,6 +327,53 @@
 }
 
 /*
+ * Called for single_lun devices on IO completion. Clear starget_sdev_user,
+ * and call __blk_run_queue for all the scsi_devices on the target -
+ * including current_sdev first.
+ *
+ * Called with *no* scsi locks held.
+ */
+static void scsi_single_lun_run(struct scsi_device *current_sdev)
+{
+	struct scsi_device *sdev;
+	unsigned long flags, flags2;
+
+	spin_lock_irqsave(current_sdev->host->host_lock, flags);
+	WARN_ON(!current_sdev->sdev_target->starget_sdev_user);
+	current_sdev->sdev_target->starget_sdev_user = NULL;
+	spin_unlock_irqrestore(current_sdev->host->host_lock, flags);
+
+	/*
+	 * Call __blk_run_queue for all LUNs on the target, starting with
+	 * current_sdev. We race with others (to set starget_sdev_user),
+	 * but in most cases, we will be first. Ideally, each LU on the
+	 * target would get some limited time or requests on the target.
+	 */
+	spin_lock_irqsave(current_sdev->request_queue->queue_lock, flags2);
+	__blk_run_queue(current_sdev->request_queue);
+	spin_unlock_irqrestore(current_sdev->request_queue->queue_lock, flags2);
+
+	spin_lock_irqsave(current_sdev->host->host_lock, flags);
+	if (current_sdev->sdev_target->starget_sdev_user) {
+		/*
+		 * After unlock, this races with anyone clearing
+		 * starget_sdev_user, but we (should) always enter this
+		 * function again, avoiding any problems.
+		 */
+		spin_unlock_irqrestore(current_sdev->host->host_lock, flags);
+		return;
+	}
+	spin_unlock_irqrestore(current_sdev->host->host_lock, flags);
+
+	list_for_each_entry(sdev, &current_sdev->same_target_siblings,
+			    same_target_siblings) {
+		spin_lock_irqsave(sdev->request_queue->queue_lock, flags2);
+		__blk_run_queue(sdev->request_queue);
+		spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags2);
+	}
+}
+
+/*
  * Function:    scsi_queue_next_request()
  *
  * Purpose:     Handle post-processing of completed commands.
@@ -351,16 +409,12 @@
  *		permutations grows as 2**N, and if too many more special cases
  *		get added, we start to get screwed.
  */
-static void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd)
+void scsi_queue_next_request(request_queue_t *q, struct scsi_cmnd *cmd)
 {
-	struct scsi_device *sdev, *sdev2;
+	struct scsi_device *sdev;
 	struct Scsi_Host *shost;
 	unsigned long flags;
-	int all_clear;
 
-	ASSERT_LOCK(q->queue_lock, 0);
-
-	spin_lock_irqsave(q->queue_lock, flags);
 	if (cmd != NULL) {
 
 		/*
@@ -369,6 +423,7 @@
 		 * in which case we need to request the blocks that come after
 		 * the bad sector.
 		 */
+		spin_lock_irqsave(q->queue_lock, flags);
 		cmd->request->special = cmd;
 		if (blk_rq_tagged(cmd->request))
 			blk_queue_end_tag(q, cmd->request);
@@ -381,62 +436,52 @@
 		cmd->request->flags |= REQ_SPECIAL;
 		cmd->request->flags &= ~REQ_DONTPREP;
 		__elv_add_request(q, cmd->request, 0, 0);
+		spin_unlock_irqrestore(q->queue_lock, flags);
 	}
 
-	/*
-	 * Just hit the requeue function for the queue.
-	 */
-	__blk_run_queue(q);
-
 	sdev = q->queuedata;
-	shost = sdev->host;
 
-	/*
-	 * If this is a single-lun device, and we are currently finished
-	 * with this device, then see if we need to get another device
-	 * started.  FIXME(eric) - if this function gets too cluttered
-	 * with special case code, then spin off separate versions and
-	 * use function pointers to pick the right one.
-	 */
-	if (sdev->single_lun && sdev->device_busy == 0 &&
-	    !shost->host_blocked && !shost->host_self_blocked &&
-	    !((shost->can_queue > 0) && (shost->host_busy >= shost->can_queue))
-	    && elv_queue_empty(q)) {
-		list_for_each_entry(sdev2, &sdev->same_target_siblings,
-			       same_target_siblings) {
-			if (!sdev2->device_blocked &&
-			    !elv_queue_empty(sdev2->request_queue)) {
-				__blk_run_queue(sdev2->request_queue);
-				break;
-			}
-		}
-	}
+	if (sdev->single_lun)
+		scsi_single_lun_run(sdev);
 
-	/*
-	 * Now see whether there are other devices on the bus which
-	 * might be starved.  If so, hit the request function.  If we
-	 * don't find any, then it is safe to reset the flag.  If we
-	 * find any device that it is starved, it isn't safe to reset the
-	 * flag as the queue function releases the lock and thus some
-	 * other device might have become starved along the way.
-	 */
-	all_clear = 1;
-	if (shost->some_device_starved) {
-		list_for_each_entry(sdev, &shost->my_devices, siblings) {
-			if (shost->can_queue > 0 &&
-			    shost->host_busy >= shost->can_queue)
-				break;
-			if (shost->host_blocked || shost->host_self_blocked)
-				break;
-			if (sdev->device_blocked || !sdev->starved)
-				continue;
-			__blk_run_queue(sdev->request_queue);
-			all_clear = 0;
-		}
+	shost = sdev->host;
+	spin_lock_irqsave(shost->host_lock, flags);
+	while (!list_empty(&shost->starved_list) &&
+	       !shost->host_blocked && !shost->host_self_blocked &&
+		!((shost->can_queue > 0) &&
+		  (shost->host_busy >= shost->can_queue))) {
+		/*
+		 * As long as shost is accepting commands and we have
+		 * starved queues, call __blk_run_queue. scsi_request_fn
+		 * drops the queue_lock and can add us back to the
+		 * starved_list.
+		 *
+		 * host_lock protects the starved_list and starved_entry.
+		 * scsi_request_fn must get the host_lock before checking
+		 * or modifying starved_list or starved_entry.
+		 */
+		sdev = list_entry(shost->starved_list.next,
+					  struct scsi_device, starved_entry);
+		list_del_init(&sdev->starved_entry);
+		spin_unlock_irqrestore(shost->host_lock, flags);
+
+		spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
+		__blk_run_queue(sdev->request_queue);
+		spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
 
-		if (sdev == NULL && all_clear)
-			shost->some_device_starved = 0;
+		spin_lock_irqsave(shost->host_lock, flags);
+		if (unlikely(!list_empty(&sdev->starved_entry)))
+			/*
+			 * sdev lost a race, and was put back on the
+			 * starved list. This is unlikely but without this
+			 * in theory we could loop forever.
+			 */
+			break;
 	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
+	spin_lock_irqsave(q->queue_lock, flags);
+	__blk_run_queue(q);
 	spin_unlock_irqrestore(q->queue_lock, flags);
 }
 
@@ -470,8 +515,6 @@
 	struct request *req = cmd->request;
 	unsigned long flags;
 
-	ASSERT_LOCK(q->queue_lock, 0);
-
 	/*
 	 * If there are blocks left over at the end, set up the command
 	 * to queue the remainder of them.
@@ -569,8 +612,6 @@
 {
 	struct request *req = cmd->request;
 
-	ASSERT_LOCK(cmd->device->host->host_lock, 0);
-
 	/*
 	 * Free up any indirection buffers we allocated for DMA purposes. 
 	 */
@@ -651,8 +692,6 @@
 	 *	would be used if we just wanted to retry, for example.
 	 *
 	 */
-	ASSERT_LOCK(q->queue_lock, 0);
-
 	/*
 	 * Free up any indirection buffers we allocated for DMA purposes. 
 	 * For the case of a READ, we need to copy the data out of the
@@ -923,22 +962,6 @@
 	return BLKPREP_KILL;
 }
 
-/*
- * The target associated with myself can only handle one active command at
- * a time. Scan through all of the luns on the same target as myself,
- * return 1 if any are active.
- */
-static int check_all_luns(struct scsi_device *myself)
-{
-	struct scsi_device *sdev;
-
-	list_for_each_entry(sdev, &myself->same_target_siblings,
-			    same_target_siblings)
-		if (sdev->device_busy)
-			return 1;
-	return 0;
-}
-
 static int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
 	struct Scsi_Device_Template *sdt;
@@ -961,7 +984,7 @@
 		if (sreq->sr_magic == SCSI_REQ_MAGIC) {
 			cmd = scsi_get_command(sreq->sr_device, GFP_ATOMIC);
 			if (unlikely(!cmd))
-				return BLKPREP_DEFER;
+				goto defer;
 			scsi_init_cmd_from_req(cmd, sreq);
 		} else
 			cmd = req->special;
@@ -972,7 +995,7 @@
 		if (!req->special) {
 			cmd = scsi_get_command(sdev, GFP_ATOMIC);
 			if (unlikely(!cmd))
-				return BLKPREP_DEFER;
+				goto defer;
 		} else
 			cmd = req->special;
 		
@@ -1037,6 +1060,82 @@
 	 */
 	req->flags |= REQ_DONTPREP;
 	return BLKPREP_OK;
+
+ defer:
+	/* If we defer, the elv_next_request() returns NULL, but the
+	 * queue must be restarted, so we plug here if no returning
+	 * command will automatically do that. */
+	if (sdev->device_busy == 0)
+		blk_plug_device(q);
+	return BLKPREP_DEFER;
+}
+
+/*
+ * scsi_dev_queue_ready: if we can send requests to sdev, return 1 else
+ * return 0.
+ *
+ * Called with the queue_lock held.
+ */
+static inline int scsi_dev_queue_ready(struct request_queue *q,
+				  struct scsi_device *sdev)
+{
+	if (sdev->device_busy >= sdev->queue_depth)
+		return 0;
+	if (sdev->device_busy == 0 && sdev->device_blocked) {
+		/*
+		 * unblock after device_blocked iterates to zero
+		 */
+		if (--sdev->device_blocked == 0) {
+			SCSI_LOG_MLQUEUE(3,
+				printk("scsi%d (%d:%d) unblocking device at"
+				       " zero depth\n", sdev->host->host_no,
+				       sdev->id, sdev->lun));
+		} else {
+			blk_plug_device(q);
+			return 0;
+		}
+	}
+	if (sdev->device_blocked)
+		return 0;
+
+	return 1;
+}
+
+/*
+ * scsi_host_queue_ready: if we can send requests to shost, return 1 else
+ * return 0. We must end up running the queue again whenever 0 is
+ * returned, else IO can hang.
+ *
+ * Called with host_lock held.
+ */
+static inline int scsi_host_queue_ready(struct request_queue *q,
+				   struct Scsi_Host *shost,
+				   struct scsi_device *sdev)
+{
+	if (shost->in_recovery)
+		return 0;
+	if (shost->host_busy == 0 && shost->host_blocked) {
+		/*
+		 * unblock after host_blocked iterates to zero
+		 */
+		if (--shost->host_blocked == 0) {
+			SCSI_LOG_MLQUEUE(3,
+				printk("scsi%d unblocking host at zero depth\n",
+					shost->host_no));
+		} else {
+			blk_plug_device(q);
+			return 0;
+		}
+	}
+	if (!list_empty(&sdev->starved_entry))
+		return 0;
+	if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) ||
+	    shost->host_blocked || shost->host_self_blocked) {
+		list_add_tail(&sdev->starved_entry, &shost->starved_list);
+		return 0;
+	}
+
+	return 1;
 }
 
 /*
@@ -1056,92 +1155,53 @@
 	struct Scsi_Host *shost = sdev->host;
 	struct scsi_cmnd *cmd;
 	struct request *req;
-
-	ASSERT_LOCK(q->queue_lock, 1);
+	unsigned long flags;
 
 	/*
 	 * To start with, we keep looping until the queue is empty, or until
 	 * the host is no longer able to accept any more requests.
 	 */
 	for (;;) {
+		if (blk_queue_plugged(q))
+			goto completed;
+
 		/*
-		 * Check this again - each time we loop through we will have
-		 * released the lock and grabbed it again, so each time
-		 * we need to check to see if the queue is plugged or not.
+		 * get next queueable request.  We do this early to make sure
+		 * that the request is fully prepared even if we cannot 
+		 * accept it.
 		 */
-		if (shost->in_recovery || blk_queue_plugged(q))
-			return;
+		req = elv_next_request(q);
 
-		if (sdev->device_busy >= sdev->queue_depth)
-			break;
+		if (!req)
+			goto completed;
 
-		if (sdev->single_lun && check_all_luns(sdev))
-			break;
-
-		if (shost->host_busy == 0 && shost->host_blocked) {
-			/* unblock after host_blocked iterates to zero */
-			if (--shost->host_blocked == 0) {
-				SCSI_LOG_MLQUEUE(3,
-					printk("scsi%d unblocking host at zero depth\n",
-						shost->host_no));
-			} else {
-				blk_plug_device(q);
-				break;
-			}
-		}
-
-		if (sdev->device_busy == 0 && sdev->device_blocked) {
-			/* unblock after device_blocked iterates to zero */
-			if (--sdev->device_blocked == 0) {
-				SCSI_LOG_MLQUEUE(3,
-					printk("scsi%d (%d:%d) unblocking device at zero depth\n",
-						shost->host_no, sdev->id, sdev->lun));
-			} else {
-				blk_plug_device(q);
-				break;
-			}
-		}
+		if (!scsi_dev_queue_ready(q, sdev))
+			goto completed;
 
 		/*
-		 * If the device cannot accept another request, then quit.
+		 * Remove the request from the request list.
 		 */
-		if (sdev->device_blocked)
-			break;
-		if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) ||
-		    shost->host_blocked || shost->host_self_blocked) {
-			/*
-			 * If we are unable to process any commands at all for
-			 * this device, then we consider it to be starved.
-			 * What this means is that there are no outstanding
-			 * commands for this device and hence we need a
-			 * little help getting it started again
-			 * once the host isn't quite so busy.
-			 */
-			if (sdev->device_busy == 0) {
-				sdev->starved = 1;
-				shost->some_device_starved = 1;
-			}
-			break;
-		} else
-			sdev->starved = 0;
+		if (!(blk_queue_tagged(q) && (blk_queue_start_tag(q, req) == 0)))
+			blkdev_dequeue_request(req);
 
-		/*
-		 * get next queueable request.  We do this early to make sure
-		 * that the request is fully prepared even if we cannot 
-		 * accept it.  If there is no request, we'll detect this
-		 * lower down.
-		 */
-		req = elv_next_request(q);
+		sdev->device_busy++;
+		spin_unlock_irq(q->queue_lock);
 
-		if (!req) {
-			/* If the device is busy, a returning I/O
-			 * will restart the queue.  Otherwise, we have
-			 * to plug the queue */
-			if(sdev->device_busy == 0)
-				blk_plug_device(q);
-			break;
+		spin_lock_irqsave(shost->host_lock, flags);
+		if (!scsi_host_queue_ready(q, shost, sdev))
+			goto host_lock_held;
+
+		if (sdev->single_lun) {
+			if (sdev->sdev_target->starget_sdev_user &&
+			    (sdev->sdev_target->starget_sdev_user != sdev))
+				goto host_lock_held;
+			else
+				sdev->sdev_target->starget_sdev_user = sdev;
 		}
 
+		shost->host_busy++;
+		spin_unlock_irqrestore(shost->host_lock, flags);
+
 		cmd = req->special;
 
 		/*
@@ -1151,25 +1211,6 @@
 		BUG_ON(!cmd);
 
 		/*
-		 * Finally, before we release the lock, we copy the
-		 * request to the command block, and remove the
-		 * request from the request list.  Note that we always
-		 * operate on the queue head - there is absolutely no
-		 * reason to search the list, because all of the
-		 * commands in this queue are for the same device.
-		 */
-		if (!(blk_queue_tagged(q) && (blk_queue_start_tag(q, req) == 0)))
-			blkdev_dequeue_request(req);
-	
-		/*
-		 * Now bump the usage count for both the host and the
-		 * device.
-		 */
-		shost->host_busy++;
-		sdev->device_busy++;
-		spin_unlock_irq(q->queue_lock);
-
-		/*
 		 * Finally, initialize any error handling parameters, and set up
 		 * the timers for timeouts.
 		 */
@@ -1186,6 +1227,24 @@
 		 */
 		spin_lock_irq(q->queue_lock);
 	}
+completed:
+	return;
+
+host_lock_held:
+	spin_unlock_irqrestore(shost->host_lock, flags);
+	/*
+	 * lock q, handle tag, requeue req, and decrement device_busy. We
+	 * must return with queue_lock held.
+	 *
+	 * Decrementing device_busy without checking it is OK, as all such
+	 * cases (host limits or settings) should run the queue at some
+	 * later time.
+	 */
+	spin_lock_irq(q->queue_lock);
+	if (blk_rq_tagged(req))
+		blk_queue_end_tag(q, req);
+	__elv_add_request(q, req, 0, 0);
+	sdev->device_busy--;
 }
 
 u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
@@ -1207,15 +1266,20 @@
 	return BLK_BOUNCE_HIGH;
 }
 
-request_queue_t *scsi_alloc_queue(struct Scsi_Host *shost)
+request_queue_t *scsi_alloc_queue(struct scsi_device *sdev)
 {
 	request_queue_t *q;
+	struct Scsi_Host *shost;
 
 	q = kmalloc(sizeof(*q), GFP_ATOMIC);
 	if (!q)
 		return NULL;
 	memset(q, 0, sizeof(*q));
 
+	/*
+	 * XXX move host code to scsi_register
+	 */
+	shost = sdev->host;
 	if (!shost->max_sectors) {
 		/*
 		 * Driver imposes no hard sector transfer limit.
@@ -1224,7 +1288,7 @@
 		shost->max_sectors = SCSI_DEFAULT_MAX_SECTORS;
 	}
 
-	blk_init_queue(q, scsi_request_fn, shost->host_lock);
+	blk_init_queue(q, scsi_request_fn, &sdev->sdev_lock);
 	blk_queue_prep_rq(q, scsi_prep_fn);
 
 	blk_queue_max_hw_segments(q, shost->sg_tablesize);
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi_scan.c linux-2.5.67-bk6/drivers/scsi/scsi_scan.c
--- linux-2.5.67-bk5/drivers/scsi/scsi_scan.c	2003-04-07 10:32:22.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi_scan.c	2003-04-15 04:36:16.000000000 -0700
@@ -387,7 +387,7 @@
  *     Scsi_Device pointer, or NULL on failure.
  **/
 static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
-	       	struct request_queue **q, uint channel, uint id, uint lun)
+	       	uint channel, uint id, uint lun)
 {
 	struct scsi_device *sdev, *device;
 
@@ -407,6 +407,7 @@
 	INIT_LIST_HEAD(&sdev->siblings);
 	INIT_LIST_HEAD(&sdev->same_target_siblings);
 	INIT_LIST_HEAD(&sdev->cmd_list);
+	INIT_LIST_HEAD(&sdev->starved_entry);
 	spin_lock_init(&sdev->list_lock);
 
 	/*
@@ -421,14 +422,10 @@
 	 */
 	sdev->borken = 1;
 
-	if (!q || *q == NULL) {
-		sdev->request_queue = scsi_alloc_queue(shost);
-		if (!sdev->request_queue)
-			goto out_free_dev;
-	} else {
-		sdev->request_queue = *q;
-		*q = NULL;
-	}
+	spin_lock_init(&sdev->sdev_lock);
+	sdev->request_queue = scsi_alloc_queue(sdev);
+	if (!sdev->request_queue)
+		goto out_free_dev;
 
 	sdev->request_queue->queuedata = sdev;
 	scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
@@ -468,10 +465,7 @@
 	return sdev;
 
 out_free_queue:
-	if (q && sdev->request_queue) {
-		*q = sdev->request_queue;
-		sdev->request_queue = NULL;
-	} else if (sdev->request_queue)
+	if (sdev->request_queue)
 		scsi_free_queue(sdev->request_queue);
 
 out_free_dev:
@@ -491,6 +485,8 @@
  **/
 static void scsi_free_sdev(struct scsi_device *sdev)
 {
+	unsigned long flags;
+
 	list_del(&sdev->siblings);
 	list_del(&sdev->same_target_siblings);
 
@@ -500,6 +496,15 @@
 		sdev->host->hostt->slave_destroy(sdev);
 	if (sdev->inquiry)
 		kfree(sdev->inquiry);
+	spin_lock_irqsave(sdev->host->host_lock, flags);
+	list_del(&sdev->starved_entry);
+	if (sdev->single_lun) {
+		sdev->sdev_target->starget_refcnt--;
+		if (sdev->sdev_target->starget_refcnt == 0)
+			kfree(sdev->sdev_target);
+	}
+	spin_unlock_irqrestore(sdev->host->host_lock, flags);
+
 	kfree(sdev);
 }
 
@@ -1135,6 +1140,10 @@
 static int scsi_add_lun(Scsi_Device *sdev, Scsi_Request *sreq,
 		char *inq_result, int *bflags)
 {
+	struct scsi_device *sdev_sibling;
+	struct scsi_target *starget;
+	unsigned long flags;
+
 	/*
 	 * XXX do not save the inquiry, since it can change underneath us,
 	 * save just vendor/model/rev.
@@ -1256,10 +1265,38 @@
 
 	/*
 	 * If we need to allow I/O to only one of the luns attached to
-	 * this target id at a time, then we set this flag.
+	 * this target id at a time set single_lun, and allocate or modify
+	 * sdev_target.
 	 */
-	if (*bflags & BLIST_SINGLELUN)
+	if (*bflags & BLIST_SINGLELUN) {
 		sdev->single_lun = 1;
+		spin_lock_irqsave(sdev->host->host_lock, flags);
+		starget = NULL;
+		/*
+		 * Search for an existing target for this sdev.
+		 */
+		list_for_each_entry(sdev_sibling, &sdev->same_target_siblings,
+				    same_target_siblings) {
+			if (sdev_sibling->sdev_target != NULL) {
+				starget = sdev_sibling->sdev_target;
+				break;
+			}
+		}
+		if (!starget) {
+			starget = kmalloc(sizeof(*starget), GFP_ATOMIC);
+			if (!starget) {
+				printk(ALLOC_FAILURE_MSG, __FUNCTION__);
+				spin_unlock_irqrestore(sdev->host->host_lock,
+						       flags);
+				return SCSI_SCAN_NO_RESPONSE;
+			}
+			starget->starget_refcnt = 0;
+			starget->starget_sdev_user = NULL;
+		}
+		starget->starget_refcnt++;
+		sdev->sdev_target = starget;
+		spin_unlock_irqrestore(sdev->host->host_lock, flags);
+	}
 
 	/* if the device needs this changing, it may do so in the detect
 	 * function */
@@ -1288,15 +1325,15 @@
  *     SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
  **/
 static int scsi_probe_and_add_lun(struct Scsi_Host *host,
-		struct request_queue **q, uint channel, uint id, uint lun,
-		int *bflagsp, struct scsi_device **sdevp)
+		uint channel, uint id, uint lun, int *bflagsp,
+		struct scsi_device **sdevp)
 {
 	struct scsi_device *sdev;
 	struct scsi_request *sreq;
 	unsigned char *result;
 	int bflags, res = SCSI_SCAN_NO_RESPONSE;
 
-	sdev = scsi_alloc_sdev(host, q, channel, id, lun);
+	sdev = scsi_alloc_sdev(host, channel, id, lun);
 	if (!sdev)
 		goto out;
 	sreq = scsi_allocate_request(sdev);
@@ -1350,13 +1387,8 @@
 	if (res == SCSI_SCAN_LUN_PRESENT) {
 		if (sdevp)
 			*sdevp = sdev;
-	} else {
-		if (q) {
-			*q = sdev->request_queue;
-			sdev->request_queue = NULL;
-		}
+	} else
 		scsi_free_sdev(sdev);
-	}
  out:
 	return res;
 }
@@ -1374,9 +1406,8 @@
  *
  *     Modifies sdevscan->lun.
  **/
-static void scsi_sequential_lun_scan(struct Scsi_Host *shost,
-	       	struct request_queue **q, uint channel, uint id,
-	       	int bflags, int lun0_res, int scsi_level)
+static void scsi_sequential_lun_scan(struct Scsi_Host *shost, uint channel,
+		uint id, int bflags, int lun0_res, int scsi_level)
 {
 	unsigned int sparse_lun, lun, max_dev_lun;
 
@@ -1444,7 +1475,7 @@
 	 * sparse_lun.
 	 */
 	for (lun = 1; lun < max_dev_lun; ++lun)
-		if ((scsi_probe_and_add_lun(shost, q, channel, id, lun,
+		if ((scsi_probe_and_add_lun(shost, channel, id, lun,
 		      NULL, NULL) != SCSI_SCAN_LUN_PRESENT) && !sparse_lun)
 			return;
 }
@@ -1497,8 +1528,7 @@
  *     0: scan completed (or no memory, so further scanning is futile)
  *     1: no report lun scan, or not configured
  **/
-static int scsi_report_lun_scan(Scsi_Device *sdev, struct request_queue **q,
-		int bflags)
+static int scsi_report_lun_scan(Scsi_Device *sdev, int bflags)
 {
 #ifdef CONFIG_SCSI_REPORT_LUNS
 
@@ -1659,8 +1689,8 @@
 		} else {
 			int res;
 
-			res = scsi_probe_and_add_lun(sdev->host, q,
-				sdev->channel, sdev->id, lun, NULL, NULL);
+			res = scsi_probe_and_add_lun(sdev->host, sdev->channel,
+				sdev->id, lun, NULL, NULL);
 			if (res == SCSI_SCAN_NO_RESPONSE) {
 				/*
 				 * Got some results, but now none, abort.
@@ -1688,8 +1718,7 @@
 	struct scsi_device *sdev;
 	int error = -ENODEV, res;
 
-	res = scsi_probe_and_add_lun(shost, NULL, channel, id, lun,
-			NULL, &sdev);
+	res = scsi_probe_and_add_lun(shost, channel, id, lun, NULL, &sdev);
 	if (res == SCSI_SCAN_LUN_PRESENT)
 		error = scsi_attach_device(sdev);
 
@@ -1730,8 +1759,8 @@
  *     First try a REPORT LUN scan, if that does not scan the target, do a
  *     sequential scan of LUNs on the target id.
  **/
-static void scsi_scan_target(struct Scsi_Host *shost, struct request_queue **q,
-			     unsigned int channel, unsigned int id)
+static void scsi_scan_target(struct Scsi_Host *shost, unsigned int channel,
+			     unsigned int id)
 {
 	int bflags = 0;
 	int res;
@@ -1747,14 +1776,14 @@
 	 * Scan LUN 0, if there is some response, scan further. Ideally, we
 	 * would not configure LUN 0 until all LUNs are scanned.
 	 */
-	res = scsi_probe_and_add_lun(shost, q, channel, id, 0, &bflags, &sdev);
+	res = scsi_probe_and_add_lun(shost, channel, id, 0, &bflags, &sdev);
 	if (res == SCSI_SCAN_LUN_PRESENT) {
-		if (scsi_report_lun_scan(sdev, q, bflags) != 0)
+		if (scsi_report_lun_scan(sdev, bflags) != 0)
 			/*
 			 * The REPORT LUN did not scan the target,
 			 * do a sequential scan.
 			 */
-			scsi_sequential_lun_scan(shost, q, channel, id, bflags,
+			scsi_sequential_lun_scan(shost, channel, id, bflags,
 				       	res, sdev->scsi_level);
 	} else if (res == SCSI_SCAN_TARGET_PRESENT) {
 		/*
@@ -1763,7 +1792,7 @@
 		 * sequential lun scan with a bflags of SPARSELUN and
 		 * a default scsi level of SCSI_2
 		 */
-		scsi_sequential_lun_scan(shost, q, channel, id, BLIST_SPARSELUN,
+		scsi_sequential_lun_scan(shost, channel, id, BLIST_SPARSELUN,
 				SCSI_SCAN_TARGET_PRESENT, SCSI_2);
 	}
 }
@@ -1778,7 +1807,6 @@
  **/
 void scsi_scan_host(struct Scsi_Host *shost)
 {
-	struct request_queue *q = NULL;
 	uint channel, id, order_id;
 
 	/*
@@ -1803,12 +1831,9 @@
 				order_id = shost->max_id - id - 1;
 			else
 				order_id = id;
-			scsi_scan_target(shost, &q, channel, order_id);
+			scsi_scan_target(shost, channel, order_id);
 		}
 	}
-
-	if (q)
-		scsi_free_queue(q);
 }
 
 void scsi_forget_host(struct Scsi_Host *shost)
@@ -1847,7 +1872,7 @@
 {
 	struct scsi_device *sdev;
 
-	sdev = scsi_alloc_sdev(shost, NULL, 0, shost->this_id, 0);
+	sdev = scsi_alloc_sdev(shost, 0, shost->this_id, 0);
 	if (sdev) {
 		sdev->borken = 0;
 	}
diff -urN linux-2.5.67-bk5/drivers/scsi/scsi_syms.c linux-2.5.67-bk6/drivers/scsi/scsi_syms.c
--- linux-2.5.67-bk5/drivers/scsi/scsi_syms.c	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/scsi_syms.c	2003-04-15 04:36:16.000000000 -0700
@@ -60,6 +60,8 @@
 EXPORT_SYMBOL(scsi_release_request);
 EXPORT_SYMBOL(scsi_wait_req);
 EXPORT_SYMBOL(scsi_do_req);
+EXPORT_SYMBOL(scsi_get_command);
+EXPORT_SYMBOL(scsi_put_command);
 
 EXPORT_SYMBOL(scsi_report_bus_reset);
 EXPORT_SYMBOL(scsi_block_requests);
diff -urN linux-2.5.67-bk5/drivers/scsi/sd.c linux-2.5.67-bk6/drivers/scsi/sd.c
--- linux-2.5.67-bk5/drivers/scsi/sd.c	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/sd.c	2003-04-15 04:36:16.000000000 -0700
@@ -123,7 +123,7 @@
 	case 1 ... 7:
 		return SCSI_DISK1_MAJOR + major_idx - 1;
 	case 8 ... 15:
-		return SCSI_DISK8_MAJOR + major_idx;
+		return SCSI_DISK8_MAJOR + major_idx - 8;
 	default:
 		BUG();
 		return 0;	/* shut up gcc */
diff -urN linux-2.5.67-bk5/drivers/scsi/st.c linux-2.5.67-bk6/drivers/scsi/st.c
--- linux-2.5.67-bk5/drivers/scsi/st.c	2003-04-07 10:31:55.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/st.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,16 +9,16 @@
    Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky,
    Michael Schaefer, J"org Weule, and Eric Youngdale.
 
-   Copyright 1992 - 2002 Kai Makisara
-   email Kai.Makisara@metla.fi
+   Copyright 1992 - 2003 Kai Makisara
+   email Kai.Makisara@kolumbus.fi
 
-   Last modified: Sat Dec 14 14:25:09 2002 by makisara
+   Last modified: Sun Apr 13 10:17:18 2003 by makisara
    Some small formal changes - aeb, 950809
 
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
  */
 
-static char *verstr = "20021214";
+static char *verstr = "20030413";
 
 #include <linux/module.h>
 
@@ -34,6 +34,7 @@
 #include <linux/fcntl.h>
 #include <linux/spinlock.h>
 #include <linux/blk.h>
+#include <linux/moduleparam.h>
 #include <asm/uaccess.h>
 #include <asm/dma.h>
 #include <asm/system.h>
@@ -65,7 +66,6 @@
 #include "st.h"
 
 static int buffer_kbs;
-static int write_threshold_kbs;
 static int max_sg_segs;
 static int try_direct_io = TRY_DIRECT_IO;
 static int try_rdio = TRUE;
@@ -78,22 +78,25 @@
 MODULE_DESCRIPTION("SCSI Tape Driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(buffer_kbs, "i");
+/* Set 'perm' (4th argument) to 0 to disable module_param's definition
+ * of sysfs parameters (which module_param doesn't yet support).
+ * Sysfs parameters defined explicitly later.
+ */
+module_param_named(buffer_kbs, buffer_kbs, int, 0);
 MODULE_PARM_DESC(buffer_kbs, "Default driver buffer size for fixed block mode (KB; 32)");
-MODULE_PARM(write_threshold_kbs, "i");
-MODULE_PARM_DESC(write_threshold_kbs, "Asynchronous write threshold (KB; 30)");
-MODULE_PARM(max_sg_segs, "i");
+module_param_named(max_sg_segs, max_sg_segs, int, 0);
 MODULE_PARM_DESC(max_sg_segs, "Maximum number of scatter/gather segments to use (256)");
-MODULE_PARM(try_direct_io, "i");
+module_param_named(try_direct_io, try_direct_io, int, 0);
 MODULE_PARM_DESC(try_direct_io, "Try direct I/O between user buffer and tape drive (1)");
 
 /* Extra parameters for testing */
-MODULE_PARM(try_rdio, "i");
+module_param_named(try_rdio, try_rdio, int, 0);
 MODULE_PARM_DESC(try_rdio, "Try direct read i/o when possible");
-MODULE_PARM(try_wdio, "i");
+module_param_named(try_wdio, try_wdio, int, 0);
 MODULE_PARM_DESC(try_wdio, "Try direct write i/o when possible");
 
 #ifndef MODULE
+static int write_threshold_kbs;  /* retained for compatibility */
 static struct st_dev_parm {
 	char *name;
 	int *val;
@@ -101,11 +104,11 @@
 	{
 		"buffer_kbs", &buffer_kbs
 	},
-	{
+	{       /* Retained for compatibility with 2.4 */
 		"write_threshold_kbs", &write_threshold_kbs
 	},
 	{
-		"max_sg_segs", &max_sg_segs
+		"max_sg_segs", NULL
 	},
 	{
 		"try_direct_io", &try_direct_io
@@ -117,7 +120,6 @@
 /* The default definitions have been moved to st_options.h */
 
 #define ST_FIXED_BUFFER_SIZE (ST_FIXED_BUFFER_BLOCKS * ST_KILOBYTE)
-#define ST_WRITE_THRESHOLD (ST_WRITE_THRESHOLD_BLOCKS * ST_KILOBYTE)
 
 /* The buffer size should fit into the 24 bits for length in the
    6-byte SCSI read and write commands. */
@@ -146,7 +148,6 @@
 static rwlock_t st_dev_arr_lock = RW_LOCK_UNLOCKED;
 
 static int st_fixed_buffer_size = ST_FIXED_BUFFER_SIZE;
-static int st_write_threshold = ST_WRITE_THRESHOLD;
 static int st_max_sg_segs = ST_MAX_SG;
 
 static Scsi_Tape **scsi_tapes = NULL;
@@ -158,6 +159,7 @@
 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 void move_buffer_data(ST_buffer *, int);
 static void buf_to_sg(ST_buffer *, unsigned int);
 
 static int st_map_user_pages(struct scatterlist *, const unsigned int, 
@@ -169,6 +171,10 @@
 static int st_attach(Scsi_Device *);
 static void st_detach(Scsi_Device *);
 
+static void do_create_driverfs_files(void);
+static void do_remove_driverfs_files(void);
+
+
 static struct Scsi_Device_Template st_template = {
 	.module =	THIS_MODULE,
 	.list =		LIST_HEAD_INIT(st_template.list),
@@ -1313,7 +1319,7 @@
 	ssize_t total;
 	ssize_t i, do_count, blks, transfer;
 	ssize_t retval;
-	int undone;
+	int undone, retry_eot = 0, scode;
 	int async_write;
 	unsigned char cmd[MAX_COMMAND_SIZE];
 	const char *b_point;
@@ -1416,7 +1422,7 @@
 	STps->rw = ST_WRITING;
 
 	b_point = buf;
-	while (count > 0) {
+	while (count > 0 && !retry_eot) {
 
 		if (STbp->do_dio) {
 			do_count = count;
@@ -1441,12 +1447,8 @@
 		filp->f_pos += do_count;
 		b_point += do_count;
 
-		async_write = !STbp->do_dio &&
+		async_write = STp->block_size == 0 && !STbp->do_dio &&
 			STm->do_async_writes && STps->eof < ST_EOM_OK;
-		if (STp->block_size != 0)
-			async_write &= count == 0 &&
-				(!STm->do_buffer_writes ||
-				 STbp->buffer_bytes >= STp->write_threshold);
 
 		if (STp->block_size != 0 && STm->do_buffer_writes &&
 		    !(STp->try_dio && try_wdio) && STps->eof < ST_EOM_OK &&
@@ -1457,12 +1459,15 @@
 				break;
 		}
 
+	retry_write:
 		if (STp->block_size == 0)
 			blks = transfer = do_count;
 		else {
 			if (!STbp->do_dio)
-				do_count = STbp->buffer_bytes;
-			blks = do_count / STp->block_size;
+				blks = STbp->buffer_bytes;
+			else
+				blks = do_count;
+			blks /= STp->block_size;
 			transfer = blks * STp->block_size;
 		}
 		cmd[2] = blks >> 16;
@@ -1488,15 +1493,15 @@
                         DEBC(printk(ST_DEB_MSG "%s: Error on write:\n", name));
 			if ((SRpnt->sr_sense_buffer[0] & 0x70) == 0x70 &&
 			    (SRpnt->sr_sense_buffer[2] & 0x40)) {
+				scode = SRpnt->sr_sense_buffer[2] & 0x0f;
 				if ((SRpnt->sr_sense_buffer[0] & 0x80) != 0)
 					undone = (SRpnt->sr_sense_buffer[3] << 24) |
 					    (SRpnt->sr_sense_buffer[4] << 16) |
 					    (SRpnt->sr_sense_buffer[5] << 8) |
                                                 SRpnt->sr_sense_buffer[6];
 				else if (STp->block_size == 0 &&
-					 (SRpnt->sr_sense_buffer[2] & 0x0f) ==
-                                         VOLUME_OVERFLOW)
-					undone = do_count;
+					 scode == VOLUME_OVERFLOW)
+					undone = transfer;
 				else
 					undone = 0;
 				if (STp->block_size != 0)
@@ -1504,7 +1509,7 @@
 				filp->f_pos -= undone;
 				if (undone <= do_count) {
 					/* Only data from this write is not written */
-					count -= undone;
+					count += undone;
 					do_count -= undone;
 					if (STp->block_size)
 						blks = (transfer - undone) / STp->block_size;
@@ -1514,21 +1519,40 @@
 					   (retval left to zero)
 					*/
 					if (STp->block_size == 0 ||
-					   undone > 0 || count == 0)
+					    undone > 0 || count == 0)
 						retval = (-ENOSPC); /* EOM within current request */
                                         DEBC(printk(ST_DEB_MSG
                                                        "%s: EOM with %d bytes unwritten.\n",
-						       name, transfer));
+						       name, count));
 				} else {
-					/* Previously buffered data not written */
-					count -= do_count;
-					blks = do_count = 0;
-					STps->eof = ST_EOM_ERROR;
-					STps->drv_block = (-1); /* Too cautious? */
-					retval = (-EIO);	/* EOM for old data */
-					DEBC(printk(ST_DEB_MSG
-                                                       "%s: EOM with lost data.\n",
-                                                       name));
+					/* EOT within data buffered earlier (possible only
+					   in fixed block mode without direct i/o) */
+					if (!retry_eot && (SRpnt->sr_sense_buffer[0] & 1) == 0 &&
+					    (scode == NO_SENSE || scode == RECOVERED_ERROR)) {
+						move_buffer_data(STp->buffer, transfer - undone);
+						retry_eot = TRUE;
+						if (STps->drv_block >= 0) {
+							STps->drv_block += (transfer - undone) /
+								STp->block_size;
+						}
+						STps->eof = ST_EOM_OK;
+						DEBC(printk(ST_DEB_MSG
+							    "%s: Retry write of %d bytes at EOM.\n",
+							    name, STp->buffer->buffer_bytes));
+						goto retry_write;
+					}
+					else {
+						/* Either error within data buffered by driver or
+						   failed retry */
+						count -= do_count;
+						blks = do_count = 0;
+						STps->eof = ST_EOM_ERROR;
+						STps->drv_block = (-1); /* Too cautious? */
+						retval = (-EIO);	/* EOM for old data */
+						DEBC(printk(ST_DEB_MSG
+							    "%s: EOM with lost data.\n",
+							    name));
+					}
 				}
 			} else {
 				filp->f_pos -= do_count;
@@ -1548,7 +1572,7 @@
 		STbp->buffer_bytes = 0;
 		STp->dirty = 0;
 
-		if (retval) {
+		if (retval || retry_eot) {
 			if (count < total)
 				retval = total - count;
 			goto out;
@@ -1557,9 +1581,9 @@
 
 	if (STps->eof == ST_EOD_1)
 		STps->eof = ST_EOM_OK;
-	else
+	else if (STps->eof != ST_EOM_OK)
 		STps->eof = ST_NOEOF;
-	retval = total;
+	retval = total - count;
 
  out:
 	if (SRpnt != NULL)
@@ -1658,9 +1682,14 @@
 
 				if (SRpnt->sr_sense_buffer[2] & 0x20) {	/* ILI */
 					if (STp->block_size == 0) {
-						if (transfer < 0) {
+						if (transfer <= 0) {
+							if (transfer < 0)
+								printk(KERN_NOTICE
+								       "%s: Failed to read %d byte block with %d byte transfer.\n",
+								       name, bytes - transfer, bytes);
 							if (STps->drv_block >= 0)
 								STps->drv_block += 1;
+							STbp->buffer_bytes = 0;
 							return (-ENOMEM);
 						}
 						STbp->buffer_bytes = bytes - transfer;
@@ -1727,6 +1756,9 @@
 				} else	/* Some other extended sense code */
 					retval = (-EIO);
 			}
+
+			if (STbp->buffer_bytes < 0)  /* Caused by bogus sense data */
+				STbp->buffer_bytes = 0;
 		}
 		/* End of extended sense test */ 
 		else {		/* Non-extended sense */
@@ -1986,16 +2018,7 @@
 			debugging = value; )
 		st_log_options(STp, STm, name);
 	} else if (code == MT_ST_WRITE_THRESHOLD) {
-		value = (options & ~MT_ST_OPTIONS) * ST_KILOBYTE;
-		if (value < 1 || value > st_fixed_buffer_size) {
-			printk(KERN_WARNING
-                               "%s: Write threshold %d too small or too large.\n",
-			       name, value);
-			return (-EIO);
-		}
-		STp->write_threshold = value;
-		printk(KERN_INFO "%s: Write threshold set to %d bytes.\n",
-		       name, value);
+		/* Retained for compatibility */
 	} else if (code == MT_ST_DEF_BLKSIZE) {
 		value = (options & ~MT_ST_OPTIONS);
 		if (value == ~MT_ST_OPTIONS) {
@@ -2136,8 +2159,8 @@
 
 
 /* Send the mode page in the tape buffer to the drive. Assumes that the mode data
-   in the buffer is correctly formatted. */
-static int write_mode_page(Scsi_Tape *STp, int page)
+   in the buffer is correctly formatted. The long timeout is used if slow is non-zero. */
+static int write_mode_page(Scsi_Tape *STp, int page, int slow)
 {
 	int pgo;
 	unsigned char cmd[MAX_COMMAND_SIZE];
@@ -2156,7 +2179,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,
-			   STp->timeout, 0, TRUE);
+			   (slow ? STp->long_timeout : STp->timeout), 0, TRUE);
 	if (SRpnt == NULL)
 		return (STp->buffer)->syscall_result;
 
@@ -2223,7 +2246,7 @@
 			b_data[mpoffs + CP_OFF_C_ALGO] = 0; /* no compression */
 	}
 
-	retval = write_mode_page(STp, COMPRESSION_PAGE);
+	retval = write_mode_page(STp, COMPRESSION_PAGE, FALSE);
 	if (retval) {
                 DEBC(printk(ST_DEB_MSG "%s: Compression change failed.\n", name));
 		return (-EIO);
@@ -3022,7 +3045,7 @@
 	bp[pgo + PP_OFF_RESERVED] = 0;
 	bp[pgo + PP_OFF_FLAGS] = PP_BIT_IDP | PP_MSK_PSUM_MB;
 
-	result = write_mode_page(STp, PART_PAGE);
+	result = write_mode_page(STp, PART_PAGE, TRUE);
 	if (result) {
 		printk(KERN_INFO "%s: Partitioning of tape failed.\n", name);
 		result = (-EIO);
@@ -3527,6 +3550,48 @@
 }
 
 
+/* Move data towards start of buffer */
+static void move_buffer_data(ST_buffer * st_bp, int offset)
+{
+	int src_seg, dst_seg, src_offset = 0, dst_offset;
+	int count, total;
+
+	if (offset == 0)
+		return;
+
+	total=st_bp->buffer_bytes - offset;
+	for (src_seg=0; src_seg < st_bp->frp_segs; src_seg++) {
+		src_offset = offset;
+		if (src_offset < st_bp->frp[src_seg].length)
+			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; ) {
+		count = min(st_bp->frp[dst_seg].length - dst_offset,
+			    st_bp->frp[src_seg].length - src_offset);
+		memmove(page_address(st_bp->frp[dst_seg].page) + dst_offset,
+			page_address(st_bp->frp[src_seg].page) + src_offset, count);
+		src_offset += count;
+		if (src_offset >= st_bp->frp[src_seg].length) {
+			src_seg++;
+			src_offset = 0;
+		}
+		dst_offset += count;
+		if (dst_offset >= st_bp->frp[dst_seg].length) {
+			dst_seg++;
+			dst_offset = 0;
+		}
+		total -= count;
+	}
+}
+
+
 /* Fill the s/g list up to the length required for this transfer */
 static void buf_to_sg(ST_buffer *STbp, unsigned int length)
 {
@@ -3559,15 +3624,6 @@
 {
 	if (buffer_kbs > 0)
 		st_fixed_buffer_size = buffer_kbs * ST_KILOBYTE;
-	if (write_threshold_kbs > 0)
-		st_write_threshold = write_threshold_kbs * ST_KILOBYTE;
-	else if (buffer_kbs > 0)
-		st_write_threshold = st_fixed_buffer_size - 2048;
-	if (st_write_threshold > st_fixed_buffer_size) {
-		st_write_threshold = st_fixed_buffer_size;
-		printk(KERN_WARNING "st: write_threshold limited to %d bytes.\n",
-		       st_write_threshold);
-	}
 	if (max_sg_segs >= ST_FIRST_SG)
 		st_max_sg_segs = max_sg_segs;
 }
@@ -3584,15 +3640,20 @@
 
 	if (ints[0] > 0) {
 		for (i = 0; i < ints[0] && i < ARRAY_SIZE(parms); i++)
-			*parms[i].val = ints[i + 1];
+			if (parms[i].val)
+				*parms[i].val = ints[i + 1];
 	} else {
 		while (stp != NULL) {
 			for (i = 0; i < ARRAY_SIZE(parms); i++) {
 				len = strlen(parms[i].name);
 				if (!strncmp(stp, parms[i].name, len) &&
 				    (*(stp + len) == ':' || *(stp + len) == '=')) {
-					*parms[i].val =
-                                                simple_strtoul(stp + len + 1, NULL, 0);
+					if (parms[i].val)
+						*parms[i].val =
+							simple_strtoul(stp + len + 1, NULL, 0);
+					else
+						printk(KERN_WARNING "st: Obsolete parameter %s\n",
+						       parms[i].name);
 					break;
 				}
 			}
@@ -3755,7 +3816,6 @@
 	tpnt->fast_mteom = ST_FAST_MTEOM;
 	tpnt->scsi2_logical = ST_SCSI2LOGICAL;
 	tpnt->immediate = ST_NOWAIT;
-	tpnt->write_threshold = st_write_threshold;
 	tpnt->default_drvbuffer = 0xff;		/* No forced buffering */
 	tpnt->partition = 0;
 	tpnt->new_partition = 0;
@@ -3917,14 +3977,14 @@
 	validate_options();
 
 	printk(KERN_INFO
-		"st: Version %s, fixed bufsize %d, wrt %d, "
-		"s/g segs %d\n",
-		verstr, st_fixed_buffer_size, st_write_threshold,
-		st_max_sg_segs);
+		"st: Version %s, fixed bufsize %d, s/g segs %d\n",
+		verstr, st_fixed_buffer_size, st_max_sg_segs);
 
 	if (register_chrdev(SCSI_TAPE_MAJOR, "st", &st_fops) >= 0) {
-		if (scsi_register_device(&st_template) == 0)
+		if (scsi_register_device(&st_template) == 0) {
+			do_create_driverfs_files();
 			return 0;
+		}
 		unregister_chrdev(SCSI_TAPE_MAJOR, "st");
 	}
 
@@ -3936,6 +3996,7 @@
 {
 	int i;
 
+	do_remove_driverfs_files();
 	scsi_unregister_device(&st_template);
 	unregister_chrdev(SCSI_TAPE_MAJOR, "st");
 	if (scsi_tapes != NULL) {
@@ -3954,6 +4015,52 @@
 module_exit(exit_st);
 
 
+/* The sysfs interface. Read-only at the moment */
+static ssize_t st_try_direct_io_show(struct device_driver *ddp, char *buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", try_direct_io);
+}
+static DRIVER_ATTR(try_direct_io, S_IRUGO, st_try_direct_io_show, NULL);
+
+static ssize_t st_fixed_buffer_size_show(struct device_driver *ddp, char *buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", st_fixed_buffer_size);
+}
+static DRIVER_ATTR(fixed_buffer_size, S_IRUGO, st_fixed_buffer_size_show, NULL);
+
+static ssize_t st_max_sg_segs_show(struct device_driver *ddp, char *buf)
+{
+	return snprintf(buf, PAGE_SIZE, "%d\n", st_max_sg_segs);
+}
+static DRIVER_ATTR(max_sg_segs, S_IRUGO, st_max_sg_segs_show, NULL);
+
+static ssize_t st_version_show(struct device_driver *ddd, char *buf)
+{
+	return snprintf(buf, PAGE_SIZE, "[%s]\n", verstr);
+}
+static DRIVER_ATTR(version, S_IRUGO, st_version_show, NULL);
+
+static void do_create_driverfs_files(void)
+{
+	struct device_driver *driverfs = &st_template.scsi_driverfs_driver;
+
+	driver_create_file(driverfs, &driver_attr_try_direct_io);
+	driver_create_file(driverfs, &driver_attr_fixed_buffer_size);
+	driver_create_file(driverfs, &driver_attr_max_sg_segs);
+	driver_create_file(driverfs, &driver_attr_version);
+}
+
+static void do_remove_driverfs_files(void)
+{
+	struct device_driver *driverfs = &st_template.scsi_driverfs_driver;
+
+	driver_remove_file(driverfs, &driver_attr_version);
+	driver_remove_file(driverfs, &driver_attr_max_sg_segs);
+	driver_remove_file(driverfs, &driver_attr_fixed_buffer_size);
+	driver_remove_file(driverfs, &driver_attr_try_direct_io);
+}
+
+
 /* Pin down user pages and put them into a scatter gather list. Returns <= 0 if
    - mapping of all pages not successful
    - any page is above max_pfn
diff -urN linux-2.5.67-bk5/drivers/scsi/st.h linux-2.5.67-bk6/drivers/scsi/st.h
--- linux-2.5.67-bk5/drivers/scsi/st.h	2003-04-07 10:32:25.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/st.h	2003-04-15 04:36:16.000000000 -0700
@@ -96,7 +96,6 @@
 	unsigned char c_algo;			/* compression algorithm */
 	unsigned char pos_unknown;			/* after reset position unknown */
 	int tape_type;
-	int write_threshold;
 	int timeout;		/* timeout for normal commands */
 	int long_timeout;	/* timeout for commands known to take long time */
 
diff -urN linux-2.5.67-bk5/drivers/scsi/st_options.h linux-2.5.67-bk6/drivers/scsi/st_options.h
--- linux-2.5.67-bk5/drivers/scsi/st_options.h	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/st_options.h	2003-04-15 04:36:16.000000000 -0700
@@ -1,9 +1,9 @@
 /*
    The compile-time configurable defaults for the Linux SCSI tape driver.
 
-   Copyright 1995-2002 Kai Makisara.
+   Copyright 1995-2003 Kai Makisara.
 
-   Last modified: Fri Jul 26 15:54:31 2002 by makisara
+   Last modified: Mon Apr  7 22:49:18 2003 by makisara
 */
 
 #ifndef _ST_OPTIONS_H
@@ -39,11 +39,6 @@
    Must be non-zero. */
 #define ST_FIXED_BUFFER_BLOCKS 32
 
-/* The number of kilobytes of data in the buffer that triggers an
-   asynchronous write in fixed block mode. See also ST_ASYNC_WRITES
-   below. */
-#define ST_WRITE_THRESHOLD_BLOCKS 30
-
 /* Maximum number of scatter/gather segments */
 #define ST_MAX_SG      256
 
diff -urN linux-2.5.67-bk5/drivers/scsi/sym53c8xx.c linux-2.5.67-bk6/drivers/scsi/sym53c8xx.c
--- linux-2.5.67-bk5/drivers/scsi/sym53c8xx.c	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/drivers/scsi/sym53c8xx.c	2003-04-15 04:36:16.000000000 -0700
@@ -13230,9 +13230,9 @@
 		return -1;
 	}
 
-#ifdef __powerpc__
+#if defined(__powerpc__) || defined(__hppa__)
 	/*
-	**	Fix-up for power/pc.
+	**	Fix-up for power/pc and hppa.
 	**	Should not be performed by the driver.
 	*/
 	if ((command & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY))
diff -urN linux-2.5.67-bk5/drivers/video/aty/aty128fb.c linux-2.5.67-bk6/drivers/video/aty/aty128fb.c
--- linux-2.5.67-bk5/drivers/video/aty/aty128fb.c	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/aty/aty128fb.c	2003-04-15 04:36:16.000000000 -0700
@@ -62,7 +62,7 @@
 #ifdef CONFIG_ALL_PPC
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
-#include "macmodes.h"
+#include "../macmodes.h"
 #endif
 
 #ifdef CONFIG_ADB_PMU
@@ -1994,23 +1994,21 @@
 
 	if (regno < 16) {
 		int i;
+		u32 *pal = info->pseudo_palette;
+
 		switch (par->crtc.depth) {
 		case 15:
-			((u16 *) (info->pseudo_palette))[regno] =
-			    (regno << 10) | (regno << 5) | regno;
+			pal[regno] = (regno << 10) | (regno << 5) | regno;
 			break;
 		case 16:
-			((u16 *) (info->pseudo_palette))[regno] =
-			    (regno << 11) | (regno << 6) | regno;
+			pal[regno] = (regno << 11) | (regno << 6) | regno;
 			break;
 		case 24:
-			((u32 *) (info->pseudo_palette))[regno] =
-			    (regno << 16) | (regno << 8) | regno;
+			pal[regno] = (regno << 16) | (regno << 8) | regno;
 			break;
 		case 32:
 			i = (regno << 8) | regno;
-			((u32 *) (info->pseudo_palette))[regno] =
-			    (i << 16) | i;
+			pal[regno] = (i << 16) | i;
 			break;
 		}
 	}
diff -urN linux-2.5.67-bk5/drivers/video/aty/atyfb_base.c linux-2.5.67-bk6/drivers/video/aty/atyfb_base.c
--- linux-2.5.67-bk5/drivers/video/aty/atyfb_base.c	2003-04-07 10:32:15.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/aty/atyfb_base.c	2003-04-15 04:36:16.000000000 -0700
@@ -2278,15 +2278,25 @@
 			return -ENOMEM;
 		}
 		memset(info, 0, sizeof(struct fb_info));
-		info->fix = atyfb_fix;		
+
+		default_par = kmalloc(sizeof(struct atyfb_par), GFP_ATOMIC);
+		if (!default_par) {
+			printk
+			    ("atyfb_init: can't alloc atyfb_par\n");
+			kfree(info);
+			return -ENXIO;
+		}
+		memset(default_par, 0, sizeof(struct atyfb_par));
+
+		info->fix = atyfb_fix;
 
 		/*
 		 *  Map the video memory (physical address given) to somewhere in the
 		 *  kernel address space.
 		 */
-		info->screen_base = (unsigned long)ioremap(phys_vmembase[m64_num],
+		info->screen_base = ioremap(phys_vmembase[m64_num],
 					 		   phys_size[m64_num]);	
-		info->fix.smem_start = info->screen_base;	/* Fake! */
+		info->fix.smem_start = (unsigned long)info->screen_base;	/* Fake! */
 		default_par->ati_regbase = (unsigned long)ioremap(phys_guiregbase[m64_num],
 							  0x10000) + 0xFC00ul;
 		info->fix.mmio_start = default_par->ati_regbase; /* Fake! */
diff -urN linux-2.5.67-bk5/drivers/video/cfbimgblt.c linux-2.5.67-bk6/drivers/video/cfbimgblt.c
--- linux-2.5.67-bk5/drivers/video/cfbimgblt.c	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/cfbimgblt.c	2003-04-15 04:36:16.000000000 -0700
@@ -329,7 +329,7 @@
 	if (p->fbops->fb_sync)
 		p->fbops->fb_sync(p);
 
-	if (image->depth == 0) {
+	if (image->depth == 1) {
 		if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
 		    p->fix.visual == FB_VISUAL_DIRECTCOLOR) {
 			fgcolor = ((u32*)(p->pseudo_palette))[image->fg_color];
@@ -346,7 +346,7 @@
 		else 
 			slow_imageblit(image, p, dst1, fgcolor, bgcolor,
 					start_index, pitch_index);
-	} else if (image->depth == bpp) 
+	} else if (image->depth <= bpp) 
 		color_imageblit(image, p, dst1, start_index, pitch_index);
 }
 
diff -urN linux-2.5.67-bk5/drivers/video/clps711xfb.c linux-2.5.67-bk6/drivers/video/clps711xfb.c
--- linux-2.5.67-bk5/drivers/video/clps711xfb.c	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/clps711xfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -342,7 +342,7 @@
 	 * CLPS7110 - no on-board SRAM
 	 * EP7212   - 38400 bytes
 	 */
-	if (size < 38400) {
+	if (size <= 38400) {
 		printk(KERN_INFO "CLPS711xFB: could use on-board SRAM?\n");
 	}
 
diff -urN linux-2.5.67-bk5/drivers/video/console/fbcon.c linux-2.5.67-bk6/drivers/video/console/fbcon.c
--- linux-2.5.67-bk5/drivers/video/console/fbcon.c	2003-04-07 10:32:13.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/console/fbcon.c	2003-04-15 04:36:16.000000000 -0700
@@ -139,8 +139,6 @@
 
 static int vbl_cursor_cnt;
 static int cursor_blink_rate;
-static int cursor_drawn;
-static int cursor_on;
 
 #define divides(a, b)	((!(a) || (b)%(a)) ? 0 : 1)
 
@@ -173,7 +171,6 @@
  */
 static void fbcon_set_display(struct vc_data *vc, int init, int logo);
 static __inline__ int real_y(struct display *p, int ypos);
-static void fb_vbl_handler(int irq, void *dummy, struct pt_regs *fp);
 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);
@@ -194,6 +191,27 @@
 }
 #endif
 
+static void fb_flashcursor(void *private)
+{
+	struct fb_info *info = (struct fb_info *) private;
+
+	/* Test to see if the cursor is erased but still on */
+	if (!info || (info->cursor.rop == ROP_COPY))
+		return;
+	info->cursor.enable ^= 1;
+	info->fbops->fb_cursor(info, &info->cursor);
+}
+
+static void fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp)
+{
+	struct fb_info *info = dev_id;
+
+	if (vbl_cursor_cnt && --vbl_cursor_cnt == 0) {
+		schedule_work(&info->queue);	
+		vbl_cursor_cnt = cursor_blink_rate; 
+	}
+}
+	
 static void cursor_timer_handler(unsigned long dev_addr);
 
 static struct timer_list cursor_timer =
@@ -203,8 +221,8 @@
 {
 	struct fb_info *info = (struct fb_info *) dev_addr;
 	
-	fb_vbl_handler(0, info, NULL);
-	cursor_timer.expires = jiffies + HZ / 50;
+	schedule_work(&info->queue);	
+	cursor_timer.expires = jiffies + HZ / 5;
 	add_timer(&cursor_timer);
 }
 
@@ -290,14 +308,14 @@
 			    const unsigned short *s)
 {
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
-	unsigned int width = (vc->vc_font.width + 7)/8;
+	unsigned int width = (vc->vc_font.width + 7) >> 3;
 	unsigned int cellsize = vc->vc_font.height * width;
 	unsigned int maxcnt = info->pixmap.size/cellsize;
 	unsigned int shift_low = 0, mod = vc->vc_font.width % 8;
 	unsigned int shift_high = 8, size, pitch, cnt, k;
 	unsigned int buf_align = info->pixmap.buf_align - 1;
 	unsigned int scan_align = info->pixmap.scan_align - 1;
-	unsigned int idx = vc->vc_font.width/8;
+	unsigned int idx = vc->vc_font.width >> 3;
 	u8 mask, *src, *dst, *dst0;
 
 	while (count) {
@@ -307,7 +325,7 @@
 			cnt = k = count;
 
 		image->width = vc->vc_font.width * cnt;
-		pitch = (image->width + 7)/8 + scan_align;
+		pitch = ((image->width + 7) >> 3) + scan_align;
 		pitch &= ~scan_align;
 		size = pitch * vc->vc_font.height + buf_align;
 		size &= ~buf_align;
@@ -338,7 +356,7 @@
 			  const unsigned short *s)
 {
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
-	unsigned int width = vc->vc_font.width/8;
+	unsigned int width = vc->vc_font.width >> 3;
 	unsigned int cellsize = vc->vc_font.height * width;
 	unsigned int maxcnt = info->pixmap.size/cellsize;
 	unsigned int scan_align = info->pixmap.scan_align - 1;
@@ -411,7 +429,7 @@
                       int c, int ypos, int xpos)
 {
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
-	unsigned int width = (vc->vc_font.width + 7)/8;
+	unsigned int width = (vc->vc_font.width + 7) >> 3;
 	unsigned int scan_align = info->pixmap.scan_align - 1;
 	unsigned int buf_align = info->pixmap.buf_align - 1;
 	int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
@@ -426,7 +444,7 @@
 	image.height = vc->vc_font.height;
 	image.fg_color = attr_fgcol(fgshift, c);
 	image.bg_color = attr_bgcol(bgshift, c);
-	image.depth = 0;
+	image.depth = 1;
 
 	pitch = width + scan_align;
 	pitch &= ~scan_align;
@@ -457,7 +475,7 @@
 	image.dx = xx * vc->vc_font.width;
 	image.dy = yy * vc->vc_font.height;
 	image.height = vc->vc_font.height;
-	image.depth = 0;
+	image.depth = 1;
 
 	if (!(vc->vc_font.width & 7))
                putcs_aligned(vc, info, &image, count, s);
@@ -501,7 +519,6 @@
  *  Low Level Operations
  */
 /* NOTE: fbcon cannot be __init: it may be called from take_over_console later */
-
 static const char *fbcon_startup(void)
 {
 	const char *display_desc = "frame buffer device";
@@ -559,6 +576,12 @@
 
 	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;
@@ -639,9 +662,12 @@
 	irqres = request_irq(IRQ_VSYNCPULSE, fb_vbl_handler, SA_SHIRQ,
 			     "framebuffer vbl", info);
 #endif
-
-	if (irqres) {
-		cursor_blink_rate = DEFAULT_CURSOR_BLINK_RATE;
+	/* Initialize the work queue. If the driver provides its
+	 * own work queue this means it will use something besides 
+	 * default timer to flash the cursor. */
+	if (!info->queue.func) {
+		INIT_WORK(&info->queue, fb_flashcursor, info);
+		
 		cursor_timer.expires = jiffies + HZ / 50;
 		cursor_timer.data = (unsigned long ) info;
 		add_timer(&cursor_timer);
@@ -956,112 +982,17 @@
 	accel_putcs(vc, info, s, count, real_y(p, ypos), xpos);
 }
 
-void accel_cursor(struct vc_data *vc, struct fb_info *info, struct fb_cursor *cursor,
-		  int yy)
+static void fbcon_cursor(struct vc_data *vc, int mode)
 {
+	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
 	unsigned short charmask = vc->vc_hi_font_mask ? 0x1ff : 0xff;
 	int bgshift = (vc->vc_hi_font_mask) ? 13 : 12;
 	int fgshift = (vc->vc_hi_font_mask) ? 9 : 8;
-	int height, width, size, c;
-	int w, cur_height, i = 0;
-	char *font, *mask, *data;
-	
-	if (cursor->set & FB_CUR_SETCUR)
-		cursor->enable = 1;
-	else
-		cursor->enable = 0;
-
-	cursor->set |= FB_CUR_SETPOS;
-
-	height = info->cursor.image.height;
-	width = info->cursor.image.width;
-
-	if (width != vc->vc_font.width || 
-	    height != vc->vc_font.height) {
-		width = vc->vc_font.width;
-		height = vc->vc_font.height;
-		cursor->set |= FB_CUR_SETSIZE;
-	}	
-
-	size = ((width + 7) >> 3) * height;
-
-	data = kmalloc(size, GFP_KERNEL);
-	mask = kmalloc(size, GFP_KERNEL);
-	
-	if (cursor->set & FB_CUR_SETSIZE) {
-		memset(data, 0xff, size);
-		cursor->set |= FB_CUR_SETSHAPE;
-	}
-
-	c = scr_readw((u16 *) vc->vc_pos);
-
-	if (info->cursor.image.fg_color != attr_fgcol(fgshift, c) ||
-	    info->cursor.image.bg_color != attr_bgcol(bgshift, c)) {
-		cursor->image.fg_color = attr_fgcol(fgshift, c);
-		cursor->image.bg_color = attr_bgcol(bgshift, c);
-		cursor->set |= FB_CUR_SETCMAP;
-	}
-	font = vc->vc_font.data + ((c & charmask) * size);
-	if (font != info->cursor.dest) {
-		cursor->dest = font;
-		cursor->set |= FB_CUR_SETDEST;
-	}
-
-	w = (width + 7) >> 3;
-
-	switch (vc->vc_cursor_type & 0x0f) {
-		case CUR_NONE:
-			cur_height = 0;
-			break;
-		case CUR_UNDERLINE:
-			cur_height = (height < 10) ? 1 : 2;
-			break;
-		case CUR_LOWER_THIRD:
-			cur_height = height/3;
-			break;
-		case CUR_LOWER_HALF:
-			cur_height = height/2;
-			break;
-		case CUR_TWO_THIRDS:
-			cur_height = (height * 2)/3;
-			break;
-		case CUR_BLOCK:
-		default:
-			cur_height = height;
-			break;
-	}
-
-	size = (height - cur_height) * w;
-	while (size--)
-		mask[i++] = 0;
-	size = cur_height * w;
-	while (size--)
-		mask[i++] = 0xff;
-
-	if (!info->cursor.mask ||  (memcmp(mask, info->cursor.mask, w*height)))
-		cursor->set |= FB_CUR_SETSHAPE;
-
-	cursor->image.width = width;
-	cursor->image.height = height;
-	cursor->image.dx = vc->vc_x * width;
-	cursor->image.dy = yy * height;
-	cursor->image.depth = 0;
-	cursor->image.data = data;
-	cursor->mask = mask;
-	cursor->rop = ROP_XOR;
-
-	info->fbops->fb_cursor(info, cursor);
-	kfree(data);
-	kfree(mask);
-}
-	
-static void fbcon_cursor(struct vc_data *vc, int mode)
-{
-	struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
 	struct display *p = &fb_display[vc->vc_num];
+	int w = (vc->vc_font.width + 7) >> 3, c;
+	int y = real_y(p, vc->vc_y);
 	struct fb_cursor cursor;
-	int y = vc->vc_y;
-
+	
 	if (mode & CM_SOFTBACK) {
 		mode &= ~CM_SOFTBACK;
 		if (softback_lines) {
@@ -1073,55 +1004,93 @@
 	} else if (softback_lines)
 		fbcon_set_origin(vc);
 
-	/* Avoid flickering if there's no real change. */
-	if ((mode == CM_ERASE) == !cursor_on)
-		return;
-
-	cursor_on = 0;
+ 	c = scr_readw((u16 *) vc->vc_pos);
 
+	cursor.image.data = vc->vc_font.data + ((c & charmask) * (w * vc->vc_font.height));
+	cursor.set = FB_CUR_SETCUR;
+	cursor.image.depth = 1;
+	
 	switch (mode) {
 	case CM_ERASE:
-		if (cursor_drawn) {
-			cursor.set = 0;
-			accel_cursor(vc, info, &cursor,
-				     real_y(p, y));
+		if (info->cursor.rop == ROP_XOR) {
+			info->cursor.enable = 0;
+			info->cursor.rop = ROP_COPY;
+			info->fbops->fb_cursor(info, &cursor);
 		}	
-		cursor_drawn = 0;
 		break;
 	case CM_MOVE:
 	case CM_DRAW:
-		if (cursor_drawn) {
-			cursor.set = FB_CUR_SETCUR;
-			accel_cursor(vc, info, &cursor, 
-				     real_y(p, y));
-		}	
+		info->cursor.enable = 1;
+		
+		if (info->cursor.image.fg_color != attr_fgcol(fgshift, c) ||
+	    	    info->cursor.image.bg_color != attr_bgcol(bgshift, c)) {
+			cursor.image.fg_color = attr_fgcol(fgshift, c);
+			cursor.image.bg_color = attr_bgcol(bgshift, c);
+			cursor.set |= FB_CUR_SETCMAP;
+		}
+		
+		if ((info->cursor.image.dx != (vc->vc_font.width * vc->vc_x)) ||
+		    (info->cursor.image.dy != (vc->vc_font.height * y))) {
+			cursor.image.dx = vc->vc_font.width * vc->vc_x;
+			cursor.image.dy = vc->vc_font.height * y;
+			cursor.set |= FB_CUR_SETPOS;
+		}
+
+		if (info->cursor.image.height != vc->vc_font.height ||
+		    info->cursor.image.width != vc->vc_font.width) {
+			cursor.image.height = vc->vc_font.height;
+			cursor.image.width = vc->vc_font.width;
+			cursor.set |= FB_CUR_SETSIZE;
+		}
+
+		if ((cursor.set & FB_CUR_SETSIZE) || ((vc->vc_cursor_type & 0x0f) != p->cursor_shape)) {
+			char *mask = kmalloc(w*vc->vc_font.height, GFP_ATOMIC);
+			int cur_height, size, i = 0;
+
+			if (!mask)	return;	
+		
+			if (info->cursor.mask)
+				kfree(info->cursor.mask);
+			info->cursor.mask = mask;
+	
+			p->cursor_shape = vc->vc_cursor_type & 0x0f;
+			cursor.set |= FB_CUR_SETSHAPE;
+
+			switch (vc->vc_cursor_type & 0x0f) {
+			case CUR_NONE:
+				cur_height = 0;
+				break;
+			case CUR_UNDERLINE:
+				cur_height = (vc->vc_font.height < 10) ? 1 : 2;
+				break;
+			case CUR_LOWER_THIRD:
+				cur_height = vc->vc_font.height/3;
+				break;
+			case CUR_LOWER_HALF:
+				cur_height = vc->vc_font.height >> 1;
+				break;
+			case CUR_TWO_THIRDS:
+				cur_height = (vc->vc_font.height << 1)/3;
+				break;
+			case CUR_BLOCK:
+			default:
+				cur_height = vc->vc_font.height;
+				break;
+			}
+			size = (vc->vc_font.height - cur_height) * w;
+			while (size--)
+				mask[i++] = 0;
+			size = cur_height * w;
+			while (size--)
+				mask[i++] = 0xff;
+		}
+        	info->cursor.rop = ROP_XOR;
+		info->fbops->fb_cursor(info, &cursor);
 		vbl_cursor_cnt = CURSOR_DRAW_DELAY;
-		cursor_on = 1;
 		break;
 	}
 }
 
-static void fb_vbl_handler(int irq, void *dev_id, struct pt_regs *fp)
-{
-	struct fb_info *info = dev_id;
-	struct display *p = &fb_display[fg_console];
-	struct vc_data *vc = vc_cons[fg_console].d;
-	struct fb_cursor cursor;
-	
-	if (!cursor_on)
-		return;
-
-	if (vbl_cursor_cnt && --vbl_cursor_cnt == 0) {
-		cursor.set = 0;
-
-		if (!cursor_drawn)
-			cursor.set = FB_CUR_SETCUR;
-		accel_cursor(vc, info, &cursor, real_y(p, vc->vc_y));
-		cursor_drawn ^= 1;
-		vbl_cursor_cnt = cursor_blink_rate; 
-	}
-}	
-	
 static int scrollback_phys_max = 0;
 static int scrollback_max = 0;
 static int scrollback_current = 0;
@@ -1129,7 +1098,7 @@
 int update_var(int con, struct fb_info *info)
 {
 	if (con == info->currcon) 
-		return fb_pan_display(&info->var, info);
+		return fb_pan_display(info, &info->var);
 	return 0;
 }
 
@@ -1632,16 +1601,16 @@
 	if (x_diff < 0 || x_diff > fw ||
 	   (y_diff < 0 || y_diff > fh)) {
 		var.activate = FB_ACTIVATE_TEST;
-		err = fb_set_var(&var, info);
+		err = fb_set_var(info, &var);
 		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(&var, info);
+		fb_set_var(info, &var);
 	}
 	p->vrows = var.yres_virtual/fh;
-	if(var.yres > (fh * (height + 1)))
+	if (var.yres > (fh * (height + 1)))
 		p->vrows -= (var.yres - (fh * height)) / fh;
 	return 0;
 }
@@ -1748,7 +1717,7 @@
 			update_screen(vc->vc_num);
 		return 0;
 	} else
-		return fb_blank(blank, info);
+		return fb_blank(info, blank);
 }
 
 static void fbcon_free_font(struct display *p)
diff -urN linux-2.5.67-bk5/drivers/video/console/fbcon.h linux-2.5.67-bk6/drivers/video/console/fbcon.h
--- linux-2.5.67-bk5/drivers/video/console/fbcon.h	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/console/fbcon.h	2003-04-15 04:36:16.000000000 -0700
@@ -33,6 +33,7 @@
     u_short scrollmode;             /* Scroll Method */
     short yscroll;                  /* Hardware scrolling */
     int vrows;                      /* number of virtual rows */
+    int cursor_shape;
 };
 
 /* drivers/video/console/fbcon.c */
diff -urN linux-2.5.67-bk5/drivers/video/controlfb.c linux-2.5.67-bk6/drivers/video/controlfb.c
--- linux-2.5.67-bk5/drivers/video/controlfb.c	2003-04-07 10:30:46.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/controlfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -376,13 +376,12 @@
 		int i;
 		switch (p->par.cmode) {
 		case CMODE_16:
-			((u16 *) (info->pseudo_palette))[regno] =
+			p->pseudo_palette[regno] =
 			    (regno << 10) | (regno << 5) | regno;
 			break;
 		case CMODE_32:
 			i = (regno << 8) | regno;
-			((u32 *) (info->pseudo_palette))[regno] =
-			    (i << 16) | i;
+			p->pseudo_palette[regno] = (i << 16) | i;
 			break;
 		}
 	}
@@ -475,7 +474,6 @@
 		var.yres_virtual = vyres;
 
 	/* Apply default var */
-	p->info.var = var;
 	var.activate = FB_ACTIVATE_NOW;
 	rc = fb_set_var(&var, &p->info);
 	if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8))
@@ -1068,17 +1066,7 @@
 		return;
 
 	while ((this_opt = strsep(&options, ",")) != NULL) {
-		if (!strncmp(this_opt, "font:", 5)) {
-			char *p;
-			int i;
-
-			p = this_opt +5;
-			for (i = 0; i < sizeof(fontname) - 1; i++)
-				if (!*p || *p == ' ' || *p == ',')
-					break;
-			memcpy(fontname, this_opt + 5, i);
-			fontname[i] = 0;
-		} else if (!strncmp(this_opt, "vmode:", 6)) {
+		if (!strncmp(this_opt, "vmode:", 6)) {
 			int vmode = simple_strtoul(this_opt+6, NULL, 0);
 			if (vmode > 0 && vmode <= VMODE_MAX &&
 			    control_mac_modes[vmode - 1].m[1] >= 0)
diff -urN linux-2.5.67-bk5/drivers/video/edid.h linux-2.5.67-bk6/drivers/video/edid.h
--- linux-2.5.67-bk5/drivers/video/edid.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/drivers/video/edid.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,138 @@
+/* 
+ * drivers/video/edid.h - EDID/DDC Header
+ *
+ * Based on:
+ *   1. XFree86 4.3.0, edid.h
+ *      Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ * 
+ *   2. John Fremlin <vii@users.sourceforge.net> and 
+ *      Ani Joshi <ajoshi@unixbox.com>
+ *
+ * DDC is a Trademark of VESA (Video Electronics Standard Association).
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+*/
+
+#ifndef __EDID_H__
+#define __EDID_H__
+
+#define EDID_LENGTH				0x80
+#define EDID_HEADER				0x00
+#define EDID_HEADER_END				0x07
+
+#define ID_MANUFACTURER_NAME			0x08
+#define ID_MANUFACTURER_NAME_END		0x09
+#define ID_MODEL				0x0a
+
+#define ID_SERIAL_NUMBER			0x0c
+
+#define MANUFACTURE_WEEK			0x10
+#define MANUFACTURE_YEAR			0x11
+
+#define EDID_STRUCT_VERSION			0x12
+#define EDID_STRUCT_REVISION			0x13
+
+#define EDID_STRUCT_DISPLAY                     0x14
+
+#define DPMS_FLAGS				0x18
+#define ESTABLISHED_TIMING_1			0x23
+#define ESTABLISHED_TIMING_2			0x24
+#define MANUFACTURERS_TIMINGS			0x25
+
+/* standard timings supported */
+#define STD_TIMING                              8
+#define STD_TIMING_DESCRIPTION_SIZE             2
+#define STD_TIMING_DESCRIPTIONS_START           0x26
+
+#define DETAILED_TIMING_DESCRIPTIONS_START	0x36
+#define DETAILED_TIMING_DESCRIPTION_SIZE	18
+#define NO_DETAILED_TIMING_DESCRIPTIONS		4
+
+#define DETAILED_TIMING_DESCRIPTION_1		0x36
+#define DETAILED_TIMING_DESCRIPTION_2		0x48
+#define DETAILED_TIMING_DESCRIPTION_3		0x5a
+#define DETAILED_TIMING_DESCRIPTION_4		0x6c
+
+#define DESCRIPTOR_DATA				5
+
+#define UPPER_NIBBLE( x ) \
+        (((128|64|32|16) & (x)) >> 4)
+
+#define LOWER_NIBBLE( x ) \
+        ((1|2|4|8) & (x))
+
+#define COMBINE_HI_8LO( hi, lo ) \
+        ( (((unsigned)hi) << 8) | (unsigned)lo )
+
+#define COMBINE_HI_4LO( hi, lo ) \
+        ( (((unsigned)hi) << 4) | (unsigned)lo )
+
+#define PIXEL_CLOCK_LO     (unsigned)block[ 0 ]
+#define PIXEL_CLOCK_HI     (unsigned)block[ 1 ]
+#define PIXEL_CLOCK	   (COMBINE_HI_8LO( PIXEL_CLOCK_HI,PIXEL_CLOCK_LO )*10000)
+#define H_ACTIVE_LO        (unsigned)block[ 2 ]
+#define H_BLANKING_LO      (unsigned)block[ 3 ]
+#define H_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 4 ] )
+#define H_ACTIVE           COMBINE_HI_8LO( H_ACTIVE_HI, H_ACTIVE_LO )
+#define H_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 4 ] )
+#define H_BLANKING         COMBINE_HI_8LO( H_BLANKING_HI, H_BLANKING_LO )
+
+#define V_ACTIVE_LO        (unsigned)block[ 5 ]
+#define V_BLANKING_LO      (unsigned)block[ 6 ]
+#define V_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 7 ] )
+#define V_ACTIVE           COMBINE_HI_8LO( V_ACTIVE_HI, V_ACTIVE_LO )
+#define V_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 7 ] )
+#define V_BLANKING         COMBINE_HI_8LO( V_BLANKING_HI, V_BLANKING_LO )
+
+#define H_SYNC_OFFSET_LO   (unsigned)block[ 8 ]
+#define H_SYNC_WIDTH_LO    (unsigned)block[ 9 ]
+
+#define V_SYNC_OFFSET_LO   UPPER_NIBBLE( (unsigned)block[ 10 ] )
+#define V_SYNC_WIDTH_LO    LOWER_NIBBLE( (unsigned)block[ 10 ] )
+
+#define V_SYNC_WIDTH_HI    ((unsigned)block[ 11 ] & (1|2))
+#define V_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (4|8)) >> 2)
+
+#define H_SYNC_WIDTH_HI    (((unsigned)block[ 11 ] & (16|32)) >> 4)
+#define H_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (64|128)) >> 6)
+
+#define V_SYNC_WIDTH       COMBINE_HI_4LO( V_SYNC_WIDTH_HI, V_SYNC_WIDTH_LO )
+#define V_SYNC_OFFSET      COMBINE_HI_4LO( V_SYNC_OFFSET_HI, V_SYNC_OFFSET_LO )
+
+#define H_SYNC_WIDTH       COMBINE_HI_4LO( H_SYNC_WIDTH_HI, H_SYNC_WIDTH_LO )
+#define H_SYNC_OFFSET      COMBINE_HI_4LO( H_SYNC_OFFSET_HI, H_SYNC_OFFSET_LO )
+
+#define H_SIZE_LO          (unsigned)block[ 12 ]
+#define V_SIZE_LO          (unsigned)block[ 13 ]
+
+#define H_SIZE_HI          UPPER_NIBBLE( (unsigned)block[ 14 ] )
+#define V_SIZE_HI          LOWER_NIBBLE( (unsigned)block[ 14 ] )
+
+#define H_SIZE             COMBINE_HI_8LO( H_SIZE_HI, H_SIZE_LO )
+#define V_SIZE             COMBINE_HI_8LO( V_SIZE_HI, V_SIZE_LO )
+
+#define H_BORDER           (unsigned)block[ 15 ]
+#define V_BORDER           (unsigned)block[ 16 ]
+
+#define FLAGS              (unsigned)block[ 17 ]
+
+#define INTERLACED         (FLAGS&128)
+#define SYNC_TYPE          (FLAGS&3<<3)	/* bits 4,3 */
+#define SYNC_SEPARATE      (3<<3)
+#define HSYNC_POSITIVE     (FLAGS & 4)
+#define VSYNC_POSITIVE     (FLAGS & 2)
+
+#define V_MIN_RATE              block[ 5 ]
+#define V_MAX_RATE              block[ 6 ]
+#define H_MIN_RATE              block[ 7 ]
+#define H_MAX_RATE              block[ 8 ]
+#define MAX_PIXEL_CLOCK         (((int)block[ 9 ]) * 10)
+#define GTF_SUPPORT		block[10]
+
+#define DPMS_ACTIVE_OFF		(1 << 5)
+#define DPMS_SUSPEND		(1 << 6)
+#define DPMS_STANDBY		(1 << 7)
+
+#endif /* __EDID_H__ */
diff -urN linux-2.5.67-bk5/drivers/video/fbcmap.c linux-2.5.67-bk6/drivers/video/fbcmap.c
--- linux-2.5.67-bk5/drivers/video/fbcmap.c	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/fbcmap.c	2003-04-15 04:36:16.000000000 -0700
@@ -154,11 +154,11 @@
  *
  */
 
-void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto)
+int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto)
 {
-    int size;
     int tooff = 0, fromoff = 0;
-
+    int size;
+    
     if (to->start > from->start)
 	fromoff = to->start-from->start;
     else
@@ -167,7 +167,7 @@
     if (size > (int) (from->len - fromoff))
 	size = from->len-fromoff;
     if (size <= 0)
-	return;
+	return -EINVAL;
     size *= sizeof(u16);
     
     switch (fsfromto) {
@@ -179,20 +179,29 @@
 	    memcpy(to->transp+tooff, from->transp+fromoff, size);
         break;
     case 1:
-	copy_from_user(to->red+tooff, from->red+fromoff, size);
-	copy_from_user(to->green+tooff, from->green+fromoff, size);
-	copy_from_user(to->blue+tooff, from->blue+fromoff, size);
+	if (copy_from_user(to->red+tooff, from->red+fromoff, size))
+		return -EFAULT;
+	if (copy_from_user(to->green+tooff, from->green+fromoff, size))
+		return -EFAULT;	
+	if (copy_from_user(to->blue+tooff, from->blue+fromoff, size))
+		return -EFAULT;
 	if (from->transp && to->transp)
-            copy_from_user(to->transp+tooff, from->transp+fromoff, size);
+            if (copy_from_user(to->transp+tooff, from->transp+fromoff, size))
+		    return -EFAULT;	
 	break;
     case 2:
-	copy_to_user(to->red+tooff, from->red+fromoff, size);
-	copy_to_user(to->green+tooff, from->green+fromoff, size);
-	copy_to_user(to->blue+tooff, from->blue+fromoff, size);
+	if (copy_to_user(to->red+tooff, from->red+fromoff, size))
+		return -EFAULT;
+	if (copy_to_user(to->green+tooff, from->green+fromoff, size))
+		return -EFAULT;
+	if (copy_to_user(to->blue+tooff, from->blue+fromoff, size))
+		return -EFAULT;
 	if (from->transp && to->transp)
-	    copy_to_user(to->transp+tooff, from->transp+fromoff, size);
+		if (copy_to_user(to->transp+tooff, from->transp+fromoff, size))
+			return -EFAULT;
 	break;
     }
+    return 0;
 }
 
 /**
diff -urN linux-2.5.67-bk5/drivers/video/fbmem.c linux-2.5.67-bk6/drivers/video/fbmem.c
--- linux-2.5.67-bk5/drivers/video/fbmem.c	2003-04-07 10:30:32.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/fbmem.c	2003-04-15 04:36:16.000000000 -0700
@@ -403,22 +403,22 @@
 	return *src;
 }
 
-void sys_outbuf(u8 src, u8 *dst)
+void sys_outbuf(u8 *src, u8 *dst, unsigned int size)
 {
-	*dst = src;
+	memcpy(dst, src, size);
 }	
 
 void move_buf_aligned(struct fb_info *info, u8 *dst, u8 *src, u32 d_pitch, 
 			u32 s_pitch, u32 height)
 {
-	int i, j;
-	
+	int i;
+
 	for (i = height; i--; ) {
-		for (j = 0; j < s_pitch; j++)
-			info->pixmap.outbuf(*src++, dst+j);
+		info->pixmap.outbuf(src, dst, s_pitch);
+		src += s_pitch;
 		dst += d_pitch;
-	}	
-}	
+	}
+}
 
 void move_buf_unaligned(struct fb_info *info, u8 *dst, u8 *src, u32 d_pitch, 
 			u32 height, u32 mask, u32 shift_high, u32 shift_low,
@@ -432,20 +432,23 @@
 			tmp = info->pixmap.inbuf(dst+j);
 			tmp &= mask;
 			tmp |= *src >> shift_low;
-			info->pixmap.outbuf(tmp, dst+j);
-			info->pixmap.outbuf(*src << shift_high, dst+j+1);
+			info->pixmap.outbuf(&tmp, dst+j, 1);
+			tmp = *src << shift_high;
+			info->pixmap.outbuf(&tmp, dst+j+1, 1);
 			src++;
 		}
 		tmp = info->pixmap.inbuf(dst+idx);
 		tmp &= mask;
 		tmp |= *src >> shift_low;
-		info->pixmap.outbuf(tmp, dst+idx);
-		if (shift_high < mod)
-			info->pixmap.outbuf(*src<<shift_high, dst+idx+1);
+		info->pixmap.outbuf(&tmp, dst+idx, 1);
+		if (shift_high < mod) {
+			tmp = *src << shift_high;
+			info->pixmap.outbuf(&tmp, dst+idx+1, 1);
+		}	
 		src++;
 		dst += d_pitch;
-	}	
-}	
+	}
+}
 
 /*
  * we need to lock this section since fb_cursor
@@ -456,8 +459,7 @@
 	u32 align = info->pixmap.buf_align - 1;
 	u32 offset, count = 1000;
 
-	spin_lock_irqsave(&info->pixmap.lock,
-			  info->pixmap.lock_flags);
+	spin_lock(&info->pixmap.lock);
 	offset = info->pixmap.offset + align;
 	offset &= ~align;
 	if (offset + size > info->pixmap.size) {
@@ -468,12 +470,9 @@
 		offset = 0;
 	}
 	info->pixmap.offset = offset + size;
-
 	atomic_inc(&info->pixmap.count);	
 	smp_mb__after_atomic_inc();
-
-	spin_unlock_irqrestore(&info->pixmap.lock,
-			       info->pixmap.lock_flags);
+	spin_unlock(&info->pixmap.lock);
 	return offset;
 }
 
@@ -566,13 +565,13 @@
 
 static void __init fb_set_logo(struct fb_info *info,
 			       const struct linux_logo *logo, u8 *dst,
-			       int needs_logo)
+			       int depth)
 {
 	int i, j, shift;
 	const u8 *src = logo->data;
 	u8 d, xor = 0;
 
-	switch (needs_logo) {
+	switch (depth) {
 	case 4:
 		for (i = 0; i < logo->height; i++)
 			for (j = 0; j < logo->width; src++) {
@@ -620,20 +619,18 @@
  * to set the DAC or the pseudo_palette.  However, the bitmap is packed, ie,
  * each byte contains color information for two pixels (upper and lower nibble).
  * To be consistent with fb_imageblit() usage, we therefore separate the two
- * nibbles into separate bytes. The "needs_logo" flag will be set to 4.
+ * nibbles into separate bytes. The "depth" flag will be set to 4.
  *
  * Case 3 - linux_logo_mono:
  * This is similar with Case 2.  Each byte contains information for 8 pixels.
- * We isolate each bit and expand each into a byte. The "needs_logo" flag will
+ * We isolate each bit and expand each into a byte. The "depth" flag will
  * be set to 1.
  */
 static struct logo_data {
 	int depth;
-	int needs_logo;
 	int needs_directpalette;
 	int needs_truepalette;
 	int needs_cmapreset;
-	int type;
 	const struct linux_logo *logo;
 } fb_logo;
 
@@ -641,74 +638,48 @@
 {
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
-	fb_logo.depth = info->var.bits_per_pixel;
-
 	switch (info->fix.visual) {
 	case FB_VISUAL_TRUECOLOR:
-		if (fb_logo.depth >= 8) {
+		if (info->var.bits_per_pixel >= 8)
 			fb_logo.needs_truepalette = 1;
-			fb_logo.needs_logo = 8;
-		} else if (fb_logo.depth >= 4)
-			fb_logo.needs_logo = 4;
-		else 
-			fb_logo.needs_logo = 1;
 		break;
 	case FB_VISUAL_DIRECTCOLOR:
-		if (fb_logo.depth >= 24) {
+		if (info->var.bits_per_pixel >= 24) {
 			fb_logo.needs_directpalette = 1;
 			fb_logo.needs_cmapreset = 1;
-			fb_logo.needs_logo = 8;
-		} else if (fb_logo.depth >= 16)	/* 16 colors */
-			fb_logo.needs_logo = 4;
-		else
-			fb_logo.needs_logo = 1;	/* 2 colors */
-		break;
-	case FB_VISUAL_MONO01:
-		/* reversed 0 = fg, 1 = bg */
-		fb_logo.needs_logo = ~1;
-		break;
-	case FB_VISUAL_MONO10:
-		fb_logo.needs_logo = 1;
+		}
 		break;
 	case FB_VISUAL_PSEUDOCOLOR:
-	case FB_VISUAL_STATIC_PSEUDOCOLOR:
-		if (fb_logo.depth >= 8) {
-			fb_logo.needs_logo = 8;
-			if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
-				fb_logo.needs_cmapreset = 1;
-		} else if (fb_logo.depth >= 4)
-			fb_logo.needs_logo = 4;	/* 16 colors */
-		else
-			fb_logo.needs_logo = 1;	
+		fb_logo.needs_cmapreset = 1;
 		break;
 	}
 
-	if (fb_logo.needs_logo >= 8)
-		fb_logo.type = LINUX_LOGO_CLUT224;
-	else if (fb_logo.needs_logo >= 4)
-		fb_logo.type = LINUX_LOGO_VGA16;
-	else
-		fb_logo.type = LINUX_LOGO_MONO;
-
 	/* Return if no suitable logo was found */
-	fb_logo.logo = fb_find_logo(fb_logo.type);
+	fb_logo.logo = find_logo(info->var.bits_per_pixel);
+	
 	if (!fb_logo.logo || fb_logo.logo->height > info->var.yres) {
 		fb_logo.logo = NULL;
 		return 0;
 	}
+	/* What depth we asked for might be different from what we get */
+	if (fb_logo.logo->type == LINUX_LOGO_CLUT224)
+		fb_logo.depth = 8;
+	else if (fb_logo.logo->type == LINUX_LOGO_VGA16)
+		fb_logo.depth = 4;
+	else
+		fb_logo.depth = 1;		
 	return fb_logo.logo->height;
 }
 
 int fb_show_logo(struct fb_info *info)
 {
-	unsigned char *fb = info->screen_base, *logo_new = NULL;
 	u32 *palette = NULL, *saved_pseudo_palette = NULL;
+	unsigned char *logo_new = NULL;
 	struct fb_image image;
 	int x;
 
 	/* Return if the frame buffer is not mapped */
-	if (!fb || !info->fbops->fb_imageblit ||
-	    fb_logo.logo == NULL)
+	if (fb_logo.logo == NULL)
 		return 0;
 
 	image.depth = fb_logo.depth;
@@ -732,7 +703,7 @@
 		info->pseudo_palette = palette;
 	}
 
-	if (fb_logo.needs_logo != 8) {
+	if (fb_logo.depth == 4) {
 		logo_new = kmalloc(fb_logo.logo->width * fb_logo.logo->height, 
 				   GFP_KERNEL);
 		if (logo_new == NULL) {
@@ -742,9 +713,8 @@
 				info->pseudo_palette = saved_pseudo_palette;
 			return 0;
 		}
-
 		image.data = logo_new;
-		fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.needs_logo);
+		fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.depth);
 	}
 
 	image.width = fb_logo.logo->width;
@@ -755,8 +725,8 @@
 	     x <= info->var.xres-fb_logo.logo->width; x += (fb_logo.logo->width + 8)) {
 		image.dx = x;
 		info->fbops->fb_imageblit(info, &image);
-		atomic_dec(&info->pixmap.count);
-		smp_mb__after_atomic_dec();
+		//atomic_dec(&info->pixmap.count);
+		//smp_mb__after_atomic_dec();
 	}
 	
 	if (palette != NULL)
@@ -876,7 +846,54 @@
 #endif /* CONFIG_KMOD */
 
 int
-fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
+fb_cursor(struct fb_info *info, struct fb_cursor *sprite)
+{
+	struct fb_cursor cursor;
+	int err;
+	
+	if (copy_from_user(&cursor, sprite, sizeof(struct fb_cursor)))
+		return -EFAULT;
+
+	if (cursor.set & FB_CUR_SETCUR)
+		info->cursor.enable = 1;
+	
+	if (cursor.set & FB_CUR_SETCMAP) {
+		err = fb_copy_cmap(&cursor.image.cmap, &sprite->image.cmap, 1);
+		if (err)
+			return err;
+	}
+	
+	if (cursor.set & FB_CUR_SETSHAPE) {
+		int size = ((cursor.image.width + 7) >> 3) * cursor.image.height;		
+		if ((cursor.image.height != info->cursor.image.height) ||
+		    (cursor.image.width != info->cursor.image.width))
+			cursor.set |= FB_CUR_SETSIZE;
+		
+		cursor.image.data = kmalloc(size, GFP_KERNEL);
+		if (!cursor.image.data)
+			return -ENOMEM;
+		
+		cursor.mask = kmalloc(size, GFP_KERNEL);
+		if (!cursor.mask) {
+			kfree(cursor.image.data);
+			return -ENOMEM;
+		}
+		
+		if (copy_from_user(&cursor.image.data, sprite->image.data, size) ||
+		    copy_from_user(cursor.mask, sprite->mask, size)) { 
+			kfree(cursor.image.data);
+			kfree(cursor.mask);
+			return -EFAULT;
+		}
+	}
+	info->cursor.set = cursor.set;
+	info->cursor.rop = cursor.rop;
+	err = info->fbops->fb_cursor(info, &cursor);
+	return err;
+}
+
+int
+fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var)
 {
         int xoffset = var->xoffset;
         int yoffset = var->yoffset;
@@ -898,7 +915,7 @@
 }
 
 int
-fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info)
+fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 {
 	int err;
 
@@ -917,7 +934,7 @@
 			if (info->fbops->fb_set_par)
 				info->fbops->fb_set_par(info);
 
-			fb_pan_display(&info->var, info);
+			fb_pan_display(info, &info->var);
 
 			fb_set_cmap(&info->cmap, 1, info);
 		}
@@ -926,7 +943,7 @@
 }
 
 int
-fb_blank(int blank, struct fb_info *info)
+fb_blank(struct fb_info *info, int blank)
 {	
 	/* ??? Varible sized stack allocation.  */
 	u16 black[info->cmap.len];
@@ -960,7 +977,7 @@
 	struct fb_cmap cmap;
 	int i;
 	
-	if (! fb)
+	if (!fb)
 		return -ENODEV;
 	switch (cmd) {
 	case FBIOGET_VSCREENINFO:
@@ -969,7 +986,7 @@
 	case FBIOPUT_VSCREENINFO:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		i = fb_set_var(&var, info);
+		i = fb_set_var(info, &var);
 		if (i) return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
@@ -983,16 +1000,17 @@
 	case FBIOGETCMAP:
 		if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
 			return -EFAULT;
-		fb_copy_cmap(&info->cmap, &cmap, 0);
-		return 0;
+		return (fb_copy_cmap(&info->cmap, &cmap, 0));
 	case FBIOPAN_DISPLAY:
 		if (copy_from_user(&var, (void *) arg, sizeof(var)))
 			return -EFAULT;
-		if ((i = fb_pan_display(&var, info)))
+		if ((i = fb_pan_display(info, &var)))
 			return i;
 		if (copy_to_user((void *) arg, &var, sizeof(var)))
 			return -EFAULT;
-		return i;
+		return 0;
+	case FBIO_CURSOR:
+		return (fb_cursor(info, (struct fb_cursor *) arg));
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
 	case FBIOGET_CON2FBMAP:
 		if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
@@ -1022,7 +1040,7 @@
 		return 0;
 #endif	/* CONFIG_FRAMEBUFFER_CONSOLE */
 	case FBIOBLANK:
-		return fb_blank(arg, info);
+		return fb_blank(info, arg);
 	default:
 		if (fb->fb_ioctl == NULL)
 			return -EINVAL;
@@ -1136,6 +1154,8 @@
 	struct fb_info *info;
 	int res = 0;
 
+	if (fbidx >= FB_MAX)
+		return -ENODEV;
 #ifdef CONFIG_KMOD
 	if (!(info = registered_fb[fbidx]))
 		try_to_load(fbidx);
@@ -1219,7 +1239,7 @@
 	if (fb_info->pixmap.inbuf == NULL)
 		fb_info->pixmap.inbuf = sys_inbuf;
 	spin_lock_init(&fb_info->pixmap.lock);
-	
+
 	registered_fb[i] = fb_info;
 	sprintf(name_buf, "fb/%d", i);
 	devfs_register(NULL, name_buf, DEVFS_FL_DEFAULT,
diff -urN linux-2.5.67-bk5/drivers/video/fbmon.c linux-2.5.67-bk6/drivers/video/fbmon.c
--- linux-2.5.67-bk5/drivers/video/fbmon.c	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/fbmon.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,7 +1,25 @@
 /*
- *   linux/drivers/video/fbmon.c
+ * linux/drivers/video/fbmon.c
  *
- *  Copyright (C) 2002 James Simmons <jsimmons@users.sf.net>
+ * Copyright (C) 2002 James Simmons <jsimmons@users.sf.net>
+ *
+ * Credits:
+ * 
+ * The EDID Parser is a conglomeration from the following sources:
+ *
+ *   1. SciTech SNAP Graphics Architecture
+ *      Copyright (C) 1991-2002 SciTech Software, Inc. All rights reserved.
+ *
+ *   2. XFree86 4.3.0, interpret_edid.c
+ *      Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
+ * 
+ *   3. John Fremlin <vii@users.sourceforge.net> and 
+ *      Ani Joshi <ajoshi@unixbox.com>
+ *  
+ * Generalized Timing Formula is derived from:
+ *
+ *      GTF Spreadsheet by Andy Morrish (1/5/97) 
+ *      available at http://www.vesa.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
@@ -11,124 +29,32 @@
 #include <linux/tty.h>
 #include <linux/fb.h>
 #include <linux/module.h>
-#ifdef CONFIG_PCI
-#include <linux/pci.h>
-#endif
 #ifdef CONFIG_ALL_PPC
+#include <linux/pci.h>
 #include <asm/prom.h>
 #endif
+#include <video/edid.h>
+#include "edid.h"
 
 /* 
  * EDID parser
- *
- * portions of this file were based on the EDID parser by
- * John Fremlin <vii@users.sourceforge.net> and Ani Joshi <ajoshi@unixbox.com>
  */
 
-#define EDID_LENGTH				0x80
-#define EDID_HEADER				0x00
-#define EDID_HEADER_END				0x07
-
-#define ID_MANUFACTURER_NAME			0x08
-#define ID_MANUFACTURER_NAME_END		0x09
-#define ID_MODEL				0x0a
-
-#define ID_SERIAL_NUMBER			0x0c
-
-#define MANUFACTURE_WEEK			0x10
-#define MANUFACTURE_YEAR			0x11
-
-#define EDID_STRUCT_VERSION			0x12
-#define EDID_STRUCT_REVISION			0x13
-
-#define DPMS_FLAGS				0x18
-#define ESTABLISHED_TIMING_1			0x23
-#define ESTABLISHED_TIMING_2			0x24
-#define MANUFACTURERS_TIMINGS			0x25
-
-#define DETAILED_TIMING_DESCRIPTIONS_START	0x36
-#define DETAILED_TIMING_DESCRIPTION_SIZE	18
-#define NO_DETAILED_TIMING_DESCRIPTIONS		4
-
-#define DETAILED_TIMING_DESCRIPTION_1		0x36
-#define DETAILED_TIMING_DESCRIPTION_2		0x48
-#define DETAILED_TIMING_DESCRIPTION_3		0x5a
-#define DETAILED_TIMING_DESCRIPTION_4		0x6c
-
-#define DESCRIPTOR_DATA				5
-
-#define UPPER_NIBBLE( x ) \
-        (((128|64|32|16) & (x)) >> 4)
-
-#define LOWER_NIBBLE( x ) \
-        ((1|2|4|8) & (x))
-
-#define COMBINE_HI_8LO( hi, lo ) \
-        ( (((unsigned)hi) << 8) | (unsigned)lo )
-
-#define COMBINE_HI_4LO( hi, lo ) \
-        ( (((unsigned)hi) << 4) | (unsigned)lo )
-
-#define PIXEL_CLOCK_LO     (unsigned)block[ 0 ]
-#define PIXEL_CLOCK_HI     (unsigned)block[ 1 ]
-#define PIXEL_CLOCK	   (COMBINE_HI_8LO( PIXEL_CLOCK_HI,PIXEL_CLOCK_LO )*1000)
-#define H_ACTIVE_LO        (unsigned)block[ 2 ]
-#define H_BLANKING_LO      (unsigned)block[ 3 ]
-#define H_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 4 ] )
-#define H_ACTIVE           COMBINE_HI_8LO( H_ACTIVE_HI, H_ACTIVE_LO )
-#define H_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 4 ] )
-#define H_BLANKING         COMBINE_HI_8LO( H_BLANKING_HI, H_BLANKING_LO )
-
-#define V_ACTIVE_LO        (unsigned)block[ 5 ]
-#define V_BLANKING_LO      (unsigned)block[ 6 ]
-#define V_ACTIVE_HI        UPPER_NIBBLE( (unsigned)block[ 7 ] )
-#define V_ACTIVE           COMBINE_HI_8LO( V_ACTIVE_HI, V_ACTIVE_LO )
-#define V_BLANKING_HI      LOWER_NIBBLE( (unsigned)block[ 7 ] )
-#define V_BLANKING         COMBINE_HI_8LO( V_BLANKING_HI, V_BLANKING_LO )
-
-#define H_SYNC_OFFSET_LO   (unsigned)block[ 8 ]
-#define H_SYNC_WIDTH_LO    (unsigned)block[ 9 ]
-
-#define V_SYNC_OFFSET_LO   UPPER_NIBBLE( (unsigned)block[ 10 ] )
-#define V_SYNC_WIDTH_LO    LOWER_NIBBLE( (unsigned)block[ 10 ] )
-
-#define V_SYNC_WIDTH_HI    ((unsigned)block[ 11 ] & (1|2))
-#define V_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (4|8)) >> 2)
-
-#define H_SYNC_WIDTH_HI    (((unsigned)block[ 11 ] & (16|32)) >> 4)
-#define H_SYNC_OFFSET_HI   (((unsigned)block[ 11 ] & (64|128)) >> 6)
-
-#define V_SYNC_WIDTH       COMBINE_HI_4LO( V_SYNC_WIDTH_HI, V_SYNC_WIDTH_LO )
-#define V_SYNC_OFFSET      COMBINE_HI_4LO( V_SYNC_OFFSET_HI, V_SYNC_OFFSET_LO )
-
-#define H_SYNC_WIDTH       COMBINE_HI_4LO( H_SYNC_WIDTH_HI, H_SYNC_WIDTH_LO )
-#define H_SYNC_OFFSET      COMBINE_HI_4LO( H_SYNC_OFFSET_HI, H_SYNC_OFFSET_LO )
-
-#define H_SIZE_LO          (unsigned)block[ 12 ]
-#define V_SIZE_LO          (unsigned)block[ 13 ]
-
-#define H_SIZE_HI          UPPER_NIBBLE( (unsigned)block[ 14 ] )
-#define V_SIZE_HI          LOWER_NIBBLE( (unsigned)block[ 14 ] )
-
-#define H_SIZE             COMBINE_HI_8LO( H_SIZE_HI, H_SIZE_LO )
-#define V_SIZE             COMBINE_HI_8LO( V_SIZE_HI, V_SIZE_LO )
-
-#define H_BORDER           (unsigned)block[ 15 ]
-#define V_BORDER           (unsigned)block[ 16 ]
-
-#define FLAGS              (unsigned)block[ 17 ]
-
-#define INTERLACED         (FLAGS&128)
-#define SYNC_TYPE          (FLAGS&3<<3)	/* bits 4,3 */
-#define SYNC_SEPARATE      (3<<3)
-#define HSYNC_POSITIVE     (FLAGS & 4)
-#define VSYNC_POSITIVE     (FLAGS & 2)
-
 const unsigned char edid_v1_header[] = { 0x00, 0xff, 0xff, 0xff,
 	0xff, 0xff, 0xff, 0x00
 };
 const unsigned char edid_v1_descriptor_flag[] = { 0x00, 0x00 };
 
+static void copy_string(unsigned char *c, unsigned char *s)
+{
+  int i;
+  c = c + 5;
+  for (i = 0; (i < 13 && *c != 0x0A); i++)
+    *(s++) = *(c++);
+  *s = 0;
+  while (i-- && (*--s == 0x20)) *s = 0;
+}
+
 static int edid_checksum(unsigned char *edid)
 {
 	unsigned char i, csum = 0;
@@ -157,138 +83,785 @@
 	return 1;
 }
 
-
-static char *edid_get_vendor(unsigned char *block)
+static void parse_vendor_block(unsigned char *block)
 {
-	static char sign[4];
-	unsigned short h;
+	unsigned char c[4];
 
-	h = COMBINE_HI_8LO(block[0], block[1]);
-	sign[0] = ((h >> 10) & 0x1f) + 'A' - 1;
-	sign[1] = ((h >> 5) & 0x1f) + 'A' - 1;
-	sign[2] = (h & 0x1f) + 'A' - 1;
-	sign[3] = 0;
+	c[0] = ((block[0] & 0x7c) >> 2) + '@';
+	c[1] = ((block[0] & 0x03) << 3) + ((block[1] & 0xe0) >> 5) + '@';
+	c[2] = (block[1] & 0x1f) + '@';
+	c[3] = 0;
+	printk("   Manufacturer: %s ", c);
+	printk("Model: %x ", block[2] + (block[3] << 8));
+	printk("Serial#: %u\n", block[4] + (block[5] << 8) + 
+	       (block[6] << 16) + (block[7] << 24));
+	printk("   Year: %u Week %u\n", block[9] + 1990, block[8]);
+}
 
-	return sign;
+static void parse_dpms_capabilities(unsigned char flags)
+{
+	printk("      DPMS: Active %s, Suspend %s, Standby %s\n",
+	       (flags & DPMS_ACTIVE_OFF) ? "yes" : "no",
+	       (flags & DPMS_SUSPEND)    ? "yes" : "no",
+	       (flags & DPMS_STANDBY)    ? "yes" : "no");
 }
+	
+static void print_chroma(unsigned char *block)
+{
+	int tmp;
 
-static char *edid_get_monitor(unsigned char *block)
+	/* Chromaticity data */
+	printk("      Chromaticity: ");
+	tmp = ((block[5] & (3 << 6)) >> 6) | (block[0x7] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("RedX:   0.%03d ", tmp/1024);
+
+	tmp = ((block[5] & (3 << 4)) >> 4) | (block[0x8] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("RedY:   0.%03d\n", tmp/1024);
+
+	tmp = ((block[5] & (3 << 2)) >> 2) | (block[0x9] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("                    GreenX: 0.%03d ", tmp/1024);
+
+	tmp = (block[5] & 3) | (block[0xa] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("GreenY: 0.%03d\n", tmp/1024);
+
+	tmp = ((block[6] & (3 << 6)) >> 6) | (block[0xb] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("                    BlueX:  0.%03d ", tmp/1024);
+
+	tmp = ((block[6] & (3 << 4)) >> 4) | (block[0xc] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("BlueY:  0.%03d\n", tmp/1024);
+	
+	tmp = ((block[6] & (3 << 2)) >> 2) | (block[0xd] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("                    WhiteX: 0.%03d ", tmp/1024);
+
+	tmp = (block[6] & 3) | (block[0xe] << 2);
+	tmp *= 1000;
+	tmp += 512;
+	printk("WhiteY: 0.%03d\n", tmp/1024);
+}
+
+static void parse_display_block(unsigned char *block)
 {
-	static char name[13];
-	unsigned i;
-	const unsigned char *ptr = block + DESCRIPTOR_DATA;
+	unsigned char c;
 
-	for (i = 0; i < 13; i++, ptr++) {
-		if (*ptr == 0xa) {
-			name[i] = 0x00;
-			return name;
+	c = (block[0] & 0x80) >> 7;
+	if (c) 
+		printk("      Digital Display Input");
+	else {
+		printk("      Analog Display Input: Input Voltage - ");
+		switch ((block[0] & 0x60) >> 5) {
+		case 0:
+			printk("0.700V/0.300V");
+			break;
+		case 1:
+			printk("0.714V/0.286V");
+			break;
+		case 2:
+			printk("1.000V/0.400V");
+			break;
+		case 3:
+			printk("0.700V/0.000V");
+			break;
+		default:
+			printk("unknown");
 		}
-		name[i] = *ptr;
+		printk("\n");
 	}
-	return name;
+	c = (block[0] & 0x10) >> 4;
+	if (c)
+		printk("      Configurable signal level\n");
+	printk("      Sync: ");
+	c = block[0] & 0x0f;
+	if (c & 0x10)
+		printk("Blank to Blank ");
+	if (c & 0x08)
+		printk("Separate ");
+	if (c & 0x04)
+		printk("Composite ");
+	if (c & 0x02)
+		printk("Sync on Green ");
+	if (c & 0x01)
+		printk("Serration on ");
+	printk("\n");
+
+	printk("      Max H-size in cm: ");
+	c = block[1];
+	if (c) 
+		printk("%d\n", c);
+	else
+		printk("variable\n");
+	
+	printk("      Max V-size in cm: ");
+	c = block[2];
+	if (c)
+		printk("%d\n", c);
+	else
+		printk("variable\n");
+
+	c = block[3];
+	printk("      Gamma: ");
+	printk("%d.%d\n", (c + 100)/100, (c+100) % 100);
+
+	parse_dpms_capabilities(block[4]);
+
+	switch ((block[4] & 0x18) >> 3) {
+	case 0:
+		printk("      Monochrome/Grayscale\n");
+		break;
+	case 1:
+		printk("      RGB Color Display\n");
+		break;
+	case 2:
+		printk("      Non-RGB Multicolor Display\n");
+		break;
+	default:
+		printk("      Unknown\n");
+		break;
+	}
+
+	print_chroma(block);
+	
+	c = block[4] & 0x7;
+	if (c & 0x04)
+		printk("      Default color format is primary\n");
+	if (c & 0x02)
+		printk("      First DETAILED Timing is preferred\n");
+	if (c & 0x01)
+		printk("      Display is GTF capable\n");
 }
 
+static void parse_std_md_block(unsigned char *block)
+{
+	unsigned char c;
+
+	c = block[0];
+	if (c&0x80) printk("      720x400@70Hz\n");
+	if (c&0x40) printk("      720x400@88Hz\n");
+	if (c&0x20) printk("      640x480@60Hz\n");
+	if (c&0x10) printk("      640x480@67Hz\n");
+	if (c&0x08) printk("      640x480@72Hz\n");
+	if (c&0x04) printk("      640x480@75Hz\n");
+	if (c&0x02) printk("      800x600@56Hz\n");
+	if (c&0x01) printk("      800x600@60Hz\n");
+
+	c = block[1];
+	if (c&0x80) printk("      800x600@72Hz\n");
+	if (c&0x40) printk("      800x600@75Hz\n");
+	if (c&0x20) printk("      832x624@75Hz\n");
+	if (c&0x10) printk("      1024x768@87Hz (interlaced)\n");
+	if (c&0x08) printk("      1024x768@60Hz\n");
+	if (c&0x04) printk("      1024x768@70Hz\n");
+	if (c&0x02) printk("      1024x768@75Hz\n");
+	if (c&0x01) printk("      1280x1024@75Hz\n");
+
+	c = block[2];
+	if (c&0x80) printk("      1152x870@75Hz\n");
+	printk("      Manufacturer's mask: %x\n",c&0x7F);
+}
+		
+		
 static int edid_is_timing_block(unsigned char *block)
 {
-	if ((block[0] == 0x00) && (block[1] == 0x00))
+	if ((block[0] != 0x00) || (block[1] != 0x00) || 
+	    (block[2] != 0x00) || (block[4] != 0x00)) 
+		return 1;
+	else
 		return 0;
+}
+
+static int edid_is_serial_block(unsigned char *block)
+{
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xff) &&
+	    (block[4] == 0x00))
+		return 1;
 	else
+		return 0;
+}
+
+static int edid_is_ascii_block(unsigned char *block)
+{
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xfe) &&
+	    (block[4] == 0x00))
 		return 1;
+	else
+		return 0;
+}
+
+static int edid_is_limits_block(unsigned char *block)
+{
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xfd) &&
+	    (block[4] == 0x00))
+		return 1;
+	else
+		return 0;
 }
 
 static int edid_is_monitor_block(unsigned char *block)
 {
-	if ((block[0] == 0x00) && (block[1] == 0x00) && (block[3] == 0xfc))
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xfc) &&
+	    (block[4] == 0x00))
 		return 1;
 	else
 		return 0;
 }
 
-static void parse_timing_block(unsigned char *block,
-			       struct fb_var_screeninfo *var)
+static int edid_is_color_block(unsigned char *block)
 {
-	var->xres = var->xres_virtual = H_ACTIVE;
-	var->yres = var->yres_virtual = V_ACTIVE;
-	var->height = var->width = -1;
-	var->right_margin = H_SYNC_OFFSET;
-	var->left_margin = (H_ACTIVE + H_BLANKING) -
-	    (H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH);
-	var->upper_margin = V_BLANKING - V_SYNC_OFFSET - V_SYNC_WIDTH;
-	var->lower_margin = V_SYNC_OFFSET;
-	var->hsync_len = H_SYNC_WIDTH;
-	var->vsync_len = V_SYNC_WIDTH;
-	var->pixclock = PIXEL_CLOCK;
-	var->pixclock /= 1000;
-	var->pixclock = KHZ2PICOS(var->pixclock);
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xfb) &&
+	    (block[4] == 0x00))
+		return 1;
+	else
+		return 0;
+}
 
-	if (HSYNC_POSITIVE)
-		var->sync |= FB_SYNC_HOR_HIGH_ACT;
-	if (VSYNC_POSITIVE)
-		var->sync |= FB_SYNC_VERT_HIGH_ACT;
+static int edid_is_std_timings_block(unsigned char *block)
+{
+	if ((block[0] == 0x00) && (block[1] == 0x00) && 
+	    (block[2] == 0x00) && (block[3] == 0xfa) &&
+	    (block[4] == 0x00))
+		return 1;
+	else
+		return 0;
+}
+
+static void parse_serial_block(unsigned char *block)
+{
+	unsigned char c[13];
+	
+	copy_string(block, c);
+	printk("      Serial No     : %s\n", c);
+}
+
+static void parse_ascii_block(unsigned char *block)
+{
+	unsigned char c[13];
+	
+	copy_string(block, c);
+	printk("      %s\n", c);
+}
+
+static void parse_limits_block(unsigned char *block)
+{
+	printk("      HorizSync     : %d-%d KHz\n", H_MIN_RATE, H_MAX_RATE);
+	printk("      VertRefresh   : %d-%d Hz\n", V_MIN_RATE, V_MAX_RATE);
+	if (MAX_PIXEL_CLOCK != 10*0xff)
+		printk("      Max Pixelclock: %d MHz\n", (int) MAX_PIXEL_CLOCK);
+}
+
+static void parse_monitor_block(unsigned char *block)
+{
+	unsigned char c[13];
+	
+	copy_string(block, c);
+	printk("      Monitor Name  : %s\n", c);
+}
+
+static void parse_color_block(unsigned char *block)
+{
+	printk("      Color Point    : unimplemented\n");
+}
+
+static void parse_std_timing_block(unsigned char *block)
+{
+	int xres, yres = 0, refresh, ratio, err = 1;
+	
+	xres = (block[0] + 31) * 8;
+	if (xres <= 256)
+		return;
+
+	ratio = (block[1] & 0xc0) >> 6;
+	switch (ratio) {
+	case 0:
+		yres = xres;
+		break;
+	case 1:
+		yres = (xres * 3)/4;
+		break;
+	case 2:
+		yres = (xres * 4)/5;
+		break;
+	case 3:
+		yres = (xres * 9)/16;
+		break;
+	}
+	refresh = (block[1] & 0x3f) + 60;
+	printk("      %dx%d@%dHz\n", xres, yres, refresh);
+	err = 0;
+}
+
+static void parse_dst_timing_block(unsigned char *block)
+{
+	int i;
+
+	block += 5;
+	for (i = 0; i < 5; i++, block += STD_TIMING_DESCRIPTION_SIZE)
+		parse_std_timing_block(block);
+}
+
+static void parse_detailed_timing_block(unsigned char *block)
+{
+	printk("      %d MHz ",  PIXEL_CLOCK/1000000);
+	printk("%d %d %d %d ", H_ACTIVE, H_ACTIVE + H_SYNC_OFFSET, 
+	       H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH, H_ACTIVE + H_BLANKING);
+	printk("%d %d %d %d ", V_ACTIVE, V_ACTIVE + V_SYNC_OFFSET, 
+	       V_ACTIVE + V_SYNC_OFFSET + V_SYNC_WIDTH, V_ACTIVE + V_BLANKING);
+	printk("%sHSync %sVSync\n\n", (HSYNC_POSITIVE) ? "+" : "-", 
+	       (VSYNC_POSITIVE) ? "+" : "-");
 }
 
 int parse_edid(unsigned char *edid, struct fb_var_screeninfo *var)
 {
-	unsigned char *block, *vendor, *monitor = NULL;
 	int i;
+	unsigned char *block;
+
+	if (edid == NULL || var == NULL)
+		return 1;
 
 	if (!(edid_checksum(edid)))
-		return 0;
+		return 1;
 
 	if (!(edid_check_header(edid)))
+		return 1;
+
+	block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
+
+	for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
+		if (edid_is_timing_block(block)) {
+			var->xres = var->xres_virtual = H_ACTIVE;
+			var->yres = var->yres_virtual = V_ACTIVE;
+			var->height = var->width = -1;
+			var->right_margin = H_SYNC_OFFSET;
+			var->left_margin = (H_ACTIVE + H_BLANKING) -
+				(H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH);
+			var->upper_margin = V_BLANKING - V_SYNC_OFFSET - 
+				V_SYNC_WIDTH;
+			var->lower_margin = V_SYNC_OFFSET;
+			var->hsync_len = H_SYNC_WIDTH;
+			var->vsync_len = V_SYNC_WIDTH;
+			var->pixclock = PIXEL_CLOCK;
+			var->pixclock /= 1000;
+			var->pixclock = KHZ2PICOS(var->pixclock);
+
+			if (HSYNC_POSITIVE)
+				var->sync |= FB_SYNC_HOR_HIGH_ACT;
+			if (VSYNC_POSITIVE)
+				var->sync |= FB_SYNC_VERT_HIGH_ACT;
+			return 0;
+		}
+	}
+	return 1;
+}
+
+static void calc_mode_timings(int xres, int yres, int refresh, struct fb_videomode *mode)
+{
+	struct fb_var_screeninfo var;
+	struct fb_info info;
+	
+	var.xres = xres;
+	var.yres = yres;
+	fb_get_mode(FB_VSYNCTIMINGS | FB_IGNOREMON, 
+		    refresh, &var, &info);
+	mode->xres = xres;
+	mode->yres = yres;
+	mode->pixclock = var.pixclock;
+	mode->refresh = refresh;
+	mode->left_margin = var.left_margin;
+	mode->right_margin = var.right_margin;
+	mode->upper_margin = var.upper_margin;
+	mode->lower_margin = var.lower_margin;
+	mode->hsync_len = var.hsync_len;
+	mode->vsync_len = var.vsync_len;
+	mode->vmode = 0;
+	mode->sync = 0;
+}
+
+static int get_est_timing(unsigned char *block, struct fb_videomode *mode)
+{
+	int num = 0;
+	unsigned char c;
+
+	c = block[0];
+	if (c&0x80) 
+		calc_mode_timings(720, 400, 70, &mode[num++]);
+	if (c&0x40) 
+		calc_mode_timings(720, 400, 88, &mode[num++]);
+	if (c&0x20)
+		mode[num++] = vesa_modes[3];
+	if (c&0x10)
+		calc_mode_timings(640, 480, 67, &mode[num++]);
+	if (c&0x08)
+		mode[num++] = vesa_modes[4];
+	if (c&0x04)
+		mode[num++] = vesa_modes[5];
+	if (c&0x02)
+		mode[num++] = vesa_modes[7];
+	if (c&0x01)
+		mode[num++] = vesa_modes[8];
+
+	c = block[1];
+	if (c&0x80)
+ 		mode[num++] = vesa_modes[9];
+	if (c&0x40)
+ 		mode[num++] = vesa_modes[10];
+	if (c&0x20)
+		calc_mode_timings(832, 624, 75, &mode[num++]);
+	if (c&0x10)
+		mode[num++] = vesa_modes[12];
+	if (c&0x08)
+		mode[num++] = vesa_modes[13];
+	if (c&0x04)
+		mode[num++] = vesa_modes[14];
+	if (c&0x02)
+		mode[num++] = vesa_modes[15];
+	if (c&0x01)
+		mode[num++] = vesa_modes[21];
+
+	c = block[2];
+	if (c&0x80)
+		mode[num++] = vesa_modes[17];
+
+	return num;
+}
+
+static int get_std_timing(unsigned char *block, struct fb_videomode *mode)
+{
+	int xres, yres = 0, refresh, ratio, i;
+	
+	xres = (block[0] + 31) * 8;
+	if (xres <= 256)
 		return 0;
 
-	printk("EDID ver %d rev %d\n", (int) edid[EDID_STRUCT_VERSION],
-	       (int) edid[EDID_STRUCT_REVISION]);
+	ratio = (block[1] & 0xc0) >> 6;
+	switch (ratio) {
+	case 0:
+		yres = xres;
+		break;
+	case 1:
+		yres = (xres * 3)/4;
+		break;
+	case 2:
+		yres = (xres * 4)/5;
+		break;
+	case 3:
+		yres = (xres * 9)/16;
+		break;
+	}
+	refresh = (block[1] & 0x3f) + 60;
 
-	vendor = edid_get_vendor(edid + ID_MANUFACTURER_NAME);
+	for (i = 0; i < VESA_MODEDB_SIZE; i++) {
+		if (vesa_modes[i].xres == xres && 
+		    vesa_modes[i].yres == yres &&
+		    vesa_modes[i].refresh == refresh) {
+			*mode = vesa_modes[i];
+			break;
+		} else {
+			calc_mode_timings(xres, yres, refresh, mode);
+			break;
+		}
+	}
+	return 1;
+}
 
-	block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
+static int get_dst_timing(unsigned char *block,
+			  struct fb_videomode *mode)
+{
+	int j, num = 0;
 
-	for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
-		if (edid_is_monitor_block(block)) {
-			monitor = edid_get_monitor(block);
+	for (j = 0; j < 6; j++, block+= STD_TIMING_DESCRIPTION_SIZE) 
+		num += get_std_timing(block, &mode[num]);
+
+	return num;
+}
+
+static void get_detailed_timing(unsigned char *block, 
+				struct fb_videomode *mode)
+{
+	mode->xres = H_ACTIVE;
+	mode->yres = V_ACTIVE;
+	mode->pixclock = PIXEL_CLOCK;
+	mode->pixclock /= 1000;
+	mode->pixclock = KHZ2PICOS(mode->pixclock);
+	mode->right_margin = H_SYNC_OFFSET;
+	mode->left_margin = (H_ACTIVE + H_BLANKING) -
+		(H_ACTIVE + H_SYNC_OFFSET + H_SYNC_WIDTH);
+	mode->upper_margin = V_BLANKING - V_SYNC_OFFSET - 
+		V_SYNC_WIDTH;
+	mode->lower_margin = V_SYNC_OFFSET;
+	mode->hsync_len = H_SYNC_WIDTH;
+	mode->vsync_len = V_SYNC_WIDTH;
+	if (HSYNC_POSITIVE)
+		mode->sync |= FB_SYNC_HOR_HIGH_ACT;
+	if (VSYNC_POSITIVE)
+		mode->sync |= FB_SYNC_VERT_HIGH_ACT;
+	mode->refresh = PIXEL_CLOCK/((H_ACTIVE + H_BLANKING) *
+				     (V_ACTIVE + V_BLANKING));
+	mode->vmode = 0;
+}
+
+/**
+ * fb_create_modedb - create video mode database
+ * @edid: EDID data
+ * @dbsize: database size
+ *
+ * RETURNS: struct fb_videomode, @dbsize contains length of database
+ *
+ * DESCRIPTION:
+ * This function builds a mode database using the contents of the EDID
+ * data
+ */
+struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize)
+{
+	struct fb_videomode *mode, *m;
+	unsigned char *block;
+	int num = 0, i;
+
+	mode = kmalloc(50 * sizeof(struct fb_videomode), GFP_KERNEL);
+	if (mode == NULL)
+		return NULL;
+	memset(mode, 0, 50 * sizeof(struct fb_videomode));
+
+	if (edid == NULL || !edid_checksum(edid) || 
+	    !edid_check_header(edid)) {
+		kfree(mode);
+		return NULL;
+	}
+
+	*dbsize = 0;
+
+	block = edid + ESTABLISHED_TIMING_1;
+	num += get_est_timing(block, &mode[num]);
+
+	block = edid + STD_TIMING_DESCRIPTIONS_START;
+	for (i = 0; i < STD_TIMING; i++, block += STD_TIMING_DESCRIPTION_SIZE) 
+		num += get_std_timing(block, &mode[num]);
+
+	block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
+	for (i = 0; i < 4; i++, block+= DETAILED_TIMING_DESCRIPTION_SIZE) {
+		if (block[0] == 0x00 && block[1] == 0x00) {
+			if (block[3] == 0xfa) {
+				num += get_dst_timing(block + 5, &mode[num]);
+			}
+		} else  {
+			get_detailed_timing(block, &mode[num]);
+			num++;
 		}
 	}
+	
+	/* Yikes, EDID data is totally useless */
+	if (!num) {
+		kfree(mode);
+		return NULL;
+	}
+
+	*dbsize = num;
+	m = kmalloc(num * sizeof(struct fb_videomode), GFP_KERNEL);
+	if (!m)
+		return mode;
+	memmove(m, mode, num * sizeof(struct fb_videomode));
+	kfree(mode);
+	return m;
+}
 
-	printk("EDID: detected %s %s\n", vendor, monitor);
+/**
+ * fb_destroy_modedb - destroys mode database
+ * @modedb: mode database to destroy
+ *
+ * DESCRIPTION:
+ * Destroy mode database created by fb_create_modedb
+ */
+void fb_destroy_modedb(struct fb_videomode *modedb)
+{
+	if (modedb)
+		kfree(modedb);
+}
 
+/**
+ * fb_get_monitor_limits - get monitor operating limits
+ * @edid: EDID data
+ * @specs: fb_monspecs structure pointer
+ *
+ * DESCRIPTION:
+ * Gets monitor operating limits from EDID data and places them in 
+ * @specs
+ */
+int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs)
+{
+	int i, retval = 1;
+	unsigned char *block;
+
+	if (edid == NULL || specs == NULL)
+		return 1;
+
+	if (!(edid_checksum(edid)))
+		return 1;
+
+	if (!(edid_check_header(edid)))
+		return 1;
+
+	memset(specs, 0, sizeof(struct fb_monspecs));
 	block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
 
+	printk("Monitor Operating Limits: ");
 	for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
-		if (edid_is_timing_block(block)) {
-			parse_timing_block(block, var);
+		if (edid_is_limits_block(block)) {
+			specs->hfmin = H_MIN_RATE * 1000;
+			specs->hfmax = H_MAX_RATE * 1000;
+			specs->vfmin = V_MIN_RATE;
+			specs->vfmax = V_MAX_RATE;
+			specs->dclkmax = (MAX_PIXEL_CLOCK != 10*0xff) ?
+				MAX_PIXEL_CLOCK * 1000000 : 0;
+			specs->gtf = (GTF_SUPPORT) ? 1 : 0;
+			specs->dpms = edid[DPMS_FLAGS];
+			retval = 0;
+			printk("From EDID\n");
+			break;
 		}
 	}
-	return 1;
+	
+	/* estimate monitor limits based on modes supported */
+	if (retval) {
+		struct fb_videomode *modes;
+		int num_modes, i, hz, hscan, pixclock;
+
+		modes = fb_create_modedb(edid, &num_modes);
+		if (!modes) {
+			printk("None Available\n");
+			return 1;
+		}
+
+		retval = 0;
+		for (i = 0; i < num_modes; i++) {
+			hz = modes[i].refresh;
+			pixclock = PICOS2KHZ(modes[i].pixclock) * 1000;
+			hscan = (modes[i].yres * 105 * hz + 5000)/100;
+			
+			if (specs->dclkmax == 0 || specs->dclkmax < pixclock)
+				specs->dclkmax = pixclock;
+			if (specs->dclkmin == 0 || specs->dclkmin > pixclock)
+				specs->dclkmin = pixclock;
+			if (specs->hfmax == 0 || specs->hfmax < hscan)
+				specs->hfmax = hscan;
+			if (specs->hfmin == 0 || specs->hfmin > hscan)
+				specs->hfmin = hscan;
+			if (specs->vfmax == 0 || specs->vfmax < hz)
+				specs->vfmax = hz;
+			if (specs->vfmin == 0 || specs->vfmin > hz)
+				specs->vfmin = hz;
+		}
+		printk("Extrapolated\n");
+		fb_destroy_modedb(modes);
+	}
+	printk("     H: %d-%dKHz V: %d-%dHz DCLK: %dMHz\n", specs->hfmin/1000, specs->hfmax/1000, 
+	       specs->vfmin, specs->vfmax, specs->dclkmax/1000000);
+	return retval;
 }
 
-#ifdef CONFIG_PCI
-char *get_EDID(struct pci_dev *pdev)
+void show_edid(unsigned char *edid)
 {
+	unsigned char *block;
+	int i;
+
+	if (edid == NULL)
+		return;
+
+	if (!(edid_checksum(edid)))
+		return;
+
+	if (!(edid_check_header(edid)))
+		return;
+	printk("========================================\n");
+	printk("Display Information (EDID)\n");
+	printk("========================================\n");
+	printk("   EDID Version %d.%d\n", (int) edid[EDID_STRUCT_VERSION],
+	       (int) edid[EDID_STRUCT_REVISION]);
+
+	parse_vendor_block(edid + ID_MANUFACTURER_NAME);
+
+	printk("   Display Characteristics:\n");
+	parse_display_block(edid + EDID_STRUCT_DISPLAY);
+
+	printk("   Standard Timings\n");
+	block = edid + STD_TIMING_DESCRIPTIONS_START;
+	for (i = 0; i < STD_TIMING; i++, block += STD_TIMING_DESCRIPTION_SIZE) 
+		parse_std_timing_block(block);
+
+	printk("   Supported VESA Modes\n");
+	parse_std_md_block(edid + ESTABLISHED_TIMING_1);
+
+	printk("   Detailed Monitor Information\n");
+	block = edid + DETAILED_TIMING_DESCRIPTIONS_START;
+	for (i = 0; i < 4; i++, block += DETAILED_TIMING_DESCRIPTION_SIZE) {
+		if (edid_is_serial_block(block)) {
+			parse_serial_block(block);
+		} else if (edid_is_ascii_block(block)) {
+			parse_ascii_block(block);
+		} else if (edid_is_limits_block(block)) {
+			parse_limits_block(block);
+		} else if (edid_is_monitor_block(block)) {
+			parse_monitor_block(block);
+		} else if (edid_is_color_block(block)) {
+			parse_color_block(block);
+		} else if (edid_is_std_timings_block(block)) {
+			parse_dst_timing_block(block);
+		} else if (edid_is_timing_block(block)) {
+			parse_detailed_timing_block(block);
+		}
+	}
+	printk("========================================\n");
+}
+
 #ifdef CONFIG_ALL_PPC
+char *get_EDID_from_OF(struct pci_dev *pdev)
+{
 	static char *propnames[] =
 	    { "DFP,EDID", "LCD,EDID", "EDID", "EDID1", NULL };
 	unsigned char *pedid = NULL;
 	struct device_node *dp;
 	int i;
 
+	if (pdev == NULL)
+		return NULL;
 	dp = pci_device_to_OF_node(pdev);
 	while (dp != NULL) {
 		for (i = 0; propnames[i] != NULL; ++i) {
-			pedid =
-			    (unsigned char *) get_property(dp,
-							   propnames[i],
-							   NULL);
+			pedid = (unsigned char *) get_property(dp, propnames[i], NULL);
 			if (pedid != NULL)
 				return pedid;
 		}
 		dp = dp->child;
 	}
+	show_edid(pedid);
 	return pedid;
-#else
-	return NULL;
+}
 #endif
+
+#ifdef CONFIG_X86
+char *get_EDID_from_BIOS(void *dummy)
+{
+	unsigned char *pedid = edid_info.dummy;
+	
+	if (!pedid)
+		return NULL;
+	show_edid(pedid);
+	return pedid;				
 }
 #endif
 
@@ -679,8 +1252,15 @@
 }
 
 EXPORT_SYMBOL(parse_edid);
-#ifdef CONFIG_PCI
-EXPORT_SYMBOL(get_EDID);
+EXPORT_SYMBOL(show_edid);
+#ifdef CONFIG_X86
+EXPORT_SYMBOL(get_EDID_from_BIOS);
+#endif
+#ifdef CONFIG_ALL_PPC
+EXPORT_SYMBOL(get_EDID_from_OF);
 #endif
+EXPORT_SYMBOL(fb_get_monitor_limits);
 EXPORT_SYMBOL(fb_get_mode);
 EXPORT_SYMBOL(fb_validate_mode);
+EXPORT_SYMBOL(fb_create_modedb);
+EXPORT_SYMBOL(fb_destroy_modedb);
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810.h linux-2.5.67-bk6/drivers/video/i810/i810.h
--- linux-2.5.67-bk5/drivers/video/i810/i810.h	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810.h	2003-04-15 04:36:16.000000000 -0700
@@ -120,7 +120,6 @@
 #define MMIO_SIZE                   (512*1024)
 #define GTT_SIZE                    (16*1024) 
 #define RINGBUFFER_SIZE             (64*1024)
-#define PIXMAP_SIZE                 (4 * 4096)
 #define CURSOR_SIZE                 4096 
 #define OFF                         0
 #define ON                          1
@@ -251,7 +250,6 @@
 	struct heap_data         fb;
 	struct heap_data         iring;
 	struct heap_data         cursor_heap;
-	struct heap_data         pixmap;
 	struct vgastate          state;
 	drm_agp_t                *drm_agp;
 	atomic_t                 use_count;
@@ -259,11 +257,6 @@
 	u32 pci_state[16];
 	unsigned long mmio_start_phys;
 	u8 *mmio_start_virtual;
-	u32 cursor_reset;
-	u8  red[64];
-	u8  green[64];
-	u8  blue[64];
-	u32 pixmap_offset;
 	u32 pitch;
 	u32 pixconf;
 	u32 watermark;
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810_accel.c linux-2.5.67-bk6/drivers/video/i810/i810_accel.c
--- linux-2.5.67-bk5/drivers/video/i810/i810_accel.c	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810_accel.c	2003-04-15 04:36:16.000000000 -0700
@@ -9,6 +9,7 @@
  *  more details.
  */
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/fb.h>
 
 #include "i810_regs.h"
@@ -54,8 +55,9 @@
  * The function waits until a free space from the ringbuffer
  * is available 
  */	
-static inline int wait_for_space(struct i810fb_par *par, u32 space)
+static inline int wait_for_space(struct fb_info *info, u32 space)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 head, count = WAIT_COUNT, tail;
 	u8 *mmio = par->mmio_start_virtual;
 
@@ -72,6 +74,7 @@
 	printk("ringbuffer lockup!!!\n");
 	i810_report_error(mmio); 
 	par->dev_flags |= LOCKUP;
+	info->pixmap.scan_align = 1;
 	return 1;
 }
 
@@ -83,11 +86,15 @@
  * This waits for lring(0), iring(1), and batch(3), etc to finish and
  * waits until ringbuffer is empty.
  */
-static inline int wait_for_engine_idle(struct i810fb_par *par)
+static inline int wait_for_engine_idle(struct fb_info *info)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u8 *mmio = par->mmio_start_virtual;
 	int count = WAIT_COUNT;
 
+	if (wait_for_space(info, par->iring.size)) /* flush */
+		return 1;
+
 	while((i810_readw(INSTDONE, mmio) & 0x7B) != 0x7B && --count); 
 	if (count) return 0;
 
@@ -95,6 +102,7 @@
 	printk("INSTDONE: 0x%04x\n", i810_readl(INSTDONE, mmio));
 	i810_report_error(mmio); 
 	par->dev_flags |= LOCKUP;
+	info->pixmap.scan_align = 1;
 	return 1;
 }
 
@@ -106,11 +114,13 @@
  * Checks/waits for sufficent space in ringbuffer of size
  * space.  Returns the tail of the buffer
  */ 
-static inline u32 begin_iring(struct i810fb_par *par, u32 space)
+static inline u32 begin_iring(struct fb_info *info, u32 space)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
 	if (par->dev_flags & ALWAYS_SYNC) 
-		wait_for_engine_idle(par);
-	return wait_for_space(par, space);
+		wait_for_engine_idle(info);
+	return wait_for_space(info, space);
 }
 
 /**
@@ -149,9 +159,11 @@
  */
 static inline void source_copy_blit(int dwidth, int dheight, int dpitch, 
 				    int xdir, int src, int dest, int rop, 
-				    int blit_bpp, struct i810fb_par *par)
+				    int blit_bpp, struct fb_info *info)
 {
-	if (begin_iring(par, 24 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | SOURCE_COPY_BLIT | 4);
 	PUT_RING(xdir | rop << 16 | dpitch | DYN_COLOR_EN | blit_bpp);
@@ -181,9 +193,11 @@
  */
 static inline void color_blit(int width, int height, int pitch,  int dest, 
 			      int rop, int what, int blit_bpp, 
-			      struct i810fb_par *par)
+			      struct fb_info *info)
 {
-	if (begin_iring(par, 24 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | COLOR_BLT | 3);
 	PUT_RING(rop << 16 | pitch | SOLIDPATTERN | DYN_COLOR_EN | blit_bpp);
@@ -220,9 +234,11 @@
 static inline void mono_src_copy_imm_blit(int dwidth, int dheight, int dpitch,
 					  int dsize, int blit_bpp, int rop,
 					  int dest, const u32 *src, int bg,
-					  int fg, struct i810fb_par *par)
+					  int fg, struct fb_info *info)
 {
-	if (begin_iring(par, 24 + (dsize << 2) + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 24 + (dsize << 2) + IRING_PAD)) return;
 
 	PUT_RING(BLIT | MONO_SOURCE_COPY_IMMEDIATE | (4 + dsize));
 	PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch);
@@ -261,9 +277,11 @@
 static inline void mono_src_copy_blit(int dwidth, int dheight, int dpitch, 
 				      int qsize, int blit_bpp, int rop, 
 				      int dest, int src, int bg,
-				      int fg, struct i810fb_par *par)
+				      int fg, struct fb_info *info)
 {
-	if (begin_iring(par, 32 + IRING_PAD)) return;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+
+	if (begin_iring(info, 32 + IRING_PAD)) return;
 
 	PUT_RING(BLIT | MONO_SOURCE_COPY_BLIT | 6);
 	PUT_RING(DYN_COLOR_EN | blit_bpp | rop << 16 | dpitch | 1 << 27);
@@ -277,19 +295,23 @@
 	end_iring(par);
 }
 
-static u32 get_buffer_offset(u32 size, struct i810fb_par *par) 
+static inline void load_front(int offset, struct fb_info *info)
 {
-	u32 offset;
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 
-	if (par->pixmap_offset + size > par->pixmap.size) {
-		wait_for_engine_idle(par);
-		par->pixmap_offset = 0;
-	}
+	if (begin_iring(info, 8 + IRING_PAD)) return;
 
-	offset = par->pixmap_offset;
-	par->pixmap_offset += size;
+	PUT_RING(PARSER | FLUSH);
+	PUT_RING(NOP);
 
-	return offset;
+	end_iring(par);
+
+	if (begin_iring(info, 8 + IRING_PAD)) return;
+
+	PUT_RING(PARSER | FRONT_BUFFER | ((par->pitch >> 3) << 8));
+	PUT_RING((par->fb.offset << 12) + offset);
+
+	end_iring(par);
 }
 
 /**
@@ -338,7 +360,7 @@
 
 	dest = info->fix.smem_start + (dy * info->fix.line_length) + dx;
 	color_blit(width, height, info->fix.line_length, dest, rop, color, 
-		   par->blit_bpp, par);
+		   par->blit_bpp, info);
 }
 	
 void i810fb_copyarea(struct fb_info *info, const struct fb_copyarea *region) 
@@ -377,17 +399,16 @@
 	dest = info->fix.smem_start + (dy * info->fix.line_length) + dx;
 
 	source_copy_blit(width, height, pitch, xdir, src, dest,
-			 PAT_COPY_ROP, par->blit_bpp, par);
+			 PAT_COPY_ROP, par->blit_bpp, info);
 }
 
 void i810fb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
-	u32 fg = 0, bg = 0, s_pitch, d_pitch, size, offset, dst, i, j;
-	u8 *s_addr, *d_addr;
+	u32 fg = 0, bg = 0, size, dst;
 	
 	if (!info->var.accel_flags || par->dev_flags & LOCKUP ||
-	    par->depth == 4 || image->depth != 0) 
+	    par->depth == 4 || image->depth != 1) 
 		return cfb_imageblit(info, image);
 
 	switch (info->var.bits_per_pixel) {
@@ -405,43 +426,17 @@
 	dst = info->fix.smem_start + (image->dy * info->fix.line_length) + 
 		(image->dx * par->depth);
 
-	s_pitch = (image->width+7)/8;
-	d_pitch = (s_pitch + 1) & ~1;
-	size = d_pitch * image->height;
-	if (s_pitch != d_pitch || size & 7) {
-		size += 7;
-		size &= ~7;
-		offset = get_buffer_offset(size, par);		
-		d_addr = par->pixmap.virtual + offset;
-		s_addr = (u8 *) image->data;
-		
-		if (s_pitch == d_pitch) {
-			memcpy_toio(d_addr, s_addr, s_pitch * image->height);
-		} else { 
-			for (i = image->height; i--; ) {
-				for (j = 0; j < s_pitch; j++) 
-					i810_writeb(j, d_addr, s_addr[j]);
-				s_addr += s_pitch;
-				d_addr += d_pitch;
-			}
-		}
-		mono_src_copy_blit(image->width * par->depth, image->height, 
-				   info->fix.line_length, size/8, 
-				   par->blit_bpp, PAT_COPY_ROP, dst, 
-				   par->pixmap.physical + offset,
-				   bg, fg, par);
-	}
-	/*
-	 * immediate blit if width is a multiple of 16 (hardware requirement)
-	 */
-	else {
-		mono_src_copy_imm_blit(image->width * par->depth, 
-				       image->height, info->fix.line_length, 
-				       size/4, par->blit_bpp,
-				       PAT_COPY_ROP, dst, (u32 *) image->data, 
-				       bg, fg, par);
-	} 
-}
+	size = (image->width+7)/8 + 1;
+	size &= ~1;
+	size *= image->height;
+	size += 7;
+	size &= ~7;
+	mono_src_copy_imm_blit(image->width * par->depth, 
+			       image->height, info->fix.line_length, 
+			       size/4, par->blit_bpp,
+			       PAT_COPY_ROP, dst, (u32 *) image->data, 
+			       bg, fg, info);
+} 
 
 int i810fb_sync(struct fb_info *info)
 {
@@ -450,9 +445,19 @@
 	if (!info->var.accel_flags || par->dev_flags & LOCKUP)
 		return 0;
 
-	return wait_for_engine_idle(par);
+	return wait_for_engine_idle(info);
 }
 
+void i810fb_load_front(u32 offset, struct fb_info *info)
+{
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
+	u8 *mmio = par->mmio_start_virtual;
+
+	if (!info->var.accel_flags || par->dev_flags & LOCKUP)
+		i810_writel(DPLYBASE, mmio, par->fb.physical + offset);
+	else 
+		load_front(offset, info);
+}
 
 /**
  * i810fb_init_ringbuffer - initialize the ringbuffer
@@ -463,12 +468,13 @@
  * size and location of the ringbuffer.  It also sets 
  * the head and tail pointers = 0
  */
-void i810fb_init_ringbuffer(struct i810fb_par *par)
+void i810fb_init_ringbuffer(struct fb_info *info)
 {
+	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 tmp1, tmp2;
 	u8 *mmio = par->mmio_start_virtual;
 	
-	wait_for_engine_idle(par);
+	wait_for_engine_idle(info);
 	i810fb_iring_enable(par, OFF);
 	i810_writel(IRING, mmio, 0);
 	i810_writel(IRING + 4, mmio, 0);
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810_dvt.c linux-2.5.67-bk6/drivers/video/i810/i810_dvt.c
--- linux-2.5.67-bk5/drivers/video/i810/i810_dvt.c	2003-04-07 10:32:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810_dvt.c	2003-04-15 04:36:16.000000000 -0700
@@ -289,8 +289,7 @@
 		case 32:
 			wmark = params->bpp24_100;
 		}
-	}
-	else {					
+	} else {					
 		switch (var->bits_per_pixel) {
 		case 8:
 			wmark = params->bpp8_133;
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810_gtf.c linux-2.5.67-bk6/drivers/video/i810/i810_gtf.c
--- linux-2.5.67-bk5/drivers/video/i810/i810_gtf.c	2003-04-07 10:31:42.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810_gtf.c	2003-04-15 04:36:16.000000000 -0700
@@ -1,5 +1,5 @@
 /*-*- linux-c -*-
- *  linux/drivers/video/i810_main.h -- Intel 810 Nondiscrete Video Timings 
+ *  linux/drivers/video/i810_main.h -- Intel 810 Non-discrete Video Timings 
  *                                     (VESA GTF)
  *
  *      Copyright (C) 2001 Antonino Daplas<adaplas@pol.net>
@@ -213,7 +213,7 @@
  * @par: pointer to i810fb_par structure
  *
  * DESCRIPTION:
- * Get's the required watermark based on 
+ * Gets the required watermark based on 
  * pixelclock and RAMBUS frequency.
  * 
  * RETURNS:
@@ -240,8 +240,7 @@
 			wmark = i810_wm_24_100;
 			size = ARRAY_SIZE(i810_wm_24_100);
 		}
-	}	
-	else {
+	} else {
 		switch(var->bits_per_pixel) {
 		case 8:
 			wmark = i810_wm_8_133;
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810_main.c linux-2.5.67-bk6/drivers/video/i810/i810_main.c
--- linux-2.5.67-bk5/drivers/video/i810/i810_main.c	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810_main.c	2003-04-15 04:36:16.000000000 -0700
@@ -631,8 +631,7 @@
 		if (f_out <= target_freq) {
 			n_reg++;
 			diff = target_freq - f_out;
-		}
-		else {
+		} else {
 			m_reg++;
 			diff = f_out - target_freq;
 		}
@@ -926,20 +925,21 @@
 	/*
 	 * Monitor limit
 	 */
+	switch (var->bits_per_pixel) {
+	case 8:
+		info->monspecs.dclkmax = 234000000;
+		break;
+	case 16:
+		info->monspecs.dclkmax = 229000000;
+		break;
+	case 24:
+	case 32:
+		info->monspecs.dclkmax = 204000000;
+		break;
+	}
+	info->monspecs.dclkmin = 15000000;
+
 	if (fb_validate_mode(var, info)) {
-		switch (var->bits_per_pixel) {
-		case 8:
-			info->monspecs.dclkmax = 234000000;
-			break;
-		case 16:
-			info->monspecs.dclkmax = 229000000;
-			break;
-		case 24:
-		case 32:
-			info->monspecs.dclkmax = 204000000;
-			break;
-		}
-		info->monspecs.dclkmin = 15000000;
 		if (fb_get_mode(FB_MAXTIMINGS, 0, var, info))
 			return -EINVAL;
 	}
@@ -1177,31 +1177,21 @@
 		for (i = 0; i < 8; i++) 
 			i810_write_dac((u8) (regno * 8) + i, (u8) red, 
 				       (u8) green, (u8) blue, mmio);
-	}
-				
-	else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR && 
+	} else if (info->fix.visual == FB_VISUAL_DIRECTCOLOR && 
 		 info->var.green.length == 6) {
-		if (!regno) {
-			memset(par->red, 0, 64);
-			memset(par->green, 0, 64);
-			memset(par->blue, 0, 64);
-		}
-
-		par->red[regno] = (u8) red;
-		par->green[regno] = (u8) green;
-		par->blue[regno] = (u8) blue;
+		u8 r, g, b;
 
 		if (regno < 32) {
 			for (i = 0; i < 8; i++) 
 				i810_write_dac((u8) (regno * 8) + i,
-					       (u8) red, par->green[regno*2], 
+					       (u8) red, (u8) green, 
 					       (u8) blue, mmio);
 		}
+		i810_read_dac((u8) (regno*4), &r, &g, &b, mmio);
 		for (i = 0; i < 4; i++) 
-			i810_write_dac((u8) (regno*4) + i, par->red[regno/2],
-				       (u8) green, par->blue[regno/2], mmio);
-	}
-	else {
+			i810_write_dac((u8) (regno*4) + i, r, (u8) green, 
+				       b, mmio);
+	} else if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
 		i810_write_dac((u8) regno, (u8) red, (u8) green,
 			       (u8) blue, mmio);
 	}
@@ -1220,16 +1210,14 @@
 					((u32 *)info->pseudo_palette)[regno] = 
 						(regno << 11) | (regno << 5) |
 						regno;
-			}
-			else {
+			} else {
 				if (info->var.green.length == 5) {
 					/* RGB 555 */
 					((u32 *)info->pseudo_palette)[regno] = 
 						((red & 0xf800) >> 1) |
 						((green & 0xf800) >> 6) |
 						((blue & 0xf800) >> 11);
-				}
-				else {
+				} else {
 					/* RGB 565 */
 					((u32 *)info->pseudo_palette)[regno] =
 						(red & 0xf800) |
@@ -1260,11 +1248,10 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 total;
-	u8 *mmio = par->mmio_start_virtual;
 	
 	total = var->xoffset * par->depth + 
 		var->yoffset * info->fix.line_length;
-	i810_writel(DPLYBASE, mmio, par->fb.physical + total);
+	i810fb_load_front(total, info);
 
 	return 0;
 }
@@ -1314,9 +1301,14 @@
 	decode_var(&info->var, par);
 	i810_load_regs(par);
 	i810_init_cursor(par);
-	par->cursor_reset = 1;
+
 	encode_fix(&info->fix, info);
 
+	if (info->var.accel_flags && !(par->dev_flags & LOCKUP)) 
+		info->pixmap.scan_align = 2;
+	else 
+		info->pixmap.scan_align = 1;
+	
 	return 0;
 }
 
@@ -1345,78 +1337,73 @@
 
 static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
-	static u8 data[64 * 8];
 	struct i810fb_par *par = (struct i810fb_par *)info->par;
 	u8 *mmio = par->mmio_start_virtual;	
-	u16 flags = cursor->set;
-
+	u8 data[64 * 8];
+	
 	if (!info->var.accel_flags || par->dev_flags & LOCKUP) 
 		return soft_cursor(info, cursor);
 
-	if (cursor->image.width > 64 || cursor->image.height > 64 ||
-	    (cursor->dest == NULL && cursor->rop == ROP_XOR))
-		return 1;
+	if (cursor->image.width > 64 || cursor->image.height > 64)
+		return -ENXIO;
 
-	if ((i810_readl(CURBASE, mmio) & 0xf) != par->cursor_heap.physical) {
+	if ((i810_readl(CURBASE, mmio) & 0xf) != par->cursor_heap.physical)
 		i810_init_cursor(par);
-		par->cursor_reset = 1;
-	}
 
-	if (par->cursor_reset) {
-		flags = FB_CUR_SETALL;
-		par->cursor_reset = 0;
-	}
-	
 	i810_enable_cursor(mmio, OFF);
 
-	if (flags & FB_CUR_SETPOS) {
+	if (cursor->set & FB_CUR_SETHOT)
+		info->cursor.hot = cursor->hot;
+	
+	if (cursor->set & FB_CUR_SETPOS) {
 		u32 tmp;
 
+		info->cursor.image.dx = cursor->image.dx;
+		info->cursor.image.dy = cursor->image.dy;
+		
 		tmp = cursor->image.dx - info->var.xoffset;
 		tmp |= (cursor->image.dy - info->var.yoffset) << 16;
 	    
 		i810_writel(CURPOS, mmio, tmp);
 	}
 
-	if (flags & FB_CUR_SETSIZE) {
+	if (cursor->set & FB_CUR_SETSIZE) {
+		info->cursor.image.height = cursor->image.height;
+		info->cursor.image.width = cursor->image.width;
 		i810_reset_cursor_image(par);
 	}
 
-	if (flags & FB_CUR_SETCMAP) {
+	if (cursor->set & FB_CUR_SETCMAP) {
+		info->cursor.image.fg_color = cursor->image.fg_color;
+		info->cursor.image.bg_color = cursor->image.bg_color;
 		i810_load_cursor_colors(cursor->image.fg_color,
 					cursor->image.bg_color,
 					info);
 	}
 
-	if (flags & (FB_CUR_SETDEST | FB_CUR_SETSHAPE)) {
-		int size = ((cursor->image.width + 7)/8) * 
-			cursor->image.height;
+	if (cursor->set & FB_CUR_SETSHAPE) {
+		int size = ((info->cursor.image.width + 7) >> 3) * 
+			     info->cursor.image.height;
 		int i;
 
-		switch (cursor->rop) {
+		switch (info->cursor.rop) {
 		case ROP_XOR:
-			for (i = 0; i < size; i++) {
-				data[i] = ((cursor->image.data[i] & 
-					    cursor->mask[i]) ^
-					   cursor->dest[i]);
-			}
+			for (i = 0; i < size; i++)
+				data[i] = cursor->image.data[i] ^ info->cursor.mask[i]; 
 			break;
 		case ROP_COPY:
 		default:
-			for (i = 0; i < size; i++) {
-				data[i] = cursor->image.data[i] & 
-					cursor->mask[i];
-			}
+			for (i = 0; i < size; i++)
+				data[i] = cursor->image.data[i] & info->cursor.mask[i]; 
 			break;
 		}
-		i810_load_cursor_image(cursor->image.width, 
-				       cursor->image.height, data,
+		i810_load_cursor_image(info->cursor.image.width, 
+				       info->cursor.image.height, data,
 				       par);
 	}
 
-	if (cursor->enable)
+	if (info->cursor.enable)
 		i810_enable_cursor(mmio, ON);
-		
 	return 0;
 }
 
@@ -1512,10 +1499,6 @@
 		(par->iring.offset << 12);
 	par->cursor_heap.virtual = par->aperture.virtual+
 		(par->cursor_heap.offset << 12);
-	par->pixmap.virtual = par->aperture.virtual + 
-		(par->pixmap.offset << 12);
-	par->pixmap.physical = par->aperture.physical + 
-		(par->pixmap.offset << 12);
 }
 
 static void __init i810_fix_offsets(struct i810fb_par *par)
@@ -1531,10 +1514,7 @@
 	par->fb.offset = v_offset_default << 20;
 	par->fb.offset >>= 12;
 
-	par->pixmap.offset = par->fb.offset + (par->fb.size >> 12);
-	par->pixmap.size = PIXMAP_SIZE;
-
-	par->iring.offset = par->pixmap.offset + (PIXMAP_SIZE >> 12);
+	par->iring.offset = par->fb.offset + (par->fb.size >> 12);
 	par->iring.size = RINGBUFFER_SIZE;
 
 	par->cursor_heap.offset = par->iring.offset + (RINGBUFFER_SIZE >> 12);
@@ -1547,7 +1527,7 @@
 	int size;
 	
 	i810_fix_offsets(par);
-	size = par->fb.size + par->iring.size + par->pixmap.size;
+	size = par->fb.size + par->iring.size;
 
 	par->drm_agp = (drm_agp_t *) inter_module_get("drm_agp");
 	if (!par->drm_agp) {
@@ -1637,23 +1617,20 @@
 static void __init i810_init_defaults(struct i810fb_par *par, 
 				      struct fb_info *info)
 {
-	if (voffset) {
+	if (voffset) 
 		v_offset_default = voffset;
-	}
-	else {
-		if (par->aperture.size > 32 * 1024 * 1024)
-			v_offset_default = 16;
-		else
-			v_offset_default = 8;
-	}
+	else if (par->aperture.size > 32 * 1024 * 1024)
+		v_offset_default = 16;
+	else
+		v_offset_default = 8;
 
 	if (!vram) 
 		vram = 1;
 
-	if (accel)
+	if (accel) 
 		par->dev_flags |= HAS_ACCELERATION;
 
-	if (sync)
+	if (sync) 
 		par->dev_flags |= ALWAYS_SYNC;
 
 	if (bpp < 8)
@@ -1698,8 +1675,6 @@
 	pci_read_config_byte(par->dev, 0x50, &reg);
 	reg &= FREQ_MASK;
 	par->mem_freq = (reg) ? 133 : 100;
-
-	i810fb_init_ringbuffer(par);
 }
 
 static int __init 
@@ -1718,8 +1693,7 @@
 		par->aperture.physical = pci_resource_start(par->dev, 0);
 		par->aperture.size = pci_resource_len(par->dev, 0);
 		par->mmio_start_phys = pci_resource_start(par->dev, 1);
-	}
-	else {
+	} else {
 		par->aperture.physical = pci_resource_start(par->dev, 1);
 		par->aperture.size = pci_resource_len(par->dev, 1);
 		par->mmio_start_phys = pci_resource_start(par->dev, 0);
@@ -1737,7 +1711,7 @@
 	}
 	par->res_flags |= FRAMEBUFFER_REQ;
 
-	par->aperture.virtual = ioremap(par->aperture.physical, 
+	par->aperture.virtual = ioremap_nocache(par->aperture.physical, 
 					par->aperture.size);
 	if (!par->aperture.virtual) {
 		printk("i810fb_init: cannot remap framebuffer region\n");
@@ -1766,7 +1740,6 @@
 {
 	char *this_opt, *suffix = NULL;
 
-	i810_init = 1;
 	if (!options || !*options)
 		return 0;
 	
@@ -1795,13 +1768,11 @@
 			hsync1 = simple_strtoul(this_opt+7, &suffix, 0);
 			if (strncmp(suffix, "H", 1)) 
 				hsync1 *= 1000;
-		} 
-		else if (!strncmp(this_opt, "hsync2:", 7)) {
+		} else if (!strncmp(this_opt, "hsync2:", 7)) {
 			hsync2 = simple_strtoul(this_opt+7, &suffix, 0);
 			if (strncmp(suffix, "H", 1)) 
 				hsync2 *= 1000;
-		} 
-		else if (!strncmp(this_opt, "vsync1:", 7)) 
+		} else if (!strncmp(this_opt, "vsync1:", 7)) 
 			vsync1 = simple_strtoul(this_opt+7, NULL, 0);
 		else if (!strncmp(this_opt, "vsync2:", 7))
 			vsync2 = simple_strtoul(this_opt+7, NULL, 0);
@@ -1812,15 +1783,12 @@
 }
 
 static int __init i810fb_init_pci (struct pci_dev *dev, 
-				      const struct pci_device_id *entry)
+				   const struct pci_device_id *entry)
 {
 	struct fb_info    *info;
 	struct i810fb_par *par = NULL;
 	int err, vfreq, hfreq, pixclock;
 
-	if (!i810_init)
-		return -EINVAL;
-
 	if (!(info = kmalloc(sizeof(struct fb_info), GFP_KERNEL))) {
 		i810fb_release_resource(info, par);
 		return -ENOMEM;
@@ -1836,6 +1804,15 @@
 	par->dev = dev;
 	info->par = par;
 
+	if (!(info->pixmap.addr = kmalloc(64*1024, GFP_KERNEL))) {
+		i810fb_release_resource(info, par);
+		return -ENOMEM;
+	}
+	memset(info->pixmap.addr, 0, 64*1024);
+	info->pixmap.size = 64*1024;
+	info->pixmap.buf_align = 8;
+	info->pixmap.flags = FB_PIXMAP_SYSTEM;
+
 	if ((err = i810_allocate_pci_resource(par, entry))) {
 		i810fb_release_resource(info, par);
 		return err;
@@ -1864,6 +1841,7 @@
 	}
 	encode_fix(&info->fix, info); 
 	 	    
+	i810fb_init_ringbuffer(info);
 	err = register_framebuffer(info);
 	if (err < 0) {
     		i810fb_release_resource(info, par); 
@@ -1894,7 +1872,7 @@
 }
 
 /***************************************************************
- *                     Deinitialization                        *
+ *                     De-initialization                        *
  ***************************************************************/
 
 static void i810fb_release_resource(struct fb_info *info, 
@@ -1931,7 +1909,7 @@
 
 		kfree(par);
 	}
-	if (info)
+	if (info) 
 		kfree(info);
 }
 
@@ -1974,7 +1952,6 @@
 
 int __init i810fb_init(void)
 {
-	i810_init = 1;
 	hsync1 *= 1000;
 	hsync2 *= 1000;
 
@@ -1994,14 +1971,14 @@
 MODULE_PARM_DESC(bpp, "Color depth for display in bits per pixel"
 		 " (default = 8)");
 MODULE_PARM(xres, "i");
-MODULE_PARM_DESC(xres, "Hozizontal resolution in pixels (default = 640)");
+MODULE_PARM_DESC(xres, "Horizontal resolution in pixels (default = 640)");
 MODULE_PARM(yres, "i");
 MODULE_PARM_DESC(yres, "Vertical resolution in scanlines (default = 480)");
 MODULE_PARM(vyres, "i");
 MODULE_PARM_DESC(vyres, "Virtual vertical resolution in scanlines"
 		 " (default = 480)");
 MODULE_PARM(hsync1, "i");
-MODULE_PARM_DESC(hsync1, "Mimimum horizontal frequency of monitor in KHz"
+MODULE_PARM_DESC(hsync1, "Minimum horizontal frequency of monitor in KHz"
 		 " (default = 31)");
 MODULE_PARM(hsync2, "i");
 MODULE_PARM_DESC(hsync2, "Maximum horizontal frequency of monitor in KHz"
diff -urN linux-2.5.67-bk5/drivers/video/i810/i810_main.h linux-2.5.67-bk6/drivers/video/i810/i810_main.h
--- linux-2.5.67-bk5/drivers/video/i810/i810_main.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/i810/i810_main.h	2003-04-15 04:36:16.000000000 -0700
@@ -55,7 +55,6 @@
 	.resume   =     i810fb_resume,
 };	
 
-static int i810_init  __initdata = 0;
 static int vram       __initdata = 4;
 static int bpp        __initdata = 8;
 static int mtrr       __initdata = 0;
@@ -132,7 +131,8 @@
 extern void i810fb_imageblit(struct fb_info *p, const struct fb_image *image);
 extern int  i810fb_sync     (struct fb_info *p);
 
-extern void i810fb_init_ringbuffer   (struct i810fb_par *par);
+extern void i810fb_init_ringbuffer(struct fb_info *info);
+extern void i810fb_load_front     (u32 offset, struct fb_info *info);
 
 /* Conditionals */
 #if defined(__i386__)
diff -urN linux-2.5.67-bk5/drivers/video/imsttfb.c linux-2.5.67-bk6/drivers/video/imsttfb.c
--- linux-2.5.67-bk5/drivers/video/imsttfb.c	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/imsttfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -409,7 +409,7 @@
 static inline u32 read_reg_le32(volatile u32 *base, int regindex)
 {
 #ifdef __powerpc__
-	in_le32((volatile u32 *) (base + regindex));
+	return in_le32((volatile u32 *) (base + regindex));
 #else
 	return readl(base + regindex);
 #endif
@@ -1211,7 +1211,7 @@
 	if (flags & FB_CUR_SETSIZE) {
         }
 
-        if (flags & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETDEST)) {
+        if (flags & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP)) {
                 int fg_idx = cursor->image.fg_color;
                 int width = (cursor->image.width+7)/8;
                 u8 *dat = (u8 *) cursor->image.data;
diff -urN linux-2.5.67-bk5/drivers/video/logo/logo.c linux-2.5.67-bk6/drivers/video/logo/logo.c
--- linux-2.5.67-bk5/drivers/video/logo/logo.c	2003-04-07 10:31:46.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/logo/logo.c	2003-04-15 04:36:16.000000000 -0700
@@ -33,69 +33,64 @@
 extern const struct linux_logo logo_superh_clut224;
 
 
-const struct linux_logo * __init fb_find_logo(int type)
+const struct linux_logo * __init find_logo(int depth)
 {
 	const struct linux_logo *logo = 0;
 
-	switch (type) {
-		case LINUX_LOGO_MONO:
+	if (depth >= 1) {
 #ifdef CONFIG_LOGO_LINUX_MONO
-			/* Generic Linux logo */
-			logo = &logo_linux_mono;
+		/* Generic Linux logo */
+		logo = &logo_linux_mono;
 #endif
 #ifdef CONFIG_LOGO_SUPERH_MONO
-			/* SuperH Linux logo */
-			logo = &logo_superh_mono;
+		/* SuperH Linux logo */
+		logo = &logo_superh_mono;
 #endif
-			break;
-
-		case LINUX_LOGO_VGA16:
+	}
+	
+	if (depth >= 4) {
 #ifdef CONFIG_LOGO_LINUX_VGA16
-			/* Generic Linux logo */
-			logo = &logo_linux_vga16;
+		/* Generic Linux logo */
+		logo = &logo_linux_vga16;
 #endif
 #ifdef CONFIG_LOGO_SUPERH_VGA16
-			/* SuperH Linux logo */
-			logo = &logo_superh_vga16;
+		/* SuperH Linux logo */
+		logo = &logo_superh_vga16;
 #endif
-			break;
-
-		case LINUX_LOGO_CLUT224:
+	}
+	
+	if (depth >= 8) {
 #ifdef CONFIG_LOGO_LINUX_CLUT224
-			/* Generic Linux logo */
-			logo = &logo_linux_clut224;
+		/* Generic Linux logo */
+		logo = &logo_linux_clut224;
 #endif
 #ifdef CONFIG_LOGO_DEC_CLUT224
-			/* DEC Linux logo on MIPS/MIPS64 */
-			if (mips_machgroup == MACH_GROUP_SGI)
-				logo = &logo_dec_clut224;
+		/* DEC Linux logo on MIPS/MIPS64 */
+		if (mips_machgroup == MACH_GROUP_SGI)
+			logo = &logo_dec_clut224;
 #endif
 #ifdef CONFIG_LOGO_MAC_CLUT224
-			/* Macintosh Linux logo on m68k */
-			if (MACH_IS_MAC)
-				logo = &logo_mac_clut224;
+		/* Macintosh Linux logo on m68k */
+		if (MACH_IS_MAC)
+			logo = &logo_mac_clut224;
 #endif
 #ifdef CONFIG_LOGO_PARISC_CLUT224
-			/* PA-RISC Linux logo */
-			logo = &logo_parisc_clut224;
+		/* PA-RISC Linux logo */
+		logo = &logo_parisc_clut224;
 #endif
 #ifdef CONFIG_LOGO_SGI_CLUT224
-			/* SGI Linux logo on MIPS/MIPS64 ans VisWs 320/540 */
-#ifndef CONFIG_X86_VISWS
-			if (mips_machgroup == MACH_GROUP_SGI)
-#endif
-				logo = &logo_sgi_clut224;
+		/* SGI Linux logo on MIPS/MIPS64 */
+		if (mips_machgroup == MACH_GROUP_SGI)
+			logo = &logo_sgi_clut224;
 #endif
 #ifdef CONFIG_LOGO_SUN_CLUT224
-			/* Sun Linux logo */
-			logo = &logo_sun_clut224;
+		/* Sun Linux logo */
+		logo = &logo_sun_clut224;
 #endif
 #ifdef CONFIG_LOGO_SUPERH_CLUT224
-			/* SuperH Linux logo */
-			logo = &logo_superh_clut224;
+		/* SuperH Linux logo */
+		logo = &logo_superh_clut224;
 #endif
-			break;
-
 	}
 	return logo;
 }
diff -urN linux-2.5.67-bk5/drivers/video/modedb.c linux-2.5.67-bk6/drivers/video/modedb.c
--- linux-2.5.67-bk5/drivers/video/modedb.c	2003-04-07 10:31:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/modedb.c	2003-04-15 04:36:16.000000000 -0700
@@ -251,6 +251,110 @@
     },
 };
 
+const struct fb_videomode vesa_modes[] = {
+	/* 0 640x350-85 VESA */
+	{ NULL, 85, 640, 350, 31746,  96, 32, 60, 32, 64, 3,
+	  FB_SYNC_HOR_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 1 640x400-85 VESA */
+	{ NULL, 85, 640, 400, 31746,  96, 32, 41, 01, 64, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 2 720x400-85 VESA */
+	{ NULL, 85, 721, 400, 28169, 108, 36, 42, 01, 72, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 3 640x480-60 VESA */
+	{ NULL, 60, 640, 480, 39682,  48, 16, 33, 10, 96, 2, 
+	  0, FB_VMODE_NONINTERLACED },
+	/* 4 640x480-72 VESA */
+	{ NULL, 72, 640, 480, 31746, 128, 24, 29, 9, 40, 2, 
+	  0, FB_VMODE_NONINTERLACED },
+	/* 5 640x480-75 VESA */
+	{ NULL, 75, 640, 480, 31746, 120, 16, 16, 01, 64, 3,
+	  0, FB_VMODE_NONINTERLACED },
+	/* 6 640x480-85 VESA */
+	{ NULL, 85, 640, 480, 27777, 80, 56, 25, 01, 56, 3,
+	  0, FB_VMODE_NONINTERLACED },
+	/* 7 800x600-56 VESA */
+	{ NULL, 56, 800, 600, 27777, 128, 24, 22, 01, 72, 2,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 8 800x600-60 VESA */
+	{ NULL, 60, 800, 600, 25000, 88, 40, 23, 01, 128, 4,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 9 800x600-72 VESA */
+	{ NULL, 72, 800, 600, 20000, 64, 56, 23, 37, 120, 6,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 10 800x600-75 VESA */
+	{ NULL, 75, 800, 600, 20202, 160, 16, 21, 01, 80, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 11 800x600-85 VESA */
+	{ NULL, 85, 800, 600, 17761, 152, 32, 27, 01, 64, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+        /* 12 1024x768i-43 VESA */
+	{ NULL, 53, 1024, 768, 22271, 56, 8, 41, 0, 176, 8,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_INTERLACED },
+	/* 13 1024x768-60 VESA */
+	{ NULL, 60, 1024, 768, 15384, 160, 24, 29, 3, 136, 6,
+	  0, FB_VMODE_NONINTERLACED },
+	/* 14 1024x768-70 VESA */
+	{ NULL, 70, 1024, 768, 13333, 144, 24, 29, 3, 136, 6,
+	  0, FB_VMODE_NONINTERLACED },
+	/* 15 1024x768-75 VESA */
+	{ NULL, 75, 1024, 768, 12690, 176, 16, 28, 1, 96, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 16 1024x768-85 VESA */
+	{ NULL, 85, 1024, 768, 10582, 208, 48, 36, 1, 96, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 17 1152x864-75 VESA */
+	{ NULL, 75, 1153, 864, 9259, 256, 64, 32, 1, 128, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 18 1280x960-60 VESA */
+	{ NULL, 60, 1280, 960, 9259, 312, 96, 36, 1, 112, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 19 1280x960-85 VESA */
+	{ NULL, 85, 1280, 960, 6734, 224, 64, 47, 1, 160, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 20 1280x1024-60 VESA */
+	{ NULL, 60, 1280, 1024, 9259, 248, 48, 38, 1, 112, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 21 1280x1024-75 VESA */
+	{ NULL, 75, 1280, 1024, 7407, 248, 16, 38, 1, 144, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 22 1280x1024-85 VESA */
+	{ NULL, 85, 1280, 1024, 6349, 224, 64, 44, 1, 160, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 23 1600x1200-60 VESA */
+	{ NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 24 1600x1200-65 VESA */
+	{ NULL, 65, 1600, 1200, 5698, 304,  64, 46, 1, 192, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 25 1600x1200-70 VESA */
+	{ NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 26 1600x1200-75 VESA */
+	{ NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3, 
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 27 1600x1200-85 VESA */
+	{ NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3,
+	  FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 28 1792x1344-60 VESA */
+	{ NULL, 60, 1792, 1344, 4882, 328, 128, 46, 1, 200, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 29 1792x1344-75 VESA */
+	{ NULL, 75, 1792, 1344, 3831, 352, 96, 69, 1, 216, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 30 1856x1392-60 VESA */
+	{ NULL, 60, 1856, 1392, 4580, 352, 96, 43, 1, 224, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 31 1856x1392-75 VESA */
+	{ NULL, 75, 1856, 1392, 3472, 352, 128, 104, 1, 224, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 32 1920x1440-60 VESA */
+	{ NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 200, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+	/* 33 1920x1440-75 VESA */
+	{ NULL, 60, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3,
+	  FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED },
+};
 
 static int __init my_atoi(const char *name)
 {
@@ -432,3 +536,4 @@
 }
 
 EXPORT_SYMBOL(__fb_try_mode);
+EXPORT_SYMBOL(vesa_modes);
diff -urN linux-2.5.67-bk5/drivers/video/platinumfb.c linux-2.5.67-bk6/drivers/video/platinumfb.c
--- linux-2.5.67-bk5/drivers/video/platinumfb.c	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/platinumfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -36,8 +36,8 @@
 #include <asm/prom.h>
 #include <asm/pgtable.h>
 
-#include "platinumfb.h"
 #include "macmodes.h"
+#include "platinumfb.h"
 
 static int default_vmode = VMODE_NVRAM;
 static int default_cmode = CMODE_NVRAM;
@@ -219,15 +219,14 @@
 
 	if (regno < 16) {
 		int i;
+		u32 *pal = info->pseudo_palette;
 		switch (p->par.cmode) {
 		case CMODE_16:
-			((u16 *) (info->pseudo_palette))[regno] =
-			    (regno << 10) | (regno << 5) | regno;
+			pal[regno] = (regno << 10) | (regno << 5) | regno;
 			break;
 		case CMODE_32:
 			i = (regno << 8) | regno;
-			((u32 *) (info->pseudo_palette))[regno] =
-			    (i << 16) | i;
+			pal[regno] = (i << 16) | i;
 			break;
 		}
 	}
@@ -401,7 +400,7 @@
 	/* Apply default var */
 	p->info.var = var;
 	var.activate = FB_ACTIVATE_NOW;
-	rc = gen_set_var(&var, -1, &p->info);
+	rc = fb_set_var(&var, &p->info);
 	if (rc && (default_vmode != VMODE_640_480_60 || default_cmode != CMODE_8))
 		goto try_again;
 
@@ -410,7 +409,7 @@
 		return 0;
 
 	printk(KERN_INFO "fb%d: platinum frame buffer device\n",
-	       GET_FB_IDX(p->info.node));
+	       minor(p->info.node));
 
 	return 1;
 }
@@ -607,21 +606,10 @@
 		return 0;
 
 	while ((this_opt = strsep(&options, ",")) != NULL) {
-		if (!strncmp(this_opt, "font:", 5)) {
-			char *p;
-			int i;
-
-			p = this_opt + 5;
-			for (i = 0; i < sizeof(fontname) - 1; i++)
-				if (!*p || *p == ' ' || *p == ',')
-					break;
-			memcpy(fontname, this_opt + 5, i);
-			fontname[i] = 0;
-		}
 		if (!strncmp(this_opt, "vmode:", 6)) {
 	    		int vmode = simple_strtoul(this_opt+6, NULL, 0);
-	    	if (vmode > 0 && vmode <= VMODE_MAX)
-			default_vmode = vmode;
+			if (vmode > 0 && vmode <= VMODE_MAX)
+				default_vmode = vmode;
 		} else if (!strncmp(this_opt, "cmode:", 6)) {
 			int depth = simple_strtoul(this_opt+6, NULL, 0);
 			switch (depth) {
diff -urN linux-2.5.67-bk5/drivers/video/pm2fb.c linux-2.5.67-bk6/drivers/video/pm2fb.c
--- linux-2.5.67-bk5/drivers/video/pm2fb.c	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/pm2fb.c	2003-04-15 04:36:16.000000000 -0700
@@ -1434,24 +1434,24 @@
 }
 
 static struct display_switch pm2_cfb8 = {
-	.setup =	fbcon_cfb8_setup,
-	.bmove =	pm2fb_pp_bmove,
+	.setup		= fbcon_cfb8_setup,
+	.bmove		= pm2fb_pp_bmove,
 #ifdef __alpha__
 	/* Not sure why, but this works and the other does not. */
 	/* Also, perhaps we need a separate routine to wait for the
 	   blitter to stop before doing this? */
 	/* In addition, maybe we need to do this for 16 and 32 bit depths? */
-	.clear =	fbcon_cfb8_clear,
+	.clear		= fbcon_cfb8_clear,
 #else
-	.clear =	pm2fb_clear8,
+	.clear		= pm2fb_clear8,
 #endif
-	.putc =		fbcon_cfb8_putc,
-	.putcs =	fbcon_cfb8_putcs,
-	.revc =		fbcon_cfb8_revc,
-	.cursor =	pm2fb_cursor,
-	.set_font =	pm2fb_set_font,
-	.clear_margins =pm2fb_clear_margins8,
-	fontwidthmask:	FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) };
+	.putc		= fbcon_cfb8_putc,
+	.putcs		= fbcon_cfb8_putcs,
+	.revc		= fbcon_cfb8_revc,
+	.cursor		= pm2fb_cursor,
+	.set_font	= pm2fb_set_font,
+	.clear_margins	= pm2fb_clear_margins8,
+	.fontwidthmask	= FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) };
 #endif /* FBCON_HAS_CFB8 */
 
 #ifdef FBCON_HAS_CFB16
diff -urN linux-2.5.67-bk5/drivers/video/radeonfb.c linux-2.5.67-bk6/drivers/video/radeonfb.c
--- linux-2.5.67-bk5/drivers/video/radeonfb.c	2003-04-07 10:32:52.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/radeonfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -121,7 +121,8 @@
 	RADEON_ND,
 	RADEON_NE,
 	RADEON_NF,
-	RADEON_NG
+	RADEON_NG,
+	RADEON_QM
 };
 
 enum radeon_arch {
@@ -168,7 +169,8 @@
 	{ "9700 ND", RADEON_R300 },
 	{ "9700 NE", RADEON_R300 },
 	{ "9700 NF", RADEON_R300 },
-	{ "9700 NG", RADEON_R300 }
+	{ "9700 NG", RADEON_R300 },
+	{ "9100 QM", RADEON_R200 }
 };
 
 
@@ -213,6 +215,7 @@
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NE},
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NF},
 	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_NG, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_NG},
+	{ PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RADEON_QM, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RADEON_QM},
 	{ 0, }
 };
 MODULE_DEVICE_TABLE(pci, radeonfb_pci_table);
@@ -881,6 +884,16 @@
 				rinfo->pll.ref_div = 12;
 				rinfo->pll.ref_clk = 2700;
 				break;
+			case PCI_DEVICE_ID_ATI_RADEON_ND:
+			case PCI_DEVICE_ID_ATI_RADEON_NE:
+			case PCI_DEVICE_ID_ATI_RADEON_NF:
+			case PCI_DEVICE_ID_ATI_RADEON_NG:
+				rinfo->pll.ppll_max = 40000;
+				rinfo->pll.ppll_min = 20000;
+				rinfo->pll.xclk = 27000;
+				rinfo->pll.ref_div = 12;
+				rinfo->pll.ref_clk = 2700;
+				break;
 			case PCI_DEVICE_ID_ATI_RADEON_QD:
 			case PCI_DEVICE_ID_ATI_RADEON_QE:
 			case PCI_DEVICE_ID_ATI_RADEON_QF:
@@ -1287,7 +1300,6 @@
 	fb_alloc_cmap(&info->cmap, 256, 0);
 
 	var.activate = FB_ACTIVATE_NOW;
-	fb_set_var(&var, info);
         return 0;
 }
 
@@ -2926,7 +2938,7 @@
 		switch (pdev->device) {
 			case PCI_DEVICE_ID_ATI_RADEON_LY:
 			case PCI_DEVICE_ID_ATI_RADEON_LZ:
-				rinfo->video_ram = 8192;
+				rinfo->video_ram = 8192 * 1024;
 				break;
 			default:
 				break;
@@ -3111,10 +3123,10 @@
 
 
 static struct pci_driver radeonfb_driver = {
-	name:		"radeonfb",
-	id_table:	radeonfb_pci_table,
-	probe:		radeonfb_pci_register,
-	remove:		__devexit_p(radeonfb_pci_unregister),
+	.name		= "radeonfb",
+	.id_table	= radeonfb_pci_table,
+	.probe		= radeonfb_pci_register,
+	.remove		= __devexit_p(radeonfb_pci_unregister),
 };
 
 
diff -urN linux-2.5.67-bk5/drivers/video/retz3fb.c linux-2.5.67-bk6/drivers/video/retz3fb.c
--- linux-2.5.67-bk5/drivers/video/retz3fb.c	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/retz3fb.c	2003-04-15 04:36:16.000000000 -0700
@@ -1589,13 +1589,13 @@
 
 
 static struct display_switch fbcon_retz3_8 = {
-    setup:		fbcon_cfb8_setup,
-    bmove:		retz3_8_bmove,
-    clear:		retz3_8_clear,
-    putc:		retz3_putc,
-    putcs:		retz3_putcs,
-    revc:		retz3_revc,
-    clear_margins:	retz3_clear_margins,
-    fontwidthmask:	FONTWIDTH(8)
+	.setup		= fbcon_cfb8_setup,
+	.bmove		= retz3_8_bmove,
+	.clear		= retz3_8_clear,
+	.putc		= retz3_putc,
+	.putcs		= retz3_putcs,
+	.revc		= retz3_revc,
+	.clear_margins	= retz3_clear_margins,
+	.fontwidthmask	= FONTWIDTH(8)
 };
 #endif
diff -urN linux-2.5.67-bk5/drivers/video/riva/fbdev.c linux-2.5.67-bk6/drivers/video/riva/fbdev.c
--- linux-2.5.67-bk5/drivers/video/riva/fbdev.c	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/riva/fbdev.c	2003-04-15 04:36:16.000000000 -0700
@@ -420,6 +420,50 @@
 	return (VGA_RD08(par->riva.PVIO, 0x3cc));
 }
 
+static u8 byte_rev[256] = {
+	0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+	0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+	0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+	0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+	0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+	0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+	0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+	0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+	0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+	0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+	0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+	0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+	0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+	0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+	0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+	0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+	0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+	0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+	0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+	0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+	0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+	0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+	0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+	0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+	0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+	0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+	0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+	0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+	0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+	0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+	0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+	0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
+};
+
+static inline void reverse_order(u32 *l)
+{
+	u8 *a = (u8 *)l;
+	*a = byte_rev[*a], a++;
+	*a = byte_rev[*a], a++;
+	*a = byte_rev[*a], a++;
+	*a = byte_rev[*a];
+}
+
 /* ------------------------------------------------------------------------- *
  *
  * cursor stuff
@@ -429,7 +473,6 @@
 /**
  * rivafb_load_cursor_image - load cursor image to hardware
  * @data: address to monochrome bitmap (1 = foreground color, 0 = background)
- * @mask: address to mask (1 = write image pixel, 0 = do not write pixel)
  * @par:  pointer to private data
  * @w:    width of cursor image in pixels
  * @h:    height of cursor image in scanlines
@@ -438,16 +481,15 @@
  *
  * DESCRIPTiON:
  * Loads cursor image based on a monochrome source and mask bitmap.  The
- * mask bit determines if the image pixel is to be written to the framebuffer
- * or not.  The imaage bits determines the color of the pixel, 0 for
- * background, 1 for foreground.  Only the affected region (as determined
- * by @w and @h parameters) will be updated.
+ * image bits determines the color of the pixel, 0 for background, 1 for
+ * foreground.  Only the affected region (as determined by @w and @h 
+ * parameters) will be updated.
  *
  * CALLED FROM:
  * rivafb_cursor()
  */
-static void rivafb_load_cursor_image(u8 *data, u8 *mask, struct riva_par *par,
-                                     int w, int h, u16 bg, u16 fg)
+static void rivafb_load_cursor_image(struct riva_par *par, u8 *data, 
+				     u8 *mask, u16 bg, u16 fg, u32 w, u32 h)
 {
 	int i, j, k = 0;
 	u32 b, m, tmp;
@@ -455,25 +497,40 @@
 	for (i = 0; i < h; i++) {
 		b = *((u32 *)data)++;
 		m = *((u32 *)mask)++;
+		reverse_order(&b);
+		
 		for (j = 0; j < w/2; j++) {
 			tmp = 0;
 #if defined (__BIG_ENDIAN)
-			if (m & (1 << 31))
-				tmp = (b & (1 << 31)) ? fg << 16 : bg << 16;
+			if (m & (1 << 31)) {
+				fg |= 1 << 15;
+				bg |= 1 << 15;
+			}
+			tmp = (b & (1 << 31)) ? fg << 16 : bg << 16;
 			b <<= 1;
 			m <<= 1;
 
-			if (m & (1 << 31))
-				tmp |= (b & (1 << 31)) ? fg : bg;
+			if (m & (1 << 31)) {
+				fg |= 1 << 15;
+				bg |= 1 << 15;
+			}
+			tmp |= (b & (1 << 31)) ? fg : bg;
 			b <<= 1;
 			m <<= 1;
 #else
-			if (m & 1)
-				tmp = (b & 1) ? fg : bg;
+			if (m & 1) {
+				fg |= 1 << 15;
+				bg |= 1 << 15;
+			}
+			tmp = (b & 1) ? fg : bg;
 			b >>= 1;
 			m >>= 1;
-			if (m & 1)
-				tmp |= (b & 1) ? fg << 16 : bg << 16;
+			
+			if (m & 1) {
+				fg |= 1 << 15;
+				bg |= 1 << 15;
+			}
+			tmp |= (b & 1) ? fg << 16 : bg << 16;
 			b >>= 1;
 			m >>= 1;
 #endif
@@ -1104,14 +1161,6 @@
 
 	par->riva.SetStartAddress(&par->riva, base);
 
-	/*
-	 * HACK: The hardware cursor occasionally disappears during fast scrolling.
-	 *       We just reset the cursor each time we change the start address.
-	 *       This also has a beneficial side effect of restoring the cursor
-	 *       image when switching from X.
-	 */
-	par->cursor_reset = 1;
-
 	info->var.xoffset = var->xoffset;
 	info->var.yoffset = var->yoffset;
 
@@ -1311,50 +1360,6 @@
 	wait_for_idle(par);
 }
 
-static u8 byte_rev[256] = {
-	0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
-	0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
-	0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
-	0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
-	0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
-	0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
-	0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
-	0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
-	0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
-	0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
-	0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
-	0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
-	0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
-	0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
-	0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
-	0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
-	0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
-	0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
-	0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
-	0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
-	0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
-	0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
-	0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
-	0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
-	0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
-	0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
-	0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
-	0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
-	0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
-	0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
-	0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
-	0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
-};
-
-static inline void reverse_order(u32 *l)
-{
-	u8 *a = (u8 *)l;
-	*a = byte_rev[*a], a++;
-	*a = byte_rev[*a], a++;
-	*a = byte_rev[*a], a++;
-	*a = byte_rev[*a];
-}
-
 static inline void convert_bgcolor_16(u32 *col)
 {
 	*col = ((*col & 0x00007C00) << 9)
@@ -1388,7 +1393,7 @@
 	volatile u32 *d;
 	int i, size;
 
-	if (image->depth != 0) {
+	if (image->depth != 1) {
 		cfb_imageblit(info, image);
 		return;
 	}
@@ -1463,29 +1468,19 @@
  */
 static int rivafb_cursor(struct fb_info *info, struct fb_cursor *cursor)
 {
-	static u8 data[MAX_CURS*MAX_CURS/8], mask[MAX_CURS*MAX_CURS/8];
 	struct riva_par *par = (struct riva_par *) info->par;
 	int i, j, d_idx = 0, s_idx = 0;
-	u16 flags = cursor->set, fg, bg;
-
-	/*
-	 * Can't do invert if one of the operands (dest) is missing,
-	 * ie, only opaque cursor supported.  This should be
-	 * standard for GUI apps.
-	 */
-	if (cursor->dest == NULL && cursor->rop == ROP_XOR)
-		return 1;
-
-	if (par->cursor_reset) {
-		flags = FB_CUR_SETALL;
-		par->cursor_reset = 0;
-	}
+	u8 data[MAX_CURS * MAX_CURS/8];
+	u8 mask[MAX_CURS * MAX_CURS/8];
+	u16 fg, bg;
 
 	par->riva.ShowHideCursor(&par->riva, 0);
 
-	if (flags & FB_CUR_SETPOS) {
+	if (cursor->set & FB_CUR_SETPOS) {
 		u32 xx, yy, temp;
 
+		info->cursor.image.dx = cursor->image.dx;
+		info->cursor.image.dy = cursor->image.dy;
 		yy = cursor->image.dy - info->var.yoffset;
 		xx = cursor->image.dx - info->var.xoffset;
 		temp = xx & 0xFFFF;
@@ -1494,58 +1489,58 @@
 		par->riva.PRAMDAC[0x0000300/4] = temp;
 	}
 
-	if (flags & FB_CUR_SETSIZE) {
-		memset(data, 0, MAX_CURS * MAX_CURS/8);
-		memset(mask, 0, MAX_CURS * MAX_CURS/8);
+	if (cursor->set & FB_CUR_SETSIZE) {
+		info->cursor.image.height = cursor->image.height;
+		info->cursor.image.width = cursor->image.width;
 		memset_io(par->riva.CURSOR, 0, MAX_CURS * MAX_CURS * 2);
 	}
 
-	if (flags & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP | FB_CUR_SETDEST)) {
-		int bg_idx = cursor->image.bg_color;
-		int fg_idx = cursor->image.fg_color;
-		int width = (cursor->image.width+7)/8;
-		u8 *dat = (u8 *) cursor->image.data;
-		u8 *dst = (u8 *) cursor->dest;
-		u8 *msk = (u8 *) cursor->mask;
+	if (cursor->set & FB_CUR_SETCMAP) {
+		info->cursor.image.bg_color = cursor->image.bg_color;
+		info->cursor.image.fg_color = cursor->image.fg_color;
+	}
 
-		switch (cursor->rop) {
+	if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETCMAP)) {
+		u32 bg_idx = info->cursor.image.bg_color;
+		u32 fg_idx = info->cursor.image.fg_color;
+		u32 s_pitch = (info->cursor.image.width+7) >> 3;
+		u32 d_pitch = MAX_CURS/8;
+		u8 *dat = (u8 *) cursor->image.data;
+		u8 *msk = (u8 *) info->cursor.mask;
+		u8 src[64];	
+		
+		switch (info->cursor.rop) {
 		case ROP_XOR:
-			for (i = 0; i < cursor->image.height; i++) {
-				for (j = 0; j < width; j++) {
-					d_idx = i * MAX_CURS/8  + j;
-					data[d_idx] =  byte_rev[dat[s_idx] ^ 
-								dst[s_idx]];
-					mask[d_idx] = byte_rev[msk[s_idx]];
-					s_idx++;
-				}
-			}
+			for (i = 0; i < s_pitch * info->cursor.image.height; i++)
+					src[i] = dat[i] ^ msk[i];
 			break;
 		case ROP_COPY:
 		default:
-			for (i = 0; i < cursor->image.height; i++) {
-				for (j = 0; j < width; j++) {
-					d_idx = i * MAX_CURS/8 + j;
-					data[d_idx] = byte_rev[dat[s_idx]];
-					mask[d_idx] = byte_rev[msk[s_idx]];
-					s_idx++;
-				}
-			}
+			for (i = 0; i < s_pitch * info->cursor.image.height; i++)
+				
+					src[i] = dat[i] & msk[i];
 			break;
 		}
+		
+		move_buf_aligned(info, data, src, d_pitch, s_pitch, info->cursor.image.height);
+
+		move_buf_aligned(info, mask, msk, d_pitch, s_pitch, info->cursor.image.height);
 
 		bg = ((info->cmap.red[bg_idx] & 0xf8) << 7) |
 		     ((info->cmap.green[bg_idx] & 0xf8) << 2) |
-		     ((info->cmap.blue[bg_idx] & 0xf8) >> 3) | 1 << 15;
+		     ((info->cmap.blue[bg_idx] & 0xf8) >> 3);
 
 		fg = ((info->cmap.red[fg_idx] & 0xf8) << 7) |
 		     ((info->cmap.green[fg_idx] & 0xf8) << 2) |
-		     ((info->cmap.blue[fg_idx] & 0xf8) >> 3) | 1 << 15;
+		     ((info->cmap.blue[fg_idx] & 0xf8) >> 3);
 
 		par->riva.LockUnlock(&par->riva, 0);
-		rivafb_load_cursor_image(data, mask, par, cursor->image.width,
-		cursor->image.height, bg, fg);
+
+		rivafb_load_cursor_image(par, data, mask, bg, fg,
+					 info->cursor.image.width, 
+					 info->cursor.image.height);
 	}
-	if (cursor->enable)
+	if (info->cursor.enable)
 		par->riva.ShowHideCursor(&par->riva, 1);
 	return 0;
 }
@@ -1609,7 +1604,6 @@
 	info->pixmap.buf_align = 4;
 	info->pixmap.scan_align = 4;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
-
 	return 0;
 }
 
diff -urN linux-2.5.67-bk5/drivers/video/sis/sis_main.h linux-2.5.67-bk6/drivers/video/sis/sis_main.h
--- linux-2.5.67-bk5/drivers/video/sis/sis_main.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/sis/sis_main.h	2003-04-15 04:36:16.000000000 -0700
@@ -286,43 +286,43 @@
 static int    video_type = FB_TYPE_PACKED_PIXELS;
 
 static struct fb_var_screeninfo default_var = {
-	xres:           0,
-	yres:           0,
-	xres_virtual:   0,
-	yres_virtual:   0,
-	xoffset:        0,
-	yoffset:        0,
-	bits_per_pixel: 0,
-	grayscale:      0,
-	red:            {0, 8, 0},
-	green:          {0, 8, 0},
-	blue:           {0, 8, 0},
-	transp:         {0, 0, 0},
-	nonstd:         0,
-	activate:       FB_ACTIVATE_NOW,
-	height:         -1,
-	width:          -1,
-	accel_flags:    0,
-	pixclock:       0,
-	left_margin:    0,
-	right_margin:   0,
-	upper_margin:   0,
-	lower_margin:   0,
-	hsync_len:      0,
-	vsync_len:      0,
-	sync:           0,
-	vmode:          FB_VMODE_NONINTERLACED,
+	.xres		= 0,
+	.yres		= 0,
+	.xres_virtual	= 0,
+	.yres_virtual	= 0,
+	.xoffset	= 0,
+	.yoffset	= 0,
+	.bits_per_pixel	= 0,
+	.grayscale	= 0,
+	.red		= {0, 8, 0},
+	.green		= {0, 8, 0},
+	.blue		= {0, 8, 0},
+	.transp		= {0, 0, 0},
+	.nonstd		= 0,
+	.activate	= FB_ACTIVATE_NOW,
+	.height		= -1,
+	.width		= -1,
+	.accel_flags	= 0,
+	.pixclock	= 0,
+	.left_margin	= 0,
+	.right_margin	= 0,
+	.upper_margin	= 0,
+	.lower_margin	= 0,
+	.hsync_len	= 0,
+	.vsync_len	= 0,
+	.sync		= 0,
+	.vmode		= FB_VMODE_NONINTERLACED,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	
-	reserved:       {0, 0, 0, 0, 0, 0}
+	.reserved	= {0, 0, 0, 0, 0, 0}
 #endif	
 };
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 static struct fb_fix_screeninfo sisfb_fix = {
-	id:		"SiS",
-	type:		FB_TYPE_PACKED_PIXELS,
-	xpanstep:	1,
-	ypanstep:	1,
+	.id		= "SiS",
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.xpanstep	= 1,
+	.ypanstep	= 1,
 };
 static char myid[20];
 static u32 pseudo_palette[17];
diff -urN linux-2.5.67-bk5/drivers/video/softcursor.c linux-2.5.67-bk6/drivers/video/softcursor.c
--- linux-2.5.67-bk5/drivers/video/softcursor.c	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/softcursor.c	2003-04-15 04:36:16.000000000 -0700
@@ -24,30 +24,9 @@
 	unsigned int i, size, dsize, s_pitch, d_pitch;
 	u8 *dst, src[64];
 
-	info->cursor.enable = (cursor->set & FB_CUR_SETCUR) ? 1 : 0;
-
 	if (cursor->set & FB_CUR_SETSIZE) {
-		info->cursor.image.width = cursor->image.width;
 		info->cursor.image.height = cursor->image.height;
-		cursor->set |= FB_CUR_SETSHAPE;
-	}
-
-	s_pitch = (info->cursor.image.width + 7) >> 3;
-	dsize = s_pitch * info->cursor.image.height;
-	d_pitch = (s_pitch + scan_align) & ~scan_align;
-	size = d_pitch * info->cursor.image.height + buf_align;
-	size &= ~buf_align;
-	dst = info->pixmap.addr + fb_get_buffer_offset(info, size);
-	info->cursor.image.data = dst;
-
-	if (cursor->set & FB_CUR_SETSHAPE) {
-		if (info->cursor.mask)
-			kfree(info->cursor.mask);
-		info->cursor.mask = kmalloc(dsize, GFP_KERNEL);
-		if (cursor->mask)
-			memcpy(info->cursor.mask, cursor->mask, dsize);
-		else
-			memset(info->cursor.mask, 0, dsize);
+		info->cursor.image.width = cursor->image.width;
 	}
 
 	if (cursor->set & FB_CUR_SETPOS) {
@@ -57,9 +36,9 @@
 
 	if (cursor->set & FB_CUR_SETHOT)
 		info->cursor.hot = cursor->hot;
-
+	
 	if (cursor->set & FB_CUR_SETCMAP) {
-		if (cursor->image.depth == 0) {
+		if (cursor->image.depth == 1) {
 			info->cursor.image.bg_color = cursor->image.bg_color;
 			info->cursor.image.fg_color = cursor->image.fg_color;
 		} else {
@@ -67,37 +46,41 @@
 				fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
 		}
 		info->cursor.image.depth = cursor->image.depth;
-	}
+	}	
+
+	s_pitch = (info->cursor.image.width + 7) >> 3;
+	dsize = s_pitch * info->cursor.image.height;
+	d_pitch = (s_pitch + scan_align) & ~scan_align;
+	size = d_pitch * info->cursor.image.height + buf_align;
+	size &= ~buf_align;
+	dst = info->pixmap.addr + fb_get_buffer_offset(info, size);
 
 	if (info->cursor.enable) {
-		switch (cursor->rop) {
+		switch (info->cursor.rop) {
 		case ROP_XOR:
-			for (i = 0; i < dsize; i++) {
-				src[i] = (cursor->image.data[i] &
-					  cursor->mask[i]) ^
-				    	  cursor->dest[i];
-			}
+			for (i = 0; i < dsize; i++)
+				src[i] = cursor->image.data[i] ^ info->cursor.mask[i]; 
 			break;
 		case ROP_COPY:
 		default:
-			for (i = 0; i < dsize; i++) {
-				src[i] = cursor->image.data[i] &
-				    	 cursor->mask[i];
-			}
+			for (i = 0; i < dsize; i++)
+				src[i] = cursor->image.data[i] & info->cursor.mask[i];
 			break;
 		}
-		move_buf_aligned(info, dst, src, d_pitch, s_pitch,
-				 cursor->image.height);
-	} else {
-		move_buf_aligned(info, dst, cursor->dest, s_pitch, d_pitch,
-				 cursor->image.height);
-	}
+	} else 
+		memcpy(src, cursor->image.data, dsize);
+	
+	move_buf_aligned(info, dst, src, d_pitch, s_pitch, info->cursor.image.height);
+	info->cursor.image.data = dst;
+	
 	info->fbops->fb_imageblit(info, &info->cursor.image);
+	atomic_dec(&info->pixmap.count);
+	smp_mb__after_atomic_dec();
 	return 0;
 }
 
 EXPORT_SYMBOL(soft_cursor);
-
+ 
 MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
 MODULE_DESCRIPTION("Generic software cursor");
 MODULE_LICENSE("GPL");
diff -urN linux-2.5.67-bk5/drivers/video/tdfxfb.c linux-2.5.67-bk6/drivers/video/tdfxfb.c
--- linux-2.5.67-bk5/drivers/video/tdfxfb.c	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/tdfxfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -930,34 +930,34 @@
 	banshee_wait_idle(info);
 }
 
-static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *pixmap) 
+static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image) 
 {
 	struct tdfx_par *par = (struct tdfx_par *) info->par;
-	int size = pixmap->height*((pixmap->width*pixmap->depth + 7)>>3);
+	int size = image->height * ((image->width * image->depth + 7)>>3);
 	int i, stride = info->fix.line_length;
 	u32 bpp = info->var.bits_per_pixel;
 	u32 dstfmt = stride | ((bpp+((bpp==8) ? 0 : 8)) << 13); 
-	u8 *chardata = (u8 *) pixmap->data;
+	u8 *chardata = (u8 *) image->data;
 	u32 srcfmt;
 
-	if (pixmap->depth != 0) {
+	if (image->depth != 1) {
 		//banshee_make_room(par, 6 + ((size + 3) >> 2));
 		//srcfmt = stride | ((bpp+((bpp==8) ? 0 : 8)) << 13) | 0x400000;
-		cfb_imageblit(info, pixmap);
+		cfb_imageblit(info, image);
 		return;
 	} else {
 		banshee_make_room(par, 8 + ((size + 3) >> 2));
-		tdfx_outl(par, COLORFORE, pixmap->fg_color);
-		tdfx_outl(par, COLORBACK, pixmap->bg_color);
+		tdfx_outl(par, COLORFORE, image->fg_color);
+		tdfx_outl(par, COLORBACK, image->bg_color);
 		srcfmt = 0x400000;
 	}	
 
 	tdfx_outl(par,	SRCXY,     0);
-	tdfx_outl(par,	DSTXY,     pixmap->dx | (pixmap->dy << 16));
+	tdfx_outl(par,	DSTXY,     image->dx | (image->dy << 16));
 	tdfx_outl(par,	COMMAND_2D, COMMAND_2D_H2S_BITBLT | (TDFX_ROP_COPY << 24));
 	tdfx_outl(par,	SRCFORMAT, srcfmt);
 	tdfx_outl(par,	DSTFORMAT, dstfmt);
-	tdfx_outl(par,	DSTSIZE,   pixmap->width | (pixmap->height << 16));
+	tdfx_outl(par,	DSTSIZE,   image->width | (image->height << 16));
 
 	/* Send four bytes at a time of data */	
 	for (i = (size >> 2) ; i > 0; i--) { 
diff -urN linux-2.5.67-bk5/drivers/video/tgafb.c linux-2.5.67-bk6/drivers/video/tgafb.c
--- linux-2.5.67-bk5/drivers/video/tgafb.c	2003-04-07 10:32:15.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/tgafb.c	2003-04-15 04:36:16.000000000 -0700
@@ -583,7 +583,7 @@
 	   can do better than the generic code.  */
 	/* ??? There is a DMA write mode; I wonder if that could be
 	   made to pull the data from the image buffer...  */
-	if (image->depth > 0) {
+	if (image->depth > 1) {
 		cfb_imageblit(info, image);
 		return;
 	}
diff -urN linux-2.5.67-bk5/drivers/video/tridentfb.c linux-2.5.67-bk6/drivers/video/tridentfb.c
--- linux-2.5.67-bk5/drivers/video/tridentfb.c	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/tridentfb.c	2003-04-15 04:36:16.000000000 -0700
@@ -1204,10 +1204,10 @@
 MODULE_DEVICE_TABLE(pci,trident_devices); 
 
 static struct pci_driver tridentfb_pci_driver = {
-	name:"tridentfb",
-	id_table:trident_devices,
-	probe:trident_pci_probe,
-	remove:__devexit_p(trident_pci_remove)
+	.name		= "tridentfb",
+	.id_table	= trident_devices,
+	.probe		= trident_pci_probe,
+	.remove		= __devexit_p(trident_pci_remove)
 };
 
 int __init tridentfb_init(void)
diff -urN linux-2.5.67-bk5/drivers/video/vesafb.c linux-2.5.67-bk6/drivers/video/vesafb.c
--- linux-2.5.67-bk5/drivers/video/vesafb.c	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/vesafb.c	2003-04-15 04:36:16.000000000 -0700
@@ -19,7 +19,9 @@
 #include <linux/fb.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
-
+#ifdef __i386__
+#include <video/edid.h>
+#endif
 #include <asm/io.h>
 #include <asm/mtrr.h>
 
@@ -213,6 +215,7 @@
 int __init vesafb_init(void)
 {
 	int video_cmap_len;
+	char *edid = 0;
 	int i;
 
 	if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB)
@@ -296,12 +299,20 @@
 		vesafb_defined.yres_virtual = vesafb_defined.yres;
 		ypan = 0;
 	}
-	
-	/* some dummy values for timing to make fbset happy */
-	vesafb_defined.pixclock     = 10000000 / vesafb_defined.xres * 1000 / vesafb_defined.yres;
-	vesafb_defined.left_margin  = (vesafb_defined.xres / 8) & 0xf8;
-	vesafb_defined.hsync_len    = (vesafb_defined.xres / 8) & 0xf8;
 
+#ifdef __i386__
+	edid = get_EDID_from_BIOS(0);
+	if (edid)
+		parse_edid(edid, &vesafb_defined);	
+	else		
+#endif
+	{	
+		/* some dummy values for timing to make fbset happy */
+		vesafb_defined.pixclock     = 10000000 / vesafb_defined.xres * 1000 / vesafb_defined.yres;
+		vesafb_defined.left_margin  = (vesafb_defined.xres / 8) & 0xf8;
+		vesafb_defined.hsync_len    = (vesafb_defined.xres / 8) & 0xf8;
+	}
+	
 	if (vesafb_defined.bits_per_pixel > 8) {
 		vesafb_defined.red.offset    = screen_info.red_pos;
 		vesafb_defined.red.length    = screen_info.red_size;
diff -urN linux-2.5.67-bk5/drivers/video/vga16fb.c linux-2.5.67-bk6/drivers/video/vga16fb.c
--- linux-2.5.67-bk5/drivers/video/vga16fb.c	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/drivers/video/vga16fb.c	2003-04-15 04:36:16.000000000 -0700
@@ -1304,9 +1304,9 @@
 				
 void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
-	if (image->depth == 0)
+	if (image->depth == 1)
 		vga_imageblit_expand(info, image);
-	else if (image->depth == info->var.bits_per_pixel)
+	else if (image->depth <= info->var.bits_per_pixel)
 		vga_imageblit_color(info, image);
 }
 
diff -urN linux-2.5.67-bk5/fs/nfs/write.c linux-2.5.67-bk6/fs/nfs/write.c
--- linux-2.5.67-bk5/fs/nfs/write.c	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/fs/nfs/write.c	2003-04-15 04:36:16.000000000 -0700
@@ -274,8 +274,14 @@
 	err = nfs_flush_file(inode, NULL, 0, 0, 0);
 	if (err < 0)
 		goto out;
-	if (is_sync)
+	if (wbc->sync_mode == WB_SYNC_HOLD)
+		goto out;
+	if (is_sync && wbc->sync_mode == WB_SYNC_ALL) {
 		err = nfs_wb_all(inode);
+	} else
+		nfs_commit_file(inode, NULL, 0, 0, 0);
+	/* Avoid races. Tell upstream we've done all we were told to do */
+	wbc->nr_to_write = 0;
 out:
 	return err;
 }
@@ -363,6 +369,7 @@
 	nfs_list_add_request(req, &nfsi->dirty);
 	nfsi->ndirty++;
 	spin_unlock(&nfs_wreq_lock);
+	inc_page_state(nr_dirty);
 	mark_inode_dirty(inode);
 }
 
@@ -390,6 +397,7 @@
 	nfs_list_add_request(req, &nfsi->commit);
 	nfsi->ncommit++;
 	spin_unlock(&nfs_wreq_lock);
+	inc_page_state(nr_unstable);
 	mark_inode_dirty(inode);
 }
 #endif
@@ -457,6 +465,7 @@
 	int	res;
 	res = nfs_scan_list(&nfsi->dirty, dst, file, idx_start, npages);
 	nfsi->ndirty -= res;
+	sub_page_state(nr_dirty,res);
 	if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty))
 		printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n");
 	return res;
@@ -481,6 +490,7 @@
 	int	res;
 	res = nfs_scan_list(&nfsi->commit, dst, file, idx_start, npages);
 	nfsi->ncommit -= res;
+	sub_page_state(nr_unstable,res);
 	if ((nfsi->ncommit == 0) != list_empty(&nfsi->commit))
 		printk(KERN_ERR "NFS: desynchronized value of nfs_i.ncommit.\n");
 	return res;
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/dma.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/dma.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/dma.h	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/dma.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,109 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/dma.h
- *
- *  Copyright (C) 2001 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 _IOP310_DMA_H_
-#define _IOP310_DMA_H_
-
-/* 2 DMA on primary PCI and 1 on secondary for 80310 */
-#define MAX_IOP310_DMA_CHANNEL   3
-#define MAX_DMA_DESC        	64	/*128 */
-
-/*
- * Make the generic DMA bits go away since we don't use it
- */
-#define MAX_DMA_CHANNELS	0
-
-#define MAX_DMA_ADDRESS		0xffffffff
-
-#define IOP310_DMA_P0      	0
-#define IOP310_DMA_P1		1
-#define IOP310_DMA_S0      	2
-
-#define DMA_MOD_READ        	0x0001
-#define DMA_MOD_WRITE		0x0002
-#define DMA_MOD_CACHED		0x0004
-#define DMA_MOD_NONCACHED	0x0008
-
-
-#define DMA_DESC_DONE   	0x0010
-#define DMA_INCOMPLETE  	0x0020
-#define DMA_HOLD		0x0040
-#define DMA_END_CHAIN		0x0080
-#define DMA_COMPLETE		0x0100
-#define DMA_NOTIFY		0x0200
-#define DMA_NEW_HEAD		0x0400
-
-#define DMA_USER_MASK	(DMA_NOTIFY | DMA_INCOMPLETE | \
-						 DMA_HOLD | DMA_COMPLETE)
-
-#define DMA_DCR_DAC		0x00000020	/* Dual Addr Cycle Enab */
-#define DMA_DCR_IE		0x00000010	/* Interrupt Enable */
-#define DMA_DCR_PCI_IOR		0x00000002	/* I/O Read */
-#define DMA_DCR_PCI_IOW		0x00000003	/* I/O Write */
-#define DMA_DCR_PCI_MR		0x00000006	/* Memory Read */
-#define DMA_DCR_PCI_MW		0x00000007	/* Memory Write */
-#define DMA_DCR_PCI_CR		0x0000000A	/* Configuration Read */
-#define DMA_DCR_PCI_CW		0x0000000B	/* Configuration Write */
-#define DMA_DCR_PCI_MRM		0x0000000C	/* Memory Read Multiple */
-#define DMA_DCR_PCI_MRL		0x0000000E	/* Memory Read Line */
-#define DMA_DCR_PCI_MWI		0x0000000F	/* Mem Write and Inval */
-
-#define DMA_USER_CMD_IE		0x00000001	/* user request int */
-#define DMA_USER_END_CHAIN	0x00000002	/* end of sgl chain flag */
-
-/* ATU defines */
-#define     IOP310_ATUCR_PRIM_OUT_ENAB  /* Configuration   */      0x00000002
-#define     IOP310_ATUCR_DIR_ADDR_ENAB  /* Configuration   */      0x00000080
-
-
-typedef void (*dma_callback_t) (void *buf_context);
-/*
- * DMA Descriptor
- */
-typedef struct _dma_desc
-{
-	u32 NDAR;					/* next descriptor address */
-	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 pointer */
-	u32 status;					/* descriptor status */
-	void *data;					/* local virt */
-	struct _dma_sgl *next;		/* next descriptor */
-} 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;
-
-/* function prototypes */
-int dma_request(dmach_t, const char *);
-int dma_queue_buffer(dmach_t, dma_head_t *);
-int dma_suspend(dmach_t);
-int dma_resume(dmach_t);
-int dma_flush_all(dmach_t);
-void dma_free(dmach_t);
-void dma_set_irq_threshold(dmach_t, int);
-dma_sgl_t *dma_get_buffer(dmach_t, int);
-void dma_return_buffer(dmach_t, dma_sgl_t *);
-
-#endif /* _ASM_ARCH_DMA_H */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/hardware.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/hardware.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/hardware.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/hardware.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,38 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/hardware.h
- */
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
-
-#include <linux/config.h>
-
-/*
- * Note about PCI IO space mappings
- *
- * To make IO space accesses efficient, we store virtual addresses in
- * the IO resources.
- *
- * The PCI IO space is located at virtual 0xfe000000 from physical
- * 0x90000000.  The PCI BARs must be programmed with physical addresses,
- * but when we read them, we convert them to virtual addresses.  See
- * arch/arm/mach-iop310/iop310-pci.c
- */
-
-#define pcibios_assign_all_busses() 1
-
-/*
- * these are the values for the secondary PCI bus on the 80312 chip.  I will
- * have to do some fixup in the bus/dev fixup code
- */
-#define PCIBIOS_MIN_IO      0
-#define PCIBIOS_MIN_MEM     0x88000000
-
-// Generic chipset bits
-#include "iop310.h"
-
-// Board specific
-#if defined(CONFIG_ARCH_IQ80310)
-#include "iq80310.h"
-#endif
-
-#endif  /* _ASM_ARCH_HARDWARE_H */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/ide.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/ide.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/ide.h	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/ide.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,51 +0,0 @@
-/*
- * include/asm-arm/arch-iop310/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, int data_port, int ctrl_port, int *irq)
-{
-	ide_ioreg_t reg;
-	int i;
-	int regincr = 1;
-
-	memset(hw, 0, sizeof(*hw));
-
-	reg = (ide_ioreg_t)data_port;
-
-	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-		hw->io_ports[i] = reg;
-		reg += regincr;
-	}
-
-	hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) 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 -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/io.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/io.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/io.h	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/io.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,20 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop310/io.h
- *
- *  Copyright (C) 2001  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
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-#define __io(p)			((p))
-#define __mem_pci(a)		((unsigned long)(a))
-#define __mem_isa(a)		((unsigned long)(a))
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/iop310.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/iop310.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/iop310.h	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/iop310.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,247 +0,0 @@
-/*
- * linux/include/asm/arch-iop310/iop310.h
- *
- * Intel IOP310 Compainion Chip definitions
- *
- * 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 _IOP310_HW_H_
-#define _IOP310_HW_H_
-
-/*
- * IOP310 I/O and Mem space regions for PCI autoconfiguration
- */
-#define IOP310_PCISEC_LOWER_IO		0x90010000
-#define IOP310_PCISEC_UPPER_IO		0x9001ffff
-#define IOP310_PCISEC_LOWER_MEM		0x88000000
-#define IOP310_PCISEC_UPPER_MEM		0x8bffffff
-
-#define IOP310_PCIPRI_LOWER_IO		0x90000000
-#define IOP310_PCIPRI_UPPER_IO		0x9000ffff
-#define IOP310_PCIPRI_LOWER_MEM		0x80000000
-#define IOP310_PCIPRI_UPPER_MEM		0x83ffffff
-
-#define IOP310_PCI_WINDOW_SIZE		64 * 0x100000
-
-/*
- * IOP310 chipset registers
- */
-#define IOP310_VIRT_MEM_BASE 0xe8001000  /* chip virtual mem address*/
-#define IOP310_PHY_MEM_BASE  0x00001000  /* chip physical memory address */
-#define IOP310_REG_ADDR(reg) (IOP310_VIRT_MEM_BASE | IOP310_PHY_MEM_BASE | (reg))
-
-/* PCI-to-PCI Bridge Unit 0x00001000 through 0x000010FF */
-#define IOP310_VIDR    (volatile u16 *)IOP310_REG_ADDR(0x00001000)
-#define IOP310_DIDR    (volatile u16 *)IOP310_REG_ADDR(0x00001002)
-#define IOP310_PCR     (volatile u16 *)IOP310_REG_ADDR(0x00001004)
-#define IOP310_PSR     (volatile u16 *)IOP310_REG_ADDR(0x00001006)
-#define IOP310_RIDR    (volatile u8  *)IOP310_REG_ADDR(0x00001008)
-#define IOP310_CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001009)
-#define IOP310_CLSR    (volatile u8  *)IOP310_REG_ADDR(0x0000100C)
-#define IOP310_PLTR    (volatile u8  *)IOP310_REG_ADDR(0x0000100D)
-#define IOP310_HTR     (volatile u8  *)IOP310_REG_ADDR(0x0000100E)
-/* Reserved 0x0000100F through  0x00001017 */
-#define IOP310_PBNR    (volatile u8  *)IOP310_REG_ADDR(0x00001018)
-#define IOP310_SBNR    (volatile u8  *)IOP310_REG_ADDR(0x00001019)
-#define IOP310_SUBBNR  (volatile u8  *)IOP310_REG_ADDR(0x0000101A)
-#define IOP310_SLTR    (volatile u8  *)IOP310_REG_ADDR(0x0000101B)
-#define IOP310_IOBR    (volatile u8  *)IOP310_REG_ADDR(0x0000101C)
-#define IOP310_IOLR    (volatile u8  *)IOP310_REG_ADDR(0x0000101D)
-#define IOP310_SSR     (volatile u16 *)IOP310_REG_ADDR(0x0000101E)
-#define IOP310_MBR     (volatile u16 *)IOP310_REG_ADDR(0x00001020)
-#define IOP310_MLR     (volatile u16 *)IOP310_REG_ADDR(0x00001022)
-#define IOP310_PMBR    (volatile u16 *)IOP310_REG_ADDR(0x00001024)
-#define IOP310_PMLR    (volatile u16 *)IOP310_REG_ADDR(0x00001026)
-/* Reserved 0x00001028 through 0x00001033 */
-#define IOP310_CAPR    (volatile u8  *)IOP310_REG_ADDR(0x00001034)
-/* Reserved 0x00001035 through 0x0000103D */
-#define IOP310_BCR     (volatile u16 *)IOP310_REG_ADDR(0x0000103E)
-#define IOP310_EBCR    (volatile u16 *)IOP310_REG_ADDR(0x00001040)
-#define IOP310_SISR    (volatile u16 *)IOP310_REG_ADDR(0x00001042)
-#define IOP310_PBISR   (volatile u32 *)IOP310_REG_ADDR(0x00001044)
-#define IOP310_SBISR   (volatile u32 *)IOP310_REG_ADDR(0x00001048)
-#define IOP310_SACR    (volatile u32 *)IOP310_REG_ADDR(0x0000104C)
-#define IOP310_PIRSR   (volatile u32 *)IOP310_REG_ADDR(0x00001050)
-#define IOP310_SIOBR   (volatile u8  *)IOP310_REG_ADDR(0x00001054)
-#define IOP310_SIOLR   (volatile u8  *)IOP310_REG_ADDR(0x00001055)
-#define IOP310_SCDR    (volatile u8  *)IOP310_REG_ADDR(0x00001056)
-
-#define IOP310_SMBR    (volatile u16 *)IOP310_REG_ADDR(0x00001058)
-#define IOP310_SMLR    (volatile u16 *)IOP310_REG_ADDR(0x0000105A)
-#define IOP310_SDER    (volatile u16 *)IOP310_REG_ADDR(0x0000105C)
-#define IOP310_QCR     (volatile u16 *)IOP310_REG_ADDR(0x0000105E)
-#define IOP310_CAPID   (volatile u8  *)IOP310_REG_ADDR(0x00001068)
-#define IOP310_NIPTR   (volatile u8  *)IOP310_REG_ADDR(0x00001069)
-#define IOP310_PMCR    (volatile u16 *)IOP310_REG_ADDR(0x0000106A)
-#define IOP310_PMCSR   (volatile u16 *)IOP310_REG_ADDR(0x0000106C)
-#define IOP310_PMCSRBSE (volatile u8 *)IOP310_REG_ADDR(0x0000106E)
-/* Reserved 0x00001064 through 0x000010FFH */
-
-/* Performance monitoring unit  0x00001100 through 0x000011FF*/
-#define IOP310_PMONGTMR    (volatile u32 *)IOP310_REG_ADDR(0x00001100)
-#define IOP310_PMONESR     (volatile u32 *)IOP310_REG_ADDR(0x00001104)
-#define IOP310_PMONEMISR   (volatile u32 *)IOP310_REG_ADDR(0x00001108)
-#define IOP310_PMONGTSR    (volatile u32 *)IOP310_REG_ADDR(0x00001110)
-#define IOP310_PMONPECR1   (volatile u32 *)IOP310_REG_ADDR(0x00001114)
-#define IOP310_PMONPECR2   (volatile u32 *)IOP310_REG_ADDR(0x00001118)
-#define IOP310_PMONPECR3   (volatile u32 *)IOP310_REG_ADDR(0x0000111C)
-#define IOP310_PMONPECR4   (volatile u32 *)IOP310_REG_ADDR(0x00001120)
-#define IOP310_PMONPECR5   (volatile u32 *)IOP310_REG_ADDR(0x00001124)
-#define IOP310_PMONPECR6   (volatile u32 *)IOP310_REG_ADDR(0x00001128)
-#define IOP310_PMONPECR7   (volatile u32 *)IOP310_REG_ADDR(0x0000112C)
-#define IOP310_PMONPECR8   (volatile u32 *)IOP310_REG_ADDR(0x00001130)
-#define IOP310_PMONPECR9   (volatile u32 *)IOP310_REG_ADDR(0x00001134)
-#define IOP310_PMONPECR10  (volatile u32 *)IOP310_REG_ADDR(0x00001138)
-#define IOP310_PMONPECR11  (volatile u32 *)IOP310_REG_ADDR(0x0000113C)
-#define IOP310_PMONPECR12  (volatile u32 *)IOP310_REG_ADDR(0x00001140)
-#define IOP310_PMONPECR13  (volatile u32 *)IOP310_REG_ADDR(0x00001144)
-#define IOP310_PMONPECR14  (volatile u32 *)IOP310_REG_ADDR(0x00001148)
-
-/* Address Translation Unit 0x00001200 through 0x000012FF */
-#define IOP310_ATUVID     (volatile u16 *)IOP310_REG_ADDR(0x00001200)
-#define IOP310_ATUDID     (volatile u16 *)IOP310_REG_ADDR(0x00001202)
-#define IOP310_PATUCMD    (volatile u16 *)IOP310_REG_ADDR(0x00001204)
-#define IOP310_PATUSR     (volatile u16 *)IOP310_REG_ADDR(0x00001206)
-#define IOP310_ATURID     (volatile u8  *)IOP310_REG_ADDR(0x00001208)
-#define IOP310_ATUCCR     (volatile u32 *)IOP310_REG_ADDR(0x00001209)
-#define IOP310_ATUCLSR    (volatile u8  *)IOP310_REG_ADDR(0x0000120C)
-#define IOP310_ATULT      (volatile u8  *)IOP310_REG_ADDR(0x0000120D)
-#define IOP310_ATUHTR     (volatile u8  *)IOP310_REG_ADDR(0x0000120E)
-
-#define IOP310_PIABAR     (volatile u32 *)IOP310_REG_ADDR(0x00001210)
-/* Reserved 0x00001214 through 0x0000122B */
-#define IOP310_ASVIR      (volatile u16 *)IOP310_REG_ADDR(0x0000122C)
-#define IOP310_ASIR       (volatile u16 *)IOP310_REG_ADDR(0x0000122E)
-#define IOP310_ERBAR      (volatile u32 *)IOP310_REG_ADDR(0x00001230)
-#define IOP310_ATUCAPPTR  (volatile u8  *)IOP310_REG_ADDR(0x00001234)
-/* Reserved 0x00001235 through 0x0000123B */
-#define IOP310_ATUILR     (volatile u8  *)IOP310_REG_ADDR(0x0000123C)
-#define IOP310_ATUIPR     (volatile u8  *)IOP310_REG_ADDR(0x0000123D)
-#define IOP310_ATUMGNT    (volatile u8  *)IOP310_REG_ADDR(0x0000123E)
-#define IOP310_ATUMLAT    (volatile u8  *)IOP310_REG_ADDR(0x0000123F)
-#define IOP310_PIALR      (volatile u32 *)IOP310_REG_ADDR(0x00001240)
-#define IOP310_PIATVR     (volatile u32 *)IOP310_REG_ADDR(0x00001244)
-#define IOP310_SIABAR     (volatile u32 *)IOP310_REG_ADDR(0x00001248)
-#define IOP310_SIALR      (volatile u32 *)IOP310_REG_ADDR(0x0000124C)
-#define IOP310_SIATVR     (volatile u32 *)IOP310_REG_ADDR(0x00001250)
-#define IOP310_POMWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001254)
-/* Reserved 0x00001258 through 0x0000125B */
-#define IOP310_POIOWVR    (volatile u32 *)IOP310_REG_ADDR(0x0000125C)
-#define IOP310_PODWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001260)
-#define IOP310_POUDR      (volatile u32 *)IOP310_REG_ADDR(0x00001264)
-#define IOP310_SOMWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001268)
-#define IOP310_SOIOWVR    (volatile u32 *)IOP310_REG_ADDR(0x0000126C)
-/* Reserved 0x00001270 through 0x00001273*/
-#define IOP310_ERLR       (volatile u32 *)IOP310_REG_ADDR(0x00001274)
-#define IOP310_ERTVR      (volatile u32 *)IOP310_REG_ADDR(0x00001278)
-/* Reserved 0x00001279 through 0x0000127C*/
-#define IOP310_ATUCAPID   (volatile u8  *)IOP310_REG_ADDR(0x00001280)
-#define IOP310_ATUNIPTR   (volatile u8  *)IOP310_REG_ADDR(0x00001281)
-#define IOP310_APMCR      (volatile u16 *)IOP310_REG_ADDR(0x00001282)
-#define IOP310_APMCSR     (volatile u16 *)IOP310_REG_ADDR(0x00001284)
-/* Reserved 0x00001286 through 0x00001287 */
-#define IOP310_ATUCR      (volatile u32 *)IOP310_REG_ADDR(0x00001288)
-/* Reserved 0x00001289  through 0x0000128C*/
-#define IOP310_PATUISR    (volatile u32 *)IOP310_REG_ADDR(0x00001290)
-#define IOP310_SATUISR    (volatile u32 *)IOP310_REG_ADDR(0x00001294)
-#define IOP310_SATUCMD    (volatile u16 *)IOP310_REG_ADDR(0x00001298)
-#define IOP310_SATUSR     (volatile u16 *)IOP310_REG_ADDR(0x0000129A)
-#define IOP310_SODWVR     (volatile u32 *)IOP310_REG_ADDR(0x0000129C)
-#define IOP310_SOUDR      (volatile u32 *)IOP310_REG_ADDR(0x000012A0)
-#define IOP310_POCCAR     (volatile u32 *)IOP310_REG_ADDR(0x000012A4)
-#define IOP310_SOCCAR     (volatile u32 *)IOP310_REG_ADDR(0x000012A8)
-#define IOP310_POCCDR     (volatile u32 *)IOP310_REG_ADDR(0x000012AC)
-#define IOP310_SOCCDR     (volatile u32 *)IOP310_REG_ADDR(0x000012B0)
-#define IOP310_PAQCR      (volatile u32 *)IOP310_REG_ADDR(0x000012B4)
-#define IOP310_SAQCR      (volatile u32 *)IOP310_REG_ADDR(0x000012B8)
-#define IOP310_PATUIMR    (volatile u32 *)IOP310_REG_ADDR(0x000012BC)
-#define IOP310_SATUIMR    (volatile u32 *)IOP310_REG_ADDR(0x000012C0)
-/* Reserved 0x000012C4 through 0x000012FF */
-/* Messaging Unit 0x00001300 through 0x000013FF */
-#define IOP310_MUIMR0       (volatile u32 *)IOP310_REG_ADDR(0x00001310)
-#define IOP310_MUIMR1       (volatile u32 *)IOP310_REG_ADDR(0x00001314)
-#define IOP310_MUOMR0       (volatile u32 *)IOP310_REG_ADDR(0x00001318)
-#define IOP310_MUOMR1       (volatile u32 *)IOP310_REG_ADDR(0x0000131C)
-#define IOP310_MUIDR        (volatile u32 *)IOP310_REG_ADDR(0x00001320)
-#define IOP310_MUIISR       (volatile u32 *)IOP310_REG_ADDR(0x00001324)
-#define IOP310_MUIIMR       (volatile u32 *)IOP310_REG_ADDR(0x00001328)
-#define IOP310_MUODR        (volatile u32 *)IOP310_REG_ADDR(0x0000132C)
-#define IOP310_MUOISR       (volatile u32 *)IOP310_REG_ADDR(0x00001330)
-#define IOP310_MUOIMR       (volatile u32 *)IOP310_REG_ADDR(0x00001334)
-#define IOP310_MUMUCR       (volatile u32 *)IOP310_REG_ADDR(0x00001350)
-#define IOP310_MUQBAR       (volatile u32 *)IOP310_REG_ADDR(0x00001354)
-#define IOP310_MUIFHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001360)
-#define IOP310_MUIFTPR      (volatile u32 *)IOP310_REG_ADDR(0x00001364)
-#define IOP310_MUIPHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001368)
-#define IOP310_MUIPTPR      (volatile u32 *)IOP310_REG_ADDR(0x0000136C)
-#define IOP310_MUOFHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001370)
-#define IOP310_MUOFTPR      (volatile u32 *)IOP310_REG_ADDR(0x00001374)
-#define IOP310_MUOPHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001378)
-#define IOP310_MUOPTPR      (volatile u32 *)IOP310_REG_ADDR(0x0000137C)
-#define IOP310_MUIAR        (volatile u32 *)IOP310_REG_ADDR(0x00001380)
-/* DMA Controller 0x00001400 through 0x000014FF */
-#define IOP310_DMA0CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001400)
-#define IOP310_DMA0CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001404)
-/* Reserved 0x001408 through 0x00140B */
-#define IOP310_DMA0DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000140C)
-#define IOP310_DMA0NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001410)
-#define IOP310_DMA0PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001414)
-#define IOP310_DMA0PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001418)
-#define IOP310_DMA0LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000141C)
-#define IOP310_DMA0BCR     (volatile u32 *)IOP310_REG_ADDR(0x00001420)
-#define IOP310_DMA0DCR     (volatile u32 *)IOP310_REG_ADDR(0x00001424)
-/* Reserved 0x00001428 through 0x0000143F */
-#define IOP310_DMA1CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001440)
-#define IOP310_DMA1CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001444)
-/* Reserved 0x00001448 through 0x0000144B */
-#define IOP310_DMA1DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000144C)
-#define IOP310_DMA1NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001450)
-#define IOP310_DMA1PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001454)
-#define IOP310_DMA1PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001458)
-#define IOP310_DMA1LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000145C)
-#define IOP310_DMA1BCR     (volatile u32 *)IOP310_REG_ADDR(0x00001460)
-#define IOP310_DMA1DCR     (volatile u32 *)IOP310_REG_ADDR(0x00001464)
-/* Reserved 0x00001468 through 0x0000147F */
-#define IOP310_DMA2CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001480)
-#define IOP310_DMA2CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001484)
-/* Reserved 0x00001488 through 0x0000148B */
-#define IOP310_DMA2DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000148C)
-#define IOP310_DMA2NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001490)
-#define IOP310_DMA2PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001494)
-#define IOP310_DMA2PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001498)
-#define IOP310_DMA2LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000149C)
-#define IOP310_DMA2BCR     (volatile u32 *)IOP310_REG_ADDR(0x000014A0)
-#define IOP310_DMA2DCR     (volatile u32 *)IOP310_REG_ADDR(0x000014A4)
-
-/* Memory controller 0x00001500 through 0x0015FF */
-
-/* core interface unit 0x00001640 - 0x0000167F */
-#define IOP310_CIUISR     (volatile u32 *)IOP310_REG_ADDR(0x00001644)
-
-/* PCI and Peripheral Interrupt Controller 0x00001700 - 0x0000171B */
-#define IOP310_IRQISR     (volatile u32 *)IOP310_REG_ADDR(0x00001700)
-#define IOP310_FIQ2ISR    (volatile u32 *)IOP310_REG_ADDR(0x00001704)
-#define IOP310_FIQ1ISR    (volatile u32 *)IOP310_REG_ADDR(0x00001708)
-#define IOP310_PDIDR      (volatile u32 *)IOP310_REG_ADDR(0x00001710)
-
-/* AAU registers. DJ 0x00001800 - 0x00001838 */
-#define IOP310_AAUACR    (volatile u32 *)IOP310_REG_ADDR(0x00001800)
-#define IOP310_AAUASR    (volatile u32 *)IOP310_REG_ADDR(0x00001804)
-#define IOP310_AAUADAR   (volatile u32 *)IOP310_REG_ADDR(0x00001808)
-#define IOP310_AAUANDAR  (volatile u32 *)IOP310_REG_ADDR(0x0000180C)
-#define IOP310_AAUSAR1   (volatile u32 *)IOP310_REG_ADDR(0x00001810)
-#define IOP310_AAUSAR2   (volatile u32 *)IOP310_REG_ADDR(0x00001814)
-#define IOP310_AAUSAR3   (volatile u32 *)IOP310_REG_ADDR(0x00001818)
-#define IOP310_AAUSAR4   (volatile u32 *)IOP310_REG_ADDR(0x0000181C)
-#define IOP310_AAUDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001820)
-#define IOP310_AAUABCR   (volatile u32 *)IOP310_REG_ADDR(0x00001824)
-#define IOP310_AAUADCR   (volatile u32 *)IOP310_REG_ADDR(0x00001828)
-#define IOP310_AAUSAR5   (volatile u32 *)IOP310_REG_ADDR(0x0000182C)
-#define IOP310_AAUSAR6   (volatile u32 *)IOP310_REG_ADDR(0x00001830)
-#define IOP310_AAUSAR7   (volatile u32 *)IOP310_REG_ADDR(0x00001834)
-#define IOP310_AAUSAR8   (volatile u32 *)IOP310_REG_ADDR(0x00001838)
-
-#endif // _IOP310_HW_H_
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/iq80310.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/iq80310.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/iq80310.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/iq80310.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,30 +0,0 @@
-/*
- * linux/include/asm/arch-iop80310/iq80310.h
- *
- * Intel IQ-80310 evaluation board registers
- */
-
-#ifndef _IQ80310_H_
-#define _IQ80310_H_
-
-#define IQ80310_RAMBASE      0xa0000000
-#define IQ80310_UART1        0xfe800000    /* UART #1 */
-#define IQ80310_UART2        0xfe810000    /* UART #2 */
-#define IQ80310_INT_STAT     0xfe820000    /* Interrupt (XINT3#) Status */
-#define IQ80310_BOARD_REV    0xfe830000    /* Board revision register */
-#define IQ80310_CPLD_REV     0xfe840000    /* CPLD revision register */
-#define IQ80310_7SEG_1       0xfe840000    /* 7-Segment MSB */
-#define IQ80310_7SEG_0       0xfe850000    /* 7-Segment LSB (WO) */
-#define IQ80310_PCI_INT_STAT 0xfe850000    /* PCI Interrupt  Status */
-#define IQ80310_INT_MASK     0xfe860000    /* Interrupt (XINT3#) Mask */
-#define IQ80310_BACKPLANE    0xfe870000    /* Backplane Detect */
-#define IQ80310_TIMER_LA0    0xfe880000    /* Timer LA0 */
-#define IQ80310_TIMER_LA1    0xfe890000    /* Timer LA1 */
-#define IQ80310_TIMER_LA2    0xfe8a0000    /* Timer LA2 */
-#define IQ80310_TIMER_LA3    0xfe8b0000    /* Timer LA3 */
-#define IQ80310_TIMER_EN     0xfe8c0000    /* Timer Enable */
-#define IQ80310_ROTARY_SW    0xfe8d0000    /* Rotary Switch */
-#define IQ80310_JTAG         0xfe8e0000    /* JTAG Port Access */
-#define IQ80310_BATT_STAT    0xfe8f0000    /* Battery Status */
-
-#endif	// _IQ80310_H_
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/irqs.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/irqs.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/irqs.h	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/irqs.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,80 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop310/irqs.h
- *
- * Author:	Nicolas Pitre
- * Copyright:	(C) 2001 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.
- *
- * 06/13/01: Added 80310 on-chip interrupt sources <dsaxena@mvista.com>
- *
- */
-#include <linux/config.h>
-
-/*
- * XS80200 specific IRQs
- */
-#define IRQ_XS80200_BCU		0	/* Bus Control Unit */
-#define IRQ_XS80200_PMU		1	/* Performance Monitoring Unit */
-#define IRQ_XS80200_EXTIRQ	2	/* external IRQ signal */
-#define IRQ_XS80200_EXTFIQ	3	/* external IRQ signal */
-
-#define NR_XS80200_IRQS		4
-
-#define XSCALE_PMU_IRQ		IRQ_XS80200_PMU
-
-/*
- * IOP80310 chipset interrupts
- */
-#define IOP310_IRQ_OFS		NR_XS80200_IRQS
-#define IOP310_IRQ(x)		(IOP310_IRQ_OFS + (x))
-
-/*
- * On FIQ1ISR register
- */
-#define IRQ_IOP310_DMA0		IOP310_IRQ(0)	/* DMA Channel 0 */
-#define IRQ_IOP310_DMA1		IOP310_IRQ(1)	/* DMA Channel 1 */
-#define IRQ_IOP310_DMA2		IOP310_IRQ(2)	/* DMA Channel 2 */
-#define IRQ_IOP310_PMON		IOP310_IRQ(3)	/* Bus performance Unit */
-#define IRQ_IOP310_AAU		IOP310_IRQ(4)	/* Application Accelator Unit */
-
-/*
- * On FIQ2ISR register
- */
-#define IRQ_IOP310_I2C		IOP310_IRQ(5)	/* I2C unit */
-#define IRQ_IOP310_MU		IOP310_IRQ(6)	/* messaging unit */
-
-#define NR_IOP310_IRQS		(IOP310_IRQ(6) + 1)
-
-#define NR_IRQS			NR_IOP310_IRQS
-
-
-/*
- * Interrupts available on the Cyclone IQ80310 board
- */
-#ifdef CONFIG_ARCH_IQ80310
-
-#define IQ80310_IRQ_OFS		NR_IOP310_IRQS
-#define IQ80310_IRQ(y)		((IQ80310_IRQ_OFS) + (y))
-
-#define IRQ_IQ80310_TIMER	IQ80310_IRQ(0)	/* Timer Interrupt */
-#define IRQ_IQ80310_I82559	IQ80310_IRQ(1)	/* I82559 Ethernet Interrupt */
-#define IRQ_IQ80310_UART1	IQ80310_IRQ(2)	/* UART1 Interrupt */
-#define IRQ_IQ80310_UART2	IQ80310_IRQ(3)	/* UART2 Interrupt */
-#define IRQ_IQ80310_INTD	IQ80310_IRQ(4)	/* PCI INTD */
-
-
-/*
- * ONLY AVAILABLE ON REV F OR NEWER BOARDS!
- */
-#define	IRQ_IQ80310_INTA	IQ80310_IRQ(5)	/* PCI INTA */
-#define	IRQ_IQ80310_INTB	IQ80310_IRQ(6)	/* PCI INTB */
-#define	IRQ_IQ80310_INTC	IQ80310_IRQ(7)	/* PCI INTC */
-
-#undef	NR_IRQS
-#define NR_IRQS			(IQ80310_IRQ(7) + 1)
-
-#endif // CONFIG_ARCH_IQ80310
-
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/memory.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/memory.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/memory.h	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/memory.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,58 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/memory.h
- */
-
-#ifndef __ASM_ARCH_MEMORY_H
-#define __ASM_ARCH_MEMORY_H
-
-#include <linux/config.h>
-#include <asm/arch/iop310.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)) & ~(*IOP310_SIATVR)) | ((*IOP310_SIABAR) & 0xfffffff0))
-#define __bus_to_virt(x)    (__phys_to_virt(((x) & ~(*IOP310_SIALR)) | ( *IOP310_SIATVR)))
-
-/* boot mem allocate global pointer for MU circular queues QBAR */
-#ifdef CONFIG_IOP310_MU
-extern void *mu_mem;
-#endif
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/param.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/param.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/param.h	2003-04-07 10:31:24.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/param.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,3 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-iop80310/param.h
- */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/pmon.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/pmon.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/pmon.h	2003-04-07 10:31:55.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/pmon.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,50 +0,0 @@
-/*
- * Definitions for XScale 80312 PMON
- * (C) 2001 Intel Corporation
- * Author: Chen Chen(chen.chen@intel.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.
- */
-
-#ifndef _IOP310_PMON_H_
-#define _IOP310_PMON_H_
-
-/*
- *  Different modes for Event Select Register for intel 80312
- */
-
-#define IOP310_PMON_MODE0                0x00000000
-#define IOP310_PMON_MODE1                0x00000001
-#define IOP310_PMON_MODE2                0x00000002
-#define IOP310_PMON_MODE3                0x00000003
-#define IOP310_PMON_MODE4                0x00000004
-#define IOP310_PMON_MODE5                0x00000005
-#define IOP310_PMON_MODE6                0x00000006
-#define IOP310_PMON_MODE7                0x00000007
-
-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;
-
-/* function prototypes */
-
-/* Claim IQ80312 PMON for usage */
-int iop310_pmon_claim(void);
-
-/* Start IQ80312 PMON */
-int iop310_pmon_start(int, int);
-
-/* Stop Performance Monitor Unit */
-int iop310_pmon_stop(iop310_pmon_res_t *);
-
-/* Release IQ80312 PMON */
-int iop310_pmon_release(int);
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/serial.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/serial.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/serial.h	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/serial.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-/*
- * include/asm-arm/arch-iop310/serial.h
- */
-#include <linux/config.h>
-
-/*
- * This assumes you have a 1.8432 MHz clock for your UART.
- *
- * It'd be nice if someone built a serial card with a 24.576 MHz
- * clock, since the 16550A is capable of handling a top speed of 1.5
- * megabits/second; but this requires the faster clock.
- */
-#define BASE_BAUD ( 1843200 / 16 )
-
-/* Standard COM flags */
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-
-#ifdef CONFIG_ARCH_IQ80310
-
-#define IRQ_UART1	IRQ_IQ80310_UART1
-#define IRQ_UART2	IRQ_IQ80310_UART2
-
-#define RS_TABLE_SIZE 2
-
-#define STD_SERIAL_PORT_DEFNS			\
-       /* UART CLK      PORT        IRQ        FLAGS        */			\
-	{ 0, BASE_BAUD, IQ80310_UART2, IRQ_UART2, STD_COM_FLAGS },  /* ttyS0 */	\
-	{ 0, BASE_BAUD, IQ80310_UART1, IRQ_UART1, STD_COM_FLAGS }  /* ttyS1 */
-
-#endif // CONFIG_ARCH_IQ80310
-
-
-#define EXTRA_SERIAL_PORT_DEFNS
-
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/system.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/system.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/system.h	2003-04-07 10:32:54.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/system.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,27 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/system.h
- *
- *  Copyright (C) 2001 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.
- */
-
-static inline void arch_idle(void)
-{
-	cpu_do_idle();
-}
-
-
-static inline void arch_reset(char mode)
-{
-	if ( 1 && mode == 's') {
-		/* Jump into ROM at address 0 */
-		cpu_reset(0);
-	} else {
-		/* No on-chip reset capability */
-		cpu_reset(0);
-	}
-}
-
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/time.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/time.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/time.h	2003-04-07 10:31:25.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/time.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,12 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/time.h
- *
- * Author:  Nicolas Pitre
- * Copyright:   (C) 2001 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.
- *
- */
-
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/timex.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/timex.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/timex.h	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/timex.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,23 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop80310/timex.h
- *
- * IOP310 architecture timex specifications
- */
-#include <linux/config.h>
-
-
-#ifdef CONFIG_ARCH_IQ80310
-
-#ifndef CONFIG_XSCALE_PMU_TIMER
-/* This is for the on-board timer */
-#define CLOCK_TICK_RATE 33000000 /* Underlying HZ */
-#else
-/* This is for the underlying xs80200 PMU clock. We run the core @ 733MHz */
-#define CLOCK_TICK_RATE	733000000
-#endif
-
-#else
-
-#error "No IOP310 timex information for this architecture"
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/uncompress.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/uncompress.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/uncompress.h	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/uncompress.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-iop80310/uncompress.h
- */
-#include <linux/config.h>
-
-#ifdef CONFIG_ARCH_IQ80310
-#define UART1_BASE    ((volatile unsigned char *)0xfe800000)
-#define UART2_BASE    ((volatile unsigned char *)0xfe810000)
-#endif
-
-static __inline__ void putc(char c)
-{
-	while ((UART2_BASE[5] & 0x60) != 0x60);
-	UART2_BASE[0] = c;
-}
-
-/*
- * This does not append a newline
- */
-static void puts(const char *s)
-{
-	while (*s) {
-		putc(*s);
-		if (*s == '\n')
-			putc('\r');
-		s++;
-	}
-}
-
-/*
- * nothing to do
- */
-#define arch_decomp_setup()
-#define arch_decomp_wdog()
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop310/vmalloc.h linux-2.5.67-bk6/include/asm-arm/arch-iop310/vmalloc.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop310/vmalloc.h	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop310/vmalloc.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,19 +0,0 @@
-/*
- * linux/include/asm-arm/arch-iop310/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       (0xe8000000)
-
-#define MODULE_START	(PAGE_OFFSET - 16*1048576)
-#define MODULE_END	(PAGE_OFFSET)
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/dma.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/dma.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/dma.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/dma.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,109 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/dma.h
+ *
+ *  Copyright (C) 2001 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 _IOP310_DMA_H_
+#define _IOP310_DMA_H_
+
+/* 2 DMA on primary PCI and 1 on secondary for 80310 */
+#define MAX_IOP310_DMA_CHANNEL   3
+#define MAX_DMA_DESC        	64	/*128 */
+
+/*
+ * Make the generic DMA bits go away since we don't use it
+ */
+#define MAX_DMA_CHANNELS	0
+
+#define MAX_DMA_ADDRESS		0xffffffff
+
+#define IOP310_DMA_P0      	0
+#define IOP310_DMA_P1		1
+#define IOP310_DMA_S0      	2
+
+#define DMA_MOD_READ        	0x0001
+#define DMA_MOD_WRITE		0x0002
+#define DMA_MOD_CACHED		0x0004
+#define DMA_MOD_NONCACHED	0x0008
+
+
+#define DMA_DESC_DONE   	0x0010
+#define DMA_INCOMPLETE  	0x0020
+#define DMA_HOLD		0x0040
+#define DMA_END_CHAIN		0x0080
+#define DMA_COMPLETE		0x0100
+#define DMA_NOTIFY		0x0200
+#define DMA_NEW_HEAD		0x0400
+
+#define DMA_USER_MASK	(DMA_NOTIFY | DMA_INCOMPLETE | \
+						 DMA_HOLD | DMA_COMPLETE)
+
+#define DMA_DCR_DAC		0x00000020	/* Dual Addr Cycle Enab */
+#define DMA_DCR_IE		0x00000010	/* Interrupt Enable */
+#define DMA_DCR_PCI_IOR		0x00000002	/* I/O Read */
+#define DMA_DCR_PCI_IOW		0x00000003	/* I/O Write */
+#define DMA_DCR_PCI_MR		0x00000006	/* Memory Read */
+#define DMA_DCR_PCI_MW		0x00000007	/* Memory Write */
+#define DMA_DCR_PCI_CR		0x0000000A	/* Configuration Read */
+#define DMA_DCR_PCI_CW		0x0000000B	/* Configuration Write */
+#define DMA_DCR_PCI_MRM		0x0000000C	/* Memory Read Multiple */
+#define DMA_DCR_PCI_MRL		0x0000000E	/* Memory Read Line */
+#define DMA_DCR_PCI_MWI		0x0000000F	/* Mem Write and Inval */
+
+#define DMA_USER_CMD_IE		0x00000001	/* user request int */
+#define DMA_USER_END_CHAIN	0x00000002	/* end of sgl chain flag */
+
+/* ATU defines */
+#define     IOP310_ATUCR_PRIM_OUT_ENAB  /* Configuration   */      0x00000002
+#define     IOP310_ATUCR_DIR_ADDR_ENAB  /* Configuration   */      0x00000080
+
+
+typedef void (*dma_callback_t) (void *buf_context);
+/*
+ * DMA Descriptor
+ */
+typedef struct _dma_desc
+{
+	u32 NDAR;					/* next descriptor address */
+	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 pointer */
+	u32 status;					/* descriptor status */
+	void *data;					/* local virt */
+	struct _dma_sgl *next;		/* next descriptor */
+} 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;
+
+/* function prototypes */
+int dma_request(dmach_t, const char *);
+int dma_queue_buffer(dmach_t, dma_head_t *);
+int dma_suspend(dmach_t);
+int dma_resume(dmach_t);
+int dma_flush_all(dmach_t);
+void dma_free(dmach_t);
+void dma_set_irq_threshold(dmach_t, int);
+dma_sgl_t *dma_get_buffer(dmach_t, int);
+void dma_return_buffer(dmach_t, dma_sgl_t *);
+
+#endif /* _ASM_ARCH_DMA_H */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/hardware.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/hardware.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/hardware.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/hardware.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,38 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/hardware.h
+ */
+#ifndef __ASM_ARCH_HARDWARE_H
+#define __ASM_ARCH_HARDWARE_H
+
+#include <linux/config.h>
+
+/*
+ * Note about PCI IO space mappings
+ *
+ * To make IO space accesses efficient, we store virtual addresses in
+ * the IO resources.
+ *
+ * The PCI IO space is located at virtual 0xfe000000 from physical
+ * 0x90000000.  The PCI BARs must be programmed with physical addresses,
+ * but when we read them, we convert them to virtual addresses.  See
+ * arch/arm/mach-iop310/iop310-pci.c
+ */
+
+#define pcibios_assign_all_busses() 1
+
+/*
+ * these are the values for the secondary PCI bus on the 80312 chip.  I will
+ * have to do some fixup in the bus/dev fixup code
+ */
+#define PCIBIOS_MIN_IO      0
+#define PCIBIOS_MIN_MEM     0x88000000
+
+// Generic chipset bits
+#include "iop310.h"
+
+// Board specific
+#if defined(CONFIG_ARCH_IQ80310)
+#include "iq80310.h"
+#endif
+
+#endif  /* _ASM_ARCH_HARDWARE_H */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/ide.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/ide.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/ide.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/ide.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,51 @@
+/*
+ * 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, int data_port, int ctrl_port, int *irq)
+{
+	ide_ioreg_t reg;
+	int i;
+	int regincr = 1;
+
+	memset(hw, 0, sizeof(*hw));
+
+	reg = (ide_ioreg_t)data_port;
+
+	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
+		hw->io_ports[i] = reg;
+		reg += regincr;
+	}
+
+	hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) 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 -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/io.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/io.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/io.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/io.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,20 @@
+/*
+ * linux/include/asm-arm/arch-iop3xx/io.h
+ *
+ *  Copyright (C) 2001  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
+
+#define IO_SPACE_LIMIT 0xffffffff
+
+#define __io(p)			((p))
+#define __mem_pci(a)		((unsigned long)(a))
+#define __mem_isa(a)		((unsigned long)(a))
+
+#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/iop310.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/iop310.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/iop310.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/iop310.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,247 @@
+/*
+ * linux/include/asm/arch-iop3xx/iop310.h
+ *
+ * Intel IOP310 Compainion Chip definitions
+ *
+ * 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 _IOP310_HW_H_
+#define _IOP310_HW_H_
+
+/*
+ * IOP310 I/O and Mem space regions for PCI autoconfiguration
+ */
+#define IOP310_PCISEC_LOWER_IO		0x90010000
+#define IOP310_PCISEC_UPPER_IO		0x9001ffff
+#define IOP310_PCISEC_LOWER_MEM		0x88000000
+#define IOP310_PCISEC_UPPER_MEM		0x8bffffff
+
+#define IOP310_PCIPRI_LOWER_IO		0x90000000
+#define IOP310_PCIPRI_UPPER_IO		0x9000ffff
+#define IOP310_PCIPRI_LOWER_MEM		0x80000000
+#define IOP310_PCIPRI_UPPER_MEM		0x83ffffff
+
+#define IOP310_PCI_WINDOW_SIZE		64 * 0x100000
+
+/*
+ * IOP310 chipset registers
+ */
+#define IOP310_VIRT_MEM_BASE 0xe8001000  /* chip virtual mem address*/
+#define IOP310_PHY_MEM_BASE  0x00001000  /* chip physical memory address */
+#define IOP310_REG_ADDR(reg) (IOP310_VIRT_MEM_BASE | IOP310_PHY_MEM_BASE | (reg))
+
+/* PCI-to-PCI Bridge Unit 0x00001000 through 0x000010FF */
+#define IOP310_VIDR    (volatile u16 *)IOP310_REG_ADDR(0x00001000)
+#define IOP310_DIDR    (volatile u16 *)IOP310_REG_ADDR(0x00001002)
+#define IOP310_PCR     (volatile u16 *)IOP310_REG_ADDR(0x00001004)
+#define IOP310_PSR     (volatile u16 *)IOP310_REG_ADDR(0x00001006)
+#define IOP310_RIDR    (volatile u8  *)IOP310_REG_ADDR(0x00001008)
+#define IOP310_CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001009)
+#define IOP310_CLSR    (volatile u8  *)IOP310_REG_ADDR(0x0000100C)
+#define IOP310_PLTR    (volatile u8  *)IOP310_REG_ADDR(0x0000100D)
+#define IOP310_HTR     (volatile u8  *)IOP310_REG_ADDR(0x0000100E)
+/* Reserved 0x0000100F through  0x00001017 */
+#define IOP310_PBNR    (volatile u8  *)IOP310_REG_ADDR(0x00001018)
+#define IOP310_SBNR    (volatile u8  *)IOP310_REG_ADDR(0x00001019)
+#define IOP310_SUBBNR  (volatile u8  *)IOP310_REG_ADDR(0x0000101A)
+#define IOP310_SLTR    (volatile u8  *)IOP310_REG_ADDR(0x0000101B)
+#define IOP310_IOBR    (volatile u8  *)IOP310_REG_ADDR(0x0000101C)
+#define IOP310_IOLR    (volatile u8  *)IOP310_REG_ADDR(0x0000101D)
+#define IOP310_SSR     (volatile u16 *)IOP310_REG_ADDR(0x0000101E)
+#define IOP310_MBR     (volatile u16 *)IOP310_REG_ADDR(0x00001020)
+#define IOP310_MLR     (volatile u16 *)IOP310_REG_ADDR(0x00001022)
+#define IOP310_PMBR    (volatile u16 *)IOP310_REG_ADDR(0x00001024)
+#define IOP310_PMLR    (volatile u16 *)IOP310_REG_ADDR(0x00001026)
+/* Reserved 0x00001028 through 0x00001033 */
+#define IOP310_CAPR    (volatile u8  *)IOP310_REG_ADDR(0x00001034)
+/* Reserved 0x00001035 through 0x0000103D */
+#define IOP310_BCR     (volatile u16 *)IOP310_REG_ADDR(0x0000103E)
+#define IOP310_EBCR    (volatile u16 *)IOP310_REG_ADDR(0x00001040)
+#define IOP310_SISR    (volatile u16 *)IOP310_REG_ADDR(0x00001042)
+#define IOP310_PBISR   (volatile u32 *)IOP310_REG_ADDR(0x00001044)
+#define IOP310_SBISR   (volatile u32 *)IOP310_REG_ADDR(0x00001048)
+#define IOP310_SACR    (volatile u32 *)IOP310_REG_ADDR(0x0000104C)
+#define IOP310_PIRSR   (volatile u32 *)IOP310_REG_ADDR(0x00001050)
+#define IOP310_SIOBR   (volatile u8  *)IOP310_REG_ADDR(0x00001054)
+#define IOP310_SIOLR   (volatile u8  *)IOP310_REG_ADDR(0x00001055)
+#define IOP310_SCDR    (volatile u8  *)IOP310_REG_ADDR(0x00001056)
+
+#define IOP310_SMBR    (volatile u16 *)IOP310_REG_ADDR(0x00001058)
+#define IOP310_SMLR    (volatile u16 *)IOP310_REG_ADDR(0x0000105A)
+#define IOP310_SDER    (volatile u16 *)IOP310_REG_ADDR(0x0000105C)
+#define IOP310_QCR     (volatile u16 *)IOP310_REG_ADDR(0x0000105E)
+#define IOP310_CAPID   (volatile u8  *)IOP310_REG_ADDR(0x00001068)
+#define IOP310_NIPTR   (volatile u8  *)IOP310_REG_ADDR(0x00001069)
+#define IOP310_PMCR    (volatile u16 *)IOP310_REG_ADDR(0x0000106A)
+#define IOP310_PMCSR   (volatile u16 *)IOP310_REG_ADDR(0x0000106C)
+#define IOP310_PMCSRBSE (volatile u8 *)IOP310_REG_ADDR(0x0000106E)
+/* Reserved 0x00001064 through 0x000010FFH */
+
+/* Performance monitoring unit  0x00001100 through 0x000011FF*/
+#define IOP310_PMONGTMR    (volatile u32 *)IOP310_REG_ADDR(0x00001100)
+#define IOP310_PMONESR     (volatile u32 *)IOP310_REG_ADDR(0x00001104)
+#define IOP310_PMONEMISR   (volatile u32 *)IOP310_REG_ADDR(0x00001108)
+#define IOP310_PMONGTSR    (volatile u32 *)IOP310_REG_ADDR(0x00001110)
+#define IOP310_PMONPECR1   (volatile u32 *)IOP310_REG_ADDR(0x00001114)
+#define IOP310_PMONPECR2   (volatile u32 *)IOP310_REG_ADDR(0x00001118)
+#define IOP310_PMONPECR3   (volatile u32 *)IOP310_REG_ADDR(0x0000111C)
+#define IOP310_PMONPECR4   (volatile u32 *)IOP310_REG_ADDR(0x00001120)
+#define IOP310_PMONPECR5   (volatile u32 *)IOP310_REG_ADDR(0x00001124)
+#define IOP310_PMONPECR6   (volatile u32 *)IOP310_REG_ADDR(0x00001128)
+#define IOP310_PMONPECR7   (volatile u32 *)IOP310_REG_ADDR(0x0000112C)
+#define IOP310_PMONPECR8   (volatile u32 *)IOP310_REG_ADDR(0x00001130)
+#define IOP310_PMONPECR9   (volatile u32 *)IOP310_REG_ADDR(0x00001134)
+#define IOP310_PMONPECR10  (volatile u32 *)IOP310_REG_ADDR(0x00001138)
+#define IOP310_PMONPECR11  (volatile u32 *)IOP310_REG_ADDR(0x0000113C)
+#define IOP310_PMONPECR12  (volatile u32 *)IOP310_REG_ADDR(0x00001140)
+#define IOP310_PMONPECR13  (volatile u32 *)IOP310_REG_ADDR(0x00001144)
+#define IOP310_PMONPECR14  (volatile u32 *)IOP310_REG_ADDR(0x00001148)
+
+/* Address Translation Unit 0x00001200 through 0x000012FF */
+#define IOP310_ATUVID     (volatile u16 *)IOP310_REG_ADDR(0x00001200)
+#define IOP310_ATUDID     (volatile u16 *)IOP310_REG_ADDR(0x00001202)
+#define IOP310_PATUCMD    (volatile u16 *)IOP310_REG_ADDR(0x00001204)
+#define IOP310_PATUSR     (volatile u16 *)IOP310_REG_ADDR(0x00001206)
+#define IOP310_ATURID     (volatile u8  *)IOP310_REG_ADDR(0x00001208)
+#define IOP310_ATUCCR     (volatile u32 *)IOP310_REG_ADDR(0x00001209)
+#define IOP310_ATUCLSR    (volatile u8  *)IOP310_REG_ADDR(0x0000120C)
+#define IOP310_ATULT      (volatile u8  *)IOP310_REG_ADDR(0x0000120D)
+#define IOP310_ATUHTR     (volatile u8  *)IOP310_REG_ADDR(0x0000120E)
+
+#define IOP310_PIABAR     (volatile u32 *)IOP310_REG_ADDR(0x00001210)
+/* Reserved 0x00001214 through 0x0000122B */
+#define IOP310_ASVIR      (volatile u16 *)IOP310_REG_ADDR(0x0000122C)
+#define IOP310_ASIR       (volatile u16 *)IOP310_REG_ADDR(0x0000122E)
+#define IOP310_ERBAR      (volatile u32 *)IOP310_REG_ADDR(0x00001230)
+#define IOP310_ATUCAPPTR  (volatile u8  *)IOP310_REG_ADDR(0x00001234)
+/* Reserved 0x00001235 through 0x0000123B */
+#define IOP310_ATUILR     (volatile u8  *)IOP310_REG_ADDR(0x0000123C)
+#define IOP310_ATUIPR     (volatile u8  *)IOP310_REG_ADDR(0x0000123D)
+#define IOP310_ATUMGNT    (volatile u8  *)IOP310_REG_ADDR(0x0000123E)
+#define IOP310_ATUMLAT    (volatile u8  *)IOP310_REG_ADDR(0x0000123F)
+#define IOP310_PIALR      (volatile u32 *)IOP310_REG_ADDR(0x00001240)
+#define IOP310_PIATVR     (volatile u32 *)IOP310_REG_ADDR(0x00001244)
+#define IOP310_SIABAR     (volatile u32 *)IOP310_REG_ADDR(0x00001248)
+#define IOP310_SIALR      (volatile u32 *)IOP310_REG_ADDR(0x0000124C)
+#define IOP310_SIATVR     (volatile u32 *)IOP310_REG_ADDR(0x00001250)
+#define IOP310_POMWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001254)
+/* Reserved 0x00001258 through 0x0000125B */
+#define IOP310_POIOWVR    (volatile u32 *)IOP310_REG_ADDR(0x0000125C)
+#define IOP310_PODWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001260)
+#define IOP310_POUDR      (volatile u32 *)IOP310_REG_ADDR(0x00001264)
+#define IOP310_SOMWVR     (volatile u32 *)IOP310_REG_ADDR(0x00001268)
+#define IOP310_SOIOWVR    (volatile u32 *)IOP310_REG_ADDR(0x0000126C)
+/* Reserved 0x00001270 through 0x00001273*/
+#define IOP310_ERLR       (volatile u32 *)IOP310_REG_ADDR(0x00001274)
+#define IOP310_ERTVR      (volatile u32 *)IOP310_REG_ADDR(0x00001278)
+/* Reserved 0x00001279 through 0x0000127C*/
+#define IOP310_ATUCAPID   (volatile u8  *)IOP310_REG_ADDR(0x00001280)
+#define IOP310_ATUNIPTR   (volatile u8  *)IOP310_REG_ADDR(0x00001281)
+#define IOP310_APMCR      (volatile u16 *)IOP310_REG_ADDR(0x00001282)
+#define IOP310_APMCSR     (volatile u16 *)IOP310_REG_ADDR(0x00001284)
+/* Reserved 0x00001286 through 0x00001287 */
+#define IOP310_ATUCR      (volatile u32 *)IOP310_REG_ADDR(0x00001288)
+/* Reserved 0x00001289  through 0x0000128C*/
+#define IOP310_PATUISR    (volatile u32 *)IOP310_REG_ADDR(0x00001290)
+#define IOP310_SATUISR    (volatile u32 *)IOP310_REG_ADDR(0x00001294)
+#define IOP310_SATUCMD    (volatile u16 *)IOP310_REG_ADDR(0x00001298)
+#define IOP310_SATUSR     (volatile u16 *)IOP310_REG_ADDR(0x0000129A)
+#define IOP310_SODWVR     (volatile u32 *)IOP310_REG_ADDR(0x0000129C)
+#define IOP310_SOUDR      (volatile u32 *)IOP310_REG_ADDR(0x000012A0)
+#define IOP310_POCCAR     (volatile u32 *)IOP310_REG_ADDR(0x000012A4)
+#define IOP310_SOCCAR     (volatile u32 *)IOP310_REG_ADDR(0x000012A8)
+#define IOP310_POCCDR     (volatile u32 *)IOP310_REG_ADDR(0x000012AC)
+#define IOP310_SOCCDR     (volatile u32 *)IOP310_REG_ADDR(0x000012B0)
+#define IOP310_PAQCR      (volatile u32 *)IOP310_REG_ADDR(0x000012B4)
+#define IOP310_SAQCR      (volatile u32 *)IOP310_REG_ADDR(0x000012B8)
+#define IOP310_PATUIMR    (volatile u32 *)IOP310_REG_ADDR(0x000012BC)
+#define IOP310_SATUIMR    (volatile u32 *)IOP310_REG_ADDR(0x000012C0)
+/* Reserved 0x000012C4 through 0x000012FF */
+/* Messaging Unit 0x00001300 through 0x000013FF */
+#define IOP310_MUIMR0       (volatile u32 *)IOP310_REG_ADDR(0x00001310)
+#define IOP310_MUIMR1       (volatile u32 *)IOP310_REG_ADDR(0x00001314)
+#define IOP310_MUOMR0       (volatile u32 *)IOP310_REG_ADDR(0x00001318)
+#define IOP310_MUOMR1       (volatile u32 *)IOP310_REG_ADDR(0x0000131C)
+#define IOP310_MUIDR        (volatile u32 *)IOP310_REG_ADDR(0x00001320)
+#define IOP310_MUIISR       (volatile u32 *)IOP310_REG_ADDR(0x00001324)
+#define IOP310_MUIIMR       (volatile u32 *)IOP310_REG_ADDR(0x00001328)
+#define IOP310_MUODR        (volatile u32 *)IOP310_REG_ADDR(0x0000132C)
+#define IOP310_MUOISR       (volatile u32 *)IOP310_REG_ADDR(0x00001330)
+#define IOP310_MUOIMR       (volatile u32 *)IOP310_REG_ADDR(0x00001334)
+#define IOP310_MUMUCR       (volatile u32 *)IOP310_REG_ADDR(0x00001350)
+#define IOP310_MUQBAR       (volatile u32 *)IOP310_REG_ADDR(0x00001354)
+#define IOP310_MUIFHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001360)
+#define IOP310_MUIFTPR      (volatile u32 *)IOP310_REG_ADDR(0x00001364)
+#define IOP310_MUIPHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001368)
+#define IOP310_MUIPTPR      (volatile u32 *)IOP310_REG_ADDR(0x0000136C)
+#define IOP310_MUOFHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001370)
+#define IOP310_MUOFTPR      (volatile u32 *)IOP310_REG_ADDR(0x00001374)
+#define IOP310_MUOPHPR      (volatile u32 *)IOP310_REG_ADDR(0x00001378)
+#define IOP310_MUOPTPR      (volatile u32 *)IOP310_REG_ADDR(0x0000137C)
+#define IOP310_MUIAR        (volatile u32 *)IOP310_REG_ADDR(0x00001380)
+/* DMA Controller 0x00001400 through 0x000014FF */
+#define IOP310_DMA0CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001400)
+#define IOP310_DMA0CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001404)
+/* Reserved 0x001408 through 0x00140B */
+#define IOP310_DMA0DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000140C)
+#define IOP310_DMA0NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001410)
+#define IOP310_DMA0PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001414)
+#define IOP310_DMA0PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001418)
+#define IOP310_DMA0LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000141C)
+#define IOP310_DMA0BCR     (volatile u32 *)IOP310_REG_ADDR(0x00001420)
+#define IOP310_DMA0DCR     (volatile u32 *)IOP310_REG_ADDR(0x00001424)
+/* Reserved 0x00001428 through 0x0000143F */
+#define IOP310_DMA1CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001440)
+#define IOP310_DMA1CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001444)
+/* Reserved 0x00001448 through 0x0000144B */
+#define IOP310_DMA1DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000144C)
+#define IOP310_DMA1NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001450)
+#define IOP310_DMA1PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001454)
+#define IOP310_DMA1PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001458)
+#define IOP310_DMA1LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000145C)
+#define IOP310_DMA1BCR     (volatile u32 *)IOP310_REG_ADDR(0x00001460)
+#define IOP310_DMA1DCR     (volatile u32 *)IOP310_REG_ADDR(0x00001464)
+/* Reserved 0x00001468 through 0x0000147F */
+#define IOP310_DMA2CCR     (volatile u32 *)IOP310_REG_ADDR(0x00001480)
+#define IOP310_DMA2CSR     (volatile u32 *)IOP310_REG_ADDR(0x00001484)
+/* Reserved 0x00001488 through 0x0000148B */
+#define IOP310_DMA2DAR     (volatile u32 *)IOP310_REG_ADDR(0x0000148C)
+#define IOP310_DMA2NDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001490)
+#define IOP310_DMA2PADR    (volatile u32 *)IOP310_REG_ADDR(0x00001494)
+#define IOP310_DMA2PUADR   (volatile u32 *)IOP310_REG_ADDR(0x00001498)
+#define IOP310_DMA2LADR    (volatile u32 *)IOP310_REG_ADDR(0x0000149C)
+#define IOP310_DMA2BCR     (volatile u32 *)IOP310_REG_ADDR(0x000014A0)
+#define IOP310_DMA2DCR     (volatile u32 *)IOP310_REG_ADDR(0x000014A4)
+
+/* Memory controller 0x00001500 through 0x0015FF */
+
+/* core interface unit 0x00001640 - 0x0000167F */
+#define IOP310_CIUISR     (volatile u32 *)IOP310_REG_ADDR(0x00001644)
+
+/* PCI and Peripheral Interrupt Controller 0x00001700 - 0x0000171B */
+#define IOP310_IRQISR     (volatile u32 *)IOP310_REG_ADDR(0x00001700)
+#define IOP310_FIQ2ISR    (volatile u32 *)IOP310_REG_ADDR(0x00001704)
+#define IOP310_FIQ1ISR    (volatile u32 *)IOP310_REG_ADDR(0x00001708)
+#define IOP310_PDIDR      (volatile u32 *)IOP310_REG_ADDR(0x00001710)
+
+/* AAU registers. DJ 0x00001800 - 0x00001838 */
+#define IOP310_AAUACR    (volatile u32 *)IOP310_REG_ADDR(0x00001800)
+#define IOP310_AAUASR    (volatile u32 *)IOP310_REG_ADDR(0x00001804)
+#define IOP310_AAUADAR   (volatile u32 *)IOP310_REG_ADDR(0x00001808)
+#define IOP310_AAUANDAR  (volatile u32 *)IOP310_REG_ADDR(0x0000180C)
+#define IOP310_AAUSAR1   (volatile u32 *)IOP310_REG_ADDR(0x00001810)
+#define IOP310_AAUSAR2   (volatile u32 *)IOP310_REG_ADDR(0x00001814)
+#define IOP310_AAUSAR3   (volatile u32 *)IOP310_REG_ADDR(0x00001818)
+#define IOP310_AAUSAR4   (volatile u32 *)IOP310_REG_ADDR(0x0000181C)
+#define IOP310_AAUDAR    (volatile u32 *)IOP310_REG_ADDR(0x00001820)
+#define IOP310_AAUABCR   (volatile u32 *)IOP310_REG_ADDR(0x00001824)
+#define IOP310_AAUADCR   (volatile u32 *)IOP310_REG_ADDR(0x00001828)
+#define IOP310_AAUSAR5   (volatile u32 *)IOP310_REG_ADDR(0x0000182C)
+#define IOP310_AAUSAR6   (volatile u32 *)IOP310_REG_ADDR(0x00001830)
+#define IOP310_AAUSAR7   (volatile u32 *)IOP310_REG_ADDR(0x00001834)
+#define IOP310_AAUSAR8   (volatile u32 *)IOP310_REG_ADDR(0x00001838)
+
+#endif // _IOP310_HW_H_
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/iq80310.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/iq80310.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/iq80310.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/iq80310.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,30 @@
+/*
+ * linux/include/asm/arch-iop80310/iq80310.h
+ *
+ * Intel IQ-80310 evaluation board registers
+ */
+
+#ifndef _IQ80310_H_
+#define _IQ80310_H_
+
+#define IQ80310_RAMBASE      0xa0000000
+#define IQ80310_UART1        0xfe800000    /* UART #1 */
+#define IQ80310_UART2        0xfe810000    /* UART #2 */
+#define IQ80310_INT_STAT     0xfe820000    /* Interrupt (XINT3#) Status */
+#define IQ80310_BOARD_REV    0xfe830000    /* Board revision register */
+#define IQ80310_CPLD_REV     0xfe840000    /* CPLD revision register */
+#define IQ80310_7SEG_1       0xfe840000    /* 7-Segment MSB */
+#define IQ80310_7SEG_0       0xfe850000    /* 7-Segment LSB (WO) */
+#define IQ80310_PCI_INT_STAT 0xfe850000    /* PCI Interrupt  Status */
+#define IQ80310_INT_MASK     0xfe860000    /* Interrupt (XINT3#) Mask */
+#define IQ80310_BACKPLANE    0xfe870000    /* Backplane Detect */
+#define IQ80310_TIMER_LA0    0xfe880000    /* Timer LA0 */
+#define IQ80310_TIMER_LA1    0xfe890000    /* Timer LA1 */
+#define IQ80310_TIMER_LA2    0xfe8a0000    /* Timer LA2 */
+#define IQ80310_TIMER_LA3    0xfe8b0000    /* Timer LA3 */
+#define IQ80310_TIMER_EN     0xfe8c0000    /* Timer Enable */
+#define IQ80310_ROTARY_SW    0xfe8d0000    /* Rotary Switch */
+#define IQ80310_JTAG         0xfe8e0000    /* JTAG Port Access */
+#define IQ80310_BATT_STAT    0xfe8f0000    /* Battery Status */
+
+#endif	// _IQ80310_H_
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/irqs.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/irqs.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/irqs.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/irqs.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,80 @@
+/*
+ * linux/include/asm-arm/arch-iop3xx/irqs.h
+ *
+ * Author:	Nicolas Pitre
+ * Copyright:	(C) 2001 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.
+ *
+ * 06/13/01: Added 80310 on-chip interrupt sources <dsaxena@mvista.com>
+ *
+ */
+#include <linux/config.h>
+
+/*
+ * XS80200 specific IRQs
+ */
+#define IRQ_XS80200_BCU		0	/* Bus Control Unit */
+#define IRQ_XS80200_PMU		1	/* Performance Monitoring Unit */
+#define IRQ_XS80200_EXTIRQ	2	/* external IRQ signal */
+#define IRQ_XS80200_EXTFIQ	3	/* external IRQ signal */
+
+#define NR_XS80200_IRQS		4
+
+#define XSCALE_PMU_IRQ		IRQ_XS80200_PMU
+
+/*
+ * IOP80310 chipset interrupts
+ */
+#define IOP310_IRQ_OFS		NR_XS80200_IRQS
+#define IOP310_IRQ(x)		(IOP310_IRQ_OFS + (x))
+
+/*
+ * On FIQ1ISR register
+ */
+#define IRQ_IOP310_DMA0		IOP310_IRQ(0)	/* DMA Channel 0 */
+#define IRQ_IOP310_DMA1		IOP310_IRQ(1)	/* DMA Channel 1 */
+#define IRQ_IOP310_DMA2		IOP310_IRQ(2)	/* DMA Channel 2 */
+#define IRQ_IOP310_PMON		IOP310_IRQ(3)	/* Bus performance Unit */
+#define IRQ_IOP310_AAU		IOP310_IRQ(4)	/* Application Accelator Unit */
+
+/*
+ * On FIQ2ISR register
+ */
+#define IRQ_IOP310_I2C		IOP310_IRQ(5)	/* I2C unit */
+#define IRQ_IOP310_MU		IOP310_IRQ(6)	/* messaging unit */
+
+#define NR_IOP310_IRQS		(IOP310_IRQ(6) + 1)
+
+#define NR_IRQS			NR_IOP310_IRQS
+
+
+/*
+ * Interrupts available on the Cyclone IQ80310 board
+ */
+#ifdef CONFIG_ARCH_IQ80310
+
+#define IQ80310_IRQ_OFS		NR_IOP310_IRQS
+#define IQ80310_IRQ(y)		((IQ80310_IRQ_OFS) + (y))
+
+#define IRQ_IQ80310_TIMER	IQ80310_IRQ(0)	/* Timer Interrupt */
+#define IRQ_IQ80310_I82559	IQ80310_IRQ(1)	/* I82559 Ethernet Interrupt */
+#define IRQ_IQ80310_UART1	IQ80310_IRQ(2)	/* UART1 Interrupt */
+#define IRQ_IQ80310_UART2	IQ80310_IRQ(3)	/* UART2 Interrupt */
+#define IRQ_IQ80310_INTD	IQ80310_IRQ(4)	/* PCI INTD */
+
+
+/*
+ * ONLY AVAILABLE ON REV F OR NEWER BOARDS!
+ */
+#define	IRQ_IQ80310_INTA	IQ80310_IRQ(5)	/* PCI INTA */
+#define	IRQ_IQ80310_INTB	IQ80310_IRQ(6)	/* PCI INTB */
+#define	IRQ_IQ80310_INTC	IQ80310_IRQ(7)	/* PCI INTC */
+
+#undef	NR_IRQS
+#define NR_IRQS			(IQ80310_IRQ(7) + 1)
+
+#endif // CONFIG_ARCH_IQ80310
+
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/memory.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/memory.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/memory.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/memory.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,58 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/memory.h
+ */
+
+#ifndef __ASM_ARCH_MEMORY_H
+#define __ASM_ARCH_MEMORY_H
+
+#include <linux/config.h>
+#include <asm/arch/iop310.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)) & ~(*IOP310_SIATVR)) | ((*IOP310_SIABAR) & 0xfffffff0))
+#define __bus_to_virt(x)    (__phys_to_virt(((x) & ~(*IOP310_SIALR)) | ( *IOP310_SIATVR)))
+
+/* boot mem allocate global pointer for MU circular queues QBAR */
+#ifdef CONFIG_IOP310_MU
+extern void *mu_mem;
+#endif
+
+#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/param.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/param.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/param.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/param.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,3 @@
+/*
+ *  linux/include/asm-arm/arch-iop80310/param.h
+ */
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/pmon.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/pmon.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/pmon.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/pmon.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,50 @@
+/*
+ * Definitions for XScale 80312 PMON
+ * (C) 2001 Intel Corporation
+ * Author: Chen Chen(chen.chen@intel.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.
+ */
+
+#ifndef _IOP310_PMON_H_
+#define _IOP310_PMON_H_
+
+/*
+ *  Different modes for Event Select Register for intel 80312
+ */
+
+#define IOP310_PMON_MODE0                0x00000000
+#define IOP310_PMON_MODE1                0x00000001
+#define IOP310_PMON_MODE2                0x00000002
+#define IOP310_PMON_MODE3                0x00000003
+#define IOP310_PMON_MODE4                0x00000004
+#define IOP310_PMON_MODE5                0x00000005
+#define IOP310_PMON_MODE6                0x00000006
+#define IOP310_PMON_MODE7                0x00000007
+
+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;
+
+/* function prototypes */
+
+/* Claim IQ80312 PMON for usage */
+int iop310_pmon_claim(void);
+
+/* Start IQ80312 PMON */
+int iop310_pmon_start(int, int);
+
+/* Stop Performance Monitor Unit */
+int iop310_pmon_stop(iop310_pmon_res_t *);
+
+/* Release IQ80312 PMON */
+int iop310_pmon_release(int);
+
+#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/serial.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/serial.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/serial.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/serial.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,34 @@
+/*
+ * include/asm-arm/arch-iop3xx/serial.h
+ */
+#include <linux/config.h>
+
+/*
+ * This assumes you have a 1.8432 MHz clock for your UART.
+ *
+ * It'd be nice if someone built a serial card with a 24.576 MHz
+ * clock, since the 16550A is capable of handling a top speed of 1.5
+ * megabits/second; but this requires the faster clock.
+ */
+#define BASE_BAUD ( 1843200 / 16 )
+
+/* Standard COM flags */
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
+
+#ifdef CONFIG_ARCH_IQ80310
+
+#define IRQ_UART1	IRQ_IQ80310_UART1
+#define IRQ_UART2	IRQ_IQ80310_UART2
+
+#define RS_TABLE_SIZE 2
+
+#define STD_SERIAL_PORT_DEFNS			\
+       /* UART CLK      PORT        IRQ        FLAGS        */			\
+	{ 0, BASE_BAUD, IQ80310_UART2, IRQ_UART2, STD_COM_FLAGS },  /* ttyS0 */	\
+	{ 0, BASE_BAUD, IQ80310_UART1, IRQ_UART1, STD_COM_FLAGS }  /* ttyS1 */
+
+#endif // CONFIG_ARCH_IQ80310
+
+
+#define EXTRA_SERIAL_PORT_DEFNS
+
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/system.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/system.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/system.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/system.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,27 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/system.h
+ *
+ *  Copyright (C) 2001 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.
+ */
+
+static inline void arch_idle(void)
+{
+	cpu_do_idle();
+}
+
+
+static inline void arch_reset(char mode)
+{
+	if ( 1 && mode == 's') {
+		/* Jump into ROM at address 0 */
+		cpu_reset(0);
+	} else {
+		/* No on-chip reset capability */
+		cpu_reset(0);
+	}
+}
+
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/time.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/time.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/time.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/time.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,12 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/time.h
+ *
+ * Author:  Nicolas Pitre
+ * Copyright:   (C) 2001 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.
+ *
+ */
+
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/timex.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/timex.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/timex.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/timex.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,23 @@
+/*
+ * linux/include/asm-arm/arch-iop80310/timex.h
+ *
+ * IOP310 architecture timex specifications
+ */
+#include <linux/config.h>
+
+
+#ifdef CONFIG_ARCH_IQ80310
+
+#ifndef CONFIG_XSCALE_PMU_TIMER
+/* This is for the on-board timer */
+#define CLOCK_TICK_RATE 33000000 /* Underlying HZ */
+#else
+/* This is for the underlying xs80200 PMU clock. We run the core @ 733MHz */
+#define CLOCK_TICK_RATE	733000000
+#endif
+
+#else
+
+#error "No IOP310 timex information for this architecture"
+
+#endif
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/uncompress.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/uncompress.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/uncompress.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/uncompress.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,34 @@
+/*
+ *  linux/include/asm-arm/arch-iop80310/uncompress.h
+ */
+#include <linux/config.h>
+
+#ifdef CONFIG_ARCH_IQ80310
+#define UART1_BASE    ((volatile unsigned char *)0xfe800000)
+#define UART2_BASE    ((volatile unsigned char *)0xfe810000)
+#endif
+
+static __inline__ void putc(char c)
+{
+	while ((UART2_BASE[5] & 0x60) != 0x60);
+	UART2_BASE[0] = c;
+}
+
+/*
+ * This does not append a newline
+ */
+static void puts(const char *s)
+{
+	while (*s) {
+		putc(*s);
+		if (*s == '\n')
+			putc('\r');
+		s++;
+	}
+}
+
+/*
+ * nothing to do
+ */
+#define arch_decomp_setup()
+#define arch_decomp_wdog()
diff -urN linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/vmalloc.h linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/vmalloc.h
--- linux-2.5.67-bk5/include/asm-arm/arch-iop3xx/vmalloc.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-arm/arch-iop3xx/vmalloc.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,19 @@
+/*
+ * linux/include/asm-arm/arch-iop3xx/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       (0xe8000000)
+
+#define MODULE_START	(PAGE_OFFSET - 16*1048576)
+#define MODULE_END	(PAGE_OFFSET)
diff -urN linux-2.5.67-bk5/include/asm-arm/assembler.h linux-2.5.67-bk6/include/asm-arm/assembler.h
--- linux-2.5.67-bk5/include/asm-arm/assembler.h	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/assembler.h	2003-04-15 04:36:16.000000000 -0700
@@ -26,3 +26,13 @@
 #define push            lsr
 #define byte(x)         ((3-x)*8)
 #endif
+
+/*
+ * Data preload for architectures that support it
+ */
+#if __LINUX_ARM_ARCH__ >= 5
+#define PLD(code...)	code
+#else
+#define PLD(code...)
+#endif
+
diff -urN linux-2.5.67-bk5/include/asm-arm/hardware/sa1111.h linux-2.5.67-bk6/include/asm-arm/hardware/sa1111.h
--- linux-2.5.67-bk5/include/asm-arm/hardware/sa1111.h	2003-04-07 10:32:54.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/hardware/sa1111.h	2003-04-15 04:36:16.000000000 -0700
@@ -553,6 +553,7 @@
 	void		*mapbase;
 	unsigned int	skpcr_mask;
 	unsigned int	irq[6];
+	u64		dma_mask;
 };
 
 #define SA1111_DEV(_d)	container_of((_d), struct sa1111_dev, dev)
diff -urN linux-2.5.67-bk5/include/asm-arm/uaccess.h linux-2.5.67-bk6/include/asm-arm/uaccess.h
--- linux-2.5.67-bk5/include/asm-arm/uaccess.h	2003-04-07 10:31:53.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-arm/uaccess.h	2003-04-15 04:36:16.000000000 -0700
@@ -28,8 +28,7 @@
 	unsigned long insn, fixup;
 };
 
-/* Returns 0 if exception not found and fixup otherwise.  */
-extern unsigned long search_exception_table(unsigned long);
+extern int fixup_exception(struct pt_regs *regs);
 
 #define get_ds()	(KERNEL_DS)
 #define get_fs()	(current_thread_info()->addr_limit)
diff -urN linux-2.5.67-bk5/include/asm-i386/setup.h linux-2.5.67-bk6/include/asm-i386/setup.h
--- linux-2.5.67-bk5/include/asm-i386/setup.h	2003-04-07 10:31:55.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-i386/setup.h	2003-04-15 04:36:16.000000000 -0700
@@ -37,6 +37,7 @@
 #define KERNEL_START (*(unsigned long *) (PARAM+0x214))
 #define INITRD_START (*(unsigned long *) (PARAM+0x218))
 #define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
+#define EDID_INFO   (*(struct edid_info *) (PARAM+0x440))
 #define EDD_NR     (*(unsigned char *) (PARAM+EDDNR))
 #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
 #define COMMAND_LINE ((char *) (PARAM+2048))
diff -urN linux-2.5.67-bk5/include/asm-i386/system.h linux-2.5.67-bk6/include/asm-i386/system.h
--- linux-2.5.67-bk5/include/asm-i386/system.h	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-i386/system.h	2003-04-15 04:36:16.000000000 -0700
@@ -378,8 +378,8 @@
 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
 
 /* interrupt control.. */
-#define local_save_flags(x)	__asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */)
-#define local_irq_restore(x) 	__asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
+#define local_save_flags(x)	do { typecheck(unsigned long,x); __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */); } while (0)
+#define local_irq_restore(x) 	do { typecheck(unsigned long,x); __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc"); } while (0)
 #define local_irq_disable() 	__asm__ __volatile__("cli": : :"memory")
 #define local_irq_enable()	__asm__ __volatile__("sti": : :"memory")
 /* used in the idle loop; sti takes one instruction cycle to complete */
diff -urN linux-2.5.67-bk5/include/asm-s390/bitops.h linux-2.5.67-bk6/include/asm-s390/bitops.h
--- linux-2.5.67-bk5/include/asm-s390/bitops.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/bitops.h	2003-04-15 04:36:16.000000000 -0700
@@ -15,6 +15,7 @@
 #include <linux/config.h>
 
 /*
+ * 32 bit bitops format:
  * bit 0 is the LSB of *addr; bit 31 is the MSB of *addr;
  * bit 32 is the LSB of *(addr+4). That combined with the
  * big endian byte order on S390 give the following bit
@@ -28,6 +29,25 @@
  * in the architecture independent code bits operations
  * of the form "flags |= (1 << bitnr)" are used INTERMIXED
  * with operation of the form "set_bit(bitnr, flags)".
+ *
+ * 64 bit bitops format:
+ * bit 0 is the LSB of *addr; bit 63 is the MSB of *addr;
+ * bit 64 is the LSB of *(addr+8). That combined with the
+ * big endian byte order on S390 give the following bit
+ * order in memory:
+ *    3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
+ *    2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
+ *    1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10
+ *    0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
+ * after that follows the next long with bit numbers
+ *    7f 7e 7d 7c 7b 7a 79 78 77 76 75 74 73 72 71 70
+ *    6f 6e 6d 6c 6b 6a 69 68 67 66 65 64 63 62 61 60
+ *    5f 5e 5d 5c 5b 5a 59 58 57 56 55 54 53 52 51 50
+ *    4f 4e 4d 4c 4b 4a 49 48 47 46 45 44 43 42 41 40
+ * The reason for this bit ordering is the fact that
+ * in the architecture independent code bits operations
+ * of the form "flags |= (1 << bitnr)" are used INTERMIXED
+ * with operation of the form "set_bit(bitnr, flags)".
  */
 
 /* set ALIGN_CS to 1 if the SMP safe bit operations should
@@ -49,106 +69,126 @@
 extern const char _zb_findmap[];
 extern const char _sb_findmap[];
 
+#ifndef __s390x__
+
+#define __BITOPS_ALIGN		3
+#define __BITOPS_WORDSIZE	32
+#define __BITOPS_OR		"or"
+#define __BITOPS_AND		"nr"
+#define __BITOPS_XOR		"xr"
+
+#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)		\
+	__asm__ __volatile__("   l   %0,0(%4)\n"			\
+			     "0: lr  %1,%0\n"				\
+			     __op_string "  %1,%3\n"			\
+			     "   cs  %0,%1,0(%4)\n"			\
+			     "   jl  0b"				\
+			     : "=&d" (__old), "=&d" (__new),	       	\
+			       "=m" (*(unsigned long *) __addr)		\
+			     : "d" (__val), "a" (__addr),		\
+			       "m" (*(unsigned long *) __addr) : "cc" );
+
+#else /* __s390x__ */
+
+#define __BITOPS_ALIGN		7
+#define __BITOPS_WORDSIZE	64
+#define __BITOPS_OR		"ogr"
+#define __BITOPS_AND		"ngr"
+#define __BITOPS_XOR		"xgr"
+
+#define __BITOPS_LOOP(__old, __new, __addr, __val, __op_string)		\
+	__asm__ __volatile__("   lg  %0,0(%4)\n"			\
+			     "0: lgr %1,%0\n"				\
+			     __op_string "  %1,%3\n"			\
+			     "   csg %0,%1,0(%4)\n"			\
+			     "   jl  0b"				\
+			     : "=&d" (__old), "=&d" (__new),	       	\
+			       "=m" (*(unsigned long *) __addr)		\
+			     : "d" (__val), "a" (__addr),		\
+			       "m" (*(unsigned long *) __addr) : "cc" );
+
+#endif /* __s390x__ */
+
 #ifdef CONFIG_SMP
 /*
  * SMP safe set_bit routine based on compare and swap (CS)
  */
-static inline void set_bit_cs(int nr, volatile unsigned long *ptr)
+static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
-	addr ^= addr & 3;		/* align address to 4 */
+	nr += (addr & __BITOPS_ALIGN) << 3;    /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	       /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 31);	/* make OR mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   or  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make OR mask */
+	mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
 }
 
 /*
  * SMP safe clear_bit routine based on compare and swap (CS)
  */
-static inline void clear_bit_cs(int nr, volatile unsigned long *ptr)
+static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
-	addr ^= addr & 3;		/* align address to 4 */
+	nr += (addr & __BITOPS_ALIGN) << 3;    /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	       /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = ~(1UL << (nr & 31));	/* make AND mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   nr  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make AND mask */
+	mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1)));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
 }
 
 /*
  * SMP safe change_bit routine based on compare and swap (CS)
  */
-static inline void change_bit_cs(int nr, volatile unsigned long *ptr)
+static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
-	addr ^= addr & 3;		/* align address to 4 */
+	nr += (addr & __BITOPS_ALIGN) << 3;    /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	       /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 31);	/* make XOR mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   xr  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make XOR mask */
+	mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
 }
 
 /*
  * SMP safe test_and_set_bit routine based on compare and swap (CS)
  */
 static inline int
-test_and_set_bit_cs(int nr, volatile unsigned long *ptr)
+test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	addr ^= addr & 3;		/* align address to 4 */
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
+	nr += (addr & __BITOPS_ALIGN) << 3;    /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	       /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 31);	/* make OR/test mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   or  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make OR/test mask */
+	mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_OR);
 	return (old & mask) != 0;
 }
 
@@ -156,26 +196,21 @@
  * SMP safe test_and_clear_bit routine based on compare and swap (CS)
  */
 static inline int
-test_and_clear_bit_cs(int nr, volatile unsigned long *ptr)
+test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
-	addr ^= addr & 3;		/* align address to 4 */
+	nr += (addr & __BITOPS_ALIGN) << 3;    /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	       /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = ~(1UL << (nr & 31));	/* make AND mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   nr  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make AND/test mask */
+	mask = ~(1UL << (nr & (__BITOPS_WORDSIZE - 1)));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_AND);
 	return (old ^ new) != 0;
 }
 
@@ -183,26 +218,21 @@
  * SMP safe test_and_change_bit routine based on compare and swap (CS) 
  */
 static inline int
-test_and_change_bit_cs(int nr, volatile unsigned long *ptr)
+test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
 {
         unsigned long addr, old, new, mask;
 
 	addr = (unsigned long) ptr;
 #if ALIGN_CS == 1
-	nr += (addr & 3) << 3;		/* add alignment to bit number */
-	addr ^= addr & 3;		/* align address to 4 */
+	nr += (addr & __BITOPS_ALIGN) << 3;  /* add alignment to bit number */
+	addr ^= addr & __BITOPS_ALIGN;	     /* align address to 8 */
 #endif
-	addr += (nr ^ (nr & 31)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 31);	/* make XOR mask */
-	asm volatile(
-		"   l   %0,0(%4)\n"
-		"0: lr  %1,%0\n"
-		"   xr  %1,%3\n"
-		"   cs  %0,%1,0(%4)\n"
-		"   jl  0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned int *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
+	/* calculate address for CS */
+	addr += (nr ^ (nr & (__BITOPS_WORDSIZE - 1))) >> 3;
+	/* make XOR/test mask */
+	mask = 1UL << (nr & (__BITOPS_WORDSIZE - 1));
+	/* Do the atomic update. */
+	__BITOPS_LOOP(old, new, addr, mask, __BITOPS_XOR);
 	return (old & mask) != 0;
 }
 #endif /* CONFIG_SMP */
@@ -210,55 +240,55 @@
 /*
  * fast, non-SMP set_bit routine
  */
-static inline void __set_bit(int nr, volatile unsigned long *ptr)
+static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
         asm volatile("oc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
+		     : "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 }
 
 static inline void 
-__constant_set_bit(const int nr, volatile unsigned long *ptr)
+__constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 3);
+	addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	switch (nr&7) {
 	case 0:
-		asm volatile ("oi 0(%1),0x01"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x01" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 1:
-		asm volatile ("oi 0(%1),0x02"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x02" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 2:
-		asm volatile ("oi 0(%1),0x04" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x04" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 3:
-		asm volatile ("oi 0(%1),0x08" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x08" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 4:
-		asm volatile ("oi 0(%1),0x10" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x10" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 5:
-		asm volatile ("oi 0(%1),0x20" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x20" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 6:
-		asm volatile ("oi 0(%1),0x40" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x40" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 7:
-		asm volatile ("oi 0(%1),0x80" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("oi 0(%1),0x80" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	}
 }
@@ -272,55 +302,55 @@
  * fast, non-SMP clear_bit routine
  */
 static inline void 
-__clear_bit(int nr, volatile unsigned long *ptr)
+__clear_bit(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
         asm volatile("nc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_ni_bitmap + (nr & 7))
-		     : "cc" );
+		     : "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 }
 
 static inline void 
-__constant_clear_bit(const int nr, volatile unsigned long *ptr)
+__constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 3);
+	addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	switch (nr&7) {
 	case 0:
-		asm volatile ("ni 0(%1),0xFE"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xFE" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 1:
-		asm volatile ("ni 0(%1),0xFD" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xFD": "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 2:
-		asm volatile ("ni 0(%1),0xFB" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xFB" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 3:
-		asm volatile ("ni 0(%1),0xF7" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xF7" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 4:
-		asm volatile ("ni 0(%1),0xEF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xEF" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 5:
-		asm volatile ("ni 0(%1),0xDF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xDF" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 6:
-		asm volatile ("ni 0(%1),0xBF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0xBF" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 7:
-		asm volatile ("ni 0(%1),0x7F" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("ni 0(%1),0x7F" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	}
 }
@@ -333,55 +363,55 @@
 /* 
  * fast, non-SMP change_bit routine 
  */
-static inline void __change_bit(int nr, volatile unsigned long *ptr)
+static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
         asm volatile("xc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
+		     :  "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 }
 
 static inline void 
-__constant_change_bit(const int nr, volatile unsigned long *ptr) 
+__constant_change_bit(const unsigned long nr, volatile unsigned long *ptr) 
 {
 	unsigned long addr;
 
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 3);
+	addr = ((unsigned long) ptr) + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	switch (nr&7) {
 	case 0:
-		asm volatile ("xi 0(%1),0x01" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x01" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 1:
-		asm volatile ("xi 0(%1),0x02" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x02" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 2:
-		asm volatile ("xi 0(%1),0x04" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x04" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 3:
-		asm volatile ("xi 0(%1),0x08" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x08" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 4:
-		asm volatile ("xi 0(%1),0x10" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x10" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 5:
-		asm volatile ("xi 0(%1),0x20" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x20" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 6:
-		asm volatile ("xi 0(%1),0x40" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x40" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	case 7:
-		asm volatile ("xi 0(%1),0x80" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
+		asm volatile ("xi 0(%1),0x80" : "=m" (*(char *) addr)
+			      : "a" (addr), "m" (*(char *) addr) : "cc" );
 		break;
 	}
 }
@@ -395,17 +425,17 @@
  * fast, non-SMP test_and_set_bit routine
  */
 static inline int
-test_and_set_bit_simple(int nr, volatile unsigned long *ptr)
+test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 	unsigned char ch;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	ch = *(unsigned char *) addr;
         asm volatile("oc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
+		     : "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 	return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_set_bit(X,Y)		test_and_set_bit_simple(X,Y)
@@ -414,17 +444,17 @@
  * fast, non-SMP test_and_clear_bit routine
  */
 static inline int
-test_and_clear_bit_simple(int nr, volatile unsigned long *ptr)
+test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 	unsigned char ch;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	ch = *(unsigned char *) addr;
         asm volatile("nc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_ni_bitmap + (nr & 7))
-		     : "cc" );
+		     : "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_ni_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 	return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_clear_bit(X,Y)	test_and_clear_bit_simple(X,Y)
@@ -433,17 +463,17 @@
  * fast, non-SMP test_and_change_bit routine
  */
 static inline int
-test_and_change_bit_simple(int nr, volatile unsigned long *ptr)
+test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
 {
 	unsigned long addr;
 	unsigned char ch;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	ch = *(unsigned char *) addr;
         asm volatile("xc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
+		     : "=m" (*(char *) addr)
+		     : "a" (addr), "a" (_oi_bitmap + (nr & 7)),
+		       "m" (*(char *) addr) : "cc" );
 	return (ch >> (nr & 7)) & 1;
 }
 #define __test_and_change_bit(X,Y)	test_and_change_bit_simple(X,Y)
@@ -469,19 +499,20 @@
  * This routine doesn't need to be atomic.
  */
 
-static inline int __test_bit(int nr, const volatile unsigned long *ptr)
+static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr)
 {
 	unsigned long addr;
 	unsigned char ch;
 
-	addr = (unsigned long) ptr + ((nr ^ 24) >> 3);
+	addr = (unsigned long) ptr + ((nr ^ (__BITOPS_WORDSIZE - 8)) >> 3);
 	ch = *(unsigned char *) addr;
 	return (ch >> (nr & 7)) & 1;
 }
 
 static inline int 
-__constant_test_bit(int nr, const volatile unsigned long * addr) {
-    return (((volatile char *) addr)[(nr>>3)^3] & (1<<(nr&7))) != 0;
+__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
+    return (((volatile char *) addr)
+	    [(nr^(__BITOPS_WORDSIZE-8))>>3] & (1<<(nr&7)));
 }
 
 #define test_bit(nr,addr) \
@@ -489,6 +520,8 @@
  __constant_test_bit((nr),(addr)) : \
  __test_bit((nr),(addr)) )
 
+#ifndef __s390x__
+
 /*
  * Find-bit routines..
  */
@@ -701,6 +734,245 @@
         return result;
 }
 
+#else /* __s390x__ */
+
+/*
+ * Find-bit routines..
+ */
+static inline unsigned long
+find_first_zero_bit(unsigned long * addr, unsigned long size)
+{
+        unsigned long res, cmp, count;
+
+        if (!size)
+                return 0;
+        __asm__("   lghi  %1,-1\n"
+                "   lgr   %2,%3\n"
+                "   slgr  %0,%0\n"
+                "   aghi  %2,63\n"
+                "   srlg  %2,%2,6\n"
+                "0: cg    %1,0(%0,%4)\n"
+                "   jne   1f\n"
+                "   aghi  %0,8\n"
+                "   brct  %2,0b\n"
+                "   lgr   %0,%3\n"
+                "   j     5f\n"
+                "1: lg    %2,0(%0,%4)\n"
+                "   sllg  %0,%0,3\n"
+                "   clr   %2,%1\n"
+		"   jne   2f\n"
+		"   aghi  %0,32\n"
+                "   srlg  %2,%2,32\n"
+		"2: lghi  %1,0xff\n"
+                "   tmll  %2,0xffff\n"
+                "   jno   3f\n"
+                "   aghi  %0,16\n"
+                "   srl   %2,16\n"
+                "3: tmll  %2,0x00ff\n"
+                "   jno   4f\n"
+                "   aghi  %0,8\n"
+                "   srl   %2,8\n"
+                "4: ngr   %2,%1\n"
+                "   ic    %2,0(%2,%5)\n"
+                "   algr  %0,%2\n"
+                "5:"
+                : "=&a" (res), "=&d" (cmp), "=&a" (count)
+		: "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" );
+        return (res < size) ? res : size;
+}
+
+static inline unsigned long
+find_first_bit(unsigned long * addr, unsigned long size)
+{
+        unsigned long res, cmp, count;
+
+        if (!size)
+                return 0;
+        __asm__("   slgr  %1,%1\n"
+                "   lgr   %2,%3\n"
+                "   slgr  %0,%0\n"
+                "   aghi  %2,63\n"
+                "   srlg  %2,%2,6\n"
+                "0: cg    %1,0(%0,%4)\n"
+                "   jne   1f\n"
+                "   aghi  %0,8\n"
+                "   brct  %2,0b\n"
+                "   lgr   %0,%3\n"
+                "   j     5f\n"
+                "1: lg    %2,0(%0,%4)\n"
+                "   sllg  %0,%0,3\n"
+                "   clr   %2,%1\n"
+		"   jne   2f\n"
+		"   aghi  %0,32\n"
+                "   srlg  %2,%2,32\n"
+		"2: lghi  %1,0xff\n"
+                "   tmll  %2,0xffff\n"
+                "   jnz   3f\n"
+                "   aghi  %0,16\n"
+                "   srl   %2,16\n"
+                "3: tmll  %2,0x00ff\n"
+                "   jnz   4f\n"
+                "   aghi  %0,8\n"
+                "   srl   %2,8\n"
+                "4: ngr   %2,%1\n"
+                "   ic    %2,0(%2,%5)\n"
+                "   algr  %0,%2\n"
+                "5:"
+                : "=&a" (res), "=&d" (cmp), "=&a" (count)
+		: "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" );
+        return (res < size) ? res : size;
+}
+
+static inline unsigned long
+find_next_zero_bit (unsigned long * addr, unsigned long size, unsigned long offset)
+{
+        unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
+        unsigned long bitvec, reg;
+        unsigned long set, bit = offset & 63, res;
+
+        if (bit) {
+                /*
+                 * Look for zero in first word
+                 */
+                bitvec = (*p) >> bit;
+                __asm__("   lhi  %2,-1\n"
+                        "   slgr %0,%0\n"
+                        "   clr  %1,%2\n"
+                        "   jne  0f\n"
+                        "   aghi %0,32\n"
+                        "   srlg %1,%1,32\n"
+			"0: lghi %2,0xff\n"
+                        "   tmll %1,0xffff\n"
+                        "   jno  1f\n"
+                        "   aghi %0,16\n"
+                        "   srlg %1,%1,16\n"
+                        "1: tmll %1,0x00ff\n"
+                        "   jno  2f\n"
+                        "   aghi %0,8\n"
+                        "   srlg %1,%1,8\n"
+                        "2: ngr  %1,%2\n"
+                        "   ic   %1,0(%1,%3)\n"
+                        "   algr %0,%1"
+                        : "=&d" (set), "+a" (bitvec), "=&d" (reg)
+                        : "a" (&_zb_findmap) : "cc" );
+                if (set < (64 - bit))
+                        return set + offset;
+                offset += 64 - bit;
+                p++;
+        }
+        /*
+         * No zero yet, search remaining full words for a zero
+         */
+        res = find_first_zero_bit (p, size - 64 * (p - (unsigned long *) addr));
+        return (offset + res);
+}
+
+static inline unsigned long
+find_next_bit (unsigned long * addr, unsigned long size, unsigned long offset)
+{
+        unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
+        unsigned long bitvec, reg;
+        unsigned long set, bit = offset & 63, res;
+
+        if (bit) {
+                /*
+                 * Look for zero in first word
+                 */
+                bitvec = (*p) >> bit;
+                __asm__("   slgr %0,%0\n"
+                        "   ltr  %1,%1\n"
+                        "   jnz  0f\n"
+                        "   aghi %0,32\n"
+                        "   srlg %1,%1,32\n"
+			"0: lghi %2,0xff\n"
+                        "   tmll %1,0xffff\n"
+                        "   jnz  1f\n"
+                        "   aghi %0,16\n"
+                        "   srlg %1,%1,16\n"
+                        "1: tmll %1,0x00ff\n"
+                        "   jnz  2f\n"
+                        "   aghi %0,8\n"
+                        "   srlg %1,%1,8\n"
+                        "2: ngr  %1,%2\n"
+                        "   ic   %1,0(%1,%3)\n"
+                        "   algr %0,%1"
+                        : "=&d" (set), "+a" (bitvec), "=&d" (reg)
+                        : "a" (&_sb_findmap) : "cc" );
+                if (set < (64 - bit))
+                        return set + offset;
+                offset += 64 - bit;
+                p++;
+        }
+        /*
+         * No set bit yet, search remaining full words for a bit
+         */
+        res = find_first_bit (p, size - 64 * (p - (unsigned long *) addr));
+        return (offset + res);
+}
+
+/*
+ * ffz = Find First Zero in word. Undefined if no zero exists,
+ * so code should check against ~0UL first..
+ */
+static inline unsigned long ffz(unsigned long word)
+{
+	unsigned long reg, result;
+
+        __asm__("   lhi  %2,-1\n"
+                "   slgr %0,%0\n"
+                "   clr  %1,%2\n"
+                "   jne  0f\n"
+                "   aghi %0,32\n"
+                "   srlg %1,%1,32\n"
+                "0: lghi %2,0xff\n"
+                "   tmll %1,0xffff\n"
+                "   jno  1f\n"
+                "   aghi %0,16\n"
+                "   srlg %1,%1,16\n"
+                "1: tmll %1,0x00ff\n"
+                "   jno  2f\n"
+                "   aghi %0,8\n"
+                "   srlg %1,%1,8\n"
+                "2: ngr  %1,%2\n"
+                "   ic   %1,0(%1,%3)\n"
+                "   algr %0,%1"
+                : "=&d" (result), "+a" (word), "=&d" (reg)
+                : "a" (&_zb_findmap) : "cc" );
+        return result;
+}
+
+/*
+ * __ffs = find first bit in word. Undefined if no bit exists,
+ * so code should check against 0UL first..
+ */
+static inline unsigned long __ffs (unsigned long word)
+{
+        unsigned long reg, result;
+
+        __asm__("   slgr %0,%0\n"
+                "   ltr  %1,%1\n"
+                "   jnz  0f\n"
+                "   aghi %0,32\n"
+                "   srlg %1,%1,32\n"
+                "0: lghi %2,0xff\n"
+                "   tmll %1,0xffff\n"
+                "   jnz  1f\n"
+                "   aghi %0,16\n"
+                "   srlg %1,%1,16\n"
+                "1: tmll %1,0x00ff\n"
+                "   jnz  2f\n"
+                "   aghi %0,8\n"
+                "   srlg %1,%1,8\n"
+                "2: ngr  %1,%2\n"
+                "   ic   %1,0(%1,%3)\n"
+                "   algr %0,%1"
+                : "=&d" (result), "+a" (word), "=&d" (reg)
+                : "a" (&_sb_findmap) : "cc" );
+        return result;
+}
+
+#endif /* __s390x__ */
+
 /*
  * Every architecture must define this function. It's the fastest
  * way of searching a 140-bit bitmap where the first 100 bits are
@@ -717,7 +989,6 @@
  * the libc and compiler builtin ffs routines, therefore
  * differs in spirit from the above ffz (man ffs).
  */
-
 extern inline int ffs (int x)
 {
         int r = 1;
@@ -785,7 +1056,14 @@
  * hweightN: returns the hamming weight (i.e. the number
  * of bits set) of a N-bit word
  */
-
+#define hweight64(x)						\
+({								\
+	unsigned long __x = (x);				\
+	unsigned int __w;					\
+	__w = generic_hweight32((unsigned int) __x);		\
+	__w += generic_hweight32((unsigned int) (__x>>32));	\
+	__w;							\
+})
 #define hweight32(x) generic_hweight32(x)
 #define hweight16(x) generic_hweight16(x)
 #define hweight8(x) generic_hweight8(x)
@@ -804,15 +1082,17 @@
  */
 
 #define ext2_set_bit(nr, addr)       \
-	test_and_set_bit((nr)^24, (unsigned long *)addr)
+	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_set_bit_atomic(lock, nr, addr)       \
-	        test_and_set_bit((nr)^24, (unsigned long *)addr)
+	test_and_set_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit(nr, addr)     \
-	test_and_clear_bit((nr)^24, (unsigned long *)addr)
+	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_clear_bit_atomic(lock, nr, addr)     \
-	        test_and_clear_bit((nr)^24, (unsigned long *)addr)
+	test_and_clear_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
 #define ext2_test_bit(nr, addr)      \
-	test_bit((nr)^24, (unsigned long *)addr)
+	test_bit((nr)^(__BITOPS_WORDSIZE - 8), (unsigned long *)addr)
+
+#ifndef __s390x__
 
 static inline int 
 ext2_find_first_zero_bit(void *vaddr, unsigned size)
@@ -897,6 +1177,100 @@
         return (p - addr) * 32 + res;
 }
 
+#else /* __s390x__ */
+
+static inline unsigned long
+ext2_find_first_zero_bit(void *vaddr, unsigned long size)
+{
+        unsigned long res, cmp, count;
+
+        if (!size)
+                return 0;
+        __asm__("   lghi  %1,-1\n"
+                "   lgr   %2,%3\n"
+                "   aghi  %2,63\n"
+                "   srlg  %2,%2,6\n"
+                "   slgr  %0,%0\n"
+                "0: clg   %1,0(%0,%4)\n"
+                "   jne   1f\n"
+                "   aghi  %0,8\n"
+                "   brct  %2,0b\n"
+                "   lgr   %0,%3\n"
+                "   j     5f\n"
+                "1: cl    %1,0(%0,%4)\n"
+		"   jne   2f\n"
+		"   aghi  %0,4\n"
+		"2: l     %2,0(%0,%4)\n"
+                "   sllg  %0,%0,3\n"
+                "   aghi  %0,24\n"
+                "   lghi  %1,0xff\n"
+                "   tmlh  %2,0xffff\n"
+                "   jo    3f\n"
+                "   aghi  %0,-16\n"
+                "   srl   %2,16\n"
+                "3: tmll  %2,0xff00\n"
+                "   jo    4f\n"
+                "   aghi  %0,-8\n"
+                "   srl   %2,8\n"
+                "4: ngr   %2,%1\n"
+                "   ic    %2,0(%2,%5)\n"
+                "   algr  %0,%2\n"
+                "5:"
+                : "=&a" (res), "=&d" (cmp), "=&a" (count)
+		: "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" );
+        return (res < size) ? res : size;
+}
+
+static inline unsigned long
+ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
+{
+        unsigned long *addr = vaddr;
+        unsigned long *p = addr + (offset >> 6);
+        unsigned long word, reg;
+        unsigned long bit = offset & 63UL, res;
+
+        if (offset >= size)
+                return size;
+
+        if (bit) {
+                __asm__("   lrvg %0,%1" /* load reversed, neat instruction */
+                        : "=a" (word) : "m" (*p) );
+                word >>= bit;
+                res = bit;
+                /* Look for zero in first 8 byte word */
+                __asm__("   lghi %2,0xff\n"
+			"   tmll %1,0xffff\n"
+			"   jno  2f\n"
+			"   ahi  %0,16\n"
+			"   srlg %1,%1,16\n"
+                	"0: tmll %1,0xffff\n"
+                        "   jno  2f\n"
+                        "   ahi  %0,16\n"
+                        "   srlg %1,%1,16\n"
+                        "1: tmll %1,0xffff\n"
+                        "   jno  2f\n"
+                        "   ahi  %0,16\n"
+                        "   srl  %1,16\n"
+                        "2: tmll %1,0x00ff\n"
+                	"   jno  3f\n"
+                	"   ahi  %0,8\n"
+                	"   srl  %1,8\n"
+                	"3: ngr  %1,%2\n"
+                	"   ic   %1,0(%1,%3)\n"
+                	"   alr  %0,%1"
+                	: "+&d" (res), "+a" (word), "=&d" (reg)
+                  	: "a" (&_zb_findmap) : "cc" );
+                if (res < 64)
+			return (p - addr)*64 + res;
+                p++;
+        }
+        /* No zero yet, search remaining full bytes for a zero */
+        res = ext2_find_first_zero_bit (p, size - 64 * (p - addr));
+        return (p - addr) * 64 + res;
+}
+
+#endif /* __s390x__ */
+
 /* Bitmap functions for the minix filesystem.  */
 /* FIXME !!! */
 #define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
diff -urN linux-2.5.67-bk5/include/asm-s390/byteorder.h linux-2.5.67-bk6/include/asm-s390/byteorder.h
--- linux-2.5.67-bk5/include/asm-s390/byteorder.h	2003-04-07 10:33:01.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/byteorder.h	2003-04-15 04:36:16.000000000 -0700
@@ -13,22 +13,63 @@
 
 #ifdef __GNUC__
 
+#ifdef __s390x__
+static __inline__ __const__ __u64 ___arch__swab64p(__u64 *x)
+{
+	__u64 result;
+
+	__asm__ __volatile__ (
+		"   lrvg %0,%1"
+		: "=d" (result) : "m" (*x) );
+	return result;
+}
+
+static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
+{
+	__u64 result;
+
+	__asm__ __volatile__ (
+		"   lrvgr %0,%1"
+		: "=d" (result) : "d" (x) );
+	return result;
+}
+
+static __inline__ void ___arch__swab64s(__u64 *x)
+{
+	*x = ___arch__swab64p(x);
+}
+#endif /* __s390x__ */
+
 static __inline__ __const__ __u32 ___arch__swab32p(__u32 *x)
 {
 	__u32 result;
 	
 	__asm__ __volatile__ (
+#ifndef __s390x__
 		"        icm   %0,8,3(%1)\n"
 		"        icm   %0,4,2(%1)\n"
 		"        icm   %0,2,1(%1)\n"
 		"        ic    %0,0(%1)"
 		: "=&d" (result) : "a" (x) : "cc" );
+#else /* __s390x__ */
+		"   lrv  %0,%1"
+		: "=d" (result) : "m" (*x) );
+#endif /* __s390x__ */
 	return result;
 }
 
 static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
 {
+#ifndef __s390x__
 	return ___arch__swab32p(&x);
+#else /* __s390x__ */
+	__u32 result;
+	
+	__asm__ __volatile__ (
+		"   lrvr  %0,%1"
+		: "=d" (result) : "d" (x) );
+	return result;
+#endif /* __s390x__ */
 }
 
 static __inline__ void ___arch__swab32s(__u32 *x)
@@ -41,9 +82,14 @@
 	__u16 result;
 	
 	__asm__ __volatile__ (
+#ifndef __s390x__
 		"        icm   %0,2,1(%1)\n"
 		"        ic    %0,0(%1)\n"
 		: "=&d" (result) : "a" (x) : "cc" );
+#else /* __s390x__ */
+		"   lrvh %0,%1"
+		: "=d" (result) : "m" (*x) );
+#endif /* __s390x__ */
 	return result;
 }
 
@@ -57,6 +103,11 @@
 	*x = ___arch__swab16p(x);
 }
 
+#ifdef __s390x__
+#define __arch__swab64(x) ___arch__swab64(x)
+#define __arch__swab64p(x) ___arch__swab64p(x)
+#define __arch__swab64s(x) ___arch__swab64s(x)
+#endif /* __s390x__ */
 #define __arch__swab32(x) ___arch__swab32(x)
 #define __arch__swab16(x) ___arch__swab16(x)
 #define __arch__swab32p(x) ___arch__swab32p(x)
@@ -64,10 +115,14 @@
 #define __arch__swab32s(x) ___arch__swab32s(x)
 #define __arch__swab16s(x) ___arch__swab16s(x)
 
+#ifndef __s390x__
 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
 #  define __BYTEORDER_HAS_U64__
 #  define __SWAB_64_THRU_32__
 #endif
+#else /* __s390x__ */
+#define __BYTEORDER_HAS_U64__
+#endif /* __s390x__ */
 
 #endif /* __GNUC__ */
 
diff -urN linux-2.5.67-bk5/include/asm-s390/ccwdev.h linux-2.5.67-bk6/include/asm-s390/ccwdev.h
--- linux-2.5.67-bk5/include/asm-s390/ccwdev.h	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/ccwdev.h	2003-04-15 04:36:16.000000000 -0700
@@ -157,6 +157,16 @@
  */
 extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
 			    unsigned long, __u8, unsigned long);
+/*
+ * ccw_device_start_timeout()
+ *
+ * This function notifies the device driver if the channel program has not
+ * completed during the specified time. If a timeout occurs, the channel
+ * program is terminated via xsch(), hsch() or csch().
+ */
+extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
+				    unsigned long, __u8, unsigned long, int);
+
 extern int ccw_device_resume(struct ccw_device *);
 extern int ccw_device_halt(struct ccw_device *, unsigned long);
 extern int ccw_device_clear(struct ccw_device *, unsigned long);
diff -urN linux-2.5.67-bk5/include/asm-s390/checksum.h linux-2.5.67-bk6/include/asm-s390/checksum.h
--- linux-2.5.67-bk5/include/asm-s390/checksum.h	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/checksum.h	2003-04-15 04:36:16.000000000 -0700
@@ -30,17 +30,29 @@
 static inline unsigned int
 csum_partial(const unsigned char * buff, int len, unsigned int sum)
 {
-	register_pair rp;
 	/*
 	 * Experiments with ethernet and slip connections show that buf
 	 * is aligned on either a 2-byte or 4-byte boundary.
 	 */
+#ifndef __s390x__
+	register_pair rp;
+
 	rp.subreg.even = (unsigned long) buff;
 	rp.subreg.odd = (unsigned long) len;
 	__asm__ __volatile__ (
 		"0:  cksm %0,%1\n"	/* do checksum on longs */
 		"    jo   0b\n"
 		: "+&d" (sum), "+&a" (rp) : : "cc" );
+#else /* __s390x__ */
+        __asm__ __volatile__ (
+                "    lgr  2,%1\n"    /* address in gpr 2 */
+                "    lgfr 3,%2\n"    /* length in gpr 3 */
+                "0:  cksm %0,2\n"    /* do checksum on longs */
+                "    jo   0b\n"
+                : "+&d" (sum)
+                : "d" (buff), "d" (len)
+                : "cc", "2", "3" );
+#endif /* __s390x__ */
 	return sum;
 }
 
@@ -50,6 +62,7 @@
 static inline unsigned int 
 csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
 {
+#ifndef __s390x__
 	register_pair rp;
 
 	rp.subreg.even = (unsigned long) buff;
@@ -58,6 +71,16 @@
 		"0:  cksm %0,%1\n"    /* do checksum on longs */
 		"    jo   0b\n"
                 : "+&d" (sum), "+&a" (rp) : : "cc" );
+#else /* __s390x__ */
+	__asm__ __volatile__ (
+		"    lgr  2,%1\n"    /* address in gpr 2 */
+		"    lgfr 3,%2\n"    /* length in gpr 3 */
+		"0:  cksm %0,2\n"    /* do checksum on longs */
+		"    jo   0b\n"
+                : "+&d" (sum)
+		: "d" (buff), "d" (len)
+                : "cc", "2", "3" );
+#endif /* __s390x__ */
 	return sum;
 }
 
@@ -100,6 +123,7 @@
 static inline unsigned short
 csum_fold(unsigned int sum)
 {
+#ifndef __s390x__
 	register_pair rp;
 
 	__asm__ __volatile__ (
@@ -110,6 +134,16 @@
 		"    alr  %0,%1\n"   /* %0 = H+L+C L+H */
 		"    srl  %0,16\n"   /* %0 = H+L+C */
 		: "+&d" (sum), "=d" (rp) : : "cc" );
+#else /* __s390x__ */
+	__asm__ __volatile__ (
+		"    sr   3,3\n"   /* %0 = H*65536 + L */
+		"    lr   2,%0\n"  /* %0 = H L, R2/R3 = H L / 0 0 */
+		"    srdl 2,16\n"  /* %0 = H L, R2/R3 = 0 H / L 0 */
+		"    alr  2,3\n"   /* %0 = H L, R2/R3 = L H / L 0 */
+		"    alr  %0,2\n"  /* %0 = H+L+C L+H */
+                "    srl  %0,16\n" /* %0 = H+L+C */
+		: "+&d" (sum) : : "cc", "2", "3");
+#endif /* __s390x__ */
 	return ((unsigned short) ~sum);
 }
 
@@ -121,8 +155,9 @@
 static inline unsigned short
 ip_fast_csum(unsigned char *iph, unsigned int ihl)
 {
-	register_pair rp;
 	unsigned long sum;
+#ifndef __s390x__
+	register_pair rp;
 
 	rp.subreg.even = (unsigned long) iph;
 	rp.subreg.odd = (unsigned long) ihl*4;
@@ -131,6 +166,17 @@
                 "0:  cksm %0,%1\n"   /* do checksum on longs */
                 "    jo   0b\n"
                 : "=&d" (sum), "+&a" (rp) : : "cc" );
+#else /* __s390x__ */
+        __asm__ __volatile__ (
+		"    slgr %0,%0\n"   /* set sum to zero */
+                "    lgr  2,%1\n"    /* address in gpr 2 */
+                "    lgfr 3,%2\n"    /* length in gpr 3 */
+                "0:  cksm %0,2\n"    /* do checksum on ints */
+                "    jo   0b\n"
+                : "=&d" (sum)
+                : "d" (iph), "d" (ihl*4)
+                : "cc", "2", "3" );
+#endif /* __s390x__ */
         return csum_fold(sum);
 }
 
@@ -143,6 +189,7 @@
                    unsigned short len, unsigned short proto,
                    unsigned int sum)
 {
+#ifndef __s390x__
 	__asm__ __volatile__ (
                 "    alr   %0,%1\n"  /* sum += saddr */
                 "    brc   12,0f\n"
@@ -163,6 +210,28 @@
 		: "+&d" (sum)
 		: "d" (((unsigned int) len<<16) + (unsigned int) proto)
 		: "cc" );
+#else /* __s390x__ */
+	__asm__ __volatile__ (
+                "    lgfr  %0,%0\n"
+                "    algr  %0,%1\n"  /* sum += saddr */
+                "    brc   12,0f\n"
+		"    aghi  %0,1\n"   /* add carry */
+		"0:  algr  %0,%2\n"  /* sum += daddr */
+                "    brc   12,1f\n"
+                "    aghi  %0,1\n"   /* add carry */
+		"1:  algfr %0,%3\n"  /* sum += (len<<16) + proto */
+		"    brc   12,2f\n"
+		"    aghi  %0,1\n"   /* add carry */
+		"2:  srlg  0,%0,32\n"
+                "    alr   %0,0\n"   /* fold to 32 bits */
+                "    brc   12,3f\n"
+                "    ahi   %0,1\n"   /* add carry */
+                "3:  llgfr %0,%0"
+		: "+&d" (sum)
+		: "d" (saddr), "d" (daddr),
+		  "d" (((unsigned int) len<<16) + (unsigned int) proto)
+		: "cc", "0" );
+#endif /* __s390x__ */
 	return sum;
 }
 
diff -urN linux-2.5.67-bk5/include/asm-s390/compat.h linux-2.5.67-bk6/include/asm-s390/compat.h
--- linux-2.5.67-bk5/include/asm-s390/compat.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/asm-s390/compat.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,122 @@
+#ifndef _ASM_S390X_COMPAT_H
+#define _ASM_S390X_COMPAT_H
+/*
+ * Architecture specific compatibility types
+ */
+#include <linux/types.h>
+
+#define COMPAT_USER_HZ	100
+
+typedef u32		compat_size_t;
+typedef s32		compat_ssize_t;
+typedef s32		compat_time_t;
+typedef s32		compat_clock_t;
+typedef s32		compat_pid_t;
+typedef u16		compat_uid_t;
+typedef u16		compat_gid_t;
+typedef u16		compat_mode_t;
+typedef u32		compat_ino_t;
+typedef u16		compat_dev_t;
+typedef s32		compat_off_t;
+typedef s64		compat_loff_t;
+typedef u16		compat_nlink_t;
+typedef u16		compat_ipc_pid_t;
+typedef s32		compat_daddr_t;
+typedef u32		compat_caddr_t;
+typedef __kernel_fsid_t	compat_fsid_t;
+
+typedef s32		compat_int_t;
+typedef s32		compat_long_t;
+typedef u32		compat_uint_t;
+typedef u32		compat_ulong_t;
+
+struct compat_timespec {
+	compat_time_t	tv_sec;
+	s32		tv_nsec;
+};
+
+struct compat_timeval {
+	compat_time_t	tv_sec;
+	s32		tv_usec;
+};
+
+struct compat_stat {
+	compat_dev_t	st_dev;
+	u16		__pad1;
+	compat_ino_t	st_ino;
+	compat_mode_t	st_mode;
+	compat_nlink_t	st_nlink;
+	compat_uid_t	st_uid;
+	compat_gid_t	st_gid;
+	compat_dev_t	st_rdev;
+	u16		__pad2;
+	u32		st_size;
+	u32		st_blksize;
+	u32		st_blocks;
+	u32		st_atime;
+	u32		st_atime_nsec;
+	u32		st_mtime;
+	u32		st_mtime_nsec;
+	u32		st_ctime;
+	u32		st_ctime_nsec;
+	u32		__unused4;
+	u32		__unused5;
+};
+
+struct compat_flock {
+	short		l_type;
+	short		l_whence;
+	compat_off_t	l_start;
+	compat_off_t	l_len;
+	compat_pid_t	l_pid;
+};
+
+#define F_GETLK64       12
+#define F_SETLK64       13
+#define F_SETLKW64      14    
+
+struct compat_flock64 {
+	short		l_type;
+	short		l_whence;
+	compat_loff_t	l_start;
+	compat_loff_t	l_len;
+	compat_pid_t	l_pid;
+};
+
+struct compat_statfs {
+	s32		f_type;
+	s32		f_bsize;
+	s32		f_blocks;
+	s32		f_bfree;
+	s32		f_bavail;
+	s32		f_files;
+	s32		f_ffree;
+	compat_fsid_t	f_fsid;
+	s32		f_namelen;
+	s32		f_spare[6];
+};
+
+typedef u32		compat_old_sigset_t;	/* at least 32 bits */
+
+#define _COMPAT_NSIG		64
+#define _COMPAT_NSIG_BPW	32
+
+typedef u32		compat_sigset_word;
+
+#define COMPAT_OFF_T_MAX	0x7fffffff
+#define COMPAT_LOFF_T_MAX	0x7fffffffffffffffL
+
+/*
+ * A pointer passed in from user mode. This should not
+ * be used for syscall parameters, just declare them
+ * as pointers because the syscall entry code will have
+ * appropriately comverted them already.
+ */
+typedef	u32		compat_uptr_t;
+
+static inline void *compat_ptr(compat_uptr_t uptr)
+{
+	return (void *)(unsigned long)(uptr & 0x7fffffffUL);
+}
+
+#endif /* _ASM_S390X_COMPAT_H */
diff -urN linux-2.5.67-bk5/include/asm-s390/div64.h linux-2.5.67-bk6/include/asm-s390/div64.h
--- linux-2.5.67-bk5/include/asm-s390/div64.h	2003-04-07 10:31:55.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/div64.h	2003-04-15 04:36:16.000000000 -0700
@@ -1,8 +1,9 @@
 #ifndef __S390_DIV64
 #define __S390_DIV64
 
+#ifndef __s390x__
+
 /* for do_div "base" needs to be smaller than 2^31-1 */
- 
 #define do_div(n, base) ({                                      \
 	unsigned long long __n = (n);				\
 	unsigned long __r;					\
@@ -41,4 +42,14 @@
         __r;                                                    \
 })
 
+#else /* __s390x__ */
+
+#define do_div(n,base) ({ \
+int __res; \
+__res = ((unsigned long) n) % (unsigned) base; \
+n = ((unsigned long) n) / (unsigned) base; \
+__res; })
+
+#endif /* __s390x__ */
+
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/ebcdic.h linux-2.5.67-bk6/include/asm-s390/ebcdic.h
--- linux-2.5.67-bk5/include/asm-s390/ebcdic.h	2003-04-07 10:31:09.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/ebcdic.h	2003-04-15 04:36:16.000000000 -0700
@@ -21,8 +21,8 @@
 extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */
 extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */
 
-extern __inline__ 
-void codepage_convert(const __u8 *codepage, volatile __u8 * addr, int nr)
+extern __inline__ void
+codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
 {
 	if (nr-- <= 0)
 		return;
diff -urN linux-2.5.67-bk5/include/asm-s390/elf.h linux-2.5.67-bk6/include/asm-s390/elf.h
--- linux-2.5.67-bk5/include/asm-s390/elf.h	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/elf.h	2003-04-15 04:36:16.000000000 -0700
@@ -23,7 +23,11 @@
 /*
  * These are used to set parameters in the core dumps.
  */
+#ifndef __s390x__
 #define ELF_CLASS	ELFCLASS32
+#else /* __s390x__ */
+#define ELF_CLASS	ELFCLASS64
+#endif /* __s390x__ */
 #define ELF_DATA	ELFDATA2MSB
 #define ELF_ARCH	EM_S390
 
@@ -36,8 +40,16 @@
 
 /* For SVR4/S390 the function pointer to be registered with `atexit` is
    passed in R14. */
+#ifndef __s390x__
 #define ELF_PLAT_INIT(_r, load_addr) \
 	_r->gprs[14] = 0
+#else /* __s390x__ */
+#define ELF_PLAT_INIT(_r, load_addr) \
+	do { \
+	_r->gprs[14] = 0; \
+	clear_thread_flag(TIF_31BIT); \
+	} while(0)
+#endif /* __s390x__ */
 
 #define USE_ELF_CORE_DUMP
 #define ELF_EXEC_PAGESIZE	4096
@@ -47,9 +59,13 @@
    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.  */
 
+#ifndef __s390x__
 #define ELF_ET_DYN_BASE         ((TASK_SIZE & 0x80000000) \
                                 ? TASK_SIZE / 3 * 2 \
                                 : 2 * TASK_SIZE / 3)
+#else /* __s390x__ */
+#define ELF_ET_DYN_BASE         (TASK_SIZE / 3 * 2)
+#endif /* __s390x__ */
 
 /* Wow, the "main" arch needs arch dependent functions too.. :) */
 
@@ -76,7 +92,18 @@
 #define ELF_PLATFORM (NULL)
 
 #ifdef __KERNEL__
+#ifndef __s390x__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
+#else /* __s390x__ */
+#define SET_PERSONALITY(ex, ibcs2)			\
+do {							\
+	if (ibcs2)					\
+		set_personality(PER_SVR4);		\
+	else if (current->personality != PER_LINUX32)	\
+		set_personality(PER_LINUX);		\
+	clear_thread_flag(TIF_31BIT);			\
+} while (0)
+#endif /* __s390x__ */
 #endif
 
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/fcntl.h linux-2.5.67-bk6/include/asm-s390/fcntl.h
--- linux-2.5.67-bk5/include/asm-s390/fcntl.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/fcntl.h	2003-04-15 04:36:16.000000000 -0700
@@ -42,10 +42,11 @@
 #define F_SETSIG	10	/*  for sockets. */
 #define F_GETSIG	11	/*  for sockets. */
 
+#ifndef __s390x__
 #define F_GETLK64	12	/*  using 'struct flock64' */
 #define F_SETLK64	13
 #define F_SETLKW64	14
-                               
+#endif /* ! __s390x__ */
 
 /* for F_[GET|SET]FL */
 #define FD_CLOEXEC	1	/* actually anything with low bit set goes */
@@ -82,6 +83,7 @@
 	pid_t l_pid;
 };
 
+#ifndef __s390x__
 struct flock64 {
 	short  l_type;
 	short  l_whence;
@@ -89,6 +91,6 @@
 	loff_t l_len;
 	pid_t  l_pid;
 };
-
+#endif
 #define F_LINUX_SPECIFIC_BASE	1024
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/gdb-stub.h linux-2.5.67-bk6/include/asm-s390/gdb-stub.h
--- linux-2.5.67-bk5/include/asm-s390/gdb-stub.h	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/gdb-stub.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,22 +0,0 @@
-/*
- *  include/asm-s390/gdb-stub.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- */
-
-#ifndef __S390_GDB_STUB__
-#define __S390_GDB_STUB__
-#include <linux/config.h>
-#if CONFIG_REMOTE_DEBUG
-#include <asm/ptrace.h>
-extern int    gdb_stub_initialised;
-extern void gdb_stub_handle_exception(struct gdb_pt_regs *regs,int sigval);
-struct net_device;
-extern struct net_device *gdb_dev;
-void gdb_do_timers(void);
-extern int putDebugChar(char c);    /* write a single character      */
-extern char getDebugChar(void);     /* read and return a single char */
-#endif
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390/hardirq.h linux-2.5.67-bk6/include/asm-s390/hardirq.h
--- linux-2.5.67-bk5/include/asm-s390/hardirq.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/hardirq.h	2003-04-15 04:36:16.000000000 -0700
@@ -80,6 +80,8 @@
 
 extern void do_call_softirq(void);
 
+#define invoke_softirq() do_call_softirq()
+
 #if CONFIG_PREEMPT
 # define in_atomic()	(in_interrupt() || preempt_count() == PREEMPT_ACTIVE)
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
diff -urN linux-2.5.67-bk5/include/asm-s390/idals.h linux-2.5.67-bk6/include/asm-s390/idals.h
--- linux-2.5.67-bk5/include/asm-s390/idals.h	2003-04-07 10:30:40.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/idals.h	2003-04-15 04:36:16.000000000 -0700
@@ -21,7 +21,7 @@
 #include <asm/cio.h>
 #include <asm/uaccess.h>
 
-#ifdef CONFIG_ARCH_S390X
+#ifdef __s390x__
 #define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
 #else
 #define IDA_SIZE_LOG 11 /* 11 for 2k , 12 for 4k */
@@ -34,7 +34,7 @@
 static inline int
 idal_is_needed(void *vaddr, unsigned int length)
 {
-#if defined(CONFIG_ARCH_S390X)
+#ifdef __s390x__
 	return ((__pa(vaddr) + length) >> 31) != 0;
 #else
 	return 0;
@@ -48,7 +48,7 @@
 static inline unsigned int
 idal_nr_words(void *vaddr, unsigned int length)
 {
-#if defined(CONFIG_ARCH_S390X)
+#ifdef __s390x__
 	if (idal_is_needed(vaddr, length))
 		return ((__pa(vaddr) & (IDA_BLOCK_SIZE-1)) + length + 
 			(IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
@@ -62,7 +62,7 @@
 static inline unsigned long *
 idal_create_words(unsigned long *idaws, void *vaddr, unsigned int length)
 {
-#if defined(CONFIG_ARCH_S390X)
+#ifdef __s390x__
 	unsigned long paddr;
 	unsigned int cidaw;
 
@@ -86,7 +86,7 @@
 static inline int
 set_normalized_cda(struct ccw1 * ccw, void *vaddr)
 {
-#if defined (CONFIG_ARCH_S390X)
+#ifdef __s390x__
 	unsigned int nridaws;
 	unsigned long *idal;
 
@@ -113,7 +113,7 @@
 static inline void
 clear_normalized_cda(struct ccw1 * ccw)
 {
-#if defined(CONFIG_ARCH_S390X)
+#ifdef __s390x__
 	if (ccw->flags & CCW_FLAG_IDA) {
 		kfree((void *)(unsigned long) ccw->cda);
 		ccw->flags &= ~CCW_FLAG_IDA;
@@ -190,7 +190,7 @@
 static inline int
 __idal_buffer_is_needed(struct idal_buffer *ib)
 {
-#ifdef CONFIG_ARCH_S390X
+#ifdef __s390x__
 	return ib->size > (4096ul << ib->page_order) ||
 		idal_is_needed(ib->data[0], ib->size);
 #else
diff -urN linux-2.5.67-bk5/include/asm-s390/io.h linux-2.5.67-bk6/include/asm-s390/io.h
--- linux-2.5.67-bk5/include/asm-s390/io.h	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/io.h	2003-04-15 04:36:16.000000000 -0700
@@ -27,9 +27,16 @@
 extern inline unsigned long virt_to_phys(volatile void * address)
 {
 	unsigned long real_address;
-	__asm__ ("   lra    %0,0(%1)\n"
+	__asm__ (
+#ifndef __s390x__
+		 "   lra    %0,0(%1)\n"
                  "   jz     0f\n"
                  "   sr     %0,%0\n"
+#else /* __s390x__ */
+		 "   lrag   %0,0(%1)\n"
+                 "   jz     0f\n"
+                 "   slgr   %0,%0\n"
+#endif /* __s390x__ */
                  "0:"
                  : "=a" (real_address) : "a" (address) : "cc" );
         return real_address;
diff -urN linux-2.5.67-bk5/include/asm-s390/ipc.h linux-2.5.67-bk6/include/asm-s390/ipc.h
--- linux-2.5.67-bk5/include/asm-s390/ipc.h	2003-04-07 10:32:54.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/ipc.h	2003-04-15 04:36:16.000000000 -0700
@@ -22,6 +22,7 @@
 #define SEMOP		 1
 #define SEMGET		 2
 #define SEMCTL		 3
+#define SEMTIMEDOP	 4
 #define MSGSND		11
 #define MSGRCV		12
 #define MSGGET		13
diff -urN linux-2.5.67-bk5/include/asm-s390/ipcbuf.h linux-2.5.67-bk6/include/asm-s390/ipcbuf.h
--- linux-2.5.67-bk5/include/asm-s390/ipcbuf.h	2003-04-07 10:31:15.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/ipcbuf.h	2003-04-15 04:36:16.000000000 -0700
@@ -21,7 +21,9 @@
 	__kernel_mode_t		mode;
 	unsigned short		__pad1;
 	unsigned short		seq;
+#ifndef __s390x__
 	unsigned short		__pad2;
+#endif /* ! __s390x__ */
 	unsigned long		__unused1;
 	unsigned long		__unused2;
 };
diff -urN linux-2.5.67-bk5/include/asm-s390/lowcore.h linux-2.5.67-bk6/include/asm-s390/lowcore.h
--- linux-2.5.67-bk5/include/asm-s390/lowcore.h	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/lowcore.h	2003-04-15 04:36:16.000000000 -0700
@@ -11,6 +11,7 @@
 #ifndef _ASM_S390_LOWCORE_H
 #define _ASM_S390_LOWCORE_H
 
+#ifndef __s390x__
 #define __LC_EXT_OLD_PSW                0x018
 #define __LC_SVC_OLD_PSW                0x020
 #define __LC_PGM_OLD_PSW                0x028
@@ -21,43 +22,76 @@
 #define __LC_PGM_NEW_PSW                0x068
 #define __LC_MCK_NEW_PSW                0x070
 #define __LC_IO_NEW_PSW                 0x078
+#else /* !__s390x__ */
+#define __LC_EXT_OLD_PSW                0x0130
+#define __LC_SVC_OLD_PSW                0x0140
+#define __LC_PGM_OLD_PSW                0x0150
+#define __LC_MCK_OLD_PSW                0x0160
+#define __LC_IO_OLD_PSW                 0x0170
+#define __LC_EXT_NEW_PSW                0x01b0
+#define __LC_SVC_NEW_PSW                0x01c0
+#define __LC_PGM_NEW_PSW                0x01d0
+#define __LC_MCK_NEW_PSW                0x01e0
+#define __LC_IO_NEW_PSW                 0x01f0
+#endif /* !__s390x__ */
+
 #define __LC_EXT_PARAMS                 0x080
 #define __LC_CPU_ADDRESS                0x084
 #define __LC_EXT_INT_CODE               0x086
-#define __LC_SVC_INT_CODE               0x08B
+
+#define __LC_SVC_ILC                    0x088
+#define __LC_SVC_INT_CODE               0x08A
 #define __LC_PGM_ILC                    0x08C
 #define __LC_PGM_INT_CODE               0x08E
-#define __LC_TRANS_EXC_ADDR             0x090
+
 #define __LC_SUBCHANNEL_ID              0x0B8
 #define __LC_SUBCHANNEL_NR              0x0BA
 #define __LC_IO_INT_PARM                0x0BC
 #define __LC_IO_INT_WORD                0x0C0
 #define __LC_MCCK_CODE                  0x0E8
-#define __LC_AREGS_SAVE_AREA            0x120
-#define __LC_CREGS_SAVE_AREA            0x1C0
 
 #define __LC_RETURN_PSW                 0x200
-#define __LC_IRB			0x208
+
+#define __LC_IRB			0x210
+
+#define __LC_DIAG44_OPCODE		0x250
 
 #define __LC_SAVE_AREA                  0xC00
+
+#ifndef __s390x__
 #define __LC_KERNEL_STACK               0xC40
 #define __LC_ASYNC_STACK                0xC44
 #define __LC_CPUID                      0xC60
 #define __LC_CPUADDR                    0xC68
 #define __LC_IPLDEV                     0xC7C
-
 #define __LC_JIFFY_TIMER		0xC80
+#else /* __s390x__ */
+#define __LC_KERNEL_STACK               0xD40
+#define __LC_ASYNC_STACK                0xD48
+#define __LC_CPUID                      0xD90
+#define __LC_CPUADDR                    0xD98
+#define __LC_IPLDEV                     0xDB8
+#define __LC_JIFFY_TIMER		0xDC0
+#endif /* __s390x__ */
 
 #define __LC_PANIC_MAGIC                0xE00
 
+#ifndef __s390x__
 #define __LC_PFAULT_INTPARM             0x080
+#define __LC_AREGS_SAVE_AREA            0x120
+#define __LC_CREGS_SAVE_AREA            0x1C0
+#else /* __s390x__ */
+#define __LC_PFAULT_INTPARM             0x11B8
+#define __LC_AREGS_SAVE_AREA            0x1340
+#define __LC_CREGS_SAVE_AREA            0x1380
+#endif /* __s390x__ */
 
 #ifndef __ASSEMBLY__
 
 #include <linux/config.h>
+#include <asm/processor.h>
 #include <linux/types.h>
 #include <asm/atomic.h>
-#include <asm/processor.h>
 #include <asm/sigp.h>
 
 void restart_int_handler(void);
@@ -69,6 +103,7 @@
 
 struct _lowcore
 {
+#ifndef __s390x__
         /* prefix area: defined by architecture */
 	psw_t        restart_psw;              /* 0x000 */
 	__u32        ccw2[4];                  /* 0x008 */
@@ -142,6 +177,101 @@
 
         /* Align to the top 1k of prefix area */
 	__u8         pad12[0x1000-0xe04];      /* 0xe04 */
+#else /* !__s390x__ */
+        /* prefix area: defined by architecture */
+	__u32        ccw1[2];                  /* 0x000 */
+	__u32        ccw2[4];                  /* 0x008 */
+	__u8         pad1[0x80-0x18];          /* 0x018 */
+	__u32        ext_params;               /* 0x080 */
+	__u16        cpu_addr;                 /* 0x084 */
+	__u16        ext_int_code;             /* 0x086 */
+        __u16        svc_ilc;                  /* 0x088 */
+        __u16        svc_code;                 /* 0x08a */
+        __u16        pgm_ilc;                  /* 0x08c */
+        __u16        pgm_code;                 /* 0x08e */
+	__u32        data_exc_code;            /* 0x090 */
+	__u16        mon_class_num;            /* 0x094 */
+	__u16        per_perc_atmid;           /* 0x096 */
+	addr_t       per_address;              /* 0x098 */
+	__u8         exc_access_id;            /* 0x0a0 */
+	__u8         per_access_id;            /* 0x0a1 */
+	__u8         op_access_id;             /* 0x0a2 */
+	__u8         ar_access_id;             /* 0x0a3 */
+	__u8         pad2[0xA8-0xA4];          /* 0x0a4 */
+	addr_t       trans_exc_code;           /* 0x0A0 */
+	addr_t       monitor_code;             /* 0x09c */
+	__u16        subchannel_id;            /* 0x0b8 */
+	__u16        subchannel_nr;            /* 0x0ba */
+	__u32        io_int_parm;              /* 0x0bc */
+	__u32        io_int_word;              /* 0x0c0 */
+	__u8         pad3[0xc8-0xc4];          /* 0x0c4 */
+	__u32        stfl_fac_list;            /* 0x0c8 */
+	__u8         pad4[0xe8-0xcc];          /* 0x0cc */
+	__u32        mcck_interruption_code[2]; /* 0x0e8 */
+	__u8         pad5[0xf4-0xf0];          /* 0x0f0 */
+	__u32        external_damage_code;     /* 0x0f4 */
+	addr_t       failing_storage_address;  /* 0x0f8 */
+	__u8         pad6[0x120-0x100];        /* 0x100 */
+	psw_t        restart_old_psw;          /* 0x120 */
+	psw_t        external_old_psw;         /* 0x130 */
+	psw_t        svc_old_psw;              /* 0x140 */
+	psw_t        program_old_psw;          /* 0x150 */
+	psw_t        mcck_old_psw;             /* 0x160 */
+	psw_t        io_old_psw;               /* 0x170 */
+	__u8         pad7[0x1a0-0x180];        /* 0x180 */
+	psw_t        restart_psw;              /* 0x1a0 */
+	psw_t        external_new_psw;         /* 0x1b0 */
+	psw_t        svc_new_psw;              /* 0x1c0 */
+	psw_t        program_new_psw;          /* 0x1d0 */
+	psw_t        mcck_new_psw;             /* 0x1e0 */
+	psw_t        io_new_psw;               /* 0x1f0 */
+        psw_t        return_psw;               /* 0x200 */
+	__u8	     irb[64];		       /* 0x210 */
+	__u32        diag44_opcode;            /* 0x250 */
+        __u8         pad8[0xc00-0x254];        /* 0x254 */
+        /* System info area */
+	__u64        save_area[16];            /* 0xc00 */
+        __u8         pad9[0xd40-0xc80];        /* 0xc80 */
+ 	__u64        kernel_stack;             /* 0xd40 */
+	__u64        async_stack;              /* 0xd48 */
+	/* entry.S sensitive area start */
+	__u8         pad10[0xd80-0xd50];       /* 0xd64 */
+	struct       cpuinfo_S390 cpu_data;    /* 0xd80 */
+	__u32        ipl_device;               /* 0xdb8 */
+	__u32        pad11;                    /* 0xdbc */
+	/* entry.S sensitive area end */
+
+        /* SMP info area: defined by DJB */
+        __u64        jiffy_timer;              /* 0xdc0 */
+	__u64        ext_call_fast;            /* 0xdc8 */
+        __u8         pad12[0xe00-0xdd0];       /* 0xdd0 */
+
+        /* 0xe00 is used as indicator for dump tools */
+        /* whether the kernel died with panic() or not */
+        __u32        panic_magic;              /* 0xe00 */
+
+	__u8         pad13[0x1200-0xe04];      /* 0xe04 */
+
+        /* System info area */ 
+
+	__u64        floating_pt_save_area[16]; /* 0x1200 */
+	__u64        gpregs_save_area[16];      /* 0x1280 */
+	__u32        st_status_fixed_logout[4]; /* 0x1300 */
+	__u8         pad14[0x1318-0x1310];      /* 0x1310 */
+	__u32        prefixreg_save_area;       /* 0x1318 */
+	__u32        fpt_creg_save_area;        /* 0x131c */
+	__u8         pad15[0x1324-0x1320];      /* 0x1320 */
+	__u32        tod_progreg_save_area;     /* 0x1324 */
+	__u32        cpu_timer_save_area[2];    /* 0x1328 */
+	__u32        clock_comp_save_area[2];   /* 0x1330 */
+	__u8         pad16[0x1340-0x1338];      /* 0x1338 */ 
+	__u32        access_regs_save_area[16]; /* 0x1340 */ 
+	__u64        cregs_save_area[16];       /* 0x1380 */
+
+	/* align to the top of the prefix area */
+
+	__u8         pad17[0x2000-0x1400];      /* 0x1400 */
+#endif /* !__s390x__ */
 } __attribute__((packed)); /* End structure*/
 
 #define S390_lowcore (*((struct _lowcore *) 0))
diff -urN linux-2.5.67-bk5/include/asm-s390/mmu_context.h linux-2.5.67-bk6/include/asm-s390/mmu_context.h
--- linux-2.5.67-bk5/include/asm-s390/mmu_context.h	2003-04-07 10:31:14.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/mmu_context.h	2003-04-15 04:36:16.000000000 -0700
@@ -27,12 +27,20 @@
         unsigned long pgd;
 
         if (prev != next) {
+#ifndef __s390x__
 	        pgd = (__pa(next->pgd)&PAGE_MASK) | 
                       (_SEGMENT_TABLE|USER_STD_MASK);
                 /* Load page tables */
                 asm volatile("    lctl  7,7,%0\n"   /* secondary space */
                              "    lctl  13,13,%0\n" /* home space */
                              : : "m" (pgd) );
+#else /* __s390x__ */
+                pgd = (__pa(next->pgd)&PAGE_MASK) | (_REGION_TABLE|USER_STD_MASK);
+                /* Load page tables */
+                asm volatile("    lctlg 7,7,%0\n"   /* secondary space */
+                             "    lctlg 13,13,%0\n" /* home space */
+                             : : "m" (pgd) );
+#endif /* __s390x__ */
         }
 	set_bit(cpu, &next->cpu_vm_mask);
 }
diff -urN linux-2.5.67-bk5/include/asm-s390/module.h linux-2.5.67-bk6/include/asm-s390/module.h
--- linux-2.5.67-bk5/include/asm-s390/module.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/module.h	2003-04-15 04:36:16.000000000 -0700
@@ -28,7 +28,7 @@
 	struct mod_arch_syminfo *syminfo;
 };
 
-#ifdef CONFIG_ARCH_S390X
+#ifdef __s390x__
 #define ElfW(x) Elf64_ ## x
 #define ELFW(x) ELF64_ ## x
 #else
@@ -36,8 +36,11 @@
 #define ELFW(x) ELF32_ ## x
 #endif
 
+#define Elf_Addr ElfW(Addr)
+#define Elf_Rela ElfW(Rela)
 #define Elf_Shdr ElfW(Shdr)
 #define Elf_Sym ElfW(Sym)
 #define Elf_Ehdr ElfW(Ehdr)
+#define ELF_R_SYM ELFW(R_SYM)
 #define ELF_R_TYPE ELFW(R_TYPE)
 #endif /* _ASM_S390_MODULE_H */
diff -urN linux-2.5.67-bk5/include/asm-s390/msgbuf.h linux-2.5.67-bk6/include/asm-s390/msgbuf.h
--- linux-2.5.67-bk5/include/asm-s390/msgbuf.h	2003-04-07 10:31:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/msgbuf.h	2003-04-15 04:36:16.000000000 -0700
@@ -14,11 +14,17 @@
 struct msqid64_ds {
 	struct ipc64_perm msg_perm;
 	__kernel_time_t msg_stime;	/* last msgsnd time */
+#ifndef __s390x__
 	unsigned long	__unused1;
+#endif /* ! __s390x__ */
 	__kernel_time_t msg_rtime;	/* last msgrcv time */
+#ifndef __s390x__
 	unsigned long	__unused2;
+#endif /* ! __s390x__ */
 	__kernel_time_t msg_ctime;	/* last change time */
+#ifndef __s390x__
 	unsigned long	__unused3;
+#endif /* ! __s390x__ */
 	unsigned long  msg_cbytes;	/* current number of bytes on queue */
 	unsigned long  msg_qnum;	/* number of messages in queue */
 	unsigned long  msg_qbytes;	/* max number of bytes on queue */
diff -urN linux-2.5.67-bk5/include/asm-s390/page.h linux-2.5.67-bk6/include/asm-s390/page.h
--- linux-2.5.67-bk5/include/asm-s390/page.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/page.h	2003-04-15 04:36:16.000000000 -0700
@@ -20,6 +20,8 @@
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
+#ifndef __s390x__
+
 static inline void clear_page(void *page)
 {
 	register_pair rp;
@@ -59,6 +61,48 @@
 			      : "memory" );
 }
 
+#else /* __s390x__ */
+
+static inline void clear_page(void *page)
+{
+        asm volatile ("   lgr  2,%0\n"
+                      "   lghi 3,4096\n"
+                      "   slgr 1,1\n"
+                      "   mvcl 2,0"
+                      : : "a" ((void *) (page))
+		      : "memory", "cc", "1", "2", "3" );
+}
+
+static inline void copy_page(void *to, void *from)
+{
+        if (MACHINE_HAS_MVPG)
+		asm volatile ("   sgr  0,0\n"
+			      "   mvpg %0,%1"
+			      : : "a" ((void *)(to)), "a" ((void *)(from))
+			      : "memory", "cc", "0" );
+	else
+		asm volatile ("   mvc  0(256,%0),0(%1)\n"
+			      "   mvc  256(256,%0),256(%1)\n"
+			      "   mvc  512(256,%0),512(%1)\n"
+			      "   mvc  768(256,%0),768(%1)\n"
+			      "   mvc  1024(256,%0),1024(%1)\n"
+			      "   mvc  1280(256,%0),1280(%1)\n"
+			      "   mvc  1536(256,%0),1536(%1)\n"
+			      "   mvc  1792(256,%0),1792(%1)\n"
+			      "   mvc  2048(256,%0),2048(%1)\n"
+			      "   mvc  2304(256,%0),2304(%1)\n"
+			      "   mvc  2560(256,%0),2560(%1)\n"
+			      "   mvc  2816(256,%0),2816(%1)\n"
+			      "   mvc  3072(256,%0),3072(%1)\n"
+			      "   mvc  3328(256,%0),3328(%1)\n"
+			      "   mvc  3584(256,%0),3584(%1)\n"
+			      "   mvc  3840(256,%0),3840(%1)\n"
+			      : : "a"((void *)(to)),"a"((void *)(from)) 
+			      : "memory" );
+}
+
+#endif /* __s390x__ */
+
 #define clear_user_page(page, vaddr, pg)	clear_page(page)
 #define copy_user_page(to, from, vaddr, pg)	copy_page(to, from)
 
@@ -79,7 +123,15 @@
 /*
  * These are used to make use of C type-checking..
  */
+
+typedef struct { unsigned long pgprot; } pgprot_t;
 typedef struct { unsigned long pte; } pte_t;
+
+#define pte_val(x)      ((x).pte)
+#define pgprot_val(x)   ((x).pgprot)
+
+#ifndef __s390x__
+
 typedef struct { unsigned long pmd; } pmd_t;
 typedef struct {
         unsigned long pgd0;
@@ -87,12 +139,23 @@
         unsigned long pgd2;
         unsigned long pgd3;
         } pgd_t;
-typedef struct { unsigned long pgprot; } pgprot_t;
 
-#define pte_val(x)      ((x).pte)
 #define pmd_val(x)      ((x).pmd)
 #define pgd_val(x)      ((x).pgd0)
-#define pgprot_val(x)   ((x).pgprot)
+
+#else /* __s390x__ */
+
+typedef struct { 
+        unsigned long pmd0;
+        unsigned long pmd1; 
+        } pmd_t;
+typedef struct { unsigned long pgd; } pgd_t;
+
+#define pmd_val(x)      ((x).pmd0)
+#define pmd_val1(x)     ((x).pmd1)
+#define pgd_val(x)      ((x).pgd)
+
+#endif /* __s390x__ */
 
 #define __pte(x)        ((pte_t) { (x) } )
 #define __pmd(x)        ((pmd_t) { (x) } )
diff -urN linux-2.5.67-bk5/include/asm-s390/pgalloc.h linux-2.5.67-bk6/include/asm-s390/pgalloc.h
--- linux-2.5.67-bk5/include/asm-s390/pgalloc.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/pgalloc.h	2003-04-15 04:36:16.000000000 -0700
@@ -1,5 +1,5 @@
 /*
- *  include/asm-s390/bugs.h
+ *  include/asm-s390/pgalloc.h
  *
  *  S390 version
  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
@@ -32,35 +32,79 @@
 	pgd_t *pgd;
 	int i;
 
+#ifndef __s390x__
 	pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,1);
         if (pgd != NULL)
 		for (i = 0; i < USER_PTRS_PER_PGD; i++)
 			pmd_clear(pmd_offset(pgd + i, i*PGDIR_SIZE));
+#else /* __s390x__ */
+	pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2);
+        if (pgd != NULL)
+		for (i = 0; i < PTRS_PER_PGD; i++)
+			pgd_clear(pgd + i);
+#endif /* __s390x__ */
 	return pgd;
 }
 
 static inline void pgd_free(pgd_t *pgd)
 {
+#ifndef __s390x__
         free_pages((unsigned long) pgd, 1);
+#else /* __s390x__ */
+        free_pages((unsigned long) pgd, 2);
+#endif /* __s390x__ */
 }
 
+#ifndef __s390x__
 /*
  * page middle directory allocation/free routines.
- * We don't use pmd cache, so these are dummy routines. This
+ * We use pmd cache only on s390x, so these are dummy routines. This
  * code never triggers because the pgd will always be present.
  */
 #define pmd_alloc_one(mm,address)       ({ BUG(); ((pmd_t *)2); })
 #define pmd_free(x)                     do { } while (0)
 #define __pmd_free_tlb(tlb,x)		do { } while (0)
 #define pgd_populate(mm, pmd, pte)      BUG()
+#else /* __s390x__ */
+static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
+{
+	pmd_t *pmd;
+        int i;
+
+	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2);
+	if (pmd != NULL) {
+		for (i=0; i < PTRS_PER_PMD; i++)
+			pmd_clear(pmd+i);
+	}
+	return pmd;
+}
+
+static inline void pmd_free (pmd_t *pmd)
+{
+	free_pages((unsigned long) pmd, 2);
+}
+
+#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd)
+
+static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
+{
+	pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd);
+}
+
+#endif /* __s390x__ */
 
 static inline void 
 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
 {
+#ifndef __s390x__
 	pmd_val(pmd[0]) = _PAGE_TABLE + __pa(pte);
 	pmd_val(pmd[1]) = _PAGE_TABLE + __pa(pte+256);
 	pmd_val(pmd[2]) = _PAGE_TABLE + __pa(pte+512);
 	pmd_val(pmd[3]) = _PAGE_TABLE + __pa(pte+768);
+#else /* __s390x__ */
+	pmd_val(*pmd) = _PMD_ENTRY + __pa(pte);
+	pmd_val1(*pmd) = _PMD_ENTRY + __pa(pte+256);
+#endif /* __s390x__ */
 }
 
 static inline void
@@ -122,11 +166,16 @@
                                     unsigned long address, pte_t *ptep)
 {
 	pte_t pte = *ptep;
+#ifndef __s390x__
 	if (!(pte_val(pte) & _PAGE_INVALID)) {
 		/* S390 has 1mb segments, we are emulating 4MB segments */
 		pte_t *pto = (pte_t *) (((unsigned long) ptep) & 0x7ffffc00);
 		__asm__ __volatile__ ("ipte %0,%1" : : "a" (pto), "a" (address));
 	}
+#else /* __s390x__ */
+	if (!(pte_val(pte) & _PAGE_INVALID)) 
+		__asm__ __volatile__ ("ipte %0,%1" : : "a" (ptep), "a" (address));
+#endif /* __s390x__ */
 	pte_clear(ptep);
 	return pte;
 }
diff -urN linux-2.5.67-bk5/include/asm-s390/pgtable.h linux-2.5.67-bk6/include/asm-s390/pgtable.h
--- linux-2.5.67-bk5/include/asm-s390/pgtable.h	2003-04-07 10:32:22.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/pgtable.h	2003-04-15 04:36:16.000000000 -0700
@@ -14,10 +14,12 @@
 #define _ASM_S390_PGTABLE_H
 
 /*
- * The Linux memory management assumes a three-level page table setup. On
- * the S390, we use that, but "fold" the mid level into the top-level page
- * table, so that we physically have the same two-level page table as the
- * S390 mmu expects.
+ * The Linux memory management assumes a three-level page table setup. For
+ * s390 31 bit we "fold" the mid level into the top-level page table, so
+ * that we physically have the same two-level page table as the s390 mmu
+ * expects in 31 bit mode. For s390 64 bit we use three of the five levels
+ * the hardware provides (region first and region second tables are not
+ * used).
  *
  * The "pgd_xxx()" functions are trivial for a folded two-level
  * setup: the pgd is never bad, and a pmd always exists (as it's folded
@@ -50,13 +52,18 @@
 /*
  * PMD_SHIFT determines the size of the area a second-level page
  * table can map
+ * PGDIR_SHIFT determines what a third-level page table entry can map
  */
-#define PMD_SHIFT       22
+#ifndef __s390x__
+# define PMD_SHIFT	22
+# define PGDIR_SHIFT	22
+#else /* __s390x__ */
+# define PMD_SHIFT	21
+# define PGDIR_SHIFT	31
+#endif /* __s390x__ */
+
 #define PMD_SIZE        (1UL << PMD_SHIFT)
 #define PMD_MASK        (~(PMD_SIZE-1))
-
-/* PGDIR_SHIFT determines what a third-level page table entry can map */
-#define PGDIR_SHIFT     22
 #define PGDIR_SIZE      (1UL << PGDIR_SHIFT)
 #define PGDIR_MASK      (~(PGDIR_SIZE-1))
 
@@ -66,24 +73,37 @@
  * for S390 segment-table entries are combined to one PGD
  * that leads to 1024 pte per pgd
  */
-#define PTRS_PER_PTE    1024
-#define PTRS_PER_PMD    1
-#define PTRS_PER_PGD    512
+#ifndef __s390x__
+# define PTRS_PER_PTE    1024
+# define PTRS_PER_PMD    1
+# define PTRS_PER_PGD    512
+#else /* __s390x__ */
+# define PTRS_PER_PTE    512
+# define PTRS_PER_PMD    1024
+# define PTRS_PER_PGD    2048
+#endif /* __s390x__ */
 
 /*
  * pgd entries used up by user/kernel:
  */
-#define USER_PTRS_PER_PGD  512
-#define USER_PGD_PTRS      512
-#define KERNEL_PGD_PTRS    512
-#define FIRST_USER_PGD_NR  0
+#ifndef __s390x__
+# define USER_PTRS_PER_PGD  512
+# define USER_PGD_PTRS      512
+# define KERNEL_PGD_PTRS    512
+# define FIRST_USER_PGD_NR  0
+#else /* __s390x__ */
+# define USER_PTRS_PER_PGD  2048
+# define USER_PGD_PTRS      2048
+# define KERNEL_PGD_PTRS    2048
+# define FIRST_USER_PGD_NR  0
+#endif /* __s390x__ */
 
 #define pte_ERROR(e) \
-	printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
+	printk("%s:%d: bad pte %p.\n", __FILE__, __LINE__, (void *) pte_val(e))
 #define pmd_ERROR(e) \
-	printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
+	printk("%s:%d: bad pmd %p.\n", __FILE__, __LINE__, (void *) pmd_val(e))
 #define pgd_ERROR(e) \
-	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
+	printk("%s:%d: bad pgd %p.\n", __FILE__, __LINE__, (void *) pgd_val(e))
 
 #ifndef __ASSEMBLY__
 /*
@@ -98,11 +118,15 @@
 #define VMALLOC_START   (((unsigned long) high_memory + VMALLOC_OFFSET) \
 			 & ~(VMALLOC_OFFSET-1))
 #define VMALLOC_VMADDR(x) ((unsigned long)(x))
-#define VMALLOC_END     (0x7fffffffL)
+#ifndef __s390x__
+# define VMALLOC_END     (0x7fffffffL)
+#else /* __s390x__ */
+# define VMALLOC_END     (0x40000000000L)
+#endif /* __s390x__ */
 
 
 /*
- * A pagetable entry of S390 has following format:
+ * A 31 bit pagetable entry of S390 has following format:
  *  |   PFRA          |    |  OS  |
  * 0                   0IP0
  * 00000000001111111111222222222233
@@ -111,7 +135,7 @@
  * I Page-Invalid Bit:    Page is not available for address-translation
  * P Page-Protection Bit: Store access not possible for page
  *
- * A segmenttable entry of S390 has following format:
+ * A 31 bit segmenttable entry of S390 has following format:
  *  |   P-table origin      |  |PTL
  * 0                         IC
  * 00000000001111111111222222222233
@@ -121,7 +145,7 @@
  * C Common-Segment Bit:     Segment is not private (PoP 3-30)
  * PTL Page-Table-Length:    Page-table length (PTL+1*16 entries -> up to 256)
  *
- * The segmenttable origin of S390 has following format:
+ * The 31 bit segmenttable origin of S390 has following format:
  *
  *  |S-table origin   |     | STL |
  * X                   **GPS
@@ -134,6 +158,46 @@
  * S Storage-Alteration:
  * STL Segment-Table-Length:  Segment-table length (STL+1*16 entries -> up to 2048)
  *
+ * A 64 bit pagetable entry of S390 has following format:
+ * |                     PFRA                         |0IP0|  OS  |
+ * 0000000000111111111122222222223333333333444444444455555555556666
+ * 0123456789012345678901234567890123456789012345678901234567890123
+ *
+ * I Page-Invalid Bit:    Page is not available for address-translation
+ * P Page-Protection Bit: Store access not possible for page
+ *
+ * A 64 bit segmenttable entry of S390 has following format:
+ * |        P-table origin                              |      TT
+ * 0000000000111111111122222222223333333333444444444455555555556666
+ * 0123456789012345678901234567890123456789012345678901234567890123
+ *
+ * I Segment-Invalid Bit:    Segment is not available for address-translation
+ * C Common-Segment Bit:     Segment is not private (PoP 3-30)
+ * P Page-Protection Bit: Store access not possible for page
+ * TT Type 00
+ *
+ * A 64 bit region table entry of S390 has following format:
+ * |        S-table origin                             |   TF  TTTL
+ * 0000000000111111111122222222223333333333444444444455555555556666
+ * 0123456789012345678901234567890123456789012345678901234567890123
+ *
+ * I Segment-Invalid Bit:    Segment is not available for address-translation
+ * TT Type 01
+ * TF
+ * TL Table lenght
+ *
+ * The 64 bit regiontable origin of S390 has following format:
+ * |      region table origon                          |       DTTL
+ * 0000000000111111111122222222223333333333444444444455555555556666
+ * 0123456789012345678901234567890123456789012345678901234567890123
+ *
+ * X Space-Switch event:
+ * G Segment-Invalid Bit:  
+ * P Private-Space Bit:    
+ * S Storage-Alteration:
+ * R Real space
+ * TL Table-Length:
+ *
  * A storage key has the following format:
  * | ACC |F|R|C|0|
  *  0   3 4 5 6 7
@@ -143,13 +207,23 @@
  * C  : changed bit
  */
 
-/* Bits in the page table entry */
-#define _PAGE_PRESENT   0x001          /* Software                         */
-#define _PAGE_MKCLEAN   0x002          /* Software                         */
-#define _PAGE_ISCLEAN   0x004	       /* Software			   */
+/* Hardware bits in the page table entry */
 #define _PAGE_RO        0x200          /* HW read-only                     */
 #define _PAGE_INVALID   0x400          /* HW invalid                       */
 
+/* Software bits in the page table entry */
+#define _PAGE_MKCLEAN   0x002
+#define _PAGE_ISCLEAN   0x004
+
+/* Mask and four different kinds of invalid pages. */
+#define _PAGE_INVALID_MASK	0x601
+#define _PAGE_INVALID_EMPTY	0x400
+#define _PAGE_INVALID_NONE	0x001
+#define _PAGE_INVALID_SWAP	0x200
+#define _PAGE_INVALID_FILE	0x201
+
+#ifndef __s390x__
+
 /* Bits in the segment table entry */
 #define _PAGE_TABLE_LEN 0xf            /* only full page-tables            */
 #define _PAGE_TABLE_COM 0x10           /* common page-table                */
@@ -166,29 +240,54 @@
 /*
  * User and Kernel pagetables are identical
  */
-#define _PAGE_TABLE     (_PAGE_TABLE_LEN )
-#define _KERNPG_TABLE   (_PAGE_TABLE_LEN )
+#define _PAGE_TABLE	_PAGE_TABLE_LEN
+#define _KERNPG_TABLE	_PAGE_TABLE_LEN
 
 /*
  * The Kernel segment-tables includes the User segment-table
  */
 
-#define _SEGMENT_TABLE  (_USER_SEG_TABLE_LEN|0x80000000|0x100)
-#define _KERNSEG_TABLE  (_KERNEL_SEG_TABLE_LEN)
+#define _SEGMENT_TABLE	(_USER_SEG_TABLE_LEN|0x80000000|0x100)
+#define _KERNSEG_TABLE	_KERNEL_SEG_TABLE_LEN
+
+#define USER_STD_MASK	0x00000080UL
+
+#else /* __s390x__ */
+
+/* Bits in the segment table entry */
+#define _PMD_ENTRY_INV   0x20          /* invalid segment table entry      */
+#define _PMD_ENTRY       0x00        
+
+/* Bits in the region third table entry */
+#define _PGD_ENTRY_INV   0x20          /* invalid region table entry       */
+#define _PGD_ENTRY       0x07
+
+/*
+ * User and kernel page directory
+ */
+#define _REGION_THIRD       0x4
+#define _REGION_THIRD_LEN   0x3 
+#define _REGION_TABLE       (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100)
+#define _KERN_REGION_TABLE  (_REGION_THIRD|_REGION_THIRD_LEN)
+
+#define USER_STD_MASK           0x0000000000000080UL
 
-#define USER_STD_MASK           0x00000080UL
+/* Bits in the storage key */
+#define _PAGE_CHANGED    0x02          /* HW changed bit                   */
+#define _PAGE_REFERENCED 0x04          /* HW referenced bit                */
+
+#endif /* __s390x__ */
 
 /*
  * No mapping available
  */
-#define PAGE_INVALID	  __pgprot(_PAGE_INVALID)
-#define PAGE_NONE_SHARED  __pgprot(_PAGE_PRESENT|_PAGE_INVALID)
-#define PAGE_NONE_PRIVATE __pgprot(_PAGE_PRESENT|_PAGE_INVALID|_PAGE_ISCLEAN)
-#define PAGE_RO_SHARED	  __pgprot(_PAGE_PRESENT|_PAGE_RO)
-#define PAGE_RO_PRIVATE	  __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN)
-#define PAGE_COPY	  __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN)
-#define PAGE_SHARED	  __pgprot(_PAGE_PRESENT)
-#define PAGE_KERNEL	  __pgprot(_PAGE_PRESENT)
+#define PAGE_NONE_SHARED  __pgprot(_PAGE_INVALID_NONE)
+#define PAGE_NONE_PRIVATE __pgprot(_PAGE_INVALID_NONE|_PAGE_ISCLEAN)
+#define PAGE_RO_SHARED	  __pgprot(_PAGE_RO)
+#define PAGE_RO_PRIVATE	  __pgprot(_PAGE_RO|_PAGE_ISCLEAN)
+#define PAGE_COPY	  __pgprot(_PAGE_RO|_PAGE_ISCLEAN)
+#define PAGE_SHARED	  __pgprot(0)
+#define PAGE_KERNEL	  __pgprot(_PAGE_ISCLEAN)
 
 /*
  * The S390 can't do page protection for execute, and considers that the
@@ -236,6 +335,8 @@
 /*
  * pgd/pmd/pte query functions
  */
+#ifndef __s390x__
+
 extern inline int pgd_present(pgd_t pgd) { return 1; }
 extern inline int pgd_none(pgd_t pgd)    { return 0; }
 extern inline int pgd_bad(pgd_t pgd)     { return 0; }
@@ -247,11 +348,54 @@
 	return (pmd_val(pmd) & (~PAGE_MASK & ~_PAGE_TABLE_INV)) != _PAGE_TABLE;
 }
 
-extern inline int pte_present(pte_t pte) { return pte_val(pte) & _PAGE_PRESENT; }
+#else /* __s390x__ */
+
+extern inline int pgd_present(pgd_t pgd)
+{
+	return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY;
+}
+
+extern inline int pgd_none(pgd_t pgd)
+{
+	return pgd_val(pgd) & _PGD_ENTRY_INV;
+}
+
+extern inline int pgd_bad(pgd_t pgd)
+{
+	return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY;
+}
+
+extern inline int pmd_present(pmd_t pmd)
+{
+	return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY;
+}
+
+extern inline int pmd_none(pmd_t pmd)
+{
+	return pmd_val(pmd) & _PMD_ENTRY_INV;
+}
+
+extern inline int pmd_bad(pmd_t pmd)
+{
+	return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY;
+}
+
+#endif /* __s390x__ */
+
 extern inline int pte_none(pte_t pte)
 {
-	return ((pte_val(pte) & 
-                (_PAGE_INVALID | _PAGE_RO | _PAGE_PRESENT)) == _PAGE_INVALID);
+	return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_EMPTY;
+}
+
+extern inline int pte_present(pte_t pte)
+{
+	return !(pte_val(pte) & _PAGE_INVALID) ||
+		(pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_NONE;
+}
+
+extern inline int pte_file(pte_t pte)
+{
+	return (pte_val(pte) & _PAGE_INVALID_MASK) == _PAGE_INVALID_FILE;
 }
 
 #define pte_same(a,b)	(pte_val(a) == pte_val(b))
@@ -286,6 +430,9 @@
 /*
  * pgd/pmd/pte modification functions
  */
+
+#ifndef __s390x__
+
 extern inline void pgd_clear(pgd_t * pgdp)      { }
 
 extern inline void pmd_clear(pmd_t * pmdp)
@@ -296,9 +443,24 @@
 	pmd_val(pmdp[3]) = _PAGE_TABLE_INV;
 }
 
+#else /* __s390x__ */
+
+extern inline void pgd_clear(pgd_t * pgdp)
+{
+	pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY;
+}
+
+extern inline void pmd_clear(pmd_t * pmdp)
+{
+	pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
+	pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
+}
+
+#endif /* __s390x__ */
+
 extern inline void pte_clear(pte_t *ptep)
 {
-	pte_val(*ptep) = _PAGE_INVALID; 
+	pte_val(*ptep) = _PAGE_INVALID_EMPTY;
 }
 
 /*
@@ -444,6 +606,18 @@
 	__pte;                                                            \
 })
 
+#ifdef __s390x__
+
+#define pfn_pmd(pfn, pgprot)                                              \
+({                                                                        \
+	pgprot_t __pgprot = (pgprot);                                     \
+	unsigned long __physpage = __pa((pfn) << PAGE_SHIFT);             \
+	pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot));           \
+	__pmd;                                                            \
+})
+
+#endif /* __s390x__ */
+
 #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
 #define pte_page(x) pfn_to_page(pte_pfn(x))
 
@@ -460,12 +634,23 @@
 /* to find an entry in a kernel page-table-directory */
 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
 
+#ifndef __s390x__
+
 /* Find an entry in the second-level page table.. */
 extern inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
 {
         return (pmd_t *) dir;
 }
 
+#else /* __s390x__ */
+
+/* Find an entry in the second-level page table.. */
+#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
+#define pmd_offset(dir,addr) \
+	((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr))
+
+#endif /* __s390x__ */
+
 /* Find an entry in the third-level page table.. */
 #define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
 #define pte_offset_kernel(pmd, address) \
@@ -476,6 +661,7 @@
 #define pte_unmap_nested(pte) do { } while (0)
 
 /*
+ * 31 bit swap entry format:
  * A page-table entry has some bits we have to treat in a special way.
  * Bits 0, 20 and bit 23 have to be zero, otherwise an specification
  * exception will occur instead of a page translation exception. The
@@ -491,17 +677,38 @@
  * 0|     offset      |0110|type |0
  * 00000000001111111111222222222233
  * 01234567890123456789012345678901
+ *
+ * 64 bit swap entry format:
+ * A page-table entry has some bits we have to treat in a special way.
+ * Bits 52 and bit 55 have to be zero, otherwise an specification
+ * exception will occur instead of a page translation exception. The
+ * specifiation exception has the bad habit not to store necessary
+ * information in the lowcore.
+ * Bit 53 and bit 54 are the page invalid bit and the page protection
+ * bit. We set both to indicate a swapped page.
+ * Bit 63 is used as the software page present bit. If a page is
+ * swapped this obviously has to be zero.
+ * This leaves the bits 0-51 and bits 56-62 to store type and offset.
+ * We use the 7 bits from 56-62 for the type and the 52 bits from 0-51
+ * for the offset.
+ * |                     offset                       |0110|type |0
+ * 0000000000111111111122222222223333333333444444444455555555556666
+ * 0123456789012345678901234567890123456789012345678901234567890123
  */
 extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
 {
 	pte_t pte;
-	pte_val(pte) = (type << 1) | (offset << 12) | _PAGE_INVALID | _PAGE_RO;
+	pte_val(pte) = (type << 1) | (offset << 12) | _PAGE_INVALID_SWAP;
+#ifndef __s390x__
 	pte_val(pte) &= 0x7ffff6fe;  /* better to be paranoid */
+#else /* __s390x__ */
+	pte_val(pte) &= 0xfffffffffffff6fe;  /* better to be paranoid */
+#endif /* __s390x__ */
 	return pte;
 }
 
 #define __swp_type(entry)	(((entry).val >> 1) & 0x3f)
-#define __swp_offset(entry)	(((entry).val >> 12) & 0x7FFFF )
+#define __swp_offset(entry)	((entry).val >> 12)
 #define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) })
 
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
@@ -509,6 +716,19 @@
 
 typedef pte_t *pte_addr_t;
 
+#ifndef __s390x__
+# define PTE_FILE_MAX_BITS	26
+#else /* __s390x__ */
+# define PTE_FILE_MAX_BITS	59
+#endif /* __s390x__ */
+
+#define pte_to_pgoff(__pte) \
+	((((__pte).pte >> 12) << 7) + (((__pte).pte >> 1) & 0x7f))
+
+#define pgoff_to_pte(__off) \
+	((pte_t) { ((((__off) & 0x7f) << 1) + (((__off) >> 7) << 12)) \
+		   | _PAGE_INVALID_FILE })
+
 #endif /* !__ASSEMBLY__ */
 
 #define kern_addr_valid(addr)   (1)
@@ -518,5 +738,9 @@
  */
 #define pgtable_cache_init()	do { } while (0)
 
+#ifdef __s390x__
+# define HAVE_ARCH_UNMAPPED_AREA
+#endif /* __s390x__ */
+
 #endif /* _S390_PAGE_H */
 
diff -urN linux-2.5.67-bk5/include/asm-s390/posix_types.h linux-2.5.67-bk6/include/asm-s390/posix_types.h
--- linux-2.5.67-bk5/include/asm-s390/posix_types.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/posix_types.h	2003-04-15 04:36:16.000000000 -0700
@@ -15,34 +15,57 @@
  * assume GCC is being used.
  */
 
-typedef unsigned short  __kernel_dev_t;
-typedef unsigned long   __kernel_ino_t;
-typedef unsigned short  __kernel_mode_t;
-typedef unsigned short  __kernel_nlink_t;
 typedef long            __kernel_off_t;
 typedef int             __kernel_pid_t;
-typedef unsigned short  __kernel_ipc_pid_t;
-typedef unsigned short  __kernel_uid_t;
-typedef unsigned short  __kernel_gid_t;
 typedef unsigned long   __kernel_size_t;
-typedef int             __kernel_ssize_t;
-typedef int             __kernel_ptrdiff_t;
 typedef long            __kernel_time_t;
 typedef long            __kernel_suseconds_t;
 typedef long            __kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int             __kernel_daddr_t;
 typedef char *          __kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;
 typedef unsigned short	__kernel_gid16_t;
+
+#ifdef __GNUC__
+typedef long long       __kernel_loff_t;
+#endif
+
+#ifndef __s390x__
+
+typedef unsigned short  __kernel_dev_t;
+typedef unsigned long   __kernel_ino_t;
+typedef unsigned short  __kernel_mode_t;
+typedef unsigned short  __kernel_nlink_t;
+typedef unsigned short  __kernel_ipc_pid_t;
+typedef unsigned short  __kernel_uid_t;
+typedef unsigned short  __kernel_gid_t;
+typedef int             __kernel_ssize_t;
+typedef int             __kernel_ptrdiff_t;
 typedef unsigned int	__kernel_uid32_t;
 typedef unsigned int	__kernel_gid32_t;
-
 typedef unsigned short	__kernel_old_uid_t;
 typedef unsigned short	__kernel_old_gid_t;
 
-#ifdef __GNUC__
-typedef long long       __kernel_loff_t;
-#endif
+#else /* __s390x__ */
+
+typedef unsigned int    __kernel_dev_t;
+typedef unsigned int    __kernel_ino_t;
+typedef unsigned int    __kernel_mode_t;
+typedef unsigned int    __kernel_nlink_t;
+typedef int             __kernel_ipc_pid_t;
+typedef unsigned int    __kernel_uid_t;
+typedef unsigned int    __kernel_gid_t;
+typedef long            __kernel_ssize_t;
+typedef long            __kernel_ptrdiff_t;
+typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */
+typedef __kernel_uid_t __kernel_old_uid_t;
+typedef __kernel_gid_t __kernel_old_gid_t;
+typedef __kernel_uid_t __kernel_uid32_t;
+typedef __kernel_gid_t __kernel_gid32_t;
+
+#endif /* __s390x__ */
 
 typedef struct {
 #if defined(__KERNEL__) || defined(__USE_ALL)
diff -urN linux-2.5.67-bk5/include/asm-s390/processor.h linux-2.5.67-bk6/include/asm-s390/processor.h
--- linux-2.5.67-bk5/include/asm-s390/processor.h	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/processor.h	2003-04-15 04:36:16.000000000 -0700
@@ -44,6 +44,9 @@
         __u16    cpu_nr;
         unsigned long loops_per_jiffy;
         unsigned long *pgd_quick;
+#ifdef __s390x__
+        unsigned long *pmd_quick;
+#endif /* __s390x__ */
         unsigned long *pte_quick;
         unsigned long pgtable_cache_sz;
 };
@@ -54,58 +57,90 @@
 extern struct task_struct *last_task_used_math;
 
 /*
- * User space process size: 2GB (default).
+ * User space process size: 2GB for 31 bit, 4TB for 64 bit.
  */
-#define TASK_SIZE       (0x80000000)
-/* This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE      (TASK_SIZE / 2)
+#ifndef __s390x__
+
+# define TASK_SIZE		(0x80000000UL)
+# define TASK_UNMAPPED_BASE	(TASK_SIZE / 2)
+
+#else /* __s390x__ */
+
+# define TASK_SIZE		(0x20000000000UL)
+# define TASK31_SIZE		(0x80000000UL)
+# define TASK_UNMAPPED_BASE	(test_thread_flag(TIF_31BIT) ? \
+					(TASK31_SIZE / 2) : (TASK_SIZE / 2))
+
+#endif /* __s390x__ */
 
 typedef struct {
         __u32 ar4;
 } mm_segment_t;
 
-/* if you change the thread_struct structure, you must
- * update the _TSS_* defines in entry.S
+/*
+ * Thread structure
  */
-
-struct thread_struct
- {
+struct thread_struct {
 	s390_fp_regs fp_regs;
-        __u32   ar2;                   /* kernel access register 2         */
-        __u32   ar4;                   /* kernel access register 4         */
-        __u32   ksp;                   /* kernel stack pointer             */
-        __u32   user_seg;              /* HSTD                             */
-        __u32   error_code;            /* error-code of last prog-excep.   */
-        __u32   prot_addr;             /* address of protection-excep.     */
-        __u32   trap_no;
-        per_struct per_info;/* Must be aligned on an 4 byte boundary*/
+	unsigned int ar2;		/* kernel access register 2         */
+        unsigned int ar4;               /* kernel access register 4         */
+        unsigned long ksp;              /* kernel stack pointer             */
+        unsigned long user_seg;         /* HSTD                             */
+        unsigned long prot_addr;        /* address of protection-excep.     */
+        unsigned int error_code;        /* error-code of last prog-excep.   */
+        unsigned int trap_no;
+        per_struct per_info;
 	/* Used to give failing instruction back to user for ieee exceptions */
-	addr_t  ieee_instruction_pointer; 
+	unsigned long ieee_instruction_pointer; 
         /* pfault_wait is used to block the process on a pfault event */
-	addr_t  pfault_wait;
+	unsigned long pfault_wait;
 };
 
 typedef struct thread_struct thread_struct;
 
-#define INIT_THREAD {{0,{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}, \
-			    {0},{0},{0},{0},{0},{0}}},            \
-                     0, 0,                                        \
-                    sizeof(init_stack) + (__u32) &init_stack,     \
-              (__pa((__u32) &swapper_pg_dir[0]) + _SEGMENT_TABLE),\
-                     0,0,0,                                       \
-                     (per_struct) {{{{0,}}},0,0,0,0,{{0,}}},      \
-                     0, 0                                         \
-}
+#ifndef __s390x__
+# define __SWAPPER_PG_DIR __pa(&swapper_pg_dir[0]) + _SEGMENT_TABLE
+#else /* __s390x__ */
+# define __SWAPPER_PG_DIR __pa(&swapper_pg_dir[0]) + _REGION_TABLE
+#endif /* __s390x__ */
+
+#define INIT_THREAD {{0,{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},	       \
+			    {0},{0},{0},{0},{0},{0}}},			       \
+		     0, 0,						       \
+		     sizeof(init_stack) + (unsigned long) &init_stack,	       \
+		     __SWAPPER_PG_DIR,					       \
+		     0,0,0,						       \
+		     (per_struct) {{{{0,}}},0,0,0,0,{{0,}}},		       \
+		     0, 0						       \
+} 
+
+/*
+ * Do necessary setup to start up a new thread.
+ */
+#ifndef __s390x__
 
-/* need to define ... */
 #define start_thread(regs, new_psw, new_stackp) do {            \
         regs->psw.mask  = PSW_USER_BITS;                        \
-        regs->psw.addr  = new_psw | PSW_ADDR_AMODE31;           \
+        regs->psw.addr  = new_psw | PSW_ADDR_AMODE;             \
         regs->gprs[15]  = new_stackp ;                          \
 } while (0)
 
+#else /* __s390x__ */
+
+#define start_thread(regs, new_psw, new_stackp) do {            \
+        regs->psw.mask  = PSW_USER_BITS;                        \
+        regs->psw.addr  = new_psw;                              \
+        regs->gprs[15]  = new_stackp;                           \
+} while (0)
+
+#define start_thread31(regs, new_psw, new_stackp) do {          \
+	regs->psw.mask  = PSW_USER32_BITS;			\
+        regs->psw.addr  = new_psw;                              \
+        regs->gprs[15]  = new_stackp;                           \
+} while (0)
+
+#endif /* __s390x__ */
+
 /* Forward declaration, a strange C thing */
 struct task_struct;
 struct mm_struct;
@@ -129,11 +164,19 @@
 
 unsigned long get_wchan(struct task_struct *p);
 #define __KSTK_PTREGS(tsk) ((struct pt_regs *) \
-        (((addr_t) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs)) & -8L))
+        (((unsigned long) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs)) & -8L))
 #define KSTK_EIP(tsk)	(__KSTK_PTREGS(tsk)->psw.addr)
 #define KSTK_ESP(tsk)	(__KSTK_PTREGS(tsk)->gprs[15])
 
-#define cpu_relax()	barrier()
+/*
+ * Give up the time slice of the virtual PU.
+ */
+#ifndef __s390x__
+# define cpu_relax()	asm volatile ("diag 0,0,68" : : : "memory")
+#else /* __s390x__ */
+# define cpu_relax() \
+	asm volatile ("ex 0,%0" : : "i" (__LC_DIAG44_OPCODE) : "memory")
+#endif /* __s390x__ */
 
 /*
  * Set PSW mask to specified value, while leaving the
@@ -147,13 +190,22 @@
 	psw_t psw;
 	psw.mask = mask;
 
+#ifndef __s390x__
 	asm volatile (
 		"    basr %0,0\n"
 		"0:  ahi  %0,1f-0b\n"
-		"    st   %0,4(%1)\n"
+		"    st	  %0,4(%1)\n"
 		"    lpsw 0(%1)\n"
 		"1:"
 		: "=&d" (addr) : "a" (&psw) : "memory", "cc" );
+#else /* __s390x__ */
+	asm volatile (
+		"    larl  %0,1f\n"
+		"    stg   %0,8(%1)\n"
+		"    lpswe 0(%1)\n"
+		"1:"
+		: "=&d" (addr) : "a" (&psw) : "memory", "cc" );
+#endif /* __s390x__ */
 }
  
 /*
@@ -166,6 +218,7 @@
 
 	wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
 		PSW_MASK_MCHECK | PSW_MASK_WAIT;
+#ifndef __s390x__
 	asm volatile (
 		"    basr %0,0\n"
 		"0:  la   %0,1f-0b(%0)\n"
@@ -174,6 +227,14 @@
 		"    lpsw 0(%1)\n"
 		"1:"
 		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
+#else /* __s390x__ */
+	asm volatile (
+		"    larl  %0,0f\n"
+		"    stg   %0,8(%1)\n"
+		"    lpswe 0(%1)\n"
+		"0:"
+		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
+#endif /* __s390x__ */
 }
 
 /*
@@ -193,7 +254,7 @@
          * Store status and then load disabled wait psw,
          * the processor is dead afterwards
          */
-
+#ifndef __s390x__
         asm volatile ("    stctl 0,0,0(%1)\n"
                       "    ni    0(%1),0xef\n" /* switch off protection */
                       "    lctl  0,0,0(%1)\n"
@@ -210,6 +271,38 @@
                       "    oi    0(%1),0x10\n" /* fake protection bit */
                       "    lpsw 0(%0)"
                       : : "a" (dw_psw), "a" (&ctl_buf) : "cc" );
+#else /* __s390x__ */
+        asm volatile ("    stctg 0,0,0(%1)\n"
+                      "    ni    4(%1),0xef\n" /* switch off protection */
+                      "    lctlg 0,0,0(%1)\n"
+                      "    lghi  1,0x1000\n"
+                      "    stpt  0x328(1)\n"      /* store timer */
+                      "    stckc 0x330(1)\n"      /* store clock comparator */
+                      "    stpx  0x318(1)\n"      /* store prefix register */
+                      "    stam  0,15,0x340(1)\n" /* store access registers */
+                      "    stfpc 0x31c(1)\n"      /* store fpu control */
+                      "    std   0,0x200(1)\n"    /* store f0 */
+                      "    std   1,0x208(1)\n"    /* store f1 */
+                      "    std   2,0x210(1)\n"    /* store f2 */
+                      "    std   3,0x218(1)\n"    /* store f3 */
+                      "    std   4,0x220(1)\n"    /* store f4 */
+                      "    std   5,0x228(1)\n"    /* store f5 */
+                      "    std   6,0x230(1)\n"    /* store f6 */
+                      "    std   7,0x238(1)\n"    /* store f7 */
+                      "    std   8,0x240(1)\n"    /* store f8 */
+                      "    std   9,0x248(1)\n"    /* store f9 */
+                      "    std   10,0x250(1)\n"   /* store f10 */
+                      "    std   11,0x258(1)\n"   /* store f11 */
+                      "    std   12,0x260(1)\n"   /* store f12 */
+                      "    std   13,0x268(1)\n"   /* store f13 */
+                      "    std   14,0x270(1)\n"   /* store f14 */
+                      "    std   15,0x278(1)\n"   /* store f15 */
+                      "    stmg  0,15,0x280(1)\n" /* store general registers */
+                      "    stctg 0,15,0x380(1)\n" /* store control registers */
+                      "    oi    0x384(1),0x10\n" /* fake protection bit */
+                      "    lpswe 0(%0)"
+                      : : "a" (dw_psw), "a" (&ctl_buf) : "cc", "0", "1");
+#endif /* __s390x__ */
 }
 
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/ptrace.h linux-2.5.67-bk6/include/asm-s390/ptrace.h
--- linux-2.5.67-bk5/include/asm-s390/ptrace.h	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/ptrace.h	2003-04-15 04:36:16.000000000 -0700
@@ -13,6 +13,8 @@
  * Offsets in the user_regs_struct. They are used for the ptrace
  * system call and in entry.S
  */
+#ifndef __s390x__
+
 #define PT_PSWMASK  0x00
 #define PT_PSWADDR  0x04
 #define PT_GPR0     0x08
@@ -92,18 +94,89 @@
 #define PT_LASTOFF  PT_IEEE_IP
 #define PT_ENDREGS  0x140-1
 
+#define GPR_SIZE	4
+#define CR_SIZE		4
+
+#define STACK_FRAME_OVERHEAD	96	/* size of minimum stack frame */
+
+#else /* __s390x__ */
+
+#define PT_PSWMASK  0x00
+#define PT_PSWADDR  0x08
+#define PT_GPR0     0x10
+#define PT_GPR1     0x18
+#define PT_GPR2     0x20
+#define PT_GPR3     0x28
+#define PT_GPR4     0x30
+#define PT_GPR5     0x38
+#define PT_GPR6     0x40
+#define PT_GPR7     0x48
+#define PT_GPR8     0x50
+#define PT_GPR9     0x58
+#define PT_GPR10    0x60
+#define PT_GPR11    0x68
+#define PT_GPR12    0x70
+#define PT_GPR13    0x78
+#define PT_GPR14    0x80
+#define PT_GPR15    0x88
+#define PT_ACR0     0x90
+#define PT_ACR1     0x94
+#define PT_ACR2     0x98
+#define PT_ACR3     0x9C
+#define PT_ACR4	    0xA0
+#define PT_ACR5	    0xA4
+#define PT_ACR6	    0xA8
+#define PT_ACR7	    0xAC
+#define PT_ACR8	    0xB0
+#define PT_ACR9	    0xB4
+#define PT_ACR10    0xB8
+#define PT_ACR11    0xBC
+#define PT_ACR12    0xC0
+#define PT_ACR13    0xC4
+#define PT_ACR14    0xC8
+#define PT_ACR15    0xCC
+#define PT_ORIGGPR2 0xD0
+#define PT_FPC	    0xD8
+#define PT_FPR0     0xE0
+#define PT_FPR1     0xE8
+#define PT_FPR2     0xF0
+#define PT_FPR3     0xF8
+#define PT_FPR4     0x100
+#define PT_FPR5     0x108
+#define PT_FPR6     0x110
+#define PT_FPR7     0x118
+#define PT_FPR8     0x120
+#define PT_FPR9     0x128
+#define PT_FPR10    0x130
+#define PT_FPR11    0x138
+#define PT_FPR12    0x140
+#define PT_FPR13    0x148
+#define PT_FPR14    0x150
+#define PT_FPR15    0x158
+#define PT_CR_9     0x160
+#define PT_CR_10    0x168
+#define PT_CR_11    0x170
+#define PT_IEEE_IP  0x1A8
+#define PT_LASTOFF  PT_IEEE_IP
+#define PT_ENDREGS  0x1B0-1
+
+#define GPR_SIZE	8
+#define CR_SIZE		8
+
+#define STACK_FRAME_OVERHEAD    160      /* size of minimum stack frame */
+
+#endif /* __s390x__ */
+
 #define NUM_GPRS	16
 #define NUM_FPRS	16
 #define NUM_CRS		16
 #define NUM_ACRS	16
-#define GPR_SIZE	4
+
 #define FPR_SIZE	8
 #define FPC_SIZE	4
 #define FPC_PAD_SIZE	4 /* gcc insists on aligning the fpregs */
-#define CR_SIZE		4
 #define ACR_SIZE	4
 
-#define STACK_FRAME_OVERHEAD	96	/* size of minimum stack frame */
 
 #define PTRACE_OLDSETOPTIONS         21
 
@@ -113,13 +186,39 @@
 #include <linux/types.h>
 #include <asm/setup.h>
 
+typedef union
+{
+	float   f;
+	double  d;
+        __u64   ui;
+	struct
+	{
+		__u32 hi;
+		__u32 lo;
+	} fp;
+} freg_t;
+
+typedef struct
+{
+	__u32   fpc;
+	freg_t  fprs[NUM_FPRS];              
+} s390_fp_regs;
+
+#define FPC_EXCEPTION_MASK      0xF8000000
+#define FPC_FLAGS_MASK          0x00F80000
+#define FPC_DXC_MASK            0x0000FF00
+#define FPC_RM_MASK             0x00000003
+#define FPC_VALID_MASK          0xF8F8FF03
+
 /* this typedef defines how a Program Status Word looks like */
 typedef struct 
 {
-        __u32   mask;
-        __u32   addr;
+        unsigned long mask;
+        unsigned long addr;
 } __attribute__ ((aligned(8))) psw_t;
 
+#ifndef __s390x__
+
 #define PSW_MASK_PER		0x40000000UL
 #define PSW_MASK_DAT		0x04000000UL
 #define PSW_MASK_IO		0x02000000UL
@@ -132,7 +231,7 @@
 #define PSW_MASK_CC		0x00003000UL
 #define PSW_MASK_PM		0x00000F00UL
 
-#define PSW_ADDR_AMODE31	0x80000000UL
+#define PSW_ADDR_AMODE		0x80000000UL
 #define PSW_ADDR_INSN		0x7FFFFFFFUL
 
 #define PSW_BASE_BITS		0x00080000UL
@@ -142,34 +241,41 @@
 #define PSW_ASC_SECONDARY	0x00008000UL
 #define PSW_ASC_HOME		0x0000C000UL
 
-#define PSW_KERNEL_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY)
-#define PSW_USER_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
+#else /* __s390x__ */
+
+#define PSW_MASK_PER		0x4000000000000000UL
+#define PSW_MASK_DAT		0x0400000000000000UL
+#define PSW_MASK_IO		0x0200000000000000UL
+#define PSW_MASK_EXT		0x0100000000000000UL
+#define PSW_MASK_KEY		0x00F0000000000000UL
+#define PSW_MASK_MCHECK		0x0004000000000000UL
+#define PSW_MASK_WAIT		0x0002000000000000UL
+#define PSW_MASK_PSTATE		0x0001000000000000UL
+#define PSW_MASK_ASC		0x0000C00000000000UL
+#define PSW_MASK_CC		0x0000300000000000UL
+#define PSW_MASK_PM		0x00000F0000000000UL
+
+#define PSW_ADDR_AMODE		0x0000000000000000UL
+#define PSW_ADDR_INSN		0xFFFFFFFFFFFFFFFFUL
+
+#define PSW_BASE_BITS		0x0000000180000000UL
+#define PSW_BASE32_BITS		0x0000000080000000UL
+
+#define PSW_ASC_PRIMARY		0x0000000000000000UL
+#define PSW_ASC_ACCREG		0x0000400000000000UL
+#define PSW_ASC_SECONDARY	0x0000800000000000UL
+#define PSW_ASC_HOME		0x0000C00000000000UL
+
+#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
 			 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
 			 PSW_MASK_PSTATE)
 
-typedef union
-{
-	float   f;
-	double  d;
-        __u64   ui;
-	struct
-	{
-		__u32 hi;
-		__u32 lo;
-	} fp;
-} freg_t;
+#endif /* __s390x__ */
 
-typedef struct
-{
-	__u32   fpc;
-	freg_t  fprs[NUM_FPRS];              
-} s390_fp_regs;
-
-#define FPC_EXCEPTION_MASK      0xF8000000
-#define FPC_FLAGS_MASK          0x00F80000
-#define FPC_DXC_MASK            0x0000FF00
-#define FPC_RM_MASK             0x00000003
-#define FPC_VALID_MASK          0xF8F8FF03
+#define PSW_KERNEL_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY)
+#define PSW_USER_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
+			 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
+			 PSW_MASK_PSTATE)
 
 /*
  * The first entries in pt_regs and user_regs_struct
@@ -180,9 +286,9 @@
 typedef struct
 {
 	psw_t psw;
-	__u32 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u32 orig_gpr2;
+	unsigned long gprs[NUM_GPRS];
+	unsigned int  acrs[NUM_ACRS];
+	unsigned long orig_gpr2;
 } s390_regs;
 
 /*
@@ -192,24 +298,27 @@
 struct pt_regs 
 {
 	psw_t psw;
-	__u32 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u32 orig_gpr2;
-	__u32 trap;
-};
+	unsigned long gprs[NUM_GPRS];
+	unsigned int  acrs[NUM_ACRS];
+	unsigned long orig_gpr2;
+	unsigned int  trap;
+} __attribute__ ((packed));
 
 /*
  * Now for the program event recording (trace) definitions.
  */
 typedef struct
 {
-	__u32 cr[3];
+	unsigned long cr[3];
 } per_cr_words;
 
-#define PER_EM_MASK 0xE8000000
+#define PER_EM_MASK 0xE8000000UL
 
 typedef	struct
 {
+#ifdef __s390x__
+	unsigned                       : 32;
+#endif /* __s390x__ */
 	unsigned em_branching          : 1;
 	unsigned em_instruction_fetch  : 1;
 	/*
@@ -224,33 +333,34 @@
 	unsigned                       : 1;
 	unsigned storage_alt_space_ctl : 1;
 	unsigned                       : 21;
-	addr_t   starting_addr;
-	addr_t   ending_addr;
+	unsigned long starting_addr;
+	unsigned long ending_addr;
 } per_cr_bits;
 
 typedef struct
 {
-	__u16          perc_atmid;          /* 0x096 */
-	__u32          address;             /* 0x098 */
-	__u8           access_id;           /* 0x0a1 */
+	unsigned short perc_atmid;
+	unsigned long address;
+	unsigned char access_id;
 } per_lowcore_words;
 
 typedef struct
 {
-	unsigned perc_branching          : 1; /* 0x096 */
+	unsigned perc_branching          : 1;
 	unsigned perc_instruction_fetch  : 1;
 	unsigned perc_storage_alteration : 1;
 	unsigned perc_gpr_alt_unused     : 1;
 	unsigned perc_store_real_address : 1;
-	unsigned                         : 4;
+	unsigned                         : 3;
+	unsigned atmid_psw_bit_31        : 1;
 	unsigned atmid_validity_bit      : 1;
 	unsigned atmid_psw_bit_32        : 1;
 	unsigned atmid_psw_bit_5         : 1;
 	unsigned atmid_psw_bit_16        : 1;
 	unsigned atmid_psw_bit_17        : 1;
 	unsigned si                      : 2;
-	addr_t   address;                     /* 0x098 */
-	unsigned                         : 4; /* 0x0a1 */
+	unsigned long address;
+	unsigned                         : 4;
 	unsigned access_id               : 4;
 } per_lowcore_bits;
 
@@ -272,8 +382,8 @@
 	 * These addresses are copied into cr10 & cr11 if single
 	 * stepping is switched off
 	 */
-	__u32     starting_addr;
-	__u32     ending_addr;
+	unsigned long starting_addr;
+	unsigned long ending_addr;
 	union {
 		per_lowcore_words words;
 		per_lowcore_bits  bits;
@@ -282,9 +392,9 @@
 
 typedef struct
 {
-	__u32  len;
-	addr_t kernel_addr;
-	addr_t process_addr;
+	unsigned int  len;
+	unsigned long kernel_addr;
+	unsigned long process_addr;
 } ptrace_area;
 
 /*
@@ -313,9 +423,9 @@
 
 typedef struct
 {
-	addr_t           lowaddr;
-	addr_t           hiaddr;
-	ptprot_flags     prot;
+	unsigned long lowaddr;
+	unsigned long hiaddr;
+	ptprot_flags prot;
 } ptprot_area;                     
 
 /* Sequence of bytes for breakpoint illegal instruction.  */
@@ -331,9 +441,9 @@
 struct user_regs_struct
 {
 	psw_t psw;
-	__u32 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u32 orig_gpr2;
+	unsigned long gprs[NUM_GPRS];
+	unsigned int  acrs[NUM_ACRS];
+	unsigned long orig_gpr2;
 	s390_fp_regs fp_regs;
 	/*
 	 * These per registers are in here so that gdb can modify them
@@ -341,13 +451,13 @@
 	 * watchpoints. This is the way intel does it.
 	 */
 	per_struct per_info;
-	addr_t  ieee_instruction_pointer; 
+	unsigned long ieee_instruction_pointer; 
 	/* Used to give failing instruction back to user for ieee exceptions */
 };
 
 #ifdef __KERNEL__
 #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
-#define instruction_pointer(regs) ((regs)->psw.addr & PSW_MASK_INSN)
+#define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN)
 extern void show_regs(struct pt_regs * regs);
 #endif
 
diff -urN linux-2.5.67-bk5/include/asm-s390/qdio.h linux-2.5.67-bk6/include/asm-s390/qdio.h
--- linux-2.5.67-bk5/include/asm-s390/qdio.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/qdio.h	2003-04-15 04:36:16.000000000 -0700
@@ -20,9 +20,9 @@
 
 #define QDIO_NAME "qdio "
 
-#ifndef CONFIG_ARCH_S390X
+#ifndef __s390x__
 #define QDIO_32_BIT
-#endif /* CONFIG_ARCH_S390X */
+#endif /* __s390x__ */
 
 /**** CONSTANTS, that are relied on without using these symbols *****/
 #define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */
diff -urN linux-2.5.67-bk5/include/asm-s390/rwsem.h linux-2.5.67-bk6/include/asm-s390/rwsem.h
--- linux-2.5.67-bk5/include/asm-s390/rwsem.h	2003-04-07 10:31:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/rwsem.h	2003-04-15 04:36:16.000000000 -0700
@@ -63,10 +63,17 @@
 	struct list_head	wait_list;
 };
 
+#ifndef __s390x__
 #define RWSEM_UNLOCKED_VALUE	0x00000000
 #define RWSEM_ACTIVE_BIAS	0x00000001
 #define RWSEM_ACTIVE_MASK	0x0000ffff
 #define RWSEM_WAITING_BIAS	(-0x00010000)
+#else /* __s390x__ */
+#define RWSEM_UNLOCKED_VALUE	0x0000000000000000L
+#define RWSEM_ACTIVE_BIAS	0x0000000000000001L
+#define RWSEM_ACTIVE_MASK	0x00000000ffffffffL
+#define RWSEM_WAITING_BIAS	(-0x0000000100000000L)
+#endif /* __s390x__ */
 #define RWSEM_ACTIVE_READ_BIAS	RWSEM_ACTIVE_BIAS
 #define RWSEM_ACTIVE_WRITE_BIAS	(RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
 
@@ -94,11 +101,19 @@
 	signed long old, new;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   ahi  %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   aghi %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
 		: "cc", "memory" );
@@ -114,6 +129,7 @@
 	signed long old, new;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: ltr  %1,%0\n"
 		"   jm   1f\n"
@@ -121,6 +137,15 @@
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b\n"
 		"1:"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: ltgr %1,%0\n"
+		"   jm   1f\n"
+		"   aghi %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b\n"
+		"1:"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
 		: "cc", "memory" );
@@ -136,11 +161,19 @@
 
 	tmp = RWSEM_ACTIVE_WRITE_BIAS;
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   a    %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   ag   %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "m" (tmp)
 		: "cc", "memory" );
@@ -156,11 +189,19 @@
 	signed long old;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%1)\n"
 		"0: ltr  %0,%0\n"
 		"   jnz  1f\n"
 		"   cs   %0,%2,0(%1)\n"
 		"   jl   0b\n"
+#else /* __s390x__ */
+		"   lg   %0,0(%1)\n"
+		"0: ltgr %0,%0\n"
+		"   jnz  1f\n"
+		"   csg  %0,%2,0(%1)\n"
+		"   jl   0b\n"
+#endif /* __s390x__ */
 		"1:"
                 : "=&d" (old)
 		: "a" (&sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS)
@@ -176,11 +217,19 @@
 	signed long old, new;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   ahi  %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   aghi %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS)
 		: "cc", "memory" );
@@ -198,11 +247,19 @@
 
 	tmp = -RWSEM_ACTIVE_WRITE_BIAS;
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   a    %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   ag   %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "m" (tmp)
 		: "cc", "memory" );
@@ -220,11 +277,19 @@
 
 	tmp = -RWSEM_WAITING_BIAS;
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   a    %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   ag   %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "m" (tmp)
 		: "cc", "memory" );
@@ -240,11 +305,19 @@
 	signed long old, new;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   ar   %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   agr  %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "d" (delta)
 		: "cc", "memory" );
@@ -258,11 +331,19 @@
 	signed long old, new;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"   l    %0,0(%2)\n"
 		"0: lr   %1,%0\n"
 		"   ar   %1,%3\n"
 		"   cs   %0,%1,0(%2)\n"
 		"   jl   0b"
+#else /* __s390x__ */
+		"   lg   %0,0(%2)\n"
+		"0: lgr  %1,%0\n"
+		"   agr  %1,%3\n"
+		"   csg  %0,%1,0(%2)\n"
+		"   jl   0b"
+#endif /* __s390x__ */
                 : "=&d" (old), "=&d" (new)
 		: "a" (&sem->count), "d" (delta)
 		: "cc", "memory" );
diff -urN linux-2.5.67-bk5/include/asm-s390/sembuf.h linux-2.5.67-bk6/include/asm-s390/sembuf.h
--- linux-2.5.67-bk5/include/asm-s390/sembuf.h	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/sembuf.h	2003-04-15 04:36:16.000000000 -0700
@@ -7,16 +7,20 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
+ * - 64-bit time_t to solve y2038 problem (for !__s390x__)
  * - 2 miscellaneous 32-bit values
  */
 
 struct semid64_ds {
 	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
 	__kernel_time_t	sem_otime;		/* last semop time */
+#ifndef __s390x__
 	unsigned long	__unused1;
+#endif /* ! __s390x__ */
 	__kernel_time_t	sem_ctime;		/* last change time */
+#ifndef __s390x__
 	unsigned long	__unused2;
+#endif /* ! __s390x__ */
 	unsigned long	sem_nsems;		/* no. of semaphores in array */
 	unsigned long	__unused3;
 	unsigned long	__unused4;
diff -urN linux-2.5.67-bk5/include/asm-s390/setup.h linux-2.5.67-bk6/include/asm-s390/setup.h
--- linux-2.5.67-bk5/include/asm-s390/setup.h	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/setup.h	2003-04-15 04:36:16.000000000 -0700
@@ -15,9 +15,15 @@
 
 #ifndef __ASSEMBLY__
 
+#ifndef __s390x__
 #define IPL_DEVICE        (*(unsigned long *)  (0x10404))
 #define INITRD_START      (*(unsigned long *)  (0x1040C))
 #define INITRD_SIZE       (*(unsigned long *)  (0x10414))
+#else /* __s390x__ */
+#define IPL_DEVICE        (*(unsigned long *)  (0x10400))
+#define INITRD_START      (*(unsigned long *)  (0x10408))
+#define INITRD_SIZE       (*(unsigned long *)  (0x10410))
+#endif /* __s390x__ */
 #define COMMAND_LINE      ((char *)            (0x10480))
 
 /*
@@ -26,10 +32,18 @@
 extern unsigned long machine_flags;
 
 #define MACHINE_IS_VM		(machine_flags & 1)
-#define MACHINE_HAS_IEEE	(machine_flags & 2)
 #define MACHINE_IS_P390		(machine_flags & 4)
-#define MACHINE_HAS_CSP		(machine_flags & 8)
 #define MACHINE_HAS_MVPG	(machine_flags & 16)
+#define MACHINE_HAS_DIAG44	(machine_flags & 32)
+
+#ifndef __s390x__
+#define MACHINE_HAS_IEEE	(machine_flags & 2)
+#define MACHINE_HAS_CSP		(machine_flags & 8)
+#else /* __s390x__ */
+#define MACHINE_HAS_IEEE	(1)
+#define MACHINE_HAS_CSP		(1)
+#endif /* __s390x__ */
+
 
 #define MACHINE_HAS_SCLP	(!MACHINE_IS_P390)
 
@@ -50,9 +64,15 @@
 
 #else 
 
+#ifndef __s390x__
 #define IPL_DEVICE        0x10404
 #define INITRD_START      0x1040C
 #define INITRD_SIZE       0x10414
+#else /* __s390x__ */
+#define IPL_DEVICE        0x10400
+#define INITRD_START      0x10408
+#define INITRD_SIZE       0x10410
+#endif /* __s390x__ */
 #define COMMAND_LINE      0x10480
 
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/shmbuf.h linux-2.5.67-bk6/include/asm-s390/shmbuf.h
--- linux-2.5.67-bk5/include/asm-s390/shmbuf.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/shmbuf.h	2003-04-15 04:36:16.000000000 -0700
@@ -7,7 +7,7 @@
  * between kernel and user space.
  *
  * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
+ * - 64-bit time_t to solve y2038 problem (for !__s390x__)
  * - 2 miscellaneous 32-bit values
  */
 
@@ -15,11 +15,17 @@
 	struct ipc64_perm	shm_perm;	/* operation perms */
 	size_t			shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
+#ifndef __s390x__
 	unsigned long		__unused1;
+#endif /* ! __s390x__ */
 	__kernel_time_t		shm_dtime;	/* last detach time */
+#ifndef __s390x__
 	unsigned long		__unused2;
+#endif /* ! __s390x__ */
 	__kernel_time_t		shm_ctime;	/* last change time */
+#ifndef __s390x__
 	unsigned long		__unused3;
+#endif /* ! __s390x__ */
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
 	unsigned long		shm_nattch;	/* no. of current attaches */
diff -urN linux-2.5.67-bk5/include/asm-s390/sigcontext.h linux-2.5.67-bk6/include/asm-s390/sigcontext.h
--- linux-2.5.67-bk5/include/asm-s390/sigcontext.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/sigcontext.h	2003-04-15 04:36:16.000000000 -0700
@@ -12,13 +12,24 @@
 #define __NUM_FPRS 16
 #define __NUM_ACRS 16
 
-/*
-  Has to be at least _NSIG_WORDS from asm/signal.h
- */
-#define _SIGCONTEXT_NSIG      64
-#define _SIGCONTEXT_NSIG_BPW  32
+#ifndef __s390x__
+
+/* Has to be at least _NSIG_WORDS from asm/signal.h */
+#define _SIGCONTEXT_NSIG	64
+#define _SIGCONTEXT_NSIG_BPW	32
 /* Size of stack frame allocated when calling signal handler. */
 #define __SIGNAL_FRAMESIZE	96
+
+#else /* __s390x__ */
+
+/* Has to be at least _NSIG_WORDS from asm/signal.h */
+#define _SIGCONTEXT_NSIG	64
+#define _SIGCONTEXT_NSIG_BPW	64 
+/* Size of stack frame allocated when calling signal handler. */
+#define __SIGNAL_FRAMESIZE	160
+
+#endif /* __s390x__ */
+
 #define _SIGCONTEXT_NSIG_WORDS	(_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
 #define _SIGMASK_COPY_SIZE	(sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
 
diff -urN linux-2.5.67-bk5/include/asm-s390/signal.h linux-2.5.67-bk6/include/asm-s390/signal.h
--- linux-2.5.67-bk5/include/asm-s390/signal.h	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/signal.h	2003-04-15 04:36:16.000000000 -0700
@@ -10,6 +10,7 @@
 #define _ASMS390_SIGNAL_H
 
 #include <linux/types.h>
+#include <linux/time.h>
 
 /* Avoid too many header ordering problems.  */
 struct siginfo;
@@ -170,9 +171,15 @@
           __sighandler_t _sa_handler;
           void (*_sa_sigaction)(int, struct siginfo *, void *);
         } _u;
+#ifndef __s390x__ /* lovely */
         sigset_t sa_mask;
         unsigned long sa_flags;
         void (*sa_restorer)(void);
+#else  /* __s390x__ */
+        unsigned long sa_flags;
+        void (*sa_restorer)(void);
+	sigset_t sa_mask;
+#endif /* __s390x__ */
 };
 
 #define sa_handler      _u._sa_handler
diff -urN linux-2.5.67-bk5/include/asm-s390/sigp.h linux-2.5.67-bk6/include/asm-s390/sigp.h
--- linux-2.5.67-bk5/include/asm-s390/sigp.h	2003-04-07 10:31:23.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/sigp.h	2003-04-15 04:36:16.000000000 -0700
@@ -72,10 +72,17 @@
 	sigp_ccode ccode;
 
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    sr     1,1\n"        /* parameter=0 in gpr 1 */
 		"    sigp   1,%1,0(%2)\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    sgr    1,1\n"        /* parameter=0 in gpr 1 */
+		"    sigp   1,%1,0(%2)\n"
+		"    ipm    %0\n"
+		"    srl    %0,28"
+#endif /* __s390x__ */
 		: "=d" (ccode)
 		: "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
 		: "cc" , "memory", "1" );
@@ -86,15 +93,23 @@
  * Signal processor with parameter
  */
 extern __inline__ sigp_ccode
-signal_processor_p(__u32 parameter,__u16 cpu_addr,sigp_order_code order_code)
+signal_processor_p(unsigned long parameter,__u16 cpu_addr,
+		   sigp_order_code order_code)
 {
 	sigp_ccode ccode;
 	
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    lr     1,%1\n"       /* parameter in gpr 1 */
 		"    sigp   1,%2,0(%3)\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    lgr    1,%1\n"       /* parameter in gpr 1 */
+		"    sigp   1,%2,0(%3)\n"
+		"    ipm    %0\n"
+		"    srl    %0,28\n"
+#endif /* __s390x__ */
 		: "=d" (ccode)
 		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
                   "a" (order_code)
@@ -106,18 +121,27 @@
  * Signal processor with parameter and return status
  */
 extern __inline__ sigp_ccode
-signal_processor_ps(__u32 *statusptr, __u32 parameter,
+signal_processor_ps(__u32 *statusptr, unsigned long parameter,
 		    __u16 cpu_addr, sigp_order_code order_code)
 {
 	sigp_ccode ccode;
 	
 	__asm__ __volatile__(
+#ifndef __s390x__
 		"    sr     2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
 		"    lr     3,%2\n"       /* parameter in gpr 3 */
 		"    sigp   2,%3,0(%4)\n"
 		"    st     2,%1\n"
 		"    ipm    %0\n"
 		"    srl    %0,28\n"
+#else /* __s390x__ */
+		"    sgr    2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
+		"    lgr    3,%2\n"       /* parameter in gpr 3 */
+		"    sigp   2,%3,0(%4)\n"
+		"    stg    2,%1\n"
+		"    ipm    %0\n"
+		"    srl    %0,28\n"
+#endif /* __s390x__ */
 		: "=d" (ccode), "=m" (*statusptr)
 		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
                   "a" (order_code)
diff -urN linux-2.5.67-bk5/include/asm-s390/smp.h linux-2.5.67-bk6/include/asm-s390/smp.h
--- linux-2.5.67-bk5/include/asm-s390/smp.h	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/smp.h	2003-04-15 04:36:16.000000000 -0700
@@ -52,7 +52,11 @@
 
 extern inline unsigned int num_online_cpus(void)
 {
+#ifndef __s390x__
 	return hweight32(cpu_online_map);
+#else /* __s390x__ */
+	return hweight64(cpu_online_map);
+#endif /* __s390x__ */
 }
 
 extern inline int any_online_cpu(unsigned int mask)
diff -urN linux-2.5.67-bk5/include/asm-s390/spinlock.h linux-2.5.67-bk6/include/asm-s390/spinlock.h
--- linux-2.5.67-bk5/include/asm-s390/spinlock.h	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/spinlock.h	2003-04-15 04:36:16.000000000 -0700
@@ -11,6 +11,22 @@
 #ifndef __ASM_SPINLOCK_H
 #define __ASM_SPINLOCK_H
 
+#ifdef __s390x__
+/*
+ * Grmph, take care of %&#! user space programs that include
+ * asm/spinlock.h. The diagnose is only available in kernel
+ * context.
+ */
+#ifdef __KERNEL__
+#include <asm/lowcore.h>
+#define __DIAG44_INSN "ex"
+#define __DIAG44_OPERAND __LC_DIAG44_OPCODE
+#else
+#define __DIAG44_INSN "#"
+#define __DIAG44_OPERAND 0
+#endif
+#endif /* __s390x__ */
+
 /*
  * Simple spin lock operations.  There are two variants, one clears IRQ's
  * on the local processor, one does not.
@@ -19,8 +35,13 @@
  */
 
 typedef struct {
+#ifndef __s390x__
 	volatile unsigned long lock;
 } spinlock_t;
+#else /* __s390x__ */
+	volatile unsigned int lock;
+} __attribute__ ((aligned (4))) spinlock_t;
+#endif /* __s390x__ */
 
 #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
 #define spin_lock_init(lp) do { (lp)->lock = 0; } while(0)
@@ -29,6 +50,7 @@
 
 extern inline void _raw_spin_lock(spinlock_t *lp)
 {
+#ifndef __s390x__
 	unsigned int reg1, reg2;
         __asm__ __volatile("    bras  %0,1f\n"
                            "0:  diag  0,0,68\n"
@@ -37,11 +59,26 @@
                            "    jl    0b\n"
                            : "=&d" (reg1), "=&d" (reg2), "+m" (lp->lock)
 			   : "a" (&lp->lock) : "cc" );
+#else /* __s390x__ */
+	unsigned long reg1, reg2;
+        __asm__ __volatile("    bras  %1,1f\n"
+                           "0:  " __DIAG44_INSN " 0,%4\n"
+                           "1:  slr   %0,%0\n"
+                           "    cs    %0,%1,0(%3)\n"
+                           "    jl    0b\n"
+                           : "=&d" (reg1), "=&d" (reg2), "+m" (lp->lock)
+                           : "a" (&lp->lock), "i" (__DIAG44_OPERAND)
+			   : "cc" );
+#endif /* __s390x__ */
 }
 
 extern inline int _raw_spin_trylock(spinlock_t *lp)
 {
+#ifndef __s390x__
 	unsigned long result, reg;
+#else /* __s390x__ */
+	unsigned int result, reg;
+#endif /* __s390x__ */
 	__asm__ __volatile("    slr   %0,%0\n"
 			   "    basr  %1,0\n"
 			   "0:  cs    %0,%1,0(%3)"
@@ -52,9 +89,11 @@
 
 extern inline void _raw_spin_unlock(spinlock_t *lp)
 {
-	__asm__ __volatile("    xc 0(4,%1),0(%1)\n"
-                           "    bcr 15,0"
-			   : "+m" (lp->lock) : "a" (&lp->lock) : "cc" );
+	unsigned int old;
+
+	__asm__ __volatile("cs %0,%3,0(%4)"
+			   : "=d" (old), "=m" (lp->lock)
+			   : "0" (lp->lock), "d" (0), "a" (lp) : "cc" );
 }
 		
 /*
@@ -78,6 +117,7 @@
 
 #define rwlock_is_locked(x) ((x)->lock != 0)
 
+#ifndef __s390x__
 #define _raw_read_lock(rw)   \
         asm volatile("   l     2,0(%1)\n"   \
                      "   j     1f\n"     \
@@ -88,7 +128,21 @@
                      "   jl    0b"       \
                      : "+m" ((rw)->lock) : "a" (&(rw)->lock) \
 		     : "2", "3", "cc" )
+#else /* __s390x__ */
+#define _raw_read_lock(rw)   \
+        asm volatile("   lg    2,0(%1)\n"   \
+                     "   j     1f\n"     \
+                     "0: " __DIAG44_INSN " 0,%2\n" \
+                     "1: nihh  2,0x7fff\n" /* clear high (=write) bit */ \
+                     "   la    3,1(2)\n"   /* one more reader */  \
+                     "   csg   2,3,0(%1)\n" /* try to write new value */ \
+                     "   jl    0b"       \
+                     : "+m" ((rw)->lock) \
+		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
+		     : "2", "3", "cc" )
+#endif /* __s390x__ */
 
+#ifndef __s390x__
 #define _raw_read_unlock(rw) \
         asm volatile("   l     2,0(%1)\n"   \
                      "   j     1f\n"     \
@@ -99,7 +153,21 @@
                      "   jl    0b"       \
                      : "+m" ((rw)->lock) : "a" (&(rw)->lock) \
 		     : "2", "3", "cc" )
+#else /* __s390x__ */
+#define _raw_read_unlock(rw) \
+        asm volatile("   lg    2,0(%1)\n"   \
+                     "   j     1f\n"     \
+                     "0: " __DIAG44_INSN " 0,%2\n" \
+                     "1: lgr   3,2\n"    \
+                     "   bctgr 3,0\n"    /* one less reader */ \
+                     "   csg   2,3,0(%1)\n" \
+                     "   jl    0b"       \
+                     : "+m" ((rw)->lock) \
+		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
+		     : "2", "3", "cc" )
+#endif /* __s390x__ */
 
+#ifndef __s390x__
 #define _raw_write_lock(rw) \
         asm volatile("   lhi   3,1\n"    \
                      "   sll   3,31\n"    /* new lock value = 0x80000000 */ \
@@ -110,7 +178,20 @@
                      "   jl    0b"       \
                      : "+m" ((rw)->lock) : "a" (&(rw)->lock) \
 		     : "2", "3", "cc" )
+#else /* __s390x__ */
+#define _raw_write_lock(rw) \
+        asm volatile("   llihh 3,0x8000\n" /* new lock value = 0x80...0 */ \
+                     "   j     1f\n"       \
+                     "0: " __DIAG44_INSN " 0,%2\n"   \
+                     "1: slgr  2,2\n"      /* old lock value must be 0 */ \
+                     "   csg   2,3,0(%1)\n" \
+                     "   jl    0b"         \
+                     : "+m" ((rw)->lock) \
+		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
+		     : "2", "3", "cc" )
+#endif /* __s390x__ */
 
+#ifndef __s390x__
 #define _raw_write_unlock(rw) \
         asm volatile("   slr   3,3\n"     /* new lock value = 0 */ \
                      "   j     1f\n"     \
@@ -121,15 +202,34 @@
                      "   jl    0b"       \
                      : "+m" ((rw)->lock) : "a" (&(rw)->lock) \
 		     : "2", "3", "cc" )
+#else /* __s390x__ */
+#define _raw_write_unlock(rw) \
+        asm volatile("   slgr  3,3\n"      /* new lock value = 0 */ \
+                     "   j     1f\n"       \
+                     "0: " __DIAG44_INSN " 0,%2\n"   \
+                     "1: llihh 2,0x8000\n" /* old lock value must be 0x8..0 */\
+                     "   csg   2,3,0(%1)\n"   \
+                     "   jl    0b"         \
+                     : "+m" ((rw)->lock) \
+		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
+		     : "2", "3", "cc" )
+#endif /* __s390x__ */
 
 extern inline int _raw_write_trylock(rwlock_t *rw)
 {
 	unsigned int result, reg;
 	
-	__asm__ __volatile__("   lhi  %0,1\n"
+	__asm__ __volatile__(
+#ifndef __s390x__
+			     "   lhi  %0,1\n"
 			     "   sll  %0,31\n"
 			     "   basr %1,0\n"
 			     "0: cs   %0,%1,0(%3)\n"
+#else /* __s390x__ */
+			     "   llihh %0,0x8000\n"
+			     "   basr  %1,0\n"
+			     "0: csg %0,%1,0(%3)\n"
+#endif /* __s390x__ */
 			     : "=&d" (result), "=&d" (reg), "+m" (rw->lock)
 			     : "a" (&rw->lock) : "cc" );
 	return !result;
diff -urN linux-2.5.67-bk5/include/asm-s390/stat.h linux-2.5.67-bk6/include/asm-s390/stat.h
--- linux-2.5.67-bk5/include/asm-s390/stat.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/stat.h	2003-04-15 04:36:16.000000000 -0700
@@ -9,6 +9,7 @@
 #ifndef _S390_STAT_H
 #define _S390_STAT_H
 
+#ifndef __s390x__
 struct __old_kernel_stat {
         unsigned short st_dev;
         unsigned short st_ino;
@@ -46,8 +47,6 @@
         unsigned long  __unused5;
 };
 
-#define STAT_HAVE_NSEC 1
-
 /* This matches struct stat64 in glibc2.1, hence the absolutely
  * insane amounts of padding around dev_t's.
  */
@@ -76,4 +75,31 @@
         unsigned long long	st_ino;
 };
 
+#else /* __s390x__ */
+
+struct stat {
+        unsigned long  st_dev;
+        unsigned long  st_ino;
+        unsigned long  st_nlink;
+        unsigned int   st_mode;
+        unsigned int   st_uid;
+        unsigned int   st_gid;
+        unsigned int   __pad1;
+        unsigned long  st_rdev;
+        unsigned long  st_size;
+        unsigned long  st_atime;
+	unsigned long  st_atime_nsec;
+        unsigned long  st_mtime;
+	unsigned long  st_mtime_nsec;
+        unsigned long  st_ctime;
+	unsigned long  st_ctime_nsec;
+        unsigned long  st_blksize;
+        long           st_blocks;
+        unsigned long  __unused[3];
+};
+
+#endif /* __s390x__ */
+
+#define STAT_HAVE_NSEC 1
+
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/statfs.h linux-2.5.67-bk6/include/asm-s390/statfs.h
--- linux-2.5.67-bk5/include/asm-s390/statfs.h	2003-04-07 10:32:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/statfs.h	2003-04-15 04:36:16.000000000 -0700
@@ -18,6 +18,7 @@
 #endif
 
 struct statfs {
+#ifndef __s390x__
 	long f_type;
 	long f_bsize;
 	long f_blocks;
@@ -28,6 +29,18 @@
 	__kernel_fsid_t f_fsid;
 	long f_namelen;
 	long f_spare[6];
+#else /* __s390x__ */
+	int  f_type;
+	int  f_bsize;
+	long f_blocks;
+	long f_bfree;
+	long f_bavail;
+	long f_files;
+	long f_ffree;
+	__kernel_fsid_t f_fsid;
+	int  f_namelen;
+	int  f_spare[6];
+#endif /* __s390x__ */
 };
 
 #endif
diff -urN linux-2.5.67-bk5/include/asm-s390/string.h linux-2.5.67-bk6/include/asm-s390/string.h
--- linux-2.5.67-bk5/include/asm-s390/string.h	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/string.h	2003-04-15 04:36:16.000000000 -0700
@@ -49,13 +49,24 @@
 {
     void *ptr;
 
-    __asm__ __volatile__ ("   lr    0,%2\n"
+    __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" );
@@ -66,9 +77,16 @@
 {
     char *tmp = dest;
 
-    __asm__ __volatile__ ("   sr    0,0\n"
+    __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;
@@ -78,12 +96,22 @@
 {
     size_t len;
 
-    __asm__ __volatile__ ("   sr    0,0\n"
+    __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;
@@ -93,25 +121,30 @@
 {
     char *tmp = dest;
 
-    __asm__ __volatile__ ("   sr    0,0\n"
+    __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;
 }
 
 extern void *alloca(size_t);
-
 #endif /* __KERNEL__ */
 
 #endif /* __S390_STRING_H_ */
-
-
-
-
-
diff -urN linux-2.5.67-bk5/include/asm-s390/system.h linux-2.5.67-bk6/include/asm-s390/system.h
--- linux-2.5.67-bk5/include/asm-s390/system.h	2003-04-07 10:33:01.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/system.h	2003-04-15 04:36:16.000000000 -0700
@@ -23,6 +23,15 @@
 
 extern struct task_struct *resume(void *, void *);
 
+#ifdef __s390x__
+#define __FLAG_SHIFT 56
+extern void __misaligned_u16(void);
+extern void __misaligned_u32(void);
+extern void __misaligned_u64(void);
+#else /* __s390x__ */
+#define __FLAG_SHIFT 24
+#endif /* __s390x__ */
+
 static inline void save_fp_regs(s390_fp_regs *fpregs)
 {
 	asm volatile (
@@ -82,13 +91,13 @@
 		break;							     \
 	save_fp_regs(&prev->thread.fp_regs);				     \
 	restore_fp_regs(&next->thread.fp_regs);				     \
-	resume(prev,next);						     \
+	prev = resume(prev,next);					     \
 } while (0)
 
 #define nop() __asm__ __volatile__ ("nop")
 
 #define xchg(ptr,x) \
-  ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+  ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(void *)(ptr),sizeof(*(ptr))))
 
 static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
 {
@@ -137,6 +146,17 @@
 			: "memory", "cc", "0" );
 		x = old;
 		break;
+#ifdef __s390x__
+	case 8:
+		asm volatile (
+			"    lg  %0,0(%2)\n"
+			"0:  csg %0,%1,0(%2)\n"
+			"    jl  0b\n"
+			: "=&d" (old) : "d" (x), "a" (ptr)
+			: "memory", "cc", "0" );
+		x = old;
+		break;
+#endif /* __s390x__ */
         }
         return x;
 }
@@ -208,6 +228,14 @@
 			: "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
 			: "memory", "cc" );
 		return prev;
+#ifdef __s390x__
+	case 8:
+		asm volatile (
+			"    csg %0,%2,0(%3)\n"
+			: "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
+			: "memory", "cc" );
+		return prev;
+#endif /* __s390x__ */
         }
         return old;
 }
@@ -241,15 +269,15 @@
 
 /* interrupt control.. */
 #define local_irq_enable() ({ \
-        __u8 __dummy; \
+        unsigned long  __dummy; \
         __asm__ __volatile__ ( \
                 "stosm 0(%1),0x03" : "=m" (__dummy) : "a" (&__dummy) ); \
         })
 
 #define local_irq_disable() ({ \
-        __u32 __flags; \
+        unsigned long __flags; \
         __asm__ __volatile__ ( \
-                "stnsm 0(%1),0xFC" : "=m" (__flags) : "a" (&__flags) ); \
+                "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
         __flags; \
         })
 
@@ -263,9 +291,70 @@
 ({					\
 	unsigned long flags;		\
 	local_save_flags(flags);	\
-        !((flags >> 24) & 3);		\
+        !((flags >> __FLAG_SHIFT) & 3);	\
 })
 
+#ifdef __s390x__
+
+#define __load_psw(psw) \
+        __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw) : "cc" );
+
+#define __ctl_load(array, low, high) ({ \
+	__asm__ __volatile__ ( \
+		"   la    1,%0\n" \
+		"   bras  2,0f\n" \
+                "   lctlg 0,0,0(1)\n" \
+		"0: ex    %1,0(2)" \
+		: : "m" (array), "a" (((low)<<4)+(high)) : "1", "2" ); \
+	})
+
+#define __ctl_store(array, low, high) ({ \
+	__asm__ __volatile__ ( \
+		"   la    1,%0\n" \
+		"   bras  2,0f\n" \
+		"   stctg 0,0,0(1)\n" \
+		"0: ex    %1,0(2)" \
+		: "=m" (array) : "a" (((low)<<4)+(high)): "1", "2" ); \
+	})
+
+#define __ctl_set_bit(cr, bit) ({ \
+        __u8 __dummy[24]; \
+        __asm__ __volatile__ ( \
+                "    la    1,%0\n"       /* align to 8 byte */ \
+                "    aghi  1,7\n" \
+                "    nill  1,0xfff8\n" \
+                "    bras  2,0f\n"       /* skip indirect insns */ \
+                "    stctg 0,0,0(1)\n" \
+                "    lctlg 0,0,0(1)\n" \
+                "0:  ex    %1,0(2)\n"    /* execute stctl */ \
+                "    lg    0,0(1)\n" \
+                "    ogr   0,%2\n"       /* set the bit */ \
+                "    stg   0,0(1)\n" \
+                "1:  ex    %1,6(2)"      /* execute lctl */ \
+                : "=m" (__dummy) : "a" (cr*17), "a" (1L<<(bit)) \
+                : "cc", "0", "1", "2"); \
+        })
+
+#define __ctl_clear_bit(cr, bit) ({ \
+        __u8 __dummy[24]; \
+        __asm__ __volatile__ ( \
+                "    la    1,%0\n"       /* align to 8 byte */ \
+                "    aghi  1,7\n" \
+                "    nill  1,0xfff8\n" \
+                "    bras  2,0f\n"       /* skip indirect insns */ \
+                "    stctg 0,0,0(1)\n" \
+                "    lctlg 0,0,0(1)\n" \
+                "0:  ex    %1,0(2)\n"    /* execute stctl */ \
+                "    lg    0,0(1)\n" \
+                "    ngr   0,%2\n"       /* set the bit */ \
+                "    stg   0,0(1)\n" \
+                "1:  ex    %1,6(2)"      /* execute lctl */ \
+                : "=m" (__dummy) : "a" (cr*17), "a" (~(1L<<(bit))) \
+                : "cc", "0", "1", "2"); \
+        })
+
+#else /* __s390x__ */
+
 #define __load_psw(psw) \
 	__asm__ __volatile__("lpsw 0(%0)" : : "a" (&psw) : "cc" );
 
@@ -273,7 +362,7 @@
 	__asm__ __volatile__ ( \
 		"   la    1,%0\n" \
 		"   bras  2,0f\n" \
-                "   lctl  0,0,0(1)\n" \
+                "   lctl 0,0,0(1)\n" \
 		"0: ex    %1,0(2)" \
 		: : "m" (array), "a" (((low)<<4)+(high)) : "1", "2" ); \
 	})
@@ -324,6 +413,7 @@
                 : "=m" (__dummy) : "a" (cr*17), "a" (~(1<<(bit))) \
                 : "cc", "0", "1", "2"); \
         })
+#endif /* __s390x__ */
 
 /* For spinlocks etc */
 #define local_irq_save(x)	((x) = local_irq_disable())
diff -urN linux-2.5.67-bk5/include/asm-s390/termios.h linux-2.5.67-bk6/include/asm-s390/termios.h
--- linux-2.5.67-bk5/include/asm-s390/termios.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/termios.h	2003-04-15 04:36:16.000000000 -0700
@@ -12,7 +12,6 @@
 #include <asm/termbits.h>
 #include <asm/ioctls.h>
 
-
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
@@ -44,7 +43,7 @@
 #define TIOCM_RI	TIOCM_RNG
 #define TIOCM_OUT1	0x2000
 #define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP      0x8000
+#define TIOCM_LOOP	0x8000
 
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 
@@ -62,7 +61,8 @@
 #define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
 #define N_IRDA		11	/* Linux IR - http://irda.sourceforge.net/ */
 #define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC         13	/* synchronous HDLC */
+#define N_HDLC		13	/* synchronous HDLC */
+#define N_SYNC_PPP	14	/* synchronous PPP */
 #define N_HCI		15  /* Bluetooth HCI UART */
 
 #ifdef __KERNEL__
@@ -78,19 +78,18 @@
 /*
  * Translate a "termio" structure into a "termios". Ugh.
  */
+#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
+	unsigned short __tmp; \
+	get_user(__tmp,&(termio)->x); \
+	(termios)->x = (0xffff0000 & ((termios)->x)) | __tmp; \
+}
 
 #define user_termio_to_kernel_termios(termios, termio) \
 ({ \
-        unsigned short tmp; \
-        get_user(tmp, &(termio)->c_iflag); \
-        (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
-        get_user(tmp, &(termio)->c_oflag); \
-        (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
-        get_user(tmp, &(termio)->c_cflag); \
-        (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
-        get_user(tmp, &(termio)->c_lflag); \
-        (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
-        get_user((termios)->c_line, &(termio)->c_line); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
+	SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
 	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
 })
 
diff -urN linux-2.5.67-bk5/include/asm-s390/thread_info.h linux-2.5.67-bk6/include/asm-s390/thread_info.h
--- linux-2.5.67-bk5/include/asm-s390/thread_info.h	2003-04-07 10:31:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/thread_info.h	2003-04-15 04:36:16.000000000 -0700
@@ -13,6 +13,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/processor.h>
+#include <asm/lowcore.h>
 
 /*
  * low level task data that entry.S needs immediate access to
@@ -46,27 +47,36 @@
 #define init_thread_info	(init_thread_union.thread_info)
 #define init_stack		(init_thread_union.stack)
 
+/*
+ * Size of kernel stack for each process
+ */
+#ifndef __s390x__
+#define THREAD_ORDER 1
+#define ASYNC_ORDER  1
+#else /* __s390x__ */
+#define THREAD_ORDER 2
+#define ASYNC_ORDER  2
+#endif /* __s390x__ */
+
+#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
+#define ASYNC_SIZE  (PAGE_SIZE << ASYNC_ORDER)
+
 /* how to get the thread information struct from C */
 static inline struct thread_info *current_thread_info(void)
 {
-	return (struct thread_info *)((*(unsigned long *) 0xc40)-8192);
+	return (struct thread_info *)((*(unsigned long *) __LC_KERNEL_STACK)-THREAD_SIZE);
 }
 
 /* thread information allocation */
 #define alloc_thread_info() ((struct thread_info *) \
-	__get_free_pages(GFP_KERNEL,1))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
+	__get_free_pages(GFP_KERNEL,THREAD_ORDER))
+#define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER)
 #define get_thread_info(ti) get_task_struct((ti)->task)
 #define put_thread_info(ti) put_task_struct((ti)->task)
 
 #endif
 
 /*
- * Size of kernel stack for each process
- */
-#define THREAD_SIZE (2*PAGE_SIZE)
-
-/*
  * thread information flags bit numbers
  */
 #define TIF_SYSCALL_TRACE	0	/* syscall trace active */
@@ -77,6 +87,7 @@
 #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_31BIT		18	/* 32bit process */ 
 
 #define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
@@ -85,6 +96,7 @@
 #define _TIF_RESTART_SVC	(1<<TIF_RESTART_SVC)
 #define _TIF_USEDFPU		(1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
+#define _TIF_31BIT		(1<<TIF_31BIT)
 
 #endif /* __KERNEL__ */
 
diff -urN linux-2.5.67-bk5/include/asm-s390/tlbflush.h linux-2.5.67-bk6/include/asm-s390/tlbflush.h
--- linux-2.5.67-bk5/include/asm-s390/tlbflush.h	2003-04-07 10:32:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/tlbflush.h	2003-04-15 04:36:16.000000000 -0700
@@ -28,7 +28,6 @@
 #define local_flush_tlb() \
 do {  __asm__ __volatile__("ptlb": : :"memory"); } while (0)
 
-
 #ifndef CONFIG_SMP
 
 /*
@@ -70,7 +69,13 @@
 
 static inline void global_flush_tlb(void)
 {
-	if (MACHINE_HAS_CSP) {
+#ifndef __s390x__
+	if (!MACHINE_HAS_CSP) {
+		smp_ptlb_all();
+		return;
+	}
+#endif /* __s390x__ */
+	{
 		long dummy = 0;
 		__asm__ __volatile__ (
 			"    la   4,1(%0)\n"
@@ -78,8 +83,7 @@
 			"    slr  3,3\n"
 			"    csp  2,4"
 			: : "a" (&dummy) : "cc", "2", "3", "4" );
-	} else
-		smp_ptlb_all();
+	}
 }
 
 /*
diff -urN linux-2.5.67-bk5/include/asm-s390/types.h linux-2.5.67-bk6/include/asm-s390/types.h
--- linux-2.5.67-bk5/include/asm-s390/types.h	2003-04-07 10:31:22.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/types.h	2003-04-15 04:36:16.000000000 -0700
@@ -27,15 +27,21 @@
 typedef __signed__ int __s32;
 typedef unsigned int __u32;
 
+#ifndef __s390x__
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 typedef __signed__ long long __s64;
 typedef unsigned long long __u64;
 #endif
+#else /* __s390x__ */
+typedef __signed__ long __s64;
+typedef unsigned long __u64;
+#endif
+
 /* A address type so that arithmetic can be done on it & it can be upgraded to
    64 bit when necessary 
 */
-typedef __u32  addr_t; 
-typedef __s32  saddr_t;
+typedef unsigned long addr_t; 
+typedef __signed__ long saddr_t;
 
 #endif /* __ASSEMBLY__ */
 
@@ -44,7 +50,11 @@
  */
 #ifdef __KERNEL__
 
+#ifndef __s390x__
 #define BITS_PER_LONG 32
+#else
+#define BITS_PER_LONG 64
+#endif
 
 #ifndef __ASSEMBLY__
 
@@ -57,11 +67,17 @@
 typedef signed int s32;
 typedef unsigned int u32;
 
+#ifndef __s390x__
 typedef signed long long s64;
 typedef unsigned long long u64;
+#else /* __s390x__ */
+typedef signed long s64;
+typedef unsigned  long u64;
+#endif /* __s390x__ */
 
 typedef u32 dma_addr_t;
 
+#ifndef __s390x__
 typedef union {
 	unsigned long long pair;
 	struct {
@@ -75,7 +91,7 @@
 #define HAVE_SECTOR_T
 #endif
 
-#endif /* __ASSEMBLY__ */
-
-#endif                                 /* __KERNEL__                       */
-#endif
+#endif /* ! __s390x__   */
+#endif /* __ASSEMBLY__  */
+#endif /* __KERNEL__    */
+#endif /* _S390_TYPES_H */
diff -urN linux-2.5.67-bk5/include/asm-s390/uaccess.h linux-2.5.67-bk6/include/asm-s390/uaccess.h
--- linux-2.5.67-bk5/include/asm-s390/uaccess.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/uaccess.h	2003-04-15 04:36:16.000000000 -0700
@@ -72,284 +72,261 @@
 };
 
 /*
- * These are the main single-value transfer routines.  They automatically
- * use the right size if we just have the right pointer type.
+ * Standard fixup section for uaccess inline functions.
+ * local label 0: is the fault point
+ * local label 1: is the return point
+ * %0 is the error variable
+ * %3 is the error value -EFAULT
  */
-
-extern inline int __put_user_asm_8(void *x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   lr    2,%1\n"
-				"   lr    4,%2\n"
-                                "   sacf  512\n"
-                                "0: mvc   0(8,4),0(2)\n"
-                                "   sacf  0\n"
-				"1:\n"
-				".section .fixup,\"ax\"\n"
-				"2: sacf  0\n"
-				"   lhi   %0,%h3\n"
-				"   bras  4,3f\n"
-				"   .long 1b\n"
-				"3: l     4,0(4)\n"
-				"   br    4\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 4\n"
-				"   .long  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "d" (x), "d" (ptr), "K" (-EFAULT)
-                                : "cc", "2", "4" );
-        return err;
-}
-
-extern inline int __put_user_asm_4(__u32 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   lr    4,%2\n"
-                                "   sacf  512\n"
-                                "0: st    %1,0(4)\n"
-                                "   sacf  0\n"
-				"1:\n"
-				".section .fixup,\"ax\"\n"
-				"2: sacf  0\n"
-				"   lhi   %0,%h3\n"
-				"   bras  4,3f\n"
-				"   .long 1b\n"
-				"3: l     4,0(4)\n"
-				"   br    4\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 4\n"
-				"   .long  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "d" (x), "d" (ptr), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-
-extern inline int __put_user_asm_2(__u16 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   lr    4,%2\n"
-                                "   sacf  512\n"
-                                "0: sth   %1,0(4)\n"
-                                "   sacf  0\n"
-				"1:\n"
-				".section .fixup,\"ax\"\n"
-				"2: sacf  0\n"
-				"   lhi   %0,%h3\n"
-				"   bras  4,3f\n"
-				"   .long 1b\n"
-				"3: l     4,0(4)\n"
-				"   br    4\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 4\n"
-				"   .long  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "d" (x), "d" (ptr), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-
-extern inline int __put_user_asm_1(__u8 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   lr    4,%2\n"
-                                "   sacf  512\n"
-                                "0: stc   %1,0(4)\n"
-                                "   sacf  0\n"
-				"1:\n"
-				".section .fixup,\"ax\"\n"
-				"2: sacf  0\n"
-				"   lhi   %0,%h3\n"
-				"   bras  4,3f\n"
-				"   .long 1b\n"
-				"3: l     4,0(4)\n"
-				"   br    4\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 4\n"
-				"   .long  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "d" (x), "d" (ptr), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
+#ifndef __s390x__
+#define __uaccess_fixup \
+	".section .fixup,\"ax\"\n"	\
+	"8: sacf  0\n"			\
+	"   lhi	  %0,%h3\n"		\
+	"   bras  4,9f\n"		\
+	"   .long 1b\n"			\
+	"9: l	  4,0(4)\n"		\
+	"   br	  4\n"			\
+	".previous\n"			\
+	".section __ex_table,\"a\"\n"	\
+	"   .align 4\n"			\
+	"   .long  0b,8b\n"		\
+	".previous"
+#else /* __s390x__ */
+#define __uaccess_fixup \
+	".section .fixup,\"ax\"\n"	\
+	"9: sacf  0\n"			\
+	"   lhi	  %0,%h3\n"		\
+	"   jg	  1b\n"			\
+	".previous\n"			\
+	".section __ex_table,\"a\"\n"	\
+	"   .align 8\n"			\
+	"   .quad  0b,9b\n"		\
+	".previous"
+#endif /* __s390x__ */
 
 /*
- * (u8)(u32) ... autsch, but that the only way we can suppress the
- * warnings when compiling binfmt_elf.c
+ * These are the main single-value transfer routines.  They automatically
+ * use the right size if we just have the right pointer type.
  */
-#define __put_user(x, ptr)                                      \
-({                                                              \
-        __typeof__(*(ptr)) __x = (x);                           \
-        int __pu_err;                                           \
-        switch (sizeof (*(ptr))) {                              \
-        case 1:                                                 \
-                __pu_err = __put_user_asm_1((__u8)(__u32) __x,  \
-                                            ptr);               \
-                break;                                          \
-        case 2:                                                 \
-                __pu_err = __put_user_asm_2((__u16)(__u32) __x, \
-                                            ptr);               \
-                break;                                          \
-        case 4:                                                 \
-                __pu_err = __put_user_asm_4((__u32) __x,        \
-                                            ptr);               \
-                break;                                          \
-        case 8:                                                 \
-                __pu_err = __put_user_asm_8(&__x, ptr);         \
-                break;                                          \
-        default:                                                \
-                __pu_err = __put_user_bad();                    \
-                break;                                          \
-         }                                                      \
-        __pu_err;                                               \
+#ifndef __s390x__
+
+#define __put_user_asm_8(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  2,%2\n"				\
+		"   la	  4,%1\n"				\
+		"   sacf  512\n"				\
+		"0: mvc	  0(8,4),0(2)\n"			\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err)					\
+		: "m" (*(__u64*)(ptr)), "m" (x), "K" (-EFAULT)	\
+		: "cc", "2", "4" );				\
+})
+
+#else /* __s390x__ */
+
+#define __put_user_asm_8(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%1\n"				\
+		"   sacf  512\n"				\
+		"0: stg	  %2,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err)					\
+		: "m" (*(__u64*)(ptr)), "d" (x), "K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#endif /* __s390x__ */
+
+#define __put_user_asm_4(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%1\n"				\
+		"   sacf  512\n"				\
+		"0: st	  %2,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err)					\
+		: "m" (*(__u32*)(ptr)), "d" (x), "K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __put_user_asm_2(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%1\n"				\
+		"   sacf  512\n"				\
+		"0: sth	  %2,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err)					\
+		: "m" (*(__u16*)(ptr)), "d" (x), "K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __put_user_asm_1(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%1\n"				\
+		"   sacf  512\n"				\
+		"0: stc	  %2,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err)					\
+		: "m" (*(__u8*)(ptr)), "d" (x),	"K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __put_user(x, ptr) \
+({								\
+	__typeof__(*(ptr)) __x = (x);				\
+	int __pu_err;						\
+	switch (sizeof (*(ptr))) {				\
+	case 1:							\
+		__put_user_asm_1(__x, ptr, __pu_err);		\
+		break;						\
+	case 2:							\
+		__put_user_asm_2(__x, ptr, __pu_err);		\
+		break;						\
+	case 4:							\
+		__put_user_asm_4(__x, ptr, __pu_err);		\
+		break;						\
+	case 8:							\
+		__put_user_asm_8(__x, ptr, __pu_err);		\
+		break;						\
+	default:						\
+		__pu_err = __put_user_bad();			\
+		break;						\
+	 }							\
+	__pu_err;						\
 })
 
 #define put_user(x, ptr) __put_user(x, ptr)
 
 extern int __put_user_bad(void);
 
-#define __get_user_asm_8(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-				"   la    2,%0\n"			   \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: mvc   0(8,2),0(4)\n"                   \
-                                "   sacf  0\n"                             \
-                                "1:\n"                                     \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: sacf  0\n"                             \
-                                "   lhi   %1,%h3\n"                        \
-                                "   bras  4,3f\n"                          \
-                                "   .long 1b\n"                            \
-                                "3: l     4,0(4)\n"                        \
-                                "   br    4\n"                             \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 4\n"                            \
-                                "   .long 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=m" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u64*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "2", "4" );                        \
-})
-
-#define __get_user_asm_4(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: l     %0,0(4)\n"                       \
-                                "   sacf  0\n"                             \
-                                "1:\n"                                     \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: sacf  0\n"                             \
-                                "   lhi   %1,%h3\n"                        \
-                                "   bras  4,3f\n"                          \
-                                "   .long 1b\n"                            \
-                                "3: l     4,0(4)\n"                        \
-                                "   br    4\n"                             \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 4\n"                            \
-                                "   .long 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=d" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u32*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                             \
-})
-
-#define __get_user_asm_2(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: lh    %0,0(4)\n"                       \
-                                "   sacf  0\n"                             \
-                                "1:\n"                                     \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: sacf  0\n"                             \
-                                "   lhi   %1,%h3\n"                        \
-                                "   bras  4,3f\n"                          \
-                                "   .long 1b\n"                            \
-                                "3: l     4,0(4)\n"                        \
-                                "   br    4\n"                             \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 4\n"                            \
-                                "   .long 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=d" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u16*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                             \
-})
-
-#define __get_user_asm_1(x, ptr, err)                                     \
-({                                                                        \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                        \
-                                "   la    4,%2\n"                         \
-                                "   sr    %0,%0\n"                        \
-                                "   sacf  512\n"                          \
-                                "0: ic    %0,0(4)\n"                      \
-                                "   sacf  0\n"                            \
-                                "1:\n"                                    \
-                                ".section .fixup,\"ax\"\n"                \
-                                "2: sacf  0\n"                            \
-                                "   lhi   %1,%h3\n"                       \
-                                "   bras  4,3f\n"                         \
-                                "   .long 1b\n"                           \
-                                "3: l     4,0(4)\n"                       \
-                                "   br    4\n"                            \
-                                ".previous\n"                             \
-                                ".section __ex_table,\"a\"\n"             \
-                                "   .align 4\n"                           \
-                                "   .long 0b,2b\n"                        \
-                                ".previous"                               \
-                                : "=d" (x) , "=&d" (err)                  \
-                                : "m" (*(const __u8*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                            \
-})
+#ifndef __s390x__
 
-#define __get_user(x, ptr)                                      \
-({                                                              \
-        __typeof__(*(ptr)) __x;                                 \
-        int __gu_err;                                           \
-        switch (sizeof(*(ptr))) {                               \
-        case 1:                                                 \
-                __get_user_asm_1(__x, ptr, __gu_err);           \
-                break;                                          \
-        case 2:                                                 \
-                __get_user_asm_2(__x, ptr, __gu_err);           \
-                break;                                          \
-        case 4:                                                 \
-                __get_user_asm_4(__x, ptr, __gu_err);           \
-                break;                                          \
-        case 8:                                                 \
-                __get_user_asm_8(__x, ptr, __gu_err);           \
-                break;                                          \
-        default:                                                \
-                __x = 0;                                        \
-                __gu_err = __get_user_bad();                    \
-                break;                                          \
-        }                                                       \
-        (x) = __x;                                              \
-        __gu_err;                                               \
+#define __get_user_asm_8(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  2,%1\n"				\
+		"   la	  4,%2\n"				\
+		"   sacf  512\n"				\
+		"0: mvc	  0(8,2),0(4)\n"			\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err), "=m" (x)				\
+		: "m" (*(const __u64*)(ptr)),"K" (-EFAULT)	\
+		: "cc", "2", "4" );				\
+})
+
+#else /* __s390x__ */
+
+#define __get_user_asm_8(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%2\n"				\
+		"   sacf  512\n"				\
+		"0: lg	  %1,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err), "=d" (x)				\
+		: "m" (*(const __u64*)(ptr)),"K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#endif /* __s390x__ */
+
+
+#define __get_user_asm_4(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%2\n"				\
+		"   sacf  512\n"				\
+		"0: l	  %1,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err), "=d" (x)				\
+		: "m" (*(const __u32*)(ptr)),"K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __get_user_asm_2(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%2\n"				\
+		"   sacf  512\n"				\
+		"0: lh	  %1,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err), "=d" (x)				\
+		: "m" (*(const __u16*)(ptr)),"K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __get_user_asm_1(x, ptr, err) \
+({								\
+	__asm__ __volatile__ (					\
+		"   sr	  %0,%0\n"				\
+		"   la	  4,%2\n"				\
+		"   sr	  %1,%1\n"				\
+		"   sacf  512\n"				\
+		"0: ic	  %1,0(4)\n"				\
+		"   sacf  0\n"					\
+		"1:\n"						\
+		__uaccess_fixup					\
+		: "=&d" (err), "=d" (x)				\
+		: "m" (*(const __u8*)(ptr)),"K" (-EFAULT)	\
+		: "cc", "4" );					\
+})
+
+#define __get_user(x, ptr)					\
+({								\
+	__typeof__(*(ptr)) __x;					\
+	int __gu_err;						\
+	switch (sizeof(*(ptr))) {				\
+	case 1:							\
+		__get_user_asm_1(__x, ptr, __gu_err);		\
+		break;						\
+	case 2:							\
+		__get_user_asm_2(__x, ptr, __gu_err);		\
+		break;						\
+	case 4:							\
+		__get_user_asm_4(__x, ptr, __gu_err);		\
+		break;						\
+	case 8:							\
+		__get_user_asm_8(__x, ptr, __gu_err);		\
+		break;						\
+	default:						\
+		__x = 0;					\
+		__gu_err = __get_user_bad();			\
+		break;						\
+	}							\
+	(x) = __x;						\
+	__gu_err;						\
 })
 
 #define get_user(x, ptr) __get_user(x, ptr)
@@ -357,7 +334,8 @@
 extern int __get_user_bad(void);
 
 /*
- * access register are set up, that 4 points to secondary (user) , 2 to primary (kernel)
+ * access register are set up, that 4 points to secondary (user),
+ * 2 to primary (kernel)
  */
 
 extern long __copy_to_user_asm(const void *from, long n, const void *to);
@@ -402,42 +380,81 @@
  * Copy a null terminated string from userspace.
  */
 
+#ifndef __s390x__
+
 static inline long
 __strncpy_from_user(char *dst, const char *src, long count)
 {
         int len;
-        __asm__ __volatile__ (  "   slr   %0,%0\n"
-				"   lr    2,%1\n"
-                                "   lr    4,%2\n"
-                                "   slr   3,3\n"
-                                "   sacf  512\n"
-                                "0: ic    3,0(%0,4)\n"
-                                "1: stc   3,0(%0,2)\n"
-                                "   ltr   3,3\n"
-                                "   jz    2f\n"
-                                "   ahi   %0,1\n"
-                                "   clr   %0,%3\n"
-                                "   jl    0b\n"
-                                "2: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-                                "3: lhi   %0,%h4\n"
-				"   basr  3,0\n"
-                                "   l     3,4f-.(3)\n"
-                                "   br    3\n"
-				"4: .long 2b\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 4\n"
-				"   .long  0b,3b\n"
-                                "   .long  1b,3b\n"
-				".previous"
-                                : "=&a" (len)
-                                : "a" (dst), "d" (src), "d" (count),
-                                  "K" (-EFAULT)
-                                : "2", "3", "4", "memory", "cc" );
-        return len;
+        __asm__ __volatile__ (
+		"   slr   %0,%0\n"
+		"   lr    2,%1\n"
+                "   lr    4,%2\n"
+                "   slr   3,3\n"
+                "   sacf  512\n"
+		"0: ic	  3,0(%0,4)\n"
+		"1: stc	  3,0(%0,2)\n"
+		"   ltr	  3,3\n"
+		"   jz	  2f\n"
+		"   ahi	  %0,1\n"
+		"   clr	  %0,%3\n"
+		"   jl	  0b\n"
+		"2: sacf  0\n"
+		".section .fixup,\"ax\"\n"
+		"3: lhi	  %0,%h4\n"
+		"   basr  3,0\n"
+		"   l	  3,4f-.(3)\n"
+		"   br	  3\n"
+		"4: .long 2b\n"
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		"   .align 4\n"
+		"   .long  0b,3b\n"
+		"   .long  1b,3b\n"
+		".previous"
+		: "=&a" (len)
+		: "a" (dst), "d" (src), "d" (count), "K" (-EFAULT)
+		: "2", "3", "4", "memory", "cc" );
+	return len;
 }
 
+#else /* __s390x__ */
+
+static inline long
+__strncpy_from_user(char *dst, const char *src, long count)
+{
+	long len;
+	__asm__ __volatile__ (
+		"   slgr  %0,%0\n"
+		"   lgr	  2,%1\n"
+		"   lgr	  4,%2\n"
+		"   slr	  3,3\n"
+		"   sacf  512\n"
+		"0: ic	  3,0(%0,4)\n"
+		"1: stc	  3,0(%0,2)\n"
+		"   ltr	  3,3\n"
+		"   jz	  2f\n"
+		"   aghi  %0,1\n"
+		"   cgr	  %0,%3\n"
+		"   jl	  0b\n"
+		"2: sacf  0\n"
+		".section .fixup,\"ax\"\n"
+		"3: lghi  %0,%h4\n"
+		"   jg	  2b\n"	 
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		"   .align 8\n"
+		"   .quad  0b,3b\n"
+		"   .quad  1b,3b\n"
+		".previous"
+		: "=&a" (len)
+		: "a"  (dst), "d" (src), "d" (count), "K" (-EFAULT)
+		: "cc", "2" ,"3", "4" );
+	return len;
+}
+
+#endif /* __s390x__ */
+
 static inline long
 strncpy_from_user(char *dst, const char *src, long count)
 {
@@ -453,35 +470,92 @@
  *
  * Return 0 for error
  */
+#ifndef __s390x__
+
+static inline unsigned long
+strnlen_user(const char * src, unsigned long n)
+{
+	__asm__ __volatile__ (
+		"   alr   %0,%1\n"
+		"   slr   0,0\n"
+		"   lr    4,%1\n"
+		"   sacf  512\n"
+		"0: srst  %0,4\n"
+		"   jo    0b\n"
+		"   slr   %0,%1\n"
+		"   ahi   %0,1\n"
+		"   sacf  0\n"
+		"1:\n"
+		".section .fixup,\"ax\"\n"
+		"2: sacf  0\n"
+		"   slr   %0,%0\n"
+		"   bras  4,3f\n"
+		"   .long 1b\n"
+		"3: l     4,0(4)\n"
+		"   br    4\n"
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		"  .align 4\n"
+		"  .long  0b,2b\n"
+		".previous"
+		: "+&a" (n) : "d" (src)
+		: "cc", "0", "4" );
+	return n;
+}
+
+#else /* __s390x__ */
+
 static inline unsigned long
 strnlen_user(const char * src, unsigned long n)
 {
-	__asm__ __volatile__ ("   alr   %0,%1\n"
-			      "   slr   0,0\n"
-			      "   lr    4,%1\n"
-			      "   sacf  512\n"
-			      "0: srst  %0,4\n"
-			      "   jo    0b\n"
-			      "   slr   %0,%1\n"
-			      "   ahi   %0,1\n"
-			      "   sacf  0\n"
-                              "1:\n"
-                              ".section .fixup,\"ax\"\n"
-                              "2: sacf  0\n"
-                              "   slr   %0,%0\n"
-                              "   bras  4,3f\n"
-                              "   .long 1b\n"
-                              "3: l     4,0(4)\n"
-                              "   br    4\n"
-                              ".previous\n"
-			      ".section __ex_table,\"a\"\n"
-			      "   .align 4\n"
-			      "   .long  0b,2b\n"
-			      ".previous"
-			      : "+&a" (n) : "d" (src)
-			      : "cc", "0", "4" );
-        return n;
+#if 0
+	__asm__ __volatile__ (
+		"   algr  %0,%1\n"
+		"   slgr  0,0\n"
+		"   lgr	  4,%1\n"
+		"   sacf  512\n"
+		"0: srst  %0,4\n"
+		"   jo	0b\n"
+		"   slgr  %0,%1\n"
+		"   aghi  %0,1\n"
+		"1: sacf  0\n"
+		".section .fixup,\"ax\"\n"
+		"2: slgr  %0,%0\n"
+		"   jg	  1b\n"
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		"  .align 8\n"
+		"  .quad  0b,2b\n"
+		".previous"
+		: "+&a" (n) : "d" (src)
+		: "cc", "0", "4" );
+#else
+	__asm__ __volatile__ (
+		"   lgr	  4,%1\n"
+		"   sacf  512\n"
+		"0: cli   0(4),0x00\n"
+		"   la    4,1(4)\n"
+		"   je    1f\n"
+		"   brctg %0,0b\n"
+		"1: lgr	  %0,4\n"
+		"   slgr  %0,%1\n"
+		"2: sacf  0\n"
+		".section .fixup,\"ax\"\n"
+		"3: slgr  %0,%0\n"
+		"   jg    2b\n"  
+		".previous\n"
+		".section __ex_table,\"a\"\n"
+		"  .align 8\n"
+		"  .quad  0b,3b\n"
+		".previous"
+		: "+&a" (n) : "d" (src)
+		: "cc", "4" );
+#endif
+	return n;
 }
+
+#endif /* __s390x__ */
+
 #define strlen_user(str) strnlen_user(str, ~0UL)
 
 /*
@@ -490,18 +564,18 @@
 
 extern long __clear_user_asm(void *to, long n);
 
-#define __clear_user(to, n)                                     \
-({                                                              \
-        __clear_user_asm(to, n);                                \
+#define __clear_user(to, n)					\
+({								\
+	__clear_user_asm(to, n);				\
 })
 
 static inline unsigned long
 clear_user(void *to, unsigned long n)
 {
-        if (access_ok(VERIFY_WRITE, to, n))
-                n = __clear_user(to, n);
-        return n;
+	if (access_ok(VERIFY_WRITE, to, n))
+		n = __clear_user(to, n);
+	return n;
 }
 
 
-#endif                                 /* _S390_UACCESS_H                  */
+#endif				       /* _S390_UACCESS_H		   */
diff -urN linux-2.5.67-bk5/include/asm-s390/unistd.h linux-2.5.67-bk6/include/asm-s390/unistd.h
--- linux-2.5.67-bk5/include/asm-s390/unistd.h	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390/unistd.h	2003-04-15 04:36:16.000000000 -0700
@@ -249,130 +249,255 @@
 #define __NR_epoll_wait		251
 #define __NR_set_tid_address	252
 #define __NR_fadvise64		253
+#define __NR_timer_create	254
+#define __NR_timer_settime	(__NR_timer_create+1)
+#define __NR_timer_gettime	(__NR_timer_create+2)
+#define __NR_timer_getoverrun	(__NR_timer_create+3)
+#define __NR_timer_delete	(__NR_timer_create+4)
+#define __NR_clock_settime	(__NR_timer_create+5)
+#define __NR_clock_gettime	(__NR_timer_create+6)
+#define __NR_clock_getres	(__NR_timer_create+7)
+#define __NR_clock_nanosleep	(__NR_timer_create+8)
+
+#define NR_syscalls 263
+
+/* 
+ * There are some system calls that are not present on 64 bit, some
+ * have a different name although they do the same (e.g. __NR_chown32
+ * is __NR_chown on 64 bit).
+ */
+#ifdef __s390x__
+#undef  __NR_time
+#undef  __NR_lchown
+#undef  __NR_setuid
+#undef  __NR_getuid
+#undef  __NR_stime
+#undef  __NR_setgid
+#undef  __NR_getgid
+#undef  __NR_geteuid
+#undef  __NR_getegid
+#undef  __NR_setreuid
+#undef  __NR_setregid
+#undef  __NR_getrlimit
+#undef  __NR_getgroups
+#undef  __NR_setgroups
+#undef  __NR_fchown
+#undef  __NR_ioperm
+#undef  __NR_setfsuid
+#undef  __NR_setfsgid
+#undef  __NR__llseek
+#undef  __NR__newselect
+#undef  __NR_setresuid
+#undef  __NR_getresuid
+#undef  __NR_setresgid
+#undef  __NR_getresgid
+#undef  __NR_chown
+#undef  __NR_ugetrlimit
+#undef  __NR_mmap2
+#undef  __NR_truncate64
+#undef  __NR_ftruncate64
+#undef  __NR_stat64
+#undef  __NR_lstat64
+#undef  __NR_fstat64
+#undef  __NR_lchown32
+#undef  __NR_getuid32
+#undef  __NR_getgid32
+#undef  __NR_geteuid32
+#undef  __NR_getegid32
+#undef  __NR_setreuid32
+#undef  __NR_setregid32
+#undef  __NR_getgroups32
+#undef  __NR_setgroups32
+#undef  __NR_fchown32
+#undef  __NR_setresuid32
+#undef  __NR_getresuid32
+#undef  __NR_setresgid32
+#undef  __NR_getresgid32
+#undef  __NR_chown32
+#undef  __NR_setuid32
+#undef  __NR_setgid32
+#undef  __NR_setfsuid32
+#undef  __NR_setfsgid32
+#undef  __NR_getdents64
+#undef  __NR_fcntl64
+#undef  __NR_sendfile64
+
+#define __NR_select		142
+#define __NR_getrlimit		191	/* SuS compliant getrlimit */
+#define __NR_lchown  		198
+#define __NR_getuid  		199
+#define __NR_getgid  		200
+#define __NR_geteuid  		201
+#define __NR_getegid  		202
+#define __NR_setreuid  		203
+#define __NR_setregid  		204
+#define __NR_getgroups  	205
+#define __NR_setgroups  	206
+#define __NR_fchown  		207
+#define __NR_setresuid  	208
+#define __NR_getresuid  	209
+#define __NR_setresgid  	210
+#define __NR_getresgid  	211
+#define __NR_chown  		212
+#define __NR_setuid  		213
+#define __NR_setgid  		214
+#define __NR_setfsuid  		215
+#define __NR_setfsgid  		216
 
+#endif
 
 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
 
-#define __syscall_return(type, res)                          \
-do {                                                         \
-        if ((unsigned long)(res) >= (unsigned long)(-125)) { \
-                errno = -(res);                              \
-                res = -1;                                    \
-        }                                                    \
-        return (type) (res);                                 \
+#define __syscall_return(type, res)			     \
+do {							     \
+	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+		errno = -(res);				     \
+		res = -1;				     \
+	}						     \
+	return (type) (res);				     \
 } while (0)
 
-#define _svc_clobber "cc", "memory"
+#define _svc_clobber "1", "cc", "memory"
+
+#define _syscall0(type,name)				     \
+type name(void) {					     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la  %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name)			     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
+}
+
+#define _syscall1(type,name,type1,arg1)			     \
+type name(type1 arg1) {					     \
+	register type1 __arg1 asm("2") = arg1;		     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la  %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name),			     \
+		  "0" (__arg1)				     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
+}
 
-#define _syscall0(type,name)                                 \
-type name(void) {                                            \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name)                          \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall1(type,name,type1,arg1)                      \
-type name(type1 arg1) {                                      \
-        register type1 __arg1 asm("2") = arg1;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall2(type,name,type1,arg1,type2,arg2)           \
-type name(type1 arg1, type2 arg2) {                          \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
+#define _syscall2(type,name,type1,arg1,type2,arg2)	     \
+type name(type1 arg1, type2 arg2) {			     \
+	register type1 __arg1 asm("2") = arg1;		     \
+	register type2 __arg2 asm("3") = arg2;		     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name),			     \
+		  "0" (__arg1),				     \
+		  "d" (__arg2)				     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
 }
 
 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\
-type name(type1 arg1, type2 arg2, type3 arg3) {              \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
+type name(type1 arg1, type2 arg2, type3 arg3) {		     \
+	register type1 __arg1 asm("2") = arg1;		     \
+	register type2 __arg2 asm("3") = arg2;		     \
+	register type3 __arg3 asm("4") = arg3;		     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la  %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name),			     \
+		  "0" (__arg1),				     \
+		  "d" (__arg2),				     \
+		  "d" (__arg3)				     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
 }
 
 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\
-                  type4,name4)                               \
+		  type4,name4)				     \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {  \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register type4 __arg4 asm("5") = arg4;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3),                              \
-                  "d" (__arg4)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
+	register type1 __arg1 asm("2") = arg1;		     \
+	register type2 __arg2 asm("3") = arg2;		     \
+	register type3 __arg3 asm("4") = arg3;		     \
+	register type4 __arg4 asm("5") = arg4;		     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la  %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name),			     \
+		  "0" (__arg1),				     \
+		  "d" (__arg2),				     \
+		  "d" (__arg3),				     \
+		  "d" (__arg4)				     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
 }
 
 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\
-                  type4,name4,type5,name5)                   \
+		  type4,name4,type5,name5)		     \
 type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4,    \
-          type5 arg5) {                                      \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register type4 __arg4 asm("5") = arg4;               \
-        register type5 __arg5 asm("6") = arg5;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3),                              \
-                  "d" (__arg4),                              \
-                  "d" (__arg5)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
+	  type5 arg5) {					     \
+	register type1 __arg1 asm("2") = arg1;		     \
+	register type2 __arg2 asm("3") = arg2;		     \
+	register type3 __arg3 asm("4") = arg3;		     \
+	register type4 __arg4 asm("5") = arg4;		     \
+	register type5 __arg5 asm("6") = arg5;		     \
+	register long __svcres asm("2");		     \
+	long __res;					     \
+	__asm__ __volatile__ (				     \
+		"    .if %1 < 256\n"			     \
+		"    svc %b1\n"				     \
+		"    .else\n"				     \
+		"    la  %%r1,%1\n"			     \
+		"    svc 0\n"				     \
+		"    .endif"				     \
+		: "=d" (__svcres)			     \
+		: "i" (__NR_##name),			     \
+		  "0" (__arg1),				     \
+		  "d" (__arg2),				     \
+		  "d" (__arg3),				     \
+		  "d" (__arg4),				     \
+		  "d" (__arg5)				     \
+		: _svc_clobber );			     \
+	__res = __svcres;				     \
+	__syscall_return(type,__res);			     \
 }
 
 #ifdef __KERNEL_SYSCALLS__
diff -urN linux-2.5.67-bk5/include/asm-s390x/a.out.h linux-2.5.67-bk6/include/asm-s390x/a.out.h
--- linux-2.5.67-bk5/include/asm-s390x/a.out.h	2003-04-07 10:31:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/a.out.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,38 +0,0 @@
-/*
- *  include/asm-s390/a.out.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *
- *  Derived from "include/asm-i386/a.out.h"
- *    Copyright (C) 1992, Linus Torvalds
- *
- * I don't think we'll ever need a.out ...
- */
-
-#ifndef __S390_A_OUT_H__
-#define __S390_A_OUT_H__
-
-struct exec
-{
-  unsigned long a_info;		/* Use macros N_MAGIC, etc for access */
-  unsigned a_text;		/* length of text, in bytes */
-  unsigned a_data;		/* length of data, in bytes */
-  unsigned a_bss;		/* length of uninitialized data area for file, in bytes */
-  unsigned a_syms;		/* length of symbol table data in file, in bytes */
-  unsigned a_entry;		/* start address */
-  unsigned a_trsize;		/* length of relocation info for text, in bytes */
-  unsigned a_drsize;		/* length of relocation info for data, in bytes */
-};
-
-#define N_TRSIZE(a)	((a).a_trsize)
-#define N_DRSIZE(a)	((a).a_drsize)
-#define N_SYMSIZE(a)	((a).a_syms)
-
-#ifdef __KERNEL__
-
-#define STACK_TOP	TASK_SIZE
-
-#endif
-
-#endif /* __A_OUT_GNU_H__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/atomic.h linux-2.5.67-bk6/include/asm-s390x/atomic.h
--- linux-2.5.67-bk5/include/asm-s390x/atomic.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/atomic.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,168 +0,0 @@
-#ifndef __ARCH_S390_ATOMIC__
-#define __ARCH_S390_ATOMIC__
-
-/*
- *  include/asm-s390x/atomic.h
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow
- *
- *  Derived from "include/asm-i386/bitops.h"
- *    Copyright (C) 1992, Linus Torvalds
- *
- */
-
-/*
- * Atomic operations that C can't guarantee us.  Useful for
- * resource counting etc..
- * S390 uses 'Compare And Swap' for atomicity in SMP enviroment
- */
-
-typedef struct { volatile int counter; } __attribute__ ((aligned (4))) atomic_t;
-#define ATOMIC_INIT(i)  { (i) }
-
-#define atomic_eieio()          __asm__ __volatile__ ("BCR 15,0")
-
-#define __CS_LOOP(old_val, new_val, ptr, op_val, op_string)		\
-        __asm__ __volatile__("   l     %0,0(%3)\n"			\
-                             "0: lr    %1,%0\n"				\
-                             op_string "  %1,%4\n"			\
-                             "   cs    %0,%1,0(%3)\n"			\
-                             "   jl    0b"				\
-                             : "=&d" (old_val), "=&d" (new_val),	\
-			       "+m" (((atomic_t *)(ptr))->counter)	\
-			     : "a" (ptr), "d" (op_val) : "cc" );
-
-#define atomic_read(v)          ((v)->counter)
-#define atomic_set(v,i)         (((v)->counter) = (i))
-
-static __inline__ void atomic_add(int i, atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, i, "ar");
-}
-
-static __inline__ int atomic_add_return (int i, atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, i, "ar");
-	return new_val;
-}
-
-static __inline__ int atomic_add_negative(int i, atomic_t *v)
-{
-	int old_val, new_val;
-        __CS_LOOP(old_val, new_val, v, i, "ar");
-        return new_val < 0;
-}
-
-static __inline__ void atomic_sub(int i, atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, i, "sr");
-}
-
-static __inline__ void atomic_inc(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "ar");
-}
-
-static __inline__ int atomic_inc_return(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "ar");
-        return new_val;
-}
-
-static __inline__ int atomic_inc_and_test(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "ar");
-	return new_val != 0;
-}
-
-static __inline__ void atomic_dec(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "sr");
-}
-
-static __inline__ int atomic_dec_return(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "sr");
-	return new_val;
-}
-
-static __inline__ int atomic_dec_and_test(volatile atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, 1, "sr");
-        return new_val == 0;
-}
-
-static __inline__ void atomic_clear_mask(unsigned long mask, atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, ~mask, "nr");
-}
-
-static __inline__ void atomic_set_mask(unsigned long mask, atomic_t *v)
-{
-	int old_val, new_val;
-	__CS_LOOP(old_val, new_val, v, mask, "or");
-}
-
-/*
-  returns 0  if expected_oldval==value in *v ( swap was successful )
-  returns 1  if unsuccessful.
-*/
-static __inline__ int
-atomic_compare_and_swap(int expected_oldval,int new_val,atomic_t *v)
-{
-        int retval;
-
-        __asm__ __volatile__(
-                "  lr   %0,%3\n"
-                "  cs   %0,%4,0(%2)\n"
-                "  ipm  %0\n"
-                "  srl  %0,28\n"
-                "0:"
-                : "=&d" (retval), "+m" (v->counter)
-                : "a" (v), "d" (expected_oldval) , "d" (new_val)
-                : "cc");
-        return retval;
-}
-
-/*
-  Spin till *v = expected_oldval then swap with newval.
- */
-static __inline__ void
-atomic_compare_and_swap_spin(int expected_oldval,int new_val,atomic_t *v)
-{
-	unsigned long tmp;
-        __asm__ __volatile__(
-                "0: lr  %1,%3\n"
-                "   cs  %1,%4,0(%2)\n"
-                "   jl  0b\n"
-                : "+m" (v->counter), "=&d" (tmp)
-		: "a" (v), "d" (expected_oldval) , "d" (new_val)
-                : "cc" );
-}
-
-#define atomic_compare_and_swap_debug(where,from,to) \
-if (atomic_compare_and_swap ((from), (to), (where))) {\
-	printk (KERN_WARNING"%s/%d atomic counter:%s couldn't be changed from %d(%s) to %d(%s), was %d\n",\
-		__FILE__,__LINE__,#where,(from),#from,(to),#to,atomic_read (where));\
-        atomic_set(where,(to));\
-}
-
-#define smp_mb__before_atomic_dec()	smp_mb()
-#define smp_mb__after_atomic_dec()	smp_mb()
-#define smp_mb__before_atomic_inc()	smp_mb()
-#define smp_mb__after_atomic_inc()	smp_mb()
-
-#endif                                 /* __ARCH_S390_ATOMIC __            */
diff -urN linux-2.5.67-bk5/include/asm-s390x/bitops.h linux-2.5.67-bk6/include/asm-s390x/bitops.h
--- linux-2.5.67-bk5/include/asm-s390x/bitops.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/bitops.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,950 +0,0 @@
-#ifndef _S390_BITOPS_H
-#define _S390_BITOPS_H
-
-/*
- *  include/asm-s390/bitops.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/bitops.h"
- *    Copyright (C) 1992, Linus Torvalds
- *
- */
-#include <linux/config.h>
-
-/*
- * bit 0 is the LSB of *addr; bit 63 is the MSB of *addr;
- * bit 64 is the LSB of *(addr+8). That combined with the
- * big endian byte order on S390 give the following bit
- * order in memory:
- *    3f 3e 3d 3c 3b 3a 39 38 37 36 35 34 33 32 31 30
- *    2f 2e 2d 2c 2b 2a 29 28 27 26 25 24 23 22 21 20
- *    1f 1e 1d 1c 1b 1a 19 18 17 16 15 14 13 12 11 10
- *    0f 0e 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
- * after that follows the next long with bit numbers
- *    7f 7e 7d 7c 7b 7a 79 78 77 76 75 74 73 72 71 70
- *    6f 6e 6d 6c 6b 6a 69 68 67 66 65 64 63 62 61 60
- *    5f 5e 5d 5c 5b 5a 59 58 57 56 55 54 53 52 51 50
- *    4f 4e 4d 4c 4b 4a 49 48 47 46 45 44 43 42 41 40
- * The reason for this bit ordering is the fact that
- * in the architecture independent code bits operations
- * of the form "flags |= (1 << bitnr)" are used INTERMIXED
- * with operation of the form "set_bit(bitnr, flags)".
- */
-
-/* set ALIGN_CS to 1 if the SMP safe bit operations should
- * align the address to 4 byte boundary. It seems to work
- * without the alignment. 
- */
-#ifdef __KERNEL__
-#define ALIGN_CS 0
-#else
-#define ALIGN_CS 1
-#ifndef CONFIG_SMP
-#error "bitops won't work without CONFIG_SMP"
-#endif
-#endif
-
-/* bitmap tables from arch/S390/kernel/bitmap.S */
-extern const char _oi_bitmap[];
-extern const char _ni_bitmap[];
-extern const char _zb_findmap[];
-extern const char _sb_findmap[];
-
-#ifdef CONFIG_SMP
-/*
- * SMP safe set_bit routine based on compare and swap (CS)
- */
-static inline void set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 63);	/* make OR mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   ogr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-}
-
-/*
- * SMP safe clear_bit routine based on compare and swap (CS)
- */
-static inline void clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = ~(1UL << (nr & 63));	/* make AND mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   ngr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-}
-
-/*
- * SMP safe change_bit routine based on compare and swap (CS)
- */
-static inline void change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 63);	/* make XOR mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   xgr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-}
-
-/*
- * SMP safe test_and_set_bit routine based on compare and swap (CS)
- */
-static inline int
-test_and_set_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 63);	/* make OR/test mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   ogr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-	return (old & mask) != 0;
-}
-
-/*
- * SMP safe test_and_clear_bit routine based on compare and swap (CS)
- */
-static inline int
-test_and_clear_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = ~(1UL << (nr & 63));	/* make AND mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   ngr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-	return (old ^ new) != 0;
-}
-
-/*
- * SMP safe test_and_change_bit routine based on compare and swap (CS) 
- */
-static inline int
-test_and_change_bit_cs(unsigned long nr, volatile unsigned long *ptr)
-{
-        unsigned long addr, old, new, mask;
-
-	addr = (unsigned long) ptr;
-#if ALIGN_CS == 1
-	nr += (addr & 7) << 3;		/* add alignment to bit number */
-	addr ^= addr & 7;		/* align address to 8 */
-#endif
-	addr += (nr ^ (nr & 63)) >> 3;	/* calculate address for CS */
-	mask = 1UL << (nr & 63);	/* make XOR mask */
-	asm volatile(
-		"   lg   %0,0(%4)\n"
-		"0: lgr  %1,%0\n"
-		"   xgr  %1,%3\n"
-		"   csg  %0,%1,0(%4)\n"
-		"   jl   0b"
-		: "=&d" (old), "=&d" (new), "+m" (*(unsigned long *) addr)
-		: "d" (mask), "a" (addr) 
-		: "cc" );
-	return (old & mask) != 0;
-}
-#endif /* CONFIG_SMP */
-
-/*
- * fast, non-SMP set_bit routine
- */
-static inline void __set_bit(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-        asm volatile("oc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
-}
-
-static inline void 
-__constant_set_bit(const unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7);
-	switch (nr&7) {
-	case 0:
-		asm volatile ("oi 0(%1),0x01"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 1:
-		asm volatile ("oi 0(%1),0x02"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 2:
-		asm volatile ("oi 0(%1),0x04" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 3:
-		asm volatile ("oi 0(%1),0x08" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 4:
-		asm volatile ("oi 0(%1),0x10" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 5:
-		asm volatile ("oi 0(%1),0x20" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 6:
-		asm volatile ("oi 0(%1),0x40" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 7:
-		asm volatile ("oi 0(%1),0x80" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	}
-}
-
-#define set_bit_simple(nr,addr) \
-(__builtin_constant_p((nr)) ? \
- __constant_set_bit((nr),(addr)) : \
- __set_bit((nr),(addr)) )
-
-/*
- * fast, non-SMP clear_bit routine
- */
-static inline void 
-__clear_bit(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-        asm volatile("nc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_ni_bitmap + (nr & 7))
-		     : "cc" );
-}
-
-static inline void 
-__constant_clear_bit(const unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7);
-	switch (nr&7) {
-	case 0:
-		asm volatile ("ni 0(%1),0xFE" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 1:
-		asm volatile ("ni 0(%1),0xFD"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 2:
-		asm volatile ("ni 0(%1),0xFB" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 3:
-		asm volatile ("ni 0(%1),0xF7" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 4:
-		asm volatile ("ni 0(%1),0xEF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 5:
-		asm volatile ("ni 0(%1),0xDF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 6:
-		asm volatile ("ni 0(%1),0xBF" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 7:
-		asm volatile ("ni 0(%1),0x7F" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	}
-}
-
-#define clear_bit_simple(nr,addr) \
-(__builtin_constant_p((nr)) ? \
- __constant_clear_bit((nr),(addr)) : \
- __clear_bit((nr),(addr)) )
-
-/* 
- * fast, non-SMP change_bit routine 
- */
-static inline void __change_bit(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-        asm volatile("xc 0(1,%1),0(%2)"
-		     :  "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
-}
-
-static inline void 
-__constant_change_bit(const unsigned long nr, volatile unsigned long *ptr) 
-{
-	unsigned long addr;
-
-	addr = ((unsigned long) ptr) + ((nr >> 3) ^ 7);
-	switch (nr&7) {
-	case 0:
-		asm volatile ("xi 0(%1),0x01" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 1:
-		asm volatile ("xi 0(%1),0x02" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 2:
-		asm volatile ("xi 0(%1),0x04" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 3:
-		asm volatile ("xi 0(%1),0x08" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 4:
-		asm volatile ("xi 0(%1),0x10" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 5:
-		asm volatile ("xi 0(%1),0x20" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 6:
-		asm volatile ("xi 0(%1),0x40" 
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	case 7:
-		asm volatile ("xi 0(%1),0x80"
-			      : "+m" (*(char *) addr) : "a" (addr) : "cc" );
-		break;
-	}
-}
-
-#define change_bit_simple(nr,addr) \
-(__builtin_constant_p((nr)) ? \
- __constant_change_bit((nr),(addr)) : \
- __change_bit((nr),(addr)) )
-
-/*
- * fast, non-SMP test_and_set_bit routine
- */
-static inline int
-test_and_set_bit_simple(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-	unsigned char ch;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-	ch = *(unsigned char *) addr;
-        asm volatile("oc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
-	return (ch >> (nr & 7)) & 1;
-}
-#define __test_and_set_bit(X,Y)		test_and_set_bit_simple(X,Y)
-
-/*
- * fast, non-SMP test_and_clear_bit routine
- */
-static inline int
-test_and_clear_bit_simple(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-	unsigned char ch;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-	ch = *(unsigned char *) addr;
-        asm volatile("nc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_ni_bitmap + (nr & 7))
-		     : "cc" );
-	return (ch >> (nr & 7)) & 1;
-}
-#define __test_and_clear_bit(X,Y)	test_and_clear_bit_simple(X,Y)
-
-/*
- * fast, non-SMP test_and_change_bit routine
- */
-static inline int
-test_and_change_bit_simple(unsigned long nr, volatile unsigned long *ptr)
-{
-	unsigned long addr;
-	unsigned char ch;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-	ch = *(unsigned char *) addr;
-        asm volatile("xc 0(1,%1),0(%2)"
-		     : "+m" (*(char *) addr)
-		     : "a" (addr), "a" (_oi_bitmap + (nr & 7))
-		     : "cc" );
-	return (ch >> (nr & 7)) & 1;
-}
-#define __test_and_change_bit(X,Y)	test_and_change_bit_simple(X,Y)
-
-#ifdef CONFIG_SMP
-#define set_bit             set_bit_cs
-#define clear_bit           clear_bit_cs
-#define change_bit          change_bit_cs
-#define test_and_set_bit    test_and_set_bit_cs
-#define test_and_clear_bit  test_and_clear_bit_cs
-#define test_and_change_bit test_and_change_bit_cs
-#else
-#define set_bit             set_bit_simple
-#define clear_bit           clear_bit_simple
-#define change_bit          change_bit_simple
-#define test_and_set_bit    test_and_set_bit_simple
-#define test_and_clear_bit  test_and_clear_bit_simple
-#define test_and_change_bit test_and_change_bit_simple
-#endif
-
-
-/*
- * This routine doesn't need to be atomic.
- */
-
-static inline int __test_bit(unsigned long nr, const volatile unsigned long *ptr)
-{
-	unsigned long addr;
-	unsigned char ch;
-
-	addr = (unsigned long) ptr + ((nr ^ 56) >> 3);
-	ch = *(unsigned char *) addr;
-	return (ch >> (nr & 7)) & 1;
-}
-
-static inline int 
-__constant_test_bit(unsigned long nr, const volatile unsigned long *addr) {
-    return (((volatile char *) addr)[(nr>>3)^7] & (1<<(nr&7))) != 0;
-}
-
-#define test_bit(nr,addr) \
-(__builtin_constant_p((nr)) ? \
- __constant_test_bit((nr),(addr)) : \
- __test_bit((nr),(addr)) )
-
-/*
- * Find-bit routines..
- */
-static inline unsigned long
-find_first_zero_bit(unsigned long * addr, unsigned long size)
-{
-        unsigned long res, cmp, count;
-
-        if (!size)
-                return 0;
-        __asm__("   lghi  %1,-1\n"
-                "   lgr   %2,%3\n"
-                "   slgr  %0,%0\n"
-                "   aghi  %2,63\n"
-                "   srlg  %2,%2,6\n"
-                "0: cg    %1,0(%0,%4)\n"
-                "   jne   1f\n"
-                "   aghi  %0,8\n"
-                "   brct  %2,0b\n"
-                "   lgr   %0,%3\n"
-                "   j     5f\n"
-                "1: lg    %2,0(%0,%4)\n"
-                "   sllg  %0,%0,3\n"
-                "   clr   %2,%1\n"
-		"   jne   2f\n"
-		"   aghi  %0,32\n"
-                "   srlg  %2,%2,32\n"
-		"2: lghi  %1,0xff\n"
-                "   tmll  %2,0xffff\n"
-                "   jno   3f\n"
-                "   aghi  %0,16\n"
-                "   srl   %2,16\n"
-                "3: tmll  %2,0x00ff\n"
-                "   jno   4f\n"
-                "   aghi  %0,8\n"
-                "   srl   %2,8\n"
-                "4: ngr   %2,%1\n"
-                "   ic    %2,0(%2,%5)\n"
-                "   algr  %0,%2\n"
-                "5:"
-                : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (addr), "a" (&_zb_findmap) : "cc" );
-        return (res < size) ? res : size;
-}
-
-static inline unsigned long
-find_first_bit(unsigned long * addr, unsigned long size)
-{
-        unsigned long res, cmp, count;
-
-        if (!size)
-                return 0;
-        __asm__("   slgr  %1,%1\n"
-                "   lgr   %2,%3\n"
-                "   slgr  %0,%0\n"
-                "   aghi  %2,63\n"
-                "   srlg  %2,%2,6\n"
-                "0: cg    %1,0(%0,%4)\n"
-                "   jne   1f\n"
-                "   aghi  %0,8\n"
-                "   brct  %2,0b\n"
-                "   lgr   %0,%3\n"
-                "   j     5f\n"
-                "1: lg    %2,0(%0,%4)\n"
-                "   sllg  %0,%0,3\n"
-                "   clr   %2,%1\n"
-		"   jne   2f\n"
-		"   aghi  %0,32\n"
-                "   srlg  %2,%2,32\n"
-		"2: lghi  %1,0xff\n"
-                "   tmll  %2,0xffff\n"
-                "   jnz   3f\n"
-                "   aghi  %0,16\n"
-                "   srl   %2,16\n"
-                "3: tmll  %2,0x00ff\n"
-                "   jnz   4f\n"
-                "   aghi  %0,8\n"
-                "   srl   %2,8\n"
-                "4: ngr   %2,%1\n"
-                "   ic    %2,0(%2,%5)\n"
-                "   algr  %0,%2\n"
-                "5:"
-                : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (addr), "a" (&_sb_findmap) : "cc" );
-        return (res < size) ? res : size;
-}
-
-static inline unsigned long
-find_next_zero_bit (unsigned long * addr, unsigned long size, unsigned long offset)
-{
-        unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
-        unsigned long bitvec, reg;
-        unsigned long set, bit = offset & 63, res;
-
-        if (bit) {
-                /*
-                 * Look for zero in first word
-                 */
-                bitvec = (*p) >> bit;
-                __asm__("   lhi  %2,-1\n"
-                        "   slgr %0,%0\n"
-                        "   clr  %1,%2\n"
-                        "   jne  0f\n"
-                        "   aghi %0,32\n"
-                        "   srlg %1,%1,32\n"
-			"0: lghi %2,0xff\n"
-                        "   tmll %1,0xffff\n"
-                        "   jno  1f\n"
-                        "   aghi %0,16\n"
-                        "   srlg %1,%1,16\n"
-                        "1: tmll %1,0x00ff\n"
-                        "   jno  2f\n"
-                        "   aghi %0,8\n"
-                        "   srlg %1,%1,8\n"
-                        "2: ngr  %1,%2\n"
-                        "   ic   %1,0(%1,%3)\n"
-                        "   algr %0,%1"
-                        : "=&d" (set), "+a" (bitvec), "=&d" (reg)
-                        : "a" (&_zb_findmap) : "cc" );
-                if (set < (64 - bit))
-                        return set + offset;
-                offset += 64 - bit;
-                p++;
-        }
-        /*
-         * No zero yet, search remaining full words for a zero
-         */
-        res = find_first_zero_bit (p, size - 64 * (p - (unsigned long *) addr));
-        return (offset + res);
-}
-
-static inline unsigned long
-find_next_bit (unsigned long * addr, unsigned long size, unsigned long offset)
-{
-        unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
-        unsigned long bitvec, reg;
-        unsigned long set, bit = offset & 63, res;
-
-        if (bit) {
-                /*
-                 * Look for zero in first word
-                 */
-                bitvec = (*p) >> bit;
-                __asm__("   slgr %0,%0\n"
-                        "   ltr  %1,%1\n"
-                        "   jnz  0f\n"
-                        "   aghi %0,32\n"
-                        "   srlg %1,%1,32\n"
-			"0: lghi %2,0xff\n"
-                        "   tmll %1,0xffff\n"
-                        "   jnz  1f\n"
-                        "   aghi %0,16\n"
-                        "   srlg %1,%1,16\n"
-                        "1: tmll %1,0x00ff\n"
-                        "   jnz  2f\n"
-                        "   aghi %0,8\n"
-                        "   srlg %1,%1,8\n"
-                        "2: ngr  %1,%2\n"
-                        "   ic   %1,0(%1,%3)\n"
-                        "   algr %0,%1"
-                        : "=&d" (set), "+a" (bitvec), "=&d" (reg)
-                        : "a" (&_sb_findmap) : "cc" );
-                if (set < (64 - bit))
-                        return set + offset;
-                offset += 64 - bit;
-                p++;
-        }
-        /*
-         * No set bit yet, search remaining full words for a bit
-         */
-        res = find_first_bit (p, size - 64 * (p - (unsigned long *) addr));
-        return (offset + res);
-}
-
-/*
- * ffz = Find First Zero in word. Undefined if no zero exists,
- * so code should check against ~0UL first..
- */
-static inline unsigned long ffz(unsigned long word)
-{
-	unsigned long reg, result;
-
-        __asm__("   lhi  %2,-1\n"
-                "   slgr %0,%0\n"
-                "   clr  %1,%2\n"
-                "   jne  0f\n"
-                "   aghi %0,32\n"
-                "   srlg %1,%1,32\n"
-                "0: lghi %2,0xff\n"
-                "   tmll %1,0xffff\n"
-                "   jno  1f\n"
-                "   aghi %0,16\n"
-                "   srlg %1,%1,16\n"
-                "1: tmll %1,0x00ff\n"
-                "   jno  2f\n"
-                "   aghi %0,8\n"
-                "   srlg %1,%1,8\n"
-                "2: ngr  %1,%2\n"
-                "   ic   %1,0(%1,%3)\n"
-                "   algr %0,%1"
-                : "=&d" (result), "+a" (word), "=&d" (reg)
-                : "a" (&_zb_findmap) : "cc" );
-        return result;
-}
-
-/*
- * __ffs = find first bit in word. Undefined if no bit exists,
- * so code should check against 0UL first..
- */
-static inline unsigned long __ffs (unsigned long word)
-{
-        unsigned long reg, result;
-
-        __asm__("   slgr %0,%0\n"
-                "   ltr  %1,%1\n"
-                "   jnz  0f\n"
-                "   aghi %0,32\n"
-                "   srlg %1,%1,32\n"
-                "0: lghi %2,0xff\n"
-                "   tmll %1,0xffff\n"
-                "   jnz  1f\n"
-                "   aghi %0,16\n"
-                "   srlg %1,%1,16\n"
-                "1: tmll %1,0x00ff\n"
-                "   jnz  2f\n"
-                "   aghi %0,8\n"
-                "   srlg %1,%1,8\n"
-                "2: ngr  %1,%2\n"
-                "   ic   %1,0(%1,%3)\n"
-                "   algr %0,%1"
-                : "=&d" (result), "+a" (word), "=&d" (reg)
-                : "a" (&_sb_findmap) : "cc" );
-        return result;
-}
-
-/*
- * Every architecture must define this function. It's the fastest
- * way of searching a 140-bit bitmap where the first 100 bits are
- * unlikely to be set. It's guaranteed that at least one of the 140
- * bits is cleared.
- */
-static inline int sched_find_first_bit(unsigned long *b)
-{
-	return find_first_bit(b, 140);
-}
-
-/*
- * ffs: find first bit set. This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-extern inline int ffs (int x)
-{
-        int r = 1;
-
-        if (x == 0)
-		return 0;
-        __asm__("    tml  %1,0xffff\n"
-                "    jnz  0f\n"
-                "    srl  %1,16\n"
-                "    ahi  %0,16\n"
-                "0:  tml  %1,0x00ff\n"
-                "    jnz  1f\n"
-                "    srl  %1,8\n"
-                "    ahi  %0,8\n"
-                "1:  tml  %1,0x000f\n"
-                "    jnz  2f\n"
-                "    srl  %1,4\n"
-                "    ahi  %0,4\n"
-                "2:  tml  %1,0x0003\n"
-                "    jnz  3f\n"
-                "    srl  %1,2\n"
-                "    ahi  %0,2\n"
-                "3:  tml  %1,0x0001\n"
-                "    jnz  4f\n"
-                "    ahi  %0,1\n"
-                "4:"
-                : "=&d" (r), "+d" (x) : : "cc" );
-        return r;
-}
-
-/*
- * fls: find last bit set.
- */
-extern __inline__ int fls(int x)
-{
-	int r = 32;
-
-	if (x == 0)
-		return 0;
-	__asm__("    tmh  %1,0xffff\n"
-		"    jz   0f\n"
-		"    sll  %1,16\n"
-		"    ahi  %0,-16\n"
-		"0:  tmh  %1,0xff00\n"
-		"    jz   1f\n"
-		"    sll  %1,8\n"
-		"    ahi  %0,-8\n"
-		"1:  tmh  %1,0xf000\n"
-		"    jz   2f\n"
-		"    sll  %1,4\n"
-		"    ahi  %0,-4\n"
-		"2:  tmh  %1,0xc000\n"
-		"    jz   3f\n"
-		"    sll  %1,2\n"
-		"    ahi  %0,-2\n"
-		"3:  tmh  %1,0x8000\n"
-		"    jz   4f\n"
-		"    ahi  %0,-1\n"
-		"4:"
-		: "+d" (r), "+d" (x) : : "cc" );
-	return r;
-}
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-#define hweight64(x)						\
-({								\
-	unsigned long __x = (x);				\
-	unsigned int __w;					\
-	__w = generic_hweight32((unsigned int) __x);		\
-	__w += generic_hweight32((unsigned int) (__x>>32));	\
-	__w;							\
-})
-#define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
-
-
-#ifdef __KERNEL__
-
-/*
- * ATTENTION: intel byte ordering convention for ext2 and minix !!
- * bit 0 is the LSB of addr; bit 31 is the MSB of addr;
- * bit 32 is the LSB of (addr+4).
- * That combined with the little endian byte order of Intel gives the
- * following bit order in memory:
- *    07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 \
- *    23 22 21 20 19 18 17 16 31 30 29 28 27 26 25 24
- */
-
-#define ext2_set_bit(nr, addr)       \
-	test_and_set_bit((nr)^56, (unsigned long *)addr)
-#define ext2_set_bit_atomic(lock, nr, addr)       \
-	        test_and_set_bit((nr)^56, (unsigned long *)addr)
-#define ext2_clear_bit(nr, addr)     \
-	test_and_clear_bit((nr)^56, (unsigned long *)addr)
-#define ext2_clear_bit_atomic(lock, nr, addr)     \
-	        test_and_clear_bit((nr)^56, (unsigned long *)addr)
-#define ext2_test_bit(nr, addr)      \
-	test_bit((nr)^56, (unsigned long *)addr)
-
-static inline unsigned long
-ext2_find_first_zero_bit(void *vaddr, unsigned long size)
-{
-        unsigned long res, cmp, count;
-
-        if (!size)
-                return 0;
-        __asm__("   lghi  %1,-1\n"
-                "   lgr   %2,%3\n"
-                "   aghi  %2,63\n"
-                "   srlg  %2,%2,6\n"
-                "   slgr  %0,%0\n"
-                "0: clg   %1,0(%0,%4)\n"
-                "   jne   1f\n"
-                "   aghi  %0,8\n"
-                "   brct  %2,0b\n"
-                "   lgr   %0,%3\n"
-                "   j     5f\n"
-                "1: cl    %1,0(%0,%4)\n"
-		"   jne   2f\n"
-		"   aghi  %0,4\n"
-		"2: l     %2,0(%0,%4)\n"
-                "   sllg  %0,%0,3\n"
-                "   aghi  %0,24\n"
-                "   lghi  %1,0xff\n"
-                "   tmlh  %2,0xffff\n"
-                "   jo    3f\n"
-                "   aghi  %0,-16\n"
-                "   srl   %2,16\n"
-                "3: tmll  %2,0xff00\n"
-                "   jo    4f\n"
-                "   aghi  %0,-8\n"
-                "   srl   %2,8\n"
-                "4: ngr   %2,%1\n"
-                "   ic    %2,0(%2,%5)\n"
-                "   algr  %0,%2\n"
-                "5:"
-                : "=&a" (res), "=&d" (cmp), "=&a" (count)
-		: "a" (size), "a" (vaddr), "a" (&_zb_findmap) : "cc" );
-        return (res < size) ? res : size;
-}
-
-static inline unsigned long
-ext2_find_next_zero_bit(void *vaddr, unsigned long size, unsigned long offset)
-{
-        unsigned long *addr = vaddr;
-        unsigned long *p = addr + (offset >> 6);
-        unsigned long word, reg;
-        unsigned long bit = offset & 63UL, res;
-
-        if (offset >= size)
-                return size;
-
-        if (bit) {
-                __asm__("   lrvg %0,%1" /* load reversed, neat instruction */
-                        : "=a" (word) : "m" (*p) );
-                word >>= bit;
-                res = bit;
-                /* Look for zero in first 8 byte word */
-                __asm__("   lghi %2,0xff\n"
-			"   tmll %1,0xffff\n"
-			"   jno  2f\n"
-			"   ahi  %0,16\n"
-			"   srlg %1,%1,16\n"
-                	"0: tmll %1,0xffff\n"
-                        "   jno  2f\n"
-                        "   ahi  %0,16\n"
-                        "   srlg %1,%1,16\n"
-                        "1: tmll %1,0xffff\n"
-                        "   jno  2f\n"
-                        "   ahi  %0,16\n"
-                        "   srl  %1,16\n"
-                        "2: tmll %1,0x00ff\n"
-                	"   jno  3f\n"
-                	"   ahi  %0,8\n"
-                	"   srl  %1,8\n"
-                	"3: ngr  %1,%2\n"
-                	"   ic   %1,0(%1,%3)\n"
-                	"   alr  %0,%1"
-                	: "+&d" (res), "+a" (word), "=&d" (reg)
-                  	: "a" (&_zb_findmap) : "cc" );
-                if (res < 64)
-			return (p - addr)*64 + res;
-                p++;
-        }
-        /* No zero yet, search remaining full bytes for a zero */
-        res = ext2_find_first_zero_bit (p, size - 64 * (p - addr));
-        return (p - addr) * 64 + res;
-}
-
-/* Bitmap functions for the minix filesystem.  */
-/* FIXME !!! */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
-
-#endif /* __KERNEL__ */
-
-#endif /* _S390_BITOPS_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/bug.h linux-2.5.67-bk6/include/asm-s390x/bug.h
--- linux-2.5.67-bk5/include/asm-s390x/bug.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/bug.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,13 +0,0 @@
-#ifndef _S390_BUG_H
-#define _S390_BUG_H
-
-#define BUG() do { \
-        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-        __asm__ __volatile__(".long 0"); \
-} while (0)                                       
-
-#define PAGE_BUG(page) do { \
-        BUG(); \
-} while (0)                      
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/bugs.h linux-2.5.67-bk6/include/asm-s390x/bugs.h
--- linux-2.5.67-bk5/include/asm-s390x/bugs.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/bugs.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,22 +0,0 @@
-/*
- *  include/asm-s390/bugs.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/bugs.h"
- *    Copyright (C) 1994  Linus Torvalds
- */
-
-/*
- * This is included by init/main.c to check for architecture-dependent bugs.
- *
- * Needs:
- *      void check_bugs(void);
- */
-
-static void __init check_bugs(void)
-{
-  /* s390 has no bugs ... */
-}
diff -urN linux-2.5.67-bk5/include/asm-s390x/byteorder.h linux-2.5.67-bk6/include/asm-s390x/byteorder.h
--- linux-2.5.67-bk5/include/asm-s390x/byteorder.h	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/byteorder.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,102 +0,0 @@
-#ifndef _S390_BYTEORDER_H
-#define _S390_BYTEORDER_H
-
-/*
- *  include/asm-s390/byteorder.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-#include <asm/types.h>
-
-#ifdef __GNUC__
-
-static __inline__ __const__ __u64 ___arch__swab64p(__u64 *x)
-{
-	__u64 result;
-
-	__asm__ __volatile__ (
-		"   lrvg %0,%1"
-		: "=d" (result) : "m" (*x) );
-	return result;
-}
-
-static __inline__ __const__ __u64 ___arch__swab64(__u64 x)
-{
-	__u64 result;
-
-	__asm__ __volatile__ (
-		"   lrvgr %0,%1"
-		: "=d" (result) : "d" (x) );
-	return result;
-}
-
-static __inline__ void ___arch__swab64s(__u64 *x)
-{
-	*x = ___arch__swab64p(x);
-}
-
-static __inline__ __const__ __u32 ___arch__swab32p(__u32 *x)
-{
-	__u32 result;
-	
-	__asm__ __volatile__ (
-		"   lrv  %0,%1"
-		: "=d" (result) : "m" (*x) );
-	return result;
-}
-
-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
-{
-	__u32 result;
-	
-	__asm__ __volatile__ (
-		"   lrvr  %0,%1"
-		: "=d" (result) : "d" (x) );
-	return result;
-}
-
-static __inline__ void ___arch__swab32s(__u32 *x)
-{
-	*x = ___arch__swab32p(x);
-}
-
-static __inline__ __const__ __u16 ___arch__swab16p(__u16 *x)
-{
-	__u16 result;
-	
-	__asm__ __volatile__ (
-		"   lrvh %0,%1"
-		: "=d" (result) : "m" (*x) );
-	return result;
-}
-
-static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
-{
-	return ___arch__swab16p(&x);
-}
-
-static __inline__ void ___arch__swab16s(__u16 *x)
-{
-	*x = ___arch__swab16p(x);
-}
-
-#define __arch__swab64(x) ___arch__swab64(x)
-#define __arch__swab32(x) ___arch__swab32(x)
-#define __arch__swab16(x) ___arch__swab16(x)
-#define __arch__swab64p(x) ___arch__swab64p(x)
-#define __arch__swab32p(x) ___arch__swab32p(x)
-#define __arch__swab16p(x) ___arch__swab16p(x)
-#define __arch__swab64s(x) ___arch__swab64s(x)
-#define __arch__swab32s(x) ___arch__swab32s(x)
-#define __arch__swab16s(x) ___arch__swab16s(x)
-
-#define __BYTEORDER_HAS_U64__
-
-#endif /* __GNUC__ */
-
-#include <linux/byteorder/big_endian.h>
-
-#endif /* _S390_BYTEORDER_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/cache.h linux-2.5.67-bk6/include/asm-s390x/cache.h
--- linux-2.5.67-bk5/include/asm-s390x/cache.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/cache.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,18 +0,0 @@
-/*
- *  include/asm-s390/cache.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *
- *  Derived from "include/asm-i386/cache.h"
- *    Copyright (C) 1992, Linus Torvalds
- */
-
-#ifndef __ARCH_S390_CACHE_H
-#define __ARCH_S390_CACHE_H
-
-#define L1_CACHE_BYTES     256
-#define L1_CACHE_SHIFT     8
-#define L1_CACHE_SHIFT_MAX 8	/* largest L1 which this arch supports */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/cacheflush.h linux-2.5.67-bk6/include/asm-s390x/cacheflush.h
--- linux-2.5.67-bk5/include/asm-s390x/cacheflush.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/cacheflush.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,17 +0,0 @@
-#ifndef _S390X_CACHEFLUSH_H
-#define _S390X_CACHEFLUSH_H
-
-/* Keep includes the same across arches.  */
-#include <linux/mm.h>
-
-/* Caches aren't brain-dead on the s390. */
-#define flush_cache_all()			do { } while (0)
-#define flush_cache_mm(mm)			do { } while (0)
-#define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
-#define flush_dcache_page(page)			do { } while (0)
-#define flush_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)
-
-#endif /* _S390X_CACHEFLUSH_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/ccwdev.h linux-2.5.67-bk6/include/asm-s390x/ccwdev.h
--- linux-2.5.67-bk5/include/asm-s390x/ccwdev.h	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ccwdev.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,185 +0,0 @@
-/*
- *  include/asm-s390/ccwdev.h
- *  include/asm-s390x/ccwdev.h
- *
- *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Arnd Bergmann <arndb@de.ibm.com>
- *
- *  Interface for CCW device drivers
- */
-#ifndef _S390_CCWDEV_H_
-#define _S390_CCWDEV_H_
-
-#include <linux/device.h>
-
-/* structs from asm/cio.h */
-struct irb;
-struct ccw1;
-
-/* the id is used to identify what hardware a device driver supports. It 
- * is used both by the ccw subsystem driver for probing and from
- * user space for automatic module loading.
- *
- * References:
- *   - struct usb_device_id (include/linux/usb.h)
- *   - devreg_hc_t (include/linux/s390dyn.h)
- *   - chandev_model_info (drivers/s390/misc/chandev.c)
- */
-struct ccw_device_id {
-	__u16	match_flags;	/* which fields to match against */
-
-	__u16	cu_type;	/* control unit type     */
-	__u16	dev_type;	/* device type           */
-	__u8	cu_model;	/* control unit model    */
-	__u8	dev_model;	/* device model          */
-
-	unsigned long driver_info;
-};
-
-enum match_flag {
-	CCW_DEVICE_ID_MATCH_CU_TYPE      = 0x01,
-	CCW_DEVICE_ID_MATCH_CU_MODEL     = 0x02,
-	CCW_DEVICE_ID_MATCH_DEVICE_TYPE  = 0x04,
-	CCW_DEVICE_ID_MATCH_DEVICE_MODEL = 0x08,
-	/* CCW_DEVICE_ID_MATCH_ANY	     = 0x10, */
-};
-
-/* simplified initializers for struct ccw_device:
- * CCW_DEVICE and CCW_DEVICE_DEVTYPE initialize one
- * entry in your MODULE_DEVICE_TABLE and set the match_flag correctly */
-#define CCW_DEVICE(cu, cum) 						\
-	.cu_type=(cu), .cu_model=(cum),					\
-	.match_flags=(CCW_DEVICE_ID_MATCH_CU_TYPE			\
-		   | (cum ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0))
-
-#define CCW_DEVICE_DEVTYPE(cu, cum, dev, devm)				\
-	.cu_type=(cu), .cu_model=(cum), .dev_type=(dev), .dev_model=(devm),\
-	.match_flags=CCW_DEVICE_ID_MATCH_CU_TYPE			\
-		   | ((cum) ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0) 	\
-		   | CCW_DEVICE_ID_MATCH_DEVICE_TYPE			\
-		   | ((devm) ? CCW_DEVICE_ID_MATCH_DEVICE_MODEL : 0)
-
-/* scan through an array of device ids and return the first
- * entry that matches the device.
- *
- * the array must end with an entry containing zero match_flags
- */
-static inline const struct ccw_device_id *
-ccw_device_id_match(const struct ccw_device_id *array,
-			const struct ccw_device_id *match)
-{
-	const struct ccw_device_id *id = array;
-
-	for (id = array; id->match_flags; id++) {
-		if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_TYPE)
-		    && (id->cu_type != match->cu_type))
-			continue;
-
-		if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_MODEL)
-		    && (id->cu_model != match->cu_model))
-			continue;
-
-		if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_TYPE)
-		    && (id->dev_type != match->dev_type))
-			continue;
-
-		if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_MODEL)
-		    && (id->dev_model != match->dev_model))
-			continue;
-
-		return id;
-	}
-
-	return 0;
-}
-
-/* The struct ccw device is our replacement for the globally accessible
- * ioinfo array. ioinfo will mutate into a subchannel device later.
- *
- * Reference: Documentation/driver-model.txt */
-struct ccw_device {
-	spinlock_t *ccwlock;
-	struct ccw_device_private *private;	/* cio private information */
-	struct ccw_device_id id;	/* id of this device, driver_info is
-					   set by ccw_find_driver */
-	struct ccw_driver *drv;		/* */
-	struct device dev;		/* */
-	int online;
-	/* This is sick, but a driver can have different interrupt handlers 
-	   for different ccw_devices (multi-subchannel drivers)... */
-	void (*handler) (struct ccw_device *, unsigned long, struct irb *);
-};
-
-
-/* Each ccw driver registers with the ccw root bus */
-struct ccw_driver {
-	struct module *owner;		/* for automatic MOD_INC_USE_COUNT   */
-	struct ccw_device_id *ids;	/* probe driver with these devs      */
-	int (*probe) (struct ccw_device *); /* ask driver to probe dev 	     */
-	int (*remove) (struct ccw_device *);
-					/* device is no longer available     */
-	int (*set_online) (struct ccw_device *);
-	int (*set_offline) (struct ccw_device *);
-	struct device_driver driver;	/* higher level structure, don't init
-					   this from your driver	     */
-	char *name;
-};
-
-extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
-					      const char *bus_id);
-
-/* devices drivers call these during module load and unload.
- * When a driver is registered, its probe method is called
- * when new devices for its type pop up */
-extern int  ccw_driver_register   (struct ccw_driver *driver);
-extern void ccw_driver_unregister (struct ccw_driver *driver);
-
-struct ccw1;
-
-extern int ccw_device_set_options(struct ccw_device *, unsigned long);
-
-/* Allow for i/o completion notification after primary interrupt status. */
-#define CCWDEV_EARLY_NOTIFICATION	0x0001
-/* Report all interrupt conditions. */
-#define CCWDEV_REPORT_ALL	 	0x0002
-
-/*
- * ccw_device_start()
- *
- *  Start a S/390 channel program. When the interrupt arrives, the
- *  IRQ handler is called, either immediately, delayed (dev-end missing,
- *  or sense required) or never (no IRQ handler registered).
- *  Depending on the action taken, ccw_device_start() returns:  
- *                           0	     - Success
- *			     -EBUSY  - Device busy, or status pending
- *			     -ENODEV - Device not operational
- *                           -EINVAL - Device invalid for operation
- */
-extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
-			    unsigned long, __u8, unsigned long);
-extern int ccw_device_resume(struct ccw_device *);
-extern int ccw_device_halt(struct ccw_device *, unsigned long);
-extern int ccw_device_clear(struct ccw_device *, unsigned long);
-
-extern int read_dev_chars(struct ccw_device *cdev, void **buffer, int length);
-extern int read_conf_data(struct ccw_device *cdev, void **buffer, int *length);
-
-extern void ccw_device_set_online(struct ccw_device *cdev);
-extern void ccw_device_set_offline(struct ccw_device *cdev);
-
-
-extern struct ciw *ccw_device_get_ciw(struct ccw_device *, __u32 cmd);
-extern __u8 ccw_device_get_path_mask(struct ccw_device *);
-
-#define get_ccwdev_lock(x) (x)->ccwlock
-
-#define to_ccwdev(n) container_of(n, struct ccw_device, dev)
-#define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
-
-extern struct ccw_device *ccw_device_probe_console(void);
-
-// FIXME: these have to go
-extern int _ccw_device_get_device_number(struct ccw_device *);
-extern int _ccw_device_get_subchannel_number(struct ccw_device *);
-
-#endif /* _S390_CCWDEV_H_ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/ccwgroup.h linux-2.5.67-bk6/include/asm-s390x/ccwgroup.h
--- linux-2.5.67-bk5/include/asm-s390x/ccwgroup.h	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ccwgroup.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,44 +0,0 @@
-#ifndef S390_CCWGROUP_H
-#define S390_CCWGROUP_H
-
-struct ccw_device;
-struct ccw_driver;
-
-struct ccwgroup_device {
-	unsigned long creator_id;	/* unique number of the driver */
-	enum {
-		CCWGROUP_OFFLINE,
-		CCWGROUP_ONLINE,
-	} state;
-	unsigned int count;		/* number of attached slave devices */
-	struct device	dev;		/* master device		    */
-	struct ccw_device *cdev[0];	/* variable number, allocate as needed */
-};
-
-struct ccwgroup_driver {
-	char *name;
-	int max_slaves;
-	unsigned long driver_id;
-
-	int (*probe) (struct ccwgroup_device *);
-	int (*remove) (struct ccwgroup_device *);
-	int (*release) (struct ccwgroup_driver *);
-	int (*set_online) (struct ccwgroup_device *);
-	int (*set_offline) (struct ccwgroup_device *);
-
-	struct device_driver driver;		/* this driver */
-};
-
-extern int  ccwgroup_driver_register   (struct ccwgroup_driver *cdriver);
-extern void ccwgroup_driver_unregister (struct ccwgroup_driver *cdriver);
-extern int ccwgroup_create (struct device *root,
-			    unsigned int creator_id,
-			    struct ccw_driver *gdrv,
-			    int argc, char *argv[]);
-
-extern int ccwgroup_probe_ccwdev(struct ccw_device *cdev);
-extern int ccwgroup_remove_ccwdev(struct ccw_device *cdev);
-
-#define to_ccwgroupdev(x) container_of((x), struct ccwgroup_device, dev)
-#define to_ccwgroupdrv(x) container_of((x), struct ccwgroup_driver, driver)
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/checksum.h linux-2.5.67-bk6/include/asm-s390x/checksum.h
--- linux-2.5.67-bk5/include/asm-s390x/checksum.h	2003-04-07 10:32:30.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/checksum.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,195 +0,0 @@
-#ifndef _S390_CHECKSUM_H
-#define _S390_CHECKSUM_H
-
-/*
- *  include/asm-s390/checksum.h
- *    S390 fast network checksum routines
- *    see also arch/S390/lib/checksum.c
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Ulrich Hild        (first version)
- *               Martin Schwidefsky (heavily optimized CKSM version)
- *               D.J. Barrow        (third attempt) 
- */
-
-#include <asm/uaccess.h>
-
-/*
- * computes the checksum of a memory block at buff, length len,
- * and adds in "sum" (32-bit)
- *
- * returns a 32-bit number suitable for feeding into itself
- * or csum_tcpudp_magic
- *
- * this function must be called with even lengths, except
- * for the last fragment, which may be odd
- *
- * it's best to have buff aligned on a 32-bit boundary
- */
-static inline unsigned int
-csum_partial(const unsigned char * buff, int len, unsigned int sum)
-{
-	/*
-	 * Experiments with ethernet and slip connections show that buff
-	 * is aligned on either a 2-byte or 4-byte boundary.
-	 */
-        __asm__ __volatile__ (
-                "    lgr  2,%1\n"    /* address in gpr 2 */
-                "    lgfr 3,%2\n"    /* length in gpr 3 */
-                "0:  cksm %0,2\n"    /* do checksum on longs */
-                "    jo   0b\n"
-                : "+&d" (sum)
-                : "d" (buff), "d" (len)
-                : "cc", "2", "3" );
-        return sum;
-	
-}
-
-/*
- * csum_partial as an inline function
- */
-static inline unsigned int 
-csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
-{
-	__asm__ __volatile__ (
-		"    lgr  2,%1\n"    /* address in gpr 2 */
-		"    lgfr 3,%2\n"    /* length in gpr 3 */
-		"0:  cksm %0,2\n"    /* do checksum on longs */
-		"    jo   0b\n"
-                : "+&d" (sum)
-		: "d" (buff), "d" (len)
-                : "cc", "2", "3" );
-	return sum;
-}
-
-/*
- * the same as csum_partial_copy, but copies from user space.
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- *
- * 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,
-                                          int len, unsigned int sum,
-                                          int *err_ptr)
-{
-	int missing;
-
-	missing = copy_from_user(dst, src, len);
-	if (missing) {
-		memset(dst + len - missing, 0, missing);
-		*err_ptr = -EFAULT;
-	}
-		
-	return csum_partial(dst, len, sum);
-}
-
-static inline unsigned int
-csum_partial_copy_nocheck (const char *src, char *dst, int len, unsigned int sum)
-{
-        memcpy(dst,src,len);
-        return csum_partial_inline(dst, len, sum);
-}
-
-/*
- *      Fold a partial checksum without adding pseudo headers
- */
-static inline unsigned short
-csum_fold(unsigned int sum)
-{
-	__asm__ __volatile__ (
-		"    sr   3,3\n"   /* %0 = H*65536 + L */
-		"    lr   2,%0\n"  /* %0 = H L, R2/R3 = H L / 0 0 */
-		"    srdl 2,16\n"  /* %0 = H L, R2/R3 = 0 H / L 0 */
-		"    alr  2,3\n"   /* %0 = H L, R2/R3 = L H / L 0 */
-		"    alr  %0,2\n"  /* %0 = H+L+C L+H */
-                "    srl  %0,16\n" /* %0 = H+L+C */
-		: "+&d" (sum) : : "cc", "2", "3");
-	return ((unsigned short) ~sum);
-}
-
-/*
- *	This is a version of ip_compute_csum() optimized for IP headers,
- *	which always checksum on 4 octet boundaries.
- *
- */
-static inline unsigned short
-ip_fast_csum(unsigned char *iph, unsigned int ihl)
-{
-	unsigned long sum;
-
-        __asm__ __volatile__ (
-		"    slgr %0,%0\n"   /* set sum to zero */
-                "    lgr  2,%1\n"    /* address in gpr 2 */
-                "    lgfr 3,%2\n"    /* length in gpr 3 */
-                "0:  cksm %0,2\n"    /* do checksum on ints */
-                "    jo   0b\n"
-                : "=&d" (sum)
-                : "d" (iph), "d" (ihl*4)
-                : "cc", "2", "3" );
-        return csum_fold(sum);
-}
-
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 32-bit checksum
- */
-static inline unsigned int 
-csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
-                   unsigned short len, unsigned short proto,
-                   unsigned int sum)
-{
-	__asm__ __volatile__ (
-                "    lgfr  %0,%0\n"
-                "    algr  %0,%1\n"  /* sum += saddr */
-                "    brc   12,0f\n"
-		"    aghi  %0,1\n"   /* add carry */
-		"0:  algr  %0,%2\n"  /* sum += daddr */
-                "    brc   12,1f\n"
-                "    aghi  %0,1\n"   /* add carry */
-		"1:  algfr %0,%3\n"  /* sum += (len<<16) + proto */
-		"    brc   12,2f\n"
-		"    aghi  %0,1\n"   /* add carry */
-		"2:  srlg  0,%0,32\n"
-                "    alr   %0,0\n"   /* fold to 32 bits */
-                "    brc   12,3f\n"
-                "    ahi   %0,1\n"   /* add carry */
-                "3:  llgfr %0,%0"
-		: "+&d" (sum)
-		: "d" (saddr), "d" (daddr),
-		  "d" (((unsigned int) len<<16) + (unsigned int) proto)
-		: "cc", "0" );
-	return sum;
-}
-
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
- */
-
-static inline unsigned short int
-csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
-                  unsigned short len, unsigned short proto,
-                  unsigned int sum)
-{
-	return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
-}
-
-/*
- * this routine is used for miscellaneous IP-like checksums, mainly
- * in icmp.c
- */
-
-static inline unsigned short
-ip_compute_csum(unsigned char * buff, int len)
-{
-	return csum_fold(csum_partial_inline(buff, len, 0));
-}
-
-#endif /* _S390_CHECKSUM_H */
-
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/cio.h linux-2.5.67-bk6/include/asm-s390x/cio.h
--- linux-2.5.67-bk5/include/asm-s390x/cio.h	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/cio.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,269 +0,0 @@
-/*
- *  include/asm-s390/cio.h
- *  include/asm-s390x/cio.h
- *
- * Common interface for I/O on S/390
- */
-#ifndef _ASM_S390_CIO_H_
-#define _ASM_S390_CIO_H_
-
-#include <linux/spinlock.h>
-#include <asm/types.h>
-
-#ifdef __KERNEL__
-
-#define LPM_ANYPATH 0xff
-
-/*
- * subchannel status word
- */
-struct scsw {
-	__u32 key  : 4;		/* subchannel key */
-	__u32 sctl : 1; 	/* suspend control */
-	__u32 eswf : 1; 	/* ESW format */
-	__u32 cc   : 2; 	/* deferred condition code */
-	__u32 fmt  : 1; 	/* format */
-	__u32 pfch : 1; 	/* prefetch */
-	__u32 isic : 1; 	/* initial-status interruption control */
-	__u32 alcc : 1; 	/* address-limit checking control */
-	__u32 ssi  : 1; 	/* supress-suspended interruption */
-	__u32 zcc  : 1; 	/* zero condition code */
-	__u32 ectl : 1; 	/* extended control */
-	__u32 pno  : 1;	    	/* path not operational */
-	__u32 res  : 1;	    	/* reserved */
-	__u32 fctl : 3;	    	/* function control */
-	__u32 actl : 7;	    	/* activity control */
-	__u32 stctl : 5;    	/* status control */
-	__u32 cpa;	    	/* channel program address */
-	__u32 dstat : 8;    	/* device status */
-	__u32 cstat : 8;    	/* subchannel status */
-	__u32 count : 16;   	/* residual count */
-} __attribute__ ((packed));
-
-#define SCSW_FCTL_CLEAR_FUNC	 0x1
-#define SCSW_FCTL_HALT_FUNC	 0x2
-#define SCSW_FCTL_START_FUNC	 0x4
-
-#define SCSW_ACTL_SUSPENDED	 0x1
-#define SCSW_ACTL_DEVACT	 0x2
-#define SCSW_ACTL_SCHACT	 0x4
-#define SCSW_ACTL_CLEAR_PEND	 0x8
-#define SCSW_ACTL_HALT_PEND	 0x10
-#define SCSW_ACTL_START_PEND	 0x20
-#define SCSW_ACTL_RESUME_PEND	 0x40
-
-#define SCSW_STCTL_STATUS_PEND	 0x1
-#define SCSW_STCTL_SEC_STATUS	 0x2
-#define SCSW_STCTL_PRIM_STATUS	 0x4
-#define SCSW_STCTL_INTER_STATUS	 0x8
-#define SCSW_STCTL_ALERT_STATUS	 0x10
-
-#define DEV_STAT_ATTENTION	 0x80
-#define DEV_STAT_STAT_MOD	 0x40
-#define DEV_STAT_CU_END		 0x20
-#define DEV_STAT_BUSY		 0x10
-#define DEV_STAT_CHN_END	 0x08
-#define DEV_STAT_DEV_END	 0x04
-#define DEV_STAT_UNIT_CHECK	 0x02
-#define DEV_STAT_UNIT_EXCEP	 0x01
-
-#define SCHN_STAT_PCI		 0x80
-#define SCHN_STAT_INCORR_LEN	 0x40
-#define SCHN_STAT_PROG_CHECK	 0x20
-#define SCHN_STAT_PROT_CHECK	 0x10
-#define SCHN_STAT_CHN_DATA_CHK	 0x08
-#define SCHN_STAT_CHN_CTRL_CHK	 0x04
-#define SCHN_STAT_INTF_CTRL_CHK	 0x02
-#define SCHN_STAT_CHAIN_CHECK	 0x01
-
-/*
- * architectured values for first sense byte
- */
-#define SNS0_CMD_REJECT		0x80
-#define SNS_CMD_REJECT		SNS0_CMD_REJEC
-#define SNS0_INTERVENTION_REQ	0x40
-#define SNS0_BUS_OUT_CHECK	0x20
-#define SNS0_EQUIPMENT_CHECK	0x10
-#define SNS0_DATA_CHECK		0x08
-#define SNS0_OVERRUN		0x04
-#define SNS0_INCOMPL_DOMAIN	0x01
-
-/*
- * architectured values for second sense byte
- */
-#define SNS1_PERM_ERR		0x80
-#define SNS1_INV_TRACK_FORMAT	0x40
-#define SNS1_EOC		0x20
-#define SNS1_MESSAGE_TO_OPER	0x10
-#define SNS1_NO_REC_FOUND	0x08
-#define SNS1_FILE_PROTECTED	0x04
-#define SNS1_WRITE_INHIBITED	0x02
-#define SNS1_INPRECISE_END	0x01
-
-/*
- * architectured values for third sense byte
- */
-#define SNS2_REQ_INH_WRITE	0x80
-#define SNS2_CORRECTABLE	0x40
-#define SNS2_FIRST_LOG_ERR	0x20
-#define SNS2_ENV_DATA_PRESENT	0x10
-#define SNS2_INPRECISE_END	0x04
-
-struct ccw1 {
-	__u8  cmd_code;		/* command code */
-	__u8  flags;   		/* flags, like IDA addressing, etc. */
-	__u16 count;   		/* byte count */
-	__u32 cda;     		/* data address */
-} __attribute__ ((packed,aligned(8)));
-
-#define CCW_FLAG_DC		0x80
-#define CCW_FLAG_CC		0x40
-#define CCW_FLAG_SLI		0x20
-#define CCW_FLAG_SKIP		0x10
-#define CCW_FLAG_PCI		0x08
-#define CCW_FLAG_IDA		0x04
-#define CCW_FLAG_SUSPEND	0x02
-
-#define CCW_CMD_READ_IPL	0x02
-#define CCW_CMD_NOOP		0x03
-#define CCW_CMD_BASIC_SENSE	0x04
-#define CCW_CMD_TIC		0x08
-#define CCW_CMD_SENSE_PGID	0x34
-#define CCW_CMD_SUSPEND_RECONN	0x5B
-#define CCW_CMD_RDC		0x64
-#define CCW_CMD_SET_PGID	0xAF
-#define CCW_CMD_SENSE_ID	0xE4
-#define CCW_CMD_DCTL		0xF3
-
-#define SENSE_MAX_COUNT		0x20
-
-struct erw {
-	__u32 res0  : 3;  	/* reserved */
-	__u32 auth  : 1;	/* Authorization check */
-	__u32 pvrf  : 1;  	/* path-verification-required flag */
-	__u32 cpt   : 1;  	/* channel-path timeout */
-	__u32 fsavf : 1;  	/* Failing storage address validity flag */
-	__u32 cons  : 1;  	/* concurrent-sense */
-	__u32 scavf : 1;	/* Secondary ccw address validity flag */
-	__u32 fsaf  : 1;	/* Failing storage address format */
-	__u32 scnt  : 6;  	/* sense count if cons == 1 */
-	__u32 res16 : 16; 	/* reserved */
-} __attribute__ ((packed));
-
-/*
- * subchannel logout area
- */
-struct sublog {
-	__u32 res0  : 1;  	/* reserved */
-	__u32 esf   : 7;  	/* extended status flags */
-	__u32 lpum  : 8;  	/* last path used mask */
-	__u32 arep  : 1;  	/* ancillary report */
-	__u32 fvf   : 5;  	/* field-validity flags */
-	__u32 sacc  : 2;  	/* storage access code */
-	__u32 termc : 2;  	/* termination code */
-	__u32 devsc : 1;  	/* device-status check */
-	__u32 serr  : 1;  	/* secondary error */
-	__u32 ioerr : 1;  	/* i/o-error alert */
-	__u32 seqc  : 3;  	/* sequence code */
-} __attribute__ ((packed));
-
-/*
- * Format 0 Extended Status Word (ESW)
- */
-struct esw0 {
-	struct sublog sublog;	/* subchannel logout */
-	struct erw erw;	    	/* extended report word */
-	__u32  faddr[2];    	/* failing storage address */
-	__u32  saddr;  		/* secondary ccw address */
-} __attribute__ ((packed));
-
-/*
- * Format 1 Extended Status Word (ESW)
- */
-struct esw1 {
-	__u8  zero0;		/* reserved zeros */
-	__u8  lpum;		/* last path used mask */
-	__u16 zero16;		/* reserved zeros */
-	struct erw erw;		/* extended report word */
-	__u32 zeros[3]; 	/* 2 fullwords of zeros */
-} __attribute__ ((packed));
-
-/*
- * Format 2 Extended Status Word (ESW)
- */
-struct esw2 {
-	__u8  zero0;		/* reserved zeros */
-	__u8  lpum;		/* last path used mask */
-	__u16 dcti;		/* device-connect-time interval */
-	struct erw erw;		/* extended report word */
-	__u32 zeros[3]; 	/* 2 fullwords of zeros */
-} __attribute__ ((packed));
-
-/*
- * Format 3 Extended Status Word (ESW)
- */
-struct esw3 {
-	__u8  zero0;		/* reserved zeros */
-	__u8  lpum;		/* last path used mask */
-	__u16 res;		/* reserved */
-	struct erw erw;		/* extended report word */
-	__u32 zeros[3]; 	/* 2 fullwords of zeros */
-} __attribute__ ((packed));
-
-/*
- * interruption response block
- */
-struct irb {
-	struct scsw scsw;	/* subchannel status word */
-	union {			/* extended status word, 4 formats */
-		struct esw0 esw0;
-		struct esw1 esw1;
-		struct esw2 esw2;
-		struct esw3 esw3;
-	} esw;
-	__u8   ecw[32];		/* extended control word */
-} __attribute__ ((packed,aligned(4)));
-
-/*
- * command information word  (CIW) layout
- */
-struct ciw {
-	__u32 et       :  2; 	/* entry type */
-	__u32 reserved :  2; 	/* reserved */
-	__u32 ct       :  4; 	/* command type */
-	__u32 cmd      :  8; 	/* command */
-	__u32 count    : 16; 	/* coun */
-} __attribute__ ((packed));
-
-#define CIW_TYPE_RCD	0x0    	/* read configuration data */
-#define CIW_TYPE_SII	0x1    	/* set interface identifier */
-#define CIW_TYPE_RNI	0x2    	/* read node identifier */
-
-/*
- * Flags used as input parameters for do_IO()
- */
-#define DOIO_ALLOW_SUSPEND	 0x0001 /* allow for channel prog. suspend */
-#define DOIO_DENY_PREFETCH	 0x0002 /* don't allow for CCW prefetch */
-#define DOIO_SUPPRESS_INTER	 0x0004 /* suppress intermediate inter. */
-					/* ... for suspended CCWs */
-
-struct diag210 {
-	__u16 vrdcdvno : 16;   /* device number (input) */
-	__u16 vrdclen  : 16;   /* data block length (input) */
-	__u32 vrdcvcla : 8;    /* virtual device class (output) */
-	__u32 vrdcvtyp : 8;    /* virtual device type (output) */
-	__u32 vrdcvsta : 8;    /* virtual device status (output) */
-	__u32 vrdcvfla : 8;    /* virtual device flags (output) */
-	__u32 vrdcrccl : 8;    /* real device class (output) */
-	__u32 vrdccrty : 8;    /* real device type (output) */
-	__u32 vrdccrmd : 8;    /* real device model (output) */
-	__u32 vrdccrft : 8;    /* real device feature (output) */
-} __attribute__ ((packed,aligned(4)));
-
-extern int diag210(struct diag210 *addr);
-
-extern void wait_cons_dev(void);
-
-#endif
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/compat.h linux-2.5.67-bk6/include/asm-s390x/compat.h
--- linux-2.5.67-bk5/include/asm-s390x/compat.h	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/compat.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,122 +0,0 @@
-#ifndef _ASM_S390X_COMPAT_H
-#define _ASM_S390X_COMPAT_H
-/*
- * Architecture specific compatibility types
- */
-#include <linux/types.h>
-
-#define COMPAT_USER_HZ	100
-
-typedef u32		compat_size_t;
-typedef s32		compat_ssize_t;
-typedef s32		compat_time_t;
-typedef s32		compat_clock_t;
-typedef s32		compat_pid_t;
-typedef u16		compat_uid_t;
-typedef u16		compat_gid_t;
-typedef u16		compat_mode_t;
-typedef u32		compat_ino_t;
-typedef u16		compat_dev_t;
-typedef s32		compat_off_t;
-typedef s64		compat_loff_t;
-typedef u16		compat_nlink_t;
-typedef u16		compat_ipc_pid_t;
-typedef s32		compat_daddr_t;
-typedef u32		compat_caddr_t;
-typedef __kernel_fsid_t	compat_fsid_t;
-
-typedef s32		compat_int_t;
-typedef s32		compat_long_t;
-typedef u32		compat_uint_t;
-typedef u32		compat_ulong_t;
-
-struct compat_timespec {
-	compat_time_t	tv_sec;
-	s32		tv_nsec;
-};
-
-struct compat_timeval {
-	compat_time_t	tv_sec;
-	s32		tv_usec;
-};
-
-struct compat_stat {
-	compat_dev_t	st_dev;
-	u16		__pad1;
-	compat_ino_t	st_ino;
-	compat_mode_t	st_mode;
-	compat_nlink_t	st_nlink;
-	compat_uid_t	st_uid;
-	compat_gid_t	st_gid;
-	compat_dev_t	st_rdev;
-	u16		__pad2;
-	u32		st_size;
-	u32		st_blksize;
-	u32		st_blocks;
-	u32		st_atime;
-	u32		st_atime_nsec;
-	u32		st_mtime;
-	u32		st_mtime_nsec;
-	u32		st_ctime;
-	u32		st_ctime_nsec;
-	u32		__unused4;
-	u32		__unused5;
-};
-
-struct compat_flock {
-	short		l_type;
-	short		l_whence;
-	compat_off_t	l_start;
-	compat_off_t	l_len;
-	compat_pid_t	l_pid;
-};
-
-#define F_GETLK64       12
-#define F_SETLK64       13
-#define F_SETLKW64      14    
-
-struct compat_flock64 {
-	short		l_type;
-	short		l_whence;
-	compat_loff_t	l_start;
-	compat_loff_t	l_len;
-	compat_pid_t	l_pid;
-};
-
-struct compat_statfs {
-	s32		f_type;
-	s32		f_bsize;
-	s32		f_blocks;
-	s32		f_bfree;
-	s32		f_bavail;
-	s32		f_files;
-	s32		f_ffree;
-	compat_fsid_t	f_fsid;
-	s32		f_namelen;
-	s32		f_spare[6];
-};
-
-typedef u32		compat_old_sigset_t;	/* at least 32 bits */
-
-#define _COMPAT_NSIG		64
-#define _COMPAT_NSIG_BPW	32
-
-typedef u32		compat_sigset_word;
-
-#define COMPAT_OFF_T_MAX	0x7fffffff
-#define COMPAT_LOFF_T_MAX	0x7fffffffffffffffL
-
-/*
- * A pointer passed in from user mode. This should not
- * be used for syscall parameters, just declare them
- * as pointers because the syscall entry code will have
- * appropriately comverted them already.
- */
-typedef	u32		compat_uptr_t;
-
-static inline void *compat_ptr(compat_uptr_t uptr)
-{
-	return (void *)(unsigned long)(uptr & 0x7fffffffUL);
-}
-
-#endif /* _ASM_S390X_COMPAT_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/cpcmd.h linux-2.5.67-bk6/include/asm-s390x/cpcmd.h
--- linux-2.5.67-bk5/include/asm-s390x/cpcmd.h	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/cpcmd.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,14 +0,0 @@
-/*
- *  arch/s390/kernel/cpcmd.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-#ifndef __CPCMD__
-#define __CPCMD__
-
-extern void cpcmd(char *cmd, char *response, int rlen);
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/current.h linux-2.5.67-bk6/include/asm-s390x/current.h
--- linux-2.5.67-bk5/include/asm-s390x/current.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/current.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,29 +0,0 @@
-/*
- *  include/asm-s390/current.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/current.h"
- */
-
-#ifndef _S390_CURRENT_H
-#define _S390_CURRENT_H
-
-#ifdef __KERNEL__
-
-#include <linux/thread_info.h>
-
-struct task_struct;
-
-static inline struct task_struct * get_current(void)
-{
-        return current_thread_info()->task;
-}
-
-#define current get_current()
-
-#endif
-
-#endif /* !(_S390_CURRENT_H) */
diff -urN linux-2.5.67-bk5/include/asm-s390x/dasd.h linux-2.5.67-bk6/include/asm-s390x/dasd.h
--- linux-2.5.67-bk5/include/asm-s390x/dasd.h	2003-04-07 10:30:59.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/dasd.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,268 +0,0 @@
-/* 
- * File...........: linux/drivers/s390/block/dasd.c
- * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
- * Bugreports.to..: <Linux390@de.ibm.com>
- * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
- *
- * This file is the interface of the DASD device driver, which is exported to user space
- * any future changes wrt the API will result in a change of the APIVERSION reported
- * to userspace by the DASDAPIVER-ioctl
- *
- * $Revision: 1.3 $
- *
- * History of changes (starts July 2000)
- * 05/04/01 created by moving the kernel interface to drivers/s390/block/dasd_int.h
- * 12/06/01 DASD_API_VERSION 2 - binary compatible to 0 (new BIODASDINFO2)
- * 01/23/02 DASD_API_VERSION 3 - added BIODASDPSRD (and BIODASDENAPAV) IOCTL
- * 02/15/02 DASD_API_VERSION 4 - added BIODASDSATTR IOCTL
- * ##/##/## DASD_API_VERSION 5 - added boxed dasd support TOBEDONE
- * 21/06/02 DASD_API_VERSION 6 - fixed HDIO_GETGEO: geo.start is in sectors!
- *         
- */
-
-#ifndef DASD_H
-#define DASD_H
-#include <linux/ioctl.h>
-
-#define DASD_IOCTL_LETTER 'D'
-
-#define DASD_API_VERSION 6
-
-/* 
- * struct dasd_information2_t
- * represents any data about the device, which is visible to userspace.
- *  including foramt and featueres.
- */
-typedef struct dasd_information2_t {
-        unsigned int devno;         /* S/390 devno */
-        unsigned int real_devno;    /* for aliases */
-        unsigned int schid;         /* S/390 subchannel identifier */
-        unsigned int cu_type  : 16; /* from SenseID */
-        unsigned int cu_model :  8; /* from SenseID */
-        unsigned int dev_type : 16; /* from SenseID */
-        unsigned int dev_model : 8; /* from SenseID */
-        unsigned int open_count; 
-        unsigned int req_queue_len; 
-        unsigned int chanq_len;     /* length of chanq */
-        char type[4];               /* from discipline.name, 'none' for unknown */
-        unsigned int status;        /* current device level */
-        unsigned int label_block;   /* where to find the VOLSER */
-        unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
-        unsigned int characteristics_size;
-        unsigned int confdata_size;
-        char characteristics[64];   /* from read_device_characteristics */
-        char configuration_data[256]; /* from read_configuration_data */
-        unsigned int format;          /* format info like formatted/cdl/ldl/... */
-        unsigned int features;        /* dasd features like 'ro',...            */
-        unsigned int reserved0;       /* reserved for further use ,...          */
-        unsigned int reserved1;       /* reserved for further use ,...          */
-        unsigned int reserved2;       /* reserved for further use ,...          */
-        unsigned int reserved3;       /* reserved for further use ,...          */
-        unsigned int reserved4;       /* reserved for further use ,...          */
-        unsigned int reserved5;       /* reserved for further use ,...          */
-        unsigned int reserved6;       /* reserved for further use ,...          */
-        unsigned int reserved7;       /* reserved for further use ,...          */
-} dasd_information2_t;
-
-/*
- * values to be used for dasd_information_t.format
- * 0x00: NOT formatted
- * 0x01: Linux disc layout
- * 0x02: Common disc layout
- */
-#define DASD_FORMAT_NONE 0
-#define DASD_FORMAT_LDL  1
-#define DASD_FORMAT_CDL  2
-/*
- * values to be used for dasd_information_t.features
- * 0x00: default features
- * 0x01: readonly (ro)
- */
-#define DASD_FEATURE_DEFAULT  0
-#define DASD_FEATURE_READONLY 1
-
-#define DASD_PARTN_BITS 2
-
-/* 
- * struct dasd_information_t
- * represents any data about the data, which is visible to userspace
- */
-typedef struct dasd_information_t {
-        unsigned int devno;         /* S/390 devno */
-        unsigned int real_devno;    /* for aliases */
-        unsigned int schid;         /* S/390 subchannel identifier */
-        unsigned int cu_type  : 16; /* from SenseID */
-        unsigned int cu_model :  8; /* from SenseID */
-        unsigned int dev_type : 16; /* from SenseID */
-        unsigned int dev_model : 8; /* from SenseID */
-        unsigned int open_count; 
-        unsigned int req_queue_len; 
-        unsigned int chanq_len;     /* length of chanq */
-        char type[4];               /* from discipline.name, 'none' for unknown */
-        unsigned int status;        /* current device level */
-        unsigned int label_block;   /* where to find the VOLSER */
-        unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
-        unsigned int characteristics_size;
-        unsigned int confdata_size;
-        char characteristics[64];   /* from read_device_characteristics */
-        char configuration_data[256]; /* from read_configuration_data */
-} dasd_information_t;
-
-/*
- * Read Subsystem Data - Perfomance Statistics
- */ 
-typedef struct dasd_rssd_perf_stats_t {
-	unsigned char  invalid:1;
-	unsigned char  format:3;
-	unsigned char  data_format:4;
-	unsigned char  unit_address;
-	unsigned short device_status;
-	unsigned int   nr_read_normal;
-	unsigned int   nr_read_normal_hits;
-	unsigned int   nr_write_normal;
-	unsigned int   nr_write_fast_normal_hits;
-	unsigned int   nr_read_seq;
-	unsigned int   nr_read_seq_hits;
-	unsigned int   nr_write_seq;
-	unsigned int   nr_write_fast_seq_hits;
-	unsigned int   nr_read_cache;
-	unsigned int   nr_read_cache_hits;
-	unsigned int   nr_write_cache;
-	unsigned int   nr_write_fast_cache_hits;
-	unsigned int   nr_inhibit_cache;
-	unsigned int   nr_bybass_cache;
-	unsigned int   nr_seq_dasd_to_cache;
-	unsigned int   nr_dasd_to_cache;
-	unsigned int   nr_cache_to_dasd;
-	unsigned int   nr_delayed_fast_write;
-	unsigned int   nr_normal_fast_write;
-	unsigned int   nr_seq_fast_write;
-	unsigned int   nr_cache_miss;
-	unsigned char  status2;
-	unsigned int   nr_quick_write_promotes;
-	unsigned char  reserved;
-	unsigned short ssid;
-	unsigned char  reseved2[96];
-} __attribute__((packed)) dasd_rssd_perf_stats_t;
-
-/* 
- * struct profile_info_t
- * holds the profinling information 
- */
-typedef struct dasd_profile_info_t {
-        unsigned int dasd_io_reqs;	 /* number of requests processed at all */
-        unsigned int dasd_io_sects;	 /* number of sectors processed at all */
-        unsigned int dasd_io_secs[32];	 /* histogram of request's sizes */
-        unsigned int dasd_io_times[32];	 /* histogram of requests's times */
-        unsigned int dasd_io_timps[32];	 /* histogram of requests's times per sector */
-        unsigned int dasd_io_time1[32];	 /* histogram of time from build to start */
-        unsigned int dasd_io_time2[32];	 /* histogram of time from start to irq */
-        unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
-        unsigned int dasd_io_time3[32];	 /* histogram of time from irq to end */
-        unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
-} dasd_profile_info_t;
-
-/* 
- * struct format_data_t
- * represents all data necessary to format a dasd
- */
-typedef struct format_data_t {
-	int start_unit; /* from track */
-	int stop_unit;  /* to track */
-	int blksize;    /* sectorsize */
-        int intensity;  
-} format_data_t;
-
-/*
- * values to be used for format_data_t.intensity
- * 0/8: normal format
- * 1/9: also write record zero
- * 3/11: also write home address
- * 4/12: invalidate track
- */
-#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
-#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
-#define DASD_FMT_INT_INVAL  4 /* invalidate tracks */
-#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
-
-
-/* 
- * struct attrib_data_t
- * represents the operation (cache) bits for the device.
- * Used in DE to influence caching of the DASD.
- */
-typedef struct attrib_data_t {
-	unsigned char operation:3;     /* cache operation mode */
-	unsigned char reserved:5;      /* cache operation mode */
-	__u16         nr_cyl;          /* no of cyliners for read ahaed */
-	__u8          reserved2[29];   /* for future use */
-} __attribute__ ((packed)) attrib_data_t;
-
-/* definition of operation (cache) bits within attributes of DE */
-#define DASD_NORMAL_CACHE  0x0
-#define DASD_BYPASS_CACHE  0x1
-#define DASD_INHIBIT_LOAD  0x2
-#define DASD_SEQ_ACCESS    0x3
-#define DASD_SEQ_PRESTAGE  0x4
-#define DASD_REC_ACCESS    0x5
-
-
-/********************************************************************************
- * SECTION: Definition of IOCTLs
- *
- * Here ist how the ioctl-nr should be used:
- *    0 -   31   DASD driver itself
- *   32 -  239   still open
- *  240 -  255   reserved for EMC 
- *******************************************************************************/
-
-/* Disable the volume (for Linux) */
-#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0) 
-/* Enable the volume (for Linux) */
-#define BIODASDENABLE  _IO(DASD_IOCTL_LETTER,1)  
-/* Issue a reserve/release command, rsp. */
-#define BIODASDRSRV    _IO(DASD_IOCTL_LETTER,2) /* reserve */
-#define BIODASDRLSE    _IO(DASD_IOCTL_LETTER,3) /* release */
-#define BIODASDSLCK    _IO(DASD_IOCTL_LETTER,4) /* steal lock */
-/* reset profiling information of a device */
-#define BIODASDPRRST   _IO(DASD_IOCTL_LETTER,5)
-
-
-/* retrieve API version number */
-#define DASDAPIVER     _IOR(DASD_IOCTL_LETTER,0,int)
-/* Get information on a dasd device */
-#define BIODASDINFO    _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
-/* retrieve profiling information of a device */
-#define BIODASDPRRD    _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
-/* Get information on a dasd device (enhanced) */
-#define BIODASDINFO2   _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
-/* Performance Statistics Read */
-#define BIODASDPSRD    _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
-
-
-/* #define BIODASDFORMAT  _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
-#define BIODASDFMT     _IOW(DASD_IOCTL_LETTER,1,format_data_t) 
-/* Set Attributes (cache operations) */
-#define BIODASDSATTR   _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 
-
-
-#endif				/* DASD_H */
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-indent-level: 4 
- * c-brace-imaginary-offset: 0
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * c-continued-statement-offset: 4
- * c-continued-brace-offset: 0
- * indent-tabs-mode: nil
- * tab-width: 8
- * End:
- */
diff -urN linux-2.5.67-bk5/include/asm-s390x/debug.h linux-2.5.67-bk6/include/asm-s390x/debug.h
--- linux-2.5.67-bk5/include/asm-s390x/debug.h	2003-04-07 10:31:42.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/debug.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,271 +0,0 @@
-/*
- *  include/asm-s390/debug.h
- *   S/390 debug facility
- *
- *    Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH,
- *                             IBM Corporation
- */
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include <linux/string.h>
-
-/* Note:
- * struct __debug_entry must be defined outside of #ifdef __KERNEL__ 
- * in order to allow a user program to analyze the 'raw'-view.
- */
-
-struct __debug_entry{
-        union {
-                struct {
-                        unsigned long long clock:52;
-                        unsigned long long exception:1;
-                        unsigned long long level:3;
-                        unsigned long long cpuid:8;
-                } fields;
-
-                unsigned long long stck;
-        } id;
-        void* caller;
-} __attribute__((packed));
-
-
-#define __DEBUG_FEATURE_VERSION      1  /* version of debug feature */
-
-#ifdef __KERNEL__
-#include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0))
- #include <asm/spinlock.h>
-#else
- #include <linux/spinlock.h>
-#endif /* LINUX_VERSION_CODE */
-#include <linux/kernel.h>
-#include <linux/time.h>
-#include <linux/proc_fs.h>
-
-#define DEBUG_MAX_LEVEL            6  /* debug levels range from 0 to 6 */
-#define DEBUG_OFF_LEVEL            -1 /* level where debug is switched off */
-#define DEBUG_FLUSH_ALL            -1 /* parameter to flush all areas */
-#define DEBUG_MAX_VIEWS            10 /* max number of views in proc fs */
-#define DEBUG_MAX_PROCF_LEN        16 /* max length for a proc file name */
-#define DEBUG_DEFAULT_LEVEL        3  /* initial debug level */
-
-#define DEBUG_DIR_ROOT "s390dbf" /* name of debug root directory in proc fs */
-
-#define DEBUG_DATA(entry) (char*)(entry + 1) /* data is stored behind */
-                                             /* the entry information */
-
-#define STCK(x)	asm volatile ("STCK 0(%1)" : "=m" (x) : "a" (&(x)) : "cc")
-
-typedef struct __debug_entry debug_entry_t;
-
-struct debug_view;
-
-typedef struct debug_info {	
-	struct debug_info* next;
-	struct debug_info* prev;
-	atomic_t ref_count;
-	spinlock_t lock;			
-	int level;
-	int nr_areas;
-	int page_order;
-	int buf_size;
-	int entry_size;	
-	debug_entry_t** areas;
-	int active_area;
-	int *active_entry;
-	struct proc_dir_entry* proc_root_entry;
-	struct proc_dir_entry* proc_entries[DEBUG_MAX_VIEWS];
-	struct debug_view* views[DEBUG_MAX_VIEWS];	
-	char name[DEBUG_MAX_PROCF_LEN];
-} debug_info_t;
-
-typedef int (debug_header_proc_t) (debug_info_t* id,
-				   struct debug_view* view,
-				   int area,
-				   debug_entry_t* entry,
-				   char* out_buf);
-
-typedef int (debug_format_proc_t) (debug_info_t* id,
-				   struct debug_view* view, char* out_buf,
-				   const char* in_buf);
-typedef int (debug_prolog_proc_t) (debug_info_t* id,
-				   struct debug_view* view,
-				   char* out_buf);
-typedef int (debug_input_proc_t) (debug_info_t* id,
-				  struct debug_view* view,
-				  struct file* file, const char* user_buf,
-				  size_t in_buf_size, loff_t* offset);
-
-int debug_dflt_header_fn(debug_info_t* id, struct debug_view* view,
-		         int area, debug_entry_t* entry, char* out_buf);						
-				
-struct debug_view {
-	char name[DEBUG_MAX_PROCF_LEN];
-	debug_prolog_proc_t* prolog_proc;
-	debug_header_proc_t* header_proc;
-	debug_format_proc_t* format_proc;
-	debug_input_proc_t*  input_proc;
-	void*                private_data;
-};
-
-extern struct debug_view debug_hex_ascii_view;
-extern struct debug_view debug_raw_view;
-extern struct debug_view debug_sprintf_view;
-
-/* do NOT use the _common functions */
-
-debug_entry_t* debug_event_common(debug_info_t* id, int level, 
-                                  const void* data, int length);
-
-debug_entry_t* debug_exception_common(debug_info_t* id, int level, 
-                                      const void* data, int length);
-
-/* Debug Feature API: */
-
-debug_info_t* debug_register(char* name, int pages_index, int nr_areas,
-                             int buf_size);
-
-void debug_unregister(debug_info_t* id);
-
-void debug_set_level(debug_info_t* id, int new_level);
-
-extern inline debug_entry_t* 
-debug_event(debug_info_t* id, int level, void* data, int length)
-{
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_event_common(id,level,data,length);
-}
-
-extern inline debug_entry_t* 
-debug_int_event(debug_info_t* id, int level, unsigned int tag)
-{
-        unsigned int t=tag;
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_event_common(id,level,&t,sizeof(unsigned int));
-}
-
-extern inline debug_entry_t *
-debug_long_event (debug_info_t* id, int level, unsigned long tag)
-{
-        unsigned long t=tag;
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_event_common(id,level,&t,sizeof(unsigned long));
-}
-
-extern inline debug_entry_t* 
-debug_text_event(debug_info_t* id, int level, const char* txt)
-{
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_event_common(id,level,txt,strlen(txt));
-}
-
-extern debug_entry_t *
-debug_sprintf_event(debug_info_t* id,int level,char *string,...)
-	__attribute__ ((format(printf, 3, 4)));
-
-
-extern inline debug_entry_t* 
-debug_exception(debug_info_t* id, int level, void* data, int length)
-{
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_exception_common(id,level,data,length);
-}
-
-extern inline debug_entry_t* 
-debug_int_exception(debug_info_t* id, int level, unsigned int tag)
-{
-        unsigned int t=tag;
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_exception_common(id,level,&t,sizeof(unsigned int));
-}
-
-extern inline debug_entry_t * 
-debug_long_exception (debug_info_t* id, int level, unsigned long tag)
-{
-        unsigned long t=tag;
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_exception_common(id,level,&t,sizeof(unsigned long));
-}
-
-extern inline debug_entry_t* 
-debug_text_exception(debug_info_t* id, int level, const char* txt)
-{
-	if ((!id) || (level > id->level)) return NULL;
-        return debug_exception_common(id,level,txt,strlen(txt));
-}
-
-
-extern debug_entry_t *
-debug_sprintf_exception(debug_info_t* id,int level,char *string,...)
-	__attribute__ ((format(printf, 3, 4)));
-
-int debug_register_view(debug_info_t* id, struct debug_view* view);
-int debug_unregister_view(debug_info_t* id, struct debug_view* view);
-
-/*
-   define the debug levels:
-   - 0 No debugging output to console or syslog
-   - 1 Log internal errors to syslog, ignore check conditions 
-   - 2 Log internal errors and check conditions to syslog
-   - 3 Log internal errors to console, log check conditions to syslog
-   - 4 Log internal errors and check conditions to console
-   - 5 panic on internal errors, log check conditions to console
-   - 6 panic on both, internal errors and check conditions
- */
-
-#ifndef DEBUG_LEVEL
-#define DEBUG_LEVEL 4
-#endif
-
-#define INTERNAL_ERRMSG(x,y...) "E" __FILE__ "%d: " x, __LINE__, y
-#define INTERNAL_WRNMSG(x,y...) "W" __FILE__ "%d: " x, __LINE__, y
-#define INTERNAL_INFMSG(x,y...) "I" __FILE__ "%d: " x, __LINE__, y
-#define INTERNAL_DEBMSG(x,y...) "D" __FILE__ "%d: " x, __LINE__, y
-
-#if DEBUG_LEVEL > 0
-#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
-#define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x )
-#define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x )
-#define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x )
-#define PRINT_FATAL(x...) panic ( PRINTK_HEADER x )
-#else
-#define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
-#define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
-#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
-#ifdef DEBUG_MALLOC
-void *b;
-#define kmalloc(x...) (PRINT_INFO(" kmalloc %p\n",b=kmalloc(x)),b)
-#define kfree(x) PRINT_INFO(" kfree %p\n",x);kfree(x)
-#define get_zeroed_page(x...) (PRINT_INFO(" gfp %p\n",b=get_zeroed_page(x)),b)
-#define __get_free_pages(x...) (PRINT_INFO(" gfps %p\n",b=__get_free_pages(x)),b)
-#endif				/* DEBUG_MALLOC */
-
-#endif				/* __KERNEL__ */
-#endif				/* DEBUG_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/delay.h linux-2.5.67-bk6/include/asm-s390x/delay.h
--- linux-2.5.67-bk5/include/asm-s390x/delay.h	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/delay.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,22 +0,0 @@
-/*
- *  include/asm-s390/delay.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/delay.h"
- *    Copyright (C) 1993 Linus Torvalds
- *
- *  Delay routines calling functions in arch/s390x/lib/delay.c
- */
- 
-#ifndef _S390_DELAY_H
-#define _S390_DELAY_H
-
-extern void __udelay(unsigned long usecs);
-extern void __delay(unsigned long loops);
-
-#define udelay(n) __udelay(n)
-
-#endif /* defined(_S390_DELAY_H) */
diff -urN linux-2.5.67-bk5/include/asm-s390x/div64.h linux-2.5.67-bk6/include/asm-s390x/div64.h
--- linux-2.5.67-bk5/include/asm-s390x/div64.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/div64.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,10 +0,0 @@
-#ifndef __S390_DIV64
-#define __S390_DIV64
-
-#define do_div(n,base) ({ \
-int __res; \
-__res = ((unsigned long) n) % (unsigned) base; \
-n = ((unsigned long) n) / (unsigned) base; \
-__res; })
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/dma-mapping.h linux-2.5.67-bk6/include/asm-s390x/dma-mapping.h
--- linux-2.5.67-bk5/include/asm-s390x/dma-mapping.h	2003-04-07 10:31:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/dma-mapping.h	1969-12-31 16:00:00.000000000 -0800
@@ -1 +0,0 @@
-#include <asm-generic/dma-mapping.h>
diff -urN linux-2.5.67-bk5/include/asm-s390x/dma.h linux-2.5.67-bk6/include/asm-s390x/dma.h
--- linux-2.5.67-bk5/include/asm-s390x/dma.h	2003-04-07 10:31:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/dma.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,18 +0,0 @@
-/*
- *  include/asm-s390x/dma.h
- *
- *  S390 version
- */
-
-#ifndef _ASM_DMA_H
-#define _ASM_DMA_H
-
-#include <asm/io.h>		/* need byte IO */
-
-/* The I/O subsystem can access only memory below 2GB.
-   We use the existing DMA zone mechanism to handle this. */
-#define MAX_DMA_ADDRESS         0x80000000
-
-#define free_dma(x)
-
-#endif /* _ASM_DMA_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/ebcdic.h linux-2.5.67-bk6/include/asm-s390x/ebcdic.h
--- linux-2.5.67-bk5/include/asm-s390x/ebcdic.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ebcdic.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,49 +0,0 @@
-/*
- *  include/asm-s390/ebcdic.h
- *    EBCDIC -> ASCII, ASCII -> EBCDIC conversion routines.
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
- */
-
-#ifndef _EBCDIC_H
-#define _EBCDIC_H
-
-#ifndef _S390_TYPES_H
-#include <types.h>
-#endif
-
-extern __u8 _ascebc_500[];   /* ASCII -> EBCDIC 500 conversion table */
-extern __u8 _ebcasc_500[];   /* EBCDIC 500 -> ASCII conversion table */
-extern __u8 _ascebc[];   /* ASCII -> EBCDIC conversion table */
-extern __u8 _ebcasc[];   /* EBCDIC -> ASCII conversion table */
-extern __u8 _ebc_tolower[]; /* EBCDIC -> lowercase */
-extern __u8 _ebc_toupper[]; /* EBCDIC -> uppercase */
-
-extern __inline__ void
-codepage_convert(const __u8 *codepage, volatile __u8 * addr, unsigned long nr)
-{
-	if (nr-- <= 0)
-		return;
-        __asm__ __volatile__(
-		"   bras  1,1f\n"
-		"   tr    0(1,%0),0(%2)\n"
-		"0: tr    0(256,%0),0(%2)\n"
-		"   la    %0,256(%0)\n"
-		"1: ahi   %1,-256\n"
-		"   jnm   0b\n"
-		"   ex    %1,0(1)"
-		: "+&a" (addr), "+&a" (nr)
-		: "a" (codepage) : "cc", "memory", "1" );
-}
-
-#define ASCEBC(addr,nr) codepage_convert(_ascebc, addr, nr)
-#define EBCASC(addr,nr) codepage_convert(_ebcasc, addr, nr)
-#define ASCEBC_500(addr,nr) codepage_convert(_ascebc_500, addr, nr)
-#define EBCASC_500(addr,nr) codepage_convert(_ebcasc_500, addr, nr)
-#define EBC_TOLOWER(addr,nr) codepage_convert(_ebc_tolower, addr, nr)
-#define EBC_TOUPPER(addr,nr) codepage_convert(_ebc_toupper, addr, nr)
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/elf.h linux-2.5.67-bk6/include/asm-s390x/elf.h
--- linux-2.5.67-bk5/include/asm-s390x/elf.h	2003-04-07 10:31:25.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/elf.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,90 +0,0 @@
-/*
- *  include/asm-s390/elf.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/elf.h"
- */
-
-#ifndef __ASMS390_ELF_H
-#define __ASMS390_ELF_H
-
-/*
- * ELF register definitions..
- */
-
-#include <asm/ptrace.h>
-#include <asm/user.h>
-
-
-typedef s390_fp_regs elf_fpregset_t;
-typedef s390_regs elf_gregset_t;
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS	ELFCLASS64
-#define ELF_DATA	ELFDATA2MSB
-#define ELF_ARCH	EM_S390
-
-/*
- * This is used to ensure we don't load something for the wrong architecture.
- */
-#define elf_check_arch(x) \
-        (((x)->e_machine == EM_S390 || (x)->e_machine == EM_S390_OLD) \
-         && (x)->e_ident[EI_CLASS] == ELF_CLASS)
-
-/* For SVR4/S390 the function pointer to be registered with `atexit` is
-   passed in R14. */
-#define ELF_PLAT_INIT(_r, load_addr) \
-	do { \
-	_r->gprs[14] = 0; \
-	clear_thread_flag(TIF_31BIT); \
-	} while(0)
-
-#define USE_ELF_CORE_DUMP
-#define ELF_EXEC_PAGESIZE	4096
-
-/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
-   use of this is to invoke "./ld.so someprog" to test out a new version of
-   the loader.  We need to make sure that it is out of the way of the program
-   that it will "exec", and that there is sufficient room for the brk.  */
-
-#define ELF_ET_DYN_BASE         (TASK_SIZE / 3 * 2)
-
-/* Wow, the "main" arch needs arch dependent functions too.. :) */
-
-/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
-   now struct_user_regs, they are different) */
-
-#define ELF_CORE_COPY_REGS(pr_reg, regs)	\
-	memcpy(&pr_reg,regs,sizeof(elf_gregset_t)); \
-
-
-
-/* This yields a mask that user programs can use to figure out what
-   instruction set this CPU supports. */
-
-#define ELF_HWCAP (0)
-
-/* This yields a string that ld.so will use to load implementation
-   specific libraries for optimization.  This is more specific in
-   intent than poking at uname or /proc/cpuinfo.
-
-   For the moment, we have only optimizations for the Intel generations,
-   but that could change... */
-
-#define ELF_PLATFORM (NULL)
-
-#ifdef __KERNEL__
-#define SET_PERSONALITY(ex, ibcs2)			\
-do {							\
-	if (ibcs2)					\
-		set_personality(PER_SVR4);		\
-	else if (current->personality != PER_LINUX32)	\
-		set_personality(PER_LINUX);		\
-	clear_thread_flag(TIF_31BIT);			\
-} while (0)
-#endif
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/errno.h linux-2.5.67-bk6/include/asm-s390x/errno.h
--- linux-2.5.67-bk5/include/asm-s390x/errno.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/errno.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,12 +0,0 @@
-/*
- *  include/asm-s390/errno.h
- *
- *  S390 version
- */
-
-#ifndef _S390_ERRNO_H
-#define _S390_ERRNO_H
-
-#include <asm-generic/errno.h>
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/fcntl.h linux-2.5.67-bk6/include/asm-s390x/fcntl.h
--- linux-2.5.67-bk5/include/asm-s390x/fcntl.h	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/fcntl.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,83 +0,0 @@
-/*
- *  include/asm-s390/fcntl.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/fcntl.h"
- */
-#ifndef _S390_FCNTL_H
-#define _S390_FCNTL_H
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_ACCMODE	   0003
-#define O_RDONLY	     00
-#define O_WRONLY	     01
-#define O_RDWR		     02
-#define O_CREAT		   0100	/* not fcntl */
-#define O_EXCL		   0200	/* not fcntl */
-#define O_NOCTTY	   0400	/* not fcntl */
-#define O_TRUNC		  01000	/* not fcntl */
-#define O_APPEND	  02000
-#define O_NONBLOCK	  04000
-#define O_NDELAY	O_NONBLOCK
-#define O_SYNC		 010000
-#define FASYNC		 020000	/* fcntl, for BSD compatibility */
-#define O_DIRECT	 040000	/* direct disk access hint */
-#define O_LARGEFILE	0100000
-#define O_DIRECTORY	0200000	/* must be a directory */
-#define O_NOFOLLOW	0400000 /* don't follow links */
-
-#define F_DUPFD		0	/* dup */
-#define F_GETFD		1	/* get close_on_exec */
-#define F_SETFD		2	/* set/clear close_on_exec */
-#define F_GETFL		3	/* get file->f_flags */
-#define F_SETFL		4	/* set file->f_flags */
-#define F_GETLK		5
-#define F_SETLK		6
-#define F_SETLKW	7
-
-#define F_SETOWN	8	/*  for sockets. */
-#define F_GETOWN	9	/*  for sockets. */
-#define F_SETSIG	10	/*  for sockets. */
-#define F_GETSIG	11	/*  for sockets. */
-
-/* for F_[GET|SET]FL */
-#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
-
-/* for posix fcntl() and lockf() */
-#define F_RDLCK		0
-#define F_WRLCK		1
-#define F_UNLCK		2
-
-/* for old implementation of bsd flock () */
-#define F_EXLCK		4	/* or 3 */
-#define F_SHLCK		8	/* or 4 */
-
-/* for leases */
-#define F_INPROGRESS	16
-
-/* operations for bsd flock(), also used by the kernel implementation */
-#define LOCK_SH		1	/* shared lock */
-#define LOCK_EX		2	/* exclusive lock */
-#define LOCK_NB		4	/* or'd with one of the above to prevent
-				   blocking */
-#define LOCK_UN		8	/* remove lock */
-
-#define LOCK_MAND	32	/* This is a mandatory flock */
-#define LOCK_READ	64	/* ... Which allows concurrent read operations */
-#define LOCK_WRITE	128	/* ... Which allows concurrent write operations
-*/
-#define LOCK_RW		192	/* ... Which allows concurrent read & write ops */
-
-struct flock {
-	short l_type;
-	short l_whence;
-	__kernel_off_t l_start;
-	__kernel_off_t l_len;
-	__kernel_pid_t l_pid;
-};
-
-#define F_LINUX_SPECIFIC_BASE  1024
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/gdb-stub.h linux-2.5.67-bk6/include/asm-s390x/gdb-stub.h
--- linux-2.5.67-bk5/include/asm-s390x/gdb-stub.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/gdb-stub.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,18 +0,0 @@
-/*
- *  include/asm-s390/gdb-stub.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- */
-
-#ifndef __S390_GDB_STUB__
-#define __S390_GDB_STUB__
-#include <linux/config.h>
-#if CONFIG_REMOTE_DEBUG
-#include <asm/s390-gdbregs.h>
-#include <asm/ptrace.h>
-extern int    gdb_stub_initialised;
-extern void gdb_stub_handle_exception(gdb_pt_regs *regs,int sigval);
-#endif
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/hardirq.h linux-2.5.67-bk6/include/asm-s390x/hardirq.h
--- linux-2.5.67-bk5/include/asm-s390x/hardirq.h	2003-04-07 10:30:35.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/hardirq.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,109 +0,0 @@
-/*
- *  include/asm-s390/hardirq.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *
- *  Derived from "include/asm-i386/hardirq.h"
- */
-
-#ifndef __ASM_HARDIRQ_H
-#define __ASM_HARDIRQ_H
-
-#include <linux/config.h>
-#include <linux/threads.h>
-#include <asm/lowcore.h>
-#include <linux/sched.h>
-#include <linux/cache.h>
-
-/* entry.S is sensitive to the offsets of these fields */
-typedef struct {
-	unsigned int __softirq_pending;
-	unsigned int __syscall_count;
-	struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
-} ____cacheline_aligned irq_cpustat_t;
-
-#include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */
-
-/*
- * We put the hardirq and softirq counter into the preemption
- * counter. The bitmask has the following meaning:
- *
- * - bits 0-7 are the preemption count (max preemption depth: 256)
- * - bits 8-15 are the softirq count (max # of softirqs: 256)
- * - bits 16-23 are the hardirq count (max # of hardirqs: 256)
- *
- * - ( bit 26 is the PREEMPT_ACTIVE flag. )
- *
- * PREEMPT_MASK: 0x000000ff
- * SOFTIRQ_MASK: 0x0000ff00
- * HARDIRQ_MASK: 0x00010000
- */
-
-#define PREEMPT_BITS	8
-#define SOFTIRQ_BITS	8
-// FIXME: we have 2^16 i/o and 2^16 external interrupts...
-#define HARDIRQ_BITS	1
-
-#define PREEMPT_SHIFT	0
-#define SOFTIRQ_SHIFT	(PREEMPT_SHIFT + PREEMPT_BITS)
-#define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
-
-#define __MASK(x)	((1UL << (x))-1)
-
-#define PREEMPT_MASK	(__MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
-#define SOFTIRQ_MASK	(__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
-#define HARDIRQ_MASK	(__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
-
-#define hardirq_count()	(preempt_count() & HARDIRQ_MASK)
-#define softirq_count()	(preempt_count() & SOFTIRQ_MASK)
-#define irq_count()	(preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
-
-#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
-#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
-#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
-
-/*
- * Are we doing bottom half or hardware interrupt processing?
- * Are we in a softirq context? Interrupt context?
- */
-#define in_irq()		(hardirq_count())
-#define in_softirq()		(softirq_count())
-#define in_interrupt()		(irq_count())
-
-
-#define hardirq_trylock()	(!in_interrupt())
-#define hardirq_endlock()	do { } while (0)
-
-#define irq_enter()		(preempt_count() += HARDIRQ_OFFSET)
-
-extern void do_call_softirq(void);
-
-#if CONFIG_PREEMPT
-# define in_atomic()	(in_interrupt() || preempt_count() == PREEMPT_ACTIVE)
-# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
-#else
-# define in_atomic()	(preempt_count() != 0)
-# define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
-#endif
-
-#define irq_exit()							\
-do {									\
-	preempt_count() -= IRQ_EXIT_OFFSET;				\
-	if (!in_interrupt() && softirq_pending(smp_processor_id()))	\
-		/* Use the async. stack for softirq */			\
-		do_call_softirq();					\
-	preempt_enable_no_resched();					\
-} while (0)
-
-#ifndef CONFIG_SMP
-# define synchronize_irq(irq)	barrier()
-#else
-  extern void synchronize_irq(unsigned int irq);
-#endif /* CONFIG_SMP */
-
-extern void show_stack(unsigned long * esp);
-
-#endif /* __ASM_HARDIRQ_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/idals.h linux-2.5.67-bk6/include/asm-s390x/idals.h
--- linux-2.5.67-bk5/include/asm-s390x/idals.h	2003-04-07 10:31:55.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/idals.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,259 +0,0 @@
-/* 
- * File...........: linux/include/asm-s390x/idals.h
- * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
- *		    Martin Schwidefsky <schwidefsky@de.ibm.com>
- * Bugreports.to..: <Linux390@de.ibm.com>
- * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 2000a
- 
- * History of changes
- * 07/24/00 new file
- * 05/04/02 code restructuring.
- */
-
-#ifndef _S390_IDALS_H
-#define _S390_IDALS_H
-
-#include <linux/config.h>
-#include <linux/errno.h>
-#include <linux/err.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <asm/cio.h>
-#include <asm/uaccess.h>
-
-#ifdef CONFIG_ARCH_S390X
-#define IDA_SIZE_LOG 12 /* 11 for 2k , 12 for 4k */
-#else
-#define IDA_SIZE_LOG 11 /* 11 for 2k , 12 for 4k */
-#endif
-#define IDA_BLOCK_SIZE (1L<<IDA_SIZE_LOG)
-
-/*
- * Test if an address/length pair needs an idal list.
- */
-static inline int
-idal_is_needed(void *vaddr, unsigned int length)
-{
-#if defined(CONFIG_ARCH_S390X)
-	return ((__pa(vaddr) + length) >> 31) != 0;
-#else
-	return 0;
-#endif
-}
-
-
-/*
- * Return the number of idal words needed for an address/length pair.
- */
-static inline unsigned int
-idal_nr_words(void *vaddr, unsigned int length)
-{
-#if defined(CONFIG_ARCH_S390X)
-	if (idal_is_needed(vaddr, length))
-		return ((__pa(vaddr) & (IDA_BLOCK_SIZE-1)) + length + 
-			(IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
-#endif
-	return 0;
-}
-
-/*
- * Create the list of idal words for an address/length pair.
- */
-static inline unsigned long *
-idal_create_words(unsigned long *idaws, void *vaddr, unsigned int length)
-{
-#if defined(CONFIG_ARCH_S390X)
-	unsigned long paddr;
-	unsigned int cidaw;
-
-	paddr = __pa(vaddr);
-	cidaw = ((paddr & (IDA_BLOCK_SIZE-1)) + length + 
-		 (IDA_BLOCK_SIZE-1)) >> IDA_SIZE_LOG;
-	*idaws++ = paddr;
-	paddr &= -IDA_BLOCK_SIZE;
-	while (--cidaw > 0) {
-		paddr += IDA_BLOCK_SIZE;
-		*idaws++ = paddr;
-	}
-#endif
-	return idaws;
-}
-
-/*
- * Sets the address of the data in CCW.
- * If necessary it allocates an IDAL and sets the appropriate flags.
- */
-static inline int
-set_normalized_cda(struct ccw1 * ccw, void *vaddr)
-{
-#if defined (CONFIG_ARCH_S390X)
-	unsigned int nridaws;
-	unsigned long *idal;
-
-	if (ccw->flags & CCW_FLAG_IDA)
-		return -EINVAL;
-	nridaws = idal_nr_words(vaddr, ccw->count);
-	if (nridaws > 0) {
-		idal = kmalloc(nridaws * sizeof(unsigned long),
-			       GFP_ATOMIC | GFP_DMA );
-		if (idal == NULL)
-			return -ENOMEM;
-		idal_create_words(idal, vaddr, ccw->count);
-		ccw->flags |= CCW_FLAG_IDA;
-		vaddr = idal;
-	}
-#endif
-	ccw->cda = (__u32)(unsigned long) vaddr;
-	return 0;
-}
-
-/*
- * Releases any allocated IDAL related to the CCW.
- */
-static inline void
-clear_normalized_cda(struct ccw1 * ccw)
-{
-#if defined(CONFIG_ARCH_S390X)
-	if (ccw->flags & CCW_FLAG_IDA) {
-		kfree((void *)(unsigned long) ccw->cda);
-		ccw->flags &= ~CCW_FLAG_IDA;
-	}
-#endif
-	ccw->cda = 0;
-}
-
-/*
- * Idal buffer extension
- */
-struct idal_buffer {
-	size_t size;
-	size_t page_order;
-	void *data[0];
-};
-
-/*
- * Allocate an idal buffer
- */
-static inline struct idal_buffer *
-idal_buffer_alloc(size_t size, int page_order)
-{
-	struct idal_buffer *ib;
-	int nr_chunks, nr_ptrs, i;
-
-	nr_ptrs = (size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
-	nr_chunks = (4096 << page_order) >> IDA_SIZE_LOG;
-	ib = kmalloc(sizeof(struct idal_buffer) + nr_ptrs*sizeof(void *),
-		     GFP_DMA | GFP_KERNEL);
-	if (ib == NULL)
-		return ERR_PTR(-ENOMEM);
-	ib->size = size;
-	ib->page_order = page_order;
-	for (i = 0; i < nr_ptrs; i++) {
-		if ((i & (nr_chunks - 1)) != 0) {
-			ib->data[i] = ib->data[i-1] + IDA_BLOCK_SIZE;
-			continue;
-		}
-		ib->data[i] = (void *)
-			__get_free_pages(GFP_KERNEL, page_order);
-		if (ib->data[i] != NULL)
-			continue;
-		// Not enough memory
-		while (i >= nr_chunks) {
-			i -= nr_chunks;
-			free_pages((unsigned long) ib->data[i],
-				   ib->page_order);
-		}
-		kfree(ib);
-		return ERR_PTR(-ENOMEM);
-	}
-	return ib;
-}
-
-/*
- * Free an idal buffer.
- */
-static inline void
-idal_buffer_free(struct idal_buffer *ib)
-{
-	int nr_chunks, nr_ptrs, i;
-
-	nr_ptrs = (ib->size + IDA_BLOCK_SIZE - 1) >> IDA_SIZE_LOG;
-	nr_chunks = (4096 << ib->page_order) >> IDA_SIZE_LOG;
-	for (i = 0; i < nr_ptrs; i += nr_chunks)
-		free_pages((unsigned long) ib->data[i], ib->page_order);
-	kfree(ib);
-}
-
-/*
- * Test if a idal list is really needed.
- */
-static inline int
-__idal_buffer_is_needed(struct idal_buffer *ib)
-{
-#ifdef CONFIG_ARCH_S390X
-	return ib->size > (4096ul << ib->page_order) ||
-		idal_is_needed(ib->data[0], ib->size);
-#else
-	return ib->size > (4096ul << ib->page_order);
-#endif
-}
-
-/*
- * Set channel data address to idal buffer.
- */
-static inline void
-idal_buffer_set_cda(struct idal_buffer *ib, struct ccw1 *ccw)
-{
-	if (__idal_buffer_is_needed(ib)) {
-		// setup idals;
-		ccw->cda = (u32)(addr_t) ib->data;
-		ccw->flags |= CCW_FLAG_IDA;
-	} else
-		// we do not need idals - use direct addressing
-		ccw->cda = (u32)(addr_t) ib->data[0];
-	ccw->count = ib->size;
-}
-
-/*
- * 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)
-{
-	size_t left;
-	int i;
-
-	if (count > ib->size)
-		BUG();
-	for (i = 0; count > IDA_BLOCK_SIZE; i++) {
-		left = copy_to_user(to, ib->data[i], IDA_BLOCK_SIZE);
-		if (left)
-			return left + count - IDA_BLOCK_SIZE;
-		(addr_t) to += IDA_BLOCK_SIZE;
-		count -= IDA_BLOCK_SIZE;
-	}
-	return copy_to_user(to, ib->data[i], count);
-}
-
-/*
- * 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)
-{
-	size_t left;
-	int i;
-
-	if (count > ib->size)
-		BUG();
-	for (i = 0; count > IDA_BLOCK_SIZE; i++) {
-		left = copy_from_user(ib->data[i], from, IDA_BLOCK_SIZE);
-		if (left)
-			return left + count - IDA_BLOCK_SIZE;
-		(addr_t) from += IDA_BLOCK_SIZE;
-		count -= IDA_BLOCK_SIZE;
-	}
-	return copy_from_user(ib->data[i], from, count);
-}
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/init.h linux-2.5.67-bk6/include/asm-s390x/init.h
--- linux-2.5.67-bk5/include/asm-s390x/init.h	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/init.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,7 +0,0 @@
-/*
- *  include/asm-s390x/init.h
- *
- *  S390 version (s390x)
- */
-
-#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff -urN linux-2.5.67-bk5/include/asm-s390x/io.h linux-2.5.67-bk6/include/asm-s390x/io.h
--- linux-2.5.67-bk5/include/asm-s390x/io.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/io.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,99 +0,0 @@
-/*
- *  include/asm-s390/io.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/io.h"
- */
-
-#ifndef _S390_IO_H
-#define _S390_IO_H
-
-#ifdef __KERNEL__
-
-#include <linux/vmalloc.h>
-#include <asm/page.h>
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-#define __io_virt(x)            ((void *)(PAGE_OFFSET | (unsigned long)(x)))
-
-/*
- * Change virtual addresses to physical addresses and vv.
- * These are pretty trivial
- */
-extern inline unsigned long virt_to_phys(volatile void * address)
-{
-	unsigned long real_address;
-	__asm__ ("   lrag   %0,0(%1)\n"
-                 "   jz     0f\n"
-                 "   slgr   %0,%0\n"
-                 "0:"
-                 : "=a" (real_address) : "a" (address) : "cc" );
-        return real_address;
-}
-
-extern inline void * phys_to_virt(unsigned long address)
-{
-        return __io_virt(address);
-}
-
-/*
- * Change "struct page" to physical address.
- */
-#define page_to_phys(page)	((page - mem_map) << PAGE_SHIFT)
-
-extern void * __ioremap(unsigned long offset, unsigned long size, unsigned long flags);
-
-extern inline void * ioremap (unsigned long offset, unsigned long size)
-{
-        return __ioremap(offset, size, 0);
-}
-
-/*
- * This one maps high address device memory and turns off caching for that area.
- * it's useful if some control registers are in such an area and write combining
- * or read caching is not desirable:
- */
-extern inline void * ioremap_nocache (unsigned long offset, unsigned long size)
-{
-        return __ioremap(offset, size, 0);
-}
-
-extern void iounmap(void *addr);
-
-/*
- * IO bus memory addresses are also 1:1 with the physical address
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
-/*
- * readX/writeX() are used to access memory mapped devices. On some
- * architectures the memory mapped IO stuff needs to be accessed
- * differently.
- */
-
-#define readb(addr) (*(volatile unsigned char *) __io_virt(addr))
-#define readw(addr) (*(volatile unsigned short *) __io_virt(addr))
-#define readl(addr) (*(volatile unsigned int *) __io_virt(addr))
-
-#define writeb(b,addr) (*(volatile unsigned char *) __io_virt(addr) = (b))
-#define writew(b,addr) (*(volatile unsigned short *) __io_virt(addr) = (b))
-#define writel(b,addr) (*(volatile unsigned int *) __io_virt(addr) = (b))
-
-#define memset_io(a,b,c)        memset(__io_virt(a),(b),(c))
-#define memcpy_fromio(a,b,c)    memcpy((a),__io_virt(b),(c))
-#define memcpy_toio(a,b,c)      memcpy(__io_virt(a),(b),(c))
-
-#define inb_p(addr) readb(addr)
-#define inb(addr) readb(addr)
-
-#define outb(x,addr) ((void) writeb(x,addr))
-#define outb_p(x,addr) outb(x,addr)
-
-#endif /* __KERNEL__ */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/ioctl.h linux-2.5.67-bk6/include/asm-s390x/ioctl.h
--- linux-2.5.67-bk5/include/asm-s390x/ioctl.h	2003-04-07 10:32:13.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ioctl.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,78 +0,0 @@
-/*
- *  include/asm-s390/ioctl.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/ioctl.h"
- */
-
-#ifndef _S390_IOCTL_H
-#define _S390_IOCTL_H
-
-/* ioctl command encoding: 32 bits total, command in lower 16 bits,
- * size of the parameter structure in the lower 14 bits of the
- * upper 16 bits.
- * Encoding the size of the parameter structure in the ioctl request
- * is useful for catching programs compiled with old versions
- * and to avoid overwriting user space outside the user buffer area.
- * The highest 2 bits are reserved for indicating the ``access mode''.
- * NOTE: This limits the max parameter size to 16kB -1 !
- */
-
-/*
- * The following is for compatibility across the various Linux
- * platforms.  The i386 ioctl numbering scheme doesn't really enforce
- * a type field.  De facto, however, the top 8 bits of the lower 16
- * bits are indeed used as a type field, so we might just as well make
- * this explicit here.  Please be sure to use the decoding macros
- * below from now on.
- */
-#define _IOC_NRBITS	8
-#define _IOC_TYPEBITS	8
-#define _IOC_SIZEBITS	14
-#define _IOC_DIRBITS	2
-
-#define _IOC_NRMASK	((1 << _IOC_NRBITS)-1)
-#define _IOC_TYPEMASK	((1 << _IOC_TYPEBITS)-1)
-#define _IOC_SIZEMASK	((1 << _IOC_SIZEBITS)-1)
-#define _IOC_DIRMASK	((1 << _IOC_DIRBITS)-1)
-
-#define _IOC_NRSHIFT	0
-#define _IOC_TYPESHIFT	(_IOC_NRSHIFT+_IOC_NRBITS)
-#define _IOC_SIZESHIFT	(_IOC_TYPESHIFT+_IOC_TYPEBITS)
-#define _IOC_DIRSHIFT	(_IOC_SIZESHIFT+_IOC_SIZEBITS)
-
-/*
- * Direction bits.
- */
-#define _IOC_NONE	0U
-#define _IOC_WRITE	1U
-#define _IOC_READ	2U
-
-#define _IOC(dir,type,nr,size) \
-	(((dir)  << _IOC_DIRSHIFT) | \
-	 ((type) << _IOC_TYPESHIFT) | \
-	 ((nr)   << _IOC_NRSHIFT) | \
-	 ((size) << _IOC_SIZESHIFT))
-
-/* used to create numbers */
-#define _IO(type,nr)		_IOC(_IOC_NONE,(type),(nr),0)
-#define _IOR(type,nr,size)	_IOC(_IOC_READ,(type),(nr),sizeof(size))
-#define _IOW(type,nr,size)	_IOC(_IOC_WRITE,(type),(nr),sizeof(size))
-#define _IOWR(type,nr,size)	_IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
-
-/* used to decode ioctl numbers.. */
-#define _IOC_DIR(nr)		(((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
-#define _IOC_TYPE(nr)		(((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
-#define _IOC_NR(nr)		(((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
-#define _IOC_SIZE(nr)		(((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
-
-/* ...and for the drivers/sound files... */
-
-#define IOC_IN		(_IOC_WRITE << _IOC_DIRSHIFT)
-#define IOC_OUT		(_IOC_READ << _IOC_DIRSHIFT)
-#define IOC_INOUT	((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
-#define IOCSIZE_MASK	(_IOC_SIZEMASK << _IOC_SIZESHIFT)
-#define IOCSIZE_SHIFT	(_IOC_SIZESHIFT)
-
-#endif /* _S390_IOCTL_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/ioctls.h linux-2.5.67-bk6/include/asm-s390x/ioctls.h
--- linux-2.5.67-bk5/include/asm-s390x/ioctls.h	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ioctls.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,88 +0,0 @@
-/*
- *  include/asm-s390/ioctls.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/ioctls.h"
- */
-
-#ifndef __ARCH_S390_IOCTLS_H__
-#define __ARCH_S390_IOCTLS_H__
-
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS		0x5401
-#define TCSETS		0x5402
-#define TCSETSW		0x5403
-#define TCSETSF		0x5404
-#define TCGETA		0x5405
-#define TCSETA		0x5406
-#define TCSETAW		0x5407
-#define TCSETAF		0x5408
-#define TCSBRK		0x5409
-#define TCXONC		0x540A
-#define TCFLSH		0x540B
-#define TIOCEXCL	0x540C
-#define TIOCNXCL	0x540D
-#define TIOCSCTTY	0x540E
-#define TIOCGPGRP	0x540F
-#define TIOCSPGRP	0x5410
-#define TIOCOUTQ	0x5411
-#define TIOCSTI		0x5412
-#define TIOCGWINSZ	0x5413
-#define TIOCSWINSZ	0x5414
-#define TIOCMGET	0x5415
-#define TIOCMBIS	0x5416
-#define TIOCMBIC	0x5417
-#define TIOCMSET	0x5418
-#define TIOCGSOFTCAR	0x5419
-#define TIOCSSOFTCAR	0x541A
-#define FIONREAD	0x541B
-#define TIOCINQ		FIONREAD
-#define TIOCLINUX	0x541C
-#define TIOCCONS	0x541D
-#define TIOCGSERIAL	0x541E
-#define TIOCSSERIAL	0x541F
-#define TIOCPKT		0x5420
-#define FIONBIO		0x5421
-#define TIOCNOTTY	0x5422
-#define TIOCSETD	0x5423
-#define TIOCGETD	0x5424
-#define TCSBRKP		0x5425	/* Needed for POSIX tcsendbreak() */
-#define TIOCSBRK	0x5427  /* BSD compatibility */
-#define TIOCCBRK	0x5428  /* BSD compatibility */
-#define TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX	0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX		0x5451
-#define FIOASYNC	0x5452
-#define TIOCSERCONFIG	0x5453
-#define TIOCSERGWILD	0x5454
-#define TIOCSERSWILD	0x5455
-#define TIOCGLCKTRMIOS	0x5456
-#define TIOCSLCKTRMIOS	0x5457
-#define TIOCSERGSTRUCT	0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT	0x545C	/* wait for a change on serial input line(s) */
-#define TIOCGICOUNT	0x545D	/* read serial port inline interrupt counts */
-#define FIOQSIZE	0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
-#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/ipc.h linux-2.5.67-bk6/include/asm-s390x/ipc.h
--- linux-2.5.67-bk5/include/asm-s390x/ipc.h	2003-04-07 10:31:24.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ipc.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,39 +0,0 @@
-/*
- *  include/asm-s390/ipc.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/ipc.h"
- */
-
-#ifndef __s390_IPC_H__
-#define __s390_IPC_H__
-
-/* 
- * These are used to wrap system calls on S390.
- *
- * See arch/s390/kernel/sys_s390.c for ugly details..
- */
-struct ipc_kludge {
-	struct msgbuf *msgp;
-	long msgtyp;
-};
-
-#define SEMOP		 1
-#define SEMGET		 2
-#define SEMCTL		 3
-#define MSGSND		11
-#define MSGRCV		12
-#define MSGGET		13
-#define MSGCTL		14
-#define SHMAT		21
-#define SHMDT		22
-#define SHMGET		23
-#define SHMCTL		24
-
-/* Used by the DIPC package, try and avoid reusing it */
-#define DIPC            25
-
-#define IPCCALL(version,op)	((version)<<16 | (op))
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/ipcbuf.h linux-2.5.67-bk6/include/asm-s390x/ipcbuf.h
--- linux-2.5.67-bk5/include/asm-s390x/ipcbuf.h	2003-04-07 10:31:46.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ipcbuf.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,28 +0,0 @@
-#ifndef __S390_IPCBUF_H__
-#define __S390_IPCBUF_H__
-
-/*
- * The user_ipc_perm structure for S/390 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct ipc64_perm
-{
-	__kernel_key_t		key;
-	__kernel_uid32_t	uid;
-	__kernel_gid32_t	gid;
-	__kernel_uid32_t	cuid;
-	__kernel_gid32_t	cgid;
-	__kernel_mode_t		mode;
-	unsigned short		__pad1;
-	unsigned short		seq;
-	unsigned long		__unused1;
-	unsigned long		__unused2;
-};
-
-#endif /* __S390_IPCBUF_H__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/irq.h linux-2.5.67-bk6/include/asm-s390x/irq.h
--- linux-2.5.67-bk5/include/asm-s390x/irq.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/irq.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,29 +0,0 @@
-#ifndef _ASM_IRQ_H
-#define _ASM_IRQ_H
-
-#ifdef __KERNEL__
-#include <asm/hardirq.h>
-
-/*
- * the definition of irqs has changed in 2.5.46:
- * NR_IRQS is no longer the number of i/o
- * interrupts (65536), but rather the number
- * of interrupt classes (6).
- */
-
-enum interruption_class {
-	EXTERNAL_INTERRUPT,
-	IO_INTERRUPT,
-	MACHINE_CHECK_INTERRUPT,
-	PROGRAM_INTERRUPT,
-	RESTART_INTERRUPT,
-	SUPERVISOR_CALL,
-
-	NR_IRQS,
-};
-
-#define touch_nmi_watchdog() do { } while(0)
-
-#endif /* __KERNEL__ */
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/kmap_types.h linux-2.5.67-bk6/include/asm-s390x/kmap_types.h
--- linux-2.5.67-bk5/include/asm-s390x/kmap_types.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/kmap_types.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,23 +0,0 @@
-#ifdef __KERNEL__
-#ifndef _ASM_KMAP_TYPES_H
-#define _ASM_KMAP_TYPES_H
-
-enum km_type {
-	KM_BOUNCE_READ,
-	KM_SKB_SUNRPC_DATA,
-	KM_SKB_DATA_SOFTIRQ,
-	KM_USER0,
-	KM_USER1,
-	KM_BIO_SRC_IRQ,
-	KM_BIO_DST_IRQ,
-	KM_PTE0,
-	KM_PTE1,
-	KM_IRQ0,
-	KM_IRQ1,
-	KM_SOFTIRQ0,
-	KM_SOFTIRQ1,	
-	KM_TYPE_NR
-};
-
-#endif
-#endif /* __KERNEL__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/linkage.h linux-2.5.67-bk6/include/asm-s390x/linkage.h
--- linux-2.5.67-bk5/include/asm-s390x/linkage.h	2003-04-07 10:32:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/linkage.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef __ASM_LINKAGE_H
-#define __ASM_LINKAGE_H
-
-/* Nothing to see here... */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/lowcore.h linux-2.5.67-bk6/include/asm-s390x/lowcore.h
--- linux-2.5.67-bk5/include/asm-s390x/lowcore.h	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/lowcore.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,184 +0,0 @@
-
-/*
- *  include/asm-s390/lowcore.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hpenner@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com),
- *               Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- */
-
-#ifndef _ASM_S390_LOWCORE_H
-#define _ASM_S390_LOWCORE_H
-
-#define __LC_EXT_OLD_PSW                0x0130
-#define __LC_SVC_OLD_PSW                0x0140
-#define __LC_PGM_OLD_PSW                0x0150
-#define __LC_MCK_OLD_PSW                0x0160
-#define __LC_IO_OLD_PSW                 0x0170
-#define __LC_EXT_NEW_PSW                0x01b0
-#define __LC_SVC_NEW_PSW                0x01c0
-#define __LC_PGM_NEW_PSW                0x01d0
-#define __LC_MCK_NEW_PSW                0x01e0
-#define __LC_IO_NEW_PSW                 0x01f0
-#define __LC_EXT_PARAMS                 0x080
-#define __LC_CPU_ADDRESS                0x084
-#define __LC_EXT_INT_CODE               0x086
-#define __LC_SVC_ILC                    0x088
-#define __LC_SVC_INT_CODE               0x08A
-#define __LC_PGM_ILC                    0x08C
-#define __LC_PGM_INT_CODE               0x08E
-#define __LC_TRANS_EXC_ADDR             0x0a8
-#define __LC_SUBCHANNEL_ID              0x0B8
-#define __LC_SUBCHANNEL_NR              0x0BA
-#define __LC_IO_INT_PARM                0x0BC
-#define __LC_IO_INT_WORD                0x0C0
-#define __LC_MCCK_CODE                  0x0E8
-
-#define __LC_RETURN_PSW                 0x200
-#define __LC_IRB			0x210
-#define __LC_DIAG44_OPCODE		0x250
-
-#define __LC_SAVE_AREA                  0xC00
-#define __LC_KERNEL_STACK               0xD40
-#define __LC_ASYNC_STACK                0xD48
-#define __LC_CPUID                      0xD90
-#define __LC_CPUADDR                    0xD98
-#define __LC_IPLDEV                     0xDB8
-
-#define __LC_JIFFY_TIMER		0xDC0
-
-#define __LC_PANIC_MAGIC                0xE00
-
-#define __LC_AREGS_SAVE_AREA            0x1340
-#define __LC_CREGS_SAVE_AREA            0x1380
-
-#define __LC_PFAULT_INTPARM             0x11B8
-
-#ifndef __ASSEMBLY__
-
-#include <linux/config.h>
-#include <asm/processor.h>
-#include <linux/types.h>
-#include <asm/atomic.h>
-#include <asm/sigp.h>
-
-void restart_int_handler(void);
-void ext_int_handler(void);
-void system_call(void);
-void pgm_check_handler(void);
-void mcck_int_handler(void);
-void io_int_handler(void);
-
-struct _lowcore
-{
-        /* prefix area: defined by architecture */
-	__u32        ccw1[2];                  /* 0x000 */
-	__u32        ccw2[4];                  /* 0x008 */
-	__u8         pad1[0x80-0x18];          /* 0x018 */
-	__u32        ext_params;               /* 0x080 */
-	__u16        cpu_addr;                 /* 0x084 */
-	__u16        ext_int_code;             /* 0x086 */
-        __u16        svc_ilc;                  /* 0x088 */
-        __u16        svc_code;                 /* 0x08a */
-        __u16        pgm_ilc;                  /* 0x08c */
-        __u16        pgm_code;                 /* 0x08e */
-	__u32        data_exc_code;            /* 0x090 */
-	__u16        mon_class_num;            /* 0x094 */
-	__u16        per_perc_atmid;           /* 0x096 */
-	addr_t       per_address;              /* 0x098 */
-	__u8         exc_access_id;            /* 0x0a0 */
-	__u8         per_access_id;            /* 0x0a1 */
-	__u8         op_access_id;             /* 0x0a2 */
-	__u8         ar_access_id;             /* 0x0a3 */
-	__u8         pad2[0xA8-0xA4];          /* 0x0a4 */
-	addr_t       trans_exc_code;           /* 0x0A0 */
-	addr_t       monitor_code;             /* 0x09c */
-	__u16        subchannel_id;            /* 0x0b8 */
-	__u16        subchannel_nr;            /* 0x0ba */
-	__u32        io_int_parm;              /* 0x0bc */
-	__u32        io_int_word;              /* 0x0c0 */
-	__u8         pad3[0xc8-0xc4];          /* 0x0c4 */
-	__u32        stfl_fac_list;            /* 0x0c8 */
-	__u8         pad4[0xe8-0xcc];          /* 0x0cc */
-	__u32        mcck_interruption_code[2]; /* 0x0e8 */
-	__u8         pad5[0xf4-0xf0];          /* 0x0f0 */
-	__u32        external_damage_code;     /* 0x0f4 */
-	addr_t       failing_storage_address;  /* 0x0f8 */
-	__u8         pad6[0x120-0x100];        /* 0x100 */
-	psw_t        restart_old_psw;          /* 0x120 */
-	psw_t        external_old_psw;         /* 0x130 */
-	psw_t        svc_old_psw;              /* 0x140 */
-	psw_t        program_old_psw;          /* 0x150 */
-	psw_t        mcck_old_psw;             /* 0x160 */
-	psw_t        io_old_psw;               /* 0x170 */
-	__u8         pad7[0x1a0-0x180];        /* 0x180 */
-	psw_t        restart_psw;              /* 0x1a0 */
-	psw_t        external_new_psw;         /* 0x1b0 */
-	psw_t        svc_new_psw;              /* 0x1c0 */
-	psw_t        program_new_psw;          /* 0x1d0 */
-	psw_t        mcck_new_psw;             /* 0x1e0 */
-	psw_t        io_new_psw;               /* 0x1f0 */
-        psw_t        return_psw;               /* 0x200 */
-	__u8	     irb[64];		       /* 0x210 */
-	__u32        diag44_opcode;            /* 0x250 */
-        __u8         pad8[0xc00-0x254];        /* 0x254 */
-        /* System info area */
-	__u64        save_area[16];            /* 0xc00 */
-        __u8         pad9[0xd40-0xc80];        /* 0xc80 */
- 	__u64        kernel_stack;             /* 0xd40 */
-	__u64        async_stack;              /* 0xd48 */
-	/* entry.S sensitive area start */
-	__u8         pad10[0xd80-0xd50];       /* 0xd64 */
-	struct       cpuinfo_S390 cpu_data;    /* 0xd80 */
-	__u32        ipl_device;               /* 0xdb8 */
-	__u32        pad11;                    /* 0xdbc */
-	/* entry.S sensitive area end */
-
-        /* SMP info area: defined by DJB */
-        __u64        jiffy_timer;              /* 0xdc0 */
-	__u64        ext_call_fast;            /* 0xdc8 */
-        __u8         pad12[0xe00-0xdd0];       /* 0xdd0 */
-
-        /* 0xe00 is used as indicator for dump tools */
-        /* whether the kernel died with panic() or not */
-        __u32        panic_magic;              /* 0xe00 */
-
-	__u8         pad13[0x1200-0xe04];      /* 0xe04 */
-
-        /* System info area */ 
-
-	__u64        floating_pt_save_area[16]; /* 0x1200 */
-	__u64        gpregs_save_area[16];      /* 0x1280 */
-	__u32        st_status_fixed_logout[4]; /* 0x1300 */
-	__u8         pad14[0x1318-0x1310];      /* 0x1310 */
-	__u32        prefixreg_save_area;       /* 0x1318 */
-	__u32        fpt_creg_save_area;        /* 0x131c */
-	__u8         pad15[0x1324-0x1320];      /* 0x1320 */
-	__u32        tod_progreg_save_area;     /* 0x1324 */
-	__u32        cpu_timer_save_area[2];    /* 0x1328 */
-	__u32        clock_comp_save_area[2];   /* 0x1330 */
-	__u8         pad16[0x1340-0x1338];      /* 0x1338 */ 
-	__u32        access_regs_save_area[16]; /* 0x1340 */ 
-	__u64        cregs_save_area[16];       /* 0x1380 */
-
-	/* align to the top of the prefix area */
-
-	__u8         pad17[0x2000-0x1400];      /* 0x1400 */
-} __attribute__((packed)); /* End structure*/
-
-#define S390_lowcore (*((struct _lowcore *) 0))
-extern struct _lowcore *lowcore_ptr[];
-
-extern __inline__ void set_prefix(__u32 address)
-{
-        __asm__ __volatile__ ("spx %0" : : "m" (address) : "memory" );
-}
-
-#define __PANIC_MAGIC           0xDEADC0DE
-
-#endif
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/mman.h linux-2.5.67-bk6/include/asm-s390x/mman.h
--- linux-2.5.67-bk5/include/asm-s390x/mman.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/mman.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,49 +0,0 @@
-/*
- *  include/asm-s390/mman.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/mman.h"
- */
-
-#ifndef __S390_MMAN_H__
-#define __S390_MMAN_H__
-
-#define PROT_READ	0x1		/* page can be read */
-#define PROT_WRITE	0x2		/* page can be written */
-#define PROT_EXEC	0x4		/* page can be executed */
-#define PROT_SEM	0x8		/* page may be used for atomic ops */
-#define PROT_NONE	0x0		/* page can not be accessed */
-
-#define MAP_SHARED	0x01		/* Share changes */
-#define MAP_PRIVATE	0x02		/* Changes are private */
-#define MAP_TYPE	0x0f		/* Mask for type of mapping */
-#define MAP_FIXED	0x10		/* Interpret addr exactly */
-#define MAP_ANONYMOUS	0x20		/* don't use a file */
-
-#define MAP_GROWSDOWN	0x0100		/* stack-like segment */
-#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
-#define MAP_EXECUTABLE	0x1000		/* mark it as an executable */
-#define MAP_LOCKED	0x2000		/* pages are locked */
-#define MAP_NORESERVE	0x4000		/* don't check for reservations */
-#define MAP_POPULATE	0x8000		/* populate (prefault) pagetables */
-#define MAP_NONBLOCK	0x10000		/* do not block on IO */
-
-#define MS_ASYNC	1		/* sync memory asynchronously */
-#define MS_INVALIDATE	2		/* invalidate the caches */
-#define MS_SYNC		4		/* synchronous memory sync */
-
-#define MCL_CURRENT	1		/* lock all current mappings */
-#define MCL_FUTURE	2		/* lock all future mappings */
-
-#define MADV_NORMAL    0x0              /* default page-in behavior */
-#define MADV_RANDOM    0x1              /* page-in minimum required */
-#define MADV_SEQUENTIAL        0x2             /* read-ahead aggressively */
-#define MADV_WILLNEED  0x3              /* pre-fault pages */
-#define MADV_DONTNEED  0x4              /* discard these pages */
-
-/* compatibility flags */
-#define MAP_ANON	MAP_ANONYMOUS
-#define MAP_FILE	0
-
-#endif /* __S390_MMAN_H__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/mmu.h linux-2.5.67-bk6/include/asm-s390x/mmu.h
--- linux-2.5.67-bk5/include/asm-s390x/mmu.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/mmu.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,7 +0,0 @@
-#ifndef __MMU_H
-#define __MMU_H
-
-/* Default "unsigned long" context */
-typedef unsigned long mm_context_t;
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/mmu_context.h linux-2.5.67-bk6/include/asm-s390x/mmu_context.h
--- linux-2.5.67-bk5/include/asm-s390x/mmu_context.h	2003-04-07 10:30:38.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/mmu_context.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,47 +0,0 @@
-/*
- *  include/asm-s390/mmu_context.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/mmu_context.h"
- */
-
-#ifndef __S390_MMU_CONTEXT_H
-#define __S390_MMU_CONTEXT_H
-
-/*
- * get a new mmu context.. S390 don't know about contexts.
- */
-#define init_new_context(tsk,mm)        0
-
-#define destroy_context(mm)             flush_tlb_mm(mm)
-
-static inline void enter_lazy_tlb(struct mm_struct *mm,
-                                  struct task_struct *tsk, unsigned cpu)
-{
-}
-
-static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
-                             struct task_struct *tsk, unsigned cpu)
-{
-        unsigned long pgd;
-
-        if (prev != next) {
-                pgd = (__pa(next->pgd)&PAGE_MASK) | (_REGION_TABLE|USER_STD_MASK);
-                /* Load page tables */
-                asm volatile("    lctlg 7,7,%0\n"   /* secondary space */
-                             "    lctlg 13,13,%0\n" /* home space */
-                             : : "m" (pgd) );
-        }
-	set_bit(cpu, &next->cpu_vm_mask);
-}
-
-#define deactivate_mm(tsk,mm)	do { } while (0)
-
-extern inline void activate_mm(struct mm_struct *prev,
-                               struct mm_struct *next)
-{
-        switch_mm(prev, next, current, smp_processor_id());
-}
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/module.h linux-2.5.67-bk6/include/asm-s390x/module.h
--- linux-2.5.67-bk5/include/asm-s390x/module.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/module.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,43 +0,0 @@
-#ifndef _ASM_S390_MODULE_H
-#define _ASM_S390_MODULE_H
-/*
- * This file contains the s390 architecture specific module code.
- */
-
-struct mod_arch_syminfo
-{
-	unsigned long got_offset;
-	unsigned long plt_offset;
-	int got_initialized;
-	int plt_initialized;
-};
-
-struct mod_arch_specific
-{
-	/* Starting offset of got in the module core memory. */
-	unsigned long got_offset;
-	/* Starting offset of plt in the module core memory. */
-	unsigned long plt_offset;
-	/* Size of the got. */
-	unsigned long got_size;
-	/* Size of the plt. */
-	unsigned long plt_size;
-	/* Number of symbols in syminfo. */
-	int nsyms;
-	/* Additional symbol information (got and plt offsets). */
-	struct mod_arch_syminfo *syminfo;
-};
-
-#ifdef CONFIG_ARCH_S390X
-#define ElfW(x) Elf64_ ## x
-#define ELFW(x) ELF64_ ## x
-#else
-#define ElfW(x) Elf32_ ## x
-#define ELFW(x) ELF64_ ## x
-#endif
-
-#define Elf_Shdr ElfW(Shdr)
-#define Elf_Sym ElfW(Sym)
-#define Elf_Ehdr ElfW(Ehdr)
-#define ELF_R_TYPE ELFW(R_TYPE)
-#endif /* _ASM_S390_MODULE_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/msgbuf.h linux-2.5.67-bk6/include/asm-s390x/msgbuf.h
--- linux-2.5.67-bk5/include/asm-s390x/msgbuf.h	2003-04-07 10:31:07.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/msgbuf.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,27 +0,0 @@
-#ifndef _S390_MSGBUF_H
-#define _S390_MSGBUF_H
-
-/* 
- * The msqid64_ds structure for S/390 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 64-bit values
- */
-
-struct msqid64_ds {
-	struct ipc64_perm msg_perm;
-	__kernel_time_t msg_stime;	/* last msgsnd time */
-	__kernel_time_t msg_rtime;	/* last msgrcv time */
-	__kernel_time_t msg_ctime;	/* last change time */
-	unsigned long  msg_cbytes;	/* current number of bytes on queue */
-	unsigned long  msg_qnum;	/* number of messages in queue */
-	unsigned long  msg_qbytes;	/* max number of bytes on queue */
-	__kernel_pid_t msg_lspid;	/* pid of last msgsnd */
-	__kernel_pid_t msg_lrpid;	/* last receive pid */
-	unsigned long  __unused1;
-	unsigned long  __unused2;
-};
-
-#endif /* _S390_MSGBUF_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/namei.h linux-2.5.67-bk6/include/asm-s390x/namei.h
--- linux-2.5.67-bk5/include/asm-s390x/namei.h	2003-04-07 10:32:17.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/namei.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,21 +0,0 @@
-/*
- *  include/asm-s390/namei.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/namei.h"
- *
- *  Included from linux/fs/namei.c
- */
-
-#ifndef __S390_NAMEI_H
-#define __S390_NAMEI_H
-
-/* This dummy routine maybe changed to something useful
- * for /usr/gnemul/ emulation stuff.
- * Look at asm-sparc/namei.h for details.
- */
-
-#define __emul_prefix() NULL
-
-#endif /* __S390_NAMEI_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/page.h linux-2.5.67-bk6/include/asm-s390x/page.h
--- linux-2.5.67-bk5/include/asm-s390x/page.h	2003-04-07 10:31:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/page.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,120 +0,0 @@
-/*
- *  include/asm-s390/page.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hpenner@de.ibm.com)
- */
-
-#ifndef _S390_PAGE_H
-#define _S390_PAGE_H
-
-#include <asm/setup.h>
-
-/* PAGE_SHIFT determines the page size */
-#define PAGE_SHIFT      12
-#define PAGE_SIZE       (1UL << PAGE_SHIFT)
-#define PAGE_MASK       (~(PAGE_SIZE-1))
-
-#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
-static inline void clear_page(void *page)
-{
-        asm volatile ("   lgr  2,%0\n"
-                      "   lghi 3,4096\n"
-                      "   slgr 1,1\n"
-                      "   mvcl 2,0"
-                      : : "a" ((void *) (page))
-		      : "memory", "cc", "1", "2", "3" );
-}
-
-static inline void copy_page(void *to, void *from)
-{
-        if (MACHINE_HAS_MVPG)
-		asm volatile ("   sgr  0,0\n"
-			      "   mvpg %0,%1"
-			      : : "a" ((void *)(to)), "a" ((void *)(from))
-			      : "memory", "cc", "0" );
-	else
-		asm volatile ("   mvc  0(256,%0),0(%1)\n"
-			      "   mvc  256(256,%0),256(%1)\n"
-			      "   mvc  512(256,%0),512(%1)\n"
-			      "   mvc  768(256,%0),768(%1)\n"
-			      "   mvc  1024(256,%0),1024(%1)\n"
-			      "   mvc  1280(256,%0),1280(%1)\n"
-			      "   mvc  1536(256,%0),1536(%1)\n"
-			      "   mvc  1792(256,%0),1792(%1)\n"
-			      "   mvc  2048(256,%0),2048(%1)\n"
-			      "   mvc  2304(256,%0),2304(%1)\n"
-			      "   mvc  2560(256,%0),2560(%1)\n"
-			      "   mvc  2816(256,%0),2816(%1)\n"
-			      "   mvc  3072(256,%0),3072(%1)\n"
-			      "   mvc  3328(256,%0),3328(%1)\n"
-			      "   mvc  3584(256,%0),3584(%1)\n"
-			      "   mvc  3840(256,%0),3840(%1)\n"
-			      : : "a"((void *)(to)),"a"((void *)(from)) 
-			      : "memory" );
-}
-
-#define clear_user_page(page, vaddr, pg)    clear_page(page)
-#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
-
-/* Pure 2^n version of get_order */
-extern __inline__ int get_order(unsigned long size)
-{
-        int order;
-
-        size = (size-1) >> (PAGE_SHIFT-1);
-        order = -1;
-        do {
-                size >>= 1;
-                order++;
-        } while (size);
-        return order;
-}
-
-/*
- * These are used to make use of C type-checking..
- */
-typedef struct { unsigned long pte; } pte_t;
-typedef struct { 
-        unsigned long pmd0;
-        unsigned long pmd1; 
-        } pmd_t;
-typedef struct { unsigned long pgd; } pgd_t;
-typedef struct { unsigned long pgprot; } pgprot_t;
-
-#define pte_val(x)      ((x).pte)
-#define pmd_val(x)      ((x).pmd0)
-#define pmd_val1(x)     ((x).pmd1)
-#define pgd_val(x)      ((x).pgd)
-#define pgprot_val(x)   ((x).pgprot)
-
-#define __pte(x)        ((pte_t) { (x) } )
-#define __pmd(x)        ((pmd_t) { (x) } )
-#define __pgd(x)        ((pgd_t) { (x) } )
-#define __pgprot(x)     ((pgprot_t) { (x) } )
-
-#endif                                 /* !__ASSEMBLY__                    */
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
-#define __PAGE_OFFSET           0x0UL
-#define PAGE_OFFSET             0x0UL
-#define __pa(x)                 (unsigned long)(x)
-#define __va(x)                 (void *)(unsigned long)(x)
-#define pfn_to_page(pfn)	(mem_map + (pfn))
-#define page_to_pfn(page)	((unsigned long)((page) - mem_map))
-#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-
-#define pfn_valid(pfn)		((pfn) < max_mapnr)
-#define virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
-
-#define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
-				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-
-#endif                                 /* __KERNEL__                       */
-
-#endif                                 /* _S390_PAGE_H                     */
diff -urN linux-2.5.67-bk5/include/asm-s390x/param.h linux-2.5.67-bk6/include/asm-s390x/param.h
--- linux-2.5.67-bk5/include/asm-s390x/param.h	2003-04-07 10:30:33.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/param.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-/*
- *  include/asm-s390/param.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/param.h"
- */
-
-#ifndef _ASMS390_PARAM_H
-#define _ASMS390_PARAM_H
-
-#ifdef __KERNEL__
-# define HZ		100		/* Internal kernel timer frequency */
-# define USER_HZ	100		/* .. some user interfaces are in "ticks" */
-# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
-#endif
-
-#ifndef HZ
-#define HZ 100
-#endif
-
-#define EXEC_PAGESIZE	4096
-
-#ifndef NGROUPS
-#define NGROUPS		32
-#endif
-
-#ifndef NOGROUP
-#define NOGROUP		(-1)
-#endif
-
-#define MAXHOSTNAMELEN	64	/* max length of hostname */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/pci.h linux-2.5.67-bk6/include/asm-s390x/pci.h
--- linux-2.5.67-bk5/include/asm-s390x/pci.h	2003-04-07 10:31:48.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/pci.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,10 +0,0 @@
-#ifndef __ASM_S390_PCI_H
-#define __ASM_S390_PCI_H
-
-/* S/390 systems 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_S390_PCI_H */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/percpu.h linux-2.5.67-bk6/include/asm-s390x/percpu.h
--- linux-2.5.67-bk5/include/asm-s390x/percpu.h	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/percpu.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef __ARCH_S390X_PERCPU__
-#define __ARCH_S390X_PERCPU__
-
-#include <asm-generic/percpu.h>
-
-#endif /* __ARCH_S390X_PERCPU__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/pgalloc.h linux-2.5.67-bk6/include/asm-s390x/pgalloc.h
--- linux-2.5.67-bk5/include/asm-s390x/pgalloc.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/pgalloc.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,154 +0,0 @@
-/*
- *  include/asm-s390/pgalloc.h
- *
- *  S390 version
- *    Copyright (C) 1999, 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hpenner@de.ibm.com)
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/pgalloc.h"
- *    Copyright (C) 1994  Linus Torvalds
- */
-
-#ifndef _S390_PGALLOC_H
-#define _S390_PGALLOC_H
-
-#include <linux/config.h>
-#include <asm/processor.h>
-#include <linux/threads.h>
-#include <linux/gfp.h>
-#include <linux/mm.h>
-
-#define check_pgt_cache()	do { } while (0)
-
-/*
- * Allocate and free page tables. The xxx_kernel() versions are
- * used to allocate a kernel page table - this turns on ASN bits
- * if any.
- */
-
-static inline pgd_t *pgd_alloc (struct mm_struct *mm)
-{
-	pgd_t *pgd;
-	int i;
-
-	pgd = (pgd_t *) __get_free_pages(GFP_KERNEL,2);
-        if (pgd != NULL)
-		for (i = 0; i < PTRS_PER_PGD; i++)
-			pgd_clear(pgd + i);
-	return pgd;
-}
-
-static inline void pgd_free (pgd_t *pgd)
-{
-        free_pages((unsigned long) pgd, 2);
-}
-
-static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
-{
-	pgd_val(*pgd) = _PGD_ENTRY | __pa(pmd);
-}
-
-/*
- * page middle directory allocation/free routines.
- */
-static inline pmd_t * pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
-{
-	pmd_t *pmd;
-        int i;
-
-	pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 2);
-	if (pmd != NULL) {
-		for (i=0; i < PTRS_PER_PMD; i++)
-			pmd_clear(pmd+i);
-	}
-	return pmd;
-}
-
-static inline void pmd_free (pmd_t *pmd)
-{
-	free_pages((unsigned long) pmd, 2);
-}
-
-#define __pmd_free_tlb(tlb,pmd) pmd_free(pmd)
-
-static inline void
-pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
-{
-	pmd_val(*pmd) = _PMD_ENTRY + __pa(pte);
-	pmd_val1(*pmd) = _PMD_ENTRY + __pa(pte+256);
-}
-
-static inline void
-pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *page)
-{
-	pmd_populate_kernel(mm, pmd, (pte_t *)((page-mem_map) << PAGE_SHIFT));
-}
-
-/*
- * page table entry allocation/free routines.
- */
-static inline pte_t *
-pte_alloc_one_kernel(struct mm_struct *mm, unsigned long vmaddr)
-{
-	pte_t *pte;
-	int count;
-        int i;
-
-	count = 0;
-	do {
-		pte = (pte_t *) __get_free_page(GFP_KERNEL);
-		if (pte != NULL) {
-			for (i=0; i < PTRS_PER_PTE; i++)
-				pte_clear(pte+i);
-		} else {
-			current->state = TASK_UNINTERRUPTIBLE;
-			schedule_timeout(HZ);
-		}
-	} while (!pte && (count++ < 10));
-	return pte;
-}
-
-static inline struct page *
-pte_alloc_one(struct mm_struct *mm, unsigned long addr)
-{
-	return virt_to_page(pte_alloc_one_kernel(mm, addr));
-}
-
-static inline void pte_free_kernel(pte_t *pte)
-{
-        free_page((unsigned long) pte);
-}
-
-static inline void pte_free(struct page *pte)
-{
-        __free_page(pte);
-}
-
-#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
-
-/*
- * This establishes kernel virtual mappings (e.g., as a result of a
- * vmalloc call).  Since s390-esame uses a separate kernel page table,
- * there is nothing to do here... :)
- */
-#define set_pgdir(vmaddr, entry)	do { } while(0)
-
-static inline pte_t ptep_invalidate(struct vm_area_struct *vma, 
-                                    unsigned long address, pte_t *ptep)
-{
-	pte_t pte = *ptep;
-	if (!(pte_val(pte) & _PAGE_INVALID)) 
-		__asm__ __volatile__ ("ipte %0,%1" : : "a" (ptep), "a" (address));
-	pte_clear(ptep);
-	return pte;
-}
-
-static inline void ptep_establish(struct vm_area_struct *vma, 
-                                  unsigned long address, pte_t *ptep, pte_t entry)
-{
-	ptep_invalidate(vma, address, ptep);
-	set_pte(ptep, entry);
-}
-
-#endif /* _S390_PGALLOC_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/pgtable.h linux-2.5.67-bk6/include/asm-s390x/pgtable.h
--- linux-2.5.67-bk5/include/asm-s390x/pgtable.h	2003-04-07 10:31:08.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/pgtable.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,550 +0,0 @@
-/*
- *  include/asm-s390/pgtable.h
- *
- *  S390 64bit version
- *    Copyright (C) 2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com)
- *               Ulrich Weigand (weigand@de.ibm.com)
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/pgtable.h"
- */
-
-#ifndef _ASM_S390_PGTABLE_H
-#define _ASM_S390_PGTABLE_H
-
-/*
- * The Linux memory management assumes a three-level page table setup. On
- * the S390, we use that, but "fold" the mid level into the top-level page
- * table, so that we physically have the same two-level page table as the
- * S390 mmu expects.
- *
- * This file contains the functions and defines necessary to modify and use
- * the S390 page table tree.
- */
-#ifndef __ASSEMBLY__
-#include <asm/processor.h>
-#include <linux/threads.h>
-
-extern pgd_t swapper_pg_dir[] __attribute__ ((aligned (4096)));
-extern void paging_init(void);
-
-/*
- * The S390 doesn't have any external MMU info: the kernel page
- * tables contain all the necessary information.
- */
-#define update_mmu_cache(vma, address, pte)     do { } while (0)
-
-/*
- * ZERO_PAGE is a global shared page that is always zero: used
- * for zero-mapped memory areas etc..
- */
-extern char empty_zero_page[PAGE_SIZE];
-#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
-#endif /* !__ASSEMBLY__ */
-
-/*
- * PMD_SHIFT determines the size of the area a second-level page
- * table can map
- */
-#define PMD_SHIFT       21
-#define PMD_SIZE        (1UL << PMD_SHIFT)
-#define PMD_MASK        (~(PMD_SIZE-1))
-
-/* PGDIR_SHIFT determines what a third-level page table entry can map */
-#define PGDIR_SHIFT     31
-#define PGDIR_SIZE      (1UL << PGDIR_SHIFT)
-#define PGDIR_MASK      (~(PGDIR_SIZE-1))
-
-/*
- * entries per page directory level: the S390 is two to five-level,
- * currently we use a 3 level lookup
- */
-#define PTRS_PER_PTE    512
-#define PTRS_PER_PMD    1024
-#define PTRS_PER_PGD    2048
-
-/*
- * pgd entries used up by user/kernel:
- */
-#define USER_PTRS_PER_PGD  2048
-#define USER_PGD_PTRS      2048
-#define KERNEL_PGD_PTRS    2048
-#define FIRST_USER_PGD_NR  0
-
-#define pte_ERROR(e) \
-	printk("%s:%d: bad pte %016lx.\n", __FILE__, __LINE__, pte_val(e))
-#define pmd_ERROR(e) \
-	printk("%s:%d: bad pmd %016lx.\n", __FILE__, __LINE__, pmd_val(e))
-#define pgd_ERROR(e) \
-	printk("%s:%d: bad pgd %016lx.\n", __FILE__, __LINE__, pgd_val(e))
-
-#ifndef __ASSEMBLY__
-/*
- * Just any arbitrary offset to the start of the vmalloc VM area: the
- * current 8MB value just means that there will be a 8MB "hole" after the
- * physical memory until the kernel virtual memory starts.  That means that
- * any out-of-bounds memory accesses will hopefully be caught.
- * The vmalloc() routines leaves a hole of 4kB between each vmalloced
- * area for the same reason. ;)
- */
-#define VMALLOC_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     (0x40000000000L)
-
-
-/*
- * A pagetable entry of S390 has following format:
- * |                     PFRA                         |0IP0|  OS  |
- * 0000000000111111111122222222223333333333444444444455555555556666
- * 0123456789012345678901234567890123456789012345678901234567890123
- *
- * I Page-Invalid Bit:    Page is not available for address-translation
- * P Page-Protection Bit: Store access not possible for page
- *
- * A segmenttable entry of S390 has following format:
- * |        P-table origin                              |      TT
- * 0000000000111111111122222222223333333333444444444455555555556666
- * 0123456789012345678901234567890123456789012345678901234567890123
- *
- * I Segment-Invalid Bit:    Segment is not available for address-translation
- * C Common-Segment Bit:     Segment is not private (PoP 3-30)
- * P Page-Protection Bit: Store access not possible for page
- * TT Type 00
- *
- * A region table entry of S390 has following format:
- * |        S-table origin                             |   TF  TTTL
- * 0000000000111111111122222222223333333333444444444455555555556666
- * 0123456789012345678901234567890123456789012345678901234567890123
- *
- * I Segment-Invalid Bit:    Segment is not available for address-translation
- * TT Type 01
- * TF
- * TL Table lenght
- *
- * The regiontable origin of S390 has following format:
- * |      region table origon                          |       DTTL
- * 0000000000111111111122222222223333333333444444444455555555556666
- * 0123456789012345678901234567890123456789012345678901234567890123
- *
- * X Space-Switch event:
- * G Segment-Invalid Bit:  
- * P Private-Space Bit:    
- * S Storage-Alteration:
- * R Real space
- * TL Table-Length:
- *
- * A storage key has the following format:
- * | ACC |F|R|C|0|
- *  0   3 4 5 6 7
- * ACC: access key
- * F  : fetch protection bit
- * R  : referenced bit
- * C  : changed bit
- */
-
-/* Bits in the page table entry */
-#define _PAGE_PRESENT   0x001          /* Software                         */
-#define _PAGE_MKCLEAN   0x002          /* Software                         */
-#define _PAGE_ISCLEAN   0x004          /* Software                         */
-#define _PAGE_RO        0x200          /* HW read-only                     */
-#define _PAGE_INVALID   0x400          /* HW invalid                       */
-
-/* Bits in the segment table entry */
-#define _PMD_ENTRY_INV   0x20          /* invalid segment table entry      */
-#define _PMD_ENTRY       0x00        
-
-/* Bits in the region third table entry */
-#define _PGD_ENTRY_INV   0x20          /* invalid region table entry       */
-#define _PGD_ENTRY       0x07
-
-/*
- * User and kernel page directory
- */
-#define _REGION_THIRD       0x4
-#define _REGION_THIRD_LEN   0x3 
-#define _REGION_TABLE       (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100)
-#define _KERN_REGION_TABLE  (_REGION_THIRD|_REGION_THIRD_LEN)
-
-#define USER_STD_MASK           0x0000000000000080UL
-
-/* Bits in the storage key */
-#define _PAGE_CHANGED    0x02          /* HW changed bit                   */
-#define _PAGE_REFERENCED 0x04          /* HW referenced bit                */
-
-/*
- * No mapping available
- */
-#define PAGE_INVALID	  __pgprot(_PAGE_INVALID)
-#define PAGE_NONE_SHARED  __pgprot(_PAGE_PRESENT|_PAGE_INVALID)
-#define PAGE_NONE_PRIVATE __pgprot(_PAGE_PRESENT|_PAGE_INVALID|_PAGE_ISCLEAN)
-#define PAGE_RO_SHARED	  __pgprot(_PAGE_PRESENT|_PAGE_RO)
-#define PAGE_RO_PRIVATE	  __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN)
-#define PAGE_COPY	  __pgprot(_PAGE_PRESENT|_PAGE_RO|_PAGE_ISCLEAN)
-#define PAGE_SHARED	  __pgprot(_PAGE_PRESENT)
-#define PAGE_KERNEL	  __pgprot(_PAGE_PRESENT)
-
-/*
- * The S390 can't do page protection for execute, and considers that the
- * same are read. Also, write permissions imply read permissions. This is
- * the closest we can get..
- */
-#define __P000  PAGE_NONE_PRIVATE
-#define __P001  PAGE_RO_PRIVATE
-#define __P010  PAGE_COPY
-#define __P011  PAGE_COPY
-#define __P100  PAGE_RO_PRIVATE
-#define __P101  PAGE_RO_PRIVATE
-#define __P110  PAGE_COPY
-#define __P111  PAGE_COPY
-
-#define __S000  PAGE_NONE_SHARED
-#define __S001  PAGE_RO_SHARED
-#define __S010  PAGE_SHARED
-#define __S011  PAGE_SHARED
-#define __S100  PAGE_RO_SHARED
-#define __S101  PAGE_RO_SHARED
-#define __S110  PAGE_SHARED
-#define __S111  PAGE_SHARED
-
-/*
- * Certain architectures need to do special things when PTEs
- * within a page table are directly modified.  Thus, the following
- * hook is made available.
- */
-extern inline void set_pte(pte_t *pteptr, pte_t pteval)
-{
-	if ((pte_val(pteval) & (_PAGE_MKCLEAN|_PAGE_INVALID))
-	    == _PAGE_MKCLEAN) 
-	{
-		pte_val(pteval) &= ~_PAGE_MKCLEAN;
-               
-		asm volatile ("sske %0,%1" 
-				: : "d" (0), "a" (pte_val(pteval)));
-	}
-
-	*pteptr = pteval;
-}
-
-/*
- * pgd/pmd/pte query functions
- */
-extern inline int pgd_present(pgd_t pgd)
-{
-	return (pgd_val(pgd) & ~PAGE_MASK) == _PGD_ENTRY;
-}
-
-extern inline int pgd_none(pgd_t pgd)
-{
-	return pgd_val(pgd) & _PGD_ENTRY_INV;
-}
-
-extern inline int pgd_bad(pgd_t pgd)
-{
-	return (pgd_val(pgd) & (~PAGE_MASK & ~_PGD_ENTRY_INV)) != _PGD_ENTRY;
-}
-
-extern inline int pmd_present(pmd_t pmd)
-{
-	return (pmd_val(pmd) & ~PAGE_MASK) == _PMD_ENTRY;
-}
-
-extern inline int pmd_none(pmd_t pmd)
-{
-	return pmd_val(pmd) & _PMD_ENTRY_INV;
-}
-
-extern inline int pmd_bad(pmd_t pmd)
-{
-	return (pmd_val(pmd) & (~PAGE_MASK & ~_PMD_ENTRY_INV)) != _PMD_ENTRY;
-}
-
-extern inline int pte_present(pte_t pte)
-{
-	return pte_val(pte) & _PAGE_PRESENT;
-}
-
-extern inline int pte_none(pte_t pte)
-{
-	return ((pte_val(pte) & 
-		 (_PAGE_INVALID | _PAGE_RO | _PAGE_PRESENT)) == _PAGE_INVALID);
-} 
-
-#define pte_same(a,b)	(pte_val(a) == pte_val(b))
-
-/*
- * query functions pte_write/pte_dirty/pte_young only work if
- * pte_present() is true. Undefined behaviour if not..
- */
-extern inline int pte_write(pte_t pte)
-{
-	return (pte_val(pte) & _PAGE_RO) == 0;
-}
-
-extern inline int pte_dirty(pte_t pte)
-{
-	int skey;
-
-	if (pte_val(pte) & _PAGE_ISCLEAN)
-		return 0;
-	asm volatile ("iske %0,%1" : "=d" (skey) : "a" (pte_val(pte)));
-	return skey & _PAGE_CHANGED;
-}
-
-extern inline int pte_young(pte_t pte)
-{
-	int skey;
-
-	asm volatile ("iske %0,%1" : "=d" (skey) : "a" (pte_val(pte)));
-	return skey & _PAGE_REFERENCED;
-}
-
-/*
- * pgd/pmd/pte modification functions
- */
-extern inline void pgd_clear(pgd_t * pgdp)
-{
-	pgd_val(*pgdp) = _PGD_ENTRY_INV | _PGD_ENTRY;
-}
-
-extern inline void pmd_clear(pmd_t * pmdp)
-{
-	pmd_val(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
-	pmd_val1(*pmdp) = _PMD_ENTRY_INV | _PMD_ENTRY;
-}
-
-extern inline void pte_clear(pte_t *ptep)
-{
-	pte_val(*ptep) = _PAGE_INVALID;
-}
-
-/*
- * The following pte_modification functions only work if 
- * pte_present() is true. Undefined behaviour if not..
- */
-extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
-{
-	pte_val(pte) &= PAGE_MASK | _PAGE_ISCLEAN;
-	pte_val(pte) |= pgprot_val(newprot) & ~_PAGE_ISCLEAN;
-	return pte; 
-}
-
-extern inline pte_t pte_wrprotect(pte_t pte)
-{
-	pte_val(pte) |= _PAGE_RO;
-	return pte;
-}
-
-extern inline pte_t pte_mkwrite(pte_t pte)
-{
-	pte_val(pte) &= ~(_PAGE_RO | _PAGE_ISCLEAN);
-	return pte;
-}
-
-extern inline pte_t pte_mkclean(pte_t pte)
-{
-	/* The only user of pte_mkclean is the fork() code.
-	   We must *not* clear the *physical* page dirty bit
-	   just because fork() wants to clear the dirty bit in
-	   *one* of the page's mappings.  So we just do nothing. */
-	return pte;
-}
-
-extern inline pte_t pte_mkdirty(pte_t pte)
-{ 
-	/* We do not explicitly set the dirty bit because the
-	 * sske instruction is slow. It is faster to let the
-	 * next instruction set the dirty bit.
-	 */
-	pte_val(pte) &= ~(_PAGE_MKCLEAN | _PAGE_ISCLEAN);
-	return pte;
-}
-
-extern inline pte_t pte_mkold(pte_t pte)
-{
-	asm volatile ("rrbe 0,%0" : : "a" (pte_val(pte)) : "cc" );
-	return pte;
-}
-
-extern inline pte_t pte_mkyoung(pte_t pte)
-{
-	/* To set the referenced bit we read the first word from the real
-	 * page with a special instruction: load using real address (lura).
-	 * Isn't S/390 a nice architecture ?! */
-	asm volatile ("lura 0,%0" : : "a" (pte_val(pte) & PAGE_MASK) : "0" );
-	return pte;
-}
-
-static inline int ptep_test_and_clear_young(pte_t *ptep)
-{
-	int ccode;
-
-	asm volatile ("rrbe 0,%1\n\t"
-		      "ipm  %0\n\t"
-		      "srl  %0,28\n\t"
-		      : "=d" (ccode) : "a" (pte_val(*ptep)) : "cc" );
-	return ccode & 2;
-}
-
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
-{
-	int skey;
-
-	if (pte_val(*ptep) & _PAGE_ISCLEAN)
-		return 0;
-	asm volatile ("iske %0,%1" : "=d" (skey) : "a" (*ptep));
-	if ((skey & _PAGE_CHANGED) == 0)
-		return 0;
-	/* We can't clear the changed bit atomically. For now we
-         * clear (!) the page referenced bit. */
-	asm volatile ("sske %0,%1" 
-	              : : "d" (0), "a" (*ptep));
-	return 1;
-}
-
-static inline pte_t ptep_get_and_clear(pte_t *ptep)
-{
-	pte_t pte = *ptep;
-	pte_clear(ptep);
-	return pte;
-}
-
-static inline void ptep_set_wrprotect(pte_t *ptep)
-{
-	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_wrprotect(old_pte));
-}
-
-static inline void ptep_mkdirty(pte_t *ptep)
-{
-	pte_mkdirty(*ptep);
-}
-
-/*
- * Conversion functions: convert a page and protection to a page entry,
- * and a page entry and page directory to the page they refer to.
- */
-extern inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
-{
-	pte_t __pte;
-	pte_val(__pte) = physpage + pgprot_val(pgprot);
-	return __pte;
-}
-
-#define mk_pte(pg, pgprot)                                                \
-({                                                                        \
-	struct page *__page = (pg);                                       \
-	pgprot_t __pgprot = (pgprot);					  \
-	unsigned long __physpage = __pa((__page-mem_map) << PAGE_SHIFT);  \
-	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
- 	                                                                  \
-	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
-			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
-	}								  \
-	__pte;                                                            \
-})
-
-#define pfn_pte(pfn, pgprot)                                              \
-({                                                                        \
-	struct page *__page = mem_map+(pfn);                              \
-	pgprot_t __pgprot = (pgprot);					  \
-	unsigned long __physpage = __pa((pfn) << PAGE_SHIFT);             \
-	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
-	                                                                  \
-	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
-			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
-	}								  \
-	__pte;                                                            \
-})
-
-#define pfn_pmd(pfn, pgprot)                                              \
-({                                                                        \
-	pgprot_t __pgprot = (pgprot);                                     \
-	unsigned long __physpage = __pa((pfn) << PAGE_SHIFT);             \
-	pmd_t __pmd = __pmd(__physpage + pgprot_val(__pgprot));           \
-	__pmd;                                                            \
-})
-
-#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
-#define pte_page(x) pfn_to_page(pte_pfn(x))
-
-#define pmd_page_kernel(pmd) (pmd_val(pmd) & PAGE_MASK)
-
-#define pmd_page(pmd) (mem_map+(pmd_val(pmd) >> PAGE_SHIFT))
-
-#define pgd_page_kernel(pgd) (pgd_val(pgd) & PAGE_MASK)
-
-/* to find an entry in a page-table-directory */
-#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
-#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
-
-/* to find an entry in a kernel page-table-directory */
-#define pgd_offset_k(address) pgd_offset(&init_mm, address)
-
-/* Find an entry in the second-level page table.. */
-#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
-#define pmd_offset(dir,addr) \
-	((pmd_t *) pgd_page_kernel(*(dir)) + pmd_index(addr))
-
-/* Find an entry in the third-level page table.. */
-#define pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE-1))
-#define pte_offset_kernel(pmd, address) \
-	((pte_t *) pmd_page_kernel(*(pmd)) + pte_index(address))
-#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
-#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
-#define pte_unmap(pte) do { } while (0)
-#define pte_unmap_nested(pte) do { } while (0)
-
-/*
- * A page-table entry has some bits we have to treat in a special way.
- * Bits 52 and bit 55 have to be zero, otherwise an specification
- * exception will occur instead of a page translation exception. The
- * specifiation exception has the bad habit not to store necessary
- * information in the lowcore.
- * Bit 53 and bit 54 are the page invalid bit and the page protection
- * bit. We set both to indicate a swapped page.
- * Bit 63 is used as the software page present bit. If a page is
- * swapped this obviously has to be zero.
- * This leaves the bits 0-51 and bits 56-62 to store type and offset.
- * We use the 7 bits from 56-62 for the type and the 52 bits from 0-51
- * for the offset.
- * |                     offset                       |0110|type |0
- * 0000000000111111111122222222223333333333444444444455555555556666
- * 0123456789012345678901234567890123456789012345678901234567890123
- */
-extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
-{
-	pte_t pte;
-	pte_val(pte) = (type << 1) | (offset << 12) | _PAGE_INVALID | _PAGE_RO;
-	pte_val(pte) &= 0xfffffffffffff6fe;  /* better to be paranoid */
-	return pte;
-}
-
-#define __swp_type(entry)	(((entry).val >> 1) & 0x3f)
-#define __swp_offset(entry)	((entry).val >> 12)
-#define __swp_entry(type,offset) ((swp_entry_t) { pte_val(mk_swap_pte((type),(offset))) })
-
-#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__ */
-
-#define kern_addr_valid(addr)   (1)
-
-/*
- * No page table caches to initialise
- */
-#define pgtable_cache_init()	do { } while (0)
-
-#define HAVE_ARCH_UNMAPPED_AREA
-
-#endif /* _S390_PAGE_H */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/poll.h linux-2.5.67-bk6/include/asm-s390x/poll.h
--- linux-2.5.67-bk5/include/asm-s390x/poll.h	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/poll.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-/*
- *  include/asm-s390/poll.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/poll.h"
- */
-
-#ifndef __S390_POLL_H
-#define __S390_POLL_H
-
-/* These are specified by iBCS2 */
-#define POLLIN          0x0001
-#define POLLPRI         0x0002
-#define POLLOUT         0x0004
-#define POLLERR         0x0008
-#define POLLHUP         0x0010
-#define POLLNVAL        0x0020
-
-/* The rest seem to be more-or-less nonstandard. Check them! */
-#define POLLRDNORM	0x0040
-#define POLLRDBAND	0x0080
-#define POLLWRNORM	0x0100
-#define POLLWRBAND	0x0200
-#define POLLMSG		0x0400
-#define POLLREMOVE	0x1000
-
-struct pollfd {
-	int fd;
-	short events;
-	short revents;
-};
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/posix_types.h linux-2.5.67-bk6/include/asm-s390x/posix_types.h
--- linux-2.5.67-bk5/include/asm-s390x/posix_types.h	2003-04-07 10:32:56.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/posix_types.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,74 +0,0 @@
-/*
- *  include/asm-s390/posix_types.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/posix_types.h"
- */
-
-#ifndef __ARCH_S390_POSIX_TYPES_H
-#define __ARCH_S390_POSIX_TYPES_H
-
-/*
- * This file is generally used by user-level software, so you need to
- * be a little careful about namespace pollution etc.  Also, we cannot
- * assume GCC is being used.
- */
-
-typedef unsigned int    __kernel_dev_t;
-typedef unsigned int    __kernel_ino_t;
-typedef unsigned int    __kernel_mode_t;
-typedef unsigned int    __kernel_nlink_t;
-typedef long            __kernel_off_t;
-typedef long long       __kernel_loff_t;
-typedef int             __kernel_pid_t;
-typedef int             __kernel_ipc_pid_t;
-typedef unsigned int    __kernel_uid_t;
-typedef unsigned int    __kernel_gid_t;
-typedef unsigned long   __kernel_size_t;
-typedef long            __kernel_ssize_t;
-typedef long            __kernel_ptrdiff_t;
-typedef long            __kernel_time_t;
-typedef long            __kernel_suseconds_t;
-typedef long            __kernel_clock_t;
-typedef int             __kernel_daddr_t;
-typedef char *          __kernel_caddr_t;
-typedef unsigned long   __kernel_sigset_t;      /* at least 32 bits */
-typedef unsigned short	__kernel_uid16_t;
-typedef unsigned short	__kernel_gid16_t;
-
-typedef __kernel_uid_t __kernel_old_uid_t;
-typedef __kernel_gid_t __kernel_old_gid_t;
-typedef __kernel_uid_t __kernel_uid32_t;
-typedef __kernel_gid_t __kernel_gid32_t;
-
-typedef struct {
-#if defined(__KERNEL__) || defined(__USE_ALL)
-        int     val[2];
-#else                        /* !defined(__KERNEL__) && !defined(__USE_ALL)*/
-        int     __val[2];
-#endif                       /* !defined(__KERNEL__) && !defined(__USE_ALL)*/
-} __kernel_fsid_t;
-
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-
-#ifndef _S390_BITOPS_H
-#include <asm/bitops.h>
-#endif
-
-#undef  __FD_SET
-#define __FD_SET(fd,fdsetp)  set_bit(fd,fdsetp->fds_bits)
-
-#undef  __FD_CLR
-#define __FD_CLR(fd,fdsetp)  clear_bit(fd,fdsetp->fds_bits)
-
-#undef  __FD_ISSET
-#define __FD_ISSET(fd,fdsetp)  test_bit(fd,fdsetp->fds_bits)
-
-#undef  __FD_ZERO
-#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
-
-#endif     /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)*/
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/processor.h linux-2.5.67-bk6/include/asm-s390x/processor.h
--- linux-2.5.67-bk5/include/asm-s390x/processor.h	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/processor.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,243 +0,0 @@
-/*
- *  include/asm-s390/processor.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hp@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/processor.h"
- *    Copyright (C) 1994, Linus Torvalds
- */
-
-#ifndef __ASM_S390_PROCESSOR_H
-#define __ASM_S390_PROCESSOR_H
-
-#include <asm/page.h>
-#include <asm/ptrace.h>
-
-#ifdef __KERNEL__
-/*
- * Default implementation of macro that returns current
- * instruction pointer ("program counter").
- */
-#define current_text_addr() ({ void *pc; __asm__("basr %0,0":"=a"(pc)); pc; })
-
-/*
- *  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]
- */
-
-typedef struct
-{
-        unsigned int version :  8;
-        unsigned int ident   : 24;
-        unsigned int machine : 16;
-        unsigned int unused  : 16;
-} __attribute__ ((packed)) cpuid_t;
-
-struct cpuinfo_S390
-{
-        cpuid_t  cpu_id;
-        unsigned long loops_per_jiffy;
-        unsigned long *pgd_quick;
-        unsigned long *pmd_quick;
-        unsigned long *pte_quick;
-        unsigned long pgtable_cache_sz;
-        __u16    cpu_addr;
-        __u16    cpu_nr;
-        __u16    pad[2];
-};
-
-extern void print_cpu_info(struct cpuinfo_S390 *);
-
-/* Lazy FPU handling on uni-processor */
-extern struct task_struct *last_task_used_math;
-
-/*
- * User space process size: 4TB (default).
- */
-#define TASK_SIZE       (0x20000000000UL)
-#define TASK31_SIZE     (0x80000000UL)
-
-/* This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE \
-	(test_thread_flag(TIF_31BIT) ? (TASK31_SIZE / 2) : (TASK_SIZE / 2))
-
-#define THREAD_SIZE (4*PAGE_SIZE)
-
-typedef struct {
-       __u32 ar4;
-} mm_segment_t;
-
-/* if you change the thread_struct structure, you must
- * update the _TSS_* defines in entry.S
- */
-
-struct thread_struct
- {
-	s390_fp_regs fp_regs;
-        __u32   ar2;                   /* kernel access register 2         */
-        __u32   ar4;                   /* kernel access register 4         */
-        addr_t  ksp;                   /* kernel stack pointer             */
-        addr_t  user_seg;              /* HSTD                             */
-        addr_t  prot_addr;             /* address of protection-excep.     */
-        __u32   error_code;            /* error-code of last prog-excep.   */
-        __u32   trap_no;
-        per_struct per_info;/* Must be aligned on an 4 byte boundary*/
-	/* Used to give failing instruction back to user for ieee exceptions */
-	addr_t  ieee_instruction_pointer; 
-	unsigned long flags;            /* various flags */
-        /* pfault_wait is used to block the process on a pfault event */
-	addr_t  pfault_wait;
-};
-
-typedef struct thread_struct thread_struct;
-
-#define INIT_THREAD {{0,{{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}, \
-			    {0},{0},{0},{0},{0},{0}}},            \
-                     0, 0,                                        \
-                    sizeof(init_stack) + (addr_t) &init_stack,    \
-              (__pa((addr_t) &swapper_pg_dir[0]) + _REGION_TABLE),\
-                     0,0,0,                                       \
-                     (per_struct) {{{{0,}}},0,0,0,0,{{0,}}},      \
-		     0, 0, 0				          \
-} 
-
-/* need to define ... */
-#define start_thread(regs, new_psw, new_stackp) do {            \
-        regs->psw.mask  = PSW_USER_BITS;                        \
-        regs->psw.addr  = new_psw;                              \
-        regs->gprs[15]  = new_stackp;                           \
-} while (0)
-
-#define start_thread31(regs, new_psw, new_stackp) do {          \
-	regs->psw.mask  = PSW_USER32_BITS;			\
-        regs->psw.addr  = new_psw;                              \
-        regs->gprs[15]  = new_stackp;                           \
-} while (0)
-
-
-/* Forward declaration, a strange C thing */
-struct task_struct;
-struct mm_struct;
-
-/* Free all resources held by a thread. */
-extern void release_thread(struct task_struct *);
-extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
-
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)	do { } while (0)
-
-/*
- * Return saved PC of a blocked thread.
- */
-extern inline unsigned long thread_saved_pc(struct task_struct *t);
-
-/*
- * Print register of task into buffer. Used in fs/proc/array.c.
- */
-extern char *task_show_regs(struct task_struct *task, char *buffer);
-
-unsigned long get_wchan(struct task_struct *p);
-#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \
-        (((addr_t) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs)) & -8L))
-#define KSTK_EIP(tsk)	(__KSTK_PTREGS(tsk)->psw.addr)
-#define KSTK_ESP(tsk)	(__KSTK_PTREGS(tsk)->gprs[15])
-
-#define cpu_relax()	barrier()
-
-/*
- * Set PSW mask to specified value, while leaving the
- * PSW addr pointing to the next instruction.
- */
-
-static inline void __load_psw_mask (unsigned long mask)
-{
-	unsigned long addr;
-
-	psw_t psw;
-	psw.mask = mask;
-
-	asm volatile (
-		"    larl  %0,1f\n"
-		"    stg   %0,8(%1)\n"
-		"    lpswe 0(%1)\n"
-		"1:"
-		: "=&d" (addr) : "a" (&psw) : "memory", "cc" );
-}
-
-/*
- * Function to stop a processor until an interruption occurred
- */
-static inline void enabled_wait(void)
-{
-	unsigned long reg;
-	psw_t wait_psw;
-
-	wait_psw.mask = PSW_BASE_BITS | PSW_MASK_IO | PSW_MASK_EXT |
-		PSW_MASK_MCHECK | PSW_MASK_WAIT;
-	asm volatile (
-		"    larl  %0,0f\n"
-		"    stg   %0,8(%1)\n"
-		"    lpswe 0(%1)\n"
-		"0:"
-		: "=&a" (reg) : "a" (&wait_psw) : "memory", "cc" );
-}
-
-/*
- * Function to drop a processor into disabled wait state
- */
-
-static inline void disabled_wait(addr_t code)
-{
-        char psw_buffer[2*sizeof(psw_t)];
-        char ctl_buf[8];
-        psw_t *dw_psw = (psw_t *)(((unsigned long) &psw_buffer+sizeof(psw_t)-1)
-                                  & -sizeof(psw_t));
-
-        dw_psw->mask = PSW_BASE_BITS | PSW_MASK_WAIT;
-        dw_psw->addr = code;
-        /* 
-         * Store status and then load disabled wait psw,
-         * the processor is dead afterwards
-         */
-        asm volatile ("    stctg 0,0,0(%1)\n"
-                      "    ni    4(%1),0xef\n" /* switch off protection */
-                      "    lctlg 0,0,0(%1)\n"
-                      "    lghi  1,0x1000\n"
-                      "    stpt  0x328(1)\n"      /* store timer */
-                      "    stckc 0x330(1)\n"      /* store clock comparator */
-                      "    stpx  0x318(1)\n"      /* store prefix register */
-                      "    stam  0,15,0x340(1)\n" /* store access registers */
-                      "    stfpc 0x31c(1)\n"      /* store fpu control */
-                      "    std   0,0x200(1)\n"    /* store f0 */
-                      "    std   1,0x208(1)\n"    /* store f1 */
-                      "    std   2,0x210(1)\n"    /* store f2 */
-                      "    std   3,0x218(1)\n"    /* store f3 */
-                      "    std   4,0x220(1)\n"    /* store f4 */
-                      "    std   5,0x228(1)\n"    /* store f5 */
-                      "    std   6,0x230(1)\n"    /* store f6 */
-                      "    std   7,0x238(1)\n"    /* store f7 */
-                      "    std   8,0x240(1)\n"    /* store f8 */
-                      "    std   9,0x248(1)\n"    /* store f9 */
-                      "    std   10,0x250(1)\n"   /* store f10 */
-                      "    std   11,0x258(1)\n"   /* store f11 */
-                      "    std   12,0x260(1)\n"   /* store f12 */
-                      "    std   13,0x268(1)\n"   /* store f13 */
-                      "    std   14,0x270(1)\n"   /* store f14 */
-                      "    std   15,0x278(1)\n"   /* store f15 */
-                      "    stmg  0,15,0x280(1)\n" /* store general registers */
-                      "    stctg 0,15,0x380(1)\n" /* store control registers */
-                      "    oi    0x384(1),0x10\n" /* fake protection bit */
-                      "    lpswe 0(%0)"
-                      : : "a" (dw_psw), "a" (&ctl_buf) : "cc", "0", "1");
-}
-
-#endif
-
-#endif                                 /* __ASM_S390_PROCESSOR_H           */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/ptrace.h linux-2.5.67-bk6/include/asm-s390x/ptrace.h
--- linux-2.5.67-bk5/include/asm-s390x/ptrace.h	2003-04-07 10:30:46.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ptrace.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,339 +0,0 @@
-/*
- *  include/asm-s390/ptrace.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- */
-
-#ifndef _S390_PTRACE_H
-#define _S390_PTRACE_H
-
-/*
- * Offsets in the user_regs_struct. They are used for the ptrace
- * system call and in entry.S
- */
-#define PT_PSWMASK  0x00
-#define PT_PSWADDR  0x08
-#define PT_GPR0     0x10
-#define PT_GPR1     0x18
-#define PT_GPR2     0x20
-#define PT_GPR3     0x28
-#define PT_GPR4     0x30
-#define PT_GPR5     0x38
-#define PT_GPR6     0x40
-#define PT_GPR7     0x48
-#define PT_GPR8     0x50
-#define PT_GPR9     0x58
-#define PT_GPR10    0x60
-#define PT_GPR11    0x68
-#define PT_GPR12    0x70
-#define PT_GPR13    0x78
-#define PT_GPR14    0x80
-#define PT_GPR15    0x88
-#define PT_ACR0     0x90
-#define PT_ACR1     0x94
-#define PT_ACR2     0x98
-#define PT_ACR3     0x9C
-#define PT_ACR4	    0xA0
-#define PT_ACR5	    0xA4
-#define PT_ACR6	    0xA8
-#define PT_ACR7	    0xAC
-#define PT_ACR8	    0xB0
-#define PT_ACR9	    0xB4
-#define PT_ACR10    0xB8
-#define PT_ACR11    0xBC
-#define PT_ACR12    0xC0
-#define PT_ACR13    0xC4
-#define PT_ACR14    0xC8
-#define PT_ACR15    0xCC
-#define PT_ORIGGPR2 0xD0
-#define PT_FPC	    0xD8
-#define PT_FPR0     0xE0
-#define PT_FPR1     0xE8
-#define PT_FPR2     0xF0
-#define PT_FPR3     0xF8
-#define PT_FPR4     0x100
-#define PT_FPR5     0x108
-#define PT_FPR6     0x110
-#define PT_FPR7     0x118
-#define PT_FPR8     0x120
-#define PT_FPR9     0x128
-#define PT_FPR10    0x130
-#define PT_FPR11    0x138
-#define PT_FPR12    0x140
-#define PT_FPR13    0x148
-#define PT_FPR14    0x150
-#define PT_FPR15    0x158
-#define PT_CR_9     0x160
-#define PT_CR_10    0x168
-#define PT_CR_11    0x170
-#define PT_IEEE_IP  0x1A8
-#define PT_LASTOFF  PT_IEEE_IP
-#define PT_ENDREGS  0x1B0-1
-
-#define NUM_GPRS      16
-#define NUM_FPRS      16
-#define NUM_CRS       16
-#define NUM_ACRS      16
-#define GPR_SIZE      8
-#define FPR_SIZE      8
-#define FPC_SIZE      4
-#define FPC_PAD_SIZE  4 /* gcc insists on aligning the fpregs */
-#define CR_SIZE       8
-#define ACR_SIZE      4
-
-#define STACK_FRAME_OVERHEAD    160      /* size of minimum stack frame */
-
-#define PTRACE_OLDSETOPTIONS         21
-
-#ifndef __ASSEMBLY__
-#include <linux/config.h>
-#include <linux/stddef.h>
-#include <linux/types.h>
-
-#include <asm/setup.h>
-
-/* this typedef defines how a Program Status Word looks like */
-typedef struct 
-{
-        __u64   mask;
-        __u64   addr;
-} __attribute__ ((aligned(8))) psw_t;
-
-#define PSW_MASK_PER		0x4000000000000000UL
-#define PSW_MASK_DAT		0x0400000000000000UL
-#define PSW_MASK_IO		0x0200000000000000UL
-#define PSW_MASK_EXT		0x0100000000000000UL
-#define PSW_MASK_KEY		0x00F0000000000000UL
-#define PSW_MASK_MCHECK		0x0004000000000000UL
-#define PSW_MASK_WAIT		0x0002000000000000UL
-#define PSW_MASK_PSTATE		0x0001000000000000UL
-#define PSW_MASK_ASC		0x0000C00000000000UL
-#define PSW_MASK_CC		0x0000300000000000UL
-#define PSW_MASK_PM		0x00000F0000000000UL
-
-#define PSW_BASE_BITS		0x0000000180000000UL
-#define PSW_BASE32_BITS		0x0000000080000000UL
-
-#define PSW_ASC_PRIMARY		0x0000000000000000UL
-#define PSW_ASC_ACCREG		0x0000400000000000UL
-#define PSW_ASC_SECONDARY	0x0000800000000000UL
-#define PSW_ASC_HOME		0x0000C00000000000UL
-
-#define PSW_KERNEL_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY)
-#define PSW_USER_BITS	(PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
-			 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
-			 PSW_MASK_PSTATE)
-#define PSW_USER32_BITS (PSW_BASE32_BITS | PSW_MASK_DAT | PSW_ASC_HOME | \
-			 PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK | \
-			 PSW_MASK_PSTATE)
-
-typedef union
-{
-	float   f;
-	double  d;
-	__u64   ui;
-	struct
-	{
-		__u32 hi;
-		__u32 lo;
-	} fp;
-} freg_t;
-
-typedef struct
-{
-	__u32   fpc;
-	freg_t  fprs[NUM_FPRS];              
-} s390_fp_regs;
-
-#define FPC_EXCEPTION_MASK      0xF8000000
-#define FPC_FLAGS_MASK          0x00F80000
-#define FPC_DXC_MASK            0x0000FF00
-#define FPC_RM_MASK             0x00000003
-#define FPC_VALID_MASK          0xF8F8FF03
-
-/*
- * The first entries in pt_regs and user_regs_struct
- * are common for the two structures. The s390_regs structure
- * covers the common parts. It simplifies copying the common part
- * between the three structures.
- */
-typedef struct
-{
-	psw_t psw;
-	__u64 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u64 orig_gpr2;
-} s390_regs;
-
-/*
- * The pt_regs struct defines the way the registers are stored on
- * the stack during a system call.
- */
-struct pt_regs 
-{
-	psw_t psw;
-	__u64 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u64 orig_gpr2;
-	__u32 trap;
-} __attribute__ ((packed));
-
-/*
- * Now for the program event recording (trace) definitions.
- */
-typedef struct
-{
-	__u64 cr[3];
-} per_cr_words;
-
-#define PER_EM_MASK 0x00000000E8000000UL
-
-typedef	struct
-{
-	unsigned                       : 32;
-	unsigned em_branching          : 1;
-	unsigned em_instruction_fetch  : 1;
-	/*
-	 * Switching on storage alteration automatically fixes
-	 * the storage alteration event bit in the users std.
-	 */
-	unsigned em_storage_alteration : 1;
-	unsigned em_gpr_alt_unused     : 1;
-	unsigned em_store_real_address : 1;
-	unsigned                       : 3;
-	unsigned branch_addr_ctl       : 1;
-	unsigned                       : 1;
-	unsigned storage_alt_space_ctl : 1;
-	unsigned                       : 21;
-	addr_t   starting_addr;
-	addr_t   ending_addr;
-} per_cr_bits;
-
-typedef struct
-{
-	__u16          perc_atmid;
-	addr_t         address;
-	__u8           access_id;
-} per_lowcore_words;
-
-typedef struct
-{
-	unsigned perc_branching          : 1; /* 0x096 */
-	unsigned perc_instruction_fetch  : 1;
-	unsigned perc_storage_alteration : 1;
-	unsigned perc_gpr_alt_unused     : 1;
-	unsigned perc_store_real_address : 1;
-	unsigned                         : 3;
-	unsigned atmid_psw_bit_31        : 1;
-	unsigned atmid_validity_bit      : 1;
-	unsigned atmid_psw_bit_32        : 1;
-	unsigned atmid_psw_bit_5         : 1;
-	unsigned atmid_psw_bit_16        : 1;
-	unsigned atmid_psw_bit_17        : 1;
-	unsigned si                      : 2;
-	addr_t   address;                     /* 0x098 */
-	unsigned                         : 4; /* 0x0a1 */
-	unsigned access_id               : 4;
-} per_lowcore_bits;
-
-typedef struct
-{
-	union {
-		per_cr_words   words;
-		per_cr_bits    bits;
-	} control_regs;
-	/*
-	 * Use these flags instead of setting em_instruction_fetch
-	 * directly they are used so that single stepping can be
-	 * switched on & off while not affecting other tracing
-	 */
-	unsigned  single_step       : 1;
-	unsigned  instruction_fetch : 1;
-	unsigned                    : 30;
-	/*
-	 * These addresses are copied into cr10 & cr11 if single
-	 * stepping is switched off
-	 */
-	addr_t    starting_addr;
-	addr_t    ending_addr;
-	union {
-		per_lowcore_words words;
-		per_lowcore_bits  bits;
-	} lowcore; 
-} per_struct;
-
-typedef struct
-{
-	__u32  len;
-	addr_t kernel_addr;
-	addr_t process_addr;
-} ptrace_area;
-
-/*
- * S/390 specific non posix ptrace requests. I chose unusual values so
- * they are unlikely to clash with future ptrace definitions.
- */
-#define PTRACE_PEEKUSR_AREA           0x5000
-#define PTRACE_POKEUSR_AREA           0x5001
-#define PTRACE_PEEKTEXT_AREA	      0x5002
-#define PTRACE_PEEKDATA_AREA	      0x5003
-#define PTRACE_POKETEXT_AREA	      0x5004
-#define PTRACE_POKEDATA_AREA 	      0x5005
-/*
- * PT_PROT definition is loosely based on hppa bsd definition in
- * gdb/hppab-nat.c
- */
-#define PTRACE_PROT                       21
-
-typedef enum
-{
-	ptprot_set_access_watchpoint,
-	ptprot_set_write_watchpoint,
-	ptprot_disable_watchpoint
-} ptprot_flags;
-
-typedef struct
-{
-	addr_t           lowaddr;
-	addr_t           hiaddr;
-	ptprot_flags     prot;
-} ptprot_area;                     
-
-/* Sequence of bytes for breakpoint illegal instruction.  */
-#define S390_BREAKPOINT     {0x0,0x1}
-#define S390_BREAKPOINT_U16 ((__u16)0x0001)
-#define S390_SYSCALL_OPCODE ((__u16)0x0a00)
-#define S390_SYSCALL_SIZE   2
-
-/*
- * The user_regs_struct defines the way the user registers are
- * store on the stack for signal handling.
- */
-struct user_regs_struct
-{
-	psw_t psw;
-	__u64 gprs[NUM_GPRS];
-	__u32 acrs[NUM_ACRS];
-	__u64 orig_gpr2;
-	s390_fp_regs fp_regs;
-	/*
-	 * These per registers are in here so that gdb can modify them
-	 * itself as there is no "official" ptrace interface for hardware
-	 * watchpoints. This is the way intel does it.
-	 */
-	per_struct per_info;
-	addr_t  ieee_instruction_pointer; 
-	/* Used to give failing instruction back to user for ieee exceptions */
-};
-
-#ifdef __KERNEL__
-#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0)
-#define instruction_pointer(regs) ((regs)->psw.addr)
-extern void show_regs(struct pt_regs * regs);
-#endif
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* _S390X_PTRACE_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/qdio.h linux-2.5.67-bk6/include/asm-s390x/qdio.h
--- linux-2.5.67-bk5/include/asm-s390x/qdio.h	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/qdio.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,399 +0,0 @@
-/*
- * linux/include/asm/qdio.h
- *
- * Linux for S/390 QDIO base support, Hipersocket base support
- * version 2
- *
- * Copyright 2000,2002 IBM Corporation
- * Author(s): Utz Bacher <utz.bacher@de.ibm.com>
- *
- */
-#ifndef __QDIO_H__
-#define __QDIO_H__
-
-#define VERSION_QDIO_H "$Revision: 1.57 $"
-
-/* note, that most of the typedef's are from ingo. */
-
-#include <linux/interrupt.h>
-#include <asm/cio.h>
-
-#define QDIO_NAME "qdio "
-
-#ifndef CONFIG_ARCH_S390X
-#define QDIO_32_BIT
-#endif /* CONFIG_ARCH_S390X */
-
-/**** CONSTANTS, that are relied on without using these symbols *****/
-#define QDIO_MAX_QUEUES_PER_IRQ 32 /* used in width of unsigned int */
-/************************ END of CONSTANTS **************************/
-#define QDIO_MAX_BUFFERS_PER_Q 128 /* must be a power of 2 (%x=&(x-1)*/
-#define QDIO_BUF_ORDER 7 /* 2**this == number of pages used for sbals in 1 q */
-#define QDIO_MAX_ELEMENTS_PER_BUFFER 16
-#define SBAL_SIZE 256
-
-#define QDIO_QETH_QFMT 0
-#define QDIO_ZFCP_QFMT 1
-#define QDIO_IQDIO_QFMT 2
-
-struct qdio_buffer_element{
-	unsigned int flags;
-	unsigned int length;
-#ifdef QDIO_32_BIT
-	void *reserved;
-#endif /* QDIO_32_BIT */
-	void *addr;
-} __attribute__ ((packed,aligned(16)));
-
-struct qdio_buffer{
-	volatile struct qdio_buffer_element element[16];
-} __attribute__ ((packed,aligned(256)));
-
-
-/* params are: ccw_device, status, qdio_error, siga_error,
-   queue_number, first element processed, number of elements processed,
-   int_parm */
-typedef void qdio_handler_t(struct ccw_device *,unsigned int,unsigned int,
-			    unsigned int,unsigned int,int,int,unsigned long);
-
-
-#define QDIO_STATUS_INBOUND_INT 0x01
-#define QDIO_STATUS_OUTBOUND_INT 0x02
-#define QDIO_STATUS_LOOK_FOR_ERROR 0x04
-#define QDIO_STATUS_MORE_THAN_ONE_QDIO_ERROR 0x08
-#define QDIO_STATUS_MORE_THAN_ONE_SIGA_ERROR 0x10
-#define QDIO_STATUS_ACTIVATE_CHECK_CONDITION 0x20
-
-#define QDIO_SIGA_ERROR_ACCESS_EXCEPTION 0x10
-#define QDIO_SIGA_ERROR_B_BIT_SET 0x20
-
-/* for qdio_initialize */
-#define QDIO_INBOUND_0COPY_SBALS 0x01
-#define QDIO_OUTBOUND_0COPY_SBALS 0x02
-#define QDIO_USE_OUTBOUND_PCIS 0x04
-
-/* for qdio_cleanup */
-#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01
-#define QDIO_FLAG_CLEANUP_USING_HALT 0x02
-
-struct qdio_initialize{
-	struct ccw_device *cdev;
-	unsigned char q_format;
-	unsigned char adapter_name[8];
-       	unsigned int qib_param_field_format; /*adapter dependent*/
-	/* pointer to 128 bytes or NULL, if no param field */
-	unsigned char *qib_param_field; /* adapter dependent */
-	/* pointer to no_queues*128 words of data or NULL */
-	unsigned long *input_slib_elements;
-	unsigned long *output_slib_elements;
-	unsigned int min_input_threshold;
-	unsigned int max_input_threshold;
-	unsigned int min_output_threshold;
-	unsigned int max_output_threshold;
-	unsigned int no_input_qs;
-	unsigned int no_output_qs;
-	qdio_handler_t *input_handler;
-	qdio_handler_t *output_handler;
-	unsigned long int_parm;
-	unsigned long flags;
-	void **input_sbal_addr_array; /* addr of n*128 void ptrs */
-	void **output_sbal_addr_array; /* addr of n*128 void ptrs */
-};
-extern int qdio_initialize(struct qdio_initialize *init_data);
-extern int qdio_allocate(struct qdio_initialize *init_data);
-extern int qdio_establish(struct ccw_device *);
-
-extern int qdio_activate(struct ccw_device *,int flags);
-
-#define QDIO_STATE_MUST_USE_OUTB_PCI	0x00000001
-#define QDIO_STATE_INACTIVE 		0x00000002 /* after qdio_cleanup */
-#define QDIO_STATE_ESTABLISHED 		0x00000004 /* after qdio_initialize */
-#define QDIO_STATE_ACTIVE 		0x00000008 /* after qdio_activate */
-#define QDIO_STATE_STOPPED 		0x00000010 /* after queues went down */
-extern unsigned long qdio_get_status(int irq);
-
-
-#define QDIO_FLAG_SYNC_INPUT     0x01
-#define QDIO_FLAG_SYNC_OUTPUT    0x02
-#define QDIO_FLAG_UNDER_INTERRUPT 0x04
-#define QDIO_FLAG_NO_INPUT_INTERRUPT_CONTEXT 0x08 /* no effect on
-						     adapter interrupts */
-#define QDIO_FLAG_DONT_SIGA 0x10
-
-extern int do_QDIO(struct ccw_device*, unsigned int flags, 
-		   unsigned int queue_number,
-		   unsigned int qidx,unsigned int count,
-		   struct qdio_buffer *buffers);
-
-extern int qdio_synchronize(struct ccw_device*, unsigned int flags,
-			    unsigned int queue_number);
-
-extern int qdio_cleanup(struct ccw_device*, int how);
-extern int qdio_shutdown(struct ccw_device*, int how);
-extern int qdio_free(struct ccw_device*);
-
-unsigned char qdio_get_slsb_state(struct ccw_device*, unsigned int flag,
-				  unsigned int queue_number,
-				  unsigned int qidx);
-
-extern void qdio_init_scrubber(void);
-
-struct qdesfmt0 {
-#ifdef QDIO_32_BIT
-	unsigned long res1;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long sliba;            /* storage-list-information-block
-					   address */
-#ifdef QDIO_32_BIT
-	unsigned long res2;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long sla;              /* storage-list address */
-#ifdef QDIO_32_BIT
-	unsigned long res3;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long slsba;            /* storage-list-state-block address */
-	unsigned int  res4;		/* reserved */
-	unsigned int  akey  :  4;       /* access key for DLIB */
-	unsigned int  bkey  :  4;       /* access key for SL */
-	unsigned int  ckey  :  4;       /* access key for SBALs */
-	unsigned int  dkey  :  4;       /* access key for SLSB */
-	unsigned int  res5  : 16;       /* reserved */
-} __attribute__ ((packed));
-
-/*
- * Queue-Description record (QDR)
- */
-struct qdr {
-	unsigned int  qfmt    :  8;     /* queue format */
-	unsigned int  pfmt    :  8;     /* impl. dep. parameter format */
-	unsigned int  res1    :  8;     /* reserved */
-	unsigned int  ac      :  8;     /* adapter characteristics */
-	unsigned int  res2    :  8;     /* reserved */
-	unsigned int  iqdcnt  :  8;     /* input-queue-descriptor count */
-	unsigned int  res3    :  8;     /* reserved */
-	unsigned int  oqdcnt  :  8;     /* output-queue-descriptor count */
-	unsigned int  res4    :  8;     /* reserved */
-	unsigned int  iqdsz   :  8;     /* input-queue-descriptor size */
-	unsigned int  res5    :  8;     /* reserved */
-	unsigned int  oqdsz   :  8;     /* output-queue-descriptor size */
-	unsigned int  res6[9];          /* reserved */
-#ifdef QDIO_32_BIT
-	unsigned long res7;		/* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long qiba;             /* queue-information-block address */
-	unsigned int  res8;             /* reserved */
-	unsigned int  qkey    :  4;     /* queue-informatio-block key */
-	unsigned int  res9    : 28;     /* reserved */
-/*	union _qd {*/ /* why this? */
-		struct qdesfmt0 qdf0[126];
-/*	} qd;*/
-} __attribute__ ((packed,aligned(4096)));
-
-
-/*
- * queue information block (QIB)
- */
-#define QIB_AC_INBOUND_PCI_SUPPORTED 0x80
-#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
-struct qib {
-	unsigned int  qfmt    :  8;     /* queue format */
-	unsigned int  pfmt    :  8;     /* impl. dep. parameter format */
-	unsigned int  res1    :  8;     /* reserved */
-	unsigned int  ac      :  8;     /* adapter characteristics */
-	unsigned int  res2;             /* reserved */
-#ifdef QDIO_32_BIT
-	unsigned long res3;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long isliba;           /* absolute address of 1st
-					   input SLIB */
-#ifdef QDIO_32_BIT
-	unsigned long res4;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long osliba;           /* absolute address of 1st
-					   output SLIB */
-	unsigned int  res5;             /* reserved */
-	unsigned int  res6;             /* reserved */
-	unsigned char ebcnam[8];        /* adapter identifier in EBCDIC */
-	unsigned char res7[88];         /* reserved */
-	unsigned char parm[QDIO_MAX_BUFFERS_PER_Q];
-					/* implementation dependent
-					   parameters */
-} __attribute__ ((packed,aligned(256)));
-
-
-/*
- * storage-list-information block element (SLIBE)
- */
-struct slibe {
-#ifdef QDIO_32_BIT
-	unsigned long res;              /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long parms;            /* implementation dependent
-					   parameters */
-};
-
-/*
- * storage-list-information block (SLIB)
- */
-struct slib {
-#ifdef QDIO_32_BIT
-	unsigned long res1;             /* reserved */
-#endif /* QDIO_32_BIT */
-        unsigned long nsliba;           /* next SLIB address (if any) */
-#ifdef QDIO_32_BIT
-	unsigned long res2;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long sla;              /* SL address */
-#ifdef QDIO_32_BIT
-	unsigned long res3;             /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long slsba;            /* SLSB address */
-	unsigned char res4[1000];       /* reserved */
-	struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q];    /* SLIB elements */
-} __attribute__ ((packed,aligned(2048)));
-
-struct sbal_flags {
-	unsigned char res1  : 1;   /* reserved */
-	unsigned char last  : 1;   /* last entry */
-	unsigned char cont  : 1;   /* contiguous storage */
-	unsigned char res2  : 1;   /* reserved */
-	unsigned char frag  : 2;   /* fragmentation (s.below) */
-	unsigned char res3  : 2;   /* reserved */
-} __attribute__ ((packed));
-
-#define SBAL_FLAGS_FIRST_FRAG	     0x04000000UL
-#define SBAL_FLAGS_MIDDLE_FRAG	     0x08000000UL
-#define SBAL_FLAGS_LAST_FRAG	     0x0c000000UL
-#define SBAL_FLAGS_LAST_ENTRY	     0x40000000UL
-#define SBAL_FLAGS_CONTIGUOUS	     0x20000000UL
-
-#define SBAL_FLAGS0_DATA_CONTINUATION 0x20UL
-
-/* Awesome OpenFCP extensions */
-#define SBAL_FLAGS0_TYPE_STATUS       0x00UL
-#define SBAL_FLAGS0_TYPE_WRITE        0x08UL
-#define SBAL_FLAGS0_TYPE_READ         0x10UL
-#define SBAL_FLAGS0_TYPE_WRITE_READ   0x18UL
-#define SBAL_FLAGS0_MORE_SBALS	      0x04UL
-#define SBAL_FLAGS0_COMMAND           0x02UL
-#define SBAL_FLAGS0_LAST_SBAL         0x00UL
-#define SBAL_FLAGS0_ONLY_SBAL         SBAL_FLAGS0_COMMAND
-#define SBAL_FLAGS0_MIDDLE_SBAL       SBAL_FLAGS0_MORE_SBALS
-#define SBAL_FLAGS0_FIRST_SBAL        SBAL_FLAGS0_MORE_SBALS | SBAL_FLAGS0_COMMAND
-/* Naught of interest beyond this point */
-
-#define SBAL_FLAGS0_PCI		0x40
-struct sbal_sbalf_0 {
-	unsigned char res1  : 1;   /* reserved */
-	unsigned char pci   : 1;   /* PCI indicator */
-	unsigned char cont  : 1;   /* data continuation */
-	unsigned char sbtype: 2;   /* storage-block type (OpenFCP) */
-	unsigned char res2  : 3;   /* reserved */
-} __attribute__ ((packed));
-
-struct sbal_sbalf_1 {
-	unsigned char res1  : 4;   /* reserved */
-	unsigned char key   : 4;   /* storage key */
-} __attribute__ ((packed));
-
-struct sbal_sbalf_14 {
-	unsigned char res1   : 4;  /* reserved */
-	unsigned char erridx : 4;  /* error index */
-} __attribute__ ((packed));
-
-struct sbal_sbalf_15 {
-	unsigned char reason;      /* reserved */
-} __attribute__ ((packed));
-
-union sbal_sbalf {
-	struct sbal_sbalf_0  i0;
-	struct sbal_sbalf_1  i1;
-	struct sbal_sbalf_14 i14;
-	struct sbal_sbalf_15 i15;
-	unsigned char value;
-};
-
-struct sbal_element {
-	union {
-		struct sbal_flags  bits;       /* flags */
-		unsigned char value;
-	} flags;
-	unsigned int  res1  : 16;   /* reserved */
-	union sbal_sbalf  sbalf;       /* SBAL flags */
-	unsigned int  res2  : 16;  /* reserved */
-	unsigned int  count : 16;  /* data count */
-#ifdef QDIO_32_BIT
-	unsigned long res3;        /* reserved */
-#endif /* QDIO_32_BIT */
-	unsigned long addr;        /* absolute data address */
-} __attribute__ ((packed,aligned(16)));
-
-/*
- * strorage-block access-list (SBAL)
- */
-struct sbal {
-	struct sbal_element element[QDIO_MAX_ELEMENTS_PER_BUFFER];
-} __attribute__ ((packed,aligned(256)));
-
-/*
- * storage-list (SL)
- */
-struct sl_element {
-#ifdef QDIO_32_BIT
-        unsigned long res;     /* reserved */
-#endif /* QDIO_32_BIT */
-        unsigned long sbal;    /* absolute SBAL address */
-} __attribute__ ((packed));
-
-struct sl {
-	struct sl_element element[QDIO_MAX_BUFFERS_PER_Q];
-} __attribute__ ((packed,aligned(1024)));
-
-/*
- * storage-list-state block (SLSB)
- */
-struct slsb_flags {
-	unsigned char owner  : 2;   /* SBAL owner */
-	unsigned char type   : 1;   /* buffer type */
-	unsigned char state  : 5;   /* processing state */
-} __attribute__ ((packed));
-
-
-struct slsb {
-	union {
-		unsigned char val[QDIO_MAX_BUFFERS_PER_Q];
-		struct slsb_flags flags[QDIO_MAX_BUFFERS_PER_Q];
-	} acc;
-} __attribute__ ((packed,aligned(256)));
-
-/*
- * SLSB values
- */
-#define SLSB_OWNER_PROG              1
-#define SLSB_OWNER_CU                2
-
-#define SLSB_TYPE_INPUT              0
-#define SLSB_TYPE_OUTPUT             1
-
-#define SLSB_STATE_NOT_INIT          0
-#define SLSB_STATE_EMPTY             1
-#define SLSB_STATE_PRIMED            2
-#define SLSB_STATE_HALTED          0xe
-#define SLSB_STATE_ERROR           0xf
-
-#define SLSB_P_INPUT_NOT_INIT     0x80
-#define SLSB_P_INPUT_PROCESSING	  0x81
-#define SLSB_CU_INPUT_EMPTY       0x41
-#define SLSB_P_INPUT_PRIMED       0x82
-#define SLSB_P_INPUT_HALTED       0x8E
-#define SLSB_P_INPUT_ERROR        0x8F
-
-#define SLSB_P_OUTPUT_NOT_INIT    0xA0
-#define SLSB_P_OUTPUT_EMPTY       0xA1
-#define SLSB_CU_OUTPUT_PRIMED     0x62
-#define SLSB_P_OUTPUT_HALTED      0xAE
-#define SLSB_P_OUTPUT_ERROR       0xAF
-
-#define SLSB_ERROR_DURING_LOOKUP  0xFF
-
-#endif /* __QDIO_H__ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/queue.h linux-2.5.67-bk6/include/asm-s390x/queue.h
--- linux-2.5.67-bk5/include/asm-s390x/queue.h	2003-04-07 10:32:23.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/queue.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,170 +0,0 @@
-/*
- *  include/asm-s390/queue.h
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *
- *  A little set of queue utilies.
- */
-#ifndef __ASM_QUEUE_H
-#define __ASM_QUEUE_H
-#include <linux/stddef.h>
-
-typedef struct queue
-{
-	struct queue *next;	
-} queue;
-
-typedef queue list;
-
-typedef struct
-{
-	queue *head;
-	queue *tail;
-} qheader;
-
-static __inline__ void init_queue(qheader *qhead)
-{
-	memset(qhead,0,sizeof(*qhead));
-}
-
-static __inline__ void enqueue_tail(qheader *qhead,queue *member)
-{	
-	if(member)
-	{
-		queue *tail=qhead->tail;
-
-		if(tail)
-			tail->next=member;
-		else
-			
-			qhead->head=member;
-		qhead->tail=member;
-		member->next=NULL;
-	}
-} 
-
-static __inline__ queue *dequeue_head(qheader *qhead)
-{
-	queue *head=qhead->head,*next_head;
-
-	if(head)
-	{
-		next_head=head->next;
-		qhead->head=next_head;
-	        if(!next_head)
-			qhead->tail=NULL;
-	}
-	return(head);
-}
-
-static __inline__ void init_list(list **lhead)
-{
-	*lhead=NULL;
-}
-
-static __inline__ void add_to_list(list **lhead,list *member)
-{
-	member->next=*lhead;
-	*lhead=member;
-}
-
-static __inline__ list *remove_listhead(list **lhead)
-{
-	list *oldhead=*lhead;
-
-	if(oldhead)
-		*lhead=(*lhead)->next;
-	return(oldhead);
-}
-
-static __inline__ void add_to_list_tail(list **lhead,list *member)
-{
-	list *curr,*prev;
-	if(*lhead==NULL)
-		*lhead=member;
-	else
-	{
-		prev=*lhead;
-		for(curr=(*lhead)->next;curr!=NULL;curr=curr->next)
-			prev=curr;
-		prev->next=member;
-	}
-}
-static __inline__ void add_to_list_tail_null(list **lhead,list *member)
-{
-	member->next=NULL;
-	add_to_list_tail_null(lhead,member);
-}
-
-
-static __inline__ int is_in_list(list *lhead,list *member)
-{
-	list *curr;
-
-	for(curr=lhead;curr!=NULL;curr=curr->next)
-		if(curr==member)
-			return(1);
-	return(0);
-}
-
-static __inline__ int get_prev(list *lhead,list *member,list **prev)
-{
-	list *curr;
-
-	*prev=NULL;
-	for(curr=lhead;curr!=NULL;curr=curr->next)
-	{
-		if(curr==member)
-			return(1);
-		*prev=curr;
-	}
-	*prev=NULL;
-	return(0);
-}
-
-
-
-static __inline__ int remove_from_list(list **lhead,list *member)
-{
-	list *prev;
-
-	if(get_prev(*lhead,member,&prev))
-	{
-
-		if(prev)
-			prev->next=member->next;
-		else
-			*lhead=member->next;
-		return(1);
-	}
-	return(0);
-}
-
-static __inline__ int remove_from_queue(qheader *qhead,queue *member)
-{
-	queue *prev;
-
-	if(get_prev(qhead->head,(list *)member,(list **)&prev))
-	{
-
-		if(prev)
-		{
-			prev->next=member->next;
-			if(prev->next==NULL)
-				qhead->tail=prev;
-		}
-		else
-		{
-			if(qhead->head==qhead->tail)
-				qhead->tail=NULL;
-			qhead->head=member->next;
-		}
-		return(1);
-	}
-	return(0);
-}
-
-#endif /* __ASM_QUEUE_H */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/resource.h linux-2.5.67-bk6/include/asm-s390x/resource.h
--- linux-2.5.67-bk5/include/asm-s390x/resource.h	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/resource.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,56 +0,0 @@
-/*
- *  include/asm-s390/resource.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/resources.h"
- */
-
-#ifndef _S390_RESOURCE_H
-#define _S390_RESOURCE_H
-
-/*
- * Resource limits
- */
-
-#define RLIMIT_CPU	0		/* CPU time in ms */
-#define RLIMIT_FSIZE	1		/* Maximum filesize */
-#define RLIMIT_DATA	2		/* max data size */
-#define RLIMIT_STACK	3		/* max stack size */
-#define RLIMIT_CORE	4		/* max core file size */
-#define RLIMIT_RSS	5		/* max resident set size */
-#define RLIMIT_NPROC	6		/* max number of processes */
-#define RLIMIT_NOFILE	7		/* max number of open files */
-#define RLIMIT_MEMLOCK	8		/* max locked-in-memory address space */
-#define RLIMIT_AS	9		/* address space limit */
-#define RLIMIT_LOCKS	10		/* maximum file locks held */
-
-#define RLIM_NLIMITS	11
-
-/*
- * SuS says limits have to be unsigned.
- * Which makes a ton more sense anyway.
- */
-#define RLIM_INFINITY   (~0UL)
-
-#ifdef __KERNEL__
-
-#define INIT_RLIMITS					\
-{							\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{      _STK_LIM, RLIM_INFINITY },		\
-	{             0, RLIM_INFINITY },		\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{        0,        0 },                  	\
-	{ INR_OPEN, INR_OPEN },                         \
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-	{ RLIM_INFINITY, RLIM_INFINITY },		\
-}
-
-#endif /* __KERNEL__ */
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/rmap.h linux-2.5.67-bk6/include/asm-s390x/rmap.h
--- linux-2.5.67-bk5/include/asm-s390x/rmap.h	2003-04-07 10:31:45.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/rmap.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,7 +0,0 @@
-#ifndef _S390X_RMAP_H
-#define _S390X_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/rwsem.h linux-2.5.67-bk6/include/asm-s390x/rwsem.h
--- linux-2.5.67-bk5/include/asm-s390x/rwsem.h	2003-04-07 10:30:59.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/rwsem.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,273 +0,0 @@
-#ifndef _S390X_RWSEM_H
-#define _S390X_RWSEM_H
-
-/*
- *  include/asm-s390x/rwsem.h
- *
- *  S390 version
- *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Based on asm-alpha/semaphore.h and asm-i386/rwsem.h
- */
-
-/*
- *
- * The MSW of the count is the negated number of active writers and waiting
- * lockers, and the LSW is the total number of active locks
- *
- * The lock count is initialized to 0 (no active and no waiting lockers).
- *
- * When a writer subtracts WRITE_BIAS, it'll get 0xffff0001 for the case of an
- * uncontended lock. This can be determined because XADD returns the old value.
- * Readers increment by 1 and see a positive value when uncontended, negative
- * if there are writers (and maybe) readers waiting (in which case it goes to
- * sleep).
- *
- * The value of WAITING_BIAS supports up to 32766 waiting processes. This can
- * be extended to 65534 by manually checking the whole MSW rather than relying
- * on the S flag.
- *
- * The value of ACTIVE_BIAS supports up to 65535 active processes.
- *
- * This should be totally fair - if anything is waiting, a process that wants a
- * lock will go to the back of the queue. When the currently active lock is
- * released, if there's a writer at the front of the queue, then that and only
- * that will be woken up; if there's a bunch of consequtive readers at the
- * front, then they'll all be woken up, but no other readers will be.
- */
-
-#ifndef _LINUX_RWSEM_H
-#error "please don't include asm/rwsem.h directly, use linux/rwsem.h instead"
-#endif
-
-#ifdef __KERNEL__
-
-#include <linux/list.h>
-#include <linux/spinlock.h>
-
-struct rwsem_waiter;
-
-extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *);
-extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *);
-extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *);
-extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *);
-extern struct rw_semaphore *rwsem_downgrade_write(struct rw_semaphore *);
-
-/*
- * the semaphore definition
- */
-struct rw_semaphore {
-	signed long		count;
-	spinlock_t		wait_lock;
-	struct list_head	wait_list;
-};
-
-#define RWSEM_UNLOCKED_VALUE	0x0000000000000000L
-#define RWSEM_ACTIVE_BIAS	0x0000000000000001L
-#define RWSEM_ACTIVE_MASK	0x00000000ffffffffL
-#define RWSEM_WAITING_BIAS	(-0x0000000100000000L)
-#define RWSEM_ACTIVE_READ_BIAS	RWSEM_ACTIVE_BIAS
-#define RWSEM_ACTIVE_WRITE_BIAS	(RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
-
-/*
- * initialisation
- */
-#define __RWSEM_INITIALIZER(name) \
-{ RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) }
-
-#define DECLARE_RWSEM(name) \
-	struct rw_semaphore name = __RWSEM_INITIALIZER(name)
-
-static inline void init_rwsem(struct rw_semaphore *sem)
-{
-	sem->count = RWSEM_UNLOCKED_VALUE;
-	spin_lock_init(&sem->wait_lock);
-	INIT_LIST_HEAD(&sem->wait_list);
-}
-
-/*
- * lock for reading
- */
-static inline void __down_read(struct rw_semaphore *sem)
-{
-	signed long old, new;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   aghi %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
-		: "cc", "memory" );
-	if (old < 0)
-		rwsem_down_read_failed(sem);
-}
-
-/*
- * trylock for reading -- returns 1 if successful, 0 if contention
- */
-static inline int __down_read_trylock(struct rw_semaphore *sem)
-{
-	signed long old, new;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: ltgr %1,%0\n"
-		"   jm   1f\n"
-		"   aghi %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b\n"
-		"1:"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "i" (RWSEM_ACTIVE_READ_BIAS)
-		: "cc", "memory" );
-	return old >= 0 ? 1 : 0;
-}
-
-/*
- * lock for writing
- */
-static inline void __down_write(struct rw_semaphore *sem)
-{
-	signed long old, new, tmp;
-
-	tmp = RWSEM_ACTIVE_WRITE_BIAS;
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   ag   %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "m" (tmp)
-		: "cc", "memory" );
-	if (old != 0)
-		rwsem_down_write_failed(sem);
-}
-
-/*
- * trylock for writing -- returns 1 if successful, 0 if contention
- */
-static inline int __down_write_trylock(struct rw_semaphore *sem)
-{
-	signed long old;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%1)\n"
-		"0: ltgr %0,%0\n"
-		"   jnz  1f\n"
-		"   csg  %0,%2,0(%1)\n"
-		"   jl   0b\n"
-		"1:"
-                : "=&d" (old)
-		: "a" (&sem->count), "d" (RWSEM_ACTIVE_WRITE_BIAS)
-		: "cc", "memory" );
-	return (old == RWSEM_UNLOCKED_VALUE) ? 1 : 0;
-}
-
-/*
- * unlock after reading
- */
-static inline void __up_read(struct rw_semaphore *sem)
-{
-	signed long old, new;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   aghi %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "i" (-RWSEM_ACTIVE_READ_BIAS)
-		: "cc", "memory" );
-	if (new < 0)
-		if ((new & RWSEM_ACTIVE_MASK) == 0)
-			rwsem_wake(sem);
-}
-
-/*
- * unlock after writing
- */
-static inline void __up_write(struct rw_semaphore *sem)
-{
-	signed long old, new, tmp;
-
-	tmp = -RWSEM_ACTIVE_WRITE_BIAS;
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   ag   %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "m" (tmp)
-		: "cc", "memory" );
-	if (new < 0)
-		if ((new & RWSEM_ACTIVE_MASK) == 0)
-			rwsem_wake(sem);
-}
-
-/*
- * downgrade write lock to read lock
- */
-static inline void __downgrade_write(struct rw_semaphore *sem)
-{
-	signed long old, new, tmp;
-
-	tmp = -RWSEM_WAITING_BIAS;
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   ag   %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "m" (tmp)
-		: "cc", "memory" );
-	if (new > 1)
-		rwsem_downgrade_wake(sem);
-}
-
-/*
- * implement atomic add functionality
- */
-static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
-{
-	signed long old, new;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   agr  %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "d" (delta)
-		: "cc", "memory" );
-}
-
-/*
- * implement exchange and add functionality
- */
-static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
-{
-	signed long old, new;
-
-	__asm__ __volatile__(
-		"   lg   %0,0(%2)\n"
-		"0: lgr  %1,%0\n"
-		"   agr  %1,%3\n"
-		"   csg  %0,%1,0(%2)\n"
-		"   jl   0b"
-                : "=&d" (old), "=&d" (new)
-		: "a" (&sem->count), "d" (delta)
-		: "cc", "memory" );
-	return new;
-}
-
-#endif /* __KERNEL__ */
-#endif /* _S390X_RWSEM_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/s390_ext.h linux-2.5.67-bk6/include/asm-s390x/s390_ext.h
--- linux-2.5.67-bk5/include/asm-s390x/s390_ext.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/s390_ext.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,34 +0,0 @@
-#ifndef _S390_EXTINT_H
-#define _S390_EXTINT_H
-
-/*
- *  include/asm-s390/s390_ext.h
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-typedef void (*ext_int_handler_t)(struct pt_regs *regs, __u16 code);
-
-/*
- * Warning: if you change ext_int_info_t you have to change the
- * external interrupt handler in entry.S too.
- */ 
-typedef struct ext_int_info_t {
-	struct ext_int_info_t *next;
-	ext_int_handler_t handler;
-	__u16 code;
-} __attribute__ ((packed)) ext_int_info_t;
-
-extern ext_int_info_t *ext_int_hash[];
-
-int register_external_interrupt(__u16 code, ext_int_handler_t handler);
-int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
-				      ext_int_info_t *info);
-int unregister_external_interrupt(__u16 code, ext_int_handler_t handler);
-int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
-					ext_int_info_t *info);
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/scatterlist.h linux-2.5.67-bk6/include/asm-s390x/scatterlist.h
--- linux-2.5.67-bk5/include/asm-s390x/scatterlist.h	2003-04-07 10:32:50.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/scatterlist.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,12 +0,0 @@
-#ifndef _ASMS390X_SCATTERLIST_H
-#define _ASMS390X_SCATTERLIST_H
-
-struct scatterlist {
-    struct page *page;
-    unsigned int offset;
-    unsigned int length;
-};
-
-#define ISA_DMA_THRESHOLD (0xffffffffffffffff)
-
-#endif /* _ASMS390X_SCATTERLIST_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/segment.h linux-2.5.67-bk6/include/asm-s390x/segment.h
--- linux-2.5.67-bk5/include/asm-s390x/segment.h	2003-04-07 10:32:32.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/segment.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,4 +0,0 @@
-#ifndef _ASM_SEGMENT_H
-#define _ASM_SEGMENT_H
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/semaphore.h linux-2.5.67-bk6/include/asm-s390x/semaphore.h
--- linux-2.5.67-bk5/include/asm-s390x/semaphore.h	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/semaphore.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,103 +0,0 @@
-/*
- *  include/asm-s390x/semaphore.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *
- *  Derived from "include/asm-i386/semaphore.h"
- *    (C) Copyright 1996 Linus Torvalds
- */
-
-#ifndef _S390_SEMAPHORE_H
-#define _S390_SEMAPHORE_H
-
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <linux/wait.h>
-#include <linux/rwsem.h>
-
-struct semaphore {
-	atomic_t count;
-	wait_queue_head_t wait;
-};
-
-#define __SEMAPHORE_INITIALIZER(name,count) \
-	{ ATOMIC_INIT(count), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) }
-
-#define __MUTEX_INITIALIZER(name) \
-	__SEMAPHORE_INITIALIZER(name,1)
-
-#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
-	struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
-
-#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
-
-static inline void sema_init (struct semaphore *sem, int val)
-{
-	*sem = (struct semaphore) __SEMAPHORE_INITIALIZER((*sem),val);
-}
-
-static inline void init_MUTEX (struct semaphore *sem)
-{
-	sema_init(sem, 1);
-}
-
-static inline void init_MUTEX_LOCKED (struct semaphore *sem)
-{
-	sema_init(sem, 0);
-}
-
-asmlinkage void __down(struct semaphore * sem);
-asmlinkage int  __down_interruptible(struct semaphore * sem);
-asmlinkage int  __down_trylock(struct semaphore * sem);
-asmlinkage void __up(struct semaphore * sem);
-
-static inline void down(struct semaphore * sem)
-{
-	if (atomic_dec_return(&sem->count) < 0)
-		__down(sem);
-}
-
-static inline int down_interruptible(struct semaphore * sem)
-{
-	int ret = 0;
-
-	if (atomic_dec_return(&sem->count) < 0)
-		ret = __down_interruptible(sem);
-	return ret;
-}
-
-static inline int down_trylock(struct semaphore * sem)
-{
-	int old_val, new_val;
-
-	/*
-	 * This inline assembly atomically implements the equivalent
-	 * to the following C code:
-	 *   old_val = sem->count.counter;
-	 *   if ((new_val = old_val) > 0)
-	 *       sem->count.counter = --new_val;
-	 * In the ppc code this is called atomic_dec_if_positive.
-	 */
-	__asm__ __volatile__ (
-		"   l    %0,0(%3)\n"
-		"0: ltr  %1,%0\n"
-		"   jle  1f\n"
-		"   ahi  %1,-1\n"
-		"   cs   %0,%1,0(%3)\n"
-		"   jl   0b\n"
-		"1:"
-		: "=&d" (old_val), "=&d" (new_val),
-		  "+m" (sem->count.counter)
-		: "a" (&sem->count.counter) : "cc" );
-	return old_val <= 0;
-}
-
-static inline void up(struct semaphore * sem)
-{
-	if (atomic_inc_return(&sem->count) <= 0)
-		__up(sem);
-}
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/sembuf.h linux-2.5.67-bk6/include/asm-s390x/sembuf.h
--- linux-2.5.67-bk5/include/asm-s390x/sembuf.h	2003-04-07 10:31:20.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/sembuf.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,22 +0,0 @@
-#ifndef _S390_SEMBUF_H
-#define _S390_SEMBUF_H
-
-/* 
- * The semid64_ds structure for S/390 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct semid64_ds {
-	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
-	__kernel_time_t	sem_otime;		/* last semop time */
-	__kernel_time_t	sem_ctime;		/* last change time */
-	unsigned long	sem_nsems;		/* no. of semaphores in array */
-	unsigned long	__unused1;
-	unsigned long	__unused2;
-};
-
-#endif /* _S390_SEMBUF_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/setup.h linux-2.5.67-bk6/include/asm-s390x/setup.h
--- linux-2.5.67-bk5/include/asm-s390x/setup.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/setup.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,59 +0,0 @@
-/*
- *  include/asm-s390/setup.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- */
-
-#ifndef _ASM_S390_SETUP_H
-#define _ASM_S390_SETUP_H
-
-#define PARMAREA		0x10400
-#define COMMAND_LINE_SIZE 	896
-#define RAMDISK_ORIGIN		0x800000
-#define RAMDISK_SIZE		0x800000
-
-#ifndef __ASSEMBLY__
-
-#define IPL_DEVICE        (*(unsigned long *)  (0x10400))
-#define INITRD_START      (*(unsigned long *)  (0x10408))
-#define INITRD_SIZE       (*(unsigned long *)  (0x10410))
-#define COMMAND_LINE      ((char *)            (0x10480))
-
-/*
- * Machine features detected in head.S
- */
-extern unsigned long machine_flags;
-
-#define MACHINE_IS_VM		(machine_flags & 1)
-#define MACHINE_IS_P390		(machine_flags & 4)
-#define MACHINE_HAS_MVPG	(machine_flags & 16)
-#define MACHINE_HAS_DIAG44	(machine_flags & 32)
-
-#define MACHINE_HAS_SCLP	(!MACHINE_IS_P390)
-
-/*
- * Console mode. Override with conmode=
- */
-extern unsigned int console_mode;
-extern unsigned int console_device;
-extern unsigned int console_irq;
-
-#define CONSOLE_IS_UNDEFINED	(console_mode == 0)
-#define CONSOLE_IS_SCLP		(console_mode == 1)
-#define CONSOLE_IS_3215		(console_mode == 2)
-#define CONSOLE_IS_3270		(console_mode == 3)
-#define SET_CONSOLE_SCLP	do { console_mode = 1; } while (0)
-#define SET_CONSOLE_3215	do { console_mode = 2; } while (0)
-#define SET_CONSOLE_3270	do { console_mode = 3; } while (0)
-
-#else 
-
-#define IPL_DEVICE        0x10400
-#define INITRD_START      0x10408
-#define INITRD_SIZE       0x10410
-#define COMMAND_LINE      0x10480
-
-#endif
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/shmbuf.h linux-2.5.67-bk6/include/asm-s390x/shmbuf.h
--- linux-2.5.67-bk5/include/asm-s390x/shmbuf.h	2003-04-07 10:33:02.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/shmbuf.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,38 +0,0 @@
-#ifndef _S390_SHMBUF_H
-#define _S390_SHMBUF_H
-
-/* 
- * The shmid64_ds structure for S/390 architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
-	struct ipc64_perm	shm_perm;	/* operation perms */
-	size_t			shm_segsz;	/* size of segment (bytes) */
-	__kernel_time_t		shm_atime;	/* last attach time */
-	__kernel_time_t		shm_dtime;	/* last detach time */
-	__kernel_time_t		shm_ctime;	/* last change time */
-	__kernel_pid_t		shm_cpid;	/* pid of creator */
-	__kernel_pid_t		shm_lpid;	/* pid of last operator */
-	unsigned long		shm_nattch;	/* no. of current attaches */
-	unsigned long		__unused1;
-	unsigned long		__unused2;
-};
-
-struct shminfo64 {
-	unsigned long	shmmax;
-	unsigned long	shmmin;
-	unsigned long	shmmni;
-	unsigned long	shmseg;
-	unsigned long	shmall;
-	unsigned long	__unused1;
-	unsigned long	__unused2;
-	unsigned long	__unused3;
-	unsigned long	__unused4;
-};
-
-#endif /* _S390_SHMBUF_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/shmparam.h linux-2.5.67-bk6/include/asm-s390x/shmparam.h
--- linux-2.5.67-bk5/include/asm-s390x/shmparam.h	2003-04-07 10:30:34.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/shmparam.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,13 +0,0 @@
-/*
- *  include/asm-s390/shmparam.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/shmparam.h"
- */
-#ifndef _ASM_S390_SHMPARAM_H
-#define _ASM_S390_SHMPARAM_H
-
-#define SHMLBA PAGE_SIZE                 /* attach addr a multiple of this */
-
-#endif /* _ASM_S390_SHMPARAM_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/sigcontext.h linux-2.5.67-bk6/include/asm-s390x/sigcontext.h
--- linux-2.5.67-bk5/include/asm-s390x/sigcontext.h	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/sigcontext.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,56 +0,0 @@
-/*
- *  include/asm-s390/sigcontext.h
- *
- *  S390 version
- *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
- */
-
-#ifndef _ASM_S390_SIGCONTEXT_H
-#define _ASM_S390_SIGCONTEXT_H
-
-#define __NUM_GPRS 16
-#define __NUM_FPRS 16
-#define __NUM_ACRS 16
-
-/* Has to be at least _NSIG_WORDS from asm/signal.h */
-#define _SIGCONTEXT_NSIG	64
-#define _SIGCONTEXT_NSIG_BPW	64 
-/* Size of stack frame allocated when calling signal handler. */
-#define __SIGNAL_FRAMESIZE	160
-#define _SIGCONTEXT_NSIG_WORDS	(_SIGCONTEXT_NSIG / _SIGCONTEXT_NSIG_BPW)
-#define _SIGMASK_COPY_SIZE	(sizeof(unsigned long)*_SIGCONTEXT_NSIG_WORDS)
-
-typedef struct 
-{
-        unsigned long mask;
-        unsigned long addr;
-} __attribute__ ((aligned(8))) _psw_t;
-
-typedef struct
-{
-	_psw_t psw;
-	unsigned long gprs[__NUM_GPRS];
-	unsigned int  acrs[__NUM_ACRS];
-} _s390_regs_common;
-
-typedef struct
-{
-	unsigned int fpc;
-	double   fprs[__NUM_FPRS];
-} _s390_fp_regs;
-
-typedef struct
-{
-	_s390_regs_common regs;
-	_s390_fp_regs     fpregs;
-} _sigregs;
-
-struct sigcontext
-{
-	unsigned long	oldmask[_SIGCONTEXT_NSIG_WORDS];
-	_sigregs        *sregs;
-};
-
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/siginfo.h linux-2.5.67-bk6/include/asm-s390x/siginfo.h
--- linux-2.5.67-bk5/include/asm-s390x/siginfo.h	2003-04-07 10:32:48.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/siginfo.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,86 +0,0 @@
-/*
- *  include/asm-s390/siginfo.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/siginfo.h"
- */
-
-#ifndef _S390_SIGINFO_H
-#define _S390_SIGINFO_H
-
-#define HAVE_ARCH_SI_CODES
-
-#include <asm-generic/siginfo.h>
-
-/*
- * SIGILL si_codes
- */
-#define ILL_ILLOPC	(__SI_FAULT|1)	/* illegal opcode */
-#define ILL_ILLOPN	(__SI_FAULT|2)	/* illegal operand */
-#define ILL_ILLADR	(__SI_FAULT|3)	/* illegal addressing mode */
-#define ILL_ILLTRP	(__SI_FAULT|4)	/* illegal trap */
-#define ILL_PRVOPC	(__SI_FAULT|5)	/* privileged opcode */
-#define ILL_PRVREG	(__SI_FAULT|6)	/* privileged register */
-#define ILL_COPROC	(__SI_FAULT|7)	/* coprocessor error */
-#define ILL_BADSTK	(__SI_FAULT|8)	/* internal stack error */
-#define NSIGILL		8
-
-/*
- * SIGFPE si_codes
- */
-#define FPE_INTDIV	(__SI_FAULT|1)	/* integer divide by zero */
-#define FPE_INTOVF	(__SI_FAULT|2)	/* integer overflow */
-#define FPE_FLTDIV	(__SI_FAULT|3)	/* floating point divide by zero */
-#define FPE_FLTOVF	(__SI_FAULT|4)	/* floating point overflow */
-#define FPE_FLTUND	(__SI_FAULT|5)	/* floating point underflow */
-#define FPE_FLTRES	(__SI_FAULT|6)	/* floating point inexact result */
-#define FPE_FLTINV	(__SI_FAULT|7)	/* floating point invalid operation */
-#define FPE_FLTSUB	(__SI_FAULT|8)	/* subscript out of range */
-#define NSIGFPE		8
-
-/*
- * SIGSEGV si_codes
- */
-#define SEGV_MAPERR	(__SI_FAULT|1)	/* address not mapped to object */
-#define SEGV_ACCERR	(__SI_FAULT|2)	/* invalid permissions for mapped object */
-#define NSIGSEGV	2
-
-/*
- * SIGBUS si_codes
- */
-#define BUS_ADRALN	(__SI_FAULT|1)	/* invalid address alignment */
-#define BUS_ADRERR	(__SI_FAULT|2)	/* non-existant physical address */
-#define BUS_OBJERR	(__SI_FAULT|3)	/* object specific hardware error */
-#define NSIGBUS		3
-
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRKPT	(__SI_FAULT|1)	/* process breakpoint */
-#define TRAP_TRACE	(__SI_FAULT|2)	/* process trace trap */
-#define NSIGTRAP	2
-
-/*
- * SIGCHLD si_codes
- */
-#define CLD_EXITED	(__SI_CHLD|1)	/* child has exited */
-#define CLD_KILLED	(__SI_CHLD|2)	/* child was killed */
-#define CLD_DUMPED	(__SI_CHLD|3)	/* child terminated abnormally */
-#define CLD_TRAPPED	(__SI_CHLD|4)	/* traced child has trapped */
-#define CLD_STOPPED	(__SI_CHLD|5)	/* child has stopped */
-#define CLD_CONTINUED	(__SI_CHLD|6)	/* stopped child has continued */
-#define NSIGCHLD	6
-
-/*
- * SIGPOLL si_codes
- */
-#define POLL_IN		(__SI_POLL|1)	/* data input available */
-#define POLL_OUT	(__SI_POLL|2)	/* output buffers available */
-#define POLL_MSG	(__SI_POLL|3)	/* input message available */
-#define POLL_ERR	(__SI_POLL|4)	/* i/o error */
-#define POLL_PRI	(__SI_POLL|5)	/* high priority input available */
-#define POLL_HUP	(__SI_POLL|6)	/* device disconnected */
-#define NSIGPOLL	6
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/signal.h linux-2.5.67-bk6/include/asm-s390x/signal.h
--- linux-2.5.67-bk5/include/asm-s390x/signal.h	2003-04-07 10:31:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/signal.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,190 +0,0 @@
-/*
- *  include/asm-s390/signal.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/signal.h"
- */
-
-#ifndef _ASMS390_SIGNAL_H
-#define _ASMS390_SIGNAL_H
-
-#include <linux/types.h>
-
-/* Avoid too many header ordering problems.  */
-struct siginfo;
-struct pt_regs;
-
-#ifdef __KERNEL__
-/* Most things should be clean enough to redefine this at will, if care
-   is taken to make libc match.  */
-#include <asm/sigcontext.h>
-#define _NSIG           _SIGCONTEXT_NSIG
-#define _NSIG_BPW       _SIGCONTEXT_NSIG_BPW
-#define _NSIG_WORDS     _SIGCONTEXT_NSIG_WORDS
-
-typedef unsigned long old_sigset_t;             /* at least 32 bits */
-
-typedef struct {
-        unsigned long sig[_NSIG_WORDS];
-} sigset_t;
-
-#else
-/* Here we must cater to libcs that poke about in kernel headers.  */
-
-#define NSIG            32
-typedef unsigned long sigset_t;
-
-#endif /* __KERNEL__ */
-
-#define SIGHUP           1
-#define SIGINT           2
-#define SIGQUIT          3
-#define SIGILL           4
-#define SIGTRAP          5
-#define SIGABRT          6
-#define SIGIOT           6
-#define SIGBUS           7
-#define SIGFPE           8
-#define SIGKILL          9
-#define SIGUSR1         10
-#define SIGSEGV         11
-#define SIGUSR2         12
-#define SIGPIPE         13
-#define SIGALRM         14
-#define SIGTERM         15
-#define SIGSTKFLT       16
-#define SIGCHLD         17
-#define SIGCONT         18
-#define SIGSTOP         19
-#define SIGTSTP         20
-#define SIGTTIN         21
-#define SIGTTOU         22
-#define SIGURG          23
-#define SIGXCPU         24
-#define SIGXFSZ         25
-#define SIGVTALRM       26
-#define SIGPROF         27
-#define SIGWINCH        28
-#define SIGIO           29
-#define SIGPOLL         SIGIO
-/*
-#define SIGLOST         29
-*/
-#define SIGPWR          30
-#define SIGSYS		31
-#define SIGUNUSED       31
-
-/* These should not be considered constants from userland.  */
-#define SIGRTMIN        32
-#define SIGRTMAX        (_NSIG-1)
-
-/*
- * SA_FLAGS values:
- *
- * SA_ONSTACK indicates that a registered stack_t will be used.
- * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the
- * SA_RESTART flag to get restarting signals (which were the default long ago)
- * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
- * SA_RESETHAND clears the handler when the signal is delivered.
- * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
- * SA_NODEFER prevents the current signal from being masked in the handler.
- *
- * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
- * Unix names RESETHAND and NODEFER respectively.
- */
-#define SA_NOCLDSTOP    0x00000001
-#define SA_NOCLDWAIT    0x00000002
-#define SA_SIGINFO      0x00000004
-#define SA_ONSTACK      0x08000000
-#define SA_RESTART      0x10000000
-#define SA_NODEFER      0x40000000
-#define SA_RESETHAND    0x80000000
-
-#define SA_NOMASK       SA_NODEFER
-#define SA_ONESHOT      SA_RESETHAND
-#define SA_INTERRUPT    0x20000000 /* dummy -- ignored */
-
-#define SA_RESTORER     0x04000000
-
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK      1
-#define SS_DISABLE      2
-
-#define MINSIGSTKSZ     2048
-#define SIGSTKSZ        8192
-
-#ifdef __KERNEL__
-
-/*
- * These values of sa_flags are used only by the kernel as part of the
- * irq handling routines.
- *
- * SA_INTERRUPT is also used by the irq handling routines.
- * SA_SHIRQ is for shared interrupt support on PCI and EISA.
- */
-#define SA_PROBE                SA_ONESHOT
-#define SA_SAMPLE_RANDOM        SA_RESTART
-#define SA_SHIRQ                0x04000000
-#endif
-
-#define SIG_BLOCK          0    /* for blocking signals */
-#define SIG_UNBLOCK        1    /* for unblocking signals */
-#define SIG_SETMASK        2    /* for setting the signal mask */
-
-/* Type of a signal handler.  */
-typedef void (*__sighandler_t)(int);
-
-#define SIG_DFL ((__sighandler_t)0)     /* default signal handling */
-#define SIG_IGN ((__sighandler_t)1)     /* ignore signal */
-#define SIG_ERR ((__sighandler_t)-1)    /* error return from signal */
-
-#ifdef __KERNEL__
-struct old_sigaction {
-        __sighandler_t sa_handler;
-        old_sigset_t sa_mask;
-        unsigned long sa_flags;
-        void (*sa_restorer)(void);
-};
-
-struct sigaction {
-        __sighandler_t sa_handler;
-        unsigned long sa_flags;
-        void (*sa_restorer)(void);
-        sigset_t sa_mask;               /* mask last for extensibility */
-};
-
-struct k_sigaction {
-        struct sigaction sa;
-};
-
-#define ptrace_signal_deliver(regs, cookie) do { } while (0)
-
-#else
-/* Here we must cater to libcs that poke about in kernel headers.  */
-
-struct sigaction {
-        union {
-          __sighandler_t _sa_handler;
-          void (*_sa_sigaction)(int, struct siginfo *, void *);
-        } _u;
-        unsigned long sa_flags;
-        void (*sa_restorer)(void);
-	sigset_t sa_mask;
-};
-
-#define sa_handler      _u._sa_handler
-#define sa_sigaction    _u._sa_sigaction
-
-#endif /* __KERNEL__ */
-
-typedef struct sigaltstack {
-        void *ss_sp;
-        int ss_flags;
-        size_t ss_size;
-} stack_t;
-
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/sigp.h linux-2.5.67-bk6/include/asm-s390x/sigp.h
--- linux-2.5.67-bk5/include/asm-s390x/sigp.h	2003-04-07 10:31:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/sigp.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,132 +0,0 @@
-/*
- *  include/asm-s390/sigp.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  sigp.h by D.J. Barrow (c) IBM 1999
- *  contains routines / structures for signalling other S/390 processors in an
- *  SMP configuration.
- */
-
-#ifndef __SIGP__
-#define __SIGP__
-
-#include <asm/ptrace.h>
-#include <asm/atomic.h>
-
-/* get real cpu address from logical cpu number */
-extern volatile int __cpu_logical_map[];
-
-typedef enum
-{
-	sigp_unassigned=0x0,
-	sigp_sense,
-	sigp_external_call,
-	sigp_emergency_signal,
-	sigp_start,
-	sigp_stop,
-	sigp_restart,
-	sigp_unassigned1,
-	sigp_unassigned2,
-	sigp_stop_and_store_status,
-	sigp_unassigned3,
-	sigp_initial_cpu_reset,
-	sigp_cpu_reset,
-	sigp_set_prefix,
-	sigp_store_status_at_address,
-	sigp_store_extended_status_at_address
-} sigp_order_code;
-
-typedef __u32 sigp_status_word;
-
-typedef enum
-{
-        sigp_order_code_accepted=0,
-	sigp_status_stored,
-	sigp_busy,
-	sigp_not_operational
-} sigp_ccode;
-
-
-/*
- * Definitions for the external call
- */
-
-/* 'Bit' signals, asynchronous */
-typedef enum
-{
-	ec_schedule=0,
-	ec_call_function,
-	ec_bit_last
-} ec_bit_sig;
-
-
-/*
- * Signal processor
- */
-extern __inline__ sigp_ccode
-signal_processor(__u16 cpu_addr, sigp_order_code order_code)
-{
-	sigp_ccode ccode;
-
-	__asm__ __volatile__(
-		"    sgr    1,1\n"        /* parameter=0 in gpr 1 */
-		"    sigp   1,%1,0(%2)\n"
-		"    ipm    %0\n"
-		"    srl    %0,28"
-		: "=d" (ccode)
-		: "d" (__cpu_logical_map[cpu_addr]), "a" (order_code)
-		: "cc" , "memory", "1" );
-	return ccode;
-}
-
-/*
- * Signal processor with parameter
- */
-extern __inline__ sigp_ccode
-signal_processor_p(__u64 parameter,__u16 cpu_addr,sigp_order_code order_code)
-{
-	sigp_ccode ccode;
-	
-	__asm__ __volatile__(
-		"    lgr    1,%1\n"       /* parameter in gpr 1 */
-		"    sigp   1,%2,0(%3)\n"
-		"    ipm    %0\n"
-		"    srl    %0,28\n"
-		: "=d" (ccode)
-		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
-                  "a" (order_code)
-		: "cc" , "memory", "1" );
-	return ccode;
-}
-
-/*
- * Signal processor with parameter and return status
- */
-extern __inline__ sigp_ccode
-signal_processor_ps(__u32 *statusptr, __u64 parameter,
-		    __u16 cpu_addr, sigp_order_code order_code)
-{
-	sigp_ccode ccode;
-	
-	__asm__ __volatile__(
-		"    sgr    2,2\n"        /* clear status so it doesn't contain rubbish if not saved. */
-		"    lgr    3,%2\n"       /* parameter in gpr 3 */
-		"    sigp   2,%3,0(%4)\n"
-		"    stg    2,%1\n"
-		"    ipm    %0\n"
-		"    srl    %0,28\n"
-		: "=d" (ccode), "=m" (*statusptr)
-		: "d" (parameter), "d" (__cpu_logical_map[cpu_addr]),
-                  "a" (order_code)
-		: "cc" , "memory", "2" , "3"
-		);
-   return ccode;
-}
-
-#endif /* __SIGP__ */
-
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/smp.h linux-2.5.67-bk6/include/asm-s390x/smp.h
--- linux-2.5.67-bk5/include/asm-s390x/smp.h	2003-04-07 10:31:19.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/smp.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,77 +0,0 @@
-/*
- *  include/asm-s390/smp.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-#ifndef __ASM_SMP_H
-#define __ASM_SMP_H
-
-#include <linux/config.h>
-#include <linux/threads.h>
-#include <linux/bitops.h>
-
-#if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
-
-#include <asm/lowcore.h>
-
-/*
-  s390 specific smp.c headers
- */
-typedef struct
-{
-	int        intresting;
-	sigp_ccode ccode; 
-	__u32      status;
-	__u16      cpu;
-} sigp_info;
-
-extern volatile unsigned long cpu_online_map;
-extern volatile unsigned long cpu_possible_map;
-
-#define NO_PROC_ID		0xFF		/* No processor magic marker */
-
-/*
- *	This magic constant controls our willingness to transfer
- *	a process across CPUs. Such a transfer incurs misses on the L1
- *	cache, and on a P6 or P5 with multiple L2 caches L2 hits. My
- *	gut feeling is this will vary by board in value. For a board
- *	with separate L2 cache it probably depends also on the RSS, and
- *	for a board with shared L2 cache it ought to decay fast as other
- *	processes are run.
- */
- 
-#define PROC_CHANGE_PENALTY	20		/* Schedule penalty */
-
-#define smp_processor_id() (current_thread_info()->cpu)
-
-#define cpu_online(cpu) (cpu_online_map & (1<<(cpu)))
-#define cpu_possible(cpu) (cpu_possible_map & (1<<(cpu)))
-
-extern inline unsigned int num_online_cpus(void)
-{
-	return hweight64(cpu_online_map);
-}
-
-extern inline int any_online_cpu(unsigned int mask)
-{
-	if (mask & cpu_online_map)
-		return __ffs(mask & cpu_online_map);
-
-	return -1;
-}
-
-extern __inline__ __u16 hard_smp_processor_id(void)
-{
-        __u16 cpu_address;
- 
-        __asm__ ("stap %0\n" : "=m" (cpu_address));
-        return cpu_address;
-}
-
-#define cpu_logical_map(cpu) (cpu)
-
-#endif
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/socket.h linux-2.5.67-bk6/include/asm-s390x/socket.h
--- linux-2.5.67-bk5/include/asm-s390x/socket.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/socket.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,71 +0,0 @@
-/*
- *  include/asm-s390/socket.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/socket.h"
- */
-
-#ifndef _ASM_SOCKET_H
-#define _ASM_SOCKET_H
-
-#include <asm/sockios.h>
-
-/* For setsockoptions(2) */
-#define SOL_SOCKET	1
-
-#define SO_DEBUG	1
-#define SO_REUSEADDR	2
-#define SO_TYPE		3
-#define SO_ERROR	4
-#define SO_DONTROUTE	5
-#define SO_BROADCAST	6
-#define SO_SNDBUF	7
-#define SO_RCVBUF	8
-#define SO_KEEPALIVE	9
-#define SO_OOBINLINE	10
-#define SO_NO_CHECK	11
-#define SO_PRIORITY	12
-#define SO_LINGER	13
-#define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
-#define SO_PASSCRED	16
-#define SO_PEERCRED	17
-#define SO_RCVLOWAT	18
-#define SO_SNDLOWAT	19
-#define SO_RCVTIMEO	20
-#define SO_SNDTIMEO	21
-
-/* Security levels - as per NRL IPv6 - don't actually do anything */
-#define SO_SECURITY_AUTHENTICATION		22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT	23
-#define SO_SECURITY_ENCRYPTION_NETWORK		24
-
-#define SO_BINDTODEVICE	25
-
-/* Socket filtering */
-#define SO_ATTACH_FILTER        26
-#define SO_DETACH_FILTER        27
-
-#define SO_PEERNAME		28
-#define SO_TIMESTAMP		29
-#define SCM_TIMESTAMP		SO_TIMESTAMP
-#define SO_ACCEPTCONN  		30
-
-/* Nast libc5 fixup - bletch */
-#if defined(__KERNEL__)
-/* Socket types. */
-#define SOCK_STREAM	1		/* stream (connection) socket	*/
-#define SOCK_DGRAM	2		/* datagram (conn.less) socket	*/
-#define SOCK_RAW	3		/* raw socket			*/
-#define SOCK_RDM	4		/* reliably-delivered message	*/
-#define SOCK_SEQPACKET	5		/* sequential packet socket	*/
-#define SOCK_PACKET	10		/* linux specific way of	*/
-					/* getting packets at the dev	*/
-					/* level.  For writing rarp and	*/
-					/* other similar things on the	*/
-					/* user level.			*/
-#define	SOCK_MAX	(SOCK_PACKET+1)
-#endif
-
-#endif /* _ASM_SOCKET_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/sockios.h linux-2.5.67-bk6/include/asm-s390x/sockios.h
--- linux-2.5.67-bk5/include/asm-s390x/sockios.h	2003-04-07 10:30:42.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/sockios.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,20 +0,0 @@
-/*
- *  include/asm-s390/sockios.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/sockios.h"
- */
-
-#ifndef __ARCH_S390_SOCKIOS__
-#define __ARCH_S390_SOCKIOS__
-
-/* Socket-level I/O control calls. */
-#define FIOSETOWN 	0x8901
-#define SIOCSPGRP	0x8902
-#define FIOGETOWN	0x8903
-#define SIOCGPGRP	0x8904
-#define SIOCATMARK	0x8905
-#define SIOCGSTAMP	0x8906		/* Get stamp */
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/spinlock.h linux-2.5.67-bk6/include/asm-s390x/spinlock.h
--- linux-2.5.67-bk5/include/asm-s390x/spinlock.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/spinlock.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,155 +0,0 @@
-/*
- *  include/asm-s390/spinlock.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/spinlock.h"
- */
-
-#ifndef __ASM_SPINLOCK_H
-#define __ASM_SPINLOCK_H
-
-/*
- * Grmph, take care of %&#! user space programs that include
- * asm/spinlock.h. The diagnose is only available in kernel
- * context.
- */
-#ifdef __KERNEL__
-#include <asm/lowcore.h>
-#define __DIAG44_INSN "ex"
-#define __DIAG44_OPERAND __LC_DIAG44_OPCODE
-#else
-#define __DIAG44_INSN "#"
-#define __DIAG44_OPERAND 0
-#endif
-
-/*
- * Simple spin lock operations.  There are two variants, one clears IRQ's
- * on the local processor, one does not.
- *
- * We make no fairness assumptions. They have a cost.
- */
-
-typedef struct {
-	volatile unsigned int lock;
-} __attribute__ ((aligned (4))) spinlock_t;
-
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-#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)
-
-extern inline void _raw_spin_lock(spinlock_t *lp)
-{
-	unsigned long reg1, reg2;
-        __asm__ __volatile("    bras  %1,1f\n"
-                           "0:  " __DIAG44_INSN " 0,%4\n"
-                           "1:  slr   %0,%0\n"
-                           "    cs    %0,%1,0(%3)\n"
-                           "    jl    0b\n"
-                           : "=&d" (reg1), "=&d" (reg2), "+m" (lp->lock)
-                           : "a" (&lp->lock), "i" (__DIAG44_OPERAND)
-			   : "cc" );
-}
-
-extern inline int _raw_spin_trylock(spinlock_t *lp)
-{
-	unsigned int result, reg;
-	__asm__ __volatile("    slr   %0,%0\n"
-			   "    basr  %1,0\n"
-			   "0:  cs    %0,%1,0(%3)"
-			   : "=&d" (result), "=&d" (reg), "+m" (lp->lock)
-			   : "a" (&lp->lock) : "cc" );
-	return !result;
-}
-
-extern inline void _raw_spin_unlock(spinlock_t *lp)
-{
-	__asm__ __volatile("    xc 0(4,%1),0(%1)\n"
-                           "    bcr 15,0"
-			   : "+m" (lp->lock) : "a" (&lp->lock) : "cc" );
-}
-		
-/*
- * Read-write spinlocks, allowing multiple readers
- * but only one writer.
- *
- * NOTE! it is quite common to have readers in interrupts
- * but no interrupt writers. For those circumstances we
- * can "mix" irq-safe locks - any writer needs to get a
- * irq-safe write-lock, but readers can get non-irqsafe
- * read-locks.
- */
-typedef struct {
-	volatile unsigned long lock;
-	volatile unsigned long owner_pc;
-} rwlock_t;
-
-#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
-
-#define rwlock_init(x)	do { *(x) = RW_LOCK_UNLOCKED; } while(0)
-
-#define rwlock_is_locked(x) ((x)->lock != 0)
-
-#define _raw_read_lock(rw)   \
-        asm volatile("   lg    2,0(%1)\n"   \
-                     "   j     1f\n"     \
-                     "0: " __DIAG44_INSN " 0,%2\n" \
-                     "1: nihh  2,0x7fff\n" /* clear high (=write) bit */ \
-                     "   la    3,1(2)\n"   /* one more reader */  \
-                     "   csg   2,3,0(%1)\n" /* try to write new value */ \
-                     "   jl    0b"       \
-                     : "+m" ((rw)->lock) \
-		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
-		     : "2", "3", "cc" )
-
-#define _raw_read_unlock(rw) \
-        asm volatile("   lg    2,0(%1)\n"   \
-                     "   j     1f\n"     \
-                     "0: " __DIAG44_INSN " 0,%2\n" \
-                     "1: lgr   3,2\n"    \
-                     "   bctgr 3,0\n"    /* one less reader */ \
-                     "   csg   2,3,0(%1)\n" \
-                     "   jl    0b"       \
-                     : "+m" ((rw)->lock) \
-		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
-		     : "2", "3", "cc" )
-
-#define _raw_write_lock(rw) \
-        asm volatile("   llihh 3,0x8000\n" /* new lock value = 0x80...0 */ \
-                     "   j     1f\n"       \
-                     "0: " __DIAG44_INSN " 0,%2\n"   \
-                     "1: slgr  2,2\n"      /* old lock value must be 0 */ \
-                     "   csg   2,3,0(%1)\n" \
-                     "   jl    0b"         \
-                     : "+m" ((rw)->lock) \
-		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
-		     : "2", "3", "cc" )
-
-#define _raw_write_unlock(rw) \
-        asm volatile("   slgr  3,3\n"      /* new lock value = 0 */ \
-                     "   j     1f\n"       \
-                     "0: " __DIAG44_INSN " 0,%2\n"   \
-                     "1: llihh 2,0x8000\n" /* old lock value must be 0x8..0 */\
-                     "   csg   2,3,0(%1)\n"   \
-                     "   jl    0b"         \
-                     : "+m" ((rw)->lock) \
-		     : "a" (&(rw)->lock), "i" (__DIAG44_OPERAND) \
-		     : "2", "3", "cc" )
-
-extern inline int _raw_write_trylock(rwlock_t *rw)
-{
-	unsigned int result, reg;
-	
-	__asm__ __volatile__("   llihh %0,0x8000\n"
-			     "   basr  %1,0\n"
-			     "0: csg %0,%1,0(%3)\n"
-			     : "=&d" (result), "=&d" (reg), "+m" (rw->lock)
-			     : "a" (&rw->lock) : "cc" );
-	return !result;
-}
-
-#endif /* __ASM_SPINLOCK_H */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/stat.h linux-2.5.67-bk6/include/asm-s390x/stat.h
--- linux-2.5.67-bk5/include/asm-s390x/stat.h	2003-04-07 10:33:03.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/stat.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,35 +0,0 @@
-/*
- *  include/asm-s390x/stat.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/stat.h"
- */
-
-#ifndef _S390_STAT_H
-#define _S390_STAT_H
-
-struct stat {
-        unsigned long  st_dev;
-        unsigned long  st_ino;
-        unsigned long  st_nlink;
-        unsigned int   st_mode;
-        unsigned int   st_uid;
-        unsigned int   st_gid;
-        unsigned int   __pad1;
-        unsigned long  st_rdev;
-        unsigned long  st_size;
-        unsigned long  st_atime;
-	unsigned long  st_atime_nsec;
-        unsigned long  st_mtime;
-	unsigned long  st_mtime_nsec;
-        unsigned long  st_ctime;
-	unsigned long  st_ctime_nsec;
-        unsigned long  st_blksize;
-        long           st_blocks;
-        unsigned long  __unused[3];
-};
-
-#define STAT_HAVE_NSEC 1
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/statfs.h linux-2.5.67-bk6/include/asm-s390x/statfs.h
--- linux-2.5.67-bk5/include/asm-s390x/statfs.h	2003-04-07 10:31:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/statfs.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,33 +0,0 @@
-/*
- *  include/asm-s390/statfs.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/statfs.h"
- */
-
-#ifndef _S390_STATFS_H
-#define _S390_STATFS_H
-
-#ifndef __KERNEL_STRICT_NAMES
-
-#include <linux/types.h>
-
-typedef __kernel_fsid_t	fsid_t;
-
-#endif
-
-struct statfs {
-	int  f_type;
-	int  f_bsize;
-	long f_blocks;
-	long f_bfree;
-	long f_bavail;
-	long f_files;
-	long f_ffree;
-	__kernel_fsid_t f_fsid;
-	int  f_namelen;
-	int  f_spare[6];
-};
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/string.h linux-2.5.67-bk6/include/asm-s390x/string.h
--- linux-2.5.67-bk5/include/asm-s390x/string.h	2003-04-07 10:32:27.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/string.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,112 +0,0 @@
-/*
- *  include/asm-s390/string.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- */
-
-#ifndef _S390_STRING_H_
-#define _S390_STRING_H_
-
-#ifdef __KERNEL__
-
-#ifndef _LINUX_TYPES_H
-#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
-
-#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_STRPBRK
-#undef __HAVE_ARCH_STRTOK
-#undef __HAVE_ARCH_BCOPY
-#undef __HAVE_ARCH_MEMCMP
-#undef __HAVE_ARCH_MEMSCAN
-#undef __HAVE_ARCH_STRSTR
-
-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 *);
-
-static inline void * memchr(const void * cs,int c,size_t count)
-{
-    void *ptr;
-
-    __asm__ __volatile__ ("   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"
-                          "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__ ("   slgr  0,0\n"
-                          "0: mvst  %0,%1\n"
-                          "   jo    0b"
-                          : "+&a" (dest), "+&a" (src) :
-                          : "cc", "memory", "0" );
-    return tmp;
-}
-
-static __inline__ size_t strlen(const char *s)
-{
-    size_t len;
-
-    __asm__ __volatile__ ("   slgr  0,0\n"
-                          "   lgr   %0,%1\n"
-                          "0: srst  0,%0\n"
-                          "   jo    0b\n"
-                          "   lgr   %0,0\n"
-                          "   sgr   %0,%1"
-                          : "=&a" (len) : "a" (s) 
-                          : "cc", "0" );
-    return len;
-}
-
-static __inline__ char *strcat(char *dest, const char *src)
-{
-    char *tmp = dest;
-
-    __asm__ __volatile__ ("   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"
-                          : "+&a" (dest), "+&a" (src) :
-                          : "cc", "memory", "0" );
-    return tmp;
-}
-
-extern void *alloca(size_t);
-#endif /* __KERNEL__ */
-
-#endif /* __S390_STRING_H_ */
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/suspend.h linux-2.5.67-bk6/include/asm-s390x/suspend.h
--- linux-2.5.67-bk5/include/asm-s390x/suspend.h	2003-04-07 10:31:50.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/suspend.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,5 +0,0 @@
-#ifndef __ASM_S390X_SUSPEND_H
-#define __ASM_S390X_SUSPEND_H
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/system.h linux-2.5.67-bk6/include/asm-s390x/system.h
--- linux-2.5.67-bk5/include/asm-s390x/system.h	2003-04-07 10:32:51.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/system.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,360 +0,0 @@
-/*
- *  include/asm-s390/system.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
- *
- *  Derived from "include/asm-i386/system.h"
- */
-
-#ifndef __ASM_SYSTEM_H
-#define __ASM_SYSTEM_H
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <asm/types.h>
-#include <asm/ptrace.h>
-#include <asm/setup.h>
-
-#ifdef __KERNEL__
-
-struct task_struct;
-
-extern struct task_struct *resume(void *, void *);
-
-static inline void save_fp_regs(s390_fp_regs *fpregs)
-{
-	asm volatile (
-		"   stfpc 0(%0)\n"
-		"   std   0,8(%0)\n"
-		"   std   1,16(%0)\n"
-		"   std   2,24(%0)\n"
-		"   std   3,32(%0)\n"
-		"   std   4,40(%0)\n"
-		"   std   5,48(%0)\n"
-		"   std   6,56(%0)\n"
-		"   std   7,64(%0)\n"
-		"   std   8,72(%0)\n"
-		"   std   9,80(%0)\n"
-		"   std   10,88(%0)\n"
-		"   std   11,96(%0)\n"
-		"   std   12,104(%0)\n"
-		"   std   13,112(%0)\n"
-		"   std   14,120(%0)\n"
-		"   std   15,128(%0)\n"
-		: : "a" (fpregs) : "memory" );
-}
-
-static inline void restore_fp_regs(s390_fp_regs *fpregs)
-{
-	asm volatile (
-		"   lfpc  0(%0)\n"
-		"   ld    0,8(%0)\n"
-		"   ld    1,16(%0)\n"
-		"   ld    2,24(%0)\n"
-		"   ld    3,32(%0)\n"
-		"   ld    4,40(%0)\n"
-		"   ld    5,48(%0)\n"
-		"   ld    6,56(%0)\n"
-		"   ld    7,64(%0)\n"
-		"   ld    8,72(%0)\n"
-		"   ld    9,80(%0)\n"
-		"   ld    10,88(%0)\n"
-		"   ld    11,96(%0)\n"
-		"   ld    12,104(%0)\n"
-		"   ld    13,112(%0)\n"
-		"   ld    14,120(%0)\n"
-		"   ld    15,128(%0)\n"
-		: : "a" (fpregs));
-}
-
-#define switch_to(prev,next,last) do {					     \
-	if (prev == next)						     \
-		break;							     \
-	save_fp_regs(&prev->thread.fp_regs);				     \
-	restore_fp_regs(&next->thread.fp_regs);				     \
-	resume(prev,next);						     \
-} while (0)
-
-#define nop() __asm__ __volatile__ ("nop")
-
-#define xchg(ptr,x) \
-  ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(void *)(ptr),sizeof(*(ptr))))
-
-extern void __misaligned_u16(void);
-extern void __misaligned_u32(void);
-extern void __misaligned_u64(void);
-
-static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
-{
-	unsigned long addr, old;
-	int shift;
-
-        switch (size) {
-	case 1:
-		addr = (unsigned long) ptr;
-		shift = (3 ^ (addr & 3)) << 3;
-		addr ^= addr & 3;
-		asm volatile(
-			"    l   %0,0(%3)\n"
-			"0:  lr  0,%0\n"
-			"    nr  0,%2\n"
-			"    or  0,%1\n"
-			"    cs  %0,0,0(%3)\n"
-			"    jl  0b\n"
-			: "=&d" (old)
-			: "d" (x << shift), "d" (~(255 << shift)), "a" (addr)
-			: "memory", "cc", "0" );
-		x = old >> shift;
-		break;
-	case 2:
-		addr = (unsigned long) ptr;
-		shift = (2 ^ (addr & 2)) << 3;
-		addr ^= addr & 2;
-		asm volatile(
-			"    l   %0,0(%3)\n"
-			"0:  lr  0,%0\n"
-			"    nr  0,%2\n"
-			"    or  0,%1\n"
-			"    cs  %0,0,0(%3)\n"
-			"    jl  0b\n"
-			: "=&d" (old) 
-			: "d" (x << shift), "d" (~(65535 << shift)), "a" (addr)
-			: "memory", "cc", "0" );
-		x = old >> shift;
-		break;
-	case 4:
-		asm volatile (
-			"    l   %0,0(%2)\n"
-			"0:  cs  %0,%1,0(%2)\n"
-			"    jl  0b\n"
-			: "=&d" (old) : "d" (x), "a" (ptr)
-			: "memory", "cc", "0" );
-		x = old;
-		break;
-	case 8:
-		asm volatile (
-			"    lg  %0,0(%2)\n"
-			"0:  csg %0,%1,0(%2)\n"
-			"    jl  0b\n"
-			: "=&d" (old) : "d" (x), "a" (ptr)
-			: "memory", "cc", "0" );
-		x = old;
-		break;
-        }
-        return x;
-}
-
-/*
- * Atomic compare and exchange.  Compare OLD with MEM, if identical,
- * store NEW in MEM.  Return the initial value in MEM.  Success is
- * indicated by comparing RETURN with OLD.
- */
-
-#define __HAVE_ARCH_CMPXCHG 1
-
-#define cmpxchg(ptr,o,n)\
-	((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
-					(unsigned long)(n),sizeof(*(ptr))))
-
-static inline unsigned long
-__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
-{
-	unsigned long addr, prev, tmp;
-	int shift;
-
-        switch (size) {
-	case 1:
-		addr = (unsigned long) ptr;
-		shift = (3 ^ (addr & 3)) << 3;
-		addr ^= addr & 3;
-		asm volatile(
-			"    l   %0,0(%4)\n"
-			"0:  nr  %0,%5\n"
-                        "    lr  %1,%0\n"
-			"    or  %0,%2\n"
-			"    or  %1,%3\n"
-			"    cs  %0,%1,0(%4)\n"
-			"    jnl 1f\n"
-			"    xr  %1,%0\n"
-			"    nr  %1,%5\n"
-			"    jnz 0b\n"
-			"1:"
-			: "=&d" (prev), "=&d" (tmp)
-			: "d" (old << shift), "d" (new << shift), "a" (ptr),
-			  "d" (~(255 << shift))
-			: "memory", "cc" );
-		return prev >> shift;
-	case 2:
-		addr = (unsigned long) ptr;
-		shift = (2 ^ (addr & 2)) << 3;
-		addr ^= addr & 2;
-		asm volatile(
-			"    l   %0,0(%4)\n"
-			"0:  nr  %0,%5\n"
-                        "    lr  %1,%0\n"
-			"    or  %0,%2\n"
-			"    or  %1,%3\n"
-			"    cs  %0,%1,0(%4)\n"
-			"    jnl 1f\n"
-			"    xr  %1,%0\n"
-			"    nr  %1,%5\n"
-			"    jnz 0b\n"
-			"1:"
-			: "=&d" (prev), "=&d" (tmp)
-			: "d" (old << shift), "d" (new << shift), "a" (ptr),
-			  "d" (~(65535 << shift))
-			: "memory", "cc" );
-		return prev >> shift;
-	case 4:
-		asm volatile (
-			"    cs  %0,%2,0(%3)\n"
-			: "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
-			: "memory", "cc" );
-		return prev;
-	case 8:
-		asm volatile (
-			"    csg %0,%2,0(%3)\n"
-			: "=&d" (prev) : "0" (old), "d" (new), "a" (ptr)
-			: "memory", "cc" );
-		return prev;
-        }
-        return old;
-}
-
-/*
- * Force strict CPU ordering.
- * And yes, this is required on UP too when we're talking
- * to devices.
- *
- * This is very similar to the ppc eieio/sync instruction in that is
- * does a checkpoint syncronisation & makes sure that 
- * all memory ops have completed wrt other CPU's ( see 7-15 POP  DJB ).
- */
-
-#define eieio()  __asm__ __volatile__ ( "bcr 15,0" : : : "memory" ) 
-# define SYNC_OTHER_CORES(x)   eieio() 
-#define mb()    eieio()
-#define rmb()   eieio()
-#define wmb()   eieio()
-#define read_barrier_depends()	do { } while(0)
-#define smp_mb()       mb()
-#define smp_rmb()      rmb()
-#define smp_wmb()      wmb()
-#define smp_read_barrier_depends()    read_barrier_depends()
-#define smp_mb__before_clear_bit()     smp_mb()
-#define smp_mb__after_clear_bit()      smp_mb()
-
-#define set_mb(var, value)      do { var = value; mb(); } while (0)
-#define set_wmb(var, value)     do { var = value; wmb(); } while (0)
-
-/* interrupt control.. */
-#define local_irq_enable() ({ \
-        unsigned long __dummy; \
-        __asm__ __volatile__ ( \
-                "stosm 0(%1),0x03" : "=m" (__dummy) : "a" (&__dummy) ); \
-        })
-
-#define local_irq_disable() ({ \
-        unsigned long __flags; \
-        __asm__ __volatile__ ( \
-                "stnsm 0(%1),0xfc" : "=m" (__flags) : "a" (&__flags) ); \
-        __flags; \
-        })
-
-#define local_save_flags(x) \
-        __asm__ __volatile__("stosm 0(%1),0" : "=m" (x) : "a" (&x) )
-
-#define local_irq_restore(x) \
-        __asm__ __volatile__("ssm   0(%0)" : : "a" (&x) )
-
-#define irqs_disabled()			\
-({					\
-	unsigned long flags;		\
-	local_save_flags(flags);	\
-        !((flags >> 56) & 3);		\
-})
-
-#define __load_psw(psw) \
-        __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw) : "cc" );
-
-#define __ctl_load(array, low, high) ({ \
-	__asm__ __volatile__ ( \
-		"   la    1,%0\n" \
-		"   bras  2,0f\n" \
-                "   lctlg 0,0,0(1)\n" \
-		"0: ex    %1,0(2)" \
-		: : "m" (array), "a" (((low)<<4)+(high)) : "1", "2" ); \
-	})
-
-#define __ctl_store(array, low, high) ({ \
-	__asm__ __volatile__ ( \
-		"   la    1,%0\n" \
-		"   bras  2,0f\n" \
-		"   stctg 0,0,0(1)\n" \
-		"0: ex    %1,0(2)" \
-		: "=m" (array) : "a" (((low)<<4)+(high)): "1", "2" ); \
-	})
-
-#define __ctl_set_bit(cr, bit) ({ \
-        __u8 __dummy[24]; \
-        __asm__ __volatile__ ( \
-                "    la    1,%0\n"       /* align to 8 byte */ \
-                "    aghi  1,7\n" \
-                "    nill  1,0xfff8\n" \
-                "    bras  2,0f\n"       /* skip indirect insns */ \
-                "    stctg 0,0,0(1)\n" \
-                "    lctlg 0,0,0(1)\n" \
-                "0:  ex    %1,0(2)\n"    /* execute stctl */ \
-                "    lg    0,0(1)\n" \
-                "    ogr   0,%2\n"       /* set the bit */ \
-                "    stg   0,0(1)\n" \
-                "1:  ex    %1,6(2)"      /* execute lctl */ \
-                : "=m" (__dummy) : "a" (cr*17), "a" (1L<<(bit)) \
-                : "cc", "0", "1", "2"); \
-        })
-
-#define __ctl_clear_bit(cr, bit) ({ \
-        __u8 __dummy[24]; \
-        __asm__ __volatile__ ( \
-                "    la    1,%0\n"       /* align to 8 byte */ \
-                "    aghi  1,7\n" \
-                "    nill  1,0xfff8\n" \
-                "    bras  2,0f\n"       /* skip indirect insns */ \
-                "    stctg 0,0,0(1)\n" \
-                "    lctlg 0,0,0(1)\n" \
-                "0:  ex    %1,0(2)\n"    /* execute stctl */ \
-                "    lg    0,0(1)\n" \
-                "    ngr   0,%2\n"       /* set the bit */ \
-                "    stg   0,0(1)\n" \
-                "1:  ex    %1,6(2)"      /* execute lctl */ \
-                : "=m" (__dummy) : "a" (cr*17), "a" (~(1L<<(bit))) \
-                : "cc", "0", "1", "2"); \
-        })
-
-/* For spinlocks etc */
-#define local_irq_save(x)	((x) = local_irq_disable())
-
-#ifdef CONFIG_SMP
-
-extern void smp_ctl_set_bit(int cr, int bit);
-extern void smp_ctl_clear_bit(int cr, int bit);
-#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
-#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
-
-#else
-
-#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
-#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
-
-#endif /* CONFIG_SMP */
-
-extern void (*_machine_restart)(char *command);
-extern void (*_machine_halt)(void);
-extern void (*_machine_power_off)(void);
-
-#endif /* __KERNEL __ */
-
-#endif
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/tape390.h linux-2.5.67-bk6/include/asm-s390x/tape390.h
--- linux-2.5.67-bk5/include/asm-s390x/tape390.h	2003-04-07 10:31:54.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/tape390.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,39 +0,0 @@
-/*************************************************************************
- *
- * tape390.h
- *         enables user programs to display messages on the tape device
- *
- *  S390 and zSeries version
- *         Copyright (C) 2001 IBM Corporation
- *         Author(s): Despina Papadopoulou <despina_p@de.ibm.com>
- *
- *************************************************************************/
-
-#ifndef _TAPE390_H
-#define _TAPE390_H
-
-#define TAPE390_DISPLAY _IOW('d', 1, struct display_struct)
-
-/*
- * The TAPE390_DISPLAY ioctl calls the Load Display command
- * which transfers 17 bytes of data from the channel to the subsystem:
- *     - 1 format control byte, and
- *     - two 8-byte messages
- *
- * Format control byte:
- *   0-2: New Message Overlay
- *     3: Alternate Messages
- *     4: Blink Message
- *     5: Display Low/High Message
- *     6: Reserved
- *     7: Automatic Load Request
- *
- */
-
-typedef struct display_struct {
-        char cntrl;
-        char message1[8];
-        char message2[8];
-} display_struct;
-
-#endif 
diff -urN linux-2.5.67-bk5/include/asm-s390x/termbits.h linux-2.5.67-bk6/include/asm-s390x/termbits.h
--- linux-2.5.67-bk5/include/asm-s390x/termbits.h	2003-04-07 10:30:44.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/termbits.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,180 +0,0 @@
-/*
- *  include/asm-s390/termbits.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/termbits.h"
- */
-
-#ifndef __ARCH_S390_TERMBITS_H__
-#define __ARCH_S390_TERMBITS_H__
-
-#include <linux/posix_types.h>
-
-typedef unsigned char	cc_t;
-typedef unsigned int	speed_t;
-typedef unsigned int	tcflag_t;
-
-#define NCCS 19
-struct termios {
-	tcflag_t c_iflag;		/* input mode flags */
-	tcflag_t c_oflag;		/* output mode flags */
-	tcflag_t c_cflag;		/* control mode flags */
-	tcflag_t c_lflag;		/* local mode flags */
-	cc_t c_line;			/* line discipline */
-	cc_t c_cc[NCCS];		/* control characters */
-};
-
-/* c_cc characters */
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VTIME 5
-#define VMIN 6
-#define VSWTC 7
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VEOL 11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOL2 16
-
-/* c_iflag bits */
-#define IGNBRK	0000001
-#define BRKINT	0000002
-#define IGNPAR	0000004
-#define PARMRK	0000010
-#define INPCK	0000020
-#define ISTRIP	0000040
-#define INLCR	0000100
-#define IGNCR	0000200
-#define ICRNL	0000400
-#define IUCLC	0001000
-#define IXON	0002000
-#define IXANY	0004000
-#define IXOFF	0010000
-#define IMAXBEL	0020000
-
-/* c_oflag bits */
-#define OPOST	0000001
-#define OLCUC	0000002
-#define ONLCR	0000004
-#define OCRNL	0000010
-#define ONOCR	0000020
-#define ONLRET	0000040
-#define OFILL	0000100
-#define OFDEL	0000200
-#define NLDLY	0000400
-#define   NL0	0000000
-#define   NL1	0000400
-#define CRDLY	0003000
-#define   CR0	0000000
-#define   CR1	0001000
-#define   CR2	0002000
-#define   CR3	0003000
-#define TABDLY	0014000
-#define   TAB0	0000000
-#define   TAB1	0004000
-#define   TAB2	0010000
-#define   TAB3	0014000
-#define   XTABS	0014000
-#define BSDLY	0020000
-#define   BS0	0000000
-#define   BS1	0020000
-#define VTDLY	0040000
-#define   VT0	0000000
-#define   VT1	0040000
-#define FFDLY	0100000
-#define   FF0	0000000
-#define   FF1	0100000
-
-/* c_cflag bit meaning */
-#define CBAUD	0010017
-#define  B0	0000000		/* hang up */
-#define  B50	0000001
-#define  B75	0000002
-#define  B110	0000003
-#define  B134	0000004
-#define  B150	0000005
-#define  B200	0000006
-#define  B300	0000007
-#define  B600	0000010
-#define  B1200	0000011
-#define  B1800	0000012
-#define  B2400	0000013
-#define  B4800	0000014
-#define  B9600	0000015
-#define  B19200	0000016
-#define  B38400	0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CSIZE	0000060
-#define   CS5	0000000
-#define   CS6	0000020
-#define   CS7	0000040
-#define   CS8	0000060
-#define CSTOPB	0000100
-#define CREAD	0000200
-#define PARENB	0000400
-#define PARODD	0001000
-#define HUPCL	0002000
-#define CLOCAL	0004000
-#define CBAUDEX 0010000
-#define  B57600  0010001
-#define  B115200 0010002
-#define  B230400 0010003
-#define  B460800 0010004
-#define   B500000 0010005
-#define   B576000 0010006
-#define   B921600 0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define CIBAUD	  002003600000	/* input baud rate (not used) */
-#define CMSPAR	  010000000000		/* mark or space (stick) parity */
-#define CRTSCTS	  020000000000		/* flow control */
-
-/* c_lflag bits */
-#define ISIG	0000001
-#define ICANON	0000002
-#define XCASE	0000004
-#define ECHO	0000010
-#define ECHOE	0000020
-#define ECHOK	0000040
-#define ECHONL	0000100
-#define NOFLSH	0000200
-#define TOSTOP	0000400
-#define ECHOCTL	0001000
-#define ECHOPRT	0002000
-#define ECHOKE	0004000
-#define FLUSHO	0010000
-#define PENDIN	0040000
-#define IEXTEN	0100000
-
-/* tcflow() and TCXONC use these */
-#define	TCOOFF		0
-#define	TCOON		1
-#define	TCIOFF		2
-#define	TCION		3
-
-/* tcflush() and TCFLSH use these */
-#define	TCIFLUSH	0
-#define	TCOFLUSH	1
-#define	TCIOFLUSH	2
-
-/* tcsetattr uses these */
-#define	TCSANOW		0
-#define	TCSADRAIN	1
-#define	TCSAFLUSH	2
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/termios.h linux-2.5.67-bk6/include/asm-s390x/termios.h
--- linux-2.5.67-bk5/include/asm-s390x/termios.h	2003-04-07 10:32:26.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/termios.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,115 +0,0 @@
-/*
- *  include/asm-s390/termios.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/termios.h"
- */
-
-#ifndef _S390_TERMIOS_H
-#define _S390_TERMIOS_H
-
-#include <asm/termbits.h>
-#include <asm/ioctls.h>
-
-
-struct winsize {
-	unsigned short ws_row;
-	unsigned short ws_col;
-	unsigned short ws_xpixel;
-	unsigned short ws_ypixel;
-};
-
-#define NCC 8
-struct termio {
-	unsigned short c_iflag;		/* input mode flags */
-	unsigned short c_oflag;		/* output mode flags */
-	unsigned short c_cflag;		/* control mode flags */
-	unsigned short c_lflag;		/* local mode flags */
-	unsigned char c_line;		/* line discipline */
-	unsigned char c_cc[NCC];	/* control characters */
-};
-
-/* modem lines */
-#define TIOCM_LE	0x001
-#define TIOCM_DTR	0x002
-#define TIOCM_RTS	0x004
-#define TIOCM_ST	0x008
-#define TIOCM_SR	0x010
-#define TIOCM_CTS	0x020
-#define TIOCM_CAR	0x040
-#define TIOCM_RNG	0x080
-#define TIOCM_DSR	0x100
-#define TIOCM_CD	TIOCM_CAR
-#define TIOCM_RI	TIOCM_RNG
-#define TIOCM_OUT1	0x2000
-#define TIOCM_OUT2	0x4000
-#define TIOCM_LOOP      0x8000
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-
-/* line disciplines */
-#define N_TTY		0
-#define N_SLIP		1
-#define N_MOUSE		2
-#define N_PPP		3
-#define N_STRIP		4
-#define N_AX25		5
-#define N_X25		6	/* X.25 async */
-#define N_6PACK		7
-#define N_MASC		8	/* Reserved for Mobitex module <kaz@cafe.net> */
-#define N_R3964		9	/* Reserved for Simatic R3964 module */
-#define N_PROFIBUS_FDL	10	/* Reserved for Profibus <Dave@mvhi.com> */
-#define N_IRDA		11	/* Linux IR - http://irda.sourceforge.net/ */
-#define N_SMSBLOCK	12	/* SMS block mode - for talking to GSM data cards about SMS messages */
-#define N_HDLC         13	/* synchronous HDLC */
-#define N_HCI		15	/* Bluetooth HCI UART */
-
-#ifdef __KERNEL__
-
-/*	intr=^C		quit=^\		erase=del	kill=^U
-	eof=^D		vtime=\0	vmin=\1		sxtc=\0
-	start=^Q	stop=^S		susp=^Z		eol=\0
-	reprint=^R	discard=^U	werase=^W	lnext=^V
-	eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-        unsigned short tmp; \
-        get_user(tmp, &(termio)->c_iflag); \
-        (termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
-        get_user(tmp, &(termio)->c_oflag); \
-        (termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
-        get_user(tmp, &(termio)->c_cflag); \
-        (termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
-        get_user(tmp, &(termio)->c_lflag); \
-        (termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
-        get_user((termios)->c_line, &(termio)->c_line); \
-	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-	put_user((termios)->c_iflag, &(termio)->c_iflag); \
-	put_user((termios)->c_oflag, &(termio)->c_oflag); \
-	put_user((termios)->c_cflag, &(termio)->c_cflag); \
-	put_user((termios)->c_lflag, &(termio)->c_lflag); \
-	put_user((termios)->c_line,  &(termio)->c_line); \
-	copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
-
-#endif	/* __KERNEL__ */
-
-#endif	/* _S390_TERMIOS_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/thread_info.h linux-2.5.67-bk6/include/asm-s390x/thread_info.h
--- linux-2.5.67-bk5/include/asm-s390x/thread_info.h	2003-04-07 10:32:16.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/thread_info.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,95 +0,0 @@
-/*
- *  include/asm-s390/thread_info.h
- *
- *  S390 version
- *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-#ifndef _ASM_THREAD_INFO_H
-#define _ASM_THREAD_INFO_H
-
-#ifdef __KERNEL__
-
-#ifndef __ASSEMBLY__
-#include <asm/processor.h>
-
-/*
- * low level task data that entry.S needs immediate access to
- * - this struct should fit entirely inside of one cache line
- * - this struct shares the supervisor stack pages
- * - if the contents of this structure are changed, the assembly constants must also be changed
- */
-struct thread_info {
-	struct task_struct	*task;		/* main task structure */
-	struct exec_domain	*exec_domain;	/* execution domain */
-	unsigned long		flags;		/* low level flags */
-	unsigned int		cpu;		/* current CPU */
-	unsigned int		preempt_count;  /* 0 => preemptable */
-	struct restart_block	restart_block;
-};
-
-/*
- * macros/functions for gaining access to the thread information structure
- */
-#define INIT_THREAD_INFO(tsk)			\
-{						\
-	.task		= &tsk,			\
-	.exec_domain	= &default_exec_domain,	\
-	.flags		= 0,			\
-	.cpu		= 0,			\
-	.restart_block	= {			\
-		.fn = do_no_restart_syscall,	\
-	},					\
-}
-
-#define init_thread_info	(init_thread_union.thread_info)
-#define init_stack		(init_thread_union.stack)
-
-/* how to get the thread information struct from C */
-static inline struct thread_info *current_thread_info(void)
-{
-	return (struct thread_info *)((*(unsigned long *) 0xd40)-16384);
-}
-
-/* thread information allocation */
-#define alloc_thread_info() ((struct thread_info *) \
-	__get_free_pages(GFP_KERNEL,2))
-#define free_thread_info(ti) free_pages((unsigned long) (ti), 2)
-#define get_thread_info(ti) get_task_struct((ti)->task)
-#define put_thread_info(ti) put_task_struct((ti)->task)
-
-#endif
-
-/*
- * Size of kernel stack for each process
- */
-#define THREAD_SIZE (4*PAGE_SIZE)
-
-/*
- * thread information flags bit numbers
- */
-#define TIF_SYSCALL_TRACE	0	/* syscall trace active */
-#define TIF_NOTIFY_RESUME	1	/* resumption notification requested */
-#define TIF_SIGPENDING		2	/* signal pending */
-#define TIF_NEED_RESCHED	3	/* rescheduling necessary */
-#define TIF_RESTART_SVC		4	/* restart svc with new svc number */
-#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_31BIT		18	/* 32bit process */ 
-
-#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
-#define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
-#define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
-#define _TIF_RESTART_SVC	(1<<TIF_RESTART_SVC)
-#define _TIF_USEDFPU		(1<<TIF_USEDFPU)
-#define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
-#define _TIF_31BIT		(1<<TIF_31BIT)
-
-#endif /* __KERNEL__ */
-
-#define PREEMPT_ACTIVE		0x4000000
-
-#endif /* _ASM_THREAD_INFO_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/timex.h linux-2.5.67-bk6/include/asm-s390x/timex.h
--- linux-2.5.67-bk5/include/asm-s390x/timex.h	2003-04-07 10:30:57.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/timex.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,40 +0,0 @@
-/*
- *  include/asm-s390/timex.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *
- *  Derived from "include/asm-i386/timex.h"
- *    Copyright (C) 1992, Linus Torvalds
- */
-
-#ifndef _ASM_S390_TIMEX_H
-#define _ASM_S390_TIMEX_H
-
-#define CLOCK_TICK_RATE	1193180 /* Underlying HZ */
-#define CLOCK_TICK_FACTOR	20	/* Factor of both 1000000 and CLOCK_TICK_RATE */
-#define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \
-	(1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \
-		<< (SHIFT_SCALE-SHIFT_HZ)) / HZ)
-
-typedef unsigned long long cycles_t;
-
-extern cycles_t cacheflush_time;
-
-static inline cycles_t get_cycles(void)
-{
-	cycles_t cycles;
-
-	__asm__("stck 0(%0)" : : "a" (&(cycles)) : "memory", "cc");
-	return cycles >> 2;
-}
-
-static inline unsigned long long get_clock (void)
-{
-	unsigned long long clock;
-
-	__asm__("stck 0(%0)" : : "a" (&(clock)) : "memory", "cc");
-	return clock;
-}
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/tlb.h linux-2.5.67-bk6/include/asm-s390x/tlb.h
--- linux-2.5.67-bk5/include/asm-s390x/tlb.h	2003-04-07 10:31:24.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/tlb.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,20 +0,0 @@
-#ifndef _S390X_TLB_H
-#define _S390X_TLB_H
-
-/*
- * s390x doesn't need any special per-pte or
- * per-vma handling..
- */
-#define tlb_start_vma(tlb, vma) do { } while (0)
-#define tlb_end_vma(tlb, vma) do { } while (0)
-#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0)
-
-/*
- * .. because we flush the whole mm when it
- * fills up.
- */
-#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
-
-#include <asm-generic/tlb.h>
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/tlbflush.h linux-2.5.67-bk6/include/asm-s390x/tlbflush.h
--- linux-2.5.67-bk5/include/asm-s390x/tlbflush.h	2003-04-07 10:32:15.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/tlbflush.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,138 +0,0 @@
-#ifndef _S390X_TLBFLUSH_H
-#define _S390X_TLBFLUSH_H
-
-#include <linux/config.h>
-#include <linux/mm.h>
-#include <asm/processor.h>
-
-/*
- * TLB flushing:
- *
- *  - flush_tlb() flushes the current mm struct TLBs
- *  - flush_tlb_all() flushes all processes TLBs 
- *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
- *  - flush_tlb_page(vma, vmaddr) flushes one page
- *  - flush_tlb_range(vma, start, end) flushes a range of pages
- *  - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
- *  - flush_tlb_pgtables(mm, start, end) flushes a range of page tables
- */
-
-/*
- * S/390 has three ways of flushing TLBs
- * 'ptlb' does a flush of the local processor
- * 'csp' flushes the TLBs on all PUs of a SMP
- * 'ipte' invalidates a pte in a page table and flushes that out of
- * the TLBs of all PUs of a SMP
- */
-
-#define local_flush_tlb() \
-do {  __asm__ __volatile__("ptlb": : :"memory"); } while (0)
-
-#ifndef CONFIG_SMP
-
-/*
- * We always need to flush, since s390 does not flush tlb
- * on each context switch
- */
-
-static inline void flush_tlb(void)
-{
-	local_flush_tlb();
-}
-static inline void flush_tlb_all(void)
-{
-	local_flush_tlb();
-}
-static inline void flush_tlb_mm(struct mm_struct *mm) 
-{
-	local_flush_tlb();
-}
-static inline void flush_tlb_page(struct vm_area_struct *vma,
-				  unsigned long addr)
-{
-	local_flush_tlb();
-}
-static inline void flush_tlb_range(struct vm_area_struct *vma,
-				   unsigned long start, unsigned long end)
-{
-	local_flush_tlb();
-}
-
-#define flush_tlb_kernel_range(start, end) \
-	local_flush_tlb();
-
-#else
-
-#include <asm/smp.h>
-
-extern void smp_ptlb_all(void);
-
-static inline void global_flush_tlb(void)
-{
-	long dummy = 0;
-
-	__asm__ __volatile__ (
-                "    la   4,1(%0)\n"
-                "    slr  2,2\n"
-                "    slr  3,3\n"
-                "    csp  2,4"
-                : : "a" (&dummy) : "cc", "2", "3", "4" );
-}
-
-/*
- * We only have to do global flush of tlb if process run since last
- * flush on any other pu than current. 
- * If we have threads (mm->count > 1) we always do a global flush, 
- * since the process runs on more than one processor at the same time.
- */
-
-static inline void __flush_tlb_mm(struct mm_struct * mm)
-{
-	preempt_disable();
-	if (mm->cpu_vm_mask != (1UL << smp_processor_id())) {
-		/* mm was active on more than one cpu. */
-		if (mm == current->active_mm &&
-		    atomic_read(&mm->mm_users) == 1)
-			/* this cpu is the only one using the mm. */
-			mm->cpu_vm_mask = 1UL << smp_processor_id();
-		global_flush_tlb();
-	} else
-		local_flush_tlb();
-	preempt_enable();
-}
-
-static inline void flush_tlb(void)
-{
-	__flush_tlb_mm(current->mm);
-}
-static inline void flush_tlb_all(void)
-{
-	global_flush_tlb();
-}
-static inline void flush_tlb_mm(struct mm_struct *mm) 
-{
-	__flush_tlb_mm(mm); 
-}
-static inline void flush_tlb_page(struct vm_area_struct *vma,
-				  unsigned long addr)
-{
-	__flush_tlb_mm(vma->vm_mm);
-}
-static inline void flush_tlb_range(struct vm_area_struct *vma,
-				   unsigned long start, unsigned long end)
-{
-	__flush_tlb_mm(vma->vm_mm); 
-}
-
-#define flush_tlb_kernel_range(start, end) \
-	__flush_tlb_mm(&init_mm)
-
-#endif
-
-static inline void flush_tlb_pgtables(struct mm_struct *mm,
-                                      unsigned long start, unsigned long end)
-{
-        /* S/390 does not keep any page table caches in TLB */
-}
-
-#endif /* _S390X_TLBFLUSH_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/todclk.h linux-2.5.67-bk6/include/asm-s390x/todclk.h
--- linux-2.5.67-bk5/include/asm-s390x/todclk.h	2003-04-07 10:30:35.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/todclk.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,23 +0,0 @@
-/*
- * File...........: linux/include/asm/todclk.h
- * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
- * Bugreports.to..: <Linux390@de.ibm.com>
- * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
- *
- * History of changes (starts July 2000)
- */
-
-#ifndef __ASM_TODCLK_H
-#define __ASM_TODCLK_H
-
-#ifdef __KERNEL__
-
-#define TOD_uSEC (0x1000ULL)
-#define TOD_mSEC (1000 * TOD_uSEC)
-#define TOD_SEC (1000 * TOD_mSEC)
-#define TOD_MIN (60 * TOD_SEC)
-#define TOD_HOUR (60 * TOD_MIN)
-
-#endif
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/topology.h linux-2.5.67-bk6/include/asm-s390x/topology.h
--- linux-2.5.67-bk5/include/asm-s390x/topology.h	2003-04-07 10:30:43.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/topology.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,6 +0,0 @@
-#ifndef _ASM_S390X_TOPOLOGY_H
-#define _ASM_S390X_TOPOLOGY_H
-
-#include <asm-generic/topology.h>
-
-#endif /* _ASM_S390X_TOPOLOGY_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/types.h linux-2.5.67-bk6/include/asm-s390x/types.h
--- linux-2.5.67-bk5/include/asm-s390x/types.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/types.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,69 +0,0 @@
-/*
- *  include/asm-s390/types.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/types.h"
- */
-
-#ifndef _S390_TYPES_H
-#define _S390_TYPES_H
-
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-typedef __signed__ long __s64;
-typedef unsigned long __u64;
-
-/* 
- * A address type so that arithmetic can be done on it & it can be upgraded to
- * 64 bit when necessary 
- */
-
-typedef unsigned long  addr_t; 
-typedef signed long  saddr_t;
-
-#endif /* __ASSEMBLY__ */
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-#ifdef __KERNEL__
-
-#define BITS_PER_LONG 64
-
-#ifndef __ASSEMBLY__
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long s64;
-typedef unsigned  long u64;
-
-typedef u32 dma_addr_t;
-
-#endif /* __ASSEMBLY__ */
-
-#endif                                 /* __KERNEL__                       */
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/uaccess.h linux-2.5.67-bk6/include/asm-s390x/uaccess.h
--- linux-2.5.67-bk5/include/asm-s390x/uaccess.h	2003-04-07 10:30:39.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/uaccess.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,481 +0,0 @@
-/*
- *  include/asm-s390/uaccess.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Hartmut Penner (hpenner@de.ibm.com),
- *               Martin Schwidefsky (schwidefsky@de.ibm.com)
- *
- *  Derived from "include/asm-i386/uaccess.h"
- */
-#ifndef __S390_UACCESS_H
-#define __S390_UACCESS_H
-
-/*
- * User space memory access functions
- */
-#include <linux/sched.h>
-#include <linux/errno.h>
-
-#define VERIFY_READ     0
-#define VERIFY_WRITE    1
-
-
-/*
- * The fs value determines whether argument validity checking should be
- * performed or not.  If get_fs() == USER_DS, checking is performed, with
- * get_fs() == KERNEL_DS, checking is bypassed.
- *
- * For historical reasons, these macros are grossly misnamed.
- */
-
-#define MAKE_MM_SEG(s)	((mm_segment_t) { (s) })
-
-
-#define KERNEL_DS	MAKE_MM_SEG(0)
-#define USER_DS		MAKE_MM_SEG(1)
-
-#define get_ds()	(KERNEL_DS)
-#define get_fs()        ({ mm_segment_t __x; \
-			   asm volatile("ear   %0,4":"=a" (__x)); \
-			   __x;})
-#define set_fs(x)       ({asm volatile("sar   4,%0"::"a" ((x).ar4));})
-
-#define segment_eq(a,b)	((a).ar4 == (b).ar4)
-
-
-#define __access_ok(addr,size) (1)
-
-#define access_ok(type,addr,size) __access_ok(addr,size)
-
-extern inline int verify_area(int type, const void * addr, unsigned long size)
-{
-        return access_ok(type,addr,size)?0:-EFAULT;
-}
-
-/*
- * The exception table consists of pairs of addresses: the first is the
- * address of an instruction that is allowed to fault, and the second is
- * the address at which the program should continue.  No registers are
- * modified, so it is entirely up to the continuation code to figure out
- * what to do.
- *
- * All the routines below use bits of fixup code that are out of line
- * with the main instruction path.  This means when everything is well,
- * we don't even have to jump over them.  Further, they do not intrude
- * on our cache or tlb entries.
- */
-
-struct exception_table_entry
-{
-        unsigned long insn, fixup;
-};
-
-/*
- * These are the main single-value transfer routines.  They automatically
- * use the right size if we just have the right pointer type.
- */
-
-extern inline int __put_user_asm_8(__u64 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   la    4,%1\n"
-                                "   sacf  512\n"
-                                "0: stg   %2,0(4)\n"
-                                "1: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-				"2: lhi   %0,%h3\n"
-				"   jg    1b\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 8\n"
-				"   .quad  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "m" (*((__u64*) ptr)), "d" (x), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-extern inline int __put_user_asm_4(__u32 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   la    4,%1\n"
-                                "   sacf  512\n"
-                                "0: st    %2,0(4)\n"
-                                "1: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-				"2: lhi   %0,%h3\n"
-				"   jg    1b\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 8\n"
-				"   .quad  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "m" (*((__u32*) ptr)), "d" (x), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-
-extern inline int __put_user_asm_2(__u16 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   la    4,%1\n"
-                                "   sacf  512\n"
-                                "0: sth   %2,0(4)\n"
-                                "1: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-				"2: lhi   %0,%h3\n"
-				"   jg    1b\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 8\n"
-				"   .quad  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "m" (*((__u16*) ptr)), "d" (x), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-
-extern inline int __put_user_asm_1(__u8 x, void *ptr)
-{
-        int err;
-
-        __asm__ __volatile__ (  "   sr    %0,%0\n"
-				"   la    4,%1\n"
-                                "   sacf  512\n"
-                                "0: stc   %2,0(4)\n"
-                                "1: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-				"2: lhi   %0,%h3\n"
-				"   jg    1b\n"
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 8\n"
-				"   .quad  0b,2b\n"
-				".previous"
-                                : "=&d" (err)
-                                : "m" (*((__u8*) ptr)), "d" (x), "K" (-EFAULT)
-                                : "cc", "4" );
-        return err;
-}
-
-/*
- * (u?)(u64) ... autsch, but that the only way we can suppress the
- * warnings when compiling binfmt_elf.c
- */
-#define __put_user(x, ptr)                                      \
-({                                                              \
-        __typeof__(*(ptr)) __x = (x);                           \
-        int __pu_err;                                           \
-        switch (sizeof (*(ptr))) {                              \
-        case 1:                                                 \
-                __pu_err = __put_user_asm_1((__u8)(__u64)(__x), \
-                                            ptr);               \
-                break;                                          \
-        case 2:                                                 \
-                __pu_err = __put_user_asm_2((__u16)(__u64)(__x),\
-                                            ptr);               \
-                break;                                          \
-        case 4:                                                 \
-                __pu_err = __put_user_asm_4((__u32)(__u64)(__x),\
-                                            ptr);               \
-                break;                                          \
-        case 8:                                                 \
-                __pu_err = __put_user_asm_8((__u64)(__x),       \
-                                            ptr);               \
-                break;                                          \
-        default:                                                \
-                __pu_err = __put_user_bad();                    \
-                break;                                          \
-         }                                                      \
-        __pu_err;                                               \
-})
-
-#define put_user(x, ptr) __put_user(x, ptr)
-
-extern int __put_user_bad(void);
-
-#define __get_user_asm_8(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: lg    %0,0(4)\n"                       \
-                                "1: sacf  0\n"                             \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: lhi   %1,%h3\n"                        \
-                                "   jg    1b\n"                            \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 8\n"                            \
-                                "   .quad 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=d" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u64*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                             \
-})
-#define __get_user_asm_4(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: l     %0,0(4)\n"                       \
-                                "1: sacf  0\n"                             \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: lhi   %1,%h3\n"                        \
-                                "   jg    1b\n"                            \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 8\n"                            \
-                                "   .quad 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=d" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u32*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                             \
-})
-
-#define __get_user_asm_2(x, ptr, err)                                      \
-({                                                                         \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                         \
-                                "   la    4,%2\n"                          \
-                                "   sacf  512\n"                           \
-                                "0: lh    %0,0(4)\n"                       \
-                                "1: sacf  0\n"                             \
-                                ".section .fixup,\"ax\"\n"                 \
-                                "2: lhi   %1,%h3\n"                        \
-                                "   jg    1b\n"                            \
-                                ".previous\n"                              \
-                                ".section __ex_table,\"a\"\n"              \
-                                "   .align 8\n"                            \
-                                "   .quad 0b,2b\n"                         \
-                                ".previous"                                \
-                                : "=d" (x) , "=&d" (err)                   \
-                                : "m" (*(const __u16*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                             \
-})
-
-#define __get_user_asm_1(x, ptr, err)                                     \
-({                                                                        \
-        __asm__ __volatile__ (  "   sr    %1,%1\n"                        \
-                                "   la    4,%2\n"                         \
-                                "   sr    %0,%0\n"                        \
-                                "   sacf  512\n"                          \
-                                "0: ic    %0,0(4)\n"                      \
-                                "1: sacf  0\n"                            \
-                                ".section .fixup,\"ax\"\n"                \
-                                "2: lhi   %1,%h3\n"                       \
-                                "   jg    1b\n"                           \
-                                ".previous\n"                             \
-                                ".section __ex_table,\"a\"\n"             \
-                                "   .align 8\n"                           \
-                                "   .quad 0b,2b\n"                        \
-                                ".previous"                               \
-                                : "=d" (x) , "=&d" (err)                  \
-                                : "m" (*(const __u8*)(ptr)),"K" (-EFAULT) \
-                                : "cc", "4" );                            \
-})
-
-#define __get_user(x, ptr)                                      \
-({                                                              \
-        __typeof__(*(ptr)) __x;                                 \
-        int __gu_err;                                           \
-        switch (sizeof(*(ptr))) {                               \
-        case 1:                                                 \
-                __get_user_asm_1(__x,ptr,__gu_err);             \
-                break;                                          \
-        case 2:                                                 \
-                __get_user_asm_2(__x,ptr,__gu_err);             \
-                break;                                          \
-        case 4:                                                 \
-                __get_user_asm_4(__x,ptr,__gu_err);             \
-                break;                                          \
-        case 8:                                                 \
-                __get_user_asm_8(__x,ptr,__gu_err);             \
-                break;                                          \
-        default:                                                \
-                __x = 0;                                        \
-                __gu_err = __get_user_bad();                    \
-                break;                                          \
-        }                                                       \
-        (x) = __x;                                              \
-        __gu_err;                                               \
-})
-
-#define get_user(x, ptr) __get_user(x, ptr)
-
-extern int __get_user_bad(void);
-
-/*
- * access register are set up, that 4 points to secondary (user) , 2 to primary (kernel)
- */
-
-extern long __copy_to_user_asm(const void *from, long n, void *to);
-
-#define __copy_to_user(to, from, n)                             \
-({                                                              \
-        __copy_to_user_asm(from, n, to);                        \
-})
-
-#define copy_to_user(to, from, n)                               \
-({                                                              \
-        long err = 0;                                           \
-        __typeof__(n) __n = (n);                                \
-        if (__access_ok(to,__n)) {                              \
-                err = __copy_to_user_asm(from, __n, to);        \
-        }                                                       \
-        else                                                    \
-                err = __n;                                      \
-        err;                                                    \
-})
-
-extern long __copy_from_user_asm(void *to, long n, const void *from);
-
-#define __copy_from_user(to, from, n)                           \
-({                                                              \
-        __copy_from_user_asm(to, n, from);                      \
-})
-
-#define copy_from_user(to, from, n)                             \
-({                                                              \
-        long err = 0;                                           \
-        __typeof__(n) __n = (n);                                \
-        if (__access_ok(from,__n)) {                            \
-                err = __copy_from_user_asm(to, __n, from);      \
-        }                                                       \
-        else                                                    \
-                err = __n;                                      \
-        err;                                                    \
-})
-
-/*
- * Copy a null terminated string from userspace.
- */
-
-static inline long
-__strncpy_from_user(char *dst, const char *src, long count)
-{
-        long len;
-        __asm__ __volatile__ (  "   slgr  %0,%0\n"
-				"   lgr   2,%1\n"
-                                "   lgr   4,%2\n"
-                                "   slr   3,3\n"
-                                "   sacf  512\n"
-                                "0: ic    3,0(%0,4)\n"
-                                "1: stc   3,0(%0,2)\n"
-                                "   ltr   3,3\n"
-                                "   jz    2f\n"
-                                "   aghi  %0,1\n"
-                                "   cgr   %0,%3\n"
-                                "   jl    0b\n"
-                                "2: sacf  0\n"
-				".section .fixup,\"ax\"\n"
-				"3: lghi  %0,%h4\n"
-				"   jg    2b\n"  
-				".previous\n"
-				".section __ex_table,\"a\"\n"
-				"   .align 8\n"
-				"   .quad  0b,3b\n"
-				"   .quad  1b,3b\n"
-				".previous"
-                                : "=&a" (len)
-                                : "a"  (dst), "d" (src), "d" (count),
-                                  "K" (-EFAULT)
-                                : "cc", "2" ,"3", "4" );
-        return len;
-}
-
-static inline long
-strncpy_from_user(char *dst, const char *src, long count)
-{
-        long res = -EFAULT;
-        if (access_ok(VERIFY_READ, src, 1))
-                res = __strncpy_from_user(dst, src, count);
-        return res;
-}
-
-/*
- * Return the size of a string (including the ending 0)
- *
- * Return 0 for error
- */
-static inline unsigned long
-strnlen_user(const char * src, unsigned long n)
-{
-#if 0
-        __asm__ __volatile__ ("   algr  %0,%1\n"
-                              "   slgr  0,0\n"
-                              "   lgr   4,%1\n"
-                              "   sacf  512\n"
-                              "0: srst  %0,4\n"
-                              "   jo    0b\n"
-                              "   slgr  %0,%1\n"
-                              "   aghi  %0,1\n"
-                              "1: sacf  0\n"
-                              ".section .fixup,\"ax\"\n"
-                              "2: slgr  %0,%0\n"
-                              "   jg    1b\n"
-                              ".previous\n"
-                              ".section __ex_table,\"a\"\n"
-                              "   .align 8\n"
-                              "   .quad  0b,2b\n"
-                              ".previous"
-                              : "+&a" (n) : "d" (src)
-                              : "cc", "0", "4" );
-#else
-	__asm__ __volatile__ ("   lgr   4,%1\n"
-			      "   sacf  512\n"
-			      "0: cli   0(4),0x00\n"
-                              "   la    4,1(4)\n"
-			      "   je    1f\n"
-                              "   brctg %0,0b\n"
-			      "1: lgr   %0,4\n"
-			      "   slgr  %0,%1\n"
-			      "2: sacf  0\n"
-                              ".section .fixup,\"ax\"\n"
-                              "3: slgr  %0,%0\n"
-                              "   jg    2b\n"  
-                              ".previous\n"
-			      ".section __ex_table,\"a\"\n"
-			      "   .align 8\n"
-			      "   .quad  0b,3b\n"
-			      ".previous"
-			      : "+&a" (n) : "d" (src)
-			      : "cc", "4" );
-#endif
-        return n;
-}
-#define strlen_user(str) strnlen_user(str, ~0UL)
-
-/*
- * Zero Userspace
- */
-
-extern long __clear_user_asm(void *to, long n);
-
-#define __clear_user(to, n)                                     \
-({                                                              \
-        __clear_user_asm(to, n);                                \
-})
-
-static inline unsigned long
-clear_user(void *to, unsigned long n)
-{
-        if (access_ok(VERIFY_WRITE, to, n))
-                n = __clear_user(to, n);
-        return n;
-}
-
-#endif                                 /* _S390_UACCESS_H                  */
-
-
-
-
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/ucontext.h linux-2.5.67-bk6/include/asm-s390x/ucontext.h
--- linux-2.5.67-bk5/include/asm-s390x/ucontext.h	2003-04-07 10:32:28.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/ucontext.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,20 +0,0 @@
-/*
- *  include/asm-s390/ucontext.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/ucontext.h"
- */
-
-#ifndef _ASM_S390_UCONTEXT_H
-#define _ASM_S390_UCONTEXT_H
-
-struct ucontext {
-	unsigned long	  uc_flags;
-	struct ucontext  *uc_link;
-	stack_t		  uc_stack;
-	_sigregs          uc_mcontext;
-	sigset_t	  uc_sigmask;	/* mask last for extensibility */
-};
-
-#endif /* !_ASM_S390_UCONTEXT_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/unaligned.h linux-2.5.67-bk6/include/asm-s390x/unaligned.h
--- linux-2.5.67-bk5/include/asm-s390x/unaligned.h	2003-04-07 10:31:04.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/unaligned.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,24 +0,0 @@
-/*
- *  include/asm-s390/unaligned.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/unaligned.h"
- */
-
-#ifndef __S390_UNALIGNED_H
-#define __S390_UNALIGNED_H
-
-/*
- * The S390 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
- * architectures where unaligned accesses aren't as simple.
- */
-
-#define get_unaligned(ptr) (*(ptr))
-
-#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) ))
-
-#endif
diff -urN linux-2.5.67-bk5/include/asm-s390x/unistd.h linux-2.5.67-bk6/include/asm-s390x/unistd.h
--- linux-2.5.67-bk5/include/asm-s390x/unistd.h	2003-04-07 10:32:15.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/unistd.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,390 +0,0 @@
-/*
- *  include/asm-s390/unistd.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/unistd.h"
- */
-
-#ifndef _ASM_S390_UNISTD_H_
-#define _ASM_S390_UNISTD_H_
-
-/*
- * This file contains the system call numbers.
- */
-
-#define __NR_exit                 1
-#define __NR_fork                 2
-#define __NR_read                 3
-#define __NR_write                4
-#define __NR_open                 5
-#define __NR_close                6
-#define __NR_restart_syscall	  7
-#define __NR_creat                8
-#define __NR_link                 9
-#define __NR_unlink              10
-#define __NR_execve              11
-#define __NR_chdir               12
-#define __NR_mknod               14
-#define __NR_chmod               15
-#define __NR_lseek               19
-#define __NR_getpid              20
-#define __NR_mount               21
-#define __NR_umount              22
-#define __NR_ptrace              26
-#define __NR_alarm               27
-#define __NR_pause               29
-#define __NR_utime               30
-#define __NR_access              33
-#define __NR_nice                34
-#define __NR_sync                36
-#define __NR_kill                37
-#define __NR_rename              38
-#define __NR_mkdir               39
-#define __NR_rmdir               40
-#define __NR_dup                 41
-#define __NR_pipe                42
-#define __NR_times               43
-#define __NR_brk                 45
-#define __NR_signal              48
-#define __NR_acct                51
-#define __NR_umount2             52
-#define __NR_ioctl               54
-#define __NR_fcntl               55
-#define __NR_setpgid             57
-#define __NR_umask               60
-#define __NR_chroot              61
-#define __NR_ustat               62
-#define __NR_dup2                63
-#define __NR_getppid             64
-#define __NR_getpgrp             65
-#define __NR_setsid              66
-#define __NR_sigaction           67
-#define __NR_sigsuspend          72
-#define __NR_sigpending          73
-#define __NR_sethostname         74
-#define __NR_setrlimit           75
-#define __NR_getrusage           77
-#define __NR_gettimeofday        78
-#define __NR_settimeofday        79
-#define __NR_symlink             83
-#define __NR_readlink            85
-#define __NR_uselib              86
-#define __NR_swapon              87
-#define __NR_reboot              88
-#define __NR_readdir             89
-#define __NR_mmap                90
-#define __NR_munmap              91
-#define __NR_truncate            92
-#define __NR_ftruncate           93
-#define __NR_fchmod              94
-#define __NR_getpriority         96
-#define __NR_setpriority         97
-#define __NR_statfs              99
-#define __NR_fstatfs            100
-#define __NR_socketcall         102
-#define __NR_syslog             103
-#define __NR_setitimer          104
-#define __NR_getitimer          105
-#define __NR_stat               106
-#define __NR_lstat              107
-#define __NR_fstat              108
-#define __NR_vhangup            111
-#define __NR_idle               112
-#define __NR_wait4              114
-#define __NR_swapoff            115
-#define __NR_sysinfo            116
-#define __NR_ipc                117
-#define __NR_fsync              118
-#define __NR_sigreturn          119
-#define __NR_clone              120
-#define __NR_setdomainname      121
-#define __NR_uname              122
-#define __NR_adjtimex           124
-#define __NR_mprotect           125
-#define __NR_sigprocmask        126
-#define __NR_create_module      127
-#define __NR_init_module        128
-#define __NR_delete_module      129
-#define __NR_get_kernel_syms    130
-#define __NR_quotactl           131
-#define __NR_getpgid            132
-#define __NR_fchdir             133
-#define __NR_bdflush            134
-#define __NR_sysfs              135
-#define __NR_personality        136
-#define __NR_afs_syscall        137 /* Syscall for Andrew File System */
-#define __NR_getdents           141
-#define __NR_select             142
-#define __NR_flock              143
-#define __NR_msync              144
-#define __NR_readv              145
-#define __NR_writev             146
-#define __NR_getsid             147
-#define __NR_fdatasync          148
-#define __NR__sysctl            149
-#define __NR_mlock              150
-#define __NR_munlock            151
-#define __NR_mlockall           152
-#define __NR_munlockall         153
-#define __NR_sched_setparam             154
-#define __NR_sched_getparam             155
-#define __NR_sched_setscheduler         156
-#define __NR_sched_getscheduler         157
-#define __NR_sched_yield                158
-#define __NR_sched_get_priority_max     159
-#define __NR_sched_get_priority_min     160
-#define __NR_sched_rr_get_interval      161
-#define __NR_nanosleep          162
-#define __NR_mremap             163
-#define __NR_query_module       167
-#define __NR_poll               168
-#define __NR_nfsservctl         169
-#define __NR_prctl              172
-#define __NR_rt_sigreturn       173
-#define __NR_rt_sigaction       174
-#define __NR_rt_sigprocmask     175
-#define __NR_rt_sigpending      176
-#define __NR_rt_sigtimedwait    177
-#define __NR_rt_sigqueueinfo    178
-#define __NR_rt_sigsuspend      179
-#define __NR_pread64            180
-#define __NR_pwrite64           181
-#define __NR_getcwd             183
-#define __NR_capget             184
-#define __NR_capset             185
-#define __NR_sigaltstack        186
-#define __NR_sendfile           187
-#define __NR_getpmsg		188
-#define __NR_putpmsg		189
-#define __NR_vfork		190
-#define __NR_getrlimit		191	/* SuS compliant getrlimit */
-#define __NR_lchown  		198
-#define __NR_getuid  		199
-#define __NR_getgid  		200
-#define __NR_geteuid  		201
-#define __NR_getegid  		202
-#define __NR_setreuid  		203
-#define __NR_setregid  		204
-#define __NR_getgroups  	205
-#define __NR_setgroups  	206
-#define __NR_fchown  		207
-#define __NR_setresuid  	208
-#define __NR_getresuid  	209
-#define __NR_setresgid  	210
-#define __NR_getresgid  	211
-#define __NR_chown  		212
-#define __NR_setuid  		213
-#define __NR_setgid  		214
-#define __NR_setfsuid  		215
-#define __NR_setfsgid  		216
-#define __NR_pivot_root         217
-#define __NR_mincore            218
-#define __NR_madvise            219
-#define __NR_readahead		222
-#define __NR_setxattr		224
-#define __NR_lsetxattr		225
-#define __NR_fsetxattr		226
-#define __NR_getxattr		227
-#define __NR_lgetxattr		228
-#define __NR_fgetxattr		229
-#define __NR_listxattr		230
-#define __NR_llistxattr		231
-#define __NR_flistxattr		232
-#define __NR_removexattr	233
-#define __NR_lremovexattr	234
-#define __NR_fremovexattr	235
-#define __NR_gettid		236
-#define __NR_tkill		237
-#define __NR_futex		238
-#define __NR_sched_setaffinity	239
-#define __NR_sched_getaffinity	240
-/*
- * Number 241 is currently unused
- */
-/*
- * Number 242 is reserved for tux
- */
-#define __NR_io_setup		243
-#define __NR_io_destroy		244
-#define __NR_io_getevents	245
-#define __NR_io_submit		246
-#define __NR_io_cancel		247
-#define __NR_exit_group		248
-#define __NR_epoll_create	249
-#define __NR_epoll_ctl		250
-#define __NR_epoll_wait		251
-#define __NR_set_tid_address	252
-#define __NR_fadvise64		253
-
-
-/* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
-
-#define __syscall_return(type, res)                          \
-do {                                                         \
-        if ((unsigned long)(res) >= (unsigned long)(-125)) { \
-                errno = -(res);                              \
-                res = -1;                                    \
-        }                                                    \
-        return (type) (res);                                 \
-} while (0)
-
-#define _svc_clobber "cc", "memory"
-
-#define _syscall0(type,name)                                 \
-type name(void) {                                            \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name)                          \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall1(type,name,type1,arg1)                      \
-type name(type1 arg1) {                                      \
-        register type1 __arg1 asm("2") = arg1;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall2(type,name,type1,arg1,type2,arg2)           \
-type name(type1 arg1, type2 arg2) {                          \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3)\
-type name(type1 arg1, type2 arg2, type3 arg3) {              \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,\
-                  type4,name4)                               \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) {  \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register type4 __arg4 asm("5") = arg4;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3),                              \
-                  "d" (__arg4)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,\
-                  type4,name4,type5,name5)                   \
-type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4,    \
-          type5 arg5) {                                      \
-        register type1 __arg1 asm("2") = arg1;               \
-        register type2 __arg2 asm("3") = arg2;               \
-        register type3 __arg3 asm("4") = arg3;               \
-        register type4 __arg4 asm("5") = arg4;               \
-        register type5 __arg5 asm("6") = arg5;               \
-        register long __svcres asm("2");                     \
-        long __res;                                          \
-        __asm__ __volatile__ (                               \
-                "    svc %b1\n"                              \
-                : "=d" (__svcres)                            \
-                : "i" (__NR_##name),                         \
-                  "0" (__arg1),                              \
-                  "d" (__arg2),                              \
-                  "d" (__arg3),                              \
-                  "d" (__arg4),                              \
-                  "d" (__arg5)                               \
-                : _svc_clobber );                            \
-	__res = __svcres;                                    \
-        __syscall_return(type,__res);                        \
-}
-
-#ifdef __KERNEL_SYSCALLS__
-
-#include <asm/stat.h>
-
-/*
- * we need this inline - forking from kernel space will result
- * in NO COPY ON WRITE (!!!), until an execve is executed. This
- * is no problem, but for the stack. This is handled by not letting
- * main() use the stack at all after fork(). Thus, no function
- * calls - which means inline code for fork too, as otherwise we
- * would use the stack upon exit from 'fork()'.
- *
- * Actually only pause and fork are needed inline, so that there
- * won't be any messing with the stack from main(), but we define
- * some others too.
- */
-#define __NR__exit __NR_exit
-static inline _syscall0(pid_t,setsid)
-static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
-static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
-static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
-static inline _syscall1(int,dup,int,fd)
-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 _syscall2(long,stat,char *,filename,struct stat *,statbuf)
-
-struct rusage;
-extern long sys_wait4(pid_t, unsigned int *, int, struct rusage *);
-static inline pid_t waitpid(int pid, int *wait_stat, int flags)
-{
-	return sys_wait4(pid, wait_stat, flags, NULL);
-}
-
-#endif
-
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-
-#endif /* _ASM_S390_UNISTD_H_ */
diff -urN linux-2.5.67-bk5/include/asm-s390x/user.h linux-2.5.67-bk6/include/asm-s390x/user.h
--- linux-2.5.67-bk5/include/asm-s390x/user.h	2003-04-07 10:31:00.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/user.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,77 +0,0 @@
-/*
- *  include/asm-s390/user.h
- *
- *  S390 version
- *
- *  Derived from "include/asm-i386/usr.h"
- */
-
-#ifndef _S390_USER_H
-#define _S390_USER_H
-
-#include <asm/page.h>
-#include <linux/ptrace.h>
-/* Core file format: The core file is written in such a way that gdb
-   can understand it and provide useful information to the user (under
-   linux we use the 'trad-core' bfd).  There are quite a number of
-   obstacles to being able to view the contents of the floating point
-   registers, and until these are solved you will not be able to view the
-   contents of them.  Actually, you can read in the core file and look at
-   the contents of the user struct to find out what the floating point
-   registers contain.
-   The actual file contents are as follows:
-   UPAGE: 1 page consisting of a user struct that tells gdb what is present
-   in the file.  Directly after this is a copy of the task_struct, which
-   is currently not used by gdb, but it may come in useful at some point.
-   All of the registers are stored as part of the upage.  The upage should
-   always be only one page.
-   DATA: The data area is stored.  We use current->end_text to
-   current->brk to pick up all of the user variables, plus any memory
-   that may have been malloced.  No attempt is made to determine if a page
-   is demand-zero or if a page is totally unused, we just cover the entire
-   range.  All of the addresses are rounded in such a way that an integral
-   number of pages is written.
-   STACK: We need the stack information in order to get a meaningful
-   backtrace.  We need to write the data from (esp) to
-   current->start_stack, so we round each of these off in order to be able
-   to write an integer number of pages.
-   The minimum core file size is 3 pages, or 12288 bytes.
-*/
-
-
-/*
- * This is the old layout of "struct pt_regs", and
- * is still the layout used by user mode (the new
- * pt_regs doesn't have all registers as the kernel
- * doesn't use the extra segment registers)
- */
-
-/* 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. */
-struct user {
-/* We start with the registers, to mimic the way that "memory" is returned
-   from the ptrace(3,...) function.  */
-  struct user_regs_struct regs;		/* Where the registers are actually stored */
-/* The rest of this junk is to help gdb figure out what goes where */
-  size_t   u_tsize;	     /* Text segment size (pages). */
-  size_t   u_dsize;	     /* Data segment size (pages). */
-  size_t   u_ssize;	     /* Stack segment size (pages). */
-  unsigned long start_code;  /* Starting virtual address of text. */
-  unsigned long start_stack; /* Starting virtual address of stack area.
-			        This is actually the bottom of the stack,
-				the top of the stack is always found in the
-				gprs[15] register.  */
-  long int signal;     	     /* Signal that caused the core dump. */
-  struct user_regs_struct *u_ar0;
-				/* Used by gdb to help find the values for */
-				/* the registers. */
-  unsigned long magic;		/* To uniquely identify a core file */
-  char u_comm[32];		/* User command that was responsible */
-};
-#define NBPG PAGE_SIZE
-#define UPAGES 1
-#define HOST_TEXT_START_ADDR (u.start_code)
-#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
-
-#endif /* _S390_USER_H */
diff -urN linux-2.5.67-bk5/include/asm-s390x/vtoc.h linux-2.5.67-bk6/include/asm-s390x/vtoc.h
--- linux-2.5.67-bk5/include/asm-s390x/vtoc.h	2003-04-07 10:32:58.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/vtoc.h	1969-12-31 16:00:00.000000000 -0800
@@ -1,373 +0,0 @@
-#ifndef __KERNEL__
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include <linux/fs.h>
-#include <linux/types.h>
-#include <linux/hdreg.h>
-#include <linux/version.h>
-#include <asm/dasd.h>
-#endif
-
-
-#define LINE_LENGTH 80
-#define VTOC_START_CC 0x0
-#define VTOC_START_HH 0x1
-#define FIRST_USABLE_CYL 1
-#define FIRST_USABLE_TRK 2
-
-#define DASD_3380_TYPE 13148
-#define DASD_3390_TYPE 13200
-#define DASD_9345_TYPE 37701
-
-#define DASD_3380_VALUE 0xbb60
-#define DASD_3390_VALUE 0xe5a2
-#define DASD_9345_VALUE 0xbc98
-
-#define VOLSER_LENGTH 6
-#define BIG_DISK_SIZE 0x10000
-
-#define VTOC_ERROR "VTOC error:"
-
-
-typedef struct ttr 
-{
-        __u16 tt;
-        __u8  r;
-} __attribute__ ((packed)) ttr_t;
-
-typedef struct cchhb 
-{
-        __u16 cc;
-        __u16 hh;
-        __u8 b;
-} __attribute__ ((packed)) cchhb_t;
-
-typedef struct cchh 
-{
-        __u16 cc;
-        __u16 hh;
-} __attribute__ ((packed)) cchh_t;
-
-typedef struct labeldate 
-{
-        __u8  year;
-        __u16 day;
-} __attribute__ ((packed)) labeldate_t;
-
-
-typedef struct volume_label 
-{
-        char volkey[4];         /* volume key = volume label                 */
-	char vollbl[4];	        /* volume label                              */
-	char volid[6];	        /* volume identifier                         */
-	__u8 security;	        /* security byte                             */
-	cchhb_t vtoc;           /* VTOC address                              */
-	char res1[5];	        /* reserved                                  */
-        char cisize[4];	        /* CI-size for FBA,...                       */
-                                /* ...blanks for CKD                         */
-	char blkperci[4];       /* no of blocks per CI (FBA), blanks for CKD */
-	char labperci[4];       /* no of labels per CI (FBA), blanks for CKD */
-	char res2[4];	        /* reserved                                  */
-	char lvtoc[14];	        /* owner code for LVTOC                      */
-	char res3[29];	        /* reserved                                  */
-} __attribute__ ((packed)) volume_label_t;
-
-
-typedef struct extent 
-{
-        __u8  typeind;          /* extent type indicator                     */
-        __u8  seqno;            /* extent sequence number                    */
-        cchh_t llimit;          /* starting point of this extent             */
-        cchh_t ulimit;          /* ending point of this extent               */
-} __attribute__ ((packed)) extent_t;
-
-
-typedef struct dev_const 
-{
-        __u16 DS4DSCYL;           /* number of logical cyls                  */
-        __u16 DS4DSTRK;           /* number of tracks in a logical cylinder  */
-        __u16 DS4DEVTK;           /* device track length                     */
-        __u8  DS4DEVI;            /* non-last keyed record overhead          */
-        __u8  DS4DEVL;            /* last keyed record overhead              */
-        __u8  DS4DEVK;            /* non-keyed record overhead differential  */
-        __u8  DS4DEVFG;           /* flag byte                               */
-        __u16 DS4DEVTL;           /* device tolerance                        */
-        __u8  DS4DEVDT;           /* number of DSCB's per track              */
-        __u8  DS4DEVDB;           /* number of directory blocks per track    */
-} __attribute__ ((packed)) dev_const_t;
-
-
-typedef struct format1_label 
-{
-	char  DS1DSNAM[44];       /* data set name                           */
-	__u8  DS1FMTID;           /* format identifier                       */
-	char  DS1DSSN[6];         /* data set serial number                  */
-	__u16 DS1VOLSQ;           /* volume sequence number                  */
-	labeldate_t DS1CREDT;     /* creation date: ydd                      */
-	labeldate_t DS1EXPDT;     /* expiration date                         */
-	__u8  DS1NOEPV;           /* number of extents on volume             */
-        __u8  DS1NOBDB;           /* no. of bytes used in last direction blk */
-	__u8  DS1FLAG1;           /* flag 1                                  */
-	char  DS1SYSCD[13];       /* system code                             */
-	labeldate_t DS1REFD;      /* date last referenced                    */
-        __u8  DS1SMSFG;           /* system managed storage indicators       */
-        __u8  DS1SCXTF;           /* sec. space extension flag byte          */
-        __u16 DS1SCXTV;           /* secondary space extension value         */
-        __u8  DS1DSRG1;           /* data set organisation byte 1            */
-        __u8  DS1DSRG2;           /* data set organisation byte 2            */
-  	__u8  DS1RECFM;           /* record format                           */
-	__u8  DS1OPTCD;           /* option code                             */
-	__u16 DS1BLKL;            /* block length                            */
-	__u16 DS1LRECL;           /* record length                           */
-	__u8  DS1KEYL;            /* key length                              */
-	__u16 DS1RKP;             /* relative key position                   */
-	__u8  DS1DSIND;           /* data set indicators                     */
-        __u8  DS1SCAL1;           /* secondary allocation flag byte          */
-  	char DS1SCAL3[3];         /* secondary allocation quantity           */
-	ttr_t DS1LSTAR;           /* last used track and block on track      */
-	__u16 DS1TRBAL;           /* space remaining on last used track      */
-        __u16 res1;               /* reserved                                */
-	extent_t DS1EXT1;         /* first extent description                */
-	extent_t DS1EXT2;         /* second extent description               */
-	extent_t DS1EXT3;         /* third extent description                */
-	cchhb_t DS1PTRDS;         /* possible pointer to f2 or f3 DSCB       */
-} __attribute__ ((packed)) format1_label_t;
-
-
-typedef struct format4_label 
-{
-	char  DS4KEYCD[44];       /* key code for VTOC labels: 44 times 0x04 */
-        __u8  DS4IDFMT;           /* format identifier                       */
-	cchhb_t DS4HPCHR;         /* highest address of a format 1 DSCB      */
-        __u16 DS4DSREC;           /* number of available DSCB's              */
-        cchh_t DS4HCCHH;          /* CCHH of next available alternate track  */
-        __u16 DS4NOATK;           /* number of remaining alternate tracks    */
-        __u8  DS4VTOCI;           /* VTOC indicators                         */
-        __u8  DS4NOEXT;           /* number of extents in VTOC               */
-        __u8  DS4SMSFG;           /* system managed storage indicators       */
-        __u8  DS4DEVAC;           /* number of alternate cylinders. 
-                                     Subtract from first two bytes of 
-                                     DS4DEVSZ to get number of usable
-				     cylinders. can be zero. valid
-				     only if DS4DEVAV on.                    */
-        dev_const_t DS4DEVCT;     /* device constants                        */
-        char DS4AMTIM[8];         /* VSAM time stamp                         */
-        char DS4AMCAT[3];         /* VSAM catalog indicator                  */
-        char DS4R2TIM[8];         /* VSAM volume/catalog match time stamp    */
-        char res1[5];             /* reserved                                */
-        char DS4F6PTR[5];         /* pointer to first format 6 DSCB          */
-        extent_t DS4VTOCE;        /* VTOC extent description                 */
-        char res2[10];            /* reserved                                */
-        __u8 DS4EFLVL;            /* extended free-space management level    */
-        cchhb_t DS4EFPTR;         /* pointer to extended free-space info     */
-        char res3[9];             /* reserved                                */
-} __attribute__ ((packed)) format4_label_t;
-
-
-typedef struct ds5ext 
-{
-	__u16 t;                  /* RTA of the first track of free extent   */
-	__u16 fc;                 /* number of whole cylinders in free ext.  */
-	__u8  ft;                 /* number of remaining free tracks         */
-} __attribute__ ((packed)) ds5ext_t;
-
-
-typedef struct format5_label 
-{
-	char DS5KEYID[4];         /* key identifier                          */
-	ds5ext_t DS5AVEXT;        /* first available (free-space) extent.    */
-	ds5ext_t DS5EXTAV[7];     /* seven available extents                 */
-	__u8 DS5FMTID;            /* format identifier                       */
-	ds5ext_t DS5MAVET[18];    /* eighteen available extents              */
-	cchhb_t DS5PTRDS;         /* pointer to next format5 DSCB            */
-} __attribute__ ((packed)) format5_label_t;
-
-
-typedef struct ds7ext 
-{
-	__u32 a;                  /* starting RTA value                      */
-	__u32 b;                  /* ending RTA value + 1                    */
-} __attribute__ ((packed)) ds7ext_t;
-
-
-typedef struct format7_label 
-{
-	char DS7KEYID[4];         /* key identifier                          */
-	ds7ext_t DS7EXTNT[5];     /* space for 5 extent descriptions         */
-	__u8 DS7FMTID;            /* format identifier                       */
-	ds7ext_t DS7ADEXT[11];    /* space for 11 extent descriptions        */
-	char res1[2];             /* reserved                                */
-	cchhb_t DS7PTRDS;         /* pointer to next FMT7 DSCB               */
-} __attribute__ ((packed)) format7_label_t;
-
-
-char * vtoc_ebcdic_enc (
-        unsigned char source[LINE_LENGTH],
-        unsigned char target[LINE_LENGTH],
-	int l);
-char * vtoc_ebcdic_dec (
-        unsigned char source[LINE_LENGTH],
-	unsigned char target[LINE_LENGTH],
-	int l);
-void vtoc_set_extent (
-        extent_t * ext,
-        __u8 typeind,
-        __u8 seqno,
-        cchh_t * lower,
-        cchh_t * upper);
-void vtoc_set_cchh (
-        cchh_t * addr,
-	__u16 cc,
-	__u16 hh);
-void vtoc_set_cchhb (
-        cchhb_t * addr,
-        __u16 cc,
-        __u16 hh,
-        __u8 b);
-void vtoc_set_date (
-        labeldate_t * d,
-        __u8 year,
-        __u16 day);
-
-void vtoc_volume_label_init (
-	volume_label_t *vlabel);
-
-int vtoc_read_volume_label (
-        char * device,
-        unsigned long vlabel_start,
-        volume_label_t * vlabel);
-
-int vtoc_write_volume_label (
-        char *device,
-        unsigned long vlabel_start,
-        volume_label_t *vlabel);
-
-void vtoc_volume_label_set_volser (
-	volume_label_t *vlabel,
-	char *volser);
-
-char *vtoc_volume_label_get_volser (
-	volume_label_t *vlabel,
-	char *volser);
-
-void vtoc_volume_label_set_key (
-        volume_label_t *vlabel,
-        char *key);     
-
-void vtoc_volume_label_set_label (
-	volume_label_t *vlabel,
-	char *lbl);
-
-char *vtoc_volume_label_get_label (
-	volume_label_t *vlabel,
-	char *lbl);
-
-void vtoc_read_label (
-        char *device,
-        unsigned long position,
-        format1_label_t *f1,
-        format4_label_t *f4,
-        format5_label_t *f5,
-        format7_label_t *f7);
-
-void vtoc_write_label (
-        char *device,
-        unsigned long position,
-        format1_label_t *f1,
-	format4_label_t *f4,
-	format5_label_t *f5,
-	format7_label_t *f7);
-
-
-void vtoc_init_format1_label (
-        char *volid,
-        unsigned int blksize,
-        extent_t *part_extent,
-        format1_label_t *f1);
-
-
-void vtoc_init_format4_label (
-        format4_label_t *f4lbl,
-	unsigned int usable_partitions,
-	unsigned int cylinders,
-	unsigned int tracks,
-	unsigned int blocks,
-	unsigned int blksize,
-	__u16 dev_type);
-
-void vtoc_update_format4_label (
-	format4_label_t *f4,
-	cchhb_t *highest_f1,
-	__u16 unused_update);
-
-
-void vtoc_init_format5_label (
-	format5_label_t *f5);
-
-void vtoc_update_format5_label_add (
-	format5_label_t *f5,
-	int verbose,
-	int cyl,
-	int trk,
-	__u16 a, 
-	__u16 b, 
-	__u8 c);
- 
-void vtoc_update_format5_label_del (
-	format5_label_t *f5,
-	int verbose,
-	int cyl,
-	int trk,
-	__u16 a, 
-	__u16 b, 
-	__u8 c);
-
-
-void vtoc_init_format7_label (
-	format7_label_t *f7);
-
-void vtoc_update_format7_label_add (
-	format7_label_t *f7,
-	int verbose,
-	__u32 a, 
-	__u32 b);
-
-void vtoc_update_format7_label_del (
-	format7_label_t *f7, 
-	int verbose,
-	__u32 a, 
-	__u32 b);
-
-
-void vtoc_set_freespace(
-	format4_label_t *f4,
-	format5_label_t *f5,
-	format7_label_t *f7,
-	char ch,
-	int verbose,
-	__u32 start,
-	__u32 stop,
-	int cyl,
-	int trk);
-
-
-
-
-
-
-
-
-
-
-
-
diff -urN linux-2.5.67-bk5/include/asm-s390x/xor.h linux-2.5.67-bk6/include/asm-s390x/xor.h
--- linux-2.5.67-bk5/include/asm-s390x/xor.h	2003-04-07 10:31:05.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-s390x/xor.h	1969-12-31 16:00:00.000000000 -0800
@@ -1 +0,0 @@
-#include <asm-generic/xor.h>
diff -urN linux-2.5.67-bk5/include/asm-sparc/pgtable.h linux-2.5.67-bk6/include/asm-sparc/pgtable.h
--- linux-2.5.67-bk5/include/asm-sparc/pgtable.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-sparc/pgtable.h	2003-04-15 04:36:16.000000000 -0700
@@ -263,6 +263,8 @@
 	return pte_val(pte) & BTFIXUP_HALF(pte_filei);
 }
 
+/*
+ */
 BTFIXUPDEF_HALF(pte_wrprotecti)
 BTFIXUPDEF_HALF(pte_mkcleani)
 BTFIXUPDEF_HALF(pte_mkoldi)
@@ -387,11 +389,15 @@
 /* file-offset-in-pte helpers */
 BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte);
 BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff);
-BTFIXUPDEF_SIMM13(pte_file_max_bits);
 
 #define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte)
 #define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off)
-#define PTE_FILE_MAX_BITS BTFIXUP_SIMM13(pte_file_max_bits)
+
+/*
+ * This is made a constant because mm/fremap.c required a constant.
+ * Note that layout of these bits is different between sun4c.c and srmmu.c.
+ */
+#define PTE_FILE_MAX_BITS 24
 
 /*
  */
diff -urN linux-2.5.67-bk5/include/asm-sparc/pgtsrmmu.h linux-2.5.67-bk6/include/asm-sparc/pgtsrmmu.h
--- linux-2.5.67-bk5/include/asm-sparc/pgtsrmmu.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-sparc/pgtsrmmu.h	2003-04-15 04:36:16.000000000 -0700
@@ -64,8 +64,7 @@
 
 #define SRMMU_FILE         0x40	/* Implemented in software */
 
-#define SRMMU_PTE_FILE_MAX_BITS	24
-#define SRMMU_PTE_FILE_SHIFT     8
+#define SRMMU_PTE_FILE_SHIFT     8	/* == 32-PTE_FILE_MAX_BITS */
 
 #define SRMMU_CHG_MASK    (0xffffff00 | SRMMU_REF | SRMMU_DIRTY)
 
diff -urN linux-2.5.67-bk5/include/asm-sparc/pgtsun4c.h linux-2.5.67-bk6/include/asm-sparc/pgtsun4c.h
--- linux-2.5.67-bk5/include/asm-sparc/pgtsun4c.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/asm-sparc/pgtsun4c.h	2003-04-15 04:36:16.000000000 -0700
@@ -74,12 +74,6 @@
 #define SUN4C_PAGE_KERNEL	__pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\
 					 _SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV)
 
-/*
- * We have a couple of free bits left, but it's probably not a big
- * deal, considering sizes of RAM and swap on sun4c.
- */
-#define SUN4C_PTE_FILE_MAX_BITS	20
-
 #ifndef __ASSEMBLY__
 
 extern __inline__ unsigned long sun4c_get_synchronous_error(void)
diff -urN linux-2.5.67-bk5/include/linux/fb.h linux-2.5.67-bk6/include/linux/fb.h
--- linux-2.5.67-bk5/include/linux/fb.h	2003-04-07 10:30:59.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/fb.h	2003-04-15 04:36:16.000000000 -0700
@@ -2,6 +2,7 @@
 #define _LINUX_FB_H
 
 #include <linux/tty.h>
+#include <linux/workqueue.h>
 #include <asm/types.h>
 #include <asm/io.h>
 
@@ -310,7 +311,6 @@
 #define FB_CUR_SETCMAP  0x08
 #define FB_CUR_SETSHAPE 0x10
 #define FB_CUR_SETSIZE	0x20
-#define FB_CUR_SETDEST	0x40
 #define FB_CUR_SETALL   0xFF
 
 struct fbcurpos {
@@ -322,7 +322,6 @@
 	__u16 enable;		/* cursor on/off */
 	__u16 rop;		/* bitop operation */
 	char *mask;		/* cursor mask bits */
-	char *dest;		/* destination */
 	struct fbcurpos hot;	/* cursor hot spot */
 	struct fb_image	image;	/* Cursor image */
 };
@@ -339,9 +338,9 @@
 	__u32 buf_align;                  /* byte alignment of each bitmap */
 	__u32 scan_align;                 /* alignment per scanline        */
 	__u32 flags;                      /* see FB_PIXMAP_*               */
-	void (*outbuf)(u8 dst, u8 *addr); /* access methods                */
+					  /* access methods                */
+	void (*outbuf)(u8 *dst, u8 *addr, unsigned int size); 
 	u8   (*inbuf) (u8 *addr);
-	unsigned long lock_flags;         /* flags for locking             */
 	spinlock_t lock;                  /* spinlock                      */
 	atomic_t count;
 };
@@ -406,8 +405,9 @@
    struct fb_fix_screeninfo fix;        /* Current fix */
    struct fb_monspecs monspecs;         /* Current Monitor specs */
    struct fb_cursor cursor;		/* Current cursor */	
-   struct fb_cmap cmap;                 /* Current cmap */
+   struct work_struct queue;		/* Framebuffer event queue */
    struct fb_pixmap pixmap;	        /* Current pixmap */
+   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 */
@@ -469,9 +469,9 @@
      *  `Generic' versions of the frame buffer device operations
      */
 
-extern int fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info); 
-extern int fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); 
-extern int fb_blank(int blank, struct fb_info *info);
+extern int fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var); 
+extern int fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var); 
+extern int fb_blank(struct fb_info *info, int blank);
 extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
 extern void cfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); 
 extern void cfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 
@@ -505,12 +505,21 @@
 		       struct fb_info *info);
 extern int fb_validate_mode(struct fb_var_screeninfo *var,
 			    struct fb_info *info);
+extern int parse_edid(unsigned char *edid, struct fb_var_screeninfo *var);
+extern int fb_get_monitor_limits(unsigned char *edid, struct fb_monspecs *specs);
+extern struct fb_videomode *fb_create_modedb(unsigned char *edid, int *dbsize);
+extern void fb_destroy_modedb(struct fb_videomode *modedb);
+extern void show_edid(unsigned char *edid);
+
+/* drivers/video/modedb.c */
+#define VESA_MODEDB_SIZE 34
+extern const struct fb_videomode vesa_modes[];
 
 /* drivers/video/fbcmap.c */
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
-extern void fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
-			 int fsfromto);
+extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to,
+			int fsfromto);
 extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, struct fb_info *fb_info);
 extern struct fb_cmap *fb_default_cmap(int len);
 extern void fb_invert_cmaps(void);
diff -urN linux-2.5.67-bk5/include/linux/interrupt.h linux-2.5.67-bk6/include/linux/interrupt.h
--- linux-2.5.67-bk5/include/linux/interrupt.h	2003-04-07 10:31:41.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/interrupt.h	2003-04-15 04:36:16.000000000 -0700
@@ -77,6 +77,9 @@
 extern void FASTCALL(cpu_raise_softirq(unsigned int cpu, unsigned int nr));
 extern void FASTCALL(raise_softirq(unsigned int nr));
 
+#ifndef invoke_softirq
+#define invoke_softirq() do_softirq()
+#endif
 
 
 /* Tasklets --- multithreaded analogue of BHs.
diff -urN linux-2.5.67-bk5/include/linux/linux_logo.h linux-2.5.67-bk6/include/linux/linux_logo.h
--- linux-2.5.67-bk5/include/linux/linux_logo.h	2003-04-07 10:30:58.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/linux_logo.h	2003-04-15 04:36:16.000000000 -0700
@@ -32,6 +32,6 @@
 	const unsigned char *data;
 };
 
-extern const struct linux_logo * __init fb_find_logo(int type);
+extern const struct linux_logo * __init find_logo(int depth);
 
 #endif /* _LINUX_LINUX_LOGO_H */
diff -urN linux-2.5.67-bk5/include/linux/page-flags.h linux-2.5.67-bk6/include/linux/page-flags.h
--- linux-2.5.67-bk5/include/linux/page-flags.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/page-flags.h	2003-04-15 04:36:16.000000000 -0700
@@ -75,6 +75,7 @@
 #define PG_reclaim		18	/* To be reclaimed asap */
 #define PG_compound		19	/* Part of a compound page */
 
+
 /*
  * Global page accounting.  One instance per CPU.  Only unsigned longs are
  * allowed.
@@ -82,6 +83,7 @@
 struct page_state {
 	unsigned long nr_dirty;		/* Dirty writeable pages */
 	unsigned long nr_writeback;	/* Pages under writeback */
+	unsigned long nr_unstable;	/* NFS unstable pages */
 	unsigned long nr_page_table_pages;/* Pages used for pagetables */
 	unsigned long nr_mapped;	/* mapped into pagetables */
 	unsigned long nr_slab;		/* In slab */
@@ -130,6 +132,7 @@
 
 #define inc_page_state(member)	mod_page_state(member, 1UL)
 #define dec_page_state(member)	mod_page_state(member, 0UL - 1)
+#define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
 
 
 /*
diff -urN linux-2.5.67-bk5/include/linux/pci_ids.h linux-2.5.67-bk6/include/linux/pci_ids.h
--- linux-2.5.67-bk5/include/linux/pci_ids.h	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/pci_ids.h	2003-04-15 04:36:16.000000000 -0700
@@ -287,6 +287,7 @@
 #define PCI_DEVICE_ID_ATI_RADEON_Ie	0x4965
 #define PCI_DEVICE_ID_ATI_RADEON_If	0x4966
 #define PCI_DEVICE_ID_ATI_RADEON_Ig	0x4967
+#define PCI_DEVICE_ID_ATI_RADEON_QM	0x514d
 /* Radeon R300 (9700) */
 #define PCI_DEVICE_ID_ATI_RADEON_ND	0x4e44
 #define PCI_DEVICE_ID_ATI_RADEON_NE	0x4e45
diff -urN linux-2.5.67-bk5/include/linux/workqueue.h linux-2.5.67-bk6/include/linux/workqueue.h
--- linux-2.5.67-bk5/include/linux/workqueue.h	2003-04-07 10:32:18.000000000 -0700
+++ linux-2.5.67-bk6/include/linux/workqueue.h	2003-04-15 04:36:16.000000000 -0700
@@ -63,5 +63,15 @@
 
 extern void init_workqueues(void);
 
+/*
+ * Kill off a pending schedule_delayed_work().  Note that the work callback
+ * function may still be running on return from cancel_delayed_work().  Run
+ * flush_scheduled_work() to wait on it.
+ */
+static inline int cancel_delayed_work(struct work_struct *work)
+{
+	return del_timer_sync(&work->timer);
+}
+
 #endif
 
diff -urN linux-2.5.67-bk5/include/video/edid.h linux-2.5.67-bk6/include/video/edid.h
--- linux-2.5.67-bk5/include/video/edid.h	1969-12-31 16:00:00.000000000 -0800
+++ linux-2.5.67-bk6/include/video/edid.h	2003-04-15 04:36:16.000000000 -0700
@@ -0,0 +1,27 @@
+#ifndef __linux_video_edid_h__
+#define __linux_video_edid_h__
+
+#ifdef __KERNEL__
+
+#include <linux/config.h>
+#ifdef CONFIG_ALL_PPC
+#include <linux/pci.h>
+#endif
+
+#ifdef CONFIG_X86
+struct edid_info {
+	unsigned char dummy[128];
+};
+
+extern struct edid_info edid_info;
+extern char *get_EDID_from_BIOS(void *);
+
+#endif /* CONFIG_X86 */
+
+#ifdef CONFIG_ALL_PPC
+extern char *get_EDID_from_OF(struct pci_dev *pdev);
+#endif
+
+#endif /* __KERNEL__ */
+
+#endif /* __linux_video_edid_h__ */
diff -urN linux-2.5.67-bk5/kernel/compat.c linux-2.5.67-bk6/kernel/compat.c
--- linux-2.5.67-bk5/kernel/compat.c	2003-04-07 10:31:21.000000000 -0700
+++ linux-2.5.67-bk6/kernel/compat.c	2003-04-15 04:36:16.000000000 -0700
@@ -226,3 +226,54 @@
 	}
 	return do_futex((unsigned long)uaddr, op, val, timeout);
 }
+
+extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
+					    unsigned long *user_mask_ptr);
+
+asmlinkage long compat_sys_sched_setaffinity(compat_pid_t pid, 
+					     unsigned int len,
+					     compat_ulong_t *user_mask_ptr)
+{
+	unsigned long kernel_mask;
+	mm_segment_t old_fs;
+	int ret;
+
+	if (get_user(kernel_mask, user_mask_ptr))
+		return -EFAULT;
+
+	old_fs = get_fs();
+	set_fs(KERNEL_DS);
+	ret = sys_sched_setaffinity(pid,
+				    sizeof(kernel_mask),
+				    &kernel_mask);
+	set_fs(old_fs);
+
+	return ret;
+}
+
+extern asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
+					    unsigned long *user_mask_ptr);
+
+asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len,
+					    compat_ulong_t *user_mask_ptr)
+{
+	unsigned long kernel_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);
+	set_fs(old_fs);
+
+	if (ret > 0) {
+		if (put_user(kernel_mask, user_mask_ptr))
+			ret = -EFAULT;
+		ret = sizeof(compat_ulong_t);
+	}
+
+	return ret;
+}
+
diff -urN linux-2.5.67-bk5/kernel/posix-timers.c linux-2.5.67-bk6/kernel/posix-timers.c
--- linux-2.5.67-bk5/kernel/posix-timers.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/kernel/posix-timers.c	2003-04-15 04:36:16.000000000 -0700
@@ -77,6 +77,16 @@
 # define timer_active(tmr) BARFY	// error to use outside of SMP
 # define set_timer_inactive(tmr) do { } while (0)
 #endif
+
+/*
+ * For some reason mips/mips64 define the SIGEV constants plus 128.
+ * Here we define a mask to get rid of the common bits.	 The
+ * optimizer should make this costless to all but mips.
+ */
+#define MIPS_SIGEV ~(SIGEV_NONE & \
+		      SIGEV_SIGNAL & \
+		      SIGEV_THREAD &  \
+		      SIGEV_THREAD_ID)
 /*
  * The timer ID is turned into a timer address by idr_find().
  * Verifying a valid ID consists of:
@@ -225,10 +235,9 @@
 	struct now_struct now;
 
 	/* Set up the timer for the next interval (if there is one) */
-	if (!timr->it_incr) {
-		set_timer_inactive(timr);
+	if (!timr->it_incr) 
 		return;
-	}
+
 	posix_get_now(&now);
 	do {
 		posix_bump_timer(timr);
@@ -258,7 +267,7 @@
 
 	timr = lock_timer(info->si_tid, &flags);
 
-	if (!timr || !timr->it_requeue_pending)
+	if (!timr || timr->it_requeue_pending != info->si_sys_private)
 		goto exit;
 
 	schedule_next_timer(timr);
@@ -276,7 +285,17 @@
  * indicating that the signal was either not queued or was queued
  * without an info block.  In this case, we will not get a call back to
  * do_schedule_next_timer() so we do it here.  This should be rare...
+
+ * An interesting problem can occure if, while a signal, and thus a call
+ * back is pending, the timer is rearmed, i.e. stopped and restarted.
+ * We then need to sort out the call back and do the right thing.  What
+ * we do is to put a counter in the info block and match it with the
+ * timers copy on the call back.  If they don't match, we just ignore
+ * the call back.  Note that we do allow the timer to be deleted while
+ * a signal is pending.  The standard says we can allow that signal to
+ * be delivered, and we do.
  */
+static int pendcount = 1;
 
 static void timer_notify_task(struct k_itimer *timr)
 {
@@ -291,12 +310,19 @@
 	info.si_code = SI_TIMER;
 	info.si_tid = timr->it_id;
 	info.si_value = timr->it_sigev_value;
-	if (!timr->it_incr)
-		set_timer_inactive(timr);
-	else
-		timr->it_requeue_pending = info.si_sys_private = 1;
-
-	ret = send_sig_info(info.si_signo, &info, timr->it_process);
+	if (timr->it_incr){
+		/*
+		 * Don't allow a call back counter of zero...
+		 * and avoid the test by using 2.
+		 */
+		pendcount += 2;
+		timr->it_requeue_pending = info.si_sys_private = pendcount;
+	}
+	if( timr->it_sigev_notify & SIGEV_THREAD_ID & MIPS_SIGEV){
+		ret = send_sig_info(info.si_signo, &info, timr->it_process);
+	}else
+		ret = send_group_sig_info(info.si_signo, &info, 
+					  timr->it_process);
 	switch (ret) {
 
 	default:
@@ -332,23 +358,11 @@
 	unsigned long flags;
 
 	spin_lock_irqsave(&timr->it_lock, flags);
+ 	set_timer_inactive(timr);
 	timer_notify_task(timr);
 	unlock_timer(timr, flags);
 }
 
-/*
- * For some reason mips/mips64 define the SIGEV constants plus 128.
- * Here we define a mask to get rid of the common bits.	 The
- * optimizer should make this costless to all but mips.
- */
-#if defined(ARCH) && ((ARCH == mips) || (ARCH == mips64))
-#define MIPS_SIGEV ~(SIGEV_NONE & \
-		      SIGEV_SIGNAL & \
-		      SIGEV_THREAD &  \
-		      SIGEV_THREAD_ID)
-#else
-#define MIPS_SIGEV (int)-1
-#endif
 
 static inline struct task_struct * good_sigevent(sigevent_t * event)
 {
@@ -848,8 +862,7 @@
 {
 	timer->it_incr = 0;
 #ifdef CONFIG_SMP
-	if (timer_active(timer) &&
-	    !del_timer(&timer->it_timer) && !timer->it_requeue_pending)
+	if (timer_active(timer) && !del_timer(&timer->it_timer))
 		/*
 		 * It can only be active if on an other cpu.  Since
 		 * we have cleared the interval stuff above, it should
diff -urN linux-2.5.67-bk5/kernel/softirq.c linux-2.5.67-bk6/kernel/softirq.c
--- linux-2.5.67-bk5/kernel/softirq.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/kernel/softirq.c	2003-04-15 04:36:16.000000000 -0700
@@ -105,7 +105,7 @@
 	BUG_ON(irqs_disabled());
 	if (unlikely(!in_interrupt() &&
 		     local_softirq_pending()))
-		do_softirq();
+		invoke_softirq();
 	preempt_check_resched();
 }
 EXPORT_SYMBOL(local_bh_enable);
diff -urN linux-2.5.67-bk5/kernel/workqueue.c linux-2.5.67-bk6/kernel/workqueue.c
--- linux-2.5.67-bk5/kernel/workqueue.c	2003-04-07 10:32:57.000000000 -0700
+++ linux-2.5.67-bk6/kernel/workqueue.c	2003-04-15 04:36:16.000000000 -0700
@@ -27,13 +27,21 @@
 #include <linux/slab.h>
 
 /*
- * The per-CPU workqueue:
+ * The per-CPU workqueue.
+ *
+ * The sequence counters are for flush_scheduled_work().  It wants to wait
+ * until until all currently-scheduled works are completed, but it doesn't
+ * want to be livelocked by new, incoming ones.  So it waits until
+ * remove_sequence is >= the insert_sequence which pertained when
+ * flush_scheduled_work() was called.
  */
 struct cpu_workqueue_struct {
 
 	spinlock_t lock;
 
-	atomic_t nr_queued;
+	long remove_sequence;	/* Least-recently added (next to run) */
+	long insert_sequence;	/* Next to add */
+
 	struct list_head worklist;
 	wait_queue_head_t more_work;
 	wait_queue_head_t work_done;
@@ -71,10 +79,9 @@
 
 		spin_lock_irqsave(&cwq->lock, flags);
 		list_add_tail(&work->entry, &cwq->worklist);
-		atomic_inc(&cwq->nr_queued);
-		spin_unlock_irqrestore(&cwq->lock, flags);
-
+		cwq->insert_sequence++;
 		wake_up(&cwq->more_work);
+		spin_unlock_irqrestore(&cwq->lock, flags);
 		ret = 1;
 	}
 	put_cpu();
@@ -93,11 +100,13 @@
 	 */
 	spin_lock_irqsave(&cwq->lock, flags);
 	list_add_tail(&work->entry, &cwq->worklist);
+	cwq->insert_sequence++;
 	wake_up(&cwq->more_work);
 	spin_unlock_irqrestore(&cwq->lock, flags);
 }
 
-int queue_delayed_work(struct workqueue_struct *wq, struct work_struct *work, unsigned long delay)
+int queue_delayed_work(struct workqueue_struct *wq,
+			struct work_struct *work, unsigned long delay)
 {
 	int ret = 0, cpu = get_cpu();
 	struct timer_list *timer = &work->timer;
@@ -107,18 +116,11 @@
 		BUG_ON(timer_pending(timer));
 		BUG_ON(!list_empty(&work->entry));
 
-		/*
-		 * Increase nr_queued so that the flush function
-		 * knows that there's something pending.
-		 */
-		atomic_inc(&cwq->nr_queued);
 		work->wq_data = cwq;
-
 		timer->expires = jiffies + delay;
 		timer->data = (unsigned long)work;
 		timer->function = delayed_work_timer_fn;
 		add_timer(timer);
-
 		ret = 1;
 	}
 	put_cpu();
@@ -135,7 +137,8 @@
 	 */
 	spin_lock_irqsave(&cwq->lock, flags);
 	while (!list_empty(&cwq->worklist)) {
-		struct work_struct *work = list_entry(cwq->worklist.next, struct work_struct, entry);
+		struct work_struct *work = list_entry(cwq->worklist.next,
+						struct work_struct, entry);
 		void (*f) (void *) = work->func;
 		void *data = work->data;
 
@@ -146,14 +149,9 @@
 		clear_bit(0, &work->pending);
 		f(data);
 
-		/*
-		 * We only wake up 'work done' waiters (flush) when
-		 * the last function has been fully processed.
-		 */
-		if (atomic_dec_and_test(&cwq->nr_queued))
-			wake_up(&cwq->work_done);
-
 		spin_lock_irqsave(&cwq->lock, flags);
+		cwq->remove_sequence++;
+		wake_up(&cwq->work_done);
 	}
 	spin_unlock_irqrestore(&cwq->lock, flags);
 }
@@ -223,37 +221,41 @@
  * Forces execution of the workqueue and blocks until its completion.
  * This is typically used in driver shutdown handlers.
  *
- * NOTE: if work is being added to the queue constantly by some other
- * context then this function might block indefinitely.
+ * This function will sample each workqueue's current insert_sequence number and
+ * will sleep until the head sequence is greater than or equal to that.  This
+ * means that we sleep until all works which were queued on entry have been
+ * handled, but we are not livelocked by new incoming ones.
+ *
+ * This function used to run the workqueues itself.  Now we just wait for the
+ * helper threads to do it.
  */
 void flush_workqueue(struct workqueue_struct *wq)
 {
 	struct cpu_workqueue_struct *cwq;
 	int cpu;
 
+	might_sleep();
+
 	for (cpu = 0; cpu < NR_CPUS; cpu++) {
+		DEFINE_WAIT(wait);
+		long sequence_needed;
+
 		if (!cpu_online(cpu))
 			continue;
 		cwq = wq->cpu_wq + cpu;
 
-		if (atomic_read(&cwq->nr_queued)) {
-			DECLARE_WAITQUEUE(wait, current);
+		spin_lock_irq(&cwq->lock);
+		sequence_needed = cwq->insert_sequence;
 
-			if (!list_empty(&cwq->worklist))
-				run_workqueue(cwq);
-
-			/*
-			 * Wait for helper thread(s) to finish up
-			 * the queue:
-			 */
-			set_task_state(current, TASK_INTERRUPTIBLE);
-			add_wait_queue(&cwq->work_done, &wait);
-			if (atomic_read(&cwq->nr_queued))
-				schedule();
-			else
-				set_task_state(current, TASK_RUNNING);
-			remove_wait_queue(&cwq->work_done, &wait);
+		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);
 	}
 }
 
@@ -279,7 +281,8 @@
 		spin_lock_init(&cwq->lock);
 		cwq->wq = wq;
 		cwq->thread = NULL;
-		atomic_set(&cwq->nr_queued, 0);
+		cwq->insert_sequence = 0;
+		cwq->remove_sequence = 0;
 		INIT_LIST_HEAD(&cwq->worklist);
 		init_waitqueue_head(&cwq->more_work);
 		init_waitqueue_head(&cwq->work_done);
diff -urN linux-2.5.67-bk5/mm/memory.c linux-2.5.67-bk6/mm/memory.c
--- linux-2.5.67-bk5/mm/memory.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/mm/memory.c	2003-04-15 04:36:16.000000000 -0700
@@ -601,7 +601,6 @@
 
 	lru_add_drain();
 	spin_lock(&mm->page_table_lock);
-	flush_cache_range(vma, address, end);
 	tlb = tlb_gather_mmu(mm, 0);
 	unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted);
 	tlb_finish_mmu(tlb, address, end);
diff -urN linux-2.5.67-bk5/mm/page-writeback.c linux-2.5.67-bk6/mm/page-writeback.c
--- linux-2.5.67-bk5/mm/page-writeback.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/mm/page-writeback.c	2003-04-15 04:36:16.000000000 -0700
@@ -138,6 +138,7 @@
 void balance_dirty_pages(struct address_space *mapping)
 {
 	struct page_state ps;
+	long nr_reclaimable;
 	long background_thresh;
 	long dirty_thresh;
 	unsigned long pages_written = 0;
@@ -145,8 +146,7 @@
 
 	struct backing_dev_info *bdi = mapping->backing_dev_info;
 
-	get_dirty_limits(&ps, &background_thresh, &dirty_thresh);
-	while (ps.nr_dirty + ps.nr_writeback > dirty_thresh) {
+	for (;;) {
 		struct writeback_control wbc = {
 			.bdi		= bdi,
 			.sync_mode	= WB_SYNC_NONE,
@@ -154,24 +154,37 @@
 			.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)
+			break;
+
 		dirty_exceeded = 1;
 
-		if (ps.nr_dirty)
+		/* Note: nr_reclaimable denotes nr_dirty + nr_unstable.
+		 * Unstable writes are a feature of certain networked
+		 * filesystems (i.e. NFS) in which data may have been
+		 * written to the server's write cache, but has not yet
+		 * been flushed to permanent storage.
+		 */
+		if (nr_reclaimable) {
 			writeback_inodes(&wbc);
-
-		get_dirty_limits(&ps, &background_thresh, &dirty_thresh);
-		if (ps.nr_dirty + ps.nr_writeback <= dirty_thresh)
-			break;
-		pages_written += write_chunk - wbc.nr_to_write;
-		if (pages_written >= write_chunk)
-			break;		/* We've done our duty */
+			get_dirty_limits(&ps, &background_thresh,
+					&dirty_thresh);
+			nr_reclaimable = ps.nr_dirty + ps.nr_unstable;
+			if (nr_reclaimable + ps.nr_writeback <= dirty_thresh)
+				break;
+			pages_written += write_chunk - wbc.nr_to_write;
+			if (pages_written >= write_chunk)
+				break;		/* We've done our duty */
+		}
 		blk_congestion_wait(WRITE, HZ/10);
 	}
 
-	if (ps.nr_dirty + ps.nr_writeback <= dirty_thresh)
+	if (nr_reclaimable + ps.nr_writeback <= dirty_thresh)
 		dirty_exceeded = 0;
 
-	if (!writeback_in_progress(bdi) && ps.nr_dirty > background_thresh)
+	if (!writeback_in_progress(bdi) && nr_reclaimable > background_thresh)
 		pdflush_operation(background_writeout, 0);
 }
 
@@ -231,7 +244,8 @@
 		long dirty_thresh;
 
 		get_dirty_limits(&ps, &background_thresh, &dirty_thresh);
-		if (ps.nr_dirty < background_thresh && min_pages <= 0)
+		if (ps.nr_dirty + ps.nr_unstable < background_thresh
+				&& min_pages <= 0)
 			break;
 		wbc.encountered_congestion = 0;
 		wbc.nr_to_write = MAX_WRITEBACK_PAGES;
@@ -302,7 +316,7 @@
 	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;
+	nr_to_write = ps.nr_dirty + ps.nr_unstable;
 	while (nr_to_write > 0) {
 		wbc.encountered_congestion = 0;
 		wbc.nr_to_write = MAX_WRITEBACK_PAGES;
diff -urN linux-2.5.67-bk5/mm/page_alloc.c linux-2.5.67-bk6/mm/page_alloc.c
--- linux-2.5.67-bk5/mm/page_alloc.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/mm/page_alloc.c	2003-04-15 04:36:16.000000000 -0700
@@ -936,11 +936,13 @@
 		K(nr_free_pages()),
 		K(nr_free_highpages()));
 
-	printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu free:%u\n",
+	printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu "
+		"unstable:%lu free:%u\n",
 		active,
 		inactive,
 		ps.nr_dirty,
 		ps.nr_writeback,
+		ps.nr_unstable,
 		nr_free_pages());
 
 	for_each_zone(zone) {
@@ -1439,6 +1441,7 @@
 static char *vmstat_text[] = {
 	"nr_dirty",
 	"nr_writeback",
+	"nr_unstable",
 	"nr_page_table_pages",
 	"nr_mapped",
 	"nr_slab",
diff -urN linux-2.5.67-bk5/net/ipv4/ipcomp.c linux-2.5.67-bk6/net/ipv4/ipcomp.c
--- linux-2.5.67-bk5/net/ipv4/ipcomp.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/net/ipv4/ipcomp.c	2003-04-15 04:36:16.000000000 -0700
@@ -132,8 +132,7 @@
 	return err;
 }
 
-static void ipcomp_tunnel_encap(struct xfrm_state *x,
-                                struct sk_buff *skb, int compress)
+static void ipcomp_tunnel_encap(struct xfrm_state *x, struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
 	struct iphdr *iph, *top_iph;
@@ -147,7 +146,6 @@
 	if (!(iph->frag_off&htons(IP_DF)))
 		__ip_select_ident(top_iph, dst, 0);
 	top_iph->ttl = iph->ttl;
-	top_iph->protocol = compress ? IPPROTO_COMP : IPPROTO_IPIP;
 	top_iph->check = 0;
 	top_iph->saddr = x->props.saddr.a4;
 	top_iph->daddr = x->id.daddr.a4;
@@ -184,15 +182,16 @@
 	/* Don't bother compressing */
 	if (skb->len < ipcd->threshold) {
 		if (x->props.mode) {
-			ipcomp_tunnel_encap(x, skb, 0);
+			ipcomp_tunnel_encap(x, skb);
 			iph = skb->nh.iph;
+			iph->protocol = IPPROTO_IPIP;
 			ip_send_check(iph);
 		}
 		goto out_ok;
 	}
 
 	if (x->props.mode) 
-		ipcomp_tunnel_encap(x, skb, 1);
+		ipcomp_tunnel_encap(x, skb);
 
 	if ((skb_is_nonlinear(skb) || skb_cloned(skb)) &&
 	    skb_linearize(skb, GFP_ATOMIC) != 0) {
@@ -202,8 +201,14 @@
 	
 	err = ipcomp_compress(x, skb);
 	if (err) {
-		if (err == -EMSGSIZE)
+		if (err == -EMSGSIZE) {
+			if (x->props.mode) {
+				iph = skb->nh.iph;
+				iph->protocol = IPPROTO_IPIP;
+				ip_send_check(iph);
+			}
 			goto out_ok;
+		}
 		goto error;
 	}
 
diff -urN linux-2.5.67-bk5/net/ipv4/ipip.c linux-2.5.67-bk6/net/ipv4/ipip.c
--- linux-2.5.67-bk5/net/ipv4/ipip.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/net/ipv4/ipip.c	2003-04-15 04:36:16.000000000 -0700
@@ -208,7 +208,7 @@
 	write_unlock_bh(&ipip_lock);
 }
 
-struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
+static struct ip_tunnel * ipip_tunnel_locate(struct ip_tunnel_parm *parms, int create)
 {
 	u32 remote = parms->iph.daddr;
 	u32 local = parms->iph.saddr;
@@ -286,7 +286,7 @@
 	dev_put(dev);
 }
 
-void ipip_err(struct sk_buff *skb, void *__unused)
+static void ipip_err(struct sk_buff *skb, void *__unused)
 {
 #ifndef I_WISH_WORLD_WERE_PERFECT
 
@@ -478,7 +478,7 @@
 		IP_ECN_set_ce(inner_iph);
 }
 
-int ipip_rcv(struct sk_buff *skb)
+static int ipip_rcv(struct sk_buff *skb)
 {
 	struct iphdr *iph;
 	struct ip_tunnel *tunnel;
@@ -852,7 +852,7 @@
 	return 0;
 }
 
-int __init ipip_fb_tunnel_init(struct net_device *dev)
+static int __init ipip_fb_tunnel_init(struct net_device *dev)
 {
 	struct iphdr *iph;
 
diff -urN linux-2.5.67-bk5/net/ipv4/netfilter/ipt_owner.c linux-2.5.67-bk6/net/ipv4/netfilter/ipt_owner.c
--- linux-2.5.67-bk5/net/ipv4/netfilter/ipt_owner.c	2003-04-07 10:32:50.000000000 -0700
+++ linux-2.5.67-bk6/net/ipv4/netfilter/ipt_owner.c	2003-04-15 04:36:16.000000000 -0700
@@ -26,16 +26,16 @@
 		task_lock(p);
 		files = p->files;
 		if(files) {
-			read_lock(&files->file_lock);
+			spin_lock(&files->file_lock);
 			for (i=0; i < files->max_fds; i++) {
 				if (fcheck_files(files, i) == skb->sk->socket->file) {
-					read_unlock(&files->file_lock);
+					spin_unlock(&files->file_lock);
 					task_unlock(p);
 					read_unlock(&tasklist_lock);
 					return 1;
 				}
 			}
-			read_unlock(&files->file_lock);
+			spin_unlock(&files->file_lock);
 		}
 		task_unlock(p);
 	} while_each_thread(g, p);
@@ -57,16 +57,16 @@
 	task_lock(p);
 	files = p->files;
 	if(files) {
-		read_lock(&files->file_lock);
+		spin_lock(&files->file_lock);
 		for (i=0; i < files->max_fds; i++) {
 			if (fcheck_files(files, i) == skb->sk->socket->file) {
-				read_unlock(&files->file_lock);
+				spin_unlock(&files->file_lock);
 				task_unlock(p);
 				read_unlock(&tasklist_lock);
 				return 1;
 			}
 		}
-		read_unlock(&files->file_lock);
+		spin_unlock(&files->file_lock);
 	}
 	task_unlock(p);
 out:
@@ -90,14 +90,14 @@
 		task_lock(p);
 		files = p->files;
 		if (files) {
-			read_lock(&files->file_lock);
+			spin_lock(&files->file_lock);
 			for (i=0; i < files->max_fds; i++) {
 				if (fcheck_files(files, i) == file) {
 					found = 1;
 					break;
 				}
 			}
-			read_unlock(&files->file_lock);
+			spin_unlock(&files->file_lock);
 		}
 		task_unlock(p);
 		if (found)
diff -urN linux-2.5.67-bk5/net/ipv4/xfrm4_tunnel.c linux-2.5.67-bk6/net/ipv4/xfrm4_tunnel.c
--- linux-2.5.67-bk5/net/ipv4/xfrm4_tunnel.c	2003-04-15 04:36:10.000000000 -0700
+++ linux-2.5.67-bk6/net/ipv4/xfrm4_tunnel.c	2003-04-15 04:36:16.000000000 -0700
@@ -163,7 +163,7 @@
 	return 0;
 }
 
-void ipip_err(struct sk_buff *skb, u32 info)
+static void ipip_err(struct sk_buff *skb, u32 info)
 {
 	struct xfrm_tunnel *handler = ipip_handler;
 	u32 arg = info;
diff -urN linux-2.5.67-bk5/net/ipv6/netfilter/ip6t_owner.c linux-2.5.67-bk6/net/ipv6/netfilter/ip6t_owner.c
--- linux-2.5.67-bk5/net/ipv6/netfilter/ip6t_owner.c	2003-04-07 10:32:23.000000000 -0700
+++ linux-2.5.67-bk6/net/ipv6/netfilter/ip6t_owner.c	2003-04-15 04:36:16.000000000 -0700
@@ -29,16 +29,16 @@
 	task_lock(p);
 	files = p->files;
 	if(files) {
-		read_lock(&files->file_lock);
+		spin_lock(&files->file_lock);
 		for (i=0; i < files->max_fds; i++) {
 			if (fcheck_files(files, i) == skb->sk->socket->file) {
-				read_unlock(&files->file_lock);
+				spin_unlock(&files->file_lock);
 				task_unlock(p);
 				read_unlock(&tasklist_lock);
 				return 1;
 			}
 		}
-		read_unlock(&files->file_lock);
+		spin_unlock(&files->file_lock);
 	}
 	task_unlock(p);
 out:
@@ -62,14 +62,14 @@
 		task_lock(p);
 		files = p->files;
 		if (files) {
-			read_lock(&files->file_lock);
+			spin_lock(&files->file_lock);
 			for (i=0; i < files->max_fds; i++) {
 				if (fcheck_files(files, i) == file) {
 					found = 1;
 					break;
 				}
 			}
-			read_unlock(&files->file_lock);
+			spin_unlock(&files->file_lock);
 		}
 		task_unlock(p);
 		if (found)
diff -urN linux-2.5.67-bk5/net/sched/sch_sfq.c linux-2.5.67-bk6/net/sched/sch_sfq.c
--- linux-2.5.67-bk5/net/sched/sch_sfq.c	2003-04-07 10:32:50.000000000 -0700
+++ linux-2.5.67-bk6/net/sched/sch_sfq.c	2003-04-15 04:36:16.000000000 -0700
@@ -131,10 +131,6 @@
 	return h & 0x3FF;
 }
 
-#ifndef IPPROTO_ESP
-#define IPPROTO_ESP 50
-#endif
-
 static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
 {
 	u32 h, h2;
