All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Toshiba RBTX4927 NMI handling code....
@ 2003-10-08 20:12 Steven J. Hill
  2003-10-08 21:18 ` Jun Sun
  0 siblings, 1 reply; 3+ messages in thread
From: Steven J. Hill @ 2003-10-08 20:12 UTC (permalink / raw)
  To: linux-mips

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

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

[-- Attachment #2: toshiba-rbtx4927-nmi.patch --]
[-- Type: text/plain, Size: 6887 bytes --]

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Toshiba RBTX4927 NMI handling code....
  2003-10-08 20:12 [PATCH] Toshiba RBTX4927 NMI handling code Steven J. Hill
@ 2003-10-08 21:18 ` Jun Sun
  2003-10-09 14:18   ` Steven J. Hill
  0 siblings, 1 reply; 3+ messages in thread
From: Jun Sun @ 2003-10-08 21:18 UTC (permalink / raw)
  To: Steven J. Hill; +Cc: linux-mips, jsun


CONFIGs are ugly.  I think it is better to add just:

if (board_nmi_handler_setup)
	board_nmi_handler_setup();

Define board_nmi_handler_setup and function pointer in traps.c
with NULL default value.

Each invidual board then decides whether it wants to initialize
the pointer to something meaningful or not.

Jun

On Wed, Oct 08, 2003 at 04:12:19PM -0400, Steven J. Hill wrote:
> 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Toshiba RBTX4927 NMI handling code....
  2003-10-08 21:18 ` Jun Sun
@ 2003-10-09 14:18   ` Steven J. Hill
  0 siblings, 0 replies; 3+ messages in thread
From: Steven J. Hill @ 2003-10-09 14:18 UTC (permalink / raw)
  To: Jun Sun; +Cc: linux-mips

[-- Attachment #1: Type: text/plain, Size: 135 bytes --]

Hey Jun.

Thanks for your input on this. Updated code has been applied
to CVS. The new patch is also attached just for record.

-Steve

[-- Attachment #2: rbtx4927-nmi.patch --]
[-- Type: text/plain, Size: 5841 bytes --]

? big.diff
? rbtx4927-nmi.patch
Index: arch/mips/kernel/traps.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/kernel/traps.c,v
retrieving revision 1.99.2.57
diff -u -r1.99.2.57 traps.c
--- arch/mips/kernel/traps.c	10 Sep 2003 10:09:47 -0000	1.99.2.57
+++ arch/mips/kernel/traps.c	9 Oct 2003 14:12:23 -0000
@@ -63,6 +63,7 @@
 
 void (*board_be_init)(void);
 int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
+void (*board_nmi_handler_setup)(void) = NULL;
 
 int kstack_depth_to_print = 24;
 
@@ -1008,6 +1009,9 @@
 		save_fp_context = fpu_emulator_save_context;
 		restore_fp_context = fpu_emulator_restore_context;
 	}
+
+	if (board_nmi_handler_setup)
+		board_nmi_handler_setup();
 
 	flush_icache_range(KSEG0, KSEG0 + 0x400);
 
Index: arch/mips/tx4927/toshiba_rbtx4927/Makefile
===================================================================
RCS file: /home/cvs/linux/arch/mips/tx4927/toshiba_rbtx4927/Makefile,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 Makefile
--- arch/mips/tx4927/toshiba_rbtx4927/Makefile	11 Apr 2003 17:26:20 -0000	1.1.2.1
+++ arch/mips/tx4927/toshiba_rbtx4927/Makefile	9 Oct 2003 14:12:23 -0000
@@ -13,6 +13,7 @@
 obj-y	+= toshiba_rbtx4927_prom.o 
 obj-y	+= toshiba_rbtx4927_setup.o 
 obj-y	+= toshiba_rbtx4927_irq.o 
+obj-y	+= toshiba_rbtx4927_nmi.o 
 
 obj-$(CONFIG_PCI)	+= toshiba_rbtx4927_pci_fixup.o 
 obj-$(CONFIG_PCI)	+= toshiba_rbtx4927_pci_ops.o 
Index: arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S
===================================================================
RCS file: arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S
diff -N arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_nmi.S	9 Oct 2003 14:12:23 -0000
@@ -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)
Index: arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
===================================================================
RCS file: /home/cvs/linux/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 toshiba_rbtx4927_setup.c
--- arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c	25 Aug 2003 16:14:53 -0000	1.1.2.5
+++ arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c	9 Oct 2003 14:12:23 -0000
@@ -907,8 +907,47 @@
 	/* no return */
 }
 
+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 toshiba_rbtx4927_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);
+}
+
 void __init toshiba_rbtx4927_setup(void)
 {
+	extern void (*board_nmi_handler_setup)(void);
 	vu32 cp0_config;
 
 	printk("CPU is %s\n", toshiba_name);
@@ -927,6 +966,9 @@
 	cp0_config = read_c0_config();
 	cp0_config = cp0_config & ~(TX49_CONF_IC | TX49_CONF_DC);
 	write_c0_config(cp0_config);
+
+	/* set up the NMI handler */
+	board_nmi_handler_setup = toshiba_rbtx4927_nmi_handler_setup;
 
 #ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
 	{

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-10-09 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-08 20:12 [PATCH] Toshiba RBTX4927 NMI handling code Steven J. Hill
2003-10-08 21:18 ` Jun Sun
2003-10-09 14:18   ` Steven J. Hill

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.