r2051 - in trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian: . patches patches/series

Joshua Kwan joshk@haydn.debian.org
Fri, 24 Dec 2004 15:36:18 -0700


Author: joshk
Date: 2004-12-24 15:36:04 -0700 (Fri, 24 Dec 2004)
New Revision: 2051

Added:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-cg6-fix.dpatch
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-warning-fixes.dpatch
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-hypersparc-dvma.dpatch
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-sun4d-support.dpatch
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-vm-fault-codes.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-11
Log:
add hella sparc32 shit


Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2004-12-24 22:36:04 UTC (rev 2051)
@@ -38,7 +38,7 @@
 
   * [SECURITY] additional x86_64 buffer overflow fix; this time,
     sys32_quotactl (Andres Salomon).
- 
+
   * [SECURITY] fix ip_conntrack_ftp leak;
     https://lists.netfilter.org/pipermail/netfilter-devel/2004-December/017677.html
     Thanks to Fabio M. Di Nitto for pointing this out (Andres Salomon).
@@ -55,7 +55,7 @@
   * Fix Revoltec USB burner problem introduced in 2.6.8.  Thanks
     to Ian Gulliver.  Note to other bug reporters: I accept bribes..
     (Andres Salomon) (closes: #285168).
- 
+
   * [SECURITY] Fix more kernel_read() problems; results weren't being
     validated properly.  See
     http://seclists.org/lists/bugtraq/2004/Dec/0214.html for additional
@@ -76,8 +76,15 @@
     - pegasos via-ide dual interrupt fix.
     (Sven Luther)
 
- -- Andres Salomon <dilinger@voxel.net>  Fri, 24 Dec 2004 00:38:49 -0500
+  * Sparc fixes from 2.6.10-rc3-wli-1:
+    - fix DVMA on UP HyperSPARC (fixes hack used in sparc32-initrd-memcpy)
+    - Chris Newport and Thomas Bogendoerfer's sun4d support patch.
+    - A lot of warning fixes for RTC/__exit/serial code.
+    - Fix cg6 framebuffer initialization.
+    - fix up VM fault code handling
 
+ -- Joshua Kwan <joshk@triplehelix.org>  Fri, 24 Dec 2004 14:33:09 -0800
+
 kernel-source-2.6.8 (2.6.8-10) unstable; urgency=high
 
   * Fix missing backport of ssleep declaration so that new aic7xxx works.

Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-11
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-11	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-11	2004-12-24 22:36:04 UTC (rev 2051)
@@ -26,3 +26,8 @@
 + powerpc-misc-powermac-fixes.dpatch
 + powerpc-serial.dpatch
 + powerpc-pegasos-via82cxxx.dpatch
++ sparc-cg6-fix.dpatch
++ sparc-warning-fixes.dpatch
++ sparc32-sun4d-support.dpatch
++ sparc32-hypersparc-dvma.dpatch
++ sparc32-vm-fault-codes.dpatch

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-cg6-fix.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-cg6-fix.dpatch	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-cg6-fix.dpatch	2004-12-24 22:36:04 UTC (rev 2051)
@@ -0,0 +1,30 @@
+Although the CG6 framebuffer is detected and initialized, without this
+patch all it displays is a blank screen. Tested on an Ultra 1 with a
+TGX+.
+
+Originally from Bob Breuer for the CG14.
+
+Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>
+
+Index: wli-2.6.10-rc3-1/drivers/video/cg6.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/drivers/video/cg6.c	2004-12-16 06:19:52.000000000 -0800
++++ wli-2.6.10-rc3-1/drivers/video/cg6.c	2004-12-22 19:26:13.652508170 -0800
+@@ -689,6 +689,9 @@
+ 	all->par.physbase = sdev->reg_addrs[0].phys_addr;
+ 
+ 	sbusfb_fill_var(&all->info.var, sdev->prom_node, 8);
++	all->info.var.red.length = 8;
++	all->info.var.green.length = 8;
++	all->info.var.blue.length = 8;
+ 
+ 	linebytes = prom_getintdefault(sdev->prom_node, "linebytes",
+ 				       all->info.var.xres);
+@@ -732,6 +735,7 @@
+ 		return;
+ 	}
+ 
++	fb_set_cmap(&all->info.cmap, &all->info);
+ 	cg6_init_fix(&all->info, linebytes);
+ 
+ 	if (register_framebuffer(&all->info) < 0) {

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-warning-fixes.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-warning-fixes.dpatch	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc-warning-fixes.dpatch	2004-12-24 22:36:04 UTC (rev 2051)
@@ -0,0 +1,205 @@
+Index: wli-2.6.10-rc3-1/include/asm-sparc/pcic.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/pcic.h	2004-06-15 22:19:13.000000000 -0700
++++ wli-2.6.10-rc3-1/include/asm-sparc/pcic.h	2004-12-22 10:08:27.597121906 -0800
+@@ -16,10 +16,10 @@
+ #include <asm/pbm.h>
+ 
+ struct linux_pcic {
+-        unsigned long           pcic_regs;
++        void * __iomem          pcic_regs;
+         unsigned long           pcic_io;
+-        unsigned long           pcic_config_space_addr;
+-        unsigned long           pcic_config_space_data;
++        void * __iomem          pcic_config_space_addr;
++        void * __iomem          pcic_config_space_data;
+ 	struct resource		pcic_res_regs;
+ 	struct resource		pcic_res_io;
+ 	struct resource		pcic_res_cfg_addr;
+Index: wli-2.6.10-rc3-1/arch/sparc/kernel/pcic.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/kernel/pcic.c	2004-12-16 06:19:27.000000000 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/kernel/pcic.c	2004-12-22 10:08:27.604120842 -0800
+@@ -161,7 +161,7 @@
+ static int pcic0_up;
+ static struct linux_pcic pcic0;
+ 
+-unsigned int pcic_regs;
++void * __iomem pcic_regs;
+ volatile int pcic_speculative;
+ volatile int pcic_trapped;
+ 
+@@ -313,8 +313,7 @@
+ 	pcic0_up = 1;
+ 
+ 	pcic->pcic_res_regs.name = "pcic_registers";
+-	pcic->pcic_regs = (unsigned long)
+-	    ioremap(regs[0].phys_addr, regs[0].reg_size);
++	pcic->pcic_regs = ioremap(regs[0].phys_addr, regs[0].reg_size);
+ 	if (!pcic->pcic_regs) {
+ 		prom_printf("PCIC: Error, cannot map PCIC registers.\n");
+ 		prom_halt();
+@@ -328,7 +327,7 @@
+ 	}
+ 
+ 	pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr";
+-	if ((pcic->pcic_config_space_addr = (unsigned long)
++	if ((pcic->pcic_config_space_addr =
+ 	    ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) {
+ 		prom_printf("PCIC: Error, cannot map" 
+ 			    "PCI Configuration Space Address.\n");
+@@ -340,7 +339,7 @@
+ 	 * must be the same. Thus, we need adjust size of data.
+ 	 */
+ 	pcic->pcic_res_cfg_data.name = "pcic_cfg_data";
+-	if ((pcic->pcic_config_space_data = (unsigned long)
++	if ((pcic->pcic_config_space_data =
+ 	    ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) {
+ 		prom_printf("PCIC: Error, cannot map" 
+ 			    "PCI Configuration Space Data.\n");
+@@ -976,7 +975,7 @@
+  * We do not use horroble macroses here because we want to
+  * advance pointer by sizeof(size).
+  */
+-void outsb(unsigned long addr, const void *src, unsigned long count) {
++void outsb(void * __iomem addr, const void *src, unsigned long count) {
+ 	while (count) {
+ 		count -= 1;
+ 		writeb(*(const char *)src, addr);
+@@ -985,7 +984,7 @@
+ 	}
+ }
+ 
+-void outsw(unsigned long addr, const void *src, unsigned long count) {
++void outsw(void * __iomem addr, const void *src, unsigned long count) {
+ 	while (count) {
+ 		count -= 2;
+ 		writew(*(const short *)src, addr);
+@@ -994,7 +993,7 @@
+ 	}
+ }
+ 
+-void outsl(unsigned long addr, const void *src, unsigned long count) {
++void outsl(void * __iomem addr, const void *src, unsigned long count) {
+ 	while (count) {
+ 		count -= 4;
+ 		writel(*(const long *)src, addr);
+@@ -1003,7 +1002,7 @@
+ 	}
+ }
+ 
+-void insb(unsigned long addr, void *dst, unsigned long count) {
++void insb(void * __iomem addr, void *dst, unsigned long count) {
+ 	while (count) {
+ 		count -= 1;
+ 		*(unsigned char *)dst = readb(addr);
+@@ -1012,7 +1011,7 @@
+ 	}
+ }
+ 
+-void insw(unsigned long addr, void *dst, unsigned long count) {
++void insw(void * __iomem addr, void *dst, unsigned long count) {
+ 	while (count) {
+ 		count -= 2;
+ 		*(unsigned short *)dst = readw(addr);
+@@ -1021,7 +1020,7 @@
+ 	}
+ }
+ 
+-void insl(unsigned long addr, void *dst, unsigned long count) {
++void insl(void * __iomem addr, void *dst, unsigned long count) {
+ 	while (count) {
+ 		count -= 4;
+ 		/*
+Index: wli-2.6.10-rc3-1/include/asm-sparc/io.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/io.h	2004-12-16 06:20:01.000000000 -0800
++++ wli-2.6.10-rc3-1/include/asm-sparc/io.h	2004-12-22 10:08:27.606120538 -0800
+@@ -134,12 +134,12 @@
+ #define inl_p(__addr)		inl(__addr)
+ #define outl_p(__l, __addr)	outl(__l, __addr)
+ 
+-extern void outsb(unsigned long addr, const void *src, unsigned long cnt);
+-extern void outsw(unsigned long addr, const void *src, unsigned long cnt);
+-extern void outsl(unsigned long addr, const void *src, unsigned long cnt);
+-extern void insb(unsigned long addr, void *dst, unsigned long count);
+-extern void insw(unsigned long addr, void *dst, unsigned long count);
+-extern void insl(unsigned long addr, void *dst, unsigned long count);
++void outsb(void * __iomem addr, const void *src, unsigned long cnt);
++void outsw(void * __iomem addr, const void *src, unsigned long cnt);
++void outsl(void * __iomem addr, const void *src, unsigned long cnt);
++void insb(void * __iomem addr, void *dst, unsigned long count);
++void insw(void * __iomem addr, void *dst, unsigned long count);
++void insl(void * __iomem addr, void *dst, unsigned long count);
+ 
+ #define IO_SPACE_LIMIT 0xffffffff
+ 
+Index: wli-2.6.10-rc3-1/drivers/char/rtc.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/drivers/char/rtc.c	2004-10-07 04:01:30.000000000 -0700
++++ wli-2.6.10-rc3-1/drivers/char/rtc.c	2004-12-22 10:09:09.741714954 -0800
+@@ -878,7 +878,7 @@
+ 	&rtc_fops
+ };
+ 
+-#ifdef RTC_IRQ
++#if defined(RTC_IRQ) && !defined(__sparc__)
+ static irqreturn_t (*rtc_int_handler_ptr)(int irq, void *dev_id, struct pt_regs *regs);
+ #endif
+ 
+Index: wli-2.6.10-rc3-1/drivers/sbus/char/rtc.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/drivers/sbus/char/rtc.c	2004-10-07 04:01:41.000000000 -0700
++++ wli-2.6.10-rc3-1/drivers/sbus/char/rtc.c	2004-12-22 10:09:09.744714498 -0800
+@@ -20,6 +20,7 @@
+ #include <linux/poll.h>
+ #include <linux/init.h>
+ #include <linux/smp_lock.h>
++#include <asm/io.h>
+ #include <asm/mostek.h>
+ #include <asm/system.h>
+ #include <asm/uaccess.h>
+@@ -30,7 +31,7 @@
+ /* Retrieve the current date and time from the real time clock. */
+ static void get_rtc_time(struct rtc_time *t)
+ {
+-	unsigned long regs = mstk48t02_regs;
++	void * __iomem regs = mstk48t02_regs;
+ 	u8 tmp;
+ 
+ 	spin_lock_irq(&mostek_lock);
+@@ -57,7 +58,7 @@
+ /* Set the current date and time inthe real time clock. */
+ void set_rtc_time(struct rtc_time *t)
+ {
+-	unsigned long regs = mstk48t02_regs;
++	void * __iomem regs = mstk48t02_regs;
+ 	u8 tmp;
+ 
+ 	spin_lock_irq(&mostek_lock);
+Index: wli-2.6.10-rc3-1/include/asm-sparc/unistd.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/unistd.h	2004-12-16 06:20:01.000000000 -0800
++++ wli-2.6.10-rc3-1/include/asm-sparc/unistd.h	2004-12-22 10:10:28.837690538 -0800
+@@ -486,7 +486,6 @@
+ static __inline__ _syscall3(int,execve,__const__ char *,file,char **,argv,char **,envp)
+ static __inline__ _syscall3(int,open,__const__ char *,file,int,flag,int,mode)
+ static __inline__ _syscall1(int,close,int,fd)
+-static __inline__ _syscall1(int,_exit,int,exitcode)
+ static __inline__ _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
+ 
+ #include <linux/linkage.h>
+Index: wli-2.6.10-rc3-1/drivers/serial/sunsu.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/drivers/serial/sunsu.c	2004-12-16 06:19:49.000000000 -0800
++++ wli-2.6.10-rc3-1/drivers/serial/sunsu.c	2004-12-22 10:08:47.529091786 -0800
+@@ -1285,7 +1285,9 @@
+ 
+ static int __init sunsu_kbd_ms_init(struct uart_sunsu_port *up, int channel)
+ {
++#ifdef CONFIG_SERIO
+ 	struct serio *serio;
++#endif
+ 
+ 	up->port.line = channel;
+ 	up->port.type = PORT_UNKNOWN;

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-hypersparc-dvma.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-hypersparc-dvma.dpatch	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-hypersparc-dvma.dpatch	2004-12-24 22:36:04 UTC (rev 2051)
@@ -0,0 +1,159 @@
+DVMA is having aliasing problems. Bob originally sent in the following
+description:
+
+At some point in the past, Bob Breuer wrote:
+> Here's the preliminary patch.  This time around, both the hme
+> and esp drivers are working for me.  This replaces my previous
+> patch and is against the vanilla 2.6.9 kernel.  I've tried to
+> reduce the amount of unnecessary cache flushing, therefore this
+> will need some testing on non-hypersparc cpus also.  It needs
+> some cleanup yet, and will be rediffed against a later kernel.
+> I'm looking for comments and feedback.
+
+This patch represents one of those subsequent rediffings.
+
+Signed-off-by: Bob Breuer <breuerr@mc.net>
+Acked-by: William Irwin <wli@holomorphy.com>
+
+Index: wli-2.6.10-rc3-1/include/asm-sparc/bitext.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/bitext.h	2004-12-22 09:07:10.078189762 -0800
++++ wli-2.6.10-rc3-1/include/asm-sparc/bitext.h	2004-12-22 10:06:59.047583482 -0800
+@@ -17,6 +17,7 @@
+ 	int last_off;
+ 	int last_size;
+ 	int first_free;
++	int num_colors;
+ };
+ 
+ extern int bit_map_string_get(struct bit_map *t, int len, int align);
+Index: wli-2.6.10-rc3-1/arch/sparc/lib/bitext.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/lib/bitext.c	2004-12-16 06:19:27.000000000 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/lib/bitext.c	2004-12-22 10:06:59.050583026 -0800
+@@ -29,10 +29,17 @@
+ 	int offset, count;	/* siamese twins */
+ 	int off_new;
+ 	int align1;
+-	int i;
++	int i, color;
+ 
+-	if (align == 0)
+-		align = 1;
++	if (t->num_colors) {
++		/* align is overloaded to be the page color */
++		color = align;
++		align = t->num_colors;
++	} else {
++		color = 0;
++		if (align == 0)
++			align = 1;
++	}
+ 	align1 = align - 1;
+ 	if ((align & align1) != 0)
+ 		BUG();
+@@ -40,6 +47,7 @@
+ 		BUG();
+ 	if (len <= 0 || len > t->size)
+ 		BUG();
++	color &= align1;
+ 
+ 	spin_lock(&t->lock);
+ 	if (len < t->last_size)
+@@ -49,7 +57,7 @@
+ 	count = 0;
+ 	for (;;) {
+ 		off_new = find_next_zero_bit(t->map, t->size, offset);
+-		off_new = (off_new + align1) & ~align1;
++		off_new = ((off_new + align1) & ~align1) + color;
+ 		count += off_new - offset;
+ 		offset = off_new;
+ 		if (offset >= t->size)
+@@ -121,6 +129,4 @@
+ 	spin_lock_init(&t->lock);
+ 	t->map = map;
+ 	t->size = size;
+-	t->last_size = 0;
+-	t->first_free = 0;
+ }
+Index: wli-2.6.10-rc3-1/arch/sparc/mm/iommu.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/mm/iommu.c	2004-12-16 06:19:27.000000000 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/mm/iommu.c	2004-12-22 10:06:59.054582418 -0800
+@@ -119,6 +119,13 @@
+ 		prom_halt();
+ 	}
+ 	bit_map_init(&iommu->usemap, bitmap, IOMMU_NPTES);
++	/* To be coherent on HyperSparc, the page color of DVMA
++	 * and physical addresses must match.
++	 */
++	if (srmmu_modtype == HyperSparc)
++		iommu->usemap.num_colors = vac_cache_size >> PAGE_SHIFT;
++	else
++		iommu->usemap.num_colors = 1;
+ 
+ 	printk("IOMMU: impl %d vers %d table 0x%p[%d B] map [%d b]\n",
+ 	    impl, vers, iommu->page_table,
+@@ -128,7 +135,9 @@
+ }
+ 
+ /* This begs to be btfixup-ed by srmmu. */
+-static void iommu_viking_flush_iotlb(iopte_t *iopte, unsigned int niopte)
++/* Flush the iotlb entries to ram. */
++/* This could be better if we didn't have to flush whole pages. */
++static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
+ {
+ 	unsigned long start;
+ 	unsigned long end;
+@@ -145,6 +154,11 @@
+ 			viking_flush_page(start);
+ 			start += PAGE_SIZE;
+ 		}
++	} else {
++		while(start < end) {
++			__flush_page_to_ram(start);
++			start += PAGE_SIZE;
++		}
+ 	}
+ }
+ 
+@@ -156,7 +170,8 @@
+ 	unsigned int busa, busa0;
+ 	int i;
+ 
+-	ioptex = bit_map_string_get(&iommu->usemap, npages, 1);
++	/* page color = pfn of page */
++	ioptex = bit_map_string_get(&iommu->usemap, npages, page_to_pfn(page));
+ 	if (ioptex < 0)
+ 		panic("iommu out");
+ 	busa0 = iommu->start + (ioptex << PAGE_SHIFT);
+@@ -172,8 +187,7 @@
+ 		page++;
+ 	}
+ 
+-	iommu_viking_flush_iotlb(iopte0, npages);
+-	flush_cache_all();
++	iommu_flush_iotlb(iopte0, npages);
+ 
+ 	return busa0;
+ }
+@@ -328,7 +342,9 @@
+ 	if ((addr & ~PAGE_MASK) != 0) BUG();
+ 	if ((len & ~PAGE_MASK) != 0) BUG();
+ 
+-	ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, 1);
++	/* page color = physical address */
++	ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT,
++		addr >> PAGE_SHIFT);
+ 	if (ioptex < 0)
+ 		panic("iommu out");
+ 
+@@ -372,7 +388,7 @@
+ 	 *        to handle the latter case as well.
+ 	 */
+ 	flush_cache_all();
+-	iommu_viking_flush_iotlb(first, len >> PAGE_SHIFT);
++	iommu_flush_iotlb(first, len >> PAGE_SHIFT);
+ 	flush_tlb_all();
+ 	iommu_invalidate(iommu->regs);
+ 

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-sun4d-support.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-sun4d-support.dpatch	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-sun4d-support.dpatch	2004-12-24 22:36:04 UTC (rev 2051)
@@ -0,0 +1,161 @@
+Chris Newport and Thomas Bogendoerfer have been working to get the
+sun4d port functional again. This patch updates 2.6.10-rc3 to a current
+snapshot of their work. It does the following 3 things:
+
+(1) add sun4d hook to sbus_bus_ranges_init()
+(2) fix up pgd_offset() call in sun4d iommu code
+(3) fix up sun4d's definition of current
+
+Signed-off-by: Chris Newport <crn@netunix.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Acked-by: William Irwin <wli@holomorphy.com>
+
+Index: wli-2.6.10-rc3-1/drivers/sbus/sbus.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/drivers/sbus/sbus.c	2004-12-22 09:07:09.318305282 -0800
++++ wli-2.6.10-rc3-1/drivers/sbus/sbus.c	2004-12-22 10:07:21.978097514 -0800
+@@ -217,6 +217,8 @@
+  * prom_sbus_ranges_init(), with all sun4d stuff cut away.
+  * Ask DaveM what is going on here, how is sun4d supposed to work... XXX
+  */
++/* added back sun4d patch from Thomas Bogendoerfer - should be OK (crn) */
++
+ static void __init sbus_bus_ranges_init(int parent_node, struct sbus_bus *sbus)
+ {
+ 	int len;
+@@ -229,6 +231,18 @@
+ 		return;
+ 	}
+ 	sbus->num_sbus_ranges = len / sizeof(struct linux_prom_ranges);
++	if (sparc_cpu_model == sun4d) {
++		struct linux_prom_ranges iounit_ranges[PROMREG_MAX];
++		int num_iounit_ranges;
++
++	len = prom_getproperty(parent_node, "ranges",
++				(char *) iounit_ranges,
++				sizeof (iounit_ranges));
++		if (len != -1) {
++			num_iounit_ranges = (len/sizeof(struct linux_prom_ranges));
++			prom_adjust_ranges (sbus->sbus_ranges, sbus->num_sbus_ranges, iounit_ranges, num_iounit_ranges);
++		}
++	}
+ }
+ 
+ static void __init __apply_ranges_to_regs(struct linux_prom_ranges *ranges,
+Index: wli-2.6.10-rc3-1/arch/sparc/mm/io-unit.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/mm/io-unit.c	2004-12-16 06:19:27.000000000 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/mm/io-unit.c	2004-12-22 10:07:21.981097058 -0800
+@@ -196,7 +196,7 @@
+ 			pte_t *ptep;
+ 			long i;
+ 
+-			pgdp = pgd_offset(init_task.mm, addr);
++			pgdp = pgd_offset(&init_mm, addr);
+ 			pmdp = pmd_offset(pgdp, addr);
+ 			ptep = pte_offset_map(pmdp, addr);
+ 
+Index: wli-2.6.10-rc3-1/arch/sparc/kernel/sun4d_smp.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/kernel/sun4d_smp.c	2004-12-22 09:07:08.431440106 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/kernel/sun4d_smp.c	2004-12-22 10:07:21.984096602 -0800
+@@ -122,8 +122,7 @@
+ 		
+ 	/* Fix idle thread fields. */
+ 	__asm__ __volatile__("ld [%0], %%g6\n\t"
+-			     "sta %%g6, [%%g0] %1\n\t"
+-			     : : "r" (&current_set[cpuid]), "i" (ASI_M_VIKING_TMP2)
++			     : : "r" (&current_set[cpuid])
+ 			     : "memory" /* paranoid */);
+ 
+ 	cpu_leds[cpuid] = 0x9;
+@@ -460,25 +459,18 @@
+ 
+ void __init smp4d_blackbox_current(unsigned *addr)
+ {
+-	/* We have a nice Linux current register :) */
+-	int rd = addr[1] & 0x3e000000;
++	int rd = *addr & 0x3e000000;
+ 	
+-	addr[0] = 0x10800006;			/* b .+24 */
+-	addr[1] = 0xc0800820 | rd;		/* lda [%g0] ASI_M_VIKING_TMP2, reg */
++	addr[0] = 0xc0800800 | rd;		/* lda [%g0] ASI_M_VIKING_TMP1, reg */
++	addr[2] = 0x81282002 | rd | (rd >> 11);	/* sll reg, 2, reg */
++	addr[4] = 0x01000000;			/* nop */
+ }
+ 
+ void __init sun4d_init_smp(void)
+ {
+ 	int i;
+-	extern unsigned int patchme_store_new_current[];
+ 	extern unsigned int t_nmi[], linux_trap_ipi15_sun4d[], linux_trap_ipi15_sun4m[];
+ 
+-	/* Store current into Linux current register :) */
+-	__asm__ __volatile__("sta %%g6, [%%g0] %0" : : "i"(ASI_M_VIKING_TMP2));
+-	
+-	/* Patch switch_to */
+-	patchme_store_new_current[0] = (patchme_store_new_current[0] & 0x3e000000) | 0xc0a00820;
+-	
+ 	/* Patch ipi15 trap table */
+ 	t_nmi[1] = t_nmi[1] + (linux_trap_ipi15_sun4d - linux_trap_ipi15_sun4m);
+ 	
+Index: wli-2.6.10-rc3-1/include/asm-sparc/winmacro.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/winmacro.h	2004-12-22 09:07:10.086188546 -0800
++++ wli-2.6.10-rc3-1/include/asm-sparc/winmacro.h	2004-12-22 10:07:21.987096146 -0800
+@@ -112,9 +112,12 @@
+ 	and      %idreg, 0xc, %idreg; \
+ 	ld       [%idreg + %dest_reg], %dest_reg;
+ 
+-/* Sliiick. We have a Linux current register :) -jj */
+-#define LOAD_CURRENT4D(dest_reg) \
+-	lda	 [%g0] ASI_M_VIKING_TMP2, %dest_reg;
++#define LOAD_CURRENT4D(dest_reg, idreg) \
++	lda	 [%g0] ASI_M_VIKING_TMP1, %idreg; \
++	sethi	%hi(C_LABEL(current_set)), %dest_reg; \
++	sll	%idreg, 2, %idreg; \
++	or	%dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \
++	ld	[%idreg + %dest_reg], %dest_reg;
+ 
+ /* Blackbox - take care with this... - check smp4m and smp4d before changing this. */
+ #define LOAD_CURRENT(dest_reg, idreg) 					\
+Index: wli-2.6.10-rc3-1/arch/sparc/prom/ranges.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/prom/ranges.c	2004-12-22 09:07:08.437439194 -0800
++++ wli-2.6.10-rc3-1/arch/sparc/prom/ranges.c	2004-12-22 10:07:21.989095842 -0800
+@@ -34,7 +34,7 @@
+ 	}
+ }
+ 
+-static void
++void
+ prom_adjust_ranges(struct linux_prom_ranges *ranges1, int nranges1,
+ 		   struct linux_prom_ranges *ranges2, int nranges2)
+ {
+Index: wli-2.6.10-rc3-1/include/asm-sparc/asi.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/asi.h	2004-12-22 09:07:10.077189914 -0800
++++ wli-2.6.10-rc3-1/include/asm-sparc/asi.h	2004-12-22 10:07:21.990095690 -0800
+@@ -104,7 +104,8 @@
+ #define ASI_M_DCDR         0x39   /* Data Cache Diagnostics Register rw, ss */
+ 
+ #define ASI_M_VIKING_TMP1  0x40	  /* Emulation temporary 1 on Viking */
+-#define ASI_M_VIKING_TMP2  0x41	  /* Emulation temporary 2 on Viking */
++/* only available on SuperSparc I */
++/* #define ASI_M_VIKING_TMP2  0x41 */  /* Emulation temporary 2 on Viking */
+ 
+ #define ASI_M_ACTION       0x4c   /* Breakpoint Action Register (GNU/Viking) */
+ 
+Index: wli-2.6.10-rc3-1/include/asm-sparc/sbus.h
+===================================================================
+--- wli-2.6.10-rc3-1.orig/include/asm-sparc/sbus.h	2004-06-15 22:19:01.000000000 -0700
++++ wli-2.6.10-rc3-1/include/asm-sparc/sbus.h	2004-12-22 10:07:21.993095234 -0800
+@@ -106,6 +106,8 @@
+ /* These yield IOMMU mappings in consistent mode. */
+ extern void *sbus_alloc_consistent(struct sbus_dev *, long, u32 *dma_addrp);
+ extern void sbus_free_consistent(struct sbus_dev *, long, void *, u32);
++void prom_adjust_ranges(struct linux_prom_ranges *, int,
++			struct linux_prom_ranges *, int);
+ 
+ #define SBUS_DMA_BIDIRECTIONAL	DMA_BIDIRECTIONAL
+ #define SBUS_DMA_TODEVICE	DMA_TO_DEVICE

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-vm-fault-codes.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-vm-fault-codes.dpatch	2004-12-24 21:10:55 UTC (rev 2050)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/sparc32-vm-fault-codes.dpatch	2004-12-24 22:36:04 UTC (rev 2051)
@@ -0,0 +1,42 @@
+Index: wli-2.6.10-rc3-1/arch/sparc/mm/fault.c
+===================================================================
+--- wli-2.6.10-rc3-1.orig/arch/sparc/mm/fault.c	2004-10-07 04:01:27.000000000 -0700
++++ wli-2.6.10-rc3-1/arch/sparc/mm/fault.c	2004-12-22 10:09:36.723613082 -0800
+@@ -294,16 +294,17 @@
+ 	 * the fault.
+ 	 */
+ 	switch (handle_mm_fault(mm, vma, address, write)) {
+-	case 1:
+-		current->min_flt++;
+-		break;
+-	case 2:
++	case VM_FAULT_SIGBUS:
++		goto do_sigbus;
++	case VM_FAULT_OOM:
++		goto out_of_memory;
++	case VM_FAULT_MAJOR:
+ 		current->maj_flt++;
+ 		break;
+-	case 0:
+-		goto do_sigbus;
++	case VM_FAULT_MINOR:
+ 	default:
+-		goto out_of_memory;
++		current->min_flt++;
++		break;
+ 	}
+ 	up_read(&mm->mmap_sem);
+ 	return;
+@@ -535,8 +536,11 @@
+ 		if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
+ 			goto bad_area;
+ 	}
+-	if (!handle_mm_fault(mm, vma, address, write))
++	switch (handle_mm_fault(mm, vma, address, write)) {
++	case VM_FAULT_SIGBUS:
++	case VM_FAULT_OOM:
+ 		goto do_sigbus;
++	}
+ 	up_read(&mm->mmap_sem);
+ 	return;
+ bad_area: