Module Name: src
Committed By: tsutsui
Date: Fri Jun 10 09:27:51 UTC 2011
Modified Files:
src/sys/arch/atari/dev: hdfd.c
src/sys/arch/atari/isa: isa_machdep.c
src/sys/arch/atari/vme: et4000.c
Log Message:
Split device_t/softc. Compile test only.
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/atari/dev/hdfd.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/isa/isa_machdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/atari/vme/et4000.c
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/hdfd.c
diff -u src/sys/arch/atari/dev/hdfd.c:1.73 src/sys/arch/atari/dev/hdfd.c:1.74
--- src/sys/arch/atari/dev/hdfd.c:1.73 Tue Apr 13 11:31:11 2010
+++ src/sys/arch/atari/dev/hdfd.c Fri Jun 10 09:27:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: hdfd.c,v 1.73 2010/04/13 11:31:11 tsutsui Exp $ */
+/* $NetBSD: hdfd.c,v 1.74 2011/06/10 09:27:51 tsutsui Exp $ */
/*-
* Copyright (c) 1996 Leo Weppelman
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.73 2010/04/13 11:31:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.74 2011/06/10 09:27:51 tsutsui Exp $");
#include "opt_ddb.h"
@@ -188,7 +188,7 @@
/* software state, per controller */
struct fdc_softc {
- struct device sc_dev; /* boilerplate */
+ device_t sc_dev; /* boilerplate */
struct callout sc_timo_ch; /* timeout callout */
struct callout sc_intr_ch; /* pseudo-intr callout */
@@ -202,11 +202,11 @@
};
/* controller driver configuration */
-int fdcprobe(struct device *, struct cfdata *, void *);
+int fdcprobe(device_t, cfdata_t, void *);
int fdprint(void *, const char *);
-void fdcattach(struct device *, struct device *, void *);
+void fdcattach(device_t, device_t, void *);
-CFATTACH_DECL(fdc, sizeof(struct fdc_softc),
+CFATTACH_DECL_NEW(fdc, sizeof(struct fdc_softc),
fdcprobe, fdcattach, NULL, NULL);
/*
@@ -246,7 +246,7 @@
/* software state, per disk (with up to 4 disks per ctlr) */
struct fd_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct disk sc_dk;
struct fd_type *sc_deftype; /* default type descriptor */
@@ -279,10 +279,10 @@
};
/* floppy driver configuration */
-int fdprobe(struct device *, struct cfdata *, void *);
-void fdattach(struct device *, struct device *, void *);
+int fdprobe(device_t, cfdata_t, void *);
+void fdattach(device_t, device_t, void *);
-CFATTACH_DECL(hdfd, sizeof(struct fd_softc),
+CFATTACH_DECL_NEW(hdfd, sizeof(struct fd_softc),
fdprobe, fdattach, NULL, NULL);
const struct bdevsw fd_bdevsw = {
@@ -298,29 +298,28 @@
struct dkdriver fddkdriver = { fdstrategy };
-void fd_set_motor(struct fdc_softc *fdc, int reset);
-void fd_motor_off(void *arg);
-void fd_motor_on(void *arg);
-int fdcresult(struct fdc_softc *fdc);
-int out_fdc(u_char x);
+void fd_set_motor(struct fdc_softc *, int);
+void fd_motor_off(void *);
+void fd_motor_on(void *);
+int fdcresult(struct fdc_softc *);
+int out_fdc(u_char);
void fdc_ctrl_intr(struct clockframe);
-void fdcstart(struct fdc_softc *fdc);
-void fdcstatus(struct device *dv, int n, const char *s);
-void fdctimeout(void *arg);
-void fdcpseudointr(void *arg);
+void fdcstart(struct fdc_softc *);
+void fdcstatus(device_t, int, const char *);
+void fdctimeout(void *);
+void fdcpseudointr(void *);
int fdcintr(void *);
-void fdcretry(struct fdc_softc *fdc);
-void fdfinish(struct fd_softc *fd, struct buf *bp);
+void fdcretry(struct fdc_softc *);
+void fdfinish(struct fd_softc *, struct buf *);
int fdformat(dev_t, struct ne7_fd_formb *, struct proc *);
static void fdgetdisklabel(struct fd_softc *, dev_t);
-static void fdgetdefaultlabel(struct fd_softc *, struct disklabel *,
- int);
+static void fdgetdefaultlabel(struct fd_softc *, struct disklabel *, int);
inline struct fd_type *fd_dev_to_type(struct fd_softc *, dev_t);
int
-fdcprobe(struct device *parent, struct cfdata *cfp, void *aux)
+fdcprobe(device_t parent, cfdata_t cf, void *aux)
{
static int fdc_matched = 0;
bus_space_tag_t mb_tag;
@@ -395,14 +394,15 @@
}
void
-fdcattach(struct device *parent, struct device *self, void *aux)
+fdcattach(device_t parent, device_t self, void *aux)
{
- struct fdc_softc *fdc = (void *)self;
+ struct fdc_softc *fdc = device_private(self);
struct fdc_attach_args fa;
int has_fifo;
has_fifo = 0;
+ fdc->sc_dev = self;
fdc->sc_state = DEVIDLE;
TAILQ_INIT(&fdc->sc_drives);
@@ -450,22 +450,22 @@
}
int
-fdprobe(struct device *parent, struct cfdata *cfp, void *aux)
+fdprobe(device_t parent, cfdata_t cf, void *aux)
{
- struct fdc_softc *fdc = (void *)parent;
+ struct fdc_softc *fdc = device_private(parent);
struct fdc_attach_args *fa = aux;
int drive = fa->fa_drive;
int n;
- if (cfp->cf_loc[FDCCF_UNIT] != FDCCF_UNIT_DEFAULT &&
- cfp->cf_loc[FDCCF_UNIT] != drive)
+ if (cf->cf_loc[FDCCF_UNIT] != FDCCF_UNIT_DEFAULT &&
+ cf->cf_loc[FDCCF_UNIT] != drive)
return 0;
/*
* XXX
* This is to work around some odd interactions between this driver
* and SMC Ethernet cards.
*/
- if (cfp->cf_loc[FDCCF_UNIT] == FDCCF_UNIT_DEFAULT && drive >= 2)
+ if (cf->cf_loc[FDCCF_UNIT] == FDCCF_UNIT_DEFAULT && drive >= 2)
return 0;
/* select drive and turn on motor */
@@ -503,14 +503,15 @@
* Controller is working, and drive responded. Attach it.
*/
void
-fdattach(struct device *parent, struct device *self, void *aux)
+fdattach(device_t parent, device_t self, void *aux)
{
- struct fdc_softc *fdc = (void *)parent;
- struct fd_softc *fd = (void *)self;
+ struct fdc_softc *fdc = device_private(parent);
+ struct fd_softc *fd = device_private(self);
struct fdc_attach_args *fa = aux;
struct fd_type *type = fa->fa_deftype;
int drive = fa->fa_drive;
+ fd->sc_dev = self;
callout_init(&fd->sc_motoron_ch, 0);
callout_init(&fd->sc_motoroff_ch, 0);
@@ -531,7 +532,7 @@
/*
* Initialize and attach the disk structure.
*/
- disk_init(&fd->sc_dk, fd->sc_dev.dv_xname, &fddkdriver);
+ disk_init(&fd->sc_dk, device_xname(self), &fddkdriver);
disk_attach(&fd->sc_dk);
/* Needed to power off if the motor is on when we halt. */
@@ -635,7 +636,9 @@
fdstart(fd);
#ifdef DIAGNOSTIC
else {
- struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev);
+ struct fdc_softc *fdc;
+
+ fdc = device_private(device_parent(fd->sc_dev));
if (fdc->sc_state == DEVIDLE) {
printf("fdstrategy: controller inactive\n");
fdcstart(fdc);
@@ -654,7 +657,7 @@
void
fdstart(struct fd_softc *fd)
{
- struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev);
+ struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
int active = fdc->sc_drives.tqh_first != 0;
/* Link into controller queue. */
@@ -669,7 +672,7 @@
void
fdfinish(struct fd_softc *fd, struct buf *bp)
{
- struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev);
+ struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
/*
* Move this drive to the end of the queue to give others a `fair'
@@ -732,11 +735,12 @@
fd_motor_off(void *arg)
{
struct fd_softc *fd = arg;
+ struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
int s;
s = splbio();
fd->sc_flags &= ~(FD_MOTOR | FD_MOTOR_WAIT);
- fd_set_motor((struct fdc_softc *) device_parent(&fd->sc_dev), 0);
+ fd_set_motor(fdc, 0);
splx(s);
}
@@ -744,7 +748,7 @@
fd_motor_on(void *arg)
{
struct fd_softc *fd = arg;
- struct fdc_softc *fdc = (void *) device_parent(&fd->sc_dev);
+ struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));
int s;
s = splbio();
@@ -858,9 +862,9 @@
}
void
-fdcstatus(struct device *dv, int n, const char *s)
+fdcstatus(device_t self, int n, const char *s)
{
- struct fdc_softc *fdc = (void *) device_parent(dv);
+ struct fdc_softc *fdc = device_private(device_parent(self));
char bits[64];
if (n == 0) {
@@ -869,7 +873,7 @@
n = 2;
}
- printf("%s: %s", dv->dv_xname, s);
+ printf("%s: %s", device_xname(self), s);
switch (n) {
case 0:
@@ -898,7 +902,7 @@
int s;
s = splbio();
- fdcstatus(&fd->sc_dev, 0, "timeout");
+ fdcstatus(fd->sc_dev, 0, "timeout");
if (bufq_peek(fd->sc_q) != NULL)
fdc->sc_state++;
@@ -1105,7 +1109,7 @@
if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 ||
cyl != bp->b_cylinder * fd->sc_type->step) {
#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "seek failed");
+ fdcstatus(fd->sc_dev, 2, "seek failed");
#endif
fdcretry(fdc);
goto loop;
@@ -1136,7 +1140,7 @@
goto loop;
}
#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 7, bp->b_flags & B_READ ?
+ fdcstatus(fd->sc_dev, 7, bp->b_flags & B_READ ?
"read failed" : "write failed");
printf("blkno %qd nblks %d\n",
fd->sc_blkno, fd->sc_nblks);
@@ -1199,7 +1203,7 @@
out_fdc(NE7CMD_SENSEI);
if (fdcresult(fdc) != 2 || (st0 & 0xf8) != 0x20 || cyl != 0) {
#ifdef FD_DEBUG
- fdcstatus(&fd->sc_dev, 2, "recalibrate failed");
+ fdcstatus(fd->sc_dev, 2, "recalibrate failed");
#endif
fdcretry(fdc);
goto loop;
@@ -1213,7 +1217,7 @@
goto doseek;
default:
- fdcstatus(&fd->sc_dev, 0, "stray interrupt");
+ fdcstatus(fd->sc_dev, 0, "stray interrupt");
return 1;
}
#ifdef DIAGNOSTIC
Index: src/sys/arch/atari/isa/isa_machdep.c
diff -u src/sys/arch/atari/isa/isa_machdep.c:1.37 src/sys/arch/atari/isa/isa_machdep.c:1.38
--- src/sys/arch/atari/isa/isa_machdep.c:1.37 Tue Apr 13 11:31:11 2010
+++ src/sys/arch/atari/isa/isa_machdep.c Fri Jun 10 09:27:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: isa_machdep.c,v 1.37 2010/04/13 11:31:11 tsutsui Exp $ */
+/* $NetBSD: isa_machdep.c,v 1.38 2011/06/10 09:27:51 tsutsui Exp $ */
/*
* Copyright (c) 1997 Leo Weppelman. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.37 2010/04/13 11:31:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.38 2011/06/10 09:27:51 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -67,16 +67,16 @@
};
#endif /* NISADMA == 0 */
-static int atariisabusprint(void *auxp, const char *);
-static int isabusmatch(struct device *, struct cfdata *, void *);
-static void isabusattach(struct device *, struct device *, void *);
+static int atariisabusprint(void *, const char *);
+static int isabusmatch(device_t, cfdata_t, void *);
+static void isabusattach(device_t, device_t, void *);
struct isabus_softc {
- struct device sc_dev;
+ device_t sc_dev;
struct atari_isa_chipset sc_chipset;
};
-CFATTACH_DECL(isab, sizeof(struct isabus_softc),
+CFATTACH_DECL_NEW(isab, sizeof(struct isabus_softc),
isabusmatch, isabusattach, NULL, NULL);
/*
@@ -86,11 +86,11 @@
static struct atari_bus_space bs_storage[2]; /* 1 iot, 1 memt */
int
-isabusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+isabusmatch(device_t parent, cfdata_t cf, void *aux)
{
static int nmatched = 0;
- if (strcmp((char *)auxp, "isab"))
+ if (strcmp((char *)aux, "isab"))
return 0; /* Wrong number... */
if (atari_realconfig == 0)
@@ -109,13 +109,15 @@
}
void
-isabusattach(struct device *pdp, struct device *dp, void *auxp)
+isabusattach(device_t parent, device_t self, void *aux)
{
- struct isabus_softc *sc = (struct isabus_softc *)dp;
+ struct isabus_softc *sc = device_private(self);
struct isabus_attach_args iba;
extern struct atari_bus_dma_tag isa_bus_dma_tag;
extern void isa_bus_init(void);
+ sc->sc_dev = self;
+
iba.iba_dmat = &isa_bus_dma_tag;
iba.iba_iot = leb_alloc_bus_space_tag(&bs_storage[0]);
iba.iba_memt = leb_alloc_bus_space_tag(&bs_storage[1]);
@@ -130,7 +132,7 @@
if (machineid & ATARI_HADES)
MFP->mf_aer |= (IO_ISA1|IO_ISA2); /* ISA interrupts: LOW->HIGH */
isa_bus_init();
- if (dp == NULL) { /* Early init */
+ if (self == NULL) { /* Early init */
#if (NPCKBC > 0)
pckbc_cnattach(iba.iba_iot, IO_KBD, KBCMDP, PCKBC_KBD_SLOT);
#endif
@@ -138,11 +140,11 @@
}
printf("\n");
- config_found_ia(dp, "isabus", &iba, atariisabusprint);
+ config_found_ia(self, "isabus", &iba, atariisabusprint);
}
int
-atariisabusprint(void *auxp, const char *name)
+atariisabusprint(void *aux, const char *name)
{
if (name == NULL)
@@ -151,7 +153,7 @@
}
void
-isa_attach_hook(struct device *parent, struct device *self, struct isabus_attach_args *iba)
+isa_attach_hook(device_t parent, device_t self, struct isabus_attach_args *iba)
{
}
Index: src/sys/arch/atari/vme/et4000.c
diff -u src/sys/arch/atari/vme/et4000.c:1.23 src/sys/arch/atari/vme/et4000.c:1.24
--- src/sys/arch/atari/vme/et4000.c:1.23 Sun Dec 12 09:56:16 2010
+++ src/sys/arch/atari/vme/et4000.c Fri Jun 10 09:27:51 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: et4000.c,v 1.23 2010/12/12 09:56:16 tsutsui Exp $ */
+/* $NetBSD: et4000.c,v 1.24 2011/06/10 09:27:51 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: et4000.c,v 1.23 2010/12/12 09:56:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: et4000.c,v 1.24 2011/06/10 09:27:51 tsutsui Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -78,8 +78,8 @@
#define VGA_MAPPABLE (128 * 1024) /* 0x20000 */
#define VGA_BASE 0xa0000
-static int et4k_vme_match(struct device *, struct cfdata *, void *);
-static void et4k_vme_attach(struct device *, struct device *, void *);
+static int et4k_vme_match(device_t, cfdata_t, void *);
+static void et4k_vme_attach(device_t, device_t, void *);
static int et4k_probe_addresses(struct vme_attach_args *);
static void et4k_start(bus_space_tag_t *, bus_space_handle_t *, int *,
u_char *);
@@ -113,7 +113,7 @@
} et4k_priv;
struct et4k_softc {
- struct device sc_dev;
+ device_t sc_dev;
bus_space_tag_t sc_iot;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_ioh;
@@ -127,7 +127,7 @@
#define ET_SC_FLAGS_INUSE 1
-CFATTACH_DECL(et4k, sizeof(struct et4k_softc),
+CFATTACH_DECL_NEW(et4k, sizeof(struct et4k_softc),
et4k_vme_match, et4k_vme_attach, NULL, NULL);
dev_type_open(et4kopen);
@@ -147,9 +147,9 @@
* match Spektrum cards too (untested).
*/
int
-et4k_vme_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+et4k_vme_match(device_t parent, cfdata_t cf, void *aux)
{
- struct vme_attach_args *va = auxp;
+ struct vme_attach_args *va = aux;
return et4k_probe_addresses(va);
}
@@ -329,13 +329,15 @@
}
static void
-et4k_vme_attach(struct device *parent, struct device *self, void *aux)
+et4k_vme_attach(device_t parent, device_t self, void *aux)
{
- struct et4k_softc *sc = (struct et4k_softc *)self;
+ struct et4k_softc *sc = device_private(self);
struct vme_attach_args *va = aux;
bus_space_handle_t ioh;
bus_space_handle_t memh;
+ sc->sc_dev = self;
+
printf("\n");
if (bus_space_map(va->va_iot, va->va_iobase, va->va_iosize, 0, &ioh))