## Automatically generated incremental diff
## From:   linux-2.4.18-pre8
## To:     linux-2.4.18-pre9
## Robot:  $Id: make-incremental-diff,v 1.9 2001/12/10 00:06:56 hpa Exp $

diff -urN linux-2.4.18-pre8/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.4.18-pre8/Documentation/Configure.help	Thu Feb  7 11:55:29 2002
+++ linux/Documentation/Configure.help	Thu Feb  7 11:55:44 2002
@@ -4118,6 +4118,19 @@
   module will be called rivafb.o. If you want to compile it as a
   module, say M here and read <file:Documentation/modules.txt>.
 
+Trident Blade/Image support
+CONFIG_FB_TRIDENT
+  This driver is supposed to support graphics boards with the
+  Trident CyberXXXX/Image/CyberBlade chips mostly found in laptops
+  but also on some motherboards.Read <file:Documentation/fb/tridentfb.txt>
+
+  Say Y if you have such a graphics board.
+
+  The driver is also available as a module ( = code which can be
+  inserted and removed from the running kernel whenever you want). The
+  module will be called rivafb.o. If you want to compile it as a
+  module, say M here and read <file:Documentation/modules.txt>.
+
 ATI Mach64 display support
 CONFIG_FB_ATY
   This driver supports graphics boards with the ATI Mach64 chips.
diff -urN linux-2.4.18-pre8/Documentation/fb/tridentfb.txt linux/Documentation/fb/tridentfb.txt
--- linux-2.4.18-pre8/Documentation/fb/tridentfb.txt	Wed Dec 31 16:00:00 1969
+++ linux/Documentation/fb/tridentfb.txt	Thu Feb  7 11:55:44 2002
@@ -0,0 +1,49 @@
+Tridentfb is a framebuffer driver for some Trident chip based cards.
+
+The following list of chips is thought to be supported although not all are
+tested:
+
+those from the Image series with Cyber in their names - accelerated
+those with Blade in their names (Blade3D,CyberBlade...) - accelerated
+the newer CyberBladeXP family  - nonaccelerated
+
+Only PCI/AGP based cards are supported, none of the older Tridents.
+
+How to use it?
+==============
+Just do your usual console work :)
+
+When booting you can pass the following parameters
+==================================================
+
+noaccel - turns off acceleration (when it doesn't work for your card)
+accel - force text acceleration (for boards which by default are noacceled)
+
+fp	- use flat panel related stuff
+crt 	- assume monitor is present instead of fp
+
+center 	- for flat panels and resolutions smaller than native size center the
+	  image, otherwise use
+stretch
+
+memsize - integer value in Kb, use if your card's memory size is misdetected.
+	  look at the driver output to see what it says when initializing.
+memdiff - integer value in Kb,should be nonzero if your card reports
+	  more memory than it actually has.For instance mine is 192K less than
+	  detection says in all three BIOS selectable situations 2M, 4M, 8M.
+	  Only use if your video memory is taken from main memory hence of
+	  configurable size.Otherwise use memsize.
+	  If in some modes which barely fit the memory you see garbage at the bottom
+	  this might help by not letting change to that mode anymore.
+
+nativex - the width in pixels of the flat panel.If you know it (usually 1024
+	  800 or 1280) and it is not what the driver seems to detect use it.
+
+bpp  - bits per pixel (8,16 or 32)
+mode - a mode name like 800x600 (as described in Documentation/fb/modedb.txt)
+
+Using insane values for the above parameters will probably result in driver
+misbehaviour so take care(for instance memsize=12345678 or memdiff=23784 or
+nativex=93)
+
+Contact: jani@astechnix.ro
diff -urN linux-2.4.18-pre8/Documentation/networking/8139too.txt linux/Documentation/networking/8139too.txt
--- linux-2.4.18-pre8/Documentation/networking/8139too.txt	Thu Feb  7 11:55:31 2002
+++ linux/Documentation/networking/8139too.txt	Thu Feb  7 11:55:44 2002
@@ -96,6 +96,7 @@
 KTI KF-230TX
 KTI KF-230TX/2
 Lantech FastNet TX
+Ovislink Fast Ethernet
 Planet ENW-9504 (V.4) 10/100
 SMC EZNET 10/100
 UNEX NexNIC ND012C
diff -urN linux-2.4.18-pre8/MAINTAINERS linux/MAINTAINERS
--- linux-2.4.18-pre8/MAINTAINERS	Thu Feb  7 11:55:32 2002
+++ linux/MAINTAINERS	Thu Feb  7 11:55:44 2002
@@ -1050,9 +1050,10 @@
 M:	jamesm@intercode.com.au
 P:	Harald Welte
 M:	laforge@gnumonks.org
-W:	http://netfilter.samba.org
-W:	http://netfilter.kernelnotes.org
-W:	http://netfilter.filewatcher.org
+P:	Jozsef Kadlecsik
+M:	kadlec@blackhole.kfki.hu
+W:	http://www.netfilter.org/
+W:	http://www.iptables.org/
 L:	netfilter@lists.samba.org
 S:	Supported
 
diff -urN linux-2.4.18-pre8/Makefile linux/Makefile
--- linux-2.4.18-pre8/Makefile	Thu Feb  7 11:55:32 2002
+++ linux/Makefile	Thu Feb  7 11:55:44 2002
@@ -1,12 +1,12 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 18
-EXTRAVERSION = -pre8
+EXTRAVERSION = -pre9
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
-KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//")
+KERNELPATH=kernel-$(shell echo $(KERNELRELEASE) | sed -e "s/-//g")
 
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 	  else if [ -x /bin/bash ]; then echo /bin/bash; \
diff -urN linux-2.4.18-pre8/arch/cris/boot/Makefile linux/arch/cris/boot/Makefile
--- linux-2.4.18-pre8/arch/cris/boot/Makefile	Thu Feb  8 16:32:44 2001
+++ linux/arch/cris/boot/Makefile	Thu Feb  7 11:55:44 2002
@@ -8,6 +8,8 @@
 	@$(MAKE) -C compressed vmlinuz
 
 dep:
+	@$(MAKE) -C compressed depend
+	@$(MAKE) -C rescue depend
 
 clean:
 	rm -f zImage tools/build compressed/vmlinux.out
diff -urN linux-2.4.18-pre8/arch/cris/boot/compressed/Makefile linux/arch/cris/boot/compressed/Makefile
--- linux-2.4.18-pre8/arch/cris/boot/compressed/Makefile	Tue May  1 16:04:56 2001
+++ linux/arch/cris/boot/compressed/Makefile	Thu Feb  7 11:55:44 2002
@@ -4,6 +4,13 @@
 # create a compressed vmlinux image from the original vmlinux files and romfs
 #
 
+ifndef TOPDIR
+TOPDIR = ../../../..
+HPATH = $(TOPDIR)/include
+export HPATH
+endif
+
+
 CC = gcc-cris -melf -I $(TOPDIR)/include
 CFLAGS = -O2
 LD = ld-cris
@@ -37,4 +44,10 @@
 
 clean:
 	rm -f piggy.img vmlinuz vmlinuz.o
+
+depend:
+	$(CC) -M *.S *.c > .depend
+
+-include .depend
+
 
diff -urN linux-2.4.18-pre8/arch/cris/boot/rescue/Makefile linux/arch/cris/boot/rescue/Makefile
--- linux-2.4.18-pre8/arch/cris/boot/rescue/Makefile	Mon Oct  8 11:43:54 2001
+++ linux/arch/cris/boot/rescue/Makefile	Thu Feb  7 11:55:44 2002
@@ -3,6 +3,8 @@
 #
 ifndef TOPDIR
 TOPDIR = ../../../..
+HPATH = $(TOPDIR)/include
+export HPATH
 endif
 CC = gcc-cris -mlinux -I $(TOPDIR)/include
 CFLAGS = -O2
@@ -35,7 +37,7 @@
 	dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784
 	rm ktr.bin tmp2423 kimagerescue_tmp.bin
 
-head.o: head.S
+head.o: head.S 
 	$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
 
 testrescue.o: testrescue.S
@@ -52,3 +54,8 @@
 modules:
 
 modules-install:
+
+depend:
+	$(CC) -M *.S > .depend
+
+-include .depend
diff -urN linux-2.4.18-pre8/arch/cris/cris.ld linux/arch/cris/cris.ld
--- linux-2.4.18-pre8/arch/cris/cris.ld	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/cris.ld	Mon Oct  8 11:43:54 2001
@@ -24,6 +24,7 @@
 		*(.fixup)
 		*(.text.__*)
 	}
+  	.text.lock : { *(.text.lock) }        /* out-of-line lock text */
 
 	_etext = . ;                  /* End of text section */ 
 	__etext = .;
diff -urN linux-2.4.18-pre8/arch/cris/drivers/ethernet.c linux/arch/cris/drivers/ethernet.c
--- linux-2.4.18-pre8/arch/cris/drivers/ethernet.c	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/drivers/ethernet.c	Thu Feb  7 11:55:44 2002
@@ -1,4 +1,4 @@
-/* $Id: ethernet.c,v 1.21 2001/11/23 11:54:49 starvik Exp $
+/* $Id: ethernet.c,v 1.22 2002/01/30 07:48:22 matsfg Exp $
  *
  * e100net.c: A network driver for the ETRAX 100LX network controller.
  *
@@ -7,6 +7,9 @@
  * The outline of this driver comes from skeleton.c.
  *
  * $Log: ethernet.c,v $
+ * Revision 1.22  2002/01/30 07:48:22  matsfg
+ * Initiate R_NETWORK_TR_CTRL
+ *
  * Revision 1.21  2001/11/23 11:54:49  starvik
  * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list
  * Removed compiler warnings
@@ -526,6 +529,15 @@
 	*R_NETWORK_GEN_CONFIG =
 		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
 		IO_STATE(R_NETWORK_GEN_CONFIG, enable, on);
+
+        *R_NETWORK_TR_CTRL = 
+                IO_STATE(R_NETWORK_TR_CTRL, clr_error, clr) |
+                IO_STATE(R_NETWORK_TR_CTRL, delay, none) |
+                IO_STATE(R_NETWORK_TR_CTRL, cancel, dont) |
+                IO_STATE(R_NETWORK_TR_CTRL, cd, enable) |
+                IO_STATE(R_NETWORK_TR_CTRL, retry, enable) |
+                IO_STATE(R_NETWORK_TR_CTRL, pad, enable) |
+                IO_STATE(R_NETWORK_TR_CTRL, crc, enable);
 
 	save_flags(flags);
 	cli();
diff -urN linux-2.4.18-pre8/arch/cris/drivers/serial.c linux/arch/cris/drivers/serial.c
--- linux-2.4.18-pre8/arch/cris/drivers/serial.c	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/drivers/serial.c	Thu Feb  7 11:55:44 2002
@@ -1,4 +1,4 @@
-/* $Id: serial.c,v 1.28 2001/12/18 15:04:53 johana Exp $
+/* $Id: serial.c,v 1.29 2002/01/14 16:10:01 pkj Exp $
  *
  * Serial port driver for the ETRAX 100LX chip
  *
@@ -7,6 +7,14 @@
  *      Many, many authors. Based once upon a time on serial.c for 16x50.
  *
  * $Log: serial.c,v $
+ * Revision 1.29  2002/01/14 16:10:01  pkj
+ * Allocate the receive buffers dynamically. The static 4kB buffer was
+ * too small for the peaks. This means that we can get rid of the extra
+ * buffer and the copying to it. It also means we require less memory
+ * under normal operations, but can use more when needed (there is a
+ * cap at 64kB for safety reasons). If there is no memory available
+ * we panic(), and die a horrible death...
+ *
  * Revision 1.28  2001/12/18 15:04:53  johana
  * Cleaned up write_rs485() - now it works correctly without padding extra
  * char.
@@ -283,7 +291,7 @@
  *
  */
 
-static char *serial_version = "$Revision: 1.28 $";
+static char *serial_version = "$Revision: 1.29 $";
 
 #include <linux/config.h>
 #include <linux/version.h>
@@ -363,8 +371,7 @@
 
 #define TTY_THROTTLE_LIMIT (TTY_FLIPBUF_SIZE/10)
 
-#define SERIAL_RECV_SIZE      4096
-#define SERIAL_DESCR_BUF_SIZE 512
+#define SERIAL_DESCR_BUF_SIZE 256
 
 /* Add an x here to log a lot of timer stuff */
 #define TIMERD(x)
@@ -1260,15 +1267,56 @@
 #define START_FLUSH_FAST_TIMER(info, string)
 #endif
 
+static struct etrax_recv_buffer *
+alloc_recv_buffer(unsigned int size)
+{
+	struct etrax_recv_buffer *buffer;
+
+	if (!(buffer = kmalloc(sizeof *buffer + size, GFP_ATOMIC)))
+		return NULL;
+
+	buffer->next = NULL;
+	buffer->length = 0;
+	buffer->error = TTY_NORMAL;
+
+	return buffer;
+}
+
+static void
+append_recv_buffer(struct e100_serial *info, struct etrax_recv_buffer *buffer)
+{
+	unsigned long flags;
+
+	save_flags(flags);
+	cli();
+
+	if (!info->first_recv_buffer)
+		info->first_recv_buffer = buffer;
+	else
+		info->last_recv_buffer->next = buffer;
+
+	info->last_recv_buffer = buffer;
+
+	info->recv_cnt += buffer->length;
+	if (info->recv_cnt > info->max_recv_cnt)
+		info->max_recv_cnt = info->recv_cnt;
+
+	restore_flags(flags);
+}
+
 static int
 add_char_and_flag(struct e100_serial *info, unsigned char data, unsigned char flag)
 {
-	if (!CIRC_SPACE(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE))
+	struct etrax_recv_buffer *buffer;
+
+	if (!(buffer = alloc_recv_buffer(4)))
 		return 0;
 
-	info->recv.buf[info->recv.head] = data;
-	info->flag_buf[info->recv.head] = flag;
-	info->recv.head = (info->recv.head + 1) & (SERIAL_RECV_SIZE - 1);
+	buffer->length = 1;
+	buffer->error = flag;
+	buffer->buffer[0] = data;
+	
+	append_recv_buffer(info, buffer);
 
 	info->icount.rx++;
 
@@ -1276,33 +1324,33 @@
 }
 
 static _INLINE_ unsigned int
-copy_descr_data(struct e100_serial *info, unsigned int recvl, unsigned char *buf)
+handle_descr_data(struct e100_serial *info, struct etrax_dma_descr *descr, unsigned int recvl)
 {
-	unsigned int count = CIRC_SPACE_TO_END(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE);
-	unsigned int length = 0;
-
-	 while (length < recvl && count) {
-		if (length + count > recvl)
-			count = recvl - length;
-
-		memcpy(info->recv.buf + info->recv.head, buf + length, count);
-		memset(info->flag_buf + info->recv.head, '\0', count);
-		info->recv.head = (info->recv.head + count) & (SERIAL_RECV_SIZE - 1);
-		length += count;
+	struct etrax_recv_buffer *buffer = phys_to_virt(descr->buf) - sizeof *buffer;
 
-		count = CIRC_SPACE_TO_END(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE);
+	if (info->recv_cnt + recvl > 65536) {
+		printk(__FUNCTION__ ": Too much pending incoming serial data! Dropping %u bytes.\n", recvl);
+		return 0;
 	}
 
-	if (length != recvl) { 
-		printk(__FUNCTION__ ": Buffer overflow! %d byte(s) did not fit.\n", recvl - length);
-		PROCSTAT(ser_stat[info->line].overrun_cnt += recvl - length);
-	}
+	buffer->length = recvl;
+
+	if (info->errorcode == ERRCODE_SET_BREAK)
+		buffer->error = TTY_BREAK;
+	info->errorcode = 0;
 
-	return length;
+	append_recv_buffer(info, buffer);
+
+	if (!(buffer = alloc_recv_buffer(SERIAL_DESCR_BUF_SIZE)))
+		panic(__FUNCTION__ ": Failed to allocate memory for receive buffer!\n");
+
+	descr->buf = virt_to_phys(buffer->buffer);
+	
+	return recvl;
 }
 
 static _INLINE_ unsigned int
-copy_all_descr_data(struct e100_serial *info)
+handle_all_descr_data(struct e100_serial *info)
 {
 	struct etrax_dma_descr *descr;
 	unsigned int recvl;
@@ -1336,7 +1384,7 @@
 		/* update stats */
 		info->icount.rx += recvl;
 
-		ret += copy_descr_data(info, recvl, phys_to_virt(descr->buf));
+		ret += handle_descr_data(info, descr, recvl);
 	}
 
 	return ret;
@@ -1347,7 +1395,6 @@
 {
 	struct tty_struct *tty;
 	unsigned char rstat;
-	unsigned int old_head;
 
 #ifdef CONFIG_SVINTO_SIM
 	/* No receive in the simulator.  Will probably be when the rest of
@@ -1372,12 +1419,7 @@
 	if (info->errorcode == ERRCODE_INSERT_BREAK)
 		add_char_and_flag(info, '\0', TTY_BREAK);
 
-	old_head = info->recv.head;
-	
-	if (copy_all_descr_data(info) && info->errorcode == ERRCODE_SET_BREAK)
-		info->flag_buf[old_head] = TTY_BREAK;
-
-	info->errorcode = 0;
+	handle_all_descr_data(info);
 
 	/* Read the status register to detect errors */
 	rstat = info->port[REG_STATUS];
@@ -1400,10 +1442,6 @@
 			add_char_and_flag(info, data, TTY_FRAME);
 	}
 
-	if (!E100_RTS_GET(info) &&
-	    CIRC_SPACE(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE) < TTY_THROTTLE_LIMIT)
-		info->tty->driver.throttle(info->tty);
-	
 	START_FLUSH_FAST_TIMER(info, "receive_chars");
 
 	/* Restart the receiving DMA */
@@ -1414,19 +1452,20 @@
 start_recv_dma(struct e100_serial *info)
 {
 	struct etrax_dma_descr *descr = info->rec_descr;
-	unsigned char *buf = info->recv.buf + 2*SERIAL_RECV_SIZE;
+	struct etrax_recv_buffer *buffer;
         int i;
 
 	/* Set up the receiving descriptors */
 	for (i = 0; i < SERIAL_RECV_DESCRIPTORS; i++) {
+		if (!(buffer = alloc_recv_buffer(SERIAL_DESCR_BUF_SIZE)))
+			panic(__FUNCTION__ ": Failed to allocate memory for receive buffer!\n");
+
 		descr[i].ctrl = d_int;
-		descr[i].buf = virt_to_phys(buf);
+		descr[i].buf = virt_to_phys(buffer->buffer);
 		descr[i].sw_len = SERIAL_DESCR_BUF_SIZE;
 		descr[i].hw_len = 0;
 		descr[i].status = 0;
 		descr[i].next = virt_to_phys(&descr[i+1]);
-
-		buf += SERIAL_DESCR_BUF_SIZE;
 	}
 
 	/* Link the last descriptor to the first */
@@ -1618,11 +1657,11 @@
 flush_to_flip_buffer(struct e100_serial *info)
 {
 	struct tty_struct *tty = info->tty;
-	unsigned int count = CIRC_CNT_TO_END(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE);
+	struct etrax_recv_buffer *buffer;
 	unsigned int length;
 	unsigned long flags;
 
-	if (!count)
+	if (!info->first_recv_buffer)
 		return;
 
 	save_flags(flags);
@@ -1630,19 +1669,31 @@
 
 	length = tty->flip.count;
 	
-	do {
+	while ((buffer = info->first_recv_buffer) && length < TTY_FLIPBUF_SIZE) {
+		unsigned int count = buffer->length;
+
 		if (length + count > TTY_FLIPBUF_SIZE)
 			count = TTY_FLIPBUF_SIZE - length;
 
-		memcpy(tty->flip.char_buf_ptr + length, info->recv.buf + info->recv.tail, count);
-		memcpy(tty->flip.flag_buf_ptr + length, info->flag_buf + info->recv.tail, count);
-		info->recv.tail = ((info->recv.tail + count) & (SERIAL_RECV_SIZE-1));
+		memcpy(tty->flip.char_buf_ptr + length, buffer->buffer, count);
+		memset(tty->flip.flag_buf_ptr + length, TTY_NORMAL, count);
+		tty->flip.flag_buf_ptr[length] = buffer->error;
+
 		length += count;
-		
-		count = CIRC_CNT_TO_END(info->recv.head,
-					info->recv.tail,
-					SERIAL_RECV_SIZE);
-	} while (length < TTY_FLIPBUF_SIZE && count);
+		info->recv_cnt -= count;
+
+		if (count == buffer->length) {
+			info->first_recv_buffer = buffer->next;
+			kfree(buffer);
+		} else {
+			buffer->length -= count;
+			memmove(buffer->buffer, buffer->buffer + count, buffer->length);
+			buffer->error = TTY_NORMAL;
+		}
+	}
+
+	if (!info->first_recv_buffer)
+		info->last_recv_buffer = NULL;
 
 	tty->flip.count = length;
 
@@ -1654,11 +1705,6 @@
 #else
 	queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
 #endif
-
-	/* unthrottle if we have throttled */
-	if (E100_RTS_GET(info) &&
-	    CIRC_SPACE(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE) > TTY_THROTTLE_LIMIT)
-		tty->driver.unthrottle(info->tty);
 }
 
 static _INLINE_ void
@@ -1668,7 +1714,7 @@
 
 	flush_to_flip_buffer(info);
 
-	if (CIRC_CNT(info->recv.head, info->recv.tail, SERIAL_RECV_SIZE))
+	if (info->first_recv_buffer)
 		START_FLUSH_FAST_TIMER(info, "flip");
 }
 
@@ -2005,18 +2051,12 @@
 {
 	unsigned long flags;
 	unsigned long xmit_page;
-	unsigned char *recv_page;
+	int i;
 
 	xmit_page = get_zeroed_page(GFP_KERNEL);
 	if (!xmit_page)
 		return -ENOMEM;
 
-	recv_page = kmalloc(2 * SERIAL_RECV_SIZE + SERIAL_RECV_DESCRIPTORS * SERIAL_DESCR_BUF_SIZE, GFP_KERNEL);
-	if (!recv_page) {
-		free_page(xmit_page);
-		return -ENOMEM;
-	}
-
 	save_flags(flags); cli();
 
 	/* if it was already initialized, skip this */
@@ -2024,7 +2064,6 @@
 	if (info->flags & ASYNC_INITIALIZED) {
 		restore_flags(flags);
 		free_page(xmit_page);
-		kfree(recv_page);
 		return 0;
 	}
 
@@ -2033,13 +2072,6 @@
 	else
 		info->xmit.buf = (unsigned char *) xmit_page;
 
-	if (info->recv.buf)
-		kfree(recv_page);
-	else {
-		info->recv.buf = (unsigned char *) recv_page;
-		info->flag_buf = info->recv.buf + SERIAL_RECV_SIZE;
-	}
-
 #ifdef SERIAL_DEBUG_OPEN
 	printk("starting up ttyS%d (xmit_buf 0x%p, recv_buf 0x%p)...\n", info->line, info->xmit.buf, info->recv.buf);
 #endif
@@ -2050,8 +2082,13 @@
 	   right? */
 	if (info->tty)
 		clear_bit(TTY_IO_ERROR, &info->tty->flags);
+
 	info->xmit.head = info->xmit.tail = 0;
-	info->recv.head = info->recv.tail = 0;
+	info->first_recv_buffer = info->last_recv_buffer = NULL;
+	info->recv_cnt = info->max_recv_cnt = 0;
+
+	for (i = 0; i < SERIAL_RECV_DESCRIPTORS; i++)
+		info->rec_descr[i].buf = NULL;
 
 	/* No real action in the simulator, but may set info important
 	   to ioctl. */
@@ -2090,8 +2127,12 @@
 		clear_bit(TTY_IO_ERROR, &info->tty->flags);
 
 	info->xmit.head = info->xmit.tail = 0;
-	info->recv.head = info->recv.tail = 0;
+	info->first_recv_buffer = info->last_recv_buffer = NULL;
+	info->recv_cnt = info->max_recv_cnt = 0;
 	
+	for (i = 0; i < SERIAL_RECV_DESCRIPTORS; i++)
+		info->rec_descr[i].buf = 0;
+
 	/*
 	 * and set the speed and other flags of the serial port
 	 * this will start the rx/tx as well
@@ -2143,6 +2184,9 @@
 shutdown(struct e100_serial * info)
 {
 	unsigned long flags;
+	struct etrax_dma_descr *descr = info->rec_descr;
+	struct etrax_recv_buffer *buffer;
+	int i;
 
 #ifndef CONFIG_SVINTO_SIM	
 	/* shut down the transmitter and receiver */
@@ -2179,11 +2223,12 @@
 		info->xmit.buf = NULL;
 	}
 
-	if (info->recv.buf) {
-		kfree(info->recv.buf);
-		info->recv.buf = NULL;
-		info->flag_buf = NULL;
-	}
+	for (i = 0; i < SERIAL_RECV_DESCRIPTORS; i++)
+		if (descr[i].buf) {
+			buffer = phys_to_virt(descr[i].buf) - sizeof *buffer;
+			kfree(buffer);
+			descr[i].buf = 0;
+		}
 
 	if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) {
 		/* hang up DTR and RTS if HUPCL is enabled */
@@ -3413,6 +3458,10 @@
 		       (unsigned long)info->icount.tx,
 		       (unsigned long)info->icount.rx);
 
+	ret += sprintf(buf+ret, " rx_pend:%lu/%lu",
+		       (unsigned long)info->recv_cnt,
+		       (unsigned long)info->max_recv_cnt);
+
 	if (info->icount.frame)
 		ret += sprintf(buf+ret, " fe:%lu",
 			       (unsigned long)info->icount.frame);
@@ -3581,9 +3630,8 @@
 		init_waitqueue_head(&info->close_wait);
 		info->xmit.buf = NULL;
 		info->xmit.tail = info->xmit.head = 0;
-		info->recv.buf = NULL;
-		info->recv.tail = info->recv.head = 0;
-		info->flag_buf = NULL;
+		info->first_recv_buffer = info->last_recv_buffer = NULL;
+		info->recv_cnt = info->max_recv_cnt = 0;
 		info->last_tx_active_usec = 0;
 		info->last_tx_active = 0;
 
diff -urN linux-2.4.18-pre8/arch/cris/drivers/serial.h linux/arch/cris/drivers/serial.h
--- linux-2.4.18-pre8/arch/cris/drivers/serial.h	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/drivers/serial.h	Thu Feb  7 11:55:44 2002
@@ -25,6 +25,15 @@
 
 #define SERIAL_RECV_DESCRIPTORS 8
 
+struct etrax_recv_buffer {
+	struct etrax_recv_buffer *next;
+	unsigned short length;
+	unsigned char error;
+	unsigned char pad;
+
+	unsigned char buffer[0];
+};
+
 struct e100_serial {
 	int			baud;
 	volatile u8		*port; /* R_SERIALx_CTRL */
@@ -81,8 +90,10 @@
 	long			session; /* Session of opening process */
 	long			pgrp; /* pgrp of opening process */
 	struct circ_buf		xmit;
-	struct circ_buf		recv;
-	unsigned char		*flag_buf;
+	struct etrax_recv_buffer *first_recv_buffer;
+	struct etrax_recv_buffer *last_recv_buffer;
+	unsigned int		recv_cnt;
+	unsigned int		max_recv_cnt;
 
 	struct tq_struct	tqueue;
 	struct async_icount	icount;   /* error-statistics etc.*/
diff -urN linux-2.4.18-pre8/arch/cris/kernel/entry.S linux/arch/cris/kernel/entry.S
--- linux-2.4.18-pre8/arch/cris/kernel/entry.S	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/kernel/entry.S	Thu Feb  7 11:55:44 2002
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.37 2001/12/07 17:03:55 bjornw Exp $
+/* $Id: entry.S,v 1.38 2002/01/16 15:15:30 bjornw Exp $
  *
  *  linux/arch/cris/entry.S
  *
@@ -7,6 +7,9 @@
  *  Authors:	Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: entry.S,v $
+ *  Revision 1.38  2002/01/16 15:15:30  bjornw
+ *  Use a C-code compatible watchdog reset when NICE_DOGGY is enabled
+ *
  *  Revision 1.37  2001/12/07 17:03:55  bjornw
  *  Call a c-hook called watchdog_bite_hook instead of show_registers directly
  *
@@ -571,6 +574,16 @@
 ;; We'll see this in ksymoops dumps.
 Watchdog_bite:
 
+#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
+	;; We just restart the watchdog here to be sure we dont get
+	;; hit while printing the watchdogmsg below
+	;; This restart is compatible with the rest of the C-code, so
+	;; the C-code can keep restarting the watchdog after this point.
+	;; The non-NICE_DOGGY code below though, disables the possibility
+	;; to restart since it changes the watchdog key, to avoid any
+	;; buggy loops etc. keeping the watchdog alive after this.
+	jsr	reset_watchdog
+#else
 ;; We need to extend the 3.3ms after the NMI at watchdog bite, so we have
 ;; time for an oops-dump over a 115k2 serial wire.  Another 100ms should do.
 
@@ -587,7 +600,8 @@
 			    ^ WD_INIT)					\
 		| IO_STATE (R_WATCHDOG, enable, start), $r10
 	move.d	$r10, [$r11]
-
+#endif
+	
 ;; Note that we don't do "setf m" here (or after two necessary NOPs),
 ;; since *not* doing that saves us from re-entrancy checks.  We don't want
 ;; to get here again due to possible subsequent NMIs; we want the watchdog
diff -urN linux-2.4.18-pre8/arch/cris/kernel/ksyms.c linux/arch/cris/kernel/ksyms.c
--- linux-2.4.18-pre8/arch/cris/kernel/ksyms.c	Thu Feb  7 11:55:33 2002
+++ linux/arch/cris/kernel/ksyms.c	Thu Feb  7 11:55:44 2002
@@ -40,7 +40,6 @@
 EXPORT_SYMBOL(memmove);
 EXPORT_SYMBOL(strtok);
 EXPORT_SYMBOL(strpbrk);
-EXPORT_SYMBOL(simple_strtol);
 EXPORT_SYMBOL(strstr);
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strchr);
diff -urN linux-2.4.18-pre8/arch/i386/kernel/i386_ksyms.c linux/arch/i386/kernel/i386_ksyms.c
--- linux-2.4.18-pre8/arch/i386/kernel/i386_ksyms.c	Thu Feb  7 11:55:34 2002
+++ linux/arch/i386/kernel/i386_ksyms.c	Thu Feb  7 11:55:45 2002
@@ -95,7 +95,6 @@
 
 EXPORT_SYMBOL(strtok);
 EXPORT_SYMBOL(strpbrk);
-EXPORT_SYMBOL(simple_strtol);
 EXPORT_SYMBOL(strstr);
 
 EXPORT_SYMBOL(strncpy_from_user);
diff -urN linux-2.4.18-pre8/arch/i386/kernel/pci-irq.c linux/arch/i386/kernel/pci-irq.c
--- linux-2.4.18-pre8/arch/i386/kernel/pci-irq.c	Sun Nov  4 09:31:58 2001
+++ linux/arch/i386/kernel/pci-irq.c	Thu Feb  7 11:55:45 2002
@@ -225,12 +225,12 @@
  */
 static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
-	return read_config_nybble(router, 0x5C, pirq-1);
+	return read_config_nybble(router, 0x5C, (pirq-1)^1);
 }
 
 static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-	write_config_nybble(router, 0x5C, pirq-1, irq);
+	write_config_nybble(router, 0x5C, (pirq-1)^1, irq);
 	return 1;
 }
 
diff -urN linux-2.4.18-pre8/arch/i386/kernel/pci-pc.c linux/arch/i386/kernel/pci-pc.c
--- linux-2.4.18-pre8/arch/i386/kernel/pci-pc.c	Thu Feb  7 11:55:34 2002
+++ linux/arch/i386/kernel/pci-pc.c	Thu Feb  7 11:55:45 2002
@@ -1129,7 +1129,7 @@
 
 	pci_read_config_byte(d, where, &v);
 	if (v & 0xe0) {
-		printk("Trying to stomp on VIA Northbridge bug...\n");
+		printk("Disabling VIA memory write queue: [%02x] %02x->%02x\n", where, v, v & 0x1f);
 		v &= 0x1f; /* clear bits 5, 6, 7 */
 		pci_write_config_byte(d, where, v);
 	}
diff -urN linux-2.4.18-pre8/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
--- linux-2.4.18-pre8/arch/i386/kernel/setup.c	Thu Feb  7 11:55:34 2002
+++ linux/arch/i386/kernel/setup.c	Thu Feb  7 11:55:45 2002
@@ -329,10 +329,6 @@
 	{ "dma2", 0xc0, 0xdf, IORESOURCE_BUSY },
 	{ "fpu", 0xf0, 0xff, IORESOURCE_BUSY }
 };
-#ifdef CONFIG_ELAN
-standard_io_resources[1] = { "pic1", 0x20, 0x21, IORESOURCE_BUSY };
-standard_io_resources[5] = { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY };
-#endif
 
 #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource))
 
diff -urN linux-2.4.18-pre8/arch/mips/kernel/mips_ksyms.c linux/arch/mips/kernel/mips_ksyms.c
--- linux-2.4.18-pre8/arch/mips/kernel/mips_ksyms.c	Sun Sep  9 10:43:01 2001
+++ linux/arch/mips/kernel/mips_ksyms.c	Thu Feb  7 11:55:45 2002
@@ -51,7 +51,6 @@
 EXPORT_SYMBOL_NOVERS(memset);
 EXPORT_SYMBOL_NOVERS(memcpy);
 EXPORT_SYMBOL_NOVERS(memmove);
-EXPORT_SYMBOL(simple_strtol);
 EXPORT_SYMBOL_NOVERS(strcat);
 EXPORT_SYMBOL_NOVERS(strchr);
 EXPORT_SYMBOL_NOVERS(strlen);
diff -urN linux-2.4.18-pre8/arch/mips64/kernel/mips64_ksyms.c linux/arch/mips64/kernel/mips64_ksyms.c
--- linux-2.4.18-pre8/arch/mips64/kernel/mips64_ksyms.c	Sun Sep  9 10:43:01 2001
+++ linux/arch/mips64/kernel/mips64_ksyms.c	Thu Feb  7 11:55:45 2002
@@ -48,7 +48,6 @@
 EXPORT_SYMBOL_NOVERS(memset);
 EXPORT_SYMBOL_NOVERS(memcpy);
 EXPORT_SYMBOL_NOVERS(memmove);
-EXPORT_SYMBOL(simple_strtol);
 EXPORT_SYMBOL_NOVERS(strcat);
 EXPORT_SYMBOL_NOVERS(strchr);
 EXPORT_SYMBOL_NOVERS(strlen);
diff -urN linux-2.4.18-pre8/arch/sh/kernel/sh_ksyms.c linux/arch/sh/kernel/sh_ksyms.c
--- linux-2.4.18-pre8/arch/sh/kernel/sh_ksyms.c	Sat Sep  8 12:29:09 2001
+++ linux/arch/sh/kernel/sh_ksyms.c	Thu Feb  7 11:55:45 2002
@@ -39,8 +39,6 @@
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
 
-EXPORT_SYMBOL(simple_strtol);
-
 EXPORT_SYMBOL(strtok);
 EXPORT_SYMBOL(strpbrk);
 EXPORT_SYMBOL(strstr);
diff -urN linux-2.4.18-pre8/arch/sparc64/kernel/pci_common.c linux/arch/sparc64/kernel/pci_common.c
--- linux-2.4.18-pre8/arch/sparc64/kernel/pci_common.c	Thu Feb  7 11:55:36 2002
+++ linux/arch/sparc64/kernel/pci_common.c	Thu Feb  7 11:55:46 2002
@@ -1,4 +1,4 @@
-/* $Id: pci_common.c,v 1.27.2.1 2002/01/14 05:46:47 davem Exp $
+/* $Id: pci_common.c,v 1.27.2.2 2002/02/01 00:56:44 davem Exp $
  * pci_common.c: PCI controller common support.
  *
  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -669,6 +669,20 @@
 	unsigned int prom_irq;
 	int prom_node = pcp->prom_node;
 	int err;
+
+	/* If this is an empty EBUS device, sometimes OBP fails to
+	 * give it a valid fully specified interrupts property.
+	 * The EBUS hooked up to SunHME on PCI I/O boards of
+	 * Ex000 systems is one such case.
+	 *
+	 * The interrupt is not important so just ignore it.
+	 */
+	if (pdev->vendor == PCI_VENDOR_ID_SUN &&
+	    pdev->device == PCI_DEVICE_ID_SUN_EBUS &&
+	    !prom_getchild(prom_node)) {
+		pdev->irq = 0;
+		return;
+	}
 
 	err = prom_getproperty(prom_node, "interrupts",
 			       (char *)&prom_irq, sizeof(prom_irq));
diff -urN linux-2.4.18-pre8/arch/sparc64/kernel/pci_psycho.c linux/arch/sparc64/kernel/pci_psycho.c
--- linux-2.4.18-pre8/arch/sparc64/kernel/pci_psycho.c	Thu Feb  7 11:55:36 2002
+++ linux/arch/sparc64/kernel/pci_psycho.c	Thu Feb  7 11:55:46 2002
@@ -1,4 +1,4 @@
-/* $Id: pci_psycho.c,v 1.30.2.1 2002/01/05 07:32:29 davem Exp $
+/* $Id: pci_psycho.c,v 1.30.2.2 2002/02/01 00:57:47 davem Exp $
  * pci_psycho.c: PSYCHO/U2P specific PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -13,7 +13,6 @@
 #include <linux/slab.h>
 
 #include <asm/pbm.h>
-#include <asm/fhc.h>
 #include <asm/iommu.h>
 #include <asm/irq.h>
 #include <asm/starfire.h>
@@ -1491,8 +1490,6 @@
 	} else {
 		pbm = &p->pbm_B;
 		pbm->pci_first_slot = 2;
-		if (central_bus != NULL)
-			pbm->pci_first_slot = 1;
 		pbm->io_space.start = p->controller_regs + PSYCHO_IOSPACE_B;
 		pbm->mem_space.start = p->controller_regs + PSYCHO_MEMSPACE_B;
 	}
diff -urN linux-2.4.18-pre8/arch/sparc64/kernel/smp.c linux/arch/sparc64/kernel/smp.c
--- linux-2.4.18-pre8/arch/sparc64/kernel/smp.c	Thu Feb  7 11:55:36 2002
+++ linux/arch/sparc64/kernel/smp.c	Thu Feb  7 11:55:46 2002
@@ -269,7 +269,7 @@
 			continue;
 
 		if ((cpucount + 1) == max_cpus)
-			break;
+			goto ignorecpu;
 		if (cpu_present_map & (1UL << i)) {
 			unsigned long entry = (unsigned long)(&sparc64_cpu_startup);
 			unsigned long cookie = (unsigned long)(&cpu_new_task);
@@ -314,13 +314,15 @@
 			}
 		}
 		if (!callin_flag) {
+ignorecpu:
 			cpu_present_map &= ~(1UL << i);
 			__cpu_number_map[i] = -1;
 		}
 	}
 	cpu_new_task = NULL;
 	if (cpucount == 0) {
-		printk("Error: only one processor found.\n");
+		if (max_cpus != 1)
+			printk("Error: only one processor found.\n");
 		cpu_present_map = (1UL << smp_processor_id());
 	} else {
 		unsigned long bogosum = 0;
diff -urN linux-2.4.18-pre8/drivers/char/sonypi.c linux/drivers/char/sonypi.c
--- linux-2.4.18-pre8/drivers/char/sonypi.c	Thu Feb  7 11:55:37 2002
+++ linux/drivers/char/sonypi.c	Thu Feb  7 11:55:46 2002
@@ -290,19 +290,38 @@
 	sonypi_device.camera_power = 1;
 }
 
+/* sets the bluetooth subsystem power state */
+static void sonypi_setbluetoothpower(u8 state) {
+
+	state = (state != 0);
+	if (sonypi_device.bluetooth_power && state) 
+		return;
+	if (!sonypi_device.bluetooth_power && !state) 
+		return;
+	
+	sonypi_call2(0x96, state);
+	sonypi_call1(0x93);
+	sonypi_device.bluetooth_power = state;
+}
+
 /* Interrupt handler: some event is available */
 void sonypi_irq(int irq, void *dev_id, struct pt_regs *regs) {
 	u8 v1, v2, event = 0;
 	int i;
 	u8 sonypi_jogger_ev, sonypi_fnkey_ev;
+	u8 sonypi_capture_ev, sonypi_bluetooth_ev;
 
 	if (sonypi_device.model == SONYPI_DEVICE_MODEL_TYPE2) {
 		sonypi_jogger_ev = SONYPI_TYPE2_JOGGER_EV;
 		sonypi_fnkey_ev = SONYPI_TYPE2_FNKEY_EV;
+		sonypi_capture_ev = SONYPI_TYPE2_CAPTURE_EV;
+		sonypi_bluetooth_ev = SONYPI_TYPE2_BLUETOOTH_EV;
 	}
 	else {
 		sonypi_jogger_ev = SONYPI_TYPE1_JOGGER_EV;
 		sonypi_fnkey_ev = SONYPI_TYPE1_FNKEY_EV;
+		sonypi_capture_ev = SONYPI_TYPE1_CAPTURE_EV;
+		sonypi_bluetooth_ev = SONYPI_TYPE1_BLUETOOTH_EV;
 	}
 
 	v1 = inb_p(sonypi_device.ioport1);
@@ -322,7 +341,7 @@
 				goto found;
 			}
 	}
-	if ((v2 & SONYPI_CAPTURE_EV) == SONYPI_CAPTURE_EV) {
+	if ((v2 & sonypi_capture_ev) == sonypi_capture_ev) {
 		for (i = 0; sonypi_captureev[i].event; i++)
 			if (sonypi_captureev[i].data == v1) {
 				event = sonypi_captureev[i].event;
@@ -336,7 +355,7 @@
 				goto found;
 			}
 	}
-	if ((v2 & SONYPI_BLUETOOTH_EV) == SONYPI_BLUETOOTH_EV) {
+	if ((v2 & sonypi_bluetooth_ev) == sonypi_bluetooth_ev) {
 		for (i = 0; sonypi_blueev[i].event; i++)
 			if (sonypi_blueev[i].data == v1) {
 				event = sonypi_blueev[i].event;
@@ -568,6 +587,20 @@
 			goto out;
 		}
 		break;
+	case SONYPI_IOCGBLUE:
+		val8 = sonypi_device.bluetooth_power;
+		if (copy_to_user((u8 *)arg, &val8, sizeof(val8))) {
+			ret = -EFAULT;
+			goto out;
+		}
+		break;
+	case SONYPI_IOCSBLUE:
+		if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) {
+			ret = -EFAULT;
+			goto out;
+		}
+		sonypi_setbluetoothpower(val8);
+		break;
 	default:
 		ret = -EINVAL;
 	}
@@ -602,6 +635,7 @@
 		sonypi_device.model = SONYPI_DEVICE_MODEL_TYPE2;
 	sonypi_initq();
 	init_MUTEX(&sonypi_device.lock);
+	sonypi_device.bluetooth_power = 0;
 	
 	if (pcidev && pci_enable_device(pcidev)) {
 		printk(KERN_ERR "sonypi: pci_enable_device failed\n");
diff -urN linux-2.4.18-pre8/drivers/char/sonypi.h linux/drivers/char/sonypi.h
--- linux-2.4.18-pre8/drivers/char/sonypi.h	Thu Feb  7 11:55:37 2002
+++ linux/drivers/char/sonypi.h	Thu Feb  7 11:55:46 2002
@@ -34,8 +34,8 @@
 
 #ifdef __KERNEL__
 
-#define SONYPI_DRIVER_MAJORVERSION	1
-#define SONYPI_DRIVER_MINORVERSION	9
+#define SONYPI_DRIVER_MAJORVERSION	 1
+#define SONYPI_DRIVER_MINORVERSION	10
 
 #include <linux/types.h>
 #include <linux/pci.h>
@@ -132,15 +132,17 @@
 #define SONYPI_CAMERA_ROMVERSION 		9
 
 /* key press event data (ioport2) */
-#define SONYPI_TYPE1_JOGGER_EV	0x10
-#define SONYPI_TYPE2_JOGGER_EV	0x08
-#define SONYPI_CAPTURE_EV	0x60
-#define SONYPI_TYPE1_FNKEY_EV	0x20
-#define SONYPI_TYPE2_FNKEY_EV	0x08
-#define SONYPI_BLUETOOTH_EV	0x30
-#define SONYPI_TYPE1_PKEY_EV	0x40
-#define SONYPI_BACK_EV		0x08
-#define SONYPI_LID_EV		0x38
+#define SONYPI_TYPE1_JOGGER_EV		0x10
+#define SONYPI_TYPE2_JOGGER_EV		0x08
+#define SONYPI_TYPE1_CAPTURE_EV		0x60
+#define SONYPI_TYPE2_CAPTURE_EV		0x08
+#define SONYPI_TYPE1_FNKEY_EV		0x20
+#define SONYPI_TYPE2_FNKEY_EV		0x08
+#define SONYPI_TYPE1_BLUETOOTH_EV	0x30
+#define SONYPI_TYPE2_BLUETOOTH_EV	0x08
+#define SONYPI_TYPE1_PKEY_EV		0x40
+#define SONYPI_BACK_EV			0x08
+#define SONYPI_LID_EV			0x38
 
 struct sonypi_event {
 	u8	data;
@@ -203,6 +205,8 @@
 /* The set of possible bluetooth events */
 static struct sonypi_event sonypi_blueev[] = {
 	{ 0x55, SONYPI_EVENT_BLUETOOTH_PRESSED },
+	{ 0x59, SONYPI_EVENT_BLUETOOTH_ON },
+	{ 0x5a, SONYPI_EVENT_BLUETOOTH_OFF },
 	{ 0x00, 0x00 }
 };
 
@@ -241,6 +245,7 @@
 	u16 ioport2;
 	u16 region_size;
 	int camera_power;
+	int bluetooth_power;
 	struct semaphore lock;
 	struct sonypi_queue queue;
 	int open_count;
diff -urN linux-2.4.18-pre8/drivers/isdn/hisax/md5sums.asc linux/drivers/isdn/hisax/md5sums.asc
--- linux-2.4.18-pre8/drivers/isdn/hisax/md5sums.asc	Wed Oct 24 15:34:51 2001
+++ linux/drivers/isdn/hisax/md5sums.asc	Thu Feb  7 11:55:46 2002
@@ -1,3 +1,6 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
 # This are valid md5sums for certificated HiSax driver.
 # The certification is valid only if the md5sums of all files match.
 # The certification is valid only for ELSA Microlink PCI,
@@ -6,17 +9,25 @@
 # in the moment.
 # Read ../../../Documentation/isdn/HiSax.cert for more informations.
 # 
-d08b59f56fb9ed1fbd17713342c75081  isac.c
-e81e6e96f307e55f8b9777aca2b356d9  isdnl1.c
-cfd2527d9fb01885484cba74bfc67121  isdnl2.c
-8c6829f11459f9d044b5768803fb646d  isdnl3.c
-d40f88dff4191d2660240749cbdcb688  tei.c
-3bd3bd05ee4cb25ffe046200b569a83a  callc.c
-d518f52402ebc3f1be84e09af375313c  cert.c
-c425de1f8be86e84006de63c9bb3cc5f  l3dss1.c
-4c411e29d4103ba60e9af4e3e1234a99  l3_1tr6.c
-68c6cc2784f208e3247a5a555918d014  elsa.c
-8d63a85d7222cf7b40e663e543191d8f  diva.c
-8c8cb4ce621fb84d8e337a696e75b0df  sedlbauer.c
-ebe5613d535748409407568435b2be97  hfc_pci.c
+cd4a9917e1147039d5dfc66440d42054  isac.c
+211840e78b56c9d4753be9c85da21a50  isdnl1.c
+5ce9b1fff42a02f9c2eb4fb81c701b1f  isdnl2.c
+6948de0c43513dd23c6706feb5fc2209  isdnl3.c
+3730780b69368218d756024165efea79  tei.c
+16e72710eb58da01415b877490f5d2ac  callc.c
+6abc55c77e0f3149ae9334f3257a1a1a  cert.c
+27bdb2800d4590e00da20eff241edc47  l3dss1.c
+df8bb877b854c4302d396b554e4e84ef  l3_1tr6.c
+3d22d2f2fe9af693eb3b471beecf596d  elsa.c
+fd6aedade5b5bbd73683a3de878b76d2  diva.c
+def8d69efd25186878dc123df73d9319  sedlbauer.c
+6c5bd0fdc59f33319823fa5367357983  hfc_pci.c
 # end of md5sums
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.0.6 (GNU/Linux)
+Comment: For info see http://www.gnupg.org
+
+iD8DBQE8UYO9DiY0VZsg4ukRAqLzAKCKK7rFSNAWpBMtpJZ0kYvF+y+b1wCZAY8u
+hf6AL732sGhUsfRpwwdENVU=
+=B3yd
+-----END PGP SIGNATURE-----
diff -urN linux-2.4.18-pre8/drivers/isdn/isdn_audio.c linux/drivers/isdn/isdn_audio.c
--- linux-2.4.18-pre8/drivers/isdn/isdn_audio.c	Fri Dec 21 09:41:54 2001
+++ linux/drivers/isdn/isdn_audio.c	Thu Feb  7 11:55:46 2002
@@ -228,7 +228,7 @@
 	:	"memory", "ax");
 #else
 	while (n--)
-		*buff++ = table[*(unsigned char *)buff];
+		*buff = table[*(unsigned char *)buff], buff++;
 #endif
 }
 
diff -urN linux-2.4.18-pre8/drivers/net/8139too.c linux/drivers/net/8139too.c
--- linux-2.4.18-pre8/drivers/net/8139too.c	Thu Feb  7 11:55:37 2002
+++ linux/drivers/net/8139too.c	Thu Feb  7 11:55:47 2002
@@ -3,7 +3,7 @@
 	8139too.c: A RealTek RTL-8139 Fast Ethernet driver for Linux.
 
 	Maintained by Jeff Garzik <jgarzik@mandrakesoft.com>
-	Copyright 2000,2001 Jeff Garzik
+	Copyright 2000-2002 Jeff Garzik
 
 	Much code comes from Donald Becker's rtl8139.c driver,
 	versions 1.13 and older.  This driver was originally based
@@ -92,7 +92,7 @@
 */
 
 #define DRV_NAME	"8139too"
-#define DRV_VERSION	"0.9.23"
+#define DRV_VERSION	"0.9.24"
 
 
 #include <linux/config.h>
@@ -215,6 +215,7 @@
 	ADDTRON8139,
 	DFE538TX,
 	DFE690TXD,
+	FE2000VX,
 	RTL8129,
 } board_t;
 
@@ -232,6 +233,7 @@
 	{ "Addtron Technolgy 8139 10/100BaseTX", RTL8139_CAPS },
 	{ "D-Link DFE-538TX (RealTek RTL8139)", RTL8139_CAPS },
 	{ "D-Link DFE-690TXD (RealTek RTL8139)", RTL8139_CAPS },
+	{ "AboCom FE2000VX (RealTek RTL8139)", RTL8139_CAPS },
 	{ "RealTek RTL8129", RTL8129_CAPS },
 };
 
@@ -245,6 +247,7 @@
 	{0x4033, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ADDTRON8139 },
 	{0x1186, 0x1300, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE538TX },
 	{0x1186, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, DFE690TXD },
+	{0x13d1, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, FE2000VX },
 
 #ifdef CONFIG_8139TOO_8129
 	{0x10ec, 0x8129, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8129 },
@@ -256,6 +259,7 @@
 	 */
 	{PCI_ANY_ID, 0x8139, 0x10ec, 0x8139, 0, 0, RTL8139 },
 	{PCI_ANY_ID, 0x8139, 0x1186, 0x1300, 0, 0, DFE538TX },
+	{PCI_ANY_ID, 0x8139, 0x13d1, 0xab06, 0, 0, FE2000VX },
 
 	{0,}
 };
diff -urN linux-2.4.18-pre8/drivers/net/Config.in linux/drivers/net/Config.in
--- linux-2.4.18-pre8/drivers/net/Config.in	Thu Feb  7 11:55:37 2002
+++ linux/drivers/net/Config.in	Thu Feb  7 11:55:47 2002
@@ -77,7 +77,6 @@
    fi
    dep_tristate '  Sun BigMAC 10/100baseT support (EXPERIMENTAL)' CONFIG_SUNBMAC $CONFIG_SBUS $CONFIG_EXPERIMENTAL
    dep_tristate '  Sun QuadEthernet support' CONFIG_SUNQE $CONFIG_SBUS
-   dep_tristate '  Sun LANCE support' CONFIG_SUNLANCE $CONFIG_SBUS
    dep_tristate '  Sun GEM support' CONFIG_SUNGEM $CONFIG_PCI
    bool '  3COM cards' CONFIG_NET_VENDOR_3COM
    if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
diff -urN linux-2.4.18-pre8/drivers/net/arcnet/com90io.c linux/drivers/net/arcnet/com90io.c
--- linux-2.4.18-pre8/drivers/net/arcnet/com90io.c	Sun Nov  4 09:31:58 2001
+++ linux/drivers/net/arcnet/com90io.c	Thu Feb  7 11:55:47 2002
@@ -241,7 +241,10 @@
 		return -ENODEV;
 	}
 	/* Reserve the I/O region - guaranteed to work by check_region */
-	request_region(dev->base_addr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)");
+	if (!request_region(dev->base_addr, ARCNET_TOTAL_SIZE, "arcnet (COM90xx-IO)")) {
+		free_irq(dev->irq, dev);
+		return -EBUSY;
+	}
 
 	/* Initialize the rest of the device structure. */
 	dev->priv = kmalloc(sizeof(struct arcnet_local), GFP_KERNEL);
diff -urN linux-2.4.18-pre8/drivers/net/au1000_eth.c linux/drivers/net/au1000_eth.c
--- linux-2.4.18-pre8/drivers/net/au1000_eth.c	Thu Feb  7 11:55:37 2002
+++ linux/drivers/net/au1000_eth.c	Thu Feb  7 11:55:47 2002
@@ -1150,12 +1150,17 @@
 
 	/* fixme */
 	switch(cmd) { 
-		case SIOCDEVPRIVATE:		/* Get the address of the PHY in use. */
+		case SIOCGMIIPHY:		/* Get the address of the PHY in use. */
+		case SIOCDEVPRIVATE:		/* binary compat, remove in 2.5 */
 		data[0] = PHY_ADDRESS;
-		case SIOCDEVPRIVATE+1:		/* Read the specified MII register. */
+
+		case SIOCGMIIREG:		/* Read the specified MII register. */
+		case SIOCDEVPRIVATE+1:		/* binary compat, remove in 2.5 */
 		//data[3] = mdio_read(ioaddr, data[0], data[1]); 
 		return 0;
-		case SIOCDEVPRIVATE+2:		/* Write the specified MII register */
+
+		case SIOCSMIIREG:		/* Write the specified MII register */
+		case SIOCDEVPRIVATE+2:		/* binary compat, remove in 2.5 */
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
 		//mdio_write(ioaddr, data[0], data[1], data[2]);
diff -urN linux-2.4.18-pre8/drivers/net/epic100.c linux/drivers/net/epic100.c
--- linux-2.4.18-pre8/drivers/net/epic100.c	Thu Feb  7 11:55:38 2002
+++ linux/drivers/net/epic100.c	Thu Feb  7 11:55:47 2002
@@ -57,11 +57,14 @@
 	* implement ETHTOOL_[GS]SET, _NWAY_RST, _[GS]MSGLVL, _GLINK (jgarzik)
 	* replace some MII-related magic numbers with constants
 
+	LK1.1.12:
+	* fix power-up sequence
+
 */
 
 #define DRV_NAME	"epic100"
-#define DRV_VERSION	"1.11+LK1.1.11"
-#define DRV_RELDATE	"Nov 17, 2001"
+#define DRV_VERSION	"1.11+LK1.1.12"
+#define DRV_RELDATE	"Jan 18, 2002"
 
 
 /* The user-configurable values.
@@ -674,9 +677,8 @@
 	   required by the details of which bits are reset and the transceiver
 	   wiring on the Ositech CardBus card.
 	*/
-#if 0
-	outl(dev->if_port == 1 ? 0x13 : 0x12, ioaddr + MIICfg);
-#endif
+
+	outl(0x12, ioaddr + MIICfg);
 	if (ep->chip_flags & MII_PWRDWN)
 		outl((inl(ioaddr + NVCTL) & ~0x003C) | 0x4800, ioaddr + NVCTL);
 
diff -urN linux-2.4.18-pre8/drivers/net/hamradio/yam.c linux/drivers/net/hamradio/yam.c
--- linux-2.4.18-pre8/drivers/net/hamradio/yam.c	Sun Sep 30 12:26:08 2001
+++ linux/drivers/net/hamradio/yam.c	Thu Feb  7 11:55:47 2002
@@ -308,7 +308,7 @@
 static void delay(int ms)
 {
 	unsigned long timeout = jiffies + ((ms * HZ) / 1000);
-	while (jiffies < timeout);
+	while (time_before(jiffies, timeout));
 }
 
 /*
diff -urN linux-2.4.18-pre8/drivers/net/mii.c linux/drivers/net/mii.c
--- linux-2.4.18-pre8/drivers/net/mii.c	Thu Feb  7 11:55:38 2002
+++ linux/drivers/net/mii.c	Thu Feb  7 11:55:47 2002
@@ -168,6 +168,10 @@
 	return r;
 }
 
+MODULE_AUTHOR ("Jeff Garzik <jgarzik@mandrakesoft.com>");
+MODULE_DESCRIPTION ("MII hardware support library");
+MODULE_LICENSE("GPL");
+
 EXPORT_SYMBOL(mii_link_ok);
 EXPORT_SYMBOL(mii_nway_restart);
 EXPORT_SYMBOL(mii_ethtool_gset);
diff -urN linux-2.4.18-pre8/drivers/net/ppp_generic.c linux/drivers/net/ppp_generic.c
--- linux-2.4.18-pre8/drivers/net/ppp_generic.c	Thu Oct 11 09:18:31 2001
+++ linux/drivers/net/ppp_generic.c	Thu Feb  7 11:55:47 2002
@@ -166,11 +166,11 @@
  */
 
 /*
- * all_ppp_lock protects the all_ppp_units.
+ * all_ppp_sem protects the all_ppp_units.
  * It also ensures that finding a ppp unit in the all_ppp_units list
  * and updating its file.refcnt field is atomic.
  */
-static spinlock_t all_ppp_lock = SPIN_LOCK_UNLOCKED;
+static DECLARE_MUTEX(all_ppp_sem);
 static LIST_HEAD(all_ppp_units);
 
 /*
@@ -706,11 +706,11 @@
 		/* Attach to an existing ppp unit */
 		if (get_user(unit, (int *) arg))
 			break;
-		spin_lock(&all_ppp_lock);
+		down(&all_ppp_sem);
 		ppp = ppp_find_unit(unit);
 		if (ppp != 0)
 			atomic_inc(&ppp->file.refcnt);
-		spin_unlock(&all_ppp_lock);
+		up(&all_ppp_sem);
 		err = -ENXIO;
 		if (ppp == 0)
 			break;
@@ -1528,6 +1528,7 @@
 			   error indication. */
 			if (len == DECOMP_FATALERROR)
 				ppp->rstate |= SC_DC_FERROR;
+			kfree_skb(ns);
 			goto err;
 		}
 
@@ -2199,7 +2200,7 @@
 	int ret = -EEXIST;
 	int i;
 
-	spin_lock(&all_ppp_lock);
+	down(&all_ppp_sem);
 	list = &all_ppp_units;
 	while ((list = list->next) != &all_ppp_units) {
 		ppp = list_entry(list, struct ppp, file.list);
@@ -2215,11 +2216,11 @@
 
 	/* Create a new ppp structure and link it before `list'. */
 	ret = -ENOMEM;
-	ppp = kmalloc(sizeof(struct ppp), GFP_ATOMIC);
+	ppp = kmalloc(sizeof(struct ppp), GFP_KERNEL);
 	if (ppp == 0)
 		goto out;
 	memset(ppp, 0, sizeof(struct ppp));
-	dev = kmalloc(sizeof(struct net_device), GFP_ATOMIC);
+	dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
 	if (dev == 0) {
 		kfree(ppp);
 		goto out;
@@ -2258,7 +2259,7 @@
 
 	list_add(&ppp->file.list, list->prev);
  out:
-	spin_unlock(&all_ppp_lock);
+ 	up(&all_ppp_sem);
 	*retp = ret;
 	if (ret != 0)
 		ppp = 0;
@@ -2286,7 +2287,7 @@
 	struct net_device *dev;
 	int n_channels ;
 
-	spin_lock(&all_ppp_lock);
+	down(&all_ppp_sem);
 	list_del(&ppp->file.list);
 
 	/* Last fd open to this ppp unit is being closed or detached:
@@ -2326,19 +2327,19 @@
 
 	/*
 	 * We can't acquire any new channels (since we have the
-	 * all_ppp_lock) so if n_channels is 0, we can free the
+	 * all_ppp_sem) so if n_channels is 0, we can free the
 	 * ppp structure.  Otherwise we leave it around until the
 	 * last channel disconnects from it.
 	 */
 	if (n_channels == 0) 
 		kfree(ppp);
 
-	spin_unlock(&all_ppp_lock);
+	up(&all_ppp_sem);
 }
 
 /*
  * Locate an existing ppp unit.
- * The caller should have locked the all_ppp_lock.
+ * The caller must have locked the all_ppp_sem.
  */
 static struct ppp *
 ppp_find_unit(int unit)
@@ -2384,7 +2385,7 @@
 	int ret = -ENXIO;
 	int hdrlen;
 
-	spin_lock(&all_ppp_lock);
+	down(&all_ppp_sem);
 	ppp = ppp_find_unit(unit);
 	if (ppp == 0)
 		goto out;
@@ -2413,7 +2414,7 @@
  outwl:
 	write_unlock_bh(&pch->upl);
  out:
-	spin_unlock(&all_ppp_lock);
+ 	up(&all_ppp_sem);
 	return ret;
 }
 
diff -urN linux-2.4.18-pre8/drivers/net/sundance.c linux/drivers/net/sundance.c
--- linux-2.4.18-pre8/drivers/net/sundance.c	Thu Feb  7 11:55:38 2002
+++ linux/drivers/net/sundance.c	Thu Feb  7 11:55:47 2002
@@ -21,11 +21,15 @@
 	Version 1.01a (jgarzik):
 	- Replace some MII-related magic numbers with constants
 
+	Version 1.01b (D-Link):
+	- Add new board to PCI ID list
+	
+
 */
 
 #define DRV_NAME	"sundance"
-#define DRV_VERSION	"1.01a"
-#define DRV_RELDATE	"11-Nov-2001"
+#define DRV_VERSION	"1.01b"
+#define DRV_RELDATE	"17-Jan-2002"
 
 
 /* The user-configurable values.
@@ -222,8 +226,9 @@
 	{0x1186, 0x1002, 0x1186, 0x1002, 0, 0, 0},
 	{0x1186, 0x1002, 0x1186, 0x1003, 0, 0, 1},
 	{0x1186, 0x1002, 0x1186, 0x1012, 0, 0, 2},
-	{0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
-	{0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+	{0x1186, 0x1002, 0x1186, 0x1040, 0, 0, 3},
+	{0x1186, 0x1002, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+	{0x13F0, 0x0201, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
 	{0,}
 };
 MODULE_DEVICE_TABLE(pci, sundance_pci_tbl);
@@ -245,6 +250,8 @@
 	 {0x10031186, 0xffffffff,},
 	 PCI_IOTYPE, 128, CanHaveMII},
 	{"D-Link DFE-580TX 4 port Server Adapter", {0x10121186, 0xffffffff,},
+	 PCI_IOTYPE, 128, CanHaveMII},
+	{"D-Link DFE-530TXS FAST Ethernet Adapter", {0x10021186, 0xffffffff,},
 	 PCI_IOTYPE, 128, CanHaveMII},
 	{"D-Link DL10050-based FAST Ethernet Adapter",
 	 {0x10021186, 0xffffffff,},
diff -urN linux-2.4.18-pre8/drivers/net/sungem.c linux/drivers/net/sungem.c
--- linux-2.4.18-pre8/drivers/net/sungem.c	Thu Feb  7 11:55:38 2002
+++ linux/drivers/net/sungem.c	Thu Feb  7 11:55:47 2002
@@ -1,4 +1,4 @@
-/* $Id: sungem.c,v 1.44.2.3 2002/01/23 15:40:01 davem Exp $
+/* $Id: sungem.c,v 1.44.2.5 2002/02/01 21:45:52 davem Exp $
  * sungem.c: Sun GEM ethernet driver.
  *
  * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
@@ -290,16 +290,26 @@
 static int gem_rxmac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
 {
 	u32 rxmac_stat = readl(gp->regs + MAC_RXSTAT);
+	int ret = 0;
 
 	if (netif_msg_intr(gp))
 		printk(KERN_DEBUG "%s: rxmac interrupt, rxmac_stat: 0x%x\n",
 			gp->dev->name, rxmac_stat);
 
 	if (rxmac_stat & MAC_RXSTAT_OFLW) {
-		printk(KERN_ERR "%s: RX MAC fifo overflow.\n",
-		       dev->name);
+		u32 smac = readl(gp->regs + MAC_SMACHINE);
+
+		printk(KERN_ERR "%s: RX MAC fifo overflow smac[%08x].\n",
+		       dev->name, smac);
 		gp->net_stats.rx_over_errors++;
 		gp->net_stats.rx_fifo_errors++;
+
+		if (((smac >> 24) & 0x7) == 0x7) {
+			/* Due to a bug, the chip is hung in this case
+			 * and a full reset is necessary.
+			 */
+			ret = 1;
+		}
 	}
 
 	if (rxmac_stat & MAC_RXSTAT_ACE)
@@ -314,7 +324,7 @@
 	/* We do not track MAC_RXSTAT_FCE and MAC_RXSTAT_VCE
 	 * events.
 	 */
-	return 0;
+	return ret;
 }
 
 static int gem_mac_interrupt(struct net_device *dev, struct gem *gp, u32 gem_status)
@@ -474,7 +484,7 @@
 	return 0;
 
 do_reset:
-	gp->reset_task_pending = 1;
+	gp->reset_task_pending = 2;
 	schedule_task(&gp->reset_task);
 
 	return 1;
@@ -1176,7 +1186,8 @@
 		/* Reset the chip & rings */
 		gem_stop(gp);
 		gem_init_rings(gp, 0);
-		gem_init_hw(gp, 0);
+		gem_init_hw(gp,
+			    (gp->reset_task_pending == 2));
 
 		netif_wake_queue(gp->dev);
 	}
diff -urN linux-2.4.18-pre8/drivers/net/wan/cosa.c linux/drivers/net/wan/cosa.c
--- linux-2.4.18-pre8/drivers/net/wan/cosa.c	Thu Sep 13 16:04:43 2001
+++ linux/drivers/net/wan/cosa.c	Thu Feb  7 11:55:47 2002
@@ -105,13 +105,6 @@
 #include <net/syncppp.h>
 #include "cosa.h"
 
-/* Linux version stuff */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1)
-typedef struct wait_queue *wait_queue_head_t;
-#define DECLARE_WAITQUEUE(wait, current) \
-	struct wait_queue wait = { current, NULL }
-#endif
-
 /* Maximum length of the identification string. */
 #define COSA_MAX_ID_STRING	128
 
diff -urN linux-2.4.18-pre8/drivers/sbus/char/aurora.c linux/drivers/sbus/char/aurora.c
--- linux-2.4.18-pre8/drivers/sbus/char/aurora.c	Thu Feb  7 11:55:39 2002
+++ linux/drivers/sbus/char/aurora.c	Thu Feb  7 11:55:49 2002
@@ -1,4 +1,4 @@
-/*	$Id: aurora.c,v 1.18 2001/10/26 17:59:31 davem Exp $
+/*	$Id: aurora.c,v 1.18.2.1 2002/02/04 22:37:43 davem Exp $
  *	linux/drivers/sbus/char/aurora.c -- Aurora multiport driver
  *
  *	Copyright (c) 1999 by Oliver Aldulea (oli at bv dot ro)
diff -urN linux-2.4.18-pre8/drivers/scsi/3w-xxxx.c linux/drivers/scsi/3w-xxxx.c
--- linux-2.4.18-pre8/drivers/scsi/3w-xxxx.c	Thu Feb  7 11:55:39 2002
+++ linux/drivers/scsi/3w-xxxx.c	Thu Feb  7 11:55:49 2002
@@ -119,6 +119,8 @@
    1.02.00.014 - Fix bug in tw_findcards() where AEN code could be lost.
                  Increase timeout in tw_aen_drain_queue() to 30 seconds.
    1.02.00.015 - Re-write raw command post with data ioctl method.
+   1.02.00.016 - Set max_cmd_len for 3dm.
+                 Set max sectors to 256 for non raid5 & 6XXX.          
 */
 
 #include <linux/module.h>
@@ -165,7 +167,7 @@
 };
 
 /* Globals */
-char *tw_driver_version="1.02.00.015";
+char *tw_driver_version="1.02.00.016";
 TW_Device_Extension *tw_device_extension_list[TW_MAX_SLOT];
 int tw_device_extension_count = 0;
 
@@ -610,7 +612,7 @@
 	}
 } /* End tw_copy_mem_info() */
 
-/* This function will print readable messages from statsu register errors */
+/* This function will print readable messages from status register errors */
 void tw_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value)
 {
 	dprintk(KERN_WARNING "3w-xxxx: tw_decode_bits()\n");
@@ -871,9 +873,17 @@
 			/* Set max target id's */
 			host->max_id = TW_MAX_UNITS;
 
+			/* Set max cdb size in bytes */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,15)			
+			host->max_cmd_len = TW_MAX_CDB_LEN;
+#endif
+
 			/* Set max sectors per io */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,7)
-			host->max_sectors = TW_MAX_SECTORS;
+			if ((tw_dev->num_raid_five > 0) && (tw_dev->tw_pci_dev->device == TW_DEVICE_ID))
+				host->max_sectors = TW_MAX_BOUNCE_SECTORS;
+			else
+				host->max_sectors = TW_MAX_SECTORS;
 #endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4)
@@ -1321,12 +1331,12 @@
 	/* Now allocate raid5 bounce buffers */
 	if ((num_raid_five != 0) && (tw_dev->tw_pci_dev->device == TW_DEVICE_ID)) {
 		for (i=0;i<TW_MAX_BOUNCEBUF;i++) {
-			tw_allocate_memory(tw_dev, i, sizeof(TW_Sector)*TW_MAX_SECTORS, 2);
+			tw_allocate_memory(tw_dev, i, sizeof(TW_Sector)*TW_MAX_BOUNCE_SECTORS, 2);
 			if (tw_dev->bounce_buffer[i] == NULL) {
 				printk(KERN_WARNING "3w-xxxx: Bounce buffer allocation failed.\n");
 				return 1;
 			}
-			memset(tw_dev->bounce_buffer[i], 0, sizeof(TW_Sector)*TW_MAX_SECTORS);
+			memset(tw_dev->bounce_buffer[i], 0, sizeof(TW_Sector)*TW_MAX_BOUNCE_SECTORS);
 		}
 	}
   
diff -urN linux-2.4.18-pre8/drivers/scsi/3w-xxxx.h linux/drivers/scsi/3w-xxxx.h
--- linux-2.4.18-pre8/drivers/scsi/3w-xxxx.h	Thu Feb  7 11:55:39 2002
+++ linux/drivers/scsi/3w-xxxx.h	Thu Feb  7 11:55:49 2002
@@ -196,13 +196,11 @@
 #define TW_MAX_AEN_TRIES                      100
 #define TW_UNIT_ONLINE                        1
 #define TW_IN_INTR                            1
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,7)
 #define TW_MAX_SECTORS                        256
-#else
-#define TW_MAX_SECTORS                        128
-#endif 
+#define TW_MAX_BOUNCE_SECTORS                 128
 #define TW_AEN_WAIT_TIME                      1000
 #define TW_IOCTL_WAIT_TIME                    (1 * HZ) /* 1 second */
+#define TW_MAX_CDB_LEN                        16
 
 /* Macros */
 #define TW_STATUS_ERRORS(x) \
@@ -268,7 +266,9 @@
 } TW_Command;
 
 typedef struct TAG_TW_Ioctl {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,15)
 	int buffer;
+#endif
 	unsigned char opcode;
 	unsigned short table_id;
 	unsigned char parameter_id;
diff -urN linux-2.4.18-pre8/drivers/scsi/README.st linux/drivers/scsi/README.st
--- linux-2.4.18-pre8/drivers/scsi/README.st	Fri Nov  9 13:52:21 2001
+++ linux/drivers/scsi/README.st	Thu Feb  7 11:55:49 2002
@@ -1,8 +1,8 @@
 This file contains brief information about the SCSI tape driver.
-The driver is currently maintained by Kai M{kisara (email
+The driver is currently maintained by Kai Mäkisara (email
 Kai.Makisara@metla.fi)
 
-Last modified: Thu Nov  1 22:41:59 2001 by makisara@kai.makisara.local
+Last modified: Tue Feb  5 21:33:23 2002 by makisara
 
 
 BASICS
@@ -327,12 +327,19 @@
 	   0xffffff means that the default is not used any more.
 	MT_ST_DEF_DENSITY
 	MT_ST_DEF_DRVBUFFER
+	   Used to set or clear the density (8 bits), and drive buffer
+	   state (3 bits). If the value is MT_ST_CLEAR_DEFAULT
+	   (0xfffff) the default will not be used any more. Otherwise
+	   the lowermost bits of the value contain the new value of
+	   the parameter.
 	MT_ST_DEF_COMPRESSION
-	   Used to set or clear the density (8 bits), drive buffer
-	   state (3 bits), and compression (single bit). If the value is
-	   MT_ST_CLEAR_DEFAULT (0xfffff), the default will not be used
-	   any more. Otherwise the lower-most bits of the value contain
-	   the new value of the parameter.
+	   The compression default will not be used if the value of
+	   the lowermost byte is 0xff. Otherwise the lowermost bit
+	   contains the new default. If the bits 8-15 are set to a
+	   non-zero number, and this number is not 0xff, the number is
+	   used as the compression algorithm. The value
+	   MT_ST_CLEAR_DEFAULT can be used to clear the compression
+	   default.
 	MT_ST_SET_TIMEOUT
 	   Set the normal timeout in seconds for this device. The
 	   default is 900 seconds (15 minutes). The timeout should be
diff -urN linux-2.4.18-pre8/drivers/scsi/scsi_merge.c linux/drivers/scsi/scsi_merge.c
--- linux-2.4.18-pre8/drivers/scsi/scsi_merge.c	Thu Oct 25 14:05:31 2001
+++ linux/drivers/scsi/scsi_merge.c	Thu Feb  7 11:55:49 2002
@@ -150,14 +150,7 @@
 	panic("DMA pool exhausted");
 }
 
-/*
- * FIXME(eric) - the original disk code disabled clustering for MOD
- * devices.  I have no idea why we thought this was a good idea - my
- * guess is that it was an attempt to limit the size of requests to MOD
- * devices.
- */
-#define CLUSTERABLE_DEVICE(SH,SD) (SH->use_clustering && \
-				   SD->type != TYPE_MOD)
+#define CLUSTERABLE_DEVICE(SH,SD) (SH->use_clustering)
 
 /*
  * This entire source file deals with the new queueing code.
diff -urN linux-2.4.18-pre8/drivers/scsi/st.c linux/drivers/scsi/st.c
--- linux-2.4.18-pre8/drivers/scsi/st.c	Thu Feb  7 11:55:39 2002
+++ linux/drivers/scsi/st.c	Thu Feb  7 11:55:49 2002
@@ -9,10 +9,10 @@
    Steve Hirsch, Andreas Koppenh"ofer, Michael Leodolter, Eyal Lebedinsky,
    Michael Schaefer, J"org Weule, and Eric Youngdale.
 
-   Copyright 1992 - 2001 Kai Makisara
+   Copyright 1992 - 2002 Kai Makisara
    email Kai.Makisara@metla.fi
 
-   Last modified: Sat Nov  3 19:30:55 2001 by makisara@kai.makisara.local
+   Last modified: Tue Feb  5 21:25:55 2002 by makisara
    Some small formal changes - aeb, 950809
 
    Last modified: 18-JAN-1998 Richard Gooch <rgooch@atnf.csiro.au> Devfs support
@@ -21,7 +21,7 @@
    error handling will be discarded.
  */
 
-static char *verstr = "20011103";
+static char *verstr = "20020205";
 
 #include <linux/module.h>
 
@@ -1944,6 +1944,10 @@
 			STm->default_blksize = value;
 			printk(KERN_INFO "st%d: Default block size set to %d bytes.\n",
 			       dev, STm->default_blksize);
+			if (STp->ready == ST_READY) {
+				STp->blksize_changed = FALSE;
+				set_mode_densblk(STp, STm);
+			}
 		}
 	} else if (code == MT_ST_TIMEOUTS) {
 		value = (options & ~MT_ST_OPTIONS);
@@ -1979,6 +1983,10 @@
 				STm->default_density = value & 0xff;
 				printk(KERN_INFO "st%d: Density default set to %x\n",
 				       dev, STm->default_density);
+				if (STp->ready == ST_READY) {
+					STp->density_changed = FALSE;
+					set_mode_densblk(STp, STm);
+				}
 			}
 		} else if (code == MT_ST_DEF_DRVBUFFER) {
 			if (value == MT_ST_CLEAR_DEFAULT) {
@@ -1990,6 +1998,8 @@
 				printk(KERN_INFO
                                        "st%d: Drive buffer default set to %x\n",
 				       dev, STp->default_drvbuffer);
+				if (STp->ready == ST_READY)
+					st_int_ioctl(STp, MTSETDRVBUFFER, STp->default_drvbuffer);
 			}
 		} else if (code == MT_ST_DEF_COMPRESSION) {
 			if (value == MT_ST_CLEAR_DEFAULT) {
@@ -1997,9 +2007,20 @@
 				printk(KERN_INFO
                                        "st%d: Compression default disabled.\n", dev);
 			} else {
-				STm->default_compression = (value & 1 ? ST_YES : ST_NO);
-				printk(KERN_INFO "st%d: Compression default set to %x\n",
-				       dev, (value & 1));
+				if ((value & 0xff00) != 0) {
+					STp->c_algo = (value & 0xff00) >> 8;
+					printk(KERN_INFO "st%d: Compression algorithm set to 0x%x.\n",
+					       dev, STp->c_algo);
+				}
+				if ((value & 0xff) != 0xff) {
+					STm->default_compression = (value & 1 ? ST_YES : ST_NO);
+					printk(KERN_INFO "st%d: Compression default set to %x\n",
+					       dev, (value & 1));
+					if (STp->ready == ST_READY) {
+						STp->compression_changed = FALSE;
+						st_compression(STp, (STm->default_compression == ST_YES));
+					}
+				}
 			}
 		}
 	} else
@@ -2028,7 +2049,8 @@
 #define MODE_SELECT_PAGE_FORMAT 0x10
 
 /* Read a mode page into the tape buffer. The block descriptors are included
-   if incl_block_descs is true. */
+   if incl_block_descs is true. The page control is ored to the page number
+   parameter, if necessary. */
 static int read_mode_page(Scsi_Tape *STp, int page, int omit_block_descs)
 {
 	unsigned char cmd[MAX_COMMAND_SIZE];
@@ -2087,6 +2109,7 @@
 #define COMPRESSION_PAGE_LENGTH 16
 
 #define CP_OFF_DCE_DCC          2
+#define CP_OFF_C_ALGO           7
 
 #define DCE_MASK  0x80
 #define DCC_MASK  0x40
@@ -2122,16 +2145,22 @@
                     (b_data[mpoffs + CP_OFF_DCE_DCC] & DCE_MASK ? 1 : 0)));
 
 	/* Check if compression can be changed */
-	if ((b_data[mpoffs + 2] & DCC_MASK) == 0) {
+	if ((b_data[mpoffs + CP_OFF_DCE_DCC] & DCC_MASK) == 0) {
                 DEBC(printk(ST_DEB_MSG "st%d: Compression not supported.\n", dev));
 		return (-EIO);
 	}
 
 	/* Do the change */
-	if (state)
+	if (state) {
 		b_data[mpoffs + CP_OFF_DCE_DCC] |= DCE_MASK;
-	else
+		if (STp->c_algo != 0)
+			b_data[mpoffs + CP_OFF_C_ALGO] = STp->c_algo;
+	}
+	else {
 		b_data[mpoffs + CP_OFF_DCE_DCC] &= ~DCE_MASK;
+		if (STp->c_algo != 0)
+			b_data[mpoffs + CP_OFF_C_ALGO] = 0; /* no compression */
+	}
 
 	retval = write_mode_page(STp, COMPRESSION_PAGE);
 	if (retval) {
@@ -2171,7 +2200,7 @@
 	 */
 	if (load_code >= 1 + MT_ST_HPLOADER_OFFSET
 	    && load_code <= 6 + MT_ST_HPLOADER_OFFSET) {
-		DEBC(printk(ST_DEB_MSG "st%d: Enhanced %sload slot %2ld.\n",
+		DEBC(printk(ST_DEB_MSG "st%d: Enhanced %sload slot %2d.\n",
 			    dev, (cmd[4]) ? "" : "un",
 			    load_code - MT_ST_HPLOADER_OFFSET));
 		cmd[3] = load_code - MT_ST_HPLOADER_OFFSET; /* MediaID field of C1553A */
diff -urN linux-2.4.18-pre8/drivers/scsi/st.h linux/drivers/scsi/st.h
--- linux-2.4.18-pre8/drivers/scsi/st.h	Fri Nov  9 13:52:21 2001
+++ linux/drivers/scsi/st.h	Thu Feb  7 11:55:49 2002
@@ -83,6 +83,7 @@
 	unsigned char cln_sense_value;
 	unsigned char cln_sense_mask;
 	unsigned char use_pf;			/* Set Page Format bit in all mode selects? */
+	unsigned char c_algo;	     /* compression algorithm */
 	int tape_type;
 	int write_threshold;
 	int timeout;		/* timeout for normal commands */
diff -urN linux-2.4.18-pre8/drivers/sound/cs46xx.c linux/drivers/sound/cs46xx.c
--- linux-2.4.18-pre8/drivers/sound/cs46xx.c	Thu Feb  7 11:55:39 2002
+++ linux/drivers/sound/cs46xx.c	Thu Feb  7 11:55:49 2002
@@ -2114,7 +2114,7 @@
 	
 	down(&state->sem);
 	if (!dmabuf->ready && (ret = __prog_dmabuf(state)))
-		goto out;
+		goto out2;
 
 	add_wait_queue(&state->dmabuf.wait, &wait);
 	while (count > 0) {
@@ -2184,8 +2184,9 @@
                 start_adc(state);
 	}
 out:
-	up(&state->sem);
 	remove_wait_queue(&state->dmabuf.wait, &wait);
+out2:
+	up(&state->sem);
 	set_current_state(TASK_RUNNING);
 	CS_DBGOUT(CS_WAVE_READ | CS_FUNCTION, 4, 
 		printk("cs46xx: cs_read()- %d\n",ret) );
@@ -2210,6 +2211,8 @@
 	state = (struct cs_state *)card->states[1];
 	if(!state)
 		return -ENODEV;
+	if (!access_ok(VERIFY_READ, buffer, count))
+		return EFAULT;
 	dmabuf = &state->dmabuf;
 
 	if (ppos != &file->f_pos)
@@ -2224,11 +2227,6 @@
 
 	if (!dmabuf->ready && (ret = __prog_dmabuf(state)))
 		goto out;
-	if (!access_ok(VERIFY_READ, buffer, count))
-	{
-	ret = -EFAULT;
-	goto out;
-	}
 	add_wait_queue(&state->dmabuf.wait, &wait);
 	ret = 0;
 /*
diff -urN linux-2.4.18-pre8/drivers/sound/opl3sa2.c linux/drivers/sound/opl3sa2.c
--- linux-2.4.18-pre8/drivers/sound/opl3sa2.c	Thu Feb  7 11:55:39 2002
+++ linux/drivers/sound/opl3sa2.c	Thu Feb  7 11:55:50 2002
@@ -64,6 +64,7 @@
 #include <linux/module.h>
 #include <linux/isapnp.h>
 #include <linux/pm.h>
+#include <linux/delay.h>
 #include "sound_config.h"
 
 #include "ad1848.h"
diff -urN linux-2.4.18-pre8/drivers/sound/sb_card.c linux/drivers/sound/sb_card.c
--- linux-2.4.18-pre8/drivers/sound/sb_card.c	Fri Dec 21 09:41:55 2001
+++ linux/drivers/sound/sb_card.c	Thu Feb  7 11:55:50 2002
@@ -378,11 +378,6 @@
 		0,0,0,0,
 		0,1,1,-1},
 	{"Sound Blaster AWE 32",
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0047),
-		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
-		0,0,0,0,
-		0,1,1,-1},
-	{"Sound Blaster AWE 32",
 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0048), 
 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),
 		0,0,0,0,
diff -urN linux-2.4.18-pre8/drivers/sound/ymfpci.c linux/drivers/sound/ymfpci.c
--- linux-2.4.18-pre8/drivers/sound/ymfpci.c	Fri Dec 21 09:41:55 2001
+++ linux/drivers/sound/ymfpci.c	Thu Feb  7 11:55:50 2002
@@ -46,6 +46,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/ioport.h>
+#include <linux/delay.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/poll.h>
diff -urN linux-2.4.18-pre8/drivers/video/Config.in linux/drivers/video/Config.in
--- linux-2.4.18-pre8/drivers/video/Config.in	Thu Feb  7 11:55:40 2002
+++ linux/drivers/video/Config.in	Thu Feb  7 11:55:50 2002
@@ -145,6 +145,7 @@
 	 fi
 	 tristate '  3Dfx Banshee/Voodoo3 display support (EXPERIMENTAL)' CONFIG_FB_3DFX
 	 tristate '  3Dfx Voodoo Graphics (sst1) support (EXPERIMENTAL)' CONFIG_FB_VOODOO1
+	 tristate '  Trident support (EXPERIMENTAL)' CONFIG_FB_TRIDENT
       fi
    fi
    if [ "$ARCH" = "sparc" -o "$ARCH" = "sparc64" ]; then
diff -urN linux-2.4.18-pre8/drivers/video/Makefile linux/drivers/video/Makefile
--- linux-2.4.18-pre8/drivers/video/Makefile	Thu Oct 25 13:53:52 2001
+++ linux/drivers/video/Makefile	Thu Feb  7 11:55:50 2002
@@ -64,6 +64,7 @@
 obj-$(CONFIG_FB_IMSTT)            += imsttfb.o
 obj-$(CONFIG_FB_RETINAZ3)         += retz3fb.o
 obj-$(CONFIG_FB_CLGEN)            += clgenfb.o fbgen.o
+obj-$(CONFIG_FB_TRIDENT)          += tridentfb.o fbgen.o
 obj-$(CONFIG_FB_S3TRIO)           += S3triofb.o
 obj-$(CONFIG_FB_TGA)              += tgafb.o fbgen.o
 obj-$(CONFIG_FB_VESA)             += vesafb.o 
diff -urN linux-2.4.18-pre8/drivers/video/fbmem.c linux/drivers/video/fbmem.c
--- linux-2.4.18-pre8/drivers/video/fbmem.c	Fri Dec 21 09:41:55 2001
+++ linux/drivers/video/fbmem.c	Thu Feb  7 11:55:50 2002
@@ -114,6 +114,8 @@
 extern int rivafb_setup(char*);
 extern int tdfxfb_init(void);
 extern int tdfxfb_setup(char*);
+extern int tridentfb_init(void);
+extern int tridentfb_setup(char*);
 extern int sisfb_init(void);
 extern int sisfb_setup(char*);
 extern int stifb_init(void);
@@ -227,6 +229,9 @@
 
 #ifdef CONFIG_FB_3DFX
 	{ "tdfx", tdfxfb_init, tdfxfb_setup },
+#endif
+#ifdef CONFIG_FB_TRIDENT
+	{ "trident", tridentfb_init, tridentfb_setup },
 #endif
 #ifdef CONFIG_FB_SGIVW
 	{ "sgivw", sgivwfb_init, sgivwfb_setup },
diff -urN linux-2.4.18-pre8/drivers/video/tridentfb.c linux/drivers/video/tridentfb.c
--- linux-2.4.18-pre8/drivers/video/tridentfb.c	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/tridentfb.c	Thu Feb  7 11:55:50 2002
@@ -0,0 +1,1306 @@
+/*
+ * Frame buffer driver for Trident Blade and Image series
+ *
+ * Copyright 2001,2002 - Jani Monoses   <jani@astechnix.ro>
+ *
+ * $Id: tridentfb.c,v 1.1 2002/02/07 18:20:18 marcelo Exp $
+ *
+ * CREDITS:(in order of appearance)
+ * 	skeletonfb.c by Geert Uytterhoeven and other fb code in drivers/video
+ * 	Special thanks ;) to Mattia Crivellini <tia@mclink.it>
+ * 	much inspired by the XFree86 4.1.0 Trident driver sources by Alan Hourihane
+ * 	the FreeVGA project
+ *	Francesco Salvestrini <salvestrini@users.sf.net> XP support,code,suggestions
+ * NOTES:
+ * 	Tested on Compaq Presario 12XL300 with CyberBladei1
+ * 	Tested on Toshiba 1800-514 with CyberBladeXPAi1
+ * 	No monitors were harmed during the writing of this driver
+ * TODO:
+ * 	timing value tweaking so it looks good on every monitor in every mode
+ * 	test text acceleration for the Image series
+ *	test DPMS stuff
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+
+#include <video/fbcon.h>
+#include <video/fbcon-cfb8.h>
+#include <video/fbcon-cfb16.h>
+#include <video/fbcon-cfb24.h>
+#include <video/fbcon-cfb32.h>
+
+#include "tridentfb.h"
+
+#define VERSION		"0.6.8"
+
+struct tridentfb_par {
+	struct fb_var_screeninfo var;
+	int bpp;
+	int hres;
+	int vres;
+	int linelength;
+	int vclk;		//in MHz
+
+	int vtotal;
+	int vdispend;
+	int vsyncstart;
+	int vsyncend;
+	int vblankstart;
+	int vblankend;
+
+	int htotal;
+	int hdispend;
+	int hsyncstart;
+	int hsyncend;
+	int hblankstart;
+	int hblankend;
+};
+
+struct tridentfb_info {
+	struct fb_info_gen gen;
+	unsigned int fbmem_virt;	//framebuffer virtual memory address
+	unsigned int fbmem;		//framebuffer physical memory address
+	unsigned int memsize;		//size of fbmem
+	unsigned int io;		//io space address
+	unsigned int io_virt;		//iospace virtual memory address
+	unsigned int nativex;		//flat panel xres
+	struct tridentfb_par currentmode;
+};
+
+static struct fb_ops tridentfb_ops;
+
+static struct tridentfb_info fb_info;
+static struct display disp;
+
+static struct { unsigned char red,green,blue,transp; } palette[256];
+
+static struct fb_var_screeninfo default_var;
+
+static char * tridentfb_name = "Trident";
+
+static int family;
+static int pci_id;
+
+static int defaultaccel;
+static int displaytype;
+
+static int pseudo_pal[16];
+
+
+/* defaults which are normally overriden by user values */
+
+/* video mode */
+static char * mode = "640x480";
+static int bpp = 8;
+
+static int noaccel;
+static int accel;
+
+static int center;
+static int stretch;
+
+static int fp;
+static int crt;
+
+static int memsize;
+static int memdiff;
+static int nativex;
+
+
+MODULE_PARM(mode,"s");
+MODULE_PARM(bpp,"i");
+MODULE_PARM(center,"i");
+MODULE_PARM(stretch,"i");
+MODULE_PARM(noaccel,"i");
+MODULE_PARM(accel,"i");
+MODULE_PARM(memsize,"i");
+MODULE_PARM(memdiff,"i");
+MODULE_PARM(nativex,"i");
+MODULE_PARM(fp,"i");
+MODULE_PARM(crt,"i");
+
+
+
+#define CRT 0x3D0		//CRTC registers offset for color display
+
+#ifndef TRIDENT_MMIO
+	#define TRIDENT_MMIO 1
+#endif
+
+#if TRIDENT_MMIO
+	#define t_outb(val,reg)	writeb(val,fb_info.io_virt + reg)
+	#define t_inb(reg)	readb(fb_info.io_virt + reg)
+#else
+	#define t_outb(val,reg) outb(val,reg)
+	#define t_inb(reg) inb(reg)
+#endif
+
+
+static struct accel_switch {
+	void (*init_accel)(int,int);
+	void (*wait_engine)(void);
+	void (*fill_rect)(int,int,int,int,int);
+	void (*copy_rect)(int,int,int,int,int,int);
+} *acc;
+
+#define writemmr(r,v)	writel(v, fb_info.io_virt + r)
+#define readmmr(r)	readl(fb_info.io_virt + r)
+
+/*
+ * Blade specific acceleration.Not XP's though those are
+ * unaccelerated.
+ */
+
+#define point(x,y) ((y)<<16|(x))
+#define STA	0x2120
+#define CMD	0x2144
+#define ROP	0x2148
+#define CLR	0x2160
+#define SR1	0x2100
+#define SR2	0x2104
+#define DR1	0x2108
+#define DR2	0x210C
+
+#define REPL(x)	x = x | x<<16
+#define ROP_S	0xCC
+
+static void blade_init_accel(int pitch,int bpp)
+{
+	int v1 = (pitch>>3)<<20;
+	int tmp = 0,v2;
+	switch (bpp) {
+		case 8:tmp = 0;break;
+		case 15:tmp = 5;break;
+		case 16:tmp = 1;break;
+		case 24:
+		case 32:tmp = 2;break;
+	}
+	v2 = v1 | (tmp<<29);
+	writemmr(0x21C0,v2);
+	writemmr(0x21C4,v2);
+	writemmr(0x21B8,v2);
+	writemmr(0x21BC,v2);
+	writemmr(0x21D0,v1);
+	writemmr(0x21D4,v1);
+	writemmr(0x21C8,v1);
+	writemmr(0x21CC,v1);
+	writemmr(0x216C,0);
+}
+
+static void blade_wait_engine(void)
+{
+	while(readmmr(STA) & 0xFA800000);
+}
+
+static void blade_fill_rect(int x,int y,int w,int h,int c)
+{
+	writemmr(CLR,c);
+	writemmr(ROP,ROP_S);
+	writemmr(CMD,0x20000000|1<<19|1<<4|2<<2);
+
+	writemmr(DR1,point(x,y));
+	writemmr(DR2,point(x+w-1,y+h-1));
+}
+
+static void blade_copy_rect(int x1,int y1,int x2,int y2,int w,int h)
+{
+	int s1,s2,d1,d2;
+	int direction = 2;
+	s1 = point(x1,y1);
+	s2 = point(x1+w-1,y1+h-1);
+	d1 = point(x2,y2);
+	d2 = point(x2+w-1,y2+h-1);
+
+	if ((y1 > y2) || ((y1 == y2) && (x1 >x2)))
+			direction = 0;
+
+
+	writemmr(ROP,ROP_S);
+	writemmr(CMD,0xE0000000|1<<19|1<<4|1<<2|direction);
+
+	writemmr(SR1,direction?s2:s1);
+	writemmr(SR2,direction?s1:s2);
+	writemmr(DR1,direction?d2:d1);
+	writemmr(DR2,direction?d1:d2);
+}
+
+static struct accel_switch accel_blade = {
+	blade_init_accel,
+	blade_wait_engine,
+	blade_fill_rect,
+	blade_copy_rect,
+};
+
+/*
+ * Image specific acceleration functions
+ */
+static void image_init_accel(int pitch,int bpp)
+{
+	int tmp = 0;
+   	switch (bpp) {
+		case 8:tmp = 0;break;
+		case 15:tmp = 5;break;
+		case 16:tmp = 1;break;
+		case 24:
+		case 32:tmp = 2;break;
+	}
+	writemmr(0x2120, 0xF0000000);
+	writemmr(0x2120, 0x40000000|tmp);
+	writemmr(0x2120, 0x80000000);
+	writemmr(0x2144, 0x00000000);
+	writemmr(0x2148, 0x00000000);
+	writemmr(0x2150, 0x00000000);
+	writemmr(0x2154, 0x00000000);
+	writemmr(0x2120, 0x60000000 |(pitch<<16) |pitch);
+	writemmr(0x216C, 0x00000000);
+	writemmr(0x2170, 0x00000000);
+	writemmr(0x217C, 0x00000000);
+	writemmr(0x2120, 0x10000000);
+	writemmr(0x2130, (2047 << 16) | 2047);
+}
+
+static void image_wait_engine(void)
+{
+	while(readmmr(0x2164) & 0xF0000000);
+}
+
+static void image_fill_rect(int x,int y,int w,int h,int c)
+{
+	writemmr(0x2120,0x80000000);
+	writemmr(0x2120,0x90000000|ROP_S);
+
+	writemmr(0x2144,c);
+
+	writemmr(DR1,point(x,y));
+	writemmr(DR2,point(x+w-1,y+h-1));
+
+	writemmr(0x2124,0x80000000|3<<22|1<<10|1<<9);
+}
+
+static void image_copy_rect(int x1,int y1,int x2,int y2,int w,int h)
+{
+	int s1,s2,d1,d2;
+	int direction = 2;
+	s1 = point(x1,y1);
+	s2 = point(x1+w-1,y1+h-1);
+	d1 = point(x2,y2);
+	d2 = point(x2+w-1,y2+h-1);
+
+	if ((y1 > y2) || ((y1 == y2) && (x1 >x2)))
+			direction = 0;
+
+	writemmr(0x2120,0x80000000);
+	writemmr(0x2120,0x90000000|ROP_S);
+
+	writemmr(SR1,direction?s2:s1);
+	writemmr(SR2,direction?s1:s2);
+	writemmr(DR1,direction?d2:d1);
+	writemmr(DR2,direction?d1:d2);
+	writemmr(0x2124,0x80000000|1<<22|1<<10|1<<7|direction);
+}
+
+
+static struct accel_switch accel_image = {
+	image_init_accel,
+	image_wait_engine,
+	image_fill_rect,
+	image_copy_rect,
+};
+
+/*
+ * Accel functions called by the upper layers
+ */
+
+static void trident_bmove (struct display *p, int sy, int sx,
+				int dy, int dx, int height, int width)
+{
+	sx *= fontwidth(p);
+	dx *= fontwidth(p);
+	width *= fontwidth(p);
+	sy *= fontheight(p);
+	dy *= fontheight(p);
+	height *= fontheight(p);
+	acc->copy_rect(sx,sy,dx,dy,width,height);
+	acc->wait_engine();
+}
+static void trident_clear_helper (int c, struct display *p,
+				int sy, int sx, int height, int width)
+{
+	sx *= fontwidth(p);
+	sy *= fontheight(p);
+	width *= fontwidth(p);
+	height *= fontheight(p);
+	acc->fill_rect(sx,sy,width,height,c);
+	acc->wait_engine();
+}
+
+
+#ifdef FBCON_HAS_CFB8
+static void trident_8bpp_clear (struct vc_data *conp, struct display *p,
+				int sy, int sx, int height, int width)
+{
+	int c;
+	c = attr_bgcol_ec(p,conp) & 0xFF;
+	c |= c<<8;
+	c |= c<<16;
+	trident_clear_helper(c,p,sy,sx,height,width);
+}
+
+static struct display_switch trident_8bpp = {
+	setup:		fbcon_cfb8_setup,
+	bmove:		trident_bmove,
+	clear:		trident_8bpp_clear,
+	putc:		fbcon_cfb8_putc,
+	putcs:		fbcon_cfb8_putcs,
+	revc:		fbcon_cfb8_revc,
+	clear_margins:	fbcon_cfb8_clear_margins,
+	fontwidthmask:	FONTWIDTH (4) | FONTWIDTH (8) | FONTWIDTH (12) | FONTWIDTH (16)
+};
+#endif
+#ifdef FBCON_HAS_CFB16
+static void trident_16bpp_clear (struct vc_data *conp, struct display *p,
+				int sy, int sx, int height, int width)
+{
+	int c;
+	c = ((u16*)p->dispsw_data)[attr_bgcol_ec(p,conp)];
+	c = c | c<<16;
+	trident_clear_helper(c,p,sy,sx,height,width);
+}
+
+static struct display_switch trident_16bpp = {
+	setup:		fbcon_cfb16_setup,
+	bmove:		trident_bmove,
+	clear:		trident_16bpp_clear,
+	putc:		fbcon_cfb16_putc,
+	putcs:		fbcon_cfb16_putcs,
+	revc:		fbcon_cfb16_revc,
+	clear_margins:	fbcon_cfb16_clear_margins,
+	fontwidthmask:	FONTWIDTH (4) | FONTWIDTH (8) | FONTWIDTH (12) | FONTWIDTH (16)
+};
+#endif
+#ifdef FBCON_HAS_CFB32
+static void trident_32bpp_clear (struct vc_data *conp, struct display *p,
+				int sy, int sx, int height, int width)
+{
+	int c;
+	c = ((u32*)p->dispsw_data)[attr_bgcol_ec(p,conp)];
+	trident_clear_helper(c,p,sy,sx,height,width);
+}
+
+static struct display_switch trident_32bpp = {
+	setup:		fbcon_cfb32_setup,
+	bmove:		trident_bmove,
+	clear:		trident_32bpp_clear,
+	putc:		fbcon_cfb32_putc,
+	putcs:		fbcon_cfb32_putcs,
+	revc:		fbcon_cfb32_revc,
+	clear_margins:	fbcon_cfb32_clear_margins,
+	fontwidthmask:	FONTWIDTH (4) | FONTWIDTH (8) | FONTWIDTH (12) | FONTWIDTH (16)
+};
+#endif
+
+/*
+ * Hardware access functions
+ */
+
+static inline unsigned char read3X4(int reg)
+{
+	writeb(reg, fb_info.io_virt + CRT + 4);
+	return readb(fb_info.io_virt + CRT + 5);
+}
+
+static inline void write3X4(int reg, unsigned char val)
+{
+	writeb(reg, fb_info.io_virt + CRT + 4);
+	writeb(val, fb_info.io_virt + CRT + 5);
+}
+
+static inline unsigned char read3C4(int reg)
+{
+	t_outb(reg, 0x3C4);
+	return t_inb(0x3C5);
+}
+
+static inline void write3C4(int reg, unsigned char val)
+{
+	t_outb(reg, 0x3C4);
+	t_outb(val, 0x3C5);
+}
+
+static inline unsigned char read3CE(int reg)
+{
+	t_outb(reg, 0x3CE);
+	return t_inb(0x3CF);
+}
+
+static inline void writeAttr(int reg, unsigned char val)
+{
+	readb(fb_info.io_virt + CRT + 0x0A);	//flip-flop to index
+	t_outb(reg, 0x3C0);
+	t_outb(val, 0x3C0);
+}
+
+static inline unsigned char readAttr(int reg)
+{
+	readb(fb_info.io_virt + CRT + 0x0A);	//flip-flop to index
+	t_outb(reg, 0x3C0);
+	return t_inb(0x3C1);
+}
+
+static inline void write3CE(int reg, unsigned char val)
+{
+	t_outb(reg, 0x3CE);
+	t_outb(val, 0x3CF);
+}
+
+#define unprotect_all()	write3C4(Protection, 0x92);unprotect()
+#define unprotect()	write3C4(NewMode1,0xC2)
+#define bios_reg(reg) 	write3CE(BiosReg, reg)
+#define enable_mmio()	outb(PCIReg, 0x3D4); \
+			outb(inb(0x3D5) | 0x01, 0x3D5)
+#define crtc_unlock()	write3X4(CRTVSyncEnd, read3X4(CRTVSyncEnd) & 0x7F)
+
+/*  Return flat panel's maximum x resolution */
+static int __init get_nativex(void)
+{
+	int x,y,tmp;
+
+	if (nativex)
+		return nativex;
+
+       	tmp = (read3CE(VertStretch) >> 4) & 3;
+
+	/* detection broken on XPAi ??? misdetects 1024 for 800 */
+	if (pci_id == CYBERBLADEXPAi1 && tmp == 3)
+		tmp = 2;
+
+	switch (tmp) {
+		case 0:x = 1280;y = 1024;break;
+		case 1:x = 640;y = 480;break;
+		case 2:x = 1024;y = 768;break;
+		default:x = 800;y = 600;break;
+	}
+
+	output("%dx%d flat panel found\n", x, y);
+	return x;
+}
+
+/* Set pitch */
+static void set_lwidth(int width)
+{
+	write3X4(Offset, width & 0xFF);
+	write3X4(AddColReg, (read3X4(AddColReg) & 0xCF) | ((width & 0x300) >>4));
+}
+
+/* For resolutions smaller than FP resolution stretch */
+static void screen_stretch(void)
+{
+	write3CE(VertStretch,(read3CE(VertStretch) & 0x7C) | 1);
+	write3CE(HorStretch,(read3CE(HorStretch) & 0x7C) | 1);
+}
+
+/* For resolutions smaller than FP resolution center */
+static void screen_center(void)
+{
+	bios_reg(0);		// no stretch
+	write3CE(VertStretch,(read3CE(VertStretch) & 0x7C) | 0x80);
+	write3CE(HorStretch,(read3CE(HorStretch) & 0x7C) | 0x80);
+}
+
+/* Address of first shown pixel in display memory */
+static void set_screen_start(int base)
+{
+	write3X4(StartAddrLow, base & 0xFF);
+	write3X4(StartAddrHigh, (base & 0xFF00) >>8);
+	write3X4(CRTCModuleTest, (read3X4(CRTCModuleTest) & 0xDF) | ((base & 0x10000) >>11));
+	write3X4(CRTHiOrd, (read3X4(CRTHiOrd) & 0xF8) | (base & 0xE0000) >> 17);
+}
+
+
+#define calc_freq(n,m,k) ((NTSC * (n+8))/((m+2)*(1<<k)))
+
+/* Set dotclock frequency */
+static void set_vclk(int freq)
+{
+	int m,n,k;
+	int f,fi,d,di;
+	unsigned char lo=0,hi=0;
+
+	d = 20;
+	for(k = 2;k>=0;k--)
+	for(m = 0;m<63;m++)
+	for(n = 0;n<128;n++) {
+		fi = calc_freq(n,m,k);
+		if ((di = abs(fi - freq)) < d) {
+			d = di;
+			f = fi;
+			lo = n;
+			hi = (k<<6) | m;
+		}
+	}
+	write3C4(ClockHigh,hi);
+	write3C4(ClockLow,lo);
+	debug("VCLK = %X %X\n",hi,lo);
+}
+
+/* Set number of lines for flat panels*/
+static void set_number_of_lines(int lines)
+{
+	int tmp = read3CE(CyberEnhance) & 0x8F;
+	if (lines > 768)
+		tmp |= 0x30;
+	else if (lines > 600)
+		tmp |= 0x20;
+	else if (lines > 480)
+		tmp |= 0x10;
+	write3CE(CyberEnhance, tmp);
+}
+
+/*
+ * If we see that FP is active we assume we have one.
+ * Otherwise we have a CRT display.User can override.
+ */
+static unsigned int __init get_displaytype(void)
+{
+	if (fp)
+		return DISPLAY_FP;
+	if (crt)
+		return DISPLAY_CRT;
+	return (read3CE(FPConfig) & 0x10)?DISPLAY_FP:DISPLAY_CRT;
+}
+
+/* Try detecting the video memory size */
+static unsigned int __init get_memsize(void)
+{
+	unsigned char tmp;
+	unsigned int k;
+
+	/* If memory size provided by user */
+	if (memsize)
+		k = memsize * Kb;
+	else
+	switch (pci_id) {
+		case CYBER9525DVD:k = 2560 * Kb;break;
+		case CYBERBLADEXPAi1:k = 16 * Mb;break;
+		case CYBERBLADEXPm16:k = 16 * Mb;break;
+		case CYBERBLADEXPm8:k = 8 * Mb;break;
+		default:
+			tmp = read3X4(SPR) & 0x0F;
+			switch (tmp) {
+				case 3:k = 1 * Mb;break;
+				case 7:k = 2 * Mb;break;
+				case 15:k = 4 * Mb;break;
+				case 4:k = 8 * Mb;break;
+				default:k = 1 * Mb;
+			}
+	}
+
+	k -= memdiff * Kb;
+	output("framebuffer size = %d Kb\n", k/Kb);
+	return k;
+}
+
+
+/* Fill in fix */
+static int trident_encode_fix(struct fb_fix_screeninfo *fix,
+				  const void *par,
+				  struct fb_info_gen *info)
+{
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+
+	debug("enter\n");
+
+	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
+	strcpy(fix->id,tridentfb_name);
+
+	fix->smem_start = i->fbmem;
+	fix->smem_len = i->memsize;
+
+	fix->type = FB_TYPE_PACKED_PIXELS;
+	fix->type_aux = 0;
+
+	fix->visual = p->bpp==8 ? FB_VISUAL_PSEUDOCOLOR:FB_VISUAL_TRUECOLOR;
+
+	fix->xpanstep = fix->ywrapstep = 0;
+	fix->ypanstep = 1;
+	fix->line_length = p->linelength;
+	fix->mmio_start = 0;
+	fix->mmio_len = 0;
+
+	fix->accel = FB_ACCEL_NONE;
+
+	debug("exit\n");
+	return 0;
+}
+
+/* Fill in par from var */
+static int trident_decode_var(const struct fb_var_screeninfo *var,
+				  void *par,
+				  struct fb_info_gen *info)
+{
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	int vres,vfront,vback,vsync;
+	debug("enter\n");
+	p->var = *var;
+	p->bpp = var->bits_per_pixel;
+
+	if (p->bpp == 24 )
+		p->bpp = 32;
+
+	p->linelength = var->xres_virtual * p->bpp/8;
+
+	switch (p->bpp) {
+		case 8:
+			p->var.red.offset = 0;
+			p->var.green.offset = 0;
+			p->var.blue.offset = 0;
+			p->var.red.length = 6;
+			p->var.green.length = 6;
+			p->var.blue.length = 6;
+			break;
+		case 16:
+			p->var.red.offset = 11;
+			p->var.green.offset = 5;
+			p->var.blue.offset = 0;
+			p->var.red.length = 5;
+			p->var.green.length = 6;
+			p->var.blue.length = 5;
+			break;
+		case 32:
+			p->var.red.offset = 16;
+			p->var.green.offset = 8;
+			p->var.blue.offset = 0;
+			p->var.red.length = 8;
+			p->var.green.length = 8;
+			p->var.blue.length = 8;
+			break;
+		default:
+			return -EINVAL;
+	}
+
+	/* convert from picoseconds to MHz */
+	p->vclk = 1000000/var->pixclock;
+
+	if (p->bpp == 32)
+		p->vclk *=2;
+
+	p->hres = var->xres;
+	vres = p->vres = var->yres;
+
+	/* See if requested resolution is larger than flat panel */
+	if (p->hres > i->nativex && flatpanel) {
+		return -EINVAL;
+	}
+
+	/* See if requested resolution fits in available memory */
+	if (p->hres * p->vres * p->bpp/8 > i->memsize) {
+		return -EINVAL;
+	}
+
+	vfront = var->upper_margin;
+	vback =	var->lower_margin;
+	vsync =	var->vsync_len;
+
+	/* Compute horizontal and vertical VGA CRTC timing values */
+	if (var->vmode & FB_VMODE_INTERLACED) {
+		vres /= 2;
+		vfront /=2;
+		vback /=2;
+		vsync /=2;
+	}
+
+	if (var->vmode & FB_VMODE_DOUBLE) {
+		vres *= 2;
+		vfront *=2;
+		vback *=2;
+		vsync *=2;
+	}
+
+	p->htotal = (p->hres + var->left_margin + var->right_margin + var->hsync_len)/8 - 10;
+	p->hdispend = p->hres/8 - 1;
+	p->hsyncstart = (p->hres + var->right_margin)/8;
+	p->hsyncend = var->hsync_len/8;
+	p->hblankstart = p->hdispend + 1;
+	p->hblankend = p->htotal + 5;
+
+	p->vtotal = vres + vfront + vback + vsync - 2;
+	p->vdispend = vres - 1;
+	p->vsyncstart = vres + vback;
+	p->vsyncend = vsync;
+	p->vblankstart = vres;
+	p->vblankend = p->vtotal + 2;
+
+	debug("exit\n");
+
+	return 0;
+}
+
+
+/* Fill in var from info */
+static int trident_encode_var(struct fb_var_screeninfo *var,
+				  const void *par,
+				  struct fb_info_gen *info)
+{
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+	debug("enter\n");
+	*var = p->var;
+	var->bits_per_pixel = p->bpp;
+	debug("exit\n");
+	return 0;
+}
+
+/* Fill in par from hardware */
+static void trident_get_par(void *par, struct fb_info_gen *info)
+{
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+
+	debug("enter\n");
+	*p = i->currentmode;
+	debug("exit\n");
+}
+
+/* Pan the display */
+static int trident_pan_display(const struct fb_var_screeninfo *var,
+				   struct fb_info_gen *info)
+{
+	unsigned int offset;
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+
+	debug("enter\n");
+
+	offset = (var->xoffset + (var->yoffset * var->xres))
+			* var->bits_per_pixel/32;
+	i->currentmode.var.xoffset = var->xoffset;
+	i->currentmode.var.yoffset = var->yoffset;
+	set_screen_start(offset);
+	debug("exit\n");
+	return 0;
+}
+
+/* Set the hardware from par */
+static void trident_set_par(const void *par, struct fb_info_gen *info)
+{
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	unsigned char tmp;
+	debug("enter\n");
+
+	i->currentmode = *p;
+	unprotect_all();
+	crtc_unlock();
+	enable_mmio();
+
+	write3CE(CyberControl,8);
+	if (flatpanel && p->hres < i->nativex) {
+		/*
+		 * on flat panels with native size larger
+		 * than requested resolution decide whether
+		 * we stretch or center
+		 */
+		t_outb(0xEB,0x3C2);
+		write3CE(CyberControl,0x81);
+		if (center) //|| (p->bpp==32 && pci_id == CYBERBLADEi1D))
+			screen_center();
+		else if (stretch)
+			screen_stretch();
+
+	} else {
+		t_outb(0x2B,0x3C2);
+		write3CE(CyberControl,8);
+	}
+
+	/* vertical timing values */
+	write3X4(CRTVTotal, p->vtotal & 0xFF);
+	write3X4(CRTVDispEnd, p->vdispend & 0xFF);
+	write3X4(CRTVSyncStart, p->vsyncstart & 0xFF);
+	write3X4(CRTVSyncEnd, (p->vsyncend & 0x0F));
+	write3X4(CRTVBlankStart, p->vblankstart & 0xFF);
+	write3X4(CRTVBlankEnd, 0/*p->vblankend & 0xFF*/);
+
+	/* horizontal timing values */
+	write3X4(CRTHTotal, p->htotal & 0xFF);
+	write3X4(CRTHDispEnd, p->hdispend & 0xFF);
+	write3X4(CRTHSyncStart, p->hsyncstart & 0xFF);
+	write3X4(CRTHSyncEnd, (p->hsyncend & 0x1F) | ((p->hblankend & 0x20)<<2));
+	write3X4(CRTHBlankStart, p->hblankstart & 0xFF);
+	write3X4(CRTHBlankEnd, 0/*(p->hblankend & 0x1F)*/);
+
+	/* higher bits of vertical timing values */
+	tmp = 0x10;
+	if (p->vtotal & 0x100) tmp |= 0x01;
+	if (p->vdispend & 0x100) tmp |= 0x02;
+	if (p->vsyncstart & 0x100) tmp |= 0x04;
+	if (p->vblankstart & 0x100) tmp |= 0x08;
+
+	if (p->vtotal & 0x200) tmp |= 0x20;
+	if (p->vdispend & 0x200) tmp |= 0x40;
+	if (p->vsyncstart & 0x200) tmp |= 0x80;
+
+	write3X4(CRTOverflow, tmp);
+
+
+	tmp = read3X4(CRTHiOrd) | 0x08;	//line compare bit 10
+
+	if (p->vtotal & 0x400) tmp |= 0x80;
+	if (p->vblankstart & 0x400) tmp |= 0x40;
+	if (p->vsyncstart & 0x400) tmp |= 0x20;
+	if (p->vdispend & 0x400) tmp |= 0x10;
+	write3X4(CRTHiOrd, tmp);
+
+	write3X4(HorizOverflow, 0);
+
+	tmp = 0x40;
+	if (p->vblankstart & 0x200) tmp |= 0x20;
+	if (p->var.vmode & FB_VMODE_DOUBLE) tmp |= 0x80;  //double scan for 200 line modes
+	write3X4(CRTMaxScanLine, tmp);
+	write3X4(CRTLineCompare,0xFF);
+	write3X4(CRTPRowScan,0);
+	write3X4(CRTModeControl,0xC3);
+	write3X4(LinearAddReg,0x20);	//enable linear addressing
+	tmp = (p->var.vmode & FB_VMODE_INTERLACED) ? 0x84:0x80;
+	write3X4(CRTCModuleTest,tmp);	//enable access extended memory
+	write3X4(GraphEngReg, 0x80);	//enable GE for text acceleration
+
+	if (p->var.accel_flags & FB_ACCELF_TEXT)
+		acc->init_accel(p->hres,p->bpp);
+
+	switch (p->bpp) {
+		case 8:tmp=0;break;
+		case 16:tmp=5;break;
+		case 24:
+			/* tmp=0x29;break; */
+			/* seems like 24bpp is same as 32bpp when using vesafb */
+		case 32:tmp=9;break;
+	}
+	write3X4(PixelBusReg, tmp);
+
+	write3X4(InterfaceSel, 0x5B);	//32bit internal data path
+	write3X4(DRAMControl, 0x30);	//both IO,linear enable
+	write3X4(Performance, 0xBF);
+	write3X4(PCIReg,0x07);		//MMIO & PCI read and write burst enable
+
+	set_vclk(p->vclk);
+
+	write3C4(0,3);
+	write3C4(1,1);		//set char clock 8 dots wide
+	write3C4(2,0x0F);	//enable 4 maps because needed in chain4 mode
+	write3C4(3,0);
+	write3C4(4,0x0E);	//memory mode enable bitmaps ??
+
+	write3CE(MiscExtFunc,(p->bpp==32)?0x1A:0x12);	//divide clock by 2 if 32bpp
+							//chain4 mode display and CPU path
+	write3CE(0x5,0x40);	//no CGA compat,allow 256 col
+	write3CE(0x6,0x05);	//graphics mode
+	write3CE(0x7,0x0F);	//planes?
+
+	writeAttr(0x10,0x41);	//graphics mode and support 256 color modes
+	writeAttr(0x12,0x0F);	//planes
+	writeAttr(0x13,0);	//horizontal pel panning
+
+	//colors
+	for(tmp = 0;tmp < 0x10;tmp++)
+		writeAttr(tmp,tmp);
+	readb(fb_info.io_virt + CRT + 0x0A);	//flip-flop to index
+	t_outb(0x20, 0x3C0);			//enable attr
+
+	switch (p->bpp) {
+		case 8:	tmp = 0;break;		//256 colors
+		case 15: tmp = 0x10;break;
+		case 16: tmp = 0x30;break;	//hicolor
+		case 24: 			//truecolor
+		case 32: tmp = 0xD0;break;
+	}
+
+	t_inb(0x3C8);
+	t_inb(0x3C6);
+	t_inb(0x3C6);
+	t_inb(0x3C6);
+	t_inb(0x3C6);
+	t_outb(tmp,0x3C6);
+	t_inb(0x3C8);
+
+	if (flatpanel)
+		set_number_of_lines(p->vres);
+	set_lwidth(p->hres*p->bpp/(4*16));
+
+	trident_pan_display(&p->var,info);
+	debug("exit\n");
+}
+
+/* Get value of one color register */
+static int trident_getcolreg(unsigned regno, unsigned *red,
+				 unsigned *green, unsigned *blue,
+				 unsigned *transp, struct fb_info *info)
+{
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	int m = i->currentmode.bpp==8?256:16;
+
+	debug("enter %d\n",regno);
+
+	if (regno >= m)
+		return 1;
+
+	*red = palette[regno].red;
+	*green = palette[regno].green;
+	*blue = palette[regno].blue;
+	*transp = palette[regno].transp;
+
+	debug("exit\n");
+	return 0;
+}
+
+/* Set one color register */
+static int trident_setcolreg(unsigned regno, unsigned red, unsigned green,
+				 unsigned blue, unsigned transp,
+				 struct fb_info *info)
+{
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	int bpp = i->currentmode.bpp;
+	int m = bpp==8?256:16;
+
+	debug("enter %d\n",regno);
+
+	if (regno >= m)
+		return 1;
+
+	palette[regno].red = red;
+	palette[regno].green = green;
+	palette[regno].blue = blue;
+	palette[regno].transp = transp;
+
+	if (bpp==8) {
+		t_outb(0xFF,0x3C6);
+		t_outb(regno,0x3C8);
+
+		t_outb(red>>10,0x3C9);
+		t_outb(green>>10,0x3C9);
+		t_outb(blue>>10,0x3C9);
+
+	} else
+	if (bpp == 16) 			/* RGB 565 */
+			((u16*)info->pseudo_palette)[regno] = (red & 0xF800) |
+			((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11);
+	else
+	if (bpp == 32)		/* ARGB 8888 */
+		((u32*)info->pseudo_palette)[regno] =
+			((transp & 0xFF00) <<16) 	|
+			((red & 0xFF00) << 8) 		|
+			((green & 0xFF00))		|
+			((blue & 0xFF00)>>8);
+
+	debug("exit\n");
+	return 0;
+}
+
+/* Try blanking the screen.For flat panels it does nothing */
+static int trident_blank(int blank_mode, struct fb_info_gen *info)
+{
+	unsigned char PMCont,DPMSCont;
+
+	debug("enter\n");
+	if (flatpanel)
+		return 0;
+	t_outb(0x04,0x83C8); /* Read DPMS Control */
+	PMCont = t_inb(0x83C6) & 0xFC;
+	DPMSCont = read3CE(PowerStatus) & 0xFC;
+	switch (blank_mode)
+	{
+	case VESA_NO_BLANKING:
+		/* Screen: On, HSync: On, VSync: On */
+		PMCont |= 0x03;
+		DPMSCont |= 0x00;
+		break;
+	case VESA_HSYNC_SUSPEND:
+		/* Screen: Off, HSync: Off, VSync: On */
+		PMCont |= 0x02;
+		DPMSCont |= 0x01;
+		break;
+	case VESA_VSYNC_SUSPEND:
+		/* Screen: Off, HSync: On, VSync: Off */
+		PMCont |= 0x02;
+		DPMSCont |= 0x02;
+		break;
+	case VESA_POWERDOWN:
+		/* Screen: Off, HSync: Off, VSync: Off */
+		PMCont |= 0x00;
+		DPMSCont |= 0x03;
+		break;
+    	}
+
+	write3CE(PowerStatus,DPMSCont);
+    	t_outb(4,0x83C8);
+    	t_outb(PMCont,0x83C6);
+
+	debug("exit\n");
+	return 0;
+}
+
+/* Set display switch used by console */
+static void trident_set_disp(const void *par, struct display *disp,
+				 struct fb_info_gen *info)
+{
+	struct tridentfb_info * i = (struct tridentfb_info *)info;
+	struct fb_info * ii = (struct fb_info *)info;
+	struct tridentfb_par * p = (struct tridentfb_par *)par;
+	int isaccel = p->var.accel_flags & FB_ACCELF_TEXT;
+
+	disp->screen_base = (char *)i->fbmem_virt;
+	debug("enter\n");
+#ifdef FBCON_HAS_CFB8
+	if (p->bpp == 8 ) {
+		if (isaccel)
+			disp->dispsw = &trident_8bpp;
+		else
+			disp->dispsw = &fbcon_cfb8;
+	} else
+#endif
+#ifdef FBCON_HAS_CFB16
+	if (p->bpp == 16) {
+		if (isaccel)
+			disp->dispsw = &trident_16bpp;
+		else
+			disp->dispsw = &fbcon_cfb16;
+		disp->dispsw_data =ii->pseudo_palette;	/* console palette */
+	} else
+#endif
+#ifdef FBCON_HAS_CFB32
+	if (p->bpp == 32) {
+		if (isaccel)
+			disp->dispsw = &trident_32bpp;
+		else
+			disp->dispsw = &fbcon_cfb32;
+		disp->dispsw_data =ii->pseudo_palette;	/* console palette */
+	} else
+#endif
+	disp->dispsw = &fbcon_dummy;
+	debug("exit\n");
+}
+
+static struct fbgen_hwswitch trident_hwswitch = {
+	NULL, /* detect not needed */
+	trident_encode_fix,
+	trident_decode_var,
+	trident_encode_var,
+	trident_get_par,
+	trident_set_par,
+	trident_getcolreg,
+	trident_setcolreg,
+	trident_pan_display,
+	trident_blank,
+	trident_set_disp
+};
+
+/* List of boards that we are trying to support */
+static struct almost_supported_board {
+	int pci_id;
+	int family;
+	struct accel_switch * acc;
+	char* board_name;
+	int accel;
+} asb[] __initdata = {
+	{ BLADE3D,		BLADE,	&accel_blade, "Blade3D",	ACCEL	},
+	{ CYBERBLADEi7,	BLADE,	&accel_blade, "CyberBladei7",	ACCEL	},
+	{ CYBERBLADEi7D,	BLADE,	&accel_blade, "CyberBladei7D",	ACCEL	},
+	{ CYBERBLADEi1,	BLADE,	&accel_blade, "CyberBladei1",	ACCEL	},
+	{ CYBERBLADEi1D,	BLADE,	&accel_blade, "CyberBladei1D",	ACCEL	},
+	{ CYBERBLADEAi1,	BLADE,	&accel_blade, "CyberBladeAi1",	ACCEL	},
+	{ CYBERBLADEAi1D,	BLADE,	&accel_blade, "CyberBladeAi1D",	ACCEL	},
+	{ CYBERBLADEE4,	BLADE,	&accel_blade, "CyberBladeE4",	ACCEL	},
+
+	{ IMAGE975,	IMAGE,	&accel_image,	"IMAGE975",	NOACCEL	},
+	{ IMAGE985,	IMAGE,	&accel_image,	"IMAGE985",	NOACCEL	},
+	{ CYBER9320,	IMAGE,	&accel_image,	"Cyber9320",	NOACCEL	},
+	{ CYBER9388,	IMAGE,	&accel_image,	"Cyber9388",	NOACCEL	},
+	{ CYBER9520,	IMAGE,	&accel_image,	"Cyber9520",	NOACCEL	},
+	{ CYBER9525DVD,	IMAGE,	&accel_image,	"Cyber9525DVD",	NOACCEL	},
+	{ CYBER9397,	IMAGE,	&accel_image,	"Cyber9397",	NOACCEL	},
+	{ CYBER9397DVD,	IMAGE,	&accel_image,	"Cyber9397DVD",	NOACCEL	},
+
+	{ CYBERBLADEXPAi1,	XP,	&accel_blade,	"CyberBladeXPAi1",	NOACCEL },
+	{ CYBERBLADEXPm8,	XP,	&accel_blade,	"CyberBladeXPm8",	NOACCEL },
+	{ CYBERBLADEXPm16,	XP,	&accel_blade,	"CyberBladeXPm16",	NOACCEL },
+};
+
+static __init int trident_find_board(void)
+{
+	int i;
+	struct pci_dev * board;
+
+	for (i = 0;i < ARRAY_SIZE(asb);i++) {
+      		if ((board = pci_find_device(PCI_VENDOR_ID_TRIDENT,
+				   asb[i].pci_id,
+				   NULL))) {
+	 		family = asb[i].family;
+	 		acc = asb[i].acc;
+	 		pci_id = asb[i].pci_id;
+	 		defaultaccel = asb[i].accel;
+
+			fb_info.io = pci_resource_start(board,1);
+			fb_info.fbmem = pci_resource_start(board,0);
+	 		output("%s board found\n", asb[i].board_name);
+	 		return 1;
+      		}
+   	}
+	output("No Trident board found\n");
+	return 0;
+}
+
+int __init tridentfb_init(void)
+{
+
+	output("Trident framebuffer  %s initializing\n", VERSION);
+
+	if (!trident_find_board())
+     		return -1;
+
+	if (!request_mem_region(fb_info.io, TRIDENT_IOSIZE, "tridentfb")) {
+		debug("request_region failed!\n");
+		return -1;
+	};
+
+	fb_info.io_virt = (unsigned int)ioremap_nocache(fb_info.io, TRIDENT_IOSIZE);
+
+	if (!fb_info.io_virt) {
+		release_region(fb_info.io, TRIDENT_IOSIZE);
+		debug("ioremap failed\n");
+		return -1;
+	}
+
+	fb_info.memsize = get_memsize();
+	if (!request_mem_region(fb_info.fbmem, fb_info.memsize, "tridentfb")) {
+		debug("request_mem_region failed!\n");
+		return -1;
+	}
+
+	fb_info.fbmem_virt = (unsigned int)ioremap_nocache(fb_info.fbmem, fb_info.memsize);
+
+	if (!fb_info.fbmem_virt) {
+		release_mem_region(fb_info.fbmem, fb_info.memsize);
+		debug("ioremap failed\n");
+		return -1;
+	}
+
+	debug("Trident board found : mem = %X,io = %X, mem_v = %X, io_v = %X\n",
+		fb_info.fbmem, fb_info.io, fb_info.fbmem_virt, fb_info.io_virt);
+
+	fb_info.gen.parsize = sizeof (struct tridentfb_par);
+	fb_info.gen.fbhw = &trident_hwswitch;
+
+	strcpy(fb_info.gen.info.modename, tridentfb_name);
+	displaytype = get_displaytype();
+	if(flatpanel)
+		fb_info.nativex = get_nativex();
+	fb_info.gen.info.changevar = NULL;
+	fb_info.gen.info.node = NODEV;
+	fb_info.gen.info.fbops = &tridentfb_ops;
+	fb_info.gen.info.disp = &disp;
+
+	fb_info.gen.info.switch_con = &fbgen_switch;
+	fb_info.gen.info.updatevar = &fbgen_update_var;
+	fb_info.gen.info.blank = &fbgen_blank;
+
+	fb_info.gen.info.flags = FBINFO_FLAG_DEFAULT;
+	fb_info.gen.info.fontname[0] = '\0';
+	fb_info.gen.info.pseudo_palette = pseudo_pal;
+
+	/* This should give a reasonable default video mode */
+	fb_find_mode(&default_var,&fb_info.gen.info,mode,NULL,0,NULL,bpp);
+	/*
+	 * Unless user explicitly requires accel/noaccel use
+	 * per chip defaults.Accel has priority over noaccel.
+	 */
+	if (accel)
+		defaultaccel = ACCEL;
+	else if (noaccel)
+		defaultaccel = NOACCEL;
+
+	if (defaultaccel == ACCEL)
+		default_var.accel_flags |= FB_ACCELF_TEXT;
+	else
+		default_var.accel_flags &= ~FB_ACCELF_TEXT;
+
+	trident_decode_var(&default_var, &fb_info.currentmode, &fb_info.gen);
+	fbgen_get_var(&disp.var, -1, &fb_info.gen.info);
+	default_var.activate |= FB_ACTIVATE_NOW;
+	fbgen_set_disp(-1, &fb_info.gen);
+
+	if (register_framebuffer(&fb_info.gen.info) < 0) {
+		printk("Could not register Trident framebuffer\n");
+		return -EINVAL;
+	}
+
+	output("fb%d: %s frame buffer device %dx%d-%dbpp\n",
+	   GET_FB_IDX(fb_info.gen.info.node), fb_info.gen.info.modename,default_var.xres,
+	   default_var.yres,default_var.bits_per_pixel);
+	return 0;
+}
+
+void __exit tridentfb_exit(void)
+{
+	unregister_framebuffer(&fb_info.gen.info);
+	iounmap((void *)fb_info.io_virt);
+	iounmap((void *)fb_info.fbmem_virt);
+}
+
+/*
+ * Parse user specified options (`video=trident:')
+ * example:
+ * 	video=trident:800x600,bpp=16,noaccel
+ */
+int tridentfb_setup(char *options)
+{
+	char * opt;
+	if (!options || !*options)
+		return 0;
+	for(opt = strtok(options,",");opt;opt = strtok(NULL,",")){
+		if (!opt) continue;
+		if (!strncmp(opt,"noaccel",7))
+			noaccel = 1;
+		else if (!strncmp(opt,"accel",5))
+			accel = 1;
+		else if (!strncmp(opt,"fp",2))
+			displaytype = DISPLAY_FP;
+		else if (!strncmp(opt,"crt",3))
+			displaytype = DISPLAY_CRT;
+		else if (!strncmp(opt,"bpp=",4))
+			bpp = simple_strtoul(opt+4,NULL,0);
+		else if (!strncmp(opt,"center",6))
+			center = 1;
+		else if (!strncmp(opt,"stretch",7))
+			stretch = 1;
+		else if (!strncmp(opt,"memsize=",8))
+			memsize = simple_strtoul(opt+8,NULL,0);
+		else if (!strncmp(opt,"memdiff=",8))
+			memdiff = simple_strtoul(opt+8,NULL,0);
+		else if (!strncmp(opt,"nativex=",8))
+			nativex = simple_strtoul(opt+8,NULL,0);
+		else
+			mode = opt;
+	}
+	return 0;
+}
+
+static struct fb_ops tridentfb_ops = {
+	fb_get_fix:fbgen_get_fix,
+	fb_get_var:fbgen_get_var,
+	fb_set_var:fbgen_set_var,
+	fb_get_cmap:fbgen_get_cmap,
+	fb_set_cmap:fbgen_set_cmap,
+	fb_pan_display:fbgen_pan_display,
+};
+
+#ifdef MODULE
+module_init(tridentfb_init);
+#endif
+module_exit(tridentfb_exit);
+
+MODULE_AUTHOR("Jani Monoses <jani@astechnix.ro>");
+MODULE_DESCRIPTION("Framebuffer driver for Trident cards");
+MODULE_LICENSE("GPL");
diff -urN linux-2.4.18-pre8/drivers/video/tridentfb.h linux/drivers/video/tridentfb.h
--- linux-2.4.18-pre8/drivers/video/tridentfb.h	Wed Dec 31 16:00:00 1969
+++ linux/drivers/video/tridentfb.h	Thu Feb  7 11:55:50 2002
@@ -0,0 +1,169 @@
+
+#ifndef TRIDENTFB_DEBUG
+#define TRIDENTFB_DEBUG 0
+#endif
+
+#if TRIDENTFB_DEBUG
+#define debug(f,a...)	printk("%s:" f,  __FUNCTION__ , ## a)
+#else
+#define debug(f,a...)
+#endif
+
+#define output(f, a...) printk("tridentfb: " f, ## a)
+
+#define Kb	(1024)
+#define Mb	(Kb*Kb)
+
+/* PCI IDS of supported cards temporarily here */
+
+#define CYBER9320	0x9320
+#define CYBER9388	0x9388
+#define CYBER9397	0x9397
+#define CYBER9397DVD	0x939A
+#define CYBER9520	0x9520
+#define CYBER9525DVD	0x9525
+#define IMAGE975	0x9750
+#define IMAGE985	0x9850
+#define BLADE3D		0x9880
+#define CYBERBLADEE4	0x9540
+#define CYBERBLADEi7	0x8400
+#define CYBERBLADEi7D	0x8420
+#define CYBERBLADEi1	0x8500
+#define CYBERBLADEi1D	0x8520
+#define CYBERBLADEAi1	0x8600
+#define CYBERBLADEAi1D	0x8620
+#define CYBERBLADEXPAi1 0x8820
+#define CYBERBLADEXPm8  0x9910
+#define CYBERBLADEXPm16 0x9930
+
+/* acceleration families */
+#define IMAGE	0
+#define BLADE	1
+#define XP	2
+
+#define is_image()	(family == IMAGE)
+#define is_blade()	(family == BLADE)
+#define is_xp()		(family == XP)
+
+/* these defines are for 'lcd' variable */
+#define LCD_STRETCH	0
+#define LCD_CENTER	1
+#define LCD_BIOS	2
+
+/* display types */
+#define DISPLAY_CRT	0
+#define DISPLAY_FP	1
+
+#define flatpanel (displaytype == DISPLAY_FP)
+/* these are for defaultaccel variable */
+#define ACCEL	1
+#define NOACCEL	0
+
+#define TRIDENT_IOSIZE	0x20000
+#define NTSC 14.31818
+#define PAL  17.73448
+
+/* General Registers */
+#define SPR	0x1F		/* Software Programming Register (videoram) */
+
+/* 3C4 */
+#define RevisionID 0x09
+#define OldOrNew 0x0B
+#define ConfPort1 0x0C
+#define ConfPort2 0x0C
+#define NewMode2 0x0D
+#define NewMode1 0x0E
+#define Protection 0x11
+#define MCLKLow 0x16
+#define MCLKHigh 0x17
+#define ClockLow 0x18
+#define ClockHigh 0x19
+#define SSetup 0x20
+#define SKey 0x37
+#define SPKey 0x57
+
+/* 0x3x4 */
+#define CRTHTotal	0x00
+#define CRTHDispEnd	0x01
+#define CRTHBlankStart	0x02
+#define CRTHBlankEnd	0x03
+#define CRTHSyncStart	0x04
+#define CRTHSyncEnd	0x05
+
+#define CRTVTotal	0x06
+#define CRTVDispEnd	0x12
+#define CRTVBlankStart	0x15
+#define CRTVBlankEnd	0x16
+#define CRTVSyncStart	0x10
+#define CRTVSyncEnd	0x11
+
+#define CRTOverflow	0x07
+#define CRTPRowScan	0x08
+#define CRTMaxScanLine	0x09
+#define CRTModeControl	0x17
+#define CRTLineCompare	0x18
+
+/* 3x4 */
+#define StartAddrHigh 0x0C
+#define StartAddrLow 0x0D
+#define Offset 0x13
+#define Underline 0x14
+#define CRTCMode 0x17
+#define CRTCModuleTest 0x1E
+#define FIFOControl 0x20
+#define LinearAddReg 0x21
+#define DRAMTiming 0x23
+#define New32 0x23
+#define RAMDACTiming 0x25
+#define CRTHiOrd 0x27
+#define AddColReg 0x29
+#define InterfaceSel 0x2A
+#define HorizOverflow 0x2B
+#define GETest 0x2D
+#define Performance 0x2F
+#define GraphEngReg 0x36
+#define I2C 0x37
+#define PixelBusReg 0x38
+#define PCIReg 0x39
+#define DRAMControl 0x3A
+#define MiscContReg 0x3C
+#define CursorXLow 0x40
+#define CursorXHigh 0x41
+#define CursorYLow 0x42
+#define CursorYHigh 0x43
+#define CursorLocLow 0x44
+#define CursorLocHigh 0x45
+#define CursorXOffset 0x46
+#define CursorYOffset 0x47
+#define CursorFG1 0x48
+#define CursorFG2 0x49
+#define CursorFG3 0x4A
+#define CursorFG4 0x4B
+#define CursorBG1 0x4C
+#define CursorBG2 0x4D
+#define CursorBG3 0x4E
+#define CursorBG4 0x4F
+#define CursorControl 0x50
+#define PCIRetry 0x55
+#define PreEndControl 0x56
+#define PreEndFetch 0x57
+#define PCIMaster 0x60
+#define Enhancement0 0x62
+#define NewEDO 0x64
+#define TVinterface 0xC0
+#define TVMode 0xC1
+#define ClockControl 0xCF
+
+
+/* 3CE */
+#define MiscExtFunc 0x0F
+#define PowerStatus 0x23
+#define MiscIntContReg 0x2F
+#define CyberControl 0x30
+#define CyberEnhance 0x31
+#define FPConfig     0x33
+#define VertStretch  0x52
+#define HorStretch   0x53
+#define BiosMode     0x5c
+#define BiosReg      0x5d
+
diff -urN linux-2.4.18-pre8/fs/buffer.c linux/fs/buffer.c
--- linux-2.4.18-pre8/fs/buffer.c	Thu Feb  7 11:55:40 2002
+++ linux/fs/buffer.c	Thu Feb  7 11:55:50 2002
@@ -2724,6 +2724,9 @@
 	printk("Buffer memory:   %6dkB\n",
 			atomic_read(&buffermem_pages) << (PAGE_SHIFT-10));
 
+	printk("Cache memory:   %6dkB\n",
+			(atomic_read(&page_cache_size)- atomic_read(&buffermem_pages)) << (PAGE_SHIFT-10));
+
 #ifdef CONFIG_SMP /* trylock does nothing on UP and so we could deadlock */
 	if (!spin_trylock(&lru_list_lock))
 		return;
diff -urN linux-2.4.18-pre8/fs/freevxfs/vxfs_kcompat.h linux/fs/freevxfs/vxfs_kcompat.h
--- linux-2.4.18-pre8/fs/freevxfs/vxfs_kcompat.h	Wed Dec 31 16:00:00 1969
+++ linux/fs/freevxfs/vxfs_kcompat.h	Thu Feb  7 11:55:50 2002
@@ -0,0 +1,43 @@
+#ifndef _VXFS_KCOMPAT_H
+#define _VXFS_KCOMPAT_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+
+#include <linux/blkdev.h>
+
+typedef long sector_t;
+
+/* Dito.  */
+static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block)
+{
+	bh->b_state |= 1 << BH_Mapped;
+	bh->b_dev = sb->s_dev;
+	bh->b_blocknr = block;
+}
+
+/* From fs/block_dev.c (Linux 2.5.2-pre2)  */
+static inline int sb_set_blocksize(struct super_block *sb, int size)
+{
+	int bits;
+	if (set_blocksize(sb->s_dev, size) < 0)
+		return 0;
+	sb->s_blocksize = size;
+	for (bits = 9, size >>= 9; size >>= 1; bits++)
+		;
+	sb->s_blocksize_bits = bits;
+	return sb->s_blocksize;
+}
+
+/* Dito.  */
+static inline int sb_min_blocksize(struct super_block *sb, int size)
+{
+	int minsize = get_hardsect_size(sb->s_dev);
+	if (size < minsize)
+		size = minsize;
+	return sb_set_blocksize(sb, size);
+}
+
+#endif /* Kernel 2.4 */
+#endif /* _VXFS_KCOMPAT_H */
diff -urN linux-2.4.18-pre8/fs/partitions/check.c linux/fs/partitions/check.c
--- linux-2.4.18-pre8/fs/partitions/check.c	Thu Oct 11 17:25:10 2001
+++ linux/fs/partitions/check.c	Thu Feb  7 11:55:50 2002
@@ -338,7 +338,8 @@
 	if (!unregister)
 		devfs_register_disc (dev, minor);
 	for (part = 1; part < dev->max_p; part++) {
-		if ( unregister || (dev->part[part + minor].nr_sects < 1) ) {
+		if ( unregister || (dev->part[minor].nr_sects < 1) ||
+		     (dev->part[part + minor].nr_sects < 1) ) {
 			devfs_unregister (dev->part[part + minor].de);
 			dev->part[part + minor].de = NULL;
 			continue;
@@ -383,6 +384,8 @@
 
 	dev->part[first_minor].nr_sects = size;
 	/* No such device or no minors to use for partitions */
+	if ( !size && dev->flags && (dev->flags[drive] & GENHD_FL_REMOVABLE) )
+		devfs_register_partitions (dev, first_minor, 0);
 	if (!size || minors == 1)
 		return;
 
diff -urN linux-2.4.18-pre8/fs/reiserfs/inode.c linux/fs/reiserfs/inode.c
--- linux-2.4.18-pre8/fs/reiserfs/inode.c	Thu Feb  7 11:55:41 2002
+++ linux/fs/reiserfs/inode.c	Thu Feb  7 11:55:50 2002
@@ -1155,6 +1155,7 @@
 	/* a stale NFS handle can trigger this without it being an error */
 	pathrelse (&path_to_sd);
 	make_bad_inode(inode) ;
+	inode->i_nlink = 0;
 	return;
     }
 
@@ -1187,6 +1188,27 @@
 
 }
 
+/**
+ * reiserfs_find_actor() - "find actor" reiserfs supplies to iget4().
+ *
+ * @inode:    inode from hash table to check
+ * @inode_no: inode number we are looking for
+ * @opaque:   "cookie" passed to iget4(). This is &reiserfs_iget4_args.
+ *
+ * This function is called by iget4() to distinguish reiserfs inodes
+ * having the same inode numbers. Such inodes can only exist due to some
+ * error condition. One of them should be bad. Inodes with identical
+ * inode numbers (objectids) are distinguished by parent directory ids.
+ *
+ */
+static int reiserfs_find_actor( struct inode *inode, 
+				unsigned long inode_no, void *opaque )
+{
+    struct reiserfs_iget4_args *args;
+
+    args = opaque;
+    return INODE_PKEY( inode ) -> k_dir_id == args -> objectid;
+}
 
 struct inode * reiserfs_iget (struct super_block * s, const struct cpu_key * key)
 {
@@ -1194,7 +1216,8 @@
     struct reiserfs_iget4_args args ;
 
     args.objectid = key->on_disk_key.k_dir_id ;
-    inode = iget4 (s, key->on_disk_key.k_objectid, 0, (void *)(&args));
+    inode = iget4 (s, key->on_disk_key.k_objectid, 
+		   reiserfs_find_actor, (void *)(&args));
     if (!inode) 
 	return ERR_PTR(-ENOMEM) ;
 
diff -urN linux-2.4.18-pre8/fs/reiserfs/stree.c linux/fs/reiserfs/stree.c
--- linux-2.4.18-pre8/fs/reiserfs/stree.c	Fri Dec 21 09:42:03 2001
+++ linux/fs/reiserfs/stree.c	Thu Feb  7 11:55:50 2002
@@ -126,19 +126,19 @@
   retval = comp_short_keys (le_key, cpu_key);
   if (retval)
       return retval;
-  if (le_key_k_offset (cpu_key->version, le_key) < cpu_key_k_offset (cpu_key))
+  if (le_key_k_offset (le_key_version(le_key), le_key) < cpu_key_k_offset (cpu_key))
       return -1;
-  if (le_key_k_offset (cpu_key->version, le_key) > cpu_key_k_offset (cpu_key))
+  if (le_key_k_offset (le_key_version(le_key), le_key) > cpu_key_k_offset (cpu_key))
       return 1;
 
   if (cpu_key->key_length == 3)
       return 0;
 
   /* this part is needed only when tail conversion is in progress */
-  if (le_key_k_type (cpu_key->version, le_key) < cpu_key_k_type (cpu_key))
+  if (le_key_k_type (le_key_version(le_key), le_key) < cpu_key_k_type (cpu_key))
     return -1;
 
-  if (le_key_k_type (cpu_key->version, le_key) > cpu_key_k_type (cpu_key))
+  if (le_key_k_type (le_key_version(le_key), le_key) > cpu_key_k_type (cpu_key))
     return 1;
 
   return 0;
diff -urN linux-2.4.18-pre8/include/asm-cris/ethernet.h linux/include/asm-cris/ethernet.h
--- linux-2.4.18-pre8/include/asm-cris/ethernet.h	Wed Dec 31 16:00:00 1969
+++ linux/include/asm-cris/ethernet.h	Thu Feb  7 11:55:50 2002
@@ -0,0 +1,18 @@
+/*  
+ * ioctl defines for ethernet driver
+ *
+ * Copyright (c) 2001 Axis Communications AB
+ * 
+ * Author: Mikael Starvik 
+ *
+ */
+
+#ifndef _CRIS_ETHERNET_H
+#define _CRIS_ETHERNET_H
+#define SET_ETH_SPEED_AUTO      SIOCDEVPRIVATE          /* Auto neg speed */
+#define SET_ETH_SPEED_10        SIOCDEVPRIVATE+1        /* 10 Mbps */
+#define SET_ETH_SPEED_100       SIOCDEVPRIVATE+2        /* 100 Mbps. */
+#define SET_ETH_DUPLEX_AUTO     SIOCDEVPRIVATE+3        /* Auto neg duplex */
+#define SET_ETH_DUPLEX_HALF     SIOCDEVPRIVATE+4        /* Full duplex */
+#define SET_ETH_DUPLEX_FULL     SIOCDEVPRIVATE+5        /* Half duplex */
+#endif /* _CRIS_ETHERNET_H */
diff -urN linux-2.4.18-pre8/include/asm-sparc64/delay.h linux/include/asm-sparc64/delay.h
--- linux-2.4.18-pre8/include/asm-sparc64/delay.h	Thu Apr 26 22:17:26 2001
+++ linux/include/asm-sparc64/delay.h	Thu Feb  7 11:55:50 2002
@@ -1,4 +1,4 @@
-/* $Id: delay.h,v 1.12 2001/04/24 01:09:12 davem Exp $
+/* $Id: delay.h,v 1.12.2.1 2002/02/02 02:11:52 kanoj Exp $
  * delay.h: Linux delay routines on the V9.
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu).
@@ -9,9 +9,13 @@
 
 #include <linux/config.h>
 #include <linux/param.h>
+
+#ifndef __ASSEMBLY__
+
 #ifdef CONFIG_SMP
-#include <linux/sched.h>
 #include <asm/smp.h>
+#else
+extern unsigned long loops_per_jiffy;
 #endif 
 
 extern __inline__ void __delay(unsigned long loops)
@@ -48,5 +52,7 @@
 #endif
 
 #define udelay(usecs) __udelay((usecs),__udelay_val)
+
+#endif /* !__ASSEMBLY__ */
 
 #endif /* defined(__SPARC64_DELAY_H) */
diff -urN linux-2.4.18-pre8/include/asm-sparc64/elf.h linux/include/asm-sparc64/elf.h
--- linux-2.4.18-pre8/include/asm-sparc64/elf.h	Fri Sep  7 11:01:20 2001
+++ linux/include/asm-sparc64/elf.h	Thu Feb  7 11:55:50 2002
@@ -1,4 +1,4 @@
-/* $Id: elf.h,v 1.30 2001/08/30 23:35:38 kanoj Exp $ */
+/* $Id: elf.h,v 1.30.2.1 2002/02/04 22:37:47 davem Exp $ */
 #ifndef __ASM_SPARC64_ELF_H
 #define __ASM_SPARC64_ELF_H
 
@@ -75,24 +75,7 @@
 	else						\
 		flags &= ~SPARC_FLAG_32BIT;		\
 	if (flags != current->thread.flags) {		\
-		unsigned long pgd_cache = 0UL;		\
-		if (flags & SPARC_FLAG_32BIT) {		\
-		  pgd_t *pgd0 = &current->mm->pgd[0];	\
-		  if (pgd_none (*pgd0)) {		\
-		    pmd_t *page = pmd_alloc_one_fast(NULL, 0);	\
-		    if (!page)				\
-		      page = pmd_alloc_one(NULL, 0);	\
-                    pgd_set(pgd0, page);		\
-		  }					\
-		  pgd_cache = pgd_val(*pgd0) << 11UL;	\
-		}					\
-		__asm__ __volatile__(			\
-			"stxa\t%0, [%1] %2\n\t"		\
-			"membar #Sync"			\
-			: /* no outputs */		\
-			: "r" (pgd_cache),		\
-			  "r" (TSB_REG),		\
-			  "i" (ASI_DMMU));		\
+		/* flush_thread will update pgd cache */\
 		current->thread.flags = flags;		\
 	}						\
 							\
diff -urN linux-2.4.18-pre8/include/asm-sparc64/processor.h linux/include/asm-sparc64/processor.h
--- linux-2.4.18-pre8/include/asm-sparc64/processor.h	Fri Dec 21 09:42:03 2001
+++ linux/include/asm-sparc64/processor.h	Thu Feb  7 11:55:50 2002
@@ -1,4 +1,4 @@
-/* $Id: processor.h,v 1.80 2001/11/17 00:10:48 davem Exp $
+/* $Id: processor.h,v 1.80.2.1 2002/02/02 02:11:52 kanoj Exp $
  * include/asm-sparc64/processor.h
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -21,6 +21,7 @@
 #include <asm/signal.h>
 #include <asm/segment.h>
 #include <asm/page.h>
+#include <asm/delay.h>
 
 /* Bus types */
 #define EISA_bus 0
@@ -304,7 +305,7 @@
 #define init_task	(init_task_union.task)
 #define init_stack	(init_task_union.stack)
 
-#define cpu_relax()	do { } while (0)
+#define cpu_relax()	udelay(1 + smp_processor_id())
 
 #endif /* __KERNEL__ */
 
diff -urN linux-2.4.18-pre8/include/linux/netfilter_ipv4.h linux/include/linux/netfilter_ipv4.h
--- linux-2.4.18-pre8/include/linux/netfilter_ipv4.h	Thu Feb  7 11:55:41 2002
+++ linux/include/linux/netfilter_ipv4.h	Thu Feb  7 11:55:50 2002
@@ -59,95 +59,20 @@
 	NF_IP_PRI_LAST = INT_MAX,
 };
 
-#ifdef CONFIG_NETFILTER_DEBUG
-#ifdef __KERNEL__
-void nf_debug_ip_local_deliver(struct sk_buff *skb);
-void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
-void nf_debug_ip_finish_output2(struct sk_buff *skb);
-#endif /*__KERNEL__*/
-#endif /*CONFIG_NETFILTER_DEBUG*/
-
 /* Arguments for setsockopt SOL_IP: */
 /* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
 /* 2.2 firewalling (+ masq) went from 64 through 76 */
 /* 2.4 firewalling went 64 through 67. */
 #define SO_ORIGINAL_DST 80
 
+#ifdef __KERNEL__
+#ifdef CONFIG_NETFILTER_DEBUG
+void nf_debug_ip_local_deliver(struct sk_buff *skb);
+void nf_debug_ip_loopback_xmit(struct sk_buff *newskb);
+void nf_debug_ip_finish_output2(struct sk_buff *skb);
+#endif /*CONFIG_NETFILTER_DEBUG*/
 
-/* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue 
- *
- * Ideally this would be ins some netfilter_utility module, but creating this
- * module for just one function doesn't make sense. -HW */
-
-#include <linux/netdevice.h>
-#include <linux/inetdevice.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
-#include <net/route.h>
-#include <linux/ip.h>
-
-static inline int route_me_harder(struct sk_buff **pskb)
-{
-	struct iphdr *iph = (*pskb)->nh.iph;
-	struct rtable *rt;
-	struct rt_key key = { dst:iph->daddr,
-			      src:iph->saddr,
-			      oif:(*pskb)->sk ? (*pskb)->sk->bound_dev_if : 0,
-			      tos:RT_TOS(iph->tos)|RTO_CONN,
-#ifdef CONFIG_IP_ROUTE_FWMARK
-			      fwmark:(*pskb)->nfmark
-#endif
-			    };
-	struct net_device *dev_src = NULL;
-	int err;
-
-	/* accomodate ip_route_output_slow(), which expects the key src to be
-	   0 or a local address; however some non-standard hacks like
-	   ipt_REJECT.c:send_reset() can cause packets with foreign
-           saddr to be appear on the NF_IP_LOCAL_OUT hook -MB */
-	if(key.src && !(dev_src = ip_dev_find(key.src)))
-		key.src = 0;
-
-	if ((err=ip_route_output_key(&rt, &key)) != 0) {
-		printk("route_me_harder: ip_route_output_key(dst=%u.%u.%u.%u, src=%u.%u.%u.%u, oif=%d, tos=0x%x, fwmark=0x%lx) error %d\n",
-			NIPQUAD(iph->daddr), NIPQUAD(iph->saddr),
-			(*pskb)->sk ? (*pskb)->sk->bound_dev_if : 0,
-			RT_TOS(iph->tos)|RTO_CONN,
-#ifdef CONFIG_IP_ROUTE_FWMARK
-			(*pskb)->nfmark,
-#else
-			0UL,
-#endif
-			err);
-		goto out;
-	}
-
-	/* Drop old route. */
-	dst_release((*pskb)->dst);
-
-	(*pskb)->dst = &rt->u.dst;
-
-	/* Change in oif may mean change in hh_len. */
-	if (skb_headroom(*pskb) < (*pskb)->dst->dev->hard_header_len) {
-		struct sk_buff *nskb;
-
-		nskb = skb_realloc_headroom(*pskb,
-					    (*pskb)->dst->dev->hard_header_len);
-		if (!nskb) {
-			err = -ENOMEM;
-			goto out;
-		}
-		if ((*pskb)->sk)
-			skb_set_owner_w(nskb, (*pskb)->sk);
-		kfree_skb(*pskb);
-		*pskb = nskb;
-	}
-
-out:
-	if (dev_src)
-		dev_put(dev_src);
-
-	return err;
-}
+extern int ip_route_me_harder(struct sk_buff **pskb);
+#endif /*__KERNEL__*/
 
 #endif /*__LINUX_IP_NETFILTER_H*/
diff -urN linux-2.4.18-pre8/include/linux/sonypi.h linux/include/linux/sonypi.h
--- linux-2.4.18-pre8/include/linux/sonypi.h	Thu Feb  7 11:55:41 2002
+++ linux/include/linux/sonypi.h	Thu Feb  7 11:55:50 2002
@@ -73,7 +73,8 @@
 #define SONYPI_EVENT_BACK_PRESSED		35
 #define SONYPI_EVENT_LID_CLOSED			36
 #define SONYPI_EVENT_LID_OPENED			37
-
+#define SONYPI_EVENT_BLUETOOTH_ON		38
+#define SONYPI_EVENT_BLUETOOTH_OFF		39
 
 /* get/set brightness */
 #define SONYPI_IOCGBRT		_IOR('v', 0, __u8)
@@ -90,6 +91,10 @@
 #define SONYPI_BFLAGS_B2	0x02
 #define SONYPI_BFLAGS_AC	0x04
 #define SONYPI_IOCGBATFLAGS	_IOR('v', 7, __u8)
+
+/* get/set bluetooth subsystem state on/off */
+#define SONYPI_IOCGBLUE		_IOR('v', 8, __u8)
+#define SONYPI_IOCSBLUE		_IOW('v', 9, __u8)
 
 #ifdef __KERNEL__
 
diff -urN linux-2.4.18-pre8/kernel/ksyms.c linux/kernel/ksyms.c
--- linux-2.4.18-pre8/kernel/ksyms.c	Thu Feb  7 11:55:41 2002
+++ linux/kernel/ksyms.c	Thu Feb  7 11:55:50 2002
@@ -257,6 +257,7 @@
 EXPORT_SYMBOL(grab_cache_page);
 EXPORT_SYMBOL(grab_cache_page_nowait);
 EXPORT_SYMBOL(read_cache_page);
+EXPORT_SYMBOL(set_page_dirty);
 EXPORT_SYMBOL(vfs_readlink);
 EXPORT_SYMBOL(vfs_follow_link);
 EXPORT_SYMBOL(page_readlink);
@@ -460,6 +461,7 @@
 EXPORT_SYMBOL(kdevname);
 EXPORT_SYMBOL(bdevname);
 EXPORT_SYMBOL(cdevname);
+EXPORT_SYMBOL(simple_strtol);
 EXPORT_SYMBOL(simple_strtoul);
 EXPORT_SYMBOL(simple_strtoull);
 EXPORT_SYMBOL(system_utsname);	/* UTS data */
diff -urN linux-2.4.18-pre8/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c
--- linux-2.4.18-pre8/net/ax25/af_ax25.c	Thu Sep 13 17:16:23 2001
+++ linux/net/ax25/af_ax25.c	Thu Feb  7 11:55:50 2002
@@ -102,6 +102,7 @@
  *			Joerg(DL1BKE)		Added support for SO_BINDTODEVICE
  *			Arnaldo C. Melo		s/suser/capable(CAP_NET_ADMIN)/, some more cleanups
  *			Michal Ostrowski	Module initialization cleanup.
+ *			Jeroen(PE1RXQ)		Use sock_orphan() on release.
  */
 
 #include <linux/config.h>
@@ -1018,7 +1019,7 @@
 				sk->state                = TCP_CLOSE;
 				sk->shutdown            |= SEND_SHUTDOWN;
 				sk->state_change(sk);
-				sk->dead                 = 1;
+				sock_orphan(sk);
 				sk->destroy              = 1;
 				break;
 
@@ -1029,7 +1030,7 @@
 		sk->state     = TCP_CLOSE;
 		sk->shutdown |= SEND_SHUTDOWN;
 		sk->state_change(sk);
-		sk->dead      = 1;
+		sock_orphan(sk);
 		ax25_destroy_socket(sk->protinfo.ax25);
 	}
 
diff -urN linux-2.4.18-pre8/net/core/netfilter.c linux/net/core/netfilter.c
--- linux-2.4.18-pre8/net/core/netfilter.c	Fri Apr 27 14:15:01 2001
+++ linux/net/core/netfilter.c	Thu Feb  7 11:55:50 2002
@@ -20,6 +20,10 @@
 #include <linux/if.h>
 #include <linux/netdevice.h>
 #include <linux/brlock.h>
+#include <linux/inetdevice.h>
+#include <net/sock.h>
+#include <net/route.h>
+#include <linux/ip.h>
 
 #define __KERNEL_SYSCALLS__
 #include <linux/unistd.h>
@@ -552,6 +556,73 @@
 	kfree(info);
 	return;
 }
+
+#ifdef CONFIG_INET
+/* route_me_harder function, used by iptable_nat, iptable_mangle + ip_queue */
+int ip_route_me_harder(struct sk_buff **pskb)
+{
+	struct iphdr *iph = (*pskb)->nh.iph;
+	struct rtable *rt;
+	struct rt_key key = { dst:iph->daddr,
+			      src:iph->saddr,
+			      oif:(*pskb)->sk ? (*pskb)->sk->bound_dev_if : 0,
+			      tos:RT_TOS(iph->tos)|RTO_CONN,
+#ifdef CONFIG_IP_ROUTE_FWMARK
+			      fwmark:(*pskb)->nfmark
+#endif
+			    };
+	struct net_device *dev_src = NULL;
+	int err;
+
+	/* accomodate ip_route_output_slow(), which expects the key src to be
+	   0 or a local address; however some non-standard hacks like
+	   ipt_REJECT.c:send_reset() can cause packets with foreign
+           saddr to be appear on the NF_IP_LOCAL_OUT hook -MB */
+	if(key.src && !(dev_src = ip_dev_find(key.src)))
+		key.src = 0;
+
+	if ((err=ip_route_output_key(&rt, &key)) != 0) {
+		printk("route_me_harder: ip_route_output_key(dst=%u.%u.%u.%u, src=%u.%u.%u.%u, oif=%d, tos=0x%x, fwmark=0x%lx) error %d\n",
+			NIPQUAD(iph->daddr), NIPQUAD(iph->saddr),
+			(*pskb)->sk ? (*pskb)->sk->bound_dev_if : 0,
+			RT_TOS(iph->tos)|RTO_CONN,
+#ifdef CONFIG_IP_ROUTE_FWMARK
+			(*pskb)->nfmark,
+#else
+			0UL,
+#endif
+			err);
+		goto out;
+	}
+
+	/* Drop old route. */
+	dst_release((*pskb)->dst);
+
+	(*pskb)->dst = &rt->u.dst;
+
+	/* Change in oif may mean change in hh_len. */
+	if (skb_headroom(*pskb) < (*pskb)->dst->dev->hard_header_len) {
+		struct sk_buff *nskb;
+
+		nskb = skb_realloc_headroom(*pskb,
+					    (*pskb)->dst->dev->hard_header_len);
+		if (!nskb) {
+			err = -ENOMEM;
+			goto out;
+		}
+		if ((*pskb)->sk)
+			skb_set_owner_w(nskb, (*pskb)->sk);
+		kfree_skb(*pskb);
+		*pskb = nskb;
+	}
+
+out:
+	if (dev_src)
+		dev_put(dev_src);
+
+	return err;
+}
+#endif /*CONFIG_INET*/
 
 /* This does not belong here, but ipt_REJECT needs it if connection
    tracking in use: without this, connection may not be in hash table,
diff -urN linux-2.4.18-pre8/net/ipv4/netfilter/ip_conntrack_irc.c linux/net/ipv4/netfilter/ip_conntrack_irc.c
--- linux-2.4.18-pre8/net/ipv4/netfilter/ip_conntrack_irc.c	Fri Dec 21 09:42:05 2001
+++ linux/net/ipv4/netfilter/ip_conntrack_irc.c	Thu Feb  7 11:55:50 2002
@@ -1,8 +1,8 @@
-/* IRC extension for IP connection tracking, Version 1.20
- * (C) 2000-2001 by Harald Welte <laforge@gnumonks.org>
+/* IRC extension for IP connection tracking, Version 1.21
+ * (C) 2000-2002 by Harald Welte <laforge@gnumonks.org>
  * based on RR's ip_conntrack_ftp.c	
  *
- * ip_conntrack_irc.c,v 1.20 2001/12/06 07:42:10 laforge Exp
+ * ip_conntrack_irc.c,v 1.21 2002/02/05 14:49:26 laforge Exp
  *
  *      This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -112,9 +112,9 @@
 
 	struct ip_ct_irc *info = &ct->help.ct_irc_info;
 
-	memset(&mask, 0, sizeof(struct ip_conntrack_tuple));
-	mask.dst.u.tcp.port = 0xFFFF;
-	mask.dst.protonum = 0xFFFF;
+	mask = ((struct ip_conntrack_tuple)
+		{ { 0, { 0 } },
+		  { 0xFFFFFFFF, { 0xFFFF }, 0xFFFF }});
 
 	DEBUGP("entered\n");
 	/* Can't track connections formed before we registered */
diff -urN linux-2.4.18-pre8/net/ipv4/netfilter/ip_nat_standalone.c linux/net/ipv4/netfilter/ip_nat_standalone.c
--- linux-2.4.18-pre8/net/ipv4/netfilter/ip_nat_standalone.c	Thu Feb  7 11:55:41 2002
+++ linux/net/ipv4/netfilter/ip_nat_standalone.c	Thu Feb  7 11:55:50 2002
@@ -188,7 +188,7 @@
 	if (ret != NF_DROP && ret != NF_STOLEN
 	    && ((*pskb)->nh.iph->saddr != saddr
 		|| (*pskb)->nh.iph->daddr != daddr))
-		return route_me_harder(pskb) == 0 ? ret : NF_DROP;
+		return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP;
 	return ret;
 }
 
diff -urN linux-2.4.18-pre8/net/ipv4/netfilter/ip_queue.c linux/net/ipv4/netfilter/ip_queue.c
--- linux-2.4.18-pre8/net/ipv4/netfilter/ip_queue.c	Thu Feb  7 11:55:41 2002
+++ linux/net/ipv4/netfilter/ip_queue.c	Thu Feb  7 11:55:50 2002
@@ -261,7 +261,7 @@
 		if (!(iph->tos == e->rt_info.tos
 		      && iph->daddr == e->rt_info.daddr
 		      && iph->saddr == e->rt_info.saddr))
-			return route_me_harder(&e->skb);
+			return ip_route_me_harder(&e->skb);
 	}
 	return 0;
 }
diff -urN linux-2.4.18-pre8/net/ipv4/netfilter/iptable_mangle.c linux/net/ipv4/netfilter/iptable_mangle.c
--- linux-2.4.18-pre8/net/ipv4/netfilter/iptable_mangle.c	Thu Feb  7 11:55:41 2002
+++ linux/net/ipv4/netfilter/iptable_mangle.c	Thu Feb  7 11:55:50 2002
@@ -162,7 +162,7 @@
 		|| (*pskb)->nh.iph->daddr != daddr
 		|| (*pskb)->nfmark != nfmark
 		|| (*pskb)->nh.iph->tos != tos))
-		return route_me_harder(pskb) == 0 ? ret : NF_DROP;
+		return ip_route_me_harder(pskb) == 0 ? ret : NF_DROP;
 
 	return ret;
 }
diff -urN linux-2.4.18-pre8/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c
--- linux-2.4.18-pre8/net/netrom/af_netrom.c	Mon Sep 10 07:58:35 2001
+++ linux/net/netrom/af_netrom.c	Thu Feb  7 11:55:51 2002
@@ -31,6 +31,7 @@
  *	NET/ROM 007	Jonathan(G4KLX)	New timer architecture.
  *					Impmented Idle timer.
  *			Arnaldo C. Melo s/suser/capable/, micro cleanups
+ *			Jeroen (PE1RXQ)	Use sock_orphan() on release.
  */
 
 #include <linux/config.h>
@@ -572,9 +573,8 @@
 			sk->state                = TCP_CLOSE;
 			sk->shutdown            |= SEND_SHUTDOWN;
 			sk->state_change(sk);
-			sk->dead                 = 1;
+			sock_orphan(sk);
 			sk->destroy              = 1;
-			sk->socket               = NULL;
 			break;
 
 		default:
@@ -838,17 +838,38 @@
 	frametype          = skb->data[19] & 0x0F;
 	flags              = skb->data[19] & 0xF0;
 
+	switch (frametype) {
+	case NR_PROTOEXT:
 #ifdef CONFIG_INET
-	/*
-	 * Check for an incoming IP over NET/ROM frame.
-	 */
-	if (frametype == NR_PROTOEXT && circuit_index == NR_PROTO_IP && circuit_id == NR_PROTO_IP) {
-		skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
-		skb->h.raw = skb->data;
+		/*
+		 * Check for an incoming IP over NET/ROM frame.
+		 */
+		if (circuit_index == NR_PROTO_IP && circuit_id == NR_PROTO_IP) {
+			skb_pull(skb, NR_NETWORK_LEN + NR_TRANSPORT_LEN);
+			skb->h.raw = skb->data;
 
-		return nr_rx_ip(skb, dev);
-	}
+			return nr_rx_ip(skb, dev);
+		}
 #endif
+		return 0;
+
+	case NR_CONNREQ:
+	case NR_CONNACK:
+	case NR_DISCREQ:
+	case NR_DISCACK:
+	case NR_INFO:
+	case NR_INFOACK:
+		/*
+		 * These frame types we understand.
+		 */
+		break;
+
+	default:
+		/*
+		 * Everything else is ignored.
+		 */
+		return 0;
+	}
 
 	/*
 	 * Find an existing socket connection, based on circuit ID, if it's
diff -urN linux-2.4.18-pre8/net/netsyms.c linux/net/netsyms.c
--- linux-2.4.18-pre8/net/netsyms.c	Thu Feb  7 11:55:41 2002
+++ linux/net/netsyms.c	Thu Feb  7 11:55:51 2002
@@ -577,6 +577,10 @@
 EXPORT_SYMBOL(nf_setsockopt);
 EXPORT_SYMBOL(nf_getsockopt);
 EXPORT_SYMBOL(ip_ct_attach);
+#ifdef CONFIG_INET
+#include <linux/netfilter_ipv4.h>
+EXPORT_SYMBOL(ip_route_me_harder);
+#endif
 #endif
 
 EXPORT_SYMBOL(register_gifconf);
diff -urN linux-2.4.18-pre8/net/rose/af_rose.c linux/net/rose/af_rose.c
--- linux-2.4.18-pre8/net/rose/af_rose.c	Mon Sep 10 07:58:35 2001
+++ linux/net/rose/af_rose.c	Thu Feb  7 11:55:51 2002
@@ -22,6 +22,10 @@
  *					Added use count to neighbour.
  *                      Tomi(OH2BNS)    Fixed rose_getname().
  *                      Arnaldo C. Melo s/suser/capable/ + micro cleanups
+ *                      Joroen (PE1RXQ) Use sock_orphan() on release.
+ *
+ *  ROSE 0.63	Jean-Paul(F6FBB) Fixed wrong length of L3 packets
+ *					Added CLEAR_REQUEST facilities
  */
 
 #include <linux/config.h>
@@ -650,16 +654,16 @@
 			sk->state                = TCP_CLOSE;
 			sk->shutdown            |= SEND_SHUTDOWN;
 			sk->state_change(sk);
-			sk->dead                 = 1;
+			sock_orphan(sk);
 			sk->destroy              = 1;
 			break;
 
 		default:
+			sk->socket = NULL;
 			break;
 	}
 
 	sock->sk = NULL;	
-	sk->socket = NULL;	/* Not used, but we should do this. **/
 
 	return 0;
 }
@@ -1429,7 +1433,7 @@
 
 static struct net_device *dev_rose;
 
-static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.62 for AX25.037 Linux 2.4\n";
+static const char banner[] = KERN_INFO "F6FBB/G4KLX ROSE for Linux. Version 0.63 for AX25.037 Linux 2.4\n";
 
 static int __init rose_proto_init(void)
 {
diff -urN linux-2.4.18-pre8/net/rose/rose_link.c linux/net/rose/rose_link.c
--- linux-2.4.18-pre8/net/rose/rose_link.c	Fri Dec 29 14:44:46 2000
+++ linux/net/rose/rose_link.c	Thu Feb  7 11:55:51 2002
@@ -264,15 +264,21 @@
 	struct sk_buff *skb;
 	unsigned char *dptr;
 	int len;
+	struct net_device *first;
+	int faclen = 0;
 
 	len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3;
 
-	if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL)
+	first = rose_dev_first();
+	if (first)
+		faclen = 6 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN;
+	
+	if ((skb = alloc_skb(len + faclen, GFP_ATOMIC)) == NULL)
 		return;
 
 	skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN);
 
-	dptr = skb_put(skb, ROSE_MIN_LEN + 3);
+	dptr = skb_put(skb, ROSE_MIN_LEN + 3 + faclen);
 
 	*dptr++ = AX25_P_ROSE;
 	*dptr++ = ((lci >> 8) & 0x0F) | ROSE_GFI;
@@ -280,6 +286,21 @@
 	*dptr++ = ROSE_CLEAR_REQUEST;
 	*dptr++ = cause;
 	*dptr++ = diagnostic;
+
+	if (first) {	
+		*dptr++ = 0x00;		/* Address length */
+		*dptr++ = 4 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN; /* Facilities length */
+		*dptr++ = 0;
+		*dptr++ = FAC_NATIONAL;
+		*dptr++ = FAC_NATIONAL_FAIL_CALL;
+		*dptr++ = AX25_ADDR_LEN;
+		memcpy(dptr, &rose_callsign, AX25_ADDR_LEN);
+		dptr += AX25_ADDR_LEN;
+		*dptr++ = FAC_NATIONAL_FAIL_ADD;
+		*dptr++ = ROSE_ADDR_LEN + 1;
+		*dptr++ = ROSE_ADDR_LEN * 2;
+		memcpy(dptr, first->dev_addr, ROSE_ADDR_LEN);
+	}
 
 	if (!rose_send_frame(skb, neigh))
 		kfree_skb(skb);
diff -urN linux-2.4.18-pre8/net/rose/rose_subr.c linux/net/rose/rose_subr.c
--- linux-2.4.18-pre8/net/rose/rose_subr.c	Fri Jun 29 19:38:26 2001
+++ linux/net/rose/rose_subr.c	Thu Feb  7 11:55:51 2002
@@ -114,9 +114,10 @@
 	unsigned char  lci1, lci2;
 	char buffer[100];
 	int len, faclen = 0;
+	int ax25_header_len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + 1;
 
-	len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 1;
-
+	len = ax25_header_len + ROSE_MIN_LEN;
+	
 	switch (frametype) {
 		case ROSE_CALL_REQUEST:
 			len   += 1 + ROSE_ADDR_LEN + ROSE_ADDR_LEN;
@@ -124,10 +125,27 @@
 			len   += faclen;
 			break;
 		case ROSE_CALL_ACCEPTED:
-		case ROSE_CLEAR_REQUEST:
 		case ROSE_RESET_REQUEST:
 			len   += 2;
 			break;
+		case ROSE_CLEAR_REQUEST:
+			len   += 3;
+			/* facilities */
+			faclen = 3 + 2 + AX25_ADDR_LEN + 3 + ROSE_ADDR_LEN;
+			dptr = buffer;
+			*dptr++ = faclen-1;	/* Facilities length */
+			*dptr++ = 0;
+			*dptr++ = FAC_NATIONAL;
+			*dptr++ = FAC_NATIONAL_FAIL_CALL;
+			*dptr++ = AX25_ADDR_LEN;
+			memcpy(dptr, &rose_callsign, AX25_ADDR_LEN);
+			dptr += AX25_ADDR_LEN;
+			*dptr++ = FAC_NATIONAL_FAIL_ADD;
+			*dptr++ = ROSE_ADDR_LEN + 1;
+			*dptr++ = ROSE_ADDR_LEN * 2;
+			memcpy(dptr, &sk->protinfo.rose->source_addr, ROSE_ADDR_LEN);
+			len   += faclen;
+			break;
 	}
 
 	if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL)
@@ -136,9 +154,9 @@
 	/*
 	 *	Space for AX.25 header and PID.
 	 */
-	skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + 1);
+	skb_reserve(skb, ax25_header_len);
 	
-	dptr = skb_put(skb, skb_tailroom(skb));
+	dptr = skb_put(skb, len - ax25_header_len);
 
 	lci1 = (sk->protinfo.rose->lci >> 8) & 0x0F;
 	lci2 = (sk->protinfo.rose->lci >> 0) & 0xFF;
@@ -172,6 +190,9 @@
 			*dptr++ = frametype;
 			*dptr++ = sk->protinfo.rose->cause;
 			*dptr++ = sk->protinfo.rose->diagnostic;
+			*dptr++ = 0x00;		/* Address length */
+			memcpy(dptr, buffer, faclen);
+			dptr   += faclen;
 			break;
 
 		case ROSE_RESET_REQUEST:
diff -urN linux-2.4.18-pre8/scripts/mkspec linux/scripts/mkspec
--- linux-2.4.18-pre8/scripts/mkspec	Mon Sep 17 23:04:05 2001
+++ linux/scripts/mkspec	Thu Feb  7 11:55:51 2002
@@ -8,7 +8,7 @@
 #
 echo "Name: kernel"
 echo "Summary: The Linux Kernel"
-echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//"
+echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g"
 # we need to determine the NEXT version number so that uname and
 # rpm -q will agree
 echo "Release: `. scripts/mkversion`"
@@ -17,7 +17,7 @@
 echo "Vendor: The Linux Community"
 echo "URL: http://www.kernel.org"
 echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
-echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//"
+echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g"
 echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
 echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
 echo ""
