- Adapt mkclock_isa.c to MI mk48txx(4) changes.

- Switch mcclock_isa.c to use MI mc146818 driver.
- Use todr(9) interface with both todclock drivers.
This commit is contained in:
tsutsui 2003-11-01 22:54:46 +00:00
parent 2ddfa78de4
commit 4e8b58dd02
5 changed files with 108 additions and 295 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.prep,v 1.43 2003/07/27 01:19:30 thorpej Exp $
# $NetBSD: files.prep,v 1.44 2003/11/01 22:54:46 tsutsui Exp $
#
# prep-specific configuration info
#
@ -119,9 +119,8 @@ file arch/prep/isa/isapnp_machdep.c isapnp
# clock
#
# mc146818 and compat.
device mcclock
device mcclock: mc146818
attach mcclock at isa with mcclock_isa
file arch/prep/prep/mcclock.c mcclock
file arch/prep/isa/mcclock_isa.c mcclock_isa
# mk48t18 and compat.

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.9 2003/07/15 02:54:51 lukem Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.10 2003/11/01 22:54:46 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.9 2003/07/15 02:54:51 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 2003/11/01 22:54:46 tsutsui Exp $");
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
@ -41,33 +41,21 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.9 2003/07/15 02:54:51 lukem Exp $"
#include <dev/clock_subr.h>
#include <dev/ic/mc146818reg.h>
#include <prep/prep/clockvar.h>
#include <prep/prep/mcclockvar.h>
#include <dev/ic/mc146818var.h>
#include <dev/isa/isavar.h>
#define MCCLOCK_NPORTS 2
struct mcclock_isa_softc {
struct mcclock_softc sc_mcclock;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
};
int mcclock_isa_match __P((struct device *, struct cfdata *, void *));
void mcclock_isa_attach __P((struct device *, struct device *, void *));
CFATTACH_DECL(mcclock_isa, sizeof (struct mcclock_isa_softc),
CFATTACH_DECL(mcclock_isa, sizeof (struct mc146818_softc),
mcclock_isa_match, mcclock_isa_attach, NULL, NULL);
void mcclock_isa_write __P((struct mcclock_softc *, u_int, u_int));
u_int mcclock_isa_read __P((struct mcclock_softc *, u_int));
void mcclock_isa_write __P((struct mc146818_softc *, u_int, u_int));
u_int mcclock_isa_read __P((struct mc146818_softc *, u_int));
const struct mcclock_busfns mcclock_isa_busfns = {
mcclock_isa_write, mcclock_isa_read,
};
int
mcclock_isa_match(parent, match, aux)
@ -76,8 +64,7 @@ mcclock_isa_match(parent, match, aux)
void *aux;
{
struct isa_attach_args *ia = aux;
struct mcclock_isa_softc sc;
bus_space_handle_t ioh;
struct mc146818_softc mc146818, *sc;
unsigned int cra, t1, t2;
int found;
@ -100,25 +87,24 @@ mcclock_isa_match(parent, match, aux)
(ia->ia_drq[0].ir_drq != ISACF_DRQ_DEFAULT))
return (0);
if (bus_space_map(ia->ia_iot, 0x70, MCCLOCK_NPORTS, 0, &ioh))
sc = &mc146818;
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, 0x70, MCCLOCK_NPORTS, 0, &sc->sc_bsh))
return (0);
sc.sc_iot = ia->ia_iot;
sc.sc_ioh = ioh;
/* Supposedly no update in progress after POST; check for this. */
cra = mcclock_isa_read((struct mcclock_softc *)&sc, MC_REGA);
cra = mcclock_isa_read(sc, MC_REGA);
if (cra & MC_REGA_UIP)
goto unmap;
/* Read from the seconds counter. */
t1 = FROMBCD(mcclock_isa_read((struct mcclock_softc *)&sc, MC_SEC));
t1 = FROMBCD(mcclock_isa_read(sc, MC_SEC));
if (t1 > 59)
goto unmap;
/* Wait, then look again. */
DELAY(1100000);
t2 = FROMBCD(mcclock_isa_read((struct mcclock_softc *)&sc, MC_SEC));
t2 = FROMBCD(mcclock_isa_read(sc, MC_SEC));
if (t2 > 59)
goto unmap;
@ -131,7 +117,7 @@ mcclock_isa_match(parent, match, aux)
found = 1;
unmap:
bus_space_unmap(ia->ia_iot, ioh, MCCLOCK_NPORTS);
bus_space_unmap(sc->sc_bst, sc->sc_bsh, MCCLOCK_NPORTS);
if (found) {
ia->ia_nio = 1;
@ -151,40 +137,49 @@ mcclock_isa_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct mc146818_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)self;
sc->sc_iot = ia->ia_iot;
if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr,
ia->ia_io[0].ir_size, 0, &sc->sc_ioh))
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, ia->ia_io[0].ir_addr,
ia->ia_io[0].ir_size, 0, &sc->sc_bsh))
panic("mcclock_isa_attach: couldn't map clock I/O space");
mcclock_attach(&sc->sc_mcclock, &mcclock_isa_busfns);
sc->sc_year0 = 1900;
sc->sc_mcread = mcclock_isa_read;
sc->sc_mcwrite = mcclock_isa_write;
mc146818_attach(sc);
todr_attach(&sc->sc_handle);
}
void
mcclock_isa_write(mcsc, reg, datum)
struct mcclock_softc *mcsc;
mcclock_isa_write(sc, reg, datum)
struct mc146818_softc *sc;
u_int reg, datum;
{
struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)mcsc;
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
bus_space_tag_t iot;
bus_space_handle_t ioh;
iot = sc->sc_bst;
ioh = sc->sc_bsh;
bus_space_write_1(iot, ioh, 0, reg);
bus_space_write_1(iot, ioh, 1, datum);
}
u_int
mcclock_isa_read(mcsc, reg)
struct mcclock_softc *mcsc;
mcclock_isa_read(sc, reg)
struct mc146818_softc *sc;
u_int reg;
{
struct mcclock_isa_softc *sc = (struct mcclock_isa_softc *)mcsc;
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
bus_space_tag_t iot;
bus_space_handle_t ioh;
u_int datum;
iot = sc->sc_bst;
ioh = sc->sc_bsh;
bus_space_write_1(iot, ioh, 0, reg);
datum = bus_space_read_1(iot, ioh, 1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkclock_isa.c,v 1.5 2002/10/02 15:52:29 thorpej Exp $ */
/* $NetBSD: mkclock_isa.c,v 1.6 2003/11/01 22:54:46 tsutsui Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -42,20 +42,19 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mkclock_isa.c,v 1.5 2002/10/02 15:52:29 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: mkclock_isa.c,v 1.6 2003/11/01 22:54:46 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <prep/prep/clockvar.h>
#include <machine/bus.h>
#include <machine/residual.h>
#include <dev/clock_subr.h>
#include <dev/ic/mk48txxreg.h>
#include <dev/ic/mk48txxvar.h>
#include <dev/isa/isavar.h>
@ -68,44 +67,23 @@ __KERNEL_RCSID(0, "$NetBSD: mkclock_isa.c,v 1.5 2002/10/02 15:52:29 thorpej Exp
#define MKCLOCK_NPORTS (MKCLOCK_DATA - MKCLOCK_STB0 + 1)
struct mkclock_isa_softc {
struct device sc_dev; /* Base device */
bus_space_tag_t sc_iot; /* I/O space access */
bus_space_handle_t sc_ioh;
todr_chip_handle_t sc_todr; /* MI todr interface handle */
};
/* Autoconfiguration interface */
int mkclock_isa_match(struct device *, struct cfdata *, void *);
void mkclock_isa_attach(struct device *, struct device *, void *);
CFATTACH_DECL(mkclock_isa, sizeof (struct mkclock_isa_softc),
CFATTACH_DECL(mkclock_isa, sizeof (struct mk48txx_softc),
mkclock_isa_match, mkclock_isa_attach, NULL, NULL);
/* mk48txx interface */
uint8_t mkclock_isa_nvrd(bus_space_tag_t, bus_space_handle_t, int);
void mkclock_isa_nvwr(bus_space_tag_t, bus_space_handle_t, int, uint8_t);
/* MI todr/PReP clock handling shim */
void mkclock_isa_init(struct device *);
void mkclock_isa_get(struct device *, time_t, struct clocktime *);
void mkclock_isa_set(struct device *, struct clocktime *);
struct clockfns mkclock_isa_clockfns = {
mkclock_isa_init, /* cf_init */
mkclock_isa_get, /* cf_get */
mkclock_isa_set /* cf_set */
};
uint8_t mkclock_isa_nvrd(struct mk48txx_softc *, int);
void mkclock_isa_nvwr(struct mk48txx_softc *, int, uint8_t);
int
mkclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
struct mk48txx_softc mk48txx, *sc;
uint8_t csr, ocsr;
unsigned int t1, t2;
int found;
@ -135,34 +113,33 @@ mkclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
/*
* Map I/O space, then try to determine if it's really there.
*/
if (bus_space_map(ia->ia_iot, 0x74, MKCLOCK_NPORTS, 0, &ioh))
sc = &mk48txx;
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, 0x74, MKCLOCK_NPORTS, 0, &sc->sc_bsh))
return (0);
/* Supposedly no control bits are set after POST; check for this. */
ocsr = mkclock_isa_nvrd(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR);
ocsr = mkclock_isa_nvrd(sc, MK48T18_CLKOFF + MK48TXX_ICSR);
if (ocsr != 0)
goto unmap;
/* Set clock data to read mode, prohibiting updates from clock. */
csr = ocsr | MK48TXX_CSR_READ;
mkclock_isa_nvwr(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR, csr);
mkclock_isa_nvwr(sc, MK48T18_CLKOFF + MK48TXX_ICSR, csr);
/* Compare. */
if (mkclock_isa_nvrd(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR)
!= csr)
if (mkclock_isa_nvrd(sc, MK48T18_CLKOFF + MK48TXX_ICSR) != csr)
goto restore;
/* Read from the seconds counter. */
t1 = FROMBCD(mkclock_isa_nvrd(ia->ia_iot, ioh,
MK48T18_CLKOFF + MK48TXX_ISEC));
t1 = FROMBCD(mkclock_isa_nvrd(sc, MK48T18_CLKOFF + MK48TXX_ISEC));
if (t1 > 59)
goto restore;
/* Make it tick again, wait, then look again. */
mkclock_isa_nvwr(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR, ocsr);
mkclock_isa_nvwr(sc, MK48T18_CLKOFF + MK48TXX_ICSR, ocsr);
DELAY(1100000);
mkclock_isa_nvwr(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR, csr);
t2 = FROMBCD(mkclock_isa_nvrd(ia->ia_iot, ioh,
MK48T18_CLKOFF + MK48TXX_ISEC));
mkclock_isa_nvwr(sc, MK48T18_CLKOFF + MK48TXX_ICSR, csr);
t2 = FROMBCD(mkclock_isa_nvrd(sc, MK48T18_CLKOFF + MK48TXX_ISEC));
if (t2 > 59)
goto restore;
@ -175,9 +152,9 @@ mkclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
found = 1;
restore:
mkclock_isa_nvwr(ia->ia_iot, ioh, MK48T18_CLKOFF + MK48TXX_ICSR, ocsr);
mkclock_isa_nvwr(sc, MK48T18_CLKOFF + MK48TXX_ICSR, ocsr);
unmap:
bus_space_unmap(ia->ia_iot, ioh, MKCLOCK_NPORTS);
bus_space_unmap(sc->sc_bst, sc->sc_bsh, MKCLOCK_NPORTS);
if (found) {
ia->ia_nio = 1;
@ -195,84 +172,33 @@ mkclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
void
mkclock_isa_attach(struct device *parent, struct device *self, void *aux)
{
struct mk48txx_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
struct mkclock_isa_softc *sc = (struct mkclock_isa_softc *)self;
/* Map I/O space. */
sc->sc_iot = ia->ia_iot;
if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr,
ia->ia_io[0].ir_size, 0, &sc->sc_ioh))
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, ia->ia_io[0].ir_addr,
ia->ia_io[0].ir_size, 0, &sc->sc_bsh))
panic("mkclock_isa_attach: couldn't map clock I/O space");
/* Attach to MI mk48txx driver. */
sc->sc_todr = mk48txx_attach(sc->sc_iot, sc->sc_ioh, "mk48t18", 1900,
mkclock_isa_nvrd, mkclock_isa_nvwr);
if (sc->sc_todr == NULL)
panic("\nmkclock_isa_attach: mk48txx attach failed");
sc->sc_model = "mk48t18";
sc->sc_year0 = 1900;
sc->sc_nvrd = mkclock_isa_nvrd;
sc->sc_nvwr = mkclock_isa_nvwr;
mk48txx_attach(sc);
clockattach(self, &mkclock_isa_clockfns);
}
/*
* Shim to interface mk48txx's MI TODR handling with current PReP structure.
*/
void
mkclock_isa_init(struct device *self)
{
/* Nothing to be done. */
}
void
mkclock_isa_get(struct device *self, time_t base, struct clocktime *ct)
{
struct mkclock_isa_softc *sc = (struct mkclock_isa_softc *)self;
struct clock_ymdhms dt;
struct timeval tv;
todr_gettime(sc->sc_todr, &tv);
/* Note: we ignore `tv_usec'. */
clock_secs_to_ymdhms(tv.tv_sec, &dt);
ct->year = dt.dt_year - 1900;
ct->mon = dt.dt_mon;
ct->day = dt.dt_day;
ct->hour = dt.dt_hour;
ct->min = dt.dt_min;
ct->sec = dt.dt_sec;
ct->dow = dt.dt_wday;
}
void
mkclock_isa_set(struct device *self, struct clocktime *ct)
{
struct mkclock_isa_softc *sc = (struct mkclock_isa_softc *)self;
struct clock_ymdhms dt;
struct timeval tv;
dt.dt_year = ct->year + 1900;
if (dt.dt_year < 1970)
dt.dt_year += 100;
dt.dt_mon = ct->mon;
dt.dt_day = ct->day;
dt.dt_wday = ct->dow;
dt.dt_hour = ct->hour;
dt.dt_min = ct->min;
dt.dt_sec = ct->sec;
tv.tv_sec = clock_ymdhms_to_secs(&dt);
tv.tv_usec = 0;
todr_settime(sc->sc_todr, &tv);
todr_attach(&sc->sc_handle);
}
/*
* Bus access methods for MI mk48txx driver.
*/
uint8_t
mkclock_isa_nvrd(bus_space_tag_t iot, bus_space_handle_t ioh, int off)
mkclock_isa_nvrd(struct mk48txx_softc *sc, int off)
{
bus_space_tag_t iot;
bus_space_handle_t ioh;
uint8_t datum;
int s;
@ -280,6 +206,9 @@ mkclock_isa_nvrd(bus_space_tag_t iot, bus_space_handle_t ioh, int off)
printf("mkclock_isa_nvrd(%d)", off);
#endif
iot = sc->sc_bst;
ioh = sc->sc_bsh;
s = splclock();
bus_space_write_1(iot, ioh, MKCLOCK_STB0, off & 0xff);
bus_space_write_1(iot, ioh, MKCLOCK_STB1, off >> 8);
@ -294,14 +223,17 @@ mkclock_isa_nvrd(bus_space_tag_t iot, bus_space_handle_t ioh, int off)
}
void
mkclock_isa_nvwr(bus_space_tag_t iot, bus_space_handle_t ioh, int off,
uint8_t datum)
mkclock_isa_nvwr(struct mk48txx_softc *sc, int off, uint8_t datum)
{
bus_space_tag_t iot;
bus_space_handle_t ioh;
int s;
#ifdef DEBUG
printf("mkclock_isa_nvwr(%d, %02x)\n", off, datum);
#endif
iot = sc->sc_bst;
ioh = sc->sc_bsh;
s = splclock();
bus_space_write_1(iot, ioh, MKCLOCK_STB0, off & 0xff);

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.6 2003/07/15 02:54:52 lukem Exp $ */
/* $NetBSD: clock.c,v 1.7 2003/11/01 22:54:46 tsutsui Exp $ */
/* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */
/*
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.6 2003/07/15 02:54:52 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.7 2003/11/01 22:54:46 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -42,8 +42,6 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.6 2003/07/15 02:54:52 lukem Exp $");
#include <dev/clock_subr.h>
#include <prep/prep/clockvar.h>
#define MINYEAR 1990
void decr_intr __P((struct clockframe *));
@ -58,21 +56,18 @@ static volatile u_long lasttb;
struct device *clockdev;
const struct clockfns *clockfns;
int clockinitted;
static todr_chip_handle_t todr_handle;
void
clockattach(dev, fns)
struct device *dev;
const struct clockfns *fns;
todr_attach(handle)
todr_chip_handle_t handle;
{
printf("\n");
if (todr_handle)
panic("todr_attach: to many todclock configured");
if (clockfns != NULL)
panic("clockattach: multiple clocks");
clockdev = dev;
clockfns = fns;
todr_handle = handle;
}
/*
@ -97,72 +92,42 @@ void
inittodr(base)
time_t base;
{
struct clocktime ct;
int year;
struct clock_ymdhms dt;
time_t deltat;
int badbase = 0;
int badbase, waszero;
badbase = 0;
waszero = (base == 0);
if (base < (MINYEAR - 1970) * SECYR) {
printf("WARNING: preposterous time in file system");
if (base != 0)
printf("WARNING: preposterous time in file system\n");
/* read the system clock anyway */
base = (MINYEAR - 1970) * SECYR + 186 * SECDAY + SECDAY / 2;
badbase = 1;
}
(*clockfns->cf_get)(clockdev, base, &ct);
#ifdef DEBUG
printf("readclock: %d/%d/%d/%d/%d/%d", ct.year, ct.mon, ct.day,
ct.hour, ct.min, ct.sec);
#endif
clockinitted = 1;
year = 1900 + ct.year;
if (year < 1970)
year += 100;
/* simple sanity checks (2037 = time_t overflow) */
if (year < MINYEAR || year > 2037 ||
ct.mon < 1 || ct.mon > 12 || ct.day < 1 ||
ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) {
if (todr_gettime(todr_handle, (struct timeval *)&time) != 0 ||
time.tv_sec == 0) {
printf("WARNING: bad date in battery clock");
/*
* Believe the time in the file system for lack of
* anything better, resetting the TODR.
* anything better, resetting the clock.
*/
time.tv_sec = base;
if (!badbase) {
printf("WARNING: preposterous clock chip time\n");
if (!badbase)
resettodr();
}
goto bad;
}
dt.dt_year = year;
dt.dt_mon = ct.mon;
dt.dt_day = ct.day;
dt.dt_hour = ct.hour;
dt.dt_min = ct.min;
dt.dt_sec = ct.sec;
time.tv_sec = clock_ymdhms_to_secs(&dt);
#ifdef DEBUG
printf("=>%ld (%d)\n", (long int)time.tv_sec, (int)base);
#endif
if (!badbase) {
} else {
/*
* See if we gained/lost two or more days;
* if so, assume something is amiss.
*/
deltat = time.tv_sec - base;
int deltat = time.tv_sec - base;
if (deltat < 0)
deltat = -deltat;
if (deltat < 2 * SECDAY)
if (waszero || deltat < 2 * SECDAY)
return;
printf("WARNING: clock %s %ld days",
time.tv_sec < base ? "lost" : "gained",
(long)deltat / SECDAY);
printf("WARNING: clock %s %d days",
time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
}
bad:
printf(" -- CHECK AND RESET THE DATE!\n");
}
@ -176,28 +141,12 @@ bad:
void
resettodr()
{
struct clock_ymdhms dt;
struct clocktime ct;
if (!clockinitted)
if (time.tv_sec == 0)
return;
clock_secs_to_ymdhms(time.tv_sec, &dt);
/* rt clock wants 2 digits */
ct.year = dt.dt_year % 100;
ct.mon = dt.dt_mon;
ct.day = dt.dt_day;
ct.hour = dt.dt_hour;
ct.min = dt.dt_min;
ct.sec = dt.dt_sec;
ct.dow = dt.dt_wday;
#ifdef DEBUG
printf("setclock: %d/%d/%d/%d/%d/%d\n", ct.year, ct.mon, ct.day,
ct.hour, ct.min, ct.sec);
#endif
(*clockfns->cf_set)(clockdev, &ct);
if (todr_settime(todr_handle, (struct timeval *)&time) != 0)
printf("resettodr: cannot set time in time-of-day clock\n");
}
/*

View File

@ -1,62 +0,0 @@
/* $NetBSD: clockvar.h,v 1.1 2000/02/29 15:21:47 nonaka Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* Definitions for cpu-independent clock handling for the alpha and pmax.
*/
/*
* clocktime structure:
*
* structure passed to TOY clocks when setting them. broken out this
* way, so that the time_t -> field conversion can be shared.
*/
struct clocktime {
int year; /* year - 1900 */
int mon; /* month (1 - 12) */
int day; /* day (1 - 31) */
int hour; /* hour (0 - 23) */
int min; /* minute (0 - 59) */
int sec; /* second (0 - 59) */
int dow; /* day of week (0 - 6; 0 = Sunday) */
};
/*
* clockfns structure:
*
* function switch used by chip-independent clock code, to access
* chip-dependent routines.
*/
struct clockfns {
void (*cf_init) __P((struct device *));
void (*cf_get) __P((struct device *, time_t, struct clocktime *));
void (*cf_set) __P((struct device *, struct clocktime *));
};
void clockattach __P((struct device *, const struct clockfns *));