diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 9d26e53298c4..43fbfc324e67 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/amd64/include/clock.h b/sys/amd64/include/clock.h index b7fafcf4ddac..de09de3f1fd4 100644 --- a/sys/amd64/include/clock.h +++ b/sys/amd64/include/clock.h @@ -27,6 +27,7 @@ void i8254_init(void); * Driver to clock driver interface. */ +void startrtclock(void); void init_TSC(void); void init_TSC_tc(void); diff --git a/sys/amd64/isa/clock.c b/sys/amd64/isa/clock.c index d66505999b34..91598d5306d7 100644 --- a/sys/amd64/isa/clock.c +++ b/sys/amd64/isa/clock.c @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/arm/sa11x0/sa11x0_ost.c b/sys/arm/sa11x0/sa11x0_ost.c index 6dd4cf34b0a8..1ffb26ca8984 100644 --- a/sys/arm/sa11x0/sa11x0_ost.c +++ b/sys/arm/sa11x0/sa11x0_ost.c @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index a84472834961..61207239d7f9 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -22,7 +22,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 54b5e9df5589..b1a0d743b599 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/i386/include/clock.h b/sys/i386/include/clock.h index 3817e32d3ec0..5a724161bf1c 100644 --- a/sys/i386/include/clock.h +++ b/sys/i386/include/clock.h @@ -27,6 +27,7 @@ void i8254_init(void); * Driver to clock driver interface. */ +void startrtclock(void); void timer_restore(void); void init_TSC(void); void init_TSC_tc(void); diff --git a/sys/i386/isa/clock.c b/sys/i386/isa/clock.c index 3c44baf37c36..93a06a3b9a13 100644 --- a/sys/i386/isa/clock.c +++ b/sys/i386/isa/clock.c @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/i386/isa/pmtimer.c b/sys/i386/isa/pmtimer.c index 87eda2d4b0a2..1eeac6ddf46b 100644 --- a/sys/i386/isa/pmtimer.c +++ b/sys/i386/isa/pmtimer.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/ia64/ia64/clock.c b/sys/ia64/ia64/clock.c index c774dad82635..22fcf9bf452c 100644 --- a/sys/ia64/ia64/clock.c +++ b/sys/ia64/ia64/clock.c @@ -29,12 +29,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include #include -#include #include #include diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 7ce78b8b0c1a..45e57ded9b1e 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -261,7 +261,6 @@ cpu_startup(dummy) */ identifycpu(); - /* startrtclock(); */ #ifdef PERFMON perfmon_init(); #endif diff --git a/sys/kern/subr_clock.c b/sys/kern/subr_clock.c index e8a847e2236d..ffc70afa353c 100644 --- a/sys/kern/subr_clock.c +++ b/sys/kern/subr_clock.c @@ -52,18 +52,14 @@ __FBSDID("$FreeBSD$"); #define ct_debug bootverbose static int adjkerntz; /* local offset from GMT in seconds */ static int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ -int disable_rtc_set; /* disable resettodr() if != 0 */ int tz_minuteswest; int tz_dsttime; /* - * These have traditionally been in machdep, but should probably be moved to + * This have traditionally been in machdep, but should probably be moved to * kern. */ -SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, - CTLFLAG_RW, &disable_rtc_set, 0, ""); - SYSCTL_INT(_machdep, OID_AUTO, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); @@ -71,8 +67,7 @@ static int sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) { int error; - error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, - req); + error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, req); if (!error && req->newptr) resettodr(); return (error); diff --git a/sys/kern/subr_rtc.c b/sys/kern/subr_rtc.c index df0df32d6023..1ec10fa7461f 100644 --- a/sys/kern/subr_rtc.c +++ b/sys/kern/subr_rtc.c @@ -63,6 +63,11 @@ __FBSDID("$FreeBSD$"); static device_t clock_dev = NULL; static long clock_res; +/* XXX: should be kern. now, it's no longer machdep. */ +static int disable_rtc_set; +SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, + CTLFLAG_RW, &disable_rtc_set, 0, ""); + void clock_register(device_t dev, long res) /* res has units of microseconds */ { @@ -118,6 +123,7 @@ inittodr(time_t base) "will not be set accurately\n"); return; } + /* XXX: We should poll all registered RTCs in case of failure */ error = CLOCK_GETTIME(clock_dev, &ts); if (error != 0 && error != EINVAL) { printf("warning: clock_gettime failed (%d), the system time " @@ -158,6 +164,7 @@ resettodr() getnanotime(&ts); ts.tv_sec -= utc_offset(); + /* XXX: We should really set all registered RTCs */ if ((error = CLOCK_SETTIME(clock_dev, &ts)) != 0) { printf("warning: clock_settime failed (%d), time-of-day clock " "not adjusted to system time\n", error); diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index cfaec358f2d6..34166e739e16 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index 7185bb5f4237..aac2e00cee80 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index ff4bd8f3931f..86dc687a8647 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index dd524c99b247..942b80478c53 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -60,7 +60,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/powerpc/aim/clock.c b/sys/powerpc/aim/clock.c index 01164751faac..1911220dfbad 100644 --- a/sys/powerpc/aim/clock.c +++ b/sys/powerpc/aim/clock.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index f28d5c20de9a..d40731443f2c 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -196,7 +196,6 @@ cpu_startup(void *dummy) */ cpu_setup(PCPU_GET(cpuid)); - /* startrtclock(); */ #ifdef PERFMON perfmon_init(); #endif diff --git a/sys/powerpc/booke/clock.c b/sys/powerpc/booke/clock.c index 3ba58c0fc72e..707016121e54 100644 --- a/sys/powerpc/booke/clock.c +++ b/sys/powerpc/booke/clock.c @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include diff --git a/sys/sys/clock.h b/sys/sys/clock.h index 00f682148238..c08683eb1b4c 100644 --- a/sys/sys/clock.h +++ b/sys/sys/clock.h @@ -35,6 +35,19 @@ * * $NetBSD: clock_subr.h,v 1.7 2000/10/03 13:41:07 tsutsui Exp $ * + * + * This file is the central clearing-house for calendrical issues. + * + * In general the kernel does not know about minutes, hours, days, timezones, + * daylight savings time, leap-years and such. All that is theoretically a + * matter for userland only. + * + * Parts of kernel code does however care: badly designed filesystems store + * timestamps in local time and RTC chips sometimes track time in a local + * timezone instead of UTC and so on. + * + * All that code should go here for service. + * * $FreeBSD$ */ @@ -43,15 +56,6 @@ #ifdef _KERNEL /* No user serviceable parts */ -/* - * Kernel to clock driver interface. - */ -void inittodr(time_t base); -void resettodr(void); -void startrtclock(void); - -extern int disable_rtc_set; - /* * Timezone info from settimeofday(2), usually not used */ diff --git a/sys/sys/time.h b/sys/sys/time.h index b12b6d89ad54..320a12124a6c 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -255,6 +255,13 @@ struct clockinfo { #endif #ifdef _KERNEL + +/* + * Kernel to clock driver interface. + */ +void inittodr(time_t base); +void resettodr(void); + extern time_t time_second; extern time_t time_uptime; extern struct timeval boottime;