Split device_t and softc for MI mc146818 clock,

and other related misc cosmetics.
This commit is contained in:
tsutsui 2008-03-28 19:05:49 +00:00
parent 65c31645cb
commit 048fb884fc
17 changed files with 155 additions and 167 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_mainbus.c,v 1.8 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_mainbus.c,v 1.9 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_mainbus.c,v 1.8 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_mainbus.c,v 1.9 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -43,31 +43,31 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_mainbus.c,v 1.8 2008/01/10 15:17:40 tsutsui
#include <dev/ic/mc146818reg.h>
#include <dev/ic/mc146818var.h>
int mcclock_mainbus_match(struct device *, struct cfdata *, void *);
void mcclock_mainbus_attach(struct device *, struct device *, void *);
int mcclock_mainbus_match(device_t, cfdata_t, void *);
void mcclock_mainbus_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_mainbus, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_mainbus, sizeof(struct mc146818_softc),
mcclock_mainbus_match, mcclock_mainbus_attach, NULL, NULL);
void mcclock_mainbus_write(struct mc146818_softc *, u_int, u_int);
u_int mcclock_mainbus_read(struct mc146818_softc *, u_int);
int
mcclock_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_mainbus_match(device_t parent, cfdata_t cf, void *aux)
{
struct mainbus_attach_args *ma = aux;
if (strcmp(ma->ma_name, match->cf_name) == 0)
if (strcmp(ma->ma_name, cf->cf_name) == 0)
return (1);
return (0);
}
void
mcclock_mainbus_attach(struct device *parent, struct device *self, void *aux)
mcclock_mainbus_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = device_private(self);
struct mainbus_attach_args *ma = aux;
struct mc146818_softc *sc = (struct mc146818_softc *)self;
sc->sc_bst = ma->ma_st;
if (bus_space_map(sc->sc_bst, ma->ma_addr, 2, 0, &sc->sc_bsh))

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.11 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.11 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -44,17 +44,17 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp
#include <dev/isa/isavar.h>
int mcclock_isa_match(struct device *, struct cfdata *, void *);
void mcclock_isa_attach(struct device *, struct device *, void *);
int mcclock_isa_match(device_t, cfdata_t, void *);
void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof(struct mc146818_softc),
mcclock_isa_match, mcclock_isa_attach, NULL, NULL);
void mcclock_isa_write(struct mc146818_softc *, u_int, u_int);
u_int mcclock_isa_read(struct mc146818_softc *, u_int);
int
mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_match(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -93,10 +93,10 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
struct mc146818_softc *sc = (struct mc146818_softc *)self;
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, ia->ia_io[0].ir_addr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.17 2007/10/17 19:52:58 garbled Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.18 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.17 2007/10/17 19:52:58 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.18 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -46,17 +46,17 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.17 2007/10/17 19:52:58 garbled Exp
#include <alpha/alpha/mcclockvar.h>
int mcclock_isa_match(struct device *, struct cfdata *, void *);
void mcclock_isa_attach(struct device *, struct device *, void *);
int mcclock_isa_match(device_t, cfdata_t, void *);
void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof(struct mc146818_softc),
mcclock_isa_match, mcclock_isa_attach, NULL, NULL);
void mcclock_isa_write(struct mc146818_softc *, u_int, u_int);
u_int mcclock_isa_read(struct mc146818_softc *, u_int);
int
mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_match(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -95,10 +95,10 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
struct mc146818_softc *sc = (void *)self;
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, ia->ia_io[0].ir_addr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_jensenio.c,v 1.6 2007/10/17 19:52:59 garbled Exp $ */
/* $NetBSD: mcclock_jensenio.c,v 1.7 2008/03/28 19:05:49 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_jensenio.c,v 1.6 2007/10/17 19:52:59 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_jensenio.c,v 1.7 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -89,10 +89,10 @@ struct mcclock_jensenio_softc {
bus_space_handle_t sc_std_rtc_ioh;
};
int mcclock_jensenio_match(struct device *, struct cfdata *, void *);
void mcclock_jensenio_attach(struct device *, struct device *, void *);
int mcclock_jensenio_match(device_t, cfdata_t, void *);
void mcclock_jensenio_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_jensenio, sizeof (struct mcclock_jensenio_softc),
CFATTACH_DECL_NEW(mcclock_jensenio, sizeof(struct mcclock_jensenio_softc),
mcclock_jensenio_match, mcclock_jensenio_attach, NULL, NULL);
void mcclock_jensenio_write(struct mc146818_softc *, u_int, u_int);
@ -100,22 +100,22 @@ u_int mcclock_jensenio_read(struct mc146818_softc *, u_int);
int
mcclock_jensenio_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_jensenio_match(device_t parent, cfdata_t cf, void *aux)
{
struct jensenio_attach_args *ja = aux;
/* Always present. */
if (strcmp(ja->ja_name, match->cf_name) == 0)
if (strcmp(ja->ja_name, cf->cf_name) == 0)
return (1);
return (0);
}
void
mcclock_jensenio_attach(struct device *parent, struct device *self, void *aux)
mcclock_jensenio_attach(device_t parent, device_t self, void *aux)
{
struct mcclock_jensenio_softc *jsc = device_private(self);
struct jensenio_attach_args *ja = aux;
struct mcclock_jensenio_softc *jsc = (void *)self;
struct mc146818_softc *sc = &jsc->sc_mc146818;
sc->sc_bst = ja->ja_iot;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_ioasic.c,v 1.13 2007/10/17 19:52:59 garbled Exp $ */
/* $NetBSD: mcclock_ioasic.c,v 1.14 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_ioasic.c,v 1.13 2007/10/17 19:52:59 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_ioasic.c,v 1.14 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -58,17 +58,17 @@ struct mcclock_ioasic_softc {
struct mcclock_ioasic_clockdatum *sc_dp;
};
int mcclock_ioasic_match(struct device *, struct cfdata *, void *);
void mcclock_ioasic_attach(struct device *, struct device *, void *);
int mcclock_ioasic_match(device_t, cfdata_t, void *);
void mcclock_ioasic_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_ioasic, sizeof(struct mcclock_ioasic_softc),
CFATTACH_DECL_NEW(mcclock_ioasic, sizeof(struct mcclock_ioasic_softc),
mcclock_ioasic_match, mcclock_ioasic_attach, NULL, NULL);
void mcclock_ioasic_write(struct mc146818_softc *, u_int, u_int);
u_int mcclock_ioasic_read(struct mc146818_softc *, u_int);
int
mcclock_ioasic_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_ioasic_match(device_t parent, cfdata_t cf, void *aux)
{
struct ioasicdev_attach_args *d = aux;
@ -79,10 +79,10 @@ mcclock_ioasic_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_ioasic_attach(struct device *parent, struct device *self, void *aux)
mcclock_ioasic_attach(device_t parent, device_t self, void *aux)
{
struct mcclock_ioasic_softc *isc = device_private(self);
struct ioasicdev_attach_args *ioasicdev = aux;
struct mcclock_ioasic_softc *isc = (void *)self;
struct mc146818_softc *sc = &isc->sc_mc146818;
/* XXX no bus_space(9) for TURBOchannel yet */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_tlsb.c,v 1.14 2007/10/17 19:52:59 garbled Exp $ */
/* $NetBSD: mcclock_tlsb.c,v 1.15 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@ -32,7 +32,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_tlsb.c,v 1.14 2007/10/17 19:52:59 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_tlsb.c,v 1.15 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -65,10 +65,10 @@ struct mcclock_tlsb_softc {
unsigned long regbase;
};
int mcclock_tlsb_match(struct device *, struct cfdata *, void *);
void mcclock_tlsb_attach(struct device *, struct device *, void *);
int mcclock_tlsb_match(device_t, cfdata_t, void *);
void mcclock_tlsb_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_tlsb, sizeof (struct mcclock_tlsb_softc),
CFATTACH_DECL_NEW(mcclock_tlsb, sizeof(struct mcclock_tlsb_softc),
mcclock_tlsb_match, mcclock_tlsb_attach, NULL, NULL);
static void mcclock_tlsb_write(struct mc146818_softc *, u_int, u_int);
@ -76,7 +76,7 @@ static u_int mcclock_tlsb_read(struct mc146818_softc *, u_int);
int
mcclock_tlsb_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_tlsb_match(device_t parent, cfdata_t cf, void *aux)
{
struct gbus_attach_args *ga = aux;
@ -86,10 +86,10 @@ mcclock_tlsb_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_tlsb_attach(struct device *parent, struct device *self, void *aux)
mcclock_tlsb_attach(device_t parent, device_t self, void *aux)
{
struct mcclock_tlsb_softc *tsc = device_private(self);
struct gbus_attach_args *ga = aux;
struct mcclock_tlsb_softc *tsc = (void *)self;
struct mc146818_softc *sc = &tsc->sc_mc146818;
/* XXX Should be bus.h'd, so we can accommodate the kn7aa. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.11 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.12 2008/03/28 19:05:49 tsutsui Exp $ */
/* $OpenBSD: clock_mc.c,v 1.9 1998/03/16 09:38:26 pefo Exp $ */
/* NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp */
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.11 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.12 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -97,10 +97,10 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.11 2008/01/10 15:17:40 tsutsui Exp
#include <arc/isa/mcclock_isavar.h>
int mcclock_isa_match(struct device *, struct cfdata *, void *);
void mcclock_isa_attach(struct device *, struct device *, void *);
int mcclock_isa_match(device_t, cfdata_t, void *);
void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof(struct mc146818_softc),
mcclock_isa_match, mcclock_isa_attach, NULL, NULL);
/* Deskstation clock access code */
@ -110,7 +110,7 @@ static void mc_isa_write(struct mc146818_softc *, u_int, u_int);
int mcclock_isa_conf = 0;
int
mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_match(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -152,9 +152,9 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (void *)self;
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
sc->sc_bst = ia->ia_iot;
@ -168,7 +168,7 @@ mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mc146818_attach(sc);
printf("\n");
aprint_normal("\n");
/* Turn interrupts off, just in case. */
mc_isa_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_jazzio.c,v 1.9 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_jazzio.c,v 1.10 2008/03/28 19:05:49 tsutsui Exp $ */
/* $OpenBSD: clock_mc.c,v 1.9 1998/03/16 09:38:26 pefo Exp $ */
/* NetBSD: clock_mc.c,v 1.2 1995/06/28 04:30:30 cgd Exp */
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_jazzio.c,v 1.9 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_jazzio.c,v 1.10 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -96,17 +96,17 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_jazzio.c,v 1.9 2008/01/10 15:17:40 tsutsui E
#include <arc/jazz/jazziovar.h>
#include <arc/jazz/mcclock_jazziovar.h>
int mcclock_jazzio_match(struct device *, struct cfdata *, void *);
void mcclock_jazzio_attach(struct device *, struct device *, void *);
int mcclock_jazzio_match(device_t, cfdata_t, void *);
void mcclock_jazzio_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_jazzio, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_jazzio, sizeof(struct mc146818_softc),
mcclock_jazzio_match, mcclock_jazzio_attach, NULL, NULL);
struct mcclock_jazzio_config *mcclock_jazzio_conf = NULL;
static int mcclock_jazzio_found = 0;
int
mcclock_jazzio_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_jazzio_match(device_t parent, cfdata_t cf, void *aux)
{
struct jazzio_attach_args *ja = aux;
@ -121,9 +121,9 @@ mcclock_jazzio_match(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_jazzio_attach(struct device *parent, struct device *self, void *aux)
mcclock_jazzio_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (void *)self;
struct mc146818_softc *sc = device_private(self);
struct jazzio_attach_args *ja = aux;
if (mcclock_jazzio_conf == NULL)
@ -132,7 +132,7 @@ mcclock_jazzio_attach(struct device *parent, struct device *self, void *aux)
sc->sc_bst = ja->ja_bust;
if (bus_space_map(sc->sc_bst,
ja->ja_addr, mcclock_jazzio_conf->mjc_iosize, 0, &sc->sc_bsh)) {
printf(": unable to map I/O space\n");
aprint_error(": unable to map I/O space\n");
return;
}
@ -142,7 +142,7 @@ mcclock_jazzio_attach(struct device *parent, struct device *self, void *aux)
mc146818_attach(sc);
printf("\n");
aprint_normal("\n");
/* Turn interrupts off, just in case. */
(*sc->sc_mcwrite)(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.3 2008/03/28 19:05:49 tsutsui Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -117,7 +117,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.3 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -139,10 +139,10 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp
* appears that some systems use that.
*/
static int mcclock_isa_probe(struct device *, struct cfdata *, void *);
static void mcclock_isa_attach(struct device *, struct device *, void *);
static int mcclock_isa_probe(device_t, cfdata_t, void *);
static void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof(struct mc146818_softc),
mcclock_isa_probe, mcclock_isa_attach, NULL, NULL);
static unsigned
@ -162,7 +162,7 @@ mcclock_isa_write(struct mc146818_softc *sc, unsigned reg, unsigned datum)
}
int
mcclock_isa_probe(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_probe(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -205,15 +205,15 @@ mcclock_isa_probe(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (struct mc146818_softc *)self;
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
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)) {
printf(": can't map registers!\n");
aprint_error(": can't map registers!\n");
return;
}
@ -241,5 +241,5 @@ mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
sc->sc_setcent = mcclock_isa_setcent;
#endif
mc146818_attach(sc);
printf("\n");
aprint_normal("\n");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock.c,v 1.3 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.3 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
@ -46,10 +46,10 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $");
#define MCCLOCK_NPORTS 2
static int mcclock_match(struct device *, struct cfdata *, void *);
static void mcclock_attach(struct device *, struct device *, void *);
static int mcclock_match(device_t, cfdata_t, void *);
static void mcclock_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock, sizeof (struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock, sizeof (struct mc146818_softc),
mcclock_match, mcclock_attach, NULL, NULL);
static void mcclock_write(struct mc146818_softc *, u_int, u_int);
@ -57,7 +57,7 @@ static u_int mcclock_read(struct mc146818_softc *, u_int);
static int
mcclock_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_match(device_t parent, cfdata_t cf, void *aux)
{
static int mcclock_found;
@ -70,9 +70,9 @@ mcclock_match(struct device *parent, struct cfdata *match, void *aux)
}
static void
mcclock_attach(struct device *parent, struct device *self, void *aux)
mcclock_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (void *)self;
struct mc146818_softc *sc = device_private(self);
struct mainbus_attach_args *ma = aux;
sc->sc_bst = ma->ma_iot;
@ -88,7 +88,7 @@ mcclock_attach(struct device *parent, struct device *self, void *aux)
sc->sc_flag = MC146818_BCD;
mc146818_attach(sc);
printf("\n");
aprint_normal("\n");
(*sc->sc_mcwrite)(sc, MC_REGB, MC_REGB_24HR);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsrtc.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $ */
/* $NetBSD: tsrtc.c,v 1.4 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: tsrtc.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: tsrtc.c,v 1.4 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
@ -46,8 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: tsrtc.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $");
#include <evbarm/tsarm/tspldvar.h>
#include <evbarm/tsarm/tsarmreg.h>
int tsrtc_match __P((struct device *, struct cfdata *, void *));
void tsrtc_attach __P((struct device *, struct device *, void *));
int tsrtc_match(device_t, cfdata_t, void *);
void tsrtc_attach(device_t, device_t, void *);
struct tsrtc_softc {
struct mc146818_softc sc_mc;
@ -56,25 +56,23 @@ struct tsrtc_softc {
bus_space_handle_t sc_idxh;
};
CFATTACH_DECL(tsrtc, sizeof (struct tsrtc_softc),
CFATTACH_DECL_NEW(tsrtc, sizeof (struct tsrtc_softc),
tsrtc_match, tsrtc_attach, NULL, NULL);
void tsrtc_write __P((struct mc146818_softc *, u_int, u_int));
u_int tsrtc_read __P((struct mc146818_softc *, u_int));
void tsrtc_write(struct mc146818_softc *, u_int, u_int);
u_int tsrtc_read(struct mc146818_softc *, u_int);
int
tsrtc_match(parent, match, aux)
struct device *parent;
struct cfdata *match;
void *aux;
tsrtc_match(device_t parent, cfdata_t cf, void *aux)
{
struct tspld_attach_args *aa = aux;
struct tsrtc_softc tsrtc, *sc;
unsigned int t1, t2;
static int found = -1;
if (found != -1) return found;
if (found != -1)
return found;
sc = &tsrtc;
sc->sc_iot = aa->ta_iot;
@ -108,11 +106,9 @@ tsrtc_match(parent, match, aux)
}
void
tsrtc_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
tsrtc_attach(device_t parent, device_t self, void *aux)
{
struct tsrtc_softc *sc = (void *)self;
struct tsrtc_softc *sc = device_private(self);
struct tspld_attach_args *aa = aux;
sc->sc_iot = aa->ta_iot;
@ -129,16 +125,14 @@ tsrtc_attach(parent, self, aux)
sc->sc_mc.sc_flag = MC146818_BCD;
mc146818_attach(&sc->sc_mc);
printf("\n");
aprint_error("\n");
(*sc->sc_mc.sc_mcwrite)((struct mc146818_softc *)sc, MC_REGB,
MC_REGB_24HR);
}
void
tsrtc_write(mc_sc, reg, datum)
struct mc146818_softc *mc_sc;
u_int reg, datum;
tsrtc_write(struct mc146818_softc *mc_sc, u_int reg, u_int datum)
{
struct tsrtc_softc *sc = (struct tsrtc_softc *)mc_sc;
@ -147,9 +141,7 @@ tsrtc_write(mc_sc, reg, datum)
}
u_int
tsrtc_read(mc_sc, reg)
struct mc146818_softc *mc_sc;
u_int reg;
tsrtc_read(struct mc146818_softc *mc_sc, u_int reg)
{
struct tsrtc_softc *sc = (struct tsrtc_softc *)mc_sc;
u_int datum;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.11 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.11 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -50,17 +50,17 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.10 2008/01/10 15:17:41 tsutsui Exp
*/
#define ALGOR_YEAR_ZERO 1920
static int mcclock_isa_match(struct device *, struct cfdata *, void *);
static void mcclock_isa_attach(struct device *, struct device *, void *);
static int mcclock_isa_match(device_t, cfdata_t, void *);
static void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof (struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof (struct mc146818_softc),
mcclock_isa_match, mcclock_isa_attach, NULL, NULL);
static void mcclock_isa_write(struct mc146818_softc *, u_int, u_int);
static u_int mcclock_isa_read(struct mc146818_softc *, u_int);
static int
mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_match(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -99,10 +99,10 @@ mcclock_isa_match(struct device *parent, struct cfdata *match, void *aux)
}
static void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
struct mc146818_softc *sc = (struct mc146818_softc *)self;
sc->sc_bst = ia->ia_iot;
if (bus_space_map(sc->sc_bst, ia->ia_io[0].ir_addr,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ds17485.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $ */
/* $NetBSD: ds17485.c,v 1.4 2008/03/28 19:05:49 tsutsui Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -157,7 +157,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ds17485.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: ds17485.c,v 1.4 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -175,18 +175,18 @@ __KERNEL_RCSID(0, "$NetBSD: ds17485.c,v 1.3 2008/01/10 15:17:41 tsutsui Exp $");
#include <arch/evbppc/pmppc/dev/mainbus.h>
#include <machine/pmppc.h>
static int rtc_match(struct device *, struct cfdata *, void *);
static void rtc_attach(struct device *, struct device *, void *);
static int rtc_match(device_t, cfdata_t, void *);
static void rtc_attach(device_t, device_t, void *);
static u_int rtc_read(struct mc146818_softc *, u_int);
static void rtc_write(struct mc146818_softc *, u_int, u_int);
CFATTACH_DECL(rtc, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(rtc, sizeof(struct mc146818_softc),
rtc_match, rtc_attach, NULL, NULL);
static int rtc_attached = 0;
int
rtc_match(struct device *parent, struct cfdata *cf, void *aux)
rtc_match(device_t parent, cfdata_t cf, void *aux)
{
struct mainbus_attach_args *maa = aux;
@ -194,15 +194,15 @@ rtc_match(struct device *parent, struct cfdata *cf, void *aux)
}
void
rtc_attach(struct device *parent, struct device *self, void *aux)
rtc_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (struct mc146818_softc *)self;
struct mc146818_softc *sc = device_private(self);
struct mainbus_attach_args *maa = aux;
sc->sc_bst = maa->mb_bt;
if (bus_space_map(sc->sc_bst, maa->mb_addr, PMPPC_RTC_SIZE, 0,
&sc->sc_bsh)) {
printf("%s: can't map i/o space\n", self->dv_xname);
aprint_error(": can't map i/o space\n");
return;
}
@ -219,8 +219,8 @@ rtc_attach(struct device *parent, struct device *self, void *aux)
sc->sc_year0 = 1900;
mc146818_attach(sc);
/* printf(": Dallas Semiconductor DS17485\n"); */
printf("\n");
/* aprint_normal(": Dallas Semiconductor DS17485\n"); */
aprint_normal("\n");
}
u_int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_pnpbus.c,v 1.4 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_pnpbus.c,v 1.5 2008/03/28 19:05:49 tsutsui Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
* All rights reserved.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_pnpbus.c,v 1.4 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_pnpbus.c,v 1.5 2008/03/28 19:05:49 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -71,12 +71,12 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_pnpbus.c,v 1.4 2008/01/10 15:17:40 tsutsui E
#include <prep/pnpbus/pnpbusvar.h>
static int mcclock_pnpbus_probe(struct device *, struct cfdata *, void *);
static void mcclock_pnpbus_attach(struct device *, struct device *, void *);
static int mcclock_pnpbus_probe(device_t, cfdata_t, void *);
static void mcclock_pnpbus_attach(device_t, device_t, void *);
extern struct cfdriver mcclock_cd;
CFATTACH_DECL(mcclock_pnpbus, sizeof (struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_pnpbus, sizeof(struct mc146818_softc),
mcclock_pnpbus_probe, mcclock_pnpbus_attach, NULL, NULL);
void mcclock_pnpbus_write(struct mc146818_softc *, u_int, u_int);
@ -87,7 +87,7 @@ int have_ds1585 = 0;
#define MCCLOCK_STD_DEV 0
static int
mcclock_pnpbus_probe(struct device *parent, struct cfdata *match, void *aux)
mcclock_pnpbus_probe(device_t parent, cfdata_t cf, void *aux)
{
struct pnpbus_dev_attach_args *pna = aux;
int ret = 0;
@ -105,16 +105,15 @@ mcclock_pnpbus_probe(struct device *parent, struct cfdata *match, void *aux)
}
static void
mcclock_pnpbus_attach(struct device *parent, struct device *self, void *aux)
mcclock_pnpbus_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (void *)self;
struct mc146818_softc *sc = device_private(self);
struct pnpbus_dev_attach_args *pna = aux;
sc->sc_bst = pna->pna_iot;
if (pnpbus_io_map(&pna->pna_res, 0, &sc->sc_bst, &sc->sc_bsh)) {
/* XXX should we panic instead? */
aprint_error("%s: couldn't map clock I/O space",
device_xname(self));
aprint_error(": couldn't map clock I/O space\n");
return;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: mcclock_isa.c,v 1.3 2008/03/28 19:05:50 tsutsui Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -117,7 +117,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.3 2008/03/28 19:05:50 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -139,10 +139,10 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock_isa.c,v 1.2 2008/01/10 15:17:40 tsutsui Exp
* appears that some systems use that.
*/
static int mcclock_isa_probe(struct device *, struct cfdata *, void *);
static void mcclock_isa_attach(struct device *, struct device *, void *);
static int mcclock_isa_probe(device_t, cfdata_t, void *);
static void mcclock_isa_attach(device_t, device_t, void *);
CFATTACH_DECL(mcclock_isa, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(mcclock_isa, sizeof(struct mc146818_softc),
mcclock_isa_probe, mcclock_isa_attach, NULL, NULL);
static unsigned
@ -162,7 +162,7 @@ mcclock_isa_write(struct mc146818_softc *sc, unsigned reg, unsigned datum)
}
int
mcclock_isa_probe(struct device *parent, struct cfdata *match, void *aux)
mcclock_isa_probe(device_t parent, cfdata_t cf, void *aux)
{
struct isa_attach_args *ia = aux;
bus_space_handle_t ioh;
@ -205,15 +205,15 @@ mcclock_isa_probe(struct device *parent, struct cfdata *match, void *aux)
}
void
mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
mcclock_isa_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (struct mc146818_softc *)self;
struct mc146818_softc *sc = device_private(self);
struct isa_attach_args *ia = aux;
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)) {
printf(": can't map registers!\n");
aprint_error(": can't map registers!\n");
return;
}
@ -241,5 +241,5 @@ mcclock_isa_attach(struct device *parent, struct device *self, void *aux)
sc->sc_setcent = mcclock_isa_setcent;
#endif
mc146818_attach(sc);
printf("\n");
aprint_normal("\n");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtc.c,v 1.3 2008/01/10 15:17:40 tsutsui Exp $ */
/* $NetBSD: rtc.c,v 1.4 2008/03/28 19:05:50 tsutsui Exp $ */
/*
* Copyright (c) 1992, 1993
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.3 2008/01/10 15:17:40 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.4 2008/03/28 19:05:50 tsutsui Exp $");
/*
* Clock driver for 'rtc' - mc146818 driver.
@ -77,10 +77,10 @@ __KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.3 2008/01/10 15:17:40 tsutsui Exp $");
#include <dev/ebus/ebusreg.h>
#include <dev/ebus/ebusvar.h>
static int rtc_ebus_match(struct device *, struct cfdata *, void *);
static void rtc_ebus_attach(struct device *, struct device *, void *);
static int rtc_ebus_match(device_t, cfdata_t, void *);
static void rtc_ebus_attach(device_t, device_t, void *);
CFATTACH_DECL(rtc_ebus, sizeof(struct mc146818_softc),
CFATTACH_DECL_NEW(rtc_ebus, sizeof(struct mc146818_softc),
rtc_ebus_match, rtc_ebus_attach, NULL, NULL);
u_int rtc_read_reg(struct mc146818_softc *, u_int);
@ -89,7 +89,7 @@ u_int rtc_getcent(struct mc146818_softc *);
void rtc_setcent(struct mc146818_softc *, u_int);
static int
rtc_ebus_match(struct device *parent, struct cfdata *cf, void *aux)
rtc_ebus_match(device_t parent, cfdata_t cf, void *aux)
{
struct ebus_attach_args *ea = aux;
@ -129,9 +129,9 @@ rtc_write_reg(struct mc146818_softc *sc, u_int reg, u_int val)
/* ARGSUSED */
static void
rtc_ebus_attach(struct device *parent, struct device *self, void *aux)
rtc_ebus_attach(device_t parent, device_t self, void *aux)
{
struct mc146818_softc *sc = (void *)self;
struct mc146818_softc *sc = device_private(self);
struct ebus_attach_args *ea = aux;
char *model;
int sz;
@ -146,7 +146,7 @@ rtc_ebus_attach(struct device *parent, struct device *self, void *aux)
sz,
BUS_SPACE_MAP_LINEAR,
&sc->sc_bsh) != 0) {
printf("%s: can't map register\n", self->dv_xname);
aprint_error(": can't map register\n");
return;
}
@ -165,7 +165,7 @@ rtc_ebus_attach(struct device *parent, struct device *self, void *aux)
sc->sc_setcent = rtc_setcent;
mc146818_attach(sc);
printf(": %s\n", model);
aprint_normal(": %s\n", model);
/*
* Turn interrupts off, just in case. (Although they shouldn't
@ -188,16 +188,13 @@ rtc_ebus_attach(struct device *parent, struct device *self, void *aux)
#define MC_CENT 0x32
u_int
rtc_getcent(sc)
struct mc146818_softc *sc;
rtc_getcent(struct mc146818_softc *sc)
{
return rtc_read_reg(sc, MC_CENT);
}
void
rtc_setcent(sc, cent)
struct mc146818_softc *sc;
u_int cent;
rtc_setcent(struct mc146818_softc *sc, u_int cent)
{
rtc_write_reg(sc, MC_CENT, cent);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mc146818var.h,v 1.4 2005/12/11 12:21:27 christos Exp $ */
/* $NetBSD: mc146818var.h,v 1.5 2008/03/28 19:05:50 tsutsui Exp $ */
/*
* Copyright (c) 2003 Izumi Tsutsui. All rights reserved.
@ -27,7 +27,7 @@
*/
struct mc146818_softc {
struct device sc_dev;
device_t *sc_dev;
bus_space_tag_t sc_bst; /* bus space tag */
bus_space_handle_t sc_bsh; /* bus space handle */