#ifdef CONFIG_X86_32 /* * This is a special lock that is owned by the CPU and holds the index * register we are working with. It is required for NMI access to the * CMOS/RTC registers. See arch/x86/include/asm/mc146818rtc.h for details.
*/ volatileunsignedlong cmos_lock;
EXPORT_SYMBOL(cmos_lock); #endif/* CONFIG_X86_32 */
/* * In order to set the CMOS clock precisely, mach_set_cmos_time has to be * called 500 ms after the second nowtime has started, because when * nowtime is written into the registers of the CMOS clock, it will * jump to the next second precisely 500 ms later. Check the Motorola * MC146818A or Dallas DS12887 data sheet for details.
*/ int mach_set_cmos_time(conststruct timespec64 *now)
{ unsignedlonglong nowtime = now->tv_sec; struct rtc_time tm; int retval = 0;
rtc_time64_to_tm(nowtime, &tm); if (!rtc_valid_tm(&tm)) {
retval = mc146818_set_time(&tm); if (retval)
printk(KERN_ERR "%s: RTC write failed with error %d\n",
__func__, retval);
} else {
printk(KERN_ERR "%s: Invalid RTC value: write of %llx to RTC failed\n",
__func__, nowtime);
retval = -EINVAL;
} return retval;
}
/* * If pm_trace abused the RTC as storage, set the timespec to 0, * which tells the caller that this RTC value is unusable.
*/ if (!pm_trace_rtc_valid()) {
now->tv_sec = now->tv_nsec = 0; return;
}
if (mc146818_get_time(&tm, 1000)) {
pr_err("Unable to read current time from RTC\n");
now->tv_sec = now->tv_nsec = 0; return;
}
pnp_for_each_dev(dev) { for (i = 0; i < ARRAY_SIZE(ids); i++) { if (compare_pnp_id(dev->id, ids[i]) != 0) return 0;
}
} #endif if (!x86_platform.legacy.rtc) return -ENODEV;
platform_device_register(&rtc_device);
dev_info(&rtc_device.dev, "registered platform RTC device (no PNP device found)\n");
return 0;
}
device_initcall(add_rtc_cmos);
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.