Remove the old USB stack and related userland, etc.
authorSascha Wildner <saw@online.de>
Mon, 10 Nov 2014 10:49:03 +0000 (11:49 +0100)
committerSascha Wildner <saw@online.de>
Mon, 10 Nov 2014 10:50:53 +0000 (11:50 +0100)
As detailed in UPDATING, users with a custom configuration file which
was derived from a *GENERIC file before we made usb4bsd default (this
happened in 3.6) might need to remove or comment out a couple of
devices which are now unknown.

186 files changed:
Makefile_upgrade.inc
UPDATING
etc/Makefile
etc/defaults/rc.conf
etc/mtree/BSD.include.dist
etc/rc.d/Makefile
etc/rc.d/syscons
etc/rc.d/usbd [deleted file]
etc/usbd.conf [deleted file]
include/Makefile
lib/Makefile
lib/libusbhid/Makefile [deleted file]
lib/libusbhid/data.c [deleted file]
lib/libusbhid/descr.c [deleted file]
lib/libusbhid/parse.c [deleted file]
lib/libusbhid/usage.c [deleted file]
lib/libusbhid/usbhid.3 [deleted file]
lib/libusbhid/usbhid.h [deleted file]
lib/libusbhid/usbvar.h [deleted file]
share/examples/etc/README.examples
share/man/man4/Makefile
share/man/man4/lgue.4 [deleted file]
share/man/man4/rue.4 [deleted file]
share/man/man4/snd_uaudio.4
share/man/man4/ural.4 [deleted file]
share/man/man5/make.conf.5
share/man/man5/rc.conf.5
sys/bus/Makefile
sys/bus/pci/pci.c
sys/bus/usb/FILES [deleted file]
sys/bus/usb/Makefile [deleted file]
sys/bus/usb/dsbr100io.h [deleted file]
sys/bus/usb/ehci.c [deleted file]
sys/bus/usb/ehci/Makefile [deleted file]
sys/bus/usb/ehci_pci.c [deleted file]
sys/bus/usb/ehcireg.h [deleted file]
sys/bus/usb/ehcivar.h [deleted file]
sys/bus/usb/hid.c [deleted file]
sys/bus/usb/hid.h [deleted file]
sys/bus/usb/kue_fw.h [deleted file]
sys/bus/usb/ohci.c [deleted file]
sys/bus/usb/ohci_pci.c [deleted file]
sys/bus/usb/ohcireg.h [deleted file]
sys/bus/usb/ohcivar.h [deleted file]
sys/bus/usb/rio500_usb.h [deleted file]
sys/bus/usb/ugraphire_rdesc.h [deleted file]
sys/bus/usb/uhci.c [deleted file]
sys/bus/usb/uhci_pci.c [deleted file]
sys/bus/usb/uhcireg.h [deleted file]
sys/bus/usb/uhcivar.h [deleted file]
sys/bus/usb/uhub.c [deleted file]
sys/bus/usb/usb.c [deleted file]
sys/bus/usb/usb.h [deleted file]
sys/bus/usb/usb/Makefile [deleted file]
sys/bus/usb/usb_ethersubr.c [deleted file]
sys/bus/usb/usb_ethersubr.h [deleted file]
sys/bus/usb/usb_if.m [deleted file]
sys/bus/usb/usb_mem.c [deleted file]
sys/bus/usb/usb_mem.h [deleted file]
sys/bus/usb/usb_port.h [deleted file]
sys/bus/usb/usb_quirks.c [deleted file]
sys/bus/usb/usb_quirks.h [deleted file]
sys/bus/usb/usb_subr.c [deleted file]
sys/bus/usb/usbcdc.h [deleted file]
sys/bus/usb/usbdi.c [deleted file]
sys/bus/usb/usbdi.h [deleted file]
sys/bus/usb/usbdi_util.c [deleted file]
sys/bus/usb/usbdi_util.h [deleted file]
sys/bus/usb/usbdivar.h [deleted file]
sys/bus/usb/usbhid.h [deleted file]
sys/conf/files
sys/conf/kmod.mk
sys/config/GENERIC
sys/config/LINT
sys/config/LINT64
sys/config/SOEKRIS
sys/config/X86_64_GENERIC
sys/dev/Makefile
sys/dev/disk/nata/Makefile
sys/dev/disk/nata/ata-usb.c [deleted file]
sys/dev/disk/nata/natausb/Makefile [deleted file]
sys/dev/netif/Makefile
sys/dev/netif/aue/Makefile [deleted file]
sys/dev/netif/aue/if_aue.c [deleted file]
sys/dev/netif/aue/if_auereg.h [deleted file]
sys/dev/netif/axe/Makefile [deleted file]
sys/dev/netif/axe/if_axe.c [deleted file]
sys/dev/netif/axe/if_axereg.h [deleted file]
sys/dev/netif/cue/Makefile [deleted file]
sys/dev/netif/cue/if_cue.c [deleted file]
sys/dev/netif/cue/if_cuereg.h [deleted file]
sys/dev/netif/kue/Makefile [deleted file]
sys/dev/netif/kue/if_kue.c [deleted file]
sys/dev/netif/kue/if_kuereg.h [deleted file]
sys/dev/netif/lgue/Makefile [deleted file]
sys/dev/netif/lgue/if_lgue.c [deleted file]
sys/dev/netif/lgue/if_lgue.h [deleted file]
sys/dev/netif/ndis/Makefile
sys/dev/netif/ndis/if_ndis.c
sys/dev/netif/ndis/if_ndis_pccard.c
sys/dev/netif/ndis/if_ndis_pci.c
sys/dev/netif/ndis/if_ndis_usb.c [deleted file]
sys/dev/netif/ndis/if_ndisvar.h
sys/dev/netif/rue/Makefile [deleted file]
sys/dev/netif/rue/if_rue.c [deleted file]
sys/dev/netif/rue/if_ruereg.h [deleted file]
sys/dev/sound/driver/Makefile
sys/dev/sound/driver/uaudio/Makefile [deleted file]
sys/dev/sound/usb/uaudio.c [deleted file]
sys/dev/sound/usb/uaudio.h [deleted file]
sys/dev/sound/usb/uaudio_pcm.c [deleted file]
sys/dev/sound/usb/uaudioreg.h [deleted file]
sys/dev/usbmisc/Makefile [deleted file]
sys/dev/usbmisc/moscom/Makefile [deleted file]
sys/dev/usbmisc/moscom/moscom.c [deleted file]
sys/dev/usbmisc/uark/Makefile [deleted file]
sys/dev/usbmisc/uark/uark.c [deleted file]
sys/dev/usbmisc/ubsa/Makefile [deleted file]
sys/dev/usbmisc/ubsa/ubsa.c [deleted file]
sys/dev/usbmisc/ubt/Makefile [deleted file]
sys/dev/usbmisc/ubt/ubt.c [deleted file]
sys/dev/usbmisc/uchcom/Makefile [deleted file]
sys/dev/usbmisc/uchcom/uchcom.c [deleted file]
sys/dev/usbmisc/ucom/Makefile [deleted file]
sys/dev/usbmisc/ucom/ucom.c [deleted file]
sys/dev/usbmisc/ucom/ucomvar.h [deleted file]
sys/dev/usbmisc/ufm/Makefile [deleted file]
sys/dev/usbmisc/ufm/ufm.c [deleted file]
sys/dev/usbmisc/uftdi/Makefile [deleted file]
sys/dev/usbmisc/uftdi/uftdi.c [deleted file]
sys/dev/usbmisc/uftdi/uftdireg.h [deleted file]
sys/dev/usbmisc/ugen/Makefile [deleted file]
sys/dev/usbmisc/ugen/ugen.c [deleted file]
sys/dev/usbmisc/ugen/ugenbuf.c [deleted file]
sys/dev/usbmisc/ugen/ugenbuf.h [deleted file]
sys/dev/usbmisc/ugensa/Makefile [deleted file]
sys/dev/usbmisc/ugensa/ugensa.c [deleted file]
sys/dev/usbmisc/uhid/Makefile [deleted file]
sys/dev/usbmisc/uhid/uhid.c [deleted file]
sys/dev/usbmisc/ukbd/Makefile [deleted file]
sys/dev/usbmisc/ukbd/ukbd.c [deleted file]
sys/dev/usbmisc/ulpt/Makefile [deleted file]
sys/dev/usbmisc/ulpt/ulpt.c [deleted file]
sys/dev/usbmisc/umass/Makefile [deleted file]
sys/dev/usbmisc/umass/umass.c [deleted file]
sys/dev/usbmisc/umct/Makefile [deleted file]
sys/dev/usbmisc/umct/umct.c [deleted file]
sys/dev/usbmisc/umodem/Makefile [deleted file]
sys/dev/usbmisc/umodem/umodem.c [deleted file]
sys/dev/usbmisc/ums/Makefile [deleted file]
sys/dev/usbmisc/ums/ums.c [deleted file]
sys/dev/usbmisc/uplcom/Makefile [deleted file]
sys/dev/usbmisc/uplcom/uplcom.c [deleted file]
sys/dev/usbmisc/urio/urio.c [deleted file]
sys/dev/usbmisc/uscanner/Makefile [deleted file]
sys/dev/usbmisc/uscanner/uscanner.c [deleted file]
sys/dev/usbmisc/uslcom/Makefile [deleted file]
sys/dev/usbmisc/uslcom/uslcom.c [deleted file]
sys/dev/usbmisc/uticom/Makefile [deleted file]
sys/dev/usbmisc/uticom/uticom.c [deleted file]
sys/dev/usbmisc/uticom/uticom_fw3410.h [deleted file]
sys/dev/usbmisc/uvisor/Makefile [deleted file]
sys/dev/usbmisc/uvisor/uvisor.c [deleted file]
sys/dev/usbmisc/uvscom/Makefile [deleted file]
sys/dev/usbmisc/uvscom/uvscom.c [deleted file]
sys/emulation/ndis/Makefile
sys/emulation/ndis/kern_ndis.c
sys/emulation/ndis/kern_windrv.c
sys/emulation/ndis/ntoskrnl_var.h
sys/emulation/ndis/subr_ndis.c
sys/emulation/ndis/subr_usbd.c [deleted file]
sys/platform/pc32/conf/files
sys/platform/pc64/conf/files
tools/tools/convert_usb_ids/convert_usb_ids.sh [deleted file]
usr.bin/Makefile
usr.bin/usbhidctl/Makefile [deleted file]
usr.bin/usbhidctl/usbhid.c [deleted file]
usr.bin/usbhidctl/usbhidctl.1 [deleted file]
usr.sbin/Makefile
usr.sbin/usbd/Makefile [deleted file]
usr.sbin/usbd/usbd.8 [deleted file]
usr.sbin/usbd/usbd.c [deleted file]
usr.sbin/usbd/usbd.conf.5 [deleted file]
usr.sbin/usbdevs/Makefile [deleted file]
usr.sbin/usbdevs/usbdevs.8 [deleted file]
usr.sbin/usbdevs/usbdevs.c [deleted file]

index eec67ee..54d3c05 100644 (file)
@@ -2680,6 +2680,39 @@ TO_REMOVE+=/usr/share/man/cat1/pkg_search.1.gz
 TO_REMOVE+=/usr/share/man/man1/pkg_search.1.gz
 TO_REMOVE+=/usr/share/man/cat7/pkgsrc.7.gz
 TO_REMOVE+=/usr/share/man/man7/pkgsrc.7.gz
+TO_REMOVE+=/boot/kernel/if_lgue.ko
+TO_REMOVE+=/boot/kernel/if_rue.ko
+TO_REMOVE+=/boot/kernel/if_ural.ko
+TO_REMOVE+=/boot/kernel/moscom.ko
+TO_REMOVE+=/boot/kernel/natausb.ko
+TO_REMOVE+=/boot/kernel/snd_uaudio.ko
+TO_REMOVE+=/boot/kernel/ubt.ko
+TO_REMOVE+=/boot/kernel/ugen.ko
+TO_REMOVE+=/boot/kernel/uscanner.ko
+TO_REMOVE+=/boot/kernel/uticom.ko
+TO_REMOVE+=/etc/rc.d/usbd
+TO_REMOVE+=/usr/include/bus/usb
+TO_REMOVE+=/usr/sbin/usbd
+TO_REMOVE+=/usr/sbin/usbdevs
+TO_REMOVE+=/usr/share/examples/etc/usbd.conf
+TO_REMOVE+=/usr/share/man/cat4/if_lgue.4.gz
+TO_REMOVE+=/usr/share/man/man4/if_lgue.4.gz
+TO_REMOVE+=/usr/share/man/cat4/if_rue.4.gz
+TO_REMOVE+=/usr/share/man/man4/if_rue.4.gz
+TO_REMOVE+=/usr/share/man/cat4/if_ural.4.gz
+TO_REMOVE+=/usr/share/man/man4/if_ural.4.gz
+TO_REMOVE+=/usr/share/man/cat4/lgue.4.gz
+TO_REMOVE+=/usr/share/man/man4/lgue.4.gz
+TO_REMOVE+=/usr/share/man/cat4/rue.4.gz
+TO_REMOVE+=/usr/share/man/man4/rue.4.gz
+TO_REMOVE+=/usr/share/man/cat4/ural.4.gz
+TO_REMOVE+=/usr/share/man/man4/ural.4.gz
+TO_REMOVE+=/usr/share/man/cat5/usbd.conf.5.gz
+TO_REMOVE+=/usr/share/man/cat8/usbd.8.gz
+TO_REMOVE+=/usr/share/man/cat8/usbdevs.8.gz
+TO_REMOVE+=/usr/share/man/man5/usbd.conf.5.gz
+TO_REMOVE+=/usr/share/man/man8/usbd.8.gz
+TO_REMOVE+=/usr/share/man/man8/usbdevs.8.gz
 
 .if ${MACHINE_ARCH} == "x86_64"
 TO_REMOVE+=/usr/sbin/stlstats
@@ -2720,561 +2753,3 @@ TO_REMOVE+=/usr/share/man/man4/iwl.4.gz
 TO_REMOVE+=/boot/kernel/if_rtw.ko
 TO_REMOVE+=/usr/share/man/cat4/rtw.4.gz
 TO_REMOVE+=/usr/share/man/man4/rtw.4.gz
-TO_REMOVE+=/boot/kernel/if_ural.ko
-TO_REMOVE+=/usr/share/man/cat4/ural.4.gz
-TO_REMOVE+=/usr/share/man/man4/ural.4.gz
-
-# Clean up old USB stuff when the new stack is requested
-# and vice versa
-.if !defined(WANT_OLDUSB)
-TO_REMOVE+=/boot/kernel/if_lgue.ko
-TO_REMOVE+=/boot/kernel/if_rue.ko
-TO_REMOVE+=/boot/kernel/moscom.ko
-TO_REMOVE+=/boot/kernel/natausb.ko
-TO_REMOVE+=/boot/kernel/snd_uaudio.ko
-TO_REMOVE+=/boot/kernel/ubt.ko
-TO_REMOVE+=/boot/kernel/ugen.ko
-TO_REMOVE+=/boot/kernel/uscanner.ko
-TO_REMOVE+=/boot/kernel/uticom.ko
-TO_REMOVE+=/usr/include/bus/usb/dsbr100io.h
-TO_REMOVE+=/usr/include/bus/usb/ehcireg.h
-TO_REMOVE+=/usr/include/bus/usb/ehcivar.h
-TO_REMOVE+=/usr/include/bus/usb/hid.h
-TO_REMOVE+=/usr/include/bus/usb/kue_fw.h
-TO_REMOVE+=/usr/include/bus/usb/ohcireg.h
-TO_REMOVE+=/usr/include/bus/usb/ohcivar.h
-TO_REMOVE+=/usr/include/bus/usb/rio500_usb.h
-TO_REMOVE+=/usr/include/bus/usb/ugraphire_rdesc.h
-TO_REMOVE+=/usr/include/bus/usb/uhcireg.h
-TO_REMOVE+=/usr/include/bus/usb/uhcivar.h
-TO_REMOVE+=/usr/include/bus/usb/usb.h
-TO_REMOVE+=/usr/include/bus/usb/usb_ethersubr.h
-TO_REMOVE+=/usr/include/bus/usb/usb_mem.h
-TO_REMOVE+=/usr/include/bus/usb/usb_port.h
-TO_REMOVE+=/usr/include/bus/usb/usb_quirks.h
-TO_REMOVE+=/usr/include/bus/usb/usbcdc.h
-TO_REMOVE+=/usr/include/bus/usb/usbdi.h
-TO_REMOVE+=/usr/include/bus/usb/usbdi_util.h
-TO_REMOVE+=/usr/include/bus/usb/usbdivar.h
-TO_REMOVE+=/usr/include/bus/usb/usbhid.h
-TO_REMOVE+=/usr/sbin/usbd
-TO_REMOVE+=/usr/sbin/usbdevs
-TO_REMOVE+=/usr/share/man/cat5/usbd.conf.5.gz
-TO_REMOVE+=/usr/share/man/cat8/usbd.8.gz
-TO_REMOVE+=/usr/share/man/cat8/usbdevs.8.gz
-TO_REMOVE+=/usr/share/man/man5/usbd.conf.5.gz
-TO_REMOVE+=/usr/share/man/man8/usbd.8.gz
-TO_REMOVE+=/usr/share/man/man8/usbdevs.8.gz
-.else
-TO_REMOVE+=/boot/kernel/if_ipheth.ko
-TO_REMOVE+=/boot/kernel/if_mos.ko
-TO_REMOVE+=/boot/kernel/if_rum.ko
-TO_REMOVE+=/boot/kernel/if_run.ko
-TO_REMOVE+=/boot/kernel/if_udav.ko
-TO_REMOVE+=/boot/kernel/if_urndis.ko
-TO_REMOVE+=/boot/kernel/if_urtwn.ko
-TO_REMOVE+=/boot/kernel/ohci.ko
-TO_REMOVE+=/boot/kernel/runfw.ko
-TO_REMOVE+=/boot/kernel/u3g.ko
-TO_REMOVE+=/boot/kernel/uaudio.ko
-TO_REMOVE+=/boot/kernel/ubser.ko
-TO_REMOVE+=/boot/kernel/ucycom.ko
-TO_REMOVE+=/boot/kernel/uep.ko
-TO_REMOVE+=/boot/kernel/uether.ko
-TO_REMOVE+=/boot/kernel/ufoma.ko
-TO_REMOVE+=/boot/kernel/uhci.ko
-TO_REMOVE+=/boot/kernel/uipaq.ko
-TO_REMOVE+=/boot/kernel/umcs.ko
-TO_REMOVE+=/boot/kernel/umoscom.ko
-TO_REMOVE+=/boot/kernel/urtwn-rtl8192cfwT.ko
-TO_REMOVE+=/boot/kernel/urtwn-rtl8192cfwU.ko
-TO_REMOVE+=/boot/kernel/usb_quirk.ko
-TO_REMOVE+=/boot/kernel/usb_template.ko
-TO_REMOVE+=/boot/kernel/usfs.ko
-TO_REMOVE+=/boot/kernel/xhci.ko
-TO_REMOVE+=/usr/bin/usbhidaction
-TO_REMOVE+=/usr/include/bus/u4b/ufm_ioctl.h
-TO_REMOVE+=/usr/include/bus/u4b/usb.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_bus.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_busdma.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_cdc.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_compat_linux.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_controller.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_core.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_debug.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_dev.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_device.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_dragonfly.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_dynamic.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_endian.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_freebsd.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_generic.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_hub.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_ioctl.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_mbuf.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_msctest.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_pci.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_pf.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_process.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_request.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_transfer.h
-TO_REMOVE+=/usr/include/bus/u4b/usb_util.h
-TO_REMOVE+=/usr/include/bus/u4b/usbdevs_data.h
-TO_REMOVE+=/usr/include/bus/u4b/usbdi.h
-TO_REMOVE+=/usr/include/bus/u4b/usbdi_util.h
-TO_REMOVE+=/usr/include/bus/u4b/usbhid.h
-TO_REMOVE+=/usr/include/libusb.h
-TO_REMOVE+=/usr/include/libusb20.h
-TO_REMOVE+=/usr/include/libusb20_desc.h
-TO_REMOVE+=/usr/include/usb.h
-TO_REMOVE+=/usr/lib/libusb.a
-TO_REMOVE+=/usr/lib/libusb.so
-TO_REMOVE+=/usr/lib/libusb.so.2
-TO_REMOVE+=/usr/lib/profile/libusb.a
-TO_REMOVE+=/usr/libdata/pkgconfig/libusb-0.1.pc
-TO_REMOVE+=/usr/libdata/pkgconfig/libusb-1.0.pc
-TO_REMOVE+=/usr/libdata/pkgconfig/libusb-2.0.pc
-TO_REMOVE+=/usr/sbin/usbconfig
-TO_REMOVE+=/usr/sbin/usbcontrol
-TO_REMOVE+=/usr/sbin/usbdump
-TO_REMOVE+=/usr/share/examples/libusb20/Makefile
-TO_REMOVE+=/usr/share/examples/libusb20/README
-TO_REMOVE+=/usr/share/examples/libusb20/bulk.c
-TO_REMOVE+=/usr/share/examples/libusb20/control.c
-TO_REMOVE+=/usr/share/examples/libusb20/util.c
-TO_REMOVE+=/usr/share/examples/libusb20/util.h
-TO_REMOVE+=/usr/share/man/cat1/usbhidaction.1.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_add_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_alloc_default.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_dequeue_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_device_foreach.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_enqueue_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_free.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_get_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_get_quirk_name.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_get_template.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_remove_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_be_set_template.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_desc_foreach.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_alloc.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_alloc_config.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_close.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_detach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_free.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_address.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_backend_name.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_bus_number.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_config_index.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_debug.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_desc.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_device_desc.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_fd.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_iface_desc.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_info.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_mode.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_parent_address.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_parent_port.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_port_path.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_power_mode.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_power_usage.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_get_speed.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_kernel_driver_active.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_open.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_process.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_req_string_simple_sync.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_req_string_sync.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_request_sync.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_reset.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_set_alt_index.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_set_config_index.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_set_power_mode.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_dev_wait_process.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_error_name.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_me_decode.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_me_encode.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_me_get_1.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_me_get_2.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_strerror.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_bulk_intr_sync.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_callback_wrapper.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_clear_stall_sync.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_close.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_drain.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_actual_frames.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_actual_length.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_length.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_max_frames.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_max_packet_length.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_max_total_length.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_pointer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_priv_sc0.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_priv_sc1.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_status.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_get_time_complete.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_open.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_pending.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_buffer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_callback.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_flags.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_length.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_priv_sc0.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_priv_sc1.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_timeout.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_set_total_frames.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_setup_bulk.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_setup_control.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_setup_intr.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_setup_isoc.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_start.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_stop.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb20_tr_submit.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_alloc_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_attach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_bulk_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_cancel_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_claim_interface.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_clear_halt.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_close.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_control_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_detach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_detach_kernel_driver_np.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_error_name.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_event_handler_active.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_event_handling_ok.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_exit.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_free_bos_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_free_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_free_device_list.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_free_ss_endpoint_comp.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_free_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_active_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_bus_number.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_config_descriptor_by_value.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_configuration.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_device_address.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_device_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_device_list.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_device_speed.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_driver.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_driver_np.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_max_iso_packet_size.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_max_packet_size.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_next_timeout.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_pollfds.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_string_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_get_string_descriptor_ascii.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_handle_events.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_handle_events_completed.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_handle_events_locked.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_handle_events_timeout.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_handle_events_timeout_completed.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_init.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_interrupt_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_kernel_driver_active.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_lock_event_waiters.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_lock_events.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_open.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_open_device_with_vid_pid.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_parse_bos_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_parse_ss_endpoint_comp.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_ref_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_release_interface.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_reset_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_set_configuration.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_set_interface_alt_setting.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_set_pollfd_notifiers.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_strerror.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_submit_transfer.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_try_lock_events.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_unlock_event_waiters.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_unlock_events.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_unref_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/libusb_wait_for_event.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_bulk_read.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_bulk_write.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_claim_interface.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_clear_halt.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_close.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_control_msg.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_destroy_configuration.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_device.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_fetch_and_parse_descriptors.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_find_busses.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_find_devices.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_get_busses.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_get_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_get_descriptor_by_endpoint.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_get_string.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_get_string_simple.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_init.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_interrupt_read.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_interrupt_write.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_open.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_parse_configuration.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_parse_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_release_interface.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_reset.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_resetep.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_set_altinterface.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_set_configuration.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/cat3/usb_strerror.3.gz
-TO_REMOVE+=/usr/share/man/cat4/if_ipheth.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_mos.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_rum.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_run.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_udav.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_urndis.4.gz
-TO_REMOVE+=/usr/share/man/cat4/if_urtwn.4.gz
-TO_REMOVE+=/usr/share/man/cat4/ipheth.4.gz
-TO_REMOVE+=/usr/share/man/cat4/mos.4.gz
-TO_REMOVE+=/usr/share/man/cat4/rum.4.gz
-TO_REMOVE+=/usr/share/man/cat4/run.4.gz
-TO_REMOVE+=/usr/share/man/cat4/runfw.4.gz
-TO_REMOVE+=/usr/share/man/cat4/u3g.4.gz
-TO_REMOVE+=/usr/share/man/cat4/ubser.4.gz
-TO_REMOVE+=/usr/share/man/cat4/ucycom.4.gz
-TO_REMOVE+=/usr/share/man/cat4/udav.4.gz
-TO_REMOVE+=/usr/share/man/cat4/uep.4.gz
-TO_REMOVE+=/usr/share/man/cat4/ufoma.4.gz
-TO_REMOVE+=/usr/share/man/cat4/uipaq.4.gz
-TO_REMOVE+=/usr/share/man/cat4/umcs.4.gz
-TO_REMOVE+=/usr/share/man/cat4/umoscom.4.gz
-TO_REMOVE+=/usr/share/man/cat4/urndis.4.gz
-TO_REMOVE+=/usr/share/man/cat4/urtwn.4.gz
-TO_REMOVE+=/usr/share/man/cat4/urtwnfw.4.gz
-TO_REMOVE+=/usr/share/man/cat4/usb_quirk.4.gz
-TO_REMOVE+=/usr/share/man/cat4/usb_template.4.gz
-TO_REMOVE+=/usr/share/man/cat4/usfs.4.gz
-TO_REMOVE+=/usr/share/man/cat4/xhci.4.gz
-TO_REMOVE+=/usr/share/man/cat8/usbconfig.8.gz
-TO_REMOVE+=/usr/share/man/cat8/usbcontrol.8.gz
-TO_REMOVE+=/usr/share/man/cat8/usbdump.8.gz
-TO_REMOVE+=/usr/share/man/man1/usbhidaction.1.gz
-TO_REMOVE+=/usr/share/man/man3/libusb.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_add_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_alloc_default.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_dequeue_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_device_foreach.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_enqueue_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_free.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_get_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_get_quirk_name.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_get_template.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_remove_dev_quirk.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_be_set_template.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_desc_foreach.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_alloc.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_alloc_config.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_close.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_detach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_free.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_address.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_backend_name.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_bus_number.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_config_index.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_debug.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_desc.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_device_desc.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_fd.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_iface_desc.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_info.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_mode.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_parent_address.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_parent_port.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_port_path.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_power_mode.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_power_usage.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_get_speed.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_kernel_driver_active.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_open.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_process.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_req_string_simple_sync.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_req_string_sync.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_request_sync.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_reset.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_set_alt_index.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_set_config_index.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_set_power_mode.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_dev_wait_process.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_error_name.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_me_decode.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_me_encode.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_me_get_1.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_me_get_2.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_strerror.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_bulk_intr_sync.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_callback_wrapper.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_clear_stall_sync.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_close.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_drain.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_actual_frames.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_actual_length.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_length.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_max_frames.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_max_packet_length.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_max_total_length.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_pointer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_priv_sc0.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_priv_sc1.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_status.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_get_time_complete.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_open.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_pending.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_buffer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_callback.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_flags.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_length.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_priv_sc0.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_priv_sc1.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_timeout.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_set_total_frames.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_setup_bulk.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_setup_control.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_setup_intr.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_setup_isoc.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_start.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_stop.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb20_tr_submit.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_alloc_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_attach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_bulk_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_cancel_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_claim_interface.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_clear_halt.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_close.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_control_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_detach_kernel_driver.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_detach_kernel_driver_np.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_error_name.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_event_handler_active.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_event_handling_ok.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_exit.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_free_bos_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_free_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_free_device_list.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_free_ss_endpoint_comp.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_free_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_active_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_bus_number.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_config_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_config_descriptor_by_value.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_configuration.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_device_address.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_device_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_device_list.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_device_speed.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_driver.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_driver_np.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_max_iso_packet_size.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_max_packet_size.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_next_timeout.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_pollfds.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_string_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_get_string_descriptor_ascii.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_handle_events.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_handle_events_completed.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_handle_events_locked.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_handle_events_timeout.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_handle_events_timeout_completed.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_init.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_interrupt_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_kernel_driver_active.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_lock_event_waiters.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_lock_events.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_open.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_open_device_with_vid_pid.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_parse_bos_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_parse_ss_endpoint_comp.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_ref_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_release_interface.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_reset_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_set_configuration.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_set_interface_alt_setting.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_set_pollfd_notifiers.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_strerror.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_submit_transfer.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_try_lock_events.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_unlock_event_waiters.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_unlock_events.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_unref_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/libusb_wait_for_event.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_bulk_read.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_bulk_write.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_check_connected.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_claim_interface.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_clear_halt.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_close.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_control_msg.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_destroy_configuration.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_device.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_fetch_and_parse_descriptors.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_find_busses.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_find_devices.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_get_busses.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_get_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_get_descriptor_by_endpoint.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_get_string.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_get_string_simple.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_init.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_interrupt_read.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_interrupt_write.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_open.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_parse_configuration.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_parse_descriptor.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_release_interface.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_reset.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_resetep.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_set_altinterface.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_set_configuration.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_set_debug.3.gz
-TO_REMOVE+=/usr/share/man/man3/usb_strerror.3.gz
-TO_REMOVE+=/usr/share/man/man4/if_ipheth.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_mos.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_rum.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_run.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_udav.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_urndis.4.gz
-TO_REMOVE+=/usr/share/man/man4/if_urtwn.4.gz
-TO_REMOVE+=/usr/share/man/man4/ipheth.4.gz
-TO_REMOVE+=/usr/share/man/man4/mos.4.gz
-TO_REMOVE+=/usr/share/man/man4/rum.4.gz
-TO_REMOVE+=/usr/share/man/man4/run.4.gz
-TO_REMOVE+=/usr/share/man/man4/runfw.4.gz
-TO_REMOVE+=/usr/share/man/man4/u3g.4.gz
-TO_REMOVE+=/usr/share/man/man4/ubser.4.gz
-TO_REMOVE+=/usr/share/man/man4/ucycom.4.gz
-TO_REMOVE+=/usr/share/man/man4/udav.4.gz
-TO_REMOVE+=/usr/share/man/man4/uep.4.gz
-TO_REMOVE+=/usr/share/man/man4/ufoma.4.gz
-TO_REMOVE+=/usr/share/man/man4/uipaq.4.gz
-TO_REMOVE+=/usr/share/man/man4/umcs.4.gz
-TO_REMOVE+=/usr/share/man/man4/umoscom.4.gz
-TO_REMOVE+=/usr/share/man/man4/urndis.4.gz
-TO_REMOVE+=/usr/share/man/man4/urtwn.4.gz
-TO_REMOVE+=/usr/share/man/man4/urtwnfw.4.gz
-TO_REMOVE+=/usr/share/man/man4/usb_quirk.4.gz
-TO_REMOVE+=/usr/share/man/man4/usb_template.4.gz
-TO_REMOVE+=/usr/share/man/man4/usfs.4.gz
-TO_REMOVE+=/usr/share/man/man4/xhci.4.gz
-TO_REMOVE+=/usr/share/man/man8/usbconfig.8.gz
-TO_REMOVE+=/usr/share/man/man8/usbcontrol.8.gz
-TO_REMOVE+=/usr/share/man/man8/usbdump.8.gz
-.endif
index cb797ef..afc6e53 100644 (file)
--- a/UPDATING
+++ b/UPDATING
@@ -8,11 +8,34 @@
 # If you discover any problem, please contact the bugs@lists.dragonflybsd.org
 # mailing list with the details.
 
++-----------------------------------------------------------------------+
++         UPGRADING DRAGONFLY FROM 4.0 TO LATER VERSIONS                +
++-----------------------------------------------------------------------+
+
+OLD USB DRIVERS REMOVED
+-----------------------
+
+The old USB stack, along with the kernel config option "device oldusb"
+and the make.conf variable "WANT_OLDUSB" have been removed. This means
+that for custom kernel configuration files which were derived from a
+GENERIC or X86_64_GENERIC file prior to making the usb4bsd stack default,
+various (old USB stack specific) devices will now complain about being
+unknown:
+
+  * oldusb     (obviously)
+  * natausb    (not yet ported to usb4bsd)
+  * rue                (not yet ported to usb4bsd)
+  * ugen       (no longer needed in usb4bsd)
+  * urio       (not yet ported to usb4bsd)
+  * uscanner   (no longer needed in usb4bsd)
+
+They should be removed or commented out in such custom kernel configs.
+
 +-----------------------------------------------------------------------+
 +         UPGRADING DRAGONFLY FROM 3.8 TO LATER VERSIONS                +
 +-----------------------------------------------------------------------+
 
-SMP and DEVICE_POLLING OPTIONS MADE UNKNOWN
+SMP AND DEVICE_POLLING OPTIONS MADE UNKNOWN
 -------------------------------------------
 
 DEVICE_POLLING was replaced by IFPOLL_ENABLE and the former SMP code is
index 73d5f96..a86b121 100644 (file)
@@ -32,7 +32,7 @@ BIN1= amd.map auth.conf \
        motd modems netconfig networks newsyslog.conf \
        nscd.conf pf.conf phones printcap profile \
        regdomain.xml remote sensorsd.conf services \
-       shells sysctl.conf syslog.conf usbd.conf \
+       shells sysctl.conf syslog.conf \
        hostapd.conf wpa_supplicant.conf \
        etc.${MACHINE_ARCH}/ttys
 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
index 07be09b..bdb4831 100644 (file)
@@ -351,8 +351,6 @@ lpd_enable="NO"             # Run the line printer daemon.
 lpd_program="/usr/sbin/lpd"    # path to lpd, if you want a different one.
 lpd_flags=""           # Flags to lpd (if enabled).
 nscd_enable="NO"       # Run the nsswitch caching daemon.
-usbd_enable="NO"       # Run the usbd daemon.
-usbd_flags=""          # Flags to usbd (if enabled).
 devd_enable="YES"      # Run devd, to trigger programs on device tree changes.
 devd_flags=""          # Additional flags for devd(8).
 dumpdev="NO"           # Device name to crashdump to (or NO).
index 46778ce..b0ed47a 100644 (file)
@@ -22,8 +22,6 @@
         ..
         smbus
         ..
-        usb
-        ..
         u4b
         ..
     ..
index 1949d87..8d4d6e1 100644 (file)
@@ -21,7 +21,7 @@ FILES=        DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \
        quota random rarpd rcconf resident rndcontrol root route6d routed \
        routing rpcbind rtadvd rtsold rwho sysdb savecore sdpd securelevel \
        sendmail sensorsd serial sppp sshd statd swap1 syscons sysctl syslogd sysvipcd \
-       timed ttys udevd udevd_early usbd \
+       timed ttys udevd udevd_early \
        varsym vfs_quota vinum virecover vkernel vknetd \
        watchdogd wpa_supplicant \
        ypbind yppasswdd ypserv ypset ypupdated ypxfrd
index 7eaac66..64cdf65 100644 (file)
@@ -28,7 +28,7 @@
 #
 
 # PROVIDE: syscons
-# REQUIRE: LOGIN usbd
+# REQUIRE: LOGIN
 
 . /etc/rc.subr
 
diff --git a/etc/rc.d/usbd b/etc/rc.d/usbd
deleted file mode 100644 (file)
index 81d2619..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: src/etc/rc.d/usbd,v 1.1 2002/06/13 22:14:36 gordon Exp $
-#
-
-# PROVIDE: usbd
-# REQUIRE: DAEMON
-# BEFORE: LOGIN
-
-. /etc/rc.subr
-
-name="usbd"
-rcvar=`set_rcvar`
-command="/usr/sbin/${name}"
-
-load_rc_config $name
-if [ -x $command -a -c /dev/usb ]; then
-       run_rc_command "$1"
-else
-       dummy_rc_command "$1"
-fi
diff --git a/etc/usbd.conf b/etc/usbd.conf
deleted file mode 100644 (file)
index 064d950..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# Configuration file the USB daemon.
-#
-# See usbd.conf(5) for the description of the format of the file.
-#
-# $FreeBSD: src/etc/usbd.conf,v 1.5.2.3 2002/11/04 08:05:44 dougb Exp $
-# $DragonFly: src/etc/usbd.conf,v 1.3 2005/06/17 23:10:11 swildner Exp $
-
-# Firmware download into the ActiveWire board. After the firmware download is
-# done the device detaches and reappears as something new and shiny automatically.
-#
-device "ActiveWire board, firmware download"
-       vendor  0x0854
-       product 0x0100
-       release 0x0000
-       attach "/usr/local/bin/ezdownload -f /usr/local/share/usb/firmware/0854.0100.0_01.hex ${DEVNAME}"
-
-# Firmware download for Entrega Serial DB25 adapter.
-#
-device "Entrega Serial with UART"
-       product 0x8001
-       vendor  0x1645
-       release 0x0101
-       attach "if ! kldstat -n usio > /dev/null 2>&1 ; then kldload usio; fi"
-       attach "/usr/sbin/ezdownload -v -f /usr/share/usb/firmware/1645.8001.0101 /dev/${DEVNAME}"
-
-# The entry below starts and stops dhclient when an ethernet device is inserted
-# Caveat: It does not support multiple interfaces.
-#
-device "USB ethernet"
-       devname "[ack]ue[0-9]+"
-       attach  "/etc/pccard_ether ${DEVNAME} start"
-       detach  "/etc/pccard_ether ${DEVNAME} stop"
-
-# This entry starts the ColdSync tool in daemon mode. Make sure you have an up
-# to date /usr/local/etc/palms. We override the 'listen' settings for port and
-# type in /usr/local/etc/coldsync.conf.
-device "Handspring Visor"
-        devname "ugen[0-9]+"
-        vendor  0x082d
-        product 0x0100
-        release 0x0100
-        attach "/usr/local/bin/coldsync -md -p /dev/${DEVNAME} -t usb"
-
-# The entry below starts moused when a mouse is plugged in. Moused
-# stops automatically (actually it bombs :) when the device disappears.
-#
-device "Mouse"
-       devname "ums[0-9]+"
-       attach "/usr/sbin/moused -p /dev/${DEVNAME} -I /var/run/moused.${DEVNAME}.pid ; /usr/sbin/vidcontrol -m on"
-
-# The fallthrough entry: Nothing is specified, nothing is done.  And it isn't
-# necessary at all :-).  Just for pretty printing in debugging mode.
-#
-device "USB device"
index 7f067c0..7a8b6f4 100644 (file)
@@ -56,7 +56,7 @@ LDIRS=        net netbt netgraph netgraph7 netinet netinet6 sys vm
 #
 LSUBDIRS= \
        bus/cam bus/cam/scsi \
-       bus/cam bus/pccard bus/pci bus/isa bus/ppbus bus/smbus \
+       bus/cam bus/pccard bus/pci bus/isa bus/ppbus bus/smbus bus/u4b \
        dev/disk/dm \
        dev/disk/mpt/mpilib \
        dev/misc/lpt dev/misc/ppi dev/misc/putter \
@@ -92,12 +92,6 @@ LSUBDIRS= \
        vfs/msdosfs vfs/nfs vfs/ntfs \
        vfs/smbfs vfs/udf vfs/ufs vfs/hammer vfs/hammer2
 
-.if !defined(WANT_OLDUSB)
-LSUBDIRS+=     bus/u4b
-.else
-LSUBDIRS+=     bus/usb
-.endif
-
 # For SHARED=symlinks, bus/cam is a symlink, so cam/scsi is taken care of
 LSYMSUBDIRS=   ${LSUBDIRS:Nbus/cam/scsi:Nnet/*:Nnetgraph/*:Nnetgraph7/*}
 
index a3f9d04..c1eb649 100644 (file)
@@ -84,8 +84,8 @@ SUBDIR=       ${SUBDIR_ORDERED} \
        libstand \
        libtcplay \
        libtelnet \
-       ${_libusb} \
-       ${_libusbhid} \
+       libusb \
+       libu4bhid \
        libvgl \
        libwrap \
        liby \
@@ -114,11 +114,4 @@ _libnetgraph=      libnetgraph7
 _libnetgraph=  libnetgraph
 .endif
 
-.if !defined(WANT_OLDUSB)
-_libusb=       libusb
-_libusbhid=    libu4bhid
-.else
-_libusbhid=    libusbhid
-.endif
-
 .include <bsd.subdir.mk>
diff --git a/lib/libusbhid/Makefile b/lib/libusbhid/Makefile
deleted file mode 100644 (file)
index 7438c64..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#      $NetBSD: Makefile,v 1.5 1999/07/23 09:44:38 mrg Exp $
-#      $FreeBSD: src/lib/libusbhid/Makefile,v 1.6 2002/03/28 18:44:24 joe Exp $
-
-LIB=   usbhid
-MAN=   usbhid.3
-
-SHLIB_MAJOR= 2
-
-MLINKS=        usbhid.3 libusbhid.3 usbhid.3 hid_get_report_desc.3 \
-       usbhid.3 hid_dispose_report_desc.3 \
-       usbhid.3 hid_start_parse.3 usbhid.3 hid_end_parse.3 \
-       usbhid.3 hid_get_item.3 usbhid.3 hid_report_size.3 \
-       usbhid.3 hid_locate.3 \
-       usbhid.3 hid_usage_page.3 usbhid.3 hid_usage_in_page.3 \
-       usbhid.3 hid_parse_usage_page.3 usbhid.3 hid_parse_usage_in_page.3 \
-       usbhid.3 hid_init.3 \
-       usbhid.3 hid_get_data.3 usbhid.3 hid_set_data.3 \
-       usbhid.3 hid_use_report_desc.3
-
-SRCS=  descr.c parse.c usage.c data.c
-
-INCS=  usbhid.h
-
-.include <bsd.lib.mk>
-
diff --git a/lib/libusbhid/data.c b/lib/libusbhid/data.c
deleted file mode 100644 (file)
index b685673..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $NetBSD: data.c,v 1.8 2000/04/02 11:10:53 augustss Exp $ */
-
-/*
- * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/data.c,v 1.6 2003/04/09 01:52:48 mdodd Exp $
- * $DragonFly: src/lib/libusbhid/data.c,v 1.3 2008/11/24 17:15:17 hasso Exp $
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include "usbhid.h"
-
-int
-hid_get_data(const void *p, const hid_item_t *h)
-{
-       const unsigned char *buf;
-       unsigned int hpos;
-       unsigned int hsize;
-       int data;
-       int i, end, offs;
-
-       buf = p;
-       hpos = h->pos;                  /* bit position of data */
-       hsize = h->report_size;         /* bit length of data */
-
-       if (hsize == 0)
-               return (0);
-       offs = hpos / 8;
-       end = (hpos + hsize) / 8 - offs;
-       data = 0;
-       for (i = 0; i <= end; i++)
-               data |= buf[offs + i] << (i*8);
-       data >>= hpos % 8;
-       data &= (1 << hsize) - 1;
-       if (h->logical_minimum < 0) {
-               /* Need to sign extend */
-               hsize = sizeof data * 8 - hsize;
-               data = (data << hsize) >> hsize;
-       }
-       return (data);
-}
-
-void
-hid_set_data(void *p, const hid_item_t *h, int data)
-{
-       unsigned char *buf;
-       unsigned int hpos;
-       unsigned int hsize;
-       int i, end, offs, mask;
-
-       buf = p;
-       hpos = h->pos;                  /* bit position of data */
-       hsize = h->report_size;         /* bit length of data */
-
-       if (hsize != 32) {
-               mask = (1 << hsize) - 1;
-               data &= mask;
-       } else
-               mask = ~0;
-
-       data <<= (hpos % 8);
-       mask <<= (hpos % 8);
-       mask = ~mask;
-
-       offs = hpos / 8;
-       end = (hpos + hsize) / 8 - offs;
-
-       for (i = 0; i <= end; i++)
-               buf[offs + i] = (buf[offs + i] & (mask >> (i*8))) |
-                       ((data >> (i*8)) & 0xff);
-}
diff --git a/lib/libusbhid/descr.c b/lib/libusbhid/descr.c
deleted file mode 100644 (file)
index b1968c2..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/* $NetBSD: descr.c,v 1.9 2000/09/24 02:13:24 augustss Exp $ */
-
-/*
- * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/descr.c,v 1.8 2003/04/09 01:52:48 mdodd Exp $
- * $DragonFly: src/lib/libusbhid/descr.c,v 1.5 2008/11/24 17:15:17 hasso Exp $
- */
-
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-
-#include <bus/usb/usb.h>
-
-#include "usbhid.h"
-#include "usbvar.h"
-
-report_desc_t
-hid_get_report_desc(int fd)
-{
-       struct usb_ctl_report_desc rep;
-
-       rep.ucrd_size = 0;
-       if (ioctl(fd, USB_GET_REPORT_DESC, &rep) < 0)
-               return (NULL);
-
-       return hid_use_report_desc(rep.ucrd_data, (unsigned int)rep.ucrd_size);
-}
-
-report_desc_t
-hid_use_report_desc(unsigned char *data, unsigned int size)
-{
-       report_desc_t r;
-
-       r = malloc(sizeof(*r) + size);
-       if (r == 0) {
-               errno = ENOMEM;
-               return (NULL);
-       }
-       r->size = size;
-       memcpy(r->data, data, size);
-       return (r);
-}
-
-void
-hid_dispose_report_desc(report_desc_t r)
-{
-
-       free(r);
-}
diff --git a/lib/libusbhid/parse.c b/lib/libusbhid/parse.c
deleted file mode 100644 (file)
index 5f4564c..0000000
+++ /dev/null
@@ -1,440 +0,0 @@
-/* $NetBSD: parse.c,v 1.11 2000/09/24 02:19:54 augustss Exp $ */
-
-/*
- * Copyright (c) 1999, 2001 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/parse.c,v 1.10 2004/02/11 21:09:13 emax Exp $
- * $DragonFly: src/lib/libusbhid/parse.c,v 1.4 2008/11/24 17:15:17 hasso Exp $
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/time.h>
-
-#include <bus/usb/usb.h>
-#include <bus/usb/usbhid.h>
-
-#include "usbhid.h"
-#include "usbvar.h"
-
-#define MAXUSAGE 100
-struct hid_data {
-       u_char *start;
-       u_char *end;
-       u_char *p;
-       hid_item_t cur;
-       unsigned int usages[MAXUSAGE];
-       int nusage;
-       int minset;
-       int logminsize;
-       int multi;
-       int multimax;
-       int kindset;
-       int reportid;
-
-       /*
-        * The start of collection item has no report ID set, so save
-        * it until we know the ID.
-        */
-       hid_item_t savedcoll;
-       u_char hassavedcoll;
-       /*
-        * Absolute data position (bits) for input/output/feature.
-        *  Assumes that hid_input, hid_output and hid_feature have
-        *  values 0, 1 and 2.
-        */
-       unsigned int kindpos[3];
-};
-
-static int min(int x, int y) { return x < y ? x : y; }
-
-static int hid_get_item_raw(hid_data_t s, hid_item_t *h);
-
-static void
-hid_clear_local(hid_item_t *c)
-{
-       c->usage = 0;
-       c->usage_minimum = 0;
-       c->usage_maximum = 0;
-       c->designator_index = 0;
-       c->designator_minimum = 0;
-       c->designator_maximum = 0;
-       c->string_index = 0;
-       c->string_minimum = 0;
-       c->string_maximum = 0;
-       c->set_delimiter = 0;
-}
-
-hid_data_t
-hid_start_parse(report_desc_t d, int kindset, int id)
-{
-       struct hid_data *s;
-
-       s = malloc(sizeof *s);
-       memset(s, 0, sizeof *s);
-       s->start = s->p = d->data;
-       s->end = d->data + d->size;
-       s->kindset = kindset;
-       s->reportid = id;
-       s->hassavedcoll = 0;
-       return (s);
-}
-
-void
-hid_end_parse(hid_data_t s)
-{
-       while (s->cur.next) {
-               hid_item_t *hi = s->cur.next->next;
-               free(s->cur.next);
-               s->cur.next = hi;
-       }
-       free(s);
-}
-
-int
-hid_get_item(hid_data_t s, hid_item_t *h)
-{
-       int r;
-
-       for (;;) {
-               r = hid_get_item_raw(s, h);
-               if (r <= 0)
-                       break;
-               if (h->report_ID == s->reportid || s->reportid == -1)
-                       break;
-       }
-       return (r);
-}
-
-#define REPORT_SAVED_COLL \
-       do { \
-               if (s->hassavedcoll) { \
-                       *h = s->savedcoll; \
-                       h->report_ID = c->report_ID; \
-                       s->hassavedcoll = 0; \
-                       return (1); \
-               } \
-       } while(/*LINTED*/ 0)
-
-static int
-hid_get_item_raw(hid_data_t s, hid_item_t *h)
-{
-       hid_item_t *c;
-       unsigned int bTag = 0, bType = 0, bSize;
-       unsigned char *data;
-       int dval;
-       unsigned char *p;
-       hid_item_t *hi;
-       hid_item_t nc;
-       int i;
-       hid_kind_t retkind;
-
-       c = &s->cur;
-
- top:
-       if (s->multimax) {
-               REPORT_SAVED_COLL;
-               if (c->logical_minimum >= c->logical_maximum) {
-                       if (s->logminsize == 1)
-                               c->logical_minimum =(int8_t)c->logical_minimum;
-                       else if (s->logminsize == 2)
-                               c->logical_minimum =(int16_t)c->logical_minimum;
-               }
-               if (s->multi < s->multimax) {
-                       c->usage = s->usages[min(s->multi, s->nusage-1)];
-                       s->multi++;
-                       *h = *c;
-                       /*
-                        * 'multimax' is only non-zero if the current
-                         *  item kind is input/output/feature
-                        */
-                       h->pos = s->kindpos[c->kind];
-                       s->kindpos[c->kind] += c->report_size;
-                       h->next = 0;
-                       return (1);
-               } else {
-                       c->report_count = s->multimax;
-                       s->multimax = 0;
-                       s->nusage = 0;
-                       hid_clear_local(c);
-               }
-       }
-       for (;;) {
-               p = s->p;
-               if (p >= s->end)
-                       return (0);
-
-               bSize = *p++;
-               if (bSize == 0xfe) {
-                       /* long item */
-                       bSize = *p++;
-                       bSize |= *p++ << 8;
-                       bTag = *p++;
-                       data = p;
-                       p += bSize;
-               } else {
-                       /* short item */
-                       bTag = bSize >> 4;
-                       bType = (bSize >> 2) & 3;
-                       bSize &= 3;
-                       if (bSize == 3) bSize = 4;
-                       data = p;
-                       p += bSize;
-               }
-               s->p = p;
-               /*
-                * The spec is unclear if the data is signed or unsigned.
-                */
-               switch(bSize) {
-               case 0:
-                       dval = 0;
-                       break;
-               case 1:
-                       dval = *data++;
-                       break;
-               case 2:
-                       dval = *data++;
-                       dval |= *data++ << 8;
-                       break;
-               case 4:
-                       dval = *data++;
-                       dval |= *data++ << 8;
-                       dval |= *data++ << 16;
-                       dval |= *data++ << 24;
-                       break;
-               default:
-                       return (-1);
-               }
-
-               switch (bType) {
-               case 0:                 /* Main */
-                       switch (bTag) {
-                       case 8:         /* Input */
-                               retkind = hid_input;
-                       ret:
-                               if (!(s->kindset & (1 << retkind))) {
-                                       /* Drop the items of this kind */
-                                       s->nusage = 0;
-                                       continue;
-                               }
-                               c->kind = retkind;
-                               c->flags = dval;
-                               if (c->flags & HIO_VARIABLE) {
-                                       s->multimax = c->report_count;
-                                       s->multi = 0;
-                                       c->report_count = 1;
-                                       if (s->minset) {
-                                               for (i = c->usage_minimum;
-                                                    i <= c->usage_maximum;
-                                                    i++) {
-                                                       s->usages[s->nusage] = i;
-                                                       if (s->nusage < MAXUSAGE-1)
-                                                               s->nusage++;
-                                               }
-                                               c->usage_minimum = 0;
-                                               c->usage_maximum = 0;
-                                               s->minset = 0;
-                                       }
-                                       goto top;
-                               } else {
-                                       if (s->minset)
-                                               c->usage = c->usage_minimum;
-                                       *h = *c;
-                                       h->next = 0;
-                                       h->pos = s->kindpos[c->kind];
-                                       s->kindpos[c->kind] +=
-                                           c->report_size * c->report_count;
-                                       hid_clear_local(c);
-                                       s->minset = 0;
-                                       return (1);
-                               }
-                       case 9:         /* Output */
-                               retkind = hid_output;
-                               goto ret;
-                       case 10:        /* Collection */
-                               c->kind = hid_collection;
-                               c->collection = dval;
-                               c->collevel++;
-                               nc = *c;
-                               hid_clear_local(c);
-                               /*c->report_ID = NO_REPORT_ID;*/
-                               s->nusage = 0;
-                               if (s->hassavedcoll) {
-                                       *h = s->savedcoll;
-                                       h->report_ID = nc.report_ID;
-                                       s->savedcoll = nc;
-                                       return (1);
-                               } else {
-                                       s->hassavedcoll = 1;
-                                       s->savedcoll = nc;
-                               }
-                               break;
-                       case 11:        /* Feature */
-                               retkind = hid_feature;
-                               goto ret;
-                       case 12:        /* End collection */
-                               REPORT_SAVED_COLL;
-                               c->kind = hid_endcollection;
-                               c->collevel--;
-                               *h = *c;
-                               /*hid_clear_local(c);*/
-                               s->nusage = 0;
-                               return (1);
-                       default:
-                               return (-2);
-                       }
-                       break;
-
-               case 1:         /* Global */
-                       switch (bTag) {
-                       case 0:
-                               c->_usage_page = dval << 16;
-                               break;
-                       case 1:
-                               c->logical_minimum = dval;
-                               s->logminsize = bSize;
-                               break;
-                       case 2:
-                               c->logical_maximum = dval;
-                               break;
-                       case 3:
-                               c->physical_maximum = dval;
-                               break;
-                       case 4:
-                               c->physical_maximum = dval;
-                               break;
-                       case 5:
-                               c->unit_exponent = dval;
-                               break;
-                       case 6:
-                               c->unit = dval;
-                               break;
-                       case 7:
-                               c->report_size = dval;
-                               break;
-                       case 8:
-                               c->report_ID = dval;
-                               s->kindpos[hid_input] =
-                                   s->kindpos[hid_output] =
-                                   s->kindpos[hid_feature] = 0;
-                               break;
-                       case 9:
-                               c->report_count = dval;
-                               break;
-                       case 10: /* Push */
-                               hi = malloc(sizeof *hi);
-                               *hi = s->cur;
-                               c->next = hi;
-                               break;
-                       case 11: /* Pop */
-                               hi = c->next;
-                               s->cur = *hi;
-                               free(hi);
-                               break;
-                       default:
-                               return (-3);
-                       }
-                       break;
-               case 2:         /* Local */
-                       switch (bTag) {
-                       case 0:
-                               c->usage = c->_usage_page | dval;
-                               if (s->nusage < MAXUSAGE)
-                                       s->usages[s->nusage++] = c->usage;
-                               /* else XXX */
-                               break;
-                       case 1:
-                               s->minset = 1;
-                               c->usage_minimum = c->_usage_page | dval;
-                               break;
-                       case 2:
-                               c->usage_maximum = c->_usage_page | dval;
-                               break;
-                       case 3:
-                               c->designator_index = dval;
-                               break;
-                       case 4:
-                               c->designator_minimum = dval;
-                               break;
-                       case 5:
-                               c->designator_maximum = dval;
-                               break;
-                       case 7:
-                               c->string_index = dval;
-                               break;
-                       case 8:
-                               c->string_minimum = dval;
-                               break;
-                       case 9:
-                               c->string_maximum = dval;
-                               break;
-                       case 10:
-                               c->set_delimiter = dval;
-                               break;
-                       default:
-                               return (-4);
-                       }
-                       break;
-               default:
-                       return (-5);
-               }
-       }
-}
-
-int
-hid_report_size(report_desc_t r, enum hid_kind k, int id)
-{
-       struct hid_data *d;
-       hid_item_t h;
-       int size;
-
-       memset(&h, 0, sizeof h);
-       size = 0;
-       for (d = hid_start_parse(r, 1<<k, id); hid_get_item(d, &h); ) {
-               if (h.report_ID == id && h.kind == k) {
-                       size = d->kindpos[k];
-               }
-       }
-       hid_end_parse(d);
-       return ((size + 7) / 8);
-}
-
-int
-hid_locate(report_desc_t desc, unsigned int u, enum hid_kind k,
-          hid_item_t *h, int id)
-{
-       hid_data_t d;
-
-       for (d = hid_start_parse(desc, 1<<k, id); hid_get_item(d, h); ) {
-               if (h->kind == k && !(h->flags & HIO_CONST) && h->usage == u) {
-                       hid_end_parse(d);
-                       return (1);
-               }
-       }
-       hid_end_parse(d);
-       h->report_size = 0;
-       return (0);
-}
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c
deleted file mode 100644 (file)
index de25076..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $NetBSD: usage.c,v 1.8 2000/10/10 19:23:58 is Exp $ */
-
-/*
- * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/usage.c,v 1.8 2003/04/09 01:52:48 mdodd Exp $
- */
-
-#include <assert.h>
-#include <ctype.h>
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "usbhid.h"
-
-#define _PATH_HIDTABLE "/usr/share/misc/usb_hid_usages"
-
-struct usage_in_page {
-       const char *name;
-       int usage;
-};
-
-static struct usage_page {
-       const char *name;
-       int usage;
-       struct usage_in_page *page_contents;
-       int pagesize, pagesizemax;
-} *pages;
-static int npages, npagesmax;
-
-#ifdef DEBUG
-void
-dump_hid_table(void)
-{
-       int i, j;
-
-       for (i = 0; i < npages; i++) {
-               printf("%d\t%s\n", pages[i].usage, pages[i].name);
-               for (j = 0; j < pages[i].pagesize; j++) {
-                       printf("\t%d\t%s\n", pages[i].page_contents[j].usage,
-                              pages[i].page_contents[j].name);
-               }
-       }
-}
-#endif
-
-void
-hid_init(const char *hidname)
-{
-       FILE *f;
-       char line[100], name[100], *p, *n;
-       int no;
-       int lineno;
-       struct usage_page *curpage = NULL;
-
-       if (hidname == NULL)
-               hidname = _PATH_HIDTABLE;
-
-       f = fopen(hidname, "r");
-       if (f == NULL)
-               err(1, "%s", hidname);
-       for (lineno = 1; ; lineno++) {
-               if (fgets(line, sizeof line, f) == NULL)
-                       break;
-               if (line[0] == '#')
-                       continue;
-               for (p = line; *p && isspace(*p); p++)
-                       ;
-               if (!*p)
-                       continue;
-               if (sscanf(line, " * %[^\n]", name) == 1)
-                       no = -1;
-               else if (sscanf(line, " 0x%x %[^\n]", &no, name) != 2 &&
-                        sscanf(line, " %d %[^\n]", &no, name) != 2)
-                       errx(1, "file %s, line %d, syntax error",
-                            hidname, lineno);
-               for (p = name; *p; p++)
-                       if (isspace(*p) || *p == '.')
-                               *p = '_';
-               n = strdup(name);
-               if (!n)
-                       err(1, "strdup");
-               if (isspace(line[0])) {
-                       if (!curpage)
-                               errx(1, "file %s, line %d, syntax error",
-                                    hidname, lineno);
-                       if (curpage->pagesize >= curpage->pagesizemax) {
-                               curpage->pagesizemax += 10;
-                               curpage->page_contents =
-                                       realloc(curpage->page_contents,
-                                               curpage->pagesizemax *
-                                               sizeof (struct usage_in_page));
-                               if (!curpage->page_contents)
-                                       err(1, "realloc");
-                       }
-                       curpage->page_contents[curpage->pagesize].name = n;
-                       curpage->page_contents[curpage->pagesize].usage = no;
-                       curpage->pagesize++;
-               } else {
-                       if (npages >= npagesmax) {
-                               if (pages == NULL) {
-                                       npagesmax = 5;
-                                       pages = malloc(npagesmax *
-                                                 sizeof (struct usage_page));
-                               } else {
-                                       npagesmax += 5;
-                                       pages = realloc(pages,
-                                                  npagesmax *
-                                                  sizeof (struct usage_page));
-                               }
-                               if (!pages)
-                                       err(1, "alloc");
-                       }
-                       curpage = &pages[npages++];
-                       curpage->name = n;
-                       curpage->usage = no;
-                       curpage->pagesize = 0;
-                       curpage->pagesizemax = 10;
-                       curpage->page_contents =
-                               malloc(curpage->pagesizemax *
-                                      sizeof (struct usage_in_page));
-                       if (!curpage->page_contents)
-                               err(1, "malloc");
-               }
-       }
-       fclose(f);
-#ifdef DEBUG
-       dump_hid_table();
-#endif
-}
-
-const char *
-hid_usage_page(int i)
-{
-       static char b[10];
-       int k;
-
-       if (!pages)
-               errx(1, "no hid table");
-
-       for (k = 0; k < npages; k++)
-               if (pages[k].usage == i)
-                       return pages[k].name;
-       sprintf(b, "0x%04x", i);
-       return b;
-}
-
-const char *
-hid_usage_in_page(unsigned int u)
-{
-       int page = HID_PAGE(u);
-       int i = HID_USAGE(u);
-       static char b[100];
-       int j, k, us;
-
-       for (k = 0; k < npages; k++)
-               if (pages[k].usage == page)
-                       break;
-       if (k >= npages)
-               goto bad;
-       for (j = 0; j < pages[k].pagesize; j++) {
-               us = pages[k].page_contents[j].usage;
-               if (us == -1) {
-                       sprintf(b,
-                           fmtcheck(pages[k].page_contents[j].name, "%d"),
-                           i);
-                       return b;
-               }
-               if (us == i)
-                       return pages[k].page_contents[j].name;
-       }
- bad:
-       sprintf(b, "0x%04x", i);
-       return b;
-}
-
-int
-hid_parse_usage_page(const char *name)
-{
-       int k;
-
-       if (!pages)
-               errx(1, "no hid table");
-
-       for (k = 0; k < npages; k++)
-               if (strcmp(pages[k].name, name) == 0)
-                       return pages[k].usage;
-       return -1;
-}
-
-/* XXX handle hex */
-int
-hid_parse_usage_in_page(const char *name)
-{
-       const char *sep;
-       int k, j;
-       unsigned int l;
-
-       sep = strchr(name, ':');
-       if (sep == NULL)
-               return -1;
-       l = sep - name;
-       for (k = 0; k < npages; k++)
-               if (strncmp(pages[k].name, name, l) == 0)
-                       goto found;
-       return -1;
- found:
-       sep++;
-       for (j = 0; j < pages[k].pagesize; j++)
-               if (strcmp(pages[k].page_contents[j].name, sep) == 0)
-                       return (pages[k].usage << 16) | pages[k].page_contents[j].usage;
-       return (-1);
-}
diff --git a/lib/libusbhid/usbhid.3 b/lib/libusbhid/usbhid.3
deleted file mode 100644 (file)
index 05ab06e..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-.\"    $NetBSD: usb.3,v 1.13 2000/09/24 02:17:52 augustss Exp $
-.\"
-.\" Copyright (c) 1999, 2001 Lennart Augustsson <augustss@NetBSD.org>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/lib/libusbhid/usbhid.3,v 1.18 2005/11/24 11:26:36 ru Exp $
-.\" $DragonFly: src/lib/libusbhid/usbhid.3,v 1.10 2008/11/26 17:17:16 swildner Exp $
-.\"
-.Dd November 24, 2008
-.Dt USBHID 3
-.Os
-.Sh NAME
-.Nm usbhid ,
-.Nm hid_get_report_desc ,
-.Nm hid_use_report_desc ,
-.Nm hid_dispose_report_desc ,
-.Nm hid_start_parse ,
-.Nm hid_end_parse ,
-.Nm hid_get_item ,
-.Nm hid_report_size ,
-.Nm hid_locate ,
-.Nm hid_usage_page ,
-.Nm hid_usage_in_page ,
-.Nm hid_parse_usage_page ,
-.Nm hid_parse_usage_in_page ,
-.Nm hid_init ,
-.Nm hid_get_data ,
-.Nm hid_set_data
-.Nd USB HID access routines
-.Sh LIBRARY
-.Lb libusbhid
-.Sh SYNOPSIS
-.In usbhid.h
-.Ft report_desc_t
-.Fn hid_get_report_desc "int file"
-.Ft report_desc_t
-.Fn hid_use_report_desc "unsigned char *data" "unsigned int size"
-.Ft void
-.Fn hid_dispose_report_desc "report_desc_t d"
-.Ft hid_data_t
-.Fn hid_start_parse "report_desc_t d" "int kindset" "int id"
-.Ft void
-.Fn hid_end_parse "hid_data_t s"
-.Ft int
-.Fn hid_get_item "hid_data_t s" "hid_item_t *h"
-.Ft int
-.Fn hid_report_size "report_desc_t d" "hid_kind_t k" "int id"
-.Ft int
-.Fn hid_locate "report_desc_t d" "unsigned int usage" "hid_kind_t k" "hid_item_t *h" "int id"
-.Ft "const char *"
-.Fn hid_usage_page "int i"
-.Ft "const char *"
-.Fn hid_usage_in_page "unsigned int u"
-.Ft int
-.Fn hid_parse_usage_page "const char *"
-.Ft int
-.Fn hid_parse_usage_in_page "const char *"
-.Ft void
-.Fn hid_init "const char *file"
-.Ft int
-.Fn hid_get_data "const void *data" "const hid_item_t *h"
-.Ft void
-.Fn hid_set_data "void *buf" "const hid_item_t *h" "int data"
-.Sh DESCRIPTION
-The
-.Nm
-library provides routines to extract data from USB Human Interface Devices.
-.Ss Introduction
-USB HID devices send and receive data laid out in a device dependent way.
-The
-.Nm
-library contains routines to extract the
-.Em "report descriptor"
-which contains the data layout information and then use this information.
-.Pp
-The routines can be divided into four parts: extraction of the descriptor,
-parsing of the descriptor, translating to/from symbolic names, and
-data manipulation.
-.Ss Descriptor Functions
-A report descriptor can be obtained by calling
-.Fn hid_get_report_desc
-with a file descriptor obtained by opening a
-.Xr uhid 4
-device.
-Alternatively a data buffer containing the report descriptor can be
-passed into
-.Fn hid_use_report_desc .
-The data is copied into an internal structure.
-When the report descriptor
-is no longer needed it should be freed by calling
-.Fn hid_dispose_report_desc .
-The type
-.Vt report_desc_t
-is opaque and should be used when calling the parsing functions.
-If
-.Fn hid_dispose_report_desc
-fails it will return
-.Dv NULL .
-.Ss Descriptor Parsing Functions
-To parse the report descriptor the
-.Fn hid_start_parse
-function should be called with a report descriptor and a set that
-describes which items that are interesting.
-The set is obtained by OR-ing together values
-.Fa "(1 << k)"
-where
-.Fa k
-is an item of type
-.Vt hid_kind_t .
-The report ID (if present) is given by
-.Fa id .
-The function returns
-.Dv NULL
-if the initialization fails, otherwise an opaque value to be used
-in subsequent calls.
-After parsing the
-.Fn hid_end_parse
-function should be called to free internal data structures.
-.Pp
-To iterate through all the items in the report descriptor
-.Fn hid_get_item
-should be called while it returns a value greater than 0.
-When the report descriptor ends it will returns 0; a syntax
-error within the report descriptor will cause a return value less
-than 0.
-The struct pointed to by
-.Fa h
-will be filled with the relevant data for the item.
-The definition of
-.Vt hid_item_t
-can be found in
-.In usbhid.h
-and the meaning of the components in the USB HID documentation.
-.Pp
-Data should be read/written to the device in the size of
-the report.
-The size of a report (of a certain kind) can be computed by the
-.Fn hid_report_size
-function.
-If the report is prefixed by an ID byte it is given by
-.Fa id .
-.Pp
-To locate a single item the
-.Fn hid_locate
-function can be used.
-It should be given the usage code of
-the item and its kind and it will fill the item and return
-non-zero if the item was found.
-.Ss Name Translation Functions
-The function
-.Fn hid_usage_page
-will return the symbolic name of a usage page, and the function
-.Fn hid_usage_in_page
-will return the symbolic name of the usage within the page.
-Both these functions may return a pointer to static data.
-.Pp
-The functions
-.Fn hid_parse_usage_page
-and
-.Fn hid_parse_usage_in_page
-are the inverses of
-.Fn hid_usage_page
-and
-.Fn hid_usage_in_page .
-They take a usage string and return the number of the usage, or \-1
-if it cannot be found.
-.Pp
-Before any of these functions can be called the usage table
-must be parsed, this is done by calling
-.Fn hid_init
-with the name of the table.
-Passing
-.Dv NULL
-to this function will cause it to use the default table.
-.Ss Data Extraction Functions
-Given the data obtained from a HID device and an item in the
-report descriptor the
-.Fn hid_get_data
-function extracts the value of the item.
-Conversely
-.Fn hid_set_data
-can be used to put data into a report (which must be zeroed first).
-.Sh FILES
-.Bl -tag -width ".Pa /usr/share/misc/usb_hid_usages"
-.It Pa /usr/share/misc/usb_hid_usages
-The default HID usage table.
-.El
-.Sh EXAMPLES
-Not yet.
-.Sh SEE ALSO
-The
-.Tn USB
-specifications can be found at
-.Pa http://www.usb.org/developers/docs/ .
-.Pp
-.Xr uhid 4 ,
-.Xr usb 4
-.Sh HISTORY
-The
-.Nm
-library first appeared in
-.Nx 1.5 .
-.Sh BUGS
-This man page is woefully incomplete.
diff --git a/lib/libusbhid/usbhid.h b/lib/libusbhid/usbhid.h
deleted file mode 100644 (file)
index f87af45..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*     $NetBSD: usb.h,v 1.8 2000/08/13 22:22:02 augustss Exp $ */
-
-/*
- * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/usbhid.h,v 1.11 2004/06/03 15:04:24 des Exp $
- * $DragonFly: src/lib/libusbhid/usbhid.h,v 1.1 2008/11/24 17:15:17 hasso Exp $
- */
-
-#include <sys/cdefs.h>
-
-typedef struct report_desc *report_desc_t;
-
-typedef struct hid_data *hid_data_t;
-
-typedef enum hid_kind {
-       hid_input = 0,
-       hid_output = 1,
-       hid_feature = 2,
-       hid_collection,
-       hid_endcollection
-} hid_kind_t;
-
-typedef struct hid_item {
-       /* Global */
-       unsigned int _usage_page;
-       int logical_minimum;
-       int logical_maximum;
-       int physical_minimum;
-       int physical_maximum;
-       int unit_exponent;
-       int unit;
-       int report_size;
-       int report_ID;
-#define NO_REPORT_ID 0
-       int report_count;
-       /* Local */
-       unsigned int usage;
-       int usage_minimum;
-       int usage_maximum;
-       int designator_index;
-       int designator_minimum;
-       int designator_maximum;
-       int string_index;
-       int string_minimum;
-       int string_maximum;
-       int set_delimiter;
-       /* Misc */
-       int collection;
-       int collevel;
-       enum hid_kind kind;
-       unsigned int flags;
-       /* Absolute data position (bits) */
-       unsigned int pos;
-       /* */
-       struct hid_item *next;
-} hid_item_t;
-
-#define HID_PAGE(u) (((u) >> 16) & 0xffff)
-#define HID_USAGE(u) ((u) & 0xffff)
-
-__BEGIN_DECLS
-
-/* Obtaining a report descriptor, descr.c: */
-report_desc_t hid_get_report_desc(int file);
-report_desc_t hid_use_report_desc(unsigned char *data, unsigned int size);
-void hid_dispose_report_desc(report_desc_t);
-
-/* Parsing of a HID report descriptor, parse.c: */
-hid_data_t hid_start_parse(report_desc_t d, int kindset, int id);
-void hid_end_parse(hid_data_t s);
-int hid_get_item(hid_data_t s, hid_item_t *h);
-int hid_report_size(report_desc_t d, enum hid_kind k, int id);
-int hid_locate(report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h, int id);
-
-/* Conversion to/from usage names, usage.c: */
-const char *hid_usage_page(int i);
-const char *hid_usage_in_page(unsigned int u);
-void hid_init(const char *file);
-int hid_parse_usage_in_page(const char *name);
-int hid_parse_usage_page(const char *name);
-
-/* Extracting/insertion of data, data.c: */
-int hid_get_data(const void *p, const hid_item_t *h);
-void hid_set_data(void *p, const hid_item_t *h, int data);
-
-__END_DECLS
diff --git a/lib/libusbhid/usbvar.h b/lib/libusbhid/usbvar.h
deleted file mode 100644 (file)
index 2b40b2a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*     $NetBSD: usbvar.h,v 1.2 1999/05/11 21:15:46 augustss Exp $      */
-
-/*
- * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libusbhid/usbvar.h,v 1.2.2.1 2002/04/03 15:54:00 joe Exp $
- * $DragonFly: src/lib/libusbhid/usbvar.h,v 1.2 2003/06/17 04:26:51 dillon Exp $
- *
- */
-
-struct report_desc {
-       unsigned int size;
-       unsigned char data[1];
-};
-
index 8d3efca..74a892e 100644 (file)
@@ -72,7 +72,6 @@ shells                - list of configurable shells
 sysctl.conf    - kernel state defaults
 syslog.conf    - configuration file for syslogd(8)
 ttys           - defines port configuration for init(8)
-usbd.conf      - configuration file for usbd(8)
 defaults/      - directory containing default configuration files
 defaults/compilers.conf        - default configuration for non-base compilers
 defaults/devfs.conf    - default rule file for devfs(5)
index 621aecb..a3a56f4 100644 (file)
@@ -130,6 +130,7 @@ MAN=        aac.4 \
        ip.4 \
        ip6.4 \
        ipfirewall.4 \
+       ipheth.4 \
        ips.4 \
        ipsec.4 \
        isa.4 \
@@ -154,7 +155,6 @@ MAN=        aac.4 \
        lagg.4 \
        led.4 \
        lge.4 \
-       lgue.4 \
        lm.4 \
        lo.4 \
        lp.4 \
@@ -169,6 +169,7 @@ MAN=        aac.4 \
        mmc.4 \
        mmcsd.4 \
        mn.4 \
+       mos.4 \
        moscom.4 \
        mouse.4 \
        mps.4 \
@@ -252,7 +253,9 @@ MAN=        aac.4 \
        rndtest.4 \
        route.4 \
        rp.4 \
-       rue.4 \
+       rum.4 \
+       run.4 \
+       runfw.4 \
        sa.4 \
        safe.4 \
        sbp.4 \
@@ -326,12 +329,18 @@ MAN=      aac.4 \
        uark.4 \
        ubsa.4 \
        ubsec.4 \
+       ubser.4 \
        ubt.4 \
        uchcom.4 \
+       ucycom.4 \
        ucom.4 \
+       udav.4 \
        udp.4 \
+       uep.4 \
        ufm.4 \
+       ufoma.4 \
        uftdi.4 \
+       uipaq.4 \
        ugen.4 \
        ugensa.4 \
        uguru.4 \
@@ -340,16 +349,25 @@ MAN=      aac.4 \
        ukbd.4 \
        ulpt.4 \
        umass.4 \
+       umcs.4 \
        umct.4 \
        umodem.4 \
+       umoscom.4 \
        ums.4 \
        unix.4 \
        uplcom.4 \
        upmap.4 \
        urio.4 \
+       urndis.4 \
+       urtwn.4 \
+       urtwnfw.4 \
        usb.4 \
+       usb_quirk.4 \
+       usb_template.4 \
        uscanner.4 \
+       usfs.4 \
        uslcom.4 \
+       u3g.4 \
        uticom.4 \
        uvisor.4 \
        uvscom.4 \
@@ -376,6 +394,7 @@ MAN=        aac.4 \
        wlan_xauth.4 \
        wpi.4 \
        xe.4 \
+       xhci.4 \
        xl.4 \
        xpt.4 \
        zero.4
@@ -388,7 +407,6 @@ MAN=        aac.4 \
 #      bwi.4 \
 #      iwl.4 \
 #      rtw.4 \
-#      ural.4 \
 
 MLINKS=        acpi_thermal.4 acpi_tz.4
 #MLINKS+=acx.4 if_acx.4
@@ -437,6 +455,7 @@ MLINKS+=iicbus.4 ic.4 \
 MLINKS+=ipfirewall.4 ipaccounting.4 \
        ipfirewall.4 ipacct.4 \
        ipfirewall.4 ipfw.4
+MLINKS+=ipheth.4 if_ipheth.4
 MLINKS+=iwi.4 if_iwi.4
 #MLINKS+=iwl.4 if_iwl.4
 MLINKS+=iwn.4 if_iwn.4
@@ -447,10 +466,10 @@ MLINKS+=jme.4 if_jme.4
 MLINKS+=kue.4 if_kue.4
 MLINKS+=lagg.4 if_lagg.4
 MLINKS+=lge.4 if_lge.4
-MLINKS+=lgue.4 if_lgue.4
 MLINKS+=lo.4 loop.4
 MLINKS+=lp.4 plip.4
 MLINKS+=mem.4 kmem.4
+MLINKS+=mos.4 if_mos.4
 MLINKS+=msk.4 if_msk.4
 MLINKS+=mxge.4 if_mxge.4
 MLINKS+=my.4 if_my.4
@@ -472,7 +491,9 @@ MLINKS+=random.4 urandom.4
 MLINKS+=re.4 if_re.4
 MLINKS+=rl.4 if_rl.4
 #MLINKS+=rtw.4 if_rtw.4
-MLINKS+=rue.4 if_rue.4
+#MLINKS+=rue.4 if_rue.4
+MLINKS+=rum.4 if_rum.4
+MLINKS+=run.4 if_run.4
 MLINKS+=sbsh.4 if_sbsh.4
 MLINKS+=scsi.4 CAM.4 \
        scsi.4 cam.4 \
@@ -517,8 +538,11 @@ MLINKS+=ti.4 if_ti.4
 MLINKS+=tl.4 if_tl.4
 MLINKS+=tun.4 if_tun.4
 MLINKS+=txp.4 if_txp.4
+MLINKS+=udav.4 if_udav.4
 MLINKS+=upmap.4 kpmap.4
 #MLINKS+=ural.4 if_ural.4
+MLINKS+=urndis.4 if_urndis.4
+MLINKS+=urtwn.4 if_urtwn.4
 MLINKS+=vga.4 vesa.4
 MLINKS+=vge.4 if_vge.4
 MLINKS+=vlan.4 if_vlan.4
@@ -531,38 +555,6 @@ MLINKS+=wpi.4 if_wpi.4
 MLINKS+=xe.4 if_xe.4
 MLINKS+=xl.4 if_xl.4
 
-.if !defined(WANT_OLDUSB)
-MAN+= \
-       ipheth.4 \
-       mos.4 \
-       rum.4 \
-       run.4 \
-       runfw.4 \
-       ubser.4 \
-       ucycom.4 \
-       udav.4 \
-       uep.4 \
-       ufoma.4 \
-       uipaq.4 \
-       umcs.4 \
-       umoscom.4 \
-       urndis.4 \
-       urtwn.4 \
-       urtwnfw.4 \
-       usb_quirk.4 \
-       usb_template.4 \
-       usfs.4 \
-       u3g.4 \
-       xhci.4
-MLINKS+=ipheth.4 if_ipheth.4
-MLINKS+=mos.4 if_mos.4
-MLINKS+=rum.4 if_rum.4
-MLINKS+=run.4 if_run.4
-MLINKS+=udav.4 if_udav.4
-MLINKS+=urndis.4 if_urndis.4
-MLINKS+=urtwn.4 if_urtwn.4
-.endif
-
 .if ${MACHINE_ARCH} == "i386"
 SUBDIR=         man4.${MACHINE_ARCH}
 .endif
diff --git a/share/man/man4/lgue.4 b/share/man/man4/lgue.4
deleted file mode 100644 (file)
index 5329324..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-.\"
-.\" Copyright (c) 2011
-.\"    The DragonFly Project.  All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\"
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in
-.\"    the documentation and/or other materials provided with the
-.\"    distribution.
-.\" 3. Neither the name of The DragonFly Project nor the names of its
-.\"    contributors may be used to endorse or promote products derived
-.\"    from this software without specific, prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
-.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
-.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.Dd July 25, 2011
-.Dt LGUE 4
-.Os
-.Sh NAME
-.Nm lgue
-.Nd USB CDC ethernet
-.Sh SYNOPSIS
-.Cd "device uhci"
-.Cd "device ohci"
-.Cd "device oldusb"
-.Cd "device lgue"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for USB CDC (communication device class) ethernet.
-It currently supports the
-.Tn LG P-500
-smartphone.
-.Pp
-For more information on configuring this device, see
-.Xr ifconfig 8 .
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr netintro 4 ,
-.Xr ng_ether 4 ,
-.Xr ifconfig 8
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Dx 2.11 .
diff --git a/share/man/man4/rue.4 b/share/man/man4/rue.4
deleted file mode 100644 (file)
index cc5984f..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-.\"
-.\" Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $FreeBSD: src/share/man/man4/rue.4,v 1.11 2005/10/07 02:32:15 trhodes Exp $
-.\"
-.Dd July 16, 2005
-.Dt RUE 4
-.Os
-.Sh NAME
-.Nm rue
-.Nd "RealTek RTL8150 USB to Fast Ethernet controller driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following lines in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device uhci"
-.Cd "device ohci"
-.Cd "device oldusb"
-.Cd "device miibus"
-.Cd "device rue"
-.Ed
-.Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-if_rue_load="YES"
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for USB Ethernet adapters based on the RealTek
-RTL8150 USB to Fast Ethernet controller chip.
-.Pp
-The RTL8150 contains an integrated Fast Ethernet MAC, which supports
-both 10 and 100Mbps speeds in either full or half duplex.
-Although designed to interface with
-100Mbps peripheral, the existing USB standard specifies a maximum
-transfer speed of 12Mbps.
-Users should therefore not expect to actually
-achieve 100Mbps speeds with this device.
-.Pp
-The
-.Nm
-driver supports the following media types:
-.Bl -tag -width ".Cm 10baseT/UTP"
-.It Cm autoselect
-Enable auto selection of the media type and options.
-The user can manually override
-the auto selected mode by adding media options to the
-.Pa /etc/rc.conf
-file.
-.It Cm 10baseT/UTP
-Set 10Mbps operation.
-The
-.Cm mediaopt
-option can also be used to select either
-.Cm full-duplex
-or
-.Cm half-duplex
-modes.
-.It Cm 100baseTX
-Set 100Mbps (Fast Ethernet) operation.
-The
-.Cm mediaopt
-option can also be used to select either
-.Cm full-duplex
-or
-.Cm half-duplex
-modes.
-.El
-.Pp
-The
-.Nm
-driver supports the following media options:
-.Bl -tag -width ".Cm 10baseT/UTP"
-.It Cm full-duplex
-Force full duplex operation.
-.It Cm half-duplex
-Force half duplex operation.
-.El
-.Pp
-For more information on configuring this device, see
-.Xr ifconfig 8 .
-.Sh HARDWARE
-The
-.Nm
-driver supports RealTek RTL8150 based USB Ethernet
-adapters including:
-.Pp
-.Bl -bullet -compact
-.It
-Buffalo (Melco Inc.) LUA-KTX
-.It
-Green House GH-USB100B
-.It
-LinkSys USB100M
-.It
-Billionton 10/100 FastEthernet USBKR2
-.El
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "rue%d: watchdog timeout"
-A packet was queued for transmission and a transmit command was
-issued, however the device failed to acknowledge the transmission
-before a timeout expired.
-.It "rue%d: rx list init failed"
-The driver failed to allocate an mbuf for the transmitter ring.
-.It "rue%d: no memory for rx list"
-The driver failed to allocate an mbuf for the receiver ring.
-.El
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr ifmedia 4 ,
-.Xr miibus 4 ,
-.Xr netintro 4 ,
-.Xr ng_ether 4 ,
-.Xr ifconfig 8
-.Rs
-.%T "ReakTek RTL8150 data sheet"
-.%O ftp://ftp.realtek.com.tw/lancard/data_sheet/8150/
-.Re
-.Sh HISTORY
-The
-.Nm
-device driver first appeared in
-.Fx 5.1 .
-.Sh AUTHORS
-The
-.Nm
-driver was written by
-.An Shunsuke Akiyama Aq Mt akiyama@FreeBSD.org .
index 68d0c5a..51eb764 100644 (file)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/snd_uaudio.4 267938 2014-06-26 21:46:14Z bapt $
 .\"
-.Dd September 2, 2014
+.Dd November 10, 2014
 .Dt SND_UAUDIO 4
 .Os
 .Sh NAME
@@ -48,7 +48,7 @@ Alternatively, to load the driver as a module at boot time, place the
 following line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
-snd_uaudio_load="YES"
+uaudio_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
diff --git a/share/man/man4/ural.4 b/share/man/man4/ural.4
deleted file mode 100644 (file)
index 085eadd..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-.\" Copyright (c) 2005, 2006
-.\"     Damien Bergamini <damien.bergamini@free.fr>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.\" $FreeBSD: src/share/man/man4/ural.4,v 1.11 2006/10/07 18:18:40 flz Exp $
-.\"
-.Dd July 26, 2008
-.Os
-.Dt URAL 4
-.Sh NAME
-.Nm ural
-.Nd "Ralink Technology RT2500USB IEEE 802.11 driver"
-.Sh SYNOPSIS
-To compile this driver into the kernel,
-place the following lines in your
-kernel configuration file:
-.Bd -ragged -offset indent
-.Cd "device ehci"
-.Cd "device uhci"
-.Cd "device ohci"
-.Cd "device oldusb"
-.Cd "device ural"
-.Cd "device wlan"
-.Cd "device wlan_ratectl_onoe"
-.Ed
-.Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
-.Xr loader.conf 5 :
-.Bd -literal -offset indent
-if_ural_load="YES"
-.Ed
-.Sh DESCRIPTION
-The
-.Nm
-driver supports USB 2.0 wireless adapters based on the RT2500USB chipset.
-.Pp
-The RT2500USB chipset consists of two integrated chips, a RT2570 MAC/BBP
-and a radio transceiver (the model of which depends on the card revision).
-.Pp
-The RT2522, RT2523, RT2524, RT2525, RT2525e and RT2526 radio transceivers
-operate in the 2.4GHz band (802.11b/g) whereas the RT5222 is a dual-band radio
-transceiver that can operate in the 2.4GHz and 5.2GHz bands (802.11a).
-.Sh HARDWARE
-The
-.Nm
-driver supports the following adapters:
-.Pp
-.Bl -bullet -compact
-.It
-AMIT WL532U
-.It
-ASUS WL-167g
-.It
-Belkin F5D7050 v2000
-.It
-Buffalo WLI-U2-KG54
-.It
-Buffalo WLI-U2-KG54-AI
-.It
-Buffalo WLI-U2-KG54-YB
-.It
-CNet CWD-854
-.It
-Compex WLU54G 2A1100
-.It
-Conceptronic C54RU
-.It
-D-Link DWL-G122 b1
-.It
-Dynalink WLG25USB
-.It
-E-Tech WGUS02
-.It
-Eminent 3035
-.It
-Gigabyte GN-WBKG
-.It
-Hercules HWGUSB2-54
-.It
-KCORP LifeStyle KLS-685
-.It
-Linksys HU200-TS
-.It
-Linksys WUSB54G v4
-.It
-Linksys WUSB54GP v4
-.It
-MSI MS-6861
-.It
-MSI MS-6865
-.It
-MSI MS-6869
-.It
-Nintendo Wi-Fi USB Connector
-.It
-NovaTech NV-902
-.It
-OvisLink Evo-W54USB
-.It
-SerComm UB801R
-.It
-SparkLAN WL-685R
-.It
-Sphairon UB801R
-.It
-Surecom EP-9001-g
-.It
-Sweex LC100060
-.It
-Tonze UW-6200C
-.It
-Zaapa ZNWUSB-54
-.It
-Zinwell ZPlus-G250
-.It
-Zinwell ZWX-G261
-.It
-Zonet ZEW2500P
-.El
-.Pp
-An up to date list can be found at
-.Pa http://ralink.rapla.net/ .
-.Sh EXAMPLES
-Refer to the
-.Sx EXAMPLES
-section of
-.Xr wlan 4 .
-.Sh DIAGNOSTICS
-.Bl -diag
-.It "ural%d: device timeout"
-The driver will reset the hardware.
-This should not happen.
-.El
-.Sh SEE ALSO
-.Xr arp 4 ,
-.Xr ifmedia 4 ,
-.Xr netintro 4 ,
-.Xr usb 4 ,
-.Xr wlan 4 ,
-.Xr wlan_ratectl 4 ,
-.Xr hostapd 8 ,
-.Xr ifconfig 8 ,
-.Xr wpa_supplicant 8
-.Rs
-.%T "Ralink Technology"
-.%O http://www.ralinktech.com/
-.Re
-.Sh HISTORY
-The
-.Nm
-driver first appeared in
-.Ox 3.7 .
-.Sh CAVEATS
-The
-.Nm
-driver supports automatic adaptation of the transmit speed in IBSS
-and HostAP operating modes,
-but it does not work well if there are more than one peer node.
-.Sh AUTHORS
-The
-.Nm
-driver was written by
-.An Damien Bergamini Aq Mt damien@FreeBSD.org .
index 38ca52d..e49ea51 100644 (file)
@@ -596,11 +596,6 @@ userland.
 It has to be accompanied by
 .Dv NETGRAPH7*
 options in the kernel.
-.It Va WANT_OLDUSB
-.Pq Vt bool
-Set to build the old, deprecated
-.Xr usb 4
-userland.
 .El
 .Pp
 The following list provides a name and short description for variables
index 13ec494..50fb9d3 100644 (file)
@@ -2264,22 +2264,6 @@ is set to
 these are the flags to pass to the
 .Xr ftpd 8
 daemon.
-.It Va usbd_enable
-.Pq Vt bool
-If set to
-.Dq Li YES ,
-run the
-.Xr usbd 8
-daemon at boot time.
-.It Va usbd_flags
-.Pq Vt str
-If
-.Va usbd_enable
-is set to
-.Dq Li YES ,
-these are the flags passed to
-.Xr usbd 8
-daemon.
 .It Va watchdogd_enable
 .Pq Vt bool
 If set to
@@ -2749,7 +2733,6 @@ if it is not set.
 .Xr syslogd 8 ,
 .Xr sysvipcd 8 ,
 .Xr timed 8 ,
-.Xr usbd 8 ,
 .Xr vinum 8 ,
 .Xr yp 8 ,
 .Xr ypbind 8 ,
index fdb37e4..3b44fc4 100644 (file)
@@ -1,9 +1,3 @@
-SUBDIR=        cam firewire iicbus mmc pccard ppbus smbus
-
-.if !defined(WANT_OLDUSB)
-SUBDIR+=u4b
-.else
-SUBDIR+=usb
-.endif
+SUBDIR=        cam firewire iicbus mmc pccard ppbus smbus u4b
 
 .include <bsd.subdir.mk>
index d6e388f..9219e50 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "opt_acpi.h"
 #include "opt_compat_oldpci.h"
-#include "use_oldusb.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <bus/pci/pcivar.h>
 #include <bus/pci/pci_private.h>
 
-#if NOLDUSB == 0
 #include <bus/u4b/controller/xhcireg.h>
 #include <bus/u4b/controller/ehcireg.h>
 #include <bus/u4b/controller/ohcireg.h>
 #include <bus/u4b/controller/uhcireg.h>
-#endif
 
 #include "pcib_if.h"
 #include "pci_if.h"
@@ -311,12 +308,8 @@ TUNABLE_INT("hw.pci.honor_msi_blacklist", &pci_honor_msi_blacklist);
 SYSCTL_INT(_hw_pci, OID_AUTO, honor_msi_blacklist, CTLFLAG_RD,
     &pci_honor_msi_blacklist, 1, "Honor chipset blacklist for MSI");
 
-#if NOLDUSB == 0
 #if defined(__i386__) || defined(__x86_64__)
 static int pci_usb_takeover = 1;
-#else
-static int pci_usb_takeover = 0;
-#endif
 TUNABLE_INT("hw.pci.usb_early_takeover", &pci_usb_takeover);
 SYSCTL_INT(_hw_pci, OID_AUTO, usb_early_takeover, CTLFLAG_RD,
     &pci_usb_takeover, 1, "Enable early takeover of USB controllers.\n\
@@ -2777,7 +2770,6 @@ pci_assign_interrupt(device_t bus, device_t dev, int force_route)
            machintr_legacy_intr_cpuid(irq));
 }
 
-#if NOLDUSB == 0
 /* Perform early OHCI takeover from SMM. */
 static void
 ohci_early_takeover(device_t self)
@@ -2970,7 +2962,6 @@ xhci_early_takeover(device_t self)
        }
        bus_release_resource(self, SYS_RES_MEMORY, rid, res);
 }
-#endif /* NOLDUSB == 0 */
 
 void
 pci_add_resources(device_t pcib, device_t bus, device_t dev, int force, uint32_t prefetchmask)
@@ -3017,7 +3008,6 @@ pci_add_resources(device_t pcib, device_t bus, device_t dev, int force, uint32_t
                pci_assign_interrupt(bus, dev, 1);
        }
 
-#if NOLDUSB == 0
        if (pci_usb_takeover && pci_get_class(dev) == PCIC_SERIALBUS &&
            pci_get_subclass(dev) == PCIS_SERIALBUS_USB) {
                if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_XHCI)
@@ -3029,7 +3019,6 @@ pci_add_resources(device_t pcib, device_t bus, device_t dev, int force, uint32_t
                else if (pci_get_progif(dev) == PCIP_SERIALBUS_USB_UHCI)
                        uhci_early_takeover(dev);
        }
-#endif
 }
 
 void
diff --git a/sys/bus/usb/FILES b/sys/bus/usb/FILES
deleted file mode 100644 (file)
index 6c87d6c..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-$FreeBSD: src/sys/dev/usb/FILES,v 1.6 2003/04/14 14:04:07 ticso Exp $
-$DragonFly: src/sys/bus/usb/FILES,v 1.4 2007/11/05 19:09:42 hasso Exp $
-
-A small roadmap of the USB files:
-
-FILES                  this file
-Makefile               to install .h files
-TODO                   just a list of things to do
-dsbr100io.h            API for ufm.c
-ehci.c                 Host controller driver for EHCI
-ehcireg.h              Hardware definitions for EHCI
-ehcivar.h              API for ehci.c
-files.usb              config include file
-hid.c                  subroutines to parse and access HID data
-hid.h                  API for hid.c
-if_aue.c               USB Pegasus Ethernet driver
-if_auereg.h              and definitions for it
-if_cue.c               USB CATC Ethernet driver
-if_cuereg.h              and definitions for it
-if_kue.c               USB Kawasaki Ethernet driver
-if_kuereg.h              and definitions for it
-if_upl.c               USB Prolofic host-to-host driver
-ohci.c                 Host controller driver for OHCI
-ohcireg.h              Hardware definitions for OHCI
-ohcivar.h              API for ohci.c
-uaudio.c               USB audio class driver
-uaudioreg.h              and definitions for it
-ufm.c                  USB fm radio driver
-[Merged] ugen.c                generic driver that can handle access to any USB device
-uhci.c                 Host controller driver for UHCI
-uhcireg.h              Hardware definitions for UHCI
-uhcivar.h              API for uhci.c
-uhid.c                 USB HID class driver
-uhub.c                 USB hub driver
-ukbd.c                 USB keyboard driver
-ukbdmap.c              wscons key mapping for ukbd
-ukbdvar.h              API for ukbd.c
-ulpt.c                 USB printer class driver
-umass.c                        USB mass storage driver
-umodem.c               USB modem (CDC ACM) driver
-ums.c                  USB mouse driver
-urio.c                 USB Diamond Rio500 driver
-usb.c                  usb (bus) device driver
-usb.h                  general USB defines
-usb_mem.c              memory allocation for DMAable memory
-usb_mem.h              API for usb_mem.c
-usb_port.h             compatibility defines for different OSs
-usb_quirks.c           table of non-conforming USB devices and their problems
-usb_quirks.h           API for usb_quirks.c
-usb_subr.c             various subroutines used by USB code
-usbcdc.h               USB CDC class definitions
-usbdi.c                        implementation of the USBDI API, which all drivers use
-usbdi.h                        API for usbdi.c
-usbdi_util.c           utilities built on top of usbdi.h
-usbdi_util.h           API for usbdi_util.c
-usbdivar.h             internal defines and structures for usbdi.c
-uscanner.c             minimal USB scanner driver
-usbhid.h               USB HID class definitions
diff --git a/sys/bus/usb/Makefile b/sys/bus/usb/Makefile
deleted file mode 100644 (file)
index 46bead2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# Makefile - module build for usb bus elements
-#
-# $DragonFly: src/sys/bus/usb/Makefile,v 1.6 2004/03/17 18:12:55 dillon Exp $
-
-SUBDIR=usb ehci
-
-.include <bsd.subdir.mk>
diff --git a/sys/bus/usb/dsbr100io.h b/sys/bus/usb/dsbr100io.h
deleted file mode 100644 (file)
index 39e29d2..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2001 M. Warner Losh
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This code is based on ugen.c and ulpt.c developed by Lennart Augustsson.
- * This code includes software developed by the NetBSD Foundation, Inc. and
- * its contributors.
- */
-
-/*
- * $FreeBSD: src/sys/dev/usb/dsbr100io.h,v 1.1 2002/03/04 03:51:19 alfred Exp $
- * $DragonFly: src/sys/bus/usb/dsbr100io.h,v 1.5 2007/06/27 12:27:59 hasso Exp $
- */
-
-#include <sys/ioccom.h>
-
-#define FM_SET_FREQ    _IOWR('U', 200, int)
-#define FM_GET_FREQ    _IOWR('U', 201, int)
-#define FM_START       _IOWR('U', 202, int)
-#define FM_STOP                _IOWR('U', 203, int)
-#define FM_GET_STAT    _IOWR('U', 204, int)
diff --git a/sys/bus/usb/ehci.c b/sys/bus/usb/ehci.c
deleted file mode 100644 (file)
index 670e0d3..0000000
+++ /dev/null
@@ -1,3201 +0,0 @@
-/*     $NetBSD: ehci.c,v 1.91 2005/02/27 00:27:51 perry Exp $ */
-/*     $FreeBSD: src/sys/dev/usb/ehci.c,v 1.36.2.3 2006/09/24 13:39:04 iedowse Exp $   */
-
-/*
- * Copyright (c) 2004 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (lennart@augustsson.net) and by Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller.
- *
- * The EHCI 1.0 spec can be found at
- * http://developer.intel.com/technology/usb/download/ehci-r10.pdf
- * and the USB 2.0 spec at
- * http://www.usb.org/developers/docs/usb_20.zip
- *
- */
-
-/*
- * TODO:
- * 1) The EHCI driver lacks support for isochronous transfers, so
- *    devices using them don't work.
- *
- * 2) Interrupt transfer scheduling does not manage the time available
- *    in each frame, so it is possible for the transfers to overrun
- *    the end of the frame.
- *
- * 3) Command failures are not recovered correctly.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/endian.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/lock.h>
-#include <sys/proc.h>
-#include <sys/queue.h>
-#include <sys/sysctl.h>
-#include <sys/thread2.h>
-
-#include <machine/cpu.h>
-#include <machine/endian.h>
-
-#include <bus/usb/usb.h>
-#include <bus/usb/usbdi.h>
-#include <bus/usb/usbdivar.h>
-#include <bus/usb/usb_mem.h>
-#include <bus/usb/usb_quirks.h>
-
-#include <bus/usb/ehcireg.h>
-#include <bus/usb/ehcivar.h>
-
-#ifdef USB_DEBUG
-#define EHCI_DEBUG USB_DEBUG
-#define DPRINTF(x)     do { if (ehcidebug) kprintf x; } while (0)
-#define DPRINTFN(n,x)  do { if (ehcidebug>(n)) kprintf x; } while (0)
-int ehcidebug = 0;
-SYSCTL_NODE(_hw_usb, OID_AUTO, ehci, CTLFLAG_RW, 0, "USB ehci");
-SYSCTL_INT(_hw_usb_ehci, OID_AUTO, debug, CTLFLAG_RW,
-          &ehcidebug, 0, "ehci debug level");
-#define bitmask_snprintf(q,f,b,l) ksnprintf((b), (l), "%b", (q), (f))
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n,x)
-#endif
-
-struct ehci_pipe {
-       struct usbd_pipe pipe;
-
-       ehci_soft_qh_t *sqh;
-       union {
-               ehci_soft_qtd_t *qtd;
-               /* ehci_soft_itd_t *itd; */
-       } tail;
-       union {
-               /* Control pipe */
-               struct {
-                       usb_dma_t reqdma;
-                       u_int length;
-                       /*ehci_soft_qtd_t *setup, *data, *stat;*/
-               } ctl;
-               /* Interrupt pipe */
-               struct {
-                       u_int length;
-               } intr;
-               /* Bulk pipe */
-               struct {
-                       u_int length;
-               } bulk;
-               /* Iso pipe */
-               /* XXX */
-       } u;
-};
-
-static usbd_status     ehci_open(usbd_pipe_handle);
-static void            ehci_poll(struct usbd_bus *);
-static void            ehci_softintr(void *);
-static int             ehci_intr1(ehci_softc_t *);
-static void            ehci_waitintr(ehci_softc_t *, usbd_xfer_handle);
-static void            ehci_check_intr(ehci_softc_t *, struct ehci_xfer *);
-static void            ehci_idone(struct ehci_xfer *);
-static void            ehci_timeout(void *);
-static void            ehci_timeout_task(void *);
-static void            ehci_intrlist_timeout(void *);
-
-static usbd_status     ehci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t);
-static void            ehci_freem(struct usbd_bus *, usb_dma_t *);
-
-static usbd_xfer_handle        ehci_allocx(struct usbd_bus *);
-static void            ehci_freex(struct usbd_bus *, usbd_xfer_handle);
-
-static usbd_status     ehci_root_ctrl_transfer(usbd_xfer_handle);
-static usbd_status     ehci_root_ctrl_start(usbd_xfer_handle);
-static void            ehci_root_ctrl_abort(usbd_xfer_handle);
-static void            ehci_root_ctrl_close(usbd_pipe_handle);
-static void            ehci_root_ctrl_done(usbd_xfer_handle);
-
-static usbd_status     ehci_root_intr_transfer(usbd_xfer_handle);
-static usbd_status     ehci_root_intr_start(usbd_xfer_handle);
-static void            ehci_root_intr_abort(usbd_xfer_handle);
-static void            ehci_root_intr_close(usbd_pipe_handle);
-static void            ehci_root_intr_done(usbd_xfer_handle);
-
-static usbd_status     ehci_device_ctrl_transfer(usbd_xfer_handle);
-static usbd_status     ehci_device_ctrl_start(usbd_xfer_handle);
-static void            ehci_device_ctrl_abort(usbd_xfer_handle);
-static void            ehci_device_ctrl_close(usbd_pipe_handle);
-static void            ehci_device_ctrl_done(usbd_xfer_handle);
-
-static usbd_status     ehci_device_bulk_transfer(usbd_xfer_handle);
-static usbd_status     ehci_device_bulk_start(usbd_xfer_handle);
-static void            ehci_device_bulk_abort(usbd_xfer_handle);
-static void            ehci_device_bulk_close(usbd_pipe_handle);
-static void            ehci_device_bulk_done(usbd_xfer_handle);
-
-static usbd_status     ehci_device_intr_transfer(usbd_xfer_handle);
-static usbd_status     ehci_device_intr_start(usbd_xfer_handle);
-static void            ehci_device_intr_abort(usbd_xfer_handle);
-static void            ehci_device_intr_close(usbd_pipe_handle);
-static void            ehci_device_intr_done(usbd_xfer_handle);
-
-static usbd_status     ehci_device_isoc_transfer(usbd_xfer_handle);
-static usbd_status     ehci_device_isoc_start(usbd_xfer_handle);
-static void            ehci_device_isoc_abort(usbd_xfer_handle);
-static void            ehci_device_isoc_close(usbd_pipe_handle);
-static void            ehci_device_isoc_done(usbd_xfer_handle);
-
-static void            ehci_device_clear_toggle(usbd_pipe_handle pipe);
-static void            ehci_noop(usbd_pipe_handle pipe);
-
-static int             ehci_str(usb_string_descriptor_t *, int, char *);
-static void            ehci_pcd(ehci_softc_t *, usbd_xfer_handle);
-static void            ehci_disown(ehci_softc_t *, int, int);
-
-static ehci_soft_qh_t  *ehci_alloc_sqh(ehci_softc_t *);
-static void            ehci_free_sqh(ehci_softc_t *, ehci_soft_qh_t *);
-
-static ehci_soft_qtd_t  *ehci_alloc_sqtd(ehci_softc_t *);
-static void            ehci_free_sqtd(ehci_softc_t *, ehci_soft_qtd_t *);
-static usbd_status     ehci_alloc_sqtd_chain(struct ehci_pipe *,
-                           ehci_softc_t *, int, int, usbd_xfer_handle,
-                           ehci_soft_qtd_t **, ehci_soft_qtd_t **);
-static void            ehci_free_sqtd_chain(ehci_softc_t *, ehci_soft_qtd_t *,
-                                           ehci_soft_qtd_t *);
-
-static usbd_status     ehci_device_request(usbd_xfer_handle xfer);
-
-static usbd_status     ehci_device_setintr(ehci_softc_t *, ehci_soft_qh_t *,
-                           int ival);
-
-static void            ehci_add_qh(ehci_soft_qh_t *, ehci_soft_qh_t *);
-static void            ehci_rem_qh(ehci_softc_t *, ehci_soft_qh_t *,
-                                   ehci_soft_qh_t *);
-static void            ehci_set_qh_qtd(ehci_soft_qh_t *, ehci_soft_qtd_t *);
-static void            ehci_sync_hc(ehci_softc_t *);
-
-static void            ehci_close_pipe(usbd_pipe_handle, ehci_soft_qh_t *);
-static void            ehci_abort_xfer(usbd_xfer_handle, usbd_status);
-
-#ifdef EHCI_DEBUG
-static void            ehci_dump_regs(ehci_softc_t *);
-void                   ehci_dump(void);
-static ehci_softc_t    *theehci;
-static void            ehci_dump_link(ehci_link_t, int);
-static void            ehci_dump_sqtds(ehci_soft_qtd_t *);
-static void            ehci_dump_sqtd(ehci_soft_qtd_t *);
-static void            ehci_dump_qtd(ehci_qtd_t *);
-static void            ehci_dump_sqh(ehci_soft_qh_t *);
-#ifdef DIAGNOSTIC
-static void            ehci_dump_exfer(struct ehci_xfer *);
-#endif
-#endif
-
-#define EHCI_NULL htole32(EHCI_LINK_TERMINATE)
-
-#define EHCI_INTR_ENDPT 1
-
-#define ehci_add_intr_list(sc, ex) \
-       LIST_INSERT_HEAD(&(sc)->sc_intrhead, (ex), inext);
-#define ehci_del_intr_list(ex) \
-       do { \
-               LIST_REMOVE((ex), inext); \
-               (ex)->inext.le_prev = NULL; \
-       } while (0)
-#define ehci_active_intr_list(ex) ((ex)->inext.le_prev != NULL)
-
-static struct usbd_bus_methods ehci_bus_methods = {
-       ehci_open,
-       ehci_softintr,
-       ehci_poll,
-       ehci_allocm,
-       ehci_freem,
-       ehci_allocx,
-       ehci_freex,
-};
-
-static struct usbd_pipe_methods ehci_root_ctrl_methods = {
-       ehci_root_ctrl_transfer,
-       ehci_root_ctrl_start,
-       ehci_root_ctrl_abort,
-       ehci_root_ctrl_close,
-       ehci_noop,
-       ehci_root_ctrl_done,
-};
-
-static struct usbd_pipe_methods ehci_root_intr_methods = {
-       ehci_root_intr_transfer,
-       ehci_root_intr_start,
-       ehci_root_intr_abort,
-       ehci_root_intr_close,
-       ehci_noop,
-       ehci_root_intr_done,
-};
-
-static struct usbd_pipe_methods ehci_device_ctrl_methods = {
-       ehci_device_ctrl_transfer,
-       ehci_device_ctrl_start,
-       ehci_device_ctrl_abort,
-       ehci_device_ctrl_close,
-       ehci_noop,
-       ehci_device_ctrl_done,
-};
-
-static struct usbd_pipe_methods ehci_device_intr_methods = {
-       ehci_device_intr_transfer,
-       ehci_device_intr_start,
-       ehci_device_intr_abort,
-       ehci_device_intr_close,
-       ehci_device_clear_toggle,
-       ehci_device_intr_done,
-};
-
-static struct usbd_pipe_methods ehci_device_bulk_methods = {
-       ehci_device_bulk_transfer,
-       ehci_device_bulk_start,
-       ehci_device_bulk_abort,
-       ehci_device_bulk_close,
-       ehci_device_clear_toggle,
-       ehci_device_bulk_done,
-};
-
-static struct usbd_pipe_methods ehci_device_isoc_methods = {
-       ehci_device_isoc_transfer,
-       ehci_device_isoc_start,
-       ehci_device_isoc_abort,
-       ehci_device_isoc_close,
-       ehci_noop,
-       ehci_device_isoc_done,
-};
-
-usbd_status
-ehci_init(ehci_softc_t *sc)
-{
-       u_int32_t vers, sparams, cparams, hcr;
-       u_int i;
-       usbd_status err;
-       ehci_soft_qh_t *sqh;
-       u_int ncomp;
-       int lev;
-
-       DPRINTF(("ehci_init: start\n"));
-#ifdef EHCI_DEBUG
-       theehci = sc;
-#endif
-
-       sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
-
-       vers = EREAD2(sc, EHCI_HCIVERSION);
-       device_printf(sc->sc_bus.bdev,
-           "EHCI version %x.%x\n", vers >> 8, vers & 0xff);
-       /* Disable all interrupts */
-       EOWRITE4(sc, EHCI_USBINTR, 0);
-
-       sparams = EREAD4(sc, EHCI_HCSPARAMS);
-       DPRINTF(("ehci_init: sparams=0x%x\n", sparams));
-       sc->sc_npcomp = EHCI_HCS_N_PCC(sparams);
-       ncomp = EHCI_HCS_N_CC(sparams);
-       if (ncomp != sc->sc_ncomp) {
-               device_printf(sc->sc_bus.bdev,
-                   "wrong number of companions (%d != %d)\n",
-                   ncomp, sc->sc_ncomp);
-               if (ncomp < sc->sc_ncomp)
-                       sc->sc_ncomp = ncomp;
-       }
-       if (sc->sc_ncomp > 0) {
-               device_printf(sc->sc_bus.bdev,
-                   "companion controller%s, %d port%s each:",
-                   sc->sc_ncomp!=1 ? "s" : "",
-                   EHCI_HCS_N_PCC(sparams),
-                   EHCI_HCS_N_PCC(sparams)!=1 ? "s" : "");
-               for (i = 0; i < sc->sc_ncomp; i++)
-                       kprintf(" %s", device_get_nameunit(sc->sc_comps[i]->bdev));
-               kprintf("\n");
-       }
-       sc->sc_noport = EHCI_HCS_N_PORTS(sparams);
-       cparams = EREAD4(sc, EHCI_HCCPARAMS);
-       DPRINTF(("ehci_init: cparams=0x%x\n", cparams));
-
-       if (EHCI_HCC_64BIT(cparams)) {
-               /* MUST clear segment register if 64 bit capable. */
-               EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
-       }
-
-       sc->sc_bus.usbrev = USBREV_2_0;
-
-       /* Reset the controller */
-       DPRINTF(("%s: resetting\n", device_get_nameunit(sc->sc_bus.bdev)));
-       EOWRITE4(sc, EHCI_USBCMD, 0);   /* Halt controller */
-       usb_delay_ms(&sc->sc_bus, 1);
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
-       for (i = 0; i < 100; i++) {
-               usb_delay_ms(&sc->sc_bus, 1);
-               hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
-               if (!hcr)
-                       break;
-       }
-       if (hcr) {
-               device_printf(sc->sc_bus.bdev, "reset timeout\n");
-               return (USBD_IOERROR);
-       }
-
-       /* frame list size at default, read back what we got and use that */
-       switch (EHCI_CMD_FLS(EOREAD4(sc, EHCI_USBCMD))) {
-       case 0: sc->sc_flsize = 1024; break;
-       case 1: sc->sc_flsize = 512; break;
-       case 2: sc->sc_flsize = 256; break;
-       case 3: return (USBD_IOERROR);
-       }
-       err = usb_allocmem(&sc->sc_bus, sc->sc_flsize * sizeof(ehci_link_t),
-                          EHCI_FLALIGN_ALIGN, &sc->sc_fldma);
-       if (err)
-               return (err);
-       DPRINTF(("%s: flsize=%d\n", device_get_nameunit(sc->sc_bus.bdev),sc->sc_flsize));
-       sc->sc_flist = KERNADDR(&sc->sc_fldma, 0);
-       EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->sc_fldma, 0));
-
-       /* Set up the bus struct. */
-       sc->sc_bus.methods = &ehci_bus_methods;
-       sc->sc_bus.pipe_size = sizeof(struct ehci_pipe);
-
-       sc->sc_eintrs = EHCI_NORMAL_INTRS;
-
-       /*
-        * Allocate the interrupt dummy QHs. These are arranged to give
-        * poll intervals that are powers of 2 times 1ms.
-        */
-       for (i = 0; i < EHCI_INTRQHS; i++) {
-               sqh = ehci_alloc_sqh(sc);
-               if (sqh == NULL) {
-                       err = USBD_NOMEM;
-                       goto bad1;
-               }
-               sc->sc_islots[i].sqh = sqh;
-       }
-       lev = 0;
-       for (i = 0; i < EHCI_INTRQHS; i++) {
-               if (i == EHCI_IQHIDX(lev + 1, 0))
-                       lev++;
-               sqh = sc->sc_islots[i].sqh;
-               if (i == 0) {
-                       /* The last (1ms) QH terminates. */
-                       sqh->qh.qh_link = EHCI_NULL;
-                       sqh->next = NULL;
-               } else {
-                       /* Otherwise the next QH has half the poll interval */
-                       sqh->next =
-                           sc->sc_islots[EHCI_IQHIDX(lev - 1, i + 1)].sqh;
-                       sqh->qh.qh_link = htole32(sqh->next->physaddr |
-                           EHCI_LINK_QH);
-               }
-               sqh->qh.qh_endp = htole32(EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH));
-               sqh->qh.qh_endphub = htole32(EHCI_QH_SET_MULT(1));
-               sqh->qh.qh_curqtd = EHCI_NULL;
-               sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
-               sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
-               sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
-               sqh->sqtd = NULL;
-       }
-       /* Point the frame list at the last level (128ms). */
-       for (i = 0; i < sc->sc_flsize; i++) {
-               sc->sc_flist[i] = htole32(EHCI_LINK_QH |
-                   sc->sc_islots[EHCI_IQHIDX(EHCI_IPOLLRATES - 1,
-                   i)].sqh->physaddr);
-       }
-
-       /* Allocate dummy QH that starts the async list. */
-       sqh = ehci_alloc_sqh(sc);
-       if (sqh == NULL) {
-               err = USBD_NOMEM;
-               goto bad1;
-       }
-       /* Fill the QH */
-       sqh->qh.qh_endp =
-           htole32(EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | EHCI_QH_HRECL);
-       sqh->qh.qh_link =
-           htole32(sqh->physaddr | EHCI_LINK_QH);
-       sqh->qh.qh_curqtd = EHCI_NULL;
-       sqh->prev = sqh; /*It's a circular list.. */
-       sqh->next = sqh;
-       /* Fill the overlay qTD */
-       sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
-       sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
-       sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
-       sqh->sqtd = NULL;
-#ifdef EHCI_DEBUG
-       if (ehcidebug) {
-               ehci_dump_sqh(sqh);
-       }
-#endif
-
-       /* Point to async list */
-       sc->sc_async_head = sqh;
-       EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
-
-       callout_init(&sc->sc_tmo_intrlist);
-
-       lockinit(&sc->sc_doorbell_lock, "ehcidb", 0, 0);
-
-       /* Turn on controller */
-       EOWRITE4(sc, EHCI_USBCMD,
-                EHCI_CMD_ITC_2 | /* 2 microframes interrupt delay */
-                (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) |
-                EHCI_CMD_ASE |
-                EHCI_CMD_PSE |
-                EHCI_CMD_RS);
-
-       /* Take over port ownership */
-       EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF);
-
-       for (i = 0; i < 100; i++) {
-               usb_delay_ms(&sc->sc_bus, 1);
-               hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
-               if (!hcr)
-                       break;
-       }
-       if (hcr) {
-               device_printf(sc->sc_bus.bdev, "run timeout\n");
-               return (USBD_IOERROR);
-       }
-
-       crit_enter();
-       sc->sc_flags |= EHCI_SCFLG_DONEINIT;
-       EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
-       ehci_intr(sc);
-       crit_exit();
-
-       return (USBD_NORMAL_COMPLETION);
-
-#if 0
- bad2:
-       ehci_free_sqh(sc, sc->sc_async_head);
-       sc->sc_async_head = NULL;
-#endif
- bad1:
-       usb_freemem(&sc->sc_bus, &sc->sc_fldma);
-       return (err);
-}
-
-int
-ehci_intr(void *v)
-{
-       ehci_softc_t *sc = v;
-
-       if (sc->sc_dying || (sc->sc_flags & EHCI_SCFLG_DONEINIT) == 0)
-               return (0);
-
-       /* If we get an interrupt while polling, then just ignore it. */
-       if (sc->sc_bus.use_polling) {
-               u_int32_t intrs = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS));
-
-               if (intrs)
-                       EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
-               sc->sc_dintrs |= intrs;
-#ifdef DIAGNOSTIC
-               DPRINTFN(16, ("ehci_intr: ignored interrupt while polling\n"));
-#endif
-               return (0);
-       }
-
-       return (ehci_intr1(sc));
-}
-
-static int
-ehci_intr1(ehci_softc_t *sc)
-{
-       u_int32_t intrs, eintrs;
-
-       DPRINTFN(20,("ehci_intr1: enter\n"));
-
-       intrs = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS)) | sc->sc_dintrs;
-       if (intrs == 0)
-               return (0);
-
-       sc->sc_dintrs = 0;
-       eintrs = intrs & sc->sc_eintrs;
-       DPRINTFN(7, ("ehci_intr1: sc=%p intrs=0x%x(0x%x) eintrs=0x%x\n",
-                    sc, (u_int)intrs, EOREAD4(sc, EHCI_USBSTS),
-                    (u_int)eintrs));
-       if (!eintrs)
-               return (0);
-
-       EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
-       sc->sc_bus.intr_context++;
-       sc->sc_bus.no_intrs++;
-       if (eintrs & EHCI_STS_IAA) {
-               DPRINTF(("ehci_intr1: door bell\n"));
-               wakeup(&sc->sc_async_head);
-               eintrs &= ~EHCI_STS_IAA;
-       }
-       if (eintrs & (EHCI_STS_INT | EHCI_STS_ERRINT)) {
-               DPRINTFN(5,("ehci_intr1: %s %s\n",
-                           eintrs & EHCI_STS_INT ? "INT" : "",
-                           eintrs & EHCI_STS_ERRINT ? "ERRINT" : ""));
-               usb_schedsoftintr(&sc->sc_bus);
-               eintrs &= ~(EHCI_STS_INT | EHCI_STS_ERRINT);
-       }
-       if (eintrs & EHCI_STS_HSE) {
-               device_printf(sc->sc_bus.bdev,
-                   "unrecoverable error, controller halted\n");
-               /* XXX what else */
-       }
-       if (eintrs & EHCI_STS_PCD) {
-               ehci_pcd(sc, sc->sc_intrxfer);
-               eintrs &= ~EHCI_STS_PCD;
-       }
-
-       sc->sc_bus.intr_context--;
-
-       if (eintrs != 0) {
-               /* Block unprocessed interrupts. */
-               sc->sc_eintrs &= ~eintrs;
-               EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
-               device_printf(sc->sc_bus.bdev,
-                   "blocking intrs 0x%x\n", eintrs);
-       }
-
-       return (1);
-}
-
-void
-ehci_pcd(ehci_softc_t *sc, usbd_xfer_handle xfer)
-{
-       u_char *p;
-       int i, m;
-
-       if (xfer == NULL) {
-               /* Just ignore the change. */
-               return;
-       }
-
-       p = KERNADDR(&xfer->dmabuf, 0);
-       m = min(sc->sc_noport, xfer->length * 8 - 1);
-       memset(p, 0, xfer->length);
-       for (i = 1; i <= m; i++) {
-               /* Pick out CHANGE bits from the status reg. */
-               if (EOREAD4(sc, EHCI_PORTSC(i)) & EHCI_PS_CLEAR)
-                       p[i/8] |= 1 << (i%8);
-       }
-       DPRINTF(("ehci_pcd: change=0x%02x\n", *p));
-       xfer->actlen = xfer->length;
-       xfer->status = USBD_NORMAL_COMPLETION;
-
-       usb_transfer_complete(xfer);
-}
-
-void
-ehci_softintr(void *v)
-{
-       ehci_softc_t *sc = v;
-       struct ehci_xfer *ex, *nextex;
-
-       DPRINTFN(10,("%s: ehci_softintr (%d)\n", device_get_nameunit(sc->sc_bus.bdev),
-                    sc->sc_bus.intr_context));
-
-       sc->sc_bus.intr_context++;
-
-       /*
-        * The only explanation I can think of for why EHCI is as brain dead
-        * as UHCI interrupt-wise is that Intel was involved in both.
-        * An interrupt just tells us that something is done, we have no
-        * clue what, so we need to scan through all active transfers. :-(
-        */
-       for (ex = LIST_FIRST(&sc->sc_intrhead); ex; ex = nextex) {
-               nextex = LIST_NEXT(ex, inext);
-               ehci_check_intr(sc, ex);
-       }
-
-       /* Schedule a callout to catch any dropped transactions. */
-       if ((sc->sc_flags & EHCI_SCFLG_LOSTINTRBUG) &&
-           !LIST_EMPTY(&sc->sc_intrhead))
-               callout_reset(&sc->sc_tmo_intrlist, hz / 5, ehci_intrlist_timeout,
-                  sc);
-
-#ifdef USB_USE_SOFTINTR
-       if (sc->sc_softwake) {
-               sc->sc_softwake = 0;
-               wakeup(&sc->sc_softwake);
-       }
-#endif /* USB_USE_SOFTINTR */
-
-       sc->sc_bus.intr_context--;
-}
-
-/* Check for an interrupt. */
-void
-ehci_check_intr(ehci_softc_t *sc, struct ehci_xfer *ex)
-{
-       ehci_soft_qtd_t *sqtd, *lsqtd;
-       u_int32_t status;
-
-       DPRINTFN(/*15*/2, ("ehci_check_intr: ex=%p\n", ex));
-
-       if (ex->sqtdstart == NULL) {
-               kprintf("ehci_check_intr: sqtdstart=NULL\n");
-               return;
-       }
-       lsqtd = ex->sqtdend;
-#ifdef DIAGNOSTIC
-       if (lsqtd == NULL) {
-               kprintf("ehci_check_intr: lsqtd==0\n");
-               return;
-       }
-#endif
-       /*
-        * If the last TD is still active we need to check whether there
-        * is a an error somewhere in the middle, or whether there was a
-        * short packet (SPD and not ACTIVE).
-        */
-       if (le32toh(lsqtd->qtd.qtd_status) & EHCI_QTD_ACTIVE) {
-               DPRINTFN(12, ("ehci_check_intr: active ex=%p\n", ex));
-               for (sqtd = ex->sqtdstart; sqtd != lsqtd; sqtd=sqtd->nextqtd) {
-                       status = le32toh(sqtd->qtd.qtd_status);
-                       /* If there's an active QTD the xfer isn't done. */
-                       if (status & EHCI_QTD_ACTIVE)
-                               break;
-                       /* Any kind of error makes the xfer done. */
-                       if (status & EHCI_QTD_HALTED)
-                               goto done;
-                       /* We want short packets, and it is short: it's done */
-                       if (EHCI_QTD_GET_BYTES(status) != 0)
-                               goto done;
-               }
-               DPRINTFN(12, ("ehci_check_intr: ex=%p std=%p still active\n",
-                             ex, ex->sqtdstart));
-               return;
-       }
- done:
-       DPRINTFN(12, ("ehci_check_intr: ex=%p done\n", ex));
-       callout_stop(&ex->xfer.timeout_handle);
-       usb_rem_task(ex->xfer.pipe->device, &ex->abort_task);
-       ehci_idone(ex);
-}
-
-void
-ehci_idone(struct ehci_xfer *ex)
-{
-       usbd_xfer_handle xfer = &ex->xfer;
-#ifdef USB_DEBUG
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-#endif
-       ehci_soft_qtd_t *sqtd, *lsqtd;
-       u_int32_t status = 0, nstatus = 0;
-       int actlen, cerr;
-
-       DPRINTFN(/*12*/2, ("ehci_idone: ex=%p\n", ex));
-#ifdef DIAGNOSTIC
-       {
-               crit_enter();
-               if (ex->isdone) {
-                       crit_exit();
-#ifdef EHCI_DEBUG
-                       kprintf("ehci_idone: ex is done!\n   ");
-                       ehci_dump_exfer(ex);
-#else
-                       kprintf("ehci_idone: ex=%p is done!\n", ex);
-#endif
-                       return;
-               }
-               ex->isdone = 1;
-               crit_exit();
-       }
-#endif
-
-       if (xfer->status == USBD_CANCELLED ||
-           xfer->status == USBD_TIMEOUT) {
-               DPRINTF(("ehci_idone: aborted xfer=%p\n", xfer));
-               return;
-       }
-
-#ifdef EHCI_DEBUG
-       DPRINTFN(/*10*/2, ("ehci_idone: xfer=%p, pipe=%p ready\n", xfer, epipe));
-       if (ehcidebug > 10)
-               ehci_dump_sqtds(ex->sqtdstart);
-#endif
-
-       /* The transfer is done, compute actual length and status. */
-       lsqtd = ex->sqtdend;
-       actlen = 0;
-       for (sqtd = ex->sqtdstart; sqtd != lsqtd->nextqtd; sqtd=sqtd->nextqtd) {
-               nstatus = le32toh(sqtd->qtd.qtd_status);
-               if (nstatus & EHCI_QTD_ACTIVE)
-                       break;
-
-               status = nstatus;
-               /* halt is ok if descriptor is last, and complete */
-               if (sqtd->qtd.qtd_next == EHCI_NULL &&
-                   EHCI_QTD_GET_BYTES(status) == 0)
-                       status &= ~EHCI_QTD_HALTED;
-               if (EHCI_QTD_GET_PID(status) != EHCI_QTD_PID_SETUP)
-                       actlen += sqtd->len - EHCI_QTD_GET_BYTES(status);
-       }
-
-       cerr = EHCI_QTD_GET_CERR(status);
-       DPRINTFN(/*10*/2, ("ehci_idone: len=%d, actlen=%d, cerr=%d, "
-           "status=0x%x\n", xfer->length, actlen, cerr, status));
-       xfer->actlen = actlen;
-       if ((status & EHCI_QTD_HALTED) != 0) {
-#ifdef EHCI_DEBUG
-               char sbuf[128];
-
-               bitmask_snprintf(status,
-                   "\20\7HALTED\6BUFERR\5BABBLE\4XACTERR"
-                   "\3MISSED\2SPLIT\1PING", sbuf, sizeof(sbuf));
-
-               DPRINTFN(2,
-                        ("ehci_idone: error, addr=%d, endpt=0x%02x, "
-                         "status 0x%s\n",
-                         xfer->pipe->device->address,
-                         xfer->pipe->endpoint->edesc->bEndpointAddress,
-                         sbuf));
-               if (ehcidebug > 2) {
-                       ehci_dump_sqh(epipe->sqh);
-                       ehci_dump_sqtds(ex->sqtdstart);
-               }
-#endif
-               if ((status & EHCI_QTD_BABBLE) == 0 && cerr > 0)
-                       xfer->status = USBD_STALLED;
-               else
-                       xfer->status = USBD_IOERROR; /* more info XXX */
-       } else {
-               xfer->status = USBD_NORMAL_COMPLETION;
-       }
-
-       usb_transfer_complete(xfer);
-       DPRINTFN(/*12*/2, ("ehci_idone: ex=%p done\n", ex));
-}
-
-/*
- * Wait here until controller claims to have an interrupt.
- * Then call ehci_intr and return.  Use timeout to avoid waiting
- * too long.
- */
-void
-ehci_waitintr(ehci_softc_t *sc, usbd_xfer_handle xfer)
-{
-       int timo = xfer->timeout;
-       int usecs;
-
-       xfer->status = USBD_IN_PROGRESS;
-       for (usecs = timo * 1000000 / hz; usecs > 0; usecs -= 1000) {
-               usb_delay_ms(&sc->sc_bus, 1);
-               if (sc->sc_dying)
-                       break;
-               ehci_intr1(sc);
-               if (xfer->status != USBD_IN_PROGRESS)
-                       return;
-       }
-
-       /* Timeout */
-       DPRINTF(("ehci_waitintr: timeout\n"));
-       xfer->status = USBD_TIMEOUT;
-       usb_transfer_complete(xfer);
-       /* XXX should free TD */
-}
-
-void
-ehci_poll(struct usbd_bus *bus)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)bus;
-#ifdef EHCI_DEBUG
-       static int last;
-       int new;
-       new = EHCI_STS_INTRS(EOREAD4(sc, EHCI_USBSTS));
-       if (new != last) {
-               DPRINTFN(10,("ehci_poll: intrs=0x%04x\n", new));
-               last = new;
-       }
-#endif
-       crit_enter();
-       ehci_intr1(sc);
-       ehci_softintr(sc);
-       crit_exit();
-}
-
-int
-ehci_detach(struct ehci_softc *sc, int flags)
-{
-       int rv = 0;
-
-       crit_enter();
-       sc->sc_dying = 1;
-       callout_stop(&sc->sc_tmo_intrlist);
-       EOWRITE4(sc, EHCI_USBINTR, 0);
-       EOWRITE4(sc, EHCI_USBCMD, 0);
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
-       crit_exit();
-
-       usb_delay_ms(&sc->sc_bus, 300); /* XXX let stray task complete */
-
-       usb_freemem(&sc->sc_bus, &sc->sc_fldma);
-       /* XXX free other data structures XXX */
-
-       return (rv);
-}
-
-/*
- * Handle suspend/resume.
- *
- * We need to switch to polling mode here, because this routine is
- * called from an interrupt context.  This is all right since we
- * are almost suspended anyway.
- */
-void
-ehci_power(int why, void *v)
-{
-       ehci_softc_t *sc = v;
-       u_int32_t cmd, hcr;
-       int i;
-
-#ifdef EHCI_DEBUG
-       DPRINTF(("ehci_power: sc=%p, why=%d\n", sc, why));
-       if (ehcidebug > 0)
-               ehci_dump_regs(sc);
-#endif
-
-       crit_enter();
-
-       switch (why) {
-       case PWR_SUSPEND:
-               sc->sc_bus.use_polling++;
-
-               for (i = 1; i <= sc->sc_noport; i++) {
-                       cmd = EOREAD4(sc, EHCI_PORTSC(i));
-                       if ((cmd & EHCI_PS_PO) == 0 &&
-                           (cmd & EHCI_PS_PE) == EHCI_PS_PE)
-                               EOWRITE4(sc, EHCI_PORTSC(i),
-                                   cmd | EHCI_PS_SUSP);
-               }
-
-               sc->sc_cmd = EOREAD4(sc, EHCI_USBCMD);
-
-               cmd = sc->sc_cmd & ~(EHCI_CMD_ASE | EHCI_CMD_PSE);
-               EOWRITE4(sc, EHCI_USBCMD, cmd);
-
-               for (i = 0; i < 100; i++) {
-                       hcr = EOREAD4(sc, EHCI_USBSTS) &
-                           (EHCI_STS_ASS | EHCI_STS_PSS);
-                       if (hcr == 0)
-                               break;
-
-                       usb_delay_ms(&sc->sc_bus, 1);
-               }
-               if (hcr != 0) {
-                       device_printf(sc->sc_bus.bdev, "reset timeout\n");
-               }
-
-               cmd &= ~EHCI_CMD_RS;
-               EOWRITE4(sc, EHCI_USBCMD, cmd);
-
-               for (i = 0; i < 100; i++) {
-                       hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
-                       if (hcr == EHCI_STS_HCH)
-                               break;
-
-                       usb_delay_ms(&sc->sc_bus, 1);
-               }
-               if (hcr != EHCI_STS_HCH) {
-                       device_printf(sc->sc_bus.bdev, "config timeout\n");
-               }
-
-               sc->sc_bus.use_polling--;
-               break;
-
-       case PWR_RESUME:
-               sc->sc_bus.use_polling++;
-
-               /* restore things in case the bios sucks */
-               EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0);
-               EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->sc_fldma, 0));
-               EOWRITE4(sc, EHCI_ASYNCLISTADDR,
-                   sc->sc_async_head->physaddr | EHCI_LINK_QH);
-               EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
-
-               hcr = 0;
-               for (i = 1; i <= sc->sc_noport; i++) {
-                       cmd = EOREAD4(sc, EHCI_PORTSC(i));
-                       if ((cmd & EHCI_PS_PO) == 0 &&
-                           (cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP) {
-                               EOWRITE4(sc, EHCI_PORTSC(i),
-                                   cmd | EHCI_PS_FPR);
-                               hcr = 1;
-                       }
-               }
-
-               if (hcr) {
-                       usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
-
-                       for (i = 1; i <= sc->sc_noport; i++) {
-                               cmd = EOREAD4(sc, EHCI_PORTSC(i));
-                               if ((cmd & EHCI_PS_PO) == 0 &&
-                                   (cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)
-                                       EOWRITE4(sc, EHCI_PORTSC(i),
-                                           cmd & ~EHCI_PS_FPR);
-                       }
-               }
-
-               EOWRITE4(sc, EHCI_USBCMD, sc->sc_cmd);
-
-               for (i = 0; i < 100; i++) {
-                       hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH;
-                       if (hcr != EHCI_STS_HCH)
-                               break;
-
-                       usb_delay_ms(&sc->sc_bus, 1);
-               }
-               if (hcr == EHCI_STS_HCH) {
-                       device_printf(sc->sc_bus.bdev, "config timeout\n");
-               }
-
-               usb_delay_ms(&sc->sc_bus, USB_RESUME_WAIT);
-
-               sc->sc_bus.use_polling--;
-               break;
-       }
-       crit_exit();
-
-#ifdef EHCI_DEBUG
-       DPRINTF(("ehci_power: sc=%p\n", sc));
-       if (ehcidebug > 0)
-               ehci_dump_regs(sc);
-#endif
-}
-
-/*
- * Shut down the controller when the system is going down.
- */
-void
-ehci_shutdown(void *v)
-{
-       ehci_softc_t *sc = v;
-
-       DPRINTF(("ehci_shutdown: stopping the HC\n"));
-       crit_enter();
-       sc->sc_dying = 1;
-       callout_stop(&sc->sc_tmo_intrlist);
-       EOWRITE4(sc, EHCI_USBINTR, 0);
-       EOWRITE4(sc, EHCI_USBCMD, 0);
-       EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
-       crit_exit();
-}
-
-usbd_status
-ehci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
-{
-       usbd_status err;
-
-       err = usb_allocmem(bus, size, 0, dma);
-#ifdef EHCI_DEBUG
-       if (err)
-               kprintf("ehci_allocm: usb_allocmem()=%d\n", err);
-#endif
-       return (err);
-}
-
-void
-ehci_freem(struct usbd_bus *bus, usb_dma_t *dma)
-{
-       usb_freemem(bus, dma);
-}
-
-usbd_xfer_handle
-ehci_allocx(struct usbd_bus *bus)
-{
-       struct ehci_softc *sc = (struct ehci_softc *)bus;
-       usbd_xfer_handle xfer;
-
-       xfer = STAILQ_FIRST(&sc->sc_free_xfers);
-       if (xfer != NULL) {
-               STAILQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
-#ifdef DIAGNOSTIC
-               if (xfer->busy_free != XFER_FREE) {
-                       kprintf("ehci_allocx: xfer=%p not free, 0x%08x\n", xfer,
-                              xfer->busy_free);
-               }
-#endif
-       } else {
-               xfer = kmalloc(sizeof(struct ehci_xfer), M_USB, M_INTWAIT);
-       }
-       if (xfer != NULL) {
-               memset(xfer, 0, sizeof(struct ehci_xfer));
-               usb_init_task(&EXFER(xfer)->abort_task, ehci_timeout_task,
-                   xfer);
-               EXFER(xfer)->ehci_xfer_flags = 0;
-#ifdef DIAGNOSTIC
-               EXFER(xfer)->isdone = 1;
-               xfer->busy_free = XFER_BUSY;
-#endif
-       }
-       return (xfer);
-}
-
-void
-ehci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer)
-{
-       struct ehci_softc *sc = (struct ehci_softc *)bus;
-
-#ifdef DIAGNOSTIC
-       if (xfer->busy_free != XFER_BUSY) {
-               kprintf("ehci_freex: xfer=%p not busy, 0x%08x\n", xfer,
-                      xfer->busy_free);
-               return;
-       }
-       xfer->busy_free = XFER_FREE;
-       if (!EXFER(xfer)->isdone) {
-               kprintf("ehci_freex: !isdone\n");
-               return;
-       }
-#endif
-       STAILQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
-}
-
-static void
-ehci_device_clear_toggle(usbd_pipe_handle pipe)
-{
-       struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
-
-       DPRINTF(("ehci_device_clear_toggle: epipe=%p status=0x%x\n",
-                epipe, epipe->sqh->qh.qh_qtd.qtd_status));
-#ifdef USB_DEBUG
-       if (ehcidebug)
-               usbd_dump_pipe(pipe);
-#endif
-       KASSERT((epipe->sqh->qh.qh_qtd.qtd_status &
-           htole32(EHCI_QTD_ACTIVE)) == 0,
-           ("ehci_device_clear_toggle: queue active"));
-       epipe->sqh->qh.qh_qtd.qtd_status &= htole32(~EHCI_QTD_TOGGLE_MASK);
-}
-
-static void
-ehci_noop(usbd_pipe_handle pipe)
-{
-}
-
-#ifdef EHCI_DEBUG
-void
-ehci_dump_regs(ehci_softc_t *sc)
-{
-       int i;
-       kprintf("cmd=0x%08x, sts=0x%08x, ien=0x%08x\n",
-              EOREAD4(sc, EHCI_USBCMD),
-              EOREAD4(sc, EHCI_USBSTS),
-              EOREAD4(sc, EHCI_USBINTR));
-       kprintf("frindex=0x%08x ctrdsegm=0x%08x periodic=0x%08x async=0x%08x\n",
-              EOREAD4(sc, EHCI_FRINDEX),
-              EOREAD4(sc, EHCI_CTRLDSSEGMENT),
-              EOREAD4(sc, EHCI_PERIODICLISTBASE),
-              EOREAD4(sc, EHCI_ASYNCLISTADDR));
-       for (i = 1; i <= sc->sc_noport; i++)
-               kprintf("port %d status=0x%08x\n", i,
-                      EOREAD4(sc, EHCI_PORTSC(i)));
-}
-
-/*
- * Unused function - this is meant to be called from a kernel
- * debugger.
- */
-void
-ehci_dump(void)
-{
-       ehci_dump_regs(theehci);
-}
-
-void
-ehci_dump_link(ehci_link_t link, int type)
-{
-       link = le32toh(link);
-       kprintf("0x%08x", link);
-       if (link & EHCI_LINK_TERMINATE)
-               kprintf("<T>");
-       else {
-               kprintf("<");
-               if (type) {
-                       switch (EHCI_LINK_TYPE(link)) {
-                       case EHCI_LINK_ITD: kprintf("ITD"); break;
-                       case EHCI_LINK_QH: kprintf("QH"); break;
-                       case EHCI_LINK_SITD: kprintf("SITD"); break;
-                       case EHCI_LINK_FSTN: kprintf("FSTN"); break;
-                       }
-               }
-               kprintf(">");
-       }
-}
-
-void
-ehci_dump_sqtds(ehci_soft_qtd_t *sqtd)
-{
-       int i;
-       u_int32_t stop;
-
-       stop = 0;
-       for (i = 0; sqtd && i < 20 && !stop; sqtd = sqtd->nextqtd, i++) {
-               ehci_dump_sqtd(sqtd);
-               stop = sqtd->qtd.qtd_next & htole32(EHCI_LINK_TERMINATE);
-       }
-       if (sqtd)
-               kprintf("dump aborted, too many TDs\n");
-}
-
-void
-ehci_dump_sqtd(ehci_soft_qtd_t *sqtd)
-{
-       kprintf("QTD(%p) at 0x%08x:\n", sqtd, sqtd->physaddr);
-       ehci_dump_qtd(&sqtd->qtd);
-}
-
-void
-ehci_dump_qtd(ehci_qtd_t *qtd)
-{
-       u_int32_t s;
-       char sbuf[128];
-
-       kprintf("  next="); ehci_dump_link(qtd->qtd_next, 0);
-       kprintf(" altnext="); ehci_dump_link(qtd->qtd_altnext, 0);
-       kprintf("\n");
-       s = le32toh(qtd->qtd_status);
-       bitmask_snprintf(EHCI_QTD_GET_STATUS(s),
-                        "\20\10ACTIVE\7HALTED\6BUFERR\5BABBLE\4XACTERR"
-                        "\3MISSED\2SPLIT\1PING", sbuf, sizeof(sbuf));
-       kprintf("  status=0x%08x: toggle=%d bytes=0x%x ioc=%d c_page=0x%x\n",
-              s, EHCI_QTD_GET_TOGGLE(s), EHCI_QTD_GET_BYTES(s),
-              EHCI_QTD_GET_IOC(s), EHCI_QTD_GET_C_PAGE(s));
-       kprintf("    cerr=%d pid=%d stat=0x%s\n", EHCI_QTD_GET_CERR(s),
-              EHCI_QTD_GET_PID(s), sbuf);
-       for (s = 0; s < 5; s++)
-               kprintf("  buffer[%d]=0x%08x\n", s, le32toh(qtd->qtd_buffer[s]));
-}
-
-void
-ehci_dump_sqh(ehci_soft_qh_t *sqh)
-{
-       ehci_qh_t *qh = &sqh->qh;
-       u_int32_t endp, endphub;
-
-       kprintf("QH(%p) at 0x%08x:\n", sqh, sqh->physaddr);
-       kprintf("  link="); ehci_dump_link(qh->qh_link, 1); kprintf("\n");
-       endp = le32toh(qh->qh_endp);
-       kprintf("  endp=0x%08x\n", endp);
-       kprintf("    addr=0x%02x inact=%d endpt=%d eps=%d dtc=%d hrecl=%d\n",
-              EHCI_QH_GET_ADDR(endp), EHCI_QH_GET_INACT(endp),
-              EHCI_QH_GET_ENDPT(endp),  EHCI_QH_GET_EPS(endp),
-              EHCI_QH_GET_DTC(endp), EHCI_QH_GET_HRECL(endp));
-       kprintf("    mpl=0x%x ctl=%d nrl=%d\n",
-              EHCI_QH_GET_MPL(endp), EHCI_QH_GET_CTL(endp),
-              EHCI_QH_GET_NRL(endp));
-       endphub = le32toh(qh->qh_endphub);
-       kprintf("  endphub=0x%08x\n", endphub);
-       kprintf("    smask=0x%02x cmask=0x%02x huba=0x%02x port=%d mult=%d\n",
-              EHCI_QH_GET_SMASK(endphub), EHCI_QH_GET_CMASK(endphub),
-              EHCI_QH_GET_HUBA(endphub), EHCI_QH_GET_PORT(endphub),
-              EHCI_QH_GET_MULT(endphub));
-       kprintf("  curqtd="); ehci_dump_link(qh->qh_curqtd, 0); kprintf("\n");
-       kprintf("Overlay qTD:\n");
-       ehci_dump_qtd(&qh->qh_qtd);
-}
-
-#ifdef DIAGNOSTIC
-static void
-ehci_dump_exfer(struct ehci_xfer *ex)
-{
-       kprintf("ehci_dump_exfer: ex=%p\n", ex);
-}
-#endif
-#endif
-
-usbd_status
-ehci_open(usbd_pipe_handle pipe)
-{
-       usbd_device_handle dev = pipe->device;
-       ehci_softc_t *sc = (ehci_softc_t *)dev->bus;
-       usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
-       u_int8_t addr = dev->address;
-       u_int8_t xfertype = ed->bmAttributes & UE_XFERTYPE;
-       struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
-       ehci_soft_qh_t *sqh;
-       usbd_status err;
-       int ival, speed, naks;
-       int hshubaddr, hshubport;
-
-       DPRINTFN(1, ("ehci_open: pipe=%p, addr=%d, endpt=%d (%d)\n",
-                    pipe, addr, ed->bEndpointAddress, sc->sc_addr));
-
-       if (dev->myhsport) {
-               hshubaddr = dev->myhsport->parent->address;
-               hshubport = dev->myhsport->portno;
-       } else {
-               hshubaddr = 0;
-               hshubport = 0;
-       }
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-       if (addr == sc->sc_addr) {
-               switch (ed->bEndpointAddress) {
-               case USB_CONTROL_ENDPOINT:
-                       pipe->methods = &ehci_root_ctrl_methods;
-                       break;
-               case UE_DIR_IN | EHCI_INTR_ENDPT:
-                       pipe->methods = &ehci_root_intr_methods;
-                       break;
-               default:
-                       return (USBD_INVAL);
-               }
-               return (USBD_NORMAL_COMPLETION);
-       }
-
-       /* XXX All this stuff is only valid for async. */
-       switch (dev->speed) {
-       case USB_SPEED_LOW:  speed = EHCI_QH_SPEED_LOW;  break;
-       case USB_SPEED_FULL: speed = EHCI_QH_SPEED_FULL; break;
-       case USB_SPEED_HIGH: speed = EHCI_QH_SPEED_HIGH; break;
-       default: panic("ehci_open: bad device speed %d", dev->speed);
-       }
-       if (speed != EHCI_QH_SPEED_HIGH && xfertype == UE_ISOCHRONOUS) {
-               device_printf(sc->sc_bus.bdev,
-                   "*** WARNING: opening low/full speed device, this "
-                   "does not work yet.\n");
-               DPRINTFN(1,("ehci_open: hshubaddr=%d hshubport=%d\n",
-                           hshubaddr, hshubport));
-               return USBD_INVAL;
-       }
-
-       naks = 8;               /* XXX */
-       sqh = ehci_alloc_sqh(sc);
-       if (sqh == NULL)
-               goto bad0;
-       /* qh_link filled when the QH is added */
-       sqh->qh.qh_endp = htole32(
-               EHCI_QH_SET_ADDR(addr) |
-               EHCI_QH_SET_ENDPT(UE_GET_ADDR(ed->bEndpointAddress)) |
-               EHCI_QH_SET_EPS(speed) |
-               (xfertype == UE_CONTROL ? EHCI_QH_DTC : 0) |
-               EHCI_QH_SET_MPL(UGETW(ed->wMaxPacketSize)) |
-               (speed != EHCI_QH_SPEED_HIGH && xfertype == UE_CONTROL ?
-                EHCI_QH_CTL : 0) |
-               EHCI_QH_SET_NRL(naks)
-               );
-       sqh->qh.qh_endphub = htole32(
-               EHCI_QH_SET_MULT(1) |
-               EHCI_QH_SET_HUBA(hshubaddr) |
-               EHCI_QH_SET_PORT(hshubport) |
-               EHCI_QH_SET_CMASK(0x1c) |
-               EHCI_QH_SET_SMASK(xfertype == UE_INTERRUPT ? 0x01 : 0)
-               );
-       sqh->qh.qh_curqtd = EHCI_NULL;
-       /* Fill the overlay qTD */
-       sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
-       sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
-       sqh->qh.qh_qtd.qtd_status =
-           htole32(EHCI_QTD_SET_TOGGLE(pipe->endpoint->savedtoggle));
-
-       epipe->sqh = sqh;
-
-       switch (xfertype) {
-       case UE_CONTROL:
-               err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t),
-                                  0, &epipe->u.ctl.reqdma);
-#ifdef EHCI_DEBUG
-               if (err)
-                       kprintf("ehci_open: usb_allocmem()=%d\n", err);
-#endif
-               if (err)
-                       goto bad1;
-               pipe->methods = &ehci_device_ctrl_methods;
-               crit_enter();
-               ehci_add_qh(sqh, sc->sc_async_head);
-               crit_exit();
-               break;
-       case UE_BULK:
-               pipe->methods = &ehci_device_bulk_methods;
-               crit_enter();
-               ehci_add_qh(sqh, sc->sc_async_head);
-               crit_exit();
-               break;
-       case UE_INTERRUPT:
-               pipe->methods = &ehci_device_intr_methods;
-               ival = pipe->interval;
-               if (ival == USBD_DEFAULT_INTERVAL)
-                       ival = ed->bInterval;
-               return (ehci_device_setintr(sc, sqh, ival));
-       case UE_ISOCHRONOUS:
-               pipe->methods = &ehci_device_isoc_methods;
-               return (USBD_INVAL);
-       default:
-               return (USBD_INVAL);
-       }
-       return (USBD_NORMAL_COMPLETION);
-
- bad1:
-       ehci_free_sqh(sc, sqh);
-       epipe->sqh = NULL;
- bad0:
-       return (USBD_NOMEM);
-}
-
-/*
- * Add an ED to the schedule.  Called while in a critical section.
- * If in the async schedule, it will always have a next.
- * If in the intr schedule it may not.
- */
-void
-ehci_add_qh(ehci_soft_qh_t *sqh, ehci_soft_qh_t *head)
-{
-       sqh->next = head->next;
-       sqh->prev = head;
-       sqh->qh.qh_link = head->qh.qh_link;
-       head->next = sqh;
-       if (sqh->next)
-               sqh->next->prev = sqh;
-       head->qh.qh_link = htole32(sqh->physaddr | EHCI_LINK_QH);
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 5) {
-               kprintf("ehci_add_qh:\n");
-               ehci_dump_sqh(sqh);
-       }
-#endif
-}
-
-/*
- * Remove an ED from the schedule.  Called while in a critical section.
- * Will always have a 'next' if it's in the async list as it's circular.
- */
-void
-ehci_rem_qh(ehci_softc_t *sc, ehci_soft_qh_t *sqh, ehci_soft_qh_t *head)
-{
-       /* XXX */
-       sqh->prev->qh.qh_link = sqh->qh.qh_link;
-       sqh->prev->next = sqh->next;
-       if (sqh->next)
-               sqh->next->prev = sqh->prev;
-       ehci_sync_hc(sc);
-}
-
-void
-ehci_set_qh_qtd(ehci_soft_qh_t *sqh, ehci_soft_qtd_t *sqtd)
-{
-       int i;
-       u_int32_t status;
-
-       /* Save toggle bit and ping status. */
-       status = sqh->qh.qh_qtd.qtd_status &
-           htole32(EHCI_QTD_TOGGLE_MASK |
-                   EHCI_QTD_SET_STATUS(EHCI_QTD_PINGSTATE));
-       /* Set HALTED to make hw leave it alone. */
-       sqh->qh.qh_qtd.qtd_status =
-           htole32(EHCI_QTD_SET_STATUS(EHCI_QTD_HALTED));
-       sqh->qh.qh_curqtd = 0;
-       sqh->qh.qh_qtd.qtd_next = htole32(sqtd->physaddr);
-       sqh->qh.qh_qtd.qtd_altnext = 0;
-       for (i = 0; i < EHCI_QTD_NBUFFERS; i++)
-               sqh->qh.qh_qtd.qtd_buffer[i] = 0;
-       sqh->sqtd = sqtd;
-       /* Set !HALTED && !ACTIVE to start execution, preserve some fields */
-       sqh->qh.qh_qtd.qtd_status = status;
-}
-
-/*
- * Ensure that the HC has released all references to the QH.  We do this
- * by asking for a Async Advance Doorbell interrupt and then we wait for
- * the interrupt.
- * To make this easier we first obtain exclusive use of the doorbell.
- */
-void
-ehci_sync_hc(ehci_softc_t *sc)
-{
-       int error;
-
-       if (sc->sc_dying) {
-               DPRINTFN(2,("ehci_sync_hc: dying\n"));
-               return;
-       }
-       DPRINTFN(2,("ehci_sync_hc: enter\n"));
-       /* get doorbell */
-       lockmgr(&sc->sc_doorbell_lock, LK_EXCLUSIVE);
-       crit_enter();
-       /* ask for doorbell */
-       EOWRITE4(sc, EHCI_USBCMD, EOREAD4(sc, EHCI_USBCMD) | EHCI_CMD_IAAD);
-       DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n",
-                   EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS)));
-       error = tsleep(&sc->sc_async_head, 0, "ehcidi", hz); /* bell wait */
-       DPRINTFN(1,("ehci_sync_hc: cmd=0x%08x sts=0x%08x\n",
-                   EOREAD4(sc, EHCI_USBCMD), EOREAD4(sc, EHCI_USBSTS)));
-       crit_exit();
-       /* release doorbell */
-       lockmgr(&sc->sc_doorbell_lock, LK_RELEASE);
-#ifdef DIAGNOSTIC
-       if (error)
-               kprintf("ehci_sync_hc: tsleep() = %d\n", error);
-#endif
-       DPRINTFN(2,("ehci_sync_hc: exit\n"));
-}
-
-/***********/
-
-/*
- * Data structures and routines to emulate the root hub.
- */
-static usb_device_descriptor_t ehci_devd = {
-       USB_DEVICE_DESCRIPTOR_SIZE,
-       UDESC_DEVICE,           /* type */
-       {0x00, 0x02},           /* USB version */
-       UDCLASS_HUB,            /* class */
-       UDSUBCLASS_HUB,         /* subclass */
-       UDPROTO_HSHUBSTT,       /* protocol */
-       64,                     /* max packet */
-       {0},{0},{0x00,0x01},    /* device id */
-       1,2,0,                  /* string indicies */
-       1                       /* # of configurations */
-};
-
-static usb_device_qualifier_t ehci_odevd = {
-       USB_DEVICE_DESCRIPTOR_SIZE,
-       UDESC_DEVICE_QUALIFIER, /* type */
-       {0x00, 0x02},           /* USB version */
-       UDCLASS_HUB,            /* class */
-       UDSUBCLASS_HUB,         /* subclass */
-       UDPROTO_FSHUB,          /* protocol */
-       64,                     /* max packet */
-       1,                      /* # of configurations */
-       0
-};
-
-static usb_config_descriptor_t ehci_confd = {
-       USB_CONFIG_DESCRIPTOR_SIZE,
-       UDESC_CONFIG,
-       {USB_CONFIG_DESCRIPTOR_SIZE +
-        USB_INTERFACE_DESCRIPTOR_SIZE +
-        USB_ENDPOINT_DESCRIPTOR_SIZE},
-       1,
-       1,
-       0,
-       UC_SELF_POWERED,
-       0                       /* max power */
-};
-
-static usb_interface_descriptor_t ehci_ifcd = {
-       USB_INTERFACE_DESCRIPTOR_SIZE,
-       UDESC_INTERFACE,
-       0,
-       0,
-       1,
-       UICLASS_HUB,
-       UISUBCLASS_HUB,
-       UIPROTO_HSHUBSTT,
-       0
-};
-
-static usb_endpoint_descriptor_t ehci_endpd = {
-       USB_ENDPOINT_DESCRIPTOR_SIZE,
-       UDESC_ENDPOINT,
-       UE_DIR_IN | EHCI_INTR_ENDPT,
-       UE_INTERRUPT,
-       {8, 0},                 /* max packet */
-       255
-};
-
-static usb_hub_descriptor_t ehci_hubd = {
-       USB_HUB_DESCRIPTOR_SIZE,
-       UDESC_HUB,
-       0,
-       {0,0},
-       0,
-       0,
-       {0},
-};
-
-static int
-ehci_str(usb_string_descriptor_t *p, int l, char *s)
-{
-       int i;
-
-       if (l == 0)
-               return (0);
-       p->bLength = 2 * strlen(s) + 2;
-       if (l == 1)
-               return (1);
-       p->bDescriptorType = UDESC_STRING;
-       l -= 2;
-       for (i = 0; s[i] && l > 1; i++, l -= 2)
-               USETW2(p->bString[i], 0, s[i]);
-       return (2*i+2);
-}
-
-/*
- * Simulate a hardware hub by handling all the necessary requests.
- */
-static usbd_status
-ehci_root_ctrl_transfer(usbd_xfer_handle xfer)
-{
-       usbd_status err;
-
-       /* Insert last in queue. */
-       err = usb_insert_transfer(xfer);
-       if (err)
-               return (err);
-
-       /* Pipe isn't running, start first */
-       return (ehci_root_ctrl_start(STAILQ_FIRST(&xfer->pipe->queue)));
-}
-
-static usbd_status
-ehci_root_ctrl_start(usbd_xfer_handle xfer)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)xfer->pipe->device->bus;
-       usb_device_request_t *req;
-       void *buf = NULL;
-       int port, i;
-       int retries;
-       int len, value, index, l, totlen = 0;
-       usb_port_status_t ps;
-       usb_hub_descriptor_t hubd;
-       usbd_status err;
-       u_int32_t v;
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-#ifdef DIAGNOSTIC
-       if (!(xfer->rqflags & URQ_REQUEST))
-               /* XXX panic */
-               return (USBD_INVAL);
-#endif
-       req = &xfer->request;
-
-       DPRINTFN(4,("ehci_root_ctrl_start: type=0x%02x request=%02x\n",
-                   req->bmRequestType, req->bRequest));
-
-       len = UGETW(req->wLength);
-       value = UGETW(req->wValue);
-       index = UGETW(req->wIndex);
-
-       if (len != 0)
-               buf = KERNADDR(&xfer->dmabuf, 0);
-
-#define C(x,y) ((x) | ((y) << 8))
-       switch(C(req->bRequest, req->bmRequestType)) {
-       case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE):
-       case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE):
-       case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT):
-               /*
-                * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops
-                * for the integrated root hub.
-                */
-               break;
-       case C(UR_GET_CONFIG, UT_READ_DEVICE):
-               if (len > 0) {
-                       *(u_int8_t *)buf = sc->sc_conf;
-                       totlen = 1;
-               }
-               break;
-       case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE):
-               DPRINTFN(8,("ehci_root_ctrl_start: wValue=0x%04x\n", value));
-               switch(value >> 8) {
-               case UDESC_DEVICE:
-                       if ((value & 0xff) != 0) {
-                               err = USBD_IOERROR;
-                               goto ret;
-                       }
-                       totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
-                       USETW(ehci_devd.idVendor, sc->sc_id_vendor);
-                       memcpy(buf, &ehci_devd, l);
-                       break;
-               /*
-                * We can't really operate at another speed, but the spec says
-                * we need this descriptor.
-                */
-               case UDESC_DEVICE_QUALIFIER:
-                       if ((value & 0xff) != 0) {
-                               err = USBD_IOERROR;
-                               goto ret;
-                       }
-                       totlen = l = min(len, USB_DEVICE_DESCRIPTOR_SIZE);
-                       memcpy(buf, &ehci_odevd, l);
-                       break;
-               /*
-                * We can't really operate at another speed, but the spec says
-                * we need this descriptor.
-                */
-               case UDESC_OTHER_SPEED_CONFIGURATION:
-               case UDESC_CONFIG:
-                       if ((value & 0xff) != 0) {
-                               err = USBD_IOERROR;
-                               goto ret;
-                       }
-                       totlen = l = min(len, USB_CONFIG_DESCRIPTOR_SIZE);
-                       memcpy(buf, &ehci_confd, l);
-                       ((usb_config_descriptor_t *)buf)->bDescriptorType =
-                               value >> 8;
-                       buf = (char *)buf + l;
-                       len -= l;
-                       l = min(len, USB_INTERFACE_DESCRIPTOR_SIZE);
-                       totlen += l;
-                       memcpy(buf, &ehci_ifcd, l);
-                       buf = (char *)buf + l;
-                       len -= l;
-                       l = min(len, USB_ENDPOINT_DESCRIPTOR_SIZE);
-                       totlen += l;
-                       memcpy(buf, &ehci_endpd, l);
-                       break;
-               case UDESC_STRING:
-                       if (len == 0)
-                               break;
-                       *(u_int8_t *)buf = 0;
-                       totlen = 1;
-                       switch (value & 0xff) {
-                       case 0: /* Language table */
-                               totlen = ehci_str(buf, len, "\001");
-                               break;
-                       case 1: /* Vendor */
-                               totlen = ehci_str(buf, len, sc->sc_vendor);
-                               break;
-                       case 2: /* Product */
-                               totlen = ehci_str(buf, len, "EHCI root hub");
-                               break;
-                       }
-                       break;
-               default:
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               break;
-       case C(UR_GET_INTERFACE, UT_READ_INTERFACE):
-               if (len > 0) {
-                       *(u_int8_t *)buf = 0;
-                       totlen = 1;
-               }
-               break;
-       case C(UR_GET_STATUS, UT_READ_DEVICE):
-               if (len > 1) {
-                       USETW(((usb_status_t *)buf)->wStatus,UDS_SELF_POWERED);
-                       totlen = 2;
-               }
-               break;
-       case C(UR_GET_STATUS, UT_READ_INTERFACE):
-       case C(UR_GET_STATUS, UT_READ_ENDPOINT):
-               if (len > 1) {
-                       USETW(((usb_status_t *)buf)->wStatus, 0);
-                       totlen = 2;
-               }
-               break;
-       case C(UR_SET_ADDRESS, UT_WRITE_DEVICE):
-               if (value >= USB_MAX_DEVICES) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               sc->sc_addr = value;
-               break;
-       case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
-               if (value != 0 && value != 1) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               sc->sc_conf = value;
-               break;
-       case C(UR_SET_DESCRIPTOR, UT_WRITE_DEVICE):
-               break;
-       case C(UR_SET_FEATURE, UT_WRITE_DEVICE):
-       case C(UR_SET_FEATURE, UT_WRITE_INTERFACE):
-       case C(UR_SET_FEATURE, UT_WRITE_ENDPOINT):
-               err = USBD_IOERROR;
-               goto ret;
-       case C(UR_SET_INTERFACE, UT_WRITE_INTERFACE):
-               break;
-       case C(UR_SYNCH_FRAME, UT_WRITE_ENDPOINT):
-               break;
-       /* Hub requests */
-       case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_DEVICE):
-               break;
-       case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
-               DPRINTFN(8, ("ehci_root_ctrl_start: UR_CLEAR_PORT_FEATURE "
-                            "port=%d feature=%d\n",
-                            index, value));
-               if (index < 1 || index > sc->sc_noport) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               port = EHCI_PORTSC(index);
-               v = EOREAD4(sc, port) &~ EHCI_PS_CLEAR;
-               switch(value) {
-               case UHF_PORT_ENABLE:
-                       EOWRITE4(sc, port, v &~ EHCI_PS_PE);
-                       break;
-               case UHF_PORT_SUSPEND:
-                       EOWRITE4(sc, port, v &~ EHCI_PS_SUSP);
-                       break;
-               case UHF_PORT_POWER:
-                       EOWRITE4(sc, port, v &~ EHCI_PS_PP);
-                       break;
-               case UHF_PORT_TEST:
-                       DPRINTFN(2,("ehci_root_ctrl_start: clear port test "
-                                   "%d\n", index));
-                       break;
-               case UHF_PORT_INDICATOR:
-                       DPRINTFN(2,("ehci_root_ctrl_start: clear port ind "
-                                   "%d\n", index));
-                       EOWRITE4(sc, port, v &~ EHCI_PS_PIC);
-                       break;
-               case UHF_C_PORT_CONNECTION:
-                       EOWRITE4(sc, port, v | EHCI_PS_CSC);
-                       break;
-               case UHF_C_PORT_ENABLE:
-                       EOWRITE4(sc, port, v | EHCI_PS_PEC);
-                       break;
-               case UHF_C_PORT_SUSPEND:
-                       /* how? */
-                       break;
-               case UHF_C_PORT_OVER_CURRENT:
-                       EOWRITE4(sc, port, v | EHCI_PS_OCC);
-                       break;
-               case UHF_C_PORT_RESET:
-                       sc->sc_isreset = 0;
-                       break;
-               default:
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               break;
-       case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE):
-               if ((value & 0xff) != 0) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               hubd = ehci_hubd;
-               hubd.bNbrPorts = sc->sc_noport;
-               v = EOREAD4(sc, EHCI_HCSPARAMS);
-               USETW(hubd.wHubCharacteristics,
-                   EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH |
-                   EHCI_HCS_P_INDICATOR(EREAD4(sc, EHCI_HCSPARAMS))
-                       ? UHD_PORT_IND : 0);
-               hubd.bPwrOn2PwrGood = 200; /* XXX can't find out? */
-               for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8)
-                       hubd.DeviceRemovable[i++] = 0; /* XXX can't find out? */
-               hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i;
-               l = min(len, hubd.bDescLength);
-               totlen = l;
-               memcpy(buf, &hubd, l);
-               break;
-       case C(UR_GET_STATUS, UT_READ_CLASS_DEVICE):
-               if (len != 4) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               memset(buf, 0, len); /* ? XXX */
-               totlen = len;
-               break;
-       case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
-               DPRINTFN(8,("ehci_root_ctrl_start: get port status i=%d\n",
-                           index));
-               if (index < 1 || index > sc->sc_noport) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               if (len != 4) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               v = EOREAD4(sc, EHCI_PORTSC(index));
-               DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n", v));
-               i = UPS_HIGH_SPEED;
-               if (v & EHCI_PS_CS)     i |= UPS_CURRENT_CONNECT_STATUS;
-               if (v & EHCI_PS_PE)     i |= UPS_PORT_ENABLED;
-               if (v & EHCI_PS_SUSP)   i |= UPS_SUSPEND;
-               if (v & EHCI_PS_OCA)    i |= UPS_OVERCURRENT_INDICATOR;
-               if (v & EHCI_PS_PR)     i |= UPS_RESET;
-               if (v & EHCI_PS_PP)     i |= UPS_PORT_POWER;
-               USETW(ps.wPortStatus, i);
-               i = 0;
-               if (v & EHCI_PS_CSC)    i |= UPS_C_CONNECT_STATUS;
-               if (v & EHCI_PS_PEC)    i |= UPS_C_PORT_ENABLED;
-               if (v & EHCI_PS_OCC)    i |= UPS_C_OVERCURRENT_INDICATOR;
-               if (sc->sc_isreset)     i |= UPS_C_PORT_RESET;
-               USETW(ps.wPortChange, i);
-               l = min(len, sizeof ps);
-               memcpy(buf, &ps, l);
-               totlen = l;
-               break;
-       case C(UR_SET_DESCRIPTOR, UT_WRITE_CLASS_DEVICE):
-               err = USBD_IOERROR;
-               goto ret;
-       case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
-               break;
-       case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER):
-               if (index < 1 || index > sc->sc_noport) {
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               port = EHCI_PORTSC(index);
-               v = EOREAD4(sc, port) &~ EHCI_PS_CLEAR;
-               switch(value) {
-               case UHF_PORT_ENABLE:
-                       EOWRITE4(sc, port, v | EHCI_PS_PE);
-                       break;
-               case UHF_PORT_SUSPEND:
-                       EOWRITE4(sc, port, v | EHCI_PS_SUSP);
-                       break;
-               case UHF_PORT_RESET:
-                       /*
-                        * Give up ownership if this is a low-speed port.
-                        */
-                       DPRINTFN(5,("ehci_root_ctrl_start: reset port %d\n",
-                                   index));
-                       if (EHCI_PS_IS_LOWSPEED(v)) {
-                               ehci_disown(sc, index, 1);
-                               break;
-                       }
-
-                       /*
-                        * Issue a RESET sequence on the port.  Set PS_PR for
-                        * 2ms then clear it, then wait for it to read clear.
-                        *
-                        * Some devices, particularly smartphones, will not
-                        * properly reset on the first try.
-                        */
-                       retries = 2;
-
-                       while (retries) {
-                               v &= ~(EHCI_PS_PE | EHCI_PS_PR);
-                               EOWRITE4(sc, port, v | EHCI_PS_PR);
-                               usb_delay_ms(&sc->sc_bus,
-                                            USB_PORT_ROOT_RESET_DELAY);
-                               if (sc->sc_dying) {
-                                       err = USBD_IOERROR;
-                                       goto ret;
-                               }
-                               EOWRITE4(sc, port, v);
-                               usb_delay_ms(&sc->sc_bus,
-                                            EHCI_PORT_RESET_COMPLETE);
-                               if (sc->sc_dying) {
-                                       err = USBD_IOERROR;
-                                       goto ret;
-                               }
-                               v = EOREAD4(sc, port);
-                               DPRINTF(("ehci after reset, status=0x%08x\n",
-                                       v));
-                               if ((v & EHCI_PS_PR) == 0 || --retries == 0)
-                                       break;
-                       }
-
-                       /*
-                        * Wait up to 1 second for PR to clear.
-                        */
-                       retries = 10;
-                       while ((v & EHCI_PS_PR) && --retries > 0) {
-                               usb_delay_ms(&sc->sc_bus, 100);
-                               v = EOREAD4(sc, port);
-                       }
-                       if (v & EHCI_PS_PR) {
-                               device_printf(sc->sc_bus.bdev,
-                                             "port reset timeout\n");
-                               err = USBD_TIMEOUT;
-                               goto ret;
-                       }
-
-                       /*
-                        * Give up ownership if this is not a high-speed
-                        * device after completing the reset sequence.
-                        */
-                       if ((v & EHCI_PS_PE) == 0) {
-                               ehci_disown(sc, index, 0);
-                               break;
-                       }
-                       sc->sc_isreset = 1;
-                       DPRINTF(("ehci port %d reset, status = 0x%08x\n",
-                                index, v));
-                       break;
-               case UHF_PORT_POWER:
-                       DPRINTFN(2,("ehci_root_ctrl_start: set port power "
-                                   "%d\n", index));
-                       EOWRITE4(sc, port, v | EHCI_PS_PP);
-                       break;
-               case UHF_PORT_TEST:
-                       DPRINTFN(2,("ehci_root_ctrl_start: set port test "
-                                   "%d\n", index));
-                       break;
-               case UHF_PORT_INDICATOR:
-                       DPRINTFN(2,("ehci_root_ctrl_start: set port ind "
-                                   "%d\n", index));
-                       EOWRITE4(sc, port, v | EHCI_PS_PIC);
-                       break;
-               default:
-                       err = USBD_IOERROR;
-                       goto ret;
-               }
-               break;
-       case C(UR_CLEAR_TT_BUFFER, UT_WRITE_CLASS_OTHER):
-       case C(UR_RESET_TT, UT_WRITE_CLASS_OTHER):
-       case C(UR_GET_TT_STATE, UT_READ_CLASS_OTHER):
-       case C(UR_STOP_TT, UT_WRITE_CLASS_OTHER):
-               break;
-       default:
-               err = USBD_IOERROR;
-               goto ret;
-       }
-       xfer->actlen = totlen;
-       err = USBD_NORMAL_COMPLETION;
- ret:
-       xfer->status = err;
-       crit_enter();
-       usb_transfer_complete(xfer);
-       crit_exit();
-       return (USBD_IN_PROGRESS);
-}
-
-void
-ehci_disown(ehci_softc_t *sc, int index, int lowspeed)
-{
-       int port;
-       u_int32_t v;
-
-       DPRINTF(("ehci_disown: index=%d lowspeed=%d\n", index, lowspeed));
-#ifdef DIAGNOSTIC
-       if (sc->sc_npcomp != 0) {
-               int i = (index-1) / sc->sc_npcomp;
-               if (i >= sc->sc_ncomp)
-                       device_printf(sc->sc_bus.bdev, "strange port\n");
-               else
-                       device_printf(sc->sc_bus.bdev,
-                           "handing over %s speed device on port %d to %s\n",
-                           (lowspeed ? "low" : "full"),
-                           index, device_get_nameunit(sc->sc_comps[i]->bdev));
-       } else {
-               device_printf(sc->sc_bus.bdev, "npcomp == 0\n");
-       }
-#endif
-       port = EHCI_PORTSC(index);
-       v = EOREAD4(sc, port) &~ EHCI_PS_CLEAR;
-       EOWRITE4(sc, port, v | EHCI_PS_PO);
-}
-
-/* Abort a root control request. */
-static void
-ehci_root_ctrl_abort(usbd_xfer_handle xfer)
-{
-       /* Nothing to do, all transfers are synchronous. */
-}
-
-/* Close the root pipe. */
-static void
-ehci_root_ctrl_close(usbd_pipe_handle pipe)
-{
-       DPRINTF(("ehci_root_ctrl_close\n"));
-       /* Nothing to do. */
-}
-
-void
-ehci_root_intr_done(usbd_xfer_handle xfer)
-{
-}
-
-static usbd_status
-ehci_root_intr_transfer(usbd_xfer_handle xfer)
-{
-       usbd_status err;
-
-       /* Insert last in queue. */
-       err = usb_insert_transfer(xfer);
-       if (err)
-               return (err);
-
-       /* Pipe isn't running, start first */
-       return (ehci_root_intr_start(STAILQ_FIRST(&xfer->pipe->queue)));
-}
-
-static usbd_status
-ehci_root_intr_start(usbd_xfer_handle xfer)
-{
-       usbd_pipe_handle pipe = xfer->pipe;
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-       sc->sc_intrxfer = xfer;
-
-       return (USBD_IN_PROGRESS);
-}
-
-/* Abort a root interrupt request. */
-static void
-ehci_root_intr_abort(usbd_xfer_handle xfer)
-{
-       if (xfer->pipe->intrxfer == xfer) {
-               DPRINTF(("ehci_root_intr_abort: remove\n"));
-               xfer->pipe->intrxfer = NULL;
-       }
-       xfer->status = USBD_CANCELLED;
-       crit_enter();
-       usb_transfer_complete(xfer);
-       crit_exit();
-}
-
-/* Close the root pipe. */
-static void
-ehci_root_intr_close(usbd_pipe_handle pipe)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-
-       DPRINTF(("ehci_root_intr_close\n"));
-
-       sc->sc_intrxfer = NULL;
-}
-
-void
-ehci_root_ctrl_done(usbd_xfer_handle xfer)
-{
-}
-
-/************************/
-
-ehci_soft_qh_t *
-ehci_alloc_sqh(ehci_softc_t *sc)
-{
-       ehci_soft_qh_t *sqh;
-       usbd_status err;
-       int i, offs;
-       usb_dma_t dma;
-
-       if (sc->sc_freeqhs == NULL) {
-               DPRINTFN(2, ("ehci_alloc_sqh: allocating chunk\n"));
-               err = usb_allocmem(&sc->sc_bus, EHCI_SQH_SIZE * EHCI_SQH_CHUNK,
-                         EHCI_PAGE_SIZE, &dma);
-#ifdef EHCI_DEBUG
-               if (err)
-                       kprintf("ehci_alloc_sqh: usb_allocmem()=%d\n", err);
-#endif
-               if (err)
-                       return (NULL);
-               for(i = 0; i < EHCI_SQH_CHUNK; i++) {
-                       offs = i * EHCI_SQH_SIZE;
-                       sqh = KERNADDR(&dma, offs);
-                       sqh->physaddr = DMAADDR(&dma, offs);
-                       sqh->next = sc->sc_freeqhs;
-                       sc->sc_freeqhs = sqh;
-               }
-       }
-       sqh = sc->sc_freeqhs;
-       sc->sc_freeqhs = sqh->next;
-       memset(&sqh->qh, 0, sizeof(ehci_qh_t));
-       sqh->next = NULL;
-       sqh->prev = NULL;
-       return (sqh);
-}
-
-void
-ehci_free_sqh(ehci_softc_t *sc, ehci_soft_qh_t *sqh)
-{
-       sqh->next = sc->sc_freeqhs;
-       sc->sc_freeqhs = sqh;
-}
-
-ehci_soft_qtd_t *
-ehci_alloc_sqtd(ehci_softc_t *sc)
-{
-       ehci_soft_qtd_t *sqtd;
-       usbd_status err;
-       int i, offs;
-       usb_dma_t dma;
-
-       if (sc->sc_freeqtds == NULL) {
-               DPRINTFN(2, ("ehci_alloc_sqtd: allocating chunk\n"));
-               err = usb_allocmem(&sc->sc_bus, EHCI_SQTD_SIZE*EHCI_SQTD_CHUNK,
-                         EHCI_PAGE_SIZE, &dma);
-#ifdef EHCI_DEBUG
-               if (err)
-                       kprintf("ehci_alloc_sqtd: usb_allocmem()=%d\n", err);
-#endif
-               if (err)
-                       return (NULL);
-               crit_enter();
-               for(i = 0; i < EHCI_SQTD_CHUNK; i++) {
-                       offs = i * EHCI_SQTD_SIZE;
-                       sqtd = KERNADDR(&dma, offs);
-                       sqtd->physaddr = DMAADDR(&dma, offs);
-                       sqtd->nextqtd = sc->sc_freeqtds;
-                       sc->sc_freeqtds = sqtd;
-               }
-               crit_exit();
-       }
-
-       crit_enter();
-       sqtd = sc->sc_freeqtds;
-       sc->sc_freeqtds = sqtd->nextqtd;
-       memset(&sqtd->qtd, 0, sizeof(ehci_qtd_t));
-       sqtd->nextqtd = NULL;
-       sqtd->xfer = NULL;
-       crit_exit();
-
-       return (sqtd);
-}
-
-void
-ehci_free_sqtd(ehci_softc_t *sc, ehci_soft_qtd_t *sqtd)
-{
-       crit_enter();
-       sqtd->nextqtd = sc->sc_freeqtds;
-       sc->sc_freeqtds = sqtd;
-       crit_exit();
-}
-
-usbd_status
-ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc,
-                    int alen, int rd, usbd_xfer_handle xfer,
-                    ehci_soft_qtd_t **sp, ehci_soft_qtd_t **ep)
-{
-       ehci_soft_qtd_t *next, *cur;
-       ehci_physaddr_t dataphys, dataphyspage, dataphyslastpage, nextphys;
-       u_int32_t qtdstatus;
-       int len, curlen, mps, offset;
-       int i, iscontrol;
-       usb_dma_t *dma = &xfer->dmabuf;
-
-       DPRINTFN(alen<4*4096,("ehci_alloc_sqtd_chain: start len=%d\n", alen));
-
-       offset = 0;
-       len = alen;
-       iscontrol = (epipe->pipe.endpoint->edesc->bmAttributes & UE_XFERTYPE) ==
-           UE_CONTROL;
-       dataphys = DMAADDR(dma, 0);
-       dataphyslastpage = EHCI_PAGE(DMAADDR(dma, len - 1));
-       qtdstatus = EHCI_QTD_ACTIVE |
-           EHCI_QTD_SET_PID(rd ? EHCI_QTD_PID_IN : EHCI_QTD_PID_OUT) |
-           EHCI_QTD_SET_CERR(3)
-           /* IOC set below */
-           /* BYTES set below */
-           ;
-       mps = UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize);
-       /*
-        * The control transfer data stage always starts with a toggle of 1.
-        * For other transfers we let the hardware track the toggle state.
-        */
-       if (iscontrol)
-               qtdstatus |= EHCI_QTD_SET_TOGGLE(1);
-
-       cur = ehci_alloc_sqtd(sc);
-       *sp = cur;
-       if (cur == NULL)
-               goto nomem;
-       for (;;) {
-               dataphyspage = EHCI_PAGE(dataphys);
-               /* XXX This is pretty broken: Because we do not allocate
-                * a contiguous buffer (contiguous in physical pages) we
-                * can only transfer one page in one go.
-                * So check whether the start and end of the buffer are on
-                * the same page.
-                */
-               if (dataphyspage == dataphyslastpage) {
-                       curlen = len;
-               }
-               else {
-                       /* See comment above (XXX) */
-                       curlen = EHCI_PAGE_SIZE -
-                                EHCI_PAGE_MASK(dataphys);
-                       /* the length must be a multiple of the max size */
-                       curlen -= curlen % mps;
-                       DPRINTFN(1,("ehci_alloc_sqtd_chain: multiple QTDs, "
-                                   "curlen=%d\n", curlen));
-                       KASSERT(curlen != 0, ("ehci_alloc_std: curlen == 0"));
-               }
-               DPRINTFN(4,("ehci_alloc_sqtd_chain: dataphys=0x%08x "
-                           "dataphyslastpage=0x%08x len=%d curlen=%d\n",
-                           dataphys, dataphyslastpage,
-                           len, curlen));
-               len -= curlen;
-
-               if (len != 0) {
-                       next = ehci_alloc_sqtd(sc);
-                       if (next == NULL)
-                               goto nomem;
-                       nextphys = htole32(next->physaddr);
-               } else {
-                       next = NULL;
-                       nextphys = EHCI_NULL;
-               }
-
-               for (i = 0; i * EHCI_PAGE_SIZE < curlen; i++) {
-                       ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE;
-                       if (i != 0) /* use offset only in first buffer */
-                               a = EHCI_PAGE(a);
-                       cur->qtd.qtd_buffer[i] = htole32(a);
-                       cur->qtd.qtd_buffer_hi[i] = 0;
-#ifdef DIAGNOSTIC
-                       if (i >= EHCI_QTD_NBUFFERS) {
-                               kprintf("ehci_alloc_sqtd_chain: i=%d\n", i);
-                               goto nomem;
-                       }
-#endif
-               }
-               cur->nextqtd = next;
-               cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys;
-               cur->qtd.qtd_status =
-                   htole32(qtdstatus | EHCI_QTD_SET_BYTES(curlen));
-               cur->xfer = xfer;
-               cur->len = curlen;
-               DPRINTFN(10,("ehci_alloc_sqtd_chain: cbp=0x%08x end=0x%08x\n",
-                           dataphys, dataphys + curlen));
-               if (iscontrol) {
-                       /*
-                        * adjust the toggle based on the number of packets
-                        * in this qtd
-                        */
-                       if (((curlen + mps - 1) / mps) & 1)
-                               qtdstatus ^= EHCI_QTD_TOGGLE_MASK;
-               }
-               if (len == 0)
-                       break;
-               DPRINTFN(10,("ehci_alloc_sqtd_chain: extend chain\n"));
-               offset += curlen;
-               dataphys = DMAADDR(dma, offset);
-               cur = next;
-       }
-       cur->qtd.qtd_status |= htole32(EHCI_QTD_IOC);
-       *ep = cur;
-
-       DPRINTFN(10,("ehci_alloc_sqtd_chain: return sqtd=%p sqtdend=%p\n",
-                    *sp, *ep));
-
-       return (USBD_NORMAL_COMPLETION);
-
- nomem:
-       /* XXX free chain */
-       DPRINTFN(-1,("ehci_alloc_sqtd_chain: no memory\n"));
-       return (USBD_NOMEM);
-}
-
-static void
-ehci_free_sqtd_chain(ehci_softc_t *sc, ehci_soft_qtd_t *sqtd,
-                   ehci_soft_qtd_t *sqtdend)
-{
-       ehci_soft_qtd_t *p;
-       int i;
-
-       DPRINTFN(10,("ehci_free_sqtd_chain: sqtd=%p sqtdend=%p\n",
-                    sqtd, sqtdend));
-
-       for (i = 0; sqtd != sqtdend; sqtd = p, i++) {
-               p = sqtd->nextqtd;
-               ehci_free_sqtd(sc, sqtd);
-       }
-}
-
-/****************/
-
-/*
- * Close a reqular pipe.
- * Assumes that there are no pending transactions.
- */
-void
-ehci_close_pipe(usbd_pipe_handle pipe, ehci_soft_qh_t *head)
-{
-       struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-       ehci_soft_qh_t *sqh = epipe->sqh;
-
-       crit_enter();
-       ehci_rem_qh(sc, sqh, head);
-       crit_exit();
-       pipe->endpoint->savedtoggle =
-           EHCI_QTD_GET_TOGGLE(le32toh(sqh->qh.qh_qtd.qtd_status));
-       ehci_free_sqh(sc, epipe->sqh);
-       epipe->sqh = NULL;
-}
-
-/*
- * Abort a device request.
- * If this routine is called from a critical section it guarantees that the
- * request will be removed from the hardware scheduling and that the callback
- * for it will be called with USBD_CANCELLED status.
- * It's impossible to guarantee that the requested transfer will not
- * have happened since the hardware runs concurrently.
- * If the transaction has already happened we rely on the ordinary
- * interrupt processing to process it.
- * XXX This is most probably wrong.
- */
-void
-ehci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
-{
-#define exfer EXFER(xfer)
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-       ehci_softc_t *sc = (ehci_softc_t *)epipe->pipe.device->bus;
-       ehci_soft_qh_t *sqh = epipe->sqh;
-       ehci_soft_qtd_t *sqtd, *snext, **psqtd;
-       ehci_physaddr_t cur, us, next;
-       int hit;
-       /* int count = 0; */
-       ehci_soft_qh_t *psqh;
-
-       DPRINTF(("ehci_abort_xfer: xfer=%p pipe=%p\n", xfer, epipe));
-
-       if (sc->sc_dying) {
-               /* If we're dying, just do the software part. */
-               crit_enter();
-               xfer->status = status;  /* make software ignore it */
-               callout_stop(&xfer->timeout_handle);
-               usb_rem_task(epipe->pipe.device, &exfer->abort_task);
-               usb_transfer_complete(xfer);
-               crit_exit();
-               return;
-       }
-
-#if 0
-       if (xfer->device->bus->intr_context /* || !curproc REMOVED DFly */)
-               panic("ehci_abort_xfer: not in process context");
-#endif
-
-       /*
-        * If an abort is already in progress then just wait for it to
-        * complete and return.
-        */
-       if (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING) {
-               DPRINTFN(2, ("ehci_abort_xfer: already aborting\n"));
-               /* No need to wait if we're aborting from a timeout. */
-               if (status == USBD_TIMEOUT)
-                       return;
-               /* Override the status which might be USBD_TIMEOUT. */
-               xfer->status = status;
-               DPRINTFN(2, ("ehci_abort_xfer: waiting for abort to finish\n"));
-               exfer->ehci_xfer_flags |= EHCI_XFER_ABORTWAIT;
-               while (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING)
-                       tsleep(&exfer->ehci_xfer_flags, 0, "ehciaw", 0);
-               return;
-       }
-
-       /*
-        * Step 1: Make interrupt routine and timeouts ignore xfer.
-        */
-       crit_enter();
-       exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
-       xfer->status = status;  /* make software ignore it */
-       callout_stop(&xfer->timeout_handle);
-       usb_rem_task(epipe->pipe.device, &exfer->abort_task);
-       crit_exit();
-
-       /*
-        * Step 2: Wait until we know hardware has finished any possible
-        * use of the xfer. We do this by removing the entire
-        * queue from the async schedule and waiting for the doorbell.
-        * Nothing else should be touching the queue now.
-        */
-       psqh = sqh->prev;
-       ehci_rem_qh(sc, sqh, psqh);
-
-       /*
-        * Step 3:  make sure the soft interrupt routine
-        * has run. This should remove any completed items off the queue.
-        * The hardware has no reference to completed items (TDs).
-        * It's safe to remove them at any time.
-        */
-       crit_enter();
-#ifdef USB_USE_SOFTINTR
-       sc->sc_softwake = 1;
-#endif /* USB_USE_SOFTINTR */
-       usb_schedsoftintr(&sc->sc_bus);
-#ifdef USB_USE_SOFTINTR
-       tsleep(&sc->sc_softwake, 0, "ehciab", 0);
-#endif /* USB_USE_SOFTINTR */
-
-       /*
-        * Step 4: Remove any vestiges of the xfer from the hardware.
-        * The complication here is that the hardware may have executed
-        * into or even beyond the xfer we're trying to abort.
-        * So as we're scanning the TDs of this xfer we check if
-        * the hardware points to any of them.
-        *
-        * first we need to see if there are any transfers
-        * on this queue before the xfer we are aborting.. we need
-        * to update any pointers that point to us to point past
-        * the aborting xfer.  (If there is something past us).
-        * Hardware and software.
-        */
-       cur = EHCI_LINK_ADDR(le32toh(sqh->qh.qh_curqtd));
-       hit = 0;
-
-       /* If they initially point here. */
-       us = exfer->sqtdstart->physaddr;
-
-       /* We will change them to point here */
-       snext = exfer->sqtdend->nextqtd;
-       next = snext ? htole32(snext->physaddr) : EHCI_NULL;
-
-       /*
-        * Now loop through any qTDs before us and keep track of the pointer
-        * that points to us for the end.
-        */
-       psqtd = &sqh->sqtd;
-       sqtd = sqh->sqtd;
-       while (sqtd && sqtd != exfer->sqtdstart) {
-               hit |= (cur == sqtd->physaddr);
-               if (EHCI_LINK_ADDR(le32toh(sqtd->qtd.qtd_next)) == us)
-                       sqtd->qtd.qtd_next = next;
-               if (EHCI_LINK_ADDR(le32toh(sqtd->qtd.qtd_altnext)) == us)
-                       sqtd->qtd.qtd_altnext = next;
-               psqtd = &sqtd->nextqtd;
-               sqtd = sqtd->nextqtd;
-       }
-               /* make the software pointer bypass us too */
-       *psqtd = exfer->sqtdend->nextqtd;
-
-       /*
-        * If we already saw the active one then we are pretty much done.
-        * We've done all the relinking we need to do.
-        */
-       if (!hit) {
-
-               /*
-                * Now reinitialise the QH to point to the next qTD
-                * (if there is one). We only need to do this if
-                * it was previously pointing to us.
-                */
-               for (sqtd = exfer->sqtdstart; ; sqtd = sqtd->nextqtd) {
-                       if (cur == sqtd->physaddr) {
-                               hit++;
-                       }
-                       if (sqtd == exfer->sqtdend)
-                               break;
-               }
-               sqtd = sqtd->nextqtd;
-               /*
-                * Only need to alter the QH if it was pointing at a qTD
-                * that we are removing.
-                */
-               if (hit) {
-                       if (snext) {
-                               ehci_set_qh_qtd(sqh, snext);
-                       } else {
-
-                               sqh->qh.qh_curqtd = 0; /* unlink qTDs */
-                               sqh->qh.qh_qtd.qtd_status &=
-                                   htole32(EHCI_QTD_TOGGLE_MASK);
-                               sqh->qh.qh_qtd.qtd_next =
-                                   sqh->qh.qh_qtd.qtd_altnext
-                                       = EHCI_NULL;
-                               DPRINTFN(1,("ehci_abort_xfer: no hit\n"));
-                       }
-               }
-       }
-       ehci_add_qh(sqh, psqh);
-       /*
-        * Step 5: Execute callback.
-        */
-#ifdef DIAGNOSTIC
-       exfer->isdone = 1;
-#endif
-       /* Do the wakeup first to avoid touching the xfer after the callback. */
-       exfer->ehci_xfer_flags &= ~EHCI_XFER_ABORTING;
-       if (exfer->ehci_xfer_flags & EHCI_XFER_ABORTWAIT) {
-               exfer->ehci_xfer_flags &= ~EHCI_XFER_ABORTWAIT;
-               wakeup(&exfer->ehci_xfer_flags);
-       }
-       usb_transfer_complete(xfer);
-
-       /* kprintf("%s: %d TDs aborted\n", __func__, count); */
-       crit_exit();
-#undef exfer
-}
-
-void
-ehci_timeout(void *addr)
-{
-       struct ehci_xfer *exfer = addr;
-       struct ehci_pipe *epipe = (struct ehci_pipe *)exfer->xfer.pipe;
-       ehci_softc_t *sc = (ehci_softc_t *)epipe->pipe.device->bus;
-
-       DPRINTF(("ehci_timeout: exfer=%p\n", exfer));
-#ifdef USB_DEBUG
-       if (ehcidebug > 1)
-               usbd_dump_pipe(exfer->xfer.pipe);
-#endif
-
-       if (sc->sc_dying) {
-               ehci_abort_xfer(&exfer->xfer, USBD_TIMEOUT);
-               return;
-       }
-
-       /* Execute the abort in a process context. */
-       usb_add_task(exfer->xfer.pipe->device, &exfer->abort_task,
-                    USB_TASKQ_HC);
-}
-
-void
-ehci_timeout_task(void *addr)
-{
-       usbd_xfer_handle xfer = addr;
-
-       DPRINTF(("ehci_timeout_task: xfer=%p\n", xfer));
-       crit_enter();
-       ehci_abort_xfer(xfer, USBD_TIMEOUT);
-       crit_exit();
-}
-
-/*
- * Some EHCI chips from VIA / ATI seem to trigger interrupts before writing
- * back the qTD status, or miss signalling occasionally under heavy load.
- * If the host machine is too fast, we can miss transaction completion - when
- * we scan the active list the transaction still seems to be active. This
- * generally exhibits itself as a umass stall that never recovers.
- *
- * We work around this behaviour by setting up this callback after any softintr
- * that completes with transactions still pending, giving us another chance to
- * check for completion after the writeback has taken place.
- */
-void
-ehci_intrlist_timeout(void *arg)
-{
-       ehci_softc_t *sc = arg;
-
-       DPRINTFN(3, ("ehci_intrlist_timeout\n"));
-       usb_schedsoftintr(&sc->sc_bus);
-}
-
-/************************/
-
-static usbd_status
-ehci_device_ctrl_transfer(usbd_xfer_handle xfer)
-{
-       usbd_status err;
-
-       /* Insert last in queue. */
-       err = usb_insert_transfer(xfer);
-       if (err)
-               return (err);
-
-       /* Pipe isn't running, start first */
-       return (ehci_device_ctrl_start(STAILQ_FIRST(&xfer->pipe->queue)));
-}
-
-static usbd_status
-ehci_device_ctrl_start(usbd_xfer_handle xfer)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)xfer->pipe->device->bus;
-       usbd_status err;
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-#ifdef DIAGNOSTIC
-       if (!(xfer->rqflags & URQ_REQUEST)) {
-               /* XXX panic */
-               kprintf("ehci_device_ctrl_transfer: not a request\n");
-               return (USBD_INVAL);
-       }
-#endif
-
-       err = ehci_device_request(xfer);
-       if (err)
-               return (err);
-
-       if (sc->sc_bus.use_polling)
-               ehci_waitintr(sc, xfer);
-       return (USBD_IN_PROGRESS);
-}
-
-void
-ehci_device_ctrl_done(usbd_xfer_handle xfer)
-{
-       struct ehci_xfer *ex = EXFER(xfer);
-       ehci_softc_t *sc = (ehci_softc_t *)xfer->pipe->device->bus;
-       /*struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;*/
-
-       DPRINTFN(10,("ehci_ctrl_done: xfer=%p\n", xfer));
-
-#ifdef DIAGNOSTIC
-       if (!(xfer->rqflags & URQ_REQUEST)) {
-               panic("ehci_ctrl_done: not a request");
-       }
-#endif
-
-       if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
-               ehci_del_intr_list(ex); /* remove from active list */
-               ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
-       }
-
-       DPRINTFN(5, ("ehci_ctrl_done: length=%d\n", xfer->actlen));
-}
-
-/* Abort a device control request. */
-static void
-ehci_device_ctrl_abort(usbd_xfer_handle xfer)
-{
-       DPRINTF(("ehci_device_ctrl_abort: xfer=%p\n", xfer));
-       ehci_abort_xfer(xfer, USBD_CANCELLED);
-}
-
-/* Close a device control pipe. */
-static void
-ehci_device_ctrl_close(usbd_pipe_handle pipe)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-       /*struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;*/
-
-       DPRINTF(("ehci_device_ctrl_close: pipe=%p\n", pipe));
-       ehci_close_pipe(pipe, sc->sc_async_head);
-}
-
-usbd_status
-ehci_device_request(usbd_xfer_handle xfer)
-{
-#define exfer EXFER(xfer)
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-       usb_device_request_t *req = &xfer->request;
-       usbd_device_handle dev = epipe->pipe.device;
-       ehci_softc_t *sc = (ehci_softc_t *)dev->bus;
-       ehci_soft_qtd_t *setup, *stat, *next;
-       ehci_soft_qh_t *sqh;
-       int isread;
-       int len;
-       int addr = dev->address;
-       usbd_status err;
-
-       isread = req->bmRequestType & UT_READ;
-       len = UGETW(req->wLength);
-
-       DPRINTFN(3,("ehci_device_request: type=0x%02x, request=0x%02x, "
-                   "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
-                   req->bmRequestType, req->bRequest, UGETW(req->wValue),
-                   UGETW(req->wIndex), len, dev->address,
-                   epipe->pipe.endpoint->edesc->bEndpointAddress));
-
-       setup = ehci_alloc_sqtd(sc);
-       if (setup == NULL) {
-               err = USBD_NOMEM;
-               goto bad1;
-       }
-       stat = ehci_alloc_sqtd(sc);
-       if (stat == NULL) {
-               err = USBD_NOMEM;
-               goto bad2;
-       }
-
-       sqh = epipe->sqh;
-       epipe->u.ctl.length = len;
-
-#if 1
-       /* Update device address and length since they may have changed
-          during the setup of the control pipe in usbd_new_device(). */
-       /* XXX This only needs to be done once, but it's too early in open. */
-       /* XXXX Should not touch ED here! */
-       sqh->qh.qh_endp =
-           (sqh->qh.qh_endp & htole32(~(EHCI_QH_ADDRMASK | EHCI_QH_MPLMASK))) |
-           htole32(
-            EHCI_QH_SET_ADDR(addr) |
-            EHCI_QH_SET_MPL(UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize))
-           );
-#endif
-
-       /* Set up data transaction */
-       if (len != 0) {
-               ehci_soft_qtd_t *end;
-
-               err = ehci_alloc_sqtd_chain(epipe, sc, len, isread, xfer,
-                         &next, &end);
-               if (err)
-                       goto bad3;
-               end->qtd.qtd_status &= htole32(~EHCI_QTD_IOC);
-               end->nextqtd = stat;
-               end->qtd.qtd_next =
-               end->qtd.qtd_altnext = htole32(stat->physaddr);
-       } else {
-               next = stat;
-       }
-
-       memcpy(KERNADDR(&epipe->u.ctl.reqdma, 0), req, sizeof *req);
-
-       /* Clear toggle */
-       setup->qtd.qtd_status = htole32(
-           EHCI_QTD_ACTIVE |
-           EHCI_QTD_SET_PID(EHCI_QTD_PID_SETUP) |
-           EHCI_QTD_SET_CERR(3) |
-           EHCI_QTD_SET_TOGGLE(0) |
-           EHCI_QTD_SET_BYTES(sizeof *req)
-           );
-       setup->qtd.qtd_buffer[0] = htole32(DMAADDR(&epipe->u.ctl.reqdma, 0));
-       setup->qtd.qtd_buffer_hi[0] = 0;
-       setup->nextqtd = next;
-       setup->qtd.qtd_next = setup->qtd.qtd_altnext = htole32(next->physaddr);
-       setup->xfer = xfer;
-       setup->len = sizeof *req;
-
-       stat->qtd.qtd_status = htole32(
-           EHCI_QTD_ACTIVE |
-           EHCI_QTD_SET_PID(isread ? EHCI_QTD_PID_OUT : EHCI_QTD_PID_IN) |
-           EHCI_QTD_SET_CERR(3) |
-           EHCI_QTD_SET_TOGGLE(1) |
-           EHCI_QTD_IOC
-           );
-       stat->qtd.qtd_buffer[0] = 0; /* XXX not needed? */
-       stat->qtd.qtd_buffer_hi[0] = 0; /* XXX not needed? */
-       stat->nextqtd = NULL;
-       stat->qtd.qtd_next = stat->qtd.qtd_altnext = EHCI_NULL;
-       stat->xfer = xfer;
-       stat->len = 0;
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 5) {
-               DPRINTF(("ehci_device_request:\n"));
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(setup);
-       }
-#endif
-
-       exfer->sqtdstart = setup;
-       exfer->sqtdend = stat;
-#ifdef DIAGNOSTIC
-       if (!exfer->isdone) {
-               kprintf("ehci_device_request: not done, exfer=%p\n", exfer);
-       }
-       exfer->isdone = 0;
-#endif
-
-       /* Insert qTD in QH list. */
-       crit_enter();
-       ehci_set_qh_qtd(sqh, setup);
-       if (xfer->timeout && !sc->sc_bus.use_polling) {
-                callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
-                           ehci_timeout, xfer);
-       }
-       ehci_add_intr_list(sc, exfer);
-       xfer->status = USBD_IN_PROGRESS;
-       crit_exit();
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 10) {
-               DPRINTF(("ehci_device_request: status=%x\n",
-                        EOREAD4(sc, EHCI_USBSTS)));
-               DELAY(10000);
-               ehci_dump_regs(sc);
-               ehci_dump_sqh(sc->sc_async_head);
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(setup);
-       }
-#endif
-
-       return (USBD_NORMAL_COMPLETION);
-
- bad3:
-       ehci_free_sqtd(sc, stat);
- bad2:
-       ehci_free_sqtd(sc, setup);
- bad1:
-       DPRINTFN(-1,("ehci_device_request: no memory\n"));
-       xfer->status = err;
-       usb_transfer_complete(xfer);
-       return (err);
-#undef exfer
-}
-
-/************************/
-
-static usbd_status
-ehci_device_bulk_transfer(usbd_xfer_handle xfer)
-{
-       usbd_status err;
-
-       /* Insert last in queue. */
-       err = usb_insert_transfer(xfer);
-       if (err)
-               return (err);
-
-       /* Pipe isn't running, start first */
-       return (ehci_device_bulk_start(STAILQ_FIRST(&xfer->pipe->queue)));
-}
-
-usbd_status
-ehci_device_bulk_start(usbd_xfer_handle xfer)
-{
-#define exfer EXFER(xfer)
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-       usbd_device_handle dev = epipe->pipe.device;
-       ehci_softc_t *sc = (ehci_softc_t *)dev->bus;
-       ehci_soft_qtd_t *data, *dataend;
-       ehci_soft_qh_t *sqh;
-       usbd_status err;
-       int len, isread, endpt;
-
-       DPRINTFN(2, ("ehci_device_bulk_start: xfer=%p len=%d flags=%d\n",
-                    xfer, xfer->length, xfer->flags));
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-#ifdef DIAGNOSTIC
-       if (xfer->rqflags & URQ_REQUEST)
-               panic("ehci_device_bulk_start: a request");
-#endif
-
-       len = xfer->length;
-       endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
-       isread = UE_GET_DIR(endpt) == UE_DIR_IN;
-       sqh = epipe->sqh;
-
-       epipe->u.bulk.length = len;
-
-       err = ehci_alloc_sqtd_chain(epipe, sc, len, isread, xfer, &data,
-                                  &dataend);
-       if (err) {
-               DPRINTFN(-1,("ehci_device_bulk_start: no memory\n"));
-               xfer->status = err;
-               usb_transfer_complete(xfer);
-               return (err);
-       }
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 5) {
-               DPRINTF(("ehci_device_bulk_start: data(1)\n"));
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(data);
-       }
-#endif
-
-       /* Set up interrupt info. */
-       exfer->sqtdstart = data;
-       exfer->sqtdend = dataend;
-#ifdef DIAGNOSTIC
-       if (!exfer->isdone) {
-               kprintf("ehci_device_bulk_start: not done, ex=%p\n", exfer);
-       }
-       exfer->isdone = 0;
-#endif
-
-       crit_enter();
-       ehci_set_qh_qtd(sqh, data);
-       if (xfer->timeout && !sc->sc_bus.use_polling) {
-               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
-                           ehci_timeout, xfer);
-       }
-       ehci_add_intr_list(sc, exfer);
-       xfer->status = USBD_IN_PROGRESS;
-       crit_exit();
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 10) {
-               DPRINTF(("ehci_device_bulk_start: data(2)\n"));
-               DELAY(10000);
-               DPRINTF(("ehci_device_bulk_start: data(3)\n"));
-               ehci_dump_regs(sc);
-#if 0
-               kprintf("async_head:\n");
-               ehci_dump_sqh(sc->sc_async_head);
-#endif
-               kprintf("sqh:\n");
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(data);
-       }
-#endif
-
-       if (sc->sc_bus.use_polling)
-               ehci_waitintr(sc, xfer);
-
-       return (USBD_IN_PROGRESS);
-#undef exfer
-}
-
-static void
-ehci_device_bulk_abort(usbd_xfer_handle xfer)
-{
-       DPRINTF(("ehci_device_bulk_abort: xfer=%p\n", xfer));
-       ehci_abort_xfer(xfer, USBD_CANCELLED);
-}
-
-/*
- * Close a device bulk pipe.
- */
-static void
-ehci_device_bulk_close(usbd_pipe_handle pipe)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-
-       DPRINTF(("ehci_device_bulk_close: pipe=%p\n", pipe));
-       ehci_close_pipe(pipe, sc->sc_async_head);
-}
-
-void
-ehci_device_bulk_done(usbd_xfer_handle xfer)
-{
-       struct ehci_xfer *ex = EXFER(xfer);
-       ehci_softc_t *sc = (ehci_softc_t *)xfer->pipe->device->bus;
-       /*struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;*/
-
-       DPRINTFN(10,("ehci_bulk_done: xfer=%p, actlen=%d\n",
-                    xfer, xfer->actlen));
-
-       if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
-               ehci_del_intr_list(ex); /* remove from active list */
-               ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
-       }
-
-       DPRINTFN(5, ("ehci_bulk_done: length=%d\n", xfer->actlen));
-}
-
-/************************/
-
-static usbd_status
-ehci_device_setintr(ehci_softc_t *sc, ehci_soft_qh_t *sqh, int ival)
-{
-       struct ehci_soft_islot *isp;
-       int islot, lev;
-
-       /* Find a poll rate that is large enough. */
-       for (lev = EHCI_IPOLLRATES - 1; lev > 0; lev--)
-               if (EHCI_ILEV_IVAL(lev) <= ival)
-                       break;
-
-       /* Pick an interrupt slot at the right level. */
-       /* XXX could do better than picking at random. */
-       islot = EHCI_IQHIDX(lev, karc4random());
-
-       sqh->islot = islot;
-       isp = &sc->sc_islots[islot];
-       ehci_add_qh(sqh, isp->sqh);
-
-       return (USBD_NORMAL_COMPLETION);
-}
-
-static usbd_status
-ehci_device_intr_transfer(usbd_xfer_handle xfer)
-{
-       usbd_status err;
-
-       /* Insert last in queue. */
-       err = usb_insert_transfer(xfer);
-       if (err)
-               return (err);
-
-       /*
-        * Pipe isn't running (otherwise err would be USBD_INPROG),
-        * so start it first.
-        */
-       return (ehci_device_intr_start(STAILQ_FIRST(&xfer->pipe->queue)));
-}
-
-static usbd_status
-ehci_device_intr_start(usbd_xfer_handle xfer)
-{
-#define exfer EXFER(xfer)
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-       usbd_device_handle dev = xfer->pipe->device;
-       ehci_softc_t *sc = (ehci_softc_t *)dev->bus;
-       ehci_soft_qtd_t *data, *dataend;
-       ehci_soft_qh_t *sqh;
-       usbd_status err;
-       int len, isread, endpt;
-
-       DPRINTFN(2, ("ehci_device_intr_start: xfer=%p len=%d flags=%d\n",
-           xfer, xfer->length, xfer->flags));
-
-       if (sc->sc_dying)
-               return (USBD_IOERROR);
-
-#ifdef DIAGNOSTIC
-       if (xfer->rqflags & URQ_REQUEST)
-               panic("ehci_device_intr_start: a request");
-#endif
-
-       len = xfer->length;
-       endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
-       isread = UE_GET_DIR(endpt) == UE_DIR_IN;
-       sqh = epipe->sqh;
-
-       epipe->u.intr.length = len;
-
-       err = ehci_alloc_sqtd_chain(epipe, sc, len, isread, xfer, &data,
-           &dataend);
-       if (err) {
-               DPRINTFN(-1, ("ehci_device_intr_start: no memory\n"));
-               xfer->status = err;
-               usb_transfer_complete(xfer);
-               return (err);
-       }
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 5) {
-               DPRINTF(("ehci_device_intr_start: data(1)\n"));
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(data);
-       }
-#endif
-
-       /* Set up interrupt info. */
-       exfer->sqtdstart = data;
-       exfer->sqtdend = dataend;
-#ifdef DIAGNOSTIC
-       if (!exfer->isdone) {
-               kprintf("ehci_device_intr_start: not done, ex=%p\n", exfer);
-       }
-       exfer->isdone = 0;
-#endif
-
-       crit_enter();
-       ehci_set_qh_qtd(sqh, data);
-       if (xfer->timeout && !sc->sc_bus.use_polling) {
-               callout_reset(&xfer->timeout_handle, MS_TO_TICKS(xfer->timeout),
-                   ehci_timeout, xfer);
-       }
-       ehci_add_intr_list(sc, exfer);
-       xfer->status = USBD_IN_PROGRESS;
-       crit_exit();
-
-#ifdef EHCI_DEBUG
-       if (ehcidebug > 10) {
-               DPRINTF(("ehci_device_intr_start: data(2)\n"));
-               DELAY(10000);
-               DPRINTF(("ehci_device_intr_start: data(3)\n"));
-               ehci_dump_regs(sc);
-               kprintf("sqh:\n");
-               ehci_dump_sqh(sqh);
-               ehci_dump_sqtds(data);
-       }
-#endif
-
-       if (sc->sc_bus.use_polling)
-               ehci_waitintr(sc, xfer);
-
-       return (USBD_IN_PROGRESS);
-#undef exfer
-}
-
-static void
-ehci_device_intr_abort(usbd_xfer_handle xfer)
-{
-       DPRINTFN(1, ("ehci_device_intr_abort: xfer=%p\n", xfer));
-       if (xfer->pipe->intrxfer == xfer) {
-               DPRINTFN(1, ("ehci_device_intr_abort: remove\n"));
-               xfer->pipe->intrxfer = NULL;
-       }
-       ehci_abort_xfer(xfer, USBD_CANCELLED);
-}
-
-static void
-ehci_device_intr_close(usbd_pipe_handle pipe)
-{
-       ehci_softc_t *sc = (ehci_softc_t *)pipe->device->bus;
-       struct ehci_pipe *epipe = (struct ehci_pipe *)pipe;
-       struct ehci_soft_islot *isp;
-
-       isp = &sc->sc_islots[epipe->sqh->islot];
-       ehci_close_pipe(pipe, isp->sqh);
-}
-
-static void
-ehci_device_intr_done(usbd_xfer_handle xfer)
-{
-#define exfer EXFER(xfer)
-       struct ehci_xfer *ex = EXFER(xfer);
-       ehci_softc_t *sc = (ehci_softc_t *)xfer->pipe->device->bus;
-       struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
-       ehci_soft_qtd_t *data, *dataend;
-       ehci_soft_qh_t *sqh;
-       usbd_status err;
-       int len, isread, endpt;
-
-       DPRINTFN(10, ("ehci_device_intr_done: xfer=%p, actlen=%d\n",
-           xfer, xfer->actlen));
-
-       if (xfer->pipe->repeat) {
-               ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
-
-               len = epipe->u.intr.length;
-               xfer->length = len;
-               endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
-               isread = UE_GET_DIR(endpt) == UE_DIR_IN;
-               sqh = epipe->sqh;
-
-               err = ehci_alloc_sqtd_chain(epipe, sc, len, isread, xfer,
-                   &data, &dataend);
-               if (err) {
-                       DPRINTFN(-1, ("ehci_device_intr_done: no memory\n"));
-                       xfer->status = err;
-                       return;
-               }
-
-               /* Set up interrupt info. */
-               exfer->sqtdstart = data;
-               exfer->sqtdend = dataend;
-#ifdef DIAGNOSTIC
-               if (!exfer->isdone) {
-                       kprintf("ehci_device_intr_done: not done, ex=%p\n",
-                           exfer);
-               }
-               exfer->isdone = 0;
-#endif
-
-               crit_enter();
-               ehci_set_qh_qtd(sqh, data);
-               if (xfer->timeout && !sc->sc_bus.use_polling) {
-                       callout_reset(&xfer->timeout_handle,
-                           MS_TO_TICKS(xfer->timeout), ehci_timeout, xfer);
-               }
-               crit_exit();
-
-               xfer->status = USBD_IN_PROGRESS;
-       } else if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
-               ehci_del_intr_list(ex); /* remove from active list */
-               ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
-       }
-#undef exfer
-}
-
-/************************/
-
-static usbd_status
-ehci_device_isoc_transfer(usbd_xfer_handle xfer)
-{
-       return USBD_IOERROR;
-}
-
-static usbd_status
-ehci_device_isoc_start(usbd_xfer_handle xfer)
-{
-       return USBD_IOERROR;
-}
-
-static void
-ehci_device_isoc_abort(usbd_xfer_handle xfer)
-{
-}
-
-static void
-ehci_device_isoc_close(usbd_pipe_handle pipe)
-{
-}
-
-static void
-ehci_device_isoc_done(usbd_xfer_handle xfer)
-{
-}
-
-MODULE_DEPEND(ehci, usb, 1, 1, 1);
diff --git a/sys/bus/usb/ehci/Makefile b/sys/bus/usb/ehci/Makefile
deleted file mode 100644 (file)
index 1d3b059..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Makefile for EHCI module
-
-.PATH: ${.CURDIR}/..
-KMOD= ehci
-SRCS= ehci.c ehci_pci.c \
-       opt_usb.h \
-       bus_if.h device_if.h pci_if.h
-
-CFLAGS+= -I${.OBJDIR}/..
-
-.include <bsd.kmod.mk>
diff --git a/sys/bus/usb/ehci_pci.c b/sys/bus/usb/ehci_pci.c
deleted file mode 100644 (file)
index 0214909..0000000
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (augustss@carlstedt.se) at
- * Carlstedt Research & Technology.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/dev/usb/ehci_pci.c,v 1.18.2.1 2006/01/26 01:43:13 iedowse Exp $
- */
-
-/*
- * USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller.
- *
- * The EHCI 1.0 spec can be found at
- * http://developer.intel.com/technology/usb/download/ehci-r10.pdf
- * and the USB 2.0 spec at
- * http://www.usb.org/developers/docs/usb_20.zip
- */
-
-/* The low level controller code for EHCI has been split into
- * PCI probes and EHCI specific code. This was done to facilitate the
- * sharing of code between *BSD's
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/queue.h>
-#include <sys/lock.h>
-#include <sys/rman.h>
-
-#include <bus/pci/pcivar.h>
-#include <bus/pci/pcireg.h>
-
-#include <bus/usb/usb.h>
-#include <bus/usb/usbdi.h>
-#include <bus/usb/usbdivar.h>
-#include <bus/usb/usb_mem.h>
-
-#include <bus/usb/ehcireg.h>
-#include <bus/usb/ehcivar.h>
-
-#define PCI_EHCI_VENDORID_ACERLABS     0x10b9
-#define PCI_EHCI_VENDORID_AMD          0x1022
-#define PCI_EHCI_VENDORID_APPLE                0x106b
-#define PCI_EHCI_VENDORID_ATI          0x1002
-#define PCI_EHCI_VENDORID_CMDTECH      0x1095
-#define PCI_EHCI_VENDORID_INTEL                0x8086
-#define PCI_EHCI_VENDORID_NEC          0x1033
-#define PCI_EHCI_VENDORID_OPTI         0x1045
-#define PCI_EHCI_VENDORID_PHILIPS      0x1131
-#define PCI_EHCI_VENDORID_SIS          0x1039
-#define PCI_EHCI_VENDORID_NVIDIA       0x12D2
-#define PCI_EHCI_VENDORID_NVIDIA2      0x10DE
-#define PCI_EHCI_VENDORID_VIA          0x1106
-
-/* AcerLabs/ALi */
-#define PCI_EHCI_DEVICEID_M5239                0x523910b9
-static const char *ehci_device_m5239 = "ALi M5239 USB 2.0 controller";
-
-/* AMD */
-#define PCI_EHCI_DEVICEID_8111         0x74631022
-#define PCI_EHCI_DEVICEID_CS5536       0x20951022
-static const char *ehci_device_8111 = "AMD 8111 USB 2.0 controller";
-static const char *ehci_device_CS5536 = "AMD CS5536 USB 2.0 controller";
-
-/* ATI */
-#define PCI_EHCI_DEVICEID_SB200                0x43451002
-static const char *ehci_device_sb200 = "ATI SB200 USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_SB400                0x43731002
-static const char *ehci_device_sb400 = "ATI SB400 USB 2.0 controller";
-
-/* Intel */
-#define PCI_EHCI_DEVICEID_6300         0x25ad8086
-static const char *ehci_device_6300 = "Intel 6300ESB USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_ICH4         0x24cd8086
-static const char *ehci_device_ich4 = "Intel 82801DB/L/M USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_ICH5         0x24dd8086
-static const char *ehci_device_ich5 = "Intel 82801EB/R USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_ICH6         0x265c8086
-static const char *ehci_device_ich6 = "Intel 82801FB USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_ICH7         0x27cc8086
-static const char *ehci_device_ich7 = "Intel 82801GB/R USB 2.0 controller";
-/* NEC */
-#define PCI_EHCI_DEVICEID_NEC          0x00e01033
-static const char *ehci_device_nec = "NEC uPD 720100 USB 2.0 controller";
-
-/* NVIDIA */
-#define PCI_EHCI_DEVICEID_NF2          0x006810de
-static const char *ehci_device_nf2 = "NVIDIA nForce2 USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_NF2_400      0x008810de
-static const char *ehci_device_nf2_400 = "NVIDIA nForce2 Ultra 400 USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_NF3          0x00d810de
-static const char *ehci_device_nf3 = "NVIDIA nForce3 USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_NF3_250      0x00e810de
-static const char *ehci_device_nf3_250 = "NVIDIA nForce3 250 USB 2.0 controller";
-#define PCI_EHCI_DEVICEID_NF4          0x005b10de
-static const char *ehci_device_nf4 = "NVIDIA nForce4 USB 2.0 controller";
-
-/* Philips */
-#define PCI_EHCI_DEVICEID_ISP156X      0x15621131
-static const char *ehci_device_isp156x = "Philips ISP156x USB 2.0 controller";
-
-/* VIA */
-#define PCI_EHCI_DEVICEID_VIA          0x31041106
-static const char *ehci_device_via = "VIA VT6202 USB 2.0 controller";
-
-/* Generic */
-static const char *ehci_device_generic = "EHCI (generic) USB 2.0 controller";
-
-#define PCI_EHCI_BASE_REG      0x10
-
-#ifdef USB_DEBUG
-#define EHCI_DEBUG USB_DEBUG
-#define DPRINTF(x)     do { if (ehcidebug) kprintf x; } while (0)
-extern int ehcidebug;
-#else
-#define DPRINTF(x)
-#endif
-
-static int ehci_pci_attach(device_t self);
-static int ehci_pci_detach(device_t self);
-static int ehci_pci_shutdown(device_t self);
-static int ehci_pci_suspend(device_t self);
-static int ehci_pci_resume(device_t self);
-static void ehci_pci_givecontroller(device_t self);
-static void ehci_pci_takecontroller(device_t self);
-
-static int
-ehci_pci_suspend(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-       int err;
-
-       err = bus_generic_suspend(self);
-       if (err)
-               return (err);
-       ehci_power(PWR_SUSPEND, sc);
-
-       return 0;
-}
-
-static int
-ehci_pci_resume(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-
-       ehci_pci_takecontroller(self);
-       ehci_power(PWR_RESUME, sc);
-       bus_generic_resume(self);
-
-       return 0;
-}
-
-static int
-ehci_pci_shutdown(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-       int err;
-
-       err = bus_generic_shutdown(self);
-       if (sc->sc_flags & EHCI_SCFLG_DONEINIT) {
-               ehci_shutdown(sc);
-               ehci_pci_givecontroller(self);
-       }
-
-       return err;
-}
-
-static const char *
-ehci_pci_match(device_t self)
-{
-       u_int32_t device_id = pci_get_devid(self);
-
-       switch (device_id) {
-       case PCI_EHCI_DEVICEID_M5239:
-               return (ehci_device_m5239);
-       case PCI_EHCI_DEVICEID_8111:
-               return (ehci_device_8111);
-       case PCI_EHCI_DEVICEID_CS5536:
-               return (ehci_device_CS5536);
-       case PCI_EHCI_DEVICEID_SB200:
-               return (ehci_device_sb200);
-       case PCI_EHCI_DEVICEID_SB400:
-               return (ehci_device_sb400);
-       case PCI_EHCI_DEVICEID_6300:
-               return (ehci_device_6300);
-       case PCI_EHCI_DEVICEID_ICH4:
-               return (ehci_device_ich4);
-       case PCI_EHCI_DEVICEID_ICH5:
-               return (ehci_device_ich5);
-       case PCI_EHCI_DEVICEID_ICH6:
-               return (ehci_device_ich6);
-       case PCI_EHCI_DEVICEID_ICH7:
-               return (ehci_device_ich7);
-       case PCI_EHCI_DEVICEID_NEC:
-               return (ehci_device_nec);
-       case PCI_EHCI_DEVICEID_NF2:
-               return (ehci_device_nf2);
-       case PCI_EHCI_DEVICEID_NF2_400:
-               return (ehci_device_nf2_400);
-       case PCI_EHCI_DEVICEID_NF3:
-               return (ehci_device_nf3);
-       case PCI_EHCI_DEVICEID_NF3_250:
-               return (ehci_device_nf3_250);
-       case PCI_EHCI_DEVICEID_NF4:
-               return (ehci_device_nf4);
-       case PCI_EHCI_DEVICEID_ISP156X:
-               return (ehci_device_isp156x);
-       case PCI_EHCI_DEVICEID_VIA:
-               return (ehci_device_via);
-       default:
-               if (pci_get_class(self) == PCIC_SERIALBUS
-                   && pci_get_subclass(self) == PCIS_SERIALBUS_USB
-                   && pci_get_progif(self) == PCI_INTERFACE_EHCI) {
-                       return (ehci_device_generic);
-               }
-       }
-
-       return NULL;            /* dunno */
-}
-
-static int
-ehci_pci_probe(device_t self)
-{
-       const char *desc = ehci_pci_match(self);
-
-       if (desc) {
-               device_set_desc(self, desc);
-               device_set_async_attach(self, TRUE);
-               return 0;
-       } else {
-               return ENXIO;
-       }
-}
-
-static int
-ehci_pci_attach(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-       device_t parent;
-       device_t *neighbors;
-       device_t *nbus;
-       struct usb_softc *usb_sc;
-       struct usbd_bus *bsc;
-       int err;
-       int rid;
-       int ncomp;
-       int count, buscount;
-       int slot, function;
-       int res;
-       int i;
-
-       switch(pci_read_config(self, PCI_USBREV, 1) & PCI_USBREV_MASK) {
-       case PCI_USBREV_PRE_1_0:
-       case PCI_USBREV_1_0:
-       case PCI_USBREV_1_1:
-               sc->sc_bus.usbrev = USBREV_UNKNOWN;
-               kprintf("pre-2.0 USB rev\n");
-               return ENXIO;
-       case PCI_USBREV_2_0:
-               sc->sc_bus.usbrev = USBREV_2_0;
-               break;
-       default:
-               sc->sc_bus.usbrev = USBREV_UNKNOWN;
-               break;
-       }
-
-       pci_enable_busmaster(self);
-
-       rid = PCI_CBMEM;
-       sc->io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid,
-           RF_ACTIVE);
-       if (!sc->io_res) {
-               device_printf(self, "Could not map memory\n");
-               return ENXIO;
-       }
-       sc->iot = rman_get_bustag(sc->io_res);
-       sc->ioh = rman_get_bushandle(sc->io_res);
-
-       rid = 0;
-       sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
-           RF_SHAREABLE | RF_ACTIVE);
-       if (sc->irq_res == NULL) {
-               device_printf(self, "Could not allocate irq\n");
-               ehci_pci_detach(self);
-               return ENXIO;
-       }
-       sc->sc_bus.bdev = device_add_child(self, "usb", -1);
-       if (!sc->sc_bus.bdev) {
-               device_printf(self, "Could not add USB device\n");
-               ehci_pci_detach(self);
-               return ENOMEM;
-       }
-       device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
-
-       /* ehci_pci_match will never return NULL if ehci_pci_probe succeeded */
-       device_set_desc(sc->sc_bus.bdev, ehci_pci_match(self));
-       switch (pci_get_vendor(self)) {
-       case PCI_EHCI_VENDORID_ACERLABS:
-               ksprintf(sc->sc_vendor, "AcerLabs");
-               break;
-       case PCI_EHCI_VENDORID_AMD:
-               ksprintf(sc->sc_vendor, "AMD");
-               break;
-       case PCI_EHCI_VENDORID_APPLE:
-               ksprintf(sc->sc_vendor, "Apple");
-               break;
-       case PCI_EHCI_VENDORID_ATI:
-               ksprintf(sc->sc_vendor, "ATI");
-               break;
-       case PCI_EHCI_VENDORID_CMDTECH:
-               ksprintf(sc->sc_vendor, "CMDTECH");
-               break;
-       case PCI_EHCI_VENDORID_INTEL:
-               ksprintf(sc->sc_vendor, "Intel");
-               break;
-       case PCI_EHCI_VENDORID_NEC:
-               ksprintf(sc->sc_vendor, "NEC");
-               break;
-       case PCI_EHCI_VENDORID_OPTI:
-               ksprintf(sc->sc_vendor, "OPTi");
-               break;
-       case PCI_EHCI_VENDORID_SIS:
-               ksprintf(sc->sc_vendor, "SiS");
-               break;
-       case PCI_EHCI_VENDORID_NVIDIA:
-       case PCI_EHCI_VENDORID_NVIDIA2:
-               ksprintf(sc->sc_vendor, "nVidia");
-               break;
-       case PCI_EHCI_VENDORID_VIA:
-               ksprintf(sc->sc_vendor, "VIA");
-               break;
-       default:
-               if (bootverbose)
-                       device_printf(self, "(New EHCI DeviceId=0x%08x)\n",
-                           pci_get_devid(self));
-               ksprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self));
-       }
-
-       err = bus_setup_intr(self, sc->irq_res, 0,
-           (driver_intr_t *) ehci_intr, sc, &sc->ih, NULL);
-       if (err) {
-               device_printf(self, "Could not setup irq, %d\n", err);
-               sc->ih = NULL;
-               ehci_pci_detach(self);
-               return ENXIO;
-       }
-
-       /* Enable workaround for dropped interrupts as required */
-       switch (pci_get_vendor(self)) {
-       case PCI_EHCI_VENDORID_ATI:
-       case PCI_EHCI_VENDORID_VIA:
-               sc->sc_flags |= EHCI_SCFLG_LOSTINTRBUG;
-               if (bootverbose)
-                       device_printf(self,
-                           "Dropped interrupts workaround enabled\n");
-               break;
-       default:
-               break;
-       }
-
-       /*
-        * Find companion controllers.  According to the spec they always
-        * have lower function numbers so they should be enumerated already.
-        */
-       parent = device_get_parent(self);
-       res = device_get_children(parent, &neighbors, &count);
-       if (res != 0) {
-               device_printf(self, "Error finding companion busses\n");
-               ehci_pci_detach(self);
-               return ENXIO;
-       }
-       ncomp = 0;
-       slot = pci_get_slot(self);
-       function = pci_get_function(self);
-       for (i = 0; i < count; i++) {
-               if (pci_get_slot(neighbors[i]) == slot && \
-                       pci_get_function(neighbors[i]) < function) {
-                       res = device_get_children(neighbors[i],
-                               &nbus, &buscount);
-                       if (res != 0 || buscount != 1)
-                               continue;
-                       usb_sc = device_get_softc(nbus[0]);
-                       if (usb_sc == NULL)
-                               continue;
-                       bsc = usb_getbushandle(usb_sc);
-                       if (bsc == NULL)
-                               continue;
-                       DPRINTF(("ehci_pci_attach: companion %s\n",
-                           device_get_nameunit(bsc->bdev)));
-                       sc->sc_comps[ncomp++] = bsc;
-                       if (ncomp >= EHCI_COMPANION_MAX)
-                               break;
-               }
-       }
-       sc->sc_ncomp = ncomp;
-
-       ehci_pci_takecontroller(self);
-       err = ehci_init(sc);
-       if (err == 0)
-               err = device_probe_and_attach(sc->sc_bus.bdev);
-
-       if (err) {
-               device_printf(self, "USB init failed err=%d\n", err);
-               ehci_pci_detach(self);
-               return EIO;
-       }
-       return 0;
-}
-
-static int
-ehci_pci_detach(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-
-       if (sc->sc_flags & EHCI_SCFLG_DONEINIT) {
-               ehci_detach(sc, 0);
-               sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
-       }
-
-       /*
-        * disable interrupts that might have been switched on in ehci_init
-        */
-       if (sc->iot && sc->ioh)
-               bus_space_write_4(sc->iot, sc->ioh, EHCI_USBINTR, 0);
-
-       if (sc->irq_res && sc->ih) {
-               int err = bus_teardown_intr(self, sc->irq_res, sc->ih);
-
-               if (err)
-                       /* XXX or should we panic? */
-                       device_printf(self, "Could not tear down irq, %d\n",
-                           err);
-               sc->ih = NULL;
-       }
-       if (sc->sc_bus.bdev) {
-               device_delete_child(self, sc->sc_bus.bdev);
-               sc->sc_bus.bdev = NULL;
-       }
-       if (sc->irq_res) {
-               bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
-               sc->irq_res = NULL;
-       }
-       if (sc->io_res) {
-               bus_release_resource(self, SYS_RES_MEMORY, PCI_CBMEM, sc->io_res);
-               sc->io_res = NULL;
-               sc->iot = 0;
-               sc->ioh = 0;
-       }
-       return 0;
-}
-
-static void
-ehci_pci_takecontroller(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-       u_int32_t cparams, eec, legsup;
-       int eecp, i;
-
-       cparams = EREAD4(sc, EHCI_HCCPARAMS);
-
-       /* Synchronise with the BIOS if it owns the controller. */
-       for (eecp = EHCI_HCC_EECP(cparams); eecp != 0;
-            eecp = EHCI_EECP_NEXT(eec)) {
-               eec = pci_read_config(self, eecp, 4);
-               if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP)
-                       continue;
-               legsup = eec;
-               pci_write_config(self, eecp, legsup | EHCI_LEGSUP_OSOWNED, 4);
-               if (legsup & EHCI_LEGSUP_BIOSOWNED) {
-                       device_printf(sc->sc_bus.bdev,
-                           "waiting for BIOS to give up control\n");
-                       for (i = 0; i < 5000; i++) {
-                               legsup = pci_read_config(self, eecp, 4);
-                               if ((legsup & EHCI_LEGSUP_BIOSOWNED) == 0)
-                                       break;
-                               DELAY(1000);
-                       }
-                       if (legsup & EHCI_LEGSUP_BIOSOWNED)
-                               device_printf(sc->sc_bus.bdev,
-                                   "timed out waiting for BIOS\n");
-               }
-       }
-}
-
-/*
- * Return the controller to the BIOS.  Do we really need to do this?
- *
- * One thing we do need to do is give the chip reset (from the shutdown)
- * time to finish before handing anything back.  This fixes a machine
- * lockup.
- */
-static void
-ehci_pci_givecontroller(device_t self)
-{
-       ehci_softc_t *sc = device_get_softc(self);
-       u_int32_t cparams, eec, legsup;
-       int eecp;
-
-       DELAY(1000);
-       cparams = EREAD4(sc, EHCI_HCCPARAMS);
-       for (eecp = EHCI_HCC_EECP(cparams); eecp != 0;
-            eecp = EHCI_EECP_NEXT(eec)) {
-               eec = pci_read_config(self, eecp, 4);
-               if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP)
-                       continue;
-               legsup = eec;
-               pci_write_config(self, eecp, legsup & ~EHCI_LEGSUP_OSOWNED, 4);
-       }
-}
-
-static device_method_t ehci_methods[] = {
-       /* Device interface */
-       DEVMETHOD(device_probe, ehci_pci_probe),
-       DEVMETHOD(device_attach, ehci_pci_attach),
-       DEVMETHOD(device_detach, ehci_pci_detach),
-       DEVMETHOD(device_suspend, ehci_pci_suspend),
-       DEVMETHOD(device_resume, ehci_pci_resume),
-       DEVMETHOD(device_shutdown, ehci_pci_shutdown),
-
-       /* Bus interface */
-       DEVMETHOD(bus_print_child, bus_generic_print_child),
-
-       DEVMETHOD_END
-};
-
-static driver_t ehci_driver = {
-       "ehci",
-       ehci_methods,
-       sizeof(ehci_softc_t),
-};
-
-static devclass_t ehci_devclass;
-
-DRIVER_MODULE(ehci, pci, ehci_driver, ehci_devclass, NULL, NULL);
-DRIVER_MODULE(ehci, cardbus, ehci_driver, ehci_devclass, NULL, NULL);
diff --git a/sys/bus/usb/ehcireg.h b/sys/bus/usb/ehcireg.h
deleted file mode 100644 (file)
index 03ab92f..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*     $NetBSD: ehcireg.h,v 1.18 2004/10/22 10:38:17 augustss Exp $    */
-/*     $FreeBSD: src/sys/dev/usb/ehcireg.h,v 1.7.2.1 2006/01/26 01:43:13 iedowse Exp $ */
-/*     $DragonFly: src/sys/bus/usb/ehcireg.h,v 1.7 2007/06/27 12:27:59 hasso Exp $     */
-
-/*
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (lennart@augustsson.net).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * The EHCI 0.96 spec can be found at
- * http://developer.intel.com/technology/usb/download/ehci-r096.pdf
- * and the USB 2.0 spec at
- * http://www.usb.org/developers/data/usb_20.zip
- */
-
-#ifndef _DEV_PCI_EHCIREG_H_
-#define _DEV_PCI_EHCIREG_H_
-
-/*** PCI config registers ***/
-
-#define PCI_CBMEM              0x10    /* configuration base MEM */
-
-#define PCI_INTERFACE_EHCI     0x20
-
-#define PCI_USBREV             0x60    /* RO USB protocol revision */
-#define  PCI_USBREV_MASK       0xff
-#define  PCI_USBREV_PRE_1_0    0x00
-#define  PCI_USBREV_1_0                0x10
-#define  PCI_USBREV_1_1                0x11
-#define  PCI_USBREV_2_0                0x20
-
-#define PCI_EHCI_FLADJ         0x61    /*RW Frame len adj, SOF=59488+6*fladj */
-
-#define PCI_EHCI_PORTWAKECAP   0x62    /* RW Port wake caps (opt)  */
-
-/* EHCI Extended Capabilities */
-#define EHCI_EC_LEGSUP         0x01
-
-#define EHCI_EECP_NEXT(x)      (((x) >> 8) & 0xff)
-#define EHCI_EECP_ID(x)                ((x) & 0xff)
-
-/* Legacy support extended capability */
-#define EHCI_LEGSUP_LEGSUP     0x01
-#define  EHCI_LEGSUP_OSOWNED   0x01000000 /* OS owned semaphore */
-#define  EHCI_LEGSUP_BIOSOWNED 0x00010000 /* BIOS owned semaphore */
-#define EHCI_LEGSUP_USBLEGCTLSTS 0x04
-
-/*** EHCI capability registers ***/
-
-#define EHCI_CAPLENGTH         0x00    /*RO Capability register length field */
-/* reserved                    0x01 */
-#define EHCI_HCIVERSION                0x02    /* RO Interface version number */
-
-#define EHCI_HCSPARAMS         0x04    /* RO Structural parameters */
-#define  EHCI_HCS_DEBUGPORT(x) (((x) >> 20) & 0xf)
-#define  EHCI_HCS_P_INDICATOR(x) ((x) & 0x10000)
-#define  EHCI_HCS_N_CC(x)      (((x) >> 12) & 0xf) /* # of companion ctlrs */
-#define  EHCI_HCS_N_PCC(x)     (((x) >> 8) & 0xf) /* # of ports per comp. */
-#define  EHCI_HCS_PPC(x)       ((x) & 0x10) /* port power control */
-#define  EHCI_HCS_N_PORTS(x)   ((x) & 0xf) /* # of ports */
-
-#define EHCI_HCCPARAMS         0x08    /* RO Capability parameters */
-#define  EHCI_HCC_EECP(x)      (((x) >> 8) & 0xff) /* extended ports caps */
-#define  EHCI_HCC_IST(x)       (((x) >> 4) & 0xf) /* isoc sched threshold */
-#define  EHCI_HCC_ASPC(x)      ((x) & 0x4) /* async sched park cap */
-#define  EHCI_HCC_PFLF(x)      ((x) & 0x2) /* prog frame list flag */
-#define  EHCI_HCC_64BIT(x)     ((x) & 0x1) /* 64 bit address cap */
-
-#define EHCI_HCSP_PORTROUTE    0x0c    /*RO Companion port route description */
-
-/* EHCI operational registers.  Offset given by EHCI_CAPLENGTH register */
-#define EHCI_USBCMD            0x00    /* RO, RW, WO Command register */
-#define  EHCI_CMD_ITC_M                0x00ff0000 /* RW interrupt threshold ctrl */
-#define   EHCI_CMD_ITC_1       0x00010000
-#define   EHCI_CMD_ITC_2       0x00020000
-#define   EHCI_CMD_ITC_4       0x00040000
-#define   EHCI_CMD_ITC_8       0x00080000
-#define   EHCI_CMD_ITC_16      0x00100000
-#define   EHCI_CMD_ITC_32      0x00200000
-#define   EHCI_CMD_ITC_64      0x00400000
-#define  EHCI_CMD_ASPME                0x00000800 /* RW/RO async park enable */
-#define  EHCI_CMD_ASPMC                0x00000300 /* RW/RO async park count */
-#define  EHCI_CMD_LHCR         0x00000080 /* RW light host ctrl reset */
-#define  EHCI_CMD_IAAD         0x00000040 /* RW intr on async adv door bell */
-#define  EHCI_CMD_ASE          0x00000020 /* RW async sched enable */
-#define  EHCI_CMD_PSE          0x00000010 /* RW periodic sched enable */
-#define  EHCI_CMD_FLS_M                0x0000000c /* RW/RO frame list size */
-#define  EHCI_CMD_FLS(x)       (((x) >> 2) & 3) /* RW/RO frame list size */
-#define  EHCI_CMD_HCRESET      0x00000002 /* RW reset */
-#define  EHCI_CMD_RS           0x00000001 /* RW run/stop */
-
-#define EHCI_USBSTS            0x04    /* RO, RW, RWC Status register */
-#define  EHCI_STS_ASS          0x00008000 /* RO async sched status */
-#define  EHCI_STS_PSS          0x00004000 /* RO periodic sched status */
-#define  EHCI_STS_REC          0x00002000 /* RO reclamation */
-#define  EHCI_STS_HCH          0x00001000 /* RO host controller halted */
-#define  EHCI_STS_IAA          0x00000020 /* RWC interrupt on async adv */
-#define  EHCI_STS_HSE          0x00000010 /* RWC host system error */
-#define  EHCI_STS_FLR          0x00000008 /* RWC frame list rollover */
-#define  EHCI_STS_PCD          0x00000004 /* RWC port change detect */
-#define  EHCI_STS_ERRINT       0x00000002 /* RWC error interrupt */
-#define  EHCI_STS_INT          0x00000001 /* RWC interrupt */
-#define  EHCI_STS_INTRS(x)     ((x) & 0x3f)
-
-#define EHCI_NORMAL_INTRS (EHCI_STS_IAA | EHCI_STS_HSE | EHCI_STS_PCD | EHCI_STS_ERRINT | EHCI_STS_INT)
-
-#define EHCI_USBINTR           0x08    /* RW Interrupt register */
-#define EHCI_INTR_IAAE         0x00000020 /* interrupt on async advance ena */
-#define EHCI_INTR_HSEE         0x00000010 /* host system error ena */
-#define EHCI_INTR_FLRE         0x00000008 /* frame list rollover ena */
-#define EHCI_INTR_PCIE         0x00000004 /* port change ena */
-#define EHCI_INTR_UEIE         0x00000002 /* USB error intr ena */
-#define EHCI_INTR_UIE          0x00000001 /* USB intr ena */
-
-#define EHCI_FRINDEX           0x0c    /* RW Frame Index register */
-
-#define EHCI_CTRLDSSEGMENT     0x10    /* RW Control Data Structure Segment */
-
-#define EHCI_PERIODICLISTBASE  0x14    /* RW Periodic List Base */
-#define EHCI_ASYNCLISTADDR     0x18    /* RW Async List Base */
-
-#define EHCI_CONFIGFLAG                0x40    /* RW Configure Flag register */
-#define  EHCI_CONF_CF          0x00000001 /* RW configure flag */
-
-#define EHCI_PORTSC(n)         (0x40+4*(n)) /* RO, RW, RWC Port Status reg */
-#define  EHCI_PS_WKOC_E                0x00400000 /* RW wake on over current ena */
-#define  EHCI_PS_WKDSCNNT_E    0x00200000 /* RW wake on disconnect ena */
-#define  EHCI_PS_WKCNNT_E      0x00100000 /* RW wake on connect ena */
-#define  EHCI_PS_PTC           0x000f0000 /* RW port test control */
-#define  EHCI_PS_PIC           0x0000c000 /* RW port indicator control */
-#define  EHCI_PS_PO            0x00002000 /* RW port owner */
-#define  EHCI_PS_PP            0x00001000 /* RW,RO port power */
-#define  EHCI_PS_LS            0x00000c00 /* RO line status */
-#define  EHCI_PS_IS_LOWSPEED(x)        (((x) & EHCI_PS_LS) == 0x00000400)
-#define  EHCI_PS_PR            0x00000100 /* RW port reset */
-#define  EHCI_PS_SUSP          0x00000080 /* RW suspend */
-#define  EHCI_PS_FPR           0x00000040 /* RW force port resume */
-#define  EHCI_PS_OCC           0x00000020 /* RWC over current change */
-#define  EHCI_PS_OCA           0x00000010 /* RO over current active */
-#define  EHCI_PS_PEC           0x00000008 /* RWC port enable change */
-#define  EHCI_PS_PE            0x00000004 /* RW port enable */
-#define  EHCI_PS_CSC           0x00000002 /* RWC connect status change */
-#define  EHCI_PS_CS            0x00000001 /* RO connect status */
-#define  EHCI_PS_CLEAR         (EHCI_PS_OCC|EHCI_PS_PEC|EHCI_PS_CSC)
-
-#define EHCI_PORT_RESET_COMPLETE 2        /* in ms */
-
-#define EHCI_FLALIGN_ALIGN     0x1000
-
-/* No data structure may cross a page boundary. */
-#define EHCI_PAGE_SIZE 0x1000
-#define EHCI_PAGE(x) ((x) &~ 0xfff)
-#define EHCI_PAGE_OFFSET(x) ((x) & 0xfff)
-#define EHCI_PAGE_MASK(x) ((x) & 0xfff)
-
-typedef u_int32_t ehci_link_t;
-#define EHCI_LINK_TERMINATE    0x00000001
-#define EHCI_LINK_TYPE(x)      ((x) & 0x00000006)
-#define  EHCI_LINK_ITD         0x0
-#define  EHCI_LINK_QH          0x2
-#define  EHCI_LINK_SITD                0x4
-#define  EHCI_LINK_FSTN                0x6
-#define EHCI_LINK_ADDR(x)      ((x) &~ 0x1f)
-
-typedef u_int32_t ehci_physaddr_t;
-
-/* Isochronous Transfer Descriptor */
-typedef struct {
-       ehci_link_t     itd_next;
-       /* XXX many more */
-} ehci_itd_t;
-#define EHCI_ITD_ALIGN 32
-
-/* Split Transaction Isochronous Transfer Descriptor */
-typedef struct {
-       ehci_link_t     sitd_next;
-       /* XXX many more */
-} ehci_sitd_t;
-#define EHCI_SITD_ALIGN 32
-
-/* Queue Element Transfer Descriptor */
-#define EHCI_QTD_NBUFFERS 5
-typedef struct {
-       ehci_link_t     qtd_next;
-       ehci_link_t     qtd_altnext;
-       u_int32_t       qtd_status;
-#define EHCI_QTD_GET_STATUS(x) (((x) >>  0) & 0xff)
-#define EHCI_QTD_SET_STATUS(x) ((x) <<  0)
-#define  EHCI_QTD_ACTIVE       0x80
-#define  EHCI_QTD_HALTED       0x40
-#define  EHCI_QTD_BUFERR       0x20
-#define  EHCI_QTD_BABBLE       0x10
-#define  EHCI_QTD_XACTERR      0x08
-#define  EHCI_QTD_MISSEDMICRO  0x04
-#define  EHCI_QTD_SPLITXSTATE  0x02
-#define  EHCI_QTD_PINGSTATE    0x01
-#define  EHCI_QTD_STATERRS     0x7c
-#define EHCI_QTD_GET_PID(x)    (((x) >>  8) & 0x3)
-#define EHCI_QTD_SET_PID(x)    ((x) <<  8)
-#define  EHCI_QTD_PID_OUT      0x0
-#define  EHCI_QTD_PID_IN       0x1
-#define  EHCI_QTD_PID_SETUP    0x2
-#define EHCI_QTD_GET_CERR(x)   (((x) >> 10) &  0x3)
-#define EHCI_QTD_SET_CERR(x)   ((x) << 10)
-#define EHCI_QTD_GET_C_PAGE(x) (((x) >> 12) &  0x7)
-#define EHCI_QTD_SET_C_PAGE(x) ((x) << 12)
-#define EHCI_QTD_GET_IOC(x)    (((x) >> 15) &  0x1)
-#define EHCI_QTD_IOC           0x00008000
-#define EHCI_QTD_GET_BYTES(x)  (((x) >> 16) &  0x7fff)
-#define EHCI_QTD_SET_BYTES(x)  ((x) << 16)
-#define EHCI_QTD_GET_TOGGLE(x) (((x) >> 31) &  0x1)
-#define        EHCI_QTD_SET_TOGGLE(x)  ((x) << 31)
-#define EHCI_QTD_TOGGLE_MASK   0x80000000
-       ehci_physaddr_t qtd_buffer[EHCI_QTD_NBUFFERS];
-       ehci_physaddr_t qtd_buffer_hi[EHCI_QTD_NBUFFERS];
-} ehci_qtd_t;
-#define EHCI_QTD_ALIGN 32
-
-/* Queue Head */
-typedef struct {
-       ehci_link_t     qh_link;
-       u_int32_t       qh_endp;
-#define EHCI_QH_GET_ADDR(x)    (((x) >>  0) & 0x7f) /* endpoint addr */
-#define EHCI_QH_SET_ADDR(x)    (x)
-#define EHCI_QH_ADDRMASK       0x0000007f
-#define EHCI_QH_GET_INACT(x)   (((x) >>  7) & 0x01) /* inactivate on next */
-#define EHCI_QH_INACT          0x00000080
-#define EHCI_QH_GET_ENDPT(x)   (((x) >>  8) & 0x0f) /* endpoint no */
-#define EHCI_QH_SET_ENDPT(x)   ((x) <<  8)
-#define EHCI_QH_GET_EPS(x)     (((x) >> 12) & 0x03) /* endpoint speed */
-#define EHCI_QH_SET_EPS(x)     ((x) << 12)
-#define  EHCI_QH_SPEED_FULL    0x0
-#define  EHCI_QH_SPEED_LOW     0x1
-#define  EHCI_QH_SPEED_HIGH    0x2
-#define EHCI_QH_GET_DTC(x)     (((x) >> 14) & 0x01) /* data toggle control */
-#define EHCI_QH_DTC            0x00004000
-#define EHCI_QH_GET_HRECL(x)   (((x) >> 15) & 0x01) /* head of reclamation */
-#define EHCI_QH_HRECL          0x00008000
-#define EHCI_QH_GET_MPL(x)     (((x) >> 16) & 0x7ff) /* max packet len */
-#define EHCI_QH_SET_MPL(x)     ((x) << 16)
-#define EHCI_QH_MPLMASK                0x07ff0000
-#define EHCI_QH_GET_CTL(x)     (((x) >> 27) & 0x01) /* control endpoint */
-#define EHCI_QH_CTL            0x08000000
-#define EHCI_QH_GET_NRL(x)     (((x) >> 28) & 0x0f) /* NAK reload */
-#define EHCI_QH_SET_NRL(x)     ((x) << 28)
-       u_int32_t       qh_endphub;
-#define EHCI_QH_GET_SMASK(x)   (((x) >>  0) & 0xff) /* intr sched mask */
-#define EHCI_QH_SET_SMASK(x)   ((x) <<  0)
-#define EHCI_QH_GET_CMASK(x)   (((x) >>  8) & 0xff) /* split completion mask */
-#define EHCI_QH_SET_CMASK(x)   ((x) <<  8)
-#define EHCI_QH_GET_HUBA(x)    (((x) >> 16) & 0x7f) /* hub address */
-#define EHCI_QH_SET_HUBA(x)    ((x) << 16)
-#define EHCI_QH_GET_PORT(x)    (((x) >> 23) & 0x7f) /* hub port */
-#define EHCI_QH_SET_PORT(x)    ((x) << 23)
-#define EHCI_QH_GET_MULT(x)    (((x) >> 30) & 0x03) /* pipe multiplier */
-#define EHCI_QH_SET_MULT(x)    ((x) << 30)
-       ehci_link_t     qh_curqtd;
-       ehci_qtd_t      qh_qtd;
-} ehci_qh_t;
-#define EHCI_QH_ALIGN 32
-
-/* Periodic Frame Span Traversal Node */
-typedef struct {
-       ehci_link_t     fstn_link;
-       ehci_link_t     fstn_back;
-} ehci_fstn_t;
-#define EHCI_FSTN_ALIGN 32
-
-#endif /* _DEV_PCI_EHCIREG_H_ */
diff --git a/sys/bus/usb/ehcivar.h b/sys/bus/usb/ehcivar.h
deleted file mode 100644 (file)
index 0576c2b..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*     $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $    */
-/*     $FreeBSD: src/sys/dev/usb/ehcivar.h,v 1.9.2.1 2006/01/26 01:43:13 iedowse Exp $ */
-/*     $DragonFly: src/sys/bus/usb/ehcivar.h,v 1.12 2008/06/10 10:04:06 hasso Exp $    */
-
-/*
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (lennart@augustsson.net).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-typedef struct ehci_soft_qtd {
-       ehci_qtd_t qtd;
-       struct ehci_soft_qtd *nextqtd; /* mirrors nextqtd in TD */
-       ehci_physaddr_t physaddr;
-       usbd_xfer_handle xfer;
-       LIST_ENTRY(ehci_soft_qtd) hnext;
-       u_int16_t len;
-} ehci_soft_qtd_t;
-#define EHCI_SQTD_SIZE ((sizeof (struct ehci_soft_qtd) + EHCI_QTD_ALIGN - 1) / EHCI_QTD_ALIGN * EHCI_QTD_ALIGN)
-#define EHCI_SQTD_CHUNK (EHCI_PAGE_SIZE / EHCI_SQTD_SIZE)
-
-typedef struct ehci_soft_qh {
-       ehci_qh_t qh;
-       struct ehci_soft_qh *next;
-       struct ehci_soft_qh *prev;
-       struct ehci_soft_qtd *sqtd;
-       ehci_physaddr_t physaddr;
-       int islot;              /* Interrupt list slot. */
-} ehci_soft_qh_t;
-#define EHCI_SQH_SIZE ((sizeof (struct ehci_soft_qh) + EHCI_QH_ALIGN - 1) / EHCI_QH_ALIGN * EHCI_QH_ALIGN)
-#define EHCI_SQH_CHUNK (EHCI_PAGE_SIZE / EHCI_SQH_SIZE)
-
-struct ehci_xfer {
-       struct usbd_xfer xfer;
-       struct usb_task abort_task;
-       LIST_ENTRY(ehci_xfer) inext; /* list of active xfers */
-       ehci_soft_qtd_t *sqtdstart;
-       ehci_soft_qtd_t *sqtdend;
-       u_int32_t ehci_xfer_flags;
-#ifdef DIAGNOSTIC
-       int isdone;
-#endif
-};
-#define EHCI_XFER_ABORTING     0x0001  /* xfer is aborting. */
-#define EHCI_XFER_ABORTWAIT    0x0002  /* abort completion is being awaited. */
-
-#define EXFER(xfer) ((struct ehci_xfer *)(xfer))
-
-/* Information about an entry in the interrupt list. */
-struct ehci_soft_islot {
-       ehci_soft_qh_t *sqh;    /* Queue Head. */
-};
-
-#define EHCI_FRAMELIST_MAXCOUNT        1024
-#define EHCI_IPOLLRATES                8 /* Poll rates (1ms, 2, 4, 8 .. 128) */
-#define EHCI_INTRQHS           ((1 << EHCI_IPOLLRATES) - 1)
-#define EHCI_MAX_POLLRATE      (1 << (EHCI_IPOLLRATES - 1))
-#define EHCI_IQHIDX(lev, pos) \
-       ((((pos) & ((1 << (lev)) - 1)) | (1 << (lev))) - 1)
-#define EHCI_ILEV_IVAL(lev)    (1 << (lev))
-
-
-#define EHCI_HASH_SIZE 128
-#define EHCI_COMPANION_MAX 8
-
-#define EHCI_SCFLG_DONEINIT    0x0001  /* ehci_init() has been called. */
-#define EHCI_SCFLG_LOSTINTRBUG 0x0002  /* workaround for VIA / ATI chipsets */
-
-typedef struct ehci_softc {
-       struct usbd_bus sc_bus;         /* base device */
-       bus_space_tag_t iot;
-       bus_space_handle_t ioh;
-       bus_size_t sc_size;
-       void *ih;
-
-       struct resource *io_res;
-       struct resource *irq_res;
-       u_int sc_offs;                  /* offset to operational regs */
-       int sc_flags;                   /* misc flags */
-
-       char sc_vendor[32];             /* vendor string for root hub */
-       int sc_id_vendor;               /* vendor ID for root hub */
-
-       u_int32_t sc_cmd;               /* shadow of cmd reg during suspend */
-
-       u_int sc_ncomp;
-       u_int sc_npcomp;
-       struct usbd_bus *sc_comps[EHCI_COMPANION_MAX];
-
-       usb_dma_t sc_fldma;
-       ehci_link_t *sc_flist;
-       u_int sc_flsize;
-
-       struct ehci_soft_islot sc_islots[EHCI_INTRQHS];
-
-       LIST_HEAD(, ehci_xfer) sc_intrhead;
-
-       ehci_soft_qh_t *sc_freeqhs;
-       ehci_soft_qtd_t *sc_freeqtds;
-
-       int sc_noport;
-       u_int8_t sc_addr;               /* device address */
-       u_int8_t sc_conf;               /* device configuration */
-       usbd_xfer_handle sc_intrxfer;
-       char sc_isreset;
-#ifdef USB_USE_SOFTINTR
-       char sc_softwake;
-#endif /* USB_USE_SOFTINTR */
-
-       u_int32_t sc_eintrs;            /* enabled interrupts */
-       u_int32_t sc_dintrs;            /* deferred interrupts */
-       ehci_soft_qh_t *sc_async_head;
-
-       STAILQ_HEAD(, usbd_xfer) sc_free_xfers; /* free xfers */
-
-       struct lock sc_doorbell_lock;
-
-       struct callout sc_tmo_intrlist;
-
-       char sc_dying;
-} ehci_softc_t;
-
-#define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))
-#define EREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (a))
-#define EREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (a))
-#define EWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (a), (x))
-#define EWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (a), (x))
-#define EWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (a), (x))
-#define EOREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
-#define EOREAD2(sc, a) bus_space_read_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
-#define EOREAD4(sc, a) bus_space_read_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a))
-#define EOWRITE1(sc, a, x) bus_space_write_1((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
-#define EOWRITE2(sc, a, x) bus_space_write_2((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
-#define EOWRITE4(sc, a, x) bus_space_write_4((sc)->iot, (sc)->ioh, (sc)->sc_offs+(a), (x))
-
-usbd_status    ehci_init(ehci_softc_t *);
-int            ehci_intr(void *);
-int            ehci_detach(ehci_softc_t *, int);
-void           ehci_power(int state, void *priv);
-void           ehci_shutdown(void *v);
-
-#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
-
diff --git a/sys/bus/usb/hid.c b/sys/bus/usb/hid.c
deleted file mode 100644 (file)
index a58a428..0000000
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * $NetBSD: hid.c,v 1.17 2001/11/13 06:24:53 lukem Exp $
- * $FreeBSD: src/sys/dev/usb/hid.c,v 1.23 2003/08/24 17:55:54 obrien Exp $
- * $DragonFly: src/sys/bus/usb/hid.c,v 1.13 2007/06/28 13:55:12 hasso Exp $
- */
-/*
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Lennart Augustsson (lennart@augustsson.net) at
- * Carlstedt Research & Technology.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-
-#include <bus/usb/usb.h>
-#include <bus/usb/usbhid.h>
-
-#include <bus/usb/hid.h>
-
-#ifdef USB_DEBUG
-#define DPRINTF(x)     if (usbdebug) kprintf x
-#define DPRINTFN(n,x)  if (usbdebug>(n)) kprintf x
-extern int usbdebug;
-#else
-#define DPRINTF(x)
-#define DPRINTFN(n,x)
-#endif
-
-static void hid_clear_local(struct hid_item *);
-
-#define MAXUSAGE 100
-struct hid_data {
-       u_char *start;
-       u_char *end;
-       u_char *p;
-       struct hid_item cur;
-       int32_t usages[MAXUSAGE];
-       int nu;
-       int minset;
-       int multi;
-       int multimax;
-       int kindset;
-};
-
-static void
-hid_clear_local(struct hid_item *c)
-{
-
-       c->usage = 0;
-       c->usage_minimum = 0;
-       c->usage_maximum = 0;
-       c->designator_index = 0;
-       c->designator_minimum = 0;
-       c->designator_maximum = 0;
-       c->string_index = 0;
-       c->string_minimum = 0;
-       c->string_maximum = 0;
-       c->set_delimiter = 0;
-}
-
-struct hid_data *
-hid_start_parse(void *d, int len, int kindset)
-{
-       struct hid_data *s;
-
-       s = kmalloc(sizeof *s, M_TEMP, M_INTWAIT|M_ZERO);
-       s->start = s->p = d;
-       s->end = (char *)d + len;
-       s->kindset = kindset;
-       return (s);
-}
-
-void
-hid_end_parse(struct hid_data *s)
-{
-
-       while (s->cur.next != NULL) {
-               struct hid_item *hi = s->cur.next->next;
-               kfree(s->cur.next, M_TEMP);
-               s->cur.next = hi;
-       }
-       kfree(s, M_TEMP);
-}
-
-int
-hid_get_item(struct hid_data *s, struct hid_item *h)
-{
-       struct hid_item *c = &s->cur;
-       unsigned int bTag, bType, bSize;
-       u_int32_t oldpos;
-       u_char *data;
-       int32_t dval;
-       u_char *p;
-       struct hid_item *hi;
-       int i;
-
- top:
-       if (s->multimax != 0) {
-               if (s->multi < s->multimax) {
-                       c->usage = s->usages[min(s->multi, s->nu-1)];
-                       s->multi++;
-                       *h = *c;
-                       c->loc.pos += c->loc.size;
-                       h->next = 0;
-                       return (1);
-               } else {
-                       c->loc.count = s->multimax;
-                       s->multimax = 0;
-                       s->nu = 0;
-                       hid_clear_local(c);
-               }
-       }
-       for (;;) {
-               p = s->p;
-               if (p >= s->end)
-                       return (0);
-
-               bSize = *p++;
-               if (bSize == 0xfe) {
-                       /* long item */
-                       bSize = *p++;
-                       bSize |= *p++ << 8;
-                       bTag = *p++;
-                       data = p;
-                       p += bSize;
-                       bType = 0xff; /* XXX what should it be */
-               } else {
-                       /* short item */
-                       bTag = bSize >> 4;
-                       bType = (bSize >> 2) & 3;
-                       bSize &= 3;
-                       if (bSize == 3) bSize = 4;
-                       data = p;
-                       p += bSize;
-               }
-               s->p = p;
-               switch(bSize) {
-               case 0:
-                       dval = 0;
-                       break;
-               case 1:
-                       dval = (int8_t)*data++;
-                       break;
-               case 2:
-                       dval = *data++;
-                       dval |= *data++ << 8;
-                       dval = (int16_t)dval;
-                       break;
-               case 4:
-                       dval = *data++;
-                       dval |= *data++ << 8;
-                       dval |= *data++ << 16;
-                       dval |= *data++ << 24;
-                       break;
-               default:
-                       kprintf("BAD LENGTH %d\n", bSize);
-                       continue;
-               }
-
-               switch (bType) {
-               case 0:                 /* Main */
-                       switch (bTag) {
-                       case 8:         /* Input */
-                               if (!(s->kindset & (1 << hid_input)))
-                                       continue;
-                               c->kind = hid_input;
-                               c->flags = dval;
-                       ret:
-                               if (c->flags & HIO_VARIABLE) {
-                                       s->multimax = c->loc.count;
-                                       s->multi = 0;
-                                       c->loc.count = 1;
-                                       if (s->minset) {
-                                               for (i = c->usage_minimum;
-                                                    i <= c->usage_maximum;
-                                                    i++) {
-                                                       s->usages[s->nu] = i;
-                                                       if (s->nu < MAXUSAGE-1)
-                                                               s->nu++;
-                                               }
-                                               s->minset = 0;
-                                       }
-                                       goto top;
-                               } else {
-                                       *h = *c;
-                                       h->next = 0;
-                                       c->loc.pos +=
-                                               c->loc.size * c->loc.count;
-                                       hid_clear_local(c);
-                                       s->minset = 0;
-                                       return (1);
-                               }
-                       case 9:         /* Output */
-                               if (!(s->kindset & (1 << hid_output)))
-                                       continue;
-                               c->kind = hid_output;
-                               c->flags = dval;
-                               goto ret;
-                       case 10:        /* Collection */
-                               c->kind = hid_collection;
-                               c->collection = dval;
-                               c->collevel++;
-                               *h = *c;
-                               hid_clear_local(c);
-                               s->nu = 0;
-                               return (1);
-                       case 11:        /* Feature */
-                               if (!(s->kindset & (1 << hid_feature)))
-                                       continue;
-                               c->kind = hid_feature;
-                               c->flags = dval;
-                               goto ret;
-                       case 12:        /* End collection */
-                               c->kind = hid_endcollection;
-                               c->collevel--;
-                               *h = *c;
-                               hid_clear_local(c);
-                               s->nu = 0;
-                               return (1);
-                       default:
-                               kprintf("Main bTag=%d\n", bTag);
-                               break;
-                       }
-                       break;
-               case 1:         /* Global */
-                       switch (bTag) {
-                       case 0:
-                               c->_usage_page = dval << 16;
-                               break;
-                       case 1:
-                               c->logical_minimum = dval;
-                               break;
-                       case 2:
-                               c->logical_maximum = dval;
-                               break;
-                       case 3:
-                               c->physical_maximum = dval;
-                               break;
-                       case 4:
-                               c->physical_maximum = dval;
-                               break;
-                       case 5:
-                               c->unit_exponent = dval;
-                               break;
-                       case 6:
-                               c->unit = dval;
-                               break;
-                       case 7:
-                               c->loc.size = dval;
-                               break;
-                       case 8:
-                               c->report_ID = dval;
-                               break;
-                       case 9:
-                               c->loc.count = dval;
-                               break;
-                       case 10: /* Push */
-                               hi = kmalloc(sizeof *hi, M_TEMP, M_INTWAIT);
-                               *hi = s->cur;
-                               c->next = hi;
-                               break;
-                       case 11: /* Pop */
-                               hi = c->next;
-                               oldpos = c->loc.pos;
-                               s->cur = *hi;
-                               c->loc.pos = oldpos;
-                               kfree(hi, M_TEMP);
-                               break;
-                       default:
-                               kprintf("Global bTag=%d\n", bTag);
-                               break;
-                       }
-                       break;
-               case 2:         /* Local */
-                       switch (bTag) {
-                       case 0:
-                               if (bSize == 1)
-                                       dval = c->_usage_page | (dval&0xff);
-                               else if (bSize == 2)
-                                       dval = c->_usage_page | (dval&0xffff);
-                               c->usage = dval;
-                               if (s->nu < MAXUSAGE)
-                                       s->usages[s->nu++] = dval;
-                               /* else XXX */
-                               break;
-                       case 1:
-                               s->minset = 1;
-                               if (bSize == 1)
-                                       dval = c->_usage_page | (dval&0xff);
-                               else if (bSize == 2)
-                                       dval = c->_usage_page | (dval&0xffff);
-                               c->usage_minimum = dval;
-                               break;
-                       case 2:
-                               if (bSize == 1)
-                                       dval = c->_usage_page | (dval&0xff);
-                               else if (bSize == 2)
-                                       dval = c->_usage_page | (dval&0xffff);
-                               c->usage_maximum = dval;
-                               break;
-                       case 3:
-                               c->designator_index = dval;
-                               break;
-                       case 4:
-                               c->designator_minimum = dval;
-                               break;
-                       case 5:
-                               c->designator_maximum = dval;
-                               break;
-                       case 7:
-                               c->string_index = dval;
-                               break;
-                       case 8:
-                               c->string_minimum = dval;
-                               break;
-                       case 9:
-                               c->string_maximum = dval;
-                               break;
-                       case 10:
-                               c->set_delimiter = dval;
-                               break;
-                       default:
-                               kprintf("Local bTag=%d\n", bTag);
-                               break;
-                       }
-                       break;
-               default:
-                       kprintf("default bType=%d\n", bType);
-                       break;
-               }
-       }
-}
-
-int
-hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *idp)
-{
-       struct hid_data *d;
-       struct hid_item h;
-       int hi, lo, size, id;
-
-       id = 0;
-       hi = lo = -1;
-       for (d = hid_start_parse(buf, len, 1<<k); hid_get_item(d, &h); ) {
-               if (h.kind == k) {
-                       if (h.report_ID != 0 && !id)
-                               id = h.report_ID;
-                       if (h.report_ID == id) {
-                               if (lo < 0)
-                                       lo = h.loc.pos;
-                               hi = h.loc.pos + h.loc.size * h.loc.count;
-                       }
-               }
-       }
-       hid_end_parse(d);
-       size = hi - lo;
-       if (id != 0) {
-               size += 8;
-               *idp = id;      /* XXX wrong */
-       } else
-               *idp = 0;
-       return ((size + 7) / 8);
-}
-
-int
-hid_locate(void *desc, int size,&n