diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-28 23:50:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-01-28 23:50:20 +0000 |
commit | 72f4f57ba7a1995800771745b3ea06271cd0b8f5 (patch) | |
tree | 696a8a6096628fba20fa6a1673abe0cff44b81ac /sys/arch/mvmeppc/dev | |
parent | 8c40da6ce09705ba6c14afaae59329b7701bc8f4 (diff) |
More clock handling cleanup:
- move clock callbacks outside the firmware structure
- map the clock virtual. A bit tricky because it needs to be mapped before
autoconf...
- compensate for the removal of 1:1 segment 8 mapping
Diffstat (limited to 'sys/arch/mvmeppc/dev')
-rw-r--r-- | sys/arch/mvmeppc/dev/clock.c | 28 | ||||
-rw-r--r-- | sys/arch/mvmeppc/dev/nvramreg.h | 11 |
2 files changed, 24 insertions, 15 deletions
diff --git a/sys/arch/mvmeppc/dev/clock.c b/sys/arch/mvmeppc/dev/clock.c index 1e569a49696..8cc39d5bffa 100644 --- a/sys/arch/mvmeppc/dev/clock.c +++ b/sys/arch/mvmeppc/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.7 2004/01/26 22:55:52 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.8 2004/01/28 23:50:16 miod Exp $ */ /* $NetBSD: clock.c,v 1.1 1996/09/30 16:34:40 ws Exp $ */ /* @@ -63,6 +63,12 @@ static volatile u_long lasttb; #define LEAPYEAR(y) (((y) & 3) == 0) #define YEAR0 1900 +tps_t *tps; +clock_read_t *clock_read; +clock_write_t *clock_write; +time_read_t *time_read; +time_write_t *time_write; + static u_int32_t chiptotime(int, int, int, int, int, int); /* event tracking variables, when the next event of each time should occur */ @@ -113,12 +119,12 @@ inittodr(time_t base) badbase = 1; } - if (fw->clock_read != NULL ) { - (fw->clock_read)( &sec, &min, &hour, &day, &mon, &year); + if (clock_read != NULL ) { + (*clock_read)( &sec, &min, &hour, &day, &mon, &year); time.tv_sec = chiptotime(sec, min, hour, day, mon, year); - } else if (fw->time_read != NULL) { - u_long cursec; - (fw->time_read)(&cursec); + } else if (time_read != NULL) { + u_int32_t cursec; + (*time_read)(&cursec); time.tv_sec = cursec; } else { /* force failure */ @@ -246,16 +252,16 @@ void resettodr() { struct timeval curtime = time; - if (fw->clock_write != NULL) { + if (clock_write != NULL) { struct chiptime c; timetochip(&c); - (fw->clock_write)(c.sec, c.min, c.hour, c.day, c.mon, c.year); - } else if (fw->time_write != NULL) { + (*clock_write)(c.sec, c.min, c.hour, c.day, c.mon, c.year); + } else if (time_write != NULL) { curtime.tv_sec -= tz.tz_minuteswest * 60; if (tz.tz_dsttime) { curtime.tv_sec += 3600; } - (fw->time_write)(curtime.tv_sec); + (*time_write)(curtime.tv_sec); } } @@ -398,7 +404,7 @@ calc_delayconst(void) { int s; - ticks_per_sec = ppc_tps(); + ticks_per_sec = (*tps)(); s = ppc_intr_disable(); ns_per_tick = 1000000000 / ticks_per_sec; ticks_per_intr = ticks_per_sec / hz; diff --git a/sys/arch/mvmeppc/dev/nvramreg.h b/sys/arch/mvmeppc/dev/nvramreg.h index 0ea3e1873e1..86769c4f801 100644 --- a/sys/arch/mvmeppc/dev/nvramreg.h +++ b/sys/arch/mvmeppc/dev/nvramreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nvramreg.h,v 1.2 2003/06/02 23:27:53 millert Exp $ */ +/* $OpenBSD: nvramreg.h,v 1.3 2004/01/28 23:50:17 miod Exp $ */ /* * Copyright (c) 1992, 1993 @@ -59,9 +59,12 @@ * 1ff8-1fff TOD clock */ -#define NVRAM_S0 0x80000074 -#define NVRAM_S1 0x80000075 -#define NVRAM_DATA 0x80000077 +#define NVRAM_PA 0x80000000 +#define NVRAM_SIZE 0x2000 + +#define NVRAM_S0 0x00000074 +#define NVRAM_S1 0x00000075 +#define NVRAM_DATA 0x00000077 #define RTC_SECONDS 0x1FF9 #define RTC_MINUTES 0x1FFA |