Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140065511
D33534.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D33534.diff
View Options
diff --git a/sys/dev/dwwdt/dwwdt.c b/sys/dev/dwwdt/dwwdt.c
--- a/sys/dev/dwwdt/dwwdt.c
+++ b/sys/dev/dwwdt/dwwdt.c
@@ -93,15 +93,20 @@
SYSCTL_NODE(_dev, OID_AUTO, dwwdt, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"Synopsys Designware watchdog timer");
-/* Setting this to 0 enables full restart mode. */
-static uint32_t dwwdt_prevent_restart = 1;
-SYSCTL_UINT(_dev_dwwdt, OID_AUTO, prevent_restart, CTLFLAG_RW | CTLFLAG_MPSAFE,
- &dwwdt_prevent_restart, 1,
- "Prevent system restart (0 - Disabled; 1 - Enabled)");
-static uint32_t dwwdt_debug_enabled = 0;
-SYSCTL_UINT(_dev_dwwdt, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_MPSAFE,
- &dwwdt_debug_enabled, 1, "Debug mode (0 - Disabled; 1 - Enabled)");
+/* Setting this to true disables full restart mode. */
+static bool dwwdt_prevent_restart = false;
+SYSCTL_BOOL(_dev_dwwdt, OID_AUTO, prevent_restart, CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &dwwdt_prevent_restart, 0, "Disable system reset on timeout");
+
+static bool dwwdt_debug_enabled = false;
+SYSCTL_BOOL(_dev_dwwdt, OID_AUTO, debug, CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &dwwdt_debug_enabled, 0, "Enable debug mode");
+
+static bool dwwdt_panic_first = true;
+SYSCTL_BOOL(_dev_dwwdt, OID_AUTO, panic_first, CTLFLAG_RW | CTLFLAG_MPSAFE,
+ &dwwdt_panic_first, 0,
+ "Try to panic on timeout, reset on another timeout");
static int dwwdt_probe(device_t);
static int dwwdt_attach(device_t);
@@ -181,13 +186,17 @@
KASSERT((DWWDT_READ4(sc, DWWDT_STAT) & DWWDT_STAT_STATUS) != 0,
("Missing interrupt status bit?"));
- if (dwwdt_prevent_restart != 0 || sc->sc_status == DWWDT_STOPPED) {
+ if (dwwdt_prevent_restart || sc->sc_status == DWWDT_STOPPED) {
/*
* Confirm interrupt reception. Restart counter.
* This also emulates stopping watchdog.
*/
(void)DWWDT_READ4(sc, DWWDT_EOI);
+ return;
}
+
+ if (dwwdt_panic_first)
+ panic("dwwdt pre-timeout interrupt");
}
static void
@@ -199,7 +208,7 @@
int val;
timeout = cmd & WD_INTERVAL;
- val = MAX(0, timeout + exponent - DWWDT_EXP_OFFSET);
+ val = MAX(0, timeout + exponent - DWWDT_EXP_OFFSET + 1);
dwwdt_stop(sc);
if (cmd == 0 || val > 0x0f) {
@@ -341,7 +350,7 @@
sc = device_get_softc(dev);
/* Prevent restarts during shutdown. */
- dwwdt_prevent_restart = 1;
+ dwwdt_prevent_restart = true;
dwwdt_stop(sc);
return (bus_generic_shutdown(dev));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 20, 6:40 PM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27099852
Default Alt Text
D33534.diff (2 KB)
Attached To
Mode
D33534: dwwdt: make it actually useful
Attached
Detach File
Event Timeline
Log In to Comment