First part of a little cleanup in the calendar/timezone/RTC handling.

Move relevant variables to <sys/clock.h> and fix #includes as necessary.

Use libkern's much more time- & spamce-efficient BCD routines.
This commit is contained in:
Poul-Henning Kamp 2006-10-02 12:59:59 +00:00
parent 77ec673a84
commit f645b0b51c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162954
30 changed files with 43 additions and 35 deletions

View File

@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/callout.h>
#include <sys/clock.h>
#include <sys/cons.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>

View File

@ -14,9 +14,7 @@
* i386 to clock driver interface.
* XXX large parts of the driver and its interface are misplaced.
*/
extern int adjkerntz;
extern int clkintr_pending;
extern int disable_rtc_set;
extern int pscnt;
extern int psdiv;
extern int statclock_disable;
@ -24,7 +22,6 @@ extern u_int timer_freq;
extern int timer0_max_count;
extern uint64_t tsc_freq;
extern int tsc_is_broken;
extern int wall_cmos_clock;
extern struct mtx clock_lock;
/*

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>

View File

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/clock.h>
#include <sys/imgact.h>
#include <sys/limits.h>
#include <sys/lock.h>

View File

@ -29,7 +29,4 @@
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
#define wall_cmos_clock 0
#define adjkerntz 0
#endif /* !_MACHINE_CLOCK_H_ */

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
#include <sys/filedesc.h>

View File

@ -53,6 +53,7 @@
#include <sys/sysctl.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/clock.h>
#include <sys/disk.h>
#include <sys/stat.h>
#include <sys/devicestat.h>
@ -60,7 +61,6 @@
#include <machine/bus.h>
#include <machine/resource.h>
#include <machine/clock.h>
#include <machine/stdarg.h>
#include <vm/vm.h>

View File

@ -49,6 +49,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysctl.h>
@ -56,7 +57,6 @@
#include <sys/taskqueue.h>
#include <machine/bus.h>
#include <machine/clock.h>
#include <machine/endian.h>
#include <machine/stdarg.h>

View File

@ -52,7 +52,7 @@
* System include files.
*/
#include <sys/param.h>
#include <sys/time.h>
#include <sys/clock.h>
#include <sys/kernel.h> /* defines tz */
#include <sys/systm.h>
#include <machine/clock.h>

View File

@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/clock.h>
#include <sys/lockmgr.h>
#include <sys/malloc.h>
#include <machine/clock.h>

View File

@ -22,6 +22,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/conf.h>
#include <sys/condvar.h>
#include <sys/eventhandler.h>

View File

@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/callout.h>
#include <sys/clock.h>
#include <sys/cons.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/sysproto.h>
#include <sys/clock.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/malloc.h>

View File

@ -14,9 +14,7 @@
* i386 to clock driver interface.
* XXX large parts of the driver and its interface are misplaced.
*/
extern int adjkerntz;
extern int clkintr_pending;
extern int disable_rtc_set;
extern int pscnt;
extern int psdiv;
extern int statclock_disable;
@ -24,7 +22,6 @@ extern u_int timer_freq;
extern int timer0_max_count;
extern uint64_t tsc_freq;
extern int tsc_is_broken;
extern int wall_cmos_clock;
extern struct mtx clock_lock;
/*

View File

@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/syslog.h>

View File

@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/clock.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/systm.h>

View File

@ -13,10 +13,6 @@
#define CLOCK_VECTOR 254
extern int adjkerntz;
extern int disable_rtc_set;
extern int wall_cmos_clock;
extern uint64_t ia64_clock_reload;
extern uint64_t itc_frequency;

View File

@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/limits.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sysproto.h>

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/clock.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/libkern.h>

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>

View File

@ -56,6 +56,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>

View File

@ -56,6 +56,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/lock.h>
#include <sys/kdb.h>
#include <sys/mutex.h>

View File

@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/callout.h>
#include <sys/clock.h>
#include <sys/cons.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>

View File

@ -11,10 +11,6 @@
#ifdef _KERNEL
extern int disable_rtc_set;
extern int wall_cmos_clock;
extern int adjkerntz;
struct trapframe;
int sysbeep(int pitch, int period);

View File

@ -33,9 +33,6 @@ extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;
extern int adjkerntz;
extern int wall_cmos_clock;
int sysbeep(int, int);
#endif /* !_MACHINE_CLOCK_H_ */

View File

@ -41,6 +41,24 @@
#ifndef _SYS_CLOCK_H_
#define _SYS_CLOCK_H_
#ifdef _KERNEL /* No user serviceable parts */
/*
* Kernel to clock driver interface.
*/
void inittodr(time_t base);
void resettodr(void);
void startrtclock(void);
extern int wall_cmos_clock;
extern int adjkerntz;
extern int disable_rtc_set;
/*
* Timezone info from settimeofday(2), usually not used
*/
extern int tz_minuteswest;
extern int tz_dsttime;
/*
* Structure to hold the values typically reported by time-of-day clocks.
* This can be passed to the generic conversion functions to be converted
@ -64,8 +82,8 @@ void clock_register(device_t, long);
/*
* BCD to decimal and decimal to BCD.
*/
#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf))
#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10))
#define FROMBCD(x) bcd2bin(x)
#define TOBCD(x) bin2bcd(x)
/* Some handy constants. */
#define SECDAY (24 * 60 * 60)
@ -74,4 +92,6 @@ void clock_register(device_t, long);
/* Traditional POSIX base year */
#define POSIX_BASE_YEAR 1970
#endif /* _KERNEL */
#endif /* !_SYS_CLOCK_H_ */

View File

@ -69,9 +69,6 @@ extern int profprocs; /* number of process's profiling */
extern int ticks;
extern int lbolt; /* once a second sleep address */
extern int tz_minuteswest;
extern int tz_dsttime;
#endif /* _KERNEL */
/*

View File

@ -266,13 +266,6 @@ void usrinfoinit(void);
/* Finalize the world. */
void shutdown_nice(int);
/*
* Kernel to clock driver interface.
*/
void inittodr(time_t base);
void resettodr(void);
void startrtclock(void);
/* Timeouts */
typedef void timeout_t(void *); /* timeout function type */
#define CALLOUT_HANDLE_INITIALIZER(handle) \