diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_apecs.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_apecs.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_apecs.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_apecs.c	2001-03-02 11:12:07.000000000 -0800
@@ -168,6 +168,7 @@
 	mcheck_expected(0) = 0;
 	mb();
 
+#if 1
 	/*
 	 * david.rusling@reo.mts.dec.com.  This code is needed for the
 	 * EB64+ as it does not generate a machine check (why I don't
@@ -193,6 +194,7 @@
 		wrmces(0x7);			/* reset machine check */
 		value = 0xffffffff;
 	}
+#endif
 
 	/* If Type1 access, must reset HAE #2 so normal IO space ops work.  */
 	if (type1) {
@@ -236,6 +238,7 @@
 	mcheck_expected(0) = 0;
 	mb();
 
+#if 1
 	/*
 	 * david.rusling@reo.mts.dec.com.  This code is needed for the
 	 * EB64+ as it does not generate a machine check (why I don't
@@ -259,6 +262,7 @@
 		mb();
 		wrmces(0x7);			/* reset machine check */
 	}
+#endif
 
 	/* If Type1 access, must reset HAE #2 so normal IO space ops work.  */
 	if (type1) {
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_cia.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_cia.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_cia.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_cia.c	2001-10-21 10:30:58.000000000 -0700
@@ -727,6 +727,7 @@
 		*(vip)CIA_IOC_PCI_W_DAC = alpha_mv.pci_dac_offset >> 32;
 	}
 
+	/* Prepare workaround for apparently broken tbia. */
 	cia_prepare_tbia_workaround();
 }
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_irongate.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_irongate.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_irongate.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_irongate.c	2001-09-13 15:21:32.000000000 -0700
@@ -513,10 +513,10 @@
 	gart_bus_addr = (unsigned long)IRONGATE0->bar0 &
 			PCI_BASE_ADDRESS_MEM_MASK; 
 
-	if (!gart_bus_addr) 
+	if (!gart_bus_addr) /* FIXME - there must be a better way!!! */
 		return addr + IRONGATE_MEM;
 
-	gart_aper_size = IRONGATE_DEFAULT_AGP_APER_SIZE; 
+	gart_aper_size = IRONGATE_DEFAULT_AGP_APER_SIZE; /* FIXME */
 
 	/* 
 	 * Check for within the AGP aperture...
@@ -538,7 +538,7 @@
 	mmio_regs = (u32 *)(((unsigned long)IRONGATE0->bar1 &
 			PCI_BASE_ADDRESS_MEM_MASK) + IRONGATE_MEM);
 
-	gatt_pages = (u32 *)(phys_to_virt(mmio_regs[1])); 
+	gatt_pages = (u32 *)(phys_to_virt(mmio_regs[1])); /* FIXME */
 
 	/*
 	 * Adjust the limits (mappings must be page aligned)
@@ -551,6 +551,21 @@
 	last = addr + size - 1;
 	size = PAGE_ALIGN(last) - addr;
 
+#if 0
+	printk("irongate_ioremap(0x%lx, 0x%lx)\n", addr, size);
+	printk("irongate_ioremap:  gart_bus_addr  0x%lx\n", gart_bus_addr);
+	printk("irongate_ioremap:  gart_aper_size 0x%lx\n", gart_aper_size);
+	printk("irongate_ioremap:  mmio_regs      %p\n", mmio_regs);
+	printk("irongate_ioremap:  gatt_pages     %p\n", gatt_pages);
+	
+	for(baddr = addr; baddr <= last; baddr += PAGE_SIZE)
+	{
+		cur_gatt = phys_to_virt(GET_GATT(baddr) & ~1);
+		pte = cur_gatt[GET_GATT_OFF(baddr)] & ~1;
+		printk("irongate_ioremap:  cur_gatt %p pte 0x%x\n",
+		       cur_gatt, pte);
+	}
+#endif
 
 	/*
 	 * Map it
@@ -576,6 +591,10 @@
 	flush_tlb_all();
 
 	vaddr = (unsigned long)area->addr + (addr & ~PAGE_MASK);
+#if 0
+	printk("irongate_ioremap(0x%lx, 0x%lx) returning 0x%lx\n",
+	       addr, size, vaddr);
+#endif
 	return vaddr;
 }
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_mcpcia.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_mcpcia.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_mcpcia.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_mcpcia.c	2001-10-12 15:35:53.000000000 -0700
@@ -636,6 +636,8 @@
 	switch (expected) {
 	case 0:
 	    {
+		/* FIXME: how do we figure out which hose the
+		   error was on?  */	
 		struct pci_controller *hose;
 		for (hose = hose_head; hose; hose = hose->next)
 			mcpcia_pci_clr_err(MCPCIA_HOSE2MID(hose->index));
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_polaris.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_polaris.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_polaris.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_polaris.c	2001-03-02 11:12:07.000000000 -0800
@@ -184,6 +184,9 @@
 	 * for now assume that the firmware has done the right thing
 	 * already.
 	 */
+#if 0
+	printk("polaris_init_arch(): trusting firmware for setup\n");
+#endif
 
 	/*
 	 * Create our single hose.
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_t2.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_t2.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_t2.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_t2.c	2001-03-02 11:12:07.000000000 -0800
@@ -136,6 +136,16 @@
 
 	DBG(("conf_read(addr=0x%lx, type1=%d)\n", addr, type1));
 
+#if 0
+	{
+	  unsigned long stat0;
+	  /* Reset status register to avoid losing errors.  */
+	  stat0 = *(vulp)T2_IOCSR;
+	  *(vulp)T2_IOCSR = stat0;
+	  mb();
+	  DBG(("conf_read: T2 IOCSR was 0x%x\n", stat0));
+	}
+#endif
 
 	/* If Type1 access, must set T2 CFG.  */
 	if (type1) {
@@ -186,6 +196,16 @@
 
 	__save_and_cli(flags);	/* avoid getting hit by machine check */
 
+#if 0
+	{
+	  unsigned long stat0;
+	  /* Reset status register to avoid losing errors.  */
+	  stat0 = *(vulp)T2_IOCSR;
+	  *(vulp)T2_IOCSR = stat0;
+	  mb();
+	  DBG(("conf_write: T2 ERR was 0x%x\n", stat0));
+	}
+#endif
 
 	/* If Type1 access, must set T2 CFG.  */
 	if (type1) {
@@ -312,8 +332,29 @@
 		mcheck_taken(i) = 0;
 	}
 
+#if 0
+	{
+	  /* Set up error reporting.  */
+	  unsigned long t2_err;
+
+	  t2_err = *(vulp)T2_IOCSR;
+	  t2_err |= (0x1 << 7);   /* master abort */
+	  *(vulp)T2_IOCSR = t2_err;
+	  mb();
+	}
+#endif
 
 	printk("t2_init: HBASE was 0x%lx\n", *(vulp)T2_HBASE);
+#if 0
+	printk("t2_init: WBASE1=0x%lx WMASK1=0x%lx TBASE1=0x%lx\n",
+	       *(vulp)T2_WBASE1,
+	       *(vulp)T2_WMASK1,
+	       *(vulp)T2_TBASE1);
+	printk("t2_init: WBASE2=0x%lx WMASK2=0x%lx TBASE2=0x%lx\n",
+	       *(vulp)T2_WBASE2,
+	       *(vulp)T2_WMASK2,
+	       *(vulp)T2_TBASE2);
+#endif
 
 	/*
 	 * Set up the PCI->physical memory translation windows.
@@ -335,6 +376,9 @@
 	*(vulp)T2_HAE_1 = 0; mb();
 	*(vulp)T2_HAE_2 = 0; mb();
 	*(vulp)T2_HAE_3 = 0; mb();
+#if 0
+	*(vulp)T2_HAE_4 = 0; mb(); /* do not touch this */
+#endif
 
 	/*
 	 * Create our single hose.
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_titan.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_titan.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_titan.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_titan.c	2001-10-21 10:30:58.000000000 -0700
@@ -395,6 +395,23 @@
 void __init
 titan_init_arch(void)
 {
+#if 0
+	printk("%s: titan_init_arch()\n", FN);
+	printk("%s: CChip registers:\n", FN);
+	printk("%s: CSR_CSC 0x%lx\n", FN, TITAN_cchip->csc.csr);
+	printk("%s: CSR_MTR 0x%lx\n", FN, TITAN_cchip->mtr.csr);
+	printk("%s: CSR_MISC 0x%lx\n", FN, TITAN_cchip->misc.csr);
+	printk("%s: CSR_DIM0 0x%lx\n", FN, TITAN_cchip->dim0.csr);
+	printk("%s: CSR_DIM1 0x%lx\n", FN, TITAN_cchip->dim1.csr);
+	printk("%s: CSR_DIR0 0x%lx\n", FN, TITAN_cchip->dir0.csr);
+	printk("%s: CSR_DIR1 0x%lx\n", FN, TITAN_cchip->dir1.csr);
+	printk("%s: CSR_DRIR 0x%lx\n", FN, TITAN_cchip->drir.csr);
+
+	printk("%s: DChip registers:\n", FN);
+	printk("%s: CSR_DSC 0x%lx\n", FN, TITAN_dchip->dsc.csr);
+	printk("%s: CSR_STR 0x%lx\n", FN, TITAN_dchip->str.csr);
+	printk("%s: CSR_DREV 0x%lx\n", FN, TITAN_dchip->drev.csr);
+#endif
 
 	boot_cpuid = __hard_smp_processor_id();
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_tsunami.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_tsunami.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_tsunami.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_tsunami.c	2001-10-21 10:30:58.000000000 -0700
@@ -398,6 +398,22 @@
 	       ? "succeeded" : "failed");
 #endif /* NXM_MACHINE_CHECKS_ON_TSUNAMI */
 
+#if 0
+	printk("%s: CChip registers:\n", FN);
+	printk("%s: CSR_CSC 0x%lx\n", FN, TSUNAMI_cchip->csc.csr);
+	printk("%s: CSR_MTR 0x%lx\n", FN, TSUNAMI_cchip.mtr.csr);
+	printk("%s: CSR_MISC 0x%lx\n", FN, TSUNAMI_cchip->misc.csr);
+	printk("%s: CSR_DIM0 0x%lx\n", FN, TSUNAMI_cchip->dim0.csr);
+	printk("%s: CSR_DIM1 0x%lx\n", FN, TSUNAMI_cchip->dim1.csr);
+	printk("%s: CSR_DIR0 0x%lx\n", FN, TSUNAMI_cchip->dir0.csr);
+	printk("%s: CSR_DIR1 0x%lx\n", FN, TSUNAMI_cchip->dir1.csr);
+	printk("%s: CSR_DRIR 0x%lx\n", FN, TSUNAMI_cchip->drir.csr);
+
+	printk("%s: DChip registers:\n");
+	printk("%s: CSR_DSC 0x%lx\n", FN, TSUNAMI_dchip->dsc.csr);
+	printk("%s: CSR_STR 0x%lx\n", FN, TSUNAMI_dchip->str.csr);
+	printk("%s: CSR_DREV 0x%lx\n", FN, TSUNAMI_dchip->drev.csr);
+#endif
 	/* With multiple PCI busses, we play with I/O as physical addrs.  */
 	ioport_resource.end = ~0UL;
 	iomem_resource.end = ~0UL;
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/core_wildfire.c linux-2.4.20-WRTstp/arch/alpha/kernel/core_wildfire.c
--- linux-2.4.20-WRT/arch/alpha/kernel/core_wildfire.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/core_wildfire.c	2001-03-02 11:12:07.000000000 -0800
@@ -191,6 +191,9 @@
 	int i;
 
 	temp = fast->qsd_whami.csr;
+#if 0
+	printk(KERN_ERR "fast QSD_WHAMI at base %p is 0x%lx\n", fast, temp);
+#endif
 
 	hard_qbb = (temp >> 8) & 7;
 	soft_qbb = (temp >> 4) & 7;
@@ -215,6 +218,9 @@
 	qsa = WILDFIRE_qsa(soft_qbb);
 
 	temp = qsa->qsa_qbb_id.csr;
+#if 0
+	printk(KERN_ERR "QSA_QBB_ID at base %p is 0x%lx\n", qsa, temp);
+#endif
 
 	if (temp & 0x40) /* Is there an HS? */
 		wildfire_hs_mask = 1;
@@ -224,6 +230,10 @@
 		temp = 0;
 		for (i = 0; i < 4; i++) {
 			temp |= gp->gpa_qbb_map[i].csr << (i * 8);
+#if 0
+			printk(KERN_ERR "GPA_QBB_MAP[%d] at base %p is 0x%lx\n",
+			       i, gp, temp);
+#endif
 		}
 
 		for (hard_qbb = 0; hard_qbb < WILDFIRE_MAX_QBB; hard_qbb++) {
@@ -242,20 +252,32 @@
 	    if (WILDFIRE_QBB_EXISTS(soft_qbb)) {
 	        qsd = WILDFIRE_qsd(soft_qbb);
 		temp = qsd->qsd_whami.csr;
+#if 0
+	printk(KERN_ERR "QSD_WHAMI at base %p is 0x%lx\n", qsd, temp);
+#endif
 		hard_qbb = (temp >> 8) & 7;
 		wildfire_hard_qbb_map[hard_qbb] = soft_qbb;
 		wildfire_soft_qbb_map[soft_qbb] = hard_qbb;
 
 		qsa = WILDFIRE_qsa(soft_qbb);
 		temp = qsa->qsa_qbb_pop[0].csr;
+#if 0
+	printk(KERN_ERR "QSA_QBB_POP_0 at base %p is 0x%lx\n", qsa, temp);
+#endif
 		wildfire_cpu_mask |= ((temp >> 0) & 0xf) << (soft_qbb << 2);
 		wildfire_mem_mask |= ((temp >> 4) & 0xf) << (soft_qbb << 2);
 
 		temp = qsa->qsa_qbb_pop[1].csr;
+#if 0
+	printk(KERN_ERR "QSA_QBB_POP_1 at base %p is 0x%lx\n", qsa, temp);
+#endif
 		wildfire_iop_mask |= (1 << soft_qbb);
 		wildfire_ior_mask |= ((temp >> 4) & 0xf) << (soft_qbb << 2);
 
 		temp = qsa->qsa_qbb_id.csr;
+#if 0
+	printk(KERN_ERR "QSA_QBB_ID at %p is 0x%lx\n", qsa, temp);
+#endif
 		if (temp & 0x20)
 		    wildfire_gp_mask |= (1 << soft_qbb);
 
@@ -310,6 +332,7 @@
 	mb();
 	mb();  /* magic */
 	draina();
+	/* FIXME: clear pci errors */
 	wrmces(0x7);
 	mb();
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/irq.c linux-2.4.20-WRTstp/arch/alpha/kernel/irq.c
--- linux-2.4.20-WRT/arch/alpha/kernel/irq.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/irq.c	2001-09-17 13:16:30.000000000 -0700
@@ -431,6 +431,7 @@
 	if (!handler)
 		return -EINVAL;
 
+#if 1
 	/*
 	 * Sanity-check: shared interrupts should REALLY pass in
 	 * a real dev-ID, otherwise we'll have trouble later trying
@@ -442,6 +443,7 @@
 		       "Bad boy: %s (at %p) called us without a dev_id!\n",
 		       devname, __builtin_return_address(0));
 	}
+#endif
 
 	action = (struct irqaction *)
 			kmalloc(sizeof(struct irqaction), GFP_KERNEL);
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/irq_smp.c linux-2.4.20-WRTstp/arch/alpha/kernel/irq_smp.c
--- linux-2.4.20-WRT/arch/alpha/kernel/irq_smp.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/irq_smp.c	2001-11-20 15:49:31.000000000 -0800
@@ -31,6 +31,10 @@
 static void
 show(char * str, void *where)
 {
+#if 0
+	int i;
+        unsigned long *stack;
+#endif
         int cpu = smp_processor_id();
 
         printk("\n%s, CPU %d: %p\n", str, cpu, where);
@@ -43,6 +47,16 @@
 	       spin_is_locked(&global_bh_lock) ? 1 : 0,
 	       local_bh_count(0),
 	       local_bh_count(1));
+#if 0
+        stack = (unsigned long *) &str;
+        for (i = 40; i ; i--) {
+		unsigned long x = *++stack;
+                if (x > (unsigned long) &init_task_union &&
+		    x < (unsigned long) &vsprintf) {
+			printk("<[%08lx]> ", x);
+                }
+        }
+#endif
 }
 
 static inline void
@@ -208,9 +222,29 @@
 void
 synchronize_irq(void)
 {
+#if 0
+	/* Joe's version.  */
+	int cpu = smp_processor_id();
+	int local_count;
+	int global_count;
+	int countdown = 1<<24;
+	void *where = __builtin_return_address(0);
+
+	mb();
+	do {
+		local_count = local_irq_count(cpu);
+		global_count = atomic_read(&global_irq_count);
+		if (DEBUG_SYNCHRONIZE_IRQ && (--countdown == 0)) {
+			printk("%d:%d/%d\n", cpu, local_count, global_count);
+			show("synchronize_irq", where);
+			break;
+		}
+	} while (global_count != local_count);
+#else
 	/* Jay's version.  */
 	if (irqs_running()) {
 		cli();
 		sti();
 	}
+#endif
 }
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/machvec_impl.h linux-2.4.20-WRTstp/arch/alpha/kernel/machvec_impl.h
--- linux-2.4.20-WRT/arch/alpha/kernel/machvec_impl.h	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/machvec_impl.h	2001-09-13 15:21:32.000000000 -0700
@@ -30,7 +30,7 @@
    seems like such a pain.  Define this to get things to compile.  */
 #define JENSEN_IACK_SC		1
 #define T2_IACK_SC		1
-#define WILDFIRE_IACK_SC	1 
+#define WILDFIRE_IACK_SC	1 /* FIXME */
 
 
 /*
@@ -142,6 +142,11 @@
 /* GCC actually has a syntax for defining aliases, but is under some
    delusion that you shouldn't be able to declare it extern somewhere
    else beforehand.  Fine.  We'll do it ourselves.  */
+#if 0
+#define ALIAS_MV(system) \
+  struct alpha_machine_vector alpha_mv __attribute__((alias(#system "_mv")));
+#else
 #define ALIAS_MV(system) \
   asm(".global alpha_mv\nalpha_mv = " #system "_mv");
+#endif
 #endif /* GENERIC */
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/osf_sys.c linux-2.4.20-WRTstp/arch/alpha/kernel/osf_sys.c
--- linux-2.4.20-WRT/arch/alpha/kernel/osf_sys.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/osf_sys.c	2005-11-08 06:23:46.000000000 -0800
@@ -73,6 +73,10 @@
 	mm = current->mm;
 	mm->end_code = bss_start + bss_len;
 	mm->brk = bss_start + bss_len;
+#if 0
+	printk("set_program_attributes(%lx %lx %lx %lx)\n",
+		text_start, text_len, bss_start, bss_len);
+#endif
 	unlock_kernel();
 	return 0;
 }
@@ -226,6 +230,11 @@
 	struct file *file = NULL;
 	unsigned long ret = -EBADF;
 
+#if 0
+	if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
+		printk("%s: unimplemented OSF mmap flags %04lx\n", 
+			current->comm, flags);
+#endif
 	if (!(flags & MAP_ANONYMOUS)) {
 		file = fget(fd);
 		if (!file)
@@ -685,6 +694,13 @@
 	return error;
 }
 
+/*
+ * The Linux kernel isn't good at returning values that look
+ * like negative longs (they are mistaken as error values).
+ * Until that is fixed, we need this little workaround for
+ * create_module() because it's one of the few system calls
+ * that return kernel addresses (which are negative).
+ */
 asmlinkage unsigned long alpha_create_module(char *module_name, unsigned long size,
 					  int a3, int a4, int a5, int a6,
 					     struct pt_regs regs)
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/pci.c linux-2.4.20-WRTstp/arch/alpha/kernel/pci.c
--- linux-2.4.20-WRT/arch/alpha/kernel/pci.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/pci.c	2005-11-08 06:24:34.000000000 -0800
@@ -287,6 +287,7 @@
 		printk(KERN_WARNING "PCI: dev %s type 64-bit\n", dev->name);
 	}
 
+	/* ??? FIXME -- record old value for shutdown.  */
 }
 
 void __init
@@ -294,6 +295,7 @@
 {
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 
+	/* ??? FIXME -- record old value for shutdown.  */
 }
 
 /* Most Alphas have straight-forward swizzling needs.  */
@@ -328,6 +330,8 @@
 	ranges->io_end -= hose->io_space->start;
 	ranges->mem_start -= hose->mem_space->start;
 	ranges->mem_end -= hose->mem_space->start;
+/* FIXME: On older alphas we could use dense memory space
+	  to access prefetchable resources. */
 	ranges->prefetch_start -= hose->mem_space->start;
 	ranges->prefetch_end -= hose->mem_space->start;
 }
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/process.c linux-2.4.20-WRTstp/arch/alpha/kernel/process.c
--- linux-2.4.20-WRT/arch/alpha/kernel/process.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/process.c	2001-09-30 12:26:08.000000000 -0700
@@ -78,6 +78,8 @@
 	current->counter = -100;
 
 	while (1) {
+		/* FIXME -- EV6 and LCA45 know how to power down
+		   the CPU.  */
 
 		/* Although we are an idle CPU, we do not want to 
 		   get into the scheduler unnecessarily.  */
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/setup.c linux-2.4.20-WRTstp/arch/alpha/kernel/setup.c
--- linux-2.4.20-WRT/arch/alpha/kernel/setup.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/setup.c	2005-11-08 06:23:46.000000000 -0800
@@ -608,6 +608,11 @@
 	/* Default root filesystem to sda2.  */
 	ROOT_DEV = to_kdev_t(0x0802);
 
+ 	/*
+	 * Check ASN in HWRPB for validity, report if bad.
+	 * FIXME: how was this failing?  Should we trust it instead,
+	 * and copy the value into alpha_mv.max_asn?
+ 	 */
 
  	if (hwrpb->max_asn != MAX_ASN) {
 		printk("Max ASN from HWRPB is bad (0x%lx)\n", hwrpb->max_asn);
@@ -1139,8 +1144,11 @@
 			     unsigned long event,
 			     void *ptr)
 {
+#if 1
+	/* FIXME FIXME FIXME */
 	/* If we are using SRM and serial console, just hard halt here. */
 	if (alpha_using_srm && srmcons_output)
 		__halt();
+#endif
         return NOTIFY_DONE;
 }
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/signal.c linux-2.4.20-WRTstp/arch/alpha/kernel/signal.c
--- linux-2.4.20-WRT/arch/alpha/kernel/signal.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/signal.c	2005-11-08 06:23:46.000000000 -0800
@@ -150,6 +150,7 @@
 	struct k_sigaction new_ka, old_ka;
 	int ret;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
@@ -198,6 +199,7 @@
 {
 	sigset_t oldset, set;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 	if (copy_from_user(&set, uset, sizeof(set)))
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/smc37c669.c linux-2.4.20-WRTstp/arch/alpha/kernel/smc37c669.c
--- linux-2.4.20-WRT/arch/alpha/kernel/smc37c669.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/smc37c669.c	2002-02-25 11:37:52.000000000 -0800
@@ -12,7 +12,11 @@
 #include <asm/io.h>
 #include <asm/segment.h>
 
+#if 0
+# define DBG_DEVS(args)         printk args
+#else
 # define DBG_DEVS(args)
+#endif
 
 #define KB              1024
 #define MB              (1024*KB)
@@ -929,6 +933,18 @@
  *
  *--
  */
+#if 0
+/* $INCLUDE_OPTIONS$ */
+#include    "cp$inc:platform_io.h"
+/* $INCLUDE_OPTIONS_END$ */
+#include    "cp$src:common.h"
+#include    "cp$inc:prototypes.h"
+#include    "cp$src:kernel_def.h"
+#include    "cp$src:msg_def.h"
+#include    "cp$src:smcc669_def.h"
+/* Platform-specific includes */
+#include    "cp$src:platform.h"
+#endif
 
 #ifndef TRUE
 #define TRUE 1
@@ -1051,6 +1067,14 @@
     unsigned int func 
 );
 
+#if 0
+static unsigned int SMC37c669_get_device_config( 
+    unsigned int func, 
+    int *port, 
+    int *irq, 
+    int *drq 
+);
+#endif
 
 static void SMC37c669_config_mode( 
     unsigned int enable 
@@ -1079,6 +1103,62 @@
     unsigned int drq 
 );
 
+#if 0
+/*
+** External Data Declarations
+*/
+
+extern struct LOCK spl_atomic;
+
+/*
+** External Function Prototype Declarations
+*/
+
+/* From kernel_alpha.mar */
+extern spinlock( 
+    struct LOCK *spl 
+);
+
+extern spinunlock( 
+    struct LOCK *spl 
+);
+
+/* From filesys.c */
+int allocinode(
+    char *name, 
+    int can_create, 
+    struct INODE **ipp
+);
+
+extern int null_procedure( void );
+
+int smcc669_init( void );
+int smcc669_open( struct FILE *fp, char *info, char *next, char *mode );
+int smcc669_read( struct FILE *fp, int size, int number, unsigned char *buf );
+int smcc669_write( struct FILE *fp, int size, int number, unsigned char *buf );
+int smcc669_close( struct FILE *fp );
+
+struct DDB smc_ddb = {
+	"smc",			/* how this routine wants to be called	*/
+	smcc669_read,		/* read routine				*/
+	smcc669_write,		/* write routine			*/
+	smcc669_open,		/* open routine				*/
+	smcc669_close,		/* close routine			*/
+	null_procedure,		/* name expansion routine		*/
+	null_procedure,		/* delete routine			*/
+	null_procedure,		/* create routine			*/
+	null_procedure,		/* setmode				*/
+	null_procedure,		/* validation routine			*/
+	0,			/* class specific use			*/
+	1,			/* allows information			*/
+	0,			/* must be stacked			*/
+	0,			/* is a flash update driver		*/
+	0,			/* is a block device			*/
+	0,			/* not seekable				*/
+	0,			/* is an Ethernet device		*/
+	0,			/* is a filesystem driver		*/
+};
+#endif
 
 #define spinlock(x)
 #define spinunlock(x)
@@ -1780,6 +1860,76 @@
 }
 
 
+#if 0
+/*
+**++
+**  FUNCTIONAL DESCRIPTION:
+**
+**      This function retrieves the configuration information of a 
+**	device function within the SMC37c699 Super I/O controller.
+**
+**  FORMAL PARAMETERS:
+**
+**      func:
+**          Which device function
+**       
+**      port:
+**          I/O port returned
+**	 
+**      irq:
+**          IRQ returned
+**	 
+**      drq:
+**          DMA channel returned
+**
+**  RETURN VALUE:
+**
+**      Returns TRUE if the device configuration was successfully
+**	retrieved, otherwise, FALSE.
+**
+**  SIDE EFFECTS:
+**
+**      The data pointed to by the port, irq, and drq parameters
+**	my be modified even if the configuration is not successfully
+**	retrieved.
+**
+**  DESIGN:
+**
+**      The device configuration is fetched from the local shadow
+**	copy.  Any unused parameters will be set to -1.  Any
+**	parameter which is not desired can specify the NULL
+**	pointer.
+**
+**--
+*/
+static unsigned int __init SMC37c669_get_device_config (
+    unsigned int func,
+    int *port,
+    int *irq,
+    int *drq )
+{
+    struct DEVICE_CONFIG *cp;
+    unsigned int ret_val = FALSE;
+/*
+** Check for a valid device configuration
+*/
+    if ( ( cp = SMC37c669_get_config( func ) ) != NULL ) {
+    	if ( drq != NULL ) {
+	    *drq = cp->drq;
+	    ret_val = TRUE;
+	}
+	if ( irq != NULL ) {
+	    *irq = cp->irq;
+	    ret_val = TRUE;
+	}
+	if ( port != NULL ) {
+	    *port = cp->port1;
+	    ret_val = TRUE;
+	}
+    }
+    return ret_val;
+}
+#endif
 
 
 /*
@@ -2249,6 +2399,111 @@
     return translated_drq;
 }
 
+#if 0
+int __init smcc669_init ( void )
+{
+    struct INODE *ip;
+
+    allocinode( smc_ddb.name, 1, &ip );
+    ip->dva = &smc_ddb;
+    ip->attr = ATTR$M_WRITE | ATTR$M_READ;
+    ip->len[0] = 0x30;
+    ip->misc = 0;
+    INODE_UNLOCK( ip );
+
+    return msg_success;
+}
+
+int __init smcc669_open( struct FILE *fp, char *info, char *next, char *mode )
+{
+    struct INODE *ip;
+/*
+** Allow multiple readers but only one writer.  ip->misc keeps track
+** of the number of writers
+*/
+    ip = fp->ip;
+    INODE_LOCK( ip );
+    if ( fp->mode & ATTR$M_WRITE ) {
+	if ( ip->misc ) {
+	    INODE_UNLOCK( ip );
+	    return msg_failure;	    /* too many writers */
+	}
+	ip->misc++;
+    }
+/*
+** Treat the information field as a byte offset
+*/
+    *fp->offset = xtoi( info );
+    INODE_UNLOCK( ip );
+
+    return msg_success;
+}
+
+int __init smcc669_close( struct FILE *fp )
+{
+    struct INODE *ip;
+
+    ip = fp->ip;
+    if ( fp->mode & ATTR$M_WRITE ) {
+	INODE_LOCK( ip );
+	ip->misc--;
+	INODE_UNLOCK( ip );
+    }
+    return msg_success;
+}
+
+int __init smcc669_read( struct FILE *fp, int size, int number, unsigned char *buf )
+{
+    int i;
+    int length;
+    int nbytes;
+    struct INODE *ip;
+
+/*
+** Always access a byte at a time
+*/
+    ip = fp->ip;
+    length = size * number;
+    nbytes = 0;
+
+    SMC37c669_config_mode( TRUE );
+    for ( i = 0; i < length; i++ ) {
+	if ( !inrange( *fp->offset, 0, ip->len[0] ) ) 
+	    break;
+	*buf++ = SMC37c669_read_config( *fp->offset );
+	*fp->offset += 1;
+	nbytes++;
+    }
+    SMC37c669_config_mode( FALSE );
+    return nbytes;
+}
+
+int __init smcc669_write( struct FILE *fp, int size, int number, unsigned char *buf )
+{
+    int i;
+    int length;
+    int nbytes;
+    struct INODE *ip;
+/*
+** Always access a byte at a time
+*/
+    ip = fp->ip;
+    length = size * number;
+    nbytes = 0;
+
+    SMC37c669_config_mode( TRUE );
+    for ( i = 0; i < length; i++ ) {
+	if ( !inrange( *fp->offset, 0, ip->len[0] ) ) 
+	    break;
+	SMC37c669_write_config( *fp->offset, *buf );
+	*fp->offset += 1;
+	buf++;
+	nbytes++;
+    }
+    SMC37c669_config_mode( FALSE );
+    return nbytes;
+}
+#endif
 
 void __init
 SMC37c669_dump_registers(void)
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/smp.c linux-2.4.20-WRTstp/arch/alpha/kernel/smp.c
--- linux-2.4.20-WRT/arch/alpha/kernel/smp.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/smp.c	2005-11-08 06:23:46.000000000 -0800
@@ -268,11 +268,19 @@
 
 	freq = hwrpb->cycle_freq ? : est_cycle_freq;
 
+#if 0
+	/* Magic estimation stolen from x86 port.  */
+	cacheflush_time = freq / 1024L * on_chip_cache / 5000L;
+
+        printk("Using heuristic of %d cycles.\n",
+               cacheflush_time);
+#else
 	/* Magic value to force potential preemption of other CPUs.  */
 	cacheflush_time = INT_MAX;
 
         printk("Using heuristic of %d cycles.\n",
                cacheflush_time);
+#endif
 }
 
 /*
@@ -420,6 +428,10 @@
 	hwpcb->flags = idle->thread.pal_flags;
 	hwpcb->res1 = hwpcb->res2 = 0;
 
+#if 0
+	DBGS(("KSP 0x%lx PTBR 0x%lx VPTBR 0x%lx UNIQUE 0x%lx\n",
+	      hwpcb->ksp, hwpcb->ptbr, hwrpb->vptb, hwpcb->unique));
+#endif
 	DBGS(("Starting secondary cpu %d: state 0x%lx pal_flags 0x%lx\n",
 	      cpuid, idle->state, idle->thread.pal_flags));
 
@@ -781,6 +793,10 @@
 	unsigned long *pending_ipis = &ipi_data[this_cpu].bits;
 	unsigned long ops;
 
+#if 0
+	DBGS(("handle_ipi: on CPU %d ops 0x%lx PC 0x%lx\n",
+	      this_cpu, *pending_ipis, regs->pc));
+#endif
 
 	mb();	/* Order interrupt and bit testing. */
 	while ((ops = xchg(pending_ipis, 0)) != 0) {
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_dp264.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_dp264.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_dp264.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_dp264.c	2001-10-12 15:35:53.000000000 -0700
@@ -220,7 +220,32 @@
 static void
 dp264_device_interrupt(unsigned long vector, struct pt_regs * regs)
 {
+#if 1
 	printk("dp264_device_interrupt: NOT IMPLEMENTED YET!! \n");
+#else
+	unsigned long pld;
+	unsigned int i;
+
+	/* Read the interrupt summary register of TSUNAMI */
+	pld = TSUNAMI_cchip->dir0.csr;
+
+	/*
+	 * Now for every possible bit set, work through them and call
+	 * the appropriate interrupt handler.
+	 */
+	while (pld) {
+		i = ffz(~pld);
+		pld &= pld - 1; /* clear least bit set */
+		if (i == 55)
+			isa_device_interrupt(vector, regs);
+		else
+			handle_irq(16 + i, 16 + i, regs);
+#if 0
+		TSUNAMI_cchip->dir0.csr = 1UL << i; mb();
+		tmp = TSUNAMI_cchip->dir0.csr;
+#endif
+	}
+#endif
 }
 
 static void 
@@ -414,8 +439,13 @@
 		{    47,    47,    47,    47,    47}, /* IdSel 6 SCSI PCI1 */
 		{    -1,    -1,    -1,    -1,    -1}, /* IdSel 7 ISA Bridge */
 		{    -1,    -1,    -1,    -1,    -1}, /* IdSel 8 P2P PCI1 */
+#if 1
 		{    28,    28,    29,    30,    31}, /* IdSel 14 slot 4 PCI2*/
 		{    24,    24,    25,    26,    27}, /* IdSel 15 slot 5 PCI2*/
+#else
+		{    -1,    -1,    -1,    -1,    -1}, /* IdSel 9 unused */
+		{    -1,    -1,    -1,    -1,    -1}, /* IdSel 10 unused */
+#endif
 		{    40,    40,    41,    42,    43}, /* IdSel 11 slot 1 PCI0*/
 		{    36,    36,    37,    38,    39}, /* IdSel 12 slot 2 PCI0*/
 		{    32,    32,    33,    34,    35}, /* IdSel 13 slot 3 PCI0*/
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_jensen.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_jensen.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_jensen.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_jensen.c	2001-09-13 15:21:32.000000000 -0700
@@ -175,6 +175,27 @@
 	    }
 	}
 
+#if 0
+        /* A useful bit of code to find out if an interrupt is going wild.  */
+        {
+          static unsigned int last_msg = 0, last_cc = 0;
+          static int last_irq = -1, count = 0;
+          unsigned int cc;
+
+          __asm __volatile("rpcc %0" : "=r"(cc));
+          ++count;
+#define JENSEN_CYCLES_PER_SEC	(150000000)
+          if (cc - last_msg > ((JENSEN_CYCLES_PER_SEC) * 3) ||
+	      irq != last_irq) {
+                printk(KERN_CRIT " irq %d count %d cc %u @ %lx\n",
+                       irq, count, cc-last_cc, regs->pc);
+                count = 0;
+                last_msg = cc;
+                last_irq = irq;
+          }
+          last_cc = cc;
+        }
+#endif
 
 	handle_irq(irq, regs);
 }
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_miata.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_miata.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_miata.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_miata.c	2002-02-25 11:37:52.000000000 -0800
@@ -64,6 +64,11 @@
 	if (alpha_using_srm)
 		alpha_mv.device_interrupt = miata_srm_device_interrupt;
 
+#if 0
+	/* These break on MiataGL so we'll try not to do it at all.  */
+	*(vulp)PYXIS_INT_HILO = 0x000000B2UL; mb();	/* ISA/NMI HI */
+	*(vulp)PYXIS_RT_COUNT = 0UL; mb();		/* clear count */
+#endif
 
 	init_i8259a_irqs();
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_nautilus.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_nautilus.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_nautilus.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_nautilus.c	2001-05-21 13:40:39.000000000 -0700
@@ -178,9 +178,15 @@
 
 /* Single bit ECC errors are categorized here.  */
 
+#if 0
+static const char *interr = "CPU internal error";
+static const char *slotb= "Slot-B error";
+static const char *membus= "Memory/EV6-bus error";
+#else
 static const char *interr = "";
 static const char *slotb = "";
 static const char *membus = "";
+#endif
 
 static void
 ev6_crd_interp(char *interp, struct el_common_EV6_mcheck * L)
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_ruffian.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_ruffian.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_ruffian.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_ruffian.c	2001-10-12 15:35:53.000000000 -0700
@@ -84,6 +84,12 @@
 static void
 ruffian_kill_arch (int mode)
 {
+#if 0
+	/* This only causes re-entry to ARCSBIOS */
+	/* Perhaps this works for other PYXIS as well?  */
+	*(vuip) PYXIS_RESET = 0x0000dead;
+	mb();
+#endif
 }
 
 /*
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_rx164.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_rx164.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_rx164.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_rx164.c	2000-10-27 10:55:01.000000000 -0700
@@ -163,6 +163,17 @@
 static int __init
 rx164_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
 {
+#if 0
+	static char irq_tab_pass1[6][5] __initdata = {
+	  /*INT   INTA  INTB  INTC   INTD */
+	  { 16+3, 16+3, 16+8, 16+13, 16+18},      /* IdSel 5,  slot 2 */
+	  { 16+5, 16+5, 16+10, 16+15, 16+20},     /* IdSel 6,  slot 0 */
+	  { 16+4, 16+4, 16+9, 16+14, 16+19},      /* IdSel 7,  slot 1 */
+	  { -1,     -1,    -1,    -1,   -1},      /* IdSel 8, PCI/ISA bridge */
+	  { 16+2, 16+2, 16+7, 16+12, 16+17},      /* IdSel 9,  slot 3 */
+	  { 16+1, 16+1, 16+6, 16+11, 16+16},      /* IdSel 10, slot 4 */
+	};
+#else
 	static char irq_tab[6][5] __initdata = {
 	  /*INT   INTA  INTB  INTC   INTD */
 	  { 16+0, 16+0, 16+6, 16+11, 16+16},      /* IdSel 5,  slot 0 */
@@ -172,6 +183,7 @@
 	  { 16+3, 16+3, 16+9, 16+14, 16+19},      /* IdSel 9,  slot 3 */
 	  { 16+4, 16+4, 16+10, 16+15, 16+5},      /* IdSel 10, PCI-PCI */
 	};
+#endif
 	const long min_idsel = 5, max_idsel = 10, irqs_per_slot = 5;
 
 	/* JRP - Need to figure out how to distinguish pass1 from pass2,
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_sio.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_sio.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_sio.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_sio.c	2001-06-20 11:10:27.000000000 -0700
@@ -232,15 +232,16 @@
 	/* Do not set *ANY* level triggers for AlphaBook1. */
 	sio_fixup_irq_levels(0);
 
-	outb(0x0f, 0x3ce); orig = inb(0x3cf);   
-	outb(0x0f, 0x3ce); outb(0x05, 0x3cf);   
-	outb(0x0b, 0x3ce); config = inb(0x3cf); 
+	/* Make sure that register PR1 indicates 1Mb mem */
+	outb(0x0f, 0x3ce); orig = inb(0x3cf);   /* read PR5  */
+	outb(0x0f, 0x3ce); outb(0x05, 0x3cf);   /* unlock PR0-4 */
+	outb(0x0b, 0x3ce); config = inb(0x3cf); /* read PR1 */
 	if ((config & 0xc0) != 0xc0) {
 		printk("AlphaBook1 VGA init: setting 1Mb memory\n");
 		config |= 0xc0;
-		outb(0x0b, 0x3ce); outb(config, 0x3cf); 
+		outb(0x0b, 0x3ce); outb(config, 0x3cf); /* write PR1 */
 	}
-	outb(0x0f, 0x3ce); outb(orig, 0x3cf); 
+	outb(0x0f, 0x3ce); outb(orig, 0x3cf); /* (re)lock PR0-4 */
 }
 
 
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/sys_wildfire.c linux-2.4.20-WRTstp/arch/alpha/kernel/sys_wildfire.c
--- linux-2.4.20-WRT/arch/alpha/kernel/sys_wildfire.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/sys_wildfire.c	2001-03-02 11:12:07.000000000 -0800
@@ -64,6 +64,32 @@
 static void __init
 wildfire_init_irq_hw(void)
 {
+#if 0
+	register wildfire_pca * pca = WILDFIRE_pca(0, 0);
+	volatile unsigned long * enable0, * enable1, * enable2, *enable3;
+	volatile unsigned long * target0, * target1, * target2, *target3;
+
+	enable0 = (unsigned long *) &pca->pca_int[0].enable;
+	enable1 = (unsigned long *) &pca->pca_int[1].enable;
+	enable2 = (unsigned long *) &pca->pca_int[2].enable;
+	enable3 = (unsigned long *) &pca->pca_int[3].enable;
+
+	target0 = (unsigned long *) &pca->pca_int[0].target;
+	target1 = (unsigned long *) &pca->pca_int[1].target;
+	target2 = (unsigned long *) &pca->pca_int[2].target;
+	target3 = (unsigned long *) &pca->pca_int[3].target;
+
+	*enable0 = *enable1 = *enable2 = *enable3 = 0;
+
+	*target0 = (1UL<<8) | WILDFIRE_QBB(0);
+	*target1 = *target2 = *target3 = 0;
+
+	mb();
+
+	*enable0; *enable1; *enable2; *enable3;
+	*target0; *target1; *target2; *target3;
+
+#else
 	int i;
 
 	doing_init_irq_hw = 1;
@@ -73,6 +99,7 @@
 		wildfire_update_irq_hw(i);
 
 	doing_init_irq_hw = 0;
+#endif
 }
 
 static void
@@ -121,6 +148,10 @@
 static void
 wildfire_end_irq(unsigned int irq)
 { 
+#if 0
+	if (!irq_desc[irq].action)
+		printk("got irq %d\n", irq);
+#endif
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
 		wildfire_enable_irq(irq);
 }
@@ -151,7 +182,17 @@
 	/* Only need the following for first PCI bus per PCA. */
 	io_bias = WILDFIRE_IO(qbbno, pcano<<1) - WILDFIRE_IO_BIAS;
 
-
+#if 0
+	outb(0, DMA1_RESET_REG + io_bias);
+	outb(0, DMA2_RESET_REG + io_bias);
+	outb(DMA_MODE_CASCADE, DMA2_MODE_REG + io_bias);
+	outb(0, DMA2_MASK_REG + io_bias);
+#endif
+
+#if 0
+	/* ??? Not sure how to do this, yet... */
+	init_i8259a_irqs(); /* ??? */
+#endif
 
 	for (i = 0; i < 16; ++i) {
 		if (i == 2)
@@ -175,8 +216,10 @@
 {
 	int qbbno, pcano;
 
+#if 1
 	wildfire_init_irq_hw();
 	init_i8259a_irqs();
+#endif
 
 	for (qbbno = 0; qbbno < WILDFIRE_MAX_QBB; qbbno++) {
 	  if (WILDFIRE_QBB_EXISTS(qbbno)) {
diff -ruN linux-2.4.20-WRT/arch/alpha/kernel/traps.c linux-2.4.20-WRTstp/arch/alpha/kernel/traps.c
--- linux-2.4.20-WRT/arch/alpha/kernel/traps.c	2003-07-04 01:10:59.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/kernel/traps.c	2005-11-08 06:24:34.000000000 -0800
@@ -80,8 +80,17 @@
 	printk("t11= %016lx  pv = %016lx  at = %016lx\n",
 	       regs->r25, regs->r27, regs->r28);
 	printk("gp = %016lx  sp = %p\n", regs->gp, regs+1);
+#if 0
+__halt();
+#endif
 }
 
+#if 0
+static char * ireg_name[] = {"v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6",
+			   "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6",
+			   "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9",
+			   "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero"};
+#endif
 
 static void
 dik_show_code(unsigned int *pc)
@@ -214,6 +223,10 @@
 		}
 	}
 
+#if 0
+	printk("%s: arithmetic trap at %016lx: %02lx %016lx\n",
+		current->comm, regs.pc, summary, write_mask);
+#endif
 	die_if_kernel("Arithmetic fault", &regs, 0, 0);
 	send_sig(SIGFPE, current, 1);
 }
@@ -985,6 +998,9 @@
 {
 	/* We only get here for OSF system calls, minus #112;
 	   the rest go to sys_ni_syscall.  */
+#if 0
+	printk("<sc %ld(%lx,%lx,%lx)>", regs.r0, a0, a1, a2);
+#endif
 	return -ENOSYS;
 }
 
diff -ruN linux-2.4.20-WRT/arch/alpha/lib/io.c linux-2.4.20-WRTstp/arch/alpha/lib/io.c
--- linux-2.4.20-WRT/arch/alpha/lib/io.c	2003-07-04 01:11:00.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/lib/io.c	2001-11-09 13:45:35.000000000 -0800
@@ -463,6 +463,7 @@
 {
 	/* Optimize co-aligned transfers.  Everything else gets handled
 	   a byte at a time. */
+	/* FIXME -- align FROM.  */
 
 	if (count >= 8 && (to & 7) == ((long)from & 7)) {
 		count -= 8;
@@ -579,6 +580,8 @@
 		if (! __is_ioaddr((unsigned long) d))
 			memcpy_fromio(d, s, count);
 		else {
+			/* FIXME: Should handle unaligned ops and
+			   operation widening.  */
 			count /= 2;
 			while (count--) {
 				u16 tmp = __raw_readw((unsigned long)(s++));
diff -ruN linux-2.4.20-WRT/arch/alpha/mm/fault.c linux-2.4.20-WRTstp/arch/alpha/mm/fault.c
--- linux-2.4.20-WRT/arch/alpha/mm/fault.c	2003-07-04 01:11:00.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/mm/fault.c	2005-11-08 06:24:34.000000000 -0800
@@ -181,6 +181,10 @@
 	if ((fixup = search_exception_table(regs->pc, regs->gp)) != 0) {
 		unsigned long newpc;
 		newpc = fixup_exception(dpf_reg, fixup, regs->pc);
+#if 0
+		printk("%s: Exception at [<%lx>] (%lx) handled successfully\n",
+		       current->comm, regs->pc, newpc);
+#endif
 		regs->pc = newpc;
 		return;
 	}
diff -ruN linux-2.4.20-WRT/arch/alpha/mm/numa.c linux-2.4.20-WRTstp/arch/alpha/mm/numa.c
--- linux-2.4.20-WRT/arch/alpha/mm/numa.c	2003-07-04 01:11:00.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/alpha/mm/numa.c	2005-11-08 06:23:46.000000000 -0800
@@ -390,6 +390,9 @@
 	       reservedpages << (PAGE_SHIFT-10),
 	       datasize >> 10,
 	       initsize >> 10);
+#if 0
+	mem_stress();
+#endif
 }
 
 void
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/arch.c linux-2.4.20-WRTstp/arch/arm/kernel/arch.c
--- linux-2.4.20-WRT/arch/arm/kernel/arch.c	2003-07-04 01:11:01.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/arch.c	2001-08-12 11:13:59.000000000 -0700
@@ -38,6 +38,12 @@
 	default:
 		break;
 	}
+#if 0
+	if (vram_size) {
+		desc->video_start = 0x02000000;
+		desc->video_end   = 0x02000000 + vram_size;
+	}
+#endif
 	return 0;
 }
 
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/dma-footbridge.c linux-2.4.20-WRTstp/arch/arm/kernel/dma-footbridge.c
--- linux-2.4.20-WRT/arch/arm/kernel/dma-footbridge.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/dma-footbridge.c	2000-09-18 15:15:24.000000000 -0700
@@ -20,9 +20,34 @@
 #include <asm/mach/dma.h>
 #include <asm/hardware/dec21285.h>
 
+#if 0
+static int fb_dma_request(dmach_t channel, dma_t *dma)
+{
+	return -EINVAL;
+}
+
+static void fb_dma_enable(dmach_t channel, dma_t *dma)
+{
+}
+
+static void fb_dma_disable(dmach_t channel, dma_t *dma)
+{
+}
+
+static struct dma_ops fb_dma_ops = {
+	type:		"fb",
+	request:	fb_dma_request,
+	enable:		fb_dma_enable,
+	disable:	fb_dma_disable,
+};
+#endif
 
 void __init arch_dma_init(dma_t *dma)
 {
+#if 0
+	dma[_DC21285_DMA(0)].d_ops = &fb_dma_ops;
+	dma[_DC21285_DMA(1)].d_ops = &fb_dma_ops;
+#endif
 #ifdef CONFIG_ISA_DMA
 	if (footbridge_cfn_mode())
 		isa_init_dma(dma + _ISA_DMA(0));
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/dma-rpc.c linux-2.4.20-WRTstp/arch/arm/kernel/dma-rpc.c
--- linux-2.4.20-WRT/arch/arm/kernel/dma-rpc.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/dma-rpc.c	2001-02-09 11:29:44.000000000 -0800
@@ -26,6 +26,18 @@
 #include <asm/mach/dma.h>
 #include <asm/hardware/iomd.h>
 
+#if 0
+typedef enum {
+	dma_size_8	= 1,
+	dma_size_16	= 2,
+	dma_size_32	= 4,
+	dma_size_128	= 16
+} dma_size_t;
+
+typedef struct {
+	dma_size_t	transfersize;
+} dma_t;
+#endif
 
 #define TRANSFER_SIZE	2
 
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/ecard.c linux-2.4.20-WRTstp/arch/arm/kernel/ecard.c
--- linux-2.4.20-WRT/arch/arm/kernel/ecard.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/ecard.c	2001-08-12 11:13:59.000000000 -0700
@@ -243,6 +243,17 @@
  */
 static void ecard_init_pgtables(struct mm_struct *mm)
 {
+	/* We want to set up the page tables for the following mapping:
+	 *  Virtual	Physical
+	 *  0x03000000	0x03000000
+	 *  0x03010000	unmapped
+	 *  0x03210000	0x03210000
+	 *  0x03400000	unmapped
+	 *  0x08000000	0x08000000
+	 *  0x10000000	unmapped
+	 *
+	 * FIXME: we don't follow this 100% yet.
+	 */
 	pgd_t *src_pgd, *dst_pgd;
 	unsigned int dst_addr = IO_START;
 
@@ -323,6 +334,12 @@
 	}
 }
 
+/*
+ * Wake the expansion card daemon to action our request.
+ *
+ * FIXME: The test here is not sufficient to detect if the
+ * kcardd is running.
+ */
 static void
 ecard_call(struct ecard_request *req)
 {
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/entry-armo.S linux-2.4.20-WRTstp/arch/arm/kernel/entry-armo.S
--- linux-2.4.20-WRT/arch/arm/kernel/entry-armo.S	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/entry-armo.S	2001-08-12 11:13:59.000000000 -0700
@@ -99,6 +99,16 @@
  * For entry-common.S
  */
 
+#if 0
+/*
+ * Uncomment these if you wish to get more debugging into about data aborts.
+ */
+#define FAULT_CODE_LDRSTRPOST	0x80
+#define FAULT_CODE_LDRSTRPRE	0x40
+#define FAULT_CODE_LDRSTRREG	0x20
+#define FAULT_CODE_LDMSTM	0x10
+#define FAULT_CODE_LDCSTC	0x08
+#endif
 #define FAULT_CODE_PREFETCH	0x04
 #define FAULT_CODE_WRITE	0x02
 #define FAULT_CODE_FORCECOW	0x01
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/entry-armv.S linux-2.4.20-WRTstp/arch/arm/kernel/entry-armv.S
--- linux-2.4.20-WRT/arch/arm/kernel/entry-armv.S	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/entry-armv.S	2005-11-08 06:23:46.000000000 -0800
@@ -434,6 +434,7 @@
 		.endm
 
 		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp
+/* FIXME: should not be using soo many LDRs here */
 		ldr	\irqnr, =IO_ADDRESS(INTEGRATOR_IC_BASE)
 		ldr	\irqstat, [\irqnr, #IRQ_STATUS]		@ get masked status
 		ldr	\irqnr, =IO_ADDRESS(INTEGRATOR_HDR_BASE)
@@ -524,7 +525,7 @@
 		.macro	irq_prio_table
 		.endm
 	
-#elif defined(CONFIG_ARCH_CAMELOT)
+#elif defined (CONFIG_ARCH_CAMELOT)
 #include <asm/arch/platform.h>
 #undef IRQ_MODE /* same name defined in asm/proc/ptrace.h */
 #include <asm/arch/int_ctrl00.h>
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/entry-common.S linux-2.4.20-WRTstp/arch/arm/kernel/entry-common.S
--- linux-2.4.20-WRT/arch/arm/kernel/entry-common.S	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/entry-common.S	2002-02-25 11:37:52.000000000 -0800
@@ -14,7 +14,7 @@
  * We rely on the fact that R0 is at the bottom of the stack (due to
  * slow/fast restore user regs).
  */
-#if S_R0
+#if S_R0 != 0
 #error "Please fix"
 #endif
 
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/head-armv.S linux-2.4.20-WRTstp/arch/arm/kernel/head-armv.S
--- linux-2.4.20-WRT/arch/arm/kernel/head-armv.S	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/head-armv.S	2001-10-11 09:04:57.000000000 -0700
@@ -120,6 +120,9 @@
 __entry:
 #endif
 #if defined(CONFIG_ARCH_L7200)
+/*
+ * FIXME - No bootloader, so manually set 'r1' with our architecture number.
+ */
 		mov	r1, #MACH_TYPE_L7200
 #endif
 
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/plx90x0.c linux-2.4.20-WRTstp/arch/arm/kernel/plx90x0.c
--- linux-2.4.20-WRT/arch/arm/kernel/plx90x0.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/plx90x0.c	2001-07-04 15:43:05.000000000 -0700
@@ -133,6 +133,13 @@
 	/* Have a sniff around and see which PLX device is present. */
 	unsigned long id = __raw_readl(base + 0xf0);
 	
+#if 0
+	/* This check was a good idea, but can fail.  The PLX9060 puts no
+	   default value in these registers unless NB# is asserted (which it
+	   isn't on these cards).  */
+	if ((id & 0xffff) != PCI_VENDOR_ID_PLX)
+		return;		/* Nothing found */
+#endif
 
 	/* Found one - now work out what it is. */
 	switch (id >> 16) {
diff -ruN linux-2.4.20-WRT/arch/arm/kernel/signal.c linux-2.4.20-WRTstp/arch/arm/kernel/signal.c
--- linux-2.4.20-WRT/arch/arm/kernel/signal.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/kernel/signal.c	2005-11-08 06:23:46.000000000 -0800
@@ -115,6 +115,7 @@
 {
 	sigset_t saveset, newset;
 
+	/* XXX: Don't preclude handling different sized sigset_t's. */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
diff -ruN linux-2.4.20-WRT/arch/arm/lib/csumpartialcopyuser.S linux-2.4.20-WRTstp/arch/arm/lib/csumpartialcopyuser.S
--- linux-2.4.20-WRT/arch/arm/lib/csumpartialcopyuser.S	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/lib/csumpartialcopyuser.S	2001-05-16 15:25:16.000000000 -0700
@@ -159,6 +159,12 @@
 
 #include "csumpartialcopygeneric.S"
 
+/*
+ * FIXME: minor buglet here
+ * We don't return the checksum for the data present in the buffer.  To do
+ * so properly, we would have to add in whatever registers were loaded before
+ * the fault, which, with the current asm above is not predictable.
+ */
 #if defined(CONFIG_CPU_32)
 		.section .fixup,"ax"
 #endif
diff -ruN linux-2.4.20-WRT/arch/arm/lib/longlong.h linux-2.4.20-WRTstp/arch/arm/lib/longlong.h
--- linux-2.4.20-WRT/arch/arm/lib/longlong.h	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/lib/longlong.h	2001-10-11 09:04:57.000000000 -0700
@@ -73,7 +73,7 @@
    If any of these macros are left undefined for a particular CPU,
    C macros are used.  */
 
-#if defined(__arm__)
+#if defined (__arm__)
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   __asm__ ("adds	%1, %4, %5
 	adc	%0, %2, %3"						\
diff -ruN linux-2.4.20-WRT/arch/arm/mach-clps711x/mm.c linux-2.4.20-WRTstp/arch/arm/mach-clps711x/mm.c
--- linux-2.4.20-WRT/arch/arm/mach-clps711x/mm.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-clps711x/mm.c	2005-11-08 06:23:46.000000000 -0800
@@ -31,6 +31,30 @@
 #include <asm/mach/map.h>
 #include <asm/hardware/clps7111.h>
 
+#if 0 //def CONFIG_DISCONTIGMEM
+  
+/*
+ * The assumption of maximum 4 discontiguous memory banks is present
+ * in several places in the ARM kernel, including the parameter block
+ * (this affects boot loaders, too).  Banks do not necessarily
+ * correspond 1:1 with NUMA nodes, although they usually will,
+ * especially if they are widely discontiguous.
+ *
+ *  - note that the parameter block is depreciated for new implementations
+ *  - also note that discontig_node_data is actually used
+ *    -- rmk 
+ */
+
+static bootmem_data_t node_bootmem_data[4];
+
+pg_data_t clps711x_node_data[4] = {
+        { bdata: &node_bootmem_data[0] },
+        { bdata: &node_bootmem_data[1] },
+        { bdata: &node_bootmem_data[2] },
+        { bdata: &node_bootmem_data[3] },
+};
+
+#endif
 
 /*
  * This maps the generic CLPS711x registers
diff -ruN linux-2.4.20-WRT/arch/arm/mach-integrator/cpu.c linux-2.4.20-WRTstp/arch/arm/mach-integrator/cpu.c
--- linux-2.4.20-WRT/arch/arm/mach-integrator/cpu.c	2003-10-14 01:07:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-integrator/cpu.c	2005-11-08 06:24:34.000000000 -0800
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2001 Deep Blue Solutions Ltd.
  *
- *  $Id: cpu.c,v 1.1.1.4 2003/10/14 08:07:14 sparq Exp $
+ *  $Id: cpu.c,v 1.2 2001/09/22 12:11:17 rmk Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
diff -ruN linux-2.4.20-WRT/arch/arm/mach-integrator/pci_v3.c linux-2.4.20-WRTstp/arch/arm/mach-integrator/pci_v3.c
--- linux-2.4.20-WRT/arch/arm/mach-integrator/pci_v3.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-integrator/pci_v3.c	2005-11-08 06:23:46.000000000 -0800
@@ -451,6 +451,15 @@
 {
 	unsigned long pc = instruction_pointer(regs);
 	unsigned long instr = *(unsigned long *)pc;
+#if 0
+	char buf[128];
+
+	sprintf(buf, "V3 fault: address=0x%08lx, pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x ISTAT=%02x\n",
+		addr, pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255,
+		v3_readb(V3_LB_ISTAT));
+	printk(KERN_DEBUG "%s", buf);
+	printascii(buf);
+#endif
 
 	v3_writeb(V3_LB_ISTAT, 0);
 	__raw_writel(3, SC_PCI);
@@ -617,4 +626,10 @@
 	v3_writeb(V3_LB_ISTAT, ~0x40);
 	v3_writeb(V3_LB_IMASK, 0x68);
 
+#if 0
+	ret = request_irq(IRQ_LBUSTIMEOUT, lb_timeout, 0, "bus timeout", NULL);
+	if (ret)
+		printk(KERN_ERR "PCI: unable to grab local bus timeout ".
+		       "interrupt: %d\n", ret);
+#endif
 }
diff -ruN linux-2.4.20-WRT/arch/arm/mach-mx1ads/arch.c linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/arch.c
--- linux-2.4.20-WRT/arch/arm/mach-mx1ads/arch.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/arch.c	2005-11-08 06:23:46.000000000 -0800
@@ -54,3 +54,6 @@
 	INITIRQ(mx1ads_init_irq)
 MACHINE_END
 
+#if 0
+
+#endif
diff -ruN linux-2.4.20-WRT/arch/arm/mach-mx1ads/cpu.c linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/cpu.c
--- linux-2.4.20-WRT/arch/arm/mach-mx1ads/cpu.c	2003-10-14 01:07:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/cpu.c	2005-11-08 06:23:46.000000000 -0800
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2001 Deep Blue Solutions Ltd.
  *
- *  $Id: cpu.c,v 1.1.1.4 2003/10/14 08:07:15 sparq Exp $
+ *  $Id: cpu.c,v 1.2 2001/09/22 12:11:17 rmk Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -12,6 +12,10 @@
  * CPU support functions
  */
 
+/*  FIXME-
+ *  Add support for clock change on the fly.  (Power)
+ *
+ */
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
diff -ruN linux-2.4.20-WRT/arch/arm/mach-mx1ads/irq.c linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/irq.c
--- linux-2.4.20-WRT/arch/arm/mach-mx1ads/irq.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/irq.c	2005-11-08 06:23:46.000000000 -0800
@@ -26,6 +26,15 @@
 
 #include <asm/mach/irq.h>
 
+/*
+ *
+ * We simply use the ENABLE DISABLE registers inside of the MX1
+ * to turn on/off specific interrupts.  FIXME- We should
+ * also add support for the accelerated interrupt controller
+ * by putting offets to irq jump code in the appropriate
+ * places.
+ *
+ */
 
 #define INTENNUM_OFF              0x8
 #define INTDISNUM_OFF             0xC
diff -ruN linux-2.4.20-WRT/arch/arm/mach-mx1ads/time.c linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/time.c
--- linux-2.4.20-WRT/arch/arm/mach-mx1ads/time.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-mx1ads/time.c	2005-11-08 06:23:46.000000000 -0800
@@ -18,6 +18,15 @@
 
 extern int (*set_rtc)(void);
 
+/* FIXME-
+ * When we have an external RTC part,
+ * put the mapping in for that part.
+ *
+ * The internal RTC within the MX1 is not sufficient
+ * for tracking time other than time of day, or
+ * date over very short periods of time.
+ *
+ */
 
 static int mx1ads_set_rtc(void)
 {
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/cpu-sa1110.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/cpu-sa1110.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/cpu-sa1110.c	2003-10-14 01:07:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/cpu-sa1110.c	2005-11-08 06:23:46.000000000 -0800
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2001 Russell King
  *
- *  $Id: cpu-sa1110.c,v 1.1.1.4 2003/10/14 08:07:15 sparq Exp $
+ *  $Id: cpu-sa1110.c,v 1.6 2001/10/22 11:53:47 rmk Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -165,6 +165,14 @@
 	(void) MDREFR;
 }
 
+/*
+ * Update the refresh period.  We do this such that we always refresh
+ * the SDRAMs within their permissible period.  The refresh period is
+ * always a multiple of the memory clock (fixed at cpu_clock / 2).
+ *
+ * FIXME: we don't currently take account of burst accesses here,
+ * but neither do Intels DM nor Angel.
+ */
 static void
 sdram_update_refresh(u_int cpu_khz, struct sdram_params *sdram)
 {
@@ -194,6 +202,22 @@
 	ppcr = sa11x0_freq_to_ppcr(khz);
 	sdram_calculate_timing(&sd, khz, sdram);
 
+#if 0
+	/*
+	 * These values are wrong according to the SA1110 documentation
+	 * and errata, but they seem to work.  Need to get a storage
+	 * scope on to the SDRAM signals to work out why.
+	 */
+	if (khz < 147500) {
+		sd.mdrefr |= MDREFR_K1DB2;
+		sd.mdcas[0] = 0xaaaaaa7f;
+	} else {
+		sd.mdrefr &= ~MDREFR_K1DB2;
+		sd.mdcas[0] = 0xaaaaaa9f;
+	}
+	sd.mdcas[1] = 0xaaaaaaaa;
+	sd.mdcas[2] = 0xaaaaaaaa;
+#endif
 	/*
 	 * The clock could be going away for some time.  Set the SDRAMs
 	 * to refresh rapidly (every 64 memory clock cycles).  To get
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/dma-sa1111.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/dma-sa1111.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/dma-sa1111.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/dma-sa1111.c	2005-11-08 06:23:46.000000000 -0800
@@ -241,6 +241,7 @@
 }
 
 
+/* FIXME:  need to complete the three following functions */
 
 int sa1111_dma_get_current(dmach_t channel, void **buf_id, dma_addr_t *addr)
 {
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/leds-system3.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/leds-system3.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/leds-system3.c	2003-10-14 01:07:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/leds-system3.c	2005-11-08 06:23:46.000000000 -0800
@@ -5,19 +5,13 @@
  *
  * Original (leds-footbridge.c) by Russell King
  *
- * $Id: leds-system3.c,v 1.1.1.4 2003/10/14 08:07:15 sparq Exp $
+ * $Id: leds-system3.c,v 1.1.6.1 2001/12/04 15:19:26 seletz Exp $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
  * $Log: leds-system3.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:15  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:19  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.1.6.1  2001/12/04 15:19:26  seletz
  * - merged from linux_2_4_13_ac5_rmk2
  *
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/neponset.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/neponset.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/neponset.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/neponset.c	2005-11-08 06:23:46.000000000 -0800
@@ -110,6 +110,7 @@
 	 * Neponset has SA1111 connected to CS4.  We know that after
 	 * reset the chip will be configured for variable latency IO.
 	 */
+	/* FIXME: setup MSC2 */
 
 	/*
 	 * Probe for a SA1111.
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/simpad.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/simpad.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/simpad.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/simpad.c	2005-11-08 06:23:46.000000000 -0800
@@ -44,7 +44,7 @@
 fixup_simpad(struct machine_desc *desc, struct param_struct *params,
 		   char **cmdline, struct meminfo *mi)
 {
-#ifdef CONFIG_SA1100_SIMPAD_DRAM_64MB     /* DRAM */
+#ifdef CONFIG_SA1100_SIMPAD_DRAM_64MB /* DRAM */
 	SET_BANK( 0, 0xc0000000, 64*1024*1024 );
 #else
 	SET_BANK( 0, 0xc0000000, 32*1024*1024 );
diff -ruN linux-2.4.20-WRT/arch/arm/mach-sa1100/system3.c linux-2.4.20-WRTstp/arch/arm/mach-sa1100/system3.c
--- linux-2.4.20-WRT/arch/arm/mach-sa1100/system3.c	2003-10-14 01:07:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mach-sa1100/system3.c	2005-11-08 06:23:46.000000000 -0800
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2001 Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de>
  *
- * $Id: system3.c,v 1.1.1.4 2003/10/14 08:07:15 sparq Exp $
+ * $Id: system3.c,v 1.1.6.1 2001/12/04 17:28:06 seletz Exp $
  *
  * This file contains all PT Sytsem 3 tweaks. Based on original work from
  * Nicolas Pitre's assabet fixes
@@ -13,12 +13,6 @@
  * published by the Free Software Foundation.
  *
  * $Log: system3.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:15  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:19  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.1.6.1  2001/12/04 17:28:06  seletz
  * - merged from previous branch
  *
@@ -164,6 +158,11 @@
 		if( irr & PT_IRQ_LAN )
 			do_IRQ(IRQ_SYSTEM3_SMC9196, regs);
 
+#if 0
+		/* Highspeed Serial Bus not yet used */
+		if( irr & PT_IRQ_USAR )
+			do_IRQ(PT_USAR_IRQ, regs);
+#endif
 
 		if( irr & PT_IRQ_SA1111 )
 			sa1111_IRQ_demux(irq, dev_id, regs);
@@ -185,6 +184,12 @@
 	irq_desc[irq].valid	= 1;
 	irq_desc[irq].probe_ok	= 1;
 
+#if 0
+	/* Highspeed Serial Bus not yet used */
+	irq = PT_USAR_IRQ;
+	irq_desc[irq].valid	= 1;
+	irq_desc[irq].probe_ok	= 1;
+#endif
 
 	/* IRQ by CPLD */
 	set_GPIO_IRQ_edge( GPIO_GPIO(25), GPIO_RISING_EDGE );
@@ -237,6 +242,13 @@
 	/* TODO: switch on/off uart in powersave mode */
 }
 
+/*
+ * Note! this can be called from IRQ context.
+ * FIXME: Handle PT Digital Board CTRL regs irq-safe.
+ *
+ * NB: system3 uses COM_RTS and COM_DTR for both UART1 (com port)
+ * and UART3 (radio module).  We only handle them for UART1 here.
+ */
 static void system3_set_mctrl(struct uart_port *port, u_int mctrl)
 {
 	if (port->mapbase == _Ser1UTCR0) {
@@ -335,7 +347,7 @@
 
 	system3_init_irq();
 
-#if defined(CONFIG_CPU_FREQ)
+#if defined( CONFIG_CPU_FREQ )
 	ret = cpufreq_register_notifier(&system3_clkchg_block);
 	if ( ret != 0 ) {
 		printk( KERN_WARNING"PT Digital Board: could not register clock scale callback\n" );
diff -ruN linux-2.4.20-WRT/arch/arm/mm/consistent.c linux-2.4.20-WRTstp/arch/arm/mm/consistent.c
--- linux-2.4.20-WRT/arch/arm/mm/consistent.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mm/consistent.c	2001-06-27 14:12:04.000000000 -0700
@@ -57,6 +57,14 @@
 	if (!ret)
 		goto no_remap;
 
+#if 0 /* ioremap_does_flush_cache_all */
+	/*
+	 * we need to ensure that there are no cachelines in use, or
+	 * worse dirty in this area.  Really, we don't need to do
+	 * this since __ioremap does a flush_cache_all() anyway. --rmk
+	 */
+	invalidate_dcache_range(virt, virt + size);
+#endif
 
 	/*
 	 * free wasted pages.  We skip the first page since we know
diff -ruN linux-2.4.20-WRT/arch/arm/mm/fault-armo.c linux-2.4.20-WRTstp/arch/arm/mm/fault-armo.c
--- linux-2.4.20-WRT/arch/arm/mm/fault-armo.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mm/fault-armo.c	2001-02-08 16:32:44.000000000 -0800
@@ -55,6 +55,12 @@
 asmlinkage int
 do_PrefetchAbort(unsigned long addr, struct pt_regs *regs)
 {
+#if 0
+	if (the memc mapping for this page exists) {
+		printk ("Page in, but got abort (undefined instruction?)\n");
+		return 0;
+	}
+#endif
 	do_page_fault(addr, FAULT_CODE_PREFETCH, regs);
 	return 1;
 }
diff -ruN linux-2.4.20-WRT/arch/arm/mm/fault-common.c linux-2.4.20-WRTstp/arch/arm/mm/fault-common.c
--- linux-2.4.20-WRT/arch/arm/mm/fault-common.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mm/fault-common.c	2005-11-08 06:24:34.000000000 -0800
@@ -351,6 +351,10 @@
 	if (pgd_none(*pgd_k))
 		goto bad_area;
 
+#if 0	/* note that we are two-level */
+	if (!pgd_present(*pgd))
+		set_pgd(pgd, *pgd_k);
+#endif
 
 	pmd_k = pmd_offset(pgd_k, addr);
 	pmd   = pmd_offset(pgd, addr);
diff -ruN linux-2.4.20-WRT/arch/arm/mm/init.c linux-2.4.20-WRTstp/arch/arm/mm/init.c
--- linux-2.4.20-WRT/arch/arm/mm/init.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mm/init.c	2001-10-11 09:04:57.000000000 -0700
@@ -167,6 +167,12 @@
 #define PFN_RANGE(s,e)	PFN_SIZE(PAGE_ALIGN((unsigned long)(e)) - \
 				(((unsigned long)(s)) & PAGE_MASK))
 
+/*
+ * FIXME: We really want to avoid allocating the bootmap bitmap
+ * over the top of the initrd.  Hopefully, this is located towards
+ * the start of a bank, so if we allocate the bootmap bitmap at
+ * the end, we won't clash.
+ */
 static unsigned int __init
 find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
 {
diff -ruN linux-2.4.20-WRT/arch/arm/mm/mm-armv.c linux-2.4.20-WRTstp/arch/arm/mm/mm-armv.c
--- linux-2.4.20-WRT/arch/arm/mm/mm-armv.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/mm/mm-armv.c	2005-11-08 06:23:46.000000000 -0800
@@ -113,6 +113,9 @@
 	memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
 		       (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
 
+	/*
+	 * FIXME: this should not be necessary
+	 */
 	clean_cache_area(new_pgd, PTRS_PER_PGD * sizeof(pgd_t));
 
 	return new_pgd;
@@ -421,6 +424,11 @@
 	unsigned long bank_start, prev_bank_end = 0;
 	unsigned int i;
 
+	/*
+	 * [FIXME] This relies on each bank being in address order.  This
+	 * may not be the case, especially if the user has provided the
+	 * information on the command line.
+	 */
 	for (i = 0; i < mi->nr_banks; i++) {
 		if (mi->bank[i].size == 0 || mi->bank[i].node != node)
 			continue;
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/ARM-gcc.h linux-2.4.20-WRTstp/arch/arm/nwfpe/ARM-gcc.h
--- linux-2.4.20-WRT/arch/arm/nwfpe/ARM-gcc.h	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/ARM-gcc.h	2005-11-08 06:23:46.000000000 -0800
@@ -105,5 +105,16 @@
 #define float64_le			___float64_le
 #define float64_lt			___float64_lt
 
+#if 0
+#define float64_add			__adddf3
+#define float64_sub			__subdf3
+#define float64_mul			__muldf3
+#define float64_div			__divdf3
+#define int32_to_float64		__floatsidf
+#define float64_to_int32_round_to_zero	__fixdfsi
+#define float64_to_uint32_round_to_zero	__fixunsdfsi
+#define float64_to_float32		__truncdfsf2
+#define float32_to_float64		__extendsfdf2
+#endif
 
 #endif
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/double_cpdo.c linux-2.4.20-WRTstp/arch/arm/nwfpe/double_cpdo.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/double_cpdo.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/double_cpdo.c	2005-11-08 06:23:46.000000000 -0800
@@ -122,11 +122,25 @@
          fpa11->fpreg[Fd].fDouble = float64_div(rFm,rFn);
       break;
 
+#if 0
+      case POW_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_pow(rFn,rFm);
+      break;
+
+      case RPW_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_pow(rFm,rFn);
+      break;
+#endif
 
       case RMF_CODE:
          fpa11->fpreg[Fd].fDouble = float64_rem(rFn,rFm);
       break;
 
+#if 0
+      case POL_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_pol(rFn,rFm);
+      break;
+#endif
 
       /* monadic opcodes */
       case MVF_CODE:
@@ -158,6 +172,43 @@
          fpa11->fpreg[Fd].fDouble = float64_sqrt(rFm);
       break;
 
+#if 0
+      case LOG_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_log(rFm);
+      break;
+
+      case LGN_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_ln(rFm);
+      break;
+
+      case EXP_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_exp(rFm);
+      break;
+
+      case SIN_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_sin(rFm);
+      break;
+
+      case COS_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_cos(rFm);
+      break;
+
+      case TAN_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_tan(rFm);
+      break;
+
+      case ASN_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_arcsin(rFm);
+      break;
+
+      case ACS_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_arccos(rFm);
+      break;
+
+      case ATN_CODE:
+         fpa11->fpreg[Fd].fDouble = float64_arctan(rFm);
+      break;
+#endif
 
       case NRM_CODE:
       break;
@@ -172,3 +223,66 @@
    return nRc;
 }
 
+#if 0
+float64 float64_exp(float64 rFm)
+{
+  return rFm;
+//series
+}
+
+float64 float64_ln(float64 rFm)
+{
+  return rFm;
+//series
+}
+
+float64 float64_sin(float64 rFm)
+{
+  return rFm;
+//series
+}
+
+float64 float64_cos(float64 rFm)
+{
+   return rFm;
+   //series
+}
+
+#if 0
+float64 float64_arcsin(float64 rFm)
+{
+//series
+}
+
+float64 float64_arctan(float64 rFm)
+{
+  //series
+}
+#endif
+
+float64 float64_log(float64 rFm)
+{
+  return float64_div(float64_ln(rFm),getDoubleConstant(7));
+}
+
+float64 float64_tan(float64 rFm)
+{
+  return float64_div(float64_sin(rFm),float64_cos(rFm));
+}
+
+float64 float64_arccos(float64 rFm)
+{
+return rFm;
+   //return float64_sub(halfPi,float64_arcsin(rFm));
+}
+
+float64 float64_pow(float64 rFn,float64 rFm)
+{
+  return float64_exp(float64_mul(rFm,float64_ln(rFn))); 
+}
+
+float64 float64_pol(float64 rFn,float64 rFm)
+{
+  return float64_arctan(float64_div(rFn,rFm)); 
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/extended_cpdo.c linux-2.4.20-WRTstp/arch/arm/nwfpe/extended_cpdo.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/extended_cpdo.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/extended_cpdo.c	2005-11-08 06:23:46.000000000 -0800
@@ -120,11 +120,25 @@
          fpa11->fpreg[Fd].fExtended = floatx80_div(rFm,rFn);
       break;
 
+#if 0
+      case POW_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_pow(rFn,rFm);
+      break;
+
+      case RPW_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_pow(rFm,rFn);
+      break;
+#endif
 
       case RMF_CODE:
          fpa11->fpreg[Fd].fExtended = floatx80_rem(rFn,rFm);
       break;
 
+#if 0
+      case POL_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_pol(rFn,rFm);
+      break;
+#endif
 
       /* monadic opcodes */
       case MVF_CODE:
@@ -150,6 +164,43 @@
          fpa11->fpreg[Fd].fExtended = floatx80_sqrt(rFm);
       break;
 
+#if 0
+      case LOG_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_log(rFm);
+      break;
+
+      case LGN_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_ln(rFm);
+      break;
+
+      case EXP_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_exp(rFm);
+      break;
+
+      case SIN_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_sin(rFm);
+      break;
+
+      case COS_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_cos(rFm);
+      break;
+
+      case TAN_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_tan(rFm);
+      break;
+
+      case ASN_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_arcsin(rFm);
+      break;
+
+      case ACS_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_arccos(rFm);
+      break;
+
+      case ATN_CODE:
+         fpa11->fpreg[Fd].fExtended = floatx80_arctan(rFm);
+      break;
+#endif
 
       case NRM_CODE:
       break;
@@ -164,3 +215,59 @@
    return nRc;
 }
 
+#if 0
+floatx80 floatx80_exp(floatx80 Fm)
+{
+//series
+}
+
+floatx80 floatx80_ln(floatx80 Fm)
+{
+//series
+}
+
+floatx80 floatx80_sin(floatx80 rFm)
+{
+//series
+}
+
+floatx80 floatx80_cos(floatx80 rFm)
+{
+//series
+}
+
+floatx80 floatx80_arcsin(floatx80 rFm)
+{
+//series
+}
+
+floatx80 floatx80_arctan(floatx80 rFm)
+{
+  //series
+}
+
+floatx80 floatx80_log(floatx80 rFm)
+{
+  return floatx80_div(floatx80_ln(rFm),getExtendedConstant(7));
+}
+
+floatx80 floatx80_tan(floatx80 rFm)
+{
+  return floatx80_div(floatx80_sin(rFm),floatx80_cos(rFm));
+}
+
+floatx80 floatx80_arccos(floatx80 rFm)
+{
+   //return floatx80_sub(halfPi,floatx80_arcsin(rFm));
+}
+
+floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm)
+{
+  return floatx80_exp(floatx80_mul(rFm,floatx80_ln(rFn))); 
+}
+
+floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm)
+{
+  return floatx80_arctan(floatx80_div(rFn,rFm)); 
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/fpa11.c linux-2.4.20-WRTstp/arch/arm/nwfpe/fpa11.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/fpa11.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/fpa11.c	2005-11-08 06:23:46.000000000 -0800
@@ -174,4 +174,42 @@
   return(nRc);
 }
 
+#if 0
+unsigned int EmulateAll1(unsigned int opcode)
+{
+  switch ((opcode >> 24) & 0xf)
+  {
+     case 0xc:
+     case 0xd:
+       if ((opcode >> 20) & 0x1)
+       {
+          switch ((opcode >> 8) & 0xf)
+          {
+             case 0x1: return PerformLDF(opcode); break;
+             case 0x2: return PerformLFM(opcode); break;
+             default: return 0;
+          }
+       }
+       else
+       {
+          switch ((opcode >> 8) & 0xf)
+          {
+             case 0x1: return PerformSTF(opcode); break;
+             case 0x2: return PerformSFM(opcode); break;
+             default: return 0;
+          }
+      }
+     break;
+     
+     case 0xe: 
+       if (opcode & 0x10)
+         return EmulateCPDO(opcode);
+       else
+         return EmulateCPRT(opcode);
+     break;
+  
+     default: return 0;
+  }
+}
+#endif
 
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/fpa11_cpdt.c linux-2.4.20-WRTstp/arch/arm/nwfpe/fpa11_cpdt.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/fpa11_cpdt.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/fpa11_cpdt.c	2005-11-08 06:23:46.000000000 -0800
@@ -325,6 +325,7 @@
    return 1;
 }
 
+#if 1
 unsigned int EmulateCPDT(const unsigned int opcode)
 {
   unsigned int nRc = 0;
@@ -354,3 +355,4 @@
   
   return nRc;
 }
+#endif
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/fpmodule.c linux-2.4.20-WRTstp/arch/arm/nwfpe/fpmodule.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/fpmodule.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/fpmodule.c	2005-11-08 06:23:46.000000000 -0800
@@ -27,11 +27,13 @@
 #include <linux/version.h>
 #include <linux/config.h>
 
+/* XXX */
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/init.h>
+/* XXX */
 
 #include "softfloat.h"
 #include "fpopcode.h"
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/single_cpdo.c linux-2.4.20-WRTstp/arch/arm/nwfpe/single_cpdo.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/single_cpdo.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/single_cpdo.c	2005-11-08 06:23:46.000000000 -0800
@@ -102,11 +102,25 @@
          fpa11->fpreg[Fd].fSingle = float32_div(rFm,rFn);
       break;
 
+#if 0
+      case POW_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_pow(rFn,rFm);
+      break;
+
+      case RPW_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_pow(rFm,rFn);
+      break;
+#endif
 
       case RMF_CODE:
          fpa11->fpreg[Fd].fSingle = float32_rem(rFn,rFm);
       break;
 
+#if 0
+      case POL_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_pol(rFn,rFm);
+      break;
+#endif
 
       /* monadic opcodes */
       case MVF_CODE:
@@ -132,6 +146,43 @@
          fpa11->fpreg[Fd].fSingle = float32_sqrt(rFm);
       break;
 
+#if 0
+      case LOG_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_log(rFm);
+      break;
+
+      case LGN_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_ln(rFm);
+      break;
+
+      case EXP_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_exp(rFm);
+      break;
+
+      case SIN_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_sin(rFm);
+      break;
+
+      case COS_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_cos(rFm);
+      break;
+
+      case TAN_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_tan(rFm);
+      break;
+
+      case ASN_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_arcsin(rFm);
+      break;
+
+      case ACS_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_arccos(rFm);
+      break;
+
+      case ATN_CODE:
+         fpa11->fpreg[Fd].fSingle = float32_arctan(rFm);
+      break;
+#endif
 
       case NRM_CODE:
       break;
@@ -146,3 +197,59 @@
    return nRc;
 }
 
+#if 0
+float32 float32_exp(float32 Fm)
+{
+//series
+}
+
+float32 float32_ln(float32 Fm)
+{
+//series
+}
+
+float32 float32_sin(float32 rFm)
+{
+//series
+}
+
+float32 float32_cos(float32 rFm)
+{
+//series
+}
+
+float32 float32_arcsin(float32 rFm)
+{
+//series
+}
+
+float32 float32_arctan(float32 rFm)
+{
+  //series
+}
+
+float32 float32_arccos(float32 rFm)
+{
+   //return float32_sub(halfPi,float32_arcsin(rFm));
+}
+
+float32 float32_log(float32 rFm)
+{
+  return float32_div(float32_ln(rFm),getSingleConstant(7));
+}
+
+float32 float32_tan(float32 rFm)
+{
+  return float32_div(float32_sin(rFm),float32_cos(rFm));
+}
+
+float32 float32_pow(float32 rFn,float32 rFm)
+{
+  return float32_exp(float32_mul(rFm,float32_ln(rFn))); 
+}
+
+float32 float32_pol(float32 rFn,float32 rFm)
+{
+  return float32_arctan(float32_div(rFn,rFm)); 
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/arm/nwfpe/softfloat.c linux-2.4.20-WRTstp/arch/arm/nwfpe/softfloat.c
--- linux-2.4.20-WRT/arch/arm/nwfpe/softfloat.c	2003-07-04 01:11:02.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/arm/nwfpe/softfloat.c	2005-11-08 06:23:46.000000000 -0800
@@ -182,7 +182,19 @@
 */
 INLINE float32 packFloat32( flag zSign, int16 zExp, bits32 zSig )
 {
+#if 0
+   float32 f;
+   __asm__("@ packFloat32;
+   	    mov %0, %1, asl #31;
+   	    orr %0, %2, asl #23;
+   	    orr %0, %3"
+   	    : /* no outputs */
+   	    : "g" (f), "g" (zSign), "g" (zExp), "g" (zSig)
+   	    : "cc");
+   return f;
+#else
     return ( ( (bits32) zSign )<<31 ) + ( ( (bits32) zExp )<<23 ) + zSig;
+#endif 
 }
 
 /*
diff -ruN linux-2.4.20-WRT/arch/cris/boot/compressed/misc.c linux-2.4.20-WRTstp/arch/cris/boot/compressed/misc.c
--- linux-2.4.20-WRT/arch/cris/boot/compressed/misc.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/boot/compressed/misc.c	2001-05-01 16:04:56.000000000 -0700
@@ -1,7 +1,7 @@
 /*
  * misc.c
  *
- * $Id: misc.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+ * $Id: misc.c,v 1.6 2001/04/09 10:00:21 starvik Exp $
  * 
  * This is a collection of several routines from gzip-1.0.3 
  * adapted for Linux.
diff -ruN linux-2.4.20-WRT/arch/cris/boot/compressed/README linux-2.4.20-WRTstp/arch/cris/boot/compressed/README
--- linux-2.4.20-WRT/arch/cris/boot/compressed/README	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/boot/compressed/README	2001-02-08 16:32:44.000000000 -0800
@@ -1,6 +1,6 @@
 Creation of the self-extracting compressed kernel image (vmlinuz)
 -----------------------------------------------------------------
-$Id: README,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+$Id: README,v 1.1 2000/11/22 17:20:46 bjornw Exp $
 
 This can be slightly confusing because it's a process with many steps.
 
diff -ruN linux-2.4.20-WRT/arch/cris/boot/rescue/head.S linux-2.4.20-WRTstp/arch/cris/boot/rescue/head.S
--- linux-2.4.20-WRT/arch/cris/boot/rescue/head.S	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/boot/rescue/head.S	2002-02-25 11:37:52.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: head.S,v 1.10 2001/11/08 15:10:16 starvik Exp $
  * 
  * Rescue code, made to reside at the beginning of the
  * flash-memory. when it starts, it checks a partition
diff -ruN linux-2.4.20-WRT/arch/cris/boot/rescue/kimagerescue.S linux-2.4.20-WRTstp/arch/cris/boot/rescue/kimagerescue.S
--- linux-2.4.20-WRT/arch/cris/boot/rescue/kimagerescue.S	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/boot/rescue/kimagerescue.S	2001-10-08 11:43:54.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: kimagerescue.S,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: kimagerescue.S,v 1.5 2001/10/03 17:15:15 bjornw Exp $
  * 
  * Rescue code to be prepended on a kimage and copied to the
  * rescue serial port.
diff -ruN linux-2.4.20-WRT/arch/cris/boot/rescue/testrescue.S linux-2.4.20-WRTstp/arch/cris/boot/rescue/testrescue.S
--- linux-2.4.20-WRT/arch/cris/boot/rescue/testrescue.S	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/boot/rescue/testrescue.S	2001-10-08 11:43:54.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: testrescue.S,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: testrescue.S,v 1.3 2001/10/03 17:15:15 bjornw Exp $
  *
  * Simple testcode to download by the rescue block.
  * Just lits some LEDs to show it was downloaded correctly.
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/axisflashmap.c linux-2.4.20-WRTstp/arch/cris/drivers/axisflashmap.c
--- linux-2.4.20-WRT/arch/cris/drivers/axisflashmap.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/axisflashmap.c	2005-11-08 06:23:46.000000000 -0800
@@ -11,12 +11,6 @@
  * partition split defined below.
  *
  * $Log: axisflashmap.c,v $
- * Revision 1.1.1.2  2003/10/14 08:07:16  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.23  2002/05/13 12:12:28  johana
  * Allow compile without CONFIG_MTD_MTDRAM but warn at compiletime and
  * be informative at runtime.
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/ds1302.c linux-2.4.20-WRTstp/arch/cris/drivers/ds1302.c
--- linux-2.4.20-WRT/arch/cris/drivers/ds1302.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/ds1302.c	2005-11-08 06:24:34.000000000 -0800
@@ -7,12 +7,6 @@
 *! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init, get_rtc_status
 *!
 *! $Log: ds1302.c,v $
-*! Revision 1.1.1.4  2003/10/14 08:07:16  sparq
-*! Broadcom Release 3.51.8.0 for BCM4712.
-*!
-*! Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
-*! LINUX_2_4 branch snapshot from linux-mips.org CVS
-*!
 *! Revision 1.13  2002/05/29 15:16:08  johana
 *! Removed unused variables.
 *!
@@ -94,7 +88,7 @@
 *!
 *! (C) Copyright 1999, 2000, 2001  Axis Communications AB, LUND, SWEDEN
 *!
-*! $Id: ds1302.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+*! $Id: ds1302.c,v 1.13 2002/05/29 15:16:08 johana Exp $
 *!
 *!***************************************************************************/
 
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/eeprom.c linux-2.4.20-WRTstp/arch/cris/drivers/eeprom.c
--- linux-2.4.20-WRT/arch/cris/drivers/eeprom.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/eeprom.c	2001-07-26 15:10:06.000000000 -0700
@@ -20,12 +20,6 @@
 *!                                  in the spin-lock.
 *!
 *!  $Log: eeprom.c,v $
-*!  Revision 1.1.1.2  2003/10/14 08:07:16  sparq
-*!  Broadcom Release 3.51.8.0 for BCM4712.
-*!
-*!  Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
-*!  LINUX_2_4 branch snapshot from linux-mips.org CVS
-*!
 *!  Revision 1.8  2001/06/15 13:24:29  jonashg
 *!  * Added verification of pointers from userspace in read and write.
 *!  * Made busy counter volatile.
@@ -243,6 +237,16 @@
         {
           D(printk("0 loc1: (%i) '%4.4s' loc2 (%i) '%4.4s'\n", 
                    LOC1, loc1, LOC2, loc2));
+#if 0
+          if (memcmp(loc1, loc2, 4) != 0 )
+          {
+            /* It's 16k */
+            printk(KERN_INFO "%s: 16k detected in step 1\n", eeprom_name);
+            eeprom.size = EEPROM_16KB;     
+            success = 1;
+          }
+          else
+#endif
           {
             /* Do step 2 check */
             /* Invert value */
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/ethernet.c linux-2.4.20-WRTstp/arch/cris/drivers/ethernet.c
--- linux-2.4.20-WRT/arch/cris/drivers/ethernet.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/ethernet.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,137 @@
-
+/* $Id: ethernet.c,v 1.30 2002/05/07 18:50:08 johana Exp $
+ *
+ * e100net.c: A network driver for the ETRAX 100LX network controller.
+ *
+ * Copyright (c) 1998-2002 Axis Communications AB.
+ *
+ * The outline of this driver comes from skeleton.c.
+ *
+ * $Log: ethernet.c,v $
+ * Revision 1.30  2002/05/07 18:50:08  johana
+ * Correct spelling in comments.
+ *
+ * Revision 1.29  2002/05/06 05:38:49  starvik
+ * Performance improvements:
+ *    Large packets are not copied (breakpoint set to 256 bytes)
+ *    The cache bug workaround is delayed until half of the receive list
+ *      has been used
+ *    Added transmit list
+ *    Transmit interrupts are only enabled when transmit queue is full
+ *
+ * Revision 1.28.2.1  2002/04/30 08:15:51  starvik
+ * Performance improvements:
+ *   Large packets are not copied (breakpoint set to 256 bytes)
+ *   The cache bug workaround is delayed until half of the receive list
+ *     has been used.
+ *   Added transmit list
+ *   Transmit interrupts are only enabled when transmit queue is full
+ *
+ * Revision 1.28  2002/04/22 11:47:21  johana
+ * Fix according to 2.4.19-pre7. time_after/time_before and
+ * missing end of comment.
+ * The patch has a typo for ethernet.c in e100_clear_network_leds(),
+ *  that is fixed here.
+ *
+ * Revision 1.27  2002/04/12 11:55:11  bjornw
+ * Added TODO
+ *
+ * Revision 1.26  2002/03/15 17:11:02  bjornw
+ * Use prepare_rx_descriptor after the CPU has touched the receiving descs
+ *
+ * Revision 1.25  2002/03/08 13:07:53  bjornw
+ * Unnecessary spinlock removed
+ *
+ * Revision 1.24  2002/02/20 12:57:43  fredriks
+ * Replaced MIN() with min().
+ *
+ * Revision 1.23  2002/02/20 10:58:14  fredriks
+ * Strip the Ethernet checksum (4 bytes) before forwarding a frame to upper layers.
+ *
+ * Revision 1.22  2002/01/30 07:48:22  matsfg
+ * Initiate R_NETWORK_TR_CTRL
+ *
+ * Revision 1.21  2001/11/23 11:54:49  starvik
+ * Added IFF_PROMISC and IFF_ALLMULTI handling in set_multicast_list
+ * Removed compiler warnings
+ *
+ * Revision 1.20  2001/11/12 19:26:00  pkj
+ * * Corrected e100_negotiate() to not assign half to current_duplex when
+ *   it was supposed to compare them...
+ * * Cleaned up failure handling in e100_open().
+ * * Fixed compiler warnings.
+ *
+ * Revision 1.19  2001/11/09 07:43:09  starvik
+ * Added full duplex support
+ * Added ioctl to set speed and duplex
+ * Clear LED timer only runs when LED is lit
+ *
+ * Revision 1.18  2001/10/03 14:40:43  jonashg
+ * Update rx_bytes counter.
+ *
+ * Revision 1.17  2001/06/11 12:43:46  olof
+ * Modified defines for network LED behavior
+ *
+ * Revision 1.16  2001/05/30 06:12:46  markusl
+ * TxDesc.next should not be set to NULL
+ *
+ * Revision 1.15  2001/05/29 10:27:04  markusl
+ * Updated after review remarks:
+ * +Use IO_EXTRACT
+ * +Handle underrun
+ *
+ * Revision 1.14  2001/05/29 09:20:14  jonashg
+ * Use driver name on printk output so one can tell which driver that complains.
+ *
+ * Revision 1.13  2001/05/09 12:35:59  johana
+ * Use DMA_NBR and IRQ_NBR defines from dma.h and irq.h
+ *
+ * Revision 1.12  2001/04/05 11:43:11  tobiasa
+ * Check dev before panic.
+ *
+ * Revision 1.11  2001/04/04 11:21:05  markusl
+ * Updated according to review remarks
+ *
+ * Revision 1.10  2001/03/26 16:03:06  bjornw
+ * Needs linux/config.h
+ *
+ * Revision 1.9  2001/03/19 14:47:48  pkj
+ * * Make sure there is always a pause after the network LEDs are
+ *   changed so they will not look constantly lit during heavy traffic.
+ * * Always use HZ when setting times relative to jiffies.
+ * * Use LED_NETWORK_SET() when setting the network LEDs.
+ *
+ * Revision 1.8  2001/02/27 13:52:48  bjornw
+ * malloc.h -> slab.h
+ *
+ * Revision 1.7  2001/02/23 13:46:38  bjornw
+ * Spellling check
+ *
+ * Revision 1.6  2001/01/26 15:21:04  starvik
+ * Don't disable interrupts while reading MDIO registers (MDIO is slow)
+ * Corrected promiscuous mode
+ * Improved deallocation of IRQs ("ifconfig eth0 down" now works)
+ *
+ * Revision 1.5  2000/11/29 17:22:22  bjornw
+ * Get rid of the udword types legacy stuff
+ *
+ * Revision 1.4  2000/11/22 16:36:09  bjornw
+ * Please marketing by using the correct case when spelling Etrax.
+ *
+ * Revision 1.3  2000/11/21 16:43:04  bjornw
+ * Minor short->int change
+ *
+ * Revision 1.2  2000/11/08 14:27:57  bjornw
+ * 2.4 port
+ *
+ * Revision 1.1  2000/11/06 13:56:00  bjornw
+ * Verbatim copy of the 1.24 version of e100net.c from elinux
+ *
+ * Revision 1.24  2000/10/04 15:55:23  bjornw
+ * * Use virt_to_phys etc. for DMA addresses
+ * * Removed bogus CHECKSUM_UNNECESSARY
+ *
+ *
+ */
 
 #include <linux/config.h>
 
@@ -446,10 +579,18 @@
 	*R_NETWORK_SA_1 = dev->dev_addr[4] | (dev->dev_addr[5] << 8);
 	*R_NETWORK_SA_2 = 0;
 
+#if 0
+	/* use promiscuous mode for testing */
+	*R_NETWORK_GA_0 = 0xffffffff;
+	*R_NETWORK_GA_1 = 0xffffffff;
+
+	*R_NETWORK_REC_CONFIG = 0xd; /* broadcast rec, individ. rec, ma0 enabled */
+#else
 	SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, broadcast, receive);
 	SETS(network_rec_config_shadow, R_NETWORK_REC_CONFIG, ma0, enable);
 	SETF(network_rec_config_shadow, R_NETWORK_REC_CONFIG, duplex, full_duplex);
 	*R_NETWORK_REC_CONFIG = network_rec_config_shadow;
+#endif
 
 	*R_NETWORK_GEN_CONFIG =
 		IO_STATE(R_NETWORK_GEN_CONFIG, phy,    mii_clk) |
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/examples/kiobuftest.c linux-2.4.20-WRTstp/arch/cris/drivers/examples/kiobuftest.c
--- linux-2.4.20-WRT/arch/cris/drivers/examples/kiobuftest.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/examples/kiobuftest.c	2001-04-06 10:42:55.000000000 -0700
@@ -10,12 +10,6 @@
  * Author:  Bjorn Wesen
  *
  * $Log: kiobuftest.c,v $
- * Revision 1.1.1.2  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.2  2001/02/27 13:52:50  bjornw
  * malloc.h -> slab.h
  *
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/gpio.c linux-2.4.20-WRTstp/arch/cris/drivers/gpio.c
--- linux-2.4.20-WRT/arch/cris/drivers/gpio.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/gpio.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: gpio.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: gpio.c,v 1.17 2002/06/17 15:53:01 johana Exp $
  *
  * Etrax general port I/O device
  *
@@ -9,12 +9,6 @@
  *             Johan Adolfsson  (read/set directions, write, port G)
  *
  * $Log: gpio.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:16  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.17  2002/06/17 15:53:01  johana
  * Added IO_READ_INBITS, IO_READ_OUTBITS, IO_SETGET_INPUT and IO_SETGET_OUTPUT
  * that take a pointer as argument and thus can handle 32 bit ports (G)
@@ -108,6 +102,9 @@
 
 static char gpio_name[] = "etrax gpio";
 
+#if 0
+static wait_queue_head_t *gpio_wq;
+#endif
 
 static int gpio_ioctl(struct inode *inode, struct file *file,
 		      unsigned int cmd, unsigned long arg);
@@ -204,6 +201,14 @@
 	  struct poll_table_struct *wait)
 {
 	/* TODO poll on alarms! */
+#if 0
+	if (!ANYTHING_WANTED) {
+		D(printk("gpio_select sleeping task\n"));
+		select_wait(&gpio_wq, table);
+		return 0;
+	}
+	D(printk("gpio_select ready\n"));
+#endif
 	return 1;
 }
 
@@ -522,7 +527,7 @@
 		SOFT_SHUTDOWN();
 		break;
 	case IO_GET_PWR_BT:
-#if defined(CONFIG_ETRAX_SOFT_SHUTDOWN)
+#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN)
 		return (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT));
 #else
 		return 0;
@@ -727,7 +732,7 @@
 {
 	extern void init_ioremap(void);
 	int res;
-#if defined(CONFIG_ETRAX_CSP0_LEDS)
+#if defined (CONFIG_ETRAX_CSP0_LEDS)
 	int i;
 #endif
 
@@ -740,14 +745,14 @@
 	}
 
 	/* Clear all leds */
-#if defined(CONFIG_ETRAX_CSP0_LEDS) ||  defined(CONFIG_ETRAX_PA_LEDS) || defined(CONFIG_ETRAX_PB_LEDS) 
+#if defined (CONFIG_ETRAX_CSP0_LEDS) ||  defined (CONFIG_ETRAX_PA_LEDS) || defined (CONFIG_ETRAX_PB_LEDS) 
 	init_ioremap();
 	LED_NETWORK_SET(0);
 	LED_ACTIVE_SET(0);
 	LED_DISK_READ(0);
 	LED_DISK_WRITE(0);
 
-#if defined(CONFIG_ETRAX_CSP0_LEDS)
+#if defined (CONFIG_ETRAX_CSP0_LEDS)
 	for (i = 0; i < 32; i++) {
 		LED_BIT_SET(i);
 	}
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/i2c.c linux-2.4.20-WRTstp/arch/cris/drivers/i2c.c
--- linux-2.4.20-WRT/arch/cris/drivers/i2c.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/i2c.c	2005-11-08 06:24:34.000000000 -0800
@@ -12,12 +12,6 @@
 *!                                 don't use PB_I2C if DS1302 uses same bits,
 *!                                 use PB.
 *! $Log: i2c.c,v $
-*! Revision 1.1.1.4  2003/10/14 08:07:16  sparq
-*! Broadcom Release 3.51.8.0 for BCM4712.
-*!
-*! Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
-*! LINUX_2_4 branch snapshot from linux-mips.org CVS
-*!
 *! Revision 1.8  2002/08/13 06:31:53  starvik
 *! Made SDA and SCL line configurable
 *! Modified i2c_inbyte to work with PCF8563
@@ -53,7 +47,7 @@
 *! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
 *!
 *!***************************************************************************/
-/* $Id: i2c.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $ */
+/* $Id: i2c.c,v 1.8 2002/08/13 06:31:53 starvik Exp $ */
 /****************** INCLUDE FILES SECTION ***********************************/
 
 #include <linux/module.h>
@@ -93,6 +87,13 @@
 #define I2C_DATA_HIGH 1
 #define I2C_DATA_LOW 0
 
+#if 0
+/* TODO: fix this so the CONFIG_ETRAX_I2C_USES... is set in Config.in instead */
+#if defined(CONFIG_DS1302) && (CONFIG_DS1302_SDABIT==0) && \
+           (CONFIG_DS1302_SCLBIT == 1)
+#define CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
+#endif
+#endif
 
 #ifdef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
 /* Use PB and not PB_I2C */
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/i2c.h linux-2.4.20-WRTstp/arch/cris/drivers/i2c.h
--- linux-2.4.20-WRT/arch/cris/drivers/i2c.h	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/i2c.h	2001-05-19 17:43:05.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: i2c.h,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $ */
+/* $Id: i2c.h,v 1.3 2001/03/19 12:43:01 markusl Exp $ */
 
 /* High level I2C actions */
 int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/ide.c linux-2.4.20-WRTstp/arch/cris/drivers/ide.c
--- linux-2.4.20-WRT/arch/cris/drivers/ide.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/ide.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ide.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: ide.c,v 1.24 2002/04/22 11:47:21 johana Exp $
  *
  * Etrax specific IDE functions, like init and PIO-mode setting etc.
  * Almost the entire ide.c is used for the rest of the Etrax ATA driver.
@@ -8,12 +8,6 @@
  *             Mikael Starvik     (pio setup stuff)
  *
  * $Log: ide.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:16  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.24  2002/04/22 11:47:21  johana
  * Fix according to 2.4.19-pre7. time_after/time_before and
  * missing end of comment.
@@ -518,6 +512,38 @@
 	WAIT_DMA(ATA_RX_DMA_NBR);
 	LED_DISK_READ(0);
 
+#if 0
+        /* old polled transfer code
+	 * this should be moved into a new function that can do polled
+	 * transfers if DMA is not available
+	 */
+        
+        /* initiate a multi word read */
+        
+        *R_ATA_TRANSFER_CNT = wcount << 1;
+        
+        *R_ATA_CTRL_DATA = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       read) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+        
+        /* svinto has a latency until the busy bit actually is set */
+        
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        nop(); nop();
+        
+        /* unit should be busy during multi transfer */
+        while((status = *R_ATA_STATUS_DATA) & IO_MASK(R_ATA_STATUS_DATA, busy)) {
+                while(!(status & IO_MASK(R_ATA_STATUS_DATA, dav)))
+                        status = *R_ATA_STATUS_DATA;
+                *ptr++ = (unsigned short)(status & 0xffff);
+        }
+#endif
 }
 
 static void 
@@ -565,6 +591,42 @@
 	WAIT_DMA(ATA_TX_DMA_NBR);
 	LED_DISK_WRITE(0);
 
+#if 0
+        /* old polled write code - see comment in input_bytes */
+
+	/* wait for busy flag */
+        while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)); 
+
+        /* initiate a multi word write */
+
+        *R_ATA_TRANSFER_CNT = bytecount >> 1;
+
+        ctrl = data_reg |
+                IO_STATE(R_ATA_CTRL_DATA, rw,       write) |
+                IO_STATE(R_ATA_CTRL_DATA, src_dst,  register) |
+                IO_STATE(R_ATA_CTRL_DATA, handsh,   pio) |
+                IO_STATE(R_ATA_CTRL_DATA, multi,    on) |
+                IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
+        
+        LED_DISK_WRITE(1);
+        
+        /* Etrax will set busy = 1 until the multi pio transfer has finished
+         * and tr_rdy = 1 after each succesful word transfer. 
+         * When the last byte has been transferred Etrax will first set tr_tdy = 1 
+         * and then busy = 0 (not in the same cycle). If we read busy before it
+         * has been set to 0 we will think that we should transfer more bytes 
+         * and then tr_rdy would be 0 forever. This is solved by checking busy
+         * in the inner loop.
+         */
+        
+        do {
+                *R_ATA_CTRL_DATA = ctrl | *ptr++;
+                while(!(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, tr_rdy)) &&
+                      (*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy)));
+        } while(*R_ATA_STATUS_DATA & IO_MASK(R_ATA_STATUS_DATA, busy));
+
+        LED_DISK_WRITE(0);
+#endif  
 
 }
 
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/lpslave/bintocarr.pl linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/bintocarr.pl
--- linux-2.4.20-WRT/arch/cris/drivers/lpslave/bintocarr.pl	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/bintocarr.pl	2001-10-08 11:43:54.000000000 -0700
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# $Id: bintocarr.pl,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+# $Id: bintocarr.pl,v 1.4 2001/08/08 08:18:13 bjarne Exp $
 # Copy of mkjulbin.pl made by Olof
 # convert a binary stdin to a C-file containing a char array of the input
 # first argument is the symbol name
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/lpslave/e100lpslavenet.c linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/e100lpslavenet.c
--- linux-2.4.20-WRT/arch/cris/drivers/lpslave/e100lpslavenet.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/e100lpslavenet.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: e100lpslavenet.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: e100lpslavenet.c,v 1.5 2002/04/22 11:47:24 johana Exp $
  *
  * e100lpslavenet.c: A network driver for the ETRAX 100LX slave controller.
  *
@@ -7,12 +7,6 @@
  * The outline of this driver comes from skeleton.c.
  *
  * $Log: e100lpslavenet.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.5  2002/04/22 11:47:24  johana
  * Fix according to 2.4.19-pre7. time_after/time_before and
  * missing end of comment.
@@ -457,6 +451,35 @@
 		return -EAGAIN;
 	}
 
+#if 0
+        /* We are not allocating DMA since DMA4 is reserved for 'cascading'
+         * and will always fail with the current dma.c
+         */
+        
+	/*
+	 * Always allocate the DMA channels after the IRQ,
+	 * and clean up on failure.
+	 */
+
+	if(request_dma(PAR0_RX_DMA_NBR, cardname)) {
+          printk("Failed to allocate PAR0_RX_DMA_NBR\n");
+		goto grace_exit;
+	}
+
+	if(request_dma(PAR1_TX_DMA_NBR, cardname)) {
+          printk("Failed to allocate PAR1_TX_DMA_NBR\n");
+	grace_exit:
+		/* this will cause some 'trying to free free irq' but what the heck... */
+
+		free_dma(PAR1_TX_DMA_NBR);
+                free_dma(PAR0_RX_DMA_NBR);
+                free_irq(PAR0_ECP_IRQ_NBR, (void *)dev);
+                free_irq(DMA4_TX_IRQ_NBR, (void *)dev);
+		free_irq(DMA3_RX_IRQ_NBR, (void *)dev);
+		
+		return -EAGAIN;
+	}
+#endif
         
 #ifdef ETHDEBUG
         printk("Par port IRQ and DMA allocated\n");
@@ -882,6 +905,9 @@
 	/* Configure the tx dma descriptor. Desc 0 is already configured.*/
 
         TxDescList[1].sw_len = length;
+	/* bug workaround - etrax100 needs d_wait on the descriptor _before_
+	 * a descriptor containing an ECP command
+	 */
 	TxDescList[1].ctrl = d_wait;
 	TxDescList[1].buf = virt_to_phys(buf);
 	TxDescList[1].next = virt_to_phys(&TxDescList[2]);
@@ -939,6 +965,15 @@
 
 	*R_DMA_CH4_CLR_INTR = IO_STATE(R_DMA_CH4_CLR_INTR, clr_descr, do);
 
+#if 0
+        /* manual transfer of boot code - requires dma turned off */
+        for (i=0; i<ETRAX_PAR_BOOT_LENGTH; i++)
+        {
+          printk("  sending byte: %u value: %x\n",i,code[i]);
+          while (((*R_PAR1_STATUS)&0x02) == 0); /* Wait while tr_rdy is busy*/
+          *R_PAR1_CTRL_DATA = code[i];
+        }
+#endif
 
 #ifdef ETHDEBUG
 	printk("  done\n");
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/lpslave/e100lpslave.S linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/e100lpslave.S
--- linux-2.4.20-WRT/arch/cris/drivers/lpslave/e100lpslave.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/lpslave/e100lpslave.S	2001-07-26 15:10:06.000000000 -0700
@@ -1,4 +1,4 @@
-	;; $Id: e100lpslave.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+	;; $Id: e100lpslave.S,v 1.3 2001/06/21 16:55:26 olof Exp $
 	;;
 	;; Etrax100 slave network<->parport forwarder
 	;;
@@ -9,6 +9,9 @@
 	;;
 
 #include <linux/config.h>
+#if 0
+#define ASSEMBLER_MACROS_ONLY
+#endif
 #include <asm/sv_addr_ag.h>
 
 #define BUFSIZE 0x600
@@ -248,6 +251,15 @@
 	;; restart DMAs
 
 	jsr	startdmaFNTP
+#if 0
+#ifdef CONFIG_ETRAX_ETHERNET_LPSLAVE_HAS_LEDS
+	;; Light the LED signaling an incoming networkpacket
+	movu.b	0xFB, r0
+	move.b	r0, [R_PORT_PA_DATA]
+	move.d	0x00010000, r0
+	move.d	r0,[LEDCount]
+#endif
+#endif
 
 noswap2:
 #ifdef CONFIG_ETRAX_ETHERNET_LPSLAVE_HAS_LEDS
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/parport.c linux-2.4.20-WRTstp/arch/cris/drivers/parport.c
--- linux-2.4.20-WRT/arch/cris/drivers/parport.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/parport.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: parport.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: parport.c,v 1.9 2002/05/15 12:30:24 starvik Exp $
  * 
  * Elinux parallel port driver
  * NOTE!
@@ -530,6 +530,7 @@
 
                 info->port = p;
                 p->private_data = info;
+                /* Axis FIXME: Set mode flags. */
                 /* p->modes = PARPORT_MODE_TRISTATE | PARPORT_MODE_SAFEININT; */
 
 	        if(request_irq(info->int_irq, parport_etrax_interrupt,
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/pcf8563.c linux-2.4.20-WRTstp/arch/cris/drivers/pcf8563.c
--- linux-2.4.20-WRT/arch/cris/drivers/pcf8563.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/pcf8563.c	2005-11-08 06:24:34.000000000 -0800
@@ -15,7 +15,7 @@
  *
  * Author: Tobias Anderberg <tobiasa@axis.com>.
  *
- * $Id: pcf8563.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+ * $Id: pcf8563.c,v 1.1 2002/08/12 13:46:02 starvik Exp $
  */
 
 #include <linux/config.h>
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/serial.c linux-2.4.20-WRTstp/arch/cris/drivers/serial.c
--- linux-2.4.20-WRT/arch/cris/drivers/serial.c	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/serial.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: serial.c,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+/* $Id: serial.c,v 1.37 2002/08/13 13:02:37 bjornw Exp $
  *
  * Serial port driver for the ETRAX 100LX chip
  *
@@ -7,12 +7,6 @@
  *      Many, many authors. Based once upon a time on serial.c for 16x50.
  *
  * $Log: serial.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:16  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.37  2002/08/13 13:02:37  bjornw
  * Removed some warnings because of unused code
  *
@@ -327,7 +321,7 @@
  *
  */
 
-static char *serial_version = "$Revision: 1.1.1.4 $";
+static char *serial_version = "$Revision: 1.37 $";
 
 #include <linux/config.h>
 #include <linux/version.h>
@@ -380,7 +374,7 @@
  * All of the compatibilty code so we can compile serial.c against
  * older kernels is hidden in serial_compat.h
  */
-#if defined(LOCAL_HEADERS) || (LINUX_VERSION_CODE < 0x020317)     /* 2.3.23 */
+#if defined(LOCAL_HEADERS) || (LINUX_VERSION_CODE < 0x020317) /* 2.3.23 */
 #include "serial_compat.h"
 #endif
 
@@ -867,6 +861,11 @@
 		restore_flags(flags);
 	}
 	
+#if 0
+	REG_SHADOW_SET(e100_modem_pins[info->line].port,
+		       *e100_modem_pins[info->line].shadow,
+		       e100_modem_pins[info->line].dtr_bit, !set);
+#endif
 #ifdef SERIAL_DEBUG_IO
 	printk("ser%i shadow after 0x%02X get: %i\n", 
 	       info->line, *e100_modem_pins[info->line].shadow, 
@@ -1083,6 +1082,10 @@
  * ------------------------------------------------------------
  */
 
+/* FIXME - when are these used and what is the purpose ? 
+ * In rs_stop we probably just can block the transmit DMA ready irq
+ * and in rs_start we re-enable it (and then the old one will come).
+ */
 
 static void 
 rs_stop(struct tty_struct *tty)
@@ -1241,6 +1244,10 @@
 static void 
 start_transmit(struct e100_serial *info)
 {
+#if 0
+	if (info->line == SERIAL_DEBUG_LINE)
+		printk("x\n");
+#endif
 
 	info->tr_descr.sw_len = 0;
 	info->tr_descr.hw_len = 0;
@@ -1575,6 +1582,8 @@
 			transmit_chars(info);
 		}
 		
+		/* FIXME: here we should really check for a change in the
+		   status lines and if so call status_handle(info) */
 	}
 }
 
@@ -1612,6 +1621,8 @@
 			receive_chars(info);
 		}
 		
+		/* FIXME: here we should really check for a change in the
+		   status lines and if so call status_handle(info) */
 	}
 }
 
@@ -2784,6 +2795,16 @@
 {
 	unsigned int result;
 	/* Polarity isn't verified */
+#if 0 /*def SERIAL_DEBUG_IO  */
+
+	printk("get_modem_info: RTS: %i DTR: %i CD: %i RI: %i DSR: %i CTS: %i\n",
+	       E100_RTS_GET(info),
+	       E100_DTR_GET(info),
+	       E100_CD_GET(info),
+	       E100_RI_GET(info),
+	       E100_DSR_GET(info),
+	       E100_CTS_GET(info));
+#endif
 	result =  
 		(!E100_RTS_GET(info) ? TIOCM_RTS : 0)
 		| (!E100_DTR_GET(info) ? TIOCM_DTR : 0)
@@ -2863,7 +2884,7 @@
 /*
  * This routine sends a break character out the serial port.
  */
-#if (LINUX_VERSION_CODE < 131394)     /* Linux 2.1.66 */
+#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
 static void 
 send_break(struct e100_serial * info, int duration)
 {
@@ -2925,10 +2946,10 @@
 	 unsigned int cmd, unsigned long arg)
 {
 	struct e100_serial * info = (struct e100_serial *)tty->driver_data;
-#if (LINUX_VERSION_CODE < 131394)     /* Linux 2.1.66 */
+#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
 	int error;
 #endif
-#if (LINUX_VERSION_CODE < 131394)     /* Linux 2.1.66 */
+#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
 	int retval;
 #endif
 	
@@ -2940,7 +2961,7 @@
 	}
 	
 	switch (cmd) {
-#if (LINUX_VERSION_CODE < 131394)     /* Linux 2.1.66 */
+#if (LINUX_VERSION_CODE < 131394) /* Linux 2.1.66 */
 	        case TCSBRK:	/* SVID version: non-zero arg --> no break */
 			retval = tty_check_change(tty);
 			if (retval)
@@ -3622,7 +3643,7 @@
 	serial_driver.stop = rs_stop;
 	serial_driver.start = rs_start;
 	serial_driver.hangup = rs_hangup;
-#if (LINUX_VERSION_CODE >= 131394)     /* Linux 2.1.66 */
+#if (LINUX_VERSION_CODE >= 131394) /* Linux 2.1.66 */
 	serial_driver.break_ctl = rs_break;
 #endif
 #if (LINUX_VERSION_CODE >= 131343)
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/usb-host.c linux-2.4.20-WRTstp/arch/cris/drivers/usb-host.c
--- linux-2.4.20-WRT/arch/cris/drivers/usb-host.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/usb-host.c	2005-11-08 06:24:34.000000000 -0800
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2001 Axis Communications AB.
  *
- * $Id: usb-host.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+ * $Id: usb-host.c,v 1.13 2001/11/13 12:06:17 pkj Exp $
  *
  */
 
@@ -34,7 +34,7 @@
 #define ETRAX_USB_RX_IRQ USB_DMA_RX_IRQ_NBR
 #define ETRAX_USB_TX_IRQ USB_DMA_TX_IRQ_NBR
 
-static const char *usb_hcd_version = "$Revision: 1.1.1.4 $";
+static const char *usb_hcd_version = "$Revision: 1.13 $";
 
 #undef KERN_DEBUG
 #define KERN_DEBUG ""
@@ -563,7 +563,11 @@
 
 	/* This is safe since there cannot be any other URB's for this epid */
 	URB_List[epid] = urb;
+#if 0
+	first_ep = (USB_EP_Desc_t *)phys_to_virt(*R_DMA_CH8_SUB2_EP);
+#else
 	first_ep = &TxIntrEPList[0];
+#endif
 
 	/* Round of the interval to 2^n, it is obvious that this code favours
 	   smaller numbers, but that is actually a good thing */
@@ -992,7 +996,11 @@
 		sb_desc_1->command = IO_FIELD(USB_SB_command, rem, 0) |
 			IO_STATE(USB_SB_command, tt, out) |
 
+#if 0
+			IO_STATE(USB_SB_command, full, no) |
+#else
 			IO_STATE(USB_SB_command, full, yes) |
+#endif
 
 			IO_STATE(USB_SB_command, eot, yes) |
 			IO_STATE(USB_SB_command, eol, yes);
@@ -1136,10 +1144,12 @@
 					 usb_maxpacket(URB_List[epid]->dev, URB_List[epid]->pipe,
 						       usb_pipeout(URB_List[epid]->pipe)));
 	}
+#if 1
 	else {
 		/* This means that this EP is now free, deconfigure it */
 		etrax_usb_free_epid(epid);
 	}
+#endif
 	
 	/* Remember to free the SB's */
 	hc_priv = (etrax_urb_priv_t *)old_urb->hcpriv;
@@ -1681,10 +1691,12 @@
 					 usb_maxpacket(URB_List[epid]->dev, URB_List[epid]->pipe,
 						       usb_pipeout(URB_List[epid]->pipe)));
 	}
+#if 1
 	else {
 		/* This means that this EP is now free, deconfigure it */
 		etrax_usb_free_epid(epid);
 	}
+#endif
 	
 	/* Remember to free the SB's */
 	hc_priv = (etrax_urb_priv_t *)old_urb->hcpriv;
@@ -1945,6 +1957,14 @@
 	reg->r_usb_irq_mask_read    = *R_USB_IRQ_MASK_READ;
 	reg->r_usb_status           = *R_USB_STATUS;
 
+#if 0
+	if (reg->r_usb_status & IO_MASK(R_USB_STATUS, perror)) {
+		panic("r_usb_status said perror\n");
+	}
+	if (reg->r_usb_status & IO_MASK(R_USB_STATUS, ourun)) {
+		panic("r_usb_status said ourun !!!\n");
+	}
+#endif
 	
 	reg->r_usb_epid_attn        = *R_USB_EPID_ATTN;
 
@@ -2356,6 +2376,22 @@
 		DBFEXIT;
 		return -1;
 	}	
+#if 0  /* Moved to head.S */
+	*R_GEN_CONFIG = genconfig_shadow =
+		(genconfig_shadow & ~(IO_MASK(R_GEN_CONFIG, usb1) |
+				      IO_MASK(R_GEN_CONFIG, usb2) |
+				      IO_MASK(R_GEN_CONFIG, dma8) |
+				      IO_MASK(R_GEN_CONFIG, dma9))) |
+		IO_STATE(R_GEN_CONFIG, dma8, usb) |
+		IO_STATE(R_GEN_CONFIG, dma9, usb)
+#ifdef CONFIG_ETRAX_USB_HOST_PORT1
+		| IO_STATE(R_GEN_CONFIG, usb1, select)
+#endif
+#ifdef CONFIG_ETRAX_USB_HOST_PORT2
+		| IO_STATE(R_GEN_CONFIG, usb2, select)
+#endif
+	;
+#endif
 	
 	usb_register_bus(hc->bus);
 
@@ -2410,8 +2446,10 @@
 		IO_STATE(R_USB_COMMAND, port_cmd, reset);
 	
 	nop(); while (*R_USB_COMMAND & IO_MASK(R_USB_COMMAND, busy));
+#if 1
 	/* Initate PSTART to all unallocatable bit times */
 	*R_USB_FM_PSTART = IO_FIELD(R_USB_FM_PSTART, value, 10000);
+#endif
 
 #ifdef CONFIG_ETRAX_USB_HOST_PORT1
 	*R_USB_PORT1_DISABLE = IO_STATE(R_USB_PORT1_DISABLE, disable, no);
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/usb-host.h linux-2.4.20-WRTstp/arch/cris/drivers/usb-host.h
--- linux-2.4.20-WRT/arch/cris/drivers/usb-host.h	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/usb-host.h	2001-08-15 01:22:15.000000000 -0700
@@ -75,6 +75,9 @@
 	__u32 r_usb_rh_port_status_2;
 	__u32 r_usb_irq_mask_read;
 	struct tq_struct usb_bh;
+#if 0
+	__u32 r_usb_ept_data[32];
+#endif
 };
 
 struct in_chunk
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/virtex.c linux-2.4.20-WRTstp/arch/cris/drivers/virtex.c
--- linux-2.4.20-WRT/arch/cris/drivers/virtex.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/virtex.c	2005-11-08 06:24:34.000000000 -0800
@@ -31,12 +31,6 @@
 *!  
 *! Jul 19 2002  Stefan Lundberg    Initial version.
 *! $Log: virtex.c,v $
-*! Revision 1.1.1.4  2003/10/14 08:07:17  sparq
-*! Broadcom Release 3.51.8.0 for BCM4712.
-*!
-*! Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
-*! LINUX_2_4 branch snapshot from linux-mips.org CVS
-*!
 *! Revision 1.1  2002/06/25 09:58:58  stefanl
 *! New FPGA driver for Platoon
 *!
@@ -46,7 +40,7 @@
 *! (C) Copyright 2002 Axis Communications AB, LUND, SWEDEN
 *!
 *!***************************************************************************/
-/* $Id: virtex.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $ */
+/* $Id: virtex.c,v 1.1 2002/06/25 09:58:58 stefanl Exp $ */
 /****************** INCLUDE FILES SECTION ***********************************/
 
 #include <linux/module.h>
diff -ruN linux-2.4.20-WRT/arch/cris/drivers/virtex.h linux-2.4.20-WRTstp/arch/cris/drivers/virtex.h
--- linux-2.4.20-WRT/arch/cris/drivers/virtex.h	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/drivers/virtex.h	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: virtex.h,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $ */
+/* $Id: virtex.h,v 1.1 2002/06/25 09:58:58 stefanl Exp $ */
 
 int virtex_writereg(unsigned short theReg, unsigned short theValue);
 unsigned short virtex_readreg(unsigned short theReg);
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/debugport.c linux-2.4.20-WRTstp/arch/cris/kernel/debugport.c
--- linux-2.4.20-WRT/arch/cris/kernel/debugport.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/debugport.c	2005-11-08 06:23:46.000000000 -0800
@@ -12,12 +12,6 @@
  *    init_etrax_debug()
  *
  * $Log: debugport.c,v $
- * Revision 1.1.1.2  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.7  2002/04/23 15:35:50  bjornw
  * Cleaned up sercons struct and removed the waitkey ptr (2.4.19-pre)
  *
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/entry.S linux-2.4.20-WRTstp/arch/cris/kernel/entry.S
--- linux-2.4.20-WRT/arch/cris/kernel/entry.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/entry.S	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: entry.S,v 1.39 2002/04/24 00:46:45 bjornw Exp $
  *
  *  linux/arch/cris/entry.S
  *
@@ -7,12 +7,6 @@
  *  Authors:	Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: entry.S,v $
- *  Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- *  Broadcom Release 3.51.8.0 for BCM4712.
- *
- *  Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- *  LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  *  Revision 1.39  2002/04/24 00:46:45  bjornw
  *  Added sys_tkill
  *
@@ -507,9 +501,31 @@
 	nop
 		
 	;; special handlers for breakpoint and NMI
+#if 0			
+hwbreakpoint:
+	push	$dccr
+	di
+	push	$r10
+	push	$r11
+	push	$r12
+	push	$r13
+	clearf	b
+	move	$brp,$r11
+	move.d	[hw_bp_msg],$r10
+	jsr	printk
+	setf	b
+	pop	$r13
+	pop	$r12
+	pop	$r11
+	pop	$r10
+	pop	$dccr
+	retb
+	nop
+#else
 hwbreakpoint:
 	push	$dccr
 	di
+#if 1
 	push	$r10
 	push	$r11
 	move.d	[hw_bp_trig_ptr],$r10
@@ -522,9 +538,11 @@
 	move.d	$r10,[hw_bp_trig_ptr]
 1:	pop	$r11
 	pop	$r10
+#endif
 	pop	$dccr
 	retb
 	nop
+#endif
 	
 IRQ1_interrupt:
 
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/fasttimer.c linux-2.4.20-WRTstp/arch/cris/kernel/fasttimer.c
--- linux-2.4.20-WRT/arch/cris/kernel/fasttimer.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/fasttimer.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,16 +1,10 @@
-/* $Id: fasttimer.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: fasttimer.c,v 1.4 2002/05/28 17:47:59 johana Exp $
  * linux/arch/cris/kernel/fasttimer.c
  *
  * Fast timers for ETRAX100/ETRAX100LX
  * This may be useful in other OS than Linux so use 2 space indentation...
  *
  * $Log: fasttimer.c,v $
- * Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.4  2002/05/28 17:47:59  johana
  * Added del_fast_timer()
  *
@@ -232,6 +226,7 @@
   /* t = 1/freq = 1/19200 = 53us
    * T=div*t,  div = T/t = delay_us*freq/1000000
    */
+#if 1 /* Adaptive timer settings */
   while (delay_us < upper_limit && freq_index < MAX_USABLE_TIMER_FREQ)
   {
     freq_index++;
@@ -241,6 +236,9 @@
   {
     freq_index--;
   }
+#else
+  freq_index = 6;
+#endif
   div = delay_us * timer_freq_100[freq_index]/10000;
   if (div < 2)
   {
@@ -673,12 +671,14 @@
     {
       int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
 
+#if 1 //ndef FAST_TIMER_LOG
       used += sprintf(bigbuf + used, "div: %i freq: %i delay: %i"
                       "\n",
                       timer_div_settings[cur],
                       timer_freq_settings[cur],
                       timer_delay_settings[cur]
                       );
+#endif
 #ifdef FAST_TIMER_LOG
       t = &timer_started_log[cur];
       used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
@@ -939,9 +939,19 @@
   /* For some reason, request_irq() hangs when called froom time_init() */
   if (!fast_timer_is_init)
   {
+#if 0 && defined(FAST_TIMER_TEST)
+    int i;
+#endif
 
     printk("fast_timer_init()\n");
 
+#if 0 && defined(FAST_TIMER_TEST)
+    for (i = 0; i <= TIMER0_DIV; i++)
+    {
+      /* We must be careful not to get overflow... */
+      printk("%3i %6u\n", i, timer0_value_us[i]);
+    }
+#endif
 #ifdef CONFIG_PROC_FS
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
    if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/head.S linux-2.4.20-WRTstp/arch/cris/kernel/head.S
--- linux-2.4.20-WRT/arch/cris/kernel/head.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/head.S	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: head.S,v 1.44 2002/02/05 15:39:57 bjornw Exp $
  * 
  * Head of the kernel - alter with care
  *
@@ -7,12 +7,6 @@
  * Authors:	Bjorn Wesen (bjornw@axis.com)
  * 
  * $Log: head.S,v $
- * Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.44  2002/02/05 15:39:57  bjornw
  * Oops.. non-CRAMFS_MAGIC should jump over the copying, not into it...
  *
@@ -492,6 +486,18 @@
 	move.d	$r0,[R_ATA_CTRL_DATA]
 	move.d	$r0,[R_ATA_TRANSFER_CNT]
 	move.d	$r0,[R_ATA_CONFIG]
+#if 0
+	move.d	R_PORT_G_DATA, $r1
+	move.d	$r0, [$r1]; assert ATA bus-reset
+	nop
+	nop
+	nop
+	nop
+	nop
+	nop
+	move.d	0x08000000,$r0
+	move.d	$r0,[$r1]
+#endif
 #endif
 
 #ifdef CONFIG_JULIETTE
@@ -614,6 +620,21 @@
 #ifndef CONFIG_SVINTO_SIM
 	move.d	$r0,[R_GEN_CONFIG]
 
+#if 0
+	moveq	4,$r0
+	move.b	$r0,[R_DMA_CH6_CMD]	; reset (ser0 dma out)
+	move.b	$r0,[R_DMA_CH7_CMD]	; reset (ser0 dma in)
+1:	move.b	[R_DMA_CH6_CMD],$r0	; wait for reset cycle to finish
+	and.b	7,$r0
+	cmp.b	4,$r0
+	beq	1b
+	nop
+1:	move.b	[R_DMA_CH7_CMD],$r0	; wait for reset cycle to finish
+	and.b	7,$r0
+	cmp.b	4,$r0
+	beq	1b
+	nop
+#endif
 	
 	moveq	IO_STATE (R_DMA_CH8_CMD, cmd, reset),$r0
 	move.b	$r0,[R_DMA_CH8_CMD]	; reset (ser1 dma out)
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/irq.c linux-2.4.20-WRTstp/arch/cris/kernel/irq.c
--- linux-2.4.20-WRT/arch/cris/kernel/irq.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/irq.c	2002-02-25 11:37:52.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: irq.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: irq.c,v 1.18 2001/11/21 13:40:18 bjornw Exp $
  *
  *	linux/arch/cris/kernel/irq.c
  *
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/kgdb.c linux-2.4.20-WRTstp/arch/cris/kernel/kgdb.c
--- linux-2.4.20-WRT/arch/cris/kernel/kgdb.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/kgdb.c	2005-11-08 06:24:34.000000000 -0800
@@ -18,12 +18,6 @@
 *! Jul 21 1999  Bjorn Wesen     eLinux port
 *!
 *! $Log: kgdb.c,v $
-*! Revision 1.1.1.4  2003/10/14 08:07:17  sparq
-*! Broadcom Release 3.51.8.0 for BCM4712.
-*!
-*! Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
-*! LINUX_2_4 branch snapshot from linux-mips.org CVS
-*!
 *! Revision 1.7  2002/07/12 09:14:56  bjornw
 *! Corrected typo
 *!
@@ -64,7 +58,7 @@
 *!
 *!---------------------------------------------------------------------------
 *!
-*! $Id: kgdb.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+*! $Id: kgdb.c,v 1.7 2002/07/12 09:14:56 bjornw Exp $
 *!
 *! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
 *!
@@ -464,6 +458,7 @@
    part of the code in order to avoid horrible addressing modes. */
 static registers reg;
 
+/* FIXME: Should this be used? Delete otherwise. */
 /* Contains the assumed consistency state of the register image. Uses the
    enum error_type for state information. */
 static int consistency_status = SUCCESS;
@@ -763,6 +758,7 @@
 	int ch;
         
         if (mem == NULL) {
+                /* Bogus read from m0. FIXME: What constitutes a valid address? */
                 for (i = 0; i < count; i++) {
                         *buf++ = '0';
                         *buf++ = '0';
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/Makefile linux-2.4.20-WRTstp/arch/cris/kernel/Makefile
--- linux-2.4.20-WRT/arch/cris/kernel/Makefile	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/Makefile	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+# $Id: Makefile,v 1.10 2002/05/27 15:41:40 johana Exp $
 #
 # Makefile for the linux kernel.
 #
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/process.c linux-2.4.20-WRTstp/arch/cris/kernel/process.c
--- linux-2.4.20-WRT/arch/cris/kernel/process.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/process.c	2002-02-25 11:37:52.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: process.c,v 1.22 2001/11/13 09:40:43 orjanf Exp $
  * 
  *  linux/arch/cris/kernel/process.c
  *
@@ -8,12 +8,6 @@
  *  Authors:   Bjorn Wesen (bjornw@axis.com)
  *
  *  $Log: process.c,v $
- *  Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- *  Broadcom Release 3.51.8.0 for BCM4712.
- *
- *  Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- *  LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  *  Revision 1.22  2001/11/13 09:40:43  orjanf
  *  Added dump_fpu (needed for core dumps).
  *
@@ -257,6 +251,27 @@
  */
 void dump_thread(struct pt_regs * regs, struct user * dump)
 {
+#if 0
+	int i;
+
+	/* changed the size calculations - should hopefully work better. lbt */
+	dump->magic = CMAGIC;
+	dump->start_code = 0;
+	dump->start_stack = regs->esp & ~(PAGE_SIZE - 1);
+	dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
+	dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
+	dump->u_dsize -= dump->u_tsize;
+	dump->u_ssize = 0;
+	for (i = 0; i < 8; i++)
+		dump->u_debugreg[i] = current->debugreg[i];  
+
+	if (dump->start_stack < TASK_SIZE)
+		dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
+
+	dump->regs = *regs;
+
+	dump->u_fpvalid = dump_fpu (regs, &dump->i387);
+#endif 
 }
 
 /* Fill in the fpu structure for a core dump. */
@@ -338,6 +353,29 @@
 
 unsigned long get_wchan(struct task_struct *p)
 {
+#if 0
+	/* YURGH. TODO. */
+
+        unsigned long ebp, esp, eip;
+        unsigned long stack_page;
+        int count = 0;
+        if (!p || p == current || p->state == TASK_RUNNING)
+                return 0;
+        stack_page = (unsigned long)p;
+        esp = p->thread.esp;
+        if (!stack_page || esp < stack_page || esp > 8188+stack_page)
+                return 0;
+        /* include/asm-i386/system.h:switch_to() pushes ebp last. */
+        ebp = *(unsigned long *) esp;
+        do {
+                if (ebp < stack_page || ebp > 8184+stack_page)
+                        return 0;
+                eip = *(unsigned long *) (ebp+4);
+                if (eip < first_sched || eip >= last_sched)
+                        return eip;
+                ebp = *(unsigned long *) ebp;
+        } while (count++ < 16);
+#endif
         return 0;
 }
 #undef last_sched
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/ptrace.c linux-2.4.20-WRTstp/arch/cris/kernel/ptrace.c
--- linux-2.4.20-WRT/arch/cris/kernel/ptrace.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/ptrace.c	2002-02-25 11:37:52.000000000 -0800
@@ -8,12 +8,6 @@
  * Authors:   Bjorn Wesen
  *
  * $Log: ptrace.c,v $
- * Revision 1.1.1.2  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.8  2001/11/12 18:26:21  pkj
  * Fixed compiler warnings.
  *
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/setup.c linux-2.4.20-WRTstp/arch/cris/kernel/setup.c
--- linux-2.4.20-WRT/arch/cris/kernel/setup.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/setup.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: setup.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: setup.c,v 1.26 2002/06/04 07:57:56 jonashg Exp $
  *
  *  linux/arch/cris/kernel/setup.c
  *
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/shadows.c linux-2.4.20-WRTstp/arch/cris/kernel/shadows.c
--- linux-2.4.20-WRT/arch/cris/kernel/shadows.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/shadows.c	2001-05-01 16:04:56.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: shadows.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: shadows.c,v 1.2 2001/03/15 14:25:16 bjornw Exp $
  * 
  * Various shadow registers. Defines for these are in include/asm-etrax100/io.h
  */
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/signal.c linux-2.4.20-WRTstp/arch/cris/kernel/signal.c
--- linux-2.4.20-WRT/arch/cris/kernel/signal.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/signal.c	2005-11-08 06:23:46.000000000 -0800
@@ -122,6 +122,7 @@
 {
 	sigset_t saveset, newset;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/sys_cris.c linux-2.4.20-WRTstp/arch/cris/kernel/sys_cris.c
--- linux-2.4.20-WRT/arch/cris/kernel/sys_cris.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/sys_cris.c	2001-07-26 15:10:06.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: sys_cris.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: sys_cris.c,v 1.10 2001/06/27 21:16:15 hp Exp $
  *
  * linux/arch/cris/kernel/sys_cris.c
  *
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/time.c linux-2.4.20-WRTstp/arch/cris/kernel/time.c
--- linux-2.4.20-WRT/arch/cris/kernel/time.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/time.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: time.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: time.c,v 1.14 2002/03/05 13:31:03 johana Exp $
  *
  *  linux/arch/cris/kernel/time.c
  *
@@ -105,6 +105,18 @@
 void cris_test_timers(void)
 {
 	int i;
+#if 0
+	for (i = 0; i < NS_TEST_SIZE; i++)
+	{
+		ns_test[i] = *R_TIMER0_DATA | (*R_TIM_PRESC_STATUS<<16);
+	}
+	for (i = 1; i < NS_TEST_SIZE; i++)
+	{
+		printk("%4i. %lu %lu %09lu ns \n",
+		       i, ns_test[i]&0x0FFFF, (ns_test[i]>>16), 
+	get_ns_in_jiffie_from_data(ns_test[i]&0x0FFFF, ns_test[i]>>16));
+	}
+#else
 	for (i = 0; i < NS_TEST_SIZE; i++)
 	{
 		ns_test[i] = get_ns_in_jiffie();
@@ -115,6 +127,7 @@
 		printk("%4i. %09lu ns diff %li ns\n",
 		       i, ns_test[i], ns_test[i]- ns_test[i-1]);
 	}
+#endif
 }
 
 #endif
@@ -395,6 +408,23 @@
 	}
 }
 
+#if 0
+/* some old debug code for testing the microsecond timing of packets */
+static unsigned int lastjiff;
+
+void print_timestamp(const char *s)
+{
+	unsigned long flags;
+	unsigned int newjiff;
+
+	save_flags(flags);
+	cli();
+	newjiff = (myjiff << 16) | (unsigned short)(-*R_TIMER01_DATA); 
+	printk("%s: %x (%x)\n", s, newjiff, newjiff - lastjiff);
+	lastjiff = newjiff;
+	restore_flags(flags);
+}
+#endif
 
 /* grab the time from the RTC chip */
 
diff -ruN linux-2.4.20-WRT/arch/cris/kernel/traps.c linux-2.4.20-WRTstp/arch/cris/kernel/traps.c
--- linux-2.4.20-WRT/arch/cris/kernel/traps.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/kernel/traps.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: traps.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: traps.c,v 1.17 2001/12/07 17:02:34 bjornw Exp $
  *
  *  linux/arch/cris/traps.c
  *
@@ -129,6 +129,20 @@
 	show_trace(sp);
 }
 
+#if 0
+/* displays a short stack trace */
+
+int 
+show_stack()
+{
+	unsigned long *sp = (unsigned long *)rdusp();
+	int i;
+	printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
+	for(i = 0; i < 16; i++)
+		printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
+	return 0;
+}
+#endif
 
 void 
 show_registers(struct pt_regs * regs)
diff -ruN linux-2.4.20-WRT/arch/cris/lib/checksumcopy.S linux-2.4.20-WRTstp/arch/cris/lib/checksumcopy.S
--- linux-2.4.20-WRT/arch/cris/lib/checksumcopy.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/checksumcopy.S	2001-10-08 11:43:54.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: checksumcopy.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: checksumcopy.S,v 1.7 2001/10/01 14:47:35 bjornw Exp $
  * A fast checksum+copy routine using movem
  * Copyright (c) 1998, 2001 Axis Communications AB
  *
diff -ruN linux-2.4.20-WRT/arch/cris/lib/checksum.S linux-2.4.20-WRTstp/arch/cris/lib/checksum.S
--- linux-2.4.20-WRT/arch/cris/lib/checksum.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/checksum.S	2001-10-08 11:43:54.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: checksum.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: checksum.S,v 1.6 2001/10/01 14:47:35 bjornw Exp $
  * A fast checksum routine using movem
  * Copyright (c) 1998-2001 Axis Communications AB
  *
diff -ruN linux-2.4.20-WRT/arch/cris/lib/dmacopy.c linux-2.4.20-WRTstp/arch/cris/lib/dmacopy.c
--- linux-2.4.20-WRT/arch/cris/lib/dmacopy.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/dmacopy.c	2001-02-08 16:32:44.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: dmacopy.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $ 
+/* $Id: dmacopy.c,v 1.1 2000/07/10 16:25:21 bjornw Exp $ 
  *
  * memcpy for large blocks, using memory-memory DMA channels 6 and 7 in Etrax
  */
@@ -16,6 +16,12 @@
 	
 	D(printk("dma_memcpy %d bytes... ", pn));
 
+#if 0
+	*R_GEN_CONFIG = genconfig_shadow = 
+		(genconfig_shadow & ~0x3c0000) |
+		IO_STATE(R_GEN_CONFIG, dma6, intdma7) |
+		IO_STATE(R_GEN_CONFIG, dma7, intdma6);
+#endif
 	indma.sw_len = outdma.sw_len = pn;
 	indma.ctrl = d_eol | d_eop;
 	outdma.ctrl = d_eol;
diff -ruN linux-2.4.20-WRT/arch/cris/lib/dram_init.S linux-2.4.20-WRTstp/arch/cris/lib/dram_init.S
--- linux-2.4.20-WRT/arch/cris/lib/dram_init.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/dram_init.S	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: dram_init.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: dram_init.S,v 1.12 2002/08/09 11:37:37 orjanf Exp $
  * 
  * DRAM/SDRAM initialization - alter with care
  * This file is intended to be included from other assembler files
@@ -11,12 +11,6 @@
  * Authors:  Mikael Starvik (starvik@axis.com)	
  * 
  * $Log: dram_init.S,v $
- * Revision 1.1.1.4  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.12  2002/08/09 11:37:37  orjanf
  * Added double initialization work-around for Samsung SDRAMs.
  *
diff -ruN linux-2.4.20-WRT/arch/cris/lib/hw_settings.S linux-2.4.20-WRTstp/arch/cris/lib/hw_settings.S
--- linux-2.4.20-WRT/arch/cris/lib/hw_settings.S	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/hw_settings.S	2005-11-08 06:24:34.000000000 -0800
@@ -1,5 +1,5 @@
 /*
- * $Id: hw_settings.S,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+ * $Id: hw_settings.S,v 1.4 2002/07/04 16:58:56 pkj Exp $
  * 
  * This table is used by some tools to extract hardware parameters.
  * The table should be included in the kernel and the decompressor.
diff -ruN linux-2.4.20-WRT/arch/cris/lib/old_checksum.c linux-2.4.20-WRTstp/arch/cris/lib/old_checksum.c
--- linux-2.4.20-WRT/arch/cris/lib/old_checksum.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/old_checksum.c	2001-02-08 16:32:44.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: old_checksum.c,v 1.1.1.4 2003/10/14 08:07:17 sparq Exp $
+/* $Id: old_checksum.c,v 1.1 2000/07/10 16:25:21 bjornw Exp $
  *
  * INET		An implementation of the TCP/IP protocol suite for the LINUX
  *		operating system.  INET is implemented using the  BSD Socket
@@ -24,6 +24,10 @@
 
 #ifdef PROFILE_CHECKSUM
 /* these are just for profiling the checksum code with an oscillioscope.. uh */
+#if 0
+#define BITOFF *((unsigned char *)0xb0000030) = 0xff
+#define BITON *((unsigned char *)0xb0000030) = 0x0
+#endif
 #include <asm/io.h>
 #define CBITON LED_ACTIVE_SET(1)
 #define CBITOFF LED_ACTIVE_SET(0)
@@ -50,6 +54,11 @@
    */
   const unsigned char *endMarker = buff + len;
   const unsigned char *marker = endMarker - (len % 16);
+#if 0
+  if((int)buff & 0x3)
+    printk("unaligned buff %p\n", buff);
+  __delay(900); /* extra delay of 90 us to test performance hit */
+#endif
   BITON;
   while (buff < marker) {
     sum += *((unsigned short *)buff)++;
@@ -72,3 +81,47 @@
   return(sum);
 }
 
+#if 0
+
+/*
+ * copy while checksumming, otherwise like csum_partial
+ */
+
+unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, 
+				  int len, unsigned int sum)
+{
+  const unsigned char *endMarker;
+  const unsigned char *marker;
+  printk("csum_partial_copy len %d.\n", len);
+#if 0
+  if((int)src & 0x3)
+    printk("unaligned src %p\n", src);
+  if((int)dst & 0x3)
+    printk("unaligned dst %p\n", dst);
+  __delay(1800); /* extra delay of 90 us to test performance hit */
+#endif
+  endMarker = src + len;
+  marker = endMarker - (len % 16);
+  CBITON;
+  while(src < marker) {
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+  }
+  marker = endMarker - (len % 2);
+  while(src < marker) {
+    sum += (*((unsigned short *)dst)++ = *((unsigned short *)src)++);
+  }
+  if(endMarker - src > 0) {
+    sum += (*dst = *src);                 /* add extra byte seperately */
+  }
+  CBITOFF;
+  return(sum);
+}
+
+#endif
diff -ruN linux-2.4.20-WRT/arch/cris/lib/usercopy.c linux-2.4.20-WRTstp/arch/cris/lib/usercopy.c
--- linux-2.4.20-WRT/arch/cris/lib/usercopy.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/lib/usercopy.c	2001-10-08 11:43:54.000000000 -0700
@@ -33,6 +33,13 @@
 unsigned long
 __copy_user (void *pdst, const void *psrc, unsigned long pn)
 {
+  /* We want the parameters put in special registers.
+     Make sure the compiler is able to make something useful of this.
+     As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
+
+     FIXME: Comment for old gcc version.  Check.
+     If gcc was allright, it really would need no temporaries, and no
+     stack space to save stuff on. */
 
   register char *dst __asm__ ("r13") = pdst;
   register const char *src __asm__ ("r11") = psrc;
@@ -155,6 +162,8 @@
     n -= 16;
   }
 
+  /* Having a separate by-four loops cuts down on cache footprint.
+     FIXME:  Test with and without; increasing switch to be 0..15.  */
   while (n >= 4)
   {
     __asm_copy_to_user_4 (dst, src, retn);
@@ -185,6 +194,13 @@
 unsigned long
 __copy_user_zeroing (void *pdst, const void *psrc, unsigned long pn)
 {
+  /* We want the parameters put in special registers.
+     Make sure the compiler is able to make something useful of this.
+     As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
+
+     FIXME: Comment for old gcc version.  Check.
+     If gcc was allright, it really would need no temporaries, and no
+     stack space to save stuff on.  */
 
   register char *dst __asm__ ("r13") = pdst;
   register const char *src __asm__ ("r11") = psrc;
@@ -346,6 +362,8 @@
     n -= 16;
   }
 
+  /* Having a separate by-four loops cuts down on cache footprint.
+     FIXME:  Test with and without; increasing switch to be 0..15.  */
   while (n >= 4)
   {
     __asm_copy_from_user_4 (dst, src, retn);
@@ -375,6 +393,13 @@
 unsigned long
 __do_clear_user (void *pto, unsigned long pn)
 {
+  /* We want the parameters put in special registers.
+     Make sure the compiler is able to make something useful of this.
+      As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
+
+     FIXME: Comment for old gcc version.  Check.
+     If gcc was allright, it really would need no temporaries, and no
+     stack space to save stuff on. */
 
   register char *dst __asm__ ("r13") = pto;
   register int n __asm__ ("r12") = pn;
@@ -398,6 +423,8 @@
     }
   }
 
+  /* Decide which copying method to use.
+     FIXME: This number is from the "ordinary" kernel memset.  */
   if (n >= (1*48))
   {
     /* For large clears we use 'movem' */
@@ -487,6 +514,8 @@
     n -= 16;
   }
 
+  /* Having a separate by-four loops cuts down on cache footprint.
+     FIXME:  Test with and without; increasing switch to be 0..15.  */
   while (n >= 4)
   {
     __asm_clear_4 (dst, retn);
diff -ruN linux-2.4.20-WRT/arch/cris/Makefile linux-2.4.20-WRTstp/arch/cris/Makefile
--- linux-2.4.20-WRT/arch/cris/Makefile	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/Makefile	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1.1.4 2003/10/14 08:07:16 sparq Exp $
+# $Id: Makefile,v 1.27 2002/03/08 13:08:50 bjornw Exp $
 # cris/Makefile
 #
 # This file is included by the global makefile so that you can add your own
diff -ruN linux-2.4.20-WRT/arch/cris/mm/extable.c linux-2.4.20-WRTstp/arch/cris/mm/extable.c
--- linux-2.4.20-WRT/arch/cris/mm/extable.c	2003-10-14 01:07:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/mm/extable.c	2005-11-08 06:23:46.000000000 -0800
@@ -2,12 +2,6 @@
  * linux/arch/cris/mm/extable.c
  *
  * $Log: extable.c,v $
- * Revision 1.1.1.2  2003/10/14 08:07:17  sparq
- * Broadcom Release 3.51.8.0 for BCM4712.
- *
- * Revision 1.1.1.1  2003/02/03 22:37:20  mhuang
- * LINUX_2_4 branch snapshot from linux-mips.org CVS
- *
  * Revision 1.4  2002/03/19 15:21:10  bjornw
  * Fixed warning
  *
diff -ruN linux-2.4.20-WRT/arch/cris/mm/fault.c linux-2.4.20-WRTstp/arch/cris/mm/fault.c
--- linux-2.4.20-WRT/arch/cris/mm/fault.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/mm/fault.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,72 @@
-
+/*
+ *  linux/arch/cris/mm/fault.c
+ *
+ *  Copyright (C) 2000, 2001  Axis Communications AB
+ *
+ *  Authors:  Bjorn Wesen 
+ * 
+ *  $Log: fault.c,v $
+ *  Revision 1.21  2002/05/28 14:24:56  bjornw
+ *  Corrected typo
+ *
+ *  Revision 1.20  2001/11/22 13:34:06  bjornw
+ *  * Bug workaround (LX TR89): force a rerun of the whole of an interrupted
+ *    unaligned write, because the second half of the write will be corrupted
+ *    otherwise. Affected unaligned writes spanning not-yet mapped pages.
+ *  * Optimization: use the wr_rd bit in R_MMU_CAUSE to know whether a miss
+ *    was due to a read or a write (before we didn't know this until the next
+ *    restart of the interrupted instruction, thus wasting one fault-irq)
+ *
+ *  Revision 1.19  2001/11/12 19:02:10  pkj
+ *  Fixed compiler warnings.
+ *
+ *  Revision 1.18  2001/07/18 22:14:32  bjornw
+ *  Enable interrupts in the bulk of do_page_fault
+ *
+ *  Revision 1.17  2001/07/18 13:07:23  bjornw
+ *  * Detect non-existant PTE's in vmalloc pmd synchronization
+ *  * Remove comment about fast-paths for VMALLOC_START etc, because all that
+ *    was totally bogus anyway it turned out :)
+ *  * Fix detection of vmalloc-area synchronization
+ *  * Add some comments
+ *
+ *  Revision 1.16  2001/06/13 00:06:08  bjornw
+ *  current_pgd should be volatile
+ *
+ *  Revision 1.15  2001/06/13 00:02:23  bjornw
+ *  Use a separate variable to store the current pgd to avoid races in schedule
+ *
+ *  Revision 1.14  2001/05/16 17:41:07  hp
+ *  Last comment tweak further tweaked.
+ *
+ *  Revision 1.13  2001/05/15 00:58:44  hp
+ *  Expand a bit on the comment why we compare address >= TASK_SIZE rather
+ *  than >= VMALLOC_START.
+ *
+ *  Revision 1.12  2001/04/04 10:51:14  bjornw
+ *  mmap_sem is grabbed for reading
+ *
+ *  Revision 1.11  2001/03/23 07:36:07  starvik
+ *  Corrected according to review remarks
+ *
+ *  Revision 1.10  2001/03/21 16:10:11  bjornw
+ *  CRIS_FRAME_FIXUP not needed anymore, use FRAME_NORMAL
+ *
+ *  Revision 1.9  2001/03/05 13:22:20  bjornw
+ *  Spell-fix and fix in vmalloc_fault handling
+ *
+ *  Revision 1.8  2000/11/22 14:45:31  bjornw
+ *  * 2.4.0-test10 removed the set_pgdir instantaneous kernel global mapping
+ *    into all processes. Instead we fill in the missing PTE entries on demand.
+ *
+ *  Revision 1.7  2000/11/21 16:39:09  bjornw
+ *  fixup switches frametype
+ *
+ *  Revision 1.6  2000/11/17 16:54:08  bjornw
+ *  More detailed siginfo reporting
+ *
+ *
+ */
 
 #include <linux/signal.h>
 #include <linux/sched.h>
@@ -73,6 +141,18 @@
 	we      = IO_EXTRACT(R_MMU_CAUSE,  we_excp,   cause);
 	writeac = IO_EXTRACT(R_MMU_CAUSE,  wr_rd,     cause);
 
+	/* ETRAX 100LX TR89 bugfix: if the second half of an unaligned
+	 * write causes a MMU-fault, it will not be restarted correctly.
+	 * This could happen if a write crosses a page-boundary and the
+	 * second page is not yet COW'ed or even loaded. The workaround
+	 * is to clear the unaligned bit in the CPU status record, so 
+	 * that the CPU will rerun both the first and second halves of
+	 * the instruction. This will not have any sideeffects unless
+	 * the first half goes to any device or memory that can't be
+	 * written twice, and which is mapped through the MMU.
+	 *
+	 * We only need to do this for writes.
+	 */
 
 	if(writeac)
 		regs->csrinstr &= ~(1 << 5);
diff -ruN linux-2.4.20-WRT/arch/cris/mm/init.c linux-2.4.20-WRTstp/arch/cris/mm/init.c
--- linux-2.4.20-WRT/arch/cris/mm/init.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/mm/init.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,104 @@
-
+/*
+ *  linux/arch/cris/mm/init.c
+ *
+ *  Copyright (C) 1995  Linus Torvalds
+ *  Copyright (C) 2000,2001  Axis Communications AB
+ *
+ *  Authors:  Bjorn Wesen (bjornw@axis.com)
+ *
+ *  $Log: init.c,v $
+ *  Revision 1.35  2002/05/17 05:33:59  starvik
+ *  Limit cache flush range to the size of the cache
+ *
+ *  Revision 1.34  2002/04/22 11:48:51  johana
+ *  Added KERN_INFO (2.4.19-pre7)
+ *
+ *  Revision 1.33  2002/03/19 15:22:17  bjornw
+ *  Added flush_etrax_cache
+ *
+ *  Revision 1.32  2002/03/15 17:09:31  bjornw
+ *  Added prepare_rx_descriptor as a workaround for a bug
+ *
+ *  Revision 1.31  2001/11/13 16:22:00  bjornw
+ *  Skip calculating totalram and sharedram in si_meminfo
+ *
+ *  Revision 1.30  2001/11/12 19:02:10  pkj
+ *  Fixed compiler warnings.
+ *
+ *  Revision 1.29  2001/07/25 16:09:50  bjornw
+ *  val->sharedram will stay 0
+ *
+ *  Revision 1.28  2001/06/28 16:30:17  bjornw
+ *  Oops. This needs to wait until 2.4.6 is merged
+ *
+ *  Revision 1.27  2001/06/28 14:04:07  bjornw
+ *  Fill in sharedram
+ *
+ *  Revision 1.26  2001/06/18 06:36:02  hp
+ *  Enable free_initmem of __init-type pages
+ *
+ *  Revision 1.25  2001/06/13 00:02:23  bjornw
+ *  Use a separate variable to store the current pgd to avoid races in schedule
+ *
+ *  Revision 1.24  2001/05/15 00:52:20  hp
+ *  Only map segment 0xa as seg if CONFIG_JULIETTE
+ *
+ *  Revision 1.23  2001/04/04 14:35:40  bjornw
+ *  * Removed get_pte_slow and friends (2.4.3 change)
+ *  * Removed bad_pmd handling (2.4.3 change)
+ *
+ *  Revision 1.22  2001/04/04 13:38:04  matsfg
+ *  Moved ioremap to a separate function instead
+ *
+ *  Revision 1.21  2001/03/27 09:28:33  bjornw
+ *  ioremap used too early - lets try it in mem_init instead
+ *
+ *  Revision 1.20  2001/03/23 07:39:21  starvik
+ *  Corrected according to review remarks
+ *
+ *  Revision 1.19  2001/03/15 14:25:17  bjornw
+ *  More general shadow registers and ioremaped addresses for external I/O
+ *
+ *  Revision 1.18  2001/02/23 12:46:44  bjornw
+ *  * 0xc was not CSE1; 0x8 is, same as uncached flash, so we move the uncached
+ *    flash during CRIS_LOW_MAP from 0xe to 0x8 so both the flash and the I/O
+ *    is mapped straight over (for !CRIS_LOW_MAP the uncached flash is still 0xe)
+ *
+ *  Revision 1.17  2001/02/22 15:05:21  bjornw
+ *  Map 0x9 straight over during LOW_MAP to allow for memory mapped LEDs
+ *
+ *  Revision 1.16  2001/02/22 15:02:35  bjornw
+ *  Map 0xc straight over during LOW_MAP to allow for memory mapped I/O
+ *
+ *  Revision 1.15  2001/01/10 21:12:10  bjornw
+ *  loops_per_sec -> loops_per_jiffy
+ *
+ *  Revision 1.14  2000/11/22 16:23:20  bjornw
+ *  Initialize totalhigh counters to 0 to make /proc/meminfo look nice.
+ *
+ *  Revision 1.13  2000/11/21 16:37:51  bjornw
+ *  Temporarily disable initmem freeing
+ *
+ *  Revision 1.12  2000/11/21 13:55:07  bjornw
+ *  Use CONFIG_CRIS_LOW_MAP for the low VM map instead of explicit CPU type
+ *
+ *  Revision 1.11  2000/10/06 12:38:22  bjornw
+ *  Cast empty_bad_page correctly (should really be of * type from the start..
+ *
+ *  Revision 1.10  2000/10/04 16:53:57  bjornw
+ *  Fix memory-map due to LX features
+ *
+ *  Revision 1.9  2000/09/13 15:47:49  bjornw
+ *  Wrong count in reserved-pages loop
+ *
+ *  Revision 1.8  2000/09/13 14:35:10  bjornw
+ *  2.4.0-test8 added a new arg to free_area_init_node
+ *
+ *  Revision 1.7  2000/08/17 15:35:55  bjornw
+ *  2.4.0-test6 removed MAP_NR and inserted virt_to_page
+ *
+ *
+ */
 
 #include <linux/config.h>
 #include <linux/signal.h>
@@ -387,6 +487,13 @@
 	}
 }
 
+/* Due to a bug in Etrax100(LX) all versions, receiving DMA buffers
+ * will occationally corrupt certain CPU writes if the DMA buffers
+ * happen to be hot in the cache.
+ * 
+ * As a workaround, we have to flush the relevant parts of the cache
+ * before (re) inserting any receiving descriptor into the DMA HW.
+ */
 
 void
 prepare_rx_descriptor(struct etrax_dma_descr *desc)
diff -ruN linux-2.4.20-WRT/arch/cris/mm/ioremap.c linux-2.4.20-WRTstp/arch/cris/mm/ioremap.c
--- linux-2.4.20-WRT/arch/cris/mm/ioremap.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/mm/ioremap.c	2001-05-01 16:04:56.000000000 -0700
@@ -116,6 +116,30 @@
 	if (!size || last_addr < phys_addr)
 		return NULL;
 
+#if 0
+	/* TODO: Here we can put checks for driver-writer abuse...  */
+
+	/*
+	 * Don't remap the low PCI/ISA area, it's always mapped..
+	 */
+	if (phys_addr >= 0xA0000 && last_addr < 0x100000)
+		return phys_to_virt(phys_addr);
+
+	/*
+	 * Don't allow anybody to remap normal RAM that we're using..
+	 */
+	if (phys_addr < virt_to_phys(high_memory)) {
+		char *t_addr, *t_end;
+		struct page *page;
+
+		t_addr = __va(phys_addr);
+		t_end = t_addr + (size - 1);
+	   
+		for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
+			if(!PageReserved(page))
+				return NULL;
+	}
+#endif
 
 	/*
 	 * Mappings have to be page-aligned
diff -ruN linux-2.4.20-WRT/arch/cris/mm/tlb.c linux-2.4.20-WRTstp/arch/cris/mm/tlb.c
--- linux-2.4.20-WRT/arch/cris/mm/tlb.c	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/mm/tlb.c	2001-07-26 15:10:06.000000000 -0700
@@ -203,6 +203,24 @@
 
 /* dump the entire TLB for debug purposes */
 
+#if 0
+void
+dump_tlb_all(void)
+{
+	int i;
+	unsigned long flags;
+	
+	printk("TLB dump. LO is: pfn | reserved | global | valid | kernel | we  |\n");
+
+	save_and_cli(flags);
+	for(i = 0; i < NUM_TLB_ENTRIES; i++) {
+		*R_TLB_SELECT = ( IO_FIELD(R_TLB_SELECT, index, i) );
+		printk("Entry %d: HI 0x%08lx, LO 0x%08lx\n",
+		       i, *R_TLB_HI, *R_TLB_LO);
+	}
+	restore_flags(flags);
+}
+#endif
 
 /*
  * Initialize the context related info for a new mm_struct
diff -ruN linux-2.4.20-WRT/arch/cris/README.mm linux-2.4.20-WRTstp/arch/cris/README.mm
--- linux-2.4.20-WRT/arch/cris/README.mm	2003-10-14 01:07:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/cris/README.mm	2001-02-08 16:32:44.000000000 -0800
@@ -3,12 +3,6 @@
 HISTORY:
 
 $Log: README.mm,v $
-Revision 1.1.1.2  2003/10/14 08:07:16  sparq
-Broadcom Release 3.51.8.0 for BCM4712.
-
-Revision 1.1.1.1  2003/02/03 22:37:19  mhuang
-LINUX_2_4 branch snapshot from linux-mips.org CVS
-
 Revision 1.1  2000/07/10 16:25:21  bjornw
 Initial revision
 
diff -ruN linux-2.4.20-WRT/arch/i386/boot/bootsect.S linux-2.4.20-WRTstp/arch/i386/boot/bootsect.S
--- linux-2.4.20-WRT/arch/i386/boot/bootsect.S	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/boot/bootsect.S	2001-11-09 13:58:02.000000000 -0800
@@ -395,9 +395,15 @@
 # NOTE: Doesn't save %ax or %dx; do it yourself if you need to.
 
 kill_motor:
+#if 1
 	xorw	%ax, %ax		# reset FDC
 	xorb	%dl, %dl
 	int	$0x13
+#else
+	movw	$0x3f2, %dx
+	xorb	%al, %al
+	outb	%al, %dx
+#endif
 	ret
 
 sectors:	.word 0
diff -ruN linux-2.4.20-WRT/arch/i386/boot/compressed/head.S linux-2.4.20-WRTstp/arch/i386/boot/compressed/head.S
--- linux-2.4.20-WRT/arch/i386/boot/compressed/head.S	2003-07-04 01:11:03.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/boot/compressed/head.S	2000-07-05 12:03:12.000000000 -0700
@@ -44,6 +44,11 @@
 	cmpl %eax,0x100000
 	je 1b
 
+/*
+ * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
+ * confuse the debugger if this code is traced.
+ * XXX - best to initialize before switching to protected mode.
+ */
 	pushl $0
 	popfl
 /*
diff -ruN linux-2.4.20-WRT/arch/i386/boot/tools/build.c linux-2.4.20-WRTstp/arch/i386/boot/tools/build.c
--- linux-2.4.20-WRT/arch/i386/boot/tools/build.c	2003-10-14 01:07:18.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/boot/tools/build.c	2001-07-02 13:56:40.000000000 -0700
@@ -1,5 +1,5 @@
 /*
- *  $Id: build.c,v 1.1.1.4 2003/10/14 08:07:18 sparq Exp $
+ *  $Id: build.c,v 1.5 1997/05/19 12:29:58 mj Exp $
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
  *  Copyright (C) 1997 Martin Mares
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/acpitable.c linux-2.4.20-WRTstp/arch/i386/kernel/acpitable.c
--- linux-2.4.20-WRT/arch/i386/kernel/acpitable.c	2003-10-14 01:07:18.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/acpitable.c	2005-11-08 06:23:46.000000000 -0800
@@ -25,7 +25,7 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
- * $Id: acpitable.c,v 1.1.1.4 2003/10/14 08:07:18 sparq Exp $
+ * $Id: acpitable.c,v 1.7 2001/11/04 12:21:18 fenrus Exp $
  */
 #include <linux/config.h>
 #include <linux/kernel.h>
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/acpitable.h linux-2.4.20-WRTstp/arch/i386/kernel/acpitable.h
--- linux-2.4.20-WRT/arch/i386/kernel/acpitable.h	2003-10-14 01:07:18.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/acpitable.h	2001-11-11 19:04:33.000000000 -0800
@@ -25,7 +25,7 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  *
- * $Id: acpitable.h,v 1.1.1.4 2003/10/14 08:07:18 sparq Exp $
+ * $Id: acpitable.h,v 1.3 2001/11/03 22:41:34 fenrus Exp $
  */
 
 /*
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/apic.c linux-2.4.20-WRTstp/arch/i386/kernel/apic.c
--- linux-2.4.20-WRT/arch/i386/kernel/apic.c	2003-10-14 01:00:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/apic.c	2006-06-12 18:05:27.000000000 -0700
@@ -345,8 +345,13 @@
 	 * like LRU than MRU (the short-term load is more even across CPUs).
 	 * See also the comment in end_level_ioapic_irq().  --macro
 	 */
+#if 1
 	/* Enable focus processor (bit==0) */
 	value &= ~APIC_SPIV_FOCUS_DISABLED;
+#else
+	/* Disable focus processor (bit==1) */
+	value |= APIC_SPIV_FOCUS_DISABLED;
+#endif
 	/*
 	 * Set spurious IRQ vector
 	 */
@@ -587,6 +592,7 @@
 	if (dont_enable_local_apic)
 		return -1;
 
+	/* Workaround for us being called before identify_cpu(). */
 	get_cpu_vendor(&boot_cpu_data);
 
 	switch (boot_cpu_data.x86_vendor) {
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/apm.c linux-2.4.20-WRTstp/arch/i386/kernel/apm.c
--- linux-2.4.20-WRT/arch/i386/kernel/apm.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/apm.c	2005-11-08 06:24:34.000000000 -0800
@@ -257,6 +257,22 @@
  *                                      calculated.
  */
 
+/* KNOWN PROBLEM MACHINES:
+ *
+ * U: TI 4000M TravelMate: BIOS is *NOT* APM compliant
+ *                         [Confirmed by TI representative]
+ * ?: ACER 486DX4/75: uses dseg 0040, in violation of APM specification
+ *                    [Confirmed by BIOS disassembly]
+ *                    [This may work now ...]
+ * P: Toshiba 1950S: battery life information only gets updated after resume
+ * P: Midwest Micro Soundbook Elite DX2/66 monochrome: screen blanking
+ * 	broken in BIOS [Reported by Garst R. Reese <reese@isn.net>]
+ * ?: AcerNote-950: oops on reading /proc/apm - workaround is a WIP
+ * 	Neale Banks <neale@lowendale.com.au> December 2000
+ *
+ * Legend: U = unusable with APM patches
+ *         P = partially usable with APM patches
+ */
 
 /*
  * Define as 1 to make the driver always call the APM BIOS busy
@@ -973,6 +989,34 @@
 	return APM_SUCCESS;
 }
 
+#if 0
+static int apm_get_battery_status(u_short which, u_short *status,
+				  u_short *bat, u_short *life, u_short *nbat)
+{
+	u32	eax;
+	u32	ebx;
+	u32	ecx;
+	u32	edx;
+	u32	esi;
+
+	if (apm_info.connection_version < 0x0102) {
+		/* pretend we only have one battery. */
+		if (which != 1)
+			return APM_BAD_DEVICE;
+		*nbat = 1;
+		return apm_get_power_status(status, bat, life);
+	}
+
+	if (apm_bios_call(APM_FUNC_GET_STATUS, (0x8000 | (which)), 0, &eax,
+			&ebx, &ecx, &edx, &esi))
+		return (eax >> 8) & 0xff;
+	*status = ebx;
+	*bat = ecx;
+	*life = edx;
+	*nbat = esi;
+	return APM_SUCCESS;
+}
+#endif
 
 /**
  *	apm_engage_power_management	-	enable PM on a device
@@ -1495,6 +1539,13 @@
 	as->event_tail = as->event_head = 0;
 	as->suspends_pending = as->standbys_pending = 0;
 	as->suspends_read = as->standbys_read = 0;
+	/*
+	 * XXX - this is a tiny bit broken, when we consider BSD
+         * process accounting. If the device is opened by root, we
+	 * instantly flag that we used superuser privs. Who knows,
+	 * we might close the device immediately without doing a
+	 * privileged operation -- cevans
+	 */
 	as->suser = capable(CAP_SYS_ADMIN);
 	as->writer = (filp->f_mode & FMODE_WRITE) == FMODE_WRITE;
 	as->reader = (filp->f_mode & FMODE_READ) == FMODE_READ;
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/cpuid.c linux-2.4.20-WRTstp/arch/i386/kernel/cpuid.c
--- linux-2.4.20-WRT/arch/i386/kernel/cpuid.c	2003-10-14 01:07:18.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/cpuid.c	2001-10-11 09:04:57.000000000 -0700
@@ -1,4 +1,4 @@
-#ident "$Id: cpuid.c,v 1.1.1.4 2003/10/14 08:07:18 sparq Exp $"
+#ident "$Id$"
 /* ----------------------------------------------------------------------- *
  *   
  *   Copyright 2000 H. Peter Anvin - All Rights Reserved
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/dmi_scan.c linux-2.4.20-WRTstp/arch/i386/kernel/dmi_scan.c
--- linux-2.4.20-WRT/arch/i386/kernel/dmi_scan.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/dmi_scan.c	2005-11-08 06:24:34.000000000 -0800
@@ -523,6 +523,12 @@
  */
  
 static __initdata struct dmi_blacklist dmi_blacklist[]={
+#if 0
+	{ disable_ide_dma, "KT7", {	/* Overbroad right now - kill DMA on problem KT7 boards */
+			MATCH(DMI_PRODUCT_NAME, "KT7-RAID"),
+			NO_MATCH, NO_MATCH, NO_MATCH
+			} },
+#endif			
 	{ broken_ps2_resume, "Dell Latitude C600", {	/* Handle problems with APM on the C600 */
 		        MATCH(DMI_SYS_VENDOR, "Dell"),
 			MATCH(DMI_PRODUCT_NAME, "Latitude C600"),
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/head.S linux-2.4.20-WRTstp/arch/i386/kernel/head.S
--- linux-2.4.20-WRT/arch/i386/kernel/head.S	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/head.S	2005-11-08 06:23:46.000000000 -0800
@@ -131,6 +131,11 @@
  * in 16-bit mode for the "real" operations.
  */
 	call setup_idt
+/*
+ * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
+ * confuse the debugger if this code is traced.
+ * XXX - best to initialize before switching to protected mode.
+ */
 	pushl $0
 	popfl
 /*
@@ -167,6 +172,11 @@
 	movl $-1,X86_CPUID		#  -1 for no CPUID initially
 
 /* check if it is 486 or 386. */
+/*
+ * XXX - this does a lot of unnecessary setup.  Alignment checks don't
+ * apply at our cpl of 0 and the stack ought to be aligned already, and
+ * we don't need to preserve eflags.
+ */
 
 	movb $3,X86		# at least 386
 	pushfl			# push EFLAGS
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/io_apic.c linux-2.4.20-WRTstp/arch/i386/kernel/io_apic.c
--- linux-2.4.20-WRT/arch/i386/kernel/io_apic.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/io_apic.c	2005-11-08 06:24:34.000000000 -0800
@@ -1253,6 +1253,25 @@
 	unsigned long v;
 	int i;
 
+/*
+ * It appears there is an erratum which affects at least version 0x11
+ * of I/O APIC (that's the 82093AA and cores integrated into various
+ * chipsets).  Under certain conditions a level-triggered interrupt is
+ * erroneously delivered as edge-triggered one but the respective IRR
+ * bit gets set nevertheless.  As a result the I/O unit expects an EOI
+ * message but it will never arrive and further interrupts are blocked
+ * from the source.  The exact reason is so far unknown, but the
+ * phenomenon was observed when two consecutive interrupt requests
+ * from a given source get delivered to the same CPU and the source is
+ * temporarily disabled in between.
+ *
+ * A workaround is to simulate an EOI message manually.  We achieve it
+ * by setting the trigger mode to edge and then to level when the edge
+ * trigger mode gets detected in the TMR of a local APIC for a
+ * level-triggered interrupt.  We mask the source for the time of the
+ * operation to prevent an edge-triggered interrupt escaping meanwhile.
+ * The idea is from Manfred Spraul.  --macro
+ */
 	i = IO_APIC_VECTOR(irq);
 	v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/irq.c linux-2.4.20-WRTstp/arch/i386/kernel/irq.c
--- linux-2.4.20-WRT/arch/i386/kernel/irq.c	2003-10-14 01:00:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/irq.c	2006-06-12 18:05:27.000000000 -0700
@@ -697,6 +697,7 @@
 	int retval;
 	struct irqaction * action;
 
+#if 1
 	/*
 	 * Sanity-check: shared interrupts should REALLY pass in
 	 * a real dev-ID, otherwise we'll have trouble later trying
@@ -707,6 +708,7 @@
 		if (!dev_id)
 			printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
 	}
+#endif
 
 	if (irq >= NR_IRQS)
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/mca.c linux-2.4.20-WRTstp/arch/i386/kernel/mca.c
--- linux-2.4.20-WRT/arch/i386/kernel/mca.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/mca.c	2000-08-24 12:52:32.000000000 -0700
@@ -704,6 +704,16 @@
 
 EXPORT_SYMBOL(mca_is_adapter_used);
 
+/**
+ *	mca_mark_as_used - claim an MCA device
+ *	@slot:	slot to claim
+ *	FIXME:  should we make this threadsafe
+ *
+ *	Claim an MCA slot for a device driver. If the
+ *	slot is already taken the function returns 1,
+ *	if it is not taken it is claimed and 0 is
+ *	returned.
+ */
 
 int mca_mark_as_used(int slot)
 {
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/mpparse.c linux-2.4.20-WRTstp/arch/i386/kernel/mpparse.c
--- linux-2.4.20-WRT/arch/i386/kernel/mpparse.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/mpparse.c	2005-11-08 06:24:34.000000000 -0800
@@ -788,6 +788,14 @@
 {
 	unsigned int address;
 
+	/*
+	 * FIXME: Linux assumes you have 640K of base ram..
+	 * this continues the error...
+	 *
+	 * 1) Scan the bottom 1K for a signature
+	 * 2) Scan the top 1K of base RAM
+	 * 3) Scan the 64K of bios
+	 */
 	if (smp_scan_config(0x0,0x400) ||
 		smp_scan_config(639*0x400,0x400) ||
 			smp_scan_config(0xF0000,0x10000))
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/msr.c linux-2.4.20-WRTstp/arch/i386/kernel/msr.c
--- linux-2.4.20-WRT/arch/i386/kernel/msr.c	2003-10-14 01:07:18.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/msr.c	2001-10-11 09:04:57.000000000 -0700
@@ -1,4 +1,4 @@
-#ident "$Id: msr.c,v 1.1.1.4 2003/10/14 08:07:18 sparq Exp $"
+#ident "$Id$"
 /* ----------------------------------------------------------------------- *
  *   
  *   Copyright 2000 H. Peter Anvin - All Rights Reserved
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/mtrr.c linux-2.4.20-WRTstp/arch/i386/kernel/mtrr.c
--- linux-2.4.20-WRT/arch/i386/kernel/mtrr.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/mtrr.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,251 @@
+/*  Generic MTRR (Memory Type Range Register) driver.
 
+    Copyright (C) 1997-2000  Richard Gooch
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    Richard Gooch may be reached by email at  rgooch@atnf.csiro.au
+    The postal address is:
+      Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
+
+    Source: "Pentium Pro Family Developer's Manual, Volume 3:
+    Operating System Writer's Guide" (Intel document number 242692),
+    section 11.11.7
+
+    ChangeLog
+
+    Prehistory Martin Tischhäuser <martin@ikcbarka.fzk.de>
+	       Initial register-setting code (from proform-1.0).
+    19971216   Richard Gooch <rgooch@atnf.csiro.au>
+               Original version for /proc/mtrr interface, SMP-safe.
+  v1.0
+    19971217   Richard Gooch <rgooch@atnf.csiro.au>
+               Bug fix for ioctls()'s.
+	       Added sample code in Documentation/mtrr.txt
+  v1.1
+    19971218   Richard Gooch <rgooch@atnf.csiro.au>
+               Disallow overlapping regions.
+    19971219   Jens Maurer <jmaurer@menuett.rhein-main.de>
+               Register-setting fixups.
+  v1.2
+    19971222   Richard Gooch <rgooch@atnf.csiro.au>
+               Fixups for kernel 2.1.75.
+  v1.3
+    19971229   David Wragg <dpw@doc.ic.ac.uk>
+               Register-setting fixups and conformity with Intel conventions.
+    19971229   Richard Gooch <rgooch@atnf.csiro.au>
+               Cosmetic changes and wrote this ChangeLog ;-)
+    19980106   Richard Gooch <rgooch@atnf.csiro.au>
+               Fixups for kernel 2.1.78.
+  v1.4
+    19980119   David Wragg <dpw@doc.ic.ac.uk>
+               Included passive-release enable code (elsewhere in PCI setup).
+  v1.5
+    19980131   Richard Gooch <rgooch@atnf.csiro.au>
+               Replaced global kernel lock with private spinlock.
+  v1.6
+    19980201   Richard Gooch <rgooch@atnf.csiro.au>
+               Added wait for other CPUs to complete changes.
+  v1.7
+    19980202   Richard Gooch <rgooch@atnf.csiro.au>
+               Bug fix in definition of <set_mtrr> for UP.
+  v1.8
+    19980319   Richard Gooch <rgooch@atnf.csiro.au>
+               Fixups for kernel 2.1.90.
+    19980323   Richard Gooch <rgooch@atnf.csiro.au>
+               Move SMP BIOS fixup before secondary CPUs call <calibrate_delay>
+  v1.9
+    19980325   Richard Gooch <rgooch@atnf.csiro.au>
+               Fixed test for overlapping regions: confused by adjacent regions
+    19980326   Richard Gooch <rgooch@atnf.csiro.au>
+               Added wbinvd in <set_mtrr_prepare>.
+    19980401   Richard Gooch <rgooch@atnf.csiro.au>
+               Bug fix for non-SMP compilation.
+    19980418   David Wragg <dpw@doc.ic.ac.uk>
+               Fixed-MTRR synchronisation for SMP and use atomic operations
+	       instead of spinlocks.
+    19980418   Richard Gooch <rgooch@atnf.csiro.au>
+	       Differentiate different MTRR register classes for BIOS fixup.
+  v1.10
+    19980419   David Wragg <dpw@doc.ic.ac.uk>
+	       Bug fix in variable MTRR synchronisation.
+  v1.11
+    19980419   Richard Gooch <rgooch@atnf.csiro.au>
+	       Fixups for kernel 2.1.97.
+  v1.12
+    19980421   Richard Gooch <rgooch@atnf.csiro.au>
+	       Safer synchronisation across CPUs when changing MTRRs.
+  v1.13
+    19980423   Richard Gooch <rgooch@atnf.csiro.au>
+	       Bugfix for SMP systems without MTRR support.
+  v1.14
+    19980427   Richard Gooch <rgooch@atnf.csiro.au>
+	       Trap calls to <mtrr_add> and <mtrr_del> on non-MTRR machines.
+  v1.15
+    19980427   Richard Gooch <rgooch@atnf.csiro.au>
+	       Use atomic bitops for setting SMP change mask.
+  v1.16
+    19980428   Richard Gooch <rgooch@atnf.csiro.au>
+	       Removed spurious diagnostic message.
+  v1.17
+    19980429   Richard Gooch <rgooch@atnf.csiro.au>
+	       Moved register-setting macros into this file.
+	       Moved setup code from init/main.c to i386-specific areas.
+  v1.18
+    19980502   Richard Gooch <rgooch@atnf.csiro.au>
+	       Moved MTRR detection outside conditionals in <mtrr_init>.
+  v1.19
+    19980502   Richard Gooch <rgooch@atnf.csiro.au>
+	       Documentation improvement: mention Pentium II and AGP.
+  v1.20
+    19980521   Richard Gooch <rgooch@atnf.csiro.au>
+	       Only manipulate interrupt enable flag on local CPU.
+	       Allow enclosed uncachable regions.
+  v1.21
+    19980611   Richard Gooch <rgooch@atnf.csiro.au>
+	       Always define <main_lock>.
+  v1.22
+    19980901   Richard Gooch <rgooch@atnf.csiro.au>
+	       Removed module support in order to tidy up code.
+	       Added sanity check for <mtrr_add>/<mtrr_del> before <mtrr_init>.
+	       Created addition queue for prior to SMP commence.
+  v1.23
+    19980902   Richard Gooch <rgooch@atnf.csiro.au>
+	       Ported patch to kernel 2.1.120-pre3.
+  v1.24
+    19980910   Richard Gooch <rgooch@atnf.csiro.au>
+	       Removed sanity checks and addition queue: Linus prefers an OOPS.
+  v1.25
+    19981001   Richard Gooch <rgooch@atnf.csiro.au>
+	       Fixed harmless compiler warning in include/asm-i386/mtrr.h
+	       Fixed version numbering and history for v1.23 -> v1.24.
+  v1.26
+    19990118   Richard Gooch <rgooch@atnf.csiro.au>
+	       Added devfs support.
+  v1.27
+    19990123   Richard Gooch <rgooch@atnf.csiro.au>
+	       Changed locking to spin with reschedule.
+	       Made use of new <smp_call_function>.
+  v1.28
+    19990201   Zoltán Böszörményi <zboszor@mail.externet.hu>
+	       Extended the driver to be able to use Cyrix style ARRs.
+    19990204   Richard Gooch <rgooch@atnf.csiro.au>
+	       Restructured Cyrix support.
+  v1.29
+    19990204   Zoltán Böszörményi <zboszor@mail.externet.hu>
+	       Refined ARR support: enable MAPEN in set_mtrr_prepare()
+	       and disable MAPEN in set_mtrr_done().
+    19990205   Richard Gooch <rgooch@atnf.csiro.au>
+	       Minor cleanups.
+  v1.30
+    19990208   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Protect plain 6x86s (and other processors without the
+               Page Global Enable feature) against accessing CR4 in
+               set_mtrr_prepare() and set_mtrr_done().
+    19990210   Richard Gooch <rgooch@atnf.csiro.au>
+	       Turned <set_mtrr_up> and <get_mtrr> into function pointers.
+  v1.31
+    19990212   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Major rewrite of cyrix_arr_init(): do not touch ARRs,
+               leave them as the BIOS have set them up.
+               Enable usage of all 8 ARRs.
+               Avoid multiplications by 3 everywhere and other
+               code clean ups/speed ups.
+    19990213   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Set up other Cyrix processors identical to the boot cpu.
+               Since Cyrix don't support Intel APIC, this is l'art pour l'art.
+               Weigh ARRs by size:
+               If size <= 32M is given, set up ARR# we were given.
+               If size >  32M is given, set up ARR7 only if it is free,
+               fail otherwise.
+    19990214   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Also check for size >= 256K if we are to set up ARR7,
+               mtrr_add() returns the value it gets from set_mtrr()
+    19990218   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Remove Cyrix "coma bug" workaround from here.
+               Moved to linux/arch/i386/kernel/setup.c and
+               linux/include/asm-i386/bugs.h
+    19990228   Richard Gooch <rgooch@atnf.csiro.au>
+	       Added MTRRIOC_KILL_ENTRY ioctl(2)
+	       Trap for counter underflow in <mtrr_file_del>.
+	       Trap for 4 MiB aligned regions for PPro, stepping <= 7.
+    19990301   Richard Gooch <rgooch@atnf.csiro.au>
+	       Created <get_free_region> hook.
+    19990305   Richard Gooch <rgooch@atnf.csiro.au>
+	       Temporarily disable AMD support now MTRR capability flag is set.
+  v1.32
+    19990308   Zoltán Böszörményi <zboszor@mail.externet.hu>
+	       Adjust my changes (19990212-19990218) to Richard Gooch's
+	       latest changes. (19990228-19990305)
+  v1.33
+    19990309   Richard Gooch <rgooch@atnf.csiro.au>
+	       Fixed typo in <printk> message.
+    19990310   Richard Gooch <rgooch@atnf.csiro.au>
+	       Support K6-II/III based on Alan Cox's <alan@redhat.com> patches.
+  v1.34
+    19990511   Bart Hartgers <bart@etpmod.phys.tue.nl>
+	       Support Centaur C6 MCR's.
+    19990512   Richard Gooch <rgooch@atnf.csiro.au>
+	       Minor cleanups.
+  v1.35
+    19990707   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Check whether ARR3 is protected in cyrix_get_free_region()
+               and mtrr_del(). The code won't attempt to delete or change it
+               from now on if the BIOS protected ARR3. It silently skips ARR3
+               in cyrix_get_free_region() or returns with an error code from
+               mtrr_del().
+    19990711   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Reset some bits in the CCRs in cyrix_arr_init() to disable SMM
+               if ARR3 isn't protected. This is needed because if SMM is active
+               and ARR3 isn't protected then deleting and setting ARR3 again
+               may lock up the processor. With SMM entirely disabled, it does
+               not happen.
+    19990812   Zoltán Böszörményi <zboszor@mail.externet.hu>
+               Rearrange switch() statements so the driver accomodates to
+               the fact that the AMD Athlon handles its MTRRs the same way
+               as Intel does.
+    19990814   Zoltán Böszörményi <zboszor@mail.externet.hu>
+	       Double check for Intel in mtrr_add()'s big switch() because
+	       that revision check is only valid for Intel CPUs.
+    19990819   Alan Cox <alan@redhat.com>
+               Tested Zoltan's changes on a pre production Athlon - 100%
+               success.
+    19991008   Manfred Spraul <manfreds@colorfullife.com>
+    	       replaced spin_lock_reschedule() with a normal semaphore.
+  v1.36
+    20000221   Richard Gooch <rgooch@atnf.csiro.au>
+               Compile fix if procfs and devfs not enabled.
+	       Formatting changes.
+  v1.37
+    20001109   H. Peter Anvin <hpa@zytor.com>
+	       Use the new centralized CPU feature detects.
+
+  v1.38
+    20010309   Dave Jones <davej@suse.de>
+	       Add support for Cyrix III.
+
+  v1.39
+    20010312   Dave Jones <davej@suse.de>
+               Ugh, I broke AMD support.
+	       Reworked fix by Troels Walsted Hansen <troels@thule.no>
+
+  v1.40
+    20010327   Dave Jones <davej@suse.de>
+	       Adapted Cyrix III support to include VIA C3.
+
+*/
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -1055,6 +1302,9 @@
     case MTRR_IF_CENTAUR_MCR:
         if ( mtrr_if == MTRR_IF_CENTAUR_MCR )
 	{
+	    /*
+	     *	FIXME: Winchip2 supports uncached
+	     */
 	    if (type != MTRR_TYPE_WRCOMB && (centaur_mcr_type == 0 || type != MTRR_TYPE_UNCACHABLE))
 	    {
 		printk (KERN_WARNING "mtrr: only write-combining%s supported\n",
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/pci-irq.c linux-2.4.20-WRTstp/arch/i386/kernel/pci-irq.c
--- linux-2.4.20-WRT/arch/i386/kernel/pci-irq.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/pci-irq.c	2005-11-08 06:24:34.000000000 -0800
@@ -207,6 +207,11 @@
 	return 1;
 }
 
+/*
+ * ITE 8330G pirq rules are nibble-based
+ * FIXME: pirqmap may be { 1, 0, 3, 2 },
+ * 	  2+3 are both mapped to irq 9 on my system
+ */
 static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
 	static unsigned char pirqmap[4] = { 1, 0, 2, 3 };
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/pci-visws.c linux-2.4.20-WRTstp/arch/i386/kernel/pci-visws.c
--- linux-2.4.20-WRT/arch/i386/kernel/pci-visws.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/pci-visws.c	2005-11-08 06:24:34.000000000 -0800
@@ -108,6 +108,12 @@
 	pci_read_bridge_bases(b);
 }
 
+#if 0
+static struct resource visws_pci_bus_resources[2] = {
+	{ "Host bus 1", 0xf4000000, 0xf7ffffff, 0 },
+	{ "Host bus 2", 0xf0000000, 0xf3ffffff, 0 }
+};
+#endif
 
 void __init pcibios_init(void)
 {
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/setup.c linux-2.4.20-WRTstp/arch/i386/kernel/setup.c
--- linux-2.4.20-WRT/arch/i386/kernel/setup.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/setup.c	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,77 @@
-
+/*
+ *  linux/arch/i386/kernel/setup.c
+ *
+ *  Copyright (C) 1995  Linus Torvalds
+ *
+ *  Enhanced CPU type detection by Mike Jagdis, Patrick St. Jean
+ *  and Martin Mares, November 1997.
+ *
+ *  Force Cyrix 6x86(MX) and M II processors to report MTRR capability
+ *  and Cyrix "coma bug" recognition by
+ *      Zoltán Böszörményi <zboszor@mail.externet.hu> February 1999.
+ * 
+ *  Force Centaur C6 processors to report MTRR capability.
+ *      Bart Hartgers <bart@etpmod.phys.tue.nl>, May 1999.
+ *
+ *  Intel Mobile Pentium II detection fix. Sean Gilley, June 1999.
+ *
+ *  IDT Winchip tweaks, misc clean ups.
+ *	Dave Jones <davej@suse.de>, August 1999
+ *
+ *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
+ *
+ *  Better detection of Centaur/IDT WinChip models.
+ *      Bart Hartgers <bart@etpmod.phys.tue.nl>, August 1999.
+ *
+ *  Memory region support
+ *	David Parsons <orc@pell.chi.il.us>, July-August 1999
+ *
+ *  Cleaned up cache-detection code
+ *	Dave Jones <davej@suse.de>, October 1999
+ *
+ *	Added proper L2 cache detection for Coppermine
+ *	Dragan Stancevic <visitor@valinux.com>, October 1999
+ *
+ *  Added the original array for capability flags but forgot to credit 
+ *  myself :) (~1998) Fixed/cleaned up some cpu_model_info and other stuff
+ *  	Jauder Ho <jauderho@carumba.com>, January 2000
+ *
+ *  Detection for Celeron coppermine, identify_cpu() overhauled,
+ *  and a few other clean ups.
+ *  Dave Jones <davej@suse.de>, April 2000
+ *
+ *  Pentium III FXSR, SSE support
+ *  General FPU state handling cleanups
+ *	Gareth Hughes <gareth@valinux.com>, May 2000
+ *
+ *  Added proper Cascades CPU and L2 cache detection for Cascades
+ *  and 8-way type cache happy bunch from Intel:^)
+ *  Dragan Stancevic <visitor@valinux.com>, May 2000 
+ *
+ *  Forward port AMD Duron errata T13 from 2.2.17pre
+ *  Dave Jones <davej@suse.de>, August 2000
+ *
+ *  Forward port lots of fixes/improvements from 2.2.18pre
+ *  Cyrix III, Pentium IV support.
+ *  Dave Jones <davej@suse.de>, October 2000
+ *
+ *  Massive cleanup of CPU detection and bug handling;
+ *  Transmeta CPU detection,
+ *  H. Peter Anvin <hpa@zytor.com>, November 2000
+ *
+ *  Added E820 sanitization routine (removes overlapping memory regions);
+ *  Brian Moyle <bmoyle@mvista.com>, February 2001
+ *
+ *  VIA C3 Support.
+ *  Dave Jones <davej@suse.de>, March 2001
+ *
+ *  AMD Athlon/Duron/Thunderbird bluesmoke support.
+ *  Dave Jones <davej@suse.de>, April 2001.
+ *
+ *  CacheSize bug workaround updates for AMD, Intel & VIA Cyrix.
+ *  Dave Jones <davej@suse.de>, September, October 2001.
+ *
+ */
 
 /*
  * This file handles the architecture-dependent parts of initialization
@@ -671,6 +744,13 @@
 	for (;;) {
 		if (c != ' ')
 			goto nextchar;
+		/*
+		 * "mem=nopentium" disables the 4MB page tables.
+		 * "mem=XXX[kKmM]" defines a memory region from HIGH_MEM
+		 * to <mem>, overriding the bios size.
+		 * "mem=XXX[KkmM]@XXX[KkmM]" defines a memory region from
+		 * <start> to <start>+<mem>, overriding the bios size.
+		 */
 		if (!memcmp(from, "mem=", 4)) {
 			if (to != command_line)
 				to--;
@@ -913,6 +993,11 @@
 	reserve_bootmem(0, PAGE_SIZE);
 
 #ifdef CONFIG_SMP
+	/*
+	 * But first pinch a few for the stack/trampoline stuff
+	 * FIXME: Don't need the extra page at 4K, but need to fix
+	 * trampoline before removing it. (see the GDT stuff)
+	 */
 	reserve_bootmem(PAGE_SIZE, PAGE_SIZE);
 #endif
 
@@ -1224,6 +1309,11 @@
 	int mbytes = max_mapnr >> (20-PAGE_SHIFT);
 	int r;
 
+	/*
+	 *	FIXME: We should handle the K5 here. Set up the write
+	 *	range and also turn on MSR 83 bits 4 and 31 (write alloc,
+	 *	no bus pipeline)
+	 */
 
 	/* Bit 31 in normal CPUID used for nonstandard 3DNow ID;
 	   3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
@@ -1414,6 +1504,13 @@
 static char cyrix_model_mult1[] __initdata = "12??43";
 static char cyrix_model_mult2[] __initdata = "12233445";
 
+/*
+ * Reset the slow-loop (SLOP) bit on the 686(L) which is set by some old
+ * BIOSes for compatability with DOS games.  This makes the udelay loop
+ * work correctly, and improves performance.
+ *
+ * FIXME: our newer udelay uses the tsc. We dont need to frob with SLOP
+ */
 
 extern void calibrate_delay(void) __init;
 
@@ -2130,6 +2227,11 @@
 #ifndef CONFIG_X86_F00F_WORKS_OK
 	static int f00f_workaround_enabled = 0;
 
+	/*
+	 * All current models of Pentium and Pentium with MMX technology CPUs
+	 * have the F0 0F bug, which lets nonpriviledged users lock up the system.
+	 * Note that the workaround only should be initialized once...
+	 */
 	c->f00f_bug = 0;
 	if (c->x86 == 5) {
 		c->f00f_bug = 1;
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/signal.c linux-2.4.20-WRTstp/arch/i386/kernel/signal.c
--- linux-2.4.20-WRT/arch/i386/kernel/signal.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/signal.c	2005-11-08 06:23:46.000000000 -0800
@@ -96,6 +96,7 @@
 	struct pt_regs * regs = (struct pt_regs *) &unewset;
 	sigset_t saveset, newset;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/smp.c linux-2.4.20-WRTstp/arch/i386/kernel/smp.c
--- linux-2.4.20-WRT/arch/i386/kernel/smp.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/smp.c	2005-11-08 06:24:34.000000000 -0800
@@ -23,6 +23,84 @@
 #include <asm/pgalloc.h>
 #include <asm/smpboot.h>
 
+/*
+ *	Some notes on x86 processor bugs affecting SMP operation:
+ *
+ *	Pentium, Pentium Pro, II, III (and all CPUs) have bugs.
+ *	The Linux implications for SMP are handled as follows:
+ *
+ *	Pentium III / [Xeon]
+ *		None of the E1AP-E3AP errata are visible to the user.
+ *
+ *	E1AP.	see PII A1AP
+ *	E2AP.	see PII A2AP
+ *	E3AP.	see PII A3AP
+ *
+ *	Pentium II / [Xeon]
+ *		None of the A1AP-A3AP errata are visible to the user.
+ *
+ *	A1AP.	see PPro 1AP
+ *	A2AP.	see PPro 2AP
+ *	A3AP.	see PPro 7AP
+ *
+ *	Pentium Pro
+ *		None of 1AP-9AP errata are visible to the normal user,
+ *	except occasional delivery of 'spurious interrupt' as trap #15.
+ *	This is very rare and a non-problem.
+ *
+ *	1AP.	Linux maps APIC as non-cacheable
+ *	2AP.	worked around in hardware
+ *	3AP.	fixed in C0 and above steppings microcode update.
+ *		Linux does not use excessive STARTUP_IPIs.
+ *	4AP.	worked around in hardware
+ *	5AP.	symmetric IO mode (normal Linux operation) not affected.
+ *		'noapic' mode has vector 0xf filled out properly.
+ *	6AP.	'noapic' mode might be affected - fixed in later steppings
+ *	7AP.	We do not assume writes to the LVT deassering IRQs
+ *	8AP.	We do not enable low power mode (deep sleep) during MP bootup
+ *	9AP.	We do not use mixed mode
+ *
+ *	Pentium
+ *		There is a marginal case where REP MOVS on 100MHz SMP
+ *	machines with B stepping processors can fail. XXX should provide
+ *	an L1cache=Writethrough or L1cache=off option.
+ *
+ *		B stepping CPUs may hang. There are hardware work arounds
+ *	for this. We warn about it in case your board doesn't have the work
+ *	arounds. Basically thats so I can tell anyone with a B stepping
+ *	CPU and SMP problems "tough".
+ *
+ *	Specific items [From Pentium Processor Specification Update]
+ *
+ *	1AP.	Linux doesn't use remote read
+ *	2AP.	Linux doesn't trust APIC errors
+ *	3AP.	We work around this
+ *	4AP.	Linux never generated 3 interrupts of the same priority
+ *		to cause a lost local interrupt.
+ *	5AP.	Remote read is never used
+ *	6AP.	not affected - worked around in hardware
+ *	7AP.	not affected - worked around in hardware
+ *	8AP.	worked around in hardware - we get explicit CS errors if not
+ *	9AP.	only 'noapic' mode affected. Might generate spurious
+ *		interrupts, we log only the first one and count the
+ *		rest silently.
+ *	10AP.	not affected - worked around in hardware
+ *	11AP.	Linux reads the APIC between writes to avoid this, as per
+ *		the documentation. Make sure you preserve this as it affects
+ *		the C stepping chips too.
+ *	12AP.	not affected - worked around in hardware
+ *	13AP.	not affected - worked around in hardware
+ *	14AP.	we always deassert INIT during bootup
+ *	15AP.	not affected - worked around in hardware
+ *	16AP.	not affected - worked around in hardware
+ *	17AP.	not affected - worked around in hardware
+ *	18AP.	not affected - worked around in hardware
+ *	19AP.	not affected - worked around in BIOS
+ *
+ *	If this sounds worrying believe me these bugs are either ___RARE___,
+ *	or are signal timing bugs worked around in hardware and there's
+ *	about nothing of note with C stepping upwards.
+ */
 
 /* The 'big kernel lock' */
 spinlock_cacheline_t kernel_flag_cacheline = {SPIN_LOCK_UNLOCKED};
@@ -47,6 +125,13 @@
 
 static inline void __send_IPI_shortcut(unsigned int shortcut, int vector)
 {
+	/*
+	 * Subtle. In the case of the 'never do double writes' workaround
+	 * we have to lock out interrupts to be safe.  As we don't care
+	 * of the value read we use an atomic rmw access to avoid costly
+	 * cli/sti.  Otherwise we use an even cheaper single atomic write
+	 * to the APIC.
+	 */
 	unsigned int cfg;
 
 	/*
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/traps.c linux-2.4.20-WRTstp/arch/i386/kernel/traps.c
--- linux-2.4.20-WRT/arch/i386/kernel/traps.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/traps.c	2005-11-08 06:24:34.000000000 -0800
@@ -57,6 +57,11 @@
 struct desc_struct default_ldt[] = { { 0, 0 }, { 0, 0 }, { 0, 0 },
 		{ 0, 0 }, { 0, 0 } };
 
+/*
+ * The IDT has to be page-aligned to simplify the Pentium
+ * F0 0F bug workaround.. We have a special link segment
+ * for this.
+ */
 struct desc_struct idt_table[256] __attribute__((__section__(".data.idt"))) = { {0, 0}, };
 
 asmlinkage void divide_error(void);
@@ -734,6 +739,10 @@
 asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs,
 					  long error_code)
 {
+#if 0
+	/* No need to warn about this any longer. */
+	printk("Ignoring P6 Local APIC Spurious Interrupt Bug...\n");
+#endif
 }
 
 /*
@@ -915,6 +924,7 @@
 	printk("Lithium PCI Bridge B (PIIX4), Bus Number: %d\n",
 				li_pcib_read16(LI_PCI_BUSNUM) & 0xff);
 
+	/* XXX blindly enables all interrupts */
 	li_pcia_write16(LI_PCI_INTEN, 0xffff);
 	li_pcib_write16(LI_PCI_INTEN, 0xffff);
 }
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/visws_apic.c linux-2.4.20-WRTstp/arch/i386/kernel/visws_apic.c
--- linux-2.4.20-WRT/arch/i386/kernel/visws_apic.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/visws_apic.c	2001-02-09 11:29:44.000000000 -0800
@@ -117,6 +117,7 @@
 
 static void disable_cobalt_irq(unsigned int irq)
 {
+	/* XXX undo the APIC entry here? */
 
 	/*
 	 * definitely, we do not want to have IRQ storms from
@@ -158,7 +159,7 @@
 	case CO_IRQ_ENET:	co_apic_set(CO_APIC_ENET, CO_IRQ_ENET);
 				return;
 
-	case CO_IRQ_SERIAL:	return; 
+	case CO_IRQ_SERIAL:	return; /* XXX move to piix4-8259 "virtual" */
 
 	case CO_IRQ_8259:	co_apic_set(CO_APIC_8259, CO_IRQ_8259);
 				return;
@@ -200,6 +201,7 @@
 	spin_lock(&irq_controller_lock);
 	{
 		unsigned int status;
+		/* XXX APIC EOI? */
 		status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
 		action = NULL;
 		if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
diff -ruN linux-2.4.20-WRT/arch/i386/kernel/vm86.c linux-2.4.20-WRTstp/arch/i386/kernel/vm86.c
--- linux-2.4.20-WRT/arch/i386/kernel/vm86.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/kernel/vm86.c	2005-11-08 06:23:46.000000000 -0800
@@ -646,6 +646,16 @@
 	return;
 
 simulate_sigsegv:
+	/* FIXME: After a long discussion with Stas we finally
+	 *        agreed, that this is wrong. Here we should
+	 *        really send a SIGSEGV to the user program.
+	 *        But how do we create the correct context? We
+	 *        are inside a general protection fault handler
+	 *        and has just returned from a page fault handler.
+	 *        The correct context for the signal handler
+	 *        should be a mixture of the two, but how do we
+	 *        get the information? [KD]
+	 */
 	return_to_32bit(regs, VM86_UNKNOWN);
 }
 
diff -ruN linux-2.4.20-WRT/arch/i386/lib/checksum.S linux-2.4.20-WRTstp/arch/i386/lib/checksum.S
--- linux-2.4.20-WRT/arch/i386/lib/checksum.S	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/lib/checksum.S	2005-11-08 06:24:34.000000000 -0800
@@ -256,6 +256,16 @@
 				  int len, int sum, int *src_err_ptr, int *dst_err_ptr)
  */ 
 
+/*
+ * Copy from ds while checksumming, otherwise like csum_partial
+ *
+ * The macros SRC and DST specify the type of access for the instruction.
+ * thus we can call a custom exception handler for all access types.
+ *
+ * FIXME: could someone double-check whether I haven't mixed up some SRC and
+ *	  DST definitions? It's damn hard to trigger all cases.  I hope I got
+ *	  them all but there's no guarantee.
+ */
 
 #define SRC(y...)			\
 	9999: y;			\
diff -ruN linux-2.4.20-WRT/arch/i386/lib/old-checksum.c linux-2.4.20-WRTstp/arch/i386/lib/old-checksum.c
--- linux-2.4.20-WRT/arch/i386/lib/old-checksum.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/lib/old-checksum.c	1998-12-27 10:32:09.000000000 -0800
@@ -1,4 +1,6 @@
-
+/*
+ * FIXME: old compatibility stuff, will be removed soon.
+ */
 
 #include <net/checksum.h>
 
diff -ruN linux-2.4.20-WRT/arch/i386/math-emu/fpu_entry.c linux-2.4.20-WRTstp/arch/i386/math-emu/fpu_entry.c
--- linux-2.4.20-WRT/arch/i386/math-emu/fpu_entry.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/math-emu/fpu_entry.c	2001-04-06 10:42:47.000000000 -0700
@@ -37,7 +37,7 @@
 
 #define __BAD__ FPU_illegal   /* Illegal on an 80486, causes SIGILL */
 
-#ifndef NO_UNDOC_CODE        /* Un-documented FPU op-codes supported by default. */
+#ifndef NO_UNDOC_CODE    /* Un-documented FPU op-codes supported by default. */
 
 /* WARNING: These codes are not documented by Intel in their 80486 manual
    and may not work on FPU clones or later Intel FPUs. */
diff -ruN linux-2.4.20-WRT/arch/i386/math-emu/fpu_trig.c linux-2.4.20-WRTstp/arch/i386/math-emu/fpu_trig.c
--- linux-2.4.20-WRT/arch/i386/math-emu/fpu_trig.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/math-emu/fpu_trig.c	2001-06-12 11:06:54.000000000 -0700
@@ -1556,7 +1556,7 @@
 	      if ( exponent(st0_ptr) >= 0 )
 		{
 		  /* st(0) holds <= -1.0 */
-#ifdef PECULIAR_486       /* Stupid 80486 doesn't worry about log(negative). */
+#ifdef PECULIAR_486   /* Stupid 80486 doesn't worry about log(negative). */
 		  changesign(st1_ptr);
 #else
 		  if ( arith_invalid(1) < 0 )
@@ -1580,7 +1580,7 @@
 		    (st0_ptr->sigl == 0)) )
 		{
 		  /* st(0) holds < -1.0 */
-#ifdef PECULIAR_486       /* Stupid 80486 doesn't worry about log(negative). */
+#ifdef PECULIAR_486   /* Stupid 80486 doesn't worry about log(negative). */
 		  changesign(st1_ptr);
 #else
 		  if ( arith_invalid(1) < 0 ) return;
diff -ruN linux-2.4.20-WRT/arch/i386/math-emu/poly_l2.c linux-2.4.20-WRTstp/arch/i386/math-emu/poly_l2.c
--- linux-2.4.20-WRT/arch/i386/math-emu/poly_l2.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/math-emu/poly_l2.c	2001-04-06 10:42:47.000000000 -0700
@@ -152,7 +152,7 @@
       if ( sign0 != SIGN_POS )
 	{
 	  /* Trying to get the log of a negative number. */
-#ifdef PECULIAR_486       /* Stupid 80486 doesn't worry about log(negative). */
+#ifdef PECULIAR_486   /* Stupid 80486 doesn't worry about log(negative). */
 	  changesign(st1_ptr);
 #else
 	  if ( arith_invalid(1) < 0 )
diff -ruN linux-2.4.20-WRT/arch/i386/mm/fault.c linux-2.4.20-WRTstp/arch/i386/mm/fault.c
--- linux-2.4.20-WRT/arch/i386/mm/fault.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/mm/fault.c	2005-11-08 06:24:34.000000000 -0800
@@ -280,6 +280,9 @@
 		return;
 	}
 
+	/*
+	 * Pentium F0 0F C7 C8 bug workaround.
+	 */
 	if (boot_cpu_data.f00f_bug) {
 		unsigned long nr;
 		
diff -ruN linux-2.4.20-WRT/arch/i386/mm/init.c linux-2.4.20-WRTstp/arch/i386/mm/init.c
--- linux-2.4.20-WRT/arch/i386/mm/init.c	2003-07-04 01:11:04.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/i386/mm/init.c	2005-11-08 06:24:34.000000000 -0800
@@ -426,6 +426,11 @@
 
 		if (e820.map[i].type != E820_RAM)	/* not usable memory */
 			continue;
+		/*
+		 *	!!!FIXME!!! Some BIOSen report areas as RAM that
+		 *	are not. Notably the 640->1Mb area. We need a sanity
+		 *	check here.
+		 */
 		addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT;
 		end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT;
 		if  ((pagenr >= addr) && (pagenr < end))
diff -ruN linux-2.4.20-WRT/arch/ia64/dig/setup.c linux-2.4.20-WRTstp/arch/ia64/dig/setup.c
--- linux-2.4.20-WRT/arch/ia64/dig/setup.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/dig/setup.c	2005-11-08 06:24:34.000000000 -0800
@@ -75,9 +75,9 @@
 	screen_info.orig_video_cols  = num_cols;
 	screen_info.orig_video_lines = num_rows;
 	screen_info.orig_video_points = font_height;
-	screen_info.orig_video_mode = 3;	
-	screen_info.orig_video_isVGA = 1;	
-	screen_info.orig_video_ega_bx = 3;	
+	screen_info.orig_video_mode = 3;	/* XXX fake */
+	screen_info.orig_video_isVGA = 1;	/* XXX fake */
+	screen_info.orig_video_ega_bx = 3;	/* XXX fake */
 }
 
 void __init
diff -ruN linux-2.4.20-WRT/arch/ia64/hp/common/sba_iommu.c linux-2.4.20-WRTstp/arch/ia64/hp/common/sba_iommu.c
--- linux-2.4.20-WRT/arch/ia64/hp/common/sba_iommu.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/hp/common/sba_iommu.c	2005-11-08 06:24:34.000000000 -0800
@@ -378,6 +378,7 @@
 #define SBA_IOVA(ioc,iovp,offset,hint_reg) ((ioc->ibase) | (iovp) | (offset) | ((hint_reg)<<(ioc->hint_shift_pdir)))
 #define SBA_IOVP(ioc,iova) (((iova) & ioc->hint_mask_pdir) & ~(ioc->ibase))
 
+/* FIXME : review these macros to verify correctness and usage */
 #define PDIR_INDEX(iovp)   ((iovp)>>IOVP_SHIFT)
 
 #define RESMAP_MASK(n)    ~(~0UL << (n))
@@ -601,7 +602,15 @@
  * on the vba.
  */
 
+#if 1
 #define sba_io_pdir_entry(pdir_ptr, vba) *pdir_ptr = ((vba & ~0xE000000000000FFFULL) | 0x8000000000000000ULL)
+#else
+void SBA_INLINE
+sba_io_pdir_entry(u64 *pdir_ptr, unsigned long vba)
+{
+	*pdir_ptr = ((vba & ~0xE000000000000FFFULL) | 0x80000000000000FFULL);
+}
+#endif
 
 #ifdef ENABLE_MARK_CLEAN
 /**
@@ -882,6 +891,14 @@
 #endif
 	spin_unlock_irqrestore(&ioc->res_lock, flags);
 
+	/* XXX REVISIT for 2.5 Linux - need syncdma for zero-copy support.
+	** For Astro based systems this isn't a big deal WRT performance.
+	** As long as 2.4 kernels copyin/copyout data from/to userspace,
+	** we don't need the syncdma. The issue here is I/O MMU cachelines
+	** are *not* coherent in all cases.  May be hwrev dependent.
+	** Need to investigate more.
+	asm volatile("syncdma");	
+	*/
 }
 
 
@@ -1400,6 +1417,7 @@
 		__FUNCTION__, ioc->ioc_hpa, ioc->iov_size >> 20,
 		iov_order + PAGE_SHIFT, ioc->pdir_size);
 
+	/* FIXME : DMA HINTs not used */
 	ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;
 	ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));
 
@@ -1427,6 +1445,11 @@
 	DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n",
 		__FUNCTION__, ioc->ibase, ioc->imask);
 
+	/*
+	** FIXME: Hint registers are programmed with default hint
+	** values during boot, so hints should be sane even if we
+	** can't reprogram them the way drivers want.
+	*/
 	WRITE_REG(ioc->imask, ioc->ioc_hpa + IOC_IMASK);
 
 	/*
@@ -1602,6 +1625,14 @@
 
 
 
+/**************************************************************************
+**
+**   SBA initialization code (HW and SW)
+**
+**   o identify SBA chip itself
+**   o FIXME: initialize DMA hints for reasonable defaults
+**
+**************************************************************************/
 
 #ifdef CONFIG_PROC_FS
 static int
diff -ruN linux-2.4.20-WRT/arch/ia64/ia32/ia32_ldt.c linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_ldt.c
--- linux-2.4.20-WRT/arch/ia64/ia32/ia32_ldt.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_ldt.c	2001-11-09 14:26:17.000000000 -0800
@@ -65,6 +65,7 @@
 	unsigned long size;
 	int err;
 
+	/* XXX fix me: should return equivalent of default_ldt[0] */
 	err = 0;
 	size = 8;
 	if (size > bytecount)
diff -ruN linux-2.4.20-WRT/arch/ia64/ia32/ia32_signal.c linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_signal.c
--- linux-2.4.20-WRT/arch/ia64/ia32/ia32_signal.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_signal.c	2005-11-08 06:23:46.000000000 -0800
@@ -220,6 +220,7 @@
 	unsigned int handler, restorer;
 	int ret;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset32_t))
 		return -EINVAL;
 
@@ -382,6 +383,10 @@
 	err |= __put_user(regs->r10, &sc->edx);
 	err |= __put_user(regs->r9, &sc->ecx);
 	err |= __put_user(regs->r8, &sc->eax);
+#if 0
+	err |= __put_user(current->tss.trap_no, &sc->trapno);
+	err |= __put_user(current->tss.error_code, &sc->err);
+#endif
 	err |= __put_user(regs->cr_iip, &sc->eip);
 	err |= __put_user(regs->r17 & 0xffff, (unsigned int *)&sc->cs);
 	/*
@@ -392,7 +397,19 @@
 	err |= __put_user(regs->r12, &sc->esp_at_signal);
 	err |= __put_user((regs->r17 >> 16) & 0xffff, (unsigned int *)&sc->ss);
 
+#if 0
+	tmp = save_i387(fpstate);
+	if (tmp < 0)
+		err = 1;
+	else
+		err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
+
+	/* non-iBCS2 extensions.. */
+#endif
 	err |= __put_user(mask, &sc->oldmask);
+#if 0
+	err |= __put_user(current->tss.cr2, &sc->cr2);
+#endif
 	return err;
 }
 
@@ -460,10 +477,25 @@
 		regs->r1 = -1;	/* disable syscall checks, r1 is orig_eax */
 	}
 
+#if 0
+	{
+		struct _fpstate * buf;
+		err |= __get_user(buf, &sc->fpstate);
+		if (buf) {
+			if (verify_area(VERIFY_READ, buf, sizeof(*buf)))
+				goto badframe;
+			err |= restore_i387(buf);
+		}
+	}
+#endif
 
 	err |= __get_user(*peax, &sc->eax);
 	return err;
 
+#if 0
+  badframe:
+	return 1;
+#endif
 }
 
 /*
@@ -533,7 +565,14 @@
 	regs->r16 = (__USER_DS << 16) |  (__USER_DS); /* ES == DS, GS, FS are zero */
 	regs->r17 = (__USER_DS << 16) | __USER_CS;
 
-
+#if 0
+	regs->eflags &= ~TF_MASK;
+#endif
+
+#if 0
+	printk("SIG deliver (%s:%d): sig=%d sp=%p pc=%lx ra=%x\n",
+               current->comm, current->pid, sig, (void *) frame, regs->cr_iip, frame->pretcode);
+#endif
 
 	return 1;
 
@@ -600,7 +639,14 @@
 	regs->r16 = (__USER_DS << 16) |  (__USER_DS); /* ES == DS, GS, FS are zero */
 	regs->r17 = (__USER_DS << 16) | __USER_CS;
 
-
+#if 0
+	regs->eflags &= ~TF_MASK;
+#endif
+
+#if 0
+	printk("SIG deliver (%s:%d): sp=%p pc=%lx ra=%x\n",
+               current->comm, current->pid, (void *) frame, regs->cr_iip, frame->pretcode);
+#endif
 
 	return 1;
 
diff -ruN linux-2.4.20-WRT/arch/ia64/ia32/ia32_support.c linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_support.c
--- linux-2.4.20-WRT/arch/ia64/ia32/ia32_support.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/ia32/ia32_support.c	2005-11-08 06:23:46.000000000 -0800
@@ -173,7 +173,7 @@
 	die_if_kernel("Bad IA-32 interrupt", regs, int_num);
 
 	siginfo.si_signo = SIGTRAP;
-	siginfo.si_errno = int_num;	
+	siginfo.si_errno = int_num;	/* XXX is it OK to abuse si_errno like this? */
 	siginfo.si_flags = 0;
 	siginfo.si_isr = 0;
 	siginfo.si_addr = 0;
diff -ruN linux-2.4.20-WRT/arch/ia64/ia32/sys_ia32.c linux-2.4.20-WRTstp/arch/ia64/ia32/sys_ia32.c
--- linux-2.4.20-WRT/arch/ia64/ia32/sys_ia32.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/ia32/sys_ia32.c	2005-11-08 06:23:46.000000000 -0800
@@ -88,6 +88,7 @@
  * Anything that modifies or inspects ia32 user virtual memory must hold this semaphore
  * while doing so.
  */
+/* XXX make per-mm: */
 static DECLARE_MUTEX(ia32_mmap_sem);
 
 static int
@@ -1676,6 +1677,7 @@
 	fput(sock->file);
 }
 
+/* XXX This really belongs in some header file... -DaveM */
 #define MAX_SOCK_ADDR	128		/* 108 for Unix domain -
 					   16 for IP, 16 for IPX,
 					   24 for IPv6,
@@ -3229,6 +3231,16 @@
 sys32_ioperm (unsigned int from, unsigned int num, int on)
 {
 
+	/*
+	 *  Since IA64 doesn't have permission bits we'd have to go to
+	 *    a lot of trouble to simulate them in software.  There's
+	 *    no point, only trusted programs can make this call so we'll
+	 *    just turn it into an iopl call and let the process have
+	 *    access to all I/O ports.
+	 *
+	 * XXX proper ioperm() support should be emulated by
+	 *	manipulating the page protections...
+	 */
 	return sys32_iopl(3);
 }
 
@@ -3813,7 +3825,7 @@
 	return ret;
 }
 
-#ifdef	NOTYET      /* UNTESTED FOR IA64 FROM HERE DOWN */
+#ifdef	NOTYET  /* UNTESTED FOR IA64 FROM HERE DOWN */
 
 struct ncp_mount_data32 {
 	int version;
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/efi.c linux-2.4.20-WRTstp/arch/ia64/kernel/efi.c
--- linux-2.4.20-WRT/arch/ia64/kernel/efi.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/efi.c	2005-11-08 06:24:34.000000000 -0800
@@ -511,11 +511,26 @@
 			} else if (md->attribute & EFI_MEMORY_UC) {
 				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
 			} else if (md->attribute & EFI_MEMORY_WC) {
+#if 0
+				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
+									   | _PAGE_D
+									   | _PAGE_MA_WC
+									   | _PAGE_PL_0
+									   | _PAGE_AR_RW));
+#else
 				printk("EFI_MEMORY_WC mapping\n");
 				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
+#endif
 			} else if (md->attribute & EFI_MEMORY_WT) {
+#if 0
+				md->virt_addr = ia64_remap(md->phys_addr, (_PAGE_A | _PAGE_P
+									   | _PAGE_D | _PAGE_MA_WT
+									   | _PAGE_PL_0
+									   | _PAGE_AR_RW));
+#else
 				printk("EFI_MEMORY_WT mapping\n");
 				md->virt_addr = (u64) ioremap(md->phys_addr, 0);
+#endif
 			}
 		}
 	}
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/entry.S linux-2.4.20-WRTstp/arch/ia64/kernel/entry.S
--- linux-2.4.20-WRT/arch/ia64/kernel/entry.S	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/entry.S	2005-11-08 06:24:34.000000000 -0800
@@ -681,13 +681,21 @@
 	shr.u loc1=r18,9		// RNaTslots <= dirtySize / (64*8) + 1
 	sub r17=r17,r18			// r17 = (physStackedSize + 8) - dirtySize
 	;;
+#if 1
 	.align 32		// see comment below about gas bug...
+#endif
 	mov ar.rsc=r19			// load ar.rsc to be used for "loadrs"
 	shladd in0=loc1,3,r17
 	mov in1=0
+#if 0
+	// gas-2.11.90 is unable to generate a stop bit after .align, which is bad,
+	// because alloc must be at the beginning of an insn-group.
+	.align 32
+#else
 	nop 0
 	nop 0
 	nop 0
+#endif
 	;;
 rse_clear_invalid:
 #ifdef CONFIG_ITANIUM
@@ -806,6 +814,15 @@
 
 #if __GNUC__ < 3
 
+	/*
+	 * Invoke schedule() while preserving in0-in7, which may be needed
+	 * in case a system call gets restarted.  Note that declaring schedule()
+	 * with asmlinkage() is NOT enough because that will only preserve as many
+	 * registers as there are formal arguments.
+	 *
+	 * XXX fix me: with gcc 3.0, we won't need this anymore because syscall_linkage
+	 *	renders all eight input registers (in0-in7) as "untouchable".
+	 */
 ENTRY(invoke_schedule)
 	.prologue ASM_UNW_PRLG_RP|ASM_UNW_PRLG_PFS, ASM_UNW_PRLG_GRSAVE(8)
 	alloc loc1=ar.pfs,8,2,0,0
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/irq.c linux-2.4.20-WRTstp/arch/ia64/kernel/irq.c
--- linux-2.4.20-WRT/arch/ia64/kernel/irq.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/irq.c	2005-11-08 06:24:34.000000000 -0800
@@ -729,6 +729,7 @@
 	int retval;
 	struct irqaction * action;
 
+#if 1
 	/*
 	 * Sanity-check: shared interrupts should REALLY pass in
 	 * a real dev-ID, otherwise we'll have trouble later trying
@@ -739,6 +740,7 @@
 		if (!dev_id)
 			printk("Bad boy: %s called us without a dev_id!\n", devname);
 	}
+#endif
 
 	if (irq >= NR_IRQS)
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/irq_ia64.c linux-2.4.20-WRTstp/arch/ia64/kernel/irq_ia64.c
--- linux-2.4.20-WRT/arch/ia64/kernel/irq_ia64.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/irq_ia64.c	2005-11-08 06:24:34.000000000 -0800
@@ -60,6 +60,7 @@
 	static int next_vector = IA64_FIRST_DEVICE_VECTOR;
 
 	if (next_vector > IA64_LAST_DEVICE_VECTOR)
+		/* XXX could look for sharable vectors instead of panic'ing... */
 		panic("%s: out of interrupt vectors!", __FUNCTION__);
 	return next_vector++;
 }
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/ivt.S linux-2.4.20-WRTstp/arch/ia64/kernel/ivt.S
--- linux-2.4.20-WRT/arch/ia64/kernel/ivt.S	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/ivt.S	2005-11-08 06:24:34.000000000 -0800
@@ -45,9 +45,21 @@
 #include <asm/system.h>
 #include <asm/unistd.h>
 
+#if 1
 # define PSR_DEFAULT_BITS	psr.ac
+#else
+# define PSR_DEFAULT_BITS	0
+#endif
 
+#if 0
+  /*
+   * This lets you track the last eight faults that occurred on the CPU.  Make sure ar.k2 isn't
+   * needed for something else before enabling this...
+   */
+# define DBG_FAULT(i)	mov r16=ar.k2;;	shl r16=r16,8;;	add r16=(i),r16;;mov ar.k2=r16
+#else
 # define DBG_FAULT(i)
+#endif
 
 #define MINSTATE_VIRT	/* needed by minstate.h */
 #include "minstate.h"
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/mca.c linux-2.4.20-WRTstp/arch/ia64/kernel/mca.c
--- linux-2.4.20-WRT/arch/ia64/kernel/mca.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/mca.c	2005-11-08 06:24:34.000000000 -0800
@@ -433,6 +433,10 @@
 	IA64_MCA_DEBUG("ia64_mca_init: registered mca rendezvous spinloop and wakeup mech.\n");
 
 	ia64_mc_info.imi_mca_handler        = __pa(mca_hldlr_ptr->fp);
+	/*
+	 * XXX - disable SAL checksum by setting size to 0; should be
+	 *	__pa(ia64_os_mca_dispatch_end) - __pa(ia64_os_mca_dispatch);
+	 */
 	ia64_mc_info.imi_mca_handler_size	= 0;
 
 	/* Register the os mca handler with SAL */
@@ -450,6 +454,10 @@
 	IA64_MCA_DEBUG("ia64_mca_init: registered os mca handler with SAL at 0x%lx, gp = 0x%lx\n",
 		       ia64_mc_info.imi_mca_handler, mca_hldlr_ptr->gp);
 
+	/*
+	 * XXX - disable SAL checksum by setting size to 0, should be
+	 * IA64_INIT_HANDLER_SIZE
+	 */
 	ia64_mc_info.imi_monarch_init_handler		= __pa(mon_init_ptr->fp);
 	ia64_mc_info.imi_monarch_init_handler_size	= 0;
 	ia64_mc_info.imi_slave_init_handler		= __pa(slave_init_ptr->fp);
@@ -524,6 +532,10 @@
 
 	printk("Mca related initialization done\n");
 
+#if 0   // Too early in initialization -- error log is lost
+	/* Do post-failure MCA error logging */
+	ia64_mca_check_errors();
+#endif  // Too early in initialization -- error log is lost
 }
 
 /*
@@ -868,7 +880,7 @@
 	}
 }
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 
 static void
 ia64_log_prt_record_header (sal_log_record_header_t *rh, prfunc_t prfunc)
@@ -1610,7 +1622,7 @@
 
 	prfunc("+Processor Device Error Info Section\n");
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 	{
 		char    *p_data = (char *)&slpi->valid;
 
@@ -1720,7 +1732,7 @@
 	if (!lh)
 		return;
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 	ia64_log_prt_record_header(lh, prfunc);
 #endif  // MCA_PRT_XTRA_DATA for test only @FVL
 
@@ -1738,7 +1750,7 @@
 		/* point to next section header */
 		slsh = (sal_log_section_hdr_t *)((char *)lh + ercd_pos);
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 		ia64_log_prt_section_header(slsh, prfunc);
 #endif  // MCA_PRT_XTRA_DATA for test only @FVL
 
@@ -1784,7 +1796,7 @@
 	if (!lh)
 		return platform_err;
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 	ia64_log_prt_record_header(lh, prfunc);
 #endif  // MCA_PRT_XTRA_DATA for test only @FVL
 
@@ -1802,7 +1814,7 @@
 		/* point to next section header */
 		slsh = (sal_log_section_hdr_t *)((char *)lh + ercd_pos);
 
-#ifdef MCA_PRT_XTRA_DATA        // for test only @FVL
+#ifdef MCA_PRT_XTRA_DATA    // for test only @FVL
 		ia64_log_prt_section_header(slsh, prfunc);
 
 		if (efi_guidcmp(slsh->guid, SAL_PROC_DEV_ERR_SECT_GUID) != 0) {
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/pci.c linux-2.4.20-WRTstp/arch/ia64/kernel/pci.c
--- linux-2.4.20-WRT/arch/ia64/kernel/pci.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/pci.c	2005-11-08 06:24:34.000000000 -0800
@@ -319,6 +319,7 @@
 	reg = (reg & size) | (((u32)(res->start - root->start)) & ~size);
 	pci_write_config_dword(dev, where, reg);
 
+	/* ??? FIXME -- record old value for shutdown.  */
 }
 
 void __init
@@ -326,6 +327,7 @@
 {
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 
+	/* ??? FIXME -- record old value for shutdown.  */
 }
 
 void __init
@@ -400,6 +402,12 @@
 	 * platform.
 	 */
 	if (mmap_state == pci_mmap_io)
+		/*
+		 * XXX we could relax this for I/O spaces for which ACPI indicates that
+		 * the space is 1-to-1 mapped.  But at the moment, we don't support
+		 * multiple PCI address spaces and the legacy I/O space is not 1-to-1
+		 * mapped, so this is moot.
+		 */
 		return -EINVAL;
 
 	/*
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/perfmon.c linux-2.4.20-WRTstp/arch/ia64/kernel/perfmon.c
--- linux-2.4.20-WRT/arch/ia64/kernel/perfmon.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/perfmon.c	2005-11-08 06:24:34.000000000 -0800
@@ -73,6 +73,7 @@
 #define PMC_IS_IMPL(i)	  (i<pmu_conf.num_pmcs && pmu_conf.impl_regs[i>>6] & (1UL<< (i) %64))
 #define PMD_IS_IMPL(i)	  (i<pmu_conf.num_pmds &&  pmu_conf.impl_regs[4+(i>>6)] & (1UL<<(i) % 64))
 
+/* XXX: these three assume that register i is implemented */
 #define PMD_IS_COUNTING(i) (pmu_conf.pmd_desc[i].type == PFM_REG_COUNTING)
 #define PMC_IS_COUNTING(i) (pmu_conf.pmc_desc[i].type == PFM_REG_COUNTING)
 #define PMC_IS_MONITOR(c)  (pmu_conf.pmc_desc[i].type == PFM_REG_MONITOR)
@@ -85,6 +86,7 @@
 #define CTX_OVFL_NOBLOCK(c)	((c)->ctx_fl_block == 0)
 #define CTX_INHERIT_MODE(c)	((c)->ctx_fl_inherit)
 #define CTX_HAS_SMPL(c)		((c)->ctx_psb != NULL)
+/* XXX: does not support more than 64 PMDs */
 #define CTX_USED_PMD(ctx, mask) (ctx)->ctx_used_pmds[0] |= (mask)
 #define CTX_IS_USED_PMD(ctx, c) (((ctx)->ctx_used_pmds[0] & (1UL << (c))) != 0UL)
 
@@ -156,7 +158,7 @@
 	void			*psb_addr;	/* points to location of first entry */
 	unsigned long		psb_entries;	/* maximum number of entries */
 	unsigned long		psb_size;	/* aligned size of buffer */
-	unsigned long		psb_index;	
+	unsigned long		psb_index;	/* next free entry slot XXX: must use the one in buffer */
 	unsigned long		psb_entry_size;	/* size of each entry including entry header */
 
 	perfmon_smpl_hdr_t	*psb_hdr;	/* points to sampling buffer header */
@@ -213,6 +215,10 @@
 	unsigned int reserved:24;
 } pfm_context_flags_t;
 
+/*
+ * perfmon context: encapsulates all the state of a monitoring session
+ * XXX: probably need to change layout
+ */
 typedef struct pfm_context {
 	pfm_smpl_buffer_desc_t	*ctx_psb;		/* sampling buffer, if any */
 	unsigned long		ctx_smpl_vaddr;		/* user level virtual address of smpl buffer */
@@ -237,7 +243,7 @@
 	unsigned long		ctx_used_ibrs[4];	/* bitmask of used IBR (speedup ctxsw) */
 	unsigned long		ctx_used_dbrs[4];	/* bitmask of used DBR (speedup ctxsw) */
 
-	pfm_counter_t		ctx_soft_pmds[IA64_NUM_PMD_REGS]; 
+	pfm_counter_t		ctx_soft_pmds[IA64_NUM_PMD_REGS]; /* XXX: size should be dynamic */
 
 	u64			ctx_saved_psr;		/* copy of psr used for lazy ctxsw */
 	unsigned long		ctx_saved_cpus_allowed;	/* copy of the task cpus_allowed (system wide) */
@@ -465,6 +471,9 @@
 static inline unsigned long
 pfm_get_stamp(void)
 {
+	/*
+	 * XXX: must find something more efficient
+	 */
 	return ia64_get_itc();
 }
 
@@ -731,6 +740,14 @@
 
 	DBprintk(("sampling buffer size=%lu bytes\n", size));
 
+	/*
+	 * check requested size to avoid Denial-of-service attacks
+	 * XXX: may have to refine this test	
+	 * Check against address space limit.
+	 *
+	 * if ((mm->total_vm << PAGE_SHIFT) + len> current->rlim[RLIMIT_AS].rlim_cur) 
+	 * 	return -ENOMEM;
+	 */
 	if (size > current->rlim[RLIMIT_MEMLOCK].rlim_cur) return -EAGAIN;
 
 	/*
@@ -769,7 +786,7 @@
 	 */
 	vma->vm_mm	     = mm;
 	vma->vm_flags	     = VM_READ| VM_MAYREAD |VM_RESERVED|VM_DONTCOPY;
-	vma->vm_page_prot    = PAGE_READONLY; 
+	vma->vm_page_prot    = PAGE_READONLY; /* XXX may need to change */
 	vma->vm_ops	     = &pfm_vm_ops; /* necesarry to get the close() callback */
 	vma->vm_pgoff	     = 0;
 	vma->vm_file	     = NULL;
@@ -791,6 +808,10 @@
 
 	spin_lock_init(&psb->psb_lock);
 
+	/*
+	 * XXX: will need to do cacheline alignment to avoid false sharing in SMP mode and
+	 * multitask monitoring.
+	 */
 	psb->psb_entry_size = sizeof(perfmon_smpl_entry_t) + regcount*sizeof(u64);
 
 	DBprintk(("psb @%p entry_size=%ld hdr=%p addr=%p refcnt=%lu psb_flags=0x%x\n", 
@@ -859,6 +880,9 @@
 	return -ENOMEM;
 }
 
+/*
+ * XXX: do something better here
+ */
 static int
 pfm_bad_permissions(struct task_struct *task)
 {
@@ -930,6 +954,12 @@
 			DBprintk(("must have notify_pid when blocking for [%d]\n", task->pid));
 			return -EINVAL;
 		}
+#if 0
+		if ((ctx_flags & PFM_FL_NOTIFY_BLOCK) && pfx->ctx_notify_pid == task->pid) {
+			DBprintk(("cannot notify self when blocking for [%d]\n", task->pid));
+			return -EINVAL;
+		}
+#endif
 	}
 	/* probably more to add here */
 
@@ -1215,6 +1245,7 @@
 
 	if (!CTX_IS_ENABLED(ctx)) return -EINVAL;
 
+	/* XXX: ctx locking may be required here */
 
 	for (i = 0; i < count; i++, req++) {
 
@@ -1348,6 +1379,7 @@
 	if (!CTX_IS_ENABLED(ctx)) return -EINVAL;
 
 
+	/* XXX: ctx locking may be required here */
 
 	for (i = 0; i < count; i++, req++) {
 
@@ -1427,7 +1459,14 @@
 
 	if (!CTX_IS_ENABLED(ctx)) return -EINVAL;
 
+	/*
+	 * XXX: MUST MAKE SURE WE DON"T HAVE ANY PENDING OVERFLOW BEFORE READING
+	 * This is required when the monitoring has been stoppped by user or kernel.
+	 * If it is still going on, then that's fine because we a re not guaranteed
+	 * to return an accurate value in this case.
+	 */
 
+	/* XXX: ctx locking may be required here */
 
 	DBprintk(("ctx_last_cpu=%d for [%d]\n", atomic_read(&ctx->ctx_last_cpu), task->pid));
 
@@ -1481,6 +1520,9 @@
 			val = th->pmd[cnum];
 		}
 		if (PMD_IS_COUNTING(cnum)) {
+			/*
+			 * XXX: need to check for overflow
+			 */
 
 			val &= pmu_conf.perf_ovfl_val;
 			val += ctx_val = ctx->ctx_soft_pmds[cnum].val;
@@ -1505,6 +1547,9 @@
 	return 0;
 abort_mission:
 	PFM_REG_RETFLAG_SET(tmp.reg_flags, PFM_REG_RETFL_EINVAL);
+	/* 
+	 * XXX: if this fails, we stick with the original failure, flag not updated!
+	 */
 	copy_to_user(req, &tmp, sizeof(tmp));
 	return -EINVAL;
 
@@ -1640,12 +1685,39 @@
 	} 
 	/* restart on another task */
 
+	/*
+	 * if blocking, then post the semaphore.
+	 * if non-blocking, then we ensure that the task will go into
+	 * pfm_overflow_must_block() before returning to user mode. 
+	 * We cannot explicitely reset another task, it MUST always
+	 * be done by the task itself. This works for system wide because
+	 * the tool that is controlling the session is doing "self-monitoring".
+	 *
+	 * XXX: what if the task never goes back to user?
+	 *
+	 */
 	if (CTX_OVFL_NOBLOCK(ctx) == 0) {
 		DBprintk(("unblocking %d \n", task->pid));
 		up(sem);
 	} else {
 		task->thread.pfm_ovfl_block_reset = 1;
 	}
+#if 0
+	/*
+	 * in case of non blocking mode, then it's just a matter of
+	 * of reseting the sampling buffer (if any) index. The PMU
+	 * is already active.
+	 */
+
+	/*
+	 * must reset the header count first
+	 */
+	if (CTX_HAS_SMPL(ctx)) {
+		DBprintk(("resetting sampling indexes for %d \n", task->pid));
+		ctx->ctx_psb->psb_hdr->hdr_count = 0;
+		ctx->ctx_psb->psb_index = 0;
+	}
+#endif
 	return 0;
 }
 
@@ -1887,6 +1959,13 @@
 	int first_time;
 	int i, ret = 0;
 
+	/*
+	 * for range restriction: psr.db must be cleared or the
+	 * the PMU will ignore the debug registers.
+	 *
+	 * XXX: may need more in system wide mode,
+	 * no task can have this bit set?
+	 */
 	if (ia64_psr(regs)->db == 1) return -EINVAL;
 
 
@@ -1983,6 +2062,11 @@
 				dbreg.dbr.dbr_r = dbreg.dbr.dbr_w = 0;
 		}
 
+		/*
+		 * clear return flags and copy back to user
+		 *
+		 * XXX: fix once EAGAIN is implemented
+		 */
 		ret = -EFAULT;
 
 		PFM_REG_RETFLAG_SET(tmp.dbreg_flags, 0);
@@ -2038,6 +2122,9 @@
 	 * install error return flag
 	 */
 	if (ret != -EFAULT) {
+		/*
+		 * XXX: for now we can only come here on EINVAL
+		 */
 		PFM_REG_RETFLAG_SET(tmp.dbreg_flags, PFM_REG_RETFL_EINVAL);
 		copy_to_user(req, &tmp, sizeof(tmp));
 	}
@@ -2229,6 +2316,9 @@
 	return 0;
 abort_mission:
 	PFM_REG_RETFLAG_SET(tmp.reg_flags, PFM_REG_RETFL_EINVAL);
+	/* 
+	 * XXX: if this fails, we stick with the original failure, flag not updated!
+	 */
 	copy_to_user(req, &tmp, sizeof(tmp));
 	return -EINVAL;
 }
@@ -2339,6 +2429,9 @@
 	if (PFM_CMD_WRITE_ARG(cmd) && !access_ok(VERIFY_WRITE, arg, sz*count)) return -EFAULT;
 
 	if (PFM_CMD_USE_PID(cmd))  {
+		/* 
+		 * XXX: may need to fine tune this one
+		 */
 		if (pid < 2) return -EPERM;
 
 		if (pid != current->pid) {
@@ -2448,6 +2541,10 @@
 
 		ctx->ctx_ovfl_regs[0] = 0UL;
 
+		/*
+		 * Unlock sampling buffer and reset index atomically
+		 * XXX: not really needed when blocking
+		 */
 		if (CTX_HAS_SMPL(ctx)) {
 			ctx->ctx_psb->psb_hdr->hdr_count = 0;
 			ctx->ctx_psb->psb_index = 0;
@@ -2479,6 +2576,14 @@
 	idx = ia64_fetch_and_add(1, &psb->psb_index);
 	DBprintk_ovfl(("recording index=%ld entries=%ld\n", idx-1, psb->psb_entries));
 
+	/*
+	* XXX: there is a small chance that we could run out on index before resetting
+	* but index is unsigned long, so it will take some time.....
+	* We use > instead of == because fetch_and_add() is off by one (see below)
+	*
+	* This case can happen in non-blocking mode or with multiple processes.
+	* For non-blocking, we need to reload and continue.
+	 */
 	if (idx > psb->psb_entries) return 0;
 
 	/* first entry is really entry 0, not 1 caused by fetch_and_add */
@@ -2491,7 +2596,7 @@
 	 */
 	h->pid  = current->pid;
 	h->cpu  = smp_processor_id();
-	h->rate = 0; 
+	h->rate = 0; /* XXX: add the sampling rate used here */
 	h->ip   = regs ? regs->cr_iip : 0x0;	/* where did the fault happened */
 	h->regs = ovfl_mask; 			/* which registers overflowed */
 
@@ -2534,6 +2639,9 @@
 	 */
 	if (idx == (psb->psb_entries-1)) {
 		DBprintk_ovfl(("sampling buffer full\n"));
+		/*
+		 * XXX: must reset buffer in blocking mode and lost notified
+		 */
 		pfm_stats.pfm_full_smpl_buffer_count++;
 		return 1;
 	}
@@ -2571,6 +2679,10 @@
 
 	t   = &task->thread;
 
+	/*
+	 * XXX: debug test
+	 * Don't think this could happen given upfront tests
+	 */
 	if ((t->flags & IA64_THREAD_PM_VALID) == 0 && ctx->ctx_fl_system == 0) {
 		printk("perfmon: Spurious overflow interrupt: process %d not using perfmon\n", 
 			task->pid);
@@ -2789,7 +2901,7 @@
 			t->pfm_ovfl_block_reset = 1; /* will cause blocking */
 		}
 	} else {
-lost_notify: 
+lost_notify: /* XXX: more to do here, to convert to non-blocking (reset values) */
 
 		DBprintk_ovfl(("notification task has disappeared !\n"));
 		/*
@@ -3057,6 +3169,10 @@
 
 	ia64_srlz_d();
 
+	/*
+	 * XXX needs further optimization.
+	 * Also must take holes into account
+	 */
 	mask = ctx->ctx_used_pmds[0];
 	for (i=0; mask; i++, mask>>=1) {
 		if (mask & 0x1) t->pmd[i] =ia64_get_pmd(i);
@@ -3125,10 +3241,16 @@
 		ctx->ctx_reload_pmcs[0],
 		ctx->ctx_used_pmds[0]));
 
+	/*
+	 * XXX: will be replaced with pure assembly call
+	 */
 	SET_PMU_OWNER(NULL);
 
 	ia64_srlz_d();
 
+	/*
+	 * XXX needs further optimization.
+	 */
 	mask = ctx->ctx_used_pmds[0];
 	for (i=0; mask; i++, mask>>=1) {
 		if (mask & 0x1) t->pmd[i] = ia64_get_pmd(i);
@@ -3217,6 +3339,18 @@
 	ctx   = task->thread.pfm_context;
 	t     = &task->thread;
 
+	/*
+	 * we restore ALL the debug registers to avoid picking up 
+	 * stale state.
+	 *
+	 * This must be done even when the task is still the owner
+	 * as the registers may have been modified via ptrace()
+	 * (not perfmon) by the previous task. 
+	 *
+	 * XXX: dealing with this in a lazy fashion requires modifications
+	 * to the way the the debug registers are managed. This is will done
+	 * in the next version of perfmon.
+	 */
 	if (ctx->ctx_fl_using_dbreg) {
 		for (i=0; i < pmu_conf.num_ibrs; i++) {
 			ia64_set_ibr(i, t->ibr[i]);
@@ -3314,6 +3448,9 @@
 
 }
 
+/*
+ * XXX: make this routine able to work with non current context
+ */
 static void
 ia64_reset_pmu(struct task_struct *task)
 {
@@ -3349,6 +3486,10 @@
 						 
 		}
 	}
+	/*
+	 * clear reset values for PMD. 
+	 * XXX: good up to 64 PMDS. Suppose that zero is a valid value.
+	 */
 	mask = pmu_conf.impl_regs[4];
 	for(i=0; mask; mask>>=1, i++) {
 		if (mask & 0x1) ia64_set_pmd(i, 0UL);
@@ -3388,6 +3529,14 @@
 	 */
 	ctx->ctx_reload_pmds[0] = pmu_conf.impl_regs[4];
 
+	/* 
+	 * Keep track of the pmds we want to sample
+	 * XXX: may be we don't need to save/restore the DEAR/IEAR pmds
+	 * but we do need the BTB for sure. This is because of a hardware
+	 * buffer of 1 only for non-BTB pmds.
+	 *
+	 * We ignore the unimplemented pmds specified by the user
+	 */
 	ctx->ctx_used_pmds[0] = ctx->ctx_smpl_regs[0] & pmu_conf.impl_regs[4];
 	ctx->ctx_used_pmcs[0] = 1; /* always save/restore PMC[0] */
 
@@ -3677,6 +3826,10 @@
 		/* what about the other pmds? zero or keep as is */
 
 	}
+	/*
+	 * clear BTB index register
+	 * XXX: CPU-model specific knowledge!
+	 */
 	thread->pmd[16] = 0;
 
 
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/process.c linux-2.4.20-WRTstp/arch/ia64/kernel/process.c
--- linux-2.4.20-WRT/arch/ia64/kernel/process.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/process.c	2005-11-08 06:24:34.000000000 -0800
@@ -306,6 +306,20 @@
 	child_ptregs->cr_ipsr =  ((child_ptregs->cr_ipsr | IA64_PSR_BITS_TO_SET)
 				  & ~IA64_PSR_BITS_TO_CLEAR);
 
+	/*
+	 * NOTE: The calling convention considers all floating point registers in the high
+	 * partition (fph) to be scratch.  Since the only way to get to this point is
+	 * through a system call, we know that the values in fph are all dead.  Hence,
+	 * there is no need to inherit the fph state from the parent to the child and all
+	 * we have to do is to make sure that IA64_THREAD_FPH_VALID is cleared in the
+	 * child.
+	 *
+	 * XXX We could push this optimization a bit further by clearing
+	 * IA64_THREAD_FPH_VALID on ANY system call.  However, it's not clear this is
+	 * worth doing.  Also, it would be a slight deviation from the normal Linux system
+	 * call behavior where scratch registers are preserved across system calls (unless
+	 * used by the system call itself).
+	 */
 #	define THREAD_FLAGS_TO_CLEAR	(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID \
 					 | IA64_THREAD_PM_VALID)
 #	define THREAD_FLAGS_TO_SET	0
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/setup.c linux-2.4.20-WRTstp/arch/ia64/kernel/setup.c
--- linux-2.4.20-WRT/arch/ia64/kernel/setup.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/setup.c	2005-11-08 06:24:34.000000000 -0800
@@ -66,7 +66,7 @@
 
 unsigned long ia64_iobase;	/* virtual address for I/O accesses */
 
-unsigned char aux_device_present = 0xaa;        
+unsigned char aux_device_present = 0xaa;        /* XXX remove this when legacy I/O is gone */
 
 #define COMMAND_LINE_SIZE	512
 
@@ -108,7 +108,7 @@
 	return 0;
 }
 
-#define IGNORE_PFN0	1	
+#define IGNORE_PFN0	1	/* XXX fix me: ignore pfn 0 until TLB miss handler is updated... */
 
 /*
  * Free available memory based on the primitive map created from
@@ -296,9 +296,21 @@
 
 	efi_init();
 
-	iomem_resource.end = ~0UL;	
+	iomem_resource.end = ~0UL;	/* FIXME probably belongs elsewhere */
 	find_memory();
 
+#if 0
+	/* XXX fix me */
+	init_mm.start_code = (unsigned long) &_stext;
+	init_mm.end_code = (unsigned long) &_etext;
+	init_mm.end_data = (unsigned long) &_edata;
+	init_mm.brk = (unsigned long) &_end;
+
+	code_resource.start = virt_to_bus(&_text);
+	code_resource.end = virt_to_bus(&_etext) - 1;
+	data_resource.start = virt_to_bus(&_etext);
+	data_resource.end = virt_to_bus(&_edata) - 1;
+#endif
 
 	/* process SAL system table: */
 	ia64_sal_init(efi.sal_systab);
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/signal.c linux-2.4.20-WRTstp/arch/ia64/kernel/signal.c
--- linux-2.4.20-WRT/arch/ia64/kernel/signal.c	2003-07-04 01:11:05.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/signal.c	2005-11-08 06:24:34.000000000 -0800
@@ -46,6 +46,7 @@
 {
 	sigset_t oldset, set;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/sys_ia64.c linux-2.4.20-WRTstp/arch/ia64/kernel/sys_ia64.c
--- linux-2.4.20-WRT/arch/ia64/kernel/sys_ia64.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/sys_ia64.c	2005-11-08 06:24:34.000000000 -0800
@@ -71,6 +71,7 @@
 	return prio;
 }
 
+/* XXX obsolete, but leave it here until the old libc is gone... */
 asmlinkage unsigned long
 sys_getpagesize (void)
 {
@@ -273,6 +274,7 @@
 	return addr;
 }
 
+#if 1
 /*
  * This is here for a while to keep compatibillity with the old stat()
  * call - it will be removed later once everybody migrates to the new
@@ -394,6 +396,7 @@
 	return err;
 }
 
+#endif
 
 #ifndef CONFIG_PCI
 
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/time.c linux-2.4.20-WRTstp/arch/ia64/kernel/time.c
--- linux-2.4.20-WRT/arch/ia64/kernel/time.c	2003-10-14 01:00:27.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/time.c	2006-06-12 18:05:27.000000000 -0700
@@ -52,8 +52,10 @@
 
 	now = ia64_get_itc();
 	if ((long) (now - last_tick) < 0) {
+# if 1
 		printk("CPU %d: now < last_tick (now=0x%lx,last_tick=0x%lx)!\n",
 		       smp_processor_id(), now, last_tick);
+# endif
 		return last_time_offset;
 	}
 	elapsed_cycles = now - last_tick;
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/unaligned.c linux-2.4.20-WRTstp/arch/ia64/kernel/unaligned.c
--- linux-2.4.20-WRT/arch/ia64/kernel/unaligned.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/unaligned.c	2005-11-08 06:24:34.000000000 -0800
@@ -1028,6 +1028,10 @@
 
 		DPRINT("ld.r1=%d ld.imm=%d x6_sz=%d\n", ld.r1, ld.imm, ld.x6_sz);
 		DDUMP("frp_init =", &fpr_init, 2*len);
+		/*
+		 * XXX fixme
+		 * Could optimize inlines by using ldfpX & 2 spills
+		 */
 		switch( ld.x6_sz ) {
 			case 0:
 				mem2float_extended(&fpr_init[0], &fpr_final[0]);
@@ -1047,6 +1051,13 @@
 				break;
 		}
 		DDUMP("fpr_final =", &fpr_final, 2*len);
+		/*
+		 * XXX fixme
+		 *
+		 * A possible optimization would be to drop fpr_final and directly
+		 * use the storage from the saved context i.e., the actual final
+		 * destination (pt_regs, switch_stack or thread structure).
+		 */
 		setfpreg(ld.r1, &fpr_final[0], regs);
 		setfpreg(ld.imm, &fpr_final[1], regs);
 	}
@@ -1136,6 +1147,13 @@
 				break;
 		}
 		DDUMP("fpr_final =", &fpr_final, len);
+		/*
+		 * XXX fixme
+		 *
+		 * A possible optimization would be to drop fpr_final and directly
+		 * use the storage from the saved context i.e., the actual final
+		 * destination (pt_regs, switch_stack or thread structure).
+		 */
 		setfpreg(ld.r1, &fpr_final, regs);
 	}
 
@@ -1337,6 +1355,36 @@
 	       "ld.x6=0x%x ld.m=%d ld.op=%d\n", opcode, u.insn.qp, u.insn.r1, u.insn.imm,
 	       u.insn.r3, u.insn.x, u.insn.hint, u.insn.x6_sz, u.insn.m, u.insn.op);
 
+	/*
+	 * IMPORTANT:
+	 * Notice that the switch statement DOES not cover all possible instructions
+	 * that DO generate unaligned references. This is made on purpose because for some
+	 * instructions it DOES NOT make sense to try and emulate the access. Sometimes it
+	 * is WRONG to try and emulate. Here is a list of instruction we don't emulate i.e.,
+	 * the program will get a signal and die:
+	 *
+	 *	load/store:
+	 *		- ldX.spill
+	 *		- stX.spill
+	 *	Reason: RNATs are based on addresses
+	 *
+	 *	synchronization:
+	 *		- cmpxchg
+	 *		- fetchadd
+	 *		- xchg
+	 *	Reason: ATOMIC operations cannot be emulated properly using multiple
+	 *	        instructions.
+	 *
+	 *	speculative loads:
+	 *		- ldX.sZ
+	 *	Reason: side effects, code must be ready to deal with failure so simpler
+	 *		to let the load fail.
+	 * ---------------------------------------------------------------------------------
+	 * XXX fixme
+	 *
+	 * I would like to get rid of this switch case and do something
+	 * more elegant.
+	 */
 	switch (opcode) {
 	      case LDS_OP:
 	      case LDSA_OP:
diff -ruN linux-2.4.20-WRT/arch/ia64/kernel/unwind.c linux-2.4.20-WRTstp/arch/ia64/kernel/unwind.c
--- linux-2.4.20-WRT/arch/ia64/kernel/unwind.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/kernel/unwind.c	2005-11-08 06:24:34.000000000 -0800
@@ -1189,6 +1189,13 @@
 	}
 	spin_unlock(&unw.lock);
 
+	/*
+	 * XXX We'll deadlock here if we interrupt a thread that is
+	 * holding a read lock on script->lock.  A try_write_lock()
+	 * might be mighty handy here...  Alternatively, we could
+	 * disable interrupts whenever we hold a read-lock, but that
+	 * seems silly.
+	 */
 	write_lock(&script->lock);
 
 	spin_lock(&unw.lock);
diff -ruN linux-2.4.20-WRT/arch/ia64/lib/copy_user.S linux-2.4.20-WRTstp/arch/ia64/lib/copy_user.S
--- linux-2.4.20-WRT/arch/ia64/lib/copy_user.S	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/lib/copy_user.S	2005-11-08 06:24:34.000000000 -0800
@@ -1,4 +1,33 @@
-
+/*
+ *
+ * Optimized version of the copy_user() routine.
+ * It is used to copy date across the kernel/user boundary.
+ *
+ * The source and destination are always on opposite side of
+ * the boundary. When reading from user space we must catch
+ * faults on loads. When writing to user space we must catch
+ * errors on stores. Note that because of the nature of the copy
+ * we don't need to worry about overlapping regions.
+ *
+ *
+ * Inputs:
+ *	in0	address of source buffer
+ *	in1	address of destination buffer
+ *	in2	number of bytes to copy
+ *
+ * Outputs:
+ *	ret0	0 in case of success. The number of bytes NOT copied in
+ *		case of error.
+ *
+ * Copyright (C) 2000-2001 Hewlett-Packard Co
+ *	Stephane Eranian <eranian@hpl.hp.com>
+ *
+ * Fixme:
+ *	- handle the case where we have more than 16 bytes and the alignment
+ *	  are different.
+ *	- more benchmarking
+ *	- fix extraneous stop bit introduced by the EX() macro.
+ */
 
 #include <asm/asmmacro.h>
 
diff -ruN linux-2.4.20-WRT/arch/ia64/lib/csum_partial_copy.c linux-2.4.20-WRTstp/arch/ia64/lib/csum_partial_copy.c
--- linux-2.4.20-WRT/arch/ia64/lib/csum_partial_copy.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/lib/csum_partial_copy.c	2001-07-31 10:30:08.000000000 -0700
@@ -12,6 +12,9 @@
 
 #include <asm/uaccess.h>
 
+/*
+ * XXX Fixme: those 2 inlines are meant for debugging and will go away
+ */
 static inline unsigned
 short from64to16(unsigned long x)
 {
@@ -92,6 +95,12 @@
 	return result;
 }
 
+/*
+ * XXX Fixme
+ *
+ * This is very ugly but temporary. THIS NEEDS SERIOUS ENHANCEMENTS.
+ * But it's very tricky to get right even in C.
+ */
 extern unsigned long do_csum(const unsigned char *, long);
 
 static unsigned int
@@ -100,6 +109,11 @@
 {
 	unsigned long result;
 
+	/* XXX Fixme
+	 * for now we separate the copy from checksum for obvious
+	 * alignment difficulties. Look at the Alpha code and you'll be
+	 * scared.
+	 */
 
 	if (__copy_from_user(dst, src, len) != 0 && errp)
 		*errp = -EFAULT;
diff -ruN linux-2.4.20-WRT/arch/ia64/lib/swiotlb.c linux-2.4.20-WRTstp/arch/ia64/lib/swiotlb.c
--- linux-2.4.20-WRT/arch/ia64/lib/swiotlb.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/lib/swiotlb.c	2005-11-08 06:24:35.000000000 -0800
@@ -184,6 +184,10 @@
 				index = 0;
 		} while (index != wrap);
 
+		/*
+		 * XXX What is a suitable recovery mechanism here?  We cannot
+		 * sleep because we are called from with in interrupts!
+		 */
 		panic("map_single: could not allocate software IO TLB (%ld bytes)", size);
 	}
   found:
@@ -254,6 +258,10 @@
 	int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
 	char *buffer = io_tlb_orig_addr[index];
 
+	/*
+	 * bounce... copy the data back into/from the original buffer
+	 * XXX How do you handle PCI_DMA_BIDIRECTIONAL here ?
+	 */
 	if (direction == PCI_DMA_FROMDEVICE)
 		memcpy(buffer, dma_addr, size);
 	else if (direction == PCI_DMA_TODEVICE)
@@ -273,7 +281,7 @@
 	 * Alloc_consistent() is defined to return memory < 4GB, no matter what the DMA
 	 * mask says.
 	 */
-	gfp |= GFP_DMA;	
+	gfp |= GFP_DMA;	/* XXX fix me: should change this to GFP_32BIT or ZONE_32BIT */
 	ret = (void *)__get_free_pages(gfp, get_order(size));
 	if (!ret)
 		return NULL;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/fakeprom/klgraph_init.c linux-2.4.20-WRTstp/arch/ia64/sn/fakeprom/klgraph_init.c
--- linux-2.4.20-WRT/arch/ia64/sn/fakeprom/klgraph_init.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/fakeprom/klgraph_init.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: klgraph_init.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id: klgraph_init.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/fakeprom/main.c linux-2.4.20-WRTstp/arch/ia64/sn/fakeprom/main.c
--- linux-2.4.20-WRT/arch/ia64/sn/fakeprom/main.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/fakeprom/main.c	2005-11-08 06:23:46.000000000 -0800
@@ -80,6 +80,13 @@
 bedrock_init(int nasid)
 {
 	nasid = nasid;		/* to quiet gcc */
+#if 0
+	/*
+	 * Undef if you need fprom to generate a 1 node klgraph
+	 * information .. only works for 1 node for nasid 0.
+	 */
+	klgraph_init();
+#endif
 }
 
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/alenlist.c linux-2.4.20-WRTstp/arch/ia64/sn/io/alenlist.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/alenlist.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/alenlist.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: alenlist.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/ate_utils.c linux-2.4.20-WRTstp/arch/ia64/sn/io/ate_utils.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/ate_utils.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/ate_utils.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ate_utils.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id: ate_utils.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/cdl.c linux-2.4.20-WRTstp/arch/ia64/sn/io/cdl.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/cdl.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/cdl.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: cdl.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/eeprom.c linux-2.4.20-WRTstp/arch/ia64/sn/io/eeprom.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/eeprom.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/eeprom.c	2005-11-08 06:23:46.000000000 -0800
@@ -665,6 +665,12 @@
     return ch;
 }
 
+/* create a part number of the form xxx-xxxx-xxx.
+ * It may be important later to generate different
+ * part numbers depending on the component we're
+ * supposed to be "reading" from, so the component
+ * paramter is provided.
+ */
 void fake_a_part_number( char *buf, int component )
 {
     int i;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/hcl.c linux-2.4.20-WRTstp/arch/ia64/sn/io/hcl.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/hcl.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/hcl.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hcl.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -725,6 +725,8 @@
 
                         if (target != NULL) {
                                 *target = source; 
+				/* XXX should incr "source" ref count here if we
+				 * ever implement ref counts */
                         }
 
                 } else if (which_place == EDGE_PLACE_WANT_CONNECTPT) {
@@ -1324,7 +1326,7 @@
 	int   pos;
 
 	if (buflen < 1)
-		return(-1);	
+		return(-1);	/* XXX should be GRAPH_BAD_PARAM ? */
 
 	locbuf = kmalloc(buflen, GFP_KERNEL);
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/hcl_util.c linux-2.4.20-WRTstp/arch/ia64/sn/io/hcl_util.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/hcl_util.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/hcl_util.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hcl_util.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/hubdev.c linux-2.4.20-WRTstp/arch/ia64/sn/io/hubdev.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/hubdev.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/hubdev.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hubdev.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/hubspc.c linux-2.4.20-WRTstp/arch/ia64/sn/io/hubspc.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/hubspc.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/hubspc.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hubspc.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/ifconfig_net.c linux-2.4.20-WRTstp/arch/ia64/sn/io/ifconfig_net.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/ifconfig_net.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/ifconfig_net.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ifconfig_net.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id: ifconfig_net.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/invent.c linux-2.4.20-WRTstp/arch/ia64/sn/io/invent.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/invent.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/invent.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: invent.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -39,6 +39,13 @@
 	pinv->inv_state = state;
 }
 
+/*
+ * Inventory addition 
+ *
+ * XXX NOTE: Currently must be called after dynamic memory allocator is
+ * initialized.
+ *
+ */
 void
 add_to_inventory(int class, int type, int controller, int unit, int state)
 {
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/io.c linux-2.4.20-WRTstp/arch/ia64/sn/io/io.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/io.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/io.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id: io.c,v 1.2 2001/06/26 14:02:43 pfg Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -573,6 +573,7 @@
 void
 hub_dmamap_drain(	hub_dmamap_t map)
 {
+    /* XXX- flush caches, if cache coherency WAR is needed */
 }
 
 /*ARGSUSED*/
@@ -581,6 +582,7 @@
 			paddr_t addr,
 			size_t bytes)
 {
+    /* XXX- flush caches, if cache coherency WAR is needed */
 }
 
 /*ARGSUSED*/
@@ -588,6 +590,7 @@
 hub_dmalist_drain(	devfs_handle_t vhdl,
 			alenlist_t list)
 {
+    /* XXX- flush caches, if cache coherency WAR is needed */
 }
 
 
@@ -644,6 +647,7 @@
 	if (hub_check_is_widget0(addra) && hub_check_is_widget0(addrb))
 		return 1;
 
+	/* XXX - Assume this is really a small window address */
 	if (WIDGETID_GET((__psunsigned_t)addra) ==
 	    WIDGETID_GET((__psunsigned_t)addrb))
 		return 1;
@@ -657,11 +661,19 @@
  * This only works if both addresses are in small windows.  It's used to
  * determine whether prom addresses refer to particular PCI devices.
  */
+/*	
+ * XXX - This won't work as written if we ever have more than two nodes
+ * on a crossbow.  In that case, we'll need an array or partners.
+ */
 int
 hub_check_pci_equiv(void *addra, void *addrb)
 {
 	nasid_t nasida, nasidb;
 
+	/*
+	 * This is for a permanent workaround that causes us to use a
+	 * big window in place of small window 0.
+	 */
 	if (!hub_check_window_equiv(addra, addrb))
 		return 0;
 
@@ -733,6 +745,23 @@
 	REMOTE_HUB_S(nasid, prb_offset, prb.iprb_regval);
 }
 
+/*
+ * hub_set_piomode()
+ *
+ * 	Put the hub into either "PIO conveyor belt" mode or "fire-and-forget"
+ * 	mode.  To do this, we have to make absolutely sure that no PIOs
+ *	are in progress so we turn off access to all widgets for the duration
+ *	of the function.
+ * 
+ * XXX - This code should really check what kind of widget we're talking
+ * to.  Bridges can only handle three requests, but XG will do more.
+ * How many can crossbow handle to widget 0?  We're assuming 1.
+ *
+ * XXX - There is a bug in the crossbow that link reset PIOs do not
+ * return write responses.  The easiest solution to this problem is to
+ * leave widget 0 (xbow) in fire-and-forget mode at all times.  This
+ * only affects pio's to xbow registers, which should be rare.
+ */
 void
 hub_set_piomode(nasid_t nasid, int conveyor)
 {
@@ -767,6 +796,10 @@
 	}
 
 	for (prbnum = HUB_WIDGET_ID_MIN; prbnum <= HUB_WIDGET_ID_MAX; prbnum++) {
+		/*
+		 * XXX - Here's where we should take the widget type into
+		 * when account assigning credits.
+		 */
 		/* Always set the PRBs in fire-and-forget mode */
 		hub_setup_prb(nasid, prbnum, 3, conveyor);
 	}
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/klconflib.c linux-2.4.20-WRTstp/arch/ia64/sn/io/klconflib.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/klconflib.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/klconflib.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: klconflib.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -182,6 +182,13 @@
                 new_name[i] = '\0';
         }
 
+        /* XXX -
+         * Since a bunch of boards made it out with weird names like
+         * IO6-fibbbed and IO6P2, we need to look for IO6 in a name and
+         * replace it with "baseio" to avoid confusion in the field.
+	 * We also have to make sure we don't report media_io instead of
+	 * baseio.
+         */
 
         /* Skip underscores at the beginning of the name */
         for (compare_ptr = new_name; (*compare_ptr) == '_'; compare_ptr++)
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/klgraph.c linux-2.4.20-WRTstp/arch/ia64/sn/io/klgraph.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/klgraph.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/klgraph.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: klgraph.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -264,6 +264,10 @@
 
 		NODEPDA(hub_cnode)->xbow_vhdl = xbow_v;
 
+		/*
+		 * XXX - This won't work is we ever hook up two hubs
+		 * by crosstown through a crossbow.
+		 */
 		if (hub_nasid != nasid) {
 			NODEPDA(hub_cnode)->xbow_peer = nasid;
 			NODEPDA(NASID_TO_COMPACT_NODEID(nasid))->xbow_peer =
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/klgraph_hack.c linux-2.4.20-WRTstp/arch/ia64/sn/io/klgraph_hack.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/klgraph_hack.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/klgraph_hack.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: klgraph_hack.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/l1.c linux-2.4.20-WRTstp/arch/ia64/sn/io/l1.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/l1.c	2003-10-14 01:07:22.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/l1.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: l1.c,v 1.1.1.4 2003/10/14 08:07:22 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -1702,6 +1702,16 @@
 l1_connect_intr(void *rx_notify, void *tx_notify)
 {
 #if defined(USE_SAL_CONSOLE_IO)
+#if 0
+	// Will need code here for sn2 - something like this
+	console_nodepda = NODEPDA(NASID_TO_COMPACT_NODEID(get_master_nasid());
+	intr_connect_level(console_nodepda->node_first_cpu,
+                                SGI_UART_VECTOR, INTPEND0_MAXMASK,
+                                dummy_intr_func);
+	request_irq(SGI_UART_VECTOR | (console_nodepda->node_first_cpu << 8),
+                                intr_func, SA_INTERRUPT | SA_SHIRQ,
+                                "l1_protocol_driver", (void *)sc);
+#endif
 #else
 	l1sc_t *sc;
 	nasid_t nasid;
@@ -3008,6 +3018,15 @@
 	    /*
 	     * an event arrived; break it down into useful pieces
 	     */
+#if defined(L1_DEBUG) && 0
+	    int ix;
+	    printf( "Event packet received:\n" );
+	    for (ix = 0; ix < 64; ix++) {
+		printf( "%x%x ", ((event[ix] >> 4) & ((uint64_t)0xf)),
+			(event[ix] & ((uint64_t)0xf)) );
+		if( (ix % 16) == 0xf ) printf( "\n" );
+	    }
+#endif /* L1_DEBUG */
 
 	    i = 0;
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/l1_command.c linux-2.4.20-WRTstp/arch/ia64/sn/io/l1_command.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/l1_command.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/l1_command.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: l1_command.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/ml_iograph.c linux-2.4.20-WRTstp/arch/ia64/sn/io/ml_iograph.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/ml_iograph.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/ml_iograph.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ml_iograph.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -966,6 +966,11 @@
 #else
 #define NUM_BASE_IO_SCSI_CTLR 6
 #endif
+/*
+ * This tells ioconfig where it can start numbering scsi controllers.
+ * Below this base number, platform-specific handles the numbering.
+ * XXX Irix legacy..controller numbering should be part of devfsd's job
+ */
 int num_base_io_scsi_ctlr = 2; /* used by syssgi */
 devfs_handle_t		base_io_scsi_ctlr_vhdl[NUM_BASE_IO_SCSI_CTLR];
 static devfs_handle_t	baseio_enet_vhdl,baseio_console_vhdl;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/ml_SN_init.c linux-2.4.20-WRTstp/arch/ia64/sn/io/ml_SN_init.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/ml_SN_init.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/ml_SN_init.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ml_SN_init.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -92,6 +92,7 @@
 }
 
 
+/* XXX - Move the meat of this to intr.c ? */
 /*
  * Set up the platform-dependent fields in the nodepda.
  */
@@ -164,6 +165,7 @@
 #endif /* LATER */
 }
 
+/* XXX - Move the interrupt stuff to intr.c ? */
 /*
  * Set up the platform-dependent fields in the processor pda.
  * Must be done _after_ init_platform_nodepda().
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/module.c linux-2.4.20-WRTstp/arch/ia64/sn/io/module.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/module.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/module.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: module.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/pciba.c linux-2.4.20-WRTstp/arch/ia64/sn/io/pciba.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/pciba.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/pciba.c	2005-11-08 06:23:46.000000000 -0800
@@ -261,10 +261,25 @@
 {
 	TRACE();
 
+	/* FIXME: should also free all that memory that we allocated
+           ;) */
 	unregister_with_devfs();
 }
 
 
+# if 0
+static void __exit
+free_nodes(void)
+{
+	struct node_data * nd;
+	
+	TRACE();
+
+	list_for_each(nd, &node_list) {
+		kfree(list_entry(nd, struct nd, node_list));
+	}
+}
+#endif
 
 
 static devfs_handle_t pciba_devfs_handle;
@@ -285,6 +300,7 @@
 	if (pciba_devfs_handle == NULL)
 		return failure;
 
+	/* FIXME: don't forget /dev/pci/mem & /dev/pci/io */
 
 	pci_for_each_dev(dev) {
 		sprintf(devfs_path, "%02x/%02x.%x",
@@ -319,6 +335,7 @@
 
 	TRACE();
 
+	/* FIXME: don't forget /dev/.../pci/mem & /dev/.../pci/io */
 
 	pci_for_each_dev(dev) {
 		device_dir_handle = devfn_to_vertex(dev->bus->number,
@@ -372,6 +389,7 @@
 {
 	TRACE();
 
+	/* FIXME: should free these allocations */
 #ifdef DEBUG_PCIBA
 	dump_allocations(&dma_node->u.dma.dma_allocs);
 #endif
@@ -520,6 +538,8 @@
 {
 	TRACE();
 
+	/* FIXME: should check that they're not trying to open the ROM
+           writable */
 
 	return 0; /* success */
 }
@@ -698,6 +718,26 @@
 }
 
 
+#if 0
+#define NEW(ptr) (ptr = kmalloc(sizeof (*(ptr)), GFP_KERNEL))
+
+static void
+test_list(void)
+{
+	u64 i;
+	LIST_HEAD(the_list);
+
+	for (i = 0; i < 5; i++) {
+		struct dma_allocation * new_alloc;
+		NEW(new_alloc);
+		new_alloc->va = (void *)i;
+		new_alloc->handle = 5*i;
+		printk("%d - the_list->next = %lx\n", i, the_list.next);
+		list_add(&new_alloc->list, &the_list);
+	}
+	dump_allocations(&the_list);
+}
+#endif
 #endif
 
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/pci_bus_cvlink.c linux-2.4.20-WRTstp/arch/ia64/sn/io/pci_bus_cvlink.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/pci_bus_cvlink.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/pci_bus_cvlink.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: pci_bus_cvlink.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -316,6 +316,22 @@
 		return;
 	}
 
+#if 0
+{
+        devfs_handle_t  bridge_vhdl = pci_bus_to_vertex(0);
+        pcibr_soft_t    pcibr_soft = (pcibr_soft_t) hwgraph_fastinfo_get(bridge_vhdl);
+	bridge_t        *bridge = pcibr_soft->bs_base;
+        printk("pci_fixup_ioc3: Before devreg fixup\n");
+        printk("pci_fixup_ioc3: Devreg 0 0x%x\n", bridge->b_device[0].reg);
+        printk("pci_fixup_ioc3: Devreg 1 0x%x\n", bridge->b_device[1].reg);
+        printk("pci_fixup_ioc3: Devreg 2 0x%x\n", bridge->b_device[2].reg);
+        printk("pci_fixup_ioc3: Devreg 3 0x%x\n", bridge->b_device[3].reg);
+        printk("pci_fixup_ioc3: Devreg 4 0x%x\n", bridge->b_device[4].reg);
+        printk("pci_fixup_ioc3: Devreg 5 0x%x\n", bridge->b_device[5].reg);
+        printk("pci_fixup_ioc3: Devreg 6 0x%x\n", bridge->b_device[6].reg);
+        printk("pci_fixup_ioc3: Devreg 7 0x%x\n", bridge->b_device[7].reg);
+}
+#endif
 	done_probing = 1;
 
 	/*
@@ -516,6 +532,28 @@
 
 	}
 
+#if 0
+
+{
+        devfs_handle_t  bridge_vhdl = pci_bus_to_vertex(0);
+        pcibr_soft_t    pcibr_soft = (pcibr_soft_t) hwgraph_fastinfo_get(bridge_vhdl);
+        bridge_t        *bridge = pcibr_soft->bs_base;
+
+        printk("pci_fixup_ioc3: Before devreg fixup\n");
+        printk("pci_fixup_ioc3: Devreg 0 0x%x\n", bridge->b_device[0].reg);
+        printk("pci_fixup_ioc3: Devreg 1 0x%x\n", bridge->b_device[1].reg);
+        printk("pci_fixup_ioc3: Devreg 2 0x%x\n", bridge->b_device[2].reg);
+        printk("pci_fixup_ioc3: Devreg 3 0x%x\n", bridge->b_device[3].reg);
+        printk("pci_fixup_ioc3: Devreg 4 0x%x\n", bridge->b_device[4].reg);
+        printk("pci_fixup_ioc3: Devreg 5 0x%x\n", bridge->b_device[5].reg);
+        printk("pci_fixup_ioc3: Devreg 6 0x%x\n", bridge->b_device[6].reg);
+        printk("pci_fixup_ioc3: Devreg 7 0x%x\n", bridge->b_device[7].reg);
+}
+
+printk("testing Big Window: 0xC0000200c0000000 %p\n", *( (volatile uint64_t *)0xc0000200a0000000));
+printk("testing Big Window: 0xC0000200c0000008 %p\n", *( (volatile uint64_t *)0xc0000200a0000008));
+
+#endif
 
 }
 
@@ -557,6 +595,14 @@
 	 * Loop throught this vertex and get the Xwidgets ..
 	 */
 	for (widgetnum = HUB_WIDGET_ID_MAX; widgetnum >= HUB_WIDGET_ID_MIN; widgetnum--) {
+#if 0
+        {
+                int pos;
+                char dname[256];
+                pos = devfs_generate_path(xtalk, dname, 256);
+                printk("%s : path= %s\n", __FUNCTION__, &dname[pos]);
+        }
+#endif
 
 		sprintf(pathname, "%d", widgetnum);
 		xwidget = NULL;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/pci_dma.c linux-2.4.20-WRTstp/arch/ia64/sn/io/pci_dma.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/pci_dma.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/pci_dma.c	2005-11-08 06:24:35.000000000 -0800
@@ -217,6 +217,13 @@
 	device_sysdata = (struct sn_device_sysdata *) hwdev->sysdata;
 	vhdl = device_sysdata->vhdl;
 
+	/*
+	 * Allocate the memory.  FIXME: if we're allocating for
+	 * two devices on the same bus, we should at least try to
+	 * allocate memory in the same 2 GB window to avoid using
+	 * ATEs for the translation.  See the comment above about the
+	 * 32 bit requirement for this function.
+	 */
 	if(!(cpuaddr = (void *)__get_free_pages(GFP_ATOMIC, get_order(size))))
 		return NULL;
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/pciio.c linux-2.4.20-WRTstp/arch/ia64/sn/io/pciio.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/pciio.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/pciio.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: pciio.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -904,6 +904,7 @@
 pciio_bus_t
 pciio_info_bus_get(pciio_info_t pciio_info)
 {
+    /* XXX for now O2 always gets back bus 0 */
     return (pciio_bus_t)0;
 }
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sgi_if.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_if.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sgi_if.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_if.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: sgi_if.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sgi_io_init.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_io_init.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sgi_io_init.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_io_init.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: sgi_io_init.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sgi_io_sim.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_io_sim.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sgi_io_sim.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sgi_io_sim.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: sgi_io_sim.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/hubcounters.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/hubcounters.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/hubcounters.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/hubcounters.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hubcounters.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: hubcounters.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -103,6 +103,10 @@
 	printed += print_hub_error(hsp, hsp->hs_ni_retry_errors,
 				   delta, 0x1);
 
+#if 0
+	printed += print_hub_error(hsp, hsp->hs_ni_sn_errors,
+				   delta, 0x2);
+#endif
 
 	printed += print_hub_error(hsp, hsp->hs_ni_cb_errors,
 				   delta, 0x4);
@@ -231,6 +235,10 @@
 
 	hub_print_usecs = hub_print_usecs;
 
+#if 0
+	printk("init_hub_stats: cnode=%d nasid=%d hs_version=%d hs_ni_port_status=0x%016lx\n",
+		cnodeid, nasid, hsp->hs_version, hsp->hs_ni_port_status);
+#endif
 }
 
 static int
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/huberror.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/huberror.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/huberror.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/huberror.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: huberror.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: huberror.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/hub_intr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/hub_intr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/hub_intr.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/hub_intr.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: hub_intr.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: hub_intr.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -94,6 +94,7 @@
 			intr_resflags = II_THREADED;
 	}
 
+	/* XXX - Need to determine if the interrupt should be threaded. */
 
 	/* If the cpu has not been picked already then choose a candidate 
 	 * interrupt target and reserve the interrupt bit 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/mem_refcnt.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/mem_refcnt.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/mem_refcnt.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/mem_refcnt.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: mem_refcnt.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: mem_refcnt.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/ml_SN_intr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/ml_SN_intr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/ml_SN_intr.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/ml_SN_intr.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ml_SN_intr.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: ml_SN_intr.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -13,7 +13,7 @@
  *	handle interrupts on an IP27 board.
  */
 
-#ident  "$Revision: 1.1.1.4 $"
+#ident  "$Revision: 1.1 $"
 
 #include <linux/types.h>
 #include <linux/config.h>
@@ -827,6 +827,22 @@
 	devfs_handle_t pconn_vhdl;
 	pcibr_soft_t pcibr_soft;
 
+	/*
+	 * This combination of SN1 and Bridge hardware has an odd "limitation".
+	 * Due to the choice of addresses for PI0 and PI1 registers on SN1
+	 * and historical limitations in Bridge, Bridge is unable to
+	 * send interrupts to both PI0 CPUs and PI1 CPUs -- we have
+	 * to choose one set or the other.  That choice is implicitly
+	 * made when Bridge first attaches its error interrupt.  After
+	 * that point, all subsequent interrupts are restricted to the
+	 * same PI number (though it's possible to send interrupts to
+	 * the same PI number on a different node).
+	 *
+	 * Since neither SN1 nor Bridge designers are willing to admit a
+	 * bug, we can't really call this a "workaround".  It's a permanent
+	 * solution for an SN1-specific and Bridge-specific hardware
+	 * limitation that won't ever be lifted.
+	 */
         if ((hwgraph_edge_get(dev, EDGE_LBL_PCI, &pconn_vhdl) == GRAPH_SUCCESS) &&
 	   ((pcibr_soft = pcibr_soft_get(pconn_vhdl)) != NULL)) {
 		/*
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn1/pcibr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/pcibr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn1/pcibr.c	2003-07-04 01:11:06.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn1/pcibr.c	2005-11-08 06:23:46.000000000 -0800
@@ -44,6 +44,9 @@
 
 #undef PCIBR_ATE_DEBUG
 
+#if 0
+#define DEBUG 1	 /* To avoid lots of bad printk() formats leave off */
+#endif
 #define PCI_DEBUG 1
 #define ATTACH_DEBUG 1
 #define PCIBR_SOFT_LIST 1
@@ -52,6 +55,13 @@
 #define	LOCAL		static
 #endif
 
+/*
+ * Macros related to the Lucent USS 302/312 usb timeout workaround.  It
+ * appears that if the lucent part can get into a retry loop if it sees a
+ * DAC on the bus during a pio read retry.  The loop is broken after about
+ * 1ms, so we need to set up bridges holding this part to allow at least
+ * 1ms for pio.
+ */
 
 #define USS302_TIMEOUT_WAR
 
@@ -63,7 +73,7 @@
 #endif
 
 #define PCIBR_LLP_CONTROL_WAR
-#if defined(PCIBR_LLP_CONTROL_WAR)
+#if defined (PCIBR_LLP_CONTROL_WAR)
 int                     pcibr_llp_control_war_cnt;
 #endif				/* PCIBR_LLP_CONTROL_WAR */
 
@@ -488,7 +498,7 @@
 
     /* wait until RRB has no outstanduing XIO packets. */
     while ((status = bridge->b_resp_status) & BRIDGE_RRB_INUSE(rrb)) {
-	;				
+	;				/* XXX- beats on bridge. bad idea? */
     }
 
     /* if the RRB has data, drain it. */
@@ -497,7 +507,7 @@
 
 	/* wait until RRB is no longer valid. */
 	while ((status = bridge->b_resp_status) & BRIDGE_RRB_VALID(rrb)) {
-	    ;				
+	    ;				/* XXX- beats on bridge. bad idea? */
 	}
     }
 }
@@ -1313,7 +1323,7 @@
 	     */
 	    if (bad) {
 		pcibr_unlock(pcibr_soft, s);
-#if DEBUG && PCIBR_DEV_DEBUG
+#if (DEBUG && PCIBR_DEV_DEBUG)
 		printk("pcibr_try_set_device: mod blocked by %R\n", bad, device_bits);
 #endif
 		return bad;
@@ -1510,6 +1520,15 @@
     len = ctob(btoc(len));		/* Make len page aligned */
     error = v_mapphys(vt, (void *) ((__psunsigned_t) bridge + off), len);
 
+    /*
+     * If the offset being mapped corresponds to the flash prom
+     * base, and if the mapping succeeds, and if the user
+     * has requested the protections to be WRITE, enable the
+     * flash prom to be written.
+     *
+     * XXX- deprecate this in favor of using the
+     * real flash driver ...
+     */
     if (!error &&
 	((off == BRIDGE_EXTERNAL_FLASH) ||
 	 (len > BRIDGE_EXTERNAL_FLASH))) {
@@ -1759,6 +1778,28 @@
     return(0);
 }
 
+/*
+ * pcibr_slot_query
+ *	Return information about the PCI slot maintained by the infrastructure.
+ *	Information is requested in the request structure.
+ *
+ *      Information returned in the response structure:
+ *		Slot hwgraph name
+ *		Vendor/Device info
+ *		Base register info
+ *		Interrupt mapping from device pins to the bridge pins
+ *		Devio register
+ *		Software RRB info
+ *		RRB register info
+ *		Host/Gues info
+ *		PCI Bus #,slot #, function #
+ *		Slot provider hwgraph name
+ *		Provider Functions
+ *		Error handler
+ *		DMA mapping usage counters
+ *		DMA direct translation info
+ *		External SSRAM workaround info
+ */
 int
 pcibr_slot_query(devfs_handle_t pcibr_vhdl, pcibr_slot_info_req_t reqp)
 {
@@ -2132,6 +2173,24 @@
 
     if (slot != PCIIO_SLOT_NONE) {
 
+	/*
+	 * Currently favored mapping from PCI
+	 * slot number and INTA/B/C/D to Bridge
+	 * PCI Interrupt Bit Number:
+	 *
+	 *     SLOT     A B C D
+	 *      0       0 4 0 4
+	 *      1       1 5 1 5
+	 *      2       2 6 2 6
+	 *      3       3 7 3 7
+	 *      4       4 0 4 0
+	 *      5       5 1 5 1
+	 *      6       6 2 6 2
+	 *      7       7 3 7 3
+	 *
+	 * XXX- allow pcibr_hints to override default
+	 * XXX- allow ADMIN to override pcibr_hints
+	 */
 	for (ibit = 0; ibit < 4; ++ibit)
 	    pcibr_info->f_ibit[ibit] =
 		(slot + 4 * ibit) & 7;
@@ -2184,6 +2243,7 @@
     slotp->bss_d32_base = PCIBR_D32_BASE_UNSET;
     slotp->bss_d32_flags = 0;
 
+    /* Clear out shadow info necessary for the external SSRAM workaround */
     slotp->bss_ext_ates_active = ATOMIC_INIT(0);
     slotp->bss_cmd_pointer = 0;
     slotp->bss_cmd_shadow = 0;
@@ -2513,6 +2573,36 @@
 		}	
 	    }
 #if defined(IOC3_VENDOR_ID_NUM) && defined(IOC3_DEVICE_ID_NUM)
+	    /*
+	     * IOC3 BASE_ADDR* BUG WORKAROUND
+	     *
+	     
+	     * If we write to BASE1 on the IOC3, the
+	     * data in BASE0 is replaced. The
+	     * original workaround was to remember
+	     * the value of BASE0 and restore it
+	     * when we ran off the end of the BASE
+	     * registers; however, a later
+	     * workaround was added (I think it was
+	     * rev 1.44) to avoid setting up
+	     * anything but BASE0, with the comment
+	     * that writing all ones to BASE1 set
+	     * the enable-parity-error test feature
+	     * in IOC3's SCR bit 14.
+	     *
+	     * So, unless we defer doing any PCI
+	     * space allocation until drivers
+	     * attach, and set up a way for drivers
+	     * (the IOC3 in paricular) to tell us
+	     * generically to keep our hands off
+	     * BASE registers, we gotta "know" about
+	     * the IOC3 here.
+	     *
+	     * Too bad the PCI folks didn't reserve the
+	     * all-zero value for 'no BASE here' (it is a
+	     * valid code for an uninitialized BASE in
+	     * 32-bit PCI memory space).
+	     */
 	    
 	    if ((vendor == IOC3_VENDOR_ID_NUM) &&
 		(device == IOC3_DEVICE_ID_NUM))
@@ -2812,7 +2902,7 @@
 
 	pci_cfg_cmd_reg_p = cfgw + PCI_CFG_COMMAND / 4;
 	pci_cfg_cmd_reg = *pci_cfg_cmd_reg_p;
-#if PCI_FBBE	  
+#if PCI_FBBE	/* XXX- check here to see if dev can do fast-back-to-back */
 	if (!((pci_cfg_cmd_reg >> 16) & PCI_STAT_F_BK_BK_CAP))
 	    fast_back_to_back_enable = 0;
 #endif
@@ -2923,6 +3013,12 @@
 			 host_slotp->slot_conn,
 			 EDGE_LBL_HOST);
 
+	/* XXX- only gives us one guest edge per
+	 * host. If/when we have a host with more than
+	 * one guest, we will need to figure out how
+	 * the host finds all its guests, and sorts
+	 * out which one is which.
+	 */
 	hwgraph_edge_add(host_slotp->slot_conn,
 			 slotp->slot_conn,
 			 EDGE_LBL_GUEST);
@@ -3748,7 +3844,7 @@
 #endif
 
 	if (num_entries > pcibr_soft->bs_int_ate_size) {
-#if PCIBR_ATE_NOTBOTH			    /* for debug -- forces us to use external ates */
+#if PCIBR_ATE_NOTBOTH			/* for debug -- forces us to use external ates */
 	    printk("pcibr_attach: disabling internal ATEs.\n");
 	    pcibr_ate_alloc(pcibr_soft, pcibr_soft->bs_int_ate_size);
 #endif
@@ -5736,6 +5832,10 @@
     alenlist_cursor_init(pciio_alenlist, 0, NULL);
 
 
+    /* In case an ATE_FREEZE was done do the ATE_THAW to unroll all the
+     * changes that ATE_FREEZE has done to implement the external SSRAM
+     * bug workaround.
+     */
     if (ate_freeze_done) {
 	ATE_THAW();
 	bridge->b_wid_tflush;		/* wait until Bridge PIO complete */
@@ -7155,7 +7255,9 @@
 
 	ctlreg = bridge->b_wid_control;
 	bridge->b_wid_control = ctlreg | BRIDGE_CTRL_RST(pciio_slot);
+	/* XXX delay? */
 	bridge->b_wid_control = ctlreg;
+	/* XXX delay? */
 
 	for (f = 0; f < nf; ++f)
 	    if ((pcibr_info = pcibr_infoh[f]))
@@ -7242,6 +7344,20 @@
 
     counter = &(pcibr_soft->bs_slot[pciio_slot].bss_pri_uctr);
 
+    /*
+     * Bridge supports PCI notions of LOW and HIGH priority
+     * arbitration rings via a "REAL_TIME" bit in the per-device
+     * Bridge register. The "GBR" bit controls access to the GBR
+     * ring on the xbow. These two bits are (re)set together.
+     *
+     * XXX- Bug in Rev B Bridge Si:
+     * Symptom: Prefetcher starts operating incorrectly. This happens
+     * due to corruption of the address storage ram in the prefetcher
+     * when a non-real time PCI request is pulled and a real-time one is
+     * put in it's place. Workaround: Use only a single arbitration ring
+     * on PCI bus. GBR and RR can still be uniquely used per
+     * device. NETLIST MERGE DONE, WILL BE FIXED IN REV C.
+     */
 
     if (pcibr_soft->bs_rev_num != BRIDGE_PART_REV_B)
 	rtbits |= BRIDGE_DEV_RT;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/bte_error.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/bte_error.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/bte_error.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/bte_error.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: bte_error.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: bte_error.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -29,6 +29,30 @@
 #include <asm/sn/sn2/shubio.h>
 #include <asm/sn/bte.h>
 
+/************************************************************************
+ *									*
+ * 			 BTE ERROR RECOVERY				*
+ *									*
+ * Given a BTE error, the node causing the error must do the following: *
+ *    a) Clear all crbs relating to that BTE				*
+ *		1) Read CRBA value for crb in question			*
+ *		2) Mark CRB as VALID, store local physical 		*
+ *		   address known to be good in the address field	*
+ *		   (bte_notification_targ is a known good local		*
+ *		    address).						*
+ *		3) Write CRBA						*
+ *		4) Using ICCR, FLUSH the CRB, and wait for it to 	*
+ *		   complete.						*
+ *		... BTE BUSY bit should now be clear (or at least 	*
+ *		    should be after ALL CRBs associated with the 	*
+ *		    transfer are complete.				*
+ *									*
+ *    b) Re-enable BTE							*
+ *		1) Write IMEM with BTE Enable + XXX bits
+ *		2) Write IECLR with BTE clear bits
+ *		3) Clear IIDSR INT_SENT bits.
+ *									*
+ ************************************************************************/
 
 #ifdef BTE_ERROR
 // This routine is not called.  Yet.  It may be someday.  It probably
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/ml_SN_intr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/ml_SN_intr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/ml_SN_intr.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/ml_SN_intr.c	2005-11-08 06:23:46.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ml_SN_intr.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: ml_SN_intr.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -13,7 +13,7 @@
  *	handle interrupts on an IPXX board.
  */
 
-#ident  "$Revision: 1.1.1.4 $"
+#ident  "$Revision: 1.1 $"
 
 #include <linux/types.h>
 #include <linux/slab.h>
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_dvr.c	2005-11-08 06:23:46.000000000 -0800
@@ -39,6 +39,13 @@
 #define rmalloc atealloc
 #endif
 
+/*
+ * Macros related to the Lucent USS 302/312 usb timeout workaround.  It
+ * appears that if the lucent part can get into a retry loop if it sees a
+ * DAC on the bus during a pio read retry.  The loop is broken after about
+ * 1ms, so we need to set up bridges holding this part to allow at least
+ * 1ms for pio.
+ */
 
 #define USS302_TIMEOUT_WAR
 
@@ -539,7 +546,7 @@
 	     */
 	    if (bad) {
 		pcibr_unlock(pcibr_soft, s);
-#if DEBUG && PCIBR_DEV_DEBUG
+#if (DEBUG && PCIBR_DEV_DEBUG)
 		printk("pcibr_try_set_device: mod blocked by %R\n", bad, device_bits);
 #endif
 		return bad;
@@ -684,6 +691,15 @@
     len = ctob(btoc(len));		/* Make len page aligned */
     error = v_mapphys(vt, (void *) ((__psunsigned_t) bridge + off), len);
 
+    /*
+     * If the offset being mapped corresponds to the flash prom
+     * base, and if the mapping succeeds, and if the user
+     * has requested the protections to be WRITE, enable the
+     * flash prom to be written.
+     *
+     * XXX- deprecate this in favor of using the
+     * real flash driver ...
+     */
     if (!error &&
 	((off == BRIDGE_EXTERNAL_FLASH) ||
 	 (len > BRIDGE_EXTERNAL_FLASH))) {
@@ -968,6 +984,24 @@
 
     if (slot != PCIIO_SLOT_NONE) {
 
+	/*
+	 * Currently favored mapping from PCI
+	 * slot number and INTA/B/C/D to Bridge
+	 * PCI Interrupt Bit Number:
+	 *
+	 *     SLOT     A B C D
+	 *      0       0 4 0 4
+	 *      1       1 5 1 5
+	 *      2       2 6 2 6
+	 *      3       3 7 3 7
+	 *      4       4 0 4 0
+	 *      5       5 1 5 1
+	 *      6       6 2 6 2
+	 *      7       7 3 7 3
+	 *
+	 * XXX- allow pcibr_hints to override default
+	 * XXX- allow ADMIN to override pcibr_hints
+	 */
 	for (ibit = 0; ibit < 4; ++ibit)
 	    pcibr_info->f_ibit[ibit] =
 		(slot + 4 * ibit) & 7;
@@ -982,6 +1016,10 @@
 }
 
 
+/* FIXME:  for now this is needed by both pcibr.c and
+ * pcibr_slot.c.  Need to find a better way, the least
+ * of which would be to move it to pcibr_private.h
+ */
 
 /*
  * PCI_ADDR_SPACE_LIMITS_STORE
@@ -1629,7 +1667,7 @@
 #endif
 
 	if (num_entries > pcibr_soft->bs_int_ate_size) {
-#if PCIBR_ATE_NOTBOTH			    /* for debug -- forces us to use external ates */
+#if PCIBR_ATE_NOTBOTH			/* for debug -- forces us to use external ates */
 	    printk("pcibr_attach: disabling internal ATEs.\n");
 	    pcibr_ate_alloc(pcibr_soft, pcibr_soft->bs_int_ate_size);
 #endif
@@ -3342,6 +3380,10 @@
     alenlist_cursor_init(pciio_alenlist, 0, NULL);
 
 
+    /* In case an ATE_FREEZE was done do the ATE_THAW to unroll all the
+     * changes that ATE_FREEZE has done to implement the external SSRAM
+     * bug workaround.
+     */
     if (ate_freeze_done) {
 	ATE_THAW();
 	bridge->b_wid_tflush;		/* wait until Bridge PIO complete */
@@ -3957,7 +3999,9 @@
 
 	ctlreg = bridge->b_wid_control;
 	bridge->b_wid_control = ctlreg | BRIDGE_CTRL_RST(pciio_slot);
+	/* XXX delay? */
 	bridge->b_wid_control = ctlreg;
+	/* XXX delay? */
 
 	for (f = 0; f < nf; ++f)
 	    if ((pcibr_info = pcibr_infoh[f]))
@@ -4044,6 +4088,20 @@
 
     counter = &(pcibr_soft->bs_slot[pciio_slot].bss_pri_uctr);
 
+    /*
+     * Bridge supports PCI notions of LOW and HIGH priority
+     * arbitration rings via a "REAL_TIME" bit in the per-device
+     * Bridge register. The "GBR" bit controls access to the GBR
+     * ring on the xbow. These two bits are (re)set together.
+     *
+     * XXX- Bug in Rev B Bridge Si:
+     * Symptom: Prefetcher starts operating incorrectly. This happens
+     * due to corruption of the address storage ram in the prefetcher
+     * when a non-real time PCI request is pulled and a real-time one is
+     * put in it's place. Workaround: Use only a single arbitration ring
+     * on PCI bus. GBR and RR can still be uniquely used per
+     * device. NETLIST MERGE DONE, WILL BE FIXED IN REV C.
+     */
 
     if (pcibr_soft->bs_rev_num != BRIDGE_PART_REV_B)
 	rtbits |= BRIDGE_DEV_RT;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_error.c	2005-11-08 06:23:47.000000000 -0800
@@ -65,10 +65,11 @@
                                 BRIDGE_ISR_PCIBUS_PIOERR;
 #endif
 
-#if defined(PCIBR_LLP_CONTROL_WAR)
+#if defined (PCIBR_LLP_CONTROL_WAR)
 int                     pcibr_llp_control_war_cnt;
 #endif				/* PCIBR_LLP_CONTROL_WAR */
 
+/* FIXME: can these arrays be local ? */
 
 #ifdef LATER
 
@@ -732,11 +733,26 @@
 	(0x00402000 == (0x00F07F00 & bridge->b_wid_err_cmdword))) {
 	err_status &= ~BRIDGE_ISR_INVLD_ADDR;
     }
-#if defined(PCIBR_LLP_CONTROL_WAR)
+#if defined (PCIBR_LLP_CONTROL_WAR)
+    /*
+     * The bridge bug, where the llp_config or control registers
+     * need to be read back after being written, affects an MP
+     * system since there could be small windows between writing
+     * the register and reading it back on one cpu while another
+     * cpu is fielding an interrupt. If we run into this scenario,
+     * workaround the problem by ignoring the error. (bug 454474)
+     * pcibr_llp_control_war_cnt keeps an approximate number of
+     * times we saw this problem on a system.
+     */
 
     if ((err_status & BRIDGE_ISR_INVLD_ADDR) &&
 	((((uint64_t) bridge->b_wid_err_upper << 32) | (bridge->b_wid_err_lower))
 	 == (BRIDGE_INT_RST_STAT & 0xff0))) {
+#if 0
+	if (kdebug)
+	    printk(KERN_NOTICE "%s bridge: ignoring llp/control address interrupt",
+		    pcibr_soft->bs_name);
+#endif
 	pcibr_llp_control_war_cnt++;
 	err_status &= ~BRIDGE_ISR_INVLD_ADDR;
     }
@@ -939,6 +955,26 @@
     (void) bridge->b_wid_tflush;	/* flushbus */
 }
 
+/*
+ * pcibr_error_extract
+ *      Given the 'pcibr vertex handle' find out which slot
+ *      the bridge status error address (from pcibr_soft info
+ *      hanging off the vertex)
+ *      allocated to, and return the slot number.
+ *      While we have the info handy, construct the
+ *      space code and offset as well.
+ *
+ * NOTE: if this routine is called, we don't know whether
+ * the address is in CFG, MEM, or I/O space. We have to guess.
+ * This will be the case on PIO stores, where the only way
+ * we have of getting the address is to check the Bridge, which
+ * stores the PCI address but not the space and not the xtalk
+ * address (from which we could get it).
+ *
+ * XXX- this interface has no way to return the function
+ * number on a multifunction card, even though that data
+ * is available.
+ */
 
 pciio_slot_t
 pcibr_error_extract(devfs_handle_t pcibr_vhdl,
@@ -976,6 +1012,19 @@
 void
 pcibr_device_disable(pcibr_soft_t pcibr_soft, int devnum)
 {
+    /*
+     * XXX
+     * Device failed to handle error. Take steps to
+     * disable this device ? HOW TO DO IT ?
+     *
+     * If there are any Read response buffers associated
+     * with this device, it's time to get them back!!
+     *
+     * We can disassociate any interrupt level associated
+     * with this device, and disable that interrupt level
+     *
+     * For now it's just a place holder
+     */
 }
 
 /*
@@ -1208,6 +1257,14 @@
 		}			/* next window unless slot set */
 	    }				/* next func unless slot set */
 	}				/* next slot unless slot set */
+	/* XXX- if slot is still -1, no PCI devices are
+	 * decoding here using their standard PCI BASE
+	 * registers. This would be a really good place
+	 * to cross-coordinate with the pciio PCI
+	 * address space allocation routines, to find
+	 * out if this address is "allocated" by any of
+	 * our subsidiary devices.
+	 */
     }
     /* Scan all piomap records on this PCI bus to update
      * the TimeOut Counters on all matching maps. If we
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_rrb.c	2005-11-08 06:23:47.000000000 -0800
@@ -64,7 +64,7 @@
 
     /* wait until RRB has no outstanduing XIO packets. */
     while ((status = bridge->b_resp_status) & BRIDGE_RRB_INUSE(rrb)) {
-	;				
+	;				/* XXX- beats on bridge. bad idea? */
     }
 
     /* if the RRB has data, drain it. */
@@ -73,7 +73,7 @@
 
 	/* wait until RRB is no longer valid. */
 	while ((status = bridge->b_resp_status) & BRIDGE_RRB_VALID(rrb)) {
-	    ;				
+	    ;				/* XXX- beats on bridge. bad idea? */
 	}
     }
 }
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/pcibr/pcibr_slot.c	2005-11-08 06:23:47.000000000 -0800
@@ -36,6 +36,9 @@
 extern pcibr_info_t     pcibr_device_info_new(pcibr_soft_t, pciio_slot_t, pciio_function_t, pciio_vendor_id_t, pciio_device_id_t);
 extern void             pcibr_freeblock_sub(iopaddr_t *, iopaddr_t *, iopaddr_t, size_t);
 extern int		pcibr_slot_initial_rrb_alloc(devfs_handle_t,pciio_slot_t);
+#if 0
+int pcibr_slot_reset(devfs_handle_t pcibr_vhdl, pciio_slot_t slot);
+#endif
 
 int pcibr_slot_info_init(devfs_handle_t pcibr_vhdl, pciio_slot_t slot);
 int pcibr_slot_info_free(devfs_handle_t pcibr_vhdl, pciio_slot_t slot);
@@ -366,6 +369,28 @@
     return(0);
 }
 
+/*
+ * pcibr_slot_query
+ *	Return information about the PCI slot maintained by the infrastructure.
+ *	Information is requested in the request structure.
+ *
+ *      Information returned in the response structure:
+ *		Slot hwgraph name
+ *		Vendor/Device info
+ *		Base register info
+ *		Interrupt mapping from device pins to the bridge pins
+ *		Devio register
+ *		Software RRB info
+ *		RRB register info
+ *		Host/Gues info
+ *		PCI Bus #,slot #, function #
+ *		Slot provider hwgraph name
+ *		Provider Functions
+ *		Error handler
+ *		DMA mapping usage counters
+ *		DMA direct translation info
+ *		External SSRAM workaround info
+ */
 int
 pcibr_slot_query(devfs_handle_t pcibr_vhdl, pcibr_slot_req_t reqp)
 {
@@ -435,6 +460,9 @@
 }
 #endif	/* LATER */
 
+/* FIXME: there should be a better way to do this.
+ * pcibr_attach() needs PCI_ADDR_SPACE_LIMITS_STORE
+ */
 
 /* 
  * PCI_ADDR_SPACE_LIMITS_LOAD
@@ -760,6 +788,36 @@
 		}	
 	    }
 #if defined(IOC3_VENDOR_ID_NUM) && defined(IOC3_DEVICE_ID_NUM)
+	    /*
+	     * IOC3 BASE_ADDR* BUG WORKAROUND
+	     *
+	     
+	     * If we write to BASE1 on the IOC3, the
+	     * data in BASE0 is replaced. The
+	     * original workaround was to remember
+	     * the value of BASE0 and restore it
+	     * when we ran off the end of the BASE
+	     * registers; however, a later
+	     * workaround was added (I think it was
+	     * rev 1.44) to avoid setting up
+	     * anything but BASE0, with the comment
+	     * that writing all ones to BASE1 set
+	     * the enable-parity-error test feature
+	     * in IOC3's SCR bit 14.
+	     *
+	     * So, unless we defer doing any PCI
+	     * space allocation until drivers
+	     * attach, and set up a way for drivers
+	     * (the IOC3 in paricular) to tell us
+	     * generically to keep our hands off
+	     * BASE registers, we gotta "know" about
+	     * the IOC3 here.
+	     *
+	     * Too bad the PCI folks didn't reserve the
+	     * all-zero value for 'no BASE here' (it is a
+	     * valid code for an uninitialized BASE in
+	     * 32-bit PCI memory space).
+	     */
 	    
 	    if ((vendor == IOC3_VENDOR_ID_NUM) &&
 		(device == IOC3_DEVICE_ID_NUM))
@@ -1060,7 +1118,7 @@
 
 	pci_cfg_cmd_reg_p = cfgw + PCI_CFG_COMMAND / 4;
 	pci_cfg_cmd_reg = *pci_cfg_cmd_reg_p;
-#if PCI_FBBE	  
+#if PCI_FBBE	/* XXX- check here to see if dev can do fast-back-to-back */
 	if (!((pci_cfg_cmd_reg >> 16) & PCI_STAT_F_BK_BK_CAP))
 	    fast_back_to_back_enable = 0;
 #endif
@@ -1171,6 +1229,12 @@
 			 host_slotp->slot_conn,
 			 EDGE_LBL_HOST);
 
+	/* XXX- only gives us one guest edge per
+	 * host. If/when we have a host with more than
+	 * one guest, we will need to figure out how
+	 * the host finds all its guests, and sorts
+	 * out which one is which.
+	 */
 	hwgraph_edge_add(host_slotp->slot_conn,
 			 slotp->slot_conn,
 			 EDGE_LBL_GUEST);
@@ -1372,6 +1436,15 @@
          nano_delay(&ts);
 #else
 #endif
+#if 0
+        /* Reset the slot */
+        error = pcibr_slot_reset(pcibr_vhdl, slot)
+        if (error) {
+            if (sub_errorp)
+                *sub_errorp = error;
+            return(PCI_SLOT_RESET_ERR);
+        }
+#endif
 
         /* Find out what is out there */
         error = pcibr_slot_info_init(pcibr_vhdl, slot);
@@ -1611,6 +1684,7 @@
     slotp->bss_d32_base = PCIBR_D32_BASE_UNSET;
     slotp->bss_d32_flags = 0;
 
+    /* Clear out shadow info necessary for the external SSRAM workaround */
     slotp->bss_ext_ates_active = ATOMIC_INIT(0);
     slotp->bss_cmd_pointer = 0;
     slotp->bss_cmd_shadow = 0;
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/shuberror.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/shuberror.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/shuberror.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/shuberror.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: shuberror.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: shuberror.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -295,6 +295,26 @@
 	"Xtalk Error Packet"
 };
 
+/*
+ * hubiio_crb_error_handler
+ *
+ *	This routine gets invoked when a hub gets an error 
+ *	interrupt. So, the routine is running in interrupt context
+ *	at error interrupt level.
+ * Action:
+ *	It's responsible for identifying ALL the CRBs that are marked
+ *	with error, and process them. 
+ *	
+ * 	If you find the CRB that's marked with error, map this to the
+ *	reason it caused error, and invoke appropriate error handler.
+ *
+ *	XXX Be aware of the information in the context register.
+ *
+ * NOTE:
+ *	Use REMOTE_HUB_* macro instead of LOCAL_HUB_* so that the interrupt
+ *	handler can be run on any node. (not necessarily the node 
+ *	corresponding to the hub that encountered error).
+ */
 
 int
 hubiio_crb_error_handler(devfs_handle_t hub_v, hubinfo_t hinfo)
@@ -350,6 +370,16 @@
 			continue;
 		}
 
+		/*
+		 * XXX
+		 * Assuming the only other error that would reach here is
+		 * crosstalk errors. 
+		 * If CRB times out on a message from Xtalk, it changes 
+		 * the message type to CRB. 
+		 *
+		 * If we get here due to other errors (SN0net/CRB)
+		 * what's the action ?
+		 */
 
 		/*
 		 * Pick out the useful fields in CRB, and
@@ -360,6 +390,15 @@
 
 
 		if (icrba.a_iow){
+			/*
+			 * XXX We shouldn't really have BRIDGE-specific code
+			 * here, but alas....
+			 *
+			 * The BRIDGE (or XBRIDGE) sets the upper bit of TNUM
+			 * to indicate a WRITE operation.  It sets the next
+			 * bit to indicate an INTERRUPT operation.  The bottom
+			 * 3 bits of TNUM indicate which device was responsible.
+			 */
 			IOERROR_SETVALUE(&ioerror,widgetdev,
 					 TNUM_TO_WIDGET_DEV(icrba.a_tnum));
 
@@ -396,6 +435,11 @@
          */
         printk( "Hub nasid %d got a PIO Write error from widget %d, cleaning up and continuing",
                         nasid, wnum);
+        /*
+         * XXX
+         * It may be necessary to adjust IO PRB counter
+         * to account for any lost credits.
+         */
 }
 
 int
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/sn2/shub_intr.c linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/shub_intr.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/sn2/shub_intr.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/sn2/shub_intr.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: shub_intr.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id: shub_intr.c,v 1.1 2002/02/28 17:31:25 marcelo Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/stubs.c linux-2.4.20-WRTstp/arch/ia64/sn/io/stubs.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/stubs.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/stubs.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: stubs.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/xbow.c linux-2.4.20-WRTstp/arch/ia64/sn/io/xbow.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/xbow.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/xbow.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: xbow.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -411,6 +411,12 @@
 	 */
 	xbow->xb_link(port).link_control =
 	    ( (xbow->xb_link(port).link_control
+	/*
+	 * Turn off these bits; they are non-fatal,
+	 * but we might want to save some statistics
+	 * on the frequency of these errors.
+	 * XXX FIXME XXX
+	 */
 	    & ~XB_CTRL_RCV_CNT_OFLOW_IE
 	    & ~XB_CTRL_XMT_CNT_OFLOW_IE
 	    & ~XB_CTRL_BNDWDTH_ALLOC_IE
@@ -456,6 +462,7 @@
 
     ASSERT(soft);
     len = ctob(btoc(len));
+    /* XXX- this ignores the offset!!! */
     error = v_mapphys(vt, (void *) soft->base, len);
     return error;
 }
@@ -515,7 +522,7 @@
     devfs_handle_t            vhdl;
     int                     error = 0;
 
-#if defined(DEBUG)
+#if defined (DEBUG)
     int                     rc;
     devfs_handle_t            conn;
     struct xwidget_info_s  *xwidget_info;
@@ -524,7 +531,7 @@
     *rvalp = 0;
 
     vhdl = dev_to_vhdl(dev);
-#if defined(DEBUG)
+#if defined (DEBUG)
     xbow_soft = xbow_soft_get(vhdl);
     conn = xbow_soft->conn;
 
@@ -756,6 +763,18 @@
 }
 #endif	/* LATER */
 
+/*
+ * xbow_intr_preset: called during mlreset time
+ * if the platform specific code needs to route
+ * an xbow interrupt before the xtalk infrastructure
+ * is available for use.
+ *
+ * Also called from xbow_setwidint, so we don't
+ * replicate the guts of the routine.
+ *
+ * XXX- probably should be renamed xbow_wid_intr_set or
+ * something to reduce confusion.
+ */
 /*ARGSUSED3 */
 void
 xbow_intr_preset(void *which_widget,
@@ -847,6 +866,10 @@
      */
     if ((part != BRIDGE_WIDGET_PART_NUM) ||
 	(mfgr != BRIDGE_WIDGET_MFGR_NUM)) {
+		/* FIXME: add Xbridge to the WAR.
+		 * Shouldn't hurt anything.  Later need to
+		 * check if we can remove this.
+                 */
     		if ((part != XBRIDGE_WIDGET_PART_NUM) ||
 		    (mfgr != XBRIDGE_WIDGET_MFGR_NUM))
 			return 0;
@@ -1076,7 +1099,7 @@
     widget_info = xwidget_info_get(xconn_vhdl);
     port = xwidget_info_id_get(widget_info);
 
-#ifdef XBOW_K1PTR			    /* defined if we only have one xbow ... */
+#ifdef XBOW_K1PTR			/* defined if we only have one xbow ... */
     xbow = XBOW_K1PTR;
 #else
     {
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/xswitch.c linux-2.4.20-WRTstp/arch/ia64/sn/io/xswitch.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/xswitch.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/xswitch.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: xswitch.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/io/xtalk.c linux-2.4.20-WRTstp/arch/ia64/sn/io/xtalk.c
--- linux-2.4.20-WRT/arch/ia64/sn/io/xtalk.c	2003-10-14 01:07:23.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/io/xtalk.c	2005-11-08 06:23:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: xtalk.c,v 1.1.1.4 2003/10/14 08:07:23 sparq Exp $
+/* $Id$
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/kernel/iomv.c linux-2.4.20-WRTstp/arch/ia64/sn/kernel/iomv.c
--- linux-2.4.20-WRT/arch/ia64/sn/kernel/iomv.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/kernel/iomv.c	2005-11-08 06:23:47.000000000 -0800
@@ -8,12 +8,14 @@
 
 #include <asm/io.h>
 
+#if 1	/* ##jh */
 #ifdef CONFIG_IA64_SGI_SN1
 #define mmiob sn1_mmiob
 #else
 #define mmiob sn2_mmiob
 #endif
 extern void mmiob(void);
+#endif /* ##jh */
 
 extern void * sn_io_addr(unsigned long port); /* defined in sn[12]/iomv.c */
 
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/kernel/setup.c linux-2.4.20-WRTstp/arch/ia64/sn/kernel/setup.c
--- linux-2.4.20-WRT/arch/ia64/sn/kernel/setup.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/kernel/setup.c	2005-11-08 06:23:47.000000000 -0800
@@ -401,3 +401,15 @@
 	return cpu;
 }
 
+#if 0 /* ##jh */
+/**
+ * get_cycles - return a non-decreasing timestamp
+ *
+ * On SN, we use an RTC read for this function
+ */
+cycles_t
+get_cycles (void)
+{
+	return GET_RTC_COUNTER();
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/kernel/sn1/synergy.c linux-2.4.20-WRTstp/arch/ia64/sn/kernel/sn1/synergy.c
--- linux-2.4.20-WRT/arch/ia64/sn/kernel/sn1/synergy.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/kernel/sn1/synergy.c	2005-11-08 06:23:47.000000000 -0800
@@ -474,6 +474,13 @@
 		/* this should not happen: still in early io init */
 		return;
 
+#if 0
+	/* use this to check nodepda initialization */
+	if (((uint64_t)npdap) & 0x7) {
+		printk("\nERROR on cpu %d : cnode=%d, npdap == %p, not aligned\n", cpu, cnode, npdap);
+		BUG();
+	}
+#endif
 
 	if (npdap->synergy_perf_enabled == 0 || npdap->synergy_perf_data == NULL) {
 		/* Not enabled, or no events to monitor */
diff -ruN linux-2.4.20-WRT/arch/ia64/sn/kernel/sv.c linux-2.4.20-WRTstp/arch/ia64/sn/kernel/sv.c
--- linux-2.4.20-WRT/arch/ia64/sn/kernel/sv.c	2003-07-04 01:11:07.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/ia64/sn/kernel/sv.c	2005-11-08 06:23:47.000000000 -0800
@@ -49,6 +49,8 @@
 #endif /* DEBUG */
 
 
+/* XXX FIXME hack hack hack.  Our mips64 tree is from before the
+   switch to WQ_FLAG_EXCLUSIVE, and our ia64 tree is from after it. */
 #ifdef TASK_EXCLUSIVE
   #undef EXCLUSIVE_IN_QUEUE
 #else
@@ -76,6 +78,8 @@
 	spin_unlock(s);
 }
 
+/* XXX Perhaps sv_wait() should do the switch() each time and avoid
+   the extra indirection and the need for the _wrapper functions? */
 
 static inline void sv_set_mon_type(sv_t *sv, int type) {
 	switch (type) {
@@ -99,6 +103,21 @@
 			BUG();
 		}
 		break;
+#if 0 
+	/*
+	 * If needed, and will need to think about interrupts.  This
+	 * may be needed, for example, if someone wants to use sv's
+	 * with something like dev_base; writers need to hold two
+	 * locks. 
+	 */
+	case SV_MON_CUSTOM: 
+		{
+		struct sv_mon_custom *c = lock;
+		sv->sv_mon_unlock_func = c->sv_mon_unlock_func;
+		sv->sv_mon_lock        = c->sv_mon_lock;
+		break;
+		}
+#endif
 		
 	default:
 		printk(KERN_ERR "sv_set_mon_type: unknown type %d (0x%x)! "
@@ -228,7 +247,7 @@
 	else
 		schedule();
 
-	if(current->state != TASK_RUNNING)  {
+	if(current->state != TASK_RUNNING) /* XXX Is this possible? */ {
 		printk(KERN_ERR "sv_wait: state not TASK_RUNNING after "
 		       "schedule().\n");
 		set_current_state(TASK_RUNNING);
@@ -242,6 +261,8 @@
 	   - woken by timeout expiring
 	*/
 
+	/* XXX This isn't really accurate; we may have been woken
+           before the signal anyway.... */
 	if(signal_pending(current))
 		return timeout ? -ret : -1;
 	return timeout ? ret : 1;
@@ -294,6 +315,9 @@
 		BUG();
 	}
 
+	/* XXX Check that the waitqueue is empty? 
+	       Mark the sv destroyed?
+	*/
 }
 
 
diff -ruN linux-2.4.20-WRT/arch/m68k/apollo/config.c linux-2.4.20-WRTstp/arch/m68k/apollo/config.c
--- linux-2.4.20-WRT/arch/m68k/apollo/config.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/apollo/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -227,6 +227,10 @@
 	/* enable IRQ of PIC B */
 	*(volatile unsigned char *)(pica+1)&=(~8);
 
+#if 0
+	printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3));
+	printk("*(0x10803) %02x\n",*(volatile unsigned char *)(timer+0x3));
+#endif
 
 	sched_timer_handler=timer_routine;
 	request_irq(0,dn_timer_int,0,NULL,NULL);
diff -ruN linux-2.4.20-WRT/arch/m68k/apollo/dma.c linux-2.4.20-WRTstp/arch/m68k/apollo/dma.c
--- linux-2.4.20-WRT/arch/m68k/apollo/dma.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/apollo/dma.c	2000-01-28 08:04:58.000000000 -0800
@@ -24,6 +24,9 @@
 
 	free_xlat_entry=next_free_xlat_entry;
 	for(i=0,xlat_map_entry=addr_xlat_map+(free_xlat_entry<<2);i<8;i++,xlat_map_entry++) {
+#if 0
+		printk("phys_addr: %x, page_aligned_addr: %x, start_map_addr: %x\n",phys_addr,page_aligned_addr,start_map_addr+i);
+#endif
 		outw(start_map_addr+i, xlat_map_entry);
 	}
 
@@ -31,6 +34,9 @@
 	if(next_free_xlat_entry>125)
 		next_free_xlat_entry=0;
 	
+#if 0
+	printk("next_free_xlat_entry: %d\n",next_free_xlat_entry);
+#endif
 
 	return free_xlat_entry<<10;
 }
diff -ruN linux-2.4.20-WRT/arch/m68k/atari/atakeyb.c linux-2.4.20-WRTstp/arch/m68k/atari/atakeyb.c
--- linux-2.4.20-WRT/arch/m68k/atari/atakeyb.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/atari/atakeyb.c	2000-12-05 12:43:47.000000000 -0800
@@ -502,6 +502,10 @@
 	}
     }
 
+#if 0
+    if (acia_stat & ACIA_CTS)
+	/* cannot happen */;
+#endif
 
     if (acia_stat & (ACIA_FE | ACIA_PE))
     {
@@ -680,6 +684,18 @@
     ikbd_write(cmd, 1);
 }
 
+#if 0
+/* This disables all other ikbd activities !!!! */
+/* Set joystick monitoring */
+void ikbd_joystick_monitor(int rate)
+{
+    static const char cmd[2] = { 0x17, rate };
+
+    ikbd_write(cmd, 2);
+
+    kb_state.state = JOYSTICK_MONITOR;
+}
+#endif
 
 /* some joystick routines not in yet (0x18-0x19) */
 
diff -ruN linux-2.4.20-WRT/arch/m68k/atari/config.c linux-2.4.20-WRTstp/arch/m68k/atari/config.c
--- linux-2.4.20-WRT/arch/m68k/atari/config.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/atari/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -114,6 +114,36 @@
  *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
  */
   
+#if 0
+static int __init
+hwreg_present_bywrite(volatile void *regp, unsigned char val)
+{
+    int		ret;
+    long	save_sp, save_vbr;
+    static long tmp_vectors[3] = { 0, 0, (long)&&after_test };
+	
+    __asm__ __volatile__
+	(	"movec	%/vbr,%2\n\t"	/* save vbr value            */
+                "movec	%4,%/vbr\n\t"	/* set up temporary vectors  */
+		"movel	%/sp,%1\n\t"	/* save sp                   */
+		"moveq	#0,%0\n\t"	/* assume not present        */
+		"moveb	%5,%3@\n\t"	/* write the hardware reg    */
+		"cmpb	%3@,%5\n\t"	/* compare it                */
+		"seq	%0"		/* comes here only if reg    */
+                                        /* is present                */
+		: "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)
+		: "a" (regp), "r" (tmp_vectors), "d" (val)
+                );
+  after_test:
+    __asm__ __volatile__
+      (	"movel	%0,%/sp\n\t"		/* restore sp                */
+        "movec	%1,%/vbr"			/* restore vbr               */
+        : : "r" (save_sp), "r" (save_vbr) : "sp"
+	);
+
+    return( ret );
+}
+#endif
 
 
 /* ++roman: This is a more elaborate test for an SCC chip, since the plain
@@ -354,7 +384,13 @@
         printk( "DSP56K " );
     }
     if (hwreg_present( &tt_scc_dma.dma_ctrl ) &&
+#if 0
+	/* This test sucks! Who knows some better? */
+	(tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
+	(tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
+#else
 	!MACH_IS_MEDUSA && !MACH_IS_HADES
+#endif
 	) {
 	ATARIHW_SET(SCC_DMA);
         printk( "SCC_DMA " );
@@ -390,6 +426,7 @@
 	ATARIHW_SET(IDE);
         printk( "IDE " );
     }
+#if 1 /* This maybe wrong */
     if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
 	hwreg_present( &tt_microwire.data ) &&
 	hwreg_present( &tt_microwire.mask ) &&
@@ -402,6 +439,7 @@
 	while (tt_microwire.mask != 0x7ff) ;
         printk( "MICROWIRE " );
     }
+#endif
     if (hwreg_present( &tt_rtc.regsel )) {
 	ATARIHW_SET(TT_CLK);
         printk( "TT_CLK " );
diff -ruN linux-2.4.20-WRT/arch/m68k/atari/hades-pci.c linux-2.4.20-WRTstp/arch/m68k/atari/hades-pci.c
--- linux-2.4.20-WRT/arch/m68k/atari/hades-pci.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/atari/hades-pci.c	2001-02-13 14:13:43.000000000 -0800
@@ -9,7 +9,11 @@
 #include <linux/kernel.h>
 #include <asm/io.h>
 
+#if 0
+# define DBG_DEVS(args)		printk args
+#else
 # define DBG_DEVS(args)
+#endif
 
 #if defined(CONFIG_PCI) && defined(CONFIG_HADES)
 
@@ -394,6 +398,7 @@
 	bus->mem_space.start = HADES_MEM_BASE;
 	bus->mem_space.end = HADES_MEM_BASE + HADES_MEM_SIZE - 1;
 	bus->mem_space.name = pci_mem_name;
+#if 1
 	if (request_resource(&iomem_resource, &bus->mem_space) != 0)
 	{
 		release_resource(&io_space);
@@ -401,9 +406,11 @@
 		kfree(bus);
 		return NULL;
 	}
+#endif
 	bus->io_space.start = pci_io_base_virt;
 	bus->io_space.end = pci_io_base_virt + HADES_VIRT_IO_SIZE - 1;
 	bus->io_space.name = pci_io_name;
+#if 1
 	if (request_resource(&ioport_resource, &bus->io_space) != 0)
 	{
 		release_resource(&bus->mem_space);
@@ -412,6 +419,7 @@
 		kfree(bus);
 		return NULL;
 	}
+#endif
 	/*
 	 * Set hardware dependent functions.
 	 */
diff -ruN linux-2.4.20-WRT/arch/m68k/bvme6000/bvmeints.c linux-2.4.20-WRTstp/arch/m68k/bvme6000/bvmeints.c
--- linux-2.4.20-WRT/arch/m68k/bvme6000/bvmeints.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/bvme6000/bvmeints.c	1998-12-17 09:06:29.000000000 -0800
@@ -66,6 +66,15 @@
 		printk("%s: Incorrect IRQ %d from %s\n", __FUNCTION__, irq, devname);
 		return -ENXIO;
 	}
+#if 0
+	/* Nothing special about auto-vectored devices for the BVME6000,
+	 * but treat it specially to avoid changes elsewhere.
+	 */
+
+	if (irq >= VEC_INT1 && irq <= VEC_INT7)
+		return sys_request_irq(irq - VEC_SPUR, handler, flags,
+						devname, dev_id);
+#endif
 	if (!(irq_tab[irq].flags & IRQ_FLG_STD)) {
 		if (irq_tab[irq].flags & IRQ_FLG_LOCK) {
 			printk("%s: IRQ %d from %s is not replaceable\n",
@@ -91,6 +100,12 @@
 		printk("%s: Incorrect IRQ %d\n", __FUNCTION__, irq);
 		return;
 	}
+#if 0
+	if (irq >= VEC_INT1 && irq <= VEC_INT7) {
+		sys_free_irq(irq - VEC_SPUR, dev_id);
+		return;
+	}
+#endif
 	if (irq_tab[irq].dev_id != dev_id)
 		printk("%s: Removing probably wrong IRQ %d from %s\n",
 		       __FUNCTION__, irq, irq_tab[irq].devname);
diff -ruN linux-2.4.20-WRT/arch/m68k/bvme6000/config.c linux-2.4.20-WRTstp/arch/m68k/bvme6000/config.c
--- linux-2.4.20-WRT/arch/m68k/bvme6000/config.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/bvme6000/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -125,6 +125,13 @@
 	else
 	    vme_brdtype = VME_TYPE_BVME4000;
     }
+#if 0
+    /* Call bvme6000_set_vectors() so ABORT will work, along with BVMBug
+     * debugger.  Note trap_init() will splat the abort vector, but
+     * bvme6000_init_IRQ() will put it back again.  Hopefully. */
+
+    bvme6000_set_vectors();
+#endif
 
     mach_max_dma_address = 0xffffffff;
     mach_sched_init      = bvme6000_sched_init;
diff -ruN linux-2.4.20-WRT/arch/m68k/hp300/config.c linux-2.4.20-WRTstp/arch/m68k/hp300/config.c
--- linux-2.4.20-WRT/arch/m68k/hp300/config.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/hp300/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -63,6 +63,9 @@
   mach_get_irq_list    = hp300_get_irq_list;
   mach_gettimeoffset   = hp300_gettimeoffset;
   mach_default_handler = &hp300_default_handler;
+#if 0
+  mach_gettod          = hp300_gettod;
+#endif
   mach_reset           = hp300_reset;
 #ifdef CONFIG_HEARTBEAT
   mach_heartbeat       = hp300_pulse;
diff -ruN linux-2.4.20-WRT/arch/m68k/hp300/hil.c linux-2.4.20-WRTstp/arch/m68k/hp300/hil.c
--- linux-2.4.20-WRT/arch/m68k/hp300/hil.c	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/hp300/hil.c	2005-11-08 06:24:35.000000000 -0800
@@ -225,6 +225,10 @@
     {
       int down = (poll.data[1] & 1) == 0;
       unsigned char scode = poll.data[1] >> 1;
+#if 0
+      if (down)
+	printk("[%02x]", scode);
+#endif
       handle_scancode(scode, down);
     }
     break;
diff -ruN linux-2.4.20-WRT/arch/m68k/hp300/reboot.S linux-2.4.20-WRTstp/arch/m68k/hp300/reboot.S
--- linux-2.4.20-WRT/arch/m68k/hp300/reboot.S	2003-07-04 01:11:08.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/hp300/reboot.S	1998-06-13 13:14:31.000000000 -0700
@@ -9,6 +9,7 @@
  *  a brave face on it.
  */
 
+/* XXX Doesn't work yet.  Not sure why and can't be bothered to fix it at the moment. */
 
 	.globl	hp300_reset
 hp300_reset:
diff -ruN linux-2.4.20-WRT/arch/m68k/ifpsp060/os.S linux-2.4.20-WRTstp/arch/m68k/ifpsp060/os.S
--- linux-2.4.20-WRT/arch/m68k/ifpsp060/os.S	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/ifpsp060/os.S	2000-11-27 17:11:26.000000000 -0800
@@ -297,6 +297,53 @@
 	rts
 
 
+#if 0
+|###############################################
+
+|
+| Use these routines if your kernel doesn't have _copyout/_copyin equivalents.
+| Assumes that D0/D1/A0/A1 are scratch registers. The _copyin/_copyout
+| below assume that the SFC/DFC have been set previously.
+|
+| Linux/68k: These are basically non-inlined versions of
+| memcpy_{to,from}fs, but without long-transfer optimization
+| Note: Assumed that SFC/DFC are pointing correctly to user data
+| space... Should be right, or are there any exceptions?
+
+|
+| int _copyout(supervisor_addr, user_addr, nbytes)
+|
+	.global 		_copyout
+_copyout:
+	move.l		4(%sp),%a0		| source
+	move.l		8(%sp),%a1		| destination
+	move.l		12(%sp),%d0		| count
+	subq.l		#1,%d0
+moreout:
+	move.b		(%a0)+,%d1		| fetch supervisor byte
+copyoutae:
+	movs.b		%d1,(%a1)+		| store user byte
+	dbra		%d0,moreout		| are we through yet?
+	moveq		#0,%d0			| return success
+	rts
+
+|
+| int _copyin(user_addr, supervisor_addr, nbytes)
+|
+	.global 		_copyin
+_copyin:
+	move.l		4(%sp),%a0		| source
+	move.l		8(%sp),%a1		| destination
+	move.l		12(%sp),%d0		| count
+    subq.l      #1,%d0
+morein:
+copyinae:	
+	movs.b		(%a0)+,%d1		| fetch user byte
+	move.b		%d1,(%a1)+		| write supervisor byte
+	dbra		%d0,morein		| are we through yet?
+	moveq		#0,%d0			| return success
+	rts
+#endif
 
 |###########################################################################
 
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/bios32.c linux-2.4.20-WRTstp/arch/m68k/kernel/bios32.c
--- linux-2.4.20-WRT/arch/m68k/kernel/bios32.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/bios32.c	2001-03-06 19:44:36.000000000 -0800
@@ -10,7 +10,11 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 
+#if 0
+# define DBG_DEVS(args)		printk args
+#else
 # define DBG_DEVS(args)
+#endif
 
 #ifdef CONFIG_PCI
 
@@ -405,10 +409,17 @@
 
 				if ((r->start == 0) || (r->parent != NULL))
 					continue;
+#if 1
 				if (r->flags & IORESOURCE_IO)
 					pr = &bus_info->io_space;
 				else
 					pr = &bus_info->mem_space;
+#else
+				if (r->flags & IORESOURCE_IO)
+					pr = &ioport_resource;
+				else
+					pr = &iomem_resource;
+#endif
 				if (request_resource(pr, r) < 0)
 				{
 					printk(KERN_ERR "PCI: Address space collision on region %d of device %s\n", i, dev->name);
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/entry.S linux-2.4.20-WRTstp/arch/m68k/kernel/entry.S
--- linux-2.4.20-WRT/arch/m68k/kernel/entry.S	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/entry.S	2005-11-08 06:24:35.000000000 -0800
@@ -144,6 +144,10 @@
 	andw	#ALLOWINT,%sr
 	tstl	%curptr@(TASK_NEEDRESCHED)
 	jne	SYMBOL_NAME(reschedule)
+#if 0
+	cmpl	#SYMBOL_NAME(task),%curptr	| task[0] cannot have signals
+	jeq	2f
+#endif
 					| check for delayed trace
 	bclr	#PT_DTRACE_BIT,%curptr@(TASK_PTRACE+PT_DTRACE_OFF)
 	jne	do_delayed_trace
@@ -177,6 +181,34 @@
 	jra	5b
 
 
+#if 0
+#if CONFIG_AMIGA
+SYMBOL_NAME_LABEL(ami_inthandler)
+	addql	#1,SYMBOL_NAME(irq_stat)+4	| local_irq_count
+	SAVE_ALL_INT
+	GET_CURRENT(%d0)
+
+	bfextu	%sp@(PT_VECTOR){#4,#12},%d0
+	movel	%d0,%a0
+	addql	#1,%a0@(SYMBOL_NAME(kstat)+STAT_IRQ-VECOFF(VEC_SPUR))
+	movel	%a0@(SYMBOL_NAME(autoirq_list)-VECOFF(VEC_SPUR)),%a0
+
+| amiga vector int handler get the req mask instead of irq vector
+	lea	CUSTOMBASE,%a1
+	movew	%a1@(C_INTREQR),%d0
+	andw	%a1@(C_INTENAR),%d0
+
+| prepare stack (push frame pointer, dev_id & req mask)
+	pea	%sp@
+	movel	%a0@(IRQ_DEVID),%sp@-
+	movel	%d0,%sp@-
+	pea	%pc@(SYMBOL_NAME(ret_from_interrupt):w)
+	jbra	@(IRQ_HANDLER,%a0)@(0)
+
+ENTRY(nmi_handler)
+	rte
+#endif
+#endif
 
 /*
 ** This is the main interrupt handler, responsible for calling process_int()
@@ -208,11 +240,13 @@
 2:
 	RESTORE_ALL
 1:
+#if 1
 	bfextu  %sp@(PT_SR){#5,#3},%d0	| Check for nested interrupt.
 #if MAX_NOINT_IPL > 0
 	cmpiw	#MAX_NOINT_IPL,%d0
 #endif
 	jhi	2b
+#endif
 	/* check if we need to do software interrupts */
 	tstl	SYMBOL_NAME(irq_stat)	| softirq_pending ?
 	jeq	SYMBOL_NAME(ret_from_exception)
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/head.S linux-2.4.20-WRTstp/arch/m68k/kernel/head.S
--- linux-2.4.20-WRT/arch/m68k/kernel/head.S	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/head.S	2005-11-08 06:24:35.000000000 -0800
@@ -683,6 +683,7 @@
 	lea	%pc@(SYMBOL_NAME(m68k_cputype)),%a1
 	movel	%a0@,%a1@
 #else /* CONFIG_HP300 */
+	/* FIXME HP300 doesn't use bootinfo yet */
 	movel	#MACH_HP300,%d4
 	lea	%pc@(SYMBOL_NAME(m68k_machtype)),%a0
 	movel	%d4,%a0@
@@ -729,6 +730,26 @@
 	movel	%a0@,%a1@
 #endif /* MAC_SERIAL_DEBUG */
 
+#if 0
+	/*
+	 * Clear the screen
+	 */
+	lea	%pc@(L(mac_videobase)),%a0
+	movel	%a0@,%a1
+	lea	%pc@(L(mac_dimensions)),%a0
+	movel	%a0@,%d1
+	swap	%d1		/* #rows is high bytes */
+	andl	#0xFFFF,%d1	/* rows */
+	subl	#10,%d1
+	lea	%pc@(L(mac_rowbytes)),%a0
+loopy2:
+	movel	%a0@,%d0
+	subql	#1,%d0
+loopx2:
+	moveb	#0x55, %a1@+
+	dbra	%d0,loopx2
+	dbra	%d1,loopy2
+#endif
 
 L(test_notmac):
 #endif /* CONFIG_MAC */
@@ -1667,6 +1688,70 @@
 	puts	"rp:"
 	putn	%a5
 	putc	'\n'
+#if 0
+	/*
+	 * The following #if/#endif block is a tight algorithm for dumping the 040
+	 * MMU Map in gory detail.  It really isn't that practical unless the
+	 * MMU Map algorithm appears to go awry and you need to debug it at the
+	 * entry per entry level.
+	 */
+	movel	#ROOT_TABLE_SIZE,%d5
+#if 0
+	movel	%a5@+,%d7		| Burn an entry to skip the kernel mappings,
+	subql	#1,%d5			| they (might) work
+#endif
+1:	tstl	%d5
+	jbeq	mmu_print_done
+	subq	#1,%d5
+	movel	%a5@+,%d7
+	btst	#1,%d7
+	jbeq	1b
+
+2:	putn	%d7
+	andil	#0xFFFFFE00,%d7
+	movel	%d7,%a4
+	movel	#PTR_TABLE_SIZE,%d4
+	putc	' '
+3:	tstl	%d4
+	jbeq	11f
+	subq	#1,%d4
+	movel	%a4@+,%d7
+	btst	#1,%d7
+	jbeq	3b
+
+4:	putn	%d7
+	andil	#0xFFFFFF00,%d7
+	movel	%d7,%a3
+	movel	#PAGE_TABLE_SIZE,%d3
+5:	movel	#8,%d2
+6:	tstl	%d3
+	jbeq	31f
+	subq	#1,%d3
+	movel	%a3@+,%d6
+	btst	#0,%d6
+	jbeq	6b
+7:	tstl	%d2
+	jbeq	8f
+	subq	#1,%d2
+	putc	' '
+	jbra	91f
+8:	putc	'\n'
+	movel	#8+1+8+1+1,%d2
+9:	putc	' '
+	dbra	%d2,9b
+	movel	#7,%d2
+91:	putn	%d6
+	jbra	6b
+
+31:	putc	'\n'
+	movel	#8+1,%d2
+32:	putc	' '
+	dbra	%d2,32b
+	jbra	3b
+
+11:	putc	'\n'
+	jbra	1b
+#endif /* MMU 040 Dumping code that's gory and detailed */
 
 	lea	%pc@(SYMBOL_NAME(kernel_pg_dir)),%a5
 	movel	%a5,%a0			/* a0 has the address of the root table ptr */
@@ -2483,6 +2568,11 @@
 
 func_start	mmu_get_root_table_entry,%d0/%a1
 
+#if 0
+	dputs	"mmu_get_root_table_entry:"
+	dputn	ARG1
+	dputs	" ="
+#endif
 
 	movel	%pc@(L(kernel_pgdir_ptr)),%a0
 	tstl	%a0
@@ -2535,6 +2625,10 @@
 	movel	ARG1,%d0
 	lea	%a0@(%d0*4),%a0
 
+#if 0
+	dputn	%a0
+	dputc	'\n'
+#endif
 
 func_return	mmu_get_root_table_entry
 
@@ -2542,6 +2636,12 @@
 
 func_start	mmu_get_ptr_table_entry,%d0/%a1
 
+#if 0
+	dputs	"mmu_get_ptr_table_entry:"
+	dputn	ARG1
+	dputn	ARG2
+	dputs	" ="
+#endif
 
 	movel	ARG1,%a0
 	movel	%a0@,%d0
@@ -2586,12 +2686,22 @@
 	movel	ARG2,%d0
 	lea	%a0@(%d0*4),%a0
 
+#if 0
+	dputn	%a0
+	dputc	'\n'
+#endif
 
 func_return	mmu_get_ptr_table_entry
 
 
 func_start	mmu_get_page_table_entry,%d0/%a1
 
+#if 0
+	dputs	"mmu_get_page_table_entry:"
+	dputn	ARG1
+	dputn	ARG2
+	dputs	" ="
+#endif
 
 	movel	ARG1,%a0
 	movel	%a0@,%d0
@@ -2630,6 +2740,10 @@
 	movel	ARG2,%d0
 	lea	%a0@(%d0*4),%a0
 
+#if 0
+	dputn	%a0
+	dputc	'\n'
+#endif
 
 func_return	mmu_get_page_table_entry
 
@@ -2856,7 +2970,7 @@
 
 #ifdef MAC_USE_SCC_B
 	/* Initialize channel B */
-#ifndef MAC_USE_SCC_A	    /* Load mac_sccbase only if needed */
+#ifndef MAC_USE_SCC_A	/* Load mac_sccbase only if needed */
 	movel	%pc@(L(mac_sccbase)),%a0
 #endif	/* MAC_USE_SCC_A */
 	lea	%pc@(L(scc_initable_mac)),%a1
@@ -2948,7 +3062,7 @@
 #endif	/* MAC_USE_SCC_A */
 
 #ifdef MAC_USE_SCC_B
-#ifndef MAC_USE_SCC_A	    /* Load mac_sccbase only if needed */
+#ifndef MAC_USE_SCC_A	/* Load mac_sccbase only if needed */
 	movel	%pc@(L(mac_sccbase)),%a1
 #endif	/* MAC_USE_SCC_A */
 4:	btst	#2,%a1@(mac_scc_cha_b_ctrl_offset)
@@ -3167,14 +3281,18 @@
  */
 ENTRY(mac_serial_print)
 	moveml	%d0/%a0,%sp@-
+#if 1
 	move	%sr,%sp@-
 	ori	#0x0700,%sr
+#endif
 	movel	%sp@(10),%a0		/* fetch parameter */
 	jra	2f
 1:	serial_putc	%d0
 2:	moveb	%a0@+,%d0
 	jne	1b
+#if 1
 	move	%sp@+,%sr
+#endif
 	moveml	%sp@+,%d0/%a0
 	rts
 #endif /* CONFIG_MAC */
@@ -3685,6 +3803,38 @@
 	rts
 #endif /* CONSOLE */
 
+#if 0
+/*
+ * This is some old code lying around.  I don't believe
+ * it's used or important anymore.  My guess is it contributed
+ * to getting to this point, but it's done for now.
+ * It was still in the 2.1.77 head.S, so it's still here.
+ * (And still not used!)
+ */
+L(showtest):
+	moveml	%a0/%d7,%sp@-
+	puts	"A="
+	putn	%a1
+
+	.long	0xf0119f15		| ptestr	#5,%a1@,#7,%a0
+
+	puts	"DA="
+	putn	%a0
+
+	puts	"D="
+	putn	%a0@
+
+	puts	"S="
+	lea	%pc@(L(mmu)),%a0
+	.long	0xf0106200		| pmove		%psr,%a0@
+	clrl	%d7
+	movew	%a0@,%d7
+	putn	%d7
+
+	putc	'\n'
+	moveml	%sp@+,%a0/%d7
+	rts
+#endif	/* 0 */
 
 __INITDATA
 	.align	4
@@ -3743,12 +3893,12 @@
 L(temp_mmap_mem):
 	.long	0
 
-#if defined(CONFIG_MVME147)
+#if defined (CONFIG_MVME147)
 M147_SCC_CTRL_A = 0xfffe3002
 M147_SCC_DATA_A = 0xfffe3003
 #endif
 
-#if defined(CONFIG_MVME16x)
+#if defined (CONFIG_MVME16x)
 M162_SCC_CTRL_A = 0xfff45005
 M167_CYCAR = 0xfff450ee
 M167_CYIER = 0xfff45011
@@ -3759,7 +3909,7 @@
 M167_PCTPIACKR = 0xfff42025
 #endif
 
-#if defined(CONFIG_BVME6000)
+#if defined (CONFIG_BVME6000)
 BVME_SCC_CTRL_A	= 0xffb0000b
 BVME_SCC_DATA_A	= 0xffb0000f
 #endif
@@ -3781,7 +3931,7 @@
 #endif /* MAC_SERIAL_DEBUG */
 #endif
 
-#if defined(CONFIG_APOLLO)
+#if defined (CONFIG_APOLLO)
 LSRB0        = 0x10412
 LTHRB0       = 0x10416
 LCPUCTRL     = 0x10100
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/ints.c linux-2.4.20-WRTstp/arch/m68k/kernel/ints.c
--- linux-2.4.20-WRT/arch/m68k/kernel/ints.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/ints.c	2001-03-06 19:44:36.000000000 -0800
@@ -142,6 +142,20 @@
 		return -ENXIO;
 	}
 
+#if 0
+	if (!(irq_list[irq].flags & IRQ_FLG_STD)) {
+		if (irq_list[irq].flags & IRQ_FLG_LOCK) {
+			printk("%s: IRQ %d from %s is not replaceable\n",
+			       __FUNCTION__, irq, irq_list[irq].devname);
+			return -EBUSY;
+		}
+		if (!(flags & IRQ_FLG_REPLACE)) {
+			printk("%s: %s can't replace IRQ %d from %s\n",
+			       __FUNCTION__, devname, irq, irq_list[irq].devname);
+			return -EBUSY;
+		}
+	}
+#endif
 
 	irq_list[irq].handler = handler;
 	irq_list[irq].flags   = flags;
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/process.c linux-2.4.20-WRTstp/arch/m68k/kernel/process.c
--- linux-2.4.20-WRT/arch/m68k/kernel/process.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/process.c	2005-11-08 06:23:47.000000000 -0800
@@ -372,6 +372,7 @@
 		    fp >= 8184+stack_page)
 			return 0;
 		pc = ((unsigned long *)fp)[1];
+		/* FIXME: This depends on the order of these functions. */
 		if (pc < first_sched || pc >= last_sched)
 			return pc;
 		fp = *(unsigned long *) fp;
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/setup.c linux-2.4.20-WRTstp/arch/m68k/kernel/setup.c
--- linux-2.4.20-WRT/arch/m68k/kernel/setup.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/setup.c	2005-11-08 06:24:35.000000000 -0800
@@ -225,6 +225,7 @@
 		/* The bootinfo is located right after the kernel bss */
 		m68k_parse_bootinfo((const struct bi_record *)&_end);
 	} else {
+		/* FIXME HP300 doesn't use bootinfo yet */
 		extern unsigned long hp300_phys_ram_base;
 		unsigned long hp300_mem_size = 0xffffffff-hp300_phys_ram_base;
 		m68k_cputype = CPU_68030;
@@ -240,6 +241,11 @@
 	else if (CPU_IS_060)
 		m68k_is040or060 = 6;
 
+	/* FIXME: m68k_fputype is passed in by Penguin booter, which can
+	 * be confused by software FPU emulation. BEWARE.
+	 * We should really do our own FPU check at startup.
+	 * [what do we do with buggy 68LC040s? if we have problems
+	 *  with them, we should add a test to check_bugs() below] */
 #ifndef CONFIG_M68KFPU_EMU_ONLY
 	/* clear the fpu if we have one */
 	if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
@@ -256,6 +262,10 @@
 	*cmdline_p = m68k_command_line;
 	memcpy(saved_command_line, *cmdline_p, CL_SIZE);
 
+	/* Parse the command line for arch-specific options.
+	 * For the m68k, this is currently only "debug=xxx" to enable printing
+	 * certain kernel messages to some machine-specific device.
+	 */
 	for( p = *cmdline_p; p && *p; ) {
 	    i = 0;
 	    if (!strncmp( p, "debug=", 6 )) {
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/signal.c linux-2.4.20-WRTstp/arch/m68k/kernel/signal.c
--- linux-2.4.20-WRT/arch/m68k/kernel/signal.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/signal.c	2005-11-08 06:23:47.000000000 -0800
@@ -98,6 +98,7 @@
 	size_t sigsetsize = (size_t)regs->d2;
 	sigset_t saveset, newset;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
 
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/sys_m68k.c linux-2.4.20-WRTstp/arch/m68k/kernel/sys_m68k.c
--- linux-2.4.20-WRT/arch/m68k/kernel/sys_m68k.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/sys_m68k.c	2001-06-11 19:15:27.000000000 -0700
@@ -111,6 +111,50 @@
 	return error;
 }
 
+#if 0
+struct mmap_arg_struct64 {
+	__u32 addr;
+	__u32 len;
+	__u32 prot;
+	__u32 flags;
+	__u64 offset; /* 64 bits */
+	__u32 fd;
+};
+
+asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
+{
+	int error = -EFAULT;
+	struct file * file = NULL;
+	struct mmap_arg_struct64 a;
+	unsigned long pgoff;
+
+	if (copy_from_user(&a, arg, sizeof(a)))
+		return -EFAULT;
+
+	if ((long)a.offset & ~PAGE_MASK)
+		return -EINVAL;
+
+	pgoff = a.offset >> PAGE_SHIFT;
+	if ((a.offset >> PAGE_SHIFT) != pgoff)
+		return -EINVAL;
+
+	if (!(a.flags & MAP_ANONYMOUS)) {
+		error = -EBADF;
+		file = fget(a.fd);
+		if (!file)
+			goto out;
+	}
+	a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
+
+	down_write(&current->mm->mmap_sem);
+	error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
+	up_write(&current->mm->mmap_sem);
+	if (file)
+		fput(file);
+out:
+	return error;
+}
+#endif
 
 extern asmlinkage int sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 
@@ -396,7 +440,7 @@
 			".chip 68k"			\
 			: "=a" (paddr)			\
 			: "0" (vaddr));			\
-  (paddr); 					\
+  (paddr); /* XXX */					\
 })
 
 static inline int
@@ -514,7 +558,8 @@
     default:
     case FLUSH_SCOPE_PAGE:
       len += (addr & ~PAGE_MASK) + (PAGE_SIZE - 1);
-      addr &= PAGE_MASK;	
+      addr &= PAGE_MASK;	/* Workaround for bug in some
+				   revisions of the 68060 */
       for (len >>= PAGE_SHIFT; len--; addr += PAGE_SIZE)
 	{
 	  if (!(paddr = virt_to_phys_060(addr)))
diff -ruN linux-2.4.20-WRT/arch/m68k/kernel/traps.c linux-2.4.20-WRTstp/arch/m68k/kernel/traps.c
--- linux-2.4.20-WRT/arch/m68k/kernel/traps.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/kernel/traps.c	2005-11-08 06:24:35.000000000 -0800
@@ -199,7 +199,7 @@
 
 asmlinkage void trap_c(struct frame *fp);
 
-#if defined(CONFIG_M68060)
+#if defined (CONFIG_M68060)
 static inline void access_error060 (struct frame *fp)
 {
 	unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
@@ -250,7 +250,7 @@
 }
 #endif /* CONFIG_M68060 */
 
-#if defined(CONFIG_M68040)
+#if defined (CONFIG_M68040)
 static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
 {
 	unsigned long mmusr;
@@ -317,6 +317,10 @@
 static inline void do_040writebacks(struct frame *fp)
 {
 	int res = 0;
+#if 0
+	if (fp->un.fmt7.wb1s & WBV_040)
+		printk("access_error040: cannot handle 1st writeback. oops.\n");
+#endif
 
 	if ((fp->un.fmt7.wb2s & WBV_040) &&
 	    !(fp->un.fmt7.wb2s & WBTT_040)) {
@@ -668,6 +672,9 @@
 		    force_sig(SIGSEGV, current);
 		    return;
 	    } else {
+#if 0
+		    static volatile long tlong;
+#endif
 
 		    printk ("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
 			    !(ssw & RW) ? "write" : "read", addr,
@@ -679,6 +686,16 @@
 		    mmusr = temp;
 
 		    printk ("level 0 mmusr is %#x\n", mmusr);
+#if 0
+		    asm volatile ("pmove %/tt0,%0@"
+				  : /* no outputs */
+				  : "a" (&tlong));
+		    printk ("tt0 is %#lx, ", tlong);
+		    asm volatile ("pmove %/tt1,%0@"
+				  : /* no outputs */
+				  : "a" (&tlong));
+		    printk ("tt1 is %#lx\n", tlong);
+#endif
 #if DEBUG
 		    printk("Unknown SIGSEGV - 1\n");
 #endif
@@ -768,17 +785,17 @@
 #endif
 
 	switch (fp->ptregs.format) {
-#if defined(CONFIG_M68060)
+#if defined (CONFIG_M68060)
 	case 4:				/* 68060 access error */
 	  access_error060 (fp);
 	  break;
 #endif
-#if defined(CONFIG_M68040)
+#if defined (CONFIG_M68040)
 	case 0x7:			/* 68040 access error */
 	  access_error040 (fp);
 	  break;
 #endif
-#if defined(CPU_M68020_OR_M68030)
+#if defined (CPU_M68020_OR_M68030)
 	case 0xa:
 	case 0xb:
 	  bus_error030 (fp);
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/baboon.c linux-2.4.20-WRTstp/arch/m68k/mac/baboon.c
--- linux-2.4.20-WRT/arch/m68k/mac/baboon.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/baboon.c	2000-12-03 17:48:19.000000000 -0800
@@ -83,6 +83,11 @@
 			baboon->mb_ifr &= ~irq_bit;
 		}
 	}
+#if 0
+	if (baboon->mb_ifr & 0x02) macide_ack_intr(NULL);
+	/* for now we need to smash all interrupts */
+	baboon->mb_ifr &= ~events;
+#endif
 }
 
 void baboon_irq_enable(int irq) {
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/bootparse.c linux-2.4.20-WRTstp/arch/m68k/mac/bootparse.c
--- linux-2.4.20-WRT/arch/m68k/mac/bootparse.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/bootparse.c	1999-09-04 13:06:41.000000000 -0700
@@ -24,7 +24,11 @@
 {
  	char *name;
  	char *value;
+#if 0
+ 	while(0 && *env)
+#else
  	while(*env)
+#endif
  	{
  		name=env;
  		value=name;
@@ -36,6 +40,16 @@
  		while(*env)
  			env++;
  		env++;
+#if 0 			
+ 		if(strcmp(name,"VIDEO_ADDR")==0)
+ 			mac_mch.videoaddr=atol(value);
+ 		if(strcmp(name,"ROW_BYTES")==0)
+ 			mac_mch.videorow=atol(value); 			
+ 		if(strcmp(name,"SCREEN_DEPTH")==0)
+ 			mac_mch.videodepth=atol(value);
+ 		if(strcmp(name,"DIMENSIONS")==0)
+ 			mac_mch.dimensions=atol(value);
+#endif 			
  		if(strcmp(name,"BOOTTIME")==0)
  			mac_bi_data.boottime=atol(value);
  		if(strcmp(name,"GMTBIAS")==0)
@@ -71,6 +85,17 @@
  		if(strcmp(name,"ADBDELAY")==0)
  			mac_bi_data.adbdelay=atol(value);
  	}
+#if 0	/* XXX: TODO with m68k_mach_* */
+ 	/* Fill in the base stuff */
+ 	boot_info.machtype=MACH_MAC;
+ 	/* Read this from the macinfo we got ! */
+/*	boot_info.cputype=CPU_68020|FPUB_68881;*/
+/* 	boot_info.memory[0].addr=0;*/
+/* 	boot_info.memory[0].size=((mac_bi_data.id>>7)&31)<<20;*/
+ 	boot_info.num_memory=1;		/* On a MacII */
+ 	boot_info.ramdisk_size=0;	/* For now */
+ 	*boot_info.command_line=0;
+#endif
  }
  
 
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/config.c linux-2.4.20-WRTstp/arch/m68k/mac/config.c
--- linux-2.4.20-WRT/arch/m68k/mac/config.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -113,6 +113,12 @@
 	via_init_clock(vector);
 }
 
+#if 0
+void mac_waitbut (void)
+{
+	;
+}
+#endif
 
 extern void mac_default_handler(int, void *, struct pt_regs *);
 
@@ -243,6 +249,9 @@
 	mach_gettod          = mac_gettod;
 	mach_hwclk           = mac_hwclk;
 	mach_set_clock_mmss	 = mac_set_clock_mmss;
+#if 0
+	mach_mksound         = mac_mksound;
+#endif
 	mach_reset           = mac_reset;
 	mach_halt            = mac_poweroff;
 	mach_power_off       = mac_poweroff;
@@ -250,7 +259,14 @@
 	conswitchp	         = &dummy_con;
 #endif
 	mach_max_dma_address = 0xffffffff;
+#if 0
+	mach_debug_init	 = mac_debug_init;
+#endif
 #ifdef CONFIG_HEARTBEAT
+#if 0
+	mach_heartbeat = mac_heartbeat;
+	mach_heartbeat_irq = IRQ_MAC_TIMER;
+#endif
 #endif
 
 	/*
@@ -437,6 +453,7 @@
 	int model = mac_bi_data.id;
 	if (!model) {
 		/* no bootinfo model id -> NetBSD booter was used! */
+		/* XXX FIXME: breaks for model > 31 */
 		model=(mac_bi_data.cpuid>>2)&63;
 		printk ("No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
 	}
@@ -473,6 +490,10 @@
 		mac_bi_data.boottime, mac_bi_data.gmtbias); 
 	printk (" Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
 		mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 
+#if 0
+	printk ("Ramdisk: addr 0x%lx size 0x%lx\n", 
+		m68k_ramdisk.addr, m68k_ramdisk.size);
+#endif
 
 	/*
 	 * TODO: set the various fields in macintosh_config->hw_present here!
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/iop.c linux-2.4.20-WRTstp/arch/m68k/mac/iop.c
--- linux-2.4.20-WRT/arch/m68k/mac/iop.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/iop.c	2001-06-11 19:15:27.000000000 -0700
@@ -301,6 +301,11 @@
 		iop_listeners[IOP_NUM_ISM][i].handler = NULL;
 	}
 
+#if 0	/* Crashing in 2.4 now, not yet sure why.   --jmt */
+#ifdef CONFIG_PROC_FS
+	create_proc_info_entry("mac_iop", 0, &proc_root, iop_get_proc_info);
+#endif
+#endif
 }
 
 /*
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/macboing.c linux-2.4.20-WRTstp/arch/m68k/mac/macboing.c
--- linux-2.4.20-WRT/arch/m68k/mac/macboing.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/macboing.c	2000-07-14 12:20:22.000000000 -0700
@@ -150,6 +150,15 @@
 	mac_asc_inited = 1;
 }	
 
+/*
+ * Called to make noise; current single entry to the boing driver. 
+ * Does the job for simple ASC, calls other routines else.
+ * XXX Fixme:
+ * Should be split into asc_mksound, easc_mksound, av_mksound and 
+ * function pointer set in mac_init_asc which would be called at 
+ * init time. 
+ * _This_ is rather ugly ...
+ */
 void mac_mksound( unsigned int freq, unsigned int length )
 {
 	__u32 cfreq = ( freq << 5 ) / 468;
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/macints.c linux-2.4.20-WRTstp/arch/m68k/mac/macints.c
--- linux-2.4.20-WRT/arch/m68k/mac/macints.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/macints.c	2005-11-08 06:24:35.000000000 -0800
@@ -490,6 +490,13 @@
 	return 0;
 }
 
+/*
+ * Add an interrupt service routine to an interrupt source.
+ * Returns 0 on success.
+ *
+ * FIXME: You can register interrupts on nonexistant source (ie PSC4 on a
+ *        non-PSC machine). We should return -EINVAL in those cases.
+ */
  
 int mac_request_irq(unsigned int irq,
 		    void (*handler)(int, void *, struct pt_regs *),
@@ -678,7 +685,23 @@
 		udelay(1000);
 
 	if ( console_loglevel >= 8 ) {
+#if 0
+		show_state();
+		printk("PC: %08lx\nSR: %04x  SP: %p\n", fp->pc, fp->sr, fp);
+		printk("d0: %08lx    d1: %08lx    d2: %08lx    d3: %08lx\n",
+		       fp->d0, fp->d1, fp->d2, fp->d3);
+		printk("d4: %08lx    d5: %08lx    a0: %08lx    a1: %08lx\n",
+		       fp->d4, fp->d5, fp->a0, fp->a1);
+	
+		if (STACK_MAGIC != *(unsigned long *)current->kernel_stack_page)
+			printk("Corrupted stack page\n");
+		printk("Process %s (pid: %d, stackpage=%08lx)\n",
+			current->comm, current->pid, current->kernel_stack_page);
+		if (intr_count == 1)
+			dump_stack((struct frame *)fp);
+#else
 		/* printk("NMI "); */
+#endif
 	}
 	in_nmi--;
 }
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/misc.c linux-2.4.20-WRTstp/arch/m68k/mac/misc.c
--- linux-2.4.20-WRT/arch/m68k/mac/misc.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/misc.c	2005-11-08 06:24:35.000000000 -0800
@@ -291,6 +291,9 @@
 	}
 }
 
+/*
+ * FIXME: not sure how this is supposed to work exactly...
+ */
 
 static void oss_shutdown(void)
 {
@@ -620,6 +623,21 @@
 		printk("mac_hwclk: tried to write %04d-%02d-%-2d %02d:%02d:%02d\n",
 			t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
 
+#if 0	/* it trashes my rtc */
+		now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
+			     t->tm_hour, t->tm_min, t->tm_sec);
+
+		if (macintosh_config->adb_type == MAC_ADB_II) {
+			via_write_time(now);
+		} else if ((macintosh_config->adb_type == MAC_ADB_IISI) ||
+			   (macintosh_config->adb_type == MAC_ADB_PB1) ||
+			   (macintosh_config->adb_type == MAC_ADB_PB2) ||
+			   (macintosh_config->adb_type == MAC_ADB_CUDA)) {
+			adb_write_time(now);
+		} else if (macintosh_config->adb_type == MAC_ADB_IOP) {
+			via_write_time(now);
+		}
+#endif
 	}
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/oss.c linux-2.4.20-WRTstp/arch/m68k/mac/oss.c
--- linux-2.4.20-WRT/arch/m68k/mac/oss.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/oss.c	2001-02-13 14:13:43.000000000 -0800
@@ -105,8 +105,10 @@
 			(int) oss->irq_pending);
 	}
 #endif
+	/* FIXME: how do you clear a pending IRQ?    */
 
 	if (events & OSS_IP_SOUND) {
+		/* FIXME: call sound handler */
 		oss->irq_pending &= ~OSS_IP_SOUND;
 	} else if (events & OSS_IP_SCSI) {
 		oss->irq_level[OSS_SCSI] = OSS_IRQLEV_DISABLED;
@@ -114,6 +116,7 @@
 		oss->irq_pending &= ~OSS_IP_SCSI;
 		oss->irq_level[OSS_SCSI] = OSS_IRQLEV_SCSI;
 	} else {
+		/* FIXME: error check here? */
 	}
 }
 
@@ -237,6 +240,7 @@
  */
 
 void oss_irq_clear(int irq) {
+	/* FIXME: how to do this on OSS? */
 	switch(irq) {
 		case IRQ_SCC:
 		case IRQ_SCCA:
diff -ruN linux-2.4.20-WRT/arch/m68k/mac/via.c linux-2.4.20-WRTstp/arch/m68k/mac/via.c
--- linux-2.4.20-WRT/arch/m68k/mac/via.c	2003-07-04 01:11:09.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mac/via.c	2001-06-11 19:15:27.000000000 -0700
@@ -35,6 +35,10 @@
 #include <asm/mac_psc.h>
 
 volatile __u8 *via1, *via2;
+#if 0
+/* See note in mac_via.h about how this is possibly not useful */
+volatile long *via_memory_bogon=(long *)&via_memory_bogon;
+#endif
 int  rbv_present,via_alt_mapping;
 __u8 rbv_clear;
 
@@ -163,6 +167,10 @@
 	via1[vT2CH] = 0;
 	via1[vACR] &= 0x3F;
 
+	/* 
+	 * SE/30: disable video IRQ
+	 * XXX: testing for SE/30 VBL
+	 */
 
 	if (macintosh_config->ident == MAC_MODEL_SE30) {
 		via1[vDirB] |= 0x40;
@@ -181,6 +189,7 @@
 
 	if (oss_present) return;
 
+#if 1
 	/* Some machines support an alternate IRQ mapping that spreads  */
 	/* Ethernet and Sound out to their own autolevel IRQs and moves */
 	/* VIA1 to level 6. A/UX uses this mapping and we do too.  Note */
@@ -203,6 +212,14 @@
 			via_alt_mapping = 0;
 			break;
 	}
+#else
+	/* The alernate IRQ mapping seems to just not work. Anyone with a   */
+	/* supported machine is welcome to take a stab at fixing it. It     */
+	/* _should_ work on the following Quadras: 610,650,700,800,900,950  */
+	/*                                               - 1999-06-12 (jmt) */
+
+	via_alt_mapping = 0;
+#endif
 
 	/*
 	 * Now initialize VIA2. For RBV we just kill all interrupts;
@@ -251,6 +268,12 @@
 	} else {
 		sys_request_irq(IRQ_AUTO_1, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
 				"via1", (void *) via1);
+#if 0 /* interferes with serial on some machines */
+		if (!psc_present) {
+			sys_request_irq(IRQ_AUTO_6, mac_bang, IRQ_FLG_LOCK,
+					"Off Switch", mac_bang);
+		}
+#endif
 	}
 	sys_request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
 			"via2", (void *) via2);
@@ -398,6 +421,20 @@
 			via1[vIER] = irq_bit | 0x80;
 		}
 
+#if 0 /* freakin' pmu is doing weird stuff */
+	if (!oss_present) {
+		/* This (still) seems to be necessary to get IDE
+		   working.  However, if you enable VBL interrupts,
+		   you're screwed... */
+		/* FIXME: should we check the SLOTIRQ bit before
+                   pulling this stunt? */
+		/* No, it won't be set. that's why we're doing this. */
+		via_irq_disable(IRQ_MAC_NUBUS);
+		via_irq_clear(IRQ_MAC_NUBUS);
+		mac_do_irq_list(IRQ_MAC_NUBUS, regs);
+		via_irq_enable(IRQ_MAC_NUBUS);
+	}
+#endif
 }
 
 void via2_irq(int irq, void *dev_id, struct pt_regs *regs)
@@ -512,6 +549,7 @@
 	} else if (irq_src == 2) {
 		via2[gIFR] = irq_bit | rbv_clear;
 	} else if (irq_src == 7) {
+		/* FIXME: hmm.. */
 	}
 }
 
diff -ruN linux-2.4.20-WRT/arch/m68k/math-emu/fp_arith.c linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_arith.c
--- linux-2.4.20-WRT/arch/m68k/math-emu/fp_arith.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_arith.c	1999-08-15 11:47:29.000000000 -0700
@@ -589,6 +589,7 @@
 	if (IS_ZERO(dest) || IS_INF(src))
 		return dest;
 
+	/* FIXME: there is almost certainly a smarter way to do this */
 	fp_copy_ext(&tmp, dest);
 	fp_fdiv(&tmp, src);		/* NOTE: src might be modified */
 	fp_roundint(&tmp, mode);
diff -ruN linux-2.4.20-WRT/arch/m68k/math-emu/fp_movem.S linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_movem.S
--- linux-2.4.20-WRT/arch/m68k/math-emu/fp_movem.S	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_movem.S	2001-02-13 14:13:43.000000000 -0800
@@ -178,6 +178,22 @@
 	jne	2b
 5:
 	printf	PDECODE,"\n"
+#if 0
+	lea	(FPD_FPREG,FPDATA),%a0
+	printf	PMOVEM,"fp:"
+	printx	PMOVEM,%a0@(0)
+	printx	PMOVEM,%a0@(12)
+	printf	PMOVEM,"\n   "
+	printx	PMOVEM,%a0@(24)
+	printx	PMOVEM,%a0@(36)
+	printf	PMOVEM,"\n   "
+	printx	PMOVEM,%a0@(48)
+	printx	PMOVEM,%a0@(60)
+	printf	PMOVEM,"\n   "
+	printx	PMOVEM,%a0@(72)
+	printx	PMOVEM,%a0@(84)
+	printf	PMOVEM,"\n"
+#endif
 	jra	fp_end
 
 | set flags for decode macros for fmovem control register
@@ -286,6 +302,18 @@
 	fp_put_pc %a1
 	printf	PDECODE,"#imm"
 |	jra	fpc_do_movem
+#if 0
+	swap	%d1
+	lsl.l	#5,%d1
+	lea	(FPD_FPCR,FPDATA),%a0
+	jra	3f
+1:	move.l	%d0,(%a0)
+2:	addq.l	#4,%a0
+3:	lsl.b	#1,%d1
+	jcs	1b
+	jne	2b
+	jra	fpc_movem_fin
+#endif
 
 fpc_do_movem:
 	swap	%d1			| get fpu register list
@@ -327,4 +355,14 @@
 	and.l	%d0,%d1
 	move.w	%d1,(FPD_PREC,FPDATA)
 	printf	PDECODE,"\n"
+#if 0
+	printf	PMOVEM,"fpcr : %08x\n",1,FPDATA@(FPD_FPCR)
+	printf	PMOVEM,"fpsr : %08x\n",1,FPDATA@(FPD_FPSR)
+	printf	PMOVEM,"fpiar: %08x\n",1,FPDATA@(FPD_FPIAR)
+	clr.l	%d0
+	move.w	(FPD_PREC,FPDATA),%d0
+	printf	PMOVEM,"prec : %04x\n",1,%d0
+	move.w	(FPD_RND,FPDATA),%d0
+	printf	PMOVEM,"rnd  : %04x\n",1,%d0
+#endif
 	jra	fp_end
diff -ruN linux-2.4.20-WRT/arch/m68k/math-emu/fp_scan.S linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_scan.S
--- linux-2.4.20-WRT/arch/m68k/math-emu/fp_scan.S	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_scan.S	2001-02-13 14:13:43.000000000 -0800
@@ -65,7 +65,11 @@
 	fp_get_pc %a0
 	printf	PDECODE,"%08x: ",1,%a0
 	getuser.b (%a0),%d0,fp_err_ua1,%a0
+#if 1
 	cmp.b	#0xf2,%d0		| cpid = 1
+#else
+	cmp.b	#0xfc,%d0		| cpid = 6
+#endif
 	jne	fp_nonstd
 | first two instruction words are kept in %d2
 	getuser.l (%a0)+,%d2,fp_err_ua1,%a0
diff -ruN linux-2.4.20-WRT/arch/m68k/math-emu/fp_util.S linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_util.S
--- linux-2.4.20-WRT/arch/m68k/math-emu/fp_util.S	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/math-emu/fp_util.S	2001-02-13 14:13:43.000000000 -0800
@@ -1400,6 +1400,32 @@
 	| as defined in fp_emu.h.
 fp_final:
 	move.l	(FPD_FPSR,FPDATA),%d0
+#if 0
+	btst	#FPSR_EXC_SNAN,%d0	| EXC_SNAN
+	jne	1f
+	btst	#FPSR_EXC_OPERR,%d0	| EXC_OPERR
+	jeq	2f
+1:	bset	#FPSR_AEXC_IOP,%d0	| set IOP bit
+2:	btst	#FPSR_EXC_OVFL,%d0	| EXC_OVFL
+	jeq	1f
+	bset	#FPSR_AEXC_OVFL,%d0	| set OVFL bit
+1:	btst	#FPSR_EXC_UNFL,%d0	| EXC_UNFL
+	jeq	1f
+	btst	#FPSR_EXC_INEX2,%d0	| EXC_INEX2
+	jeq	1f
+	bset	#FPSR_AEXC_UNFL,%d0	| set UNFL bit
+1:	btst	#FPSR_EXC_DZ,%d0	| EXC_INEX1
+	jeq	1f
+	bset	#FPSR_AEXC_DZ,%d0	| set DZ bit
+1:	btst	#FPSR_EXC_OVFL,%d0	| EXC_OVFL
+	jne	1f
+	btst	#FPSR_EXC_INEX2,%d0	| EXC_INEX2
+	jne	1f
+	btst	#FPSR_EXC_INEX1,%d0	| EXC_INEX1
+	jeq	2f
+1:	bset	#FPSR_AEXC_INEX,%d0	| set INEX bit
+2:	move.l	%d0,(FPD_FPSR,FPDATA)
+#else
 	| same as above, greatly optimized, but untested (yet)
 	move.l	%d0,%d2
 	lsr.l	#5,%d0
@@ -1421,6 +1447,7 @@
 	and.b	#0xf8,%d0
 	or.b	%d0,%d2
 	move.l	%d2,(FPD_FPSR,FPDATA)
+#endif
 	move.b	(FPD_FPSR+2,FPDATA),%d0
 	and.b	(FPD_FPCR+2,FPDATA),%d0
 	jeq	1f
diff -ruN linux-2.4.20-WRT/arch/m68k/math-emu/multi_arith.h linux-2.4.20-WRTstp/arch/m68k/math-emu/multi_arith.h
--- linux-2.4.20-WRT/arch/m68k/math-emu/multi_arith.h	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/math-emu/multi_arith.h	2005-11-08 06:23:47.000000000 -0800
@@ -19,6 +19,250 @@
 #ifndef MULTI_ARITH_H
 #define MULTI_ARITH_H
 
+#if 0	/* old code... */
+
+/* Unsigned only, because we don't need signs to multiply and divide. */
+typedef unsigned int int128[4];
+
+/* Word order */
+enum {
+	MSW128,
+	NMSW128,
+	NLSW128,
+	LSW128
+};
+
+/* big-endian */
+#define LO_WORD(ll) (((unsigned int *) &ll)[1])
+#define HI_WORD(ll) (((unsigned int *) &ll)[0])
+
+/* Convenience functions to stuff various integer values into int128s */
+
+extern inline void zero128(int128 a)
+{
+	a[LSW128] = a[NLSW128] = a[NMSW128] = a[MSW128] = 0;
+}
+
+/* Human-readable word order in the arguments */
+extern inline void set128(unsigned int i3,
+			  unsigned int i2,
+			  unsigned int i1,
+			  unsigned int i0,
+			  int128 a)
+{
+	a[LSW128] = i0;
+	a[NLSW128] = i1;
+	a[NMSW128] = i2;
+	a[MSW128] = i3;
+}
+
+/* Convenience functions (for testing as well) */
+extern inline void int64_to_128(unsigned long long src,
+				int128 dest)
+{
+	dest[LSW128] = (unsigned int) src;
+	dest[NLSW128] = src >> 32;
+	dest[NMSW128] = dest[MSW128] = 0;
+}
+
+extern inline void int128_to_64(const int128 src,
+				unsigned long long *dest)
+{
+	*dest = src[LSW128] | (long long) src[NLSW128] << 32;
+}
+
+extern inline void put_i128(const int128 a)
+{
+	printk("%08x %08x %08x %08x\n", a[MSW128], a[NMSW128],
+	       a[NLSW128], a[LSW128]);
+}
+
+/* Internal shifters:
+
+   Note that these are only good for 0 < count < 32.
+ */
+
+extern inline void _lsl128(unsigned int count, int128 a)
+{
+	a[MSW128] = (a[MSW128] << count) | (a[NMSW128] >> (32 - count));
+	a[NMSW128] = (a[NMSW128] << count) | (a[NLSW128] >> (32 - count));
+	a[NLSW128] = (a[NLSW128] << count) | (a[LSW128] >> (32 - count));
+	a[LSW128] <<= count;
+}
+
+extern inline void _lsr128(unsigned int count, int128 a)
+{
+	a[LSW128] = (a[LSW128] >> count) | (a[NLSW128] << (32 - count));
+	a[NLSW128] = (a[NLSW128] >> count) | (a[NMSW128] << (32 - count));
+	a[NMSW128] = (a[NMSW128] >> count) | (a[MSW128] << (32 - count));
+	a[MSW128] >>= count;
+}
+
+/* Should be faster, one would hope */
+
+extern inline void lslone128(int128 a)
+{
+	asm volatile ("lsl.l #1,%0\n"
+		      "roxl.l #1,%1\n"
+		      "roxl.l #1,%2\n"
+		      "roxl.l #1,%3\n"
+		      :
+		      "=d" (a[LSW128]),
+		      "=d"(a[NLSW128]),
+		      "=d"(a[NMSW128]),
+		      "=d"(a[MSW128])
+		      :
+		      "0"(a[LSW128]),
+		      "1"(a[NLSW128]),
+		      "2"(a[NMSW128]),
+		      "3"(a[MSW128]));
+}
+
+extern inline void lsrone128(int128 a)
+{
+	asm volatile ("lsr.l #1,%0\n"
+		      "roxr.l #1,%1\n"
+		      "roxr.l #1,%2\n"
+		      "roxr.l #1,%3\n"
+		      :
+		      "=d" (a[MSW128]),
+		      "=d"(a[NMSW128]),
+		      "=d"(a[NLSW128]),
+		      "=d"(a[LSW128])
+		      :
+		      "0"(a[MSW128]),
+		      "1"(a[NMSW128]),
+		      "2"(a[NLSW128]),
+		      "3"(a[LSW128]));
+}
+
+/* Generalized 128-bit shifters:
+
+   These bit-shift to a multiple of 32, then move whole longwords.  */
+
+extern inline void lsl128(unsigned int count, int128 a)
+{
+	int wordcount, i;
+
+	if (count % 32)
+		_lsl128(count % 32, a);
+
+	if (0 == (wordcount = count / 32))
+		return;
+
+	/* argh, gak, endian-sensitive */
+	for (i = 0; i < 4 - wordcount; i++) {
+		a[i] = a[i + wordcount];
+	}
+	for (i = 3; i >= 4 - wordcount; --i) {
+		a[i] = 0;
+	}
+}
+
+extern inline void lsr128(unsigned int count, int128 a)
+{
+	int wordcount, i;
+
+	if (count % 32)
+		_lsr128(count % 32, a);
+
+	if (0 == (wordcount = count / 32))
+		return;
+
+	for (i = 3; i >= wordcount; --i) {
+		a[i] = a[i - wordcount];
+	}
+	for (i = 0; i < wordcount; i++) {
+		a[i] = 0;
+	}
+}
+
+extern inline int orl128(int a, int128 b)
+{
+	b[LSW128] |= a;
+}
+
+extern inline int btsthi128(const int128 a)
+{
+	return a[MSW128] & 0x80000000;
+}
+
+/* test bits (numbered from 0 = LSB) up to and including "top" */
+extern inline int bftestlo128(int top, const int128 a)
+{
+	int r = 0;
+
+	if (top > 31)
+		r |= a[LSW128];
+	if (top > 63)
+		r |= a[NLSW128];
+	if (top > 95)
+		r |= a[NMSW128];
+
+	r |= a[3 - (top / 32)] & ((1 << (top % 32 + 1)) - 1);
+
+	return (r != 0);
+}
+
+/* Aargh.  We need these because GCC is broken */
+/* FIXME: do them in assembly, for goodness' sake! */
+extern inline void mask64(int pos, unsigned long long *mask)
+{
+	*mask = 0;
+
+	if (pos < 32) {
+		LO_WORD(*mask) = (1 << pos) - 1;
+		return;
+	}
+	LO_WORD(*mask) = -1;
+	HI_WORD(*mask) = (1 << (pos - 32)) - 1;
+}
+
+extern inline void bset64(int pos, unsigned long long *dest)
+{
+	/* This conditional will be optimized away.  Thanks, GCC! */
+	if (pos < 32)
+		asm volatile ("bset %1,%0":"=m"
+			      (LO_WORD(*dest)):"id"(pos));
+	else
+		asm volatile ("bset %1,%0":"=m"
+			      (HI_WORD(*dest)):"id"(pos - 32));
+}
+
+extern inline int btst64(int pos, unsigned long long dest)
+{
+	if (pos < 32)
+		return (0 != (LO_WORD(dest) & (1 << pos)));
+	else
+		return (0 != (HI_WORD(dest) & (1 << (pos - 32))));
+}
+
+extern inline void lsl64(int count, unsigned long long *dest)
+{
+	if (count < 32) {
+		HI_WORD(*dest) = (HI_WORD(*dest) << count)
+		    | (LO_WORD(*dest) >> count);
+		LO_WORD(*dest) <<= count;
+		return;
+	}
+	count -= 32;
+	HI_WORD(*dest) = LO_WORD(*dest) << count;
+	LO_WORD(*dest) = 0;
+}
+
+extern inline void lsr64(int count, unsigned long long *dest)
+{
+	if (count < 32) {
+		LO_WORD(*dest) = (LO_WORD(*dest) >> count)
+		    | (HI_WORD(*dest) << (32 - count));
+		HI_WORD(*dest) >>= count;
+		return;
+	}
+	count -= 32;
+	LO_WORD(*dest) = HI_WORD(*dest) >> count;
+	HI_WORD(*dest) = 0;
+}
+#endif
 
 extern inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt)
 {
@@ -239,6 +483,116 @@
 	}
 }
 
+#if 0
+extern inline unsigned int fp_fls128(union fp_mant128 *src)
+{
+	unsigned long data;
+	unsigned int res, off;
+
+	if ((data = src->m32[0]))
+		off = 0;
+	else if ((data = src->m32[1]))
+		off = 32;
+	else if ((data = src->m32[2]))
+		off = 64;
+	else if ((data = src->m32[3]))
+		off = 96;
+	else
+		return 128;
+
+	asm ("bfffo %1{#0,#32},%0" : "=d" (res) : "dm" (data));
+	return res + off;
+}
+
+extern inline void fp_shiftmant128(union fp_mant128 *src, int shift)
+{
+	unsigned long sticky;
+
+	switch (shift) {
+	case 0:
+		return;
+	case 1:
+		asm volatile ("lsl.l #1,%0"
+			: "=d" (src->m32[3]) : "0" (src->m32[3]));
+		asm volatile ("roxl.l #1,%0"
+			: "=d" (src->m32[2]) : "0" (src->m32[2]));
+		asm volatile ("roxl.l #1,%0"
+			: "=d" (src->m32[1]) : "0" (src->m32[1]));
+		asm volatile ("roxl.l #1,%0"
+			: "=d" (src->m32[0]) : "0" (src->m32[0]));
+		return;
+	case 2 ... 31:
+		src->m32[0] = (src->m32[0] << shift) | (src->m32[1] >> (32 - shift));
+		src->m32[1] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
+		src->m32[2] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
+		src->m32[3] = (src->m32[3] << shift);
+		return;
+	case 32 ... 63:
+		shift -= 32;
+		src->m32[0] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift));
+		src->m32[1] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
+		src->m32[2] = (src->m32[3] << shift);
+		src->m32[3] = 0;
+		return;
+	case 64 ... 95:
+		shift -= 64;
+		src->m32[0] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift));
+		src->m32[1] = (src->m32[3] << shift);
+		src->m32[2] = src->m32[3] = 0;
+		return;
+	case 96 ... 127:
+		shift -= 96;
+		src->m32[0] = (src->m32[3] << shift);
+		src->m32[1] = src->m32[2] = src->m32[3] = 0;
+		return;
+	case -31 ... -1:
+		shift = -shift;
+		sticky = 0;
+		if (src->m32[3] << (32 - shift))
+			sticky = 1;
+		src->m32[3] = (src->m32[3] >> shift) | (src->m32[2] << (32 - shift)) | sticky;
+		src->m32[2] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift));
+		src->m32[1] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
+		src->m32[0] = (src->m32[0] >> shift);
+		return;
+	case -63 ... -32:
+		shift = -shift - 32;
+		sticky = 0;
+		if ((src->m32[2] << (32 - shift)) || src->m32[3])
+			sticky = 1;
+		src->m32[3] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)) | sticky;
+		src->m32[2] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift));
+		src->m32[1] = (src->m32[0] >> shift);
+		src->m32[0] = 0;
+		return;
+	case -95 ... -64:
+		shift = -shift - 64;
+		sticky = 0;
+		if ((src->m32[1] << (32 - shift)) || src->m32[2] || src->m32[3])
+			sticky = 1;
+		src->m32[3] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)) | sticky;
+		src->m32[2] = (src->m32[0] >> shift);
+		src->m32[1] = src->m32[0] = 0;
+		return;
+	case -127 ... -96:
+		shift = -shift - 96;
+		sticky = 0;
+		if ((src->m32[0] << (32 - shift)) || src->m32[1] || src->m32[2] || src->m32[3])
+			sticky = 1;
+		src->m32[3] = (src->m32[0] >> shift) | sticky;
+		src->m32[2] = src->m32[1] = src->m32[0] = 0;
+		return;
+	}
+
+	if (shift < 0 && (src->m32[0] || src->m32[1] || src->m32[2] || src->m32[3]))
+		src->m32[3] = 1;
+	else
+		src->m32[3] = 0;
+	src->m32[2] = 0;
+	src->m32[1] = 0;
+	src->m32[0] = 0;
+}
+#endif
 
 extern inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, int shift)
 {
@@ -284,5 +638,185 @@
 	}
 }
 
+#if 0 /* old code... */
+extern inline int fls(unsigned int a)
+{
+	int r;
+
+	asm volatile ("bfffo %1{#0,#32},%0"
+		      : "=d" (r) : "md" (a));
+	return r;
+}
+
+/* fls = "find last set" (cf. ffs(3)) */
+extern inline int fls128(const int128 a)
+{
+	if (a[MSW128])
+		return fls(a[MSW128]);
+	if (a[NMSW128])
+		return fls(a[NMSW128]) + 32;
+	/* XXX: it probably never gets beyond this point in actual
+	   use, but that's indicative of a more general problem in the
+	   algorithm (i.e. as per the actual 68881 implementation, we
+	   really only need at most 67 bits of precision [plus
+	   overflow]) so I'm not going to fix it. */
+	if (a[NLSW128])
+		return fls(a[NLSW128]) + 64;
+	if (a[LSW128])
+		return fls(a[LSW128]) + 96;
+	else
+		return -1;
+}
+
+extern inline int zerop128(const int128 a)
+{
+	return !(a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
+}
+
+extern inline int nonzerop128(const int128 a)
+{
+	return (a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]);
+}
+
+/* Addition and subtraction */
+/* Do these in "pure" assembly, because "extended" asm is unmanageable
+   here */
+extern inline void add128(const int128 a, int128 b)
+{
+	/* rotating carry flags */
+	unsigned int carry[2];
+
+	carry[0] = a[LSW128] > (0xffffffff - b[LSW128]);
+	b[LSW128] += a[LSW128];
+
+	carry[1] = a[NLSW128] > (0xffffffff - b[NLSW128] - carry[0]);
+	b[NLSW128] = a[NLSW128] + b[NLSW128] + carry[0];
+
+	carry[0] = a[NMSW128] > (0xffffffff - b[NMSW128] - carry[1]);
+	b[NMSW128] = a[NMSW128] + b[NMSW128] + carry[1];
+
+	b[MSW128] = a[MSW128] + b[MSW128] + carry[0];
+}
+
+/* Note: assembler semantics: "b -= a" */
+extern inline void sub128(const int128 a, int128 b)
+{
+	/* rotating borrow flags */
+	unsigned int borrow[2];
+
+	borrow[0] = b[LSW128] < a[LSW128];
+	b[LSW128] -= a[LSW128];
+
+	borrow[1] = b[NLSW128] < a[NLSW128] + borrow[0];
+	b[NLSW128] = b[NLSW128] - a[NLSW128] - borrow[0];
+
+	borrow[0] = b[NMSW128] < a[NMSW128] + borrow[1];
+	b[NMSW128] = b[NMSW128] - a[NMSW128] - borrow[1];
+
+	b[MSW128] = b[MSW128] - a[MSW128] - borrow[0];
+}
+
+/* Poor man's 64-bit expanding multiply */
+extern inline void mul64(unsigned long long a,
+		  unsigned long long b,
+		  int128 c)
+{
+	unsigned long long acc;
+	int128 acc128;
+
+	zero128(acc128);
+	zero128(c);
+
+	/* first the low words */
+	if (LO_WORD(a) && LO_WORD(b)) {
+		acc = (long long) LO_WORD(a) * LO_WORD(b);
+		c[NLSW128] = HI_WORD(acc);
+		c[LSW128] = LO_WORD(acc);
+	}
+	/* Next the high words */
+	if (HI_WORD(a) && HI_WORD(b)) {
+		acc = (long long) HI_WORD(a) * HI_WORD(b);
+		c[MSW128] = HI_WORD(acc);
+		c[NMSW128] = LO_WORD(acc);
+	}
+	/* The middle words */
+	if (LO_WORD(a) && HI_WORD(b)) {
+		acc = (long long) LO_WORD(a) * HI_WORD(b);
+		acc128[NMSW128] = HI_WORD(acc);
+		acc128[NLSW128] = LO_WORD(acc);
+		add128(acc128, c);
+	}
+	/* The first and last words */
+	if (HI_WORD(a) && LO_WORD(b)) {
+		acc = (long long) HI_WORD(a) * LO_WORD(b);
+		acc128[NMSW128] = HI_WORD(acc);
+		acc128[NLSW128] = LO_WORD(acc);
+		add128(acc128, c);
+	}
+}
+
+/* Note: unsigned */
+extern inline int cmp128(int128 a, int128 b)
+{
+	if (a[MSW128] < b[MSW128])
+		return -1;
+	if (a[MSW128] > b[MSW128])
+		return 1;
+	if (a[NMSW128] < b[NMSW128])
+		return -1;
+	if (a[NMSW128] > b[NMSW128])
+		return 1;
+	if (a[NLSW128] < b[NLSW128])
+		return -1;
+	if (a[NLSW128] > b[NLSW128])
+		return 1;
+
+	return (signed) a[LSW128] - b[LSW128];
+}
+
+inline void div128(int128 a, int128 b, int128 c)
+{
+	int128 mask;
+
+	/* Algorithm:
+
+	   Shift the divisor until it's at least as big as the
+	   dividend, keeping track of the position to which we've
+	   shifted it, i.e. the power of 2 which we've multiplied it
+	   by.
+
+	   Then, for this power of 2 (the mask), and every one smaller
+	   than it, subtract the mask from the dividend and add it to
+	   the quotient until the dividend is smaller than the raised
+	   divisor.  At this point, divide the dividend and the mask
+	   by 2 (i.e. shift one place to the right).  Lather, rinse,
+	   and repeat, until there are no more powers of 2 left. */
+
+	/* FIXME: needless to say, there's room for improvement here too. */
+
+	/* Shift up */
+	/* XXX: since it just has to be "at least as big", we can
+	   probably eliminate this horribly wasteful loop.  I will
+	   have to prove this first, though */
+	set128(0, 0, 0, 1, mask);
+	while (cmp128(b, a) < 0 && !btsthi128(b)) {
+		lslone128(b);
+		lslone128(mask);
+	}
+
+	/* Shift down */
+	zero128(c);
+	do {
+		if (cmp128(a, b) >= 0) {
+			sub128(b, a);
+			add128(mask, c);
+		}
+		lsrone128(mask);
+		lsrone128(b);
+	} while (nonzerop128(mask));
+
+	/* The remainder is in a... */
+}
+#endif
 
 #endif	/* MULTI_ARITH_H */
diff -ruN linux-2.4.20-WRT/arch/m68k/mm/init.c linux-2.4.20-WRTstp/arch/m68k/mm/init.c
--- linux-2.4.20-WRT/arch/m68k/mm/init.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mm/init.c	2001-09-20 20:02:03.000000000 -0700
@@ -140,6 +140,12 @@
 	totalram_pages = free_all_bootmem();
 
 	for (tmp = PAGE_OFFSET ; tmp < (unsigned long)high_memory; tmp += PAGE_SIZE) {
+#if 0
+#ifndef CONFIG_SUN3
+		if (virt_to_phys ((void *)tmp) >= mach_max_dma_address)
+			clear_bit(PG_DMA, &virt_to_page(tmp)->flags);
+#endif
+#endif
 		if (PageReserved(virt_to_page(tmp))) {
 			if (tmp >= (unsigned long)&_text
 			    && tmp < (unsigned long)&_etext)
@@ -151,6 +157,14 @@
 				datapages++;
 			continue;
 		}
+#if 0
+		set_page_count(virt_to_page(tmp), 1);
+#ifdef CONFIG_BLK_DEV_INITRD
+		if (!initrd_start ||
+		    (tmp < (initrd_start & PAGE_MASK) || tmp >= initrd_end))
+#endif
+			free_page(tmp);
+#endif
 	}
 	
 #ifndef CONFIG_SUN3
diff -ruN linux-2.4.20-WRT/arch/m68k/mm/memory.c linux-2.4.20-WRTstp/arch/m68k/mm/memory.c
--- linux-2.4.20-WRT/arch/m68k/mm/memory.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mm/memory.c	2005-11-08 06:23:47.000000000 -0800
@@ -39,7 +39,55 @@
 	pgd_set(pgd, (pmd_t *)BAD_PAGETABLE);
 }
 
+#if 0
+pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset)
+{
+	pte_t *pte;
+
+	pte = (pte_t *) __get_free_page(GFP_KERNEL);
+	if (pmd_none(*pmd)) {
+		if (pte) {
+			clear_page(pte);
+			__flush_page_to_ram((unsigned long)pte);
+			flush_tlb_kernel_page((unsigned long)pte);
+			nocache_page((unsigned long)pte);
+			pmd_set(pmd, pte);
+			return pte + offset;
+		}
+		pmd_set(pmd, BAD_PAGETABLE);
+		return NULL;
+	}
+	free_page((unsigned long)pte);
+	if (pmd_bad(*pmd)) {
+		__bad_pte(pmd);
+		return NULL;
+	}
+	return (pte_t *)__pmd_page(*pmd) + offset;
+}
+#endif
 
+#if 0
+pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset)
+{
+	pmd_t *pmd;
+
+	pmd = get_pointer_table();
+	if (pgd_none(*pgd)) {
+		if (pmd) {
+			pgd_set(pgd, pmd);
+			return pmd + offset;
+		}
+		pgd_set(pgd, (pmd_t *)BAD_PAGETABLE);
+		return NULL;
+	}
+	free_pointer_table(pmd);
+	if (pgd_bad(*pgd)) {
+		__bad_pmd(pgd);
+		return NULL;
+	}
+	return (pmd_t *)__pgd_page(*pgd) + offset;
+}
+#endif
 
 /* ++andreas: {get,free}_pointer_table rewritten to use unused fields from
    struct page instead of separately kmalloced struct.  Stolen from
diff -ruN linux-2.4.20-WRT/arch/m68k/mvme147/config.c linux-2.4.20-WRTstp/arch/m68k/mvme147/config.c
--- linux-2.4.20-WRT/arch/m68k/mvme147/config.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/mvme147/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -154,6 +154,7 @@
 }
 
 /* This is always executed with interrupts disabled.  */
+/* XXX There are race hazards in this code XXX */
 unsigned long mvme147_gettimeoffset (void)
 {
 	volatile unsigned short *cp = (volatile unsigned short *)0xfffe1012;
diff -ruN linux-2.4.20-WRT/arch/m68k/q40/config.c linux-2.4.20-WRTstp/arch/m68k/q40/config.c
--- linux-2.4.20-WRT/arch/m68k/q40/config.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/q40/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -84,6 +84,13 @@
 extern char *q40_mem_cptr; /*=(char *)0xff020000;*/
 static int _cpleft;
 
+#if 0
+int q40_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
+{
+        *keycodep = keycode;
+        return 1;
+}
+#endif
 
 static void q40_mem_console_write(struct console *co, const char *s,
 				  unsigned int count)
@@ -97,7 +104,27 @@
       _cpleft--;
     }
 }
+#if 0
+void printq40(char *str)
+{
+  int l=strlen(str);
+  char *p=q40_mem_cptr;
+
+  while (l-- >0 && _cpleft-- >0)
+    {
+      *p=*str++;
+      p+=4;
+    }
+  q40_mem_cptr=p;
+}
+#endif
 
+#if 0
+int q40_kbdrate (struct kbd_repeat *k)
+{
+	return 0;
+}
+#endif
 
 static int halted=0;
 
diff -ruN linux-2.4.20-WRT/arch/m68k/q40/q40ints.c linux-2.4.20-WRTstp/arch/m68k/q40/q40ints.c
--- linux-2.4.20-WRT/arch/m68k/q40/q40ints.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/q40/q40ints.c	2005-11-08 06:23:47.000000000 -0800
@@ -268,6 +268,12 @@
 */
 
 struct IRQ_TABLE{ unsigned mask; int irq ;};
+#if 0
+static struct IRQ_TABLE iirqs[]={
+  {Q40_IRQ_FRAME_MASK,Q40_IRQ_FRAME},
+  Q40_{IRQ_KEYB_MASK,Q40_IRQ_KEYBOARD},
+  {0,0}};
+#endif
 static struct IRQ_TABLE eirqs[]={
   {Q40_IRQ3_MASK,3},                   /* ser 1 */
   {Q40_IRQ4_MASK,4},                   /* ser 2 */
@@ -288,6 +294,7 @@
 static int ccleirq=60;    /* ISA dev IRQ's*/
 /*static int cclirq=60;*/     /* internal */
 
+/* FIXME: add shared ints,mask,unmask,probing.... */
 
 #define IRQ_INPROGRESS 1
 /*static unsigned short saved_mask;*/
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/config.c linux-2.4.20-WRTstp/arch/m68k/sun3/config.c
--- linux-2.4.20-WRT/arch/m68k/sun3/config.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -77,6 +77,7 @@
 	memset(sun3_reserved_pmeg, 0, sizeof(sun3_reserved_pmeg));
 
 	/* Reserve important PMEGS */
+	/* FIXME: These should be probed instead of hardcoded */
 
 	for (i=0; i<8; i++)		/* Kernel PMEGs */
 		sun3_reserved_pmeg[i] = 1;
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/idprom.c linux-2.4.20-WRTstp/arch/m68k/sun3/idprom.c
--- linux-2.4.20-WRT/arch/m68k/sun3/idprom.c	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/idprom.c	1999-09-08 11:20:42.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: idprom.c,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+/* $Id: idprom.c,v 1.22 1996/11/13 05:09:25 davem Exp $
  * idprom.c: Routines to load the idprom into kernel addresses and
  *           interpret the data contained within.
  *
@@ -63,6 +63,11 @@
 			if (machtype != (SM_SUN4M_OBP | 0x00))
 				printk("TYPE: %s\n", Sun_Machines[i].name);
 			else {
+#if 0
+				prom_getproperty(prom_root_node, "banner-name",
+						 sysname, sizeof(sysname));
+				printk("TYPE: %s\n", sysname);
+#endif				
 			}
 			return;
 		}
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/mmu_emu.c linux-2.4.20-WRTstp/arch/m68k/sun3/mmu_emu.c
--- linux-2.4.20-WRT/arch/m68k/sun3/mmu_emu.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/mmu_emu.c	2005-11-08 06:24:35.000000000 -0800
@@ -66,6 +66,25 @@
 /* Print a PTE value in symbolic form. For debugging. */
 void print_pte (pte_t pte)
 {
+#if 0
+	/* Verbose version. */
+	unsigned long val = pte_val (pte);
+	printk (" pte=%lx [addr=%lx",
+		val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT);
+	if (val & SUN3_PAGE_VALID)	printk (" valid");
+	if (val & SUN3_PAGE_WRITEABLE)	printk (" write");
+	if (val & SUN3_PAGE_SYSTEM)	printk (" sys");
+	if (val & SUN3_PAGE_NOCACHE)	printk (" nocache");
+	if (val & SUN3_PAGE_ACCESSED)	printk (" accessed");
+	if (val & SUN3_PAGE_MODIFIED)	printk (" modified");
+	switch (val & SUN3_PAGE_TYPE_MASK) {
+		case SUN3_PAGE_TYPE_MEMORY: printk (" memory"); break;
+		case SUN3_PAGE_TYPE_IO:     printk (" io");     break;
+		case SUN3_PAGE_TYPE_VME16:  printk (" vme16");  break;
+		case SUN3_PAGE_TYPE_VME32:  printk (" vme32");  break;
+	}
+	printk ("]\n");
+#else
 	/* Terse version. More likely to fit on a line. */
 	unsigned long val = pte_val (pte);
 	char flags[7], *type;
@@ -88,6 +107,7 @@
 
 	printk (" pte=%08lx [%07lx %s %s]\n",
 		val, (val & SUN3_PAGE_PGNUM_MASK) << PAGE_SHIFT, flags, type);
+#endif
 }
 
 /* Print the PTE value for a given virtual address. For debugging. */
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/prom/console.c linux-2.4.20-WRTstp/arch/m68k/sun3/prom/console.c
--- linux-2.4.20-WRT/arch/m68k/sun3/prom/console.c	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/prom/console.c	1999-11-12 04:29:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: console.c,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+/* $Id: console.c,v 1.10 1996/12/18 06:46:54 tridge Exp $
  * console.c: Routines that deal with sending and receiving IO
  *            to/from the current console device using the PROM.
  *
@@ -61,6 +61,114 @@
 }
 
 /* Query for input device type */
+#if 0
+enum prom_input_device
+prom_query_input_device()
+{
+	unsigned long flags;
+	int st_p;
+	char propb[64];
+	char *p;
+
+	switch(prom_vers) {
+	case PROM_V0:
+	case PROM_V2:
+	default:
+		switch(*romvec->pv_stdin) {
+		case PROMDEV_KBD:	return PROMDEV_IKBD;
+		case PROMDEV_TTYA:	return PROMDEV_ITTYA;
+		case PROMDEV_TTYB:	return PROMDEV_ITTYB;
+		default:
+			return PROMDEV_I_UNK;
+		};
+	case PROM_V3:
+	case PROM_P1275:
+		save_flags(flags); cli();
+		st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdin);
+		__asm__ __volatile__("ld [%0], %%g6\n\t" : :
+				     "r" (&current_set[smp_processor_id()]) :
+				     "memory");
+		restore_flags(flags);
+		if(prom_node_has_property(st_p, "keyboard"))
+			return PROMDEV_IKBD;
+		prom_getproperty(st_p, "device_type", propb, sizeof(propb));
+		if(strncmp(propb, "serial", sizeof("serial")))
+			return PROMDEV_I_UNK;
+		prom_getproperty(prom_root_node, "stdin-path", propb, sizeof(propb));
+		p = propb;
+		while(*p) p++; p -= 2;
+		if(p[0] == ':') {
+			if(p[1] == 'a')
+				return PROMDEV_ITTYA;
+			else if(p[1] == 'b')
+				return PROMDEV_ITTYB;
+		}
+		return PROMDEV_I_UNK;
+	case PROM_AP1000:
+		return PROMDEV_I_UNK;
+	};
+}
+#endif
 
 /* Query for output device type */
 
+#if 0
+enum prom_output_device
+prom_query_output_device()
+{
+	unsigned long flags;
+	int st_p;
+	char propb[64];
+	char *p;
+	int propl;
+
+	switch(prom_vers) {
+	case PROM_V0:
+		switch(*romvec->pv_stdin) {
+		case PROMDEV_SCREEN:	return PROMDEV_OSCREEN;
+		case PROMDEV_TTYA:	return PROMDEV_OTTYA;
+		case PROMDEV_TTYB:	return PROMDEV_OTTYB;
+		};
+		break;
+	case PROM_V2:
+	case PROM_V3:
+	case PROM_P1275:
+		save_flags(flags); cli();
+		st_p = (*romvec->pv_v2devops.v2_inst2pkg)(*romvec->pv_v2bootargs.fd_stdout);
+		__asm__ __volatile__("ld [%0], %%g6\n\t" : :
+				     "r" (&current_set[smp_processor_id()]) :
+				     "memory");
+		restore_flags(flags);
+		propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb));
+		if (propl >= 0 && propl == sizeof("display") &&
+			strncmp("display", propb, sizeof("display")) == 0)
+		{
+			return PROMDEV_OSCREEN;
+		}
+		if(prom_vers == PROM_V3) {
+			if(strncmp("serial", propb, sizeof("serial")))
+				return PROMDEV_O_UNK;
+			prom_getproperty(prom_root_node, "stdout-path", propb, sizeof(propb));
+			p = propb;
+			while(*p) p++; p -= 2;
+			if(p[0]==':') {
+				if(p[1] == 'a')
+					return PROMDEV_OTTYA;
+				else if(p[1] == 'b')
+					return PROMDEV_OTTYB;
+			}
+			return PROMDEV_O_UNK;
+		} else {
+			/* This works on SS-2 (an early OpenFirmware) still. */
+			switch(*romvec->pv_stdin) {
+			case PROMDEV_TTYA:	return PROMDEV_OTTYA;
+			case PROMDEV_TTYB:	return PROMDEV_OTTYB;
+			};
+		}
+		break;
+	case PROM_AP1000:
+		return PROMDEV_I_UNK;
+	};
+	return PROMDEV_O_UNK;
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/prom/init.c linux-2.4.20-WRTstp/arch/m68k/sun3/prom/init.c
--- linux-2.4.20-WRT/arch/m68k/sun3/prom/init.c	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/prom/init.c	1999-09-08 11:20:42.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: init.c,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+/* $Id: init.c,v 1.9 1996/12/18 06:46:55 tridge Exp $
  * init.c:  Initialize internal variables used by the PROM
  *          library functions.
  *
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/prom/Makefile linux-2.4.20-WRTstp/arch/m68k/sun3/prom/Makefile
--- linux-2.4.20-WRT/arch/m68k/sun3/prom/Makefile	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/prom/Makefile	1999-12-20 14:43:40.000000000 -0800
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+# $Id: Makefile,v 1.5 1995/11/25 00:59:48 davem Exp $
 # Makefile for the Sun Boot PROM interface library under
 # Linux.
 #
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/prom/misc.c linux-2.4.20-WRTstp/arch/m68k/sun3/prom/misc.c
--- linux-2.4.20-WRT/arch/m68k/sun3/prom/misc.c	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/prom/misc.c	1999-11-12 04:29:47.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: misc.c,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+/* $Id: misc.c,v 1.15 1997/05/14 20:45:00 davem Exp $
  * misc.c:  Miscellaneous prom functions that don't belong
  *          anywhere else.
  *
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3/prom/printf.c linux-2.4.20-WRTstp/arch/m68k/sun3/prom/printf.c
--- linux-2.4.20-WRT/arch/m68k/sun3/prom/printf.c	2003-10-14 01:07:29.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3/prom/printf.c	1999-09-04 13:06:41.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: printf.c,v 1.1.1.4 2003/10/14 08:07:29 sparq Exp $
+/* $Id: printf.c,v 1.5 1996/04/04 16:31:07 tridge Exp $
  * printf.c:  Internal prom library printf facility.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3x/config.c linux-2.4.20-WRTstp/arch/m68k/sun3x/config.c
--- linux-2.4.20-WRT/arch/m68k/sun3x/config.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3x/config.c	2005-11-08 06:24:35.000000000 -0800
@@ -86,6 +86,22 @@
 	sun3_intreg = (unsigned char *)SUN3X_INTREG;
 
 	/* only the serial console is known to work anyway... */
+#if 0    
+	switch (*(unsigned char *)SUN3X_EEPROM_CONS) {
+	case 0x10:
+		serial_console = 1;
+		conswitchp = NULL;
+		break;
+	case 0x11:
+		serial_console = 2;
+		conswitchp = NULL;
+		break;
+	default:
+		serial_console = 0;
+		conswitchp = &dummy_con;
+		break;
+	}
+#endif
 
 }
 
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3x/dvma.c linux-2.4.20-WRTstp/arch/m68k/sun3x/dvma.c
--- linux-2.4.20-WRT/arch/m68k/sun3x/dvma.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3x/dvma.c	2001-06-11 19:15:27.000000000 -0700
@@ -45,9 +45,15 @@
 #define dvma_entry_paddr(index) 	(iommu_pte[index] & IOMMU_ADDR_MASK)
 #define dvma_entry_vaddr(index,paddr) 	((index << DVMA_PAGE_SHIFT) |  \
 					 (paddr & (DVMA_PAGE_SIZE-1)))
+#if 0
+#define dvma_entry_set(index,addr)	(iommu_pte[index] =            \
+					    (addr & IOMMU_ADDR_MASK) | \
+				             IOMMU_DT_VALID | IOMMU_CACHE_INHIBIT)
+#else
 #define dvma_entry_set(index,addr)	(iommu_pte[index] =            \
 					    (addr & IOMMU_ADDR_MASK) | \
 				             IOMMU_DT_VALID)
+#endif
 #define dvma_entry_clr(index)		(iommu_pte[index] = IOMMU_DT_INVALID)
 #define dvma_entry_hash(addr)		((addr >> DVMA_PAGE_SHIFT) ^ \
 					 ((addr & 0x03c00000) >>     \
@@ -187,6 +193,13 @@
 #ifdef DEBUG
 		printk("freeing bus mapping %08x\n", index << DVMA_PAGE_SHIFT);
 #endif
+#if 0
+		if(!dvma_entry_use(index)) 
+			printk("dvma_unmap freeing unused entry %04x\n",
+			       index);
+		else
+			dvma_entry_dec(index);
+#endif
 		dvma_entry_clr(index);
 	}
 
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3x/prom.c linux-2.4.20-WRTstp/arch/m68k/sun3x/prom.c
--- linux-2.4.20-WRT/arch/m68k/sun3x/prom.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3x/prom.c	2005-11-08 06:24:35.000000000 -0800
@@ -130,6 +130,9 @@
 	    idprom->id_machtype = SM_SUN3X | SM_3_80;
     }
 
+    /* point trap #14 at abort.
+     * XXX this is futile since we restore the vbr first - oops
+     */
     vectors[VEC_TRAP14] = sun3x_prom_abort;
     
     /* If debug=prom was specified, start the debug console */
diff -ruN linux-2.4.20-WRT/arch/m68k/sun3x/time.c linux-2.4.20-WRTstp/arch/m68k/sun3x/time.c
--- linux-2.4.20-WRT/arch/m68k/sun3x/time.c	2003-07-04 01:11:10.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/m68k/sun3x/time.c	2005-11-08 06:24:35.000000000 -0800
@@ -100,6 +100,18 @@
     return 0L;
 }
 
+#if 0
+static void sun3x_timer_tick(int irq, void *dev_id, struct pt_regs *regs)
+{
+    void (*vector)(int, void *, struct pt_regs *) = dev_id;
+
+    /* Clear the pending interrupt - pulse the enable line low */
+    disable_irq(5);
+    enable_irq(5);
+    
+    vector(irq, NULL, regs);
+}
+#endif
 
 void __init sun3x_sched_init(void (*vector)(int, void *, struct pt_regs *))
 {
diff -ruN linux-2.4.20-WRT/arch/mips/arc/memory.c linux-2.4.20-WRTstp/arch/mips/arc/memory.c
--- linux-2.4.20-WRT/arch/mips/arc/memory.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/arc/memory.c	2005-11-08 06:24:35.000000000 -0800
@@ -31,7 +31,7 @@
 	return (struct linux_mdesc *) ARC_CALL1(get_mdesc, Current);
 }
 
-#ifdef DEBUG     /* convenient for debugging */
+#ifdef DEBUG /* convenient for debugging */
 static char *arcs_mtypes[8] = {
 	"Exception Block",
 	"ARCS Romvec Page",
diff -ruN linux-2.4.20-WRT/arch/mips/arc/misc.c linux-2.4.20-WRTstp/arch/mips/arc/misc.c
--- linux-2.4.20-WRT/arch/mips/arc/misc.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/arc/misc.c	2005-11-08 06:23:47.000000000 -0800
@@ -47,6 +47,7 @@
 never:	goto never;
 }
 
+/* XXX is this a soft reset basically? XXX */
 VOID
 ArcRestart(VOID)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/common/dbg_io.c linux-2.4.20-WRTstp/arch/mips/au1000/common/dbg_io.c
--- linux-2.4.20-WRT/arch/mips/au1000/common/dbg_io.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/common/dbg_io.c	2006-06-12 17:49:48.000000000 -0700
@@ -5,6 +5,10 @@
 
 #ifdef CONFIG_REMOTE_DEBUG
 
+/*
+ * FIXME the user should be able to select the
+ * uart to be used for debugging.
+ */
 #define	DEBUG_BASE  UART2_ADDR
 /**/
 
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/common/prom.c linux-2.4.20-WRTstp/arch/mips/au1000/common/prom.c
--- linux-2.4.20-WRT/arch/mips/au1000/common/prom.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/common/prom.c	2006-06-12 18:15:48.000000000 -0700
@@ -105,9 +105,9 @@
 inline unsigned char str2hexnum(unsigned char c)
 {
 	if(c >= '0' && c <= '9')
-	return c - '0';
+		return c - '0';
 	if(c >= 'a' && c <= 'f')
-	return c - 'a' + 10;
+		return c - 'a' + 10;
 	return 0; /* foo */
 }
 
@@ -128,6 +128,7 @@
 
 int get_ethernet_addr(char *ethernet_addr)
 {
+	int i;
         char *ethaddr_str;
 
         ethaddr_str = prom_getenv("ethaddr");
@@ -137,6 +138,12 @@
 	}
 	str2eaddr(ethernet_addr, ethaddr_str);
 
+#if 0
+	printk("get_ethernet_addr: ");
+	for (i=0; i<5; i++)
+		printk("%02x:", (unsigned char)*(ethernet_addr+i));
+	printk("%02x\n", *(ethernet_addr+i));
+#endif
 
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/common/serial.c linux-2.4.20-WRTstp/arch/mips/au1000/common/serial.c
--- linux-2.4.20-WRT/arch/mips/au1000/common/serial.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/common/serial.c	2006-06-12 18:15:48.000000000 -0700
@@ -593,6 +593,9 @@
 		if (status & UART_LSR_THRE)
 			transmit_chars(info, 0);
 		if (pass_counter++ > RS_ISR_PASS_LIMIT) {
+#if 0
+			printk("rs_single loop break.\n");
+#endif
 			break;
 		}
 	} while (!(serial_in(info, UART_IIR) & UART_IIR_NO_INT));
@@ -670,6 +673,15 @@
 	last_strobe = jiffies;
 	mod_timer(&serial_timer, jiffies + RS_STROBE_TIME);
 
+#if 0
+	if (IRQ_ports[0]) {
+		save_flags(flags); cli();
+		rs_interrupt_single(0, NULL, NULL);
+		restore_flags(flags);
+
+		mod_timer(&serial_timer, jiffies + IRQ_timeout[0]);
+	}
+#endif
 }
 
 /*
@@ -786,6 +798,10 @@
 	/*
 	 * Allocate the IRQ if necessary
 	 */
+#if 0
+	/* au1000, uart0 irq is 0 */
+	if (state->irq && (!IRQ_ports[state->irq] || !IRQ_ports[state->irq]->next_port)) {
+#endif
 	if ((!IRQ_ports[state->irq] || !IRQ_ports[state->irq]->next_port)) {
 		if (IRQ_ports[state->irq]) {
 			retval = -EBUSY;
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/common/usbdev.c linux-2.4.20-WRTstp/arch/mips/au1000/common/usbdev.c
--- linux-2.4.20-WRT/arch/mips/au1000/common/usbdev.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/common/usbdev.c	2006-06-12 18:15:48.000000000 -0700
@@ -197,6 +197,18 @@
 	return (req >= 0 && req <= 12) ? std_req_name[req] : "UNKNOWN";
 }
 
+#if 0
+static void
+dump_setup(devrequest* s)
+{
+	dbg(__FUNCTION__ ": requesttype=%d", s->requesttype);
+	dbg(__FUNCTION__ ": request=%d %s", s->request,
+	    get_std_req_name(s->request));
+	dbg(__FUNCTION__ ": value=0x%04x", s->wValue);
+	dbg(__FUNCTION__ ": index=%d", s->index);
+	dbg(__FUNCTION__ ": length=%d", s->length);
+}
+#endif
 
 static inline usbdev_pkt_t *
 alloc_packet(endpoint_t * ep, int data_size, void* data)
@@ -387,6 +399,32 @@
 	return read_count;
 }
 
+#if 0
+/* EP spinlock must be held when calling. */
+static int
+endpoint_fifo_write(endpoint_t * ep, int index)
+{
+	int write_count = 0;
+	u8 *bufptr;
+	usbdev_pkt_t *pkt = ep->inlist.head;
+
+	if (!pkt)
+		return -EINVAL;
+
+	bufptr = &pkt->payload[index];
+	while ((au_readl(ep->reg->write_fifo_status) &
+		USBDEV_FSTAT_FCNT_MASK) < EP_FIFO_DEPTH) {
+		if (bufptr < pkt->payload + pkt->size) {
+			au_writel(*bufptr++, ep->reg->write_fifo);
+			write_count++;
+		} else {
+			break;
+		}
+	}
+
+	return write_count;
+}
+#endif
 
 /*
  * This routine is called to restart transmission of a packet.
@@ -541,6 +579,15 @@
 }
 
 
+/*
+ * This routine is called when a packet in the outlist has been
+ * completed (received) and we need to prepare for a new packet
+ * to be received. Halts DMA and computes the packet size from the
+ * remaining DMA counter. Then prepares a new packet for reception
+ * and restarts DMA. FIXME: what if another packet comes in
+ * on top of the completed packet? Counter would be wrong.
+ * EP spinlock must be held when calling.
+ */
 static usbdev_pkt_t *
 receive_packet_complete(endpoint_t * ep)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/db1x00/pci_ops.c linux-2.4.20-WRTstp/arch/mips/au1000/db1x00/pci_ops.c
--- linux-2.4.20-WRT/arch/mips/au1000/db1x00/pci_ops.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/db1x00/pci_ops.c	2006-06-12 17:49:48.000000000 -0700
@@ -109,11 +109,13 @@
 	device = (dev_fn >> 3) & 0x1f;
 	function = dev_fn & 0x7;
 
+#if 1
 	//if (!cfg_addr || (device < 10) || (device > 16)) {
 	if (!cfg_addr || (device > 16)) {
 		*data = 0xffffffff;
 		return -1;
 	}
+#endif
 
 	au_writel(((0x2000 << 16) | (au_readl(Au1500_PCI_STATCMD) & 0xffff)),
 			Au1500_PCI_STATCMD);
@@ -124,6 +126,10 @@
 	config = cfg_addr | 
 		((1<<device)<<11) | (function << 8) | (where & ~0x3);
 
+#if 0
+	printk("cfg access: config %x, dev_fn %x, device %x function %x\n",
+			config, dev_fn, device, function);
+#endif
 
 	if (access_type == PCI_ACCESS_WRITE) {
 		au_writel(*data, config);
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/db1x00/setup.c linux-2.4.20-WRTstp/arch/mips/au1000/db1x00/setup.c
--- linux-2.4.20-WRT/arch/mips/au1000/db1x00/setup.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/db1x00/setup.c	2006-06-12 18:15:48.000000000 -0700
@@ -150,7 +150,7 @@
 	// YAMON (specifically reset_db1500.s) setups all PCI
 	//
 
-#if defined(CONFIG_USB_OHCI) || defined(CONFIG_AU1000_USB_DEVICE)
+#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1000_USB_DEVICE)
 #ifdef CONFIG_USB_OHCI
 	if ((argptr = strstr(argptr, "usb_ohci=")) == NULL) {
 	        char usb_args[80];
@@ -196,6 +196,20 @@
 	ide_ops = &std_ide_ops;
 #endif
 
+#if 0
+	//// FIX!!! must be valid for au1000, au1500 and au1100
+	/* Enable Au1000 BCLK switching */
+	switch (prid & 0x000000FF)
+	{
+	case 0x00: /* DA */
+	case 0x01: /* HA */
+	case 0x02: /* HB */
+		break;
+	default:  /* HC and newer */
+		au_writel(0x00000060, 0xb190003c);
+		break;
+	}
+#endif
 
 	au_writel(0, 0xAE000010); /* turn off pcmcia power */
 
@@ -214,17 +228,3 @@
 static phys_t db_fixup_bigphys_addr(phys_t phys_addr, phys_t size)
 {
 	u32 pci_start = (u32)Au1500_PCI_MEM_START;
-	u32 pci_end = (u32)Au1500_PCI_MEM_END;
-
-	/* Don't fixup 36 bit addresses */
-	if ((phys_addr >> 32) != 0) return phys_addr;
-
-	/* check for pci memory window */
-	if ((phys_addr >= pci_start) && ((phys_addr + size) < pci_end)) {
-		return (phys_t)((phys_addr - pci_start) +
-				     Au1500_PCI_MEM_START);
-	}
-	else 
-		return phys_addr;
-}
-#endif
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/pb1000/setup.c linux-2.4.20-WRTstp/arch/mips/au1000/pb1000/setup.c
--- linux-2.4.20-WRT/arch/mips/au1000/pb1000/setup.c	2003-07-04 01:11:11.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/pb1000/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -126,7 +126,7 @@
 	au_writel(0, SYS_PINSTATERD);
 	udelay(100);
 
-#if defined(CONFIG_USB_OHCI) || defined(CONFIG_AU1X00_USB_DEVICE)
+#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
 #ifdef CONFIG_USB_OHCI
 	if ((argptr = strstr(argptr, "usb_ohci=")) == NULL) {
 	        char usb_args[80];
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/pb1100/setup.c linux-2.4.20-WRTstp/arch/mips/au1000/pb1100/setup.c
--- linux-2.4.20-WRT/arch/mips/au1000/pb1100/setup.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/pb1100/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -135,7 +135,7 @@
 	au_writel(0, SYS_PININPUTEN);
 	udelay(100);
 
-#if defined(CONFIG_USB_OHCI) || defined(CONFIG_AU1X00_USB_DEVICE)
+#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
 #ifdef CONFIG_USB_OHCI
 	if ((argptr = strstr(argptr, "usb_ohci=")) == NULL) {
 	        char usb_args[80];
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/pb1500/pci_ops.c linux-2.4.20-WRTstp/arch/mips/au1000/pb1500/pci_ops.c
--- linux-2.4.20-WRT/arch/mips/au1000/pb1500/pci_ops.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/pb1500/pci_ops.c	2006-06-12 17:49:48.000000000 -0700
@@ -109,6 +109,10 @@
         /* setup the lower bits of the 36 bit address */
         config = cfg_addr | (function << 8) | (where & ~0x3);
 
+#if 0
+	printk("cfg access: config %x, dev_fn %x, device %x function %x\n",
+			config, dev_fn, device, function);
+#endif
 
 	if (access_type == PCI_ACCESS_WRITE) {
 		au_writel(*data, config);
@@ -126,6 +130,9 @@
 
 	/* check master abort */
 	status = au_readl(Au1500_PCI_STATCMD);
+#if 0
+printk("cfg access: status %x, data %x\n", status, *data );
+#endif
 	if (status & (1<<29)) { 
 		*data = 0xffffffff;
 		return -1;
diff -ruN linux-2.4.20-WRT/arch/mips/au1000/pb1500/setup.c linux-2.4.20-WRTstp/arch/mips/au1000/pb1500/setup.c
--- linux-2.4.20-WRT/arch/mips/au1000/pb1500/setup.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/au1000/pb1500/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -143,7 +143,7 @@
 	au_writel(0, SYS_PINSTATERD);
 	udelay(100);
 
-#if defined(CONFIG_USB_OHCI) || defined(CONFIG_AU1X00_USB_DEVICE)
+#if defined (CONFIG_USB_OHCI) || defined (CONFIG_AU1X00_USB_DEVICE)
 #ifdef CONFIG_USB_OHCI
 	if ((argptr = strstr(argptr, "usb_ohci=")) == NULL) {
 	        char usb_args[80];
@@ -217,7 +217,7 @@
 		argptr = prom_getcmdline();
 		strcat(argptr, " video=e1356fb:system:pb1500");
 	}
-#elif defined(CONFIG_FB_XPERT98)
+#elif defined (CONFIG_FB_XPERT98)
 	if ((argptr = strstr(argptr, "video=")) == NULL) {
 		argptr = prom_getcmdline();
 		strcat(argptr, " video=atyfb:1024x768-8@70");
diff -ruN linux-2.4.20-WRT/arch/mips/baget/irq.c linux-2.4.20-WRTstp/arch/mips/baget/irq.c
--- linux-2.4.20-WRT/arch/mips/baget/irq.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/baget/irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -34,10 +34,10 @@
  */
 
 static int irq_to_pil_map[BAGET_IRQ_NR] = {
-	7YYDELETEMEYY,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 0x00 - 0x0f */
-	-1,-1,-1,-1, 3,-1,-1,-1, 2, 2, 2,-1, 3,-1,-1,3YYDELETEMEYY, /* 0x10 - 0x1f */
+	7/*fixme: dma_err -1*/,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 0x00 - 0x0f */
+	-1,-1,-1,-1, 3,-1,-1,-1, 2, 2, 2,-1, 3,-1,-1,3/*fixme: lance*/, /* 0x10 - 0x1f */
         -1,-1,-1,-1,-1,-1, 5,-1,-1,-1,-1,-1, 7,-1,-1,-1, /* 0x20 - 0x2f */
-	-1, 3, 2YYDELETEMEYY, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3  /* 0x30 - 0x3f */
+	-1, 3, 2/*fixme systimer:3*/, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3  /* 0x30 - 0x3f */
 };
 
 static inline int irq_to_pil(int irq_nr)
diff -ruN linux-2.4.20-WRT/arch/mips/baget/reset.c linux-2.4.20-WRTstp/arch/mips/baget/reset.c
--- linux-2.4.20-WRT/arch/mips/baget/reset.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/baget/reset.c	1999-06-25 17:40:12.000000000 -0700
@@ -14,6 +14,7 @@
 	(*(vector*)R3000_RESET_VEC)();
 }
 
+/* fixme: proper functionality */
 
 void baget_machine_restart(char *command)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/baget/vacserial.c linux-2.4.20-WRTstp/arch/mips/baget/vacserial.c
--- linux-2.4.20-WRT/arch/mips/baget/vacserial.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/baget/vacserial.c	2006-06-12 18:15:48.000000000 -0700
@@ -461,6 +461,10 @@
 
 static _INLINE_ void check_modem_status(struct async_struct *info)
 {
+#if 0 /* VAC hasn't modem control */
+	wake_up_interruptible(&info->open_wait);
+	rs_sched_event(info, RS_EVENT_WRITE_WAKEUP);
+#endif
 }
 
 #ifdef CONFIG_SERIAL_SHARE_IRQ
@@ -2332,6 +2336,22 @@
  *  It is not a good idea to share interrupts with console,
  *  but it looks we cannot avoid it.
  */
+#if 0
+
+#ifdef CONFIG_SERIAL_CONSOLE
+	/*
+	 *	The interrupt of the serial console port
+	 *	can't be shared.
+	 */
+	if (sercons.flags & CON_CONSDEV) {
+		for(i = 0; i < NR_PORTS; i++)
+			if (i != sercons.index &&
+			    rs_table[i].irq == rs_table[sercons.index].irq)
+				rs_table[i].irq = 0;
+	}
+#endif
+
+#endif
 	show_serial_version();
 
 	/* Initialize the tty_driver structure */
@@ -2752,12 +2772,12 @@
 }
 
 static struct console sercons = {
-	.name		= "ttyS",
-	.write		= serial_console_write,
-	.device		= serial_console_device,
-	.setup		= serial_console_setup,
-	.flags		= CON_PRINTBUFFER,
-	.index		= -1,
+	name:		"ttyS",
+	write:		serial_console_write,
+	device:		serial_console_device,
+	setup:		serial_console_setup,
+	flags:		CON_PRINTBUFFER,
+	index:		-1,
 };
 
 /*
@@ -2841,6 +2861,7 @@
 	 */
 
 	quot = info->baud_base / 9600;	     /* baud rate is fixed to 9600 */
+	/* FIXME: if rs_debug interface is needed, we need to set speed here */
 
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/mips/cobalt/pci.c linux-2.4.20-WRTstp/arch/mips/cobalt/pci.c
--- linux-2.4.20-WRT/arch/mips/cobalt/pci.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/cobalt/pci.c	2006-06-12 17:49:48.000000000 -0700
@@ -222,6 +222,7 @@
 		*((volatile unsigned int *)0xb4000c04) = 0x00004020;
 	} else if (galileo_id == 0x1 || galileo_id == 0x2) {
 		signed int timeo;
+		/* XXX WE MUST DO THIS ELSE GALILEO LOCKS UP! -DaveM */
 		timeo = *((volatile unsigned int *)0xb4000c04);
 		/* Old Galileo, assumes PCI STOP line to VIA is disconnected. */
 		*((volatile unsigned int *)0xb4000c04) = 0x0000ffff;
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5074/int-handler.S linux-2.4.20-WRTstp/arch/mips/ddb5074/int-handler.S
--- linux-2.4.20-WRT/arch/mips/ddb5074/int-handler.S	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5074/int-handler.S	2006-06-12 18:15:48.000000000 -0700
@@ -62,8 +62,10 @@
 	.set	at
 	mfc0	s0, CP0_CAUSE		# get irq mask
 
+#if 1
 	mfc0	t2,CP0_STATUS		# get enabled interrupts
 	and	s0,t2			# isolate allowed ones
+#endif
 	/* First we check for r4k counter/timer IRQ. */
 	andi	a0, s0, CAUSEF_IP2	# delay slot, check local level zero
 	beq	a0, zero, 1f
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5074/irq.c linux-2.4.20-WRTstp/arch/mips/ddb5074/irq.c
--- linux-2.4.20-WRT/arch/mips/ddb5074/irq.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5074/irq.c	2006-06-12 18:15:48.000000000 -0700
@@ -159,10 +159,12 @@
 {
 	u32 mask;
 	int nile4_irq;
+#if 1
 	volatile static int nesting = 0;
 	if (nesting++ == 0)
 		ddb5074_led_d3(1);
 	ddb5074_led_hex(nesting < 16 ? nesting : 15);
+#endif
 
 	mask = nile4_get_irq_stat(0);
 	nile4_clear_irq_mask(mask);
@@ -184,9 +186,11 @@
 				do_IRQ(nile4_to_irq(nile4_irq), regs);
 			nile4_enable_irq(nile4_irq);
 		}
+#if 1
 	if (--nesting == 0)
 		ddb5074_led_d3(0);
 	ddb5074_led_hex(nesting < 16 ? nesting : 15);
+#endif
 }
 
 void ddb_local1_irqdispatch(void)
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5074/nile4.c linux-2.4.20-WRTstp/arch/mips/ddb5074/nile4.c
--- linux-2.4.20-WRT/arch/mips/ddb5074/nile4.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5074/nile4.c	2006-06-12 18:15:48.000000000 -0700
@@ -30,6 +30,11 @@
 		return;
 	}
 	switch (size) {
+#if 0				/* We don't support 4 GB yet */
+	case 0x100000000:	/* 4 GB */
+		maskbits = 4;
+		break;
+#endif
 	case 0x80000000:	/* 2 GB */
 		maskbits = 5;
 		break;
@@ -266,3 +271,22 @@
 	return irq;
 }
 
+#if 0
+void nile4_dump_irq_status(void)
+{
+	printk("CPUSTAT = %p:%p\n", (void *) nile4_in32(NILE4_CPUSTAT + 4),
+	       (void *) nile4_in32(NILE4_CPUSTAT));
+	printk("INTCTRL = %p:%p\n", (void *) nile4_in32(NILE4_INTCTRL + 4),
+	       (void *) nile4_in32(NILE4_INTCTRL));
+	printk("INTSTAT0 = %p:%p\n",
+	       (void *) nile4_in32(NILE4_INTSTAT0 + 4),
+	       (void *) nile4_in32(NILE4_INTSTAT0));
+	printk("INTSTAT1 = %p:%p\n",
+	       (void *) nile4_in32(NILE4_INTSTAT1 + 4),
+	       (void *) nile4_in32(NILE4_INTSTAT1));
+	printk("INTCLR = %p:%p\n", (void *) nile4_in32(NILE4_INTCLR + 4),
+	       (void *) nile4_in32(NILE4_INTCLR));
+	printk("INTPPES = %p:%p\n", (void *) nile4_in32(NILE4_INTPPES + 4),
+	       (void *) nile4_in32(NILE4_INTPPES));
+}
+#endif
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5xxx/common/nile4.c linux-2.4.20-WRTstp/arch/mips/ddb5xxx/common/nile4.c
--- linux-2.4.20-WRT/arch/mips/ddb5xxx/common/nile4.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5xxx/common/nile4.c	2005-11-08 06:24:35.000000000 -0800
@@ -29,6 +29,11 @@
         u32 widthbits;
 
         switch (size) {
+#if 0                           /* We don't support 4 GB yet */
+        case 0x100000000:       /* 4 GB */
+                maskbits = 4;
+                break;
+#endif
         case 0x80000000:        /* 2 GB */
                 maskbits = 5;
                 break;
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5074/int-handler.S linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5074/int-handler.S
--- linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5074/int-handler.S	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5074/int-handler.S	2005-11-08 06:24:35.000000000 -0800
@@ -62,8 +62,10 @@
 	.set	at
 	mfc0	s0, CP0_CAUSE		# get irq mask
 
+#if 1
 	mfc0	t2,CP0_STATUS		# get enabled interrupts
 	and	s0,t2			# isolate allowed ones
+#endif
 	/* First we check for r4k counter/timer IRQ. */
 	andi	a0, s0, CAUSEF_IP2	# delay slot, check local level zero
 	beq	a0, zero, 1f
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5074/irq.c linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5074/irq.c
--- linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5074/irq.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5074/irq.c	2005-11-08 06:24:35.000000000 -0800
@@ -105,6 +105,12 @@
 	mask = nile4_get_irq_stat(0);
 
 	/* Handle the timer interrupt first */
+#if 0
+	if (mask & (1 << NILE4_INT_GPT)) {
+		do_IRQ(nile4_to_irq(NILE4_INT_GPT), regs);
+		mask &= ~(1 << NILE4_INT_GPT);
+	}
+#endif
 	for (nile4_irq = 0; mask; nile4_irq++, mask >>= 1)
 		if (mask & 1) {
 			if (nile4_irq == NILE4_INT_INTE) {
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5476/pci_ops.c linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5476/pci_ops.c
--- linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5476/pci_ops.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5476/pci_ops.c	2005-11-08 06:24:35.000000000 -0800
@@ -69,6 +69,10 @@
 		 */
 		if (slot_num == 12) slot_num = 0;
 
+#if 0
+		/* BUG : skip P2P bridge for now */
+		if (slot_num == 5) slot_num = 0;
+#endif
 
 	} else {
 		/* now we have to be hornest, returning the true
diff -ruN linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5476/setup.c linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5476/setup.c
--- linux-2.4.20-WRT/arch/mips/ddb5xxx/ddb5476/setup.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ddb5xxx/ddb5476/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -296,6 +296,11 @@
 	// *(unsigned char*)0xa8040058 = 0x74;              // use SIRQ, primary tri-state
 	*(unsigned char *) 0xa8040058 = 0x75;	// primary tri-state
 
+#if 0
+	/* this is not necessary if M5229 does not use SIRQ */
+	*(unsigned char *) 0xa8040044 = 0x0d;	// primary to IRQ 14
+	*(unsigned char *) 0xa8040075 = 0x0d;	// secondary to IRQ 14
+#endif
 
 	/* enable IDE in the M5229 config register 0x50 (bit 0 - 1) */
 	/* M5229 IDSEL is addr:24; see above setting */
diff -ruN linux-2.4.20-WRT/arch/mips/dec/prom/identify.c linux-2.4.20-WRTstp/arch/mips/dec/prom/identify.c
--- linux-2.4.20-WRT/arch/mips/dec/prom/identify.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/dec/prom/identify.c	2006-06-12 17:49:48.000000000 -0700
@@ -124,6 +124,10 @@
 	/* We're obviously one of the DEC machines */
 	mips_machgroup = MACH_GROUP_DEC;
 
+	/*
+	 * FIXME: This may not be an exhaustive list of DECStations/Servers!
+	 * Put all model-specific initialisation calls here.
+	 */
 	switch (dec_systype) {
 	case DS2100_3100:
 		mips_machtype = MACH_DS23100;
diff -ruN linux-2.4.20-WRT/arch/mips/dec/prom/memory.c linux-2.4.20-WRTstp/arch/mips/dec/prom/memory.c
--- linux-2.4.20-WRT/arch/mips/dec/prom/memory.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/dec/prom/memory.c	2006-06-12 17:49:48.000000000 -0700
@@ -37,6 +37,11 @@
 	memcpy(&old_handler, (void *)(KSEG0 + 0x80), 0x80);
 	memcpy((void *)(KSEG0 + 0x80), &genexcept_early, 0x80);
 
+	/* read unmapped and uncached (KSEG1)
+	 * DECstations have at least 4MB RAM
+	 * Assume less than 480MB of RAM, as this is max for 5000/2xx
+	 * FIXME this should be replaced by the first free page!
+	 */
 	for (memory_page = (unsigned char *) KSEG1 + CHUNK_SIZE;
 	     (mem_err== 0) && (memory_page < ((unsigned char *) KSEG1+0x1E000000));
   	     memory_page += CHUNK_SIZE) {
@@ -64,6 +69,7 @@
 	bitmap_size = rex_getbitmap(bm);
 
 	for (i = 0; i < bitmap_size; i++) {
+		/* FIXME: very simplistically only add full sets of pages */
 		if (bm->bitmap[i] == 0xff)
 			mem_size += (8 * bm->pagesize);
 		else if (!mem_size)
@@ -97,6 +103,12 @@
 	 */
 
 #if defined(CONFIG_DECLANCE) || defined(CONFIG_DECLANCE_MODULE)
+	/*
+	 * Leave 128 KB reserved for Lance memory for
+	 * IOASIC DECstations.
+	 *
+	 * XXX: save this address for use in dec_lance.c?
+	 */
 	if (IOASIC)
 		end = __pa(&_ftext) - 0x00020000;
 	else
diff -ruN linux-2.4.20-WRT/arch/mips/dec/time.c linux-2.4.20-WRTstp/arch/mips/dec/time.c
--- linux-2.4.20-WRT/arch/mips/dec/time.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/dec/time.c	2006-06-12 17:49:48.000000000 -0700
@@ -60,6 +60,11 @@
 /* Last jiffy when do_fast_gettimeoffset() was called. */
 static unsigned long last_jiffies = 0;
 
+/*
+ * On MIPS only R4000 and better have a cycle counter.
+ *
+ * FIXME: Does playing with the RP bit in c0_status interfere with this code?
+ */
 static unsigned long do_fast_gettimeoffset(void)
 {
 	u32 count;
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/etherboot.h linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/etherboot.h
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/etherboot.h	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/etherboot.h	2005-11-08 06:23:47.000000000 -0800
@@ -12,7 +12,7 @@
 #define	ASK_PROMPT	"Boot from (N)etwork or from (L)ocal? "
 #define	ANS_NETWORK	'N'
 #define	ANS_LOCAL	'L'
-#ifndef	ANS_DEFAULT		    /* in case left out in Makefile */
+#ifndef	ANS_DEFAULT		/* in case left out in Makefile */
 #define	ANS_DEFAULT	ANS_NETWORK
 #endif
 
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/flashdrv.c linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/flashdrv.c
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/flashdrv.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/flashdrv.c	2005-11-08 06:24:35.000000000 -0800
@@ -23,7 +23,7 @@
 #endif
 /* locals */
 
-#ifdef __MIPSEB__		    // skranz, add
+#ifdef __MIPSEB__		// skranz, add
 #define BE			// skranz, add
 #endif				// skranz, add
 
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/meminit.S linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/meminit.S
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/meminit.S	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/meminit.S	2005-11-08 06:24:35.000000000 -0800
@@ -126,6 +126,7 @@
 	beqz	a0,9f
 	addu	a0,a1			# end of memory
 
+	/* XXX should run cached, but caches may not be initialised yet */
 	.set noreorder
 #if __mips >= 3
 1:	sd	zero,0(a1)
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/ns16550.h linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/ns16550.h
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/ns16550.h	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/ns16550.h	2005-11-08 06:23:47.000000000 -0800
@@ -98,7 +98,7 @@
 /* modem control register */
 #define MCR_LOOPBACK    0x10	/* loopback */
 #define MCR_IENABLE     0x08	/* output 2 = int enable */
-#define MCR_DRS         0x04	
+#define MCR_DRS         0x04	/* output 1 = xxx */
 #define MCR_RTS         0x02	/* enable RTS */
 #define MCR_DTR         0x01	/* enable DTR */
 
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/osdep.h linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/osdep.h
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/osdep.h	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/osdep.h	2005-11-08 06:23:47.000000000 -0800
@@ -8,7 +8,7 @@
  * your option) any later version.
  */
 
-#if	defined(__linux__) || defined(__FreeBSD__) || defined(__MIPSEB__)
+#if	defined(__linux__) || defined(__FreeBSD__) || defined (__MIPSEB__)
 #define	ETHERBOOT32
 #define ntohl(x) (x)
 #define htonl(x) (x)
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/sbd.h linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/sbd.h
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/sbd.h	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/sbd.h	2005-11-08 06:23:47.000000000 -0800
@@ -8,6 +8,7 @@
 #define MHZ		150
 #endif
 
+/* FIXME These timings are completely fictional */
 #define RAMCYCLE	60	/* 60ns dram cycle */
 #define ROMCYCLE	750	/* ~750ns rom cycle */
 #define CACHECYCLE	(1000/MHZ)	/* internal clock */
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/sbdreset_evb64120A.S linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/sbdreset_evb64120A.S
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/compressed/sbdreset_evb64120A.S	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/compressed/sbdreset_evb64120A.S	2005-11-08 06:24:35.000000000 -0800
@@ -24,7 +24,7 @@
 #include "gt64011.h"
 #include "ns16550.h"
 
-#ifdef GALILEO_PORT     // miniBios crack
+#ifdef GALILEO_PORT // miniBios crack
 #define C0_CONFIG CP0_CONFIG
 #define C0_STATUS CP0_STATUS
 #define C0_TLBLO0 CP0_ENTRYLO0
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/int-handler.S linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/int-handler.S
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/int-handler.S	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/int-handler.S	2005-11-08 06:24:35.000000000 -0800
@@ -73,6 +73,25 @@
 		j	ret_from_irq
 		nop
 
+#if 0
+		.align	5
+		.set	reorder
+ll_pci_intB:
+		move 	a0,sp
+		jal	pci_intB
+		nop
+		j	ret_from_irq
+		nop
+
+		.align	5
+		.set	reorder
+ll_pci_intC:
+		move 	a0,sp
+		jal	pci_intC
+		nop
+		j	ret_from_irq
+		nop
+#endif
 
 		.align	5
 		.set	reorder
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/irq.c linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/irq.c
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/irq.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -158,6 +158,12 @@
 	return 0;
 }
 
+#if 0
+static void no_irq_ack(unsigned int irq)
+{
+	printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq);
+}
+#endif
 
 struct hw_interrupt_type no_irq_type = {
 	.typename= "none",
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/serialGT.c linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/serialGT.c
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev64120/serialGT.c	2003-07-04 01:11:12.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev64120/serialGT.c	2005-11-08 06:24:35.000000000 -0800
@@ -137,6 +137,16 @@
 	 */
 	sav_lcr = inreg(channel, LCR);
 
+#if 0
+	/*
+	 * Set baud rate
+	 */
+	outreg(channel, LCR, LCR_DLAB | sav_lcr);
+	//  outreg(DLL,(XTAL/(16*2*(baud))-2));
+	outreg(channel, DLL, XTAL / (16 * baud));
+	//  outreg(DLM,(XTAL/(16*2*(baud))-2)>>8);
+	outreg(channel, DLM, (XTAL / (16 * baud)) >> 8);
+#else
 	/*
 	 * Note: Set baud rate, hardcoded here for rate of 115200
 	 * since became unsure of above "buad rate" algorithm (??).
@@ -145,6 +155,7 @@
 	outreg(channel, DLM, 0x00);	// See note above
 	outreg(channel, DLL, 0x02);	// See note above.
 	outreg(channel, LCR, 0x03);
+#endif
 
 	/*
 	 * Restore line control register
diff -ruN linux-2.4.20-WRT/arch/mips/galileo-boards/ev96100/time.c linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev96100/time.c
--- linux-2.4.20-WRT/arch/mips/galileo-boards/ev96100/time.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/galileo-boards/ev96100/time.c	2006-06-12 17:49:48.000000000 -0700
@@ -123,6 +123,9 @@
 
 static unsigned int timerhi = 0, timerlo = 0;
 
+/*
+ * FIXME: Does playing with the RP bit in c0_status interfere with this code?
+ */
 static unsigned long do_fast_gettimeoffset(void)
 {
 	u32 count;
diff -ruN linux-2.4.20-WRT/arch/mips/hp-lj/int-handler.S linux-2.4.20-WRTstp/arch/mips/hp-lj/int-handler.S
--- linux-2.4.20-WRT/arch/mips/hp-lj/int-handler.S	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/hp-lj/int-handler.S	2006-06-12 17:49:48.000000000 -0700
@@ -36,6 +36,10 @@
 	beqz	t0,3f			# no pending intrs, then spurious
 	nop				# delay slot
 
+	/*
+	 * Find irq with highest priority
+	 * FIXME: This is slow - use binary search
+	 */
 
 	la	a0,7
 1:	bltz	t0,2f			# found pending irq
diff -ruN linux-2.4.20-WRT/arch/mips/ite-boards/generic/irq.c linux-2.4.20-WRTstp/arch/mips/ite-boards/generic/irq.c
--- linux-2.4.20-WRT/arch/mips/ite-boards/generic/irq.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/ite-boards/generic/irq.c	2006-06-12 18:15:49.000000000 -0700
@@ -286,6 +286,14 @@
 	it8172_hw0_icregs->lpc_trigger |= (0x2 | 0x1000);
 
 
+#if 0
+	// Enable this piece of code to make internal USB interrupt
+	// edge triggered.
+	it8172_hw0_icregs->pci_trigger |=
+		(1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
+	it8172_hw0_icregs->pci_level &=
+		~(1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
+#endif
 
 	for (i = 0; i <= IT8172_LAST_IRQ; i++) {
 		irq_desc[i].handler = &it8172_irq_type;
@@ -303,7 +311,18 @@
 
 void mips_spurious_interrupt(struct pt_regs *regs)
 {
+#if 1
 	return;
+#else
+	unsigned long status, cause;
+
+	printk("got spurious interrupt\n");
+	status = read_32bit_cp0_register(CP0_STATUS);
+	cause = read_32bit_cp0_register(CP0_CAUSE);
+	printk("status %x cause %x\n", status, cause);
+	printk("epc %x badvaddr %x \n", regs->cp0_epc, regs->cp0_badvaddr);
+//	while(1);
+#endif
 }
 
 void it8172_hw0_irqdispatch(struct pt_regs *regs)
diff -ruN linux-2.4.20-WRT/arch/mips/jazz/floppy-jazz.c linux-2.4.20-WRTstp/arch/mips/jazz/floppy-jazz.c
--- linux-2.4.20-WRT/arch/mips/jazz/floppy-jazz.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jazz/floppy-jazz.c	2006-06-12 17:49:48.000000000 -0700
@@ -100,7 +100,7 @@
 	mem = __get_dma_pages(GFP_KERNEL, get_order(size));
 	if(!mem)
 		return 0;
-	vdma_alloc(PHYSADDR(mem), size);	
+	vdma_alloc(PHYSADDR(mem), size);	/* XXX error checking */
 
 	return mem;
 }
@@ -114,6 +114,9 @@
 
 static unsigned long jazz_fd_drive_type(unsigned long n)
 {
+	/* XXX This is wrong for machines with ED 2.88mb disk drives like the
+	   Olivetti M700.  Anyway, we should suck this from the ARC
+	   firmware.  */
 	if (n == 0)
 		return 4;	/* 3,5", 1.44mb */
 
diff -ruN linux-2.4.20-WRT/arch/mips/jazz/int-handler.S linux-2.4.20-WRTstp/arch/mips/jazz/int-handler.S
--- linux-2.4.20-WRT/arch/mips/jazz/int-handler.S	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jazz/int-handler.S	2006-06-12 17:49:48.000000000 -0700
@@ -39,6 +39,10 @@
 		beqz	t0,3f
 		sll	t0,16			# delay slot
 
+		/*
+		 * Find irq with highest priority
+		 * FIXME: This is slow - use binary search
+		 */
 		la	t1,ll_vectors
 1:		bltz	t0,2f			# found pending irq
 		sll	t0,1
@@ -69,7 +73,7 @@
 		PANIC("Unimplemented local_dma handler")
 
 ll_local_dev:	lbu	t0,JAZZ_IO_IRQ_SOURCE
-#if PTRSIZE == 8	    /* True 64 bit kernel */
+#if PTRSIZE == 8	/* True 64 bit kernel */
 		dsll	t0,1
 #endif
 		.set	reorder
@@ -132,6 +136,28 @@
 ll_count:	j	return
 		 mtc0	zero,CP0_COMPARE
 
+#if 0
+/*
+ * Call the handler for the interrupt
+ * (Currently unused)
+ */
+call_real:	/*
+		 * temporarily disable interrupt
+		 */
+		mfc0	t2,CP0_STATUS
+		and	t2,s1
+		mtc0	t2,CP0_STATUS
+		nor	s1,zero,s1
+		jal	do_IRQ
+
+		/*
+		 * reenable interrupt
+		 */
+		mfc0	t2,CP0_STATUS
+		or	t2,s1
+		mtc0	t2,CP0_STATUS
+		j	ret_from_irq
+#endif
 
 		.data
 		PTR	ll_sw0			# SW0
diff -ruN linux-2.4.20-WRT/arch/mips/jazz/io.c linux-2.4.20-WRTstp/arch/mips/jazz/io.c
--- linux-2.4.20-WRT/arch/mips/jazz/io.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jazz/io.c	2000-02-24 22:52:30.000000000 -0800
@@ -18,6 +18,7 @@
  */
 static inline void map_eisa_address(unsigned long address)
 {
+  /* XXX */
   /* We've got an wired entry in the TLB.  We just need to modify it.
      fast and clean.  But since we want to get rid of wired entries
      things are a little bit more complicated ... */
diff -ruN linux-2.4.20-WRT/arch/mips/jazz/irq.c linux-2.4.20-WRTstp/arch/mips/jazz/irq.c
--- linux-2.4.20-WRT/arch/mips/jazz/irq.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jazz/irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -30,4 +30,15 @@
 
 	init_generic_irq();
 	init_i8259_irqs();			/* Integrated i8259  */
+#if 0
+	init_jazz_irq();
+
+	/* Actually we've got more interrupts to handle ...  */
+	for (i = PCIMT_IRQ_INT2; i <= PCIMT_IRQ_ETHERNET; i++) {
+		irq_desc[i].status     = IRQ_DISABLED;
+		irq_desc[i].action     = 0;
+		irq_desc[i].depth      = 1;
+		irq_desc[i].handler    = &pciasic_irq_type;
+	}
+#endif
 }
diff -ruN linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/irq.c linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/irq.c
--- linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/irq.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -296,6 +296,9 @@
 	tx_branch_likely_bug_fixup(regs);
 #endif
 	if ((regs->cp0_cause & CAUSEF_IP7) == 0) {
+#if 0
+		jmr3927_spurious(regs);
+#endif
 		return;
 	}
 	irq = (regs->cp0_cause >> CAUSEB_IP2) & 0x0f;
@@ -376,6 +379,10 @@
 		/* ETHER1 Int. Is High-Active. */
 		if (tx3927_ircptr->ssr & (1 << 0))
 			jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT0;
+#if 0	/* INT3 may be asserted by ether0 (even after reboot...) */
+		else if (tx3927_ircptr->ssr & (1 << 3))
+			jmr3927_ether1_irq = JMR3927_IRQ_IRC_INT3;
+#endif
 		/* disable interrupt control */
 		tx3927_ircptr->cer = 0;
 
diff -ruN linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/kgdb_io.c linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/kgdb_io.c
--- linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/kgdb_io.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/kgdb_io.c	2006-06-12 17:49:48.000000000 -0700
@@ -125,4 +125,31 @@
 	tx3927_sioptr(0)->flcr = 0x02;
 	tx3927_sioptr(0)->bgr = ((JMR3927_BASE_BAUD + baud / 2) / baud) |
 		TXx927_SIBGR_BCLK_T0;
+#if 0
+	/*
+	 * Reset the UART.
+	 */
+	tx3927_sioptr(0)->fcr = TXx927_SIFCR_SWRST;
+	while (tx3927_sioptr(0)->fcr & TXx927_SIFCR_SWRST)
+		;
+
+	/*
+	 * and set the speed of the serial port
+	 * (currently hardwired to 9600 8N1
+	 */
+
+	tx3927_sioptr(0)->lcr = TXx927_SILCR_UMODE_8BIT |
+		TXx927_SILCR_USBL_1BIT |
+		TXx927_SILCR_SCS_IMCLK_BG;
+	tx3927_sioptr(0)->bgr =
+		((JMR3927_BASE_BAUD + baud / 2) / baud) |
+		TXx927_SIBGR_BCLK_T0;
+
+	/* HW RTS/CTS control */
+	if (ser->flags & ASYNC_HAVE_CTS_LINE)
+		tx3927_sioptr(0)->flcr = TXx927_SIFLCR_RCS | TXx927_SIFLCR_TES |
+			TXx927_SIFLCR_RTSTL_MAX /* 15 */;
+	/* Enable RX/TX */
+	tx3927_sioptr(0)->flcr &= ~(TXx927_SIFLCR_RSDE | TXx927_SIFLCR_TSDE);
+#endif
 }
diff -ruN linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/pci_fixup.c linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/pci_fixup.c
--- linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/pci_fixup.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/pci_fixup.c	2006-06-12 17:49:48.000000000 -0700
@@ -76,6 +76,11 @@
 	} else {
 		/* PCI Backplane */
 		irq = (irq + 3 + PCI_SLOT(dev->devfn)) % 4;
+#if 0	/* ??? */
+		for (bus = dev->bus; bus->parent != NULL; bus = bus->parent) {
+			irq = (irq + 3 + PCI_SLOT(bus->self->devfn)) % 4;
+		}
+#endif
 	}
 	irq++;	/* 1-4 */
 
diff -ruN linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/setup.c linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/setup.c
--- linux-2.4.20-WRT/arch/mips/jmr3927/rbhma3100/setup.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/jmr3927/rbhma3100/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -98,11 +98,13 @@
 	extern void tc35815_killall(void);
 	tc35815_killall();
 #endif
+#if 1	/* Resetting PCI bus */
 	jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
 	jmr3927_ioc_reg_out(JMR3927_IOC_RESET_PCI, JMR3927_IOC_RESET_ADDR);
 	(void)jmr3927_ioc_reg_in(JMR3927_IOC_RESET_ADDR);	/* flush WB */
 	mdelay(1);
 	jmr3927_ioc_reg_out(0, JMR3927_IOC_RESET_ADDR);
+#endif
 	jmr3927_ioc_reg_out(JMR3927_IOC_RESET_CPU, JMR3927_IOC_RESET_ADDR);
 }
 
@@ -229,6 +231,7 @@
 		conf = read_c0_conf();
 	}
 
+#if 1
 	/* cache setup */
 	{
 		unsigned int conf;
@@ -255,6 +258,7 @@
 		write_c0_conf(conf);
 		write_c0_cache(0);
 	}
+#endif
 
 	/* initialize board */
 	jmr3927_board_init();
@@ -433,6 +437,7 @@
 	       tx3927_pcicptr->rid);
 	if (!(tx3927_ccfgptr->ccfg & TX3927_CCFG_PCIXARB)) {
 		printk("External\n");
+		/* XXX */
 	} else {
 		printk("Internal\n");
 
@@ -482,15 +487,22 @@
 
 		/* PCIC Int => IRC IRQ10 */
 		tx3927_pcicptr->il = TX3927_IR_PCI;
+#if 1
 		/* Target Control (per errata) */
 		tx3927_pcicptr->tc = TX3927_PCIC_TC_OF8E | TX3927_PCIC_TC_IF8E;
+#endif
 
 		/* Enable Bus Arbiter */
+#if 0
+		tx3927_pcicptr->req_trace = 0x73737373;
+#endif
 		tx3927_pcicptr->pbapmc = TX3927_PCIC_PBAPMC_PBAEN;
 
 		tx3927_pcicptr->pcicmd = PCI_COMMAND_MASTER |
 			PCI_COMMAND_MEMORY |
+#if 1
 			PCI_COMMAND_IO |
+#endif
 			PCI_COMMAND_PARITY | PCI_COMMAND_SERR;
 	}
 #endif /* CONFIG_PCI */
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/gdb-stub.c linux-2.4.20-WRTstp/arch/mips/kernel/gdb-stub.c
--- linux-2.4.20-WRT/arch/mips/kernel/gdb-stub.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/gdb-stub.c	2006-06-12 18:15:49.000000000 -0700
@@ -434,6 +434,36 @@
 }
 
 
+#if 0
+/*
+ * Print registers (on target console)
+ * Used only to debug the stub...
+ */
+void show_gdbregs(struct gdb_regs * regs)
+{
+	/*
+	 * Saved main processor registers
+	 */
+	printk("$0 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+	       regs->reg0, regs->reg1, regs->reg2, regs->reg3,
+               regs->reg4, regs->reg5, regs->reg6, regs->reg7);
+	printk("$8 : %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+	       regs->reg8, regs->reg9, regs->reg10, regs->reg11,
+               regs->reg12, regs->reg13, regs->reg14, regs->reg15);
+	printk("$16: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+	       regs->reg16, regs->reg17, regs->reg18, regs->reg19,
+               regs->reg20, regs->reg21, regs->reg22, regs->reg23);
+	printk("$24: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
+	       regs->reg24, regs->reg25, regs->reg26, regs->reg27,
+	       regs->reg28, regs->reg29, regs->reg30, regs->reg31);
+
+	/*
+	 * Saved cp0 registers
+	 */
+	printk("epc  : %08lx\nStatus: %08lx\nCause : %08lx\n",
+	       regs->cp0_epc, regs->cp0_status, regs->cp0_cause);
+}
+#endif /* dead code */
 
 /*
  * We single-step by setting breakpoints. When an exception
@@ -565,7 +595,18 @@
 	char *ptr;
 	unsigned long *stack;
 
+#if 0
+	printk("in handle_exception()\n");
+	show_gdbregs(regs);
+#endif
 
+	/*
+	 * First check trap type. If this is CPU_UNUSABLE and CPU_ID is 1,
+	 * the simply switch the FPU on and return since this is no error
+	 * condition. kernel/traps.c does the same.
+	 * FIXME: This doesn't work yet, so we don't catch CPU_UNUSABLE
+	 * traps for now.
+	 */
 	trap = (regs->cp0_cause & 0x7c) >> 2;
 /*	printk("trap=%d\n",trap); */
 	if (trap == 11) {
@@ -683,8 +724,28 @@
 			ptr = mem2hex((char *)&regs->cp0_index, ptr, 16*4, 0); /* cp0 */
 			break;
 
+		/*
+		 * set the value of the CPU registers - return OK
+		 * FIXME: Needs to be written
+		 */
 		case 'G':
 		{
+#if 0
+			unsigned long *newsp, psr;
+
+			ptr = &input_buffer[1];
+			hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */
+
+			/*
+			 * See if the stack pointer has moved. If so, then copy the
+			 * saved locals and ins to the new location.
+			 */
+
+			newsp = (unsigned long *)registers[SP];
+			if (sp != newsp)
+				sp = memcpy(newsp, sp, 16 * 4);
+
+#endif
 			strcpy(output_buffer,"OK");
 		 }
 		break;
@@ -756,6 +817,9 @@
 			break;		/* do nothing */
 
 
+		/*
+		 * Reset the whole machine (FIXME: system dependent)
+		 */
 		case 'r':
 			break;
 
@@ -773,8 +837,47 @@
 			return;
 			/* NOTREACHED */
 
+		/*
+		 * Set baud rate (bBB)
+		 * FIXME: Needs to be written
+		 */
 		case 'b':
 		{
+#if 0
+			int baudrate;
+			extern void set_timer_3();
+
+			ptr = &input_buffer[1];
+			if (!hexToInt(&ptr, &baudrate))
+			{
+				strcpy(output_buffer,"B01");
+				break;
+			}
+
+			/* Convert baud rate to uart clock divider */
+
+			switch (baudrate)
+			{
+				case 38400:
+					baudrate = 16;
+					break;
+				case 19200:
+					baudrate = 33;
+					break;
+				case 9600:
+					baudrate = 65;
+					break;
+				default:
+					baudrate = 0;
+					strcpy(output_buffer,"B02");
+					goto x1;
+			}
+
+			if (baudrate) {
+				putpacket("OK");	/* Ack before changing speed */
+				set_timer_3(baudrate); /* Set it */
+			}
+#endif
 		}
 		break;
 
@@ -848,11 +951,11 @@
 }
 
 static struct console gdb_console = {
-	.name	= "gdb",
-	.write	= gdb_console_write,
-	.device	= gdb_console_dev,
-	.flags	= CON_PRINTBUFFER,
-	.index	= -1
+	name:	"gdb",
+	write:	gdb_console_write,
+	device:	gdb_console_dev,
+	flags:	CON_PRINTBUFFER,
+	index:	-1
 };
 
 __init void register_gdb_console(void)
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/head.S linux-2.4.20-WRTstp/arch/mips/kernel/head.S
--- linux-2.4.20-WRT/arch/mips/kernel/head.S	2003-10-14 01:00:37.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/head.S	2006-06-12 18:15:49.000000000 -0700
@@ -53,7 +53,7 @@
 		LEAF(except_vec2_generic)
 		.set	noreorder
 		.set	noat
-		.set	mips0
+		.set    mips0
 		/*
 		 * This is a very bad place to be.  Our cache error
 		 * detection has triggered.  If we have write-back data
@@ -140,23 +140,23 @@
 		* unconditional jump to this vector.
 		*/
 		NESTED(except_vec_nmi, 0, sp)
-		j	nmi_handler
+		j       nmi_handler
 		 nop
 		END(except_vec_nmi)
 
 		__FINIT
 
 		NESTED(nmi_handler, PT_SIZE, sp)
-		.set	noat
-		.set	noreorder
-		.set	mips3
+		.set    noat
+		.set    noreorder
+		.set    mips3
 		SAVE_ALL
-		jal	nmi_exception_handler
-		 move	a0, sp
+		jal     nmi_exception_handler
+		 move   a0, sp
 		RESTORE_ALL
 		eret
-		.set	at
-		.set	mips0
+		.set    at
+		.set    mips0
 		END(nmi_handler)
 
 		__INIT
@@ -203,8 +203,8 @@
  * function after setting up the stack and gp registers.
  */
 		LEAF(smp_bootstrap)
-		.set	push
-		.set	noreorder
+		.set push
+		.set noreorder
 		mtc0	zero, CP0_WIRED
 		CLI
 		mfc0	t0, CP0_STATUS
@@ -213,7 +213,7 @@
 		or	t0, (ST0_CU0);
 		jal	start_secondary
 		mtc0	t0, CP0_STATUS
-		.set	pop
+		.set pop
 		END(smp_bootstrap)
 #endif
 
@@ -227,7 +227,7 @@
 		EXPORT(ejtag_debug_buffer)
 		.fill	4
 
-		.comm	kernelsp, NR_CPUS * 8, 8
+		.comm	kernelsp,    NR_CPUS * 8, 8
 		.comm	pgd_current, NR_CPUS * 8, 8
 
 	.macro	page name, order=0
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/irix5sys.h linux-2.4.20-WRTstp/arch/mips/kernel/irix5sys.h
--- linux-2.4.20-WRT/arch/mips/kernel/irix5sys.h	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/irix5sys.h	2005-11-08 06:23:47.000000000 -0800
@@ -25,18 +25,18 @@
 SYS(sys_write, 3)			/* 1004  write()	       V*/
 SYS(sys_open, 3)			/* 1005  open()		       V*/
 SYS(sys_close, 1)			/* 1006  close()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1007  (XXX IRIX 4 wait)     V*/
 SYS(sys_creat, 2)			/* 1008  creat()	       V*/
 SYS(sys_link, 2)			/* 1009  link()		       V*/
 SYS(sys_unlink, 1)			/* 1010  unlink()	       V*/
 SYS(irix_exec, 0)			/* 1011  exec()		       V*/
 SYS(sys_chdir, 1)			/* 1012  chdir()	       V*/
 SYS(irix_gtime, 0)			/* 1013  time()		       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1014  (XXX IRIX 4 mknod)    V*/
 SYS(sys_chmod, 2)			/* 1015  chmod()	       V*/
 SYS(sys_chown, 3)			/* 1016  chown()	       V*/
 SYS(irix_brk, 1)			/* 1017  break()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1018  (XXX IRIX 4 stat)     V*/
 SYS(sys_lseek, 3)			/* 1019  lseek()     XXX64bit HV*/
 SYS(irix_getpid, 0)			/* 1020  getpid()	       V*/
 SYS(irix_mount, 6)			/* 1021  mount()	      IV*/
@@ -44,9 +44,9 @@
 SYS(sys_setuid, 1)			/* 1023  setuid()	       V*/
 SYS(irix_getuid, 0)			/* 1024  getuid()	       V*/
 SYS(irix_stime, 1)			/* 1025  stime()	       V*/
-SYS(irix_unimp, 4)			
+SYS(irix_unimp, 4)			/* 1026  XXX ptrace()	      IV*/
 SYS(irix_alarm, 1)			/* 1027  alarm()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1028  (XXX IRIX 4 fstat)    V*/
 SYS(irix_pause, 0)			/* 1029  pause()	       V*/
 SYS(sys_utime, 2)			/* 1030  utime()	       V*/
 SYS(irix_unimp, 0)			/* 1031  nuthin'	       V*/
@@ -62,18 +62,18 @@
 SYS(sys_dup, 1)				/* 1041  dup()		       V*/
 SYS(sys_pipe, 0)			/* 1042  pipe()		       V*/
 SYS(irix_times, 1)			/* 1043  times()	       V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1044  XXX profil()	      IV*/
+SYS(irix_unimp, 0)			/* 1045  XXX lock()	      IV*/
 SYS(sys_setgid, 1)			/* 1046  setgid()	       V*/
 SYS(irix_getgid, 0)			/* 1047  getgid()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1048  (XXX IRIX 4 ssig)     V*/
 SYS(irix_msgsys, 6)			/* 1049  sys_msgsys	       V*/
 SYS(sys_sysmips, 4)			/* 1050  sysmips()	      HV*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1051	 XXX sysacct()	      IV*/
 SYS(irix_shmsys, 5)			/* 1052  sys_shmsys	       V*/
 SYS(irix_semsys, 0)			/* 1053  sys_semsys	       V*/
 SYS(irix_ioctl, 3)			/* 1054  ioctl()	      HV*/
-SYS(irix_uadmin, 0)			
+SYS(irix_uadmin, 0)			/* 1055  XXX sys_uadmin()     HC*/
 SYS(irix_sysmp, 0)			/* 1056  sysmp()	      HV*/
 SYS(irix_utssys, 4)			/* 1057  sys_utssys()	      HV*/
 SYS(irix_unimp, 0)			/* 1058  nada enchilada	       V*/
@@ -82,19 +82,19 @@
 SYS(sys_chroot, 1)			/* 1061  chroot()	       V*/
 SYS(irix_fcntl, 3)			/* 1062  fcntl()	      ?V*/
 SYS(irix_ulimit, 2)			/* 1063  ulimit()	      HV*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1064  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1065  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1066  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1067  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1068  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1069  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1070  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1071  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1072  XXX AFS shit	      DC*/
+SYS(irix_unimp, 0)			/* 1073  XXX AFS shit	      DC*/
 SYS(irix_unimp, 0)			/* 1074  nuttin'	       V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1075  XXX sys_getrlimit64()IV*/
+SYS(irix_unimp, 0)			/* 1076  XXX sys_setrlimit64()IV*/
 SYS(sys_nanosleep, 2)			/* 1077  nanosleep()	       V*/
 SYS(irix_lseek64, 5)			/* 1078  lseek64()	      ?V*/
 SYS(sys_rmdir, 1)			/* 1079  rmdir()	       V*/
@@ -103,8 +103,8 @@
 SYS(irix_sginap, 1)			/* 1082  sys_sginap()	       V*/
 SYS(irix_sgikopt, 3)			/* 1083  sys_sgikopt()	      DC*/
 SYS(sys_sysfs, 3)			/* 1084  sysfs()	      ?V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1085  XXX sys_getmsg()     DC*/
+SYS(irix_unimp, 0)			/* 1086  XXX sys_putmsg()     DC*/
 SYS(sys_poll, 3)			/* 1087  poll()	               V*/
 SYS(irix_sigreturn, 0)			/* 1088  sigreturn()	      ?V*/
 SYS(sys_accept, 3)			/* 1089  accept()	       V*/
@@ -135,23 +135,23 @@
 SYS(sys_rename, 2)			/* 1114  rename()	       V*/
 SYS(sys_symlink, 2)			/* 1115  symlink()	       V*/
 SYS(sys_readlink, 3)			/* 1116  readlink()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1117  XXX IRIX 4 lstat()   DC*/
 SYS(irix_unimp, 0)			/* 1118  nothin'	       V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1119  XXX nfs_svc()	      DC*/
+SYS(irix_unimp, 0)			/* 1120  XXX nfs_getfh()      DC*/
+SYS(irix_unimp, 0)			/* 1121  XXX async_daemon()   DC*/
+SYS(irix_unimp, 0)			/* 1122  XXX exportfs()	      DC*/
 SYS(sys_setregid, 2)			/* 1123  setregid()	       V*/
 SYS(sys_setreuid, 2)			/* 1124  setreuid()	       V*/
 SYS(sys_getitimer, 2)			/* 1125  getitimer()	       V*/
 SYS(sys_setitimer, 3)			/* 1126  setitimer()	       V*/
-SYS(irix_unimp, 1)			
+SYS(irix_unimp, 1)			/* 1127  XXX adjtime() 	      IV*/
 SYS(irix_gettimeofday, 1)		/* 1128  gettimeofday()	       V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1129  XXX sproc()	      IV*/
 SYS(irix_prctl, 0)			/* 1130  prctl()	      HV*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1131  XXX procblk()	      IV*/
+SYS(irix_unimp, 0)			/* 1132  XXX sprocsp()	      IV*/
+SYS(irix_unimp, 0)			/* 1133  XXX sgigsc()	      IV*/
 SYS(irix_mmap32, 6)			/* 1134  mmap()	   XXXflags?  ?V*/
 SYS(sys_munmap, 2)			/* 1135  munmap()	       V*/
 SYS(sys_mprotect, 3)			/* 1136  mprotect()	       V*/
@@ -172,7 +172,7 @@
 SYS(sys_cachectl, 3)			/* 1151  cachectl()	      HV*/
 SYS(sys_fchown, 3)			/* 1152  fchown()	      ?V*/
 SYS(sys_fchmod, 2)			/* 1153  fchmod()	      ?V*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1154  XXX IRIX 4 wait3()    V*/
 SYS(sys_socketpair, 4)			/* 1155  socketpair()	       V*/
 SYS(irix_systeminfo, 3)			/* 1156  systeminfo()	      IV*/
 SYS(irix_uname, 1)			/* 1157  uname()	      IV*/
@@ -194,8 +194,8 @@
 SYS(irix_sigsendset, 2)			/* 1173  sigsendset()	      IV*/
 SYS(irix_statvfs, 2)			/* 1174  statvfs()	       V*/
 SYS(irix_fstatvfs, 2)			/* 1175  fstatvfs()	       V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1176  XXX getpmsg()	      DC*/
+SYS(irix_unimp, 0)			/* 1177  XXX putpmsg()	      DC*/
 SYS(sys_lchown, 3)			/* 1178  lchown()	       V*/
 SYS(irix_priocntl, 0)			/* 1179  priocntl()	      DC*/
 SYS(irix_sigqueue, 4)			/* 1180  sigqueue()	      IV*/
@@ -209,41 +209,41 @@
 SYS(irix_pwrite, 6)			/* 1188  pwrite()	      IV*/
 SYS(sys_fsync, 1)			/* 1189  fdatasync()  XXPOSIX HV*/
 SYS(irix_sgifastpath, 7)		/* 1190  sgifastpath() WHEEE  IV*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1191  XXX attr_get()	      DC*/
+SYS(irix_unimp, 0)			/* 1192  XXX attr_getf()      DC*/
+SYS(irix_unimp, 0)			/* 1193  XXX attr_set()	      DC*/
+SYS(irix_unimp, 0)			/* 1194  XXX attr_setf()      DC*/
+SYS(irix_unimp, 0)			/* 1195  XXX attr_remove()    DC*/
+SYS(irix_unimp, 0)			/* 1196  XXX attr_removef()   DC*/
+SYS(irix_unimp, 0)			/* 1197  XXX attr_list()      DC*/
+SYS(irix_unimp, 0)			/* 1198  XXX attr_listf()     DC*/
+SYS(irix_unimp, 0)			/* 1199  XXX attr_multi()     DC*/
+SYS(irix_unimp, 0)			/* 1200  XXX attr_multif()    DC*/
 SYS(irix_statvfs64, 2)			/* 1201  statvfs64()	       V*/
 SYS(irix_fstatvfs64, 2)			/* 1202  fstatvfs64()	       V*/
 SYS(irix_getmountid, 2)			/* 1203  getmountid()XXXfsids HV*/
 SYS(irix_nsproc, 5)			/* 1204  nsproc()	      IV*/
 SYS(irix_getdents64, 3)			/* 1205  getdents64()	      HV*/
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1206  XXX DFS garbage      DC*/
 SYS(irix_ngetdents, 4)			/* 1207  ngetdents() XXXeop   HV*/
 SYS(irix_ngetdents64, 4)		/* 1208  ngetdents64() XXXeop HV*/
 SYS(irix_unimp, 0)			/* 1209  nothin'	       V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1210  XXX pidsprocsp()	*/
+SYS(irix_unimp, 0)			/* 1211  XXX rexec()		*/
+SYS(irix_unimp, 0)			/* 1212  XXX timer_create()	*/
+SYS(irix_unimp, 0)			/* 1213  XXX timer_delete()	*/
+SYS(irix_unimp, 0)			/* 1214  XXX timer_settime()	*/
+SYS(irix_unimp, 0)			/* 1215  XXX timer_gettime()	*/
+SYS(irix_unimp, 0)			/* 1216  XXX timer_setoverrun()	*/
 SYS(sys_sched_rr_get_interval, 2)	/* 1217  sched_rr_get_interval()V*/
 SYS(sys_sched_yield, 0)			/* 1218  sched_yield()	       V*/
 SYS(sys_sched_getscheduler, 1)		/* 1219  sched_getscheduler()  V*/
 SYS(sys_sched_setscheduler, 3)		/* 1220  sched_setscheduler()  V*/
 SYS(sys_sched_getparam, 2)		/* 1221  sched_getparam()      V*/
 SYS(sys_sched_setparam, 2)		/* 1222  sched_setparam()      V*/
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
-SYS(irix_unimp, 0)			
+SYS(irix_unimp, 0)			/* 1223  XXX usync_cntl()	*/
+SYS(irix_unimp, 0)			/* 1224  XXX psema_cntl()	*/
+SYS(irix_unimp, 0)			/* 1225  XXX restartreturn()	*/
 
 /* Just to pad things out nicely. */
 SYS(irix_unimp, 0)
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/irixelf.c linux-2.4.20-WRTstp/arch/mips/kernel/irixelf.c
--- linux-2.4.20-WRT/arch/mips/kernel/irixelf.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/irixelf.c	2006-06-12 17:49:48.000000000 -0700
@@ -404,6 +404,12 @@
 		return -ENOEXEC;
 	}
 
+	/* XXX Don't support N32 or 64bit binaries yet because they can
+	 * XXX and do execute 64 bit instructions and expect all registers
+	 * XXX to be 64 bit as well.  We need to make the kernel save
+	 * XXX all registers as 64bits on cpu's capable of this at
+	 * XXX exception time plus frob the XTLB exception vector.
+	 */
 	if((ehp->e_flags & 0x20)) {
 		return -ENOEXEC;
 	}
@@ -750,6 +756,17 @@
 	printk("(brk) %lx\n" , (long) current->mm->brk);
 #endif
 
+#if 0 /* XXX No fucking way dude... */
+	/* Why this, you ask???  Well SVr4 maps page 0 as read-only,
+	 * and some applications "depend" upon this behavior.
+	 * Since we do not have the power to recompile these, we
+	 * emulate the SVr4 behavior.  Sigh.
+	 */
+	down_write(&current->mm->mmap_sem);
+	(void) do_mmap(NULL, 0, 4096, PROT_READ | PROT_EXEC,
+		       MAP_FIXED | MAP_PRIVATE, 0);
+	up_write(&current->mm->mmap_sem);
+#endif
 
 	start_thread(regs, elf_entry, bprm->p);
 	if (current->ptrace & PT_PTRACED)
@@ -955,10 +972,12 @@
 {
 	if (!(vma->vm_flags & (VM_READ|VM_WRITE|VM_EXEC)))
 		return 0;
+#if 1
 	if (vma->vm_flags & (VM_WRITE|VM_GROWSUP|VM_GROWSDOWN))
 		return 1;
 	if (vma->vm_flags & (VM_READ|VM_EXEC|VM_EXECUTABLE|VM_SHARED))
 		return 0;
+#endif
 	return 1;
 }
 
@@ -1003,9 +1022,10 @@
 
 	DUMP_WRITE(&en, sizeof(en));
 	DUMP_WRITE(men->name, en.n_namesz);
-	DUMP_SEEK(roundup((unsigned long)file->f_pos, 4));	
+	/* XXX - cast from long long to long to avoid need for libgcc.a */
+	DUMP_SEEK(roundup((unsigned long)file->f_pos, 4));	/* XXX */
 	DUMP_WRITE(men->data, men->datasz);
-	DUMP_SEEK(roundup((unsigned long)file->f_pos, 4));	
+	DUMP_SEEK(roundup((unsigned long)file->f_pos, 4));	/* XXX */
 
 	return 1;
 
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/irixsig.c linux-2.4.20-WRTstp/arch/mips/kernel/irixsig.c
--- linux-2.4.20-WRT/arch/mips/kernel/irixsig.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/irixsig.c	2005-11-08 06:24:35.000000000 -0800
@@ -104,7 +104,7 @@
 	__put_user((u64) regs->cp0_cause, &ctx->cp0_cause);
 	__put_user((u64) regs->cp0_badvaddr, &ctx->cp0_badvaddr);
 
-	__put_user(0, &ctx->sstk_flags); 
+	__put_user(0, &ctx->sstk_flags); /* XXX sigstack unimp... todo... */
 
 	__copy_to_user(&ctx->sigset, oldmask, sizeof(irix_sigset_t));
 
@@ -113,7 +113,7 @@
 #endif
 
 	regs->regs[4] = (unsigned long) signr;
-	regs->regs[5] = 0; 
+	regs->regs[5] = 0; /* XXX sigcode XXX */
 	regs->regs[6] = regs->regs[29] = sp;
 	regs->regs[7] = (unsigned long) ka->sa.sa_handler;
 	regs->regs[25] = regs->cp0_epc = (unsigned long) ka->sa.sa_restorer;
@@ -336,6 +336,7 @@
 		__get_user(current->thread.fpu.hard.control, &context->fpcsr);
 	}
 
+	/* XXX do sigstack crapola here... XXX */
 
 	if (__copy_from_user(&blocked, &context->sigset, sizeof(blocked)))
 		goto badframe;
@@ -409,6 +410,7 @@
 		new_ka.sa.sa_restorer = trampoline;
 	}
 
+/* XXX Implement SIG_SETMASK32 for IRIX compatibility */
 	ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
 
 	if (!ret && oact) {
@@ -602,6 +604,7 @@
 		if (sigismember (&kset, sig))
 			continue;
 		if (sigismember (&current->pending.signal, sig)) {
+			/* XXX need more than this... */
 			if (info)
 				info->sig = sig;
 			error = 0;
@@ -773,6 +776,7 @@
 
 	__copy_to_user(&ctx->sigmask, &current->blocked, sizeof(irix_sigset_t));
 
+	/* XXX Do sigstack stuff someday... */
 	__put_user(0, &ctx->stack.sp);
 	__put_user(0, &ctx->stack.size);
 	__put_user(0, &ctx->stack.flags);
@@ -790,6 +794,7 @@
 	if(!current->used_math) {
 		flags &= ~(0x08);
 	} else {
+		/* XXX wheee... */
 		printk("Wheee, no code for saving IRIX FPU context yet.\n");
 	}
 	__put_user(flags, &ctx->flags);
@@ -818,12 +823,14 @@
 		goto out;
 
 	if (ctx->flags & 0x02) {
+		/* XXX sigstack garbage, todo... */
 		printk("Wheee, cannot do sigstack stuff in setcontext\n");
 	}
 
 	if (ctx->flags & 0x04) {
 		int i;
 
+		/* XXX extra control block stuff... todo... */
 		for(i = 1; i < 32; i++)
 			regs->regs[i] = ctx->regs[i];
 		regs->lo = ctx->regs[32];
@@ -832,6 +839,7 @@
 	}
 
 	if (ctx->flags & 0x08) {
+		/* XXX fpu context, blah... */
 		printk("Wheee, cannot restore FPU context yet...\n");
 	}
 	current->thread.irix_oldctx = ctx->link;
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/irq.c linux-2.4.20-WRTstp/arch/mips/kernel/irq.c
--- linux-2.4.20-WRT/arch/mips/kernel/irq.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/irq.c	2005-11-08 06:24:35.000000000 -0800
@@ -534,6 +534,7 @@
 	int retval;
 	struct irqaction * action;
 
+#if 1
 	/*
 	 * Sanity-check: shared interrupts should REALLY pass in
 	 * a real dev-ID, otherwise we'll have trouble later trying
@@ -544,6 +545,7 @@
 		if (!dev_id)
 			printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
 	}
+#endif
 
 	if (irq >= NR_IRQS)
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/irq_cpu.c linux-2.4.20-WRTstp/arch/mips/kernel/irq_cpu.c
--- linux-2.4.20-WRT/arch/mips/kernel/irq_cpu.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/irq_cpu.c	2006-06-12 17:49:48.000000000 -0700
@@ -51,7 +51,7 @@
 
 static void mips_cpu_irq_ack(unsigned int irq)
 {
-	/* although we attemp to clear the IP bit in cause reigster, I think
+	/* although we attempt to clear the IP bit in cause register, I think
 	 * usually it is cleared by device (irq source)
 	 */
 	clear_c0_cause(1 << (irq - mips_cpu_irq_base + 8));
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/old-time.c linux-2.4.20-WRTstp/arch/mips/kernel/old-time.c
--- linux-2.4.20-WRT/arch/mips/kernel/old-time.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/old-time.c	2006-06-12 17:49:48.000000000 -0700
@@ -44,6 +44,11 @@
 
 static unsigned int timerhi, timerlo;
 
+/*
+ * On MIPS only R4000 and better have a cycle counter.
+ *
+ * FIXME: Does playing with the RP bit in c0_status interfere with this code?
+ */
 static unsigned long do_fast_gettimeoffset(void)
 {
 	u32 count;
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/pci_auto.c linux-2.4.20-WRTstp/arch/mips/kernel/pci_auto.c
--- linux-2.4.20-WRT/arch/mips/kernel/pci_auto.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/pci_auto.c	2005-11-08 06:24:35.000000000 -0800
@@ -124,6 +124,11 @@
 		if (!bar_response)
 			continue;
 
+		/*
+		 * Workaround for a BAR that doesn't use its upper word,
+		 * like the ALi 1535D+ PCI DC-97 Controller Modem (M5457).
+		 * bdl <brad@ltc.com>
+		 */
 		if (!(bar_response & 0xffff0000))
 			bar_response |= 0xffff0000;
 
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/ptrace.c linux-2.4.20-WRTstp/arch/mips/kernel/ptrace.c
--- linux-2.4.20-WRT/arch/mips/kernel/ptrace.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/ptrace.c	2006-06-12 17:49:48.000000000 -0700
@@ -45,6 +45,11 @@
 	int ret;
 
 	lock_kernel();
+#if 0
+	printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
+	       (int) request, (int) pid, (unsigned long) addr,
+	       (unsigned long) data);
+#endif
 	if (request == PTRACE_TRACEME) {
 		/* are we already being traced? */
 		if (current->ptrace & PT_PTRACED) {
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/scall_o32.S linux-2.4.20-WRTstp/arch/mips/kernel/scall_o32.S
--- linux-2.4.20-WRT/arch/mips/kernel/scall_o32.S	2003-10-14 01:00:38.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/scall_o32.S	2006-06-12 18:15:49.000000000 -0700
@@ -34,6 +34,7 @@
 	beqz	t0, illegal_syscall
 	sw	t1, PT_EPC(sp)
 
+	/* XXX Put both in one cacheline, should save a bit. */
 	sll	t0, v0, 2
 	lw	t2, sys_call_table(t0)	# syscall routine
 	lbu	t3, sys_narg_table(v0)	# number of arguments
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/setup.c linux-2.4.20-WRTstp/arch/mips/kernel/setup.c
--- linux-2.4.20-WRT/arch/mips/kernel/setup.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/setup.c	2006-06-12 18:15:49.000000000 -0700
@@ -196,6 +196,12 @@
 	print_memory_map();
 
 	for (;;) {
+		/*
+		 * "mem=XXX[kKmM]" defines a memory region from
+		 * 0 to <XXX>, overriding the determined size.
+		 * "mem=XXX[KkmM]@YYY[KkmM]" defines a memory region from
+		 * <YYY> to <YYY>+<XXX>, overriding the determined size.
+		 */
 		if (c == ' ' && !memcmp(from, "mem=", 4)) {
 			if (to != command_line)
 				to--;
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/signal.c linux-2.4.20-WRTstp/arch/mips/kernel/signal.c
--- linux-2.4.20-WRT/arch/mips/kernel/signal.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/signal.c	2006-06-12 17:49:48.000000000 -0700
@@ -107,6 +107,7 @@
 	sigset_t *unewset, saveset, newset;
         size_t sigsetsize;
 
+	/* XXX Don't preclude handling different sized sigset_t's.  */
 	sigsetsize = regs.regs[5];
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/smp.c linux-2.4.20-WRTstp/arch/mips/kernel/smp.c
--- linux-2.4.20-WRT/arch/mips/kernel/smp.c	2003-10-14 01:00:38.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/smp.c	2006-06-12 18:05:27.000000000 -0700
@@ -84,6 +84,10 @@
 
 void __init smp_callin(void)
 {
+#if 0
+	calibrate_delay();
+	smp_store_cpu_info(cpuid);
+#endif
 }
 
 #ifndef CONFIG_SGI_IP27
@@ -98,6 +102,10 @@
 	prom_init_secondary();
 	per_cpu_trap_init();
 
+	/*
+	 * XXX parity protection should be folded in here when it's converted
+	 * to an option instead of something based on .cputype
+	 */
 	pgd_current[cpu] = init_mm.pgd;
 	cpu_data[cpu].udelay_val = loops_per_jiffy;
 	prom_smp_finish();
@@ -166,6 +174,7 @@
 			core_send_ipi(i, SMP_CALL_FUNCTION);
 
 	/* Wait for response */
+	/* FIXME: lock-up detection, backtrace on lock-up */
 	while (atomic_read(&data.started) != cpus)
 		barrier();
 
@@ -184,7 +193,7 @@
 	int wait = call_data->wait;
 	int cpu = smp_processor_id();
 
-	irq_enter(cpu, 0);	
+	irq_enter(cpu, 0);	/* XXX choose an irq number? */
 	/*
 	 * Notify initiating CPU that I've grabbed the data and am
 	 * about to execute the function.
@@ -200,7 +209,7 @@
 		mb();
 		atomic_inc(&call_data->finished);
 	}
-	irq_exit(cpu, 0);	
+	irq_exit(cpu, 0);	/* XXX choose an irq number? */
 }
 
 static void stop_this_cpu(void *dummy)
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/syscall.c linux-2.4.20-WRTstp/arch/mips/kernel/syscall.c
--- linux-2.4.20-WRT/arch/mips/kernel/syscall.c	2003-10-14 01:00:38.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/syscall.c	2006-06-12 18:15:49.000000000 -0700
@@ -237,6 +237,11 @@
 	return error;
 }
 
+/*
+ * If we ever come here the user sp is bad.  Zap the process right away.
+ * Due to the bad stack signaling wouldn't work.
+ * XXX kernel locking???
+ */
 asmlinkage void bad_stack(void)
 {
 	do_exit(SIGSEGV);
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/sysirix.c linux-2.4.20-WRTstp/arch/mips/kernel/sysirix.c
--- linux-2.4.20-WRT/arch/mips/kernel/sysirix.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/sysirix.c	2006-06-12 17:49:48.000000000 -0700
@@ -273,9 +273,68 @@
 	case SGI_SYSID: {
 		char *buf = (char *) regs->regs[base + 5];
 
+		/* XXX Use ethernet addr.... */
 		retval = clear_user(buf, 64);
 		break;
 	}
+#if 0
+	case SGI_RDNAME: {
+		int pid = (int) regs->regs[base + 5];
+		char *buf = (char *) regs->regs[base + 6];
+		struct task_struct *p;
+		char comm[16];
+
+		retval = verify_area(VERIFY_WRITE, buf, 16);
+		if (retval)
+			break;
+		read_lock(&tasklist_lock);
+		p = find_task_by_pid(pid);
+		if (!p) {
+			read_unlock(&tasklist_lock);
+			retval = -ESRCH;
+			break;
+		}
+		memcpy(comm, p->comm, 16);
+		read_unlock(&tasklist_lock);
+
+		/* XXX Need to check sizes. */
+		copy_to_user(buf, p->comm, 16);
+		retval = 0;
+		break;
+	}
+
+	case SGI_GETNVRAM: {
+		char *name = (char *) regs->regs[base+5];
+		char *buf = (char *) regs->regs[base+6];
+		char *value;
+		return -EINVAL;	/* til I fix it */
+		retval = verify_area(VERIFY_WRITE, buf, 128);
+		if (retval)
+			break;
+		value = prom_getenv(name);	/* PROM lock?  */
+		if (!value) {
+			retval = -EINVAL;
+			break;
+		}
+		/* Do I strlen() for the length? */
+		copy_to_user(buf, value, 128);
+		retval = 0;
+		break;
+	}
+
+	case SGI_SETNVRAM: {
+		char *name = (char *) regs->regs[base+5];
+		char *value = (char *) regs->regs[base+6];
+		return -EINVAL;	/* til I fix it */
+		retval = prom_setenv(name, value);
+		/* XXX make sure retval conforms to syssgi(2) */
+		printk("[%s:%d] setnvram(\"%s\", \"%s\"): retval %d",
+		       current->comm, current->pid, name, value, retval);
+/*		if (retval == PROM_ENOENT)
+		  	retval = -ENOENT; */
+		break;
+	}
+#endif
 
 	case SGI_SETPGID: {
 #ifdef DEBUG_PROCGRPS
@@ -293,7 +352,7 @@
 	case SGI_SYSCONF: {
 		switch(regs->regs[base + 5]) {
 		case 1:
-			retval = (MAX_ARG_PAGES >> 4); 
+			retval = (MAX_ARG_PAGES >> 4); /* XXX estimate... */
 			goto out;
 		case 2:
 			retval = max_threads;
@@ -392,6 +451,7 @@
 		break;
 
 	case SGI_TOSSTSAVE:
+		/* XXX We don't need to do anything? */
 		retval = 0;
 		break;
 
@@ -637,6 +697,7 @@
 extern asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type,
 				unsigned long new_flags, void * data);
 
+/* XXX need more than this... */
 asmlinkage int irix_mount(char *dev_name, char *dir_name, unsigned long flags,
 			  char *type, void *data, int datalen)
 {
@@ -1182,6 +1243,7 @@
 	ks.st_size = (long long) sb->st_size;
 	ks.st_pad3 = 0;
 
+	/* XXX hackety hack... */
 	ks.st_atime.tv_sec = (s32) sb->st_atime; ks.st_atime.tv_nsec = 0;
 	ks.st_mtime.tv_sec = (s32) sb->st_atime; ks.st_mtime.tv_nsec = 0;
 	ks.st_ctime.tv_sec = (s32) sb->st_atime; ks.st_ctime.tv_nsec = 0;
@@ -1403,10 +1465,10 @@
 	__put_user(kbuf.f_frsize, &buf->f_frsize);
 	__put_user(kbuf.f_blocks, &buf->f_blocks);
 	__put_user(kbuf.f_bfree, &buf->f_bfree);
-	__put_user(kbuf.f_bfree, &buf->f_bavail);  
+	__put_user(kbuf.f_bfree, &buf->f_bavail);  /* XXX hackety hack... */
 	__put_user(kbuf.f_files, &buf->f_files);
 	__put_user(kbuf.f_ffree, &buf->f_ffree);
-	__put_user(kbuf.f_ffree, &buf->f_favail);  
+	__put_user(kbuf.f_ffree, &buf->f_favail);  /* XXX hackety hack... */
 #ifdef __MIPSEB__
 	__put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
 #else
@@ -1451,10 +1513,10 @@
 	__put_user(kbuf.f_frsize, &buf->f_frsize);
 	__put_user(kbuf.f_blocks, &buf->f_blocks);
 	__put_user(kbuf.f_bfree, &buf->f_bfree);
-	__put_user(kbuf.f_bfree, &buf->f_bavail); 
+	__put_user(kbuf.f_bfree, &buf->f_bavail); /* XXX hackety hack... */
 	__put_user(kbuf.f_files, &buf->f_files);
 	__put_user(kbuf.f_ffree, &buf->f_ffree);
-	__put_user(kbuf.f_ffree, &buf->f_favail); 
+	__put_user(kbuf.f_ffree, &buf->f_favail); /* XXX hackety hack... */
 #ifdef __MIPSEB__
 	__put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
 #else
@@ -1664,10 +1726,10 @@
 	__put_user(kbuf.f_frsize, &buf->f_frsize);
 	__put_user(kbuf.f_blocks, &buf->f_blocks);
 	__put_user(kbuf.f_bfree, &buf->f_bfree);
-	__put_user(kbuf.f_bfree, &buf->f_bavail);  
+	__put_user(kbuf.f_bfree, &buf->f_bavail);  /* XXX hackety hack... */
 	__put_user(kbuf.f_files, &buf->f_files);
 	__put_user(kbuf.f_ffree, &buf->f_ffree);
-	__put_user(kbuf.f_ffree, &buf->f_favail);  
+	__put_user(kbuf.f_ffree, &buf->f_favail);  /* XXX hackety hack... */
 #ifdef __MIPSEB__
 	__put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
 #else
@@ -1712,10 +1774,10 @@
 	__put_user(kbuf.f_frsize, &buf->f_frsize);
 	__put_user(kbuf.f_blocks, &buf->f_blocks);
 	__put_user(kbuf.f_bfree, &buf->f_bfree);
-	__put_user(kbuf.f_bfree, &buf->f_bavail);  
+	__put_user(kbuf.f_bfree, &buf->f_bavail);  /* XXX hackety hack... */
 	__put_user(kbuf.f_files, &buf->f_files);
 	__put_user(kbuf.f_ffree, &buf->f_ffree);
-	__put_user(kbuf.f_ffree, &buf->f_favail);  
+	__put_user(kbuf.f_ffree, &buf->f_favail);  /* XXX hackety hack... */
 #ifdef __MIPSEB__
 	__put_user(kbuf.f_fsid.val[1], &buf->f_fsid);
 #else
@@ -1743,6 +1805,12 @@
 	if (err)
 		return err;
 
+	/*
+	 * The idea with this system call is that when trying to determine
+	 * 'pwd' and it's a toss-up for some reason, userland can use the
+	 * fsid of the filesystem to try and make the right decision, but
+	 * we don't have this so for now. XXX
+	 */
 	err |= __put_user(0, &midbuf[0]);
 	err |= __put_user(0, &midbuf[1]);
 	err |= __put_user(0, &midbuf[2]);
@@ -2134,6 +2202,12 @@
 		goto out;
 
 	case 4:
+#if 0
+		printk("[%s:%d] irix_ulimit: Wants to get fd limit.\n",
+		       current->comm, current->pid);
+		retval = -EINVAL;
+		goto out;
+#endif
 		retval = current->rlim[RLIMIT_NOFILE].rlim_cur;
 		goto out;
 
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/traps.c linux-2.4.20-WRTstp/arch/mips/kernel/traps.c
--- linux-2.4.20-WRT/arch/mips/kernel/traps.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/traps.c	2006-06-12 18:15:49.000000000 -0700
@@ -504,6 +504,9 @@
 	force_sig_info(SIGFPE, &info, current);
 }
 
+/*
+ * XXX Delayed fp exceptions when doing a lazy ctx switch XXX
+ */
 asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
 {
 	if (fcr31 & FPU_CSR_UNI_X) {
@@ -795,7 +798,7 @@
 	       reg_val & (1<<22) ? "E0 " : "");
 	printk("IDX: 0x%08x\n", reg_val & ((1<<22)-1));
 
-#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
+#if defined(CONFIG_CPU_MIPS32) || defined (CONFIG_CPU_MIPS64)
 	if (reg_val & (1<<22))
 		printk("DErrAddr0: 0x%08x\n", read_c0_derraddr0());
 
@@ -835,6 +838,10 @@
 		depc += 4;
 	write_c0_depc(depc);
 
+#if 0
+	printk("\n\n----- Enable EJTAG single stepping ----\n\n");
+	write_32bit_cp0_register(CP0_DEBUG, debug | 0x100);
+#endif
 }
 
 /*
@@ -1019,9 +1026,10 @@
 
 	flush_icache_range(KSEG0, KSEG0 + 0x400);
 
-	atomic_inc(&init_mm.mm_count);	
+	atomic_inc(&init_mm.mm_count);	/* XXX UP?  */
 	current->active_mm = &init_mm;
 
+	/* XXX Must be done for all CPUs  */
 	current_cpu_data.asid_cache = ASID_FIRST_VERSION;
 	TLBMISS_HANDLER_SETUP();
 }
diff -ruN linux-2.4.20-WRT/arch/mips/kernel/unaligned.c linux-2.4.20-WRTstp/arch/mips/kernel/unaligned.c
--- linux-2.4.20-WRT/arch/mips/kernel/unaligned.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/kernel/unaligned.c	2006-06-12 18:15:49.000000000 -0700
@@ -550,4 +550,9 @@
 	die_if_kernel("Kernel unaligned instruction access", regs);
 	force_sig(SIGBUS, current);
 
+	/*
+	 * XXX On return from the signal handler we should advance the epc
+	 */
+
+	return;
 }
diff -ruN linux-2.4.20-WRT/arch/mips/lasat/lasat_board.c linux-2.4.20-WRTstp/arch/mips/lasat/lasat_board.c
--- linux-2.4.20-WRT/arch/mips/lasat/lasat_board.c	2003-07-04 01:11:13.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/lasat/lasat_board.c	2006-06-12 18:15:49.000000000 -0700
@@ -69,7 +69,7 @@
 	case 3:
 		/* These have old serial numbers that we can't convert. */
 		return -1;
-
+		
 	case 4:
 		/* This used flags for obscure purposes. */
 		old.version = 5;
@@ -168,8 +168,8 @@
 	{
 		if (0 > upgrade_eeprom_info(&(lasat_board_info.li_eeprom_info))) {
 			printk("Upgrading EEPROM information from version %d to version %d failed!\n", 
-			       (unsigned int)lasat_board_info.li_eeprom_info.version,
-			       LASAT_EEPROM_VERSION);
+		       (unsigned int)lasat_board_info.li_eeprom_info.version,
+		       LASAT_EEPROM_VERSION);
 			return -1;
 		}
 		lasat_write_eeprom_info();
diff -ruN linux-2.4.20-WRT/arch/mips/lasat/reset.c linux-2.4.20-WRTstp/arch/mips/lasat/reset.c
--- linux-2.4.20-WRT/arch/mips/lasat/reset.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/lasat/reset.c	2006-06-12 18:15:49.000000000 -0700
@@ -43,11 +43,11 @@
 	{
 		volatile unsigned int *softres_reg = lasat_misc->reset_reg;
 
-		if (lasat_boot_to_service) {
-			printk("machine_restart: Rebooting to service mode\n");
-			*(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
-			*(volatile unsigned int *)0xa00000fc = 0xfedeabba;
-		}
+	if (lasat_boot_to_service) {
+		printk("machine_restart: Rebooting to service mode\n");
+		*(volatile unsigned int *)0xa0000024 = 0xdeadbeef;
+		*(volatile unsigned int *)0xa00000fc = 0xfedeabba;
+	}
 		*softres_reg = 0xbedead;
 	}
 	for (;;) ;
diff -ruN linux-2.4.20-WRT/arch/mips/lib/tinycon.c linux-2.4.20-WRTstp/arch/mips/lib/tinycon.c
--- linux-2.4.20-WRT/arch/mips/lib/tinycon.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/lib/tinycon.c	2005-11-08 06:24:35.000000000 -0800
@@ -1,4 +1,18 @@
-
+/*
+ * arch/mips/lib/console.c
+ *
+ * Copyright (C) 1994 by Waldorf Electronic,
+ * written by Ralf Baechle and Andreas Busse
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive for
+ * more details.
+ *
+ * FIXME: This file is hacked to be hardwired for the Deskstation
+ *        Only thought as a debugging console output.  It's as inefficient
+ *        as a piece of code can be but probably a good piece of code to
+ *        implement a preliminary console for a new target.
+ */
 
 #include <linux/tty.h>
 #include <asm/bootinfo.h>
diff -ruN linux-2.4.20-WRT/arch/mips/Makefile linux-2.4.20-WRTstp/arch/mips/Makefile
--- linux-2.4.20-WRT/arch/mips/Makefile	2004-11-17 00:08:32.000000000 -0800
+++ linux-2.4.20-WRTstp/arch/mips/Makefile	2006-06-12 18:15:49.000000000 -0700
@@ -525,8 +525,8 @@
 # (In fact, this just uses the exact same support as the BCM912500A (SWARM).)
 #
 ifdef CONFIG_SIBYTE_RHONE
-LIBS          += arch/mips/sibyte/swarm/sbswarm.a
-SUBDIRS       += arch/mips/sibyte/swarm
+LIBS		+= arch/mips/sibyte/swarm/sbswarm.a
+SUBDIRS		+= arch/mips/sibyte/swarm
 endif
 
 #
diff -ruN linux-2.4.20-WRT/arch/mips/math-emu/cp1emu.c linux-2.4.20-WRTstp/arch/mips/math-emu/cp1emu.c
--- linux-2.4.20-WRT/arch/mips/math-emu/cp1emu.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/math-emu/cp1emu.c	2005-11-08 06:24:35.000000000 -0800
@@ -205,6 +205,7 @@
 		return SIGBUS;
 	}
 
+	/* XXX NEC Vr54xx bug workaround */
 	if ((xcp->cp0_cause & CAUSEF_BD) && !isBranchInstr(&ir))
 		xcp->cp0_cause &= ~CAUSEF_BD;
 
diff -ruN linux-2.4.20-WRT/arch/mips/math-emu/dp_fint.c linux-2.4.20-WRTstp/arch/mips/math-emu/dp_fint.c
--- linux-2.4.20-WRT/arch/mips/math-emu/dp_fint.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/math-emu/dp_fint.c	2001-04-13 20:26:07.000000000 -0700
@@ -50,6 +50,7 @@
 		xm = x;
 	}
 
+#if 1
 	/* normalize - result can never be inexact or overflow */
 	xe = DP_MBITS;
 	while ((xm >> DP_MBITS) == 0) {
@@ -57,6 +58,15 @@
 		xe--;
 	}
 	return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
+#else
+	/* normalize */
+	xe = DP_MBITS + 3;
+	while ((xm >> (DP_MBITS + 3)) == 0) {
+		xm <<= 1;
+		xe--;
+	}
+	DPNORMRET1(xs, xe, xm, "fint", x);
+#endif
 }
 
 ieee754dp ieee754dp_funs(unsigned int u)
diff -ruN linux-2.4.20-WRT/arch/mips/mips-boards/atlas/atlas_int.c linux-2.4.20-WRTstp/arch/mips/mips-boards/atlas/atlas_int.c
--- linux-2.4.20-WRT/arch/mips/mips-boards/atlas/atlas_int.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mips-boards/atlas/atlas_int.c	2005-11-08 06:24:35.000000000 -0800
@@ -42,7 +42,11 @@
 extern asmlinkage void mipsIRQ(void);
 extern void do_IRQ(int irq, struct pt_regs *regs);
 
+#if 0
+#define DEBUG_INT(x...) printk(x)
+#else
 #define DEBUG_INT(x...)
+#endif
 
 void disable_atlas_irq(unsigned int irq_nr)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/mips-boards/generic/memory.c linux-2.4.20-WRTstp/arch/mips/mips-boards/generic/memory.c
--- linux-2.4.20-WRT/arch/mips/mips-boards/generic/memory.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mips-boards/generic/memory.c	2006-06-12 17:49:48.000000000 -0700
@@ -82,7 +82,7 @@
 	mdesc[1].base = 0x00001000;
 	mdesc[1].size = 0x000ef000;
 
-#if CONFIG_MIPS_MALTA
+#if (CONFIG_MIPS_MALTA)
 	/*
 	 * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the
 	 * south bridge and PCI access always forwarded to the ISA Bus and
diff -ruN linux-2.4.20-WRT/arch/mips/mm/cerr-sb1.c linux-2.4.20-WRTstp/arch/mips/mm/cerr-sb1.c
--- linux-2.4.20-WRT/arch/mips/mm/cerr-sb1.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/cerr-sb1.c	2006-06-12 18:15:49.000000000 -0700
@@ -21,6 +21,7 @@
 
 /* SB1 definitions */
 
+/* XXX should come from config1 XXX */
 #define SB1_CACHE_INDEX_MASK   0x1fe0
 
 #define CP0_ERRCTL_RECOVERABLE (1 << 31)
diff -ruN linux-2.4.20-WRT/arch/mips/mm/c-mips32.c linux-2.4.20-WRTstp/arch/mips/mm/c-mips32.c
--- linux-2.4.20-WRT/arch/mips/mm/c-mips32.c	2004-08-25 23:56:33.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/c-mips32.c	2006-06-12 18:15:49.000000000 -0700
@@ -337,13 +337,13 @@
 	if (size >= scache_size) {
 		blast_scache();
 	} else if (size) {
-		a = addr & ~(sc_lsize - 1);
-		end = (addr + size - 1) & ~(sc_lsize - 1);
-		while (1) {
-			flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
-			if (a == end) break;
-			a += sc_lsize;
-		}
+	a = addr & ~(sc_lsize - 1);
+	end = (addr + size - 1) & ~(sc_lsize - 1);
+	while (1) {
+		flush_scache_line(a);	/* Hit_Writeback_Inv_SD */
+		if (a == end) break;
+		a += sc_lsize;
+	}
 	}
 }
 
@@ -378,13 +378,13 @@
 	if (size >= scache_size) {
 		blast_scache();
 	} else if (size) {
-		a = addr & ~(sc_lsize - 1);
-		end = (addr + size - 1) & ~(sc_lsize - 1);
-		while (1) {
-			invalidate_scache_line(a); /* Hit_Inv_SD */
-			if (a == end) break;
-			a += sc_lsize;
-		}
+	a = addr & ~(sc_lsize - 1);
+	end = (addr + size - 1) & ~(sc_lsize - 1);
+	while (1) {
+		invalidate_scache_line(a); /* Hit_Inv_SD */
+		if (a == end) break;
+		a += sc_lsize;
+	}
 	}
 }
 
diff -ruN linux-2.4.20-WRT/arch/mips/mm/c-r4k.c linux-2.4.20-WRTstp/arch/mips/mm/c-r4k.c
--- linux-2.4.20-WRT/arch/mips/mm/c-r4k.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/c-r4k.c	2006-06-12 18:15:49.000000000 -0700
@@ -955,6 +955,7 @@
 #ifdef R4600_V2_HIT_CACHEOP_WAR
 		unsigned long flags;
 
+		/* Workaround for R4600 bug.  See comment in <asm/war>. */
 		local_irq_save(flags);
 		*(volatile unsigned long *)KSEG1;
 #endif
@@ -1002,6 +1003,7 @@
 #ifdef R4600_V2_HIT_CACHEOP_WAR
 		unsigned long flags;
 
+		/* Workaround for R4600 bug.  See comment in <asm/war>. */
 		local_irq_save(flags);
 		*(volatile unsigned long *)KSEG1;
 #endif
diff -ruN linux-2.4.20-WRT/arch/mips/mm/c-rm7k.c linux-2.4.20-WRTstp/arch/mips/mm/c-rm7k.c
--- linux-2.4.20-WRT/arch/mips/mm/c-rm7k.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/c-rm7k.c	2006-06-12 18:15:49.000000000 -0700
@@ -103,16 +103,28 @@
 
 static void rm7k_flush_icache_range(unsigned long start, unsigned long end)
 {
+	/*
+	 * FIXME: This is overdoing things and harms performance.
+	 */
 	__flush_cache_all_d32i32();
 }
 
 static void rm7k_flush_icache_page(struct vm_area_struct *vma,
                                    struct page *page)
 {
+	/*
+	 * FIXME: We should not flush the entire cache but establish some
+	 * temporary mapping and use hit_invalidate operation to flush out
+	 * the line from the cache.
+	 */
 	__flush_cache_all_d32i32();
 }
 
 
+/*
+ * Writeback and invalidate the primary cache dcache before DMA.
+ * (XXX These need to be fixed ...)
+ */
 static void
 rm7k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/mm/c-sb1.c linux-2.4.20-WRTstp/arch/mips/mm/c-sb1.c
--- linux-2.4.20-WRT/arch/mips/mm/c-sb1.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/c-sb1.c	2006-06-12 18:15:49.000000000 -0700
@@ -116,14 +116,14 @@
 	"	cache	%3, (2<<13)($1)	\n" /* Index-WB-inval this address */
 	"	cache	%3, (3<<13)($1)	\n" /* Index-WB-inval this address */
 	"	bne	%0, %1, 1b	\n" /* loop test */
-	"	 addu	%0, %0, %2	\n" /* next line */
-	"	sync			\n"
-	"	.set pop		\n"
-	:
-	: "r" (start  & ~(dcache_line_size - 1)),
+		"	addu	%0, %0, %2	\n" /* next line */
+		"	sync			\n"
+		"	.set pop		\n"
+		:
+		: "r" (start  & ~(dcache_line_size - 1)),
 	  "r" ((end - 1) & ~(dcache_line_size - 1)),
-	  "r" (dcache_line_size),
-	  "i" (Index_Writeback_Inv_D));
+		  "r" (dcache_line_size),
+		  "i" (Index_Writeback_Inv_D));
 }
 
 
@@ -194,8 +194,8 @@
 		return;
 	}
 
-	__sb1_writeback_inv_dcache_range(start, end);
-
+		__sb1_writeback_inv_dcache_range(start, end);
+	
 	__asm__ __volatile__ (
 		".set push                  \n"
 		".set noreorder             \n"
diff -ruN linux-2.4.20-WRT/arch/mips/mm/fault.c linux-2.4.20-WRTstp/arch/mips/mm/fault.c
--- linux-2.4.20-WRT/arch/mips/mm/fault.c	2003-07-04 01:11:14.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/fault.c	2006-06-12 17:49:48.000000000 -0700
@@ -101,6 +101,10 @@
 	 */
 	if (in_interrupt() || !mm)
 		goto no_context;
+#if 0
+	printk("[%s:%d:%08lx:%ld:%08lx]\n", current->comm, current->pid,
+	       address, write, regs->cp0_epc);
+#endif
 	down_read(&mm->mmap_sem);
 	vma = find_vma(mm, address);
 	if (!vma)
@@ -159,6 +163,15 @@
 	if (user_mode(regs)) {
 		tsk->thread.cp0_badvaddr = address;
 		tsk->thread.error_code = write;
+#if 0
+		printk("do_page_fault() #2: sending SIGSEGV to %s for illegal %s\n"
+		       "%08lx (epc == %08lx, ra == %08lx)\n",
+		       tsk->comm,
+		       write ? "write access to" : "read access from",
+		       address,
+		       (unsigned long) regs->cp0_epc,
+		       (unsigned long) regs->regs[31]);
+#endif
 		info.si_signo = SIGSEGV;
 		info.si_errno = 0;
 		/* info.si_code has been set above */
diff -ruN linux-2.4.20-WRT/arch/mips/mm/tlbex-r4k.S linux-2.4.20-WRTstp/arch/mips/mm/tlbex-r4k.S
--- linux-2.4.20-WRT/arch/mips/mm/tlbex-r4k.S	2003-10-14 01:00:39.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/tlbex-r4k.S	2006-06-12 18:15:49.000000000 -0700
@@ -215,6 +215,15 @@
 	END(except_vec0_r4600)
 
 	/* TLB refill, EXL == 0, R52x0 "Nevada" version */
+        /*
+         * This version has a bug workaround for the Nevada.  It seems
+         * as if under certain circumstances the move from cp0_context
+         * might produce a bogus result when the mfc0 instruction and
+         * it's consumer are in a different cacheline or a load instruction,
+         * probably any memory reference, is between them.  This is
+         * potencially slower than the R4000 version, so we use this
+         * special version.
+         */
 	.set	noreorder
 	.set	noat
 	LEAF(except_vec0_nevada)
@@ -292,7 +301,7 @@
 	addu	k1, k1, k0
 	PTE_L	k0, 0(k1)
 	PTE_L	k1, PTE_SIZE(k1)
-	nop				
+	nop				/* XXX */
 	tlbp
 	PTE_SRL	k0, k0, 6
 	P_MTC0	k0, CP0_ENTRYLO0
@@ -324,7 +333,7 @@
 	addu	k1, k1, k0
 	PTE_L	k0, 0(k1)
 	PTE_L	k1, PTE_SIZE(k1)
-	nop				
+	nop				/* XXX */
 	tlbp
 	PTE_SRL	k0, k0, 6
 	P_MTC0	k0, CP0_ENTRYLO0
@@ -387,7 +396,7 @@
 	addu	k1, k1, k0
 	PTE_L	k0, 0(k1)
 	PTE_L	k1, PTE_SIZE(k1)
-	nop				
+	nop				/* XXX */
 	tlbp
 	PTE_SRL	k0, k0, 6
 	P_MTC0  zero, CP0_ENTRYLO0
diff -ruN linux-2.4.20-WRT/arch/mips/mm/tlb-r3k.c linux-2.4.20-WRTstp/arch/mips/mm/tlb-r3k.c
--- linux-2.4.20-WRT/arch/mips/mm/tlb-r3k.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/tlb-r3k.c	2006-06-12 18:15:49.000000000 -0700
@@ -189,8 +189,14 @@
 	write_c0_entryhi(address | pid);
 	if (idx < 0) {					/* BARRIER */
 		tlb_write_random();
+#if 0
+		printk("[MISS]");
+#endif
 	} else {
 		tlb_write_indexed();
+#if 0
+		printk("[HIT]");
+#endif
 	}
 	write_c0_entryhi(pid);
 	local_irq_restore(flags);
diff -ruN linux-2.4.20-WRT/arch/mips/mm/tlb-r4k.c linux-2.4.20-WRTstp/arch/mips/mm/tlb-r4k.c
--- linux-2.4.20-WRT/arch/mips/mm/tlb-r4k.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/tlb-r4k.c	2006-06-12 18:15:49.000000000 -0700
@@ -233,6 +233,35 @@
 	local_irq_restore(flags);
 }
 
+#if 0
+static void r4k_update_mmu_cache_hwbug(struct vm_area_struct * vma,
+				       unsigned long address, pte_t pte)
+{
+	unsigned long flags;
+	pgd_t *pgdp;
+	pmd_t *pmdp;
+	pte_t *ptep;
+	int idx;
+
+	__save_and_cli(flags);
+	address &= (PAGE_MASK << 1);
+	set_entryhi(address | (get_entryhi() & 0xff));
+	pgdp = pgd_offset(vma->vm_mm, address);
+	tlb_probe();
+	pmdp = pmd_offset(pgdp, address);
+	idx = get_index();
+	ptep = pte_offset(pmdp, address);
+	set_entrylo0(pte_val(*ptep++) >> 6);
+	set_entrylo1(pte_val(*ptep) >> 6);
+	BARRIER;
+	if (idx < 0)
+		tlb_write_random();
+	else
+		tlb_write_indexed();
+	BARRIER;
+	__restore_flags(flags);
+}
+#endif
 
 void __init add_wired_entry(unsigned long entrylo0, unsigned long entrylo1,
 		     unsigned long entryhi, unsigned long pagemask)
diff -ruN linux-2.4.20-WRT/arch/mips/mm/tlb-sb1.c linux-2.4.20-WRTstp/arch/mips/mm/tlb-sb1.c
--- linux-2.4.20-WRT/arch/mips/mm/tlb-sb1.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/mm/tlb-sb1.c	2006-06-12 18:15:49.000000000 -0700
@@ -261,7 +261,7 @@
 		get_new_mmu_context(mm, smp_processor_id());
 		if (mm == current->active_mm) {
 			write_c0_entryhi(cpu_asid(cpu, mm));
-		}
+	}
 	}
 	local_irq_restore(flags);
 }
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt64240_dep.h linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt64240_dep.h
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt64240_dep.h	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt64240_dep.h	2005-11-08 06:24:35.000000000 -0800
@@ -21,6 +21,12 @@
 /*
  * PCI address allocation
  */
+#if 0
+#define GT_PCI_MEM_BASE    (0x22000000)
+#define GT_PCI_MEM_SIZE    GT_DEF_PCI0_MEM0_SIZE
+#define GT_PCI_IO_BASE     (0x20000000)
+#define GT_PCI_IO_SIZE     GT_DEF_PCI0_IO_SIZE
+#endif
 
 extern unsigned long gt64240_base;
 
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt64240.h linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt64240.h
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt64240.h	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt64240.h	2005-11-08 06:24:35.000000000 -0800
@@ -8,6 +8,19 @@
 #define GTREG(v)        (((v) & 0xff) << 24) | (((v) & 0xff00) << 8) | \
                         (((v) >> 24) & 0xff) | (((v) >> 8) & 0xff00)
 
+#if 0
+#define GTREG_SHORT(X)	(((X) << 8) | ((X) >> 8))
+
+#define LONG_GTREG(X)	((l64) \
+			(((X)&0x00000000000000ffULL) << 56) | \
+			(((X)&0x000000000000ff00ULL) << 40) | \
+			(((X)&0x0000000000ff0000ULL) << 24) | \
+			(((X)&0x00000000ff000000ULL) << 8)  | \
+			(((X)&0x000000ff00000000ULL) >> 8)  | \
+			(((X)&0x0000ff0000000000ULL) >> 24) | \
+			(((X)&0x00ff000000000000ULL) >> 40) | \
+			(((X)&0xff00000000000000ULL) >> 56))
+#endif
 
 #include "gt64240_dep.h"
 
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt-irq.c linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt-irq.c
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/gt-irq.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/gt-irq.c	2005-11-08 06:24:35.000000000 -0800
@@ -154,6 +154,12 @@
 	    int_high_src_mask;
 	int handled;
 
+#if 0
+	GT_READ(GT_INTRCAUSE_OFS, &irq_src);
+	GT_READ(GT_INTRMASK_OFS, &irq_src_mask);
+	GT_READ(GT_HINTRCAUSE_OFS, &int_high_src);
+	GT_READ(GT_HINTRMASK_OFS, &int_high_src_mask);
+#endif
 	irq_src = irq_src & irq_src_mask;
 	int_high_src = int_high_src & int_high_src_mask;
 
@@ -187,6 +193,10 @@
 		}
 #endif				/*  UNUSED  */
 	}
+#if 0
+	GT_WRITE(GT_INTRCAUSE_OFS, 0);
+	GT_WRITE(GT_HINTRCAUSE_OFS, 0);
+#endif
 
 #undef GALILEO_I2O
 #ifdef GALILEO_I2O
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/ocelot_pld.h linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/ocelot_pld.h
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/ocelot_pld.h	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/ocelot_pld.h	2006-06-12 18:15:49.000000000 -0700
@@ -8,7 +8,11 @@
 #ifndef __MOMENCO_OCELOT_PLD_H__
 #define __MOMENCO_OCELOT_PLD_H__
 
+#if 0
+#define OCELOT_CS0_ADDR (0xe0020000)
+#else
 #define OCELOT_CS0_ADDR (0xfc000000)
+#endif
 
 #define OCELOT_REG_BOARDREV (0)
 #define OCELOT_REG_PLD1_ID (1)
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/pci.c linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/pci.c
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/pci.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/pci.c	2006-06-12 17:49:48.000000000 -0700
@@ -418,6 +418,31 @@
 
 	return;
 
+#if 0
+	new = res->start | (res->flags & PCI_REGION_FLAG_MASK);
+	if (resource < 6) {
+		reg = PCI_BASE_ADDRESS_0 + 4 * resource;
+	} else if (resource == PCI_ROM_RESOURCE) {
+		res->flags |= PCI_ROM_ADDRESS_ENABLE;
+		reg = dev->rom_base_reg;
+	} else {
+		/*
+		 * Somebody might have asked allocation of a non-standard
+		 * resource
+		 */
+		return;
+	}
+
+	pci_write_config_dword(dev, reg, new);
+	pci_read_config_dword(dev, reg, &check);
+	if ((new ^ check) &
+	    ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
+	     PCI_BASE_ADDRESS_MEM_MASK)) {
+		printk(KERN_ERR "PCI: Error while updating region "
+		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
+		       new, check);
+	}
+#endif
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
diff -ruN linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/setup.c linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/setup.c
--- linux-2.4.20-WRT/arch/mips/momentum/ocelot_g/setup.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/momentum/ocelot_g/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -201,6 +201,7 @@
 		break;
 	}
 
+	/* FIXME: Fix up the DiskOnChip mapping */
 	GT_WRITE(0x468, 0xfef73);
 }
 
diff -ruN linux-2.4.20-WRT/arch/mips/philips/nino/int-handler.S linux-2.4.20-WRTstp/arch/mips/philips/nino/int-handler.S
--- linux-2.4.20-WRT/arch/mips/philips/nino/int-handler.S	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/philips/nino/int-handler.S	2005-11-08 06:23:47.000000000 -0800
@@ -14,6 +14,21 @@
 #include <asm/regdef.h>
 #include <asm/stackframe.h>
 
+	/*
+	 * Here is the table of interrupts for the Philips Nino
+	 * which uses the Philips PR31700/Toshiba TMPR3912 core.
+	 *
+	 *   MIPS IRQ             Description
+	 *   --------	--------------------------------
+	 *       0	SW0 interrupt (unused)
+	 *       1	SW1 interrupt (unused)
+	 *       2
+	 *       3
+	 *       4	PR31700 low priority interrupts
+	 *       5
+	 *       6	PR31700 high priority interrupts
+	 *       7
+	 */
 
 	.text
 	.set	noreorder
diff -ruN linux-2.4.20-WRT/arch/mips/philips/nino/irq.c linux-2.4.20-WRTstp/arch/mips/philips/nino/irq.c
--- linux-2.4.20-WRT/arch/mips/philips/nino/irq.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/philips/nino/irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -208,6 +208,11 @@
 	outl(0xffffffff, TX3912_INT4_CLEAR);
 	outl(0xffffffff, TX3912_INT5_CLEAR);
 
+	/*
+	 * Disable all PR31700 interrupts. We let the various
+	 * device drivers in the system register themselves
+	 * and set the proper hardware bits.
+	 */
 	outl(0x00000000, TX3912_INT1_ENABLE);
 	outl(0x00000000, TX3912_INT2_ENABLE);
 	outl(0x00000000, TX3912_INT3_ENABLE);
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-hpc.c linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-hpc.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-hpc.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-hpc.c	2006-06-12 17:49:48.000000000 -0700
@@ -13,7 +13,11 @@
 #include <asm/sgialib.h>
 #include <asm/bootinfo.h>
 
+#if 0
+#define HPC_DEBUG(args...)		printk(args)
+#else
 #define HPC_DEBUG(args...)
+#endif
 
 struct hpc3_regs *hpc3c0, *hpc3c1;
 struct hpc3_miscregs *hpc3mregs;
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-mc.c linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-mc.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-mc.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-mc.c	2005-11-08 06:24:35.000000000 -0800
@@ -63,6 +63,16 @@
 	printk(KERN_INFO "MC: SGI memory controller Revision %d\n",
 	       (int) mcmisc_regs->systemid & SGIMC_SYSID_MASKREV);
 
+#if 0 /* XXX Until I figure out what this bit really indicates XXX */
+	/* XXX Is this systemid bit reliable? */
+	if(mcmisc_regs->systemid & SGIMC_SYSID_EPRESENT) {
+		EISA_bus = 1;
+		printk("with EISA\n");
+	} else {
+		EISA_bus = 0;
+		printk("no EISA\n");
+	}
+#endif
 
 #ifdef DEBUG_SGIMC
 	prom_printf("sgimc_init: memconfig0<%s> mconfig1<%s>\n",
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-reset.c linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-reset.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-reset.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-reset.c	2006-06-12 17:49:48.000000000 -0700
@@ -40,6 +40,7 @@
 static void sgi_machine_halt(void) __attribute__((noreturn));
 static void sgi_machine_power_off(void) __attribute__((noreturn));
 
+/* XXX How to pass the reboot command to the firmware??? */
 static void sgi_machine_restart(char *command)
 {
 	if (shuting_down)
@@ -83,6 +84,7 @@
 
 static void blink_timeout(unsigned long data)
 {
+	/* XXX fix this for fullhouse  */
 	sgi_hpc_write1 ^= (HPC3_WRITE1_LC0OFF|HPC3_WRITE1_LC1OFF);
 	hpc3mregs->write1 = sgi_hpc_write1;
 
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-sc.c linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-sc.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip22/ip22-sc.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip22/ip22-sc.c	2005-11-08 06:24:35.000000000 -0800
@@ -207,6 +207,8 @@
 	return 1;
 }
 
+/* XXX Check with wje if the Indy caches can differenciate between
+   writeback + invalidate and just invalidate.  */
 struct bcache_ops indy_sc_ops = {
 	indy_sc_enable,
 	indy_sc_disable,
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-berr.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-berr.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-berr.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-berr.c	2006-06-12 17:49:48.000000000 -0700
@@ -76,6 +76,7 @@
 
 void __init bus_error_init(void)
 {
+	/* XXX Initialize all the Hub & Bridge error handling here.  */
 	int cpu = LOCAL_HUB_L(PI_CPU_NUM);
 	int cpuoff = cpu << 8;
 
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-init.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-init.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-init.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-init.c	2006-06-12 17:49:48.000000000 -0700
@@ -273,10 +273,21 @@
 void sn_mp_setup(void)
 {
 	cnodeid_t	cnode;
+#if 0
+	cpuid_t		cpu;
+#endif
 
 	for (cnode = 0; cnode < numnodes; cnode++) {
+#if 0
+		init_platform_nodepda();
+#endif
 		intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
 	}
+#if 0
+	for (cpu = 0; cpu < maxcpus; cpu++) {
+		init_platform_pda();
+	}
+#endif
 }
 
 void per_hub_init(cnodeid_t cnode)
@@ -349,6 +360,9 @@
 	cnodeid_t cnode = get_compact_nodeid();
 
 	TLBMISS_HANDLER_SETUP();
+#if 0
+	intr_init();
+#endif
 	clear_c0_status(ST0_IM);
 	per_hub_init(cnode);
 	cpu_time_init();
@@ -356,6 +370,9 @@
 		install_cpuintr(cpu);
 	/* Install our NMI handler if symmon hasn't installed one. */
 	install_cpu_nmi_handler(cputoslice(cpu));
+#if 0
+	install_tlbintr(cpu);
+#endif
 	set_c0_status(SRB_DEV0 | SRB_DEV1);
 	if (is_slave) {
 		load_mmu();
@@ -409,11 +426,24 @@
 	CPUMASK_CLRB(boot_barrier, getcpuid());	/* needs atomicity */
 	per_cpu_init();
 	per_cpu_trap_init();
+#if 0
+	ecc_init();
+	bte_lateinit();
+	init_mfhi_war();
+#endif
 	local_flush_tlb_all();
 	flush_cache_l1();
 	flush_cache_l2();
 
 	local_irq_enable();
+#if 0
+	/*
+	 * Get our bogomips.
+	 */
+        calibrate_delay();
+        smp_store_cpu_info(cpuid);
+	prom_smp_finish();
+#endif
 	printk("Slave cpu booted successfully\n");
 	CPUMASK_SETB(cpu_online_map, cpu);
 	atomic_inc(&cpus_booted);
@@ -442,6 +472,10 @@
 	sn_mp_setup();
 	/* Master has already done per_cpu_init() */
 	install_cpuintr(smp_processor_id());
+#if 0
+	bte_lateinit();
+	ecc_init();
+#endif
 
 	replicate_kernel_text(numnodes);
 	boot_barrier = boot_cpumask;
@@ -510,6 +544,14 @@
 		CPUMASK_SETB(cpu_online_map, cpu);
 		num_cpus++;
 
+		/*
+		 * Wait this cpu to start up and initialize its hub,
+		 * and discover the io devices it will control.
+		 *
+		 * XXX: We really want to fire up launch all the CPUs
+		 * at once.  We have to preserve the order of the
+		 * devices on the bridges first though.
+		 */
 		while (atomic_read(&numstarted) != num_cpus);
 	}
 
@@ -517,7 +559,17 @@
 	Wait logic goes here.
 #endif
 	for (cnode = 0; cnode < numnodes; cnode++) {
+#if 0
+		if (cnodetocpu(cnode) == -1) {
+			printk("Initializing headless hub,cnode %d", cnode);
+			per_hub_init(cnode);
+		}
+#endif
 	}
+#if 0
+	cpu_io_setup();
+	init_mfhi_war();
+#endif
 	smp_num_cpus = num_cpus;
 }
 
@@ -528,12 +580,14 @@
 	init_new_context(current, &init_mm);
 	current->processor = 0;
 	init_idle();
+	/* smp_tune_scheduling();  XXX */
 	allowboot();
 }
 
 #else /* CONFIG_SMP */
 void __init start_secondary(void)
 {
+	/* XXX Why do we need this empty definition at all?  */
 }
 #endif /* CONFIG_SMP */
 
@@ -726,4 +780,94 @@
 	}
 }
 
+#if 0
+#define		brd_widgetnum	brd_slot
+#define NODE_OFFSET_TO_KLINFO(n,off)    ((klinfo_t*) TO_NODE_CAC(n,off))
+void
+dump_klcfg(void)
+{
+	cnodeid_t       cnode;
+	int i;
+	nasid_t         nasid;
+	lboard_t        *lbptr;
+	gda_t           *gdap;
+
+	gdap = (gda_t *)GDA_ADDR(get_nasid());
+	if (gdap->g_magic != GDA_MAGIC) {
+		printk("dumpklcfg_cmd: Invalid GDA MAGIC\n");
+		return;
+	}
+
+	for (cnode = 0; cnode < MAX_COMPACT_NODES; cnode ++) {
+		nasid = gdap->g_nasidtable[cnode];
+
+		if (nasid == INVALID_NASID)
+			continue;
+
+		printk("\nDumpping klconfig Nasid %d:\n", nasid);
+
+		lbptr = KL_CONFIG_INFO(nasid);
+
+		while (lbptr) {
+			printk("    %s, Nasid %d, Module %d, widget 0x%x, partition %d, NIC 0x%x lboard 0x%lx",
+				"board name here", /* BOARD_NAME(lbptr->brd_type), */
+				lbptr->brd_nasid, lbptr->brd_module,
+				lbptr->brd_widgetnum,
+				lbptr->brd_partition,
+				(lbptr->brd_nic), lbptr);
+			if (lbptr->brd_flags & DUPLICATE_BOARD)
+				printk(" -D");
+			printk("\n");
+			for (i = 0; i < lbptr->brd_numcompts; i++) {
+				klinfo_t *kli;
+				kli = NODE_OFFSET_TO_KLINFO(NASID_GET(lbptr), lbptr->brd_compts[i]);
+				printk("        type %2d, flags 0x%04x, diagval %3d, physid %4d, virtid %2d: %s\n",
+					kli->struct_type,
+					kli->flags,
+					kli->diagval,
+					kli->physid,
+					kli->virtid,
+					"comp. name here");
+					/* COMPONENT_NAME(kli->struct_type)); */
+			}
+			lbptr = KLCF_NEXT(lbptr);
+		}
+	}
+	printk("\n");
+
+	/* Useful to print router maps also */
+
+	for (cnode = 0; cnode < MAX_COMPACT_NODES; cnode ++) {
+		klrou_t *kr;
+		int i;
+
+        	nasid = gdap->g_nasidtable[cnode];
+        	if (nasid == INVALID_NASID)
+            		continue;
+        	lbptr = KL_CONFIG_INFO(nasid);
+
+        	while (lbptr) {
+
+			lbptr = find_lboard_class(lbptr, KLCLASS_ROUTER);
+			if(!lbptr)
+				break;
+			if (!KL_CONFIG_DUPLICATE_BOARD(lbptr)) {
+				printk("%llx -> \n", lbptr->brd_nic);
+				kr = (klrou_t *)find_first_component(lbptr,
+					KLSTRUCT_ROU);
+				for (i = 1; i <= MAX_ROUTER_PORTS; i++) {
+					printk("[%d, %llx]; ",
+						kr->rou_port[i].port_nasid,
+						kr->rou_port[i].port_offset);
+				}
+				printk("\n");
+			}
+			lbptr = KLCF_NEXT(lbptr);
+        	}
+        	printk("\n");
+    	}
+
+	dump_topology();
+}
+#endif
 
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-irq.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-irq.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-irq.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-irq.c	2005-11-08 06:24:35.000000000 -0800
@@ -115,7 +115,7 @@
 		j = LEAST_LEVEL + 3;	/* resched & crosscall entries taken */
 		while (++j < PERNODE_LEVELS)
 			if (node_level_to_irq[nodenum][j] == irq) {
-				*cpunum = 0;	
+				*cpunum = 0;	/* XXX Fixme */
 				return(j);
 			}
 	}
@@ -212,6 +212,11 @@
 	/* more stuff in int_enable reg */
 	bridge->b_int_enable |= 0x7ffffe00;
 
+	/*
+	 * XXX This only works if b_int_device is initialized to 0!
+	 * We program the bridge to have a 1:1 mapping between devices
+	 * (slots) and intr pins.
+	 */
 	device = bridge->b_int_device;
 	device |= (pin << (pin*3));
 	bridge->b_int_device = device;
@@ -388,7 +393,7 @@
 {
 	int irq;
 
-#if CPUS_PER_NODE == 2
+#if (CPUS_PER_NODE == 2)
 	switch (action) {
 		case SMP_RESCHEDULE_YOURSELF:
 			irq = CPU_RESCHED_A_IRQ;
@@ -420,7 +425,7 @@
 void install_cpuintr(int cpu)
 {
 #ifdef CONFIG_SMP
-#if CPUS_PER_NODE == 2
+#if (CPUS_PER_NODE == 2)
 	static int done = 0;
 
 	/*
@@ -474,4 +479,9 @@
 
 void install_tlbintr(int cpu)
 {
+#if 0
+	int intr_bit = N_INTPEND_BITS + TLB_INTR_A + cputoslice(cpu);
+
+	intr_connect_level(cpu, intr_bit);
+#endif
 }
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-irq-glue.S linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-irq-glue.S
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-irq-glue.S	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-irq-glue.S	2005-11-08 06:24:35.000000000 -0800
@@ -45,6 +45,7 @@
 	j	ret_from_irq
 
 1:
+#if 1
 	mfc0	a1, CP0_STATUS
 	srl	a1, a1, 8
 	andi	a1, 0xff
@@ -57,6 +58,7 @@
 	PRINT("Spurious interrupt, c0_status = %02x, c0_cause = %02x, pending %02x.\n")
 	ld	a1, PT_EPC(sp)
 0:	b	0b
+#endif
 
 	j	ret_from_irq
 	END(ip27_irq)
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-klnuma.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-klnuma.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-klnuma.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-klnuma.c	2005-11-08 06:24:35.000000000 -0800
@@ -22,6 +22,11 @@
 extern char _end;
 static cpumask_t ktext_repmask;
 
+/*
+ * XXX - This needs to be much smarter about where it puts copies of the
+ * kernel.  For example, we should never put a copy on a headless node,
+ * and we should respect the topology of the machine.
+ */
 void __init setup_replication_mask(int maxnodes)
 {
 	static int 	numa_kernel_replication_ratio;
@@ -74,6 +79,7 @@
 	printk("REPLICATION: ON nasid %d, ktext from nasid %d, kdata from nasid %d\n", client_nasid, server_nasid, master_nasid);
 }
 
+/* XXX - When the BTE works, we should use it instead of this. */
 static __init void copy_kernel(nasid_t dest_nasid)
 {
 	extern char _stext, _etext;
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-nmi.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-nmi.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-nmi.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-nmi.c	2005-11-08 06:24:35.000000000 -0800
@@ -9,7 +9,11 @@
 #include <asm/sn/arch.h>
 #include <asm/sn/sn0/hub.h>
 
+#if 0
+#define NODE_NUM_CPUS(n)	CNODE_NUM_CPUS(n)
+#else
 #define NODE_NUM_CPUS(n)	CPUS_PER_NODE
+#endif
 
 #define CNODEID_NONE (cnodeid_t)-1
 #define enter_panic_mode()	spin_lock(&nmi_lock)
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-pci.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-pci.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-pci.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-pci.c	2006-06-12 17:49:48.000000000 -0700
@@ -260,6 +260,12 @@
 	return str;
 }
 
+/*
+ * Device might live on a subordinate PCI bus.  XXX Walk up the chain of buses
+ * to find the slot number in sense of the bridge device register.
+ * XXX This also means multiple devices might rely on conflicting bridge
+ * settings.
+ */
 
 static void __init pci_disable_swapping(struct pci_dev *dev)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-reset.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-reset.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-reset.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-reset.c	2005-11-08 06:24:35.000000000 -0800
@@ -31,14 +31,24 @@
 
 #define noreturn while(1);				/* Silence gcc.  */
 
+/* XXX How to pass the reboot command to the firmware??? */
 static void ip27_machine_restart(char *command)
 {
+#if 0
+	int i;
+#endif
 
 	printk("Reboot started from CPU %d\n", smp_processor_id());
 #ifdef CONFIG_SMP
 	smp_send_stop();
 #endif
+#if 0
+	for (i = 0; i < numnodes; i++)
+		REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG,
+							PROMOP_REBOOT);
+#else
 	LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
+#endif
 	noreturn;
 }
 
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-setup.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-setup.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-setup.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -52,6 +52,7 @@
 	                 >> NSRI_NODEID_SHFT);
 }
 
+/* Extracted from the IOC3 meta driver.  FIXME.  */
 static inline void ioc3_sio_init(void)
 {
 	struct ioc3 *ioc3;
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-timer.c linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-timer.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip27/ip27-timer.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip27/ip27-timer.c	2006-06-12 17:49:48.000000000 -0700
@@ -90,7 +90,7 @@
 	return retval;
 }
 
-#define IP27_TIMER_IRQ	9			
+#define IP27_TIMER_IRQ	9			/* XXX Assign number */
 
 void rt_timer_interrupt(struct pt_regs *regs)
 {
@@ -198,7 +198,7 @@
 	irq->handler = no_action;
 
 	/* setup irqaction */
-//	setup_irq(IP27_TIMER_IRQ, irq);		
+//	setup_irq(IP27_TIMER_IRQ, irq);		/* XXX Can't do this yet.  */
 }
 
 void __init ip27_time_init(void)
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip32/crime.c linux-2.4.20-WRTstp/arch/mips/sgi-ip32/crime.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip32/crime.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip32/crime.c	2005-11-08 06:24:35.000000000 -0800
@@ -22,6 +22,7 @@
 		(unsigned long) CRIME_BASE);
 }
 
+/* XXX Like on Sun, these give us various useful information to printk. */
 void crime_memerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
 {
 	u64 memerr = crime_read_64 (CRIME_MEM_ERROR_STAT);
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-irq.c linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-irq.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-irq.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-irq.c	2006-06-12 17:49:48.000000000 -0700
@@ -260,7 +260,7 @@
 {
 	enable_macepci_irq (irq);
 
-	return 0; 
+	return 0; /* XXX */
 }
 
 static void disable_macepci_irq(unsigned int irq)
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-pci.c linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-pci.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-pci.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-pci.c	2006-06-12 17:49:48.000000000 -0700
@@ -366,6 +366,7 @@
 	pci_fixup_irqs (macepci_swizzle, macepci_map_irq);
 }
 
+/* XXX anybody know what this is supposed to do? */
 void __init pcibios_fixup_pbus_ranges(struct pci_bus * bus,
 	struct pbus_set_ranges_data * ranges)
 {
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-setup.c linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-setup.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-setup.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -100,5 +100,6 @@
 
 int __init page_is_ram (unsigned long pagenr)
 {
+	/* XXX: to do? */
 	return 1;
 }
diff -ruN linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-timer.c linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-timer.c
--- linux-2.4.20-WRT/arch/mips/sgi-ip32/ip32-timer.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sgi-ip32/ip32-timer.c	2006-06-12 17:49:48.000000000 -0700
@@ -102,6 +102,11 @@
 	}
 }
 
+/*
+ * On MIPS only R4000 and better have a cycle counter.
+ *
+ * FIXME: Does playing with the RP bit in c0_status interfere with this code?
+ */
 static unsigned long do_gettimeoffset(void)
 {
 	u32 count;
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/cfe/cfe_api.c linux-2.4.20-WRTstp/arch/mips/sibyte/cfe/cfe_api.c
--- linux-2.4.20-WRT/arch/mips/sibyte/cfe/cfe_api.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/cfe/cfe_api.c	2006-06-12 17:49:48.000000000 -0700
@@ -284,6 +284,11 @@
 	info->fwi_bootarea_pa = xiocb.plist.xiocb_fwinfo.fwi_bootarea_pa;
 	info->fwi_bootarea_size =
 	    xiocb.plist.xiocb_fwinfo.fwi_bootarea_size;
+#if 0
+	info->fwi_reserved1 = xiocb.plist.xiocb_fwinfo.fwi_reserved1;
+	info->fwi_reserved2 = xiocb.plist.xiocb_fwinfo.fwi_reserved2;
+	info->fwi_reserved3 = xiocb.plist.xiocb_fwinfo.fwi_reserved3;
+#endif
 
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/sb1250/bcm1250_tbprof.c linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/bcm1250_tbprof.c
--- linux-2.4.20-WRT/arch/mips/sibyte/sb1250/bcm1250_tbprof.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/bcm1250_tbprof.c	2006-06-12 18:15:49.000000000 -0700
@@ -60,6 +60,8 @@
 {
         unsigned long long scdperfcnt;
 	unsigned long long next = (1ULL << 40) - TB_PERIOD;
+	/* Generate an SCD_PERFCNT interrupt in TB_PERIOD Zclks to
+	   trigger start of trace.  XXX vary sampling period */
 	out64(0, KSEG1 + A_SCD_PERF_CNT_1);
 	scdperfcnt = in64(KSEG1 + A_SCD_PERF_CNT_CFG);
 	/* Unfortunately, in Pass 2 we must clear all counters to knock down
@@ -82,6 +84,7 @@
 	int i;
 	DBG(printk(DEVNAME ": tb_intr\n"));
 	if (sbp->next_tb_sample < MAX_TB_SAMPLES) {
+		/* XXX should use XKPHYS to make writes bypass L2 */
 		unsigned long long *p = sbp->sbprof_tbbuf[sbp->next_tb_sample++];
 		/* Read out trace */
 		out64(M_SCD_TRACE_CFG_START_READ, KSEG1 + A_SCD_TRACE_CFG);
@@ -273,7 +276,7 @@
 }
 
 static ssize_t sbprof_tb_read(struct file *filp, char *buf,
-			   size_t size, loff_t *offp)
+			      size_t size, loff_t *offp)
 {
 	int cur_sample, sample_off, cur_count, sample_left;
 	char *src;
@@ -313,9 +316,9 @@
 #define SBPROF_ZBFULL	_IOW('s', 2, int)
 
 static int sbprof_tb_ioctl(struct inode *inode,
-			struct file *filp,
-			unsigned int command,
-			unsigned long arg)
+			   struct file *filp,
+			   unsigned int command,
+			   unsigned long arg)
 {
 	int error = 0;
 	int full;
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/sb1250/irq.c linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/irq.c
--- linux-2.4.20-WRT/arch/mips/sibyte/sb1250/irq.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/irq.c	2006-06-12 18:15:49.000000000 -0700
@@ -164,7 +164,7 @@
 			irq_desc[i].handler = &sb1250_irq_type;
 		else
 			irq_desc[i].handler = &no_irq_type;
-	}
+		}
 }
 
 
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/sb1250/Makefile linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/Makefile
--- linux-2.4.20-WRT/arch/mips/sibyte/sb1250/Makefile	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/Makefile	2006-06-12 18:15:49.000000000 -0700
@@ -4,10 +4,10 @@
 
 obj-y := setup.o irq.o irq_handler.o time.o
 
-obj-$(CONFIG_PCI)		+= pci.o
-obj-$(CONFIG_SMP)		+= smp.o
+obj-$(CONFIG_PCI)			+= pci.o
+obj-$(CONFIG_SMP)			+= smp.o
 obj-$(CONFIG_BCM1250_TBPROF)	+= bcm1250_tbprof.o
 obj-$(CONFIG_MIPS32)		+= lib_hssubr.o
-obj-$(CONFIG_SIBYTE_STANDALONE)	+= prom.o
+obj-$(CONFIG_SIBYTE_STANDALONE)		+= prom.o
 
 include $(TOPDIR)/Rules.make
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/sb1250/pci.c linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/pci.c
--- linux-2.4.20-WRT/arch/mips/sibyte/sb1250/pci.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/pci.c	2006-06-12 18:15:49.000000000 -0700
@@ -106,7 +106,7 @@
 	u32 data = 0;
 	u32 cfgaddr = CFGADDR(dev, where);
 
-	data = READCFG32(cfgaddr);
+		data = READCFG32(cfgaddr);
 
 	/*
 	 * If the LDT was not configured, make it look like the bridge
@@ -132,7 +132,7 @@
 	if (where & 1)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	data = READCFG32(cfgaddr);
+		data = READCFG32(cfgaddr);
 
 	/*
 	 * If the LDT was not configured, make it look like the bridge
@@ -157,7 +157,7 @@
 	if (where & 3)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	data = READCFG32(cfgaddr);
+		data = READCFG32(cfgaddr);
 
 	/*
 	 * If the LDT was not configured, make it look like the bridge
@@ -180,12 +180,12 @@
 	u32 data = 0;
 	u32 cfgaddr = CFGADDR(dev, where);
 
-	data = READCFG32(cfgaddr);
+		data = READCFG32(cfgaddr);
 
-	data = (data & ~(0xff << ((where & 3) << 3))) |
-	    (val << ((where & 3) << 3));
+		data = (data & ~(0xff << ((where & 3) << 3))) |
+		    (val << ((where & 3) << 3));
 
-	WRITECFG32(cfgaddr, data);
+		WRITECFG32(cfgaddr, data);
 
 	return PCIBIOS_SUCCESSFUL;
 }
@@ -199,12 +199,12 @@
 	if (where & 1)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	data = READCFG32(cfgaddr);
+		data = READCFG32(cfgaddr);
 
-	data = (data & ~(0xffff << ((where & 3) << 3))) |
-	    (val << ((where & 3) << 3));
+		data = (data & ~(0xffff << ((where & 3) << 3))) |
+		    (val << ((where & 3) << 3));
 
-	WRITECFG32(cfgaddr, data);
+		WRITECFG32(cfgaddr, data);
 
 	return PCIBIOS_SUCCESSFUL;
 }
@@ -217,7 +217,7 @@
 	if (where & 3)
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	WRITECFG32(cfgaddr, val);
+		WRITECFG32(cfgaddr, val);
 
 	return PCIBIOS_SUCCESSFUL;
 }
@@ -244,11 +244,11 @@
 	cmdreg = READCFG32((A_PCI_TYPE00_HEADER | MATCH_BITS) +
 			   PCI_COMMAND);
 
-	if (!(cmdreg & PCI_COMMAND_MASTER)) {
-		printk
-		    ("PCI: Skipping PCI probe.  Bus is not initialized.\n");
-		return;
-	}
+		if (!(cmdreg & PCI_COMMAND_MASTER)) {
+			printk
+			    ("PCI: Skipping PCI probe.  Bus is not initialized.\n");
+			return;
+		}
 
 	reg = *((volatile uint64_t *) KSEG1ADDR(A_SCD_SYSTEM_CFG));
 	if (!(reg & M_SYS_PCI_HOST)) {
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/sb1250/smp.c linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/smp.c
--- linux-2.4.20-WRT/arch/mips/sibyte/sb1250/smp.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/sb1250/smp.c	2006-06-12 17:49:48.000000000 -0700
@@ -110,6 +110,7 @@
 	init_idle();
 	__cpu_number_map[0] = 0;
 	__cpu_logical_map[0] = 0;
+	/* smp_tune_scheduling();  XXX */
 
 	/*
 	 * This loop attempts to compensate for "holes" in the CPU
diff -ruN linux-2.4.20-WRT/arch/mips/sibyte/swarm/setup.c linux-2.4.20-WRTstp/arch/mips/sibyte/swarm/setup.c
--- linux-2.4.20-WRT/arch/mips/sibyte/swarm/setup.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sibyte/swarm/setup.c	2006-06-12 18:15:49.000000000 -0700
@@ -86,11 +86,11 @@
 
 	panic_timeout = 5;  /* For debug.  */
 
-        board_timer_setup = swarm_timer_setup;
-
-        rtc_get_time = xicor_get_time;
-        rtc_set_time = xicor_set_time;
+	board_timer_setup = swarm_timer_setup;
 
+		rtc_get_time = xicor_get_time;
+		rtc_set_time = xicor_set_time;
+ 
 #ifdef CONFIG_L3DEMO
 	if (l3info != NULL) {
 		printk("\n");
diff -ruN linux-2.4.20-WRT/arch/mips/sni/pci.c linux-2.4.20-WRTstp/arch/mips/sni/pci.c
--- linux-2.4.20-WRT/arch/mips/sni/pci.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sni/pci.c	2006-06-12 18:15:49.000000000 -0700
@@ -27,6 +27,43 @@
 	         (where  & 0xfc);                                            \
 } while(0)
 
+#if 0
+/* To do:  Bring this uptodate ...  */
+static void pcimt_pcibios_fixup (void)
+{
+	struct pci_dev *dev;
+
+	pci_for_each_dev(dev) {
+		/*
+		 * TODO: Take care of RM300 revision D boards for where the
+		 * network slot became an ordinary PCI slot.
+		 */
+		if (dev->devfn == PCI_DEVFN(1, 0)) {
+			/* Evil hack ...  */
+			set_cp0_config(CONF_CM_CMASK, CONF_CM_CACHABLE_NO_WA);
+			dev->irq = PCIMT_IRQ_SCSI;
+			continue;
+		}
+		if (dev->devfn == PCI_DEVFN(2, 0)) {
+			dev->irq = PCIMT_IRQ_ETHERNET;
+			continue;
+		}
+
+		switch(dev->irq) {
+		case 1 ... 4:
+			dev->irq += PCIMT_IRQ_INTA - 1;
+			break;
+		case 0:
+			break;
+		default:
+			printk("PCI device on bus %d, dev %d, function %d "
+			       "impossible interrupt configured.\n",
+			       dev->bus->number, PCI_SLOT(dev->devfn),
+			       PCI_SLOT(dev->devfn));
+		}
+	}
+}
+#endif
 
 /*
  * We can't address 8 and 16 bit words directly.  Instead we have to
diff -ruN linux-2.4.20-WRT/arch/mips/sni/reset.c linux-2.4.20-WRTstp/arch/mips/sni/reset.c
--- linux-2.4.20-WRT/arch/mips/sni/reset.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sni/reset.c	1997-06-26 12:33:38.000000000 -0700
@@ -23,6 +23,7 @@
 			break;
 }
 
+/* XXX This ends up at the ARC firmware prompt ...  */
 void sni_machine_restart(char *command)
 {
 	int i, j;
diff -ruN linux-2.4.20-WRT/arch/mips/sni/setup.c linux-2.4.20-WRTstp/arch/mips/sni/setup.c
--- linux-2.4.20-WRT/arch/mips/sni/setup.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/sni/setup.c	2006-06-12 17:49:48.000000000 -0700
@@ -94,6 +94,7 @@
 
 	request_region(0x00,0x20,"dma1");
 	request_region(0x40,0x20,"timer");
+	/* XXX FIXME: CONFIG_RTC */
 	request_region(0x70,0x10,"rtc");
 	request_region(0x80,0x10,"dma page reg");
 	request_region(0xc0,0x20,"dma2");
diff -ruN linux-2.4.20-WRT/arch/mips/vr4181/common/serial.c linux-2.4.20-WRTstp/arch/mips/vr4181/common/serial.c
--- linux-2.4.20-WRT/arch/mips/vr4181/common/serial.c	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips/vr4181/common/serial.c	2006-06-12 17:49:48.000000000 -0700
@@ -12,6 +12,13 @@
  *
  */
 
+/*
+ * [jsun, 010925]
+ * You need to make sure rs_table has at least one element in
+ * drivers/char/serial.c file.	There is no good way to do it right
+ * now.	 A workaround is to include CONFIG_SERIAL_MANY_PORTS in your
+ * configure file, which would gives you 64 ports and wastes 11K ram.
+ */
 
 #include <linux/types.h>
 #include <linux/kernel.h>
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/cpu-probe.c linux-2.4.20-WRTstp/arch/mips64/kernel/cpu-probe.c
--- linux-2.4.20-WRT/arch/mips64/kernel/cpu-probe.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/cpu-probe.c	2006-06-12 17:49:48.000000000 -0700
@@ -148,6 +148,19 @@
 
 	printk("yes, workaround... ");
 	local_irq_save(flags);
+	/*
+	 * We want the multiply and the shift to be isolated from the
+	 * rest of the code to disable gcc optimizations.  Hence the
+	 * asm statements that execute nothing, but make gcc not know
+	 * what the values of m1, m2 and s are and what v and p are
+	 * used for.
+	 *
+	 * We have to use single integers for m1 and m2 and a double
+	 * one for p to be sure the mulsidi3 gcc's RTL multiplication
+	 * instruction has the workaround applied.  Older versions of
+	 * gcc have correct mulsi3, but other multiplication variants
+	 * lack the workaround.
+	 */
 	asm volatile(
 		""
 		: "=r" (m1), "=r" (m2), "=r" (s)
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/irq.c linux-2.4.20-WRTstp/arch/mips64/kernel/irq.c
--- linux-2.4.20-WRT/arch/mips64/kernel/irq.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/irq.c	2005-11-08 06:24:35.000000000 -0800
@@ -534,6 +534,7 @@
 	int retval;
 	struct irqaction * action;
 
+#if 1
 	/*
 	 * Sanity-check: shared interrupts should REALLY pass in
 	 * a real dev-ID, otherwise we'll have trouble later trying
@@ -544,6 +545,7 @@
 		if (!dev_id)
 			printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
 	}
+#endif
 
 	if (irq >= NR_IRQS)
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/linux32.c linux-2.4.20-WRTstp/arch/mips64/kernel/linux32.c
--- linux-2.4.20-WRT/arch/mips64/kernel/linux32.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/linux32.c	2006-06-12 18:15:49.000000000 -0700
@@ -256,6 +256,189 @@
 	return ret;
 }
 
+#if 0
+/*
+ * count32() counts the number of arguments/envelopes
+ */
+static int count32(u32 * argv, int max)
+{
+	int i = 0;
+
+	if (argv != NULL) {
+		for (;;) {
+			u32 p;
+			/* egcs is stupid */
+			if (!access_ok(VERIFY_READ, argv, sizeof (u32)))
+				return -EFAULT;
+			__get_user(p,argv);
+			if (!p)
+				break;
+			argv++;
+			if(++i > max)
+				return -E2BIG;
+		}
+	}
+	return i;
+}
+
+
+/*
+ * 'copy_strings32()' copies argument/envelope strings from user
+ * memory to free pages in kernel mem. These are in a format ready
+ * to be put directly into the top of new user memory.
+ */
+int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm)
+{
+	while (argc-- > 0) {
+		u32 str;
+		int len;
+		unsigned long pos;
+
+		if (get_user(str, argv+argc) || !str ||
+		     !(len = strnlen_user((char *)A(str), bprm->p)))
+			return -EFAULT;
+		if (bprm->p < len)
+			return -E2BIG;
+
+		bprm->p -= len;
+		/* XXX: add architecture specific overflow check here. */
+
+		pos = bprm->p;
+		while (len > 0) {
+			char *kaddr;
+			int i, new, err;
+			struct page *page;
+			int offset, bytes_to_copy;
+
+			offset = pos % PAGE_SIZE;
+			i = pos/PAGE_SIZE;
+			page = bprm->page[i];
+			new = 0;
+			if (!page) {
+				page = alloc_page(GFP_HIGHUSER);
+				bprm->page[i] = page;
+				if (!page)
+					return -ENOMEM;
+				new = 1;
+			}
+			kaddr = kmap(page);
+
+			if (new && offset)
+				memset(kaddr, 0, offset);
+			bytes_to_copy = PAGE_SIZE - offset;
+			if (bytes_to_copy > len) {
+				bytes_to_copy = len;
+				if (new)
+					memset(kaddr+offset+len, 0,
+					       PAGE_SIZE-offset-len);
+			}
+			err = copy_from_user(kaddr + offset, (char *)A(str),
+			                     bytes_to_copy);
+			flush_page_to_ram(page);
+			kunmap(page);
+
+			if (err)
+				return -EFAULT;
+
+			pos += bytes_to_copy;
+			str += bytes_to_copy;
+			len -= bytes_to_copy;
+		}
+	}
+	return 0;
+}
+
+
+/*
+ * sys_execve32() executes a new program.
+ */
+int do_execve32(char * filename, u32 * argv, u32 * envp, struct pt_regs * regs)
+{
+	struct linux_binprm bprm;
+	struct dentry * dentry;
+	int retval;
+	int i;
+
+	bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
+	memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));
+
+	dentry = open_namei(filename, 0, 0);
+	retval = PTR_ERR(dentry);
+	if (IS_ERR(dentry))
+		return retval;
+
+	bprm.dentry = dentry;
+	bprm.filename = filename;
+	bprm.sh_bang = 0;
+	bprm.loader = 0;
+	bprm.exec = 0;
+	if ((bprm.argc = count32(argv, bprm.p / sizeof(u32))) < 0) {
+		dput(dentry);
+		return bprm.argc;
+	}
+
+	if ((bprm.envc = count32(envp, bprm.p / sizeof(u32))) < 0) {
+		dput(dentry);
+		return bprm.envc;
+	}
+
+	retval = prepare_binprm(&bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = copy_strings_kernel(1, &bprm.filename, &bprm);
+	if (retval < 0)
+		goto out;
+
+	bprm.exec = bprm.p;
+	retval = copy_strings32(bprm.envc, envp, &bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = copy_strings32(bprm.argc, argv, &bprm);
+	if (retval < 0)
+		goto out;
+
+	retval = search_binary_handler(&bprm,regs);
+	if (retval >= 0)
+		/* execve success */
+		return retval;
+
+out:
+	/* Something went wrong, return the inode and free the argument pages*/
+	if (bprm.dentry)
+		dput(bprm.dentry);
+
+	/* Assumes that free_page() can take a NULL argument. */
+	/* I hope this is ok for all architectures */
+	for (i = 0 ; i < MAX_ARG_PAGES ; i++)
+		if (bprm.page[i])
+			__free_page(bprm.page[i]);
+
+	return retval;
+}
+
+/*
+ * sys_execve() executes a new program.
+ */
+asmlinkage int sys32_execve(abi64_no_regargs, struct pt_regs regs)
+{
+	int error;
+	char * filename;
+
+	filename = getname((char *) (long)regs.regs[4]);
+	printk("Executing: %s\n", filename);
+	error = PTR_ERR(filename);
+	if (IS_ERR(filename))
+		goto out;
+	error = do_execve32(filename, (u32 *) (long)regs.regs[5],
+	                  (u32 *) (long)regs.regs[6], &regs);
+	putname(filename);
+
+out:
+	return error;
+}
+#else
 static int nargs(unsigned int arg, char **ap)
 {
 	char *ptr;
@@ -2334,6 +2517,7 @@
 	fput(sock->file);
 }
 
+/* XXX This really belongs in some header file... -DaveM */
 #define MAX_SOCK_ADDR	128		/* 108 for Unix domain - 
 					   16 for IP, 16 for IPX,
 					   24 for IPv6,
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/ptrace.c linux-2.4.20-WRTstp/arch/mips64/kernel/ptrace.c
--- linux-2.4.20-WRT/arch/mips64/kernel/ptrace.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/ptrace.c	2006-06-12 17:49:48.000000000 -0700
@@ -267,6 +267,11 @@
 	int ret;
 
 	lock_kernel();
+#if 0
+	printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
+	       (int) request, (int) pid, (unsigned long) addr,
+	       (unsigned long) data);
+#endif
 	ret = -EPERM;
 	if (request == PTRACE_TRACEME) {
 		/* are we already being traced? */
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/scall_o32.S linux-2.4.20-WRTstp/arch/mips64/kernel/scall_o32.S
--- linux-2.4.20-WRT/arch/mips64/kernel/scall_o32.S	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/scall_o32.S	2006-06-12 17:49:49.000000000 -0700
@@ -38,7 +38,14 @@
 	daddiu	t1, 4			# skip to next instruction
 	beqz	t0, not_o32_scall
 	sd	t1, PT_EPC(sp)
+#if 0
+ SAVE_ALL
+ move a1, v0
+ PRINT("Scall %ld\n")
+ RESTORE_ALL
+#endif
 
+	/* XXX Put both in one cacheline, should save a bit. */
 	dsll	t0, v0, 3		# offset into table
 	ld	t2, (sys_call_table - (__NR_O32_Linux * 8))(t0)
 	lbu	t3, (sys_narg_table - __NR_O32_Linux)(v0)
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/setup.c linux-2.4.20-WRTstp/arch/mips64/kernel/setup.c
--- linux-2.4.20-WRT/arch/mips64/kernel/setup.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/setup.c	2006-06-12 18:15:49.000000000 -0700
@@ -205,6 +205,12 @@
 	print_memory_map();
 
 	for (;;) {
+		/*
+		 * "mem=XXX[kKmM]" defines a memory region from
+		 * 0 to <XXX>, overriding the determined size.
+		 * "mem=XXX[KkmM]@YYY[KkmM]" defines a memory region from
+		 * <YYY> to <YYY>+<XXX>, overriding the determined size.
+		 */
 		if (c == ' ' && !memcmp(from, "mem=", 4)) {
 			if (to != command_line)
 				to--;
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/signal32.c linux-2.4.20-WRTstp/arch/mips64/kernel/signal32.c
--- linux-2.4.20-WRT/arch/mips64/kernel/signal32.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/signal32.c	2006-06-12 17:49:49.000000000 -0700
@@ -147,6 +147,7 @@
         size_t sigsetsize;
 
 	save_static(&regs);
+	/* XXX Don't preclude handling different sized sigset_t's.  */
 	sigsetsize = regs.regs[5];
 	if (sigsetsize != sizeof(sigset32_t))
 		return -EINVAL;
@@ -844,6 +845,7 @@
 	struct k_sigaction new_sa, old_sa;
 	int ret = -EINVAL;
 
+	/* XXX: Don't preclude handling different sized sigset_t's.  */
 	if (sigsetsize != sizeof(sigset_t))
 		goto out;
 
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/signal.c linux-2.4.20-WRTstp/arch/mips64/kernel/signal.c
--- linux-2.4.20-WRT/arch/mips64/kernel/signal.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/signal.c	2006-06-12 18:15:49.000000000 -0700
@@ -81,6 +81,7 @@
 
 	save_static(&regs);
 
+	/* XXX Don't preclude handling different sized sigset_t's.  */
 	sigsetsize = regs.regs[5];
 	if (sigsetsize != sizeof(sigset_t))
 		return -EINVAL;
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/smp.c linux-2.4.20-WRTstp/arch/mips64/kernel/smp.c
--- linux-2.4.20-WRT/arch/mips64/kernel/smp.c	2003-10-14 01:00:42.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/smp.c	2006-06-12 18:05:27.000000000 -0700
@@ -88,6 +88,10 @@
 
 void __init smp_callin(void)
 {
+#if 0
+	calibrate_delay();
+	smp_store_cpu_info(cpuid);
+#endif
 }
 
 #ifndef CONFIG_SGI_IP27
@@ -102,6 +106,10 @@
 	prom_init_secondary();
 	per_cpu_trap_init();
 
+	/*
+	 * XXX parity protection should be folded in here when it's converted
+	 * to an option instead of something based on .cputype
+	 */
 	pgd_current[cpu] = init_mm.pgd;
 	cpu_data[cpu].udelay_val = loops_per_jiffy;
 	prom_smp_finish();
@@ -170,6 +178,7 @@
 			core_send_ipi(i, SMP_CALL_FUNCTION);
 
 	/* Wait for response */
+	/* FIXME: lock-up detection, backtrace on lock-up */
 	while (atomic_read(&data.started) != cpus)
 		barrier();
 
@@ -188,7 +197,7 @@
 	int wait = call_data->wait;
 	int cpu = smp_processor_id();
 
-	irq_enter(cpu, 0);	
+	irq_enter(cpu, 0);	/* XXX choose an irq number? */
 	/*
 	 * Notify initiating CPU that I've grabbed the data and am
 	 * about to execute the function.
@@ -204,7 +213,7 @@
 		mb();
 		atomic_inc(&call_data->finished);
 	}
-	irq_exit(cpu, 0);	
+	irq_exit(cpu, 0);	/* XXX choose an irq number? */
 }
 
 static void stop_this_cpu(void *dummy)
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/syscall.c linux-2.4.20-WRTstp/arch/mips64/kernel/syscall.c
--- linux-2.4.20-WRT/arch/mips64/kernel/syscall.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/syscall.c	2006-06-12 17:49:49.000000000 -0700
@@ -176,6 +176,11 @@
 	return error;
 }
 
+/*
+ * Do the indirect syscall syscall.
+ *
+ * XXX This is borken.
+ */
 asmlinkage int sys_syscall(abi64_no_regargs, struct pt_regs regs)
 {
 	return -ENOSYS;
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/traps.c linux-2.4.20-WRTstp/arch/mips64/kernel/traps.c
--- linux-2.4.20-WRT/arch/mips64/kernel/traps.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/traps.c	2006-06-12 18:15:49.000000000 -0700
@@ -408,6 +408,9 @@
 	force_sig_info(SIGFPE, &info, current);
 }
 
+/*
+ * XXX Delayed fp exceptions when doing a lazy ctx switch XXX
+ */
 asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
 {
 	if (fcr31 & FPU_CSR_UNI_X) {
@@ -783,6 +786,6 @@
 
 	flush_icache_range(KSEG0, KSEG0 + 0x400);
 
-	atomic_inc(&init_mm.mm_count);	
+	atomic_inc(&init_mm.mm_count);	/* XXX UP?  */
 	current->active_mm = &init_mm;
 }
diff -ruN linux-2.4.20-WRT/arch/mips64/kernel/unaligned.c linux-2.4.20-WRTstp/arch/mips64/kernel/unaligned.c
--- linux-2.4.20-WRT/arch/mips64/kernel/unaligned.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/kernel/unaligned.c	2006-06-12 18:15:49.000000000 -0700
@@ -500,6 +500,10 @@
 {
 	unsigned long *regptr, newval;
 	extern int do_dsemulret(struct pt_regs *);
+#if 0
+        printk("ade: Cpu%d[%s:%d:%0lx:%0lx]\n", smp_processor_id(),
+                current->comm, current->pid, regs->cp0_badvaddr, regs->cp0_epc);
+#endif
 	mm_segment_t seg;
 	unsigned long pc;
 
diff -ruN linux-2.4.20-WRT/arch/mips64/lib/csum_partial.S linux-2.4.20-WRTstp/arch/mips64/lib/csum_partial.S
--- linux-2.4.20-WRT/arch/mips64/lib/csum_partial.S	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/lib/csum_partial.S	2001-09-09 10:43:01.000000000 -0700
@@ -226,7 +226,7 @@
 	andi	ta2, a1, 0x3
 
 small_memcpy:
- j small_csumcpy; move a1, ta2		
+ j small_csumcpy; move a1, ta2		/* XXX ??? */
 	beqz	t2, out
 	 move	a1, ta2
 
diff -ruN linux-2.4.20-WRT/arch/mips64/Makefile linux-2.4.20-WRTstp/arch/mips64/Makefile
--- linux-2.4.20-WRT/arch/mips64/Makefile	2003-07-04 01:11:15.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/Makefile	2006-06-12 18:15:49.000000000 -0700
@@ -268,8 +268,8 @@
 # (In fact, this just uses the exact same support as the BCM912500A (SWARM).)
 #
 ifdef CONFIG_SIBYTE_RHONE
-LIBS          += arch/mips/sibyte/swarm/sbswarm.a
-SUBDIRS       += arch/mips/sibyte/swarm
+LIBS		+= arch/mips/sibyte/swarm/sbswarm.a
+SUBDIRS		+= arch/mips/sibyte/swarm
 endif
 
 #
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/c-r4k.c linux-2.4.20-WRTstp/arch/mips64/mm/c-r4k.c
--- linux-2.4.20-WRT/arch/mips64/mm/c-r4k.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/c-r4k.c	2006-06-12 18:15:49.000000000 -0700
@@ -955,6 +955,7 @@
 #ifdef R4600_V2_HIT_CACHEOP_WAR
 		unsigned long flags;
 
+		/* Workaround for R4600 bug.  See comment in <asm/war>. */
 		local_irq_save(flags);
 		*(volatile unsigned long *)KSEG1;
 #endif
@@ -1002,6 +1003,7 @@
 #ifdef R4600_V2_HIT_CACHEOP_WAR
 		unsigned long flags;
 
+		/* Workaround for R4600 bug.  See comment in <asm/war>. */
 		local_irq_save(flags);
 		*(volatile unsigned long *)KSEG1;
 #endif
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/c-sb1.c linux-2.4.20-WRTstp/arch/mips64/mm/c-sb1.c
--- linux-2.4.20-WRT/arch/mips64/mm/c-sb1.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/c-sb1.c	2006-06-12 18:15:49.000000000 -0700
@@ -73,7 +73,7 @@
 		"1:   cache  %3, 0($1)      \n" /* Invalidate this index */
 		"     daddiu %1, %1, -1     \n" /* Decrement loop count */
 		"     bnez   %1, 1b         \n" /* loop test */
-		"      daddu   $1, $1, %0    \n" /* Next address */
+		"      daddu $1, $1, %0     \n" /* Next address */
 		".set pop                   \n"
 		:
 		: "r" (dcache_line_size), "r" (dcache_sets * dcache_assoc),
@@ -85,10 +85,10 @@
 	unsigned long end)
 {
 	__asm__ __volatile__ (
-	"	.set	push		\n"
-	"	.set	noreorder	\n"
-	"	.set	noat		\n"
-	"	.set	mips4		\n"
+		"	.set	push		\n"
+		"	.set	noreorder	\n"
+		"	.set	noat		\n"
+		"	.set	mips4		\n"
 	"1:	cache	%3, (0<<13)(%0)	\n" /* Index-WB-inval this address */
 	"	cache	%3, (1<<13)(%0)	\n" /* Index-WB-inval this address */
 	"	cache	%3, (2<<13)(%0)	\n" /* Index-WB-inval this address */
@@ -98,15 +98,15 @@
 	"	cache	%3, (1<<13)($1)	\n" /* Index-WB-inval this address */
 	"	cache	%3, (2<<13)($1)	\n" /* Index-WB-inval this address */
 	"	cache	%3, (3<<13)($1)	\n" /* Index-WB-inval this address */
-	"	bne	%0, %1, 1b	\n" /* loop test */
+		"	bne	%0, %1, 1b	\n" /* loop test */
 	"	 addu	%0, %0, %2	\n" /* next line */
-	"	sync			\n"
-	"	.set pop		\n"
-	:
-	: "r" (start  & ~(dcache_line_size - 1)),
+		"	sync			\n"
+		"	.set pop		\n"
+		:
+		: "r" (start  & ~(dcache_line_size - 1)),
 	  "r" ((end - 1) & ~(dcache_line_size - 1)),
-	  "r" (dcache_line_size),
-	  "i" (Index_Writeback_Inv_D));
+		  "r" (dcache_line_size),
+		  "i" (Index_Writeback_Inv_D));
 }
 
 
@@ -119,9 +119,9 @@
 		".set mips4                 \n"
 		"     move   $1, %2         \n" /* Start at index 0 */
 		"1:   cache  %3, 0($1)       \n" /* Invalidate this index */
-		"     daddiu  %1, %1, -1     \n" /* Decrement loop count */
+		"     daddiu %1, %1, -1     \n" /* Decrement loop count */
 		"     bnez   %1, 1b         \n" /* loop test */
-		"      daddu   $1, $1, %0    \n" /* Next address */
+		"      daddu $1, $1, %0     \n" /* Next address */
 		".set pop                   \n"
 		:
 		: "r" (icache_line_size), "r" (icache_sets * icache_assoc),
@@ -177,8 +177,8 @@
 		return;
 	}
 
-	__sb1_writeback_inv_dcache_range(start, end);
-
+		__sb1_writeback_inv_dcache_range(start, end);
+	
 	__asm__ __volatile__ (
 		".set push                  \n"
 		".set noreorder             \n"
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/fault.c linux-2.4.20-WRTstp/arch/mips64/mm/fault.c
--- linux-2.4.20-WRT/arch/mips64/mm/fault.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/fault.c	2005-11-08 06:24:35.000000000 -0800
@@ -104,6 +104,10 @@
 	unsigned long fixup;
 	siginfo_t info;
 
+#if 0
+	printk("Cpu%d[%s:%d:%08lx:%ld:%08lx]\n", smp_processor_id(),
+		current->comm, current->pid, address, write, regs->cp0_epc);
+#endif
 
 	/*
 	 * We fault-in kernel-space virtual memory on-demand. The
@@ -182,6 +186,16 @@
 	if (user_mode(regs)) {
 		tsk->thread.cp0_badvaddr = address;
 		tsk->thread.error_code = write;
+#if 0
+		printk("do_page_fault() #2: sending SIGSEGV to %s for illegal %s\n"
+		       "%08lx (epc == %08lx, ra == %08lx)\n",
+		       tsk->comm,
+		       write ? "write access to" : "read access from",
+		       address,
+		       (unsigned long) regs->cp0_epc,
+		       (unsigned long) regs->regs[31]);
+while(1);
+#endif
 		info.si_signo = SIGSEGV;
 		info.si_errno = 0;
 		/* info.si_code has been set above */
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/init.c linux-2.4.20-WRTstp/arch/mips64/mm/init.c
--- linux-2.4.20-WRT/arch/mips64/mm/init.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/init.c	2006-06-12 17:49:49.000000000 -0700
@@ -113,6 +113,7 @@
 
 asmlinkage int sys_cacheflush(void *addr, int bytes, int cache)
 {
+	/* XXX Just get it working for now... */
 	flush_cache_l1();
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/loadmmu.c linux-2.4.20-WRTstp/arch/mips64/mm/loadmmu.c
--- linux-2.4.20-WRT/arch/mips64/mm/loadmmu.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/loadmmu.c	2006-06-12 17:49:49.000000000 -0700
@@ -60,7 +60,7 @@
 void __init load_mmu(void)
 {
 	if (mips_cpu.options & MIPS_CPU_4KTLB) {
-#if defined(CONFIG_CPU_R4300)						\
+#if defined (CONFIG_CPU_R4300)						\
     || defined (CONFIG_CPU_R4X00)					\
     || defined (CONFIG_CPU_R5000)					\
     || defined (CONFIG_CPU_NEVADA)
@@ -96,6 +96,12 @@
 		break;
 
 	default:
+		/* XXX We need an generic routine in the MIPS port
+		 * XXX to jabber stuff onto the screen on all machines
+		 * XXX before the console is setup.  The ARCS prom
+		 * XXX routines look good for this, but only the SGI
+		 * XXX code has a full library for that at this time.
+		 */
 		panic("Yeee, unsupported mmu/cache architecture or "
 		      "wrong compiletime kernel configuration.");
 	}
diff -ruN linux-2.4.20-WRT/arch/mips64/mm/tlb-sb1.c linux-2.4.20-WRTstp/arch/mips64/mm/tlb-sb1.c
--- linux-2.4.20-WRT/arch/mips64/mm/tlb-sb1.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/mips64/mm/tlb-sb1.c	2006-06-12 18:15:49.000000000 -0700
@@ -239,7 +239,7 @@
 		get_new_mmu_context(mm, smp_processor_id());
 		if (mm == current->active_mm) {
 			write_c0_entryhi(cpu_asid(cpu, mm));
-		}
+	}
 	}
 	local_irq_restore(flags);
 }
diff -ruN linux-2.4.20-WRT/arch/parisc/hpux/sys_hpux.c linux-2.4.20-WRTstp/arch/parisc/hpux/sys_hpux.c
--- linux-2.4.20-WRT/arch/parisc/hpux/sys_hpux.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/hpux/sys_hpux.c	2005-11-08 06:24:35.000000000 -0800
@@ -240,6 +240,10 @@
 	/*  HP-UX  utsname has no domainname field.  */
 
 	/*  TODO:  Implement idnumber!!!  */
+#if 0
+	error |= __put_user(0,name->idnumber);
+	error |= __put_user(0,name->idnumber+HPUX_SNLEN-1);
+#endif
 
 	error = error ? -EFAULT : 0;
 
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/cache.c linux-2.4.20-WRTstp/arch/parisc/kernel/cache.c
--- linux-2.4.20-WRT/arch/parisc/kernel/cache.c	2003-10-14 01:07:37.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/cache.c	2005-11-08 06:24:35.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.1.1.4 2003/10/14 08:07:37 sparq Exp $
+/* $Id: cache.c,v 1.4 2000/01/25 00:11:38 prumpf Exp $
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -116,6 +116,53 @@
 	if(pdc_cache_info(&cache_info)<0)
 		panic("cache_init: pdc_cache_info failed");
 
+#if 0
+	printk(KERN_DEBUG "ic_size %lx dc_size %lx it_size %lx pdc_cache_info %d*long pdc_cache_cf %d\n",
+	    cache_info.ic_size,
+	    cache_info.dc_size,
+	    cache_info.it_size,
+	    sizeof (struct pdc_cache_info) / sizeof (long),
+	    sizeof (struct pdc_cache_cf)
+	);
+
+	printk(KERN_DEBUG "dc base %x dc stride %x dc count %x dc loop %d\n",
+	    cache_info.dc_base,
+	    cache_info.dc_stride,
+	    cache_info.dc_count,
+	    cache_info.dc_loop);
+
+	printk(KERN_DEBUG "dc conf: alias %d block %d line %d wt %d sh %d cst %d assoc %d\n",
+	    cache_info.dc_conf.cc_alias,
+	    cache_info.dc_conf.cc_block,
+	    cache_info.dc_conf.cc_line,
+	    cache_info.dc_conf.cc_wt,
+	    cache_info.dc_conf.cc_sh,
+	    cache_info.dc_conf.cc_cst,
+	    cache_info.dc_conf.cc_assoc);
+
+	printk(KERN_DEBUG "ic conf: alias %d block %d line %d wt %d sh %d cst %d assoc %d\n",
+	    cache_info.ic_conf.cc_alias,
+	    cache_info.ic_conf.cc_block,
+	    cache_info.ic_conf.cc_line,
+	    cache_info.ic_conf.cc_wt,
+	    cache_info.ic_conf.cc_sh,
+	    cache_info.ic_conf.cc_cst,
+	    cache_info.ic_conf.cc_assoc);
+
+	printk(KERN_DEBUG "dt conf: sh %d page %d cst %d aid %d pad1 %d \n",
+	    cache_info.dt_conf.tc_sh,
+	    cache_info.dt_conf.tc_page,
+	    cache_info.dt_conf.tc_cst,
+	    cache_info.dt_conf.tc_aid,
+	    cache_info.dt_conf.tc_pad1);
+
+	printk(KERN_DEBUG "it conf: sh %d page %d cst %d aid %d pad1 %d \n",
+	    cache_info.it_conf.tc_sh,
+	    cache_info.it_conf.tc_page,
+	    cache_info.it_conf.tc_cst,
+	    cache_info.it_conf.tc_aid,
+	    cache_info.it_conf.tc_pad1);
+#endif
 
 	split_tlb = 0;
 	if (cache_info.dt_conf.tc_sh == 0 || cache_info.dt_conf.tc_sh == 2) {
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/ccio-dma.c linux-2.4.20-WRTstp/arch/parisc/kernel/ccio-dma.c
--- linux-2.4.20-WRT/arch/parisc/kernel/ccio-dma.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/ccio-dma.c	2005-11-08 06:24:35.000000000 -0800
@@ -369,9 +369,35 @@
 typedef unsigned long space_t;
 #define KERNEL_SPACE 0
 
+/*
+** DMA "Page Type" and Hints 
+** o if SAFE_DMA isn't set, mapping is for FAST_DMA. SAFE_DMA should be
+**   set for subcacheline DMA transfers since we don't want to damage the
+**   other part of a cacheline.
+** o SAFE_DMA must be set for "memory" allocated via pci_alloc_consistent().
+**   This bit tells U2 to do R/M/W for partial cachelines. "Streaming"
+**   data can avoid this if the mapping covers full cache lines.
+** o STOP_MOST is needed for atomicity across cachelines.
+**   Apperently only "some EISA devices" need this.
+**   Using CONFIG_ISA is hack. Only the IOA with EISA under it needs
+**   to use this hint iff the EISA devices needs this feature.
+**   According to the U2 ERS, STOP_MOST enabled pages hurt performance.
+** o PREFETCH should *not* be set for cases like Multiple PCI devices
+**   behind GSCtoPCI (dino) bus converter. Only one cacheline per GSC
+**   device can be fetched and multiply DMA streams will thrash the
+**   prefetch buffer and burn memory bandwidth. See 6.7.3 "Prefetch Rules
+**   and Invalidation of Prefetch Entries".
+**
+** FIXME: the default hints need to be per GSC device - not global.
+** 
+** HP-UX dorks: linux device driver programming model is totally different
+**    than HP-UX's. HP-UX always sets HINT_PREFETCH since it's drivers
+**    do special things to work on non-coherent platforms...linux has to
+**    be much more careful with this.
+*/
 #define IOPDIR_VALID    0x01UL
 #define HINT_SAFE_DMA   0x02UL	/* used for pci_alloc_consistent() pages */
-#ifdef CONFIG_ISA	    /* EISA support really */
+#ifdef CONFIG_ISA	/* EISA support really */
 #define HINT_STOP_MOST  0x04UL	/* LSL support */
 #else
 #define HINT_STOP_MOST  0x00UL	/* only needed for "some EISA devices" */
@@ -469,10 +495,31 @@
 	((u32 *)pdir_ptr)[0] = (u32) pa;
 
 
+	/* FIXME: PCX_W platforms don't need FDC/SYNC. (eg C360)
+	**        PCX-U/U+ do. (eg C200/C240)
+	**        PCX-T'? Don't know. (eg C110 or similar K-class)
+	**
+	** See PDC_MODEL/option 0/SW_CAP word for "Non-coherent IO-PDIR bit".
+	** Hopefully we can patch (NOP) these out at boot time somehow.
+	**
+	** "Since PCX-U employs an offset hash that is incompatible with
+	** the real mode coherence index generation of U2, the PDIR entry
+	** must be flushed to memory to retain coherence."
+	*/
 	asm volatile("fdc 0(%0)" : : "r" (pdir_ptr));
 	asm volatile("sync");
 }
 
+/**
+ * ccio_clear_io_tlb - Remove stale entries from the I/O TLB.
+ * @ioc: The I/O Controller.
+ * @iovp: The I/O Virtual Page.
+ * @byte_cnt: The requested number of bytes to be freed from the I/O Pdir.
+ *
+ * Purge invalid I/O PDIR entries from the I/O TLB.
+ *
+ * FIXME: Can we change the byte_cnt to pages_mapped?
+ */
 static CCIO_INLINE void
 ccio_clear_io_tlb(struct ioc *ioc, dma_addr_t iovp, size_t byte_cnt)
 {
@@ -488,6 +535,24 @@
       }
 }
 
+/**
+ * ccio_mark_invalid - Mark the I/O Pdir entries invalid.
+ * @ioc: The I/O Controller.
+ * @iova: The I/O Virtual Address.
+ * @byte_cnt: The requested number of bytes to be freed from the I/O Pdir.
+ *
+ * Mark the I/O Pdir entries invalid and blow away the corresponding I/O
+ * TLB entries.
+ *
+ * FIXME: at some threshhold it might be "cheaper" to just blow
+ *        away the entire I/O TLB instead of individual entries.
+ *
+ * FIXME: Uturn has 256 TLB entries. We don't need to purge every
+ *        PDIR entry - just once for each possible TLB entry.
+ *        (We do need to maker I/O PDIR entries invalid regardless).
+ *
+ * FIXME: Can we change byte_cnt to pages_mapped?
+ */ 
 static CCIO_INLINE void
 ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
 {
@@ -504,6 +569,14 @@
 
 		ASSERT(idx < (ioc->pdir_size / sizeof(u64)));
 		pdir_ptr[7] = 0;	/* clear only VALID bit */ 
+		/*
+		** FIXME: PCX_W platforms don't need FDC/SYNC. (eg C360)
+		**   PCX-U/U+ do. (eg C200/C240)
+		** See PDC_MODEL/option 0/SW_CAP for "Non-coherent IO-PDIR bit".
+		**
+		** Hopefully someone figures out how to patch (NOP) the
+		** FDC/SYNC out at boot time.
+		*/
 		asm volatile("fdc 0(%0)" : : "r" (pdir_ptr[7]));
 
 		iovp     += IOVP_SIZE;
@@ -664,6 +737,16 @@
 ccio_alloc_consistent(struct pci_dev *dev, size_t size, dma_addr_t *dma_handle)
 {
       void *ret;
+#if 0
+/* GRANT Need to establish hierarchy for non-PCI devs as well
+** and then provide matching gsc_map_xxx() functions for them as well.
+*/
+	if(!hwdev) {
+		/* only support PCI */
+		*dma_handle = 0;
+		return 0;
+	}
+#endif
         ret = (void *) __get_free_pages(GFP_ATOMIC, get_order(size));
 
 	if (ret) {
@@ -1118,7 +1201,7 @@
 		}
 		strcat(buf, "\n\n");
 		ioc = ioc->next;
-		break; 
+		break; /* XXX - remove me */
 	}
 
 	return strlen(buf);
@@ -1188,10 +1271,33 @@
 	}
 }
 
+#if 0
+/* GRANT -  is this needed for U2 or not? */
+
+/*
+** Get the size of the I/O TLB for this I/O MMU.
+**
+** If spa_shift is non-zero (ie probably U2),
+** then calculate the I/O TLB size using spa_shift.
+**
+** Otherwise we are supposed to get the IODC entry point ENTRY TLB
+** and execute it. However, both U2 and Uturn firmware supplies spa_shift.
+** I think only Java (K/D/R-class too?) systems don't do this.
+*/
+static int
+ccio_get_iotlb_size(struct parisc_device *dev)
+{
+	if (dev->spa_shift == 0) {
+		panic("%s() : Can't determine I/O TLB size.\n", __FUNCTION__);
+	}
+	return (1 << dev->spa_shift);
+}
+#else
 
 /* Uturn supports 256 TLB entries */
 #define CCIO_CHAINID_SHIFT	8
 #define CCIO_CHAINID_MASK	0xff
+#endif /* 0 */
 
 /**
  * ccio_ioc_init - Initalize the I/O Controller
@@ -1441,6 +1547,7 @@
 	hppa_dma_ops = &ccio_ops;
 
 	if (ioc_count == 0) {
+		/* XXX: Create separate entries for each ioc */
 		create_proc_read_entry(MODULE_NAME, S_IRWXU, proc_runway_root,
 				       ccio_proc_info, NULL);
 		create_proc_read_entry(MODULE_NAME"-bitmap", S_IRWXU,
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/ccio-rm-dma.c linux-2.4.20-WRTstp/arch/parisc/kernel/ccio-rm-dma.c
--- linux-2.4.20-WRT/arch/parisc/kernel/ccio-rm-dma.c	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/ccio-rm-dma.c	2005-11-08 06:24:35.000000000 -0800
@@ -132,7 +132,16 @@
 
 static void ccio_unmap_sg(struct pci_dev *dev, struct scatterlist *sglist, int nents, int direction)
 {
+#if 0
+	while (nents) {
+		ccio_unmap_single(dev, sg_dma_address(sglist), sg_dma_len(sglist), direction);
+		nents--;
+		sglist++;
+	}
+	return;
+#else
 	/* Do nothing (copied from current ccio_unmap_single()  :^) */
+#endif
 }
 
 
@@ -161,7 +170,16 @@
 			dev->id.hversion == U2_BC_GSC ? "U2" : "UTurn",
 			dev->hpa);
 
+/*
+** FIXME - should check U2 registers to verify it's really running
+** in "Real Mode".
+*/
 
+#if 0
+/* will need this for "Virtual Mode" operation */
+	ccio_hw_init(ccio_dev);
+	ccio_common_init(ccio_dev);
+#endif
 	hppa_dma_ops = &ccio_ops;
 	return 0;
 }
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/entry.S linux-2.4.20-WRTstp/arch/parisc/kernel/entry.S
--- linux-2.4.20-WRT/arch/parisc/kernel/entry.S	2003-07-04 01:11:16.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/entry.S	2005-11-08 06:24:35.000000000 -0800
@@ -261,6 +261,9 @@
 	mfctl	%isr,spc
 	b	itlb_miss_11
 	mfctl 	%ior,va
+	/* FIXME: If user causes a naitlb miss, the priv level may not be in
+	 * lower bits of va, where the itlb miss handler is expecting them
+	 */
 
 	.align		32
 	.endm
@@ -285,6 +288,9 @@
 	b	itlb_miss_20
 #endif
 	mfctl 	%ior,va
+	/* FIXME: If user causes a naitlb miss, the priv level may not be in
+	 * lower bits of va, where the itlb miss handler is expecting them
+	 */
 
 	.align		32
 	.endm
@@ -417,7 +423,11 @@
 	def		13
 	def		14
 	dtlb_20		15
+#if 0
+	naitlb_20	16
+#else
 	def             16
+#endif
 	nadtlb_20	17
 	def		18
 	def		19
@@ -461,7 +471,11 @@
 	def		13
 	def		14
 	dtlb_11		15
+#if 0
+	naitlb_11	16
+#else
 	def             16
+#endif
 	nadtlb_11	17
 	def		18
 	def		19
@@ -611,6 +625,22 @@
 	bv	%r0(%r2)
 	copy	%r26, %r28
 
+	/*
+	 * Common rfi return path for interruptions, kernel execve, and
+	 * sys_rt_sigreturn (sometimes).  The sys_rt_sigreturn syscall will
+	 * return via this path if the signal was received when the process
+	 * was running; if the process was blocked on a syscall then the
+	 * normal syscall_exit path is used.  All syscalls for traced
+	 * proceses exit via intr_restore.
+	 *
+	 * XXX If any syscalls that change a processes space id ever exit
+	 * this way, then we will need to copy %sr3 in to PT_SR[3..7], and
+	 * adjust IASQ[0..1].
+	 *
+	 * Note that the following code uses a "relied upon translation".
+	 * See the parisc ACD for details. The ssm is necessary due to a
+	 * PCXT bug.
+	 */
 
 	.align 4096
 
@@ -789,6 +819,19 @@
 	b,n 3f
 
 1:
+#if 0  /* Interrupt Stack support not working yet! */
+	mfctl	%cr31,%r1
+	copy	%r30,%r17
+	/* FIXME! depi below has hardcoded idea of interrupt stack size (32k)*/
+#ifdef __LP64__
+	depdi	0,63,15,%r17
+#else
+	depi	0,31,15,%r17
+#endif
+	CMPB=,n	%r1,%r17,2f
+	get_stack_use_cr31
+	b,n 3f
+#endif
 2:
 	get_stack_use_r30
 
@@ -833,6 +876,13 @@
 
 	/* If this trap is a itlb miss, skip saving/adjusting isr/ior */
 
+	/*
+	 * FIXME: 1) Use a #define for the hardwired "6" below (and in
+	 *           traps.c.
+	 *        2) Once we start executing code above 4 Gb, we need
+	 *           to adjust iasq/iaoq here in the same way we
+	 *           adjust isr/ior below.
+	 */
 
 	CMPIB=,n        6,%r26,skip_save_ior
 
@@ -849,6 +899,11 @@
 	extrd,u,*<>     %r8,PSW_W_BIT,1,%r0
 	depdi           0,1,2,%r17
 
+	/*
+	 * FIXME: This code has hardwired assumptions about the split
+	 *        between space bits and offset bits. This will change
+	 *        when we allow alternate page sizes.
+	 */
 
 	/* adjust isr/ior. */
 
@@ -1859,6 +1914,14 @@
 	   %r31		   syscall return pointer
 	 */
 
+	/* Floating point registers (FIXME: what do we do with these?)
+
+	   %fr0  - %fr3	   status/exception, not preserved
+	   %fr4  - %fr7	   arguments
+	   %fr8	 - %fr11   not preserved by C code
+	   %fr12 - %fr21   preserved by C code
+	   %fr22 - %fr31   not preserved by C code
+	 */
 
 	.macro	reg_save regs
 	STREG	%r3, PT_GR3(\regs)
@@ -2054,6 +2117,7 @@
 	ldo	-FRAME_SIZE(%r30), %r30
 	LDREG	-RP_OFFSET(%r30), %r2
 
+	/* FIXME: I think we need to restore a few more things here. */
 	ldo	TASK_REGS-TASK_SZ_ALGN-FRAME_SIZE(%r30),%r1	    /* get pt regs */
 	reg_restore %r1
 
@@ -2270,6 +2334,7 @@
 	STREG   %r25,TASK_PT_IASQ0(%r1)
 	STREG   %r25,TASK_PT_IASQ1(%r1)
 
+	/* XXX W bit??? */
 	/* Now if old D bit is clear, it means we didn't save all registers
 	 * on syscall entry, so do that now.  This only happens on TRACEME
 	 * calls, or if someone attached to us while we were on a syscall.
@@ -2317,6 +2382,10 @@
 
 	.import do_signal,code
 syscall_do_signal:
+	/* Save callee-save registers (for sigcontext).
+	   FIXME: After this point the process structure should be
+	   consistent with all the relevant state of the process
+	   before the syscall.  We need to verify this. */
 	ldo	TASK_REGS(%r1), %r25		/* struct pt_regs *regs */
 	reg_save %r25
 
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/firmware.c linux-2.4.20-WRTstp/arch/parisc/kernel/firmware.c
--- linux-2.4.20-WRT/arch/parisc/kernel/firmware.c	2003-07-04 01:11:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/firmware.c	2005-11-08 06:24:35.000000000 -0800
@@ -74,7 +74,7 @@
 #endif
 static long real32_call(unsigned long function, ...);
 
-#if defined(__LP64__) && !defined(CONFIG_PDC_NARROW)
+#if defined(__LP64__) && ! defined(CONFIG_PDC_NARROW)
 #define MEM_PDC (unsigned long)(PAGE0->mem_pdc_hi) << 32 | PAGE0->mem_pdc
 #   define mem_pdc_call(args...) real64_call(MEM_PDC, args)
 #else
@@ -470,6 +470,7 @@
 	retval = mem_pdc_call(PDC_LAN_STATION_ID, PDC_LAN_STATION_ID_READ,
 			__pa(pdc_result), hpa);
 	if (retval < 0) {
+		/* FIXME: else read MAC from NVRAM */
 		memset(lan_addr, 0, PDC_LAN_STATION_ID_SIZE);
 	} else {
 		memcpy(lan_addr, pdc_result, PDC_LAN_STATION_ID_SIZE);
@@ -656,6 +657,10 @@
 }
 #endif /* __LP64__ */
 
+/* FIXME: Is this pdc used?  I could not find type reference to ftc_bitmap
+ * so I guessed at unsigned long.  Someone who knows what this does, can fix
+ * it later. :)
+ */
 int pdc_do_firm_test_reset(unsigned long ftc_bitmap)
 {
         int retval;
@@ -753,6 +758,7 @@
  */
 void pdc_iodc_putc(unsigned char c)
 {
+        /* XXX Should we spinlock posx usage */
         static int posx;        /* for simple TAB-Simulation... */
         static int __attribute__((aligned(8)))   iodc_retbuf[32];
         static char __attribute__((aligned(64))) iodc_dbuf[4096];
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/head64.S linux-2.4.20-WRTstp/arch/parisc/kernel/head64.S
--- linux-2.4.20-WRT/arch/parisc/kernel/head64.S	2003-07-04 01:11:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/head64.S	2005-11-08 06:24:35.000000000 -0800
@@ -99,7 +99,7 @@
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
 
-#if __PAGE_OFFSET != 0x10000000UL
+#if (__PAGE_OFFSET != 0x10000000UL)
 Error! Code below (the next five std's) needs to be changed
 #endif
 
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/head.S linux-2.4.20-WRTstp/arch/parisc/kernel/head.S
--- linux-2.4.20-WRT/arch/parisc/kernel/head.S	2003-07-04 01:11:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/head.S	2005-11-08 06:24:35.000000000 -0800
@@ -95,7 +95,7 @@
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
 
-#if __PAGE_OFFSET != 0x10000000UL
+#if (__PAGE_OFFSET != 0x10000000UL)
 Error! Code below (the next two stw's) needs to be changed
 #endif
 
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/hpmc.S linux-2.4.20-WRTstp/arch/parisc/kernel/hpmc.S
--- linux-2.4.20-WRT/arch/parisc/kernel/hpmc.S	2003-07-04 01:11:17.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/hpmc.S	2005-11-08 06:24:35.000000000 -0800
@@ -184,6 +184,7 @@
 
 os_hpmc_3:
 
+	/* FIXME? Check for errors from PDC_IO (-1 might be OK) */
 
 	/*
 	 * Initialize the IODC console device (HPA,SPA, path etc.
diff -ruN linux-2.4.20-WRT/arch/parisc/kernel/ioctl32.c linux-2.4.20-WRTstp/arch/parisc/kernel/ioctl32.c
--- linux-2.4.20-WRT/arch/parisc/kernel/ioctl32.c	2003-10-14 01:07:38.000000000 -0700
+++ linux-2.4.20-WRTstp/arch/parisc/kernel/ioctl32.c	2005-11-08 06:24:35.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ioctl32.c,v 1.1.1.4 2003/10/14 08:07:38 sparq Exp $
+/* $Id: ioctl32.c,v 1.12 2002/07/08 20:52:15 grundler Exp $
  * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
  *
  * Copyright (C) 1997-2000  Jakub Jelinek  (jakub@redhat.com)
@@ -454,6 +454,110 @@
 }
 
 
+#if 0
+/* looks like SPARC only - eg sbus video */
+struct  fbcmap32 {
+	int             index;          /* first element (0 origin) */
+	int             count;
+	u32		red;
+	u32		green;
+	u32		blue;
+};
+
+
+static inline int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg)
+{
+	struct fbcmap f;
+	int ret;
+	char red[256], green[256], blue[256];
+	u32 r, g, b;
+	mm_segment_t old_fs = get_fs();
+	
+	ret = get_user(f.index, &(((struct fbcmap32 *)arg)->index));
+	ret |= __get_user(f.count, &(((struct fbcmap32 *)arg)->count));
+	ret |= __get_user(r, &(((struct fbcmap32 *)arg)->red));
+	ret |= __get_user(g, &(((struct fbcmap32 *)arg)->green));
+	ret |= __get_user(b, &(((struct fbcmap32 *)arg)->blue));
+	if (ret)
+		return -EFAULT;
+	if ((f.index < 0) || (f.index > 255)) return -EINVAL;
+	if (f.index + f.count > 256)
+		f.count = 256 - f.index;
+	if (cmd == FBIOPUTCMAP32) {
+		ret = copy_from_user (red, (char *)A(r), f.count);
+		ret |= copy_from_user (green, (char *)A(g), f.count);
+		ret |= copy_from_user (blue, (char *)A(b), f.count);
+		if (ret)
+			return -EFAULT;
+	}
+	f.red = red; f.green = green; f.blue = blue;
+	set_fs (KERNEL_DS);
+	ret = sys_ioctl (fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (long)&f);
+	set_fs (o