From: Takeharu KATO <kato.takeharu@jp.fujitsu.com>
To: Takeharu KATO <kato.takeharu@jp.fujitsu.com>
Cc: ppcembed <linuxppc-embedded@ozlabs.org>
Subject: Re: [PATCH 3/3] PowerPC4xx/E500 WatchDogTimerDriver(exception handler part)
Date: Thu, 03 Mar 2005 21:07:27 +0900 [thread overview]
Message-ID: <4226FDFF.5080904@jp.fujitsu.com> (raw)
In-Reply-To: <42231C26.7020508@jp.fujitsu.com>
Dear all:
I fix PowerPC405 exception handling part.
This patch corrects the problem of having not stopped WDT
when the WDT exception is generated.
This patch also stop WDT when the system fall in panic.
Signed-off-by: Takeharu KATO <kato.takeharu@jp.fujitsu.com>
--- linux-2.6.11-rc5-ppc4xx/arch/ppc/kernel/head_44x.S 2005-02-27 15:27:46.000000000 +0900
+++ linux-2.6.11-rc5/arch/ppc/kernel/head_44x.S 2005-03-03 18:09:03.000000000 +0900
@@ -444,8 +444,11 @@ interrupt_base:
EXCEPTION(0x1010, FixedIntervalTimer, UnknownException, EXC_XFER_EE)
/* Watchdog Timer Interrupt */
- /* TODO: Add watchdog support */
+#if defined(CONFIG_PPC4xx_WATCHDOG)
+ CRITICAL_EXCEPTION(0x1020, WatchdogTimer, ppc4xx_wdt_exception)
+#else
CRITICAL_EXCEPTION(0x1020, WatchdogTimer, UnknownException)
+#endif
/* Data TLB Error Interrupt */
START_EXCEPTION(DataTLBError)
diff -uprN linux-2.6.11-rc5-ppc4xx/arch/ppc/kernel/head_4xx.S
linux-2.6.11-rc5/arch/ppc/kernel/head_4xx.S
--- linux-2.6.11-rc5-ppc4xx/arch/ppc/kernel/head_4xx.S 2005-03-03 18:30:12.000000000 +0900
+++ linux-2.6.11-rc5/arch/ppc/kernel/head_4xx.S 2005-03-03 18:09:04.000000000 +0900
@@ -477,17 +477,21 @@ label:
#if 0
/* NOTE:
- * FIT and WDT handlers are not implemented yet.
+ * FIT handler is not implemented yet.
*/
/* 0x1010 - Fixed Interval Timer (FIT) Exception
*/
STND_EXCEPTION(0x1010, FITException, UnknownException)
+#endif
+
/* 0x1020 - Watchdog Timer (WDT) Exception
*/
-
- CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
+#if defined(CONFIG_PPC4xx_WATCHDOG)
+ CRITICAL_EXCEPTION(0x1020, WDTException, ppc4xx_wdt_exception)
+#else
+ CRITICAL_EXCEPTION(0x1020, WDTException, UnknownException)
#endif
/* 0x1100 - Data TLB Miss Exception
diff -uprN linux-2.6.11-rc5-ppc4xx/arch/ppc/kernel/head_e500.S
linux-2.6.11-rc5/arch/ppc/kernel/head_e500.S
--- linux-2.6.11-rc5-ppc4xx/arch/ppc/kernel/head_e500.S 2005-02-27 15:29:39.000000000 +0900
+++ linux-2.6.11-rc5/arch/ppc/kernel/head_e500.S 2005-03-03 18:09:04.000000000 +0900
@@ -494,8 +494,12 @@ interrupt_base:
EXCEPTION(0x3100, FixedIntervalTimer, UnknownException, EXC_XFER_EE)
/* Watchdog Timer Interrupt */
- /* TODO: Add watchdog support */
+#if defined(CONFIG_PPC4xx_WATCHDOG)
+ CRITICAL_EXCEPTION(0x3200, WatchdogTimer, ppc4xx_wdt_exception)
+#else
CRITICAL_EXCEPTION(0x3200, WatchdogTimer, UnknownException)
+#endif
+
/* Data TLB Error Interrupt */
START_EXCEPTION(DataTLBError)
diff -uprN linux-2.6.11-rc5-ppc4xx/drivers/char/watchdog/ppc4xx_wdt.c
linux-2.6.11-rc5/drivers/char/watchdog/ppc4xx_wdt.c
--- linux-2.6.11-rc5-ppc4xx/drivers/char/watchdog/ppc4xx_wdt.c 2005-03-03 18:28:33.000000000 +0900
+++ linux-2.6.11-rc5/drivers/char/watchdog/ppc4xx_wdt.c 2005-03-03 20:29:16.946286104 +0900
@@ -66,12 +66,18 @@ static struct watchdog_info ident = {
.firmware_version = 0, /* This is filled with PVR in initialization. */
.identity = "PPC4xx WDT",
};
-
+/*
+ * PowerPC Linux common exception handler
+ */
+extern void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
+/* Panic notifier */
+extern struct notifier_block *panic_notifier_list;
/*
* External linkage functions
*/
void ppc4xx_wdt_heartbeat(void);
void ppc4xx_wdt_setup_options(char *cmd_line);
+void ppc4xx_wdt_exception(struct pt_regs *regs);
/*
* Internal linkage functions
*/
@@ -243,7 +249,7 @@ ppc4xx_wdt_heartbeat(void)
if (!wdt_enable)
goto out;
-
+
if (wdt_heartbeat_count > 0)
wdt_heartbeat_count--;
else
@@ -255,6 +261,20 @@ ppc4xx_wdt_heartbeat(void)
/* Reset count */
ppc_md.heartbeat_count = 0;
}
+/**
+ * ppc4xx_wdt_exception:
+ * WatchDog Exception
+ */
+void
+ppc4xx_wdt_exception(struct pt_regs *regs)
+{
+ wdt_enable=0;
+
+ __ppc4xx_wdt_disable();
+ printk("WDT Exception at PC: %lx, MSR: %lx, vector=%lx %s\n",
+ regs->nip, regs->msr, regs->trap, print_tainted());
+ panic(ppc4xx_mkmsg("Initiating system reboot.\n"));
+}
\f
/*
* Driver Logic functions
@@ -526,10 +546,9 @@ static int
ppc4xx_wdt_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
- if(code==SYS_DOWN || code==SYS_HALT) {
- /* Turn the card off */
+ if (code != SYS_POWER_OFF) /* Turn the card off */
ppc4xx_wdt_stop();
- }
+
return NOTIFY_DONE;
}
@@ -572,6 +591,7 @@ ppc4xx_wdt_exit(void)
{
misc_deregister(&ppc4xx_wdt_miscdev);
unregister_reboot_notifier(&ppc4xx_wdt_notifier);
+ notifier_chain_unregister(&panic_notifier_list,&ppc4xx_wdt_notifier);
}
/**
@@ -592,6 +612,14 @@ ppc4xx_wdt_init(void)
return ret;
}
+ /* Register panic notifier */
+ ret = notifier_chain_register(&panic_notifier_list,&ppc4xx_wdt_notifier);
+ if(ret) {
+ ppc4xx_wdt_err("Cannot register panic notifier (err=%d)\n", ret);
+ unregister_reboot_notifier(&ppc4xx_wdt_notifier);
+ return ret;
+ }
+
ret = 0;
ppc4xx_wdt_init_device();
/* Check that the heartbeat value is within it's range ; if not reset to the default */
--
Takeharu KATO
Fujitsu Limited
Email:kato.takeharu at jp.fujitsu.com
prev parent reply other threads:[~2005-03-03 12:07 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-23 19:00 PowerPC4xx Watchdog Takeharu KATO
2005-02-23 19:15 ` Takeharu KATO
2005-02-23 21:27 ` Matt Porter
2005-02-23 23:23 ` Takeharu KATO
2005-02-23 23:36 ` Takeharu KATO
2005-03-02 17:52 ` Matt Porter
2005-03-02 23:06 ` Kumar Gala
2005-03-02 23:15 ` Matt Porter
2005-03-03 11:50 ` Takeharu KATO
2005-03-03 12:13 ` Takeharu KATO
2005-03-03 14:53 ` Kumar Gala
2005-03-03 15:20 ` Matt Porter
2005-03-03 15:21 ` Takeharu KATO
2005-03-03 17:11 ` Matt Porter
2005-03-04 9:38 ` [PATCH] WDT Driver for Book-E [1/2] Architecture specific part Takeharu KATO
2005-03-04 15:54 ` Kumar Gala
2005-03-08 17:08 ` Takeharu KATO
2005-03-04 9:38 ` [PATCH] WDT Driver for Book-E [2/2] Device driver part Takeharu KATO
2005-03-04 16:02 ` Kumar Gala
2005-03-04 16:35 ` Matt Porter
2005-03-04 16:44 ` Kumar Gala
2005-03-05 0:34 ` Josh Boyer
2005-03-05 8:11 ` Takeharu KATO
2005-03-06 19:15 ` Takeharu KATO
2005-03-06 21:11 ` Josh Boyer
2005-02-25 19:35 ` PowerPC4xx Watchdog Takeharu KATO
2005-02-28 13:18 ` [PATCH 1/3] PowerPC4xx/E500 WatchDogTimerDriver(Core and PPC4xx part) Takeharu KATO
2005-02-28 13:20 ` PowerPC4xx Watchdog Takeharu KATO
2005-02-28 13:27 ` [PATCH 3/3] PowerPC4xx/E500 WatchDogTimerDriver(exception handler part) Takeharu KATO
2005-03-03 7:14 ` Kumar Gala
2005-03-03 7:31 ` Takeharu KATO
2005-03-03 12:07 ` Takeharu KATO [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4226FDFF.5080904@jp.fujitsu.com \
--to=kato.takeharu@jp.fujitsu.com \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.