FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ffclock.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/timetc.h>
#include "clock_if.h"
Go to the source code of this file.
Data Structures | |
struct | rtc_instance |
Functions | |
__FBSDID ("$FreeBSD$") | |
SYSCTL_INT (_debug, OID_AUTO, clock_show_io, CTLFLAG_RWTUN, &show_io, 0, "Enable debug printing of RTC clock I/O; 1=reads, 2=writes, 3=both.") | |
static int | sysctl_clock_do_io (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_debug, OID_AUTO, clock_do_io, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, 0, sysctl_clock_do_io, "I", "Trigger one-time IO on RTC clocks; 1=read (and discard), 2=write") | |
SYSCTL_INT (_machdep, OID_AUTO, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, "Disallow adjusting time-of-day clock") | |
static void | settime_task_func (void *arg, int pending) |
LIST_HEAD (rtc_listhead, rtc_instance) | |
SX_SYSINIT (rtc_list_lock_init, &rtc_list_lock, "rtc list") | |
static void | clock_dbgprint_hdr (device_t dev, int rw) |
void | clock_dbgprint_bcd (device_t dev, int rw, const struct bcd_clocktime *bct) |
void | clock_dbgprint_ct (device_t dev, int rw, const struct clocktime *ct) |
void | clock_dbgprint_err (device_t dev, int rw, int err) |
void | clock_dbgprint_ts (device_t dev, int rw, const struct timespec *ts) |
void | clock_register_flags (device_t clockdev, long resolution, int flags) |
void | clock_register (device_t dev, long res) |
void | clock_unregister (device_t clockdev) |
void | clock_schedule (device_t clockdev, u_int offsetns) |
static int | read_clocks (struct timespec *ts, bool debug_read) |
void | inittodr (time_t base) |
void | resettodr (void) |
Variables | |
static int | show_io |
static int | disable_rtc_set |
static struct rtc_listhead | rtc_list = LIST_HEAD_INITIALIZER(rtc_list) |
static struct sx | rtc_list_lock |
__FBSDID | ( | "$FreeBSD$" | ) |
void clock_dbgprint_bcd | ( | device_t | dev, |
int | rw, | ||
const struct bcd_clocktime * | bct | ||
) |
Definition at line 171 of file subr_rtc.c.
References clock_dbgprint_hdr(), clock_print_bcd(), printf(), and show_io.
void clock_dbgprint_ct | ( | device_t | dev, |
int | rw, | ||
const struct clocktime * | ct | ||
) |
Definition at line 182 of file subr_rtc.c.
References clock_dbgprint_hdr(), clock_print_ct(), printf(), and show_io.
void clock_dbgprint_err | ( | device_t | dev, |
int | rw, | ||
int | err | ||
) |
Definition at line 193 of file subr_rtc.c.
References clock_dbgprint_hdr(), printf(), and show_io.
|
static |
Definition at line 160 of file subr_rtc.c.
References clock_print_ts(), device_printf(), getnanotime(), and printf().
Referenced by clock_dbgprint_bcd(), clock_dbgprint_ct(), clock_dbgprint_err(), and clock_dbgprint_ts().
void clock_dbgprint_ts | ( | device_t | dev, |
int | rw, | ||
const struct timespec * | ts | ||
) |
Definition at line 203 of file subr_rtc.c.
References clock_dbgprint_hdr(), clock_print_ts(), printf(), show_io, and ts.
void clock_register | ( | device_t | dev, |
long | res | ||
) |
Definition at line 250 of file subr_rtc.c.
References clock_register_flags(), and res.
void clock_register_flags | ( | device_t | clockdev, |
long | resolution, | ||
int | flags | ||
) |
Definition at line 214 of file subr_rtc.c.
References rtc_instance::clockdev, device_printf(), rtc_instance::flags, malloc(), rtc_instance::resadj, rtc_instance::resolution, rtc_instance::rtc_entries, rtc_list, rtc_list_lock, rtc_instance::schedns, settime_task_func(), and rtc_instance::stask.
Referenced by clock_register().
void clock_schedule | ( | device_t | clockdev, |
u_int | offsetns | ||
) |
Definition at line 277 of file subr_rtc.c.
References rtc_instance::clockdev, rtc_instance::rtc_entries, rtc_list, rtc_list_lock, and rtc_instance::schedns.
void clock_unregister | ( | device_t | clockdev | ) |
Definition at line 257 of file subr_rtc.c.
References rtc_instance::clockdev, free(), rtc_instance::rtc_entries, rtc_list, rtc_list_lock, rtc_instance::stask, taskqueue_cancel_timeout(), and taskqueue_drain_timeout().
void inittodr | ( | time_t | base | ) |
Definition at line 334 of file subr_rtc.c.
References printf(), read_clocks(), tc_setclock(), and ts.
Referenced by vfs_mountroot().
LIST_HEAD | ( | rtc_listhead | , |
rtc_instance | |||
) |
|
static |
Definition at line 292 of file subr_rtc.c.
References bootverbose, rtc_instance::clockdev, device_printf(), rtc_instance::flags, rtc_instance::resadj, rtc_instance::rtc_entries, rtc_list, rtc_list_lock, ts, and utc_offset().
Referenced by inittodr(), and sysctl_clock_do_io().
void resettodr | ( | void | ) |
Definition at line 377 of file subr_rtc.c.
References disable_rtc_set, getnanotime(), rtc_instance::rtc_entries, rtc_list, rtc_list_lock, rtc_instance::schedns, rtc_instance::stask, and taskqueue_enqueue_timeout_sbt().
Referenced by periodic_resettodr(), settime(), shutdown_resettodr(), sysctl_clock_do_io(), and sysctl_machdep_adjkerntz().
|
static |
Definition at line 137 of file subr_rtc.c.
References bootverbose, rtc_instance::clockdev, device_printf(), rtc_instance::flags, getnanotime(), rtc_instance::resadj, ts, and utc_offset().
Referenced by clock_register_flags().
SX_SYSINIT | ( | rtc_list_lock_init | , |
& | rtc_list_lock, | ||
"rtc list" | |||
) |
|
static |
Definition at line 404 of file subr_rtc.c.
References printf(), read_clocks(), resettodr(), sysctl_handle_int(), and value.
SYSCTL_INT | ( | _debug | , |
OID_AUTO | , | ||
clock_show_io | , | ||
CTLFLAG_RWTUN | , | ||
& | show_io, | ||
0 | , | ||
"Enable debug printing of RTC clock I/O; | 1 = reads , |
||
2 | = writes |
||
) |
SYSCTL_INT | ( | _machdep | , |
OID_AUTO | , | ||
disable_rtc_set | , | ||
CTLFLAG_RW | , | ||
& | disable_rtc_set, | ||
0 | , | ||
"Disallow adjusting time-of-day clock" | |||
) |
SYSCTL_PROC | ( | _debug | , |
OID_AUTO | , | ||
clock_do_io | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_clock_do_io | , | ||
"I" | , | ||
"Trigger one-time IO on RTC clocks; | 1 = read (and discard) |
||
) |
|
static |
Definition at line 89 of file subr_rtc.c.
Referenced by resettodr().
|
static |
Definition at line 127 of file subr_rtc.c.
Referenced by clock_register_flags(), clock_schedule(), clock_unregister(), read_clocks(), and resettodr().
|
static |
Definition at line 128 of file subr_rtc.c.
Referenced by clock_register_flags(), clock_schedule(), clock_unregister(), read_clocks(), and resettodr().
|
static |
Definition at line 79 of file subr_rtc.c.
Referenced by clock_dbgprint_bcd(), clock_dbgprint_ct(), clock_dbgprint_err(), and clock_dbgprint_ts().