~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sh/kernel/nmi_debug.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (C) 2007 Atmel Corporation
  4  */
  5 #include <linux/delay.h>
  6 #include <linux/kdebug.h>
  7 #include <linux/notifier.h>
  8 #include <linux/sched.h>
  9 #include <linux/sched/debug.h>
 10 #include <linux/hardirq.h>
 11 
 12 enum nmi_action {
 13         NMI_SHOW_STATE  = 1 << 0,
 14         NMI_SHOW_REGS   = 1 << 1,
 15         NMI_DIE         = 1 << 2,
 16         NMI_DEBOUNCE    = 1 << 3,
 17 };
 18 
 19 static unsigned long nmi_actions;
 20 
 21 static int nmi_debug_notify(struct notifier_block *self,
 22                 unsigned long val, void *data)
 23 {
 24         struct die_args *args = data;
 25 
 26         if (likely(val != DIE_NMI))
 27                 return NOTIFY_DONE;
 28 
 29         if (nmi_actions & NMI_SHOW_STATE)
 30                 show_state();
 31         if (nmi_actions & NMI_SHOW_REGS)
 32                 show_regs(args->regs);
 33         if (nmi_actions & NMI_DEBOUNCE)
 34                 mdelay(10);
 35         if (nmi_actions & NMI_DIE)
 36                 return NOTIFY_BAD;
 37 
 38         return NOTIFY_OK;
 39 }
 40 
 41 static struct notifier_block nmi_debug_nb = {
 42         .notifier_call = nmi_debug_notify,
 43 };
 44 
 45 static int __init nmi_debug_setup(char *str)
 46 {
 47         char *p, *sep;
 48 
 49         register_die_notifier(&nmi_debug_nb);
 50 
 51         if (*str != '=')
 52                 return 1;
 53 
 54         for (p = str + 1; *p; p = sep + 1) {
 55                 sep = strchr(p, ',');
 56                 if (sep)
 57                         *sep = 0;
 58                 if (strcmp(p, "state") == 0)
 59                         nmi_actions |= NMI_SHOW_STATE;
 60                 else if (strcmp(p, "regs") == 0)
 61                         nmi_actions |= NMI_SHOW_REGS;
 62                 else if (strcmp(p, "debounce") == 0)
 63                         nmi_actions |= NMI_DEBOUNCE;
 64                 else if (strcmp(p, "die") == 0)
 65                         nmi_actions |= NMI_DIE;
 66                 else
 67                         printk(KERN_WARNING "NMI: Unrecognized action `%s'\n",
 68                                 p);
 69                 if (!sep)
 70                         break;
 71         }
 72 
 73         return 1;
 74 }
 75 __setup("nmi_debug", nmi_debug_setup);
 76 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php