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.

Dependency Surface

Detected Declarations

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

Implementation Notes