Module Name: src
Committed By: tsutsui
Date: Sun Jun 5 06:33:43 UTC 2011
Modified Files:
src/sys/arch/atari/dev: atari5380.c clock.c ncr5380.c ncr5380reg.h
nvram.c nvramvar.h
src/sys/arch/atari/vme: vme.c vmevar.h
Log Message:
Split device_t/softc. No crash on TT030.
To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/atari/dev/atari5380.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/atari/dev/clock.c
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/atari/dev/ncr5380.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/atari/dev/ncr5380reg.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/atari/dev/nvram.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/atari/dev/nvramvar.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/atari/vme/vme.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/atari/vme/vmevar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/atari/dev/atari5380.c
diff -u src/sys/arch/atari/dev/atari5380.c:1.56 src/sys/arch/atari/dev/atari5380.c:1.57
--- src/sys/arch/atari/dev/atari5380.c:1.56 Sat Apr 17 12:54:29 2010
+++ src/sys/arch/atari/dev/atari5380.c Sun Jun 5 06:33:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $ */
+/* $NetBSD: atari5380.c,v 1.57 2011/06/05 06:33:42 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.56 2010/04/17 12:54:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.57 2011/06/05 06:33:42 tsutsui Exp $");
#include "opt_atariscsi.h"
@@ -100,8 +100,7 @@
static uint8_t *alloc_bounceb(u_long);
static void free_bounceb(uint8_t *);
-static int machine_match(struct device *, void *, void *,
- struct cfdriver *);
+static int machine_match(device_t, cfdata_t, void *, struct cfdriver *);
void scsi_ctrl(int);
void scsi_dma(int);
@@ -1102,11 +1101,11 @@
* Our autoconfig matching function
*/
static int
-machine_match(struct device *pdp, void *match, void *auxp, struct cfdriver *cd)
+machine_match(device_t parent, cfdata_t cf, void *aux, struct cfdriver *cd)
{
static int we_matched = 0; /* Only one unit */
- if (strcmp(auxp, cd->cd_name) || we_matched)
+ if (strcmp(aux, cd->cd_name) || we_matched)
return 0;
we_matched = 1;
Index: src/sys/arch/atari/dev/clock.c
diff -u src/sys/arch/atari/dev/clock.c:1.52 src/sys/arch/atari/dev/clock.c:1.53
--- src/sys/arch/atari/dev/clock.c:1.52 Tue Feb 8 20:20:10 2011
+++ src/sys/arch/atari/dev/clock.c Sun Jun 5 06:33:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.52 2011/02/08 20:20:10 rmind Exp $ */
+/* $NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.52 2011/02/08 20:20:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.53 2011/06/05 06:33:42 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -100,8 +100,9 @@
*/
struct clock_softc {
- struct device sc_dev;
+ device_t sc_dev;
int sc_flags;
+ struct todr_chip_handle sc_handle;
};
/*
@@ -114,10 +115,10 @@
dev_type_read(rtcread);
dev_type_write(rtcwrite);
-static void clockattach(struct device *, struct device *, void *);
-static int clockmatch(struct device *, struct cfdata *, void *);
+static void clockattach(device_t, device_t, void *);
+static int clockmatch(device_t, cfdata_t, void *);
-CFATTACH_DECL(clock, sizeof(struct clock_softc),
+CFATTACH_DECL_NEW(clock, sizeof(struct clock_softc),
clockmatch, clockattach, NULL, NULL);
const struct cdevsw rtc_cdevsw = {
@@ -147,10 +148,10 @@
#endif
int
-clockmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+clockmatch(device_t parent, cfdata_t cf, void *aux)
{
- if (!strcmp("clock", auxp))
+ if (!strcmp("clock", aux))
return 1;
return 0;
}
@@ -158,17 +159,18 @@
/*
* Start the real-time clock.
*/
-void clockattach(struct device *pdp, struct device *dp, void *auxp)
+void clockattach(device_t parent, device_t self, void *aux)
{
+ struct clock_softc *sc = device_private(self);
+ struct todr_chip_handle *tch;
- struct clock_softc *sc = (void *)dp;
- static struct todr_chip_handle tch;
+ sc->sc_dev = self;
+ tch = &sc->sc_handle;
+ tch->todr_gettime_ymdhms = atari_rtc_get;
+ tch->todr_settime_ymdhms = atari_rtc_set;
+ tch->todr_setwen = NULL;
- tch.todr_gettime_ymdhms = atari_rtc_get;
- tch.todr_settime_ymdhms = atari_rtc_set;
- tch.todr_setwen = NULL;
-
- todr_attach(&tch);
+ todr_attach(tch);
sc->sc_flags = 0;
Index: src/sys/arch/atari/dev/ncr5380.c
diff -u src/sys/arch/atari/dev/ncr5380.c:1.68 src/sys/arch/atari/dev/ncr5380.c:1.69
--- src/sys/arch/atari/dev/ncr5380.c:1.68 Sat Apr 17 12:54:29 2010
+++ src/sys/arch/atari/dev/ncr5380.c Sun Jun 5 06:33:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $ */
+/* $NetBSD: ncr5380.c,v 1.69 2011/06/05 06:33:42 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.68 2010/04/17 12:54:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.69 2011/06/05 06:33:42 tsutsui Exp $");
/*
* Bit mask of targets you want debugging to be shown
@@ -182,27 +182,28 @@
#define CFSTRING(n) __STRING(n)
#define CFDRNAME(n) n
-CFATTACH_DECL(CFDRNAME(DRNAME), sizeof(struct ncr_softc),
+CFATTACH_DECL_NEW(CFDRNAME(DRNAME), sizeof(struct ncr_softc),
ncr_match, ncr_attach, NULL, NULL);
extern struct cfdriver CFNAME(DRNAME);
int
-ncr_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+ncr_match(device_t parent, cfdata_t cf, void *aux)
{
- return machine_match(pdp, cfp, auxp, &CFNAME(DRNAME));
+ return machine_match(parent, cf, aux, &CFNAME(DRNAME));
}
void
-ncr_attach(struct device *pdp, struct device *dp, void *auxp)
+ncr_attach(device_t parent, device_t self, void *aux)
{
struct ncr_softc *sc;
int i;
- sc = (struct ncr_softc *)dp;
+ sc = device_private(self);
+ sc->sc_dev = self;
- sc->sc_adapter.adapt_dev = &sc->sc_dev;
+ sc->sc_adapter.adapt_dev = self;
sc->sc_adapter.adapt_openings = 7;
sc->sc_adapter.adapt_max_periph = 1;
sc->sc_adapter.adapt_ioctl = NULL;
@@ -250,7 +251,7 @@
/*
* attach all scsi units on us
*/
- config_found(dp, &sc->sc_channel, scsiprint);
+ config_found(self, &sc->sc_channel, scsiprint);
}
/*
@@ -266,11 +267,13 @@
{
struct scsipi_xfer *xs;
struct scsipi_periph *periph;
- struct ncr_softc *sc = (void *)chan->chan_adapter->adapt_dev;
+ struct ncr_softc *sc;
int sps;
SC_REQ *reqp, *link, *tmp;
int flags;
+ sc = device_private(chan->chan_adapter->adapt_dev);
+
switch (req) {
case ADAPTER_REQ_RUN_XFER:
xs = arg;
@@ -714,7 +717,8 @@
uint8_t targ_bit;
struct ncr_softc *sc;
- sc = (void *)reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev;
+ sc = device_private(
+ reqp->xs->xs_periph->periph_channel->chan_adapter->adapt_dev);
DBG_SELPRINT ("Starting arbitration\n", 0);
PID("scsi_select1");
@@ -1958,7 +1962,7 @@
vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
- printf("%s: %s", sc->sc_dev.dv_xname, buf);
+ printf("%s: %s", device_xname(sc->sc_dev), buf);
}
/****************************************************************************
* Start Debugging Functions *
Index: src/sys/arch/atari/dev/ncr5380reg.h
diff -u src/sys/arch/atari/dev/ncr5380reg.h:1.22 src/sys/arch/atari/dev/ncr5380reg.h:1.23
--- src/sys/arch/atari/dev/ncr5380reg.h:1.22 Tue Apr 13 13:30:37 2010
+++ src/sys/arch/atari/dev/ncr5380reg.h Sun Jun 5 06:33:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ncr5380reg.h,v 1.22 2010/04/13 13:30:37 tsutsui Exp $ */
+/* $NetBSD: ncr5380reg.h,v 1.23 2011/06/05 06:33:42 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -152,7 +152,7 @@
#define INTR_DMA 3
struct ncr_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct scsipi_channel sc_channel;
struct scsipi_adapter sc_adapter;
Index: src/sys/arch/atari/dev/nvram.c
diff -u src/sys/arch/atari/dev/nvram.c:1.18 src/sys/arch/atari/dev/nvram.c:1.19
--- src/sys/arch/atari/dev/nvram.c:1.18 Tue Apr 13 09:51:07 2010
+++ src/sys/arch/atari/dev/nvram.c Sun Jun 5 06:33:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nvram.c,v 1.18 2010/04/13 09:51:07 tsutsui Exp $ */
+/* $NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.18 2010/04/13 09:51:07 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.19 2011/06/05 06:33:43 tsutsui Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -61,26 +61,26 @@
/*
* Auto config stuff....
*/
-static void nvr_attach(struct device *, struct device *, void *);
-static int nvr_match(struct device *, struct cfdata *, void *);
+static void nvr_attach(device_t, device_t, void *);
+static int nvr_match(device_t, cfdata_t, void *);
-CFATTACH_DECL(nvr, sizeof(struct nvr_softc),
+CFATTACH_DECL_NEW(nvr, sizeof(struct nvr_softc),
nvr_match, nvr_attach, NULL, NULL);
/*ARGSUSED*/
static int
-nvr_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+nvr_match(device_t parent, cfdata_t cf, void *aux)
{
- if (!strcmp((char *)auxp, "nvr"))
+ if (!strcmp((char *)aux, "nvr"))
return (1);
return (0);
}
/*ARGSUSED*/
static void
-nvr_attach(device_t pdp, device_t dp, void *auxp)
+nvr_attach(device_t parent, device_t self, void *aux)
{
- struct nvr_softc *nvr_soft;
+ struct nvr_softc *sc;
int nreg;
/*
@@ -92,8 +92,9 @@
mc146818_write(RTC, nreg, 0);
nvram_set_csum(nvram_csum());
}
- nvr_soft = device_lookup_private(&nvr_cd, 0);
- nvr_soft->nvr_flags = NVR_CONFIGURED;
+ sc = device_private(self);
+ sc->sc_dev = self;
+ sc->sc_flags = NVR_CONFIGURED;
printf("\n");
}
/*
@@ -108,10 +109,10 @@
nvr_get_byte(int byteno)
{
#if NNVR > 0
- struct nvr_softc *nvr_soft;
+ struct nvr_softc *sc;
- nvr_soft = device_lookup_private(&nvr_cd, 0);
- if (!(nvr_soft->nvr_flags & NVR_CONFIGURED))
+ sc = device_lookup_private(&nvr_cd, 0);
+ if (!(sc->sc_flags & NVR_CONFIGURED))
return(NVR_INVALID);
return (mc146818_read(RTC, byteno + MC_NVRAM_START) & 0xff);
#else
@@ -129,10 +130,10 @@
int nleft;
u_char buf[MC_NVRAM_CSUM - MC_NVRAM_START + 1];
u_char *p;
- struct nvr_softc *nvr_soft;
+ struct nvr_softc *sc;
- nvr_soft = device_lookup_private(&nvr_cd,0);
- if (!(nvr_soft->nvr_flags & NVR_CONFIGURED))
+ sc = device_lookup_private(&nvr_cd,0);
+ if (!(sc->sc_flags & NVR_CONFIGURED))
return ENXIO;
#ifdef NV_DEBUG
Index: src/sys/arch/atari/dev/nvramvar.h
diff -u src/sys/arch/atari/dev/nvramvar.h:1.3 src/sys/arch/atari/dev/nvramvar.h:1.4
--- src/sys/arch/atari/dev/nvramvar.h:1.3 Tue Oct 20 19:10:11 2009
+++ src/sys/arch/atari/dev/nvramvar.h Sun Jun 5 06:33:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: nvramvar.h,v 1.3 2009/10/20 19:10:11 snj Exp $ */
+/* $NetBSD: nvramvar.h,v 1.4 2011/06/05 06:33:43 tsutsui Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -30,8 +30,8 @@
*/
struct nvr_softc {
- struct device nvr_dev;
- u_int16_t nvr_flags;
+ device_t sc_dev;
+ u_int16_t sc_flags;
};
/*
Index: src/sys/arch/atari/vme/vme.c
diff -u src/sys/arch/atari/vme/vme.c:1.16 src/sys/arch/atari/vme/vme.c:1.17
--- src/sys/arch/atari/vme/vme.c:1.16 Sat Mar 14 21:04:08 2009
+++ src/sys/arch/atari/vme/vme.c Sun Jun 5 06:33:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vme.c,v 1.16 2009/03/14 21:04:08 dsl Exp $ */
+/* $NetBSD: vme.c,v 1.17 2011/06/05 06:33:43 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.16 2009/03/14 21:04:08 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.17 2011/06/05 06:33:43 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -40,18 +40,17 @@
#include <atari/vme/vmevar.h>
-int vmematch(struct device *, struct cfdata *, void *);
-void vmeattach(struct device *, struct device *, void *);
+int vmematch(device_t, cfdata_t, void *);
+void vmeattach(device_t, device_t, void *);
int vmeprint(void *, const char *);
-CFATTACH_DECL(vme, sizeof(struct vme_softc),
+CFATTACH_DECL_NEW(vme, sizeof(struct vme_softc),
vmematch, vmeattach, NULL, NULL);
-int vmesearch(struct device *, struct cfdata *,
- const int *, void *);
+int vmesearch(device_t, cfdata_t, const int *, void *);
int
-vmematch(struct device *parent, struct cfdata *cf, void *aux)
+vmematch(device_t parent, cfdata_t cf, void *aux)
{
struct vmebus_attach_args *vba = aux;
@@ -62,13 +61,14 @@
}
void
-vmeattach(struct device *parent, struct device *self, void *aux)
+vmeattach(device_t parent, device_t self, void *aux)
{
- struct vme_softc *sc = (struct vme_softc *)self;
+ struct vme_softc *sc = device_private(self);
struct vmebus_attach_args *vba = aux;
printf("\n");
+ sc->sc_dev = self;
sc->sc_iot = vba->vba_iot;
sc->sc_memt = vba->vba_memt;
sc->sc_vc = vba->vba_vc;
@@ -95,9 +95,9 @@
}
int
-vmesearch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+vmesearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
- struct vme_softc *sc = (struct vme_softc *)parent;
+ struct vme_softc *sc = device_private(parent);
struct vme_attach_args va;
va.va_iot = sc->sc_iot;
Index: src/sys/arch/atari/vme/vmevar.h
diff -u src/sys/arch/atari/vme/vmevar.h:1.6 src/sys/arch/atari/vme/vmevar.h:1.7
--- src/sys/arch/atari/vme/vmevar.h:1.6 Mon Apr 28 20:23:15 2008
+++ src/sys/arch/atari/vme/vmevar.h Sun Jun 5 06:33:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmevar.h,v 1.6 2008/04/28 20:23:15 martin Exp $ */
+/* $NetBSD: vmevar.h,v 1.7 2011/06/05 06:33:43 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
* VME master bus
*/
struct vme_softc {
- struct device sc_dev; /* base device */
+ device_t sc_dev; /* base device */
bus_space_tag_t sc_iot; /* vme io space tag */
bus_space_tag_t sc_memt; /* vme mem space tag */