Module Name: src
Committed By: skrll
Date: Sun May 20 10:28:44 UTC 2012
Modified Files:
src/sys/arch/evbarm/dev: plcom.c plcomvar.h
src/sys/arch/evbarm/ifpga: plcom_ifpga.c plcom_ifpgavar.h
Log Message:
device_t/softc split
struct device * -> device_t
struct cfdata * -> cfdata_t
To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/evbarm/dev/plcom.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/dev/plcomvar.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/evbarm/ifpga/plcom_ifpga.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/ifpga/plcom_ifpgavar.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/evbarm/dev/plcom.c
diff -u src/sys/arch/evbarm/dev/plcom.c:1.37 src/sys/arch/evbarm/dev/plcom.c:1.38
--- src/sys/arch/evbarm/dev/plcom.c:1.37 Sun May 20 07:57:34 2012
+++ src/sys/arch/evbarm/dev/plcom.c Sun May 20 10:28:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom.c,v 1.37 2012/05/20 07:57:34 skrll Exp $ */
+/* $NetBSD: plcom.c,v 1.38 2012/05/20 10:28:44 skrll Exp $ */
/*-
* Copyright (c) 2001 ARM Ltd
@@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.37 2012/05/20 07:57:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.38 2012/05/20 10:28:44 skrll Exp $");
#include "opt_plcom.h"
#include "opt_ddb.h"
@@ -242,7 +242,7 @@ void plcom_kgdb_putc (void *, int);
#define PLCOMDIALOUT(x) (minor(x) & PLCOMDIALOUT_MASK)
#define PLCOM_ISALIVE(sc) ((sc)->enabled != 0 && \
- device_is_active(&(sc)->sc_dev))
+ device_is_active((sc)->sc_dev))
#define BR BUS_SPACE_BARRIER_READ
#define BW BUS_SPACE_BARRIER_WRITE
@@ -284,7 +284,7 @@ plcomstatus(struct plcom_softc *sc, cons
struct tty *tp = sc->sc_tty;
printf("%s: %s %sclocal %sdcd %sts_carr_on %sdtr %stx_stopped\n",
- sc->sc_dev.dv_xname, str,
+ device_xname(sc->sc_dev), str,
ISSET(tp->t_cflag, CLOCAL) ? "+" : "-",
ISSET(sc->sc_msr, PL01X_MSR_DCD) ? "+" : "-",
ISSET(tp->t_state, TS_CARR_ON) ? "+" : "-",
@@ -292,7 +292,7 @@ plcomstatus(struct plcom_softc *sc, cons
sc->sc_tx_stopped ? "+" : "-");
printf("%s: %s %scrtscts %scts %sts_ttstop %srts %xrx_flags\n",
- sc->sc_dev.dv_xname, str,
+ device_xname(sc->sc_dev), str,
ISSET(tp->t_cflag, CRTSCTS) ? "+" : "-",
ISSET(sc->sc_msr, PL01X_MSR_CTS) ? "+" : "-",
ISSET(tp->t_state, TS_TTSTOP) ? "+" : "-",
@@ -341,7 +341,7 @@ plcom_enable_debugport(struct plcom_soft
bus_space_write_1(sc->sc_iot, sc->sc_ioh, plcom_cr, sc->sc_cr);
SET(sc->sc_mcr, PL01X_MCR_DTR | PL01X_MCR_RTS);
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr);
}
@@ -383,7 +383,7 @@ plcom_attach_subr(struct plcom_softc *sc
if (ISSET(sc->sc_hwflags, PLCOM_HW_TXFIFO_DISABLE)) {
sc->sc_fifolen = 1;
- printf("%s: txfifo disabled\n", sc->sc_dev.dv_xname);
+ printf("%s: txfifo disabled\n", device_xname(sc->sc_dev));
}
if (sc->sc_fifolen > 1)
@@ -400,7 +400,7 @@ plcom_attach_subr(struct plcom_softc *sc
sc->sc_rbavail = plcom_rbuf_size;
if (sc->sc_rbuf == NULL) {
printf("%s: unable to allocate ring buffer\n",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
return;
}
sc->sc_ebuf = sc->sc_rbuf + (plcom_rbuf_size << 1);
@@ -413,9 +413,9 @@ plcom_attach_subr(struct plcom_softc *sc
/* locate the major number */
maj = cdevsw_lookup_major(&plcom_cdevsw);
- cn_tab->cn_dev = makedev(maj, device_unit(&sc->sc_dev));
+ cn_tab->cn_dev = makedev(maj, device_unit(sc->sc_dev));
- printf("%s: console\n", sc->sc_dev.dv_xname);
+ printf("%s: console\n", device_xname(sc->sc_dev));
}
#ifdef KGDB
@@ -427,14 +427,14 @@ plcom_attach_subr(struct plcom_softc *sc
plcom_kgdb_attached = 1;
SET(sc->sc_hwflags, PLCOM_HW_KGDB);
- printf("%s: kgdb\n", sc->sc_dev.dv_xname);
+ printf("%s: kgdb\n", device_xname(sc->sc_dev));
}
#endif
sc->sc_si = softint_establish(SOFTINT_SERIAL, plcomsoft, sc);
#ifdef RND_COM
- rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev)),
RND_TYPE_TTY, 0);
#endif
@@ -463,9 +463,9 @@ plcom_config(struct plcom_softc *sc)
}
int
-plcom_detach(struct device *self, int flags)
+plcom_detach(device_t self, int flags)
{
- struct plcom_softc *sc = (struct plcom_softc *)self;
+ struct plcom_softc *sc = device_private(self);
int maj, mn;
if (sc->sc_hwflags & (PLCOM_HW_CONSOLE|PLCOM_HW_KGDB))
@@ -585,7 +585,7 @@ plcomopen(dev_t dev, int flag, int mode,
sc->sc_rbuf == NULL)
return ENXIO;
- if (!device_is_active(&sc->sc_dev))
+ if (!device_is_active(sc->sc_dev))
return ENXIO;
#ifdef KGDB
@@ -615,7 +615,7 @@ plcomopen(dev_t dev, int flag, int mode,
if ((*sc->enable)(sc)) {
splx(s);
printf("%s: device enable failed\n",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
return EIO;
}
mutex_spin_enter(&sc->sc_lock);
@@ -1307,7 +1307,7 @@ plcom_iflush(struct plcom_softc *sc)
bus_space_read_1(iot, ioh, plcom_dr);
#ifdef DIAGNOSTIC
if (!timo)
- printf("%s: plcom_iflush timeout %02x\n", sc->sc_dev.dv_xname,
+ printf("%s: plcom_iflush timeout %02x\n", device_xname(sc->sc_dev),
reg);
#endif
}
@@ -1327,7 +1327,7 @@ plcom_loadchannelregs(struct plcom_softc
bus_space_write_1(iot, ioh, plcom_dlbh, sc->sc_dlbh);
bus_space_write_1(iot, ioh, plcom_lcr, sc->sc_lcr);
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr_active = sc->sc_mcr);
bus_space_write_1(iot, ioh, plcom_cr, sc->sc_cr);
@@ -1384,7 +1384,7 @@ plcom_hwiflow(struct plcom_softc *sc)
SET(sc->sc_mcr_active, sc->sc_mcr_rts);
}
/* XXX device_unit() abuse */
- sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(&sc->sc_dev),
+ sc->sc_set_mcr(sc->sc_set_mcr_arg, device_unit(sc->sc_dev),
sc->sc_mcr_active);
}
@@ -1485,7 +1485,7 @@ plcomdiag(void *arg)
mutex_spin_exit(&sc->sc_lock);
log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf flood%s\n",
- sc->sc_dev.dv_xname,
+ device_xname(sc->sc_dev),
overflows, overflows == 1 ? "" : "s",
floods, floods == 1 ? "" : "s");
}
Index: src/sys/arch/evbarm/dev/plcomvar.h
diff -u src/sys/arch/evbarm/dev/plcomvar.h:1.9 src/sys/arch/evbarm/dev/plcomvar.h:1.10
--- src/sys/arch/evbarm/dev/plcomvar.h:1.9 Sun May 20 07:54:40 2012
+++ src/sys/arch/evbarm/dev/plcomvar.h Sun May 20 10:28:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcomvar.h,v 1.9 2012/05/20 07:54:40 skrll Exp $ */
+/* $NetBSD: plcomvar.h,v 1.10 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -67,7 +67,7 @@ int plcom_is_console (bus_space_tag_t,
#define PLCOM_RING_SIZE 2048
struct plcom_softc {
- struct device sc_dev;
+ device_t sc_dev;
void *sc_si;
struct tty *sc_tty;
@@ -142,6 +142,6 @@ struct plcom_softc {
int plcomprobe1 (bus_space_tag_t, bus_space_handle_t);
int plcomintr (void *);
void plcom_attach_subr (struct plcom_softc *);
-int plcom_detach (struct device *, int);
-int plcom_activate (struct device *, enum devact);
+int plcom_detach (device_t, int);
+int plcom_activate (device_t, enum devact);
Index: src/sys/arch/evbarm/ifpga/plcom_ifpga.c
diff -u src/sys/arch/evbarm/ifpga/plcom_ifpga.c:1.12 src/sys/arch/evbarm/ifpga/plcom_ifpga.c:1.13
--- src/sys/arch/evbarm/ifpga/plcom_ifpga.c:1.12 Mon May 14 19:40:06 2012
+++ src/sys/arch/evbarm/ifpga/plcom_ifpga.c Sun May 20 10:28:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom_ifpga.c,v 1.12 2012/05/14 19:40:06 skrll Exp $ */
+/* $NetBSD: plcom_ifpga.c,v 1.13 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 2001 ARM Ltd
@@ -32,7 +32,7 @@
/* Interface to plcom (PL010) serial driver. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom_ifpga.c,v 1.12 2012/05/14 19:40:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom_ifpga.c,v 1.13 2012/05/20 10:28:44 skrll Exp $");
#include <sys/types.h>
#include <sys/device.h>
@@ -53,29 +53,30 @@ __KERNEL_RCSID(0, "$NetBSD: plcom_ifpga.
#include <evbarm/ifpga/ifpgareg.h>
#include <evbarm/ifpga/ifpgavar.h>
-static int plcom_ifpga_match(struct device *, struct cfdata *, void *);
-static void plcom_ifpga_attach(struct device *, struct device *, void *);
+static int plcom_ifpga_match(device_t, cfdata_t, void *);
+static void plcom_ifpga_attach(device_t, device_t, void *);
static void plcom_ifpga_set_mcr(void *, int, u_int);
-CFATTACH_DECL(plcom_ifpga, sizeof(struct plcom_softc),
+CFATTACH_DECL_NEW(plcom_ifpga, sizeof(struct plcom_ifpga_softc),
plcom_ifpga_match, plcom_ifpga_attach, NULL, NULL);
static int
-plcom_ifpga_match(struct device *parent, struct cfdata *cf, void *aux)
+plcom_ifpga_match(device_t parent, cfdata_t cf, void *aux)
{
return 1;
}
static void
-plcom_ifpga_attach(struct device *parent, struct device *self, void *aux)
+plcom_ifpga_attach(device_t parent, device_t self, void *aux)
{
- struct plcom_ifpga_softc *isc = (struct plcom_ifpga_softc *)self;
+ struct plcom_ifpga_softc *isc = device_private(self);
struct plcom_softc *sc = &isc->sc_plcom;
struct ifpga_attach_args *ifa = aux;
isc->sc_iot = ifa->ifa_iot;
isc->sc_ioh = ifa->ifa_sc_ioh;
- sc->sc_iounit = device_unit(&sc->sc_dev);
+ sc->sc_dev = self;
+ sc->sc_iounit = device_unit(sc->sc_dev);
sc->sc_frequency = IFPGA_UART_CLK;
sc->sc_iot = ifa->ifa_iot;
sc->sc_hwflags = 0;
@@ -85,7 +86,7 @@ plcom_ifpga_attach(struct device *parent
if (bus_space_map(ifa->ifa_iot, ifa->ifa_addr, PLCOM_UART_SIZE, 0,
&sc->sc_ioh)) {
- printf("%s: unable to map device\n", sc->sc_dev.dv_xname);
+ printf("%s: unable to map device\n", device_xname(sc->sc_dev));
return;
}
@@ -94,7 +95,7 @@ plcom_ifpga_attach(struct device *parent
sc);
if (isc->sc_ih == NULL)
panic("%s: cannot install interrupt handler",
- sc->sc_dev.dv_xname);
+ device_xname(sc->sc_dev));
}
static void plcom_ifpga_set_mcr(void *aux, int unit, u_int mcr)
Index: src/sys/arch/evbarm/ifpga/plcom_ifpgavar.h
diff -u src/sys/arch/evbarm/ifpga/plcom_ifpgavar.h:1.1 src/sys/arch/evbarm/ifpga/plcom_ifpgavar.h:1.2
--- src/sys/arch/evbarm/ifpga/plcom_ifpgavar.h:1.1 Sat Oct 27 16:19:10 2001
+++ src/sys/arch/evbarm/ifpga/plcom_ifpgavar.h Sun May 20 10:28:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom_ifpgavar.h,v 1.1 2001/10/27 16:19:10 rearnsha Exp $ */
+/* $NetBSD: plcom_ifpgavar.h,v 1.2 2012/05/20 10:28:44 skrll Exp $ */
/*
* Copyright (c) 2001 ARM Ltd
@@ -32,7 +32,8 @@
/* Interface to plcom (PL010) serial driver. */
struct plcom_ifpga_softc {
- struct plcom_softc sc_plcom;
+ struct plcom_softc sc_plcom;
+
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void *sc_ih;