sync with head rmind-uvmplock
authorrmind <rmind@NetBSD.org>
Sun, 12 Jun 2011 00:23:50 +0000
branchrmind-uvmplock
changeset 280649 ac982c7f5d3e
parent 280648 e19bade37012
child 280650 c7cce4440a4a
sync with head
sys/arch/acorn26/acorn26/fpu.c
sys/arch/acorn26/ioc/arckbd.c
sys/arch/acorn26/ioc/ioeb.c
sys/arch/acorn26/ioc/ioebvar.h
sys/arch/acorn26/ioc/latches.c
sys/arch/acorn26/ioc/ssn.c
sys/arch/acorn32/acorn32/autoconf.c
sys/arch/acorn32/conf/EB7500ATX
sys/arch/acorn32/eb7500atx/rsbus.c
sys/arch/acorn32/include/podulebus_machdep.h
sys/arch/acorn32/mainbus/com_pioc.c
sys/arch/acorn32/mainbus/fd.c
sys/arch/acorn32/mainbus/lpt_pioc.c
sys/arch/acorn32/mainbus/pioc.c
sys/arch/acorn32/mainbus/wdc_pioc.c
sys/arch/acorn32/podulebus/amps.c
sys/arch/acorn32/podulebus/asc.c
sys/arch/acorn32/podulebus/cosc.c
sys/arch/acorn32/podulebus/csc.c
sys/arch/acorn32/podulebus/if_ie.c
sys/arch/acorn32/podulebus/netslot.c
sys/arch/acorn32/podulebus/podulebus.c
sys/arch/acorn32/podulebus/ptsc.c
sys/arch/algor/dev/mainbus.c
sys/arch/alpha/alpha/compat_13_machdep.c
sys/arch/alpha/alpha/compat_16_machdep.c
sys/arch/alpha/alpha/core_machdep.c
sys/arch/alpha/alpha/cpu.c
sys/arch/alpha/alpha/fp_complete.c
sys/arch/alpha/alpha/genassym.cf
sys/arch/alpha/alpha/ipifuncs.c
sys/arch/alpha/alpha/locore.s
sys/arch/alpha/alpha/machdep.c
sys/arch/alpha/alpha/process_machdep.c
sys/arch/alpha/alpha/trap.c
sys/arch/alpha/alpha/vm_machdep.c
sys/arch/alpha/include/alpha.h
sys/arch/alpha/include/intr.h
sys/arch/alpha/include/pcb.h
sys/arch/alpha/include/proc.h
sys/arch/alpha/include/types.h
sys/arch/alpha/isa/isa_machdep.c
sys/arch/alpha/pci/ttwoga.c
sys/arch/alpha/tc/ioasic.c
sys/arch/alpha/tc/tcasic.c
sys/arch/alpha/tlsb/tlsb.c
sys/arch/amd64/conf/Makefile.amd64
sys/arch/amiga/amiga/autoconf.c
sys/arch/amiga/dev/a2kbbc.c
sys/arch/amiga/dev/a34kbbc.c
sys/arch/amiga/dev/clock.c
sys/arch/amiga/dev/fd.c
sys/arch/amiga/dev/grf.c
sys/arch/amiga/dev/gvpbus.c
sys/arch/amiga/dev/kbd.c
sys/arch/amiga/dev/msc.c
sys/arch/amiga/dev/toccata.c
sys/arch/amiga/dev/zbus.c
sys/arch/amigappc/amigappc/cpu.c
sys/arch/amigappc/amigappc/mainbus.c
sys/arch/arm/at91/at91aic.c
sys/arch/arm/mainbus/cpu_mainbus.c
sys/arch/arm/mainbus/mainbus.c
sys/arch/arm/marvell/mvsoctmr.c
sys/arch/arm/ofw/ofwgencfg_machdep.c
sys/arch/arm/xscale/pxa2x0.c
sys/arch/arm/xscale/pxa2x0_ac97.c
sys/arch/arm/xscale/pxa2x0_dmac.c
sys/arch/arm/xscale/pxa2x0_gpio.c
sys/arch/arm/xscale/pxa2x0_intr.c
sys/arch/arm/xscale/pxa2x0_udc.c
sys/arch/atari/atari/autoconf.c
sys/arch/atari/dev/atari5380.c
sys/arch/atari/dev/clock.c
sys/arch/atari/dev/grf.c
sys/arch/atari/dev/grfvar.h
sys/arch/atari/dev/hdfd.c
sys/arch/atari/dev/ite.c
sys/arch/atari/dev/ite_cc.c
sys/arch/atari/dev/ite_et.c
sys/arch/atari/dev/itevar.h
sys/arch/atari/dev/kbd.c
sys/arch/atari/dev/ncr5380.c
sys/arch/atari/dev/ncr5380reg.h
sys/arch/atari/dev/nvram.c
sys/arch/atari/dev/nvramvar.h
sys/arch/atari/isa/isa_machdep.c
sys/arch/atari/pci/pci_machdep.c
sys/arch/atari/vme/et4000.c
sys/arch/atari/vme/leo.c
sys/arch/atari/vme/vme.c
sys/arch/atari/vme/vme_machdep.c
sys/arch/atari/vme/vmevar.h
sys/arch/bebox/bebox/cpu.c
sys/arch/bebox/bebox/mainbus.c
sys/arch/bebox/bebox/pic_bebox.c
sys/arch/bebox/include/atomic.h
sys/arch/cats/pci/pcib.c
sys/arch/cesfic/cesfic/autoconf.c
sys/arch/emips/emips/mainbus.c
sys/arch/evbarm/adi_brh/obio.c
sys/arch/evbarm/conf/SHEEVAPLUG
sys/arch/evbarm/conf/TWINTAIL
sys/arch/evbarm/hdl_g/obio.c
sys/arch/evbarm/iq80310/obio.c
sys/arch/evbarm/iq80321/obio.c
sys/arch/evbarm/ixm1200/nappi_nppb.c
sys/arch/evbmips/conf/files.gdium
sys/arch/evbmips/gdium/gdium_dma.c
sys/arch/evbmips/gdium/gdium_intr.c
sys/arch/evbmips/gdium/machdep.c
sys/arch/evbmips/malta/dev/gt.c
sys/arch/evbmips/malta/dev/mainbus.c
sys/arch/evbmips/malta/pci/pchb.c
sys/arch/evbppc/conf/INSTALL.inc
sys/arch/evbppc/conf/INSTALL_MPC8536DS
sys/arch/evbppc/conf/INSTALL_MPC8548CDS
sys/arch/evbppc/conf/INSTALL_OPENBLOCKS266
sys/arch/evbppc/conf/INSTALL_P2020DS
sys/arch/evbppc/conf/INSTALL_P2020RDB
sys/arch/evbppc/conf/INSTALL_PMPPC
sys/arch/evbppc/conf/INSTALL_WALNUT
sys/arch/evbppc/conf/MPC8536DS
sys/arch/evbppc/conf/MPC8548CDS
sys/arch/evbppc/conf/P2020DS
sys/arch/evbppc/conf/P2020RDB
sys/arch/evbppc/conf/RB800
sys/arch/evbppc/conf/WALNUT
sys/arch/evbppc/conf/std.mpc85xx
sys/arch/evbppc/ev64260/mainbus.c
sys/arch/evbppc/explora/dev/elb.c
sys/arch/evbppc/include/atomic.h
sys/arch/evbppc/mpc85xx/machdep.c
sys/arch/evbppc/mpc85xx/mpc85xx_start.S
sys/arch/evbppc/pmppc/dev/cpc_mainbus.c
sys/arch/evbppc/pmppc/mainbus.c
sys/arch/evbppc/virtex/dev/xcvbus.c
sys/arch/evbppc/walnut/dev/pbus.c
sys/arch/evbppc/walnut/pci/pchb.c
sys/arch/hp700/gsc/if_ie_gsc.c
sys/arch/hpcmips/tx/txioman.c
sys/arch/hpcsh/dev/hd64465/hd64465.c
sys/arch/i386/conf/Makefile.i386
sys/arch/i386/i386/machdep.c
sys/arch/i386/include/frame.h
sys/arch/i386/isa/npx.c
sys/arch/i386/pci/pci_intr_fixup.c
sys/arch/i386/pci/viapcib.c
sys/arch/i386/pnpbios/wss_pnpbios.c
sys/arch/i386/pnpbios/ym_pnpbios.c
sys/arch/i386/stand/boot/Makefile.boot
sys/arch/i386/stand/lib/Makefile
sys/arch/i386/stand/lib/cpufunc.S
sys/arch/i386/stand/lib/pcio.c
sys/arch/i386/stand/lib/putstr32.S
sys/arch/ibmnws/include/atomic.h
sys/arch/iyonix/iyonix/obio.c
sys/arch/luna68k/luna68k/mainbus.c
sys/arch/m68k/include/pmap_motorola.h
sys/arch/m68k/m68k/pmap_motorola.c
sys/arch/mac68k/dev/adb.c
sys/arch/mac68k/mac68k/mainbus.c
sys/arch/mac68k/obio/obio.c
sys/arch/macppc/include/atomic.h
sys/arch/macppc/include/intr.h
sys/arch/macppc/macppc/cpu.c
sys/arch/macppc/macppc/ipi_hammerhead.c
sys/arch/macppc/macppc/machdep.c
sys/arch/macppc/macppc/mainbus.c
sys/arch/mips/alchemy/dev/auaudio.c
sys/arch/mips/alchemy/dev/auspi.c
sys/arch/mips/atheros/dev/arspi.c
sys/arch/mips/mips/cache.c
sys/arch/mips/mips/cache_ls2.c
sys/arch/mips/mips/mips_machdep.c
sys/arch/mips/mips/vm_machdep.c
sys/arch/mipsco/obio/obio.c
sys/arch/mmeye/mmeye/mainbus.c
sys/arch/mvme68k/dev/mainbus.c
sys/arch/mvmeppc/include/atomic.h
sys/arch/mvmeppc/mvmeppc/cpu.c
sys/arch/mvmeppc/mvmeppc/mainbus.c
sys/arch/netwinder/pci/pcib.c
sys/arch/next68k/dev/intio.c
sys/arch/next68k/next68k/mainbus.c
sys/arch/ofppc/include/atomic.h
sys/arch/ofppc/include/intr.h
sys/arch/ofppc/ofppc/cpu.c
sys/arch/ofppc/ofppc/mainbus.c
sys/arch/pmax/ibus/mcclock_ibus.c
sys/arch/pmax/ibus/pm.c
sys/arch/pmax/ibus/sii.c
sys/arch/pmax/ibus/sii_ds.c
sys/arch/pmax/ibus/siivar.h
sys/arch/pmax/pmax/clock.c
sys/arch/pmax/tc/dt.c
sys/arch/pmax/tc/dtkbd.c
sys/arch/pmax/tc/dtms.c
sys/arch/pmax/tc/dtvar.h
sys/arch/pmax/tc/ioasic.c
sys/arch/pmax/tc/mcclock_ioasic.c
sys/arch/pmax/tc/tcbus.c
sys/arch/powerpc/booke/booke_machdep.c
sys/arch/powerpc/booke/booke_pmap.c
sys/arch/powerpc/booke/booke_stubs.c
sys/arch/powerpc/booke/e500_intr.c
sys/arch/powerpc/booke/e500_mpsubr.S
sys/arch/powerpc/booke/e500_tlb.c
sys/arch/powerpc/booke/genassym.cf
sys/arch/powerpc/booke/pci/pq3pci.c
sys/arch/powerpc/booke/spe.c
sys/arch/powerpc/booke/trap.c
sys/arch/powerpc/booke/trap_subr.S
sys/arch/powerpc/conf/Makefile.powerpc
sys/arch/powerpc/conf/files.powerpc
sys/arch/powerpc/ibm4xx/cpu.c
sys/arch/powerpc/ibm4xx/dev/plb.c
sys/arch/powerpc/ibm4xx/genassym.cf
sys/arch/powerpc/ibm4xx/pci/pchb.c
sys/arch/powerpc/ibm4xx/trap.c
sys/arch/powerpc/ibm4xx/trap_subr.S
sys/arch/powerpc/include/Makefile
sys/arch/powerpc/include/asm.h
sys/arch/powerpc/include/atomic.h
sys/arch/powerpc/include/booke/cpuvar.h
sys/arch/powerpc/include/booke/e500reg.h
sys/arch/powerpc/include/booke/e500var.h
sys/arch/powerpc/include/booke/etsecreg.h
sys/arch/powerpc/include/booke/intr.h
sys/arch/powerpc/include/booke/pmap.h
sys/arch/powerpc/include/booke/spr.h
sys/arch/powerpc/include/booke/vmparam.h
sys/arch/powerpc/include/bus.h
sys/arch/powerpc/include/cpu.h
sys/arch/powerpc/include/cpuset.h
sys/arch/powerpc/include/proc.h
sys/arch/powerpc/include/types.h
sys/arch/powerpc/oea/altivec.c
sys/arch/powerpc/oea/cpu_subr.c
sys/arch/powerpc/oea/genassym.cf
sys/arch/powerpc/pci/pchb.c
sys/arch/powerpc/pic/files.pic
sys/arch/powerpc/pic/intr.c
sys/arch/powerpc/pic/ipi.c
sys/arch/powerpc/pic/ipi_openpic.c
sys/arch/powerpc/pic/ipivar.h
sys/arch/powerpc/pic/openpic_common.c
sys/arch/powerpc/pic/pic_distopenpic.c
sys/arch/powerpc/powerpc/bus_dma.c
sys/arch/powerpc/powerpc/fpu.c
sys/arch/powerpc/powerpc/kobj_machdep.c
sys/arch/powerpc/powerpc/lock_stubs.S
sys/arch/powerpc/powerpc/locore_subr.S
sys/arch/powerpc/powerpc/ofwreal.S
sys/arch/powerpc/powerpc/powerpc_machdep.c
sys/arch/powerpc/powerpc/trap.c
sys/arch/powerpc/powerpc/trap_subr.S
sys/arch/powerpc/powerpc/vm_machdep.c
sys/arch/prep/include/atomic.h
sys/arch/prep/isa/isabeep.c
sys/arch/prep/isa/paud_isa.c
sys/arch/prep/pci/pceb.c
sys/arch/prep/prep/cpu.c
sys/arch/prep/prep/mainbus.c
sys/arch/rs6000/include/atomic.h
sys/arch/rs6000/rs6000/cpu.c
sys/arch/rs6000/rs6000/mainbus.c
sys/arch/sandpoint/include/atomic.h
sys/arch/sandpoint/sandpoint/eumb.c
sys/arch/sandpoint/sandpoint/mainbus.c
sys/arch/sandpoint/stand/altboot/README.altboot
sys/arch/sandpoint/stand/altboot/dsk.c
sys/arch/sgimips/hpc/pi1ppc.c
sys/arch/sgimips/hpc/pi1ppcvar.h
sys/arch/shark/ofw/cpu_ofbus.c
sys/arch/shark/ofw/ofisapc.c
sys/arch/shark/ofw/ofisascr.c
sys/arch/shark/shark/shark_machdep.c
sys/arch/sparc/dev/audioamd.c
sys/arch/sparc/dev/if_ie_obio.c
sys/arch/sparc/sparc/machdep.c
sys/arch/sparc/stand/ofwboot/boot.h
sys/arch/sparc/stand/ofwboot/md5.h
sys/arch/sparc/stand/ofwboot/ofdev.c
sys/arch/sparc64/conf/files.sparc64
sys/arch/sparc64/dev/auxio.c
sys/arch/sparc64/dev/com_ebus.c
sys/arch/sparc64/dev/cons.h
sys/arch/sparc64/dev/ebus.c
sys/arch/sparc64/dev/ebus_mainbus.c
sys/arch/sparc64/dev/ebusvar.h
sys/arch/sparc64/dev/fdc.c
sys/arch/sparc64/dev/ffb.c
sys/arch/sparc64/dev/ffb_mainbus.c
sys/arch/sparc64/dev/ffbvar.h
sys/arch/sparc64/dev/pcons.c
sys/arch/sparc64/dev/pld_wdog.c
sys/arch/sparc64/dev/power.c
sys/arch/sparc64/dev/psm.c
sys/arch/sparc64/dev/psycho.c
sys/arch/sparc64/dev/psychovar.h
sys/arch/sparc64/dev/pyro.c
sys/arch/sparc64/dev/pyrovar.h
sys/arch/sparc64/dev/sab.c
sys/arch/sparc64/dev/schizo.c
sys/arch/sparc64/dev/schizovar.h
sys/arch/sparc64/dev/upa.c
sys/arch/sparc64/sparc64/autoconf.c
sys/arch/sparc64/sparc64/cache.c
sys/arch/sparc64/sparc64/cache.h
sys/arch/sparc64/sparc64/clock.c
sys/arch/sparc64/sparc64/ipifuncs.c
sys/arch/sparc64/sparc64/machdep.c
sys/arch/sparc64/sparc64/pmap.c
sys/arch/sun2/dev/if_ie_mbmem.c
sys/arch/sun2/dev/if_ie_obio.c
sys/arch/sun2/include/pmap.h
sys/arch/sun2/sun2/pmap.c
sys/arch/sun3/include/pmap3.h
sys/arch/sun3/include/pmap3x.h
sys/arch/sun3/sun3/pmap.c
sys/arch/sun3/sun3x/pmap.c
sys/arch/vax/include/cpu.h
sys/arch/vax/include/nexus.h
sys/arch/vax/include/types.h
sys/arch/vax/uba/uba_ubi.c
sys/arch/vax/vax/ka6400.c
sys/arch/vax/vax/ka730.c
sys/arch/vax/vax/ka820.c
sys/arch/vax/vax/ka88.c
sys/arch/vax/vax/multicpu.c
sys/arch/vax/vax/ubi.c
sys/arch/vax/vsa/tc_vsbus.c
sys/arch/x86/acpi/acpi_cpu_md.c
sys/arch/x86/conf/files.x86
sys/arch/x86/include/cpu.h
sys/arch/x86/pci/ichlpcib.c
sys/arch/x86/x86/x86_machdep.c
sys/arch/x86/x86/x86_userconf.c
sys/arch/xen/include/i386/hypercalls.h
sys/arch/xen/xen/xbdback_xenbus.c
sys/arch/xen/xenbus/xenbus_xs.c
sys/common/pmap/tlb/pmap.c
sys/common/pmap/tlb/pmap.h
sys/common/pmap/tlb/pmap_tlb.c
sys/compat/common/compat_sigaltstack.h
sys/compat/linux/arch/alpha/files.linux_alpha
sys/compat/linux/arch/alpha/linux_machdep.c
sys/compat/linux/arch/arm/linux_commons.c
sys/compat/linux/arch/i386/linux_commons.c
sys/compat/linux/arch/powerpc/linux_syscall.h
sys/compat/linux/arch/powerpc/linux_syscallargs.h
sys/compat/linux/arch/powerpc/linux_syscalls.c
sys/compat/linux/arch/powerpc/linux_sysent.c
sys/compat/linux/arch/powerpc/syscalls.master
sys/compat/linux/common/linux_sched.c
sys/compat/netbsd32/netbsd32_fs.c
sys/compat/netbsd32/netbsd32_netbsd.c
sys/ddb/db_xxx.c
sys/dev/acpi/acpi.c
sys/dev/acpi/acpi_acad.c
sys/dev/acpi/acpi_cpu_pstate.c
sys/dev/acpi/acpi_cpu_tstate.c
sys/dev/acpi/acpi_pmtr.c
sys/dev/acpi/acpi_tz.c
sys/dev/acpi/thinkpad_acpi.c
sys/dev/acpi/wss_acpi.c
sys/dev/acpi/ym_acpi.c
sys/dev/dec/mcclock.c
sys/dev/dec/mcclockvar.h
sys/dev/dm/dm_target_stripe.c
sys/dev/ebus/cs4231_ebus.c
sys/dev/gpio/gpio.c
sys/dev/hpc/hpckbd.c
sys/dev/ic/ad1848var.h
sys/dev/ic/am7930var.h
sys/dev/ic/cs4231.c
sys/dev/ic/cs4231var.h
sys/dev/ic/i82586.c
sys/dev/ic/i82586var.h
sys/dev/ic/vga.c
sys/dev/isa/ad1848_isa.c
sys/dev/isa/if_ai.c
sys/dev/isa/if_ef.c
sys/dev/isa/if_ix.c
sys/dev/isa/wss.c
sys/dev/isa/wss_isa.c
sys/dev/isa/ym.c
sys/dev/isapnp/wss_isapnp.c
sys/dev/isapnp/ym_isapnp.c
sys/dev/mca/if_elmc_mca.c
sys/dev/mca/mca.c
sys/dev/mii/brgphy.c
sys/dev/mii/miidevs
sys/dev/mii/miidevs.h
sys/dev/mii/miidevs_data.h
sys/dev/mvme/if_ie_mvme.c
sys/dev/ofisa/ofisa.c
sys/dev/ofw/ofbus.c
sys/dev/pci/arcmsr.c
sys/dev/pci/gcscaudio.c
sys/dev/pci/if_bge.c
sys/dev/pci/machfb.c
sys/dev/pci/pci_subr.c
sys/dev/pci/pcidevs
sys/dev/pci/pcidevs.h
sys/dev/pci/pcidevs_data.h
sys/dev/pci/pcireg.h
sys/dev/podulebus/if_ei.c
sys/dev/sbus/cs4231_sbus.c
sys/dev/spi/spi.c
sys/dev/spi/spivar.h
sys/dev/sysmon/swsensor.c
sys/dev/sysmon/sysmon_envsys.c
sys/dev/sysmon/sysmon_envsys_events.c
sys/dev/sysmon/sysmon_envsysvar.h
sys/dev/sysmon/sysmonvar.h
sys/dev/tc/bba.c
sys/dev/tc/ioasic_subr.c
sys/dev/tc/ioasicvar.h
sys/dev/tc/tc.c
sys/dev/tc/tcvar.h
sys/dev/usb/ehci.c
sys/dev/usb/files.usb
sys/dev/usb/if_cdce.c
sys/dev/usb/ohci.c
sys/dev/usb/udl.c
sys/dev/usb/uhci.c
sys/dev/usb/uhub.c
sys/dev/usb/usb.c
sys/dev/usb/usb_mem.c
sys/dev/usb/usb_subr.c
sys/dev/usb/usbdevs
sys/dev/usb/usbdevs.h
sys/dev/usb/usbdevs_data.h
sys/dev/usb/usbdi.c
sys/dev/vme/if_ie_vme.c
sys/dev/wscons/wsconsio.h
sys/dev/wsfb/genfb.c
sys/dev/wsfb/genfbvar.h
sys/external/bsd/drm/dist/bsd-core/drmP.h
sys/fs/filecorefs/filecore_vfsops.c
sys/fs/smbfs/smbfs_subr.c
sys/kern/init_main.c
sys/kern/kern_exec.c
sys/kern/kern_exit.c
sys/kern/kern_ktrace.c
sys/kern/kern_lwp.c
sys/kern/kern_mutex_obj.c
sys/kern/kern_pmf.c
sys/kern/kern_resource.c
sys/kern/kern_stub.c
sys/kern/makesyscalls.sh
sys/kern/subr_autoconf.c
sys/kern/subr_exec_fd.c
sys/kern/subr_pcu.c
sys/kern/subr_userconf.c
sys/kern/vfs_mount.c
sys/kern/vfs_syscalls.c
sys/modules/padlock/Makefile
sys/net/bpf.c
sys/net/pfkeyv2.h
sys/netinet/tcp_usrreq.c
sys/netinet/tcp_vtw.c
sys/netinet/tcp_vtw.h
sys/netinet6/ip6_input.c
sys/netipsec/ipsec.c
sys/netipsec/ipsec.h
sys/netipsec/ipsec6.h
sys/netipsec/ipsec_output.c
sys/netipsec/key.c
sys/netipsec/key.h
sys/netipsec/xform_ipip.c
sys/opencrypto/crypto.c
sys/opencrypto/cryptodev.c
sys/opencrypto/cryptodev.h
sys/opencrypto/cryptosoft.c
sys/opencrypto/cryptosoft_xform.c
sys/opencrypto/gmac.c
sys/opencrypto/gmac.h
sys/rump/dev/lib/libusb/opt/opt_usb.h
sys/sys/filedesc.h
sys/sys/kernhist.h
sys/sys/ktrace.h
sys/sys/pcu.h
sys/sys/quota.h
sys/sys/resourcevar.h
sys/sys/userconf.h
sys/sys/vfs_syscalls.h
sys/ufs/ffs/ffs_quota2.c
sys/ufs/ufs/quota1_subr.c
sys/ufs/ufs/quota2.h
sys/ufs/ufs/quota2_subr.c
sys/ufs/ufs/ufs_quota2.c
sys/uvm/uvm_page.c
--- a/sys/arch/acorn26/acorn26/fpu.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/acorn26/fpu.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.11.4.1 2011/03/05 20:49:03 rmind Exp $	*/
+/*	$NetBSD: fpu.c,v 1.11.4.2 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 Ben Harris
@@ -32,7 +32,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.11.4.1 2011/03/05 20:49:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.11.4.2 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/device.h>
 #include <sys/proc.h>
@@ -46,8 +46,8 @@
 
 #include "opt_fputypes.h"
 
-static int fpu_match(struct device *, struct cfdata *, void *);
-static void fpu_attach(struct device *, struct device *, void *);
+static int fpu_match(device_t, cfdata_t, void *);
+static void fpu_attach(device_t, device_t, void *);
 static register_t fpu_identify(void);
 
 CFATTACH_DECL(fpu, sizeof(struct fpu_softc),
@@ -56,17 +56,17 @@
 struct fpu_softc *the_fpu;
 
 static int
-fpu_match(struct device *parent, struct cfdata *cf, void *aux)
+fpu_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return the_fpu == NULL && fpu_identify() != 0;
 }
 
 static void
-fpu_attach(struct device *parent, struct device *self, void *aux)
+fpu_attach(device_t parent, device_t self, void *aux)
 {
 	int supported;
-	struct fpu_softc *sc = (void *)self;
+	struct fpu_softc *sc = device_private(self);
 
 	the_fpu = sc;
 	printf(": ");
--- a/sys/arch/acorn26/ioc/arckbd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/ioc/arckbd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arckbd.c,v 1.18 2009/02/16 21:36:09 bjh21 Exp $ */
+/* $NetBSD: arckbd.c,v 1.18.4.1 2011/06/12 00:23:50 rmind Exp $ */
 /*-
  * Copyright (c) 1998, 1999, 2000 Ben Harris
  * All rights reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.18 2009/02/16 21:36:09 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.18.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -124,8 +124,8 @@
 	enum arckbd_state	sc_state;
 	u_char			sc_byteone;
 	u_char			sc_kbid;
-	struct device		*sc_wskbddev;
-	struct device		*sc_wsmousedev;
+	device_t		sc_wskbddev;
+	device_t		sc_wsmousedev;
 	struct wskbd_mapdata	sc_mapdata;
 	int			sc_cmdqueue;  /* Single-command queue */
 	enum arckbd_state	sc_statequeue;
--- a/sys/arch/acorn26/ioc/ioeb.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/ioc/ioeb.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ioeb.c,v 1.5 2002/10/02 03:25:47 thorpej Exp $ */
+/* $NetBSD: ioeb.c,v 1.5.134.1 2011/06/12 00:23:50 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000 Ben Harris
@@ -29,7 +29,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: ioeb.c,v 1.5 2002/10/02 03:25:47 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioeb.c,v 1.5.134.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/device.h>
 #include <sys/systm.h>
@@ -46,19 +46,19 @@
 	bus_space_handle_t sc_ioh;
 };
 
-static int ioeb_match(struct device *, struct cfdata *, void *);
-static void ioeb_attach(struct device *, struct device *, void *);
+static int ioeb_match(device_t, cfdata_t, void *);
+static void ioeb_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ioeb, sizeof(struct ioeb_softc),
     ioeb_match, ioeb_attach, NULL, NULL);
 
-struct device *the_ioeb;
+device_t the_ioeb;
 
 /* IOEB is only four bits wide */
 #define ioeb_read(t, h, o) (bus_space_read_1(t, h, o) & 0xf)
 
 static int
-ioeb_match(struct device *parent, struct cfdata *cf, void *aux)
+ioeb_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct ioc_attach_args *ioc = aux;
 	int id;
@@ -72,9 +72,9 @@
 }
 
 static void
-ioeb_attach(struct device *parent, struct device *self, void *aux)
+ioeb_attach(device_t parent, device_t self, void *aux)
 {
-	struct ioeb_softc *sc = (void *)self;
+	struct ioeb_softc *sc = device_private(self);
 	struct ioc_attach_args *ioc = aux;
 
 	if (the_ioeb == NULL)
@@ -87,7 +87,7 @@
 void
 ioeb_irq_clear(int mask)
 {
-	struct ioeb_softc *sc = (void *)the_ioeb;
+	struct ioeb_softc *sc = device_private(the_ioeb);
 
 	/* The IOEB only controls interrupt 0 */
 	if (mask & IOEB_IRQ_CLEARABLE_MASK)
--- a/sys/arch/acorn26/ioc/ioebvar.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/ioc/ioebvar.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ioebvar.h,v 1.2 2002/03/24 23:37:44 bjh21 Exp $ */
+/* $NetBSD: ioebvar.h,v 1.2.142.1 2011/06/12 00:23:50 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000 Ben Harris
@@ -34,5 +34,5 @@
 
 extern void ioeb_irq_clear(int mask);
 
-extern struct device *the_ioeb;
+extern device_t the_ioeb;
 #endif
--- a/sys/arch/acorn26/ioc/latches.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/ioc/latches.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: latches.c,v 1.5 2009/01/07 00:09:24 bjh21 Exp $ */
+/* $NetBSD: latches.c,v 1.5.6.1 2011/06/12 00:23:50 rmind Exp $ */
 
 /*-
  * Copyright (c) 2001 Ben Harris
@@ -29,7 +29,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: latches.c,v 1.5 2009/01/07 00:09:24 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: latches.c,v 1.5.6.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/device.h>
 #include <sys/systm.h>
@@ -101,7 +101,7 @@
 void
 latcha_update(u_int8_t mask, u_int8_t value)
 {
-	struct latches_softc *sc = (void *)the_latches;
+	struct latches_softc *sc = device_private(the_latches);
 
 	sc->sc_latcha = (sc->sc_latcha & ~mask) | value;
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, LATCH_A, sc->sc_latcha);
@@ -110,7 +110,7 @@
 void
 latchb_update(u_int8_t mask, u_int8_t value)
 {
-	struct latches_softc *sc = (void *)the_latches;
+	struct latches_softc *sc = device_private(the_latches);
 
 	sc->sc_latchb = (sc->sc_latchb & ~mask) | value;
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, LATCH_B, sc->sc_latcha);
--- a/sys/arch/acorn26/ioc/ssn.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn26/ioc/ssn.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssn.c,v 1.8 2005/12/11 12:16:04 christos Exp $	*/
+/*	$NetBSD: ssn.c,v 1.8.100.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2002 Ben Harris
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ssn.c,v 1.8 2005/12/11 12:16:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssn.c,v 1.8.100.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -44,12 +44,12 @@
 struct ssn_softc {
 	struct device sc_dev;
 	struct ds_handle sc_dsh;
-	struct device *sc_ioc;
+	device_t sc_ioc;
 	int sc_timebase;
 };
 
-static int ssn_match(struct device *, struct cfdata *, void *);
-static void ssn_attach(struct device *, struct device *, void *);
+static int ssn_match(device_t, cfdata_t, void *);
+static void ssn_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(ssn, sizeof(struct ssn_softc),
     ssn_match, ssn_attach, NULL, NULL);
@@ -61,16 +61,16 @@
 static int ds_crc(const u_int8_t *data, size_t len);
 
 static int
-ssn_match(struct device *parent, struct cfdata *cf, void *aux)
+ssn_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	return (1);
 }
 
 static void
-ssn_attach(struct device *parent, struct device *self, void *aux)
+ssn_attach(device_t parent, device_t self, void *aux)
 {
-	struct ssn_softc *sc = (void *)self;
+	struct ssn_softc *sc = device_private(self);
 	int i;
 	u_int8_t rombuf[8];
 
--- a/sys/arch/acorn32/acorn32/autoconf.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/acorn32/autoconf.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.16 2009/05/12 06:56:59 cegger Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.16 2009/05/12 06:56:59 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include "opt_md.h"
 
@@ -185,7 +185,7 @@
 }
 
 void
-device_register(struct device *dev, void *aux)
+device_register(device_t dev, void *aux)
 {
 }
 /* End of autoconf.c */
--- a/sys/arch/acorn32/conf/EB7500ATX	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/conf/EB7500ATX	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: EB7500ATX,v 1.39.4.3 2011/04/21 01:40:44 rmind Exp $
+#	$NetBSD: EB7500ATX,v 1.39.4.4 2011/06/12 00:23:50 rmind Exp $
 #
 #	EB7500ATX --- NetBSD/acorn32 complete configuration
 #
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"EB7500ATX-$Revision: 1.39.4.3 $"
+#ident		"EB7500ATX-$Revision: 1.39.4.4 $"
 
 # estimated number of users
 maxusers	32
@@ -144,7 +144,7 @@
 options 	USERCONF	# userconf(4) support
 #options	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
 #options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
-options		SYMTAB_SPACE=262144
+options		SYMTAB_SPACE=275000
 
 # Enable experimental buffer queue strategy for better responsiveness under 
 # high disk I/O load. Use it with caution - it's not proven to be stable yet.
--- a/sys/arch/acorn32/eb7500atx/rsbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/eb7500atx/rsbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rsbus.c,v 1.7 2009/10/21 16:16:24 rmind Exp $ */
+/* $NetBSD: rsbus.c,v 1.7.4.1 2011/06/12 00:23:50 rmind Exp $ */
 
 /*
  * Copyright (c) 2002
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: rsbus.c,v 1.7 2009/10/21 16:16:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rsbus.c,v 1.7.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -45,25 +45,25 @@
 
 /* Declare prototypes */
 
-static int	rsbus_match(struct device *, struct cfdata *, void *);
-static void	rsbus_attach(struct device *, struct device *, void *);
+static int	rsbus_match(device_t, cfdata_t, void *);
+static void	rsbus_attach(device_t, device_t, void *);
 static int	rsbus_print(void *, const char *);
-static int	rsbus_search(struct device *, struct cfdata *,
+static int	rsbus_search(device_t, cfdata_t,
 			     const int *, void *);
 
 CFATTACH_DECL(rsbus, sizeof(struct rsbus_softc),
     rsbus_match, rsbus_attach, NULL, NULL);
  
 static int
-rsbus_match(struct device *parent, struct cfdata *cf, void *aux)
+rsbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	return(1);
 }
 
 static void
-rsbus_attach(struct device *parent, struct device *self, void *aux)
+rsbus_attach(device_t parent, device_t self, void *aux)
 {
-	struct rsbus_softc *sc = (void *) self;
+	struct rsbus_softc *sc = device_private(self);
 	sc->sc_iot = &rsbus_bs_tag;
 
 	printf("\n");
@@ -75,9 +75,9 @@
 }
 
 static int
-rsbus_search(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+rsbus_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct rsbus_softc *sc = (struct rsbus_softc *)parent;
+	struct rsbus_softc *sc = device_private(parent);
 	struct rsbus_attach_args sa;
 
 	sa.sa_iot = sc->sc_iot;
@@ -94,7 +94,7 @@
 static int
 rsbus_print(void *aux, const char *name)
 {
-        struct rsbus_attach_args *sa = (struct rsbus_attach_args*)aux;
+        struct rsbus_attach_args *sa = aux;
 
 	if (sa->sa_size)
 		aprint_normal(" addr 0x%lx", sa->sa_addr);
@@ -105,4 +105,3 @@
 
 	return (UNCONF);
 }
-
--- a/sys/arch/acorn32/include/podulebus_machdep.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/include/podulebus_machdep.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: podulebus_machdep.h,v 1.2 2009/03/14 14:45:51 dsl Exp $ */
+/* $NetBSD: podulebus_machdep.h,v 1.2.4.1 2011/06/12 00:23:50 rmind Exp $ */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -161,8 +161,8 @@
     bus_space_tag_t *);
 
 /* Used internally by the podulebus code */
-extern void netslotscan(struct device *);
-extern void poduleexamine(podule_t *, struct device *, int);
+extern void netslotscan(device_t);
+extern void poduleexamine(podule_t *, device_t, int);
 
 #endif
 
--- a/sys/arch/acorn32/mainbus/com_pioc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/mainbus/com_pioc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_pioc.c,v 1.14 2008/04/28 20:23:09 martin Exp $	*/
+/*	$NetBSD: com_pioc.c,v 1.14.22.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: com_pioc.c,v 1.14 2008/04/28 20:23:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_pioc.c,v 1.14.22.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/systm.h>
 #include <sys/tty.h>
@@ -103,7 +103,7 @@
 extern bus_space_tag_t comconstag;	/* From pioc.c */
 
 /*
- * int com_pioc_probe(struct device *parent, struct cfdata *cf, void *aux)
+ * int com_pioc_probe(device_t parent, cfdata_t cf, void *aux)
  *
  * Make sure we are trying to attach a com device and then
  * probe for one.
@@ -141,7 +141,7 @@
 }
 
 /*
- * void com_pioc_attach(struct device *parent, struct device *self, void *aux)
+ * void com_pioc_attach(device_t parent, device_t self, void *aux)
  *
  * attach the com device
  */
--- a/sys/arch/acorn32/mainbus/fd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/mainbus/fd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.47.2.1 2011/03/05 20:49:06 rmind Exp $	*/
+/*	$NetBSD: fd.c,v 1.47.2.2 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.47.2.1 2011/03/05 20:49:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.47.2.2 2011/06/12 00:23:50 rmind Exp $");
 
 #include "opt_ddb.h"
 
@@ -174,9 +174,9 @@
 };
 
 /* 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),
     fdcprobe, fdcattach, NULL, NULL);
@@ -249,8 +249,8 @@
 };
 
 /* 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 *);
 
 extern char floppy_read_fiq[], floppy_read_fiq_end[];
 extern char floppy_write_fiq[], floppy_write_fiq_end[];
@@ -289,7 +289,7 @@
 int fdcresult(struct fdc_softc *fdc);
 int out_fdc(bus_space_tag_t iot, bus_space_handle_t ioh, u_char x);
 void fdcstart(struct fdc_softc *fdc);
-void fdcstatus(struct device *dv, int n, const char *s);
+void fdcstatus(device_t dv, int n, const char *s);
 void fdctimeout(void *arg);
 void fdcpseudointr(void *arg);
 int fdcintr(void *);
@@ -299,7 +299,7 @@
 int fdformat(dev_t, struct ne7_fd_formb *, struct lwp *);
 
 int
-fdcprobe(struct device *parent, struct cfdata *cf, void *aux)
+fdcprobe(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pioc_attach_args *pa = aux;
 	bus_space_tag_t iot;
@@ -361,9 +361,9 @@
 }
 
 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);
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
 	struct pioc_attach_args *pa = aux;
@@ -388,10 +388,10 @@
 	callout_init(&fdc->sc_timo_ch, 0); 
 	callout_init(&fdc->sc_intr_ch, 0);
 
-	fdc->sc_ih = intr_claim(pa->pa_irq, IPL_BIO, "fdc",
-	    fdcintr, fdc);
+	fdc->sc_ih = intr_claim(pa->pa_irq, IPL_BIO, "fdc", fdcintr, fdc);
 	if (!fdc->sc_ih)
-		panic("%s: Cannot claim IRQ %d", self->dv_xname, pa->pa_irq);
+		panic("%s: Cannot claim IRQ %d",
+		    device_xname(self), pa->pa_irq);
 
 #if 0
 	/*
@@ -417,9 +417,9 @@
 }
 
 int
-fdprobe(struct device *parent, struct cfdata *cf, 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;
 	bus_space_tag_t iot = fdc->sc_iot;
@@ -472,10 +472,10 @@
  * 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;
@@ -840,7 +840,7 @@
 }
 
 void
-fdcstatus(struct device *dv, int n, const char *s)
+fdcstatus(device_t dv, int n, const char *s)
 {
 	struct fdc_softc *fdc = (void *) device_parent(dv);
 
@@ -1028,7 +1028,8 @@
 		    fdc->sc_fr.fh_r12, (u_int)bp->b_data, fd->sc_skip);
 #endif
 		if (fiq_claim(&fdc->sc_fh) == -1)
-			panic("%s: Cannot claim FIQ vector", fdc->sc_dev.dv_xname);
+			panic("%s: Cannot claim FIQ vector",
+			    device_xname(&fdc->sc_dev));
 		IOMD_WRITE_BYTE(IOMD_FIQMSK, 0x01);
 		bus_space_write_2(iot, ioh, fdctl, type->rate);
 #ifdef FD_DEBUG
--- a/sys/arch/acorn32/mainbus/lpt_pioc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/mainbus/lpt_pioc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: lpt_pioc.c,v 1.10 2008/04/13 01:14:26 chris Exp $	*/
+/*	$NetBSD: lpt_pioc.c,v 1.10.26.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe
@@ -36,7 +36,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: lpt_pioc.c,v 1.10 2008/04/13 01:14:26 chris Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lpt_pioc.c,v 1.10.26.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -152,7 +152,7 @@
 }
 
 /*
- * int lpt_pioc_probe(struct device *parent, struct cfdata *cf, void *aux)
+ * int lpt_pioc_probe(device_t parent, cfdata_t cf, void *aux)
  *
  * Make sure we are trying to attach a lpt device and then
  * probe for one.
@@ -181,7 +181,7 @@
 }
 
 /*
- * void lpt_pioc_attach(struct device *parent, struct device *self, void *aux)
+ * void lpt_pioc_attach(device_t parent, device_t self, void *aux)
  *
  * attach the lpt device
  */
--- a/sys/arch/acorn32/mainbus/pioc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/mainbus/pioc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pioc.c,v 1.15 2009/05/12 07:07:44 cegger Exp $	*/     
+/*	$NetBSD: pioc.c,v 1.15.4.1 2011/06/12 00:23:50 rmind Exp $	*/     
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -41,7 +41,7 @@
 /*#define PIOC_DEBUG*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pioc.c,v 1.15 2009/05/12 07:07:44 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pioc.c,v 1.15.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -91,13 +91,13 @@
 
 /* Prototypes for functions */
 
-static int  piocmatch(struct device *, struct cfdata *, void *);
-static void piocattach(struct device *, struct device *, void *);
+static int  piocmatch(device_t, cfdata_t, void *);
+static void piocattach(device_t, device_t, void *);
 static int  piocprint(void *aux, const char *name);
 #if 0
-static int  piocsearch(struct device *, struct cfdata *, void *);
+static int  piocsearch(device_t, cfdata_t, void *);
 #endif
-static int  piocsubmatch(struct device *, struct cfdata *,
+static int  piocsubmatch(device_t, cfdata_t,
 			      const int *, void *);
 static void piocgetid(bus_space_tag_t iot, bus_space_handle_t ioh,
 			      int config_entry, int *id, int *revision);
@@ -132,7 +132,7 @@
 }
 
 /*
- * int piocmatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int piocmatch(device_t parent, cfdata_t cf, void *aux)
  *
  * Put the controller into config mode and probe the ID to see if
  * we recognise it.
@@ -141,7 +141,7 @@
  */ 
  
 static int
-piocmatch(struct device *parent, struct cfdata *cf, void *aux)
+piocmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *mb = aux;
 	bus_space_tag_t iot;
@@ -203,7 +203,7 @@
 
 #if 0
 /*
- * int piocsearch(struct device *parent, struct cfdata *cf, void *aux)
+ * int piocsearch(device_t parent, cfdata_t cf, void *aux)
  *
  * search function used to probe and attach the child devices.
  *
@@ -212,9 +212,9 @@
  */
 
 static int
-piocsearch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+piocsearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
-	struct pioc_softc *sc = (struct pioc_softc *)parent;
+	struct pioc_softc *sc = device_private(parent);
 	struct pioc_attach_args pa;
 	int tryagain;
 
@@ -245,7 +245,7 @@
 #endif
 
 /*
- * int piocsubmatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int piocsubmatch(device_t parent, cfdata_t cf, void *aux)
  *
  * search function used to probe and attach the child devices.
  *
@@ -254,7 +254,7 @@
  */
 
 static int
-piocsubmatch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+piocsubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct pioc_attach_args *pa = aux;
 	int tryagain;
@@ -277,17 +277,17 @@
 }
 
 /*
- * void piocattach(struct device *parent, struct device *dev, void *aux)
+ * void piocattach(device_t parent, device_t dev, void *aux)
  *
  * Identify the PIOC and read the config registers into the softc.
  * Search and configure all children
  */
   
 static void
-piocattach(struct device *parent, struct device *self, void *aux)
+piocattach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args *mb = aux;
-	struct pioc_softc *sc = (struct pioc_softc *)self;
+	struct pioc_softc *sc = device_private(self);
 	bus_space_tag_t iot;
 	bus_space_handle_t ioh;
 	int id, rev;
--- a/sys/arch/acorn32/mainbus/wdc_pioc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/mainbus/wdc_pioc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc_pioc.c,v 1.23 2008/03/18 23:52:16 cube Exp $	*/
+/*	$NetBSD: wdc_pioc.c,v 1.23.26.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*
  * Copyright (c) 1997-1998 Mark Brinicombe.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.23 2008/03/18 23:52:16 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pioc.c,v 1.23.26.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -74,7 +74,7 @@
     wdc_pioc_probe, wdc_pioc_attach, NULL, NULL);
 
 /*
- * int wdc_pioc_probe(struct device *parent, struct cfdata *cf, void *aux)
+ * int wdc_pioc_probe(device_t parent, cfdata_t cf, void *aux)
  *
  * Make sure we are trying to attach a wdc device and then
  * probe for one.
@@ -137,7 +137,7 @@
 }
 
 /*
- * void wdc_pioc_attach(struct device *parent, struct device *self, void *aux)
+ * void wdc_pioc_attach(device_t parent, device_t self, void *aux)
  *
  * attach the wdc device
  */
--- a/sys/arch/acorn32/podulebus/amps.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/amps.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: amps.c,v 1.17 2009/11/27 03:23:03 rmind Exp $	*/
+/*	$NetBSD: amps.c,v 1.17.4.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amps.c,v 1.17 2009/11/27 03:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amps.c,v 1.17.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,8 +85,8 @@
 	bus_space_tag_t		sc_iot;			/* Bus tag */
 };
 
-int	amps_probe(struct device *, struct cfdata *, void *);
-void	amps_attach(struct device *, struct device *, void *);
+int	amps_probe(device_t, cfdata_t, void *);
+void	amps_attach(device_t, device_t, void *);
 
 CFATTACH_DECL(amps, sizeof(struct amps_softc),
     amps_probe, amps_attach, NULL, NULL);
@@ -130,9 +130,9 @@
  */
 
 int
-amps_probe(struct device *parent, struct cfdata *cf, void *aux)
+amps_probe(device_t parent, cfdata_t cf, void *aux)
 {
-	struct podule_attach_args *pa = (void *)aux;
+	struct podule_attach_args *pa = aux;
 
 	return (pa->pa_product == PODULE_ATOMWIDE_SERIAL);
 }
@@ -145,10 +145,10 @@
  */
 
 void
-amps_attach(struct device *parent, struct device *self, void *aux)
+amps_attach(device_t parent, device_t self, void *aux)
 {
-	struct amps_softc *sc = (void *)self;
-	struct podule_attach_args *pa = (void *)aux;
+	struct amps_softc *sc = device_private(self);
+	struct podule_attach_args *pa = aux;
 	struct amps_attach_args aa;
 
 	/* Note the podule number and validate */
--- a/sys/arch/acorn32/podulebus/asc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/asc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: asc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $	*/
+/*	$NetBSD: asc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*
  * Copyright (c) 2001 Richard Earnshaw
@@ -98,7 +98,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -126,8 +126,8 @@
 #include <acorn32/podulebus/ascreg.h>
 #include <acorn32/podulebus/ascvar.h>
 
-void ascattach		(struct device *, struct device *, void *);
-int  ascmatch		(struct device *, struct cfdata *, void *);
+void ascattach		(device_t, device_t, void *);
+int  ascmatch		(device_t, cfdata_t, void *);
 
 void asc_enintr		(struct sbic_softc *);
 
@@ -160,7 +160,7 @@
 #endif
 
 int
-ascmatch(struct device *pdp, struct cfdata *cf, void *auxp)
+ascmatch(device_t pdp, cfdata_t cf, void *auxp)
 {
 	struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
 
@@ -181,7 +181,7 @@
 }
 
 void
-ascattach(struct device *pdp, struct device *dp, void *auxp)
+ascattach(device_t pdp, device_t dp, void *auxp)
 {
 	/* volatile struct sdmac *rp;*/
 	struct asc_softc *sc;
--- a/sys/arch/acorn32/podulebus/cosc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/cosc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cosc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $	*/
+/*	$NetBSD: cosc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cosc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cosc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -65,8 +65,8 @@
 #include <acorn32/podulebus/coscvar.h>
 #include <dev/podulebus/podules.h>
 
-void coscattach(struct device *, struct device *, void *);
-int coscmatch(struct device *, struct cfdata *, void *);
+void coscattach(device_t, device_t, void *);
+int coscmatch(device_t, cfdata_t, void *);
 
 CFATTACH_DECL(cosc, sizeof(struct cosc_softc),
     coscmatch, coscattach, NULL, NULL);
@@ -86,9 +86,9 @@
 #endif
 
 int
-coscmatch(struct device *pdp, struct cfdata *cf, void *auxp)
+coscmatch(device_t parent, cfdata_t cf, void *aux)
 {
-	struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
+	struct podule_attach_args *pa = aux;
 
 	/* Look for the card */
 
@@ -106,15 +106,13 @@
 static int dummy[6];
 
 void
-coscattach(struct device *pdp, struct device *dp, void *auxp)
+coscattach(device_t parent, device_t self, void *aux)
 {
-	struct cosc_softc *sc = (struct cosc_softc *)dp;
-	struct podule_attach_args *pa;
+	struct cosc_softc *sc = device_private(self);
+	struct podule_attach_args *pa = aux;
 	cosc_regmap_p	   rp = &sc->sc_regmap;
 	vu_char		  *esc;
 
-	pa = (struct podule_attach_args *)auxp;
-
 	if (pa->pa_podule_number == -1)
 		panic("Podule has disappeared !");
 
@@ -236,7 +234,7 @@
 	sc->sc_softc.sc_bump_sz = PAGE_SIZE;
 	sc->sc_softc.sc_bump_pa = 0x0;
 
-	escinitialize((struct esc_softc *)sc);
+	escinitialize(&sc->sc_softc);
 
 	sc->sc_softc.sc_adapter.adapt_dev = &sc->sc_softc.sc_dev;
 	sc->sc_softc.sc_adapter.adapt_nchannels = 1;
@@ -271,18 +269,18 @@
 #endif
 	{
 		evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
-		    device_xname(dp), "intr");
+		    device_xname(self), "intr");
 		sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO,
 		    cosc_intr, sc, &sc->sc_intrcnt);
 		if (sc->sc_ih == NULL)
 			panic("%s: Cannot install IRQ handler",
-			    dp->dv_xname);
+			    device_xname(self));
 	}
 
 	printf("\n");
 
 	/* attach all scsi units on us */
-	config_found(dp, &sc->sc_softc.sc_channel, scsiprint);
+	config_found(self, &sc->sc_softc.sc_channel, scsiprint);
 }
 
 
--- a/sys/arch/acorn32/podulebus/csc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/csc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: csc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $	*/
+/*	$NetBSD: csc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: csc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: csc.c,v 1.16.4.1 2011/06/12 00:23:50 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -57,8 +57,8 @@
 #include <dev/podulebus/podules.h>
 #include <dev/podulebus/powerromreg.h>
 
-int  cscmatch(struct device *, struct cfdata *, void *);
-void cscattach(struct device *, struct device *, void *);
+int  cscmatch(device_t, cfdata_t, void *);
+void cscattach(device_t, device_t, void *);
 
 CFATTACH_DECL(csc, sizeof(struct csc_softc),
     cscmatch, cscattach, NULL, NULL);
@@ -77,7 +77,7 @@
  * if we are a Cumana SCSI-2 card
  */
 int
-cscmatch(struct device *pdp, struct cfdata *cf, void *auxp)
+cscmatch(device_t pdp, cfdata_t cf, void *auxp)
 {
 	struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
 
@@ -95,7 +95,7 @@
 }
 
 void
-cscattach(struct device *pdp, struct device *dp, void *auxp)
+cscattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct csc_softc *sc = (struct csc_softc *)dp;
 	struct podule_attach_args  *pa;
--- a/sys/arch/acorn32/podulebus/if_ie.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/if_ie.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.28.4.1 2010/05/30 05:16:34 rmind Exp $ */
+/* $NetBSD: if_ie.c,v 1.28.4.2 2011/06/12 00:23:51 rmind Exp $ */
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.28.4.1 2010/05/30 05:16:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.28.4.2 2011/06/12 00:23:51 rmind Exp $");
 
 #define IGNORE_ETHER1_IDROM_CHECKSUM
 
@@ -173,8 +173,8 @@
 			      struct ie_sys_ctl_block *pscb,
 			      void *pcmd, int ocmd, int scmd, int mask );
 
-int ieprobe(struct device *, struct cfdata *, void *);
-void ieattach(struct device *, struct device *, void *);
+int ieprobe(device_t, cfdata_t, void *);
+void ieattach(device_t, device_t, void *);
 
 static inline void ie_cli(struct ie_softc *);
 static inline void ieattn(struct ie_softc *);
@@ -292,9 +292,9 @@
  */
 
 int
-ieprobe(struct device *parent, struct cfdata *cf, void *aux)
+ieprobe(device_t parent, cfdata_t cf, void *aux)
 {
-	struct podule_attach_args *pa = (void *)aux;
+	struct podule_attach_args *pa = aux;
 
 /* Look for a network slot interface */
 
@@ -305,10 +305,10 @@
  * Attach our driver to the interfaces it uses
  */
   
-void ieattach ( struct device *parent, struct device *self, void *aux )
+void ieattach ( device_t parent, device_t self, void *aux )
 {
-	struct ie_softc *sc = (void *)self;
-	struct podule_attach_args *pa = (void *)aux;
+	struct ie_softc *sc = device_private(self);
+	struct podule_attach_args *pa = aux;
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	int i;
 	char idrom[32];
--- a/sys/arch/acorn32/podulebus/netslot.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/netslot.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: netslot.c,v 1.8 2009/03/14 15:35:59 dsl Exp $	*/
+/*	$NetBSD: netslot.c,v 1.8.4.1 2011/06/12 00:23:51 rmind Exp $	*/
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -35,7 +35,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(1, "$NetBSD: netslot.c,v 1.8 2009/03/14 15:35:59 dsl Exp $");
+__KERNEL_RCSID(1, "$NetBSD: netslot.c,v 1.8.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -73,7 +73,7 @@
 }
 
 void
-netslotscan(struct device *dev)
+netslotscan(device_t dev)
 {
 	podule_t *podule;
 	volatile u_char *address;
--- a/sys/arch/acorn32/podulebus/podulebus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/podulebus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: podulebus.c,v 1.25 2009/05/12 06:54:10 cegger Exp $ */
+/* $NetBSD: podulebus.c,v 1.25.4.1 2011/06/12 00:23:51 rmind Exp $ */
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -43,7 +43,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.25 2009/05/12 06:54:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: podulebus.c,v 1.25.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -73,23 +73,22 @@
 /* Declare prototypes */
 
 u_int poduleread(u_int, int);
-int podulebusmatch(struct device *, struct cfdata *, void *);
-void podulebusattach(struct device *, struct device *, void *);
+int podulebusmatch(device_t, cfdata_t, void *);
+void podulebusattach(device_t, device_t, void *);
 int podulebusprint(void *, const char *);
-int podulebussubmatch(struct device *, struct cfdata *,
-		      const int *, void *);
+int podulebussubmatch(device_t, cfdata_t, const int *, void *);
 void podulechunkdirectory(podule_t *);
-void podulescan(struct device *);
+void podulescan(device_t);
 
 /*
- * int podulebusmatch(struct device *parent, void *match, void *aux)
+ * int podulebusmatch(device_t parent, void *match, void *aux)
  *
  * Probe for the podule bus. Currently all this does is return 1 to
  * indicate that the podule bus was found.
  */
  
 int
-podulebusmatch(struct device *parent, struct cfdata *cf, void *aux)
+podulebusmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	switch (IOMD_ID) {
 	case RPC600_IOMD_ID:
@@ -123,7 +122,7 @@
 
 
 int
-podulebussubmatch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+podulebussubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct podule_attach_args *pa = aux;
 
@@ -226,7 +225,7 @@
 
 
 void
-poduleexamine(podule_t *podule, struct device *dev, int slottype)
+poduleexamine(podule_t *podule, device_t dev, int slottype)
 {
 	struct manufacturer_description *man_desc;
 	struct podule_description *pod_desc;
@@ -300,7 +299,7 @@
 }
 
 void
-podulescan(struct device *dev)
+podulescan(device_t dev)
 {
 	int loop;
 	podule_t *podule;
@@ -391,7 +390,7 @@
 
 
 /*
- * void podulebusattach(struct device *parent, struct device *dev, void *aux)
+ * void podulebusattach(device_t parent, device_t dev, void *aux)
  *
  * Attach podulebus.
  * This probes all the podules and sets up the podules array with
@@ -401,7 +400,7 @@
  */
   
 void
-podulebusattach(struct device *parent, struct device *self, void *aux)
+podulebusattach(device_t parent, device_t self, void *aux)
 {
 	int loop;
 	struct podule_attach_args pa;
@@ -511,7 +510,7 @@
 }
 
 
-CFATTACH_DECL(podulebus, sizeof(struct device),
+CFATTACH_DECL_NEW(podulebus, 0,
 	podulebusmatch, podulebusattach, NULL, NULL);
 
 /* Useful functions that drivers may share */
--- a/sys/arch/acorn32/podulebus/ptsc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/acorn32/podulebus/ptsc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptsc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $	*/
+/*	$NetBSD: ptsc.c,v 1.16.4.1 2011/06/12 00:23:51 rmind Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ptsc.c,v 1.16 2009/05/12 06:54:10 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptsc.c,v 1.16.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,8 +98,8 @@
 #include <dev/podulebus/podules.h>
 #include <dev/podulebus/powerromreg.h>
 
-int  ptscmatch(struct device *, struct cfdata *, void *);
-void ptscattach(struct device *, struct device *, void *);
+int  ptscmatch(device_t, cfdata_t, void *);
+void ptscattach(device_t, device_t, void *);
 
 CFATTACH_DECL(ptsc, sizeof(struct ptsc_softc),
     ptscmatch, ptscattach, NULL, NULL);
@@ -118,9 +118,9 @@
  * if we are a Power-tec SCSI-2 card
  */
 int
-ptscmatch(struct device *pdp, struct cfdata *cf, void *auxp)
+ptscmatch(device_t parent, cfdata_t cf, void *aux)
 {
-	struct podule_attach_args *pa = (struct podule_attach_args *)auxp;
+	struct podule_attach_args *pa = aux;
 
 	/* Look for the card */
 
@@ -138,15 +138,13 @@
 }
 
 void
-ptscattach(struct device *pdp, struct device *dp, void *auxp)
+ptscattach(device_t parent, device_t self, void *aux)
 {
-	struct ptsc_softc *sc = (struct ptsc_softc *)dp;
-	struct podule_attach_args  *pa;
+	struct ptsc_softc *sc = device_private(self);
+	struct podule_attach_args  *pa = aux;
 	ptsc_regmap_p	   rp = &sc->sc_regmap;
 	vu_char		  *fas;
 
-	pa = (struct podule_attach_args *)auxp;
-
 	if (pa->pa_podule_number == -1)
 		panic("Podule has disappeared !");
 
@@ -225,11 +223,11 @@
 
 #if PTSC_POLL == 0
 	evcnt_attach_dynamic(&sc->sc_softc.sc_intrcnt, EVCNT_TYPE_INTR, NULL,
-	    device_xname(dp), "intr");
+	    device_xname(self), "intr");
 	sc->sc_softc.sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO,
 	    ptsc_intr, &sc->sc_softc, &sc->sc_softc.sc_intrcnt);
 	if (sc->sc_softc.sc_ih == NULL)
-	    panic("%s: Cannot install IRQ handler", dp->dv_xname);
+	    panic("%s: Cannot install IRQ handler", device_xname(self));
 #else
 	printf(" polling");
 	sc->sc_softc.sc_adapter.adapt_flags = SCSIPI_ADAPT_POLL_ONLY;
@@ -238,7 +236,7 @@
 	printf("\n");
 
 	/* attach all scsi units on us */
-	config_found(dp, &sc->sc_softc.sc_channel, scsiprint);
+	config_found(self, &sc->sc_softc.sc_channel, scsiprint);
 }
 
 
--- a/sys/arch/algor/dev/mainbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/algor/dev/mainbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.20.22.1 2011/03/05 20:49:08 rmind Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.20.22.2 2011/06/12 00:23:51 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20.22.1 2011/03/05 20:49:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20.22.2 2011/06/12 00:23:51 rmind Exp $");
 
 #include "opt_algor_p4032.h"
 #include "opt_algor_p5064.h"
@@ -63,14 +63,14 @@
 #include "locators.h"
 #include "pci.h"
 
-int	mainbus_match(struct device *, struct cfdata *, void *);
-void	mainbus_attach(struct device *, struct device *, void *);
+int	mainbus_match(device_t, cfdata_t, void *);
+void	mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 int	mainbus_print(void *, const char *);
-int	mainbus_submatch(struct device *, struct cfdata *,
+int	mainbus_submatch(device_t, cfdata_t,
 			 const int *, void *);
 
 /* There can be only one. */
@@ -125,7 +125,7 @@
 #endif /* ALGOR_P6032 */
 
 int
-mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (mainbus_found)
@@ -135,7 +135,7 @@
 }
 
 void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct mainbus_attach_args ma;
 	struct mainbusdev *md;
@@ -247,7 +247,7 @@
 }
 
 int
-mainbus_submatch(struct device *parent, struct cfdata *cf,
+mainbus_submatch(device_t parent, cfdata_t cf,
 		 const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
--- a/sys/arch/alpha/alpha/compat_13_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/compat_13_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_13_machdep.c,v 1.18 2009/11/21 05:35:40 rmind Exp $ */
+/* $NetBSD: compat_13_machdep.c,v 1.18.4.1 2011/06/12 00:23:51 rmind 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: compat_13_machdep.c,v 1.18 2009/11/21 05:35:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.18.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -94,8 +94,7 @@
 
 	/* XXX ksc.sc_ownedfp ? */
 	pcb = lwp_getpcb(l);
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 0);
+	fpu_discard();
 	memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs,
 	    sizeof(struct fpreg));
 	/* XXX ksc.sc_fp_control ? */
--- a/sys/arch/alpha/alpha/compat_16_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/compat_16_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_16_machdep.c,v 1.16 2009/11/21 05:35:40 rmind Exp $ */
+/* $NetBSD: compat_16_machdep.c,v 1.16.4.1 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -86,7 +86,7 @@
 #include <machine/cpu.h>
 #include <machine/reg.h>
 
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.16 2009/11/21 05:35:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.16.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 
 #ifdef DEBUG
@@ -132,9 +132,8 @@
 	frame.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp();
 
  	/* save the floating-point state, if necessary, then copy it. */
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 1);
-	frame.sf_sc.sc_ownedfp = l->l_md.md_flags & MDP_FPUSED;
+	fpu_save();
+	frame.sf_sc.sc_ownedfp = fpu_used_p(l);
 	memcpy((struct fpreg *)frame.sf_sc.sc_fpregs, &pcb->pcb_fp,
 	    sizeof(struct fpreg));
 	frame.sf_sc.sc_fp_control = alpha_read_fp_c(l);
@@ -281,14 +280,13 @@
 	regtoframe((struct reg *)ksc.sc_regs, l->l_md.md_tf);
 	alpha_pal_wrusp(ksc.sc_regs[R_SP]);
 
-	/* XXX ksc.sc_ownedfp ? */
 	pcb = lwp_getpcb(l);
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 0);
+	fpu_discard();
 	memcpy(&pcb->pcb_fp, (struct fpreg *)ksc.sc_fpregs,
 	    sizeof(struct fpreg));
 	pcb->pcb_fp.fpr_cr = ksc.sc_fpcr;
-	l->l_md.md_flags = ksc.sc_fp_control & MDP_FP_C;
+	l->l_md.md_flags = (ksc.sc_fp_control & MDLWP_FP_C)
+	    | (ksc.sc_ownedfp ? MDLWP_FPUSED : 0);
 
 	mutex_enter(p->p_lock);
 	/* Restore signal stack. */
--- a/sys/arch/alpha/alpha/core_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/core_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: core_machdep.c,v 1.3.4.1 2011/03/05 20:49:09 rmind Exp $ */
+/* $NetBSD: core_machdep.c,v 1.3.4.2 2011/06/12 00:23:51 rmind 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: core_machdep.c,v 1.3.4.1 2011/03/05 20:49:09 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.3.4.2 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,10 +68,9 @@
 
 	cpustate.md_tf = *l->l_md.md_tf;
 	cpustate.md_tf.tf_regs[FRAME_SP] = alpha_pal_rdusp();	/* XXX */
-	if (l->l_md.md_flags & MDP_FPUSED) {
+	if (fpu_used_p(l)) {
 		struct pcb *pcb = lwp_getpcb(l);
-		if (pcb->pcb_fpcpu != NULL)
-			fpusave_proc(l, 1);
+		fpu_save();
 		cpustate.md_fpstate = pcb->pcb_fp;
 	} else
 		memset(&cpustate.md_fpstate, 0, sizeof(cpustate.md_fpstate));
--- a/sys/arch/alpha/alpha/cpu.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/cpu.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.88 2009/11/26 00:19:11 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.88.4.1 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.88 2009/11/26 00:19:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.88.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -660,16 +660,15 @@
 	struct cpu_info *ci;
 	CPU_INFO_ITERATOR cii;
 
-	db_printf("addr		dev	id	flags	ipis	curproc		fpcurproc\n");
+	db_printf("addr		dev	id	flags	ipis	curproc\n");
 	for (CPU_INFO_FOREACH(cii, ci)) {
-		db_printf("%p	%s	%lu	%lx	%lx	%p	%p\n",
+		db_printf("%p	%s	%lu	%lx	%lx	%p\n",
 		    ci,
 		    ci->ci_softc->sc_dev.dv_xname,
 		    ci->ci_cpuid,
 		    ci->ci_flags,
 		    ci->ci_ipis,
-		    ci->ci_curlwp,
-		    ci->ci_fpcurlwp);
+		    ci->ci_curlwp);
 	}
 }
 
--- a/sys/arch/alpha/alpha/fp_complete.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/fp_complete.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.12 2008/05/10 15:31:04 martin Exp $ */
+/* $NetBSD: fp_complete.c,v 1.12.20.1 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -35,13 +35,15 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.12 2008/05/10 15:31:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.12.20.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include "opt_compat_osf1.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+#include <sys/atomic.h>
+#include <sys/evcnt.h>
 
 #ifdef COMPAT_OSF1
 #include <compat/osf1/osf1_exec.h>
@@ -99,6 +101,9 @@
 
 #define	CRBLIT(sw, hw, m, offs) (((sw) & ~(m)) | ((hw) >> (offs) & (m)))
 
+struct evcnt fpevent_use;
+struct evcnt fpevent_reuse;
+
 /*
  * Temporary trap shadow instrumentation. The [un]resolved counters
  * could be kept permanently, as they provide information on whether
@@ -398,12 +403,13 @@
 {
 	u_int64_t md_flags;
 
-	fp_c &= MDP_FP_C;
+	fp_c &= MDLWP_FP_C;
 	md_flags = l->l_md.md_flags;
-	if ((md_flags & MDP_FP_C) == fp_c)
+	if ((md_flags & MDLWP_FP_C) == fp_c)
 		return;
-	l->l_md.md_flags = (md_flags & ~MDP_FP_C) | fp_c;
-	alpha_enable_fp(l, 1);
+	l->l_md.md_flags = (md_flags & ~MDLWP_FP_C) | fp_c;
+	fpu_load();
+	alpha_pal_wrfen(1);
 	fp_c_to_fpcr(l);
 	alpha_pal_wrfen(0);
 }
@@ -417,7 +423,7 @@
 	 * but in a transparent way. Some of the code for that would need to
 	 * go right here.
 	 */
-	return l->l_md.md_flags & MDP_FP_C;
+	return l->l_md.md_flags & MDLWP_FP_C;
 }
 
 static float64
@@ -579,7 +585,8 @@
 		this_cannot_happen(6, -1);
 		return SIGSEGV;
 	}
-	alpha_enable_fp(l, 1);
+	fpu_load();
+	alpha_pal_wrfen(1);
 	/*
 	 * If necessary, lie about the dynamic rounding mode so emulation
 	 * software need go to only one place for it, and so we don't have to
@@ -707,3 +714,55 @@
 	}
 	return 0;
 }
+
+/*
+ * Load the float-point context for the current lwp.
+ */
+void
+fpu_state_load(struct lwp *l, bool used)
+{
+	struct pcb * const pcb = lwp_getpcb(l);
+
+	/*
+	 * Instrument FP usage -- if a process had not previously
+	 * used FP, mark it as having used FP for the first time,
+	 * and count this event.
+	 *
+	 * If a process has used FP, count a "used FP, and took
+	 * a trap to use it again" event.
+	 */
+	if (!fpu_used_p(l)) {
+		atomic_inc_ulong(&fpevent_use.ev_count);
+		fpu_mark_used(l);
+	} else
+		atomic_inc_ulong(&fpevent_reuse.ev_count);
+
+	alpha_pal_wrfen(1);
+	restorefpstate(&pcb->pcb_fp);
+	alpha_pal_wrfen(0);
+
+	l->l_md.md_flags |= MDLWP_FPACTIVE;
+}
+
+/*
+ * Save the FPU state.
+ */
+
+void
+fpu_state_save(struct lwp *l)
+{
+	struct pcb * const pcb = lwp_getpcb(l);
+
+	alpha_pal_wrfen(1);
+	savefpstate(&pcb->pcb_fp);
+	alpha_pal_wrfen(0);
+}
+
+/*
+ * Release the FPU.
+ */
+void
+fpu_state_release(struct lwp *l)
+{
+	l->l_md.md_flags &= ~MDLWP_FPACTIVE;
+}
--- a/sys/arch/alpha/alpha/genassym.cf	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/genassym.cf	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.18.4.1 2011/03/05 20:49:09 rmind Exp $
+# $NetBSD: genassym.cf,v 1.18.4.2 2011/06/12 00:23:51 rmind Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -190,7 +190,6 @@
 
 # CPU info
 define	CPU_INFO_CURLWP		offsetof(struct cpu_info, ci_curlwp)
-define	CPU_INFO_FPCURLWP	offsetof(struct cpu_info, ci_fpcurlwp)
 define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
 define	CPU_INFO_IDLE_LWP	offsetof(struct cpu_info, ci_data.cpu_idlelwp)
 define	CPU_INFO_SIZEOF		sizeof(struct cpu_info)
--- a/sys/arch/alpha/alpha/ipifuncs.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.41.4.1 2010/07/03 01:19:11 rmind Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.41.4.2 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.41.4.1 2010/07/03 01:19:11 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.41.4.2 2011/06/12 00:23:51 rmind Exp $");
 
 /*
  * Interprocessor interrupt handlers.
@@ -47,6 +47,7 @@
 #include <sys/cpu.h>
 #include <sys/intr.h>
 #include <sys/xcall.h>
+#include <sys/bitops.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -62,8 +63,6 @@
 void	alpha_ipi_microset(struct cpu_info *, struct trapframe *);
 void	alpha_ipi_imb(struct cpu_info *, struct trapframe *);
 void	alpha_ipi_ast(struct cpu_info *, struct trapframe *);
-void	alpha_ipi_synch_fpu(struct cpu_info *, struct trapframe *);
-void	alpha_ipi_discard_fpu(struct cpu_info *, struct trapframe *);
 void	alpha_ipi_pause(struct cpu_info *, struct trapframe *);
 void	alpha_ipi_xcall(struct cpu_info *, struct trapframe *);
 
@@ -71,28 +70,24 @@
  * NOTE: This table must be kept in order with the bit definitions
  * in <machine/intr.h>.
  */
-ipifunc_t ipifuncs[ALPHA_NIPIS] = {
-	alpha_ipi_halt,
-	alpha_ipi_microset,
-	pmap_do_tlb_shootdown,
-	alpha_ipi_imb,
-	alpha_ipi_ast,
-	alpha_ipi_synch_fpu,
-	alpha_ipi_discard_fpu,
-	alpha_ipi_pause,
-	alpha_ipi_xcall
+const ipifunc_t ipifuncs[ALPHA_NIPIS] = {
+	[ilog2(ALPHA_IPI_HALT)] =	alpha_ipi_halt,
+	[ilog2(ALPHA_IPI_MICROSET)] =	alpha_ipi_microset,
+	[ilog2(ALPHA_IPI_SHOOTDOWN)] =	pmap_do_tlb_shootdown,
+	[ilog2(ALPHA_IPI_IMB)] =	alpha_ipi_imb,
+	[ilog2(ALPHA_IPI_AST)] =	alpha_ipi_ast,
+	[ilog2(ALPHA_IPI_PAUSE)] =	alpha_ipi_pause,
+	[ilog2(ALPHA_IPI_XCALL)] =	alpha_ipi_xcall
 };
 
-const char *ipinames[ALPHA_NIPIS] = {
-	"halt ipi",
-	"microset ipi",
-	"shootdown ipi",
-	"imb ipi",
-	"ast ipi",
-	"synch fpu ipi",
-	"discard fpu ipi",
-	"pause ipi",
-	"xcall ipi"
+const char * const ipinames[ALPHA_NIPIS] = {
+	[ilog2(ALPHA_IPI_HALT)] =	"halt ipi",
+	[ilog2(ALPHA_IPI_MICROSET)] =	"microset ipi",
+	[ilog2(ALPHA_IPI_SHOOTDOWN)] =	"shootdown ipi",
+	[ilog2(ALPHA_IPI_IMB)] =	"imb ipi",
+	[ilog2(ALPHA_IPI_AST)] =	"ast ipi",
+	[ilog2(ALPHA_IPI_PAUSE)] =	"pause ipi",
+	[ilog2(ALPHA_IPI_XCALL)] =	"xcall ipi"
 };
 
 /*
@@ -269,24 +264,6 @@
 }
 
 void
-alpha_ipi_synch_fpu(struct cpu_info *ci, struct trapframe *framep)
-{
-
-	if (ci->ci_flags & CPUF_FPUSAVE)
-		return;
-	fpusave_cpu(ci, 1);
-}
-
-void
-alpha_ipi_discard_fpu(struct cpu_info *ci, struct trapframe *framep)
-{
-
-	if (ci->ci_flags & CPUF_FPUSAVE)
-		return;
-	fpusave_cpu(ci, 0);
-}
-
-void
 alpha_ipi_pause(struct cpu_info *ci, struct trapframe *framep)
 {
 	u_long cpumask = (1UL << ci->ci_cpuid);
--- a/sys/arch/alpha/alpha/locore.s	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/locore.s	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.119.2.1 2011/03/05 20:49:09 rmind Exp $ */
+/* $NetBSD: locore.s,v 1.119.2.2 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.119.2.1 2011/03/05 20:49:09 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.119.2.2 2011/06/12 00:23:51 rmind Exp $");
 
 #include "assym.h"
 
@@ -275,11 +275,9 @@
 	bne	t3, 7f				/* yes */
 	/* no: headed back to user space */
 
-	/* Enable the FPU based on whether the current proc is fpcurlwp. */
-4:	ldq	t2, CPU_INFO_FPCURLWP(v0)
-	cmpeq	t1, t2, t1
-	mov	zero, a0
-	cmovne	t1, 1, a0
+	/* Enable the FPU based on whether MDLWP_FPACTIVE is set. */
+4:	ldq	t2, L_MD_FLAGS(t1)
+	cmplt	t2, zero, a0
 	call_pal PAL_OSF1_wrfen
 
 	/* restore the registers, and return */
--- a/sys/arch/alpha/alpha/machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.326.2.5 2011/05/31 03:03:52 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.326.2.6 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326.2.5 2011/05/31 03:03:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.326.2.6 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -206,6 +206,17 @@
 void	identifycpu(void);
 void	printregs(struct reg *);
 
+const pcu_ops_t fpu_ops = {
+	.pcu_id = PCU_FPU,
+	.pcu_state_load = fpu_state_load,
+	.pcu_state_save = fpu_state_save,
+	.pcu_state_release = fpu_state_release,
+};
+
+const pcu_ops_t * const pcu_ops_md_defs[PCU_UNIT_COUNT] = {
+	[PCU_FPU] = &fpu_ops,
+};
+
 void
 alpha_init(u_long pfn, u_long ptb, u_long bim, u_long bip, u_long biv)
 	/* pfn:		 first free PFN number */
@@ -658,7 +669,6 @@
 	 */
 	pcb0->pcb_hw.apcb_ksp = v + USPACE - sizeof(struct trapframe);
 	lwp0.l_md.md_tf = (struct trapframe *)pcb0->pcb_hw.apcb_ksp;
-	mutex_init(&pcb0->pcb_fpcpu_lock, MUTEX_DEFAULT, IPL_HIGH);
 
 	/* Indicate that lwp0 has a CPU. */
 	lwp0.l_cpu = ci;
@@ -1632,117 +1642,12 @@
 	tfp->tf_regs[FRAME_A3] = l->l_proc->p_psstrp;	/* a3 = ps_strings */
 	tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC];	/* a.k.a. PV */
 
-	l->l_md.md_flags &= ~MDP_FPUSED;
+	l->l_md.md_flags &= ~MDLWP_FPUSED;
 	if (__predict_true((l->l_md.md_flags & IEEE_INHERIT) == 0)) {
-		l->l_md.md_flags &= ~MDP_FP_C;
+		l->l_md.md_flags &= ~MDLWP_FP_C;
 		pcb->pcb_fp.fpr_cr = FPCR_DYN(FP_RN);
 	}
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 0);
-}
-
-/*
- * Release the FPU.
- */
-void
-fpusave_cpu(struct cpu_info *ci, int save)
-{
-	struct lwp *l;
-	struct pcb *pcb;
-#if defined(MULTIPROCESSOR)
-	int s;
-#endif
-
-	KDASSERT(ci == curcpu());
-
-#if defined(MULTIPROCESSOR)
-	s = splhigh();		/* block IPIs for the duration */
-	atomic_or_ulong(&ci->ci_flags, CPUF_FPUSAVE);
-#endif
-
-	l = ci->ci_fpcurlwp;
-	if (l == NULL)
-		goto out;
-
-	pcb = lwp_getpcb(l);
-	if (save) {
-		alpha_pal_wrfen(1);
-		savefpstate(&pcb->pcb_fp);
-	}
-
-	alpha_pal_wrfen(0);
-
-	FPCPU_LOCK(pcb);
-
-	pcb->pcb_fpcpu = NULL;
-	ci->ci_fpcurlwp = NULL;
-
-	FPCPU_UNLOCK(pcb);
-
- out:
-#if defined(MULTIPROCESSOR)
-	atomic_and_ulong(&ci->ci_flags, ~CPUF_FPUSAVE);
-	splx(s);
-#endif
-	return;
-}
-
-/*
- * Synchronize FP state for this process.
- */
-void
-fpusave_proc(struct lwp *l, int save)
-{
-	struct cpu_info *ci = curcpu();
-	struct cpu_info *oci;
-	struct pcb *pcb;
-#if defined(MULTIPROCESSOR)
-	u_long ipi = save ? ALPHA_IPI_SYNCH_FPU : ALPHA_IPI_DISCARD_FPU;
-	int s, spincount;
-#endif
-
-	pcb = lwp_getpcb(l);
-	KDASSERT(pcb != NULL);
-
-#if defined(MULTIPROCESSOR)
-	s = splhigh();		/* block IPIs for the duration */
-#endif
-	FPCPU_LOCK(pcb);
-
-	oci = pcb->pcb_fpcpu;
-	if (oci == NULL) {
-		FPCPU_UNLOCK(pcb);
-#if defined(MULTIPROCESSOR)
-		splx(s);
-#endif
-		return;
-	}
-
-#if defined(MULTIPROCESSOR)
-	if (oci == ci) {
-		KASSERT(ci->ci_fpcurlwp == l);
-		FPCPU_UNLOCK(pcb);
-		splx(s);
-		fpusave_cpu(ci, save);
-		return;
-	}
-
-	KASSERT(oci->ci_fpcurlwp == l);
-	alpha_send_ipi(oci->ci_cpuid, ipi);
-	FPCPU_UNLOCK(pcb);
-
-	spincount = 0;
-	while (pcb->pcb_fpcpu != NULL) {
-		spincount++;
-		delay(1000);	/* XXX */
-		if (spincount > 10000)
-			panic("fpsave ipi didn't");
-	}
-#else
-	KASSERT(ci->ci_fpcurlwp == l);
-	FPCPU_UNLOCK(pcb);
-	fpusave_cpu(ci, save);
-#endif /* MULTIPROCESSOR */
+	fpu_discard();
 }
 
 /*
@@ -1919,8 +1824,8 @@
 	*flags |= _UC_CPU | _UC_UNIQUE;
 
 	/* Save floating point register context, if any, and copy it. */
-	if (l->l_md.md_flags & MDP_FPUSED) {
-		fpusave_proc(l, 1);
+	if (fpu_used_p(l)) {
+		fpu_save();
 		(void)memcpy(&mcp->__fpregs, &pcb->pcb_fp,
 		    sizeof (mcp->__fpregs));
 		mcp->__fpregs.__fp_fpcr = alpha_read_fp_c(l);
@@ -1956,12 +1861,11 @@
 	/* Restore floating point register context, if any. */
 	if (flags & _UC_FPU) {
 		/* If we have an FP register context, get rid of it. */
-		if (pcb->pcb_fpcpu != NULL)
-			fpusave_proc(l, 0);
+		fpu_discard();
 		(void)memcpy(&pcb->pcb_fp, &mcp->__fpregs,
 		    sizeof (pcb->pcb_fp));
-		l->l_md.md_flags = mcp->__fpregs.__fp_fpcr & MDP_FP_C;
-		l->l_md.md_flags |= MDP_FPUSED;
+		l->l_md.md_flags = mcp->__fpregs.__fp_fpcr & MDLWP_FP_C;
+		fpu_mark_used(l);
 	}
 
 	return (0);
--- a/sys/arch/alpha/alpha/process_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/process_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: process_machdep.c,v 1.25 2009/11/21 05:35:40 rmind Exp $ */
+/* $NetBSD: process_machdep.c,v 1.25.4.1 2011/06/12 00:23:51 rmind Exp $ */
 
 /*
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -54,7 +54,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.25 2009/11/21 05:35:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.25.4.1 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -116,8 +116,7 @@
 {
 	struct pcb *pcb = lwp_getpcb(l);
 
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 1);
+	fpu_save();
 
 	memcpy(regs, &pcb->pcb_fp, sizeof(struct fpreg));
 	return (0);
@@ -128,8 +127,8 @@
 {
 	struct pcb *pcb = lwp_getpcb(l);
 
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 0);
+	fpu_discard();
+	fpu_mark_used(l);
 
 	memcpy(&pcb->pcb_fp, regs, sizeof(struct fpreg));
 	return (0);
--- a/sys/arch/alpha/alpha/trap.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/trap.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.121.4.3 2011/04/21 01:40:46 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.121.4.4 2011/06/12 00:23:51 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121.4.3 2011/04/21 01:40:46 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121.4.4 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -123,9 +123,6 @@
 static int handle_opdec(struct lwp *l, u_long *ucodep);
 static int alpha_ucode_to_ksiginfo(u_long ucode);
 
-struct evcnt fpevent_use;
-struct evcnt fpevent_reuse;
-
 /*
  * Initialize the trap vectors for the current processor.
  */
@@ -360,8 +357,7 @@
 			break;
 
 		case ALPHA_IF_CODE_FEN:
-			alpha_enable_fp(l, 0);
-			alpha_pal_wrfen(0);
+			fpu_load();
 			goto out;
 
 		default:
@@ -563,71 +559,6 @@
 }
 
 /*
- * Set the float-point enable for the current process, and return
- * the FPU context to the named process. If check == 0, it is an
- * error for the named process to already be fpcurlwp.
- */
-void
-alpha_enable_fp(struct lwp *l, int check)
-{
-#if defined(MULTIPROCESSOR)
-	int s;
-#endif
-	struct cpu_info *ci = curcpu();
-	struct pcb *pcb;
-
-	if (check && ci->ci_fpcurlwp == l) {
-		alpha_pal_wrfen(1);
-		return;
-	}
-	if (ci->ci_fpcurlwp == l)
-		panic("trap: fp disabled for fpcurlwp == %p", l);
-
-	if (ci->ci_fpcurlwp != NULL)
-		fpusave_cpu(ci, 1);
-
-	KDASSERT(ci->ci_fpcurlwp == NULL);
-
-	pcb = lwp_getpcb(l);
-#if defined(MULTIPROCESSOR)
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 1);
-#else
-	KDASSERT(pcb->pcb_fpcpu == NULL);
-#endif
-
-#if defined(MULTIPROCESSOR)
-	s = splhigh();		/* block IPIs */
-#endif
-	FPCPU_LOCK(pcb);
-
-	pcb->pcb_fpcpu = ci;
-	ci->ci_fpcurlwp = l;
-
-	FPCPU_UNLOCK(pcb);
-#if defined(MULTIPROCESSOR)
-	splx(s);
-#endif
-
-	/*
-	 * Instrument FP usage -- if a process had not previously
-	 * used FP, mark it as having used FP for the first time,
-	 * and count this event.
-	 *
-	 * If a process has used FP, count a "used FP, and took
-	 * a trap to use it again" event.
-	 */
-	if ((l->l_md.md_flags & MDP_FPUSED) == 0) {
-		atomic_inc_ulong(&fpevent_use.ev_count);
-		l->l_md.md_flags |= MDP_FPUSED;
-	} else
-		atomic_inc_ulong(&fpevent_reuse.ev_count);
-
-	alpha_pal_wrfen(1);
-	restorefpstate(&pcb->pcb_fp);
-}
-
-/*
  * Process an asynchronous software trap.
  * This is relatively easy.
  */
@@ -687,10 +618,6 @@
 #define	frp(l, reg)							\
 	(&pcb->pcb_fp.fpr_regs[(reg)])
 
-#define	dump_fp_regs(pcb)						\
-	if (pcb->pcb_fpcpu != NULL)					\
-		fpusave_proc(l, 1)
-
 #define	unaligned_load(storage, ptrf, mod)				\
 	if (copyin((void *)va, &(storage), sizeof (storage)) != 0)	\
 		break;							\
@@ -714,14 +641,14 @@
 	unaligned_store(storage, irp, )
 
 #define	unaligned_load_floating(storage, mod) do {			\
-	struct pcb *pcb = lwp_getpcb(l);				\
-	dump_fp_regs(pcb);						\
+	struct pcb * const pcb = lwp_getpcb(l);				\
+	fpu_save();							\
 	unaligned_load(storage, frp, mod)				\
 } while (/*CONSTCOND*/0)
 
 #define	unaligned_store_floating(storage, mod) do {			\
-	struct pcb *pcb = lwp_getpcb(l);				\
-	dump_fp_regs(pcb);						\
+	struct pcb * const pcb = lwp_getpcb(l);				\
+	fpu_save();							\
 	unaligned_store(storage, frp, mod)				\
 } while (/*CONSTCOND*/0)
 
--- a/sys/arch/alpha/alpha/vm_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.104.4.2 2011/05/31 03:03:52 rmind Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.104.4.3 2011/06/12 00:23:51 rmind 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: vm_machdep.c,v 1.104.4.2 2011/05/31 03:03:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.104.4.3 2011/06/12 00:23:51 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,12 +50,7 @@
 void
 cpu_lwp_free(struct lwp *l, int proc)
 {
-	struct pcb *pcb = lwp_getpcb(l);
-
-	if (pcb->pcb_fpcpu != NULL)
-		fpusave_proc(l, 0);
-
-	mutex_destroy(&pcb->pcb_fpcpu_lock);
+	(void) l;
 }
 
 void
@@ -93,7 +88,7 @@
 	pcb2 = lwp_getpcb(l2);
 
 	l2->l_md.md_tf = l1->l_md.md_tf;
-	l2->l_md.md_flags = l1->l_md.md_flags & (MDP_FPUSED | MDP_FP_C);
+	l2->l_md.md_flags = l1->l_md.md_flags & (MDLWP_FPUSED | MDLWP_FP_C);
 	l2->l_md.md_astpending = 0;
 
 	/*
@@ -103,15 +98,9 @@
 	l2->l_md.md_pcbpaddr = (void *)vtophys((vaddr_t)pcb2);
 
 	/*
-	 * Copy floating point state from the FP chip to the PCB
-	 * if this process has state stored there.
-	 */
-	if (pcb1->pcb_fpcpu != NULL)
-		fpusave_proc(l1, 1);
-
-	/*
 	 * Copy pcb and user stack pointer from proc p1 to p2.
 	 * If specificed, give the child a different stack.
+	 * Floating point state from the FP chip has already been saved.
 	 */
 	*pcb2 = *pcb1;
 	if (stack != NULL)
@@ -119,8 +108,6 @@
 	else
 		pcb2->pcb_hw.apcb_usp = alpha_pal_rdusp();
 
-	mutex_init(&pcb2->pcb_fpcpu_lock, MUTEX_DEFAULT, IPL_HIGH);
-
 	/*
 	 * Arrange for a non-local goto when the new process
 	 * is started, to resume here, returning nonzero from setjmp.
--- a/sys/arch/alpha/include/alpha.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/include/alpha.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.h,v 1.24.4.2 2011/03/05 20:49:11 rmind Exp $ */
+/* $NetBSD: alpha.h,v 1.24.4.3 2011/06/12 00:23:51 rmind Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -60,6 +60,8 @@
 #include <machine/bus.h>
 #include <machine/stdarg.h>
 
+#include <sys/pcu.h>
+
 struct pcb;
 struct lwp;
 struct reg;
@@ -106,8 +108,29 @@
 void	enable_nsio_ide(bus_space_tag_t);
 char *	dot_conv(unsigned long);
 
-void	fpusave_cpu(struct cpu_info *, int);
-void	fpusave_proc(struct lwp *, int);
+extern const pcu_ops_t fpu_ops;
+
+void    fpu_state_load(struct lwp *, bool);
+void    fpu_state_save(struct lwp *);
+void    fpu_state_release(struct lwp *);
+
+static inline void
+fpu_load(void)
+{
+	pcu_load(&fpu_ops);
+}
+
+static inline void
+fpu_save(void)
+{
+	pcu_save(&fpu_ops);
+}
+
+static inline void
+fpu_discard(void)
+{
+	pcu_discard(&fpu_ops);
+}
 
 void	alpha_patch(bool);
 
@@ -138,7 +161,6 @@
 u_int64_t alpha_read_fp_c(struct lwp *);
 void alpha_write_fp_c(struct lwp *, u_int64_t);
 
-void alpha_enable_fp(struct lwp *, int);
 int alpha_fp_complete(u_long, u_long, struct lwp *, u_int64_t *);
 
 /* Security sensitive rate limiting printf */
--- a/sys/arch/alpha/include/intr.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/include/intr.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.67.4.1 2010/07/03 01:19:11 rmind Exp $ */
+/* $NetBSD: intr.h,v 1.67.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001, 2002 The NetBSD Foundation, Inc.
@@ -162,12 +162,10 @@
 #define	ALPHA_IPI_SHOOTDOWN		(1UL << 2)
 #define	ALPHA_IPI_IMB			(1UL << 3)
 #define	ALPHA_IPI_AST			(1UL << 4)
-#define	ALPHA_IPI_SYNCH_FPU		(1UL << 5)
-#define	ALPHA_IPI_DISCARD_FPU		(1UL << 6)
-#define	ALPHA_IPI_PAUSE			(1UL << 7)
-#define	ALPHA_IPI_XCALL			(1UL << 8)
+#define	ALPHA_IPI_PAUSE			(1UL << 5)
+#define	ALPHA_IPI_XCALL			(1UL << 6)
 
-#define	ALPHA_NIPIS		9	/* must not exceed 64 */
+#define	ALPHA_NIPIS		7	/* must not exceed 64 */
 
 struct cpu_info;
 struct trapframe;
--- a/sys/arch/alpha/include/pcb.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/include/pcb.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.18.32.1 2011/05/31 03:03:53 rmind Exp $ */
+/* $NetBSD: pcb.h,v 1.18.32.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -60,8 +60,6 @@
 	struct fpreg	pcb_fp;			/* FP registers		[SW] */
 	unsigned long	pcb_onfault;		/* for copy faults	[SW] */
 	unsigned long	pcb_accessaddr;		/* for [fs]uswintr	[SW] */
-	struct cpu_info * volatile pcb_fpcpu;	/* CPU with our FP state[SW] */
-	kmutex_t	pcb_fpcpu_lock;		/* lock on fpcpu	[SW] */
 };
 
 #define	FPCPU_LOCK(pcb)		mutex_enter(&(pcb)->pcb_fpcpu_lock)
--- a/sys/arch/alpha/include/proc.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/include/proc.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.18.4.1 2011/03/05 20:49:11 rmind Exp $ */
+/* $NetBSD: proc.h,v 1.18.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -37,31 +37,33 @@
  * Machine-dependent part of the lwp struct for the Alpha.
  */
 struct mdlwp {
-	u_long	md_flags;
-	struct	trapframe *md_tf;	/* trap/syscall registers */
+	u_long md_flags;		/* see below */
+	struct trapframe *md_tf;	/* trap/syscall registers */
 	struct pcb *md_pcbpaddr;	/* phys addr of the pcb */
-	volatile int md_astpending;	/* AST pending for this process */
+	volatile int md_astpending;	/* AST pending for this thread */
 };
+
 /*
  * md_flags usage
  * --------------
- * MDP_FPUSED
+ * MDLWP_FPUSED
  * 	A largely unused bit indicating the presence of FPU history.
  * 	Cleared on exec. Set but not used by the fpu context switcher
  * 	itself.
  * 
- * MDP_FP_C
+ * MDLWP_FP_C
  * 	The architected FP Control word. It should forever begin at bit 1,
  * 	as the bits are AARM specified and this way it doesn't need to be
  * 	shifted.
  * 
  * 	Until C99 there was never an IEEE 754 API, making most of the
  * 	standard useless.  Because of overlapping AARM, OSF/1, NetBSD, and
- * 	C99 API's, the use of the MDP_FP_C bits is defined variously in
+ * 	C99 API's, the use of the MDLWP_FP_C bits is defined variously in
  * 	ieeefp.h and fpu.h.
  */
-#define	MDP_FPUSED	0x00000001	/* Process used the FPU */
-#define	MDP_FP_C	0x007ffffe	/* Extended FP_C Quadword bits */
+#define	MDLWP_FPUSED	0x00000001	/* LWP used the FPU */
+#define	MDLWP_FP_C	0x007ffffe	/* Extended FP_C Quadword bits */
+#define	MDLWP_FPACTIVE	__BIT(63)	/* FPU is active on LWP's PCU CPU */
 
 /*
  * Machine-dependent part of the proc struct for the Alpha.
@@ -72,5 +74,10 @@
 	void	(*md_syscall)(struct lwp *, u_int64_t, struct trapframe *);
 };
 
+#ifdef _KERNEL
+#define	fpu_used_p(l)		(((l)->l_md.md_flags & MDLWP_FPUSED) != 0)
+#define	fpu_mark_used(l)	((void)((l)->l_md.md_flags |= MDLWP_FPUSED))
+#endif
+
 
 #endif /* !_ALPHA_PROC_H_ */
--- a/sys/arch/alpha/include/types.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/include/types.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.42.4.3 2011/04/21 01:40:46 rmind Exp $ */
+/* $NetBSD: types.h,v 1.42.4.4 2011/06/12 00:23:52 rmind Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -86,4 +86,9 @@
 #define	__HAVE_RAS
 #endif
 
+#if defined(_KERNEL) || defined(_KMEMUSER)
+#define	PCU_FPU		0	/* FPU */
+#define	PCU_UNIT_COUNT	1
+#endif
+
 #endif	/* _MACHTYPES_H_ */
--- a/sys/arch/alpha/isa/isa_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/isa/isa_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isa_machdep.c,v 1.18.4.1 2011/03/05 20:49:11 rmind Exp $ */
+/* $NetBSD: isa_machdep.c,v 1.18.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.18.4.1 2011/03/05 20:49:11 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.18.4.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -55,10 +55,10 @@
 #if (NPCPPI > 0)
 #include <dev/isa/pcppivar.h>
 
-int isabeepmatch(struct device *, struct cfdata *, void *);
-void isabeepattach(struct device *, struct device *, void *);
+int isabeepmatch(device_t, cfdata_t, void *);
+void isabeepattach(device_t, device_t, void *);
 
-CFATTACH_DECL(isabeep, sizeof(struct device),
+CFATTACH_DECL_NEW(isabeep, 0,
     isabeepmatch, isabeepattach, NULL, NULL);
 
 static int ppi_attached;
@@ -79,13 +79,13 @@
 
 #if (NPCPPI > 0)
 int
-isabeepmatch(struct device *parent, struct cfdata *match, void *aux)
+isabeepmatch(device_t parent, cfdata_t match, void *aux)
 {
 	return (!ppi_attached);
 }
 
 void
-isabeepattach(struct device *parent, struct device *self, void *aux)
+isabeepattach(device_t parent, device_t self, void *aux)
 {
 	printf("\n");
 
--- a/sys/arch/alpha/pci/ttwoga.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/pci/ttwoga.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttwoga.c,v 1.11.22.1 2011/05/31 03:03:53 rmind Exp $ */
+/* $NetBSD: ttwoga.c,v 1.11.22.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.11.22.1 2011/05/31 03:03:53 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.11.22.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,18 +62,18 @@
 
 #include "locators.h"
 
-int	ttwogamatch(struct device *, struct cfdata *, void *);
-void	ttwogaattach(struct device *, struct device *, void *);
+int	ttwogamatch(device_t, cfdata_t, void *);
+void	ttwogaattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ttwoga, sizeof(struct device),
+CFATTACH_DECL_NEW(ttwoga, 0,
     ttwogamatch, ttwogaattach, NULL, NULL);
 
 int	ttwogaprint(void *, const char *);
 
-int	ttwopcimatch(struct device *, struct cfdata *, void *);
-void	ttwopciattach(struct device *, struct device *, void *);
+int	ttwopcimatch(device_t, cfdata_t, void *);
+void	ttwopciattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ttwopci, sizeof(struct device),
+CFATTACH_DECL_NEW(ttwopci, 0,
     ttwopcimatch, ttwopciattach, NULL, NULL);
 
 int	ttwosableioprint(void *, const char *);
@@ -108,7 +108,7 @@
 #undef MEGABYTE
 
 int
-ttwogamatch(struct device *parent, struct cfdata *match, void *aux)
+ttwogamatch(device_t parent, cfdata_t match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -123,7 +123,7 @@
 }
 
 void
-ttwogaattach(struct device *parent, struct device *self, void *aux)
+ttwogaattach(device_t parent, device_t self, void *aux)
 {
 	struct pcibus_attach_args pba;
 	int hose;
@@ -205,7 +205,7 @@
 }
 
 int
-ttwopcimatch(struct device *parent, struct cfdata *match, void *aux)
+ttwopcimatch(device_t parent, cfdata_t match, void *aux)
 {
 	struct pcibus_attach_args *pba = aux;
 
@@ -217,7 +217,7 @@
 }
 
 void
-ttwopciattach(struct device *parent, struct device *self, void *aux)
+ttwopciattach(device_t parent, device_t self, void *aux)
 {
 	struct pcibus_attach_args *pba = aux, npba;
 	struct ttwoga_config *tcp;
--- a/sys/arch/alpha/tc/ioasic.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/tc/ioasic.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ioasic.c,v 1.42 2009/03/14 21:04:03 dsl Exp $ */
+/* $NetBSD: ioasic.c,v 1.42.4.1 2011/06/12 00:23:52 rmind Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.42 2009/03/14 21:04:03 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.42.4.1 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -79,10 +79,10 @@
 #include <dev/tc/ioasicvar.h>
 
 /* Definition of the driver for autoconfig. */
-int	ioasicmatch(struct device *, struct cfdata *, void *);
-void	ioasicattach(struct device *, struct device *, void *);
+int	ioasicmatch(device_t, cfdata_t, void *);
+void	ioasicattach(device_t, device_t, void *);
 
-CFATTACH_DECL(ioasic, sizeof(struct ioasic_softc),
+CFATTACH_DECL_NEW(ioasic, sizeof(struct ioasic_softc),
     ioasicmatch, ioasicattach, NULL, NULL);
 
 int	ioasic_intr(void *);
@@ -125,7 +125,7 @@
 int ioasicfound;
 
 int
-ioasicmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+ioasicmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct tc_attach_args *ta = aux;
 
@@ -144,9 +144,9 @@
 }
 
 void
-ioasicattach(struct device *parent, struct device *self, void *aux)
+ioasicattach(device_t parent, device_t self, void *aux)
 {
-	struct ioasic_softc *sc = (struct ioasic_softc *)self;
+	struct ioasic_softc *sc = device_private(self);
 	struct tc_attach_args *ta = aux;
 #ifdef DEC_3000_300
 	u_long ssr;
@@ -157,10 +157,11 @@
 
 	ioasicfound = 1;
 
+	sc->sc_dev = self;
 	sc->sc_bst = ta->ta_memt; 
 	if (bus_space_map(ta->ta_memt, ta->ta_addr,
 			0x400000, 0, &sc->sc_bsh)) {
-		printf("%s: unable to map device\n", sc->sc_dv.dv_xname);
+		printf("%s: unable to map device\n", device_xname(self));
 		return;
 	}
 	sc->sc_dmat = ta->ta_dmat;
@@ -199,7 +200,7 @@
 			panic("ioasicattach");
 		sprintf(cp, "slot %lu", i);
 		evcnt_attach_dynamic(&ioasicintrs[i].iai_evcnt,
-		    EVCNT_TYPE_INTR, pevcnt, self->dv_xname, cp);
+		    EVCNT_TYPE_INTR, pevcnt, device_xname(self), cp);
 	}
 	tc_intr_establish(parent, ta->ta_cookie, TC_IPL_NONE, ioasic_intr, sc);
 
--- a/sys/arch/alpha/tc/tcasic.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/tc/tcasic.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcasic.c,v 1.42 2009/03/14 15:36:00 dsl Exp $ */
+/* $NetBSD: tcasic.c,v 1.42.4.1 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.42 2009/03/14 15:36:00 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcasic.c,v 1.42.4.1 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,10 +46,10 @@
 #include <alpha/tc/tc_conf.h>
 
 /* Definition of the driver for autoconfig. */
-int	tcasicmatch(struct device *, struct cfdata *, void *);
-void	tcasicattach(struct device *, struct device *, void *);
+int	tcasicmatch(device_t, cfdata_t, void *);
+void	tcasicattach(device_t, device_t, void *);
 
-CFATTACH_DECL(tcasic, sizeof (struct device),
+CFATTACH_DECL_NEW(tcasic, 0,
     tcasicmatch, tcasicattach, NULL, NULL);
 
 extern struct cfdriver tcasic_cd;
@@ -60,7 +60,7 @@
 int	tcasicfound;
 
 int
-tcasicmatch(struct device *parent, struct cfdata *cfdata, void *aux)
+tcasicmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -79,7 +79,7 @@
 }
 
 void
-tcasicattach(struct device *parent, struct device *self, void *aux)
+tcasicattach(device_t parent, device_t self, void *aux)
 {
 	struct tcbus_attach_args tba;
 	void (*intr_setup)(void);
--- a/sys/arch/alpha/tlsb/tlsb.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/alpha/tlsb/tlsb.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tlsb.c,v 1.34 2009/03/14 15:36:00 dsl Exp $ */
+/* $NetBSD: tlsb.c,v 1.34.4.1 2011/06/12 00:23:52 rmind Exp $ */
 /*
  * Copyright (c) 1997 by Matthew Jacob
  * NASA AMES Research Center.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.34 2009/03/14 15:36:00 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.34.4.1 2011/06/12 00:23:52 rmind Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -62,10 +62,10 @@
 
 #define KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
 
-static int	tlsbmatch(struct device *, struct cfdata *, void *);
-static void	tlsbattach(struct device *, struct device *, void *);
+static int	tlsbmatch(device_t, cfdata_t, void *);
+static void	tlsbattach(device_t, device_t, void *);
 
-CFATTACH_DECL(tlsb, sizeof (struct device),
+CFATTACH_DECL_NEW(tlsb, 0,
     tlsbmatch, tlsbattach, NULL, NULL);
 
 extern struct cfdriver tlsb_cd;
@@ -100,7 +100,7 @@
 }
 
 static int
-tlsbmatch(struct device *parent, struct cfdata *cf, void *aux)
+tlsbmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -120,7 +120,7 @@
 }
 
 static void
-tlsbattach(struct device *parent, struct device *self, void *aux)
+tlsbattach(device_t parent, device_t self, void *aux)
 {
 	struct tlsb_dev_attach_args ta;
 	u_int32_t tldev;
--- a/sys/arch/amd64/conf/Makefile.amd64	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amd64/conf/Makefile.amd64	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.29.4.2 2011/05/31 03:03:53 rmind Exp $
+#	$NetBSD: Makefile.amd64,v 1.29.4.3 2011/06/12 00:23:52 rmind Exp $
 
 # Makefile for NetBSD
 #
@@ -36,7 +36,7 @@
 DEFCOPTS=	-O2
 CPPFLAGS+=	-Damd64 -Dx86_64
 CFLAGS+=	-mcmodel=kernel
-CFLAGS+=	-mno-red-zone
+CFLAGS+=	-mno-red-zone -mno-sse -mno-sse2 -mno-sse3
 
 ##
 ## (3) libkern and compat
@@ -67,6 +67,7 @@
 AFLAGS.mptramp.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 AFLAGS.linux32_sigcode.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 AFLAGS.netbsd32_sigcode.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
+AFLAGS.spl.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":?-Wno-error:}
 
 ##
--- a/sys/arch/amiga/amiga/autoconf.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/amiga/autoconf.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.104.4.2 2011/03/05 20:49:18 rmind Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.104.4.3 2011/06/12 00:23:52 rmind Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.104.4.2 2011/03/05 20:49:18 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.104.4.3 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,9 +51,9 @@
 #endif
 
 static void findroot(void);
-void mbattach(struct device *, struct device *, void *);
+void mbattach(device_t, device_t, void *);
 int mbprint(void *, const char *);
-int mbmatch(struct device *, struct cfdata *, void *);
+int mbmatch(device_t, cfdata_t, void *);
 
 #include <sys/kernel.h>
 
@@ -157,10 +157,10 @@
  * by checking for NULL.
  */
 int
-amiga_config_found(struct cfdata *pcfp, struct device *pdp, void *auxp, cfprint_t pfn)
+amiga_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn)
 {
 	struct device temp;
-	struct cfdata *cf;
+	cfdata_t cf;
 	const struct cfattach *ca;
 
 	if (amiga_realconfig)
@@ -195,7 +195,7 @@
 void
 config_console(void)
 {
-	struct cfdata *cf;
+	cfdata_t cf;
 
 	config_init();
 
@@ -229,11 +229,11 @@
 /*
  * mainbus driver
  */
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mbmatch, mbattach, NULL, NULL);
 
 int
-mbmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+mbmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 #if 0	/*
 	 * XXX is this right? but we need to be found twice
@@ -254,7 +254,7 @@
  * "find" all the things that should be there.
  */
 void
-mbattach(struct device *pdp, struct device *dp, void *auxp)
+mbattach(device_t pdp, device_t dp, void *auxp)
 {
 	printf("\n");
 	config_found(dp, __UNCONST("clock"), simple_devprint);
--- a/sys/arch/amiga/dev/a2kbbc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/a2kbbc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: a2kbbc.c,v 1.21.78.1 2011/03/05 20:49:20 rmind Exp $ */
+/*	$NetBSD: a2kbbc.c,v 1.21.78.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a2kbbc.c,v 1.21.78.1 2011/03/05 20:49:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a2kbbc.c,v 1.21.78.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -55,10 +55,10 @@
 
 #include <dev/clock_subr.h>
 
-int a2kbbc_match(struct device *, struct cfdata *, void *);
-void a2kbbc_attach(struct device *, struct device *, void *);
+int a2kbbc_match(device_t, cfdata_t, void *);
+void a2kbbc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(a2kbbc, sizeof(struct device),
+CFATTACH_DECL_NEW(a2kbbc, 0,
     a2kbbc_match, a2kbbc_attach, NULL, NULL);
 
 void *a2kclockaddr;
@@ -67,7 +67,7 @@
 static struct todr_chip_handle a2ktodr;
 
 int
-a2kbbc_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+a2kbbc_match(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	struct clock_ymdhms dt;
 	static int a2kbbc_matched = 0;
@@ -98,7 +98,7 @@
  * Attach us to the rtc function pointers.
  */
 void
-a2kbbc_attach(struct device *pdp, struct device *dp, void *auxp)
+a2kbbc_attach(device_t pdp, device_t dp, void *auxp)
 {
 	printf("\n");
 	a2kclockaddr = (void *)__UNVOLATILE(ztwomap(0xdc0000));
--- a/sys/arch/amiga/dev/a34kbbc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/a34kbbc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: a34kbbc.c,v 1.20.78.1 2011/03/05 20:49:20 rmind Exp $ */
+/*	$NetBSD: a34kbbc.c,v 1.20.78.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: a34kbbc.c,v 1.20.78.1 2011/03/05 20:49:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a34kbbc.c,v 1.20.78.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -55,10 +55,10 @@
 
 #include <dev/clock_subr.h>
 
-int a34kbbc_match(struct device *, struct cfdata *, void *);
-void a34kbbc_attach(struct device *, struct device *, void *);
+int a34kbbc_match(device_t, cfdata_t, void *);
+void a34kbbc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(a34kbbc, sizeof(struct device),
+CFATTACH_DECL_NEW(a34kbbc, 0,
     a34kbbc_match, a34kbbc_attach, NULL, NULL);
 
 void *a34kclockaddr;
@@ -67,7 +67,7 @@
 static struct todr_chip_handle a34ktodr;
 
 int
-a34kbbc_match(struct device *pdp, struct cfdata *cfp, void *auxp)
+a34kbbc_match(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	struct clock_ymdhms dt;
 	static int a34kbbc_matched = 0;
@@ -94,7 +94,7 @@
  * Attach us to the rtc function pointers.
  */
 void
-a34kbbc_attach(struct device *pdp, struct device *dp, void *auxp)
+a34kbbc_attach(device_t pdp, device_t dp, void *auxp)
 {
 	printf("\n");
 	a34kclockaddr = (void *)__UNVOLATILE(ztwomap(0xdc0000));
--- a/sys/arch/amiga/dev/clock.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/clock.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.51.4.1 2011/03/05 20:49:20 rmind Exp $ */
+/*	$NetBSD: clock.c,v 1.51.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.51.4.1 2011/03/05 20:49:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.51.4.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -79,10 +79,10 @@
  * periods where N is the value loaded into the counter.
  */
 
-int clockmatch(struct device *, struct cfdata *, void *);
-void clockattach(struct device *, struct device *, void *);
+int clockmatch(device_t, cfdata_t, void *);
+void clockattach(device_t, device_t, void *);
 void cpu_initclocks(void);
-static void calibrate_delay(struct device *);
+static void calibrate_delay(device_t);
 
 /* the clocks run at NTSC: 715.909kHz or PAL: 709.379kHz.
    We're using a 100 Hz clock. */
@@ -103,11 +103,11 @@
 	NULL,		/* next */
 };
 
-CFATTACH_DECL(clock, sizeof(struct device),
+CFATTACH_DECL_NEW(clock, 0,
     clockmatch, clockattach, NULL, NULL);
 
 int
-clockmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+clockmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	if (matchname("clock", auxp))
 		return(1);
@@ -118,7 +118,7 @@
  * Start the real-time clock.
  */
 void
-clockattach(struct device *pdp, struct device *dp, void *auxp)
+clockattach(device_t pdp, device_t dp, void *auxp)
 {
 	const char *clockchip;
 	unsigned short interval;
@@ -326,7 +326,7 @@
  * off by 2.4%
  */
 static void
-calibrate_delay(struct device *dp)
+calibrate_delay(device_t dp)
 {
 	unsigned long t1, t2;
 	extern u_int32_t delaydivisor;
--- a/sys/arch/amiga/dev/fd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/fd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.84.4.1 2011/03/05 20:49:21 rmind Exp $ */
+/*	$NetBSD: fd.c,v 1.84.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.84.4.1 2011/03/05 20:49:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.84.4.2 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -144,7 +144,7 @@
  * floppy disk device data
  */
 struct fd_softc {
-	struct device sc_dv;	/* generic device info; must come first */
+	device_t sc_dev;	/* generic device info; must come first */
 	struct disk dkdev;	/* generic disk info */
 	struct bufq_state *bufq;/* queue pending I/O operations */
 	struct buf curbuf;	/* state of current I/O operation */
@@ -189,11 +189,11 @@
 	int unit;
 };
 
-int	fdcmatch(struct device *, struct cfdata *, void *);
-void	fdcattach(struct device *, struct device *, void *);
+int	fdcmatch(device_t, cfdata_t, void *);
+void	fdcattach(device_t, device_t, void *);
 int	fdcprint(void *, const char *);
-int	fdmatch(struct device *, struct cfdata *, void *);
-void	fdattach(struct device *, struct device *, void *);
+int	fdmatch(device_t, cfdata_t, void *);
+void	fdattach(device_t, device_t, void *);
 
 void	fdintr(int);
 void	fdidxintr(void);
@@ -241,7 +241,7 @@
 };
 int nfdtype = __arraycount(fdtype);
 
-CFATTACH_DECL(fd, sizeof(struct fd_softc),
+CFATTACH_DECL_NEW(fd, sizeof(struct fd_softc),
     fdmatch, fdattach, NULL, NULL);
 
 extern struct cfdriver fd_cd;
@@ -264,7 +264,7 @@
 
 struct dkdriver fddkdriver = { fdstrategy };
 
-CFATTACH_DECL(fdc, sizeof(struct device),
+CFATTACH_DECL_NEW(fdc, 0,
     fdcmatch, fdcattach, NULL, NULL);
 
 /*
@@ -325,7 +325,7 @@
 
 
 int
-fdcmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+fdcmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	static int fdc_matched = 0;
 
@@ -342,7 +342,7 @@
 }
 
 void
-fdcattach(struct device *pdp, struct device *dp, void *auxp)
+fdcattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct fdcargs args;
 
@@ -374,7 +374,7 @@
 
 /*ARGSUSED*/
 int
-fdmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+fdmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	struct fdcargs *fdap;
 
@@ -387,7 +387,7 @@
 }
 
 void
-fdattach(struct device *pdp, struct device *dp, void *auxp)
+fdattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct fdcargs *ap;
 	struct fd_softc *sc;
@@ -395,6 +395,7 @@
 
 	ap = auxp;
 	sc = device_private(dp);
+	sc->sc_dev = dp;
 
 	bufq_alloc(&sc->bufq, "disksort", BUFQ_SORT_CYLINDER);
 	callout_init(&sc->calibrate_ch, 0);
@@ -415,7 +416,7 @@
 	/*
 	 * Initialize and attach the disk structure.
 	 */
-	disk_init(&sc->dkdev, sc->sc_dv.dv_xname, &fddkdriver);
+	disk_init(&sc->dkdev, device_xname(sc->sc_dev), &fddkdriver);
 	disk_attach(&sc->dkdev);
 
 	/*
@@ -1467,8 +1468,8 @@
 		 */
 		sc->flags &= ~FDF_DIRTY;
 		if (timeo)
-			printf("%s: write of track cache timed out.\n",
-			    sc->sc_dv.dv_xname);
+			aprint_error_dev(sc->sc_dev,
+			    "write of track cache timed out.\n");
 		if (sc->flags & FDF_JUSTFLUSH) {
 			sc->flags &= ~FDF_JUSTFLUSH;
 			/*
@@ -1496,8 +1497,8 @@
 	else {
 #ifdef FDDEBUG
 		if (timeo)
-			printf("%s: fddmadone: cache load timed out.\n",
-			    sc->sc_dv.dv_xname);
+			aprint_debug_dev(sc->sc_dev,
+			    "fddmadone: cache load timed out.\n");
 #endif
 		if (sc->retried >= sc->retries) {
 			sc->retried = 0;
@@ -1579,7 +1580,7 @@
 
 	biodone(bp);
 nobuf:
-	fdfindwork(device_unit(&sc->sc_dv));
+	fdfindwork(device_unit(sc->sc_dev));
 }
 
 void
@@ -1789,8 +1790,8 @@
 again:
 	if (doagain == 0 || (rp = srp = fdfindsync(srp, erp)) == NULL) {
 #ifdef DIAGNOSTIC
-		printf("%s: corrupted track (%d) data.\n",
-		    sc->sc_dv.dv_xname, sc->cachetrk);
+		aprint_error_dev(sc->sc_dev, "corrupted track (%d) data.\n",
+		    sc->cachetrk);
 #endif
 		return(-1);
 	}
@@ -1812,8 +1813,9 @@
 		}
 		if (((info >> 16) & 0xff) != sc->cachetrk) {
 #ifdef DEBUG
-			printf("%s: incorrect track found: 0x%lx %d\n",
-			    sc->sc_dv.dv_xname, info, sc->cachetrk);
+			aprint_debug_dev(sc->sc_dev,
+			    "incorrect track found: 0x%lx %d\n",
+			    info, sc->cachetrk);
 #endif
 			goto again;
 		}
@@ -1952,8 +1954,9 @@
 			 */
 			if ((rp = (u_short *)fdfindsync((u_long *)rp, (u_long *)erp)) == NULL) {
 #ifdef DIAGNOSTIC
-				printf("%s: corrupted track (%d) data.\n",
-				sc->sc_dv.dv_xname, sc->cachetrk);
+				aprint_normal_dev(sc->sc_dev,
+				    "corrupted track (%d) data.\n",
+				    sc->cachetrk);
 #endif
 				return(-1);
 			}
--- a/sys/arch/amiga/dev/grf.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/grf.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf.c,v 1.52.4.1 2011/03/05 20:49:21 rmind Exp $ */
+/*	$NetBSD: grf.c,v 1.52.4.2 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.52.4.1 2011/03/05 20:49:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.52.4.2 2011/06/12 00:23:52 rmind Exp $");
 
 /*
  * Graphics display driver for the Amiga
@@ -82,15 +82,15 @@
 int grfoff(dev_t);
 int grfsinfo(dev_t, struct grfdyninfo *);
 
-void grfattach(struct device *, struct device *, void *);
-int grfmatch(struct device *, struct cfdata *, void *);
+void grfattach(device_t, device_t, void *);
+int grfmatch(device_t, cfdata_t, void *);
 int grfprint(void *, const char *);
 /*
  * pointers to grf drivers device structs
  */
 struct grf_softc *grfsp[NGRF];
 
-CFATTACH_DECL(grf, sizeof(struct device),
+CFATTACH_DECL_NEW(grf, 0,
     grfmatch, grfattach, NULL, NULL);
 
 dev_type_open(grfopen);
@@ -106,14 +106,14 @@
 /*
  * only used in console init.
  */
-static struct cfdata *cfdata;
+static cfdata_t cfdata;
 
 /*
  * match if the unit of grf matches its perspective
  * low level board driver.
  */
 int
-grfmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+grfmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 
 	if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit)
@@ -128,7 +128,7 @@
  * durring console init.
  */
 void
-grfattach(struct device *pdp, struct device *dp, void *auxp)
+grfattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct grf_softc *gp;
 	int maj;
--- a/sys/arch/amiga/dev/gvpbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/gvpbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: gvpbus.c,v 1.24 2009/10/26 19:16:54 cegger Exp $ */
+/*	$NetBSD: gvpbus.c,v 1.24.4.1 2011/06/12 00:23:52 rmind Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gvpbus.c,v 1.24 2009/10/26 19:16:54 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gvpbus.c,v 1.24.4.1 2011/06/12 00:23:52 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -40,17 +40,17 @@
 #include <amiga/dev/zbusvar.h>
 #include <amiga/dev/gvpbusvar.h>
 
-void gvpbusattach(struct device *, struct device *, void *);
-int gvpbusmatch(struct device *, struct cfdata *, void *);
+void gvpbusattach(device_t, device_t, void *);
+int gvpbusmatch(device_t, cfdata_t, void *);
 int gvpbusprint(void *auxp, const char *);
 
 extern int sbic_no_dma;		/* Kludge for A1291 - mlh */
 
-CFATTACH_DECL(gvpbus, sizeof(struct device),
+CFATTACH_DECL_NEW(gvpbus, 0,
     gvpbusmatch, gvpbusattach, NULL, NULL);
 
 int
-gvpbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+gvpbusmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	struct zbus_args *zap;
 
@@ -69,7 +69,7 @@
 }
 
 void
-gvpbusattach(struct device *pdp, struct device *dp, void *auxp)
+gvpbusattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct zbus_args *zap;
 	struct gvpbus_args ga;
--- a/sys/arch/amiga/dev/kbd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/kbd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.53 2009/12/12 13:10:36 phx Exp $ */
+/*	$NetBSD: kbd.c,v 1.53.4.1 2011/06/12 00:23:53 rmind Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.53 2009/12/12 13:10:36 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.53.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -143,14 +143,14 @@
 
 	int k_console;		/* true if used as console keyboard */
 #if NWSKBD>0
-	struct device *k_wskbddev; /* pointer to wskbd for sending strokes */
+	device_t k_wskbddev; /* pointer to wskbd for sending strokes */
 	int k_pollingmode;         /* polling mode on? whatever it isss... */
 #endif
 };
 struct kbd_softc kbd_softc;
 
-int kbdmatch(struct device *, struct cfdata *, void *);
-void kbdattach(struct device *, struct device *, void *);
+int kbdmatch(device_t, cfdata_t, void *);
+void kbdattach(device_t, device_t, void *);
 void kbdintr(int);
 void kbdstuffchar(u_char);
 
@@ -160,7 +160,7 @@
 int drkbdputc2(u_int8_t, u_int8_t);
 int drkbdwaitfor(int);
 
-CFATTACH_DECL(kbd, sizeof(struct device),
+CFATTACH_DECL_NEW(kbd, 0,
     kbdmatch, kbdattach, NULL, NULL);
 
 dev_type_open(kbdopen);
@@ -177,7 +177,7 @@
 
 /*ARGSUSED*/
 int
-kbdmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+kbdmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 
 	if (matchname((char *)auxp, "kbd"))
@@ -187,7 +187,7 @@
 
 /*ARGSUSED*/
 void
-kbdattach(struct device *pdp, struct device *dp, void *auxp)
+kbdattach(device_t pdp, device_t dp, void *auxp)
 {
 #ifdef DRACO
 	kbdenable();
--- a/sys/arch/amiga/dev/msc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/msc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msc.c,v 1.41.20.2 2011/05/31 03:03:54 rmind Exp $ */
+/*	$NetBSD: msc.c,v 1.41.20.3 2011/06/12 00:23:53 rmind Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -93,7 +93,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.41.20.2 2011/05/31 03:03:54 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msc.c,v 1.41.20.3 2011/06/12 00:23:53 rmind Exp $");
 
 #include "msc.h"
 
@@ -207,13 +207,13 @@
 int mscmctl(dev_t dev, int bits, int howto);
 void mscmint(register void *data);
 
-int mscmatch(struct device *, struct cfdata *, void *);
-void mscattach(struct device *, struct device *, void *);
+int mscmatch(device_t, cfdata_t, void *);
+void mscattach(device_t, device_t, void *);
 
 #define	SWFLAGS(dev)	(msc->openflags | (MSCDIALIN(dev) ? 0 : TIOCFLAG_SOFTCAR))
 #define	DEBUG_CD	0
 
-CFATTACH_DECL(msc, sizeof(struct device),
+CFATTACH_DECL_NEW(msc, 0,
     mscmatch, mscattach, NULL, NULL);
 
 dev_type_open(mscopen);
@@ -231,7 +231,7 @@
 };
 
 int
-mscmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+mscmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 	struct zbus_args *zap;
 
@@ -243,7 +243,7 @@
 }
 
 void
-mscattach(struct device *pdp, struct device *dp, void *auxp)
+mscattach(device_t pdp, device_t dp, void *auxp)
 {
 	volatile struct mscmemory *mscmem;
 	struct mscdevice *msc;
--- a/sys/arch/amiga/dev/toccata.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/toccata.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: toccata.c,v 1.12 2008/04/28 20:23:12 martin Exp $ */
+/* $NetBSD: toccata.c,v 1.12.22.1 2011/06/12 00:23:53 rmind Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.12 2008/04/28 20:23:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.12.22.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -222,14 +222,14 @@
 	void			 *sc_playarg;
 };
 
-int toccata_match(struct device *, struct cfdata *, void *);
-void toccata_attach(struct device *, struct device *, void *);
+int toccata_match(device_t, cfdata_t, void *);
+void toccata_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(toccata, sizeof(struct toccata_softc),
+CFATTACH_DECL_NEW(toccata, sizeof(struct toccata_softc),
     toccata_match, toccata_attach, NULL, NULL);
 
 int
-toccata_match(struct device *parent, struct cfdata *cfp, void *aux)
+toccata_match(device_t parent, cfdata_t cfp, void *aux)
 {
 	struct zbus_args *zap;
 
@@ -245,15 +245,16 @@
 }
 
 void
-toccata_attach(struct device *parent, struct device *self, void *aux)
+toccata_attach(device_t parent, device_t self, void *aux)
 {
 	struct toccata_softc *sc;
 	struct ad1848_softc *asc;
 	struct zbus_args *zap;
 	volatile uint8_t *boardp;
 
-	sc = (struct toccata_softc *)self;
+	sc = device_private(self);
 	asc = &sc->sc_ad;
+	asc->sc_dev = self;
 	zap = aux;
 
 	boardp = (volatile uint8_t *)zap->va;
@@ -280,7 +281,7 @@
 	sc->sc_isr.isr_intr = toccata_intr;
 	add_isr(&sc->sc_isr);
 
-	audio_attach_mi(&audiocs_hw_if, sc, &asc->sc_dev);
+	audio_attach_mi(&audiocs_hw_if, sc, self);
 
 }
 
@@ -329,8 +330,8 @@
 	 * FIFO interrupt.
 	 */
 #ifdef DEBUG
-	printf("%s: got unexpected interrupt %x\n", sc->sc_ad.sc_dev.dv_xname,
-	    status);
+	printf("%s: got unexpected interrupt %x\n",
+	    device_xname(sc->sc_ad.sc_dev), status);
 #endif
 	*sc->sc_boardp = TOCC_ACT;
 	return 1;
--- a/sys/arch/amiga/dev/zbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amiga/dev/zbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbus.c,v 1.61.42.1 2011/03/05 20:49:22 rmind Exp $ */
+/*	$NetBSD: zbus.c,v 1.61.42.2 2011/06/12 00:23:53 rmind Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.61.42.1 2011/03/05 20:49:22 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zbus.c,v 1.61.42.2 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -218,9 +218,9 @@
 static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata);
 
 
-void zbusattach(struct device *, struct device *, void *);
+void zbusattach(device_t, device_t, void *);
 int zbusprint(void *, const char *);
-int zbusmatch(struct device *, struct cfdata *, void *);
+int zbusmatch(device_t, cfdata_t, void *);
 void *zbusmap(void *, u_int);
 static const char *aconflookup(int, int);
 
@@ -244,14 +244,14 @@
  * mainbus driver
  */
 
-CFATTACH_DECL(zbus, sizeof(struct device),
+CFATTACH_DECL_NEW(zbus, 0,
     zbusmatch, zbusattach, NULL, NULL);
 
-static struct cfdata *early_cfdata;
+static cfdata_t early_cfdata;
 
 /*ARGSUSED*/
 int
-zbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+zbusmatch(device_t pdp, cfdata_t cfp, void *auxp)
 {
 
 	if (matchname(auxp, "zbus") == 0)
@@ -267,7 +267,7 @@
  * with that driver if matched else print a diag.
  */
 void
-zbusattach(struct device *pdp, struct device *dp, void *auxp)
+zbusattach(device_t pdp, device_t dp, void *auxp)
 {
 	struct zbus_args za;
 	struct preconfdata *pcp, *epcp;
--- a/sys/arch/amigappc/amigappc/cpu.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amigappc/amigappc/cpu.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.1 2009/07/21 09:49:15 phx Exp $	*/
+/*	$NetBSD: cpu.c,v 1.1.6.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008,2009 Frank Wille.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1 2009/07/21 09:49:15 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1.6.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,16 +41,16 @@
 
 #include <amiga/amiga/device.h>
 
-int cpu_match(struct device *, struct cfdata *, void *);
-void cpu_attach(struct device *, struct device *, void *);
+int cpu_match(device_t, cfdata_t, void *);
+void cpu_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpu_match, cpu_attach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
 int
-cpu_match(struct device *parent, struct cfdata *cf, void *aux)
+cpu_match(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (strcmp((char *)aux, cpu_cd.cd_name) != 0)
@@ -61,7 +61,7 @@
 }
 
 void
-cpu_attach(struct device *parent, struct device *self, void *aux)
+cpu_attach(device_t parent, device_t self, void *aux)
 {
 
 	if (amiga_realconfig)
--- a/sys/arch/amigappc/amigappc/mainbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/amigappc/amigappc/mainbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.1.6.1 2010/05/30 05:16:37 rmind Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.1.6.2 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2008,2009 Frank Wille.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1.6.1 2010/05/30 05:16:37 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.1.6.2 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -79,22 +79,22 @@
 #endif
 #endif
 
-void mbattach(struct device *, struct device *, void *);
+void mbattach(device_t, device_t, void *);
 int mbprint(void *, const char *);
-int mbmatch(struct device *, struct cfdata *, void *);
+int mbmatch(device_t, cfdata_t, void *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mbmatch, mbattach, NULL, NULL);
 
 int
-mbmatch(struct device *parent, struct cfdata *cfp, void *aux)
+mbmatch(device_t parent, cfdata_t cfp, void *aux)
 {
 
 	return 1;
 }
 
 void
-mbattach(struct device *parent, struct device *self, void *aux)
+mbattach(device_t parent, device_t self, void *aux)
 {
 
 	printf("\n");
--- a/sys/arch/arm/at91/at91aic.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/at91/at91aic.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,5 +1,5 @@
-/*	$Id: at91aic.c,v 1.3.4.2 2011/03/05 20:49:31 rmind Exp $	*/
-/*	$NetBSD: at91aic.c,v 1.3.4.2 2011/03/05 20:49:31 rmind Exp $	*/
+/*	$Id: at91aic.c,v 1.3.4.3 2011/06/12 00:23:53 rmind Exp $	*/
+/*	$NetBSD: at91aic.c,v 1.3.4.3 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy.
@@ -75,7 +75,7 @@
 static int	at91aic_match(device_t, cfdata_t, void *);
 static void	at91aic_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(at91aic, sizeof(struct device),
+CFATTACH_DECL_NEW(at91aic, 0,
 	      at91aic_match, at91aic_attach, NULL, NULL);
 
 static int
--- a/sys/arch/arm/mainbus/cpu_mainbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/mainbus/cpu_mainbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_mainbus.c,v 1.10 2009/03/14 15:36:02 dsl Exp $	*/
+/*	$NetBSD: cpu_mainbus.c,v 1.10.4.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_mainbus.c,v 1.10 2009/03/14 15:36:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_mainbus.c,v 1.10.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -63,33 +63,33 @@
 /*
  * Prototypes
  */
-static int cpu_mainbus_match(struct device *, struct cfdata *, void *);
-static void cpu_mainbus_attach(struct device *, struct device *, void *);
+static int cpu_mainbus_match(device_t, cfdata_t, void *);
+static void cpu_mainbus_attach(device_t, device_t, void *);
  
 /*
- * int cpumatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int cpumatch(device_t parent, cfdata_t cf, void *aux)
  *
  * Probe for the main cpu. Currently all this does is return 1 to
  * indicate that the cpu was found.
  */ 
  
 static int
-cpu_mainbus_match(struct device *parent, struct cfdata *cf, void *aux)
+cpu_mainbus_match(device_t parent, cfdata_t cf, void *aux)
 {
 	return(1);
 }
 
 /*
- * void cpusattach(struct device *parent, struct device *dev, void *aux)
+ * void cpusattach(device_t parent, device_t dev, void *aux)
  *
  * Attach the main cpu
  */
   
 static void
-cpu_mainbus_attach(struct device *parent, struct device *self, void *aux)
+cpu_mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	cpu_attach(self);
 }
 
-CFATTACH_DECL(cpu_mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu_mainbus, 0,
     cpu_mainbus_match, cpu_mainbus_attach, NULL, NULL);
--- a/sys/arch/arm/mainbus/mainbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/mainbus/mainbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.16 2009/03/14 15:36:02 dsl Exp $ */
+/* $NetBSD: mainbus.c,v 1.16.4.1 2011/06/12 00:23:53 rmind Exp $ */
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.16 2009/03/14 15:36:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.16.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -68,25 +68,25 @@
 
 /* Prototypes for functions provided */
 
-static int  mainbusmatch(struct device *, struct cfdata *, void *);
-static void mainbusattach(struct device *, struct device *, void *);
+static int  mainbusmatch(device_t, cfdata_t, void *);
+static void mainbusattach(device_t, device_t, void *);
 static int  mainbusprint(void *aux, const char *mainbus);
-static int  mainbussearch(struct device *, struct cfdata *,
+static int  mainbussearch(device_t, cfdata_t,
 				const int *, void *);
 
 /* attach and device structures for the device */
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbusmatch, mainbusattach, NULL, NULL);
 
 /*
- * int mainbusmatch(struct device *parent, struct cfdata *cf, void *aux)
+ * int mainbusmatch(device_t parent, cfdata_t cf, void *aux)
  *
  * Always match for unit 0
  */
 
 static int
-mainbusmatch(struct device *parent, struct cfdata *cf, void *aux)
+mainbusmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	return (1);
 }
@@ -116,13 +116,13 @@
 }
 
 /*
- * int mainbussearch(struct device *parent, struct device *self, void *aux)
+ * int mainbussearch(device_t parent, device_t self, void *aux)
  *
  * search routine used during the config of children
  */
 
 static int
-mainbussearch(struct device *parent, struct cfdata *cf, const int *ldesc, void *aux)
+mainbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct mainbus_attach_args mb;
 	int tryagain;
@@ -155,13 +155,13 @@
 }
 
 /*
- * void mainbusattach(struct device *parent, struct device *self, void *aux)
+ * void mainbusattach(device_t parent, device_t self, void *aux)
  *
  * probe and attach all children
  */
 
 static void
-mainbusattach(struct device *parent, struct device *self, void *aux)
+mainbusattach(device_t parent, device_t self, void *aux)
 {
 	aprint_naive("\n");
 	aprint_normal("\n");
--- a/sys/arch/arm/marvell/mvsoctmr.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/marvell/mvsoctmr.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoctmr.c,v 1.1.10.2 2011/03/05 20:49:37 rmind Exp $	*/
+/*	$NetBSD: mvsoctmr.c,v 1.1.10.3 2011/06/12 00:23:53 rmind Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.1.10.2 2011/03/05 20:49:37 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoctmr.c,v 1.1.10.3 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -60,18 +60,12 @@
 static void mvsoctmr_attach(device_t, device_t, void *);
 
 static int clockhandler(void *);
-static int statclockhandler(void *);
 
 static u_int mvsoctmr_get_timecount(struct timecounter *);
 
 static void mvsoctmr_cntl(struct mvsoctmr_softc *, int, u_int, int, int);
 
-#ifndef STATHZ
-#define STATHZ	64
-#endif
-
 static struct mvsoctmr_softc *mvsoctmr_sc;
-static uint32_t clock_ticks, statclock_ticks;
 static struct timecounter mvsoctmr_timecounter = {
 	mvsoctmr_get_timecount,	/* get_timecount */
 	0,			/* no poll_pps */
@@ -82,7 +76,6 @@
 	NULL,			/* prev */
 	NULL,			/* next */
 };
-static volatile uint32_t mvsoctmr_base;
 
 CFATTACH_DECL_NEW(mvsoctmr, sizeof(struct mvsoctmr_softc),
     mvsoctmr_match, mvsoctmr_attach, NULL, NULL);
@@ -121,6 +114,9 @@
 	if (bus_space_subregion(mva->mva_iot, mva->mva_ioh,
 	    mva->mva_offset, mva->mva_size, &sc->sc_ioh))
 		panic("%s: Cannot map registers", device_xname(self));
+
+	mvsoctmr_timecounter.tc_name = device_xname(self);
+	mvsoctmr_cntl(sc, MVSOCTMR_TIMER1, 0xffffffff, 1, 1);
 }
 
 /*
@@ -133,48 +129,20 @@
 {
 	struct clockframe *frame = arg;
 
-	atomic_add_32(&mvsoctmr_base, clock_ticks);
-
 	hardclock(frame);
 
 	return 1;
 }
 
 /*
- * statclockhandler:
- *
- *	Handle the statclock interrupt.
- */
-static int
-statclockhandler(void *arg)
-{
-	struct clockframe *frame = arg;
-
-	statclock(frame);
-
-	return 1;
-}
-
-
-/*
  * setstatclockrate:
  *
  *	Set the rate of the statistics clock.
- *
- *	We assume that hz is either stathz or profhz, and that neither
- *	will change after being set by cpu_initclocks().  We could
- *	recalculate the intervals here, but that would be a pain.
  */
 /* ARGSUSED */
 void
 setstatclockrate(int newhz)
 {
-	struct mvsoctmr_softc *sc = mvsoctmr_sc;
-	const int en = 1, autoen = 1;
-
-	statclock_ticks = mvTclk / newhz;
-
-	mvsoctmr_cntl(sc, MVSOCTMR_TIMER1, statclock_ticks, en, autoen);
 }
 
 /*
@@ -188,32 +156,26 @@
 	struct mvsoctmr_softc *sc;
 	void *clock_ih;
 	const int en = 1, autoen = 1;
+	uint32_t timer0_tval;
 
 	sc = mvsoctmr_sc;
 	if (sc == NULL)
 		panic("cpu_initclocks: mvsoctmr not found");
 
-	stathz = profhz = STATHZ;
+	mvsoctmr_timecounter.tc_priv = sc;
 	mvsoctmr_timecounter.tc_frequency = mvTclk;
-	clock_ticks = mvTclk / hz;
 
-	mvsoctmr_cntl(sc, MVSOCTMR_TIMER0, clock_ticks, en, autoen);
+	timer0_tval = (mvTclk * 2) / (u_long) hz;
+	timer0_tval = (timer0_tval / 2) + (timer0_tval & 1);
+
+	mvsoctmr_cntl(sc, MVSOCTMR_TIMER0, timer0_tval, en, autoen);
+	mvsoctmr_cntl(sc, MVSOCTMR_TIMER1, 0xffffffff, en, autoen);
 
 	clock_ih = mvsoc_bridge_intr_establish(MVSOC_MLMB_MLMBI_CPUTIMER0INTREQ,
 	    IPL_CLOCK, clockhandler, NULL);
 	if (clock_ih == NULL)
 		panic("cpu_initclocks: unable to register timer interrupt");
 
-	if (stathz) {
-		setstatclockrate(stathz);
-		clock_ih = mvsoc_bridge_intr_establish(
-		    MVSOC_MLMB_MLMBI_CPUTIMER1INTREQ, IPL_HIGH,
-		    statclockhandler, NULL);
-		if (clock_ih == NULL)
-			panic("cpu_initclocks:"
-			    " unable to register statclock timer interrupt");
-	}
-
 	tc_init(&mvsoctmr_timecounter);
 }
 
@@ -237,7 +199,7 @@
 	 * counted.
 	 */
 	initial_tick = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
-	    MVSOCTMR_TIMER(MVSOCTMR_TIMER0));
+	    MVSOCTMR_TIMER(MVSOCTMR_TIMER1));
 
 	if (n <= UINT_MAX / mvTclk) {
 		/*
@@ -255,9 +217,9 @@
 
 	while (remaining > 0) {
 		cur_tick = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
-		    MVSOCTMR_TIMER(MVSOCTMR_TIMER0));
+		    MVSOCTMR_TIMER(MVSOCTMR_TIMER1));
 		if (cur_tick > initial_tick)
-			remaining -= clock_ticks - cur_tick + initial_tick;
+			remaining -= 0xffffffff - cur_tick + initial_tick;
 		else
 			remaining -= (initial_tick - cur_tick);
 		initial_tick = cur_tick;
@@ -267,20 +229,12 @@
 static u_int
 mvsoctmr_get_timecount(struct timecounter *tc)
 {
-	struct mvsoctmr_softc *sc = mvsoctmr_sc;
-	uint32_t counter, base;
-	u_int intrstat;
+	struct mvsoctmr_softc *sc = tc->tc_priv;
 
-	intrstat = disable_interrupts(I32_bit);
-	base = mvsoctmr_base;
-	counter = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
-	    MVSOCTMR_TIMER(MVSOCTMR_TIMER0));
-	restore_interrupts(intrstat);
-
-	return base - counter;
+	return 0xffffffff - bus_space_read_4(sc->sc_iot, sc->sc_ioh,
+	    MVSOCTMR_TIMER(MVSOCTMR_TIMER1));
 }
 
-
 static void
 mvsoctmr_cntl(struct mvsoctmr_softc *sc, int num, u_int ticks, int en,
 	      int autoen)
--- a/sys/arch/arm/ofw/ofwgencfg_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/ofw/ofwgencfg_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofwgencfg_machdep.c,v 1.17 2009/03/14 15:36:02 dsl Exp $	*/
+/*	$NetBSD: ofwgencfg_machdep.c,v 1.17.4.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright 1997
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwgencfg_machdep.c,v 1.17 2009/03/14 15:36:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwgencfg_machdep.c,v 1.17.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include "opt_ddb.h"
 
@@ -88,8 +88,8 @@
 extern void data_abort_handler(trapframe_t *frame);
 extern void prefetch_abort_handler(trapframe_t *frame);
 extern void undefinedinstruction_bounce(trapframe_t *frame);
-int	ofbus_match(struct device *, struct cfdata *, void *);
-void	ofbus_attach(struct device *, struct device *, void *);
+int	ofbus_match(device_t, cfdata_t, void *);
+void	ofbus_attach(device_t, device_t, void *);
 
 /* Local routines */
 static void process_kernel_args(void);
@@ -106,7 +106,7 @@
 
 int ofw_handleticks = 0;	/* set to TRUE by cpu_initclocks */
 
-CFATTACH_DECL(ofbus_root, sizeof(struct device),
+CFATTACH_DECL_NEW(ofbus_root, 0,
     ofbus_match, ofbus_attach, NULL, NULL);
 
 /**************************************************************/
--- a/sys/arch/arm/xscale/pxa2x0.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0.c,v 1.18 2009/08/09 06:12:33 kiyohara Exp $ */
+/*	$NetBSD: pxa2x0.c,v 1.18.4.1 2011/06/12 00:23:53 rmind Exp $ */
 
 /*
  * Copyright (c) 2002, 2005  Genetec Corporation.  All rights reserved.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0.c,v 1.18 2009/08/09 06:12:33 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0.c,v 1.18.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include "pxaintc.h"
 #include "pxagpio.h"
@@ -126,7 +126,7 @@
 #include <arm/xscale/xscalereg.h>
 
 struct pxaip_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	bus_space_tag_t sc_bust;
 	bus_dma_tag_t sc_dmat;
 	bus_space_handle_t sc_bush_clk;
@@ -134,10 +134,9 @@
 };
 
 /* prototypes */
-static int	pxaip_match(struct device *, struct cfdata *, void *);
-static void	pxaip_attach(struct device *, struct device *, void *);
-static int 	pxaip_search(struct device *, struct cfdata *,
-			     const int *, void *);
+static int	pxaip_match(device_t, cfdata_t, void *);
+static void	pxaip_attach(device_t, device_t, void *);
+static int 	pxaip_search(device_t, cfdata_t, const int *, void *);
 static void	pxaip_attach_critical(struct pxaip_softc *);
 static int	pxaip_print(void *, const char *);
 
@@ -154,7 +153,7 @@
 #endif
 
 /* attach structures */
-CFATTACH_DECL(pxaip, sizeof(struct pxaip_softc),
+CFATTACH_DECL_NEW(pxaip, sizeof(struct pxaip_softc),
     pxaip_match, pxaip_attach, NULL, NULL);
 
 static struct pxaip_softc *pxaip_sc;
@@ -166,7 +165,7 @@
 	(*((volatile uint32_t *)(pxaclkman_regs + (reg))))
 
 static int
-pxaip_match(struct device *parent, struct cfdata *match, void *aux)
+pxaip_match(device_t parent, cfdata_t match, void *aux)
 {
 
 #if	!defined(CPU_XSCALE_PXA270)
@@ -190,16 +189,17 @@
 }
 
 static void
-pxaip_attach(struct device *parent, struct device *self, void *aux)
+pxaip_attach(device_t parent, device_t self, void *aux)
 {
-	struct pxaip_softc *sc = (struct pxaip_softc *)self;
+	struct pxaip_softc *sc = device_private(self);
 	int cpuclock;
 
 	pxaip_sc = sc;
+	sc->sc_dev = self;
 	sc->sc_bust = &pxa2x0_bs_tag;
 	sc->sc_dmat = &pxa2x0_bus_dma_tag;
 
-	aprint_normal(": PXA2x0 Onchip Peripheral Bus\n");
+	aprint_normal(": Onchip Peripheral Bus\n");
 
 	if (bus_space_map(sc->sc_bust, PXA2X0_CLKMAN_BASE, PXA2X0_CLKMAN_SIZE,
 	    0, &sc->sc_bush_clk))
@@ -234,8 +234,7 @@
 }
 
 static int
-pxaip_search(struct device *parent, struct cfdata *cf,
-	     const int *ldesc, void *aux)
+pxaip_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
 {
 	struct pxaip_softc *sc = aux;
 	struct pxaip_attach_args aa;
@@ -265,7 +264,7 @@
 	aa.pxa_addr = PXA2X0_INTCTL_BASE;
 	aa.pxa_size = PXA2X0_INTCTL_SIZE;
 	aa.pxa_intr = PXAIPCF_INTR_DEFAULT;
-	if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+	if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
 		panic("pxaip_attach_critical: failed to attach INTC!");
 
 #if NPXAGPIO > 0
@@ -275,7 +274,7 @@
 	aa.pxa_addr = PXA2X0_GPIO_BASE;
 	aa.pxa_size = PXA2X0_GPIO_SIZE;
 	aa.pxa_intr = PXAIPCF_INTR_DEFAULT;
-	if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+	if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
 		panic("pxaip_attach_critical: failed to attach GPIO!");
 #endif
 
@@ -286,7 +285,7 @@
 	aa.pxa_addr = PXA2X0_DMAC_BASE;
 	aa.pxa_size = PXA2X0_DMAC_SIZE;
 	aa.pxa_intr = PXA2X0_INT_DMA;
-	if (config_found(&sc->sc_dev, &aa, pxaip_print) == NULL)
+	if (config_found(sc->sc_dev, &aa, pxaip_print) == NULL)
 		panic("pxaip_attach_critical: failed to attach DMAC!");
 #endif
 }
@@ -294,7 +293,7 @@
 static int
 pxaip_print(void *aux, const char *name)
 {
-	struct pxaip_attach_args *sa = (struct pxaip_attach_args*)aux;
+	struct pxaip_attach_args *sa = (struct pxaip_attach_args *)aux;
 
 	if (sa->pxa_addr != PXAIPCF_ADDR_DEFAULT) {
 		aprint_normal(" addr 0x%lx", sa->pxa_addr);
--- a/sys/arch/arm/xscale/pxa2x0_ac97.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_ac97.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_ac97.c,v 1.7 2007/10/17 19:53:44 garbled Exp $	*/
+/*	$NetBSD: pxa2x0_ac97.c,v 1.7.42.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -75,7 +75,7 @@
 #define KERNADDR(ad) ((void *)((ad)->ad_addr))
 
 struct acu_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	bus_space_tag_t sc_bust;
 	bus_dma_tag_t sc_dmat;
 	bus_space_handle_t sc_bush;
@@ -113,10 +113,10 @@
 	struct audio_encoding_set *sc_encodings;
 };
 
-static int	pxaacu_match(struct device *, struct cfdata *, void *);
-static void	pxaacu_attach(struct device *, struct device *, void *);
+static int	pxaacu_match(device_t, cfdata_t, void *);
+static void	pxaacu_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pxaacu, sizeof(struct acu_softc),
+CFATTACH_DECL_NEW(pxaacu, sizeof(struct acu_softc),
     pxaacu_match, pxaacu_attach, NULL, NULL);
 
 static int acu_codec_attach(void *, struct ac97_codec_if *);
@@ -230,7 +230,7 @@
 }
 
 static int
-pxaacu_match(struct device *parent, struct cfdata *cf, void *aux)
+pxaacu_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pxaip_attach_args *pxa = aux;
 	struct pxa2x0_gpioconf *gpioconf;
@@ -256,11 +256,12 @@
 }
 
 static void
-pxaacu_attach(struct device *parent, struct device *self, void *aux)
+pxaacu_attach(device_t parent, device_t self, void *aux)
 {
-	struct acu_softc *sc = (struct acu_softc *)self;
+	struct acu_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = aux;
 
+	sc->sc_dev = self;
 	sc->sc_bust = pxa->pxa_iot;
 	sc->sc_dmat = pxa->pxa_dmat;
 
@@ -269,7 +270,7 @@
 
 	if (bus_space_map(sc->sc_bust, pxa->pxa_addr, pxa->pxa_size, 0,
 	    &sc->sc_bush)) {
-		aprint_error("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "Can't map registers!\n");
 		return;
 	}
 
@@ -293,8 +294,7 @@
 		delay(100);
 		pxa2x0_clkman_config(CKEN_AC97, false);
 		bus_space_unmap(sc->sc_bust, sc->sc_bush, pxa->pxa_size);
-		aprint_error("%s: Primary codec not ready\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "Primary codec not ready\n");
 		return;
 	}
 
@@ -311,9 +311,8 @@
 	sc->sc_in_reset = 0;
 	sc->sc_dac_rate = sc->sc_adc_rate = 0;
 
-	if (ac97_attach(&sc->sc_host_if, &sc->sc_dev)) {
-		aprint_error("%s: Failed to attach primary codec\n",
-		    sc->sc_dev.dv_xname);
+	if (ac97_attach(&sc->sc_host_if, sc->sc_dev)) {
+		aprint_error_dev(self, "Failed to attach primary codec\n");
  fail:
 		acu_reg_write(sc, AC97_GCR, 0);
 		delay(100);
@@ -324,14 +323,13 @@
 
 	if (auconv_create_encodings(acu_formats, ACU_NFORMATS,
 	    &sc->sc_encodings)) {
-		aprint_error("%s: Failed to create encodings\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "Failed to create encodings\n");
 		if (sc->sc_codec_if != NULL)
 			(sc->sc_codec_if->vtbl->detach)(sc->sc_codec_if);
 		goto fail;
 	}
 
-	sc->sc_audiodev = audio_attach_mi(&acu_hw_if, sc, &sc->sc_dev);
+	sc->sc_audiodev = audio_attach_mi(&acu_hw_if, sc, sc->sc_dev);
 
 	/*
 	 * As a work-around for braindamage in the PXA250's AC97 controller
@@ -463,8 +461,8 @@
 	delay(100);
 
 	if (acu_wait_gsr(sc, GSR_PCR)) {
-		printf("%s: acu_codec_reset: failed to ready after reset\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		    "acu_codec_reset: failed to ready after reset\n");
 		return (ETIMEDOUT);
 	}
 
@@ -488,7 +486,7 @@
 		acu_reg_write(sc, AC97_POCR, 0);
 		reg = acu_reg_read(sc, AC97_POSR);
 		acu_reg_write(sc, AC97_POSR, reg);
-		printf("%s: Tx PCM Fifo underrun\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "Tx PCM Fifo underrun\n");
 	}
 
 	/*
@@ -502,7 +500,7 @@
 		acu_reg_write(sc, AC97_PICR, 0);
 		reg = acu_reg_read(sc, AC97_PISR);
 		acu_reg_write(sc, AC97_PISR, reg);
-		printf("%s: Rx PCM Fifo overrun\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "Rx PCM Fifo overrun\n");
 	}
 
 	return (1);
@@ -925,9 +923,9 @@
 		panic("acu_tx_loop_segment: xfer mismatch!");
 
 	if (status) {
-		printf(
-		    "%s: acu_tx_loop_segment: non-zero completion status %d\n",
-		    sc->sc_dev.dv_xname, status);
+		aprint_error_dev(sc->sc_dev,
+		    "acu_tx_loop_segment: non-zero completion status %d\n",
+		    status);
 	}
 
 	s = splaudio();
@@ -949,9 +947,9 @@
 		panic("acu_rx_loop_segment: xfer mismatch!");
 
 	if (status) {
-		printf(
-		    "%s: acu_rx_loop_segment: non-zero completion status %d\n",
-		    sc->sc_dev.dv_xname, status);
+		aprint_error_dev(sc->sc_dev,
+		    "acu_rx_loop_segment: non-zero completion status %d\n",
+		    status);
 	}
 
 	s = splaudio();
--- a/sys/arch/arm/xscale/pxa2x0_dmac.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_dmac.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_dmac.c,v 1.6 2009/03/16 11:42:31 nonaka Exp $	*/
+/*	$NetBSD: pxa2x0_dmac.c,v 1.6.4.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -163,7 +163,7 @@
 #endif
 
 struct pxadmac_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	bus_space_tag_t sc_bust;
 	bus_dma_tag_t sc_dmat;
 	bus_space_handle_t sc_bush;
@@ -216,10 +216,10 @@
 #endif
 };
 
-static int	pxadmac_match(struct device *, struct cfdata *, void *);
-static void	pxadmac_attach(struct device *, struct device *, void *);
+static int	pxadmac_match(device_t, cfdata_t, void *);
+static void	pxadmac_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pxadmac, sizeof(struct pxadmac_softc),
+CFATTACH_DECL_NEW(pxadmac, sizeof(struct pxadmac_softc),
     pxadmac_match, pxadmac_attach, NULL, NULL);
 
 static struct pxadmac_softc *pxadmac_sc;
@@ -278,7 +278,7 @@
 }
 
 static int
-pxadmac_match(struct device *parent, struct cfdata *cf, void *aux)
+pxadmac_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pxaip_attach_args *pxa = aux;
 
@@ -292,13 +292,14 @@
 }
 
 static void
-pxadmac_attach(struct device *parent, struct device *self, void *aux)
+pxadmac_attach(device_t parent, device_t self, void *aux)
 {
-	struct pxadmac_softc *sc = (struct pxadmac_softc *)self;
+	struct pxadmac_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = aux;
 	struct pxa2x0_dma_desc *dd;
 	int i, nsegs;
 
+	sc->sc_dev = self;
 	sc->sc_bust = pxa->pxa_iot;
 	sc->sc_dmat = pxa->pxa_dmat;
 
@@ -306,7 +307,7 @@
 
 	if (bus_space_map(sc->sc_bust, pxa->pxa_addr, pxa->pxa_size, 0,
 	    &sc->sc_bush)) {
-		aprint_error("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "Can't map registers!\n");
 		return;
 	}
 
@@ -1186,8 +1187,9 @@
 		dmac_reg_write(sc, DMAC_DCSR(channel), dcsr & ~DCSR_RUN);
 
 	if ((dxs = sc->sc_active[channel]) == NULL) {
-		printf("%s: Stray DMAC interrupt for unallocated channel %d\n",
-		    sc->sc_dev.dv_xname, channel);
+		aprint_error_dev(sc->sc_dev,
+		    "Stray DMAC interrupt for unallocated channel %d\n",
+		    channel);
 		return (0);
 	}
 
--- a/sys/arch/arm/xscale/pxa2x0_gpio.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_gpio.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_gpio.c,v 1.13 2009/08/04 12:11:33 kiyohara Exp $	*/
+/*	$NetBSD: pxa2x0_gpio.c,v 1.13.4.1 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.13 2009/08/04 12:11:33 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.13.4.1 2011/06/12 00:23:53 rmind Exp $");
 
 #include "opt_pxa2x0_gpio.h"
 
@@ -65,7 +65,7 @@
 };
 
 struct pxagpio_softc {
-	struct device sc_dev;
+	device_t sc_dev;
 	bus_space_tag_t sc_bust;
 	bus_space_handle_t sc_bush;
 	void *sc_irqcookie[4];
@@ -77,10 +77,10 @@
 #endif
 };
 
-static int	pxagpio_match(struct device *, struct cfdata *, void *);
-static void	pxagpio_attach(struct device *, struct device *, void *);
+static int	pxagpio_match(device_t, cfdata_t, void *);
+static void	pxagpio_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pxagpio, sizeof(struct pxagpio_softc),
+CFATTACH_DECL_NEW(pxagpio, sizeof(struct pxagpio_softc),
     pxagpio_match, pxagpio_attach, NULL, NULL);
 
 static struct pxagpio_softc *pxagpio_softc;
@@ -120,7 +120,7 @@
 }
 
 static int
-pxagpio_match(struct device *parent, struct cfdata *cf, void *aux)
+pxagpio_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pxaip_attach_args *pxa = aux;
 
@@ -133,18 +133,19 @@
 }
 
 static void
-pxagpio_attach(struct device *parent, struct device *self, void *aux)
+pxagpio_attach(device_t parent, device_t self, void *aux)
 {
-	struct pxagpio_softc *sc = (struct pxagpio_softc *)self;
+	struct pxagpio_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = aux;
 
+	sc->sc_dev = self;
 	sc->sc_bust = pxa->pxa_iot;
 
 	aprint_normal(": GPIO Controller\n");
 
 	if (bus_space_map(sc->sc_bust, pxa->pxa_addr, pxa->pxa_size, 0,
 	    &sc->sc_bush)) {
-		aprint_error("%s: Can't map registers!\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "Can't map registers!\n");
 		return;
 	}
 
@@ -176,8 +177,7 @@
 	sc->sc_irqcookie[2] = pxa2x0_intr_establish(PXA2X0_INT_GPION, IPL_BIO,
 	    gpio_intrN, sc);
 	if (sc->sc_irqcookie[2] == NULL) {
-		aprint_error("%s: failed to hook main GPIO interrupt\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "failed to hook main GPIO interrupt\n");
 		return;
 	}
 #endif
@@ -323,8 +323,7 @@
 
 #ifdef DIAGNOSTIC
 	if (sc->sc_handlers[0] == NULL) {
-		printf("%s: stray GPIO#0 edge interrupt\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "stray GPIO#0 edge interrupt\n");
 		return (0);
 	}
 #endif
@@ -342,8 +341,7 @@
 
 #ifdef DIAGNOSTIC
 	if (sc->sc_handlers[1] == NULL) {
-		printf("%s: stray GPIO#1 edge interrupt\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "stray GPIO#1 edge interrupt\n");
 		return (0);
 	}
 #endif
@@ -385,8 +383,9 @@
 	 */
 #ifdef DEBUG
 	if ((gedr & sc->sc_mask[bank]) == 0) {
-		printf("%s: stray GPIO interrupt. Bank %d, GEDR 0x%08x, mask 0x%08x\n",
-		    sc->sc_dev.dv_xname, bank, gedr, sc->sc_mask[bank]);
+		aprint_error_dev(sc->sc_dev,
+		    "stray GPIO interrupt. Bank %d, GEDR 0x%08x, mask 0x%08x\n",
+		    bank, gedr, sc->sc_mask[bank]);
 		return (1);	/* XXX: Pretend we dealt with it */
 	}
 #endif
@@ -405,8 +404,9 @@
 		gedr &= ~mask;
 
 		if ((gh = *ghp) == NULL) {
-			printf("%s: unhandled GPIO interrupt. GPIO#%d\n",
-			    sc->sc_dev.dv_xname, gpio_base + i);
+			aprint_error_dev(sc->sc_dev,
+			    "unhandled GPIO interrupt. GPIO#%d\n",
+			    gpio_base + i);
 			continue;
 		}
 
--- a/sys/arch/arm/xscale/pxa2x0_intr.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_intr.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_intr.c,v 1.16.4.1 2010/07/03 01:19:15 rmind Exp $	*/
+/*	$NetBSD: pxa2x0_intr.c,v 1.16.4.2 2011/06/12 00:23:53 rmind Exp $	*/
 
 /*
  * Copyright (c) 2002  Genetec Corporation.  All rights reserved.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.c,v 1.16.4.1 2010/07/03 01:19:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_intr.c,v 1.16.4.2 2011/06/12 00:23:53 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -58,10 +58,10 @@
 /*
  * INTC autoconf glue
  */
-static int	pxaintc_match(struct device *, struct cfdata *, void *);
-static void	pxaintc_attach(struct device *, struct device *, void *);
+static int	pxaintc_match(device_t, cfdata_t, void *);
+static void	pxaintc_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(pxaintc, sizeof(struct device),
+CFATTACH_DECL_NEW(pxaintc, 0,
     pxaintc_match, pxaintc_attach, NULL, NULL);
 
 static int pxaintc_attached;
@@ -98,7 +98,7 @@
 
 
 static int
-pxaintc_match(struct device *parent, struct cfdata *cf, void *aux)
+pxaintc_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pxaip_attach_args *pxa = aux;
 
@@ -109,7 +109,7 @@
 }
 
 void
-pxaintc_attach(struct device *parent, struct device *self, void *args)
+pxaintc_attach(device_t parent, device_t self, void *args)
 {
 	int i;
 
--- a/sys/arch/arm/xscale/pxa2x0_udc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_udc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_udc.c,v 1.3 2009/08/09 06:24:03 kiyohara Exp $	*/
+/*	$NetBSD: pxa2x0_udc.c,v 1.3.4.1 2011/06/12 00:23:53 rmind Exp $	*/
 /*	$OpenBSD: pxa27x_udc.c,v 1.5 2005/03/30 14:24:39 dlg Exp $ */
 
 /*
@@ -31,7 +31,7 @@
 #include <arm/xscale/pxa2x0_gpio.h>
 
 struct pxaudc_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 	bus_space_tag_t		sc_iot;
 	bus_space_handle_t	sc_ioh;
 	bus_size_t		sc_size;
@@ -39,18 +39,18 @@
 	void 			*sc_powerhook;
 };
 
-static int	pxaudc_match(struct device *, struct cfdata *, void *);
-static void	pxaudc_attach(struct device *, struct device *, void *);
-static int	pxaudc_detach(struct device *, int);
+static int	pxaudc_match(device_t, cfdata_t, void *);
+static void	pxaudc_attach(device_t, device_t, void *);
+static int	pxaudc_detach(device_t, int);
 
-CFATTACH_DECL(pxaudc, sizeof(struct pxaudc_softc),
+CFATTACH_DECL_NEW(pxaudc, sizeof(struct pxaudc_softc),
     pxaudc_match, pxaudc_attach, pxaudc_detach, NULL);
 
 static void	pxaudc_power(int, void *);
 static void	pxaudc_enable(struct pxaudc_softc *);
 
 static int
-pxaudc_match(struct device *parent, struct cfdata *cf, void *aux)
+pxaudc_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct pxaip_attach_args *pxa = aux;
 
@@ -62,24 +62,26 @@
 }
 
 static void
-pxaudc_attach(struct device *parent, struct device *self, void *aux)
+pxaudc_attach(device_t parent, device_t self, void *aux)
 {
-	struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
+	struct pxaudc_softc *sc = device_private(self);
 	struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux;
 
+	sc->sc_dev = self;
 	sc->sc_iot = pxa->pxa_iot;
 	sc->sc_size = 0;
 	sc->sc_powerhook = NULL;
 
+	aprint_normal(": USB Device Controller\n");
+	aprint_naive("\n");
+
 	if (bus_space_map(sc->sc_iot, pxa->pxa_addr, pxa->pxa_size, 0,
 	    &sc->sc_ioh)) {
-		aprint_error(": couldn't map memory space\n");
+		aprint_error_dev(self, "couldn't map memory space\n");
 		return;
 	}
 	sc->sc_size = pxa->pxa_size;
 
-	printf(": PXA2x0 USB Device Controller\n");
-
 	bus_space_barrier(sc->sc_iot, sc->sc_ioh, 0, sc->sc_size,
 	    BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE);
 
@@ -87,18 +89,17 @@
 
 	pxaudc_enable(sc);
 
-	sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname,
+	sc->sc_powerhook = powerhook_establish(device_xname(self),
 	    pxaudc_power, sc);
 	if (sc->sc_powerhook == NULL) {
-		aprint_error("%s: unable to establish powerhook.\n",
-		    sc->sc_dev.dv_xname);
+		aprint_error_dev(self, "unable to establish powerhook.\n");
 	}
 }
 
 static int
-pxaudc_detach(struct device *self, int flags)
+pxaudc_detach(device_t self, int flags)
 {
-	struct pxaudc_softc *sc = (struct pxaudc_softc *)self;
+	struct pxaudc_softc *sc = device_private(self);
 
 	if (sc->sc_powerhook)
 		powerhook_disestablish(sc->sc_powerhook);
--- a/sys/arch/atari/atari/autoconf.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/atari/autoconf.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.56.4.1 2010/05/30 05:16:38 rmind Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.56.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.56.4.1 2010/05/30 05:16:38 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.56.4.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -46,8 +46,8 @@
 #include <atari/atari/device.h>
 
 static void findroot(void);
-int mbmatch(struct device *, struct cfdata *, void *);
-void mbattach(struct device *, struct device *, void *);
+int mbmatch(device_t, cfdata_t, void *);
+void mbattach(device_t, device_t, void *);
 #if 0
 int mbprint(void *, const char *);
 #endif
@@ -93,11 +93,10 @@
  * by checking for NULL.
  */
 int
-atari_config_found(struct cfdata *pcfp, struct device *pdp, void *auxp,
-    cfprint_t pfn)
+atari_config_found(cfdata_t pcfp, device_t pdp, void *auxp, cfprint_t pfn)
 {
 	struct device temp;
-	struct cfdata *cf;
+	cfdata_t cf;
 	const struct cfattach *ca;
 
 	if (atari_realconfig)
@@ -131,7 +130,7 @@
 void
 config_console(void)
 {	
-	struct cfdata *cf;
+	cfdata_t cf;
 
 	config_init();
 
@@ -188,7 +187,7 @@
 {
 	struct disk *dkp;
 	struct partition *pp;
-	struct device **devs;
+	device_t *devs;
 	const struct bdevsw *bdev;
 	int i, maj, unit;
 
@@ -204,7 +203,7 @@
 			 * Find the disk structure corresponding to the
 			 * current device.
 			 */
-			devs = (struct device **)genericconf[i]->cd_devs;
+			devs = (device_t *)genericconf[i]->cd_devs;
 			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
 				continue;
 
@@ -243,13 +242,13 @@
 /* 
  * mainbus driver 
  */
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mbmatch, mbattach, NULL, NULL);
 
 static int mb_attached;
 
 int
-mbmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+mbmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (mb_attached)
@@ -264,35 +263,35 @@
  * "find" all the things that should be there.
  */
 void
-mbattach(struct device *pdp, struct device *dp, void *auxp)
+mbattach(device_t parent, device_t self, void *aux)
 {
 
 	mb_attached = 1;
 
 	printf ("\n");
-	config_found(dp, __UNCONST("clock")   , simple_devprint);
-	config_found(dp, __UNCONST("grfbus")  , simple_devprint);
-	config_found(dp, __UNCONST("kbd")     , simple_devprint);
-	config_found(dp, __UNCONST("fdc")     , simple_devprint);
-	config_found(dp, __UNCONST("ser")     , simple_devprint);
-	config_found(dp, __UNCONST("zs")      , simple_devprint);
-	config_found(dp, __UNCONST("ncrscsi") , simple_devprint);
-	config_found(dp, __UNCONST("nvr")     , simple_devprint);
-	config_found(dp, __UNCONST("lpt")     , simple_devprint);
-	config_found(dp, __UNCONST("wdc")     , simple_devprint);
-	config_found(dp, __UNCONST("ne")      , simple_devprint);
-	config_found(dp, __UNCONST("isab")    , simple_devprint);
-	config_found(dp, __UNCONST("pcib")    , simple_devprint);
-	config_found(dp, __UNCONST("avmebus") , simple_devprint);
+	config_found(self, __UNCONST("clock")   , simple_devprint);
+	config_found(self, __UNCONST("grfbus")  , simple_devprint);
+	config_found(self, __UNCONST("kbd")     , simple_devprint);
+	config_found(self, __UNCONST("fdc")     , simple_devprint);
+	config_found(self, __UNCONST("ser")     , simple_devprint);
+	config_found(self, __UNCONST("zs")      , simple_devprint);
+	config_found(self, __UNCONST("ncrscsi") , simple_devprint);
+	config_found(self, __UNCONST("nvr")     , simple_devprint);
+	config_found(self, __UNCONST("lpt")     , simple_devprint);
+	config_found(self, __UNCONST("wdc")     , simple_devprint);
+	config_found(self, __UNCONST("ne")      , simple_devprint);
+	config_found(self, __UNCONST("isab")    , simple_devprint);
+	config_found(self, __UNCONST("pcib")    , simple_devprint);
+	config_found(self, __UNCONST("avmebus") , simple_devprint);
 }
 
 #if 0
 int
-mbprint(void *auxp, const char *pnp)
+mbprint(void *aux, const char *pnp)
 {
 
 	if (pnp)
-		aprint_normal("%s at %s", (char *)auxp, pnp);
+		aprint_normal("%s at %s", (char *)aux, pnp);
 	return UNCONF;
 }
 #endif
--- a/sys/arch/atari/dev/atari5380.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/atari5380.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: atari5380.c,v 1.53.4.1 2010/05/30 05:16:39 rmind Exp $	*/
+/*	$NetBSD: atari5380.c,v 1.53.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.53.4.1 2010/05/30 05:16:39 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atari5380.c,v 1.53.4.2 2011/06/12 00:23:54 rmind 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;
--- a/sys/arch/atari/dev/clock.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/clock.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.50.4.2 2011/03/05 20:49:42 rmind Exp $	*/
+/*	$NetBSD: clock.c,v 1.50.4.3 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.50.4.2 2011/03/05 20:49:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.50.4.3 2011/06/12 00:23:54 rmind 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 = (void *)dp;
-	static struct todr_chip_handle	tch;
+	struct clock_softc *sc = device_private(self);
+	struct todr_chip_handle	*tch;
 
-	tch.todr_gettime_ymdhms = atari_rtc_get;
-	tch.todr_settime_ymdhms = atari_rtc_set;
-	tch.todr_setwen = NULL;
+	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;
 
-	todr_attach(&tch);
+	todr_attach(tch);
 
 	sc->sc_flags = 0;
 
--- a/sys/arch/atari/dev/grf.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/grf.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf.c,v 1.41.4.2 2011/03/05 20:49:42 rmind Exp $	*/
+/*	$NetBSD: grf.c,v 1.41.4.3 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.41.4.2 2011/03/05 20:49:42 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.41.4.3 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -90,16 +90,16 @@
 int grfoff(dev_t);
 int grfsinfo(dev_t, struct grfdyninfo *);
 
-int grfbusprint(void *auxp, const char *);
-int grfbusmatch(struct device *, struct cfdata *, void *);
-void grfbusattach(struct device *, struct device *, void *);
+int grfbusprint(void *, const char *);
+int grfbusmatch(device_t, cfdata_t, void *);
+void grfbusattach(device_t, device_t, void *);
 
 /*
  * pointers to grf drivers device structs 
  */
 struct grf_softc *grfsp[NGRF]; /* XXX */
 
-CFATTACH_DECL(grfbus, sizeof(struct device),
+CFATTACH_DECL_NEW(grfbus, 0,
     grfbusmatch, grfbusattach, NULL, NULL);
 
 dev_type_open(grfopen);
@@ -115,38 +115,38 @@
 /*
  * only used in console init.
  */
-static struct cfdata *cfdata_gbus  = NULL;
+static cfdata_t cfdata_gbus  = NULL;
 
 int
-grfbusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+grfbusmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
-	if (strcmp(auxp, grfbus_cd.cd_name))
+	if (strcmp(aux, grfbus_cd.cd_name))
 		return 0;
 
 	if (atari_realconfig == 0)
-		cfdata_gbus = cfp;
+		cfdata_gbus = cf;
 	return 1;	/* Always there	*/
 }
 
 void
-grfbusattach(struct device *pdp, struct device *dp, void *auxp)
+grfbusattach(device_t parent, device_t self, void *aux)
 {
 	grf_auxp_t	grf_auxp;
 
 	grf_auxp.busprint       = grfbusprint;
 	grf_auxp.from_bus_match = 1;
 
-	if (dp == NULL) /* Console init	*/
+	if (self == NULL) /* Console init	*/
 		atari_config_found(cfdata_gbus, NULL, &grf_auxp, grfbusprint);
 	else {
 		printf("\n");
-		config_found(dp, &grf_auxp, grfbusprint);
+		config_found(self, &grf_auxp, grfbusprint);
 	}
 }
 
 int
-grfbusprint(void *auxp, const char *name)
+grfbusprint(void *aux, const char *name)
 {
 
 	if (name == NULL)
--- a/sys/arch/atari/dev/grfvar.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/grfvar.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfvar.h,v 1.11.4.1 2011/03/05 20:49:42 rmind Exp $	*/
+/*	$NetBSD: grfvar.h,v 1.11.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -55,7 +55,7 @@
  * uses it... 
  */
 struct	grf_softc {
-	struct device	g_device;	/* config sets this up.		*/
+	device_t	g_device;	/* config sets this up.		*/
 	struct grfinfo	g_display;	/* hardware descr. (for ioctl)	*/
 	int		g_flags;	/* software flags		*/
 	int		g_unit;		/* grf unit we want/have	*/
--- a/sys/arch/atari/dev/hdfd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/hdfd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdfd.c,v 1.71.4.1 2010/05/30 05:16:39 rmind Exp $	*/
+/*	$NetBSD: hdfd.c,v 1.71.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1996 Leo Weppelman
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.71.4.1 2010/05/30 05:16:39 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.71.4.2 2011/06/12 00:23:54 rmind 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
--- a/sys/arch/atari/dev/ite.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/ite.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.66.4.3 2011/05/31 03:03:57 rmind Exp $	*/
+/*	$NetBSD: ite.c,v 1.66.4.4 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.66.4.3 2011/05/31 03:03:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.66.4.4 2011/06/12 00:23:54 rmind Exp $");
 
 #include "opt_ddb.h"
 
@@ -81,12 +81,12 @@
 
 #define ITEUNIT(dev)	(minor(dev))
 
-#define SUBR_INIT(ip)			(ip)->grf->g_iteinit(ip)
-#define SUBR_DEINIT(ip)			(ip)->grf->g_itedeinit(ip)
-#define SUBR_PUTC(ip,c,dy,dx,m)		(ip)->grf->g_iteputc(ip,c,dy,dx,m)
-#define SUBR_CURSOR(ip,flg)		(ip)->grf->g_itecursor(ip,flg)
-#define SUBR_CLEAR(ip,sy,sx,h,w)	(ip)->grf->g_iteclear(ip,sy,sx,h,w)
-#define SUBR_SCROLL(ip,sy,sx,cnt,dir)	(ip)->grf->g_itescroll(ip,sy,sx,cnt,dir)
+#define SUBR_INIT(sc)			(sc)->grf->g_iteinit(sc)
+#define SUBR_DEINIT(sc)			(sc)->grf->g_itedeinit(sc)
+#define SUBR_PUTC(sc,c,dy,dx,m)		(sc)->grf->g_iteputc(sc,c,dy,dx,m)
+#define SUBR_CURSOR(sc,flg)		(sc)->grf->g_itecursor(sc,flg)
+#define SUBR_CLEAR(sc,sy,sx,h,w)	(sc)->grf->g_iteclear(sc,sy,sx,h,w)
+#define SUBR_SCROLL(sc,sy,sx,cnt,dir)	(sc)->grf->g_itescroll(sc,sy,sx,cnt,dir)
 
 int	start_repeat_timeo = 30;	/* first repeat after x s/100 */
 int	next_repeat_timeo  = 10;	/* next repeat after x s/100 */
@@ -135,10 +135,10 @@
 static void	ite_switch(int);
 static void	repeat_handler(void *);
 
-void iteputchar(int c, struct ite_softc *ip);
+void iteputchar(int c, struct ite_softc *sc);
 void ite_putstr(const u_char * s, int len, dev_t dev);
-void iteattach(struct device *, struct device *, void *);
-int  itematch(struct device *, struct cfdata *, void *);
+void iteattach(device_t, device_t, void *);
+int  itematch(device_t, cfdata_t, void *);
 
 /*
  * Console specific types.
@@ -148,7 +148,7 @@
 dev_type_cngetc(itecngetc);
 dev_type_cnputc(itecnputc);
 
-CFATTACH_DECL(ite, sizeof(struct ite_softc),
+CFATTACH_DECL_NEW(ite, sizeof(struct ite_softc),
     itematch, iteattach, NULL, NULL);
 
 dev_type_open(iteopen);
@@ -171,7 +171,7 @@
 static int		cons_ite = -1;
 
 int
-itematch(struct device *pdp, struct cfdata *cfp, void *auxp)
+itematch(device_t parent, cfdata_t cf, void *aux)
 {
 	
 	/*
@@ -181,59 +181,59 @@
 	if (atari_realconfig == 0) {
 		if (cons_ite >= 0)
 			return 0;
-		cons_ite = cfp->cf_unit;
+		cons_ite = cf->cf_unit;
 		return 1;
 	}
 	return 1;
 }
 
 void
-iteattach(struct device *pdp, struct device *dp, void *auxp)
+iteattach(device_t parent, device_t self, void *aux)
 {
-	struct grf_softc	*gp;
-	struct ite_softc	*ip;
+	struct grf_softc	*gsc;
+	struct ite_softc	*sc;
 	int			s;
 	int			maj, unit;
 
-	gp = (struct grf_softc *)auxp;
-	ip = (struct ite_softc *)dp;
+	gsc = device_private(parent);
+	sc = device_private(self);
 
 	maj = cdevsw_lookup_major(&ite_cdevsw);
-	unit = (dp != NULL) ? device_unit(&ip->device) : cons_ite;
-	gp->g_itedev = makedev(maj, unit);
+	unit = (self != NULL) ? device_unit(self) : cons_ite;
+	gsc->g_itedev = makedev(maj, unit);
 
-	if (dp) {
+	if (self != NULL) {
 		s = spltty();
 		if (con_itesoftc.grf != NULL &&
-		    con_itesoftc.grf->g_unit == gp->g_unit) {
+		    con_itesoftc.grf->g_unit == gsc->g_unit) {
 			/*
 			 * console reinit copy params over.
 			 * and console always gets keyboard
 			 */
-			memcpy(&ip->grf, &con_itesoftc.grf,
-			    (char *)&ip[1] - (char *)&ip->grf);
+			memcpy(&sc->grf, &con_itesoftc.grf,
+			    (char *)&sc[1] - (char *)&sc->grf);
 			con_itesoftc.grf = NULL;
-			kbd_ite = ip;
+			kbd_ite = sc;
 		}
-		ip->grf = gp;
+		sc->grf = gsc;
 		splx(s);
 
-		iteinit(gp->g_itedev);
-		printf(": %dx%d", ip->rows, ip->cols);
+		iteinit(gsc->g_itedev);
+		printf(": %dx%d", sc->rows, sc->cols);
 		printf(" repeat at (%d/100)s next at (%d/100)s",
 		    start_repeat_timeo, next_repeat_timeo);
 
 		if (kbd_ite == NULL)
-			kbd_ite = ip;
-		if (kbd_ite == ip)
+			kbd_ite = sc;
+		if (kbd_ite == sc)
 			printf(" has keyboard");
 		printf("\n");
-		ip->flags |= ITE_ATTACHED;
+		sc->flags |= ITE_ATTACHED;
  	} else {
 		if (con_itesoftc.grf != NULL &&
-		    con_itesoftc.grf->g_conpri > gp->g_conpri)
+		    con_itesoftc.grf->g_conpri > gsc->g_conpri)
 			return;
-		con_itesoftc.grf = gp;
+		con_itesoftc.grf = gsc;
 		con_itesoftc.tabs = cons_tabs;
 	}
 }
@@ -276,12 +276,12 @@
 void
 itecninit(struct consdev *cd)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 
-	ip = getitesp(cd->cn_dev);
-	ip->flags |= ITE_ISCONS;
+	sc = getitesp(cd->cn_dev);
+	sc->flags |= ITE_ISCONS;
 	iteinit(cd->cn_dev);
-	ip->flags |= ITE_ACTIVE | ITE_ISCONS;
+	sc->flags |= ITE_ACTIVE | ITE_ISCONS;
 }
 
 /*
@@ -290,7 +290,7 @@
  * up this ite now that the system is more functional.
  */
 void
-ite_cnfinish(struct ite_softc *ip)
+ite_cnfinish(struct ite_softc *sc)
 {
 	static int done;
 
@@ -315,20 +315,20 @@
 itecnputc(dev_t dev, int c)
 {
 	static int paniced;
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 	char ch;
 
-	ip = getitesp(dev);
+	sc = getitesp(dev);
 	ch = c;
 
 	if (panicstr && !paniced &&
-	    (ip->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
+	    (sc->flags & (ITE_ACTIVE | ITE_INGRF)) != ITE_ACTIVE) {
 		ite_on(dev, 3);
 		paniced = 1;
 	}
-	SUBR_CURSOR(ip, START_CURSOROPT);
-	iteputchar(ch, ip);
-	SUBR_CURSOR(ip, END_CURSOROPT);
+	SUBR_CURSOR(sc, START_CURSOROPT);
+	iteputchar(ch, sc);
+	SUBR_CURSOR(sc, END_CURSOROPT);
 }
 
 /*
@@ -343,34 +343,34 @@
 void
 iteinit(dev_t dev)
 {
-	struct ite_softc	*ip;
+	struct ite_softc	*sc;
 
-	ip = getitesp(dev);
-	if (ip->flags & ITE_INITED)
+	sc = getitesp(dev);
+	if (sc->flags & ITE_INITED)
 		return;
 	if (atari_realconfig) {
-		if (ip->kbdmap && ip->kbdmap != &ascii_kbdmap)
-			free(ip->kbdmap, M_DEVBUF);
-		ip->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK);
-		memcpy(ip->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap));
+		if (sc->kbdmap && sc->kbdmap != &ascii_kbdmap)
+			free(sc->kbdmap, M_DEVBUF);
+		sc->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK);
+		memcpy(sc->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap));
 	}
 	else
-		ip->kbdmap = &ascii_kbdmap;
+		sc->kbdmap = &ascii_kbdmap;
 
-	ip->cursorx = 0;
-	ip->cursory = 0;
-	SUBR_INIT(ip);
-	SUBR_CURSOR(ip, DRAW_CURSOR);
-	if (ip->tabs == NULL)
-		ip->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK);
-	ite_reset(ip);
-	ip->flags |= ITE_INITED;
+	sc->cursorx = 0;
+	sc->cursory = 0;
+	SUBR_INIT(sc);
+	SUBR_CURSOR(sc, DRAW_CURSOR);
+	if (sc->tabs == NULL)
+		sc->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK);
+	ite_reset(sc);
+	sc->flags |= ITE_INITED;
 }
 
 int
 iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 	struct tty *tp;
 	int error, first, unit;
 
@@ -379,23 +379,23 @@
 		return ENXIO;
 
 	first = 0;
-	ip = getitesp(dev);
-	if (ip == NULL)
+	sc = getitesp(dev);
+	if (sc == NULL)
 		return ENXIO;
-	if ((ip->flags & ITE_ATTACHED) == 0)
+	if ((sc->flags & ITE_ATTACHED) == 0)
 		return (ENXIO);
 
-	if (ip->tp == NULL) {
-		tp = ip->tp = tty_alloc();
+	if (sc->tp == NULL) {
+		tp = sc->tp = tty_alloc();
 		tty_attach(tp);
 	}
 	else
-		tp = ip->tp;
+		tp = sc->tp;
 
 	if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
 		return (EBUSY);
 
-	if ((ip->flags & ITE_ACTIVE) == 0) {
+	if ((sc->flags & ITE_ACTIVE) == 0) {
 		ite_on(dev, 0);
 		first = 1;
 	}
@@ -422,8 +422,8 @@
 	if (error)
 		goto bad;
 
-	tp->t_winsize.ws_row = ip->rows;
-	tp->t_winsize.ws_col = ip->cols;
+	tp->t_winsize.ws_row = sc->rows;
+	tp->t_winsize.ws_col = sc->cols;
 	if (!kbd_init) {
 		kbd_init = 1;
 		kbdenable();
@@ -495,16 +495,16 @@
 iteioctl(dev_t dev, u_long cmd, void * addr, int flag, struct lwp *l)
 {
 	struct iterepeat	*irp;
-	struct ite_softc	*ip;
+	struct ite_softc	*sc;
 	struct tty		*tp;
 	view_t			*view;
 	struct itewinsize	*is;
 	struct itebell		*ib;
 	int error;
 	
-	ip   = getitesp(dev);
-	tp   = ip->tp;
-	view = viewview(ip->grf->g_viewdev);
+	sc   = getitesp(dev);
+	tp   = sc->tp;
+	view = viewview(sc->grf->g_viewdev);
 
 	KDASSERT(tp);
 
@@ -520,7 +520,7 @@
 	case ITEIOCSKMAP:
 		if (addr == NULL)
 			return(EFAULT);
-		memcpy(ip->kbdmap, addr, sizeof(struct kbdmap));
+		memcpy(sc->kbdmap, addr, sizeof(struct kbdmap));
 		return 0;
 	case ITEIOCSSKMAP:
 		if (addr == NULL)
@@ -530,7 +530,7 @@
 	case ITEIOCGKMAP:
 		if (addr == NULL)
 			return(EFAULT);
-		memcpy(addr, ip->kbdmap, sizeof(struct kbdmap));
+		memcpy(addr, sc->kbdmap, sizeof(struct kbdmap));
 		return 0;
 	case ITEIOCGREPT:
 		if (addr == NULL)
@@ -559,10 +559,10 @@
 		is->depth  = view->bitmap->depth;
 		return 0;
 	case ITEIOCDSPWIN:
-		ip->grf->g_mode(ip->grf, GM_GRFON, NULL, 0, 0);
+		sc->grf->g_mode(sc->grf, GM_GRFON, NULL, 0, 0);
 		return 0;
 	case ITEIOCREMWIN:
-		ip->grf->g_mode(ip->grf, GM_GRFOFF, NULL, 0, 0);
+		sc->grf->g_mode(sc->grf, GM_GRFOFF, NULL, 0, 0);
 		return 0;
 	case ITEIOCSBELL:
 		if (addr == NULL)
@@ -577,18 +577,18 @@
 		kbd_bell_gparms(&ib->volume, &ib->pitch, &ib->msec);
 		return 0;
 	}
-	return (ip->itexx_ioctl)(ip, cmd, addr, flag, l);
+	return (sc->itexx_ioctl)(sc, cmd, addr, flag, l);
 }
 
 void
 itestart(struct tty *tp)
 {
 	struct clist *rbp;
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 	u_char buf[ITEBURST];
 	int s, len;
 
-	ip = getitesp(tp->t_dev);
+	sc = getitesp(tp->t_dev);
 
 	KDASSERT(tp);
 
@@ -619,25 +619,25 @@
 void
 ite_on(dev_t dev, int flag)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 	int unit;
 
 	unit = ITEUNIT(dev);
-	ip = getitesp(dev); 
+	sc = getitesp(dev); 
 
 	/* force ite active, overriding graphics mode */
 	if (flag & 1) {
-		ip->flags |= ITE_ACTIVE;
-		ip->flags &= ~(ITE_INGRF | ITE_INITED);
+		sc->flags |= ITE_ACTIVE;
+		sc->flags &= ~(ITE_INGRF | ITE_INITED);
 	}
 	/* leave graphics mode */
 	if (flag & 2) {
-		ip->flags &= ~ITE_INGRF;
-		if ((ip->flags & ITE_ACTIVE) == 0)
+		sc->flags &= ~ITE_INGRF;
+		if ((sc->flags & ITE_ACTIVE) == 0)
 			return;
 	}
-	ip->flags |= ITE_ACTIVE;
-	if (ip->flags & ITE_INGRF)
+	sc->flags |= ITE_ACTIVE;
+	if (sc->flags & ITE_INGRF)
 		return;
 	iteinit(dev);
 }
@@ -645,46 +645,46 @@
 void
 ite_off(dev_t dev, int flag)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 
-	ip = getitesp(dev);
+	sc = getitesp(dev);
 	if (flag & 2)
-		ip->flags |= ITE_INGRF;
-	if ((ip->flags & ITE_ACTIVE) == 0)
+		sc->flags |= ITE_INGRF;
+	if ((sc->flags & ITE_ACTIVE) == 0)
 		return;
 	if ((flag & 1) ||
-	    (ip->flags & (ITE_INGRF | ITE_ISCONS | ITE_INITED)) == ITE_INITED)
-		SUBR_DEINIT(ip);
+	    (sc->flags & (ITE_INGRF | ITE_ISCONS | ITE_INITED)) == ITE_INITED)
+		SUBR_DEINIT(sc);
 	if ((flag & 2) == 0)	/* XXX hmm grfon() I think wants this to  go inactive. */
-		ip->flags &= ~ITE_ACTIVE;
+		sc->flags &= ~ITE_ACTIVE;
 }
 
 static void
 ite_switch(int unit)
 {
-	struct ite_softc	*ip;
+	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	ip = getitesp(unit);
-	if ((ip->flags & (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = getitesp(unit);
+	if ((sc->flags & (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*
 	 * If switching to an active ite, also switch the keyboard.
 	 */
-	if (ip->flags & ITE_ACTIVE)
-		kbd_ite = ip;
+	if (sc->flags & ITE_ACTIVE)
+		kbd_ite = sc;
 
 	/*
 	 * Now make it visible
 	 */
-	(*view_cdevsw.d_ioctl)(ip->grf->g_viewdev, VIOCDISPLAY, NULL,
+	(*view_cdevsw.d_ioctl)(sc->grf->g_viewdev, VIOCDISPLAY, NULL,
 			       0, NOLWP);
 
 	/*
 	 * Make sure the cursor's there too....
 	 */
-  	SUBR_CURSOR(ip, DRAW_CURSOR);
+  	SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 /* XXX called after changes made in underlying grf layer. */
@@ -692,10 +692,10 @@
 void
 ite_reinit(dev_t dev)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 
-	ip = getitesp(dev);
-	ip->flags &= ~ITE_INITED;
+	sc = getitesp(dev);
+	sc->flags &= ~ITE_INITED;
 	iteinit(dev);
 }
 
@@ -709,31 +709,31 @@
 }
 
 void
-ite_reset(struct ite_softc *ip)
+ite_reset(struct ite_softc *sc)
 {
 	int i;
 
-	ip->curx = 0;
-	ip->cury = 0;
-	ip->attribute = ATTR_NOR;
-	ip->save_curx = 0;
-	ip->save_cury = 0;
-	ip->save_attribute = ATTR_NOR;
-	ip->ap = ip->argbuf;
-	ip->emul_level = 0;
-	ip->eightbit_C1 = 0;
-	ip->top_margin = 0;
-	ip->bottom_margin = ip->rows - 1;
-	ip->inside_margins = 0;
-	ip->linefeed_newline = 0;
-	ip->auto_wrap = ite_default_wrap;
-	ip->cursor_appmode = 0;
-	ip->keypad_appmode = 0;
-	ip->imode = 0;
-	ip->key_repeat = 1;
-	memset(ip->tabs, 0, ip->cols);
-	for (i = 0; i < ip->cols; i++)
-		ip->tabs[i] = ((i & 7) == 0);
+	sc->curx = 0;
+	sc->cury = 0;
+	sc->attribute = ATTR_NOR;
+	sc->save_curx = 0;
+	sc->save_cury = 0;
+	sc->save_attribute = ATTR_NOR;
+	sc->ap = sc->argbuf;
+	sc->emul_level = 0;
+	sc->eightbit_C1 = 0;
+	sc->top_margin = 0;
+	sc->bottom_margin = sc->rows - 1;
+	sc->inside_margins = 0;
+	sc->linefeed_newline = 0;
+	sc->auto_wrap = ite_default_wrap;
+	sc->cursor_appmode = 0;
+	sc->keypad_appmode = 0;
+	sc->imode = 0;
+	sc->key_repeat = 1;
+	memset(sc->tabs, 0, sc->cols);
+	for (i = 0; i < sc->cols; i++)
+		sc->tabs[i] = ((i & 7) == 0);
 }
 
 /*
@@ -1071,210 +1071,210 @@
 }
 
 static void
-alignment_display(struct ite_softc *ip)
+alignment_display(struct ite_softc *sc)
 {
   int i, j;
 
-  for (j = 0; j < ip->rows; j++)
-    for (i = 0; i < ip->cols; i++)
-      SUBR_PUTC(ip, 'E', j, i, ATTR_NOR);
-  attrclr(ip, 0, 0, ip->rows, ip->cols);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  for (j = 0; j < sc->rows; j++)
+    for (i = 0; i < sc->cols; i++)
+      SUBR_PUTC(sc, 'E', j, i, ATTR_NOR);
+  attrclr(sc, 0, 0, sc->rows, sc->cols);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-snap_cury(struct ite_softc *ip)
+snap_cury(struct ite_softc *sc)
 {
-  if (ip->inside_margins)
+  if (sc->inside_margins)
     {
-      if (ip->cury < ip->top_margin)
-	ip->cury = ip->top_margin;
-      if (ip->cury > ip->bottom_margin)
-	ip->cury = ip->bottom_margin;
+      if (sc->cury < sc->top_margin)
+	sc->cury = sc->top_margin;
+      if (sc->cury > sc->bottom_margin)
+	sc->cury = sc->bottom_margin;
     }
 }
 
 static inline void
-ite_dnchar(struct ite_softc *ip, int n)
+ite_dnchar(struct ite_softc *sc, int n)
 {
-  n = min(n, ip->cols - ip->curx);
-  if (n < ip->cols - ip->curx)
+  n = min(n, sc->cols - sc->curx);
+  if (n < sc->cols - sc->curx)
     {
-      SUBR_SCROLL(ip, ip->cury, ip->curx + n, n, SCROLL_LEFT);
-      attrmov(ip, ip->cury, ip->curx + n, ip->cury, ip->curx,
-	      1, ip->cols - ip->curx - n);
-      attrclr(ip, ip->cury, ip->cols - n, 1, n);
+      SUBR_SCROLL(sc, sc->cury, sc->curx + n, n, SCROLL_LEFT);
+      attrmov(sc, sc->cury, sc->curx + n, sc->cury, sc->curx,
+	      1, sc->cols - sc->curx - n);
+      attrclr(sc, sc->cury, sc->cols - n, 1, n);
     }
   while (n-- > 0)
-    SUBR_PUTC(ip, ' ', ip->cury, ip->cols - n - 1, ATTR_NOR);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+    SUBR_PUTC(sc, ' ', sc->cury, sc->cols - n - 1, ATTR_NOR);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-ite_inchar(struct ite_softc *ip, int n)
+ite_inchar(struct ite_softc *sc, int n)
 {
-  n = min(n, ip->cols - ip->curx);
-  if (n < ip->cols - ip->curx)
+  n = min(n, sc->cols - sc->curx);
+  if (n < sc->cols - sc->curx)
     {
-      SUBR_SCROLL(ip, ip->cury, ip->curx, n, SCROLL_RIGHT);
-      attrmov(ip, ip->cury, ip->curx, ip->cury, ip->curx + n,
-	      1, ip->cols - ip->curx - n);
-      attrclr(ip, ip->cury, ip->curx, 1, n);
+      SUBR_SCROLL(sc, sc->cury, sc->curx, n, SCROLL_RIGHT);
+      attrmov(sc, sc->cury, sc->curx, sc->cury, sc->curx + n,
+	      1, sc->cols - sc->curx - n);
+      attrclr(sc, sc->cury, sc->curx, 1, n);
     }
   while (n--)
-    SUBR_PUTC(ip, ' ', ip->cury, ip->curx + n, ATTR_NOR);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+    SUBR_PUTC(sc, ' ', sc->cury, sc->curx + n, ATTR_NOR);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-ite_clrtoeol(struct ite_softc *ip)
+ite_clrtoeol(struct ite_softc *sc)
 {
-  int y = ip->cury, x = ip->curx;
-  if (ip->cols - x > 0)
+  int y = sc->cury, x = sc->curx;
+  if (sc->cols - x > 0)
     {
-      SUBR_CLEAR(ip, y, x, 1, ip->cols - x);
-      attrclr(ip, y, x, 1, ip->cols - x);
-      SUBR_CURSOR(ip, DRAW_CURSOR);
+      SUBR_CLEAR(sc, y, x, 1, sc->cols - x);
+      attrclr(sc, y, x, 1, sc->cols - x);
+      SUBR_CURSOR(sc, DRAW_CURSOR);
     }
 }
 
 static inline void
-ite_clrtobol(struct ite_softc *ip)
+ite_clrtobol(struct ite_softc *sc)
 {
-  int y = ip->cury, x = min(ip->curx + 1, ip->cols);
-  SUBR_CLEAR(ip, y, 0, 1, x);
-  attrclr(ip, y, 0, 1, x);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  int y = sc->cury, x = min(sc->curx + 1, sc->cols);
+  SUBR_CLEAR(sc, y, 0, 1, x);
+  attrclr(sc, y, 0, 1, x);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-ite_clrline(struct ite_softc *ip)
+ite_clrline(struct ite_softc *sc)
 {
-  int y = ip->cury;
-  SUBR_CLEAR(ip, y, 0, 1, ip->cols);
-  attrclr(ip, y, 0, 1, ip->cols);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  int y = sc->cury;
+  SUBR_CLEAR(sc, y, 0, 1, sc->cols);
+  attrclr(sc, y, 0, 1, sc->cols);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 
 
 static inline void
-ite_clrtoeos(struct ite_softc *ip)
+ite_clrtoeos(struct ite_softc *sc)
 {
-  ite_clrtoeol(ip);
-  if (ip->cury < ip->rows - 1)
+  ite_clrtoeol(sc);
+  if (sc->cury < sc->rows - 1)
     {
-      SUBR_CLEAR(ip, ip->cury + 1, 0, ip->rows - 1 - ip->cury, ip->cols);
-      attrclr(ip, ip->cury, 0, ip->rows - ip->cury, ip->cols);
-      SUBR_CURSOR(ip, DRAW_CURSOR);
+      SUBR_CLEAR(sc, sc->cury + 1, 0, sc->rows - 1 - sc->cury, sc->cols);
+      attrclr(sc, sc->cury, 0, sc->rows - sc->cury, sc->cols);
+      SUBR_CURSOR(sc, DRAW_CURSOR);
     }
 }
 
 static inline void
-ite_clrtobos(struct ite_softc *ip)
+ite_clrtobos(struct ite_softc *sc)
 {
-  ite_clrtobol(ip);
-  if (ip->cury > 0)
+  ite_clrtobol(sc);
+  if (sc->cury > 0)
     {
-      SUBR_CLEAR(ip, 0, 0, ip->cury, ip->cols);
-      attrclr(ip, 0, 0, ip->cury, ip->cols);
-      SUBR_CURSOR(ip, DRAW_CURSOR);
+      SUBR_CLEAR(sc, 0, 0, sc->cury, sc->cols);
+      attrclr(sc, 0, 0, sc->cury, sc->cols);
+      SUBR_CURSOR(sc, DRAW_CURSOR);
     }
 }
 
 static inline void
-ite_clrscreen(struct ite_softc *ip)
+ite_clrscreen(struct ite_softc *sc)
 {
-  SUBR_CLEAR(ip, 0, 0, ip->rows, ip->cols);
-  attrclr(ip, 0, 0, ip->rows, ip->cols);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  SUBR_CLEAR(sc, 0, 0, sc->rows, sc->cols);
+  attrclr(sc, 0, 0, sc->rows, sc->cols);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 
 
 static inline void
-ite_dnline(struct ite_softc *ip, int n)
+ite_dnline(struct ite_softc *sc, int n)
 {
   /* interesting.. if the cursor is outside the scrolling
      region, this command is simply ignored.. */
-  if (ip->cury < ip->top_margin || ip->cury > ip->bottom_margin)
+  if (sc->cury < sc->top_margin || sc->cury > sc->bottom_margin)
     return;
 
-  n = min(n, ip->bottom_margin + 1 - ip->cury);
-  if (n <= ip->bottom_margin - ip->cury)
+  n = min(n, sc->bottom_margin + 1 - sc->cury);
+  if (n <= sc->bottom_margin - sc->cury)
     {
-      SUBR_SCROLL(ip, ip->cury + n, 0, n, SCROLL_UP);
-      attrmov(ip, ip->cury + n, 0, ip->cury, 0,
-	      ip->bottom_margin + 1 - ip->cury - n, ip->cols);
+      SUBR_SCROLL(sc, sc->cury + n, 0, n, SCROLL_UP);
+      attrmov(sc, sc->cury + n, 0, sc->cury, 0,
+	      sc->bottom_margin + 1 - sc->cury - n, sc->cols);
     }
-  SUBR_CLEAR(ip, ip->bottom_margin - n + 1, 0, n, ip->cols);
-  attrclr(ip, ip->bottom_margin - n + 1, 0, n, ip->cols);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  SUBR_CLEAR(sc, sc->bottom_margin - n + 1, 0, n, sc->cols);
+  attrclr(sc, sc->bottom_margin - n + 1, 0, n, sc->cols);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-ite_inline(struct ite_softc *ip, int n)
+ite_inline(struct ite_softc *sc, int n)
 {
   /* interesting.. if the cursor is outside the scrolling
      region, this command is simply ignored.. */
-  if (ip->cury < ip->top_margin || ip->cury > ip->bottom_margin)
+  if (sc->cury < sc->top_margin || sc->cury > sc->bottom_margin)
     return;
 
-  n = min(n, ip->bottom_margin + 1 - ip->cury);
-  if (n <= ip->bottom_margin - ip->cury)
+  n = min(n, sc->bottom_margin + 1 - sc->cury);
+  if (n <= sc->bottom_margin - sc->cury)
     {
-      SUBR_SCROLL(ip, ip->cury, 0, n, SCROLL_DOWN);
-      attrmov(ip, ip->cury, 0, ip->cury + n, 0,
-	      ip->bottom_margin + 1 - ip->cury - n, ip->cols);
+      SUBR_SCROLL(sc, sc->cury, 0, n, SCROLL_DOWN);
+      attrmov(sc, sc->cury, 0, sc->cury + n, 0,
+	      sc->bottom_margin + 1 - sc->cury - n, sc->cols);
     }
-  SUBR_CLEAR(ip, ip->cury, 0, n, ip->cols);
-  attrclr(ip, ip->cury, 0, n, ip->cols);
-  SUBR_CURSOR(ip, DRAW_CURSOR);
+  SUBR_CLEAR(sc, sc->cury, 0, n, sc->cols);
+  attrclr(sc, sc->cury, 0, n, sc->cols);
+  SUBR_CURSOR(sc, DRAW_CURSOR);
 }
 
 static inline void
-ite_lf (struct ite_softc *ip)
+ite_lf (struct ite_softc *sc)
 {
-  ++ip->cury;
-  if ((ip->cury == ip->bottom_margin+1) || (ip->cury == ip->rows))
+  ++sc->cury;
+  if ((sc->cury == sc->bottom_margin+1) || (sc->cury == sc->rows))
     {
-      ip->cury--;
-      SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP);
-      ite_clrline(ip);
+      sc->cury--;
+      SUBR_SCROLL(sc, sc->top_margin + 1, 0, 1, SCROLL_UP);
+      ite_clrline(sc);
     }
-  SUBR_CURSOR(ip, MOVE_CURSOR);
-  clr_attr(ip, ATTR_INV);
+  SUBR_CURSOR(sc, MOVE_CURSOR);
+  clr_attr(sc, ATTR_INV);
 }
 
 static inline void
-ite_crlf (struct ite_softc *ip)
+ite_crlf (struct ite_softc *sc)
 {
-  ip->curx = 0;
-  ite_lf (ip);
+  sc->curx = 0;
+  ite_lf (sc);
 }
 
 static inline void
-ite_cr (struct ite_softc *ip)
+ite_cr (struct ite_softc *sc)
 {
-  if (ip->curx)
+  if (sc->curx)
     {
-      ip->curx = 0;
-      SUBR_CURSOR(ip, MOVE_CURSOR);
+      sc->curx = 0;
+      SUBR_CURSOR(sc, MOVE_CURSOR);
     }
 }
 
 static inline void
-ite_rlf (struct ite_softc *ip)
+ite_rlf (struct ite_softc *sc)
 {
-  ip->cury--;
-  if ((ip->cury < 0) || (ip->cury == ip->top_margin - 1))
+  sc->cury--;
+  if ((sc->cury < 0) || (sc->cury == sc->top_margin - 1))
     {
-      ip->cury++;
-      SUBR_SCROLL(ip, ip->top_margin, 0, 1, SCROLL_DOWN);
-      ite_clrline(ip);
+      sc->cury++;
+      SUBR_SCROLL(sc, sc->top_margin, 0, 1, SCROLL_DOWN);
+      ite_clrline(sc);
     }
-  SUBR_CURSOR(ip, MOVE_CURSOR);
-  clr_attr(ip, ATTR_INV);
+  SUBR_CURSOR(sc, MOVE_CURSOR);
+  clr_attr(sc, ATTR_INV);
 }
 
 static inline int
@@ -1289,35 +1289,35 @@
 }
 
 static inline int
-ite_argnum (struct ite_softc *ip)
+ite_argnum (struct ite_softc *sc)
 {
   char ch;
   int n;
 
   /* convert argument string into number */
-  if (ip->ap == ip->argbuf)
+  if (sc->ap == sc->argbuf)
     return 1;
-  ch = *ip->ap;
-  *ip->ap = 0;
-  n = atoi (ip->argbuf);
-  *ip->ap = ch;
+  ch = *sc->ap;
+  *sc->ap = 0;
+  n = atoi (sc->argbuf);
+  *sc->ap = ch;
   
   return n;
 }
 
 static inline int
-ite_zargnum (struct ite_softc *ip)
+ite_zargnum (struct ite_softc *sc)
 {
   char ch;
   int n;
 
   /* convert argument string into number */
-  if (ip->ap == ip->argbuf)
+  if (sc->ap == sc->argbuf)
     return 0;
-  ch = *ip->ap;
-  *ip->ap = 0;
-  n = atoi (ip->argbuf);
-  *ip->ap = ch;
+  ch = *sc->ap;
+  *sc->ap = 0;
+  n = atoi (sc->argbuf);
+  *sc->ap = ch;
   
   return n;	/* don't "n ? n : 1" here, <CSI>0m != <CSI>1m ! */
 }
@@ -1325,25 +1325,25 @@
 void
 ite_putstr(const u_char *s, int len, dev_t dev)
 {
-	struct ite_softc *ip;
+	struct ite_softc *sc;
 	int i;
 	
-	ip = getitesp(dev);
+	sc = getitesp(dev);
 
 	/* XXX avoid problems */
-	if ((ip->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE)
+	if ((sc->flags & (ITE_ACTIVE|ITE_INGRF)) != ITE_ACTIVE)
 	  	return;
 
-	SUBR_CURSOR(ip, START_CURSOROPT);
+	SUBR_CURSOR(sc, START_CURSOROPT);
 	for (i = 0; i < len; i++)
 		if (s[i])
-			iteputchar(s[i], ip);
-	SUBR_CURSOR(ip, END_CURSOROPT);
+			iteputchar(s[i], sc);
+	SUBR_CURSOR(sc, END_CURSOROPT);
 }
 
 
 void
-iteputchar(register int c, struct ite_softc *ip)
+iteputchar(register int c, struct ite_softc *sc)
 {
 	struct tty *kbd_tty;
 	int n, x, y;
@@ -1354,9 +1354,9 @@
 	else
 		kbd_tty = kbd_ite->tp;
 
-	if (ip->escape) 
+	if (sc->escape) 
 	  {
-	    switch (ip->escape) 
+	    switch (sc->escape) 
 	      {
 	      case ESC:
 	        switch (c)
@@ -1365,69 +1365,69 @@
 		  
 	          case 'D':
 		    c = IND;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break; /* and fall into the next switch below (same for all `break') */
 		    
 		  case 'E':
 		    c = NEL;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case 'H':
 		    c = HTS;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case 'M':
 		    c = RI;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case 'N':
 		    c = SS2;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		  
 		  case 'O':
 		    c = SS3;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case 'P':
 		    c = DCS;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case '[':
 		    c = CSI;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case '\\':
 		    c = ST;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case ']':
 		    c = OSC;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case '^':
 		    c = PM;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 		    
 		  case '_':
 		    c = APC;
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    break;
 
 
 		  /* introduces 7/8bit control */
 		  case ' ':
 		     /* can be followed by either F or G */
-		     ip->escape = ' ';
+		     sc->escape = ' ';
 		     break;
 
 		  
@@ -1435,7 +1435,7 @@
 		     94-character sets: */
 		  case '(':	/* G0 */
 		  case ')':	/* G1 */
-		    ip->escape = c;
+		    sc->escape = c;
 		    return;
 
 		  case '*':	/* G2 */
@@ -1461,88 +1461,88 @@
 		  case '6':	/* norwegian/danish */
 		  /* note: %5 and %6 are not supported (two chars..) */
 		    
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    /* just ignore for now */
 		    return;
 		    
 		  
 		  /* locking shift modes (as you might guess, not yet supported..) */
 		  case '`':
-		    ip->GR = ip->G1;
-		    ip->escape = 0;
+		    sc->GR = sc->G1;
+		    sc->escape = 0;
 		    return;
 		    
 		  case 'n':
-		    ip->GL = ip->G2;
-		    ip->escape = 0;
+		    sc->GL = sc->G2;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '}':
-		    ip->GR = ip->G2;
-		    ip->escape = 0;
+		    sc->GR = sc->G2;
+		    sc->escape = 0;
 		    return;
 		    
 		  case 'o':
-		    ip->GL = ip->G3;
-		    ip->escape = 0;
+		    sc->GL = sc->G3;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '|':
-		    ip->GR = ip->G3;
-		    ip->escape = 0;
+		    sc->GR = sc->G3;
+		    sc->escape = 0;
 		    return;
 		    
 		  
 		  /* font width/height control */
 		  case '#':
-		    ip->escape = '#';
+		    sc->escape = '#';
 		    return;
 		    
 		    
 		  /* hard terminal reset .. */
 		  case 'c':
-		    ite_reset (ip);
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    ip->escape = 0;
+		    ite_reset (sc);
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    sc->escape = 0;
 		    return;
 
 
 		  case '7':
-		    ip->save_curx = ip->curx;
-		    ip->save_cury = ip->cury;
-		    ip->save_attribute = ip->attribute;
-		    ip->escape = 0;
+		    sc->save_curx = sc->curx;
+		    sc->save_cury = sc->cury;
+		    sc->save_attribute = sc->attribute;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '8':
-		    ip->curx = ip->save_curx;
-		    ip->cury = ip->save_cury;
-		    ip->attribute = ip->save_attribute;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    ip->escape = 0;
+		    sc->curx = sc->save_curx;
+		    sc->cury = sc->save_cury;
+		    sc->attribute = sc->save_attribute;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    sc->escape = 0;
 		    return;
 		    
 		  case '=':
-		    ip->keypad_appmode = 1;
-		    ip->escape = 0;
+		    sc->keypad_appmode = 1;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '>':
-		    ip->keypad_appmode = 0;
-		    ip->escape = 0;
+		    sc->keypad_appmode = 0;
+		    sc->escape = 0;
 		    return;
 		  
 		  case 'Z':	/* request ID */
-		    if (ip->emul_level == EMUL_VT100)
+		    if (sc->emul_level == EMUL_VT100)
 		      ite_sendstr ("\033[?61;0c"); /* XXX not clean */
 		    else
 		      ite_sendstr ("\033[?63;0c"); /* XXX not clean */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 		  /* default catch all for not recognized ESC sequences */
 		  default:
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		  }
 		break;
@@ -1550,7 +1550,7 @@
 
 	      case '(':
 	      case ')':
-		ip->escape = 0;
+		sc->escape = 0;
 		return;
 
 
@@ -1558,18 +1558,18 @@
 	        switch (c)
 	          {
 	          case 'F':
-		    ip->eightbit_C1 = 0;
-		    ip->escape = 0;
+		    sc->eightbit_C1 = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  case 'G':
-		    ip->eightbit_C1 = 1;
-		    ip->escape = 0;
+		    sc->eightbit_C1 = 1;
+		    sc->escape = 0;
 		    return;
 		    
 		  default:
 		    /* not supported */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		  }
 		break;
@@ -1580,32 +1580,32 @@
 		  {
 		  case '5':
 		    /* single height, single width */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '6':
 		    /* double width, single height */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '3':
 		    /* top half */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '4':
 		    /* bottom half */
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  case '8':
 		    /* screen alignment pattern... */
-		    alignment_display (ip);
-		    ip->escape = 0;
+		    alignment_display (sc);
+		    sc->escape = 0;
 		    return;
 		    
 		  default:
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		  }
 		break;
@@ -1619,78 +1619,78 @@
 	          case '0': case '1': case '2': case '3': case '4':
 	          case '5': case '6': case '7': case '8': case '9':
 	          case ';': case '\"': case '$': case '>':
-	            if (ip->ap < ip->argbuf + MAX_ARGSIZE)
-	              *ip->ap++ = c;
+	            if (sc->ap < sc->argbuf + MAX_ARGSIZE)
+	              *sc->ap++ = c;
 	            return;
 
 		  case BS:
 		    /* you wouldn't believe such perversion is possible?
 		       it is.. BS is allowed in between cursor sequences
 		       (at least), according to vttest.. */
-		    if (--ip->curx < 0)
-		      ip->curx = 0;
+		    if (--sc->curx < 0)
+		      sc->curx = 0;
 		    else
-		      SUBR_CURSOR(ip, MOVE_CURSOR);
+		      SUBR_CURSOR(sc, MOVE_CURSOR);
 		    break;
 
 	          case 'p':
-		    *ip->ap = 0;
-	            if (! strncmp (ip->argbuf, "61\"", 3))
-	              ip->emul_level = EMUL_VT100;
-	            else if (! strncmp (ip->argbuf, "63;1\"", 5)
-	            	     || ! strncmp (ip->argbuf, "62;1\"", 5))
-	              ip->emul_level = EMUL_VT300_7;
+		    *sc->ap = 0;
+	            if (! strncmp (sc->argbuf, "61\"", 3))
+	              sc->emul_level = EMUL_VT100;
+	            else if (! strncmp (sc->argbuf, "63;1\"", 5)
+	            	     || ! strncmp (sc->argbuf, "62;1\"", 5))
+	              sc->emul_level = EMUL_VT300_7;
 	            else
-	              ip->emul_level = EMUL_VT300_8;
-	            ip->escape = 0;
+	              sc->emul_level = EMUL_VT300_8;
+	            sc->escape = 0;
 	            return;
 	            
 	          
 	          case '?':
-		    *ip->ap = 0;
-	            ip->escape = '?';
-	            ip->ap = ip->argbuf;
+		    *sc->ap = 0;
+	            sc->escape = '?';
+	            sc->ap = sc->argbuf;
 	            return;
 
 
 		  case 'c':
-  		    *ip->ap = 0;
-		    if (ip->argbuf[0] == '>')
+  		    *sc->ap = 0;
+		    if (sc->argbuf[0] == '>')
 		      {
 		        ite_sendstr ("\033[>24;0;0;0c");
 		      }
-		    else switch (ite_zargnum(ip))
+		    else switch (ite_zargnum(sc))
 		      {
 		      case 0:
 			/* primary DA request, send primary DA response */
-			if (ip->emul_level == EMUL_VT100)
+			if (sc->emul_level == EMUL_VT100)
 		          ite_sendstr ("\033[?1;1c");
 		        else
 		          ite_sendstr ("\033[?63;1c");
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 		  case 'n':
-		    switch (ite_zargnum(ip))
+		    switch (ite_zargnum(sc))
 		      {
 		      case 5:
 		        ite_sendstr ("\033[0n");	/* no malfunction */
 			break;
 		      case 6:
 			/* cursor position report */
-		        sprintf (ip->argbuf, "\033[%d;%dR", 
-				 ip->cury + 1, ip->curx + 1);
-			ite_sendstr (ip->argbuf);
+		        sprintf (sc->argbuf, "\033[%d;%dR", 
+				 sc->cury + 1, sc->curx + 1);
+			ite_sendstr (sc->argbuf);
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 	          
   
 		  case 'x':
-		    switch (ite_zargnum(ip))
+		    switch (ite_zargnum(sc))
 		      {
 		      case 0:
 			/* Fake some terminal parameters.  */
@@ -1700,62 +1700,62 @@
 		        ite_sendstr ("\033[3;1;1;112;112;1;0x");
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 
 		  case 'g':
-		    switch (ite_zargnum(ip))
+		    switch (ite_zargnum(sc))
 		      {
 		      case 0:
-			if (ip->curx < ip->cols)
-			  ip->tabs[ip->curx] = 0;
+			if (sc->curx < sc->cols)
+			  sc->tabs[sc->curx] = 0;
 			break;
 		      case 3:
-		        for (n = 0; n < ip->cols; n++)
-		          ip->tabs[n] = 0;
+		        for (n = 0; n < sc->cols; n++)
+		          sc->tabs[n] = 0;
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 	          
   	          case 'h': case 'l':
-		    n = ite_zargnum (ip);
+		    n = ite_zargnum (sc);
 		    switch (n)
 		      {
 		      case 4:
-		        ip->imode = (c == 'h');	/* insert/replace mode */
+		        sc->imode = (c == 'h');	/* insert/replace mode */
 			break;
 		      case 20:
-			ip->linefeed_newline = (c == 'h');
+			sc->linefeed_newline = (c == 'h');
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 
 		  case 'M':
-		    ite_dnline (ip, ite_argnum (ip));
-	            ip->escape = 0;
+		    ite_dnline (sc, ite_argnum (sc));
+	            sc->escape = 0;
 	            return;
 
 		  
 		  case 'L':
-		    ite_inline (ip, ite_argnum (ip));
-	            ip->escape = 0;
+		    ite_inline (sc, ite_argnum (sc));
+	            sc->escape = 0;
 	            return;
 
 
 		  case 'P':
-		    ite_dnchar (ip, ite_argnum (ip));
-	            ip->escape = 0;
+		    ite_dnchar (sc, ite_argnum (sc));
+	            sc->escape = 0;
 	            return;
 		    
 
 		  case '@':
-		    ite_inchar (ip, ite_argnum (ip));
-	            ip->escape = 0;
+		    ite_inchar (sc, ite_argnum (sc));
+	            sc->escape = 0;
 	            return;
 
 
@@ -1763,177 +1763,177 @@
 		    /* this one was *not* in my vt320 manual but in 
 		       a vt320 termcap entry.. who is right?
 		       It's supposed to set the horizontal cursor position. */
-		    *ip->ap = 0;
-		    x = atoi (ip->argbuf);
+		    *sc->ap = 0;
+		    x = atoi (sc->argbuf);
 		    if (x) x--;
-		    ip->curx = min(x, ip->cols - 1);
-		    ip->escape = 0;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		    sc->curx = min(x, sc->cols - 1);
+		    sc->escape = 0;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 
 
 		  case 'd':
 		    /* same thing here, this one's for setting the absolute
 		       vertical cursor position. Not documented... */
-		    *ip->ap = 0;
-		    y = atoi (ip->argbuf);
+		    *sc->ap = 0;
+		    y = atoi (sc->argbuf);
 		    if (y) y--;
-		    if (ip->inside_margins)
-		      y += ip->top_margin;
-		    ip->cury = min(y, ip->rows - 1);
-		    ip->escape = 0;
-		    snap_cury(ip);
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		    if (sc->inside_margins)
+		      y += sc->top_margin;
+		    sc->cury = min(y, sc->rows - 1);
+		    sc->escape = 0;
+		    snap_cury(sc);
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 
 
 		  case 'H':
 		  case 'f':
-		    *ip->ap = 0;
-		    y = atoi (ip->argbuf);
+		    *sc->ap = 0;
+		    y = atoi (sc->argbuf);
 		    x = 0;
-		    cp = strchr(ip->argbuf, ';');
+		    cp = strchr(sc->argbuf, ';');
 		    if (cp)
 		      x = atoi (cp + 1);
 		    if (x) x--;
 		    if (y) y--;
-		    if (ip->inside_margins)
-		      y += ip->top_margin;
-		    ip->cury = min(y, ip->rows - 1);
-		    ip->curx = min(x, ip->cols - 1);
-		    ip->escape = 0;
-		    snap_cury(ip);
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		    if (sc->inside_margins)
+		      y += sc->top_margin;
+		    sc->cury = min(y, sc->rows - 1);
+		    sc->curx = min(x, sc->cols - 1);
+		    sc->escape = 0;
+		    snap_cury(sc);
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 		    
 		  case 'A':		    
-		    n = ite_argnum (ip);
-		    n = ip->cury - (n ? n : 1);
+		    n = ite_argnum (sc);
+		    n = sc->cury - (n ? n : 1);
 		    if (n < 0) n = 0;
-		    if (ip->inside_margins)
-		      n = max(ip->top_margin, n);
-		    else if (n == ip->top_margin - 1)
+		    if (sc->inside_margins)
+		      n = max(sc->top_margin, n);
+		    else if (n == sc->top_margin - 1)
 		      /* allow scrolling outside region, but don't scroll out
 			 of active region without explicit CUP */
-		      n = ip->top_margin;
-		    ip->cury = n;
-		    ip->escape = 0;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		      n = sc->top_margin;
+		    sc->cury = n;
+		    sc->escape = 0;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 		  
 		  case 'B':
-		    n = ite_argnum (ip);
-		    n = ip->cury + (n ? n : 1);
-		    n = min(ip->rows - 1, n);
-		    if (ip->inside_margins)
-		      n = min(ip->bottom_margin, n);
-		    else if (n == ip->bottom_margin + 1)
+		    n = ite_argnum (sc);
+		    n = sc->cury + (n ? n : 1);
+		    n = min(sc->rows - 1, n);
+		    if (sc->inside_margins)
+		      n = min(sc->bottom_margin, n);
+		    else if (n == sc->bottom_margin + 1)
 		      /* allow scrolling outside region, but don't scroll out
 			 of active region without explicit CUP */
-		      n = ip->bottom_margin;
-		    ip->cury = n;
-		    ip->escape = 0;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		      n = sc->bottom_margin;
+		    sc->cury = n;
+		    sc->escape = 0;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 		  
 		  case 'C':
-		    n = ite_argnum (ip);
+		    n = ite_argnum (sc);
 		    n = n ? n : 1;
-		    ip->curx = min(ip->curx + n, ip->cols - 1);
-		    ip->escape = 0;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		    sc->curx = min(sc->curx + n, sc->cols - 1);
+		    sc->escape = 0;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 		  
 		  case 'D':
-		    n = ite_argnum (ip);
+		    n = ite_argnum (sc);
 		    n = n ? n : 1;
-		    n = ip->curx - n;
-		    ip->curx = n >= 0 ? n : 0;
-		    ip->escape = 0;
-		    SUBR_CURSOR(ip, MOVE_CURSOR);
-		    clr_attr (ip, ATTR_INV);
+		    n = sc->curx - n;
+		    sc->curx = n >= 0 ? n : 0;
+		    sc->escape = 0;
+		    SUBR_CURSOR(sc, MOVE_CURSOR);
+		    clr_attr (sc, ATTR_INV);
 		    return;
 		  
 		    
 
 
 		  case 'J':
-		    *ip->ap = 0;
-		    n = ite_zargnum (ip);
+		    *sc->ap = 0;
+		    n = ite_zargnum (sc);
 		    if (n == 0)
-	              ite_clrtoeos(ip);
+	              ite_clrtoeos(sc);
 		    else if (n == 1)
-		      ite_clrtobos(ip);
+		      ite_clrtobos(sc);
 		    else if (n == 2)
-		      ite_clrscreen(ip);
-	            ip->escape = 0;
+		      ite_clrscreen(sc);
+	            sc->escape = 0;
 	            return;
 
 
 		  case 'K':
-		    n = ite_zargnum (ip);
+		    n = ite_zargnum (sc);
 		    if (n == 0)
-		      ite_clrtoeol(ip);
+		      ite_clrtoeol(sc);
 		    else if (n == 1)
-		      ite_clrtobol(ip);
+		      ite_clrtobol(sc);
 		    else if (n == 2)
-		      ite_clrline(ip);
-		    ip->escape = 0;
+		      ite_clrline(sc);
+		    sc->escape = 0;
 		    return;
 
 
 		  case 'X':
-		    n = ite_argnum(ip) - 1;
-		    n = min(n, ip->cols - 1 - ip->curx);
+		    n = ite_argnum(sc) - 1;
+		    n = min(n, sc->cols - 1 - sc->curx);
 		    for (; n >= 0; n--)
 		      {
-			attrclr(ip, ip->cury, ip->curx + n, 1, 1);
-			SUBR_PUTC(ip, ' ', ip->cury, ip->curx + n, ATTR_NOR);
+			attrclr(sc, sc->cury, sc->curx + n, 1, 1);
+			SUBR_PUTC(sc, ' ', sc->cury, sc->curx + n, ATTR_NOR);
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 	          
 	          case '}': case '`':
 	            /* status line control */
-	            ip->escape = 0;
+	            sc->escape = 0;
 	            return;
 
 
 		  case 'r':
-		    *ip->ap = 0;
-		    x = atoi (ip->argbuf);
+		    *sc->ap = 0;
+		    x = atoi (sc->argbuf);
 		    x = x ? x : 1;
-		    y = ip->rows;
-		    cp = strchr(ip->argbuf, ';');
+		    y = sc->rows;
+		    cp = strchr(sc->argbuf, ';');
 		    if (cp)
 		      {
 			y = atoi (cp + 1);
-			y = y ? y : ip->rows;
+			y = y ? y : sc->rows;
 		      }
 		    if (y - x < 2)
 		      {
 			/* if illegal scrolling region, reset to defaults */
 			x = 1;
-			y = ip->rows;
+			y = sc->rows;
 		      }
 		    x--;
 		    y--;
-		    ip->top_margin = min(x, ip->rows - 1);
-		    ip->bottom_margin = min(y, ip->rows - 1);
-		    if (ip->inside_margins)
+		    sc->top_margin = min(x, sc->rows - 1);
+		    sc->bottom_margin = min(y, sc->rows - 1);
+		    if (sc->inside_margins)
 		      {
-			ip->cury = ip->top_margin;
-			ip->curx = 0;
-			SUBR_CURSOR(ip, MOVE_CURSOR);
+			sc->cury = sc->top_margin;
+			sc->curx = 0;
+			SUBR_CURSOR(sc, MOVE_CURSOR);
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  
@@ -1941,22 +1941,22 @@
 		    /* big attribute setter/resetter */
 		    {
 		      char *chp;
-		      *ip->ap = 0;
+		      *sc->ap = 0;
 		      /* kludge to make CSIm work (== CSI0m) */
-		      if (ip->ap == ip->argbuf)
-		        ip->ap++;
-		      for (chp = ip->argbuf; chp < ip->ap; )
+		      if (sc->ap == sc->argbuf)
+		        sc->ap++;
+		      for (chp = sc->argbuf; chp < sc->ap; )
 		        {
 			  switch (*chp)
 			    {
 			    case 0:
 			    case '0':
-			      clr_attr (ip, ATTR_ALL);
+			      clr_attr (sc, ATTR_ALL);
 			      chp++;
 			      break;
 			      
 			    case '1':
-			      set_attr (ip, ATTR_BOLD);
+			      set_attr (sc, ATTR_BOLD);
 			      chp++;
 			      break;
 			      
@@ -1964,22 +1964,22 @@
 			      switch (chp[1])
 			        {
 			        case '2':
-			          clr_attr (ip, ATTR_BOLD);
+			          clr_attr (sc, ATTR_BOLD);
 			          chp += 2;
 			          break;
 			        
 			        case '4':
-			          clr_attr (ip, ATTR_UL);
+			          clr_attr (sc, ATTR_UL);
 			          chp += 2;
 			          break;
 			          
 			        case '5':
-			          clr_attr (ip, ATTR_BLINK);
+			          clr_attr (sc, ATTR_BLINK);
 			          chp += 2;
 			          break;
 			          
 			        case '7':
-			          clr_attr (ip, ATTR_INV);
+			          clr_attr (sc, ATTR_INV);
 			          chp += 2;
 			          break;
 		        	
@@ -1990,17 +1990,17 @@
 			      break;
 			      
 			    case '4':
-			      set_attr (ip, ATTR_UL);
+			      set_attr (sc, ATTR_UL);
 			      chp++;
 			      break;
 			      
 			    case '5':
-			      set_attr (ip, ATTR_BLINK);
+			      set_attr (sc, ATTR_BLINK);
 			      chp++;
 			      break;
 			      
 			    case '7':
-			      set_attr (ip, ATTR_INV);
+			      set_attr (sc, ATTR_INV);
 			      chp++;
 			      break;
 			    
@@ -2011,20 +2011,20 @@
 		        }
 		    
 		    }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 
 		  case 'u':
 		    /* DECRQTSR */
 		    ite_sendstr ("\033P\033\\");
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 		  
 		  
 		  default:
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		  }
 		break;
@@ -2039,37 +2039,37 @@
 	          case ';': case '\"': case '$':
 		    /* Don't fill the last character; it's needed.  */
 		    /* XXX yeah, where ?? */
-	            if (ip->ap < ip->argbuf + MAX_ARGSIZE - 1)
-	              *ip->ap++ = c;
+	            if (sc->ap < sc->argbuf + MAX_ARGSIZE - 1)
+	              *sc->ap++ = c;
 	            return;
 
 
 		  case 'n':
-		    *ip->ap = 0;
-		    if (ip->ap == &ip->argbuf[2])
+		    *sc->ap = 0;
+		    if (sc->ap == &sc->argbuf[2])
 		      {
-		        if (! strncmp (ip->argbuf, "15", 2))
+		        if (! strncmp (sc->argbuf, "15", 2))
 		          /* printer status: no printer */
 		          ite_sendstr ("\033[13n");
 		          
-		        else if (! strncmp (ip->argbuf, "25", 2))
+		        else if (! strncmp (sc->argbuf, "25", 2))
 		          /* udk status */
 		          ite_sendstr ("\033[20n");
 		          
-		        else if (! strncmp (ip->argbuf, "26", 2))
+		        else if (! strncmp (sc->argbuf, "26", 2))
 		          /* keyboard dialect: US */
 		          ite_sendstr ("\033[27;1n");
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 
 
   		  case 'h': case 'l':
-		    n = ite_zargnum (ip);
+		    n = ite_zargnum (sc);
 		    switch (n)
 		      {
 		      case 1:
-		        ip->cursor_appmode = (c == 'h');
+		        sc->cursor_appmode = (c == 'h');
 		        break;
 
 		      case 3:
@@ -2084,40 +2084,40 @@
 		        break;
 
 		      case 6: /* origin mode */
-			ip->inside_margins = (c == 'h');
-			ip->curx = 0;
-			ip->cury = ip->inside_margins ? ip->top_margin : 0;
-			SUBR_CURSOR(ip, MOVE_CURSOR);
+			sc->inside_margins = (c == 'h');
+			sc->curx = 0;
+			sc->cury = sc->inside_margins ? sc->top_margin : 0;
+			SUBR_CURSOR(sc, MOVE_CURSOR);
 			break;
 
 		      case 7: /* auto wraparound */
-			ip->auto_wrap = (c == 'h');
+			sc->auto_wrap = (c == 'h');
 			break;
 
 		      case 8: /* keyboard repeat */
-			ip->key_repeat = (c == 'h');
+			sc->key_repeat = (c == 'h');
 			break;
 
 		      case 20: /* newline mode */
-			ip->linefeed_newline = (c == 'h');
+			sc->linefeed_newline = (c == 'h');
 			break;
 
 		      case 25: /* cursor on/off */
-			SUBR_CURSOR(ip, (c == 'h') ? DRAW_CURSOR : ERASE_CURSOR);
+			SUBR_CURSOR(sc, (c == 'h') ? DRAW_CURSOR : ERASE_CURSOR);
 			break;
 		      }
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		    
 		  default:
-		    ip->escape = 0;
+		    sc->escape = 0;
 		    return;
 		  }
 		break;
 
 	      
 	      default:
-	        ip->escape = 0;
+	        sc->escape = 0;
 	        return;
 	      }
           }
@@ -2129,28 +2129,28 @@
 	case LF:
 		/* cr->crlf distinction is done here, on output, 
 		   not on input! */
-		if (ip->linefeed_newline)
-		  ite_crlf (ip);
+		if (sc->linefeed_newline)
+		  ite_crlf (sc);
 		else
-		  ite_lf (ip);
+		  ite_lf (sc);
 		break;
 
 	case CR:
-		ite_cr (ip);
+		ite_cr (sc);
 		break;
 	
 	case BS:
-		if (--ip->curx < 0)
-			ip->curx = 0;
+		if (--sc->curx < 0)
+			sc->curx = 0;
 		else
-			SUBR_CURSOR(ip, MOVE_CURSOR);
+			SUBR_CURSOR(sc, MOVE_CURSOR);
 		break;
 
 	case HT:
-		for (n = ip->curx + 1; n < ip->cols; n++) {
-			if (ip->tabs[n]) {
-				ip->curx = n;
-				SUBR_CURSOR(ip, MOVE_CURSOR);
+		for (n = sc->curx + 1; n < sc->cols; n++) {
+			if (sc->tabs[n]) {
+				sc->curx = n;
+				SUBR_CURSOR(sc, MOVE_CURSOR);
 				break;
 			}
 		}
@@ -2162,11 +2162,11 @@
 		break;
 
 	case SO:
-		ip->GL = ip->G1;
+		sc->GL = sc->G1;
 		break;
 		
 	case SI:
-		ip->GL = ip->G0;
+		sc->GL = sc->G0;
 		break;
 
 	case ENQ:
@@ -2174,35 +2174,35 @@
 		break;
 
 	case CAN:
-		ip->escape = 0;	/* cancel any escape sequence in progress */
+		sc->escape = 0;	/* cancel any escape sequence in progress */
 		break;
 		
 	case SUB:
-		ip->escape = 0;	/* dito, but see below */
+		sc->escape = 0;	/* dito, but see below */
 		/* should also display a reverse question mark!! */
 		break;
 
 	case ESC:
-		ip->escape = ESC;
+		sc->escape = ESC;
 		break;
 
 
 	/* now it gets weird.. 8bit control sequences.. */
 	case IND:	/* index: move cursor down, scroll */
-		ite_lf (ip);
+		ite_lf (sc);
 		break;
 		
 	case NEL:	/* next line. next line, first pos. */
-		ite_crlf (ip);
+		ite_crlf (sc);
 		break;
 
 	case HTS:	/* set horizontal tab */
-		if (ip->curx < ip->cols)
-		  ip->tabs[ip->curx] = 1;
+		if (sc->curx < sc->cols)
+		  sc->tabs[sc->curx] = 1;
 		break;
 		
 	case RI:	/* reverse index */
-		ite_rlf (ip);
+		ite_rlf (sc);
 		break;
 
 	case SS2:	/* go into G2 for one character */
@@ -2213,13 +2213,13 @@
 		break;
 		
 	case DCS:	/* device control string introducer */
-		ip->escape = DCS;
-		ip->ap = ip->argbuf;
+		sc->escape = DCS;
+		sc->ap = sc->argbuf;
 		break;
 		
 	case CSI:	/* control sequence introducer */
-		ip->escape = CSI;
-		ip->ap = ip->argbuf;
+		sc->escape = CSI;
+		sc->ap = sc->argbuf;
 		break;
 		
 	case ST:	/* string terminator */
@@ -2227,60 +2227,60 @@
 		break;
 		
 	case OSC:	/* introduces OS command. Ignore everything upto ST */
-		ip->escape = OSC;
+		sc->escape = OSC;
 		break;
 
 	case PM:	/* privacy message, ignore everything upto ST */
-		ip->escape = PM;
+		sc->escape = PM;
 		break;
 		
 	case APC:	/* application program command, ignore everything upto ST */
-		ip->escape = APC;
+		sc->escape = APC;
 		break;
 
 	default:
 		if (c < ' ' || c == DEL)
 			break;
-		if (ip->imode)
-			ite_inchar(ip, 1);
-		iteprecheckwrap(ip);
+		if (sc->imode)
+			ite_inchar(sc, 1);
+		iteprecheckwrap(sc);
 #ifdef DO_WEIRD_ATTRIBUTES
-		if ((ip->attribute & ATTR_INV) || attrtest(ip, ATTR_INV)) {
-			attrset(ip, ATTR_INV);
-			SUBR_PUTC(ip, c, ip->cury, ip->curx, ATTR_INV);
+		if ((sc->attribute & ATTR_INV) || attrtest(sc, ATTR_INV)) {
+			attrset(sc, ATTR_INV);
+			SUBR_PUTC(sc, c, sc->cury, sc->curx, ATTR_INV);
 		}			
 		else
-			SUBR_PUTC(ip, c, ip->cury, ip->curx, ATTR_NOR);
+			SUBR_PUTC(sc, c, sc->cury, sc->curx, ATTR_NOR);
 #else
-		SUBR_PUTC(ip, c, ip->cury, ip->curx, ip->attribute);
+		SUBR_PUTC(sc, c, sc->cury, sc->curx, sc->attribute);
 #endif
-		SUBR_CURSOR(ip, DRAW_CURSOR);
-		itecheckwrap(ip);
+		SUBR_CURSOR(sc, DRAW_CURSOR);
+		itecheckwrap(sc);
 		break;
 	}
 }
 
 static void
-iteprecheckwrap(struct ite_softc *ip)
+iteprecheckwrap(struct ite_softc *sc)
 {
-	if (ip->auto_wrap && ip->curx == ip->cols) {
-		ip->curx = 0;
-		clr_attr(ip, ATTR_INV);
-		if (++ip->cury >= ip->bottom_margin + 1) {
-			ip->cury = ip->bottom_margin;
-			SUBR_CURSOR(ip, MOVE_CURSOR);
-			SUBR_SCROLL(ip, ip->top_margin + 1, 0, 1, SCROLL_UP);
-			ite_clrtoeol(ip);
+	if (sc->auto_wrap && sc->curx == sc->cols) {
+		sc->curx = 0;
+		clr_attr(sc, ATTR_INV);
+		if (++sc->cury >= sc->bottom_margin + 1) {
+			sc->cury = sc->bottom_margin;
+			SUBR_CURSOR(sc, MOVE_CURSOR);
+			SUBR_SCROLL(sc, sc->top_margin + 1, 0, 1, SCROLL_UP);
+			ite_clrtoeol(sc);
 		} else
-			SUBR_CURSOR(ip, MOVE_CURSOR);
+			SUBR_CURSOR(sc, MOVE_CURSOR);
 	}
 }
 
 static void
-itecheckwrap(struct ite_softc *ip)
+itecheckwrap(struct ite_softc *sc)
 {
-	if (ip->curx < ip->cols) {
-		ip->curx++;
-		SUBR_CURSOR(ip, MOVE_CURSOR);
+	if (sc->curx < sc->cols) {
+		sc->curx++;
+		SUBR_CURSOR(sc, MOVE_CURSOR);
 	}
 }
--- a/sys/arch/atari/dev/ite_cc.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/ite_cc.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_cc.c,v 1.35.2.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: ite_cc.c,v 1.35.2.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.35.2.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_cc.c,v 1.35.2.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -105,11 +105,11 @@
 /*
  * grfcc config stuff
  */
-void grfccattach(struct device *, struct device *, void *);
-int  grfccmatch(struct device *, struct cfdata *, void *);
+void grfccattach(device_t, device_t, void *);
+int  grfccmatch(device_t, cfdata_t, void *);
 int  grfccprint(void *, const char *);
 
-CFATTACH_DECL(grfcc, sizeof(struct grf_softc),
+CFATTACH_DECL_NEW(grfcc, sizeof(struct grf_softc),
     grfccmatch, grfccattach, NULL, NULL);
 
 /*
@@ -128,11 +128,11 @@
 #endif /* FALCON_VIDEO */
 
 int
-grfccmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+grfccmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int did_consinit = 0;
 	static int must_probe = 1;
-	grf_auxp_t *grf_auxp = auxp;
+	grf_auxp_t *grf_auxp = aux;
 	extern const struct cdevsw view_cdevsw;
 
 	if (must_probe) {
@@ -161,9 +161,9 @@
 		 */
 		if (did_consinit)
 			return 0;
-		if ((*view_cdevsw.d_open)(cfp->cf_unit, 0, 0, NULL))
+		if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL))
 			return 0;
-		cfdata_grf = cfp;
+		cfdata_grf = cf;
 		did_consinit = 1;
 		return 1;
 	}
@@ -176,14 +176,14 @@
 	if (grf_auxp->from_bus_match && (did_consinit > 1))
 		return 0;
 
-	if (!grf_auxp->from_bus_match && (grf_auxp->unit != cfp->cf_unit))
+	if (!grf_auxp->from_bus_match && (grf_auxp->unit != cf->cf_unit))
 		return 0;
 
 	/*
 	 * Final constraint: each grf needs a view....
 	 */
 	if ((cfdata_grf == NULL) || (did_consinit > 1)) {
-	    if ((*view_cdevsw.d_open)(cfp->cf_unit, 0, 0, NULL))
+	    if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL))
 		return 0;
 	}
 	did_consinit = 2;
@@ -195,13 +195,13 @@
  * note  : dp is NULL during early console init.
  */
 void
-grfccattach(struct device *pdp, struct device *dp, void *auxp)
+grfccattach(device_t parent, device_t self, void *aux)
 {
 	static struct grf_softc congrf;
 	static int first_attach = 1;
-	grf_auxp_t *grf_bus_auxp = auxp;
+	grf_auxp_t *grf_bus_auxp = aux;
 	grf_auxp_t grf_auxp;
-	struct grf_softc *gp;
+	struct grf_softc *sc;
 	int maj;
 	extern const struct cdevsw grf_cdevsw;
 
@@ -213,7 +213,12 @@
 	/*
 	 * Handle exception case: early console init
 	 */
-	if (dp == NULL) {
+	if (self == NULL) {
+		struct device itedev;
+
+		memset(&itedev, 0, sizeof(itedev));
+		itedev.dv_private = &congrf;
+
 		congrf.g_unit    = cfdata_grf->cf_unit;
 		congrf.g_grfdev  = makedev(maj, congrf.g_unit);
 		congrf.g_itedev  = (dev_t)-1;
@@ -225,43 +230,44 @@
 		grf_viewsync(&congrf);
 
 		/* Attach console ite */
-		atari_config_found(cfdata_grf, NULL, &congrf, grfccprint);
+		atari_config_found(cfdata_grf, &itedev, &congrf, grfccprint);
 		return;
 	}
 
-	gp = (struct grf_softc *)dp;
-	gp->g_unit = device_unit(&gp->g_device);
-	grfsp[gp->g_unit] = gp;
+	sc = device_private(self);
+	sc->g_device = self;
+	sc->g_unit = device_unit(self);
+	grfsp[sc->g_unit] = sc;
 
-	if ((cfdata_grf != NULL) && (gp->g_unit == congrf.g_unit)) {
+	if ((cfdata_grf != NULL) && (sc->g_unit == congrf.g_unit)) {
 		/*
 		 * We inited earlier just copy the info, take care
 		 * not to copy the device struct though.
 		 */
-		memcpy(&gp->g_display, &congrf.g_display,
-			(char *)&gp[1] - (char *)&gp->g_display);
+		memcpy(&sc->g_display, &congrf.g_display,
+			(char *)&sc[1] - (char *)&sc->g_display);
 	} else {
-		gp->g_grfdev  = makedev(maj, gp->g_unit);
-		gp->g_itedev  = (dev_t)-1;
-		gp->g_flags   = GF_ALIVE;
-		gp->g_mode    = grf_mode;
-		gp->g_conpri  = 0;
-		gp->g_viewdev = gp->g_unit;
-		grfcc_iteinit(gp);
-		grf_viewsync(gp);
+		sc->g_grfdev  = makedev(maj, sc->g_unit);
+		sc->g_itedev  = (dev_t)-1;
+		sc->g_flags   = GF_ALIVE;
+		sc->g_mode    = grf_mode;
+		sc->g_conpri  = 0;
+		sc->g_viewdev = sc->g_unit;
+		grfcc_iteinit(sc);
+		grf_viewsync(sc);
 	}
 
-	printf(": width %d height %d", gp->g_display.gd_dwidth,
-		    gp->g_display.gd_dheight);
-	if (gp->g_display.gd_colors == 2)
+	printf(": width %d height %d", sc->g_display.gd_dwidth,
+		    sc->g_display.gd_dheight);
+	if (sc->g_display.gd_colors == 2)
 		printf(" monochrome\n");
 	else
-		printf(" colors %d\n", gp->g_display.gd_colors);
+		printf(" colors %d\n", sc->g_display.gd_colors);
 	
 	/*
 	 * try and attach an ite
 	 */
-	config_found(dp, gp, grfccprint);
+	config_found(self, sc /* XXX */, grfccprint);
 
 	/*
 	 * If attaching the first unit, go ahead and 'find' the rest of us
@@ -270,13 +276,13 @@
 		first_attach = 0;
 		grf_auxp.from_bus_match = 0;
 		for (grf_auxp.unit=1; grf_auxp.unit < NGRFCC; grf_auxp.unit++) {
-			config_found(pdp, &grf_auxp, grf_bus_auxp->busprint);
+			config_found(parent, &grf_auxp, grf_bus_auxp->busprint);
 		}
 	}
 }
 
 int
-grfccprint(void *auxp, const char *pnp)
+grfccprint(void *aux, const char *pnp)
 {
 
 	if (pnp)
@@ -297,15 +303,15 @@
  * grf_softc struct
  */
 void
-grfcc_iteinit(struct grf_softc *gp)
+grfcc_iteinit(struct grf_softc *sc)
 {
 
-	gp->g_itecursor = cursor32;
-	gp->g_iteputc   = putc8;
-	gp->g_iteclear  = clear8;
-	gp->g_itescroll = scroll8;
-	gp->g_iteinit   = view_init;
-	gp->g_itedeinit = view_deinit;
+	sc->g_itecursor = cursor32;
+	sc->g_iteputc   = putc8;
+	sc->g_iteclear  = clear8;
+	sc->g_itescroll = scroll8;
+	sc->g_iteinit   = view_init;
+	sc->g_itedeinit = view_deinit;
 }
 
 static void
--- a/sys/arch/atari/dev/ite_et.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/ite_et.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite_et.c,v 1.28.2.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: ite_et.c,v 1.28.2.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.28.2.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_et.c,v 1.28.2.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -90,11 +90,11 @@
 /*
  * grfet config stuff
  */
-void grfetattach(struct device *, struct device *, void *);
-int  grfetmatch(struct device *, struct cfdata *, void *);
+void grfetattach(device_t, device_t, void *);
+int  grfetmatch(device_t, cfdata_t, void *);
 int  grfetprint(void *, const char *);
 
-CFATTACH_DECL(grfet, sizeof(struct grf_softc),
+CFATTACH_DECL_NEW(grfet, sizeof(struct grf_softc),
     grfetmatch, grfetattach, NULL, NULL);
 
 /*
@@ -103,11 +103,11 @@
 static struct cfdata *cfdata_grf   = NULL;
 
 int
-grfetmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+grfetmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int	card_probed  = -1;
 	static int	did_consinit = 0;
-	grf_auxp_t	*grf_auxp = auxp;
+	grf_auxp_t	*grf_auxp = aux;
 	extern const struct cdevsw view_cdevsw;
 
 	if (card_probed <= 0) {
@@ -134,9 +134,9 @@
 		 */
 		if (did_consinit)
 			return 0;
-		if ((*view_cdevsw.d_open)(cfp->cf_unit, 0, 0, NULL))
+		if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL))
 			return 0;
-		cfdata_grf = cfp;
+		cfdata_grf = cf;
 		did_consinit = 1;
 		return 1;
 	}
@@ -150,14 +150,14 @@
 	    && ((did_consinit > 1) || !et_probe_card()))
 		return 0;
 
-	if (!grf_auxp->from_bus_match && (grf_auxp->unit != cfp->cf_unit))
+	if (!grf_auxp->from_bus_match && (grf_auxp->unit != cf->cf_unit))
 		return 0;
 
 	/*
 	 * Final constraint: each grf needs a view....
 	 */
 	if ((cfdata_grf == NULL) || (did_consinit > 1)) {
-		if ((*view_cdevsw.d_open)(cfp->cf_unit, 0, 0, NULL))
+		if ((*view_cdevsw.d_open)(cf->cf_unit, 0, 0, NULL))
 			return 0;
 	}
 	did_consinit = 2;
@@ -166,16 +166,16 @@
 
 /*
  * attach: initialize the grf-structure and try to attach an ite to us.
- * note  : dp is NULL during early console init.
+ * note  : self is NULL during early console init.
  */
 void
-grfetattach(struct device *pdp, struct device *dp, void *auxp)
+grfetattach(device_t parent, device_t self, void *aux)
 {
 	static struct grf_softc		congrf;
 	static int			first_attach = 1;
-	       grf_auxp_t		*grf_bus_auxp = auxp;
+	       grf_auxp_t		*grf_bus_auxp = aux;
 	       grf_auxp_t		grf_auxp;
-	       struct grf_softc		*gp;
+	       struct grf_softc		*sc;
 	       int			maj;
 	extern const struct cdevsw grf_cdevsw;
 
@@ -187,7 +187,12 @@
 	/*
 	 * Handle exception case: early console init
 	 */
-	if (dp == NULL) {
+	if (self == NULL) {
+		struct device itedev;
+
+		memset(&itedev, 0, sizeof(itedev));
+		itedev.dv_private = &congrf;
+
 		congrf.g_unit    = cfdata_grf->cf_unit;
 		congrf.g_grfdev  = makedev(maj, congrf.g_unit);
 		congrf.g_itedev  = (dev_t)-1;
@@ -199,42 +204,43 @@
 		grf_viewsync(&congrf);
 
 		/* Attach console ite */
-		atari_config_found(cfdata_grf, NULL, &congrf, grfetprint);
+		atari_config_found(cfdata_grf, &itedev, &congrf, grfetprint);
 		return;
 	}
 
-	gp = (struct grf_softc *)dp;
-	gp->g_unit = device_unit(&gp->g_device);
-	grfsp[gp->g_unit] = gp;
+	sc = device_private(self);
+	sc->g_device = self;
+	sc->g_unit = device_unit(self);
+	grfsp[sc->g_unit] = sc;
 
-	if ((cfdata_grf != NULL) && (gp->g_unit == congrf.g_unit)) {
+	if ((cfdata_grf != NULL) && (sc->g_unit == congrf.g_unit)) {
 		/*
 		 * We inited earlier just copy the info, take care
 		 * not to copy the device struct though.
 		 */
-		memcpy(&gp->g_display, &congrf.g_display,
-			(char *)&gp[1] - (char *)&gp->g_display);
+		memcpy(&sc->g_display, &congrf.g_display,
+			(char *)&sc[1] - (char *)&sc->g_display);
 	} else {
-		gp->g_grfdev  = makedev(maj, gp->g_unit);
-		gp->g_itedev  = (dev_t)-1;
-		gp->g_flags   = GF_ALIVE;
-		gp->g_mode    = grf_mode;
-		gp->g_conpri  = 0;
-		gp->g_viewdev = gp->g_unit;
-		grfet_iteinit(gp);
-		grf_viewsync(gp);
+		sc->g_grfdev  = makedev(maj, sc->g_unit);
+		sc->g_itedev  = (dev_t)-1;
+		sc->g_flags   = GF_ALIVE;
+		sc->g_mode    = grf_mode;
+		sc->g_conpri  = 0;
+		sc->g_viewdev = sc->g_unit;
+		grfet_iteinit(sc);
+		grf_viewsync(sc);
 	}
 
-	printf(": %dx%d", gp->g_display.gd_dwidth, gp->g_display.gd_dheight);
-	if (gp->g_display.gd_colors == 2)
+	printf(": %dx%d", sc->g_display.gd_dwidth, sc->g_display.gd_dheight);
+	if (sc->g_display.gd_colors == 2)
 		printf(" monochrome\n");
 	else
-		printf(" colors %d\n", gp->g_display.gd_colors);
+		printf(" colors %d\n", sc->g_display.gd_colors);
 	
 	/*
 	 * try and attach an ite
 	 */
-	config_found(dp, gp, grfetprint);
+	config_found(self, sc /* XXX */, grfetprint);
 
 	/*
 	 * If attaching the first unit, go ahead and 'find' the rest of us
@@ -243,13 +249,14 @@
 		first_attach = 0;
 		grf_auxp.from_bus_match = 0;
 		for (grf_auxp.unit=0; grf_auxp.unit < NGRFET; grf_auxp.unit++) {
-		    config_found(pdp, (void*)&grf_auxp, grf_bus_auxp->busprint);
+			config_found(parent, (void*)&grf_auxp,
+			    grf_bus_auxp->busprint);
 		}
 	}
 }
 
 int
-grfetprint(void *auxp, const char *pnp)
+grfetprint(void *aux, const char *pnp)
 {
 
 	if (pnp) /* XXX */
@@ -261,15 +268,15 @@
  * Init ite portion of grf_softc struct
  */
 static void
-grfet_iteinit(struct grf_softc *gp)
+grfet_iteinit(struct grf_softc *sc)
 {
 
-	gp->g_itecursor = et_cursor;
-	gp->g_iteputc   = et_putc;
-	gp->g_iteclear  = et_clear;
-	gp->g_itescroll = et_scroll;
-	gp->g_iteinit   = view_init;
-	gp->g_itedeinit = view_deinit;
+	sc->g_itecursor = et_cursor;
+	sc->g_iteputc   = et_putc;
+	sc->g_iteclear  = et_clear;
+	sc->g_itescroll = et_scroll;
+	sc->g_iteinit   = view_init;
+	sc->g_itedeinit = view_deinit;
 }
 
 static void
--- a/sys/arch/atari/dev/itevar.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/itevar.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: itevar.h,v 1.13 2009/03/14 14:45:56 dsl Exp $	*/
+/*	$NetBSD: itevar.h,v 1.13.4.1 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -53,7 +53,7 @@
 };
 
 struct ite_softc {
-	struct	device		device;		/* _Must_ be first	*/
+	device_t		device;		/* _Must_ be first	*/
 	char			argbuf[MAX_ARGSIZE];
 	struct  grf_softc	*grf;		/* XXX */
 	char			*ap;
--- a/sys/arch/atari/dev/kbd.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/kbd.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: kbd.c,v 1.40.4.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: kbd.c,v 1.40.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.40.4.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kbd.c,v 1.40.4.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include "mouse.h"
 #include "ite.h"
@@ -117,15 +117,15 @@
 void	kbdintr(int);
 
 static void kbdsoft(void *);
-static void kbdattach(struct device *, struct device *, void *);
-static int  kbdmatch(struct device *, struct cfdata *, void *);
+static void kbdattach(device_t, device_t, void *);
+static int  kbdmatch(device_t, cfdata_t, void *);
 #if NITE>0
 static int  kbd_do_modifier(uint8_t);
 #endif
 static int  kbd_write_poll(const uint8_t *, int);
 static void kbd_pkg_start(struct kbd_softc *, uint8_t);
 
-CFATTACH_DECL(kbd, sizeof(struct device),
+CFATTACH_DECL_NEW(kbd, 0,
     kbdmatch, kbdattach, NULL, NULL);
 
 const struct cdevsw kbd_cdevsw = {
@@ -165,17 +165,17 @@
 
 /*ARGSUSED*/
 static	int
-kbdmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+kbdmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
-	if (!strcmp((char *)auxp, "kbd"))
+	if (!strcmp((char *)aux, "kbd"))
 		return 1;
 	return 0;
 }
 
 /*ARGSUSED*/
 static void
-kbdattach(struct device *pdp, struct device *dp, void *auxp)
+kbdattach(device_t parent, device_t self, void *aux)
 {
 	int timeout;
 	const uint8_t kbd_rst[]  = { 0x80, 0x01 };
@@ -222,7 +222,7 @@
 	kbd_softc.k_sicookie = softint_establish(SOFTINT_SERIAL, kbdsoft, NULL);
 
 #if NWSKBD>0
-	if (dp != NULL) {
+	if (self != NULL) {
 		/*
 		 * Try to attach the wskbd.
 		 */
@@ -235,7 +235,7 @@
 		waa.keymap = &kbd_mapdata;
 		waa.accessops = &kbd_accessops;
 		waa.accesscookie = NULL;
-		kbd_softc.k_wskbddev = config_found(dp, &waa, wskbddevprint);
+		kbd_softc.k_wskbddev = config_found(self, &waa, wskbddevprint);
 
 		kbd_softc.k_pollingmode = 0;
 
--- a/sys/arch/atari/dev/ncr5380.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/ncr5380.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr5380.c,v 1.66.2.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: ncr5380.c,v 1.66.2.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.66.2.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr5380.c,v 1.66.2.2 2011/06/12 00:23:54 rmind 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				    *
--- a/sys/arch/atari/dev/ncr5380reg.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/ncr5380reg.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr5380reg.h,v 1.21.4.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: ncr5380reg.h,v 1.21.4.2 2011/06/12 00:23:54 rmind 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;
 
--- a/sys/arch/atari/dev/nvram.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/nvram.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvram.c,v 1.17.4.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: nvram.c,v 1.17.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.17.4.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.17.4.2 2011/06/12 00:23:54 rmind 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
--- a/sys/arch/atari/dev/nvramvar.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/dev/nvramvar.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvramvar.h,v 1.3 2009/10/20 19:10:11 snj Exp $	*/
+/*	$NetBSD: nvramvar.h,v 1.3.4.1 2011/06/12 00:23:54 rmind 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;
 };
 
 /*
--- a/sys/arch/atari/isa/isa_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/isa/isa_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.36.4.1 2010/05/30 05:16:40 rmind Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.36.4.2 2011/06/12 00:23:54 rmind 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.36.4.1 2010/05/30 05:16:40 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.36.4.2 2011/06/12 00:23:54 rmind 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)
 {
 }
 
--- a/sys/arch/atari/pci/pci_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/pci/pci_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.47.4.3 2011/05/31 03:03:57 rmind Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.47.4.4 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.47.4.3 2011/05/31 03:03:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.47.4.4 2011/06/12 00:23:54 rmind Exp $");
 
 #include "opt_mbtype.h"
 
@@ -120,16 +120,16 @@
 	_bus_dmamap_sync,
 };
 
-int	ataripcibusprint(void *auxp, const char *);
-int	pcibusmatch(struct device *, struct cfdata *, void *);
-void	pcibusattach(struct device *, struct device *, void *);
+int	ataripcibusprint(void *, const char *);
+int	pcibusmatch(device_t, cfdata_t, void *);
+void	pcibusattach(device_t, device_t, void *);
 
 static void enable_pci_devices(void);
 static void insert_into_list(PCI_MEMREG *head, struct pci_memreg *elem);
 static int overlap_pci_areas(struct pci_memreg *p,
 	struct pci_memreg *self, u_int addr, u_int size, u_int what);
 
-CFATTACH_DECL(pcib, sizeof(struct device),
+CFATTACH_DECL_NEW(pcib, 0,
     pcibusmatch, pcibusattach, NULL, NULL);
 
 /*
@@ -139,11 +139,11 @@
 static struct atari_bus_space	bs_storage[2];	/* 1 iot, 1 memt */
 
 int
-pcibusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+pcibusmatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int	nmatched = 0;
 
-	if (strcmp((char *)auxp, "pcib"))
+	if (strcmp((char *)aux, "pcib"))
 		return 0;	/* Wrong number... */
 
 	if (atari_realconfig == 0)
@@ -162,7 +162,7 @@
 }
 
 void
-pcibusattach(struct device *pdp, struct device *dp, void *auxp)
+pcibusattach(device_t parent, device_t self, void *aux)
 {
 	struct pcibus_attach_args	pba;
 
@@ -180,7 +180,7 @@
 	pba.pba_iot->base  = PCI_IO_PHYS;
 	pba.pba_memt->base = PCI_MEM_PHYS;
 
-	if (dp == NULL) {
+	if (self == NULL) {
 		/*
 		 * Scan the bus for a VGA-card that we support. If we
 		 * find one, try to initialize it to a 'standard' text
@@ -198,11 +198,11 @@
 
 	printf("\n");
 
-	config_found_ia(dp, "pcibus", &pba, ataripcibusprint);
+	config_found_ia(self, "pcibus", &pba, ataripcibusprint);
 }
 
 int
-ataripcibusprint(void *auxp, const char *name)
+ataripcibusprint(void *aux, const char *name)
 {
 
 	if (name == NULL)
@@ -211,7 +211,7 @@
 }
 
 void
-pci_attach_hook(struct device *parent, struct device *self, struct pcibus_attach_args *pba)
+pci_attach_hook(device_t parent, device_t self, struct pcibus_attach_args *pba)
 {
 }
 
--- a/sys/arch/atari/vme/et4000.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/vme/et4000.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: et4000.c,v 1.20.4.2 2011/03/05 20:49:44 rmind Exp $	*/
+/*	$NetBSD: et4000.c,v 1.20.4.3 2011/06/12 00:23:54 rmind 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.20.4.2 2011/03/05 20:49:44 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: et4000.c,v 1.20.4.3 2011/06/12 00:23:54 rmind 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))
--- a/sys/arch/atari/vme/leo.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/vme/leo.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: leo.c,v 1.16.4.1 2010/05/30 05:16:41 rmind Exp $	*/
+/*	$NetBSD: leo.c,v 1.16.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1997 maximum entropy <entropy@zippy.bernstein.com>
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: leo.c,v 1.16.4.1 2010/05/30 05:16:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: leo.c,v 1.16.4.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -78,7 +78,7 @@
 #define NLEOSTD (sizeof(leostd) / sizeof(leostd[0]))
 
 struct leo_softc {
-	struct device sc_dev;		/* XXX what goes here? */
+	device_t sc_dev;		/* XXX what goes here? */
 	bus_space_tag_t sc_iot;
 	bus_space_tag_t sc_memt;
 	bus_space_handle_t sc_ioh;
@@ -90,15 +90,15 @@
 
 #define LEO_SC_FLAGS_INUSE 1
 
-static int leo_match(struct device *, struct cfdata *, void *);
-static void leo_attach(struct device *, struct device *, void *);
+static int leo_match(device_t, cfdata_t, void *);
+static void leo_attach(device_t, device_t, void *);
 static int leo_probe(bus_space_tag_t *, bus_space_tag_t *,
 			  bus_space_handle_t *, bus_space_handle_t *,
 			  u_int, u_int);
 static int leo_init(struct leo_softc *, int);
 static int leo_scroll(struct leo_softc *, int);
 
-CFATTACH_DECL(leo, sizeof(struct leo_softc),
+CFATTACH_DECL_NEW(leo, sizeof(struct leo_softc),
     leo_match, leo_attach, NULL, NULL);
 
 dev_type_open(leoopen);
@@ -113,7 +113,7 @@
 };
 
 static int
-leo_match(struct device *parent, struct cfdata *cfp, void *aux)
+leo_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct vme_attach_args *va = aux;
 	int i;
@@ -205,9 +205,9 @@
 }
 
 static void
-leo_attach(struct device *parent, struct device *self, void *aux)
+leo_attach(device_t parent, device_t self, void *aux)
 {
-	struct leo_softc *sc = (struct leo_softc *)self;
+	struct leo_softc *sc = device_private(self);
 	struct vme_attach_args *va = aux;
 	bus_space_handle_t ioh;
 	bus_space_handle_t memh;
@@ -215,6 +215,8 @@
 	int i;
 #endif
 
+	sc->sc_dev = self;
+
 	printf("\n");
 	if (bus_space_map(va->va_iot, va->va_iobase, va->va_iosize, 0, &ioh))
 		panic("leo_attach: cannot map io area");
@@ -239,7 +241,7 @@
 }
 
 int
-leoopen(dev_t dev, int flags, int devtype, struct proc *p)
+leoopen(dev_t dev, int flags, int devtype, struct lwp *l)
 {
 	struct leo_softc *sc;
 	int r;
@@ -328,7 +330,7 @@
 }
 
 int
-leoclose(dev_t dev, int flags, int devtype, struct proc *p)
+leoclose(dev_t dev, int flags, int devtype, struct lwp *l)
 {
 	struct leo_softc *sc;
 
@@ -372,7 +374,7 @@
 }
 
 int
-leoioctl(dev_t dev, u_long cmd, void *data, int flags, struct proc *p)
+leoioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
 {
 	struct leo_softc *sc;
 
--- a/sys/arch/atari/vme/vme.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/vme/vme.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vme.c,v 1.16 2009/03/14 21:04:08 dsl Exp $	*/
+/*	$NetBSD: vme.c,v 1.16.4.1 2011/06/12 00:23:54 rmind 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.16.4.1 2011/06/12 00:23:54 rmind 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;
--- a/sys/arch/atari/vme/vme_machdep.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/vme/vme_machdep.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vme_machdep.c,v 1.18.4.1 2010/05/30 05:16:41 rmind Exp $	*/
+/*	$NetBSD: vme_machdep.c,v 1.18.4.2 2011/06/12 00:23:54 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.18.4.1 2010/05/30 05:16:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vme_machdep.c,v 1.18.4.2 2011/06/12 00:23:54 rmind Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -46,28 +46,28 @@
 #include <atari/atari/device.h>
 #include <atari/vme/vmevar.h>
 
-static int	vmebusprint(void *auxp, const char *);
-static int	vmebusmatch(struct device *, struct cfdata *, void *);
-static void	vmebusattach(struct device *, struct device *, void *);
+static int	vmebusprint(void *, const char *);
+static int	vmebusmatch(device_t, cfdata_t, void *);
+static void	vmebusattach(device_t, device_t, void *);
 
-CFATTACH_DECL(avmebus, sizeof(struct device),
+CFATTACH_DECL_NEW(avmebus, 0,
     vmebusmatch, vmebusattach, NULL, NULL);
 
 int vmebus_attached;
 
 int
-vmebusmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
+vmebusmatch(device_t parent, cfdata_t cf, void *aux)
 {
 
 	if (atari_realconfig == 0)
 		return 0;
-	if (strcmp((char *)auxp, "avmebus") || vmebus_attached)
+	if (strcmp((char *)aux, "avmebus") || vmebus_attached)
 		return 0;
 	return (machineid & ATARI_FALCON) ? 0 : 1;
 }
 
 void
-vmebusattach(struct device *pdp, struct device *dp, void *auxp)
+vmebusattach(device_t parent, device_t self, void *aux)
 {
 	struct vmebus_attach_args	vba;
 
@@ -88,11 +88,11 @@
 	vba.vba_memt->base = 0;
 
 	printf("\n");
-	config_found(dp, &vba, vmebusprint);
+	config_found(self, &vba, vmebusprint);
 }
 
 int
-vmebusprint(void *auxp, const char *name)
+vmebusprint(void *aux, const char *name)
 {
 
 	if (name == NULL)
--- a/sys/arch/atari/vme/vmevar.h	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/atari/vme/vmevar.h	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmevar.h,v 1.6 2008/04/28 20:23:15 martin Exp $	*/
+/*	$NetBSD: vmevar.h,v 1.6.22.1 2011/06/12 00:23:54 rmind 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 */
 
--- a/sys/arch/bebox/bebox/cpu.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/bebox/bebox/cpu.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.9 2008/04/28 20:23:15 martin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.9.22.1 2011/06/12 00:23:55 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9 2008/04/28 20:23:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.9.22.1 2011/06/12 00:23:55 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -40,16 +40,16 @@
 #include <machine/bus.h>
 #include <machine/cpu.h>
 
-int cpumatch(struct device *, struct cfdata *, void *);
-void cpuattach(struct device *, struct device *, void *);
+int cpumatch(device_t, cfdata_t, void *);
+void cpuattach(device_t, device_t, void *);
 
-CFATTACH_DECL(cpu, sizeof(struct device),
+CFATTACH_DECL_NEW(cpu, 0,
     cpumatch, cpuattach, NULL, NULL);
 
 extern struct cfdriver cpu_cd;
 
 int
-cpumatch(struct device *parent, struct cfdata *cfdata, void *aux)
+cpumatch(device_t parent, cfdata_t cfdata, void *aux)
 {
 	struct confargs *ca = aux;
   
@@ -61,7 +61,7 @@
 }
 
 void
-cpuattach(struct device *parent, struct device *self, void *aux)
+cpuattach(device_t parent, device_t self, void *aux)
 {
 	(void) cpu_attach_common(self, 0);
 }
--- a/sys/arch/bebox/bebox/mainbus.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/bebox/bebox/mainbus.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.24.4.1 2011/05/31 03:03:57 rmind Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.24.4.2 2011/06/12 00:23:55 rmind Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24.4.1 2011/05/31 03:03:57 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24.4.2 2011/06/12 00:23:55 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/extent.h>
@@ -49,10 +49,10 @@
 #include <machine/pci_machdep.h>
 #include <machine/isa_machdep.h>
 
-int	mainbus_match(struct device *, struct cfdata *, void *);
-void	mainbus_attach(struct device *, struct device *, void *);
+int	mainbus_match(device_t, cfdata_t, void *);
+void	mainbus_attach(device_t, device_t, void *);
 
-CFATTACH_DECL(mainbus, sizeof(struct device),
+CFATTACH_DECL_NEW(mainbus, 0,
     mainbus_match, mainbus_attach, NULL, NULL);
 
 int	mainbus_print (void *, const char *);
@@ -72,7 +72,7 @@
  * Probe for the mainbus; always succeeds.
  */
 int
-mainbus_match(struct device *parent, struct cfdata *match, void *aux)
+mainbus_match(device_t parent, cfdata_t match, void *aux)
 {
 	return 1;
 }
@@ -81,7 +81,7 @@
  * Attach the mainbus.
  */
 void
-mainbus_attach(struct device *parent, struct device *self, void *aux)
+mainbus_attach(device_t parent, device_t self, void *aux)
 {
 	union mainbus_attach_args mba;
 	struct confargs ca;
--- a/sys/arch/bebox/bebox/pic_bebox.c	Tue May 31 03:03:52 2011 +0000
+++ b/sys/arch/bebox/bebox/pic_bebox.c	Sun Jun 12 00:23:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_bebox.c,v 1.6 2008/04/28 20:23:15 martin Exp $ */
+/* $NetBSD: pic_bebox.c,v 1.6.22.1 2011/06/12 00:23:55 rmind Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.6 2008/04/28 20:23:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.6.22.1 2011/06/12 00:23:55 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -38,7 +38,6 @@
 
 #include <uvm/uvm_extern.h>
 
-#include <machine/atomic.h>
 #include <machine/pio.h>
 
 #include <arch/powerpc/pic/picvar.h>
--- a/sys/arch/bebox/include/atomic.h	Tue May 31 03:03:52 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-/*	$NetBSD: atomic.h,v 1.2 2005/12/11 12:17:03 christos Exp $	*/