1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Add wall_cmos_clock sysctl variable, needed to manage adjkerntz even for

UTC cmos clocks (needed for Local Timezone FSes)
This commit is contained in:
Andrey A. Chernov 1996-04-05 03:36:31 +00:00
parent b376966fbf
commit fe0d5f43c5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15045
11 changed files with 59 additions and 35 deletions

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.178 1996/03/11 02:21:42 hsu Exp $
* $Id: machdep.c,v 1.179 1996/03/26 19:57:51 wollman Exp $
*/
#include "npx.h"
@ -1094,6 +1094,9 @@ SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo,
CTLFLAG_RD, &bootinfo, bootinfo, "");
SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
CTLFLAG_RW, &wall_cmos_clock, 0, "");
/*
* Initialize 386 and configure to run kernel
*/

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $
* $Id: clock.c,v 1.54 1996/03/31 04:05:36 bde Exp $
*/
/*
@ -92,8 +92,10 @@
*/
#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
int adjkerntz; /* local offset from GMT in seconds */
int disable_rtc_set; /* disable resettodr() if != 0 */
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
u_int idelayed;
#if defined(I586_CPU) || defined(I686_CPU)
unsigned i586_ctr_rate;
@ -491,7 +493,7 @@ inittodr(time_t base)
/* sec now contains the number of seconds, since Jan 1 1970,
in the local time zone */
sec += tz.tz_minuteswest * 60 + adjkerntz;
sec += tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
s = splclock();
time.tv_sec = sec;
@ -524,7 +526,7 @@ resettodr()
/* Calculate local time to put in RTC */
tm -= tz.tz_minuteswest * 60 + adjkerntz;
tm -= tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */

View File

@ -3,7 +3,7 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
* $Id: clock.h,v 1.9 1996/01/30 18:56:24 wollman Exp $
* $Id: clock.h,v 1.10 1996/03/31 04:05:17 bde Exp $
*/
#ifndef _MACHINE_CLOCK_H_
@ -54,6 +54,8 @@
*/
extern int adjkerntz;
extern int disable_rtc_set;
extern int wall_cmos_clock;
#if defined(I586_CPU) || defined(I686_CPU)
extern unsigned i586_ctr_rate; /* fixed point */
extern long long i586_last_tick;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
* $Id: cpu.h,v 1.21 1995/07/16 10:33:28 phk Exp $
* $Id: cpu.h,v 1.22 1996/03/29 14:14:07 bde Exp $
*/
#ifndef _MACHINE_CPU_H_
@ -112,10 +112,11 @@ struct cpu_nameclass {
* CTL_MACHDEP definitions.
*/
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
#define CPU_ADJKERNTZ 2 /* int: timezone offset for resettodr() */
#define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */
#define CPU_DISRTCSET 3 /* int: disable resettodr() call */
#define CPU_BOOTINFO 4 /* struct: bootinfo */
#define CPU_MAXID 5 /* number of valid machdep ids */
#define CPU_WALLCLOCK 5 /* int: indicates wall CMOS clock */
#define CPU_MAXID 6 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@ -123,6 +124,7 @@ struct cpu_nameclass {
{ "adjkerntz", CTLTYPE_INT }, \
{ "disable_rtc_set", CTLTYPE_INT }, \
{ "bootinfo", CTLTYPE_STRUCT }, \
{ "wall_cmos_clock", CTLTYPE_INT }, \
}
#ifdef KERNEL

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $
* $Id: clock.c,v 1.54 1996/03/31 04:05:36 bde Exp $
*/
/*
@ -92,8 +92,10 @@
*/
#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
int adjkerntz; /* local offset from GMT in seconds */
int disable_rtc_set; /* disable resettodr() if != 0 */
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
u_int idelayed;
#if defined(I586_CPU) || defined(I686_CPU)
unsigned i586_ctr_rate;
@ -491,7 +493,7 @@ inittodr(time_t base)
/* sec now contains the number of seconds, since Jan 1 1970,
in the local time zone */
sec += tz.tz_minuteswest * 60 + adjkerntz;
sec += tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
s = splclock();
time.tv_sec = sec;
@ -524,7 +526,7 @@ resettodr()
/* Calculate local time to put in RTC */
tm -= tz.tz_minuteswest * 60 + adjkerntz;
tm -= tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */

View File

@ -35,7 +35,7 @@
* SUCH DAMAGE.
*
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.178 1996/03/11 02:21:42 hsu Exp $
* $Id: machdep.c,v 1.179 1996/03/26 19:57:51 wollman Exp $
*/
#include "npx.h"
@ -1094,6 +1094,9 @@ SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set,
SYSCTL_STRUCT(_machdep, CPU_BOOTINFO, bootinfo,
CTLFLAG_RD, &bootinfo, bootinfo, "");
SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
CTLFLAG_RW, &wall_cmos_clock, 0, "");
/*
* Initialize 386 and configure to run kernel
*/

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $
* $Id: clock.c,v 1.54 1996/03/31 04:05:36 bde Exp $
*/
/*
@ -92,8 +92,10 @@
*/
#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
int adjkerntz; /* local offset from GMT in seconds */
int disable_rtc_set; /* disable resettodr() if != 0 */
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
u_int idelayed;
#if defined(I586_CPU) || defined(I686_CPU)
unsigned i586_ctr_rate;
@ -491,7 +493,7 @@ inittodr(time_t base)
/* sec now contains the number of seconds, since Jan 1 1970,
in the local time zone */
sec += tz.tz_minuteswest * 60 + adjkerntz;
sec += tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
s = splclock();
time.tv_sec = sec;
@ -524,7 +526,7 @@ resettodr()
/* Calculate local time to put in RTC */
tm -= tz.tz_minuteswest * 60 + adjkerntz;
tm -= tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */

View File

@ -3,7 +3,7 @@
* Garrett Wollman, September 1994.
* This file is in the public domain.
*
* $Id: clock.h,v 1.9 1996/01/30 18:56:24 wollman Exp $
* $Id: clock.h,v 1.10 1996/03/31 04:05:17 bde Exp $
*/
#ifndef _MACHINE_CLOCK_H_
@ -54,6 +54,8 @@
*/
extern int adjkerntz;
extern int disable_rtc_set;
extern int wall_cmos_clock;
#if defined(I586_CPU) || defined(I686_CPU)
extern unsigned i586_ctr_rate; /* fixed point */
extern long long i586_last_tick;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)cpu.h 5.4 (Berkeley) 5/9/91
* $Id: cpu.h,v 1.21 1995/07/16 10:33:28 phk Exp $
* $Id: cpu.h,v 1.22 1996/03/29 14:14:07 bde Exp $
*/
#ifndef _MACHINE_CPU_H_
@ -112,10 +112,11 @@ struct cpu_nameclass {
* CTL_MACHDEP definitions.
*/
#define CPU_CONSDEV 1 /* dev_t: console terminal device */
#define CPU_ADJKERNTZ 2 /* int: timezone offset for resettodr() */
#define CPU_ADJKERNTZ 2 /* int: timezone offset (seconds) */
#define CPU_DISRTCSET 3 /* int: disable resettodr() call */
#define CPU_BOOTINFO 4 /* struct: bootinfo */
#define CPU_MAXID 5 /* number of valid machdep ids */
#define CPU_WALLCLOCK 5 /* int: indicates wall CMOS clock */
#define CPU_MAXID 6 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@ -123,6 +124,7 @@ struct cpu_nameclass {
{ "adjkerntz", CTLTYPE_INT }, \
{ "disable_rtc_set", CTLTYPE_INT }, \
{ "bootinfo", CTLTYPE_STRUCT }, \
{ "wall_cmos_clock", CTLTYPE_INT }, \
}
#ifdef KERNEL

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $
* $Id: clock.c,v 1.54 1996/03/31 04:05:36 bde Exp $
*/
/*
@ -92,8 +92,10 @@
*/
#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
int adjkerntz; /* local offset from GMT in seconds */
int disable_rtc_set; /* disable resettodr() if != 0 */
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
u_int idelayed;
#if defined(I586_CPU) || defined(I686_CPU)
unsigned i586_ctr_rate;
@ -491,7 +493,7 @@ inittodr(time_t base)
/* sec now contains the number of seconds, since Jan 1 1970,
in the local time zone */
sec += tz.tz_minuteswest * 60 + adjkerntz;
sec += tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
s = splclock();
time.tv_sec = sec;
@ -524,7 +526,7 @@ resettodr()
/* Calculate local time to put in RTC */
tm -= tz.tz_minuteswest * 60 + adjkerntz;
tm -= tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)clock.c 7.2 (Berkeley) 5/12/91
* $Id: clock.c,v 1.53 1996/03/23 21:36:03 nate Exp $
* $Id: clock.c,v 1.54 1996/03/31 04:05:36 bde Exp $
*/
/*
@ -92,8 +92,10 @@
*/
#define TIMER0_MIN_MAX_COUNT TIMER_DIV(20000)
int adjkerntz = 0; /* offset from CMOS clock */
int disable_rtc_set = 0; /* disable resettodr() if != 0 */
int adjkerntz; /* local offset from GMT in seconds */
int disable_rtc_set; /* disable resettodr() if != 0 */
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
u_int idelayed;
#if defined(I586_CPU) || defined(I686_CPU)
unsigned i586_ctr_rate;
@ -491,7 +493,7 @@ inittodr(time_t base)
/* sec now contains the number of seconds, since Jan 1 1970,
in the local time zone */
sec += tz.tz_minuteswest * 60 + adjkerntz;
sec += tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
s = splclock();
time.tv_sec = sec;
@ -524,7 +526,7 @@ resettodr()
/* Calculate local time to put in RTC */
tm -= tz.tz_minuteswest * 60 + adjkerntz;
tm -= tz.tz_minuteswest * 60 + wall_cmos_clock ? adjkerntz : 0;
writertc(RTC_SEC, bin2bcd(tm%60)); tm /= 60; /* Write back Seconds */
writertc(RTC_MIN, bin2bcd(tm%60)); tm /= 60; /* Write back Minutes */