arch/powerpc/platforms/powernv/opal-rtc.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/powernv/opal-rtc.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/powernv/opal-rtc.c- Extension
.c- Size
- 1979 bytes
- Lines
- 85
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/time.hlinux/bcd.hlinux/rtc.hlinux/delay.hlinux/of.hlinux/of_platform.hlinux/platform_device.hasm/opal.hasm/firmware.hasm/machdep.h
Detected Declarations
function opal_to_tmfunction opal_get_boot_timefunction opal_time_init
Annotated Snippet
if (rc == OPAL_BUSY_EVENT) {
mdelay(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL);
} else if (rc == OPAL_BUSY) {
mdelay(OPAL_BUSY_DELAY_MS);
}
}
if (rc != OPAL_SUCCESS)
return 0;
y_m_d = be32_to_cpu(__y_m_d);
h_m_s_ms = be64_to_cpu(__h_m_s_ms);
opal_to_tm(y_m_d, h_m_s_ms, &tm);
return rtc_tm_to_time64(&tm);
}
static __init int opal_time_init(void)
{
struct platform_device *pdev;
struct device_node *rtc;
rtc = of_find_node_by_path("/ibm,opal/rtc");
if (rtc) {
pdev = of_platform_device_create(rtc, "opal-rtc", NULL);
of_node_put(rtc);
} else {
if (opal_check_token(OPAL_RTC_READ) ||
opal_check_token(OPAL_READ_TPO))
pdev = platform_device_register_simple("opal-rtc", -1,
NULL, 0);
else
return -ENODEV;
}
return PTR_ERR_OR_ZERO(pdev);
}
machine_subsys_initcall(powernv, opal_time_init);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/time.h`, `linux/bcd.h`, `linux/rtc.h`, `linux/delay.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`.
- Detected declarations: `function opal_to_tm`, `function opal_get_boot_time`, `function opal_time_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: integration 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.