summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-06-14 13:46:10 +0000
committerdfr <dfr@FreeBSD.org>1998-06-14 13:46:10 +0000
commitdc295ed278eb0235154462b23615e89213bc591c (patch)
tree0734d180ccb27bfdde5cd04d1961394e2e0ac94f /sys/alpha
parenta7d3dec6df55d42bcb12806631798932380ce34b (diff)
downloadFreeBSD-src-dc295ed278eb0235154462b23615e89213bc591c.zip
FreeBSD-src-dc295ed278eb0235154462b23615e89213bc591c.tar.gz
Major changes to the generic device framework for FreeBSD/alpha:
* Eliminate bus_t and make it possible for all devices to have attached children. * Support dynamically extendable interfaces for drivers to replace both the function pointers in driver_t and bus_ops_t (which has been removed entirely. Two system defined interfaces have been defined, 'device' which is mandatory for all devices and 'bus' which is recommended for all devices which support attached children. * In addition, the alpha port defines two simple interfaces 'clock' for attaching various real time clocks to the system and 'mcclock' for the many different variations of mc146818 clocks which can be attached to different alpha platforms. This eliminates two more function pointer tables in favour of the generic method dispatch system provided by the device framework. Future device interfaces may include: * cdev and bdev interfaces for devfs to use in replacement for specfs and the fixed interfaces bdevsw and cdevsw. * scsi interface to replace struct scsi_adapter (not sure how this works in CAM but I imagine there is something similar there). * various tailored interfaces for different bus types such as pci, isa, pccard etc.
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/autoconf.c6
-rw-r--r--sys/alpha/alpha/clock.c23
-rw-r--r--sys/alpha/alpha/cons.c4
-rw-r--r--sys/alpha/alpha/dec_kn8ae.c3
-rw-r--r--sys/alpha/alpha/genassym.c12
-rw-r--r--sys/alpha/alpha/gensetdefs.c4
-rw-r--r--sys/alpha/conf/Makefile.alpha21
-rw-r--r--sys/alpha/conf/files.alpha34
-rw-r--r--sys/alpha/include/alpha_cpu.h12
-rw-r--r--sys/alpha/include/param.h4
-rw-r--r--sys/alpha/include/vmparam.h12
-rw-r--r--sys/alpha/tlsb/dwlpx.c28
-rw-r--r--sys/alpha/tlsb/gbus.c98
-rw-r--r--sys/alpha/tlsb/gbusvar.h4
-rw-r--r--sys/alpha/tlsb/kftxx.c128
-rw-r--r--sys/alpha/tlsb/kftxxvar.h4
-rw-r--r--sys/alpha/tlsb/mcclock_tlsb.c62
-rw-r--r--sys/alpha/tlsb/tlsb.c164
-rw-r--r--sys/alpha/tlsb/tlsbvar.h4
-rw-r--r--sys/alpha/tlsb/zs_tlsb.c102
20 files changed, 390 insertions, 339 deletions
diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c
index f70e85d..cf4f581 100644
--- a/sys/alpha/alpha/autoconf.c
+++ b/sys/alpha/alpha/autoconf.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: autoconf.c,v 1.1 1998/06/10 10:52:10 dfr Exp $
*/
#include <sys/param.h>
@@ -69,6 +69,8 @@ configure_finish()
#endif
}
+extern void pci_configure(void);
+
/*
* Determine i/o configuration for a machine.
*/
@@ -77,7 +79,7 @@ configure(void *dummy)
{
configure_start();
- bus_add_device(root_bus, platform.iobus, 0, 0);
+ device_add_child(root_bus, platform.iobus, 0, 0);
root_bus_configure();
pci_configure();
diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c
index 24eb3c8..2fdaa68 100644
--- a/sys/alpha/alpha/clock.c
+++ b/sys/alpha/alpha/clock.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: clock.c,v 1.1 1998/06/10 10:52:13 dfr Exp $ */
/* $NetBSD: clock.c,v 1.20 1998/01/31 10:32:47 ross Exp $ */
/*
@@ -52,8 +52,7 @@
#include <sys/bus.h>
#include <machine/cpuconf.h>
-
-#include <dev/dec/clockvar.h>
+#include <machine/clockvar.h>
#define SECMIN ((unsigned)60) /* seconds per minute */
#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */
@@ -63,13 +62,12 @@
#define LEAPYEAR(year) (((year) % 4) == 0)
device_t clockdev;
-const struct clockfns *clockfns;
int clockinitted;
int tickfix;
int tickfixinterval;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
-extern cycles_per_sec;
+extern int cycles_per_sec;
static timecounter_get_t alpha_get_timecount;
static timecounter_pps_t alpha_poll_pps;
@@ -103,18 +101,15 @@ static u_int32_t last_time;
static void handleclock(void* arg);
void
-clockattach(dev, fns)
- struct device *dev;
- const struct clockfns *fns;
+clockattach(device_t dev)
{
/*
* Just bookkeeping.
*/
- if (clockfns != NULL)
+ if (clockdev)
panic("clockattach: multiple clocks");
clockdev = dev;
- clockfns = fns;
#ifdef EVCNT_COUNTERS
evcnt_attach(dev, "intr", &clock_intr_evcnt);
#endif
@@ -140,7 +135,7 @@ clockattach(dev, fns)
void
cpu_initclocks()
{
- if (clockfns == NULL)
+ if (clockdev == NULL)
panic("cpu_initclocks: no clock attached");
tick = 1000000 / hz; /* number of microseconds between interrupts */
@@ -177,7 +172,7 @@ cpu_initclocks()
/*
* Get the clock started.
*/
- (*clockfns->cf_init)(clockdev);
+ CLOCK_INIT(clockdev);
}
static void
@@ -241,7 +236,7 @@ inittodr(base)
} else
badbase = 0;
- (*clockfns->cf_get)(clockdev, base, &ct);
+ CLOCK_GET(clockdev, base, &ct);
clockinitted = 1;
/* simple sanity checks */
@@ -344,7 +339,7 @@ resettodr()
ct.min = t / SECMIN;
ct.sec = t % SECMIN;
- (*clockfns->cf_set)(clockdev, &ct);
+ CLOCK_SET(clockdev, &ct);
}
static unsigned
diff --git a/sys/alpha/alpha/cons.c b/sys/alpha/alpha/cons.c
index 511f370..78d1149 100644
--- a/sys/alpha/alpha/cons.c
+++ b/sys/alpha/alpha/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.57 1998/03/28 10:32:56 bde Exp $
+ * $Id: cons.c,v 1.1 1998/06/10 10:52:15 dfr Exp $
*/
#include "opt_devfs.h"
@@ -424,7 +424,7 @@ cnputc(c)
}
}
-static cn_devsw_installed = 0;
+static int cn_devsw_installed = 0;
static void
cn_drvinit(void *unused)
diff --git a/sys/alpha/alpha/dec_kn8ae.c b/sys/alpha/alpha/dec_kn8ae.c
index aad572b..813d202 100644
--- a/sys/alpha/alpha/dec_kn8ae.c
+++ b/sys/alpha/alpha/dec_kn8ae.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: dec_kn8ae.c,v 1.1 1998/06/10 10:52:30 dfr Exp $ */
/* $NetBSD: dec_kn8ae.c,v 1.15 1998/02/13 00:12:50 thorpej Exp $ */
/*
@@ -44,6 +44,7 @@
#include <alpha/tlsb/tlsbreg.h>
#include <alpha/tlsb/gbusreg.h>
+#include <alpha/tlsb/zsvar.h>
void dec_kn8ae_init(int);
static void dec_kn8ae_cons_init(void);
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c
index 520bd41..50ebf1d 100644
--- a/sys/alpha/alpha/genassym.c
+++ b/sys/alpha/alpha/genassym.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
- * $Id: genassym.c,v 1.54 1998/04/06 18:59:14 peter Exp $
+ * $Id: genassym.c,v 1.1 1998/06/10 10:52:39 dfr Exp $
*/
#include <sys/param.h>
@@ -64,8 +64,10 @@
int main __P((void));
int printf __P((const char *, ...));
+#define BIG(val) ((val) > 999LL || (val) < -999LL)
+
#define P(name, val) \
- printf(val > 999 ? "#define\t%s 0x%lx\n" : "#define\t%s %ld\n", name, val)
+ printf(BIG(val) ? "#define\t%s 0x%qx\n" : "#define\t%s %qd\n", name, val)
/* XXX Danger Will Robinson */
struct prochd {
@@ -73,9 +75,9 @@ struct prochd {
struct proc *ph_rlink;
};
-#define OFF(name, type, elem) P(#name, (long)&((type*)0)->elem)
-#define CONST2(name, val) P(#name, val)
-#define CONST1(name) P(#name, name)
+#define OFF(name, type, elem) P(#name, (long long) &((type*)0)->elem)
+#define CONST2(name, val) P(#name, (long long) val)
+#define CONST1(name) P(#name, (long long) name)
int
main()
diff --git a/sys/alpha/alpha/gensetdefs.c b/sys/alpha/alpha/gensetdefs.c
index 0e446345..d2aaa8d 100644
--- a/sys/alpha/alpha/gensetdefs.c
+++ b/sys/alpha/alpha/gensetdefs.c
@@ -23,11 +23,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: gensetdefs.c,v 1.1 1997/05/21 23:21:25 jdp Exp $
+ * $Id: gensetdefs.c,v 1.1 1998/06/10 10:52:41 dfr Exp $
*/
#include <sys/types.h>
-#include <machine/elf.h>
+#include "../../alpha/include/elf.h"
#include <err.h>
#include <stddef.h>
diff --git a/sys/alpha/conf/Makefile.alpha b/sys/alpha/conf/Makefile.alpha
index ecc9daa..51cb957 100644
--- a/sys/alpha/conf/Makefile.alpha
+++ b/sys/alpha/conf/Makefile.alpha
@@ -1,7 +1,7 @@
# Makefile.alpha -- with config changes.
# Copyright 1990 W. Jolitz
# from: @(#)Makefile.alpha 7.1 5/10/91
-# $Id: Makefile.alpha,v 1.109 1998/04/17 07:51:36 dima Exp $
+# $Id: Makefile.alpha,v 1.1 1998/06/10 10:53:59 dfr Exp $
#
# Makefile for FreeBSD
#
@@ -30,6 +30,9 @@ S= ../..
.endif
ALPHA= ${S}/alpha
+HCC?=${CC}
+SIZE?=size
+
COPTFLAGS?=-O
INCLUDES= -nostdinc -I- -I. -I$S
# This hack is to allow kernel compiles to succeed on machines w/out srcdist
@@ -59,6 +62,9 @@ DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
+NORMAL_M= sh $S/kern/makedevops.sh -c $<;\
+ ${CC} -c ${CFLAGS} ${PROF} `basename $< .m`.c
+
# ${ALPHA}/alpha/setdef0.c and ${ALPHA}/alpha/setdef1.c are intentionally
# omitted from SYSTEM_CFILES. They depend on setdefs.h, a header which
# is generated from all of ${OBJS}. We don't want to have to compile
@@ -71,11 +77,12 @@ SYMORDER_EXCLUDE=-x symbols.exclude
.endif
SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
.if ${BINFORMAT} == elf
-SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \
+SYSTEM_OBJS= locore.o setdef0.o vnode_if.o \
+ ${OBJS} ioconf.o param.o config.o \
setdef1.o
SYSTEM_LD= @${LD} -Bstatic -N -Ttext ${LOAD_ADDRESS} -e locorestart -defsym _DYNAMIC=0 \
-o $@ -X ${SYSTEM_OBJS} vers.o
-SYSTEM_LD_TAIL= @size $@; chmod 755 $@
+SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@
.endif
%BEFORE_DEPEND
@@ -123,10 +130,10 @@ setdefs.h: gensetdefs ${OBJS}
@./gensetdefs ${OBJS} >setdefs.h
gensetdefs: gensetdefs.o
- ${CC} ${CFLAGS} gensetdefs.o -o $@
+ ${HCC} gensetdefs.o -o $@
gensetdefs.o: ${ALPHA}/alpha/gensetdefs.c
- ${CC} -c ${CFLAGS} ${ALPHA}/alpha/gensetdefs.c
+ ${HCC} ${CFLAGS} -c ${ALPHA}/alpha/gensetdefs.c
# everything potentially depends on the Makefile since everything potentially
# depends on the options. Some things are more dependent on the Makefile for
@@ -151,10 +158,10 @@ assym.s: genassym
# Some of the defines that genassym outputs may well depend on the
# value of kernel options.
genassym.o: ${ALPHA}/alpha/genassym.c Makefile opt_global.h
- ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${ALPHA}/alpha/genassym.c
+ ${HCC} -c ${COPTS} ${PARAM} -UKERNEL ${ALPHA}/alpha/genassym.c
genassym: genassym.o
- ${CC} ${CFLAGS} ${PARAM} genassym.o -o $@
+ ${HCC} ${COPTS} ${PARAM} genassym.o -o $@
SYSTEM_OBJS+= __divqu.o __divq.o __divlu.o __divl.o
SYSTEM_OBJS+= __remqu.o __remq.o __remlu.o __reml.o
diff --git a/sys/alpha/conf/files.alpha b/sys/alpha/conf/files.alpha
index 04e5410..57c00a6 100644
--- a/sys/alpha/conf/files.alpha
+++ b/sys/alpha/conf/files.alpha
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $Id$
+# $Id: files.alpha,v 1.1 1998/06/10 10:54:08 dfr Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -48,6 +48,14 @@ alpha/alpha/interrupt.c standard
alpha/alpha/userconfig.c optional userconfig
alpha/alpha/vm_machdep.c standard
alpha/alpha/clock.c standard
+alpha/alpha/clock_if.m standard \
+ dependency "$S/kern/makedevops.sh" \
+ clean "clock_if.c"
+clock_if.h standard \
+ dependency "$S/kern/makedevops.sh $S/alpha/alpha/clock_if.m" \
+ compile-with "sh $S/kern/makedevops.sh -h $S/alpha/alpha/clock_if.m" \
+ no-obj no-implicit-rule before-depend \
+ clean "clock_if.h"
alpha/alpha/diskslice_machdep.c standard
alpha/tlsb/tlsb.c optional tlsb
alpha/tlsb/gbus.c optional gbus
@@ -56,8 +64,32 @@ alpha/tlsb/mcclock_tlsb.c optional gbus
alpha/tlsb/zs_tlsb.c optional gbus
alpha/tlsb/dwlpx.c optional dwlpx
dev/dec/mcclock.c optional gbus
+dev/dec/mcclock_if.m optional gbus \
+ dependency "$S/kern/makedevops.sh" \
+ clean "mcclock_if.c"
+mcclock_if.h standard \
+ dependency "$S/kern/makedevops.sh $S/dev/dec/mcclock_if.m" \
+ compile-with "sh $S/kern/makedevops.sh -h $S/dev/dec/mcclock_if.m" \
+ no-obj no-implicit-rule before-depend \
+ clean "mcclock_if.h"
alpha/pci/pcibus.c optional pci
kern/subr_bus.c standard
+kern/device_if.m standard \
+ dependency "$S/kern/makedevops.sh" \
+ clean "device_if.c"
+device_if.h standard \
+ dependency "$S/kern/makedevops.sh $S/kern/device_if.m" \
+ compile-with "sh $S/kern/makedevops.sh -h $S/kern/device_if.m" \
+ no-obj no-implicit-rule before-depend \
+ clean "device_if.h"
+kern/bus_if.m standard \
+ dependency "$S/kern/makedevops.sh" \
+ clean "bus_if.c"
+bus_if.h standard \
+ dependency "$S/kern/makedevops.sh $S/kern/bus_if.m" \
+ compile-with "sh $S/kern/makedevops.sh -h $S/kern/bus_if.m" \
+ no-obj no-implicit-rule before-depend \
+ clean "bus_if.h"
libkern/bcd.c standard
libkern/bcmp.c standard
libkern/ffs.c standard
diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h
index 9bd97f4..5107274 100644
--- a/sys/alpha/include/alpha_cpu.h
+++ b/sys/alpha/include/alpha_cpu.h
@@ -1,4 +1,4 @@
-/* $Id: alpha_cpu.h,v 1.1 1998/01/10 10:13:13 jb Exp $ */
+/* $Id: alpha_cpu.h,v 1.2 1998/06/10 10:54:21 dfr Exp $ */
/* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */
/*
@@ -191,12 +191,12 @@ struct alpha_logout_area {
#define ALPHA_L1SHIFT (ALPHA_L2SHIFT+ALPHA_PTSHIFT)
#define ALPHA_USEG_BASE 0 /* virtual */
-#define ALPHA_USEG_END 0x000003ffffffffff
+#define ALPHA_USEG_END 0x000003ffffffffffLL
-#define ALPHA_K0SEG_BASE 0xfffffc0000000000 /* direct-mapped */
-#define ALPHA_K0SEG_END 0xfffffdffffffffff
-#define ALPHA_K1SEG_BASE 0xfffffe0000000000 /* virtual */
-#define ALPHA_K1SEG_END 0xffffffffffffffff
+#define ALPHA_K0SEG_BASE 0xfffffc0000000000LL /* direct-mapped */
+#define ALPHA_K0SEG_END 0xfffffdffffffffffLL
+#define ALPHA_K1SEG_BASE 0xfffffe0000000000LL /* virtual */
+#define ALPHA_K1SEG_END 0xffffffffffffffffLL
#define ALPHA_K0SEG_TO_PHYS(x) ((x) & ~ALPHA_K0SEG_BASE)
#define ALPHA_PHYS_TO_K0SEG(x) ((x) | ALPHA_K0SEG_BASE)
diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h
index 70101f0..63e203c 100644
--- a/sys/alpha/include/param.h
+++ b/sys/alpha/include/param.h
@@ -1,4 +1,4 @@
-/* $Id: param.h,v 1.2 1998/03/09 05:53:10 jb Exp $ */
+/* $Id: param.h,v 1.3 1998/06/10 10:55:15 dfr Exp $ */
/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */
/*
@@ -75,7 +75,7 @@
#define PAGE_MASK (PAGE_SIZE-1)
#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
-#define KERNBASE 0xfffffc0000230000 /* start of kernel virtual */
+#define KERNBASE 0xfffffc0000230000LL /* start of kernel virtual */
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h
index 612fe8e..fead056 100644
--- a/sys/alpha/include/vmparam.h
+++ b/sys/alpha/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $Id: vmparam.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */
+/* $Id: vmparam.h,v 1.2 1998/06/10 10:55:30 dfr Exp $ */
/* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */
#ifndef _ALPHA_VMPARAM_H
#define _ALPHA_VMPARAM_H
@@ -133,11 +133,11 @@
*/
/* user/kernel map constants */
-#define VM_MIN_ADDRESS ((vm_offset_t)ALPHA_USEG_BASE) /* 0 */
-#define VM_MAXUSER_ADDRESS ((vm_offset_t)(ALPHA_USEG_END + 1L))
+#define VM_MIN_ADDRESS (ALPHA_USEG_BASE) /* 0 */
+#define VM_MAXUSER_ADDRESS ((ALPHA_USEG_END + 1LL))
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
-#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_BASE)
-#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_END)
+#define VM_MIN_KERNEL_ADDRESS (ALPHA_K1SEG_BASE)
+#define VM_MAX_KERNEL_ADDRESS (ALPHA_K1SEG_END)
/* virtual sizes (bytes) for various kernel submaps */
#ifndef VM_KMEM_SIZE
@@ -159,5 +159,5 @@
#endif
/* some Alpha-specific constants */
-#define VPTBASE ((vm_offset_t)0xfffffffe00000000) /* Virt. pg table */
+#define VPTBASE (0xfffffffe00000000LL) /* Virt. pg table */
#endif /* !_ALPHA_VMPARAM_H */
diff --git a/sys/alpha/tlsb/dwlpx.c b/sys/alpha/tlsb/dwlpx.c
index e9f2aa5..14317b6 100644
--- a/sys/alpha/tlsb/dwlpx.c
+++ b/sys/alpha/tlsb/dwlpx.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: dwlpx.c,v 1.1 1998/06/10 10:55:41 dfr Exp $
*/
#include "opt_simos.h"
@@ -231,33 +231,37 @@ dwlpx_cfgwritel(u_int b, u_int s, u_int f, u_int r, u_int32_t data)
SPARSE_WRITE_LONG(sc->cfg_base, off, data);
}
-static driver_probe_t dwlpx_probe;
-static driver_attach_t dwlpx_attach;
+static int dwlpx_probe(device_t dev);
+static int dwlpx_attach(device_t dev);
static driver_intr_t dwlpx_intr;
+static device_method_t dwlpx_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, dwlpx_probe),
+ DEVMETHOD(device_attach, dwlpx_attach),
+
+ { 0, 0 }
+};
+
static driver_t dwlpx_driver = {
"dwlpx",
- dwlpx_probe,
- dwlpx_attach,
- NULL,
- NULL,
+ dwlpx_methods,
DRIVER_TYPE_MISC,
sizeof(struct dwlpx_softc),
- NULL,
};
-
static int
-dwlpx_probe(bus_t bus, device_t dev)
+dwlpx_probe(device_t dev)
{
if (dwlpx0)
return ENXIO;
+ dwlpx0 = dev;
device_set_desc(dev, "DWLPA or DWLPB PCI adapter");
return 0;
}
static int
-dwlpx_attach(bus_t bus, device_t dev)
+dwlpx_attach(device_t dev)
{
struct dwlpx_softc* sc = DWLPX_SOFTC(dev);
vm_offset_t regs;
@@ -273,7 +277,7 @@ dwlpx_attach(bus_t bus, device_t dev)
*(u_int32_t*) (regs + PCIA_CTL(0)) = 1; /* Type1 config cycles */
- bus_map_intr(bus, dev, dwlpx_intr, 0);
+ BUS_MAP_INTR(device_get_parent(dev), dev, dwlpx_intr, 0);
return 0;
}
diff --git a/sys/alpha/tlsb/gbus.c b/sys/alpha/tlsb/gbus.c
index 5235284..c7a1191 100644
--- a/sys/alpha/tlsb/gbus.c
+++ b/sys/alpha/tlsb/gbus.c
@@ -75,54 +75,33 @@ struct gbus_device gbus_children[] = {
static devclass_t gbus_devclass;
/*
- * Bus handlers.
+ * Device methods
*/
-static bus_print_device_t gbus_print_device;
-static bus_read_ivar_t gbus_read_ivar;
-
-static bus_ops_t gbus_bus_ops = {
- gbus_print_device,
- gbus_read_ivar,
- null_write_ivar,
- null_map_intr,
+static int gbus_probe(device_t dev);
+static void gbus_print_child(device_t dev, device_t child);
+static int gbus_read_ivar(device_t dev, device_t child, int which, u_long *result);;
+
+static device_method_t gbus_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, gbus_probe),
+ DEVMETHOD(device_attach, bus_generic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+ /* Bus interface */
+ DEVMETHOD(bus_print_child, gbus_print_child),
+ DEVMETHOD(bus_read_ivar, gbus_read_ivar),
+ DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
+ DEVMETHOD(bus_map_intr, bus_generic_map_intr),
+
+ { 0, 0 }
};
-static void
-gbus_print_device(bus_t bus, device_t dev)
-{
- struct gbus_device* gdev = DEVTOGBUS(dev);
- device_t gbusdev = bus_get_device(bus);
-
- printf(" at %s%d offset 0x%lx",
- device_get_name(gbusdev), device_get_unit(gbusdev),
- gdev->gd_offset);
-}
-
-static int
-gbus_read_ivar(bus_t bus, device_t dev,
- int index, u_long* result)
-{
- struct gbus_device* gdev = DEVTOGBUS(dev);
-
- switch (index) {
- case GBUS_IVAR_OFFSET:
- *result = gdev->gd_offset;
- break;
- }
- return ENOENT;
-}
-
-static driver_probe_t gbus_bus_probe;
-
-static driver_t gbus_bus_driver = {
+static driver_t gbus_driver = {
"gbus",
- gbus_bus_probe,
- bus_generic_attach,
- bus_generic_detach,
- bus_generic_shutdown,
+ gbus_methods,
DRIVER_TYPE_MISC,
- sizeof(struct bus),
- NULL,
+ 1, /* no softc */
};
/*
@@ -131,9 +110,8 @@ static driver_t gbus_bus_driver = {
* are alive.
*/
static int
-gbus_bus_probe(bus_t parent, device_t dev)
+gbus_probe(device_t dev)
{
- bus_t bus = device_get_softc(dev);
struct gbus_device *gdev;
/*
@@ -144,12 +122,34 @@ gbus_bus_probe(bus_t parent, device_t dev)
if (!TLDEV_ISCPU(tlsb_get_dtype(dev)))
return ENXIO;
- bus_init(bus, dev, &gbus_bus_ops);
-
for (gdev = gbus_children; gdev->gd_name; gdev++)
- bus_add_device(bus, gdev->gd_name, -1, gdev);
+ device_add_child(dev, gdev->gd_name, -1, gdev);
return 0;
}
-DRIVER_MODULE(gbus, tlsb, gbus_bus_driver, gbus_devclass, 0, 0);
+static void
+gbus_print_child(device_t bus, device_t dev)
+{
+ struct gbus_device* gdev = DEVTOGBUS(dev);
+
+ printf(" at %s%d offset 0x%lx",
+ device_get_name(bus), device_get_unit(bus),
+ gdev->gd_offset);
+}
+
+static int
+gbus_read_ivar(device_t bus, device_t dev,
+ int index, u_long* result)
+{
+ struct gbus_device* gdev = DEVTOGBUS(dev);
+
+ switch (index) {
+ case GBUS_IVAR_OFFSET:
+ *result = gdev->gd_offset;
+ break;
+ }
+ return ENOENT;
+}
+
+DRIVER_MODULE(gbus, tlsb, gbus_driver, gbus_devclass, 0, 0);
diff --git a/sys/alpha/tlsb/gbusvar.h b/sys/alpha/tlsb/gbusvar.h
index 1575817..5ece6e0 100644
--- a/sys/alpha/tlsb/gbusvar.h
+++ b/sys/alpha/tlsb/gbusvar.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: gbusvar.h,v 1.2 1998/06/10 20:40:59 dfr Exp $
*/
/* $NetBSD: gbusvar.h,v 1.1 1998/05/13 02:50:29 thorpej Exp $ */
@@ -81,7 +81,7 @@ enum gbus_device_ivars {
static __inline T gbus_get_ ## A(device_t dev) \
{ \
u_long v; \
- bus_read_ivar(device_get_parent(dev), dev, GBUS_IVAR_ ## B, &v); \
+ BUS_READ_IVAR(device_get_parent(dev), dev, GBUS_IVAR_ ## B, &v); \
return (T) v; \
}
diff --git a/sys/alpha/tlsb/kftxx.c b/sys/alpha/tlsb/kftxx.c
index 9f41b62..d2b19d2 100644
--- a/sys/alpha/tlsb/kftxx.c
+++ b/sys/alpha/tlsb/kftxx.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: kftxx.c,v 1.1 1998/06/10 10:55:49 dfr Exp $ */
/* $NetBSD: kftxx.c,v 1.9 1998/05/14 00:01:32 thorpej Exp $ */
/*
@@ -53,7 +53,6 @@
#include <alpha/tlsb/kftxxvar.h>
struct kft_softc {
- struct bus sc_bus; /* bus common */
int sc_node; /* TLSB node */
u_int16_t sc_dtype; /* device type */
};
@@ -73,72 +72,37 @@ struct kft_device {
static devclass_t kft_devclass;
/*
- * Bus handlers.
+ * Device methods
*/
-static bus_print_device_t kft_print_device;
-static bus_read_ivar_t kft_read_ivar;
-
-static bus_ops_t kft_bus_ops = {
- kft_print_device,
- kft_read_ivar,
- null_write_ivar,
- null_map_intr,
+static int kft_probe(device_t dev);
+static void kft_print_child(device_t dev, device_t child);
+static int kft_read_ivar(device_t dev, device_t child, int which, u_long *result);;
+
+static device_method_t kft_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, kft_probe),
+ DEVMETHOD(device_attach, bus_generic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+ /* Bus interface */
+ DEVMETHOD(bus_print_child, kft_print_child),
+ DEVMETHOD(bus_read_ivar, kft_read_ivar),
+ DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
+ DEVMETHOD(bus_map_intr, bus_generic_map_intr),
+
+ { 0, 0 }
};
-static void
-kft_print_device(bus_t bus, device_t dev)
-{
- struct kft_device *kd = (struct kft_device*) device_get_ivars(dev);
- device_t busdev = bus_get_device(bus);
-
- printf(" at %s%d hose %d",
- device_get_name(busdev), device_get_unit(busdev),
- kd->kd_hosenum);
-}
-
-static int
-kft_read_ivar(bus_t bus, device_t dev,
- int index, u_long* result)
-{
- struct kft_device *kd = (struct kft_device*) device_get_ivars(dev);
-
- switch (index) {
- case KFT_IVAR_NAME:
- *result = (u_long) kd->kd_name;
- return 0;
-
- case KFT_IVAR_NODE:
- *result = (u_long) kd->kd_node;
- return 0;
-
- case KFT_IVAR_DTYPE:
- *result = (u_long) kd->kd_dtype;
- return 0;
-
- case KFT_IVAR_HOSENUM:
- *result = (u_long) kd->kd_hosenum;
- return 0;
-
- default:
- return ENOENT;
- }
-}
-
-static driver_probe_t kft_bus_probe;
-
-static driver_t kft_bus_driver = {
+static driver_t kft_driver = {
"kft",
- kft_bus_probe,
- bus_generic_attach,
- bus_generic_detach,
- bus_generic_shutdown,
+ kft_methods,
DRIVER_TYPE_MISC,
- sizeof(struct kft_softc),
- NULL,
+ 1, /* no softc */
};
static int
-kft_bus_probe(bus_t parent, device_t dev)
+kft_probe(device_t dev)
{
struct kft_softc *sc = (struct kft_softc *) device_get_softc(dev);
struct kft_device* kd;
@@ -147,8 +111,6 @@ kft_bus_probe(bus_t parent, device_t dev)
if (!TLDEV_ISIOPORT(tlsb_get_dtype(dev)))
return ENXIO;
- bus_init(&sc->sc_bus, dev, &kft_bus_ops);
-
sc->sc_node = tlsb_get_node(dev);
sc->sc_dtype = tlsb_get_dtype(dev);
@@ -183,10 +145,48 @@ kft_bus_probe(bus_t parent, device_t dev)
kd->kd_node = sc->sc_node;
kd->kd_dtype = sc->sc_dtype;
kd->kd_hosenum = hoseno;
- bus_add_device(&sc->sc_bus, kd->kd_name, -1, kd);
+ device_add_child(dev, kd->kd_name, -1, kd);
}
return 0;
}
-DRIVER_MODULE(kft, tlsb, kft_bus_driver, kft_devclass, 0, 0);
+static void
+kft_print_child(device_t bus, device_t dev)
+{
+ struct kft_device *kd = (struct kft_device*) device_get_ivars(dev);
+
+ printf(" at %s%d hose %d",
+ device_get_name(bus), device_get_unit(bus),
+ kd->kd_hosenum);
+}
+
+static int
+kft_read_ivar(device_t bus, device_t dev,
+ int index, u_long* result)
+{
+ struct kft_device *kd = (struct kft_device*) device_get_ivars(dev);
+
+ switch (index) {
+ case KFT_IVAR_NAME:
+ *result = (u_long) kd->kd_name;
+ return 0;
+
+ case KFT_IVAR_NODE:
+ *result = (u_long) kd->kd_node;
+ return 0;
+
+ case KFT_IVAR_DTYPE:
+ *result = (u_long) kd->kd_dtype;
+ return 0;
+
+ case KFT_IVAR_HOSENUM:
+ *result = (u_long) kd->kd_hosenum;
+ return 0;
+
+ default:
+ return ENOENT;
+ }
+}
+
+DRIVER_MODULE(kft, tlsb, kft_driver, kft_devclass, 0, 0);
diff --git a/sys/alpha/tlsb/kftxxvar.h b/sys/alpha/tlsb/kftxxvar.h
index 40c7424..56168e6 100644
--- a/sys/alpha/tlsb/kftxxvar.h
+++ b/sys/alpha/tlsb/kftxxvar.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: kftxxvar.h,v 1.2 1998/06/10 20:48:03 dfr Exp $
*/
/*
@@ -45,7 +45,7 @@ enum kft_dev_ivars {
static __inline T kft_get_ ## A(device_t dev) \
{ \
u_long v; \
- bus_read_ivar(device_get_parent(dev), dev, KFT_IVAR_ ## B, &v); \
+ BUS_READ_IVAR(device_get_parent(dev), dev, KFT_IVAR_ ## B, &v); \
return (T) v; \
}
diff --git a/sys/alpha/tlsb/mcclock_tlsb.c b/sys/alpha/tlsb/mcclock_tlsb.c
index 15974fc..593b00f 100644
--- a/sys/alpha/tlsb/mcclock_tlsb.c
+++ b/sys/alpha/tlsb/mcclock_tlsb.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: mcclock_tlsb.c,v 1.1 1998/06/10 10:55:52 dfr Exp $ */
/* $NetBSD: mcclock_tlsb.c,v 1.8 1998/05/13 02:50:29 thorpej Exp $ */
/*
@@ -37,7 +37,7 @@
#include <sys/module.h>
#include <sys/bus.h>
-#include <dev/dec/clockvar.h>
+#include <machine/clockvar.h>
#include <dev/dec/mcclockvar.h>
#include <alpha/tlsb/gbusvar.h>
@@ -53,71 +53,73 @@
#define REGSHIFT 6
struct mcclock_tlsb_softc {
- struct mcclock_softc sc_mcclock;
unsigned long regbase;
};
-static int mcclock_tlsb_probe(bus_t, device_t);
-static int mcclock_tlsb_attach(bus_t, device_t);
+static int mcclock_tlsb_probe(device_t dev);
+static int mcclock_tlsb_attach(device_t dev);
+static void mcclock_tlsb_write(device_t, u_int, u_int);
+static u_int mcclock_tlsb_read(device_t, u_int);
-static devclass_t mcclock_devclass;
+static device_method_t mcclock_tlsb_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, mcclock_tlsb_probe),
+ DEVMETHOD(device_attach, mcclock_tlsb_attach),
+
+ /* mcclock interface */
+ DEVMETHOD(mcclock_write, mcclock_tlsb_write),
+ DEVMETHOD(mcclock_read, mcclock_tlsb_read),
+
+ /* clock interface */
+ DEVMETHOD(clock_init, mcclock_init),
+ DEVMETHOD(clock_get, mcclock_get),
+ DEVMETHOD(clock_set, mcclock_set),
+
+ { 0, 0 }
+};
-driver_t mcclock_tlsb_driver = {
+static driver_t mcclock_tlsb_driver = {
"mcclock",
- mcclock_tlsb_probe,
- mcclock_tlsb_attach,
- NULL,
- NULL,
+ mcclock_tlsb_methods,
DRIVER_TYPE_MISC,
sizeof(struct mcclock_tlsb_softc),
- NULL,
};
-static void mcclock_tlsb_write __P((struct mcclock_softc *, u_int, u_int));
-static u_int mcclock_tlsb_read __P((struct mcclock_softc *, u_int));
-
-const struct mcclock_busfns mcclock_tlsb_busfns = {
- mcclock_tlsb_write, mcclock_tlsb_read,
-};
+static devclass_t mcclock_devclass;
int
-mcclock_tlsb_probe(bus_t bus, device_t dev)
+mcclock_tlsb_probe(device_t dev)
{
device_set_desc(dev, "MC146818A real time clock");
return 0;
}
int
-mcclock_tlsb_attach(bus_t bus, device_t dev)
+mcclock_tlsb_attach(device_t dev)
{
struct mcclock_tlsb_softc *sc = device_get_softc(dev);
/* XXX Should be bus.h'd, so we can accomodate the kn7aa. */
- sc->sc_mcclock.sc_dev = dev;
sc->regbase = TLSB_GBUS_BASE + gbus_get_offset(dev);
- mcclock_attach(&sc->sc_mcclock, &mcclock_tlsb_busfns);
+ mcclock_attach(dev);
return 0;
}
static void
-mcclock_tlsb_write(mcsc, reg, val)
- struct mcclock_softc *mcsc;
- u_int reg, val;
+mcclock_tlsb_write(device_t dev, u_int reg, u_int val)
{
- struct mcclock_tlsb_softc *sc = (struct mcclock_tlsb_softc *)mcsc;
+ struct mcclock_tlsb_softc *sc = device_get_softc(dev);
unsigned char *ptr = (unsigned char *)
KV(sc->regbase + (reg << REGSHIFT));
*ptr = val;
}
static u_int
-mcclock_tlsb_read(mcsc, reg)
- struct mcclock_softc *mcsc;
- u_int reg;
+mcclock_tlsb_read(device_t dev, u_int reg)
{
- struct mcclock_tlsb_softc *sc = (struct mcclock_tlsb_softc *)mcsc;
+ struct mcclock_tlsb_softc *sc = device_get_softc(dev);
unsigned char *ptr = (unsigned char *)
KV(sc->regbase + (reg << REGSHIFT));
return *ptr;
diff --git a/sys/alpha/tlsb/tlsb.c b/sys/alpha/tlsb/tlsb.c
index 7b778ac..cb9639f 100644
--- a/sys/alpha/tlsb/tlsb.c
+++ b/sys/alpha/tlsb/tlsb.c
@@ -78,7 +78,6 @@ struct intr_mapping {
};
struct tlsb_softc {
- struct bus bus;
STAILQ_HEAD(, intr_mapping) intr_handlers;
};
@@ -86,88 +85,39 @@ static char *tlsb_node_type_str(u_int32_t);
static void tlsb_intr(void* frame, u_long vector);
/* There can be only one. */
-static int tlsb_found;
-static struct tlsb_softc* tlsb0_softc;
+static int tlsb_found;
+static struct tlsb_softc* tlsb0_softc;
+static devclass_t tlsb_devclass;
/*
- * Bus handlers.
+ * Device methods
*/
-static bus_print_device_t tlsb_print_device;
-static bus_read_ivar_t tlsb_read_ivar;
-static bus_map_intr_t tlsb_map_intr;
-
-static bus_ops_t tlsb_bus_ops = {
- tlsb_print_device,
- tlsb_read_ivar,
- null_write_ivar,
- tlsb_map_intr,
+static int tlsb_probe(device_t dev);
+static void tlsb_print_child(device_t dev, device_t child);
+static int tlsb_read_ivar(device_t dev, device_t child, int which, u_long* result);
+static int tlsb_map_intr(device_t dev, device_t child, driver_intr_t *intr, void *arg);
+
+static device_method_t tlsb_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, tlsb_probe),
+ DEVMETHOD(device_attach, bus_generic_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+ /* Bus interface */
+ DEVMETHOD(bus_print_child, tlsb_print_child),
+ DEVMETHOD(bus_read_ivar, tlsb_read_ivar),
+ DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
+ DEVMETHOD(bus_map_intr, tlsb_map_intr),
+
+ { 0, 0 }
};
-static void
-tlsb_print_device(bus_t bus, device_t dev)
-{
- device_t busdev = bus_get_device(bus);
- struct tlsb_device* tdev = DEVTOTLSB(dev);
-
- printf(" at %s%d node %d",
- device_get_name(busdev),
- device_get_unit(busdev),
- tdev->td_node);
-}
-
-static int
-tlsb_read_ivar(bus_t bus, device_t dev,
- int index, u_long* result)
-{
- struct tlsb_device* tdev = DEVTOTLSB(dev);
-
- switch (index) {
- case TLSB_IVAR_NODE:
- *result = tdev->td_node;
- break;
-
- case TLSB_IVAR_DTYPE:
- *result = tdev->td_dtype;
- break;
-
- case TLSB_IVAR_SWREV:
- *result = tdev->td_swrev;
- break;
-
- case TLSB_IVAR_HWREV:
- *result = tdev->td_hwrev;
- break;
- }
- return ENOENT;
-}
-
-static int
-tlsb_map_intr(bus_t bus, device_t dev, driver_intr_t *intr, void *arg)
-{
- struct tlsb_softc* sc = (struct tlsb_softc*) bus;
- struct intr_mapping* i;
- i = malloc(sizeof(struct intr_mapping), M_DEVBUF, M_NOWAIT);
- if (!i)
- return ENOMEM;
- i->intr = intr;
- i->arg = arg;
- STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue);
-
- return 0;
-}
-
-static driver_probe_t tlsb_bus_probe;
-static devclass_t tlsb_devclass;
-
-static driver_t tlsb_bus_driver = {
+static driver_t tlsb_driver = {
"tlsb",
- tlsb_bus_probe,
- bus_generic_attach,
- bus_generic_detach,
- bus_generic_shutdown,
+ tlsb_methods,
DRIVER_TYPE_MISC,
sizeof(struct tlsb_softc),
- NULL,
};
/*
@@ -176,17 +126,17 @@ static driver_t tlsb_bus_driver = {
* are alive.
*/
static int
-tlsb_bus_probe(bus_t parent, device_t dev)
+tlsb_probe(device_t dev)
{
struct tlsb_softc* sc = device_get_softc(dev);
struct tlsb_device *tdev;
u_int32_t tldev;
u_int8_t vid;
int node;
- device_t subdev;
+ device_t child;
device_set_desc(dev, "TurboLaser bus");
- bus_init(&sc->bus, dev, &tlsb_bus_ops);
+
STAILQ_INIT(&sc->intr_handlers);
tlsb0_softc = sc;
@@ -252,8 +202,8 @@ tlsb_bus_probe(bus_t parent, device_t dev)
tdev->td_swrev = TLDEV_SWREV(tldev);
tdev->td_hwrev = TLDEV_HWREV(tldev);
- subdev = bus_add_device(&sc->bus, NULL, -1, tdev);
- device_set_desc(subdev, tlsb_node_type_str(tdev->td_dtype));
+ child = device_add_child(dev, NULL, -1, tdev);
+ device_set_desc(child, tlsb_node_type_str(tdev->td_dtype));
/*
* Deal with hooking CPU instances to TurboLaser nodes.
@@ -277,6 +227,58 @@ tlsb_bus_probe(bus_t parent, device_t dev)
}
static void
+tlsb_print_child(device_t dev, device_t child)
+{
+ struct tlsb_device* tdev = DEVTOTLSB(child);
+
+ printf(" at %s%d node %d",
+ device_get_name(dev),
+ device_get_unit(dev),
+ tdev->td_node);
+}
+
+static int
+tlsb_read_ivar(device_t dev, device_t child,
+ int index, u_long* result)
+{
+ struct tlsb_device* tdev = DEVTOTLSB(child);
+
+ switch (index) {
+ case TLSB_IVAR_NODE:
+ *result = tdev->td_node;
+ break;
+
+ case TLSB_IVAR_DTYPE:
+ *result = tdev->td_dtype;
+ break;
+
+ case TLSB_IVAR_SWREV:
+ *result = tdev->td_swrev;
+ break;
+
+ case TLSB_IVAR_HWREV:
+ *result = tdev->td_hwrev;
+ break;
+ }
+ return ENOENT;
+}
+
+static int
+tlsb_map_intr(device_t dev, device_t child, driver_intr_t *intr, void *arg)
+{
+ struct tlsb_softc* sc = device_get_softc(dev);
+ struct intr_mapping* i;
+ i = malloc(sizeof(struct intr_mapping), M_DEVBUF, M_NOWAIT);
+ if (!i)
+ return ENOMEM;
+ i->intr = intr;
+ i->arg = arg;
+ STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue);
+
+ return 0;
+}
+
+static void
tlsb_intr(void* frame, u_long vector)
{
struct tlsb_softc* sc = tlsb0_softc;
@@ -291,7 +293,7 @@ tlsb_intr(void* frame, u_long vector)
i->intr(i->arg);
}
-DRIVER_MODULE(tlsb, root, tlsb_bus_driver, tlsb_devclass, 0, 0);
+DRIVER_MODULE(tlsb, root, tlsb_driver, tlsb_devclass, 0, 0);
static char *
tlsb_node_type_str(u_int32_t dtype)
diff --git a/sys/alpha/tlsb/tlsbvar.h b/sys/alpha/tlsb/tlsbvar.h
index bfb24ed..6b72785 100644
--- a/sys/alpha/tlsb/tlsbvar.h
+++ b/sys/alpha/tlsb/tlsbvar.h
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: tlsbvar.h,v 1.1 1998/06/10 10:55:58 dfr Exp $ */
/* $NetBSD: tlsbvar.h,v 1.5 1998/05/13 23:23:23 thorpej Exp $ */
/*
@@ -55,7 +55,7 @@ enum tlsb_device_instvars {
static __inline T tlsb_get_ ## A(device_t dev) \
{ \
u_long v; \
- bus_read_ivar(device_get_parent(dev), dev, TLSB_IVAR_ ## B, &v); \
+ BUS_READ_IVAR(device_get_parent(dev), dev, TLSB_IVAR_ ## B, &v); \
return v; \
}
diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c
index 8532ed3..bc20705 100644
--- a/sys/alpha/tlsb/zs_tlsb.c
+++ b/sys/alpha/tlsb/zs_tlsb.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: zs_tlsb.c,v 1.1 1998/06/10 10:55:59 dfr Exp $
*/
/*
* This driver is a hopeless hack to get the SimOS console working. A real
@@ -47,6 +47,7 @@
#include <alpha/tlsb/gbusvar.h>
#include <alpha/tlsb/tlsbreg.h> /* XXX */
#include <alpha/tlsb/zsreg.h>
+#include <alpha/tlsb/zsvar.h>
#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr)))
@@ -96,31 +97,35 @@ struct consdev zs_cons = {
static caddr_t zs_console_addr;
static int zs_console;
-static int zs_probe(bus_t, device_t);
-static int zs_attach(bus_t, device_t);
+static int zs_probe(device_t);
+static int zs_attach(device_t);
static devclass_t zs_devclass;
static devclass_t zsc_devclass;
-driver_t zs_driver = {
+static device_method_t zs_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, zs_probe),
+ DEVMETHOD(device_attach, zs_attach),
+
+ { 0, 0 }
+};
+
+static driver_t zs_driver = {
"zs",
- zs_probe,
- zs_attach,
- NULL,
- NULL,
+ zs_methods,
DRIVER_TYPE_MISC,
sizeof(struct zs_softc),
- NULL,
};
static int
-zs_probe(bus_t bus, device_t dev)
+zs_probe(device_t dev)
{
return 0;
}
static int
-zs_attach(bus_t bus, device_t dev)
+zs_attach(device_t dev)
{
struct zs_softc *sc = device_get_softc(dev);
@@ -355,34 +360,38 @@ CDEV_DRIVER_MODULE(zs, zsc, zs_driver, zs_devclass,
*/
struct zsc_softc {
- struct bus bus;
caddr_t base;
struct zs_softc* sc_a;
struct zs_softc* sc_b;
};
-static driver_probe_t zsc_tlsb_probe;
-static driver_attach_t zsc_tlsb_attach;
-static driver_intr_t zsc_tlsb_intr;
-static bus_print_device_t zsc_tlsb_print_device;
+static int zsc_tlsb_probe(device_t dev);
+static int zsc_tlsb_attach(device_t dev);
+static void zsc_tlsb_print_child(device_t dev, device_t child);
+static driver_intr_t zsc_tlsb_intr;
+
+
+static device_method_t zsc_tlsb_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, zsc_tlsb_probe),
+ DEVMETHOD(device_attach, zsc_tlsb_attach),
+ DEVMETHOD(device_detach, bus_generic_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
+ /* Bus interface */
+ DEVMETHOD(bus_print_child, zsc_tlsb_print_child),
+ DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
+ DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
+ DEVMETHOD(bus_map_intr, bus_generic_map_intr),
-driver_t zsc_tlsb_driver = {
+ { 0, 0 }
+};
+
+static driver_t zsc_tlsb_driver = {
"zsc",
- zsc_tlsb_probe,
- zsc_tlsb_attach,
- NULL,
- NULL,
+ zsc_tlsb_methods,
DRIVER_TYPE_MISC,
sizeof(struct zsc_softc),
- NULL,
-};
-
-
-static bus_ops_t zsc_tlsb_ops = {
- zsc_tlsb_print_device,
- null_read_ivar,
- null_write_ivar,
- null_map_intr,
};
static int
@@ -394,56 +403,51 @@ zsc_get_channel(device_t dev)
static caddr_t
zsc_get_base(device_t dev)
{
- device_t busdev = bus_get_device(device_get_parent(dev));
- struct zsc_softc* sc = device_get_softc(busdev);
+ device_t bus = device_get_parent(dev);
+ struct zsc_softc* sc = device_get_softc(bus);
return sc->base;
}
-static void
-zsc_tlsb_print_device(bus_t bus, device_t dev)
-{
- device_t busdev = bus_get_device(bus);
-
- printf(" at %s%d channel %c",
- device_get_name(busdev), device_get_unit(busdev),
- 'A' + (device_get_unit(dev) & 1));
-}
-
static int
-zsc_tlsb_probe(bus_t parent, device_t dev)
+zsc_tlsb_probe(device_t dev)
{
struct zsc_softc* sc = device_get_softc(dev);
device_set_desc(dev, "Z8530 uart");
- bus_init(&sc->bus, dev, &zsc_tlsb_ops);
-
sc->base = (caddr_t) ALPHA_PHYS_TO_K0SEG(TLSB_GBUS_BASE
+ gbus_get_offset(dev));
/*
* Add channel A for now.
*/
- bus_add_device(&sc->bus, "zs", -1, (void*) 0);
+ device_add_child(dev, "zs", -1, (void*) 0);
return 0;
}
static int
-zsc_tlsb_attach(bus_t parent, device_t dev)
+zsc_tlsb_attach(device_t dev)
{
struct zsc_softc* sc = device_get_softc(dev);
- bus_generic_attach(parent, dev);
+ bus_generic_attach(dev);
/* XXX */
sc->sc_a = ZS_SOFTC(0);
- bus_map_intr(parent, dev, zsc_tlsb_intr, sc);
+ BUS_MAP_INTR(device_get_parent(dev), dev, zsc_tlsb_intr, sc);
return 0;
}
+static void
+zsc_tlsb_print_child(device_t bus, device_t dev)
+{
+ printf(" at %s%d channel %c",
+ device_get_name(bus), device_get_unit(bus),
+ 'A' + (device_get_unit(dev) & 1));
+}
static void
zsc_tlsb_intr(void* arg)
OpenPOWER on IntegriCloud