drivers/watchdog/intel_oc_wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/intel_oc_wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/intel_oc_wdt.c- Extension
.c- Size
- 5856 bytes
- Lines
- 234
- Domain
- Driver Families
- Bucket
- drivers/watchdog
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/bits.hlinux/io.hlinux/module.hlinux/moduleparam.hlinux/platform_device.hlinux/watchdog.h
Detected Declarations
struct intel_oc_wdtfunction intel_oc_wdt_startfunction intel_oc_wdt_stopfunction intel_oc_wdt_pingfunction intel_oc_wdt_set_timeoutfunction intel_oc_wdt_setupfunction intel_oc_wdt_probe
Annotated Snippet
struct intel_oc_wdt {
struct watchdog_device wdd;
struct resource *ctrl_res;
struct watchdog_info info;
bool locked;
};
static int heartbeat;
module_param(heartbeat, uint, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. (default="
__MODULE_STRING(WDT_HEARTBEAT) ")");
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static int intel_oc_wdt_start(struct watchdog_device *wdd)
{
struct intel_oc_wdt *oc_wdt = watchdog_get_drvdata(wdd);
if (oc_wdt->locked)
return 0;
outl(inl(INTEL_OC_WDT_CTRL_REG(oc_wdt)) | INTEL_OC_WDT_EN,
INTEL_OC_WDT_CTRL_REG(oc_wdt));
return 0;
}
static int intel_oc_wdt_stop(struct watchdog_device *wdd)
{
struct intel_oc_wdt *oc_wdt = watchdog_get_drvdata(wdd);
outl(inl(INTEL_OC_WDT_CTRL_REG(oc_wdt)) & ~INTEL_OC_WDT_EN,
INTEL_OC_WDT_CTRL_REG(oc_wdt));
return 0;
}
static int intel_oc_wdt_ping(struct watchdog_device *wdd)
{
struct intel_oc_wdt *oc_wdt = watchdog_get_drvdata(wdd);
outl(inl(INTEL_OC_WDT_CTRL_REG(oc_wdt)) | INTEL_OC_WDT_RLD,
INTEL_OC_WDT_CTRL_REG(oc_wdt));
return 0;
}
static int intel_oc_wdt_set_timeout(struct watchdog_device *wdd,
unsigned int t)
{
struct intel_oc_wdt *oc_wdt = watchdog_get_drvdata(wdd);
outl((inl(INTEL_OC_WDT_CTRL_REG(oc_wdt)) & ~INTEL_OC_WDT_TOV) | (t - 1),
INTEL_OC_WDT_CTRL_REG(oc_wdt));
wdd->timeout = t;
return 0;
}
static const struct watchdog_info intel_oc_wdt_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
.identity = DRV_NAME,
};
static const struct watchdog_ops intel_oc_wdt_ops = {
.owner = THIS_MODULE,
.start = intel_oc_wdt_start,
.stop = intel_oc_wdt_stop,
.ping = intel_oc_wdt_ping,
.set_timeout = intel_oc_wdt_set_timeout,
};
static int intel_oc_wdt_setup(struct intel_oc_wdt *oc_wdt)
{
unsigned long val;
val = inl(INTEL_OC_WDT_CTRL_REG(oc_wdt));
if (val & INTEL_OC_WDT_STS_BITS)
oc_wdt->wdd.bootstatus |= WDIOF_CARDRESET;
oc_wdt->locked = !!(val & INTEL_OC_WDT_CTL_LCK);
if (val & INTEL_OC_WDT_EN) {
/*
* No need to issue a ping here to "commit" the new timeout
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bits.h`, `linux/io.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/platform_device.h`, `linux/watchdog.h`.
- Detected declarations: `struct intel_oc_wdt`, `function intel_oc_wdt_start`, `function intel_oc_wdt_stop`, `function intel_oc_wdt_ping`, `function intel_oc_wdt_set_timeout`, `function intel_oc_wdt_setup`, `function intel_oc_wdt_probe`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.