Index: oldkernel/linux/CREDITS
diff -u linux/CREDITS:1.2 linux/CREDITS:1.3
--- linux/CREDITS:1.2	Wed May 31 14:50:06 2000
+++ linux/CREDITS	Thu Jun  1 15:44:43 2000
@@ -1416,7 +1416,7 @@
 S: Netherlands
 
 N: David S. Miller
-E: davem@dm.cobaltmicro.com
+E: davem@redhat.com
 D: Sparc and blue box hacker
 D: Vger Linux mailing list co-maintainer
 D: Linux Emacs elf/qmagic support + other libc/gcc things
Index: oldkernel/linux/Documentation/Configure.help
diff -u linux/Documentation/Configure.help:1.4 linux/Documentation/Configure.help:1.5
--- linux/Documentation/Configure.help:1.4	Thu Jun  1 15:05:19 2000
+++ linux/Documentation/Configure.help	Thu Jun  1 15:44:43 2000
@@ -10658,8 +10658,14 @@
   inserted in and removed from the running kernel whenever you want),
   say M and read Documentation/modules.txt. If unsure, say Y.
 
-#Mostek real time clock support
-#CONFIG_SUN_MOSTEK_RTC
+Mostek real time clock support
+CONFIG_SUN_MOSTEK_RTC
+  The Mostek RTC chip is used on all knows Sun computers except
+  some JavaStation-s. For a JavaStation you need to say Y both here
+  and to CONFIG_RTC.
+
+  Say Y here unless you are building a special purpose kernel.
+
 #
 #Siemens SAB82532 serial support
 #CONFIG_SAB82532
Index: oldkernel/linux/arch/sparc/config.in
diff -u linux/arch/sparc/config.in:1.2 linux/arch/sparc/config.in:1.3
--- linux/arch/sparc/config.in:1.2	Thu Jun  1 15:00:59 2000
+++ linux/arch/sparc/config.in	Thu Jun  1 15:44:43 2000
@@ -103,6 +103,25 @@
 
 if [ "$CONFIG_NET" = "y" ]; then
 	source net/Config.in
+	mainmenu_option next_comment
+	comment 'Amateur Radio support'
+	bool 'Amateur Radio support' CONFIG_HAMRADIO
+	if [ "$CONFIG_HAMRADIO" != "n" ] ; then
+		comment 'Packet Radio protocols'
+		tristate 'Amateur Radio AX.25 Level 2 protocol' CONFIG_AX25
+		if [ "$CONFIG_AX25" != "n" ]; then
+			bool '   AX.25 DAMA Slave support' CONFIG_AX25_DAMA_SLAVE
+#			bool '   AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER
+			dep_tristate '   Amateur Radio NET/ROM protocol' CONFIG_NETROM $CONFIG_AX25
+			dep_tristate '   Amateur Radio X.25 PLP (Rose)' CONFIG_ROSE $CONFIG_AX25
+
+			comment 'AX.25 network device drivers'
+			dep_tristate 'Serial port KISS driver' CONFIG_MKISS $CONFIG_AX25
+			dep_tristate 'Serial port 6PACK driver' CONFIG_6PACK $CONFIG_AX25
+		fi
+	fi
+
+	endmenu
 fi
 
 mainmenu_option next_comment
@@ -139,7 +158,7 @@
 	mainmenu_option next_comment
 	comment 'SCSI low-level drivers'
 
-	bool 'Sparc ESP Scsi Driver' CONFIG_SCSI_SUNESP $CONFIG_SCSI
+	tristate 'Sparc ESP Scsi Driver' CONFIG_SCSI_SUNESP $CONFIG_SCSI
 	tristate 'PTI Qlogic,ISP Driver' CONFIG_SCSI_QLOGICPTI $CONFIG_SCSI
 	endmenu
 fi
Index: oldkernel/linux/arch/sparc/defconfig
diff -u linux/arch/sparc/defconfig:1.2 linux/arch/sparc/defconfig:1.3
--- linux/arch/sparc/defconfig:1.2	Thu Jun  1 15:00:59 2000
+++ linux/arch/sparc/defconfig	Thu Jun  1 15:44:43 2000
@@ -146,6 +146,11 @@
 # CONFIG_NET_SCHED is not set
 
 #
+# Amateur Radio support
+#
+# CONFIG_HAMRADIO is not set
+
+#
 # ISDN subsystem
 #
 # CONFIG_ISDN is not set
Index: oldkernel/linux/arch/sparc/kernel/ebus.c
diff -u linux/arch/sparc/kernel/ebus.c:1.1.1.1 linux/arch/sparc/kernel/ebus.c:1.2
--- linux/arch/sparc/kernel/ebus.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/kernel/ebus.c	Thu Jun  1 15:44:43 2000
@@ -1,9 +1,10 @@
-/* $Id: ebus.c,v 1.2 1998/10/07 11:35:16 jj Exp $
+/* $Id: ebus.c,v 1.2.2.1 2000/01/21 01:05:35 davem Exp $
  * ebus.c: PCI to EBus bridge device.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
  *
  * Adopted for sparc by V. Roganov and G. Raiko.
+ * Fixes for different platforms by Pete Zaitcev.
  */
 
 #include <linux/config.h>
@@ -25,9 +26,9 @@
 #undef DEBUG_FILL_EBUS_DEV
 
 #ifdef PROM_DEBUG
-#define dprintf prom_printf
+#define dprintk prom_printf
 #else
-#define dprintf printk
+#define dprintk printk
 #endif
 
 struct linux_ebus *ebus_chain = 0;
@@ -48,6 +49,9 @@
 extern int envctrl_init(void);
 #endif
 
+/* We are together with pcic.c under CONFIG_PCI. */
+extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
+
 static inline unsigned long ebus_alloc(size_t size)
 {
 	return (unsigned long)kmalloc(size, GFP_ATOMIC);
@@ -66,6 +70,7 @@
 	strcpy(dev->prom_name, lbuf);
 
 	len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs));
+	if (len == -1) len = 0;
 	dev->num_addrs = len / sizeof(regs[0]);
 
 	for (i = 0; i < dev->num_addrs; i++) {
@@ -77,22 +82,36 @@
 		dev->base_address[i] = dev->parent->base_address[regs[i]];
 	}
 
+	/*
+	 * Houston, we have a problem...
+	 * Sometimes PROM supplies absolutely meaningless properties.
+	 * Still, we take what it gives since we have nothing better.
+	 * Children of ebus may be wired on any input pin of PCIC.
+	 */
 	len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs));
 	if ((len == -1) || (len == 0)) {
 		dev->num_irqs = 0;
-		/*
-		 * Oh, well, some PROMs don't export interrupts
-		 * property to children of EBus devices...
-		 *
-		 * Be smart about PS/2 keyboard and mouse.
-		 */
-		if (!strcmp(dev->parent->prom_name, "8042")) {
+		dev->irqs[0] = 0;
+		if (dev->parent->num_irqs != 0) {
 			dev->num_irqs = 1;
 			dev->irqs[0] = dev->parent->irqs[0];
+/* P3 remove */ printk("EBUS: dev %s irq %d from parent\n", dev->prom_name, dev->irqs[0]);
 		}
 	} else {
 		dev->num_irqs = len / sizeof(irqs[0]);
-		printk("FIXME: %s irq(%d)\n", dev->prom_name, irqs[0]);
+		if (irqs[0] == 0 || irqs[0] >= 8) {
+			/*
+			 * XXX Zero is a valid pin number...
+			 * This works as long as Ebus is not wired to INTA#.
+			 */
+			printk("EBUS: %s got bad irq %d from PROM\n",
+			    dev->prom_name, irqs[0]);
+			dev->num_irqs = 0;
+			dev->irqs[0] = 0;
+		} else {
+			dev->irqs[0] = pcic_pin_to_irq(irqs[0], dev->prom_name);
+/* P3 remove */ printk("EBUS: dev %s irq %d from PROM\n", dev->prom_name, dev->irqs[0]);
+		}
 	}
 
 #ifdef DEBUG_FILL_EBUS_DEV
@@ -131,7 +150,30 @@
 	dev->num_addrs = len / sizeof(struct linux_prom_registers);
 
 	for (i = 0; i < dev->num_addrs; i++) {
-		n = (regs[i].which_io - 0x10) >> 2;
+		/*
+		 * XXX Collect JE-1 PROM
+		 * 
+		 * Example - JS-E with 3.11:
+		 *  /ebus
+		 *      regs 
+		 *        0x00000000, 0x0, 0x00000000, 0x0, 0x00000000,
+		 *        0x82000010, 0x0, 0xf0000000, 0x0, 0x01000000,
+		 *        0x82000014, 0x0, 0x38800000, 0x0, 0x00800000,
+		 *      ranges
+		 *        0x00, 0x00000000, 0x02000010, 0x0, 0x0, 0x01000000,
+		 *        0x01, 0x01000000, 0x02000014, 0x0, 0x0, 0x00800000,
+		 *  /ebus/8042
+		 *      regs
+		 *        0x00000001, 0x00300060, 0x00000008,
+		 *        0x00000001, 0x00300060, 0x00000008,
+		 */
+		n = regs[i].which_io;
+		if (n >= 4) {
+			/* XXX This is copied from old JE-1 by Gleb. */
+			n = (regs[i].which_io - 0x10) >> 2;
+		} else {
+			;
+		}
 
 		dev->base_address[i] = dev->bus->self->base_address[n];
 		dev->base_address[i] += regs[i].phys_addr;
@@ -141,8 +183,14 @@
 		       (unsigned long)sparc_alloc_io (dev->base_address[i], 0,
 						      regs[i].reg_size,
 						      dev->prom_name, 0, 0);
+#if 0
+/*
+ * This release_region() screwes those who do sparc_alloc_io().
+ * Change drivers which do check_region(). See drivers/block/floppy.c.
+ */
 		    /* Some drivers call 'check_region', so we release it */
                     release_region(dev->base_address[i] & PAGE_MASK, PAGE_SIZE);
+#endif
 
 		    if (dev->base_address[i] == 0 ) {
 			panic("ebus: unable sparc_alloc_io for dev %s",
@@ -154,12 +202,22 @@
 	len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs));
 	if ((len == -1) || (len == 0)) {
 		dev->num_irqs = 0;
+		if ((dev->irqs[0] = dev->bus->self->irq) != 0) {
+			 dev->num_irqs = 1;
+/* P3 remove */ printk("EBUS: child %s irq %d from parent\n", dev->prom_name, dev->irqs[0]);
+		}
 	} else {
-		dev->num_irqs = len / sizeof(irqs[0]);
-
-#define IRQ_8042 7
-		if (irqs[0] == 4) dev->irqs[0] = IRQ_8042;
-		printk("FIXME: %s irq(%d)\n", dev->prom_name, irqs[0]);
+		dev->num_irqs = 1;  /* dev->num_irqs = len / sizeof(irqs[0]); */
+		if (irqs[0] == 0 || irqs[0] >= 8) {
+			/* See above for the parent. XXX */
+			printk("EBUS: %s got bad irq %d from PROM\n",
+			    dev->prom_name, irqs[0]);
+			dev->num_irqs = 0;
+			dev->irqs[0] = 0;
+		} else {
+			dev->irqs[0] = pcic_pin_to_irq(irqs[0], dev->prom_name);
+/* P3 remove */ printk("EBUS: child %s irq %d from PROM\n", dev->prom_name, dev->irqs[0]);
+		}
 	}
 
 #ifdef DEBUG_FILL_EBUS_DEV
Index: oldkernel/linux/arch/sparc/kernel/entry.S
diff -u linux/arch/sparc/kernel/entry.S:1.1.1.1 linux/arch/sparc/kernel/entry.S:1.2
--- linux/arch/sparc/kernel/entry.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/kernel/entry.S	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.159.2.6 1999/10/11 08:24:35 davem Exp $
+/* $Id: entry.S,v 1.159.2.7 2000/01/21 01:05:35 davem Exp $
  * arch/sparc/kernel/entry.S:  Sparc trap low-level entry points.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -1898,5 +1898,53 @@
 	LOAD_CURRENT(g6, o0)
 	retl
 	 nop
+
+#ifdef CONFIG_PCI
+#include <asm/pcic.h>
+
+	.align	4
+	.globl	linux_trap_ipi15_pcic
+linux_trap_ipi15_pcic:
+	rd	%wim, %l3
+	SAVE_ALL
+
+	/*
+	 * First deactivate NMI
+	 * or we cannot drop ET, cannot get window spill traps.
+	 * The busy loop is necessary because the PIO error
+	 * sometimes does not go away quickly and we trap again.
+	 */
+	sethi	%hi(C_LABEL(pcic_regs)), %o1
+	ld	[%o1 + %lo(C_LABEL(pcic_regs))], %o2
+
+	! Get pending status for printouts later.
+	ld	[%o2 + PCI_SYS_INT_PENDING], %o0
+
+	mov	PCI_SYS_INT_PENDING_CLEAR_ALL, %o1
+	stb	%o1, [%o2 + PCI_SYS_INT_PENDING_CLEAR]
+1:
+	ld	[%o2 + PCI_SYS_INT_PENDING], %o1
+	andcc	%o1, ((PCI_SYS_INT_PENDING_PIO|PCI_SYS_INT_PENDING_PCI)>>24), %g0
+	bne	1b
+	 nop
+
+	or	%l0, PSR_PIL, %l4
+	wr	%l4, 0x0, %psr
+	WRITE_PAUSE
+	wr	%l4, PSR_ET, %psr
+	WRITE_PAUSE
+
+	call	C_LABEL(pcic_nmi)
+	 add	%sp, REGWIN_SZ, %o1	! struct pt_regs *regs
+	RESTORE_ALL
+
+	.globl	C_LABEL(pcic_nmi_trap_patch)
+C_LABEL(pcic_nmi_trap_patch):
+	sethi	%hi(linux_trap_ipi15_pcic), %l3
+	jmpl	%l3 + %lo(linux_trap_ipi15_pcic), %g0
+	 rd	%psr, %l0
+	.word	0
+
+#endif /* CONFIG_PCI */
 
 /* End of entry.S */
Index: oldkernel/linux/arch/sparc/kernel/head.S
diff -u linux/arch/sparc/kernel/head.S:1.1.1.1 linux/arch/sparc/kernel/head.S:1.2
--- linux/arch/sparc/kernel/head.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/kernel/head.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: head.S,v 1.95.2.5 1999/12/02 11:51:56 davem Exp $
+/* $Id: head.S,v 1.95.2.6 2000/01/21 01:05:39 davem Exp $
  * head.S: The initial boot code for the Sparc port of Linux.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
- * Copyright (C) 1995 Peter Zaitcev   (Zaitcev@ipmce.su)
+ * Copyright (C) 1995,1999 Pete Zaitcev   (zaitcev@metabyte.com)
  * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  * Copyright (C) 1997 Jakub Jelinek   (jj@sunsite.mff.cuni.cz)
  * Copyright (C) 1997 Michael A. Griffith (grif@acm.org)
@@ -116,10 +116,10 @@
 t_irq12:TRAP_ENTRY_INTERRUPT(12)            /* IRQ Zilog serial chip         */
 t_irq13:TRAP_ENTRY_INTERRUPT(13)            /* IRQ Audio Intr.               */
 t_irq14:TRAP_ENTRY_INTERRUPT(14)            /* IRQ Timer #2                  */
+	.globl	t_nmi
 #ifndef __SMP__
 t_nmi:	NMI_TRAP                            /* Level 15 (NMI)                */
 #else
-	.globl	t_nmi
 t_nmi:	TRAP_ENTRY(0x1f, linux_trap_ipi15_sun4m)
 #endif
 t_racc:	TRAP_ENTRY(0x20, do_reg_access)     /* General Register Access Error */
Index: oldkernel/linux/arch/sparc/kernel/pcic.c
diff -u linux/arch/sparc/kernel/pcic.c:1.1.1.1 linux/arch/sparc/kernel/pcic.c:1.2
--- linux/arch/sparc/kernel/pcic.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/kernel/pcic.c	Thu Jun  1 15:44:43 2000
@@ -1,10 +1,12 @@
-/* $Id: pcic.c,v 1.5.2.1 1999/08/07 10:42:43 davem Exp $
+/* $Id: pcic.c,v 1.5.2.2 2000/01/21 01:05:41 davem Exp $
  * pcic.c: Sparc/PCI controller support
  *
  * Copyright (C) 1998 V. Roganov and G. Raiko
  *
  * Code is derived from Ultra/PCI PSYCHO controller support, see that
  * for author info.
+ *
+ * Support for diverse IIep based platforms by Pete Zaitcev.
  */
 
 #include <linux/config.h>
@@ -16,20 +18,10 @@
 
 #include <asm/ebus.h>
 #include <asm/sbus.h> /* for sanity check... */
+#include <asm/swift.h> /* for cache flushing. */
 
 #include <asm/io.h>
 
-#undef PROM_DEBUG
-#undef FIXUP_REGS_DEBUG
-#undef FIXUP_IRQ_DEBUG
-#undef FIXUP_VMA_DEBUG
-
-#ifdef PROM_DEBUG
-#define dprintf	prom_printf
-#else
-#define dprintf printk
-#endif
-
 #include <linux/ctype.h>
 #include <linux/pci.h>
 #include <linux/timex.h>
@@ -68,9 +60,101 @@
 
 #else
 
+unsigned int pcic_pin_to_irq(unsigned int pin, char *name);
+
+/*
+ * I studied different documents and many live PROMs both from 2.30
+ * family and 3.xx versions. I came to the amazing conclusion: there is
+ * absolutely no way to route interrupts in IIep systems relying on
+ * information which PROM presents. We must hardcode interrupt routing
+ * schematics. And this actually sucks.   -- zaitcev 1999/05/12
+ *
+ * To find irq for a device we determine which routing map
+ * is in effect or, in other words, on which machine we are running.
+ * We use PROM name for this although other techniques may be used
+ * in special cases (Gleb reports a PROMless IIep based system).
+ * Once we know the map we take device configuration address and
+ * find PCIC pin number where INT line goes. Then we may either program
+ * preferred irq into the PCIC or supply the preexisting irq to the device.
+ *
+ * XXX Entries for JE-1 are completely bogus. Gleb, Vladimir, please fill them.
+ */
+struct pcic_ca2irq {
+	unsigned char busno;		/* PCI bus number */
+	unsigned char devfn;		/* Configuration address */
+	unsigned char pin;		/* PCIC external interrupt pin */
+	unsigned char irq;		/* Preferred IRQ (mappable in PCIC) */
+	unsigned int force;		/* Enforce preferred IRQ */
+};
+
+struct pcic_sn2list {
+	char *sysname;
+	struct pcic_ca2irq *intmap;
+	int mapdim;
+};
+
+/*
+ * XXX JE-1 is a little known beast.
+ * One rumor has the map this way: pin 0 - parallel, audio;
+ * pin 1 - Ethernet; pin 2 - su; pin 3 - PS/2 kbd and mouse.
+ * All other comparable systems tie serial and keyboard together,
+ * so we do not code this rumor just yet.
+ */
+static struct pcic_ca2irq pcic_i_je1[] = {
+	{ 0, 0x01, 1,  6, 1 },		/* Happy Meal */
+};
+
+/* XXX JS-E entry is incomplete - PCI Slot 2 address (pin 7)? */
+static struct pcic_ca2irq pcic_i_jse[] = {
+	{ 0, 0x00, 0, 13, 0 },		/* Ebus - serial and keyboard */
+	{ 0, 0x01, 1,  6, 0 },		/* hme */
+	{ 0, 0x08, 2,  9, 0 },		/* VGA - we hope not used :) */
+	{ 0, 0x18, 6,  8, 0 },		/* PCI INTA# in Slot 1 */
+	{ 0, 0x38, 4,  9, 0 },		/* All ISA devices. Read 8259. */
+	{ 0, 0x80, 5, 11, 0 },		/* EIDE */
+	/* {0,0x88, 0,0,0} - unknown device... PMU? Probably no interrupt. */
+	{ 0, 0xA0, 4,  9, 0 },		/* USB */
+	/*
+	 * Some pins belong to non-PCI devices, we hardcode them in drivers.
+	 * sun4m timers - irq 10, 14
+	 * PC style RTC - pin 7, irq 4 ?
+	 * Smart card, Parallel - pin 4 shared with USB, ISA
+	 * audio - pin 3, irq 5 ?
+	 */
+};
+
+/*
+ * Krups
+ * No documentation available, so we guess it, based on Espresso layout.
+ * Since we always run PROLL on Krups we may put map in there.
+ */
+static struct pcic_ca2irq pcic_i_jk[] = {
+	{ 0, 0x00, 0, 13, 0 },		/* Ebus - serial and keyboard */
+	{ 0, 0x01, 1,  6, 0 },		/* hme */
+};
+
+/*
+ * Several entries in this list may point to the same routing map
+ * as several PROMs may be installed on the same physical board.
+ */
+#define SN2L_INIT(name, map)	\
+  { name, map, sizeof(map)/sizeof(struct pcic_ca2irq) }
+
+static struct pcic_sn2list pcic_known_sysnames[] = {
+	SN2L_INIT("JE-1-name", pcic_i_je1),  /* XXX Gleb, put name here, pls */
+	SN2L_INIT("SUNW,JS-E", pcic_i_jse),	/* PROLL JavaStation-E */
+	SN2L_INIT("SUNW,JS-NC", pcic_i_jk),	/* PROLL JavaStation-NC */
+	SN2L_INIT("SUNW,JSIIep", pcic_i_jk),	/* OBP JavaStation-NC */
+	{ NULL, NULL, 0 }
+};
+
 static struct linux_pcic PCIC;
 static struct linux_pcic *pcic = NULL;
 
+unsigned int pcic_regs;
+volatile int pcic_speculative;
+volatile int pcic_trapped;
+
 static void pci_do_gettimeofday(struct timeval *tv);
 static void pci_do_settimeofday(struct timeval *tv);
 
@@ -100,7 +184,7 @@
 			    "from PROM.\n");
 		prom_halt();
 	}
-	
+
 	pcic = &PCIC;
 
 	pcic->pcic_regs = (unsigned long)sparc_alloc_io(regs[0].phys_addr, NULL,
@@ -146,8 +230,39 @@
 
 	pbm = &pcic->pbm;
 	pbm->prom_node = node;
-	prom_getstring(node, "name", namebuf, sizeof(namebuf));
+	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
 	strcpy(pbm->prom_name, namebuf);
+
+	{
+		extern volatile int t_nmi[1];
+		extern int pcic_nmi_trap_patch[1];
+
+		t_nmi[0] = pcic_nmi_trap_patch[0];
+		t_nmi[1] = pcic_nmi_trap_patch[1];
+		t_nmi[2] = pcic_nmi_trap_patch[2];
+		t_nmi[3] = pcic_nmi_trap_patch[3];
+		swift_flush_dcache();
+		pcic_regs = pcic->pcic_regs;
+	}
+
+	prom_getstring(prom_root_node, "name", namebuf, 63);  namebuf[63] = 0;
+	{
+		struct pcic_sn2list *p;
+
+		for (p = pcic_known_sysnames; p->sysname != NULL; p++) {
+			if (strcmp(namebuf, p->sysname) == 0)
+				break;
+		}
+		pcic->pcic_imap = p->intmap;
+		pcic->pcic_imdim = p->mapdim;
+	}
+	if (pcic->pcic_imap == NULL) {
+		/*
+		 * We do not panic here for the sake of embedded systems.
+		 */
+		printk("PCIC: System %s is unknown, cannot route interrupts\n",
+		    namebuf);
+	}
 }
 
 __initfunc(void pcibios_init(void))
@@ -165,20 +280,15 @@
 	       pcic->pcic_regs, pcic->pcic_io);
 
 	/*
-	 * FIXME:
 	 *      Switch off IOTLB translation.
-	 *      It'll be great to use IOMMU to handle HME's rings
-	 *      but we couldn't. Thus, we have to flush CPU cache
-	 *      in HME.
 	 */
 	writeb(PCI_DVMA_CONTROL_IOTLB_DISABLE, 
 	       pcic->pcic_regs+PCI_DVMA_CONTROL);
 
 	/*
-	 * FIXME:
 	 *      Increase mapped size for PCI memory space (DMA access).
 	 *      Should be done in that order (size first, address second).
-	 *      Why we couldn't set up 4GB and forget about it ?
+	 *      Why we couldn't set up 4GB and forget about it? XXX
 	 */
 	writel(0xF0000000UL, pcic->pcic_regs+PCI_SIZE_0);
 	writel(0+PCI_BASE_ADDRESS_SPACE_MEMORY, 
@@ -203,7 +313,7 @@
 		if(err != 0 && err != -1) {
 			unsigned long devfn = (regs[0].which_io >> 8) & 0xff;
 			if(devfn == pdev->devfn)
-				return node; /* Match */
+				return node;
 		}
 		node = prom_getsibling(node);
 	}
@@ -214,11 +324,15 @@
 {
 	return kmalloc(sizeof(struct pcidev_cookie), GFP_ATOMIC);
 }
-
 
-static void pcic_map_pci_device (struct pci_dev *dev) {
-	int node, pcinode;
+static void pcic_map_pci_device (struct pci_dev *dev, int node) {
+	char namebuf[64];
+	struct linux_prom_pci_assigned_addresses addrs[6];
+	int addrlen;
+	unsigned long address;
+	int length;
 	int i, j;
+	int nmem = 0, nio = 0;
 
 	/* Is any valid address present ? */
 	i = 0;
@@ -226,103 +340,165 @@
 		if (dev->base_address[j]) i++;
 	if (!i) return; /* nothing to do */
 
+	if (node == 0 || node == -1) {
+		printk("PCIC: no prom node for device (%x,%x)\n",
+		    dev->device, dev->vendor);
+		return;
+	}
+	prom_getstring(node, "name", namebuf, 63);  namebuf[63] = 0;
+
 	/*
 	 * find related address and get it's window length
 	 */
-	pcinode = prom_getchild(prom_root_node);
-	pcinode = prom_searchsiblings(pcinode, "pci");
-	if (!pcinode)
-		panic("PCIC: failed to locate 'pci' node");
-
-
-	for (node = prom_getchild(pcinode); node;
-	     node = prom_getsibling(node)) {
-		struct linux_prom_pci_assigned_addresses addrs[6];
-		int addrlen = prom_getproperty(node,"assigned-addresses",
+	addrlen = prom_getproperty(node,"assigned-addresses",
 					       (char*)addrs, sizeof(addrs));
-		if (addrlen == -1)
-			continue;
-
-		addrlen /= sizeof(struct linux_prom_pci_assigned_addresses);
-		for (i = 0; i < addrlen; i++ )
-		    for (j = 0; j < 6; j++) {
-			if (!dev->base_address[j] || !addrs[i].phys_lo)
-				continue;
-			if (addrs[i].phys_lo == dev->base_address[j]) {
-			    unsigned long address = dev->base_address[j];
-			    int length  = addrs[i].size_lo;
-			    char namebuf[128] = { 0, };
-			    unsigned long mapaddr, addrflags;
-	    
-			    prom_getstring(node, "name",
-					   namebuf,  sizeof(namebuf));
-
-			    /* FIXME:
-			     *      failure in allocation too large space
-			     */
-			    if (length > 0x200000) {
-				length = 0x200000;
-				prom_printf("PCIC: map window for device '%s' "
-					    "reduced to 2MB !\n", namebuf);
-			    }
-
-			    /*
-			     *  Be careful with MEM/IO address flags
-			     */
-			    if ((address & PCI_BASE_ADDRESS_SPACE) ==
-				 PCI_BASE_ADDRESS_SPACE_IO) {
-				mapaddr = address & PCI_BASE_ADDRESS_IO_MASK;
-			    } else {
-				mapaddr = address & PCI_BASE_ADDRESS_MEM_MASK;
-			    }
-			    addrflags = address ^ mapaddr;
-
-			    dev->base_address[j] =
-				(unsigned long)sparc_alloc_io(address, 0, 
-							      length,
-							      namebuf, 0, 0);
-			    if ( dev->base_address[j] == 0 )
-				panic("PCIC: failed make mapping for "
-				      "pci device '%s' with address %lx\n",
-				       namebuf, address);
+	if (addrlen == -1) {
+		/*
+		 * We could live without this property. Address and size
+		 * can be determined from PCI Configuration space registers.
+		 * We use "assigned-addresses" to gather length, which
+		 * is typically less than otherwise would be needed.
+		 */
+		printk("PCIC: no \"assigned-addresses\" for device (%x,%x)\n",
+		    dev->device, dev->vendor);
+		return;
+	}
 
-			    dev->base_address[j] ^= addrflags;
-			    return;
+	addrlen /= sizeof(struct linux_prom_pci_assigned_addresses);
+	for (j = 0; j < 6; j++) {		/* changing data goes first */
+		address = dev->base_address[j];
+		if (address == 0) break;	/* are sequential */
+		if ((address & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) {
+			if (address < 0x10000) {
+				/*
+				 * Under 64K I/O - use fixed map.
+				 * We expect ALL devices to get here.
+				 *
+				 * CheerIO converts PCI memory transactions
+				 * into IOW/IOR transactions for us, forget it.
+				 *
+				 * Note that check_region()/request_region()
+				 * work for these devices.
+				 */
+				dev->base_address[j] += pcic->pcic_io;
+				nio++;
+			} else {
+				/*
+				 * OOPS... PCI Spec allows this. Sun does
+				 * not have any devices getting above 64K
+				 * so it must be user with a weird I/O
+				 * board in a PCI slot. We must remap it
+				 * under 64K but it is not done yet. XXX
+				 */
+				printk("PCIC: Skipping I/O space at 0x%x,"
+				    "this will Oops if a driver attaches;"
+				    "device '%s' (%x,%x)\n", address, namebuf,
+	    			    dev->device, dev->vendor);
 			}
+		} else {
+			/*
+			 * Memory we must map, as Gleb did this originally.
+			 */
+
+			for (i = 0; i < addrlen; i++) {
+				if (addrs[i].phys_lo == 0) continue;
+				if (addrs[i].phys_lo !=
+				   (address & PCI_BASE_ADDRESS_MEM_MASK))
+					continue;
+
+				length  = addrs[i].size_lo;
+
+				/*
+				 *      failure in allocation too large space
+				 */
+				if (length > 0x200000) {
+					length = 0x200000;
+					prom_printf("PCIC: map window for "
+					    "device '%s' reduced to 2MB !\n",
+					    namebuf);
+				}
+
+				dev->base_address[j] =
+				    (unsigned long)sparc_alloc_io(
+				    address & PCI_BASE_ADDRESS_MEM_MASK,
+				    0, length, namebuf, 0, 0);
+
+				if (dev->base_address[j] == 0) {
+					panic("PCIC: failed to map "
+					    "device '%s' (%x,%x) at %lx\n",
+					    namebuf, dev->device, dev->vendor,
+					    address);
+				}
+				dev->base_address[j] |= address & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
+				nmem++;
+			}
 		}
 	}
 
-	panic("PCIC: unable to locate prom node for pci device (%x,%x) \n",
-	      dev->device, dev->vendor);
+	if (nio == 0 && nmem == 0) {
+		printk("PCIC: not mapped device '%s' (%x,%x)\n",
+		    namebuf, dev->device, dev->vendor);
+	}
 }
 
-/*
- * Assign IO space for a device.
- * This is a chance for devices which have the same IO and Mem Space to
- * fork access to IO and Mem.
- *
- * Now, we assume there is one such device only (IGA 1682) but code below
- * should work in cases when space of all such devices is less then 16MB.
- */
-unsigned long pcic_alloc_io( unsigned long* addr )
-{
-	unsigned long paddr = *addr;
-	unsigned long offset;
+static void pcic_fill_irq(struct pci_dev *dev, int node) {
+	struct pcic_ca2irq *p;
+	int i, ivec;
+	char namebuf[64];  /* P3 remove */
 
-	if(pcic->pcic_mapped_io == 0) {
-		pcic->pcic_mapped_io = paddr & ~(PCI_SPACE_SIZE-1) ;
-		writeb((pcic->pcic_mapped_io>>24) & 0xff, 
-		       pcic->pcic_regs+PCI_PIBAR);
-		writeb((pcic->pcic_io_phys>>24) & PCI_SIBAR_ADDRESS_MASK,
-		       pcic->pcic_regs+PCI_SIBAR);
-		writeb(PCI_ISIZE_16M, pcic->pcic_regs+PCI_ISIZE);
-	}
-	if(paddr < pcic->pcic_mapped_io ||
-	   paddr > pcic->pcic_mapped_io + PCI_SPACE_SIZE)
-		return 0;
-	offset = paddr - pcic->pcic_mapped_io;
-	*addr = pcic->pcic_io_phys + offset;
-	return pcic->pcic_io + offset;
+	if (node == -1) {
+		strcpy(namebuf, "???");
+	} else {
+		prom_getstring(node, "name", namebuf, sizeof(namebuf)); /* P3 remove */
+	}
+
+	if ((p = pcic->pcic_imap) == 0) {
+		dev->irq = 0;
+		return;
+	}
+	for (i = 0; i < pcic->pcic_imdim; i++) {
+		if (p->busno == dev->bus->number && p->devfn == dev->devfn)
+			break;
+		p++;
+	}
+	if (i >= pcic->pcic_imdim) {
+		printk("PCIC: device %s devfn %02x:%02x not found in %d\n",
+		    namebuf, dev->bus->number, dev->devfn, pcic->pcic_imdim);
+		dev->irq = 0;
+		return;
+	}
+
+	i = p->pin;
+	if (i >= 0 && i < 4) {
+		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
+		dev->irq = ivec >> (i << 2) & 0xF;
+	} else if (i >= 4 && i < 8) {
+		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
+		dev->irq = ivec >> ((i-4) << 2) & 0xF;
+	} else {					/* Corrupted map */
+		printk("PCIC: BAD PIN %d\n", i); for (;;) {}
+	}
+/* P3 remove later */ printk("PCIC: device %s pin %d ivec 0x%x irq %x\n", namebuf, i, ivec, dev->irq);
+
+	/*
+	 * dev->irq=0 means PROM did not bothered to program the upper
+	 * half of PCIC. This happens on JS-E with PROM 3.11, for instance.
+	 */
+	if (dev->irq == 0 || p->force) {
+		if (p->irq == 0 || p->irq >= 15) {	/* Corrupted map */
+			printk("PCIC: BAD IRQ %d\n", p->irq); for (;;) {}
+		}
+		printk("PCIC: setting irq %x for device (%x,%x)\n",
+		    p->irq, dev->device, dev->vendor);
+		dev->irq = p->irq;
+
+		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
+		ivec &= ~(0xF << ((p->pin - 4) << 2));
+		ivec |= p->irq << ((p->pin - 4) << 2);
+		writew(ivec, pcic->pcic_regs+PCI_INT_SELECT_HI);
+	}
+
+	return;
 }
 
 /*
@@ -333,6 +509,9 @@
   struct pci_dev *dev;
   int i, has_io, has_mem;
   unsigned short cmd;
+	struct linux_pbm_info* pbm = &pcic->pbm;
+	int node;
+	struct pcidev_cookie *pcp;
 
 	if(pcic == NULL) {
 		prom_printf("PCI: Error, PCIC not found.\n");
@@ -358,47 +537,61 @@
 		}
 		pci_read_config_word(dev, PCI_COMMAND, &cmd);
 		if (has_io && !(cmd & PCI_COMMAND_IO)) {
-			printk("PCI: Enabling I/O for device %02x:%02x\n",
+			printk("PCIC: Enabling I/O for device %02x:%02x\n",
 				dev->bus->number, dev->devfn);
 			cmd |= PCI_COMMAND_IO;
 			pci_write_config_word(dev, PCI_COMMAND, cmd);
 		}
 		if (has_mem && !(cmd & PCI_COMMAND_MEMORY)) {
-			printk("PCI: Enabling memory for device %02x:%02x\n",
+			printk("PCIC: Enabling memory for device %02x:%02x\n",
 				dev->bus->number, dev->devfn);
 			cmd |= PCI_COMMAND_MEMORY;
 			pci_write_config_word(dev, PCI_COMMAND, cmd);
 		}    
 
+		node = pdev_to_pnode(pbm, dev);
+		if(node == 0)
+			node = -1;
+
 		/* cookies */
-		{
-			struct pcidev_cookie *pcp;
-			struct linux_pbm_info* pbm = &pcic->pbm;
-			int node = pdev_to_pnode(pbm, dev);
-
-			if(node == 0)
-				node = -1;
-			pcp = pci_devcookie_alloc();
-			pcp->pbm = pbm;
-			pcp->prom_node = node;
-			dev->sysdata = pcp;
-		}
+		pcp = pci_devcookie_alloc();
+		pcp->pbm = pbm;
+		pcp->prom_node = node;
+		dev->sysdata = pcp;
 
 		/* memory mapping */
-		if (!(dev->vendor == PCI_VENDOR_ID_SUN &&
-		      dev->device == PCI_DEVICE_ID_SUN_EBUS)) {
-			pcic_map_pci_device(dev);
-		}
-
-		/* irq */
-#define SETIRQ(vend,devid,irqn) \
-	if (dev->vendor==vend && dev->device==devid) dev->irq = irqn;
+		if ((dev->class>>16) != PCI_BASE_CLASS_BRIDGE)
+			pcic_map_pci_device(dev, node);
 
-		SETIRQ(PCI_VENDOR_ID_SUN,PCI_DEVICE_ID_SUN_HAPPYMEAL,3);
+		pcic_fill_irq(dev, node);
 	}
+
 	ebus_init();
 }
 
+/*
+ * pcic_pin_to_irq() is exported to ebus.c.
+ */
+unsigned int
+pcic_pin_to_irq(unsigned int pin, char *name)
+{
+	unsigned int irq;
+	unsigned int ivec;
+
+	if (pin < 4) {
+		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO);
+		irq = ivec >> (pin << 2) & 0xF;
+	} else if (pin < 8) {
+		ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI);
+		irq = ivec >> ((pin-4) << 2) & 0xF;
+	} else {					/* Corrupted map */
+		printk("PCIC: BAD PIN %d FOR %s\n", pin, name);
+		for (;;) {}	/* XXX Cannot panic properly in case of PROLL */
+	}
+/* P3 remove later */ printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq);
+	return irq;
+}
+
 /* Makes compiler happy */
 static volatile int pcic_timer_dummy;
 
@@ -538,26 +731,38 @@
 			       unsigned char where, unsigned int *value)
 {
 	unsigned long flags;
-	if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
-	if (bus != 0 || 
-	    (device_fn != 0 && device_fn != 1 && device_fn != 0x80)) {
-		*value = 0xffffffff;
-		return PCIBIOS_SUCCESSFUL;
-	}
 
-	/* FIXME: IGA haven't got high config memory addresses !!! */
-	if (device_fn == 0x80 && where > PCI_INTERRUPT_LINE) {
-		*value = 0xffffffff;
-		return PCIBIOS_SUCCESSFUL;
-	}
+	if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
 
 	save_and_cli(flags);
+#if 0
+	pcic_speculative = 1;
+	pcic_trapped = 0;
+#endif
 	writel(CONFIG_CMD(bus,device_fn,where), pcic->pcic_config_space_addr);
+#if 0
+	nop();
+	if (pcic_trapped) {
+		restore_flags(flags);
+		*value = ~0;
+		return PCIBIOS_SUCCESSFUL;
+	}
+#endif
+	pcic_speculative = 2;
+	pcic_trapped = 0;
 	*value = readl(pcic->pcic_config_space_data + (where&4));
+	nop();
+	if (pcic_trapped) {
+		pcic_speculative = 0;
+		restore_flags(flags);
+		*value = ~0;
+		return PCIBIOS_SUCCESSFUL;
+	}
+	pcic_speculative = 0;
 	restore_flags(flags);
 	return PCIBIOS_SUCCESSFUL;
 }
-    
+
 int pcibios_write_config_byte (unsigned char bus, unsigned char devfn,
 			       unsigned char where, unsigned char value)
 {
@@ -585,8 +790,8 @@
 				unsigned char where, unsigned int value)
 {
 	unsigned long flags;
-	if ((where&3) || bus != 0 || (devfn != 0 && devfn != 1 && devfn != 0x80))
-		return PCIBIOS_BAD_REGISTER_NUMBER;
+
+	if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
 
 	save_and_cli(flags);
 	writel(CONFIG_CMD(bus,devfn,where),pcic->pcic_config_space_addr);
@@ -598,6 +803,29 @@
 __initfunc(char *pcibios_setup(char *str))
 {
 	return str;
+}
+
+/*
+ * NMI
+ */
+void pcic_nmi(unsigned int pend, struct pt_regs *regs)
+{
+
+	pend = flip_dword(pend);
+
+	if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) {
+		/*
+		 * XXX On CP-1200 PCI #SERR may happen, we do not know
+		 * what to do about it yet.
+		 */
+		printk("Aiee, NMI pend 0x%x pc 0x%x spec %d, hanging\n",
+		    pend, (int)regs->pc, pcic_speculative);
+		for (;;) { }
+	}
+	pcic_speculative = 0;
+	pcic_trapped = 1;
+	regs->pc = regs->npc;
+	regs->npc += 4;
 }
 
 /*
Index: oldkernel/linux/arch/sparc/kernel/sys_sunos.c
diff -u linux/arch/sparc/kernel/sys_sunos.c:1.1.1.1 linux/arch/sparc/kernel/sys_sunos.c:1.2
--- linux/arch/sparc/kernel/sys_sunos.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/kernel/sys_sunos.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos.c,v 1.94.2.3 1999/10/04 10:36:20 davem Exp $
+/* $Id: sys_sunos.c,v 1.94.2.4 2000/01/17 21:28:27 davem Exp $
  * sys_sunos.c: SunOS specific syscall compatibility support.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -370,6 +370,7 @@
 	spin_lock_irq(&current->sigmask_lock);
 	old = current->blocked.sig[0];
 	current->blocked.sig[0] |= (blk_mask & _BLOCKABLE);
+	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	return old;
 }
@@ -381,6 +382,7 @@
 	spin_lock_irq(&current->sigmask_lock);
 	retval = current->blocked.sig[0];
 	current->blocked.sig[0] = (newmask & _BLOCKABLE);
+	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	return retval;
 }
Index: oldkernel/linux/arch/sparc/mm/srmmu.c
diff -u linux/arch/sparc/mm/srmmu.c:1.1.1.1 linux/arch/sparc/mm/srmmu.c:1.2
--- linux/arch/sparc/mm/srmmu.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc/mm/srmmu.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: srmmu.c,v 1.187.2.7 1999/11/16 06:29:44 davem Exp $
+/* $Id: srmmu.c,v 1.187.2.8 1999/12/23 01:58:38 davem Exp $
  * srmmu.c:  SRMMU specific routines for memory management.
  *
  * Copyright (C) 1995 David S. Miller  (davem@caip.rutgers.edu)
@@ -1662,7 +1662,8 @@
 	srmmu_map[srmmu_bank].vbase = vbase;
 	srmmu_map[srmmu_bank].pbase = sp_banks[sp_entry].base_addr;
 	srmmu_map[srmmu_bank].size = sp_banks[sp_entry].num_bytes;
-	srmmu_bank++;
+	if (srmmu_map[srmmu_bank].size)
+		srmmu_bank++;
 	map_spbank_last_pa = pstart - SRMMU_PGDIR_SIZE;
 	return vstart;
 }
Index: oldkernel/linux/arch/sparc64/config.in
diff -u linux/arch/sparc64/config.in:1.2 linux/arch/sparc64/config.in:1.3
--- linux/arch/sparc64/config.in:1.2	Thu Jun  1 15:00:59 2000
+++ linux/arch/sparc64/config.in	Thu Jun  1 15:44:43 2000
@@ -131,6 +131,25 @@
 
 if [ "$CONFIG_NET" = "y" ]; then
 	source net/Config.in
+	mainmenu_option next_comment
+	comment 'Amateur Radio support'
+	bool 'Amateur Radio support' CONFIG_HAMRADIO
+	if [ "$CONFIG_HAMRADIO" != "n" ] ; then
+		comment 'Packet Radio protocols'
+		tristate 'Amateur Radio AX.25 Level 2 protocol' CONFIG_AX25
+		if [ "$CONFIG_AX25" != "n" ]; then
+			bool '   AX.25 DAMA Slave support' CONFIG_AX25_DAMA_SLAVE
+#			bool '   AX.25 DAMA Master support' CONFIG_AX25_DAMA_MASTER
+			dep_tristate '   Amateur Radio NET/ROM protocol' CONFIG_NETROM $CONFIG_AX25
+			dep_tristate '   Amateur Radio X.25 PLP (Rose)' CONFIG_ROSE $CONFIG_AX25
+
+			comment 'AX.25 network device drivers'
+			dep_tristate 'Serial port KISS driver' CONFIG_MKISS $CONFIG_AX25
+			dep_tristate 'Serial port 6PACK driver' CONFIG_6PACK $CONFIG_AX25
+		fi
+	fi
+
+	endmenu
 fi
 
 mainmenu_option next_comment
@@ -158,7 +177,7 @@
 	mainmenu_option next_comment
 	comment 'SCSI low-level drivers'
 
-	bool 'Sparc ESP Scsi Driver' CONFIG_SCSI_SUNESP $CONFIG_SCSI
+	tristate 'Sparc ESP Scsi Driver' CONFIG_SCSI_SUNESP $CONFIG_SCSI
 	tristate 'PTI Qlogic,ISP Driver' CONFIG_SCSI_QLOGICPTI $CONFIG_SCSI
 
 	if [ "$CONFIG_PCI" != "n" ]; then
Index: oldkernel/linux/arch/sparc64/defconfig
diff -u linux/arch/sparc64/defconfig:1.2 linux/arch/sparc64/defconfig:1.3
--- linux/arch/sparc64/defconfig:1.2	Thu Jun  1 15:00:59 2000
+++ linux/arch/sparc64/defconfig	Thu Jun  1 15:44:43 2000
@@ -176,6 +176,11 @@
 # CONFIG_NET_SCHED is not set
 
 #
+# Amateur Radio support
+#
+# CONFIG_HAMRADIO is not set
+
+#
 # SCSI support
 #
 CONFIG_SCSI=y
Index: oldkernel/linux/arch/sparc64/kernel/binfmt_elf32.c
diff -u linux/arch/sparc64/kernel/binfmt_elf32.c:1.1.1.1 linux/arch/sparc64/kernel/binfmt_elf32.c:1.2
--- linux/arch/sparc64/kernel/binfmt_elf32.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/binfmt_elf32.c	Thu Jun  1 15:44:43 2000
@@ -1,7 +1,7 @@
 /*
  * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra.
  *
- * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller	(davem@dm.cobaltmicro.com)
+ * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller	(davem@redhat.com)
  * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek	(jj@ultra.linux.cz)
  */
 
Index: oldkernel/linux/arch/sparc64/kernel/dtlb_backend.S
diff -u linux/arch/sparc64/kernel/dtlb_backend.S:1.1.1.1 linux/arch/sparc64/kernel/dtlb_backend.S:1.2
--- linux/arch/sparc64/kernel/dtlb_backend.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/dtlb_backend.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: dtlb_backend.S,v 1.7.2.1 1999/12/05 10:41:57 davem Exp $
+/* $Id: dtlb_backend.S,v 1.7.2.2 2000/01/31 05:02:35 davem Exp $
  * dtlb_backend.S: Back end to DTLB miss replacement strategy.
  *                 This is included directly into the trap table.
  *
- * Copyright (C) 1996,1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1996,1998 David S. Miller (davem@redhat.com)
  * Copyright (C) 1997,1998 Jakub Jelinek   (jj@ultra.linux.cz)
  */
 
Index: oldkernel/linux/arch/sparc64/kernel/dtlb_base.S
diff -u linux/arch/sparc64/kernel/dtlb_base.S:1.1.1.1 linux/arch/sparc64/kernel/dtlb_base.S:1.2
--- linux/arch/sparc64/kernel/dtlb_base.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/dtlb_base.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: dtlb_base.S,v 1.4 1998/06/15 16:59:30 jj Exp $
+/* $Id: dtlb_base.S,v 1.4.2.1 2000/01/31 05:02:35 davem Exp $
  * dtlb_base.S:	Front end to DTLB miss replacement strategy.
  *              This is included directly into the trap table.
  *
- * Copyright (C) 1996,1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1996,1998 David S. Miller (davem@redhat.com)
  * Copyright (C) 1997,1998 Jakub Jelinek   (jj@ultra.linux.cz)
  */
 
Index: oldkernel/linux/arch/sparc64/kernel/dtlb_prot.S
diff -u linux/arch/sparc64/kernel/dtlb_prot.S:1.1.1.1 linux/arch/sparc64/kernel/dtlb_prot.S:1.2
--- linux/arch/sparc64/kernel/dtlb_prot.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/dtlb_prot.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: dtlb_prot.S,v 1.18 1999/03/02 15:42:14 jj Exp $
+/* $Id: dtlb_prot.S,v 1.18.2.1 2000/01/31 05:02:35 davem Exp $
  * dtlb_prot.S: DTLB protection trap strategy.
  *              This is included directly into the trap table.
  *
- * Copyright (C) 1996,1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1996,1998 David S. Miller (davem@redhat.com)
  * Copyright (C) 1997,1998 Jakub Jelinek   (jj@ultra.linux.cz)
  */
 
Index: oldkernel/linux/arch/sparc64/kernel/ioctl32.c
diff -u linux/arch/sparc64/kernel/ioctl32.c:1.1.1.1 linux/arch/sparc64/kernel/ioctl32.c:1.2
--- linux/arch/sparc64/kernel/ioctl32.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/ioctl32.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: ioctl32.c,v 1.62.2.8 1999/11/16 23:59:31 davem Exp $
+/* $Id: ioctl32.c,v 1.62.2.9 2000/01/15 04:40:57 davem Exp $
  * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
  *
  * Copyright (C) 1997  Jakub Jelinek  (jj@sunsite.mff.cuni.cz)
@@ -37,6 +37,7 @@
 #include <linux/ext2_fs.h>
 #include <linux/videodev.h>
 #include <linux/netdevice.h>
+#include <linux/smb_fs.h>
 
 #include <scsi/scsi.h>
 /* Ugly hack. */
@@ -1692,6 +1693,24 @@
 	return 0;
 }
 
+static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	mm_segment_t old_fs = get_fs();
+	__kernel_uid_t kuid;
+	int err;
+
+	cmd = SMB_IOC_GETMOUNTUID;
+
+	set_fs(KERNEL_DS);
+	err = sys_ioctl(fd, cmd, (unsigned long)&kuid);
+	set_fs(old_fs);
+
+	if (err >= 0)
+		err = put_user(kuid, (__kernel_uid_t32 *)arg);
+
+	return err;
+}
+
 asmlinkage int sys32_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	struct file * filp;
@@ -1878,6 +1897,11 @@
 		error = do_video_ioctl(fd, cmd, arg);
 		goto out;
 
+	/* One SMB ioctl needs translations. */
+	case _IOR('u', 1, __kernel_uid_t32): /* SMB_IOC_GETMOUNTUID */
+		error = do_smb_getmountuid(fd, cmd, arg);
+		goto out;
+
 	/* List here exlicitly which ioctl's are known to have
 	 * compatable types passed or none at all...
 	 */
@@ -2393,6 +2417,9 @@
 	/* Raw devices */
 	case _IO(0xac, 0): /* RAW_SETBIND */
 	case _IO(0xac, 1): /* RAW_GETBIND */
+
+	/* SMB ioctls which do not need any translations */
+	case SMB_IOC_NEWCONN:
 
 		error = sys_ioctl (fd, cmd, arg);
 		goto out;
Index: oldkernel/linux/arch/sparc64/kernel/itlb_base.S
diff -u linux/arch/sparc64/kernel/itlb_base.S:1.1.1.1 linux/arch/sparc64/kernel/itlb_base.S:1.2
--- linux/arch/sparc64/kernel/itlb_base.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/itlb_base.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: itlb_base.S,v 1.7 1999/03/02 15:42:12 jj Exp $
+/* $Id: itlb_base.S,v 1.7.2.1 2000/01/31 05:02:35 davem Exp $
  * itlb_base.S:	Front end to ITLB miss replacement strategy.
  *              This is included directly into the trap table.
  *
- * Copyright (C) 1996,1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1996,1998 David S. Miller (davem@redhat.com)
  * Copyright (C) 1997,1998 Jakub Jelinek   (jj@ultra.linux.cz)
  */
 
Index: oldkernel/linux/arch/sparc64/kernel/signal32.c
diff -u linux/arch/sparc64/kernel/signal32.c:1.1.1.1 linux/arch/sparc64/kernel/signal32.c:1.2
--- linux/arch/sparc64/kernel/signal32.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/signal32.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/*  $Id: signal32.c,v 1.47.2.1 1999/06/14 00:36:24 davem Exp $
+/*  $Id: signal32.c,v 1.47.2.3 1999/12/20 01:14:06 davem Exp $
  *  arch/sparc64/kernel/signal32.c
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
@@ -1033,6 +1033,62 @@
 		err |= __put_user(0, &sf->fpu_save);
 	}
 	
+	/* Update the siginfo structure.  Is this good?  */
+	if (info->si_code == 0) {
+		info->si_signo = signr;
+		info->si_errno = 0;
+
+		switch (signr) {
+		case SIGSEGV:
+		case SIGILL:
+		case SIGFPE:
+		case SIGBUS:
+		case SIGEMT:
+			info->si_code = current->tss.sig_desc;
+			info->si_addr = (void *)current->tss.sig_address;
+			info->si_trapno = 0;
+			break;
+		default:
+			break;
+		}
+	}
+
+	err = __put_user (info->si_signo, &sf->info.si_signo);
+	err |= __put_user (info->si_errno, &sf->info.si_errno);
+	err |= __put_user (info->si_code, &sf->info.si_code);
+	if (info->si_code < 0)
+		err |= __copy_to_user (sf->info._sifields._pad, info->_sifields._pad, SI_PAD_SIZE);
+	else {
+		i = info->si_signo;
+		if (info->si_code == SI_USER)
+			i = SIGRTMIN;
+		switch (i) {
+		case SIGPOLL:
+			err |= __put_user (info->si_band, &sf->info.si_band);
+			err |= __put_user (info->si_fd, &sf->info.si_fd);
+			break;
+		case SIGCHLD:
+			err |= __put_user (info->si_pid, &sf->info.si_pid);
+			err |= __put_user (info->si_uid, &sf->info.si_uid);
+			err |= __put_user (info->si_status, &sf->info.si_status);
+			err |= __put_user (info->si_utime, &sf->info.si_utime);
+			err |= __put_user (info->si_stime, &sf->info.si_stime);
+			break;
+		case SIGSEGV:
+		case SIGILL:
+		case SIGFPE:
+		case SIGBUS:
+		case SIGEMT:
+			err |= __put_user ((long)info->si_addr, &sf->info.si_addr);
+			err |= __put_user (info->si_trapno, &sf->info.si_trapno);
+			break;
+		default:
+			err |= __put_user (info->si_pid, &sf->info.si_pid);
+			err |= __put_user (info->si_uid, &sf->info.si_uid);
+			break;
+		}
+	}
+	
 	/* Setup sigaltstack */
 	err |= __put_user(current->sas_ss_sp, &sf->stack.ss_sp);
 	err |= __put_user(sas_ss_flags(regs->u_regs[UREG_FP]), &sf->stack.ss_flags);
@@ -1048,7 +1104,7 @@
 	case 1: seta.sig[1] = (oldset->sig[0] >> 32);
 	        seta.sig[0] = oldset->sig[0];
 	}
-	err |= __copy_to_user(&sf->mask, &seta, sizeof(sigset_t));
+	err |= __copy_to_user(&sf->mask, &seta, sizeof(sigset_t32));
 
 	err |= copy_in_user((u32 *)sf,
 			    (u32 *)(regs->u_regs[UREG_FP]),
Index: oldkernel/linux/arch/sparc64/kernel/starfire.c
diff -u linux/arch/sparc64/kernel/starfire.c:1.1.1.1 linux/arch/sparc64/kernel/starfire.c:1.2
--- linux/arch/sparc64/kernel/starfire.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/starfire.c	Thu Jun  1 15:44:43 2000
@@ -1,7 +1,7 @@
-/* $Id: starfire.c,v 1.2 1998/12/09 18:53:11 davem Exp $
+/* $Id: starfire.c,v 1.2.2.1 2000/01/31 05:02:35 davem Exp $
  * starfire.c: Starfire/E10000 support.
  *
- * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  */
 
 #include <linux/kernel.h>
Index: oldkernel/linux/arch/sparc64/kernel/sys32.S
diff -u linux/arch/sparc64/kernel/sys32.S:1.2 linux/arch/sparc64/kernel/sys32.S:1.3
--- linux/arch/sparc64/kernel/sys32.S:1.2	Thu Jun  1 15:03:08 2000
+++ linux/arch/sparc64/kernel/sys32.S	Thu Jun  1 15:44:43 2000
@@ -20,7 +20,7 @@
 
 	.align		32
 	.globl		sys32_lseek
-	.globl		sys32_chmod, sys32_chown, sys32_lchown, sys32_mknod
+	.globl		sys32_chmod, sys32_mknod
 sys32_lseek:
 	sra		%o1, 0, %o1
 	sethi		%hi(sys_lseek), %g1
@@ -32,20 +32,6 @@
 	orcc		%g2, %lo(0xffff), %g2
 	jmpl		%g1 + %lo(sys_chmod), %g0
 	 and		%o1, %g2, %o1
-sys32_chown:
-	sethi		%hi(0xffff), %g2
-	sethi		%hi(sys_chown), %g1
-	orcc		%g2, %lo(0xffff), %g2
-	and		%o1, %g2, %o1
-	jmpl		%g1 + %lo(sys_chown), %g0
-	 and		%o2, %g2, %o2
-sys32_lchown:
-	sethi		%hi(0xffff), %g2
-	sethi		%hi(sys_lchown), %g1
-	orcc		%g2, %lo(0xffff), %g2
-	and		%o1, %g2, %o1
-	jmpl		%g1 + %lo(sys_lchown), %g0
-	 and		%o2, %g2, %o2
 sys32_mknod:
 	sethi		%hi(0xffff), %g2
 	sethi		%hi(sys_mknod), %g1
Index: oldkernel/linux/arch/sparc64/kernel/sys_sparc32.c
diff -u linux/arch/sparc64/kernel/sys_sparc32.c:1.2 linux/arch/sparc64/kernel/sys_sparc32.c:1.3
--- linux/arch/sparc64/kernel/sys_sparc32.c:1.2	Thu Jun  1 15:03:08 2000
+++ linux/arch/sparc64/kernel/sys_sparc32.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.107.2.5 1999/11/12 11:17:47 davem Exp $
+/* $Id: sys_sparc32.c,v 1.107.2.7 2000/01/24 11:36:50 jj Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
@@ -1954,15 +1954,14 @@
 	return ret;
 }
 
+#define low2highuid(uid) ((uid) == (u16)-1) ? (uid_t)-1 : (uid_t)(uid)
+#define low2highgid(gid) ((gid) == (u16)-1) ? (gid_t)-1 : (gid_t)(gid)
+
 extern asmlinkage int sys_setreuid(uid_t ruid, uid_t euid);
 
 asmlinkage int sys32_setreuid(__kernel_uid_t32 ruid, __kernel_uid_t32 euid)
 {
-	uid_t sruid, seuid;
-
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
-	return sys_setreuid(sruid, seuid);
+	return sys_setreuid(low2highuid(ruid), low2highuid(euid));
 }
 
 extern asmlinkage int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid);
@@ -1971,12 +1970,7 @@
 			       __kernel_uid_t32 euid,
 			       __kernel_uid_t32 suid)
 {
-	uid_t sruid, seuid, ssuid;
-
-	sruid = (ruid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)ruid);
-	seuid = (euid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)euid);
-	ssuid = (suid == (__kernel_uid_t32)-1) ? ((uid_t)-1) : ((uid_t)suid);
-	return sys_setresuid(sruid, seuid, ssuid);
+	return sys_setresuid(low2highuid(ruid), low2highuid(euid), low2highuid(suid));
 }
 
 extern asmlinkage int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);
@@ -1999,11 +1993,7 @@
 
 asmlinkage int sys32_setregid(__kernel_gid_t32 rgid, __kernel_gid_t32 egid)
 {
-	gid_t srgid, segid;
-
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
-	return sys_setregid(srgid, segid);
+	return sys_setregid(low2highgid(rgid), low2highgid(egid));
 }
 
 extern asmlinkage int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid);
@@ -2012,12 +2002,7 @@
 			       __kernel_gid_t32 egid,
 			       __kernel_gid_t32 sgid)
 {
-	gid_t srgid, segid, ssgid;
-
-	srgid = (rgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)rgid);
-	segid = (egid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)egid);
-	ssgid = (sgid == (__kernel_gid_t32)-1) ? ((gid_t)-1) : ((gid_t)sgid);
-	return sys_setresgid(srgid, segid, ssgid);
+	return sys_setresgid(low2highgid(rgid), low2highgid(egid), low2highgid(sgid));
 }
 
 extern asmlinkage int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);
@@ -2037,6 +2022,25 @@
 		ret |= put_user (c, sgid);
 	}
 	return ret;
+}
+
+extern asmlinkage long sys_chown(const char *, uid_t,gid_t);
+extern asmlinkage long sys_lchown(const char *, uid_t,gid_t);
+extern asmlinkage long sys_fchown(unsigned int, uid_t,gid_t);
+
+asmlinkage long sys32_chown16(const char * filename, u16 user, u16 group)
+{
+	return sys_chown(filename, low2highuid(user), low2highgid(group));
+}
+
+asmlinkage long sys32_lchown16(const char * filename, u16 user, u16 group)
+{
+	return sys_lchown(filename, low2highuid(user), low2highgid(group));
+}
+                
+asmlinkage long sys32_fchown16(unsigned int fd, u16 user, u16 group)
+{
+	return sys_fchown(fd, low2highuid(user), low2highgid(group));
 }
 
 struct tms32 {
Index: oldkernel/linux/arch/sparc64/kernel/sys_sunos32.c
diff -u linux/arch/sparc64/kernel/sys_sunos32.c:1.2 linux/arch/sparc64/kernel/sys_sunos32.c:1.3
--- linux/arch/sparc64/kernel/sys_sunos32.c:1.2	Thu Jun  1 15:03:08 2000
+++ linux/arch/sparc64/kernel/sys_sunos32.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos32.c,v 1.22.2.2 1999/08/07 10:43:02 davem Exp $
+/* $Id: sys_sunos32.c,v 1.22.2.3 2000/01/17 21:28:31 davem Exp $
  * sys_sunos32.c: SunOS binary compatability layer on sparc64.
  *
  * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
@@ -327,6 +327,7 @@
 	spin_lock_irq(&current->sigmask_lock);
 	old = (u32) current->blocked.sig[0];
 	current->blocked.sig[0] |= (blk_mask & _BLOCKABLE);
+	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	return old;
 }
@@ -338,6 +339,7 @@
 	spin_lock_irq(&current->sigmask_lock);
 	retval = (u32) current->blocked.sig[0];
 	current->blocked.sig[0] = (newmask & _BLOCKABLE);
+	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 	return retval;
 }
Index: oldkernel/linux/arch/sparc64/kernel/systbls.S
diff -u linux/arch/sparc64/kernel/systbls.S:1.2 linux/arch/sparc64/kernel/systbls.S:1.3
--- linux/arch/sparc64/kernel/systbls.S:1.2	Thu Jun  1 15:03:08 2000
+++ linux/arch/sparc64/kernel/systbls.S	Thu Jun  1 15:44:43 2000
@@ -43,7 +43,7 @@
 	.word sys32_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_nis_syscall, sys_nis_syscall
 /*110*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
 	.word sys_nis_syscall, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
-/*120*/	.word sys32_readv, sys32_writev, sys32_settimeofday, sys_fchown, sys_fchmod
+/*120*/	.word sys32_readv, sys32_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
 	.word sys_nis_syscall, sys32_setreuid, sys32_setregid, sys_rename, sys_truncate
 /*130*/	.word sys_ftruncate, sys_flock, sys_lstat64, sys_nis_syscall, sys_nis_syscall
 	.word sys_nis_syscall, sys_mkdir, sys_rmdir, sys32_utimes, sys_stat64
@@ -143,7 +143,7 @@
 	.word sys_close, sunos_wait4, sys_creat
 	.word sys_link, sys_unlink, sunos_execv
 	.word sys_chdir, sunos_nosys, sys32_mknod
-	.word sys32_chmod, sys32_lchown, sunos_brk
+	.word sys32_chmod, sys32_lchown16, sunos_brk
 	.word sunos_nosys, sys32_lseek, sunos_getpid
 	.word sunos_nosys, sunos_nosys, sunos_nosys
 	.word sunos_getuid, sunos_nosys, sys_ptrace
@@ -179,7 +179,7 @@
 	.word sys32_sigstack, sys32_recvmsg, sys32_sendmsg
 	.word sunos_nosys, sys32_gettimeofday, sys32_getrusage
 	.word sunos_getsockopt, sunos_nosys, sunos_readv
-	.word sunos_writev, sys32_settimeofday, sys_fchown
+	.word sunos_writev, sys32_settimeofday, sys32_fchown16
 	.word sys_fchmod, sys32_recvfrom, sys32_setreuid
 	.word sys_setregid, sys_rename, sys_truncate
 	.word sys_ftruncate, sys_flock, sunos_nosys
Index: oldkernel/linux/arch/sparc64/kernel/traps.c
diff -u linux/arch/sparc64/kernel/traps.c:1.1.1.1 linux/arch/sparc64/kernel/traps.c:1.2
--- linux/arch/sparc64/kernel/traps.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/kernel/traps.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.58.2.2 1999/12/01 23:55:43 davem Exp $
+/* $Id: traps.c,v 1.58.2.3 1999/12/19 23:59:28 davem Exp $
  * arch/sparc64/kernel/traps.c
  *
  * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -516,8 +516,22 @@
 		regs->tpc = regs->tnpc;
 		regs->tnpc += 4;
 	} else {
+		unsigned long fsr = current->tss.xfsr[0];
+
 		current->tss.sig_address = regs->tpc;
 		current->tss.sig_desc = SUBSIG_FPERROR;
+		if ((fsr & 0x1c000) == (1 << 14)) {
+			if (fsr & 0x01)
+				current->tss.sig_desc = SUBSIG_FPINEXACT;
+			else if (fsr & 0x02)
+				current->tss.sig_desc = SUBSIG_FPDIVZERO;
+			else if (fsr & 0x04)
+				current->tss.sig_desc = SUBSIG_FPUNFLOW;
+			else if (fsr & 0x08)
+				current->tss.sig_desc = SUBSIG_FPOVFLOW;
+			else if (fsr & 0x10)
+				current->tss.sig_desc = SUBSIG_FPINTOVFL;
+		}
 		send_sig(SIGFPE, current, 1);
 	}
 }
@@ -561,7 +575,9 @@
 
 void do_div0(struct pt_regs *regs)
 {
-	send_sig(SIGILL, current, 1);
+	current->tss.sig_address = regs->tpc;
+	current->tss.sig_desc = SUBSIG_IDIVZERO;
+	send_sig(SIGFPE, current, 1);
 }
 
 void instruction_dump (unsigned int *pc)
@@ -686,10 +702,12 @@
 	send_sig(SIGILL, current, 1);
 }
 
-void handle_hw_divzero(struct pt_regs *regs, unsigned long pc, unsigned long npc,
-		       unsigned long psr)
+void handle_hw_divzero(struct pt_regs *regs, unsigned long pc,
+		       unsigned long npc, unsigned long psr)
 {
-	send_sig(SIGILL, current, 1);
+	current->tss.sig_address = regs->tpc;
+	current->tss.sig_desc = SUBSIG_IDIVZERO;
+	send_sig(SIGFPE, current, 1);
 }
 
 /* Trap level 1 stuff or other traps we should never see... */
Index: oldkernel/linux/arch/sparc64/lib/debuglocks.c
diff -u linux/arch/sparc64/lib/debuglocks.c:1.1.1.1 linux/arch/sparc64/lib/debuglocks.c:1.2
--- linux/arch/sparc64/lib/debuglocks.c:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/lib/debuglocks.c	Thu Jun  1 15:44:43 2000
@@ -1,7 +1,7 @@
-/* $Id: debuglocks.c,v 1.2 1998/10/13 09:07:27 davem Exp $
+/* $Id: debuglocks.c,v 1.2.2.1 2000/01/31 05:02:31 davem Exp $
  * debuglocks.c: Debugging versions of SMP locking primitives.
  *
- * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  */
 
 #include <linux/kernel.h>
Index: oldkernel/linux/arch/sparc64/lib/memscan.S
diff -u linux/arch/sparc64/lib/memscan.S:1.1.1.1 linux/arch/sparc64/lib/memscan.S:1.2
--- linux/arch/sparc64/lib/memscan.S:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/lib/memscan.S	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: memscan.S,v 1.2 1998/05/21 14:42:22 jj Exp $
+/* $Id: memscan.S,v 1.2.2.1 2000/01/31 05:02:32 davem Exp $
  * memscan.S: Optimized memscan for Sparc64.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@ultra.linux.cz)
- * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  */
 
 #define HI_MAGIC	0x8080808080808080
Index: oldkernel/linux/arch/sparc64/math-emu/sfp-machine.h
diff -u linux/arch/sparc64/math-emu/sfp-machine.h:1.1.1.1 linux/arch/sparc64/math-emu/sfp-machine.h:1.2
--- linux/arch/sparc64/math-emu/sfp-machine.h:1.1.1.1	Wed May 31 12:33:53 2000
+++ linux/arch/sparc64/math-emu/sfp-machine.h	Thu Jun  1 15:44:43 2000
@@ -37,7 +37,7 @@
   _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
 
 #define _FP_DIV_MEAT_S(R,X,Y)	_FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm)
-#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv(D,R,X,Y)
+#define _FP_DIV_MEAT_D(R,X,Y)	_FP_DIV_MEAT_1_udiv_norm(D,R,X,Y)
 #define _FP_DIV_MEAT_Q(R,X,Y)	_FP_DIV_MEAT_2_udiv(Q,R,X,Y)
 
 #define _FP_NANFRAC_S		((_FP_QNANBIT_S << 1) - 1)
Index: oldkernel/linux/drivers/block/cmd646.c
diff -u linux/drivers/block/cmd646.c:1.1.1.1 linux/drivers/block/cmd646.c:1.2
--- linux/drivers/block/cmd646.c:1.1.1.1	Wed May 31 12:33:50 2000
+++ linux/drivers/block/cmd646.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: cmd646.c,v 1.11 1998/12/13 08:36:54 davem Exp $
+/* $Id: cmd646.c,v 1.11.2.1 2000/01/31 05:02:39 davem Exp $
  * cmd646.c: Enable interrupts at initialization time on Ultra/PCI machines.
  *           Note, this driver is not used at all on other systems because
  *           there the "BIOS" has done all of the following already.
@@ -6,7 +6,7 @@
  *           on the 646U2 and not on the 646U.
  *
  * Copyright (C) 1998       Eddie C. Dost  (ecd@skynet.be)
- * Copyright (C) 1998       David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998       David S. Miller (davem@redhat.com)
  */
 
 #include <linux/types.h>
Index: oldkernel/linux/drivers/misc/parport_ax.c
diff -u linux/drivers/misc/parport_ax.c:1.1.1.1 linux/drivers/misc/parport_ax.c:1.2
--- linux/drivers/misc/parport_ax.c:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/misc/parport_ax.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: parport_ax.c,v 1.17 1999/01/20 06:18:54 davem Exp $
+/* $Id: parport_ax.c,v 1.17.2.1 2000/01/09 18:29:28 ecd Exp $
  * Parallel-port routines for Sun Ultra/AX architecture
  * 
  * Author: Eddie C. Dost <ecd@skynet.be>
@@ -30,13 +30,6 @@
 #include <asm/irq.h>
 
 
-/*
- * Define this if you have Devices which don't support short
- * host read/write cycles.
- */
-#undef HAVE_SLOW_DEVICES
-
-
 #define DATA		0x00
 #define STATUS		0x01
 #define CONTROL		0x02
@@ -513,7 +506,6 @@
 	struct parport tmpport, *p;
 	unsigned long base;
 	unsigned long config;
-	unsigned char tmp;
 	int irq, dma;
 
 	/* Pointer to NS87303 Configuration Registers */
@@ -523,29 +515,15 @@
 	tmpport.base = dev->base_address[0];
 	tmpport.ops = &parport_ax_ops;
 
+	/* Configure IRQ to Push Pull, Level Low */
 	/* Enable ECP mode, set bit 2 of the CTR first */
 	tmpport.ops->write_control(&tmpport, 0x04);
-	tmp = ns87303_readb(config, PCR);
-	tmp |= (PCR_EPP_IEEE | PCR_ECP_ENABLE | PCR_ECP_CLK_ENA);
-	ns87303_writeb(config, PCR, tmp);
+	ns87303_modify(config, PCR,
+		       PCR_EPP_ENABLE | PCR_IRQ_ODRAIN,
+		       PCR_ECP_ENABLE | PCR_ECP_CLK_ENA | PCR_IRQ_POLAR);
 
 	/* LPT CTR bit 5 controls direction of parallel port */
-	tmp = ns87303_readb(config, PTR);
-	tmp |= PTR_LPT_REG_DIR;
-	ns87303_writeb(config, PTR, tmp);
-
-	/* Configure IRQ to Push Pull, Level Low */
-	tmp = ns87303_readb(config, PCR);
-	tmp &= ~(PCR_IRQ_ODRAIN);
-	tmp |= PCR_IRQ_POLAR;
-	ns87303_writeb(config, PCR, tmp);
-
-#ifndef HAVE_SLOW_DEVICES
-	/* Enable Zero Wait State for ECP */
-	tmp = ns87303_readb(config, FCR);
-	tmp |= FCR_ZWS_ENA;
-	ns87303_writeb(config, FCR, tmp);
-#endif
+	ns87303_modify(config, PTR, 0, PTR_LPT_REG_DIR);
 
 	/*
 	 * Now continue initializing the port
Index: oldkernel/linux/drivers/sbus/audio/dbri.c
diff -u linux/drivers/sbus/audio/dbri.c:1.1.1.1 linux/drivers/sbus/audio/dbri.c:1.2
--- linux/drivers/sbus/audio/dbri.c:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/sbus/audio/dbri.c	Thu Jun  1 15:44:43 2000
@@ -17,6 +17,7 @@
  *   - Data sheet of the T7903, a newer but very similar ISA bus equivalent
  *     available from the Lucent (formarly AT&T microelectronics) home
  *     page.
+ *   - http://www.freesoft.org/Linux/DBRI (PDF data sheet)
  * - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec
  *   Interfaces: CHI, Audio In & Out, 2 bits parallel
  *   Documentation: from the Crystal Semiconductor home page.
Index: oldkernel/linux/drivers/sbus/char/pcikbd.c
diff -u linux/drivers/sbus/char/pcikbd.c:1.2 linux/drivers/sbus/char/pcikbd.c:1.3
--- linux/drivers/sbus/char/pcikbd.c:1.2	Thu Jun  1 15:08:24 2000
+++ linux/drivers/sbus/char/pcikbd.c	Thu Jun  1 15:44:43 2000
@@ -1,8 +1,8 @@
-/* $Id: pcikbd.c,v 1.27.2.1 1999/10/01 05:09:36 davem Exp $
+/* $Id: pcikbd.c,v 1.27.2.2 2000/01/21 01:05:45 davem Exp $
  * pcikbd.c: Ultra/AX PC keyboard support.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
- * JavaStation(MrCoffee) support by Pete A. Zaitcev.
+ * JavaStation support by Pete A. Zaitcev.
  *
  * This code is mainly put together from various places in
  * drivers/char, please refer to these sources for credits
@@ -30,13 +30,16 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
-#ifdef __sparc_v9__
-#define	PCI_KB_NAME	"kb_ps2"
-#define PCI_MS_NAME	"kdmouse"
-#else
-#define PCI_KB_NAME	"keyboard"
-#define PCI_MS_NAME	"mouse"
-#endif
+/*
+ * Different platforms provide different permutations of names.
+ * AXi - kb_ps2, kdmouse.
+ * MrCoffee - keyboard, mouse.
+ * Espresso - keyboard, kdmouse.
+ */
+#define	PCI_KB_NAME1	"kb_ps2"
+#define PCI_KB_NAME2	"keyboard"
+#define PCI_MS_NAME1	"kdmouse"
+#define PCI_MS_NAME2	"mouse"
 
 #include "pcikbd.h"
 #include "sunserial.h"
@@ -502,7 +505,8 @@
 			for_each_ebusdev(edev, ebus) {
 				if(!strcmp(edev->prom_name, "8042")) {
 					for_each_edevchild(edev, child) {
-                                                if (!strcmp(child->prom_name, PCI_KB_NAME))
+                                                if (strcmp(child->prom_name, PCI_KB_NAME1) == 0 ||
+						    strcmp(child->prom_name, PCI_KB_NAME2) == 0)
 							goto found;
 					}
 				}
@@ -513,12 +517,14 @@
 
 found:
 		pcikbd_iobase = child->base_address[0];
+#ifdef __sparc_v9__
 		if (check_region(pcikbd_iobase, sizeof(unsigned long))) {
 			printk("8042: can't get region %lx, %d\n",
 			       pcikbd_iobase, (int)sizeof(unsigned long));
 			return;
 		}
 		request_region(pcikbd_iobase, sizeof(unsigned long), "8042 controller");
+#endif
 
 		pcikbd_irq = child->irqs[0];
 		if (request_irq(pcikbd_irq, &pcikbd_interrupt,
@@ -548,7 +554,7 @@
 	 * XXX: my 3.1.3 PROM does not give me the beeper node for the audio
 	 *      auxio register, though I know it is there... (ecd)
 	 *
-	 * Both JE1 & MrCoffe have no beeper. How about Krups? --zaitcev
+	 * JavaStations appear not to have beeper. --zaitcev
 	 */
 	if (!edev)
 		pcibeep_iobase = (pcikbd_iobase & ~(0xffffff)) | 0x722000;
@@ -575,7 +581,6 @@
 }
 
 
-
 /*
  * Here begins the Mouse Driver.
  */
@@ -979,7 +984,8 @@
 			for_each_ebusdev(edev, ebus) {
 				if(!strcmp(edev->prom_name, "8042")) {
 					for_each_edevchild(edev, child) {
-							if (!strcmp(child->prom_name, PCI_MS_NAME))
+							if (strcmp(child->prom_name, PCI_MS_NAME1) == 0 ||
+							    strcmp(child->prom_name, PCI_MS_NAME2) == 0)
 							goto found;
 					}
 				}
@@ -1054,7 +1060,7 @@
 
 __initfunc(int ps2kbd_probe(unsigned long *memory_start))
 {
-	int pnode, enode, node, dnode;
+	int pnode, enode, node, dnode, xnode;
 	int kbnode = 0, msnode = 0, bnode = 0;
 	int devices = 0;
 	char prop[128];
@@ -1134,18 +1140,20 @@
 			 * For each '8042' on this EBus...
 			 */
 			while (node) {
+				dnode = prom_getchild(node);
+
 				/*
 				 * Does it match?
 				 */
-				dnode = prom_getchild(node);
-				dnode = prom_searchsiblings(dnode, PCI_KB_NAME);
-				if (dnode == kbnode) {
+				if ((xnode = prom_searchsiblings(dnode, PCI_KB_NAME1)) == kbnode) {
 					++devices;
+				} else if ((xnode = prom_searchsiblings(dnode, PCI_KB_NAME2)) == kbnode) {
+					++devices;
 				}
 
-				dnode = prom_getchild(node);
-				dnode = prom_searchsiblings(dnode, PCI_MS_NAME);
-				if (dnode == msnode) {
+				if ((xnode = prom_searchsiblings(dnode, PCI_MS_NAME1)) == msnode) {
+					++devices;
+				} else if ((xnode = prom_searchsiblings(dnode, PCI_MS_NAME2)) == msnode) {
 					++devices;
 				}
 
Index: oldkernel/linux/drivers/sbus/char/zs.c
diff -u linux/drivers/sbus/char/zs.c:1.1.1.1 linux/drivers/sbus/char/zs.c:1.2
--- linux/drivers/sbus/char/zs.c:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/sbus/char/zs.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: zs.c,v 1.41.2.4 1999/10/14 08:44:40 davem Exp $
+/* $Id: zs.c,v 1.41.2.5 2000/01/21 01:05:47 davem Exp $
  * zs.c: Zilog serial port driver for the Sparc.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -1855,7 +1855,7 @@
 
 static void show_serial_version(void)
 {
-	char *revision = "$Revision: 1.41.2.4 $";
+	char *revision = "$Revision: 1.41.2.5 $";
 	char *version, *p;
 
 	version = strchr(revision, ' ');
@@ -2023,9 +2023,8 @@
 		/* Can use the prom for other machine types */
 		zsnode = prom_getchild(prom_root_node);
 		if (sparc_cpu_model == sun4d) {
-			int node;
 			int no = 0;
-			
+
 			tmpnode = zsnode;
 			zsnode = 0;
 			bbnode = 0;
Index: oldkernel/linux/drivers/scsi/esp.c
diff -u linux/drivers/scsi/esp.c:1.1.1.1 linux/drivers/scsi/esp.c:1.2
--- linux/drivers/scsi/esp.c:1.1.1.1	Wed May 31 12:33:51 2000
+++ linux/drivers/scsi/esp.c	Thu Jun  1 15:44:43 2000
@@ -39,6 +39,8 @@
 #include <asm/idprom.h>
 #include <asm/spinlock.h>
 
+#include <linux/module.h>
+
 #define DEBUG_ESP
 /* #define DEBUG_ESP_HME */
 /* #define DEBUG_ESP_DATA */
@@ -4313,3 +4315,11 @@
 	spin_unlock_irqrestore(&io_request_lock, flags);
 }
 #endif
+
+#ifdef MODULE
+Scsi_Host_Template driver_template = SCSI_SPARC_ESP;
+
+#include "scsi_module.c"
+
+EXPORT_NO_SYMBOLS;
+#endif /* MODULE */
Index: oldkernel/linux/drivers/video/atyfb.c
diff -u linux/drivers/video/atyfb.c:1.2 linux/drivers/video/atyfb.c:1.3
--- linux/drivers/video/atyfb.c:1.2	Thu Jun  1 15:12:47 2000
+++ linux/drivers/video/atyfb.c	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/*  $Id: atyfb.c,v 1.106.2.6 1999/10/14 08:44:47 davem Exp $
+/*  $Id: atyfb.c,v 1.106.2.7 1999/11/19 00:12:29 davem Exp $
  *  linux/drivers/video/atyfb.c -- Frame buffer device for ATI Mach64
  *
  *	Copyright (C) 1997-1998  Geert Uytterhoeven
Index: oldkernel/linux/drivers/video/iga.h
diff -u linux/drivers/video/iga.h:1.1.1.1 linux/drivers/video/iga.h:1.2
--- linux/drivers/video/iga.h:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/video/iga.h	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: iga.h,v 1.1 1998/10/07 11:36:07 jj Exp $
+/* $Id: iga.h,v 1.1.2.1 2000/01/21 01:05:53 davem Exp $
  * iga1682.h: Sparc/PCI iga1682 driver constants etc.
  *
  * Copyleft 1998 V. Roganov and G. Raiko
@@ -12,6 +12,8 @@
     unsigned int total_vram;
 };
 
+#define IGA_ATTR_CTL			0x3C0
+#define   IGA_IDX_VGA_OVERSCAN		0x11
 #define DAC_W_INDEX                     0x03C8
 #define DAC_DATA                        0x03C9
 #define IGA_EXT_CNTRL                   0x3CE
Index: oldkernel/linux/drivers/video/igafb.c
diff -u linux/drivers/video/igafb.c:1.1.1.1 linux/drivers/video/igafb.c:1.2
--- linux/drivers/video/igafb.c:1.1.1.1	Wed May 31 12:33:52 2000
+++ linux/drivers/video/igafb.c	Thu Jun  1 15:44:43 2000
@@ -659,11 +659,11 @@
 	info->frame_buffer_phys = addr & PCI_BASE_ADDRESS_MEM_MASK;
 
 #ifdef __sparc__
-	
-	info->io_base_phys = info->frame_buffer_phys;
-	
-	/* Obtain virtual address and correct physical by PCIC shift */
-	info->io_base = pcic_alloc_io(&info->io_base_phys);
+
+	info->io_base_phys = 0x30000000;
+
+	info->io_base = sparc_alloc_io(info->io_base_phys,
+	    NULL, 0x1000, "iga", 0, 0);
 	if (!info->io_base) {
 		return;
 	}
Index: oldkernel/linux/include/asm-sparc/ethtool.h
diff -u linux/include/asm-sparc/ethtool.h:1.1.1.1 linux/include/asm-sparc/ethtool.h:1.2
--- linux/include/asm-sparc/ethtool.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc/ethtool.h	Thu Jun  1 15:44:43 2000
@@ -1,7 +1,7 @@
-/* $Id: ethtool.h,v 1.1 1998/12/19 15:09:38 davem Exp $
+/* $Id: ethtool.h,v 1.1.2.1 2000/01/31 05:02:42 davem Exp $
  * ethtool.h: Defines for SparcLinux ethtool.
  *
- * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  */
 
 #ifndef _SPARC_ETHTOOL_H
Index: oldkernel/linux/include/asm-sparc/pcic.h
diff -u linux/include/asm-sparc/pcic.h:1.1.1.1 linux/include/asm-sparc/pcic.h:1.2
--- linux/include/asm-sparc/pcic.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc/pcic.h	Thu Jun  1 15:44:43 2000
@@ -1,5 +1,5 @@
-/* $Id: pcic.h,v 1.1 1998/09/22 05:54:39 jj Exp $
- * pcic.h: JavaEngine 1 specific PCI definitions.
+/* $Id: pcic.h,v 1.1.2.1 2000/01/21 01:05:56 davem Exp $
+ * pcic.h: MicroSPARC-IIep specific PCI definitions.
  *
  * Copyright (C) 1998 V. Roganov and G. Raiko
  */
@@ -7,6 +7,8 @@
 #ifndef __SPARC_PCIC_H
 #define __SPARC_PCIC_H
 
+#ifndef __ASSEMBLY__
+
 #include <linux/types.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
@@ -21,13 +23,17 @@
         unsigned long           pcic_config_space_addr;
         unsigned long           pcic_config_space_data;
         struct linux_pbm_info   pbm;
+	struct pcic_ca2irq	*pcic_imap;
+	int			pcic_imdim;
 };
 
 extern unsigned long pcic_alloc_io(unsigned long* addr);
 extern void pcic_probe(void);
 extern void sun4m_pci_init_IRQ(void);
+
+#endif
 
-/* Size of PCI Space */
+/* Size of PCI I/O space which we relocate. */
 #define PCI_SPACE_SIZE                  0x1000000       /* 16 MB */
 
 /* PCIC Register Set. */
@@ -50,10 +56,18 @@
 #define PCI_SOFTWARE_INT_CLEAR          0x6a    /* 16 bits */
 #define PCI_SOFTWARE_INT_SET            0x6e    /* 16 bits */
 #define PCI_SYS_INT_PENDING             0x70    /* 32 bits */
+#define  PCI_SYS_INT_PENDING_PIO		0x40000000
+#define  PCI_SYS_INT_PENDING_DMA		0x20000000
+#define  PCI_SYS_INT_PENDING_PCI		0x10000000
+#define  PCI_SYS_INT_PENDING_APSR		0x08000000
 #define PCI_SYS_INT_TARGET_MASK         0x74    /* 32 bits */
 #define PCI_SYS_INT_TARGET_MASK_CLEAR   0x78    /* 32 bits */
 #define PCI_SYS_INT_TARGET_MASK_SET     0x7c    /* 32 bits */
 #define PCI_SYS_INT_PENDING_CLEAR       0x83    /* 8  bits */
+#define  PCI_SYS_INT_PENDING_CLEAR_ALL		0x80
+#define  PCI_SYS_INT_PENDING_CLEAR_PIO		0x40
+#define  PCI_SYS_INT_PENDING_CLEAR_DMA		0x20
+#define  PCI_SYS_INT_PENDING_CLEAR_PCI		0x10
 #define PCI_IOTLB_CONTROL               0x84    /* 8  bits */
 #define PCI_INT_SELECT_LO               0x88    /* 16 bits */
 #define PCI_ARBITRATION_SELECT          0x8a    /* 16 bits */
Index: oldkernel/linux/include/asm-sparc64/ethtool.h
diff -u linux/include/asm-sparc64/ethtool.h:1.1.1.1 linux/include/asm-sparc64/ethtool.h:1.2
--- linux/include/asm-sparc64/ethtool.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc64/ethtool.h	Thu Jun  1 15:44:43 2000
@@ -1,7 +1,7 @@
-/* $Id: ethtool.h,v 1.1 1998/12/19 15:09:40 davem Exp $
+/* $Id: ethtool.h,v 1.1.2.1 2000/01/31 05:02:43 davem Exp $
  * ethtool.h: Defines for SparcLinux ethtool.
  *
- * Copyright (C) 1998 David S. Miller (davem@dm.cobaltmicro.com)
+ * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  */
 
 #ifndef _SPARC64_ETHTOOL_H
Index: oldkernel/linux/include/asm-sparc64/floppy.h
diff -u linux/include/asm-sparc64/floppy.h:1.1.1.1 linux/include/asm-sparc64/floppy.h:1.2
--- linux/include/asm-sparc64/floppy.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc64/floppy.h	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: floppy.h,v 1.18.2.2 1999/08/09 21:07:41 ecd Exp $
+/* $Id: floppy.h,v 1.18.2.3 2000/01/09 18:29:32 ecd Exp $
  * asm-sparc64/floppy.h: Sparc specific parts of the Floppy driver.
  *
  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
@@ -574,7 +574,6 @@
 		struct linux_ebus_device *edev = 0;
 		unsigned long config = 0;
 		unsigned long auxio_reg;
-		unsigned char cfg;
 
 		for_each_ebus(ebus) {
 			for_each_ebusdev(edev, ebus) {
@@ -678,9 +677,7 @@
 			return sun_floppy_types[0];
 
 		/* Enable PC-AT mode. */
-		cfg = ns87303_readb(config, ASC);
-		cfg |= 0xc0;
-		ns87303_writeb(config, ASC, cfg);
+		ns87303_modify(config, ASC, 0, 0xc0);
 
 #ifdef PCI_FDC_SWAP_DRIVES
 		/*
@@ -691,15 +688,9 @@
 			 * Set the drive exchange bit in FCR on NS87303,
 			 * make shure other bits are sane before doing so.
 			 */
-			cfg = ns87303_readb(config, FER);
-			cfg &= ~(FER_EDM);
-			ns87303_writeb(config, FER, cfg);
-			cfg = ns87303_readb(config, ASC);
-			cfg &= ~(ASC_DRV2_SEL);
-			ns87303_writeb(config, ASC, cfg);
-			cfg = ns87303_readb(config, FCR);
-			cfg |= FCR_LDE;
-			ns87303_writeb(config, FCR, cfg);
+			ns87303_modify(config, FER, FER_EDM, 0);
+			ns87303_modify(config, ASC, ASC_DRV2_SEL, 0);
+			ns87303_modify(config, FCR, 0, FCR_LDE);
 
 			cfg = sun_floppy_types[0];
 			sun_floppy_types[0] = sun_floppy_types[1];
Index: oldkernel/linux/include/asm-sparc64/io.h
diff -u linux/include/asm-sparc64/io.h:1.1.1.1 linux/include/asm-sparc64/io.h:1.2
--- linux/include/asm-sparc64/io.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc64/io.h	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: io.h,v 1.19 1998/08/23 05:41:46 ecd Exp $ */
+/* $Id: io.h,v 1.19.2.1 2000/01/14 03:55:36 davem Exp $ */
 #ifndef __SPARC64_IO_H
 #define __SPARC64_IO_H
 
@@ -120,12 +120,66 @@
 extern void insl(unsigned long addr, void *dst, unsigned long count);
 
 /* Memory functions, same as I/O accesses on Ultra. */
-#define readb(addr)		inb((unsigned long)(addr))
-#define readw(addr)		inw((unsigned long)(addr))
-#define readl(addr)		inl((unsigned long)(addr))
-#define writeb(b, addr)		outb((b), (unsigned long)(addr))
-#define writew(w, addr)		outw((w), (unsigned long)(addr))
-#define writel(l, addr)		outl((l), (unsigned long)(addr))
+extern __inline__ unsigned int _readb(unsigned long addr)
+{
+	unsigned int ret;
+
+	__asm__ __volatile__("lduba [%1] %2, %0"
+			     : "=r" (ret)
+			     : "r" (addr), "i" (ASI_PL));
+
+	return ret;
+}
+
+extern __inline__ unsigned int _readw(unsigned long addr)
+{
+	unsigned int ret;
+
+	__asm__ __volatile__("lduha [%1] %2, %0"
+			     : "=r" (ret)
+			     : "r" (addr), "i" (ASI_PL));
+
+	return ret;
+}
+
+extern __inline__ unsigned int _readl(unsigned long addr)
+{
+	unsigned int ret;
+
+	__asm__ __volatile__("lduwa [%1] %2, %0"
+			     : "=r" (ret)
+			     : "r" (addr), "i" (ASI_PL));
+
+	return ret;
+}
+
+extern __inline__ void _writeb(unsigned char b, unsigned long addr)
+{
+	__asm__ __volatile__("stba %0, [%1] %2"
+			     : /* no outputs */
+			     : "r" (b), "r" (addr), "i" (ASI_PL));
+}
+
+extern __inline__ void _writew(unsigned short w, unsigned long addr)
+{
+	__asm__ __volatile__("stha %0, [%1] %2"
+			     : /* no outputs */
+			     : "r" (w), "r" (addr), "i" (ASI_PL));
+}
+
+extern __inline__ void _writel(unsigned int l, unsigned long addr)
+{
+	__asm__ __volatile__("stwa %0, [%1] %2"
+			     : /* no outputs */
+			     : "r" (l), "r" (addr), "i" (ASI_PL));
+}
+
+#define readb(addr)		_readb((unsigned long)(addr))
+#define readw(addr)		_readw((unsigned long)(addr))
+#define readl(addr)		_readl((unsigned long)(addr))
+#define writeb(b, addr)		_writeb((b), (unsigned long)(addr))
+#define writew(w, addr)		_writew((w), (unsigned long)(addr))
+#define writel(l, addr)		_writel((l), (unsigned long)(addr))
 
 /*
  * Memcpy to/from I/O space is just a regular memory operation on
Index: oldkernel/linux/include/asm-sparc64/ns87303.h
diff -u linux/include/asm-sparc64/ns87303.h:1.1.1.1 linux/include/asm-sparc64/ns87303.h:1.2
--- linux/include/asm-sparc64/ns87303.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/asm-sparc64/ns87303.h	Thu Jun  1 15:44:43 2000
@@ -1,4 +1,4 @@
-/* $Id: ns87303.h,v 1.2 1998/09/13 15:38:50 ecd Exp $
+/* $Id: ns87303.h,v 1.2.2.1 2000/01/09 18:29:33 ecd Exp $
  * ns87303.h: Configuration Register Description for the
  *            National Semiconductor PC87303 (SuperIO).
  *
@@ -45,7 +45,7 @@
 #define FCR_LDE		0x10	/* Logical Drive Exchange                    */
 #define FCR_ZWS_ENA	0x20	/* Enable short host read/write in ECP/EPP   */
 
-/* Printer Controll Register (PCR) bits */
+/* Printer Control Register (PCR) bits */
 #define PCR_EPP_ENABLE	0x01
 #define PCR_EPP_IEEE	0x02	/* Enable EPP Version 1.9 (IEEE 1284)        */
 #define PCR_ECP_ENABLE	0x04
@@ -61,27 +61,51 @@
 #define ASC_LPT_IRQ7	0x01	/* Allways use IRQ7 for LPT                  */
 #define ASC_DRV2_SEL	0x02	/* Logical Drive Exchange controlled by TDR  */
 
+#define FER_RESERVED	0x00
+#define FAR_RESERVED	0x00
+#define PTR_RESERVED	0x73
+#define FCR_RESERVED	0xc4
+#define PCR_RESERVED	0x10
+#define KRR_RESERVED	0x00
+#define PMC_RESERVED	0x98
+#define TUP_RESERVED	0xfb
+#define SIP_RESERVED	0x00
+#define ASC_RESERVED	0x18
+#define CS0CF0_RESERVED	0x00
+#define CS0CF1_RESERVED	0x08
+#define CS1CF0_RESERVED	0x00
+#define CS1CF1_RESERVED	0x08
+
 #ifdef __KERNEL__
 
 #include <asm/system.h>
 #include <asm/io.h>
 
-static __inline__ void ns87303_writeb(unsigned long port, int index,
-				     unsigned char value)
+static __inline__ int ns87303_modify(unsigned long port, unsigned int index,
+				     unsigned char clr, unsigned char set)
 {
+	static unsigned char reserved[] = {
+		FER_RESERVED, FAR_RESERVED, PTR_RESERVED, FCR_RESERVED,
+		PCR_RESERVED, KRR_RESERVED, PMC_RESERVED, TUP_RESERVED,
+		SIP_RESERVED, ASC_RESERVED, CS0CF0_RESERVED, CS0CF1_RESERVED,
+		CS1CF0_RESERVED, CS1CF1_RESERVED
+	};
 	unsigned long flags;
+	unsigned char value;
+
+	if (index > 0x0d)
+		return -EINVAL;
 
 	save_flags(flags); cli();
 	outb(index, port);
+	value = inb(port + 1);
+	value &= ~(reserved[index] | clr);
+	value |= set;
 	outb(value, port + 1);
 	outb(value, port + 1);
 	restore_flags(flags);
-}
 
-static __inline__ unsigned char ns87303_readb(unsigned long port, int index)
-{
-	outb(index, port);
-	return inb(port + 1);
+	return 0;
 }
 
 #endif /* __KERNEL__ */
Index: oldkernel/linux/include/math-emu/op-1.h
diff -u linux/include/math-emu/op-1.h:1.1.1.1 linux/include/math-emu/op-1.h:1.2
--- linux/include/math-emu/op-1.h:1.1.1.1	Wed May 31 12:33:49 2000
+++ linux/include/math-emu/op-1.h	Thu Jun  1 15:44:43 2000
@@ -199,25 +199,25 @@
 
 #define _FP_DIV_MEAT_1_udiv_norm(fs, R, X, Y)				\
   do {									\
-    _FP_W_TYPE _nh, _nl, _q, _r;					\
+    _FP_W_TYPE _nh, _nl, _q, _r, _y;					\
 									\
     /* Normalize Y -- i.e. make the most significant bit set.  */	\
-    Y##_f <<= _FP_WFRACXBITS_##fs - 1;					\
+    _y = Y##_f << _FP_WFRACXBITS_##fs;					\
 									\
     /* Shift X op correspondingly high, that is, up one full word.  */	\
-    if (X##_f <= Y##_f)							\
+    if (X##_f < Y##_f)							\
       {									\
+	R##_e--;							\
 	_nl = 0;							\
 	_nh = X##_f;							\
       }									\
     else								\
       {									\
-	R##_e++;							\
-	_nl = X##_f << (_FP_W_TYPE_SIZE-1);				\
+	_nl = X##_f << (_FP_W_TYPE_SIZE - 1);				\
 	_nh = X##_f >> 1;						\
       }									\
     									\
-    udiv_qrnnd(_q, _r, _nh, _nl, Y##_f);				\
+    udiv_qrnnd(_q, _r, _nh, _nl, _y);					\
     R##_f = _q | (_r != 0);						\
   } while (0)
 
