[PATCH] Toshiba RBTX4927 NMI handling code....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings.

If no one has any objections, I would like to apply this patch.
This utilizes the NMI present on the RBTX4927 board and is quite
handy for debugging purposes. I have also refined my earlier NMI
code a bit and believe this to be much cleaner than before.

-Steve
diff -urN linux/arch/mips/config-shared.in linux-patched/arch/mips/config-shared.in
--- linux/arch/mips/config-shared.in	Wed Sep 10 15:06:10 2003
+++ linux-patched/arch/mips/config-shared.in	Wed Oct  8 14:06:55 2003
@@ -647,6 +647,7 @@
    define_bool CONFIG_SWAP_IO_SPACE_L y
    define_bool CONFIG_ISA y
    define_bool CONFIG_NONCOHERENT_IO y
+   define_bool CONFIG_NMI y
 fi
 if [ "$CONFIG_VICTOR_MPC30X" = "y" ]; then
    define_bool CONFIG_IRQ_CPU y
diff -urN linux/arch/mips/defconfig-rbtx4927 linux-patched/arch/mips/defconfig-rbtx4927
--- linux/arch/mips/defconfig-rbtx4927	Tue Sep  9 20:17:31 2003
+++ linux-patched/arch/mips/defconfig-rbtx4927	Wed Oct  8 14:07:23 2003
@@ -1,5 +1,5 @@
 #
-# Automatically generated by make menuconfig: don't edit
+# Automatically generated make config: don't edit
 #
 CONFIG_MIPS=y
 CONFIG_MIPS32=y
@@ -76,7 +76,7 @@
 CONFIG_SWAP_IO_SPACE_L=y
 CONFIG_ISA=y
 CONFIG_NONCOHERENT_IO=y
-CONFIG_DUMMY_KEYB=y
+CONFIG_NMI=y
 # CONFIG_MIPS_AU1000 is not set
 
 #
@@ -199,6 +199,10 @@
 # CONFIG_KHTTPD is not set
 # CONFIG_ATM is not set
 # CONFIG_VLAN_8021Q is not set
+
+#
+#  
+#
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
 
@@ -407,7 +411,6 @@
 # CONFIG_ESPSERIAL is not set
 # CONFIG_MOXA_INTELLIO is not set
 # CONFIG_MOXA_SMARTIO is not set
-# CONFIG_ISI is not set
 # CONFIG_SYNCLINK is not set
 # CONFIG_SYNCLINKMP is not set
 # CONFIG_N_HDLC is not set
@@ -416,12 +419,11 @@
 # CONFIG_SX is not set
 # CONFIG_RIO is not set
 # CONFIG_STALDRV is not set
-CONFIG_SERIAL_TXX9=y
-CONFIG_SERIAL_TXX9_CONSOLE=y
 # CONFIG_SERIAL_TX3912 is not set
 # CONFIG_SERIAL_TX3912_CONSOLE is not set
+CONFIG_SERIAL_TXX9=y
+CONFIG_SERIAL_TXX9_CONSOLE=y
 # CONFIG_TXX927_SERIAL is not set
-# CONFIG_TXX927_SERIAL_CONSOLE is not set
 # CONFIG_UNIX98_PTYS is not set
 
 #
@@ -439,6 +441,14 @@
 # Joysticks
 #
 # CONFIG_INPUT_GAMEPORT is not set
+
+#
+# Input core support is needed for gameports
+#
+
+#
+# Input core support is needed for joysticks
+#
 # CONFIG_QIC02_TAPE is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_IPMI_PANIC_EVENT is not set
diff -urN linux/arch/mips/kernel/traps.c linux-patched/arch/mips/kernel/traps.c
--- linux/arch/mips/kernel/traps.c	Wed Sep 10 15:06:10 2003
+++ linux-patched/arch/mips/kernel/traps.c	Wed Oct  8 14:03:03 2003
@@ -1009,6 +1009,14 @@
 		restore_fp_context = fpu_emulator_restore_context;
 	}
 
+#ifdef CONFIG_NMI
+	{
+		extern void nmi_handler_setup (void);
+
+		nmi_handler_setup();
+	}
+#endif
+
 	flush_icache_range(KSEG0, KSEG0 + 0x400);
 
 	atomic_inc(&init_mm.mm_count);	/* XXX UP?  */
diff -urN linux/arch/mips/tx4927/toshiba_rbtx4927/Makefile linux-patched/arch/mips/tx4927/toshiba_rbtx4927/Makefile
--- linux/arch/mips/tx4927/toshiba_rbtx4927/Makefile	Fri Apr 11 13:26:20 2003
+++ linux-patched/arch/mips/tx4927/toshiba_rbtx4927/Makefile	Wed Oct  8 14:04:27 2003
@@ -16,5 +16,6 @@
 
 obj-$(CONFIG_PCI)	+= toshiba_rbtx4927_pci_fixup.o 
 obj-$(CONFIG_PCI)	+= toshiba_rbtx4927_pci_ops.o 
+obj-$(CONFIG_NMI)	+= toshiba_rbtx4927_nmi.o
 
 include $(TOPDIR)/Rules.make
diff -urN linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S linux-patched/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S
--- linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S	Wed Dec 31 19:00:00 1969
+++ linux-patched/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S	Wed Oct  8 14:03:29 2003
@@ -0,0 +1,46 @@
+/*
+ * linux/arch/mips/tx4927/toshiba_rbtx4927/tx4927_irq_handler.S
+ *
+ * NMI handler for Toshiba RBTX4927 board
+ *
+ * Copyright (C) 2003 TimeSys Corp.
+ *                    S. James Hill (James.Hill@timesys.com)
+ *                                  (sjhill@realitydiluted.com)
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; either version 2 of the License, or (at your
+ *  option) any later version.
+ *
+ *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include <asm/regdef.h>
+#include <asm/stackframe.h>
+
+		.align	5
+		.set noat
+		NESTED(tx4927_nmi_handler, PT_SIZE, sp)
+		SAVE_ALL
+		CLI
+		.set at
+		mfc0	k0, CP0_STATUS
+		lui	k1, 0x50		/* Clear BEV and NMI */
+		nor	k1, zero, k1
+		and	k0, k1
+		mtc0	k0, CP0_STATUS
+		move	a0, sp
+		jal	toshiba_rbtx4927_nmi
+		END(tx4927_nmi_handler)
diff -urN linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c linux-patched/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
--- linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c	Thu Aug 28 10:04:47 2003
+++ linux-patched/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c	Wed Oct  8 14:08:29 2003
@@ -907,6 +907,46 @@
 	/* no return */
 }
 
+#ifdef CONFIG_NMI
+void toshiba_rbtx4927_nmi (struct pt_regs *regs)
+{
+	extern void show_code(unsigned int *pc);
+	extern void show_runqueue(void);
+	extern void show_stack(unsigned int *sp);
+	extern void show_state_nolock(void);
+	extern void show_trace(unsigned long *sp, unsigned int *ra,
+			       unsigned int *pc);
+
+	bust_spinlocks(1);
+	printk("\ncurrent = %d:%s\n",current->pid,current->comm);
+	show_regs(regs);
+	printk("Process %s (pid: %d, stackpage=%08lx)\n",
+		current->comm, current->pid, (unsigned long) current);
+	show_stack((unsigned int *)regs->regs[29]);
+	show_trace((unsigned long *)regs->regs[29], 
+	           (unsigned int *)regs->regs[31],
+	           (unsigned int *)regs->cp0_epc);
+	show_code((unsigned int *)regs->cp0_epc);
+	bust_spinlocks(0);
+}
+
+void nmi_handler_setup (void)
+{
+	extern void tx4927_nmi_handler (void);
+	unsigned long vec[2];
+
+	vec[0] = 0x08000000 |
+			(0x03ffffff & ((unsigned long)tx4927_nmi_handler >> 2));
+	vec[1] = 0;
+
+	/*
+	 * Our firmware (PMON in this case) has a NMI hook that
+	 * jumps to 0x80000220. We locate our NMI handler there.
+	 */
+	memcpy((void *)(KSEG0 + 0x220), &vec, 0x8);
+}
+#endif
+
 void __init toshiba_rbtx4927_setup(void)
 {
 	vu32 cp0_config;

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux