Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
 - removal of portability code

Patch most NetBSD changes, excluding
 - DMA memory "reserve", since we don't need contiguous buffers any longer
 - volatiles in DMA structure, since it should not be needed
   with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
 - Move all DMA related code to usb_mem.[ch]
   (add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
   XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
 - Add corresponding non-DMA code to usb_mem_nodma.[ch] .
   Currently just use malloc(9).
 - Above files are conditionally used by config framework (added
   attributes to conf/files and dev/usb/files.usb).
 - Add diagnostic panics when resource allocation is requested
   on interrupt context.
 - Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
 advantage:	Buffers can be freed on detaching host interface.
		Activity of a host interface does not affect others.
 disadvantages:	It possibly consumes more memory.

API changes
 - usbd_alloc_xfer() is changed:
    old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
    new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
		usbd_pipe_handle pipe);
 - pipe argument of usbd_setup_*xfer() are now unused
   XXX the pipe argument should be removed?
 - add mapping APIs
 - async request will be processed as a task (kernel thread context),
   and delayed to some extent
 - usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
   (mapped/allocated/refered buffer for HCI driver)
 - usb_port.h: change usb_proc_ptr from  struct ptoc *  to struct lwp *
 - usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
 - usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
 - atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
   uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
   uscanner, ustir, utoppy:
    * catch up API change of usbd_alloc_xfer()
 - umass, usscanner:
    * catch up API change of usbd_alloc_xfer()
    * eliminate memory copy for large transfer

ohci
 - free resources on detach
 - add lots of bus_dmamap_sync() operations
 - simplify the code of loading std chain
 - rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
 - add workaround for CMD Tech 670 and 673 chipsets
 - make sure resources are not allocated in interrupt context
 - add support for mapping buffer and mbuf

slhci
 - allocate xfer and slhci_xfer at once, and simplify relevant code
 - add slhci_detach()
 - remove second arg of slhci_attach() since it is the same as the first arg.
 - add support for "mapping" (no, it doesn't map since it doesn't do DMA)
   buffer and mbuf
 - add pcmcia frontend
 - NOT TESTED, missing hardware

ehci
 - add lots of bus_dmamap_sync() operations, possibly too many
 - make sure resources are not allocated in interrupt context
 - add support for mapping buffer and mbuf
 - done only simple test

uhci
 - add lots of bus_dmamap_sync() operations, possibly too many
 - make sure resources are not allocated in interrupt context
 - add support for mapping buffer and mbuf

To do
 - review, test, debug
 - rewrite network drivers to utilize usbd_map_buffer_mbuf()
 - rewrite uaudio(4) to eliminate memcpy
 - "pipe" argument of usbd_setup_*xfer() should eventually be removed
usbdi(9): Change usbd_map_buffer_mbuf to return the result, since
	mbuf(9) chain may be fragmented and mapping failure will happen.
-void usbd_map_buffer_mbuf(usbd_xfer_handle xfer, struct mbuf *chain)
+usbd_status usbd_map_buffer_mbuf(usbd_xfer_handle xfer, struct mbuf *chain)

usbdi(9): Add more diagnostic assertions.
uhci(4): fix aux dma for mbuf mapping.
slhci(4): fix repeated interrupt transfer (not tested).
ehci/slhci/ohci/uhci: Add checks where mbuf(4) transfer is not supported.

usb_port.h: Add some compat macros for FreeBSD.
usb_mem_nodma.c: Fix typos.
Convert to use usbd_map_buffer_mbuf() and eliminate copying.
Tested, ... but it doesn't work.  Why?

arpresolve: can't allocate llinfo on cdce0 for 192.168.129.201
Fix mbuf transfer.
Fix "can't allocate llinfo" errors.
Setup ifp->if_init/ifp->if_stop, and use ether_ioctl() for cdce_ioctl().
Fix problem where aux buffer is overwritten if multiple aux buffers
are used on a transfer.
Move commonly used code in USB Ethernet drivers to usb_ethersubr.[ch],
from FreeBSD.  The interface is modified to fit our new code.

(Note FreeBSD passes packets to different kernel thread, which I did NOT
adopt or now.  That is because I'm not sure it is really necessary,
and it enforces more context switchings per packet and probably causes
large latency and poor performace.)
- Convert to use usbd_map_buffer_mbuf() and eliminate mbuf-memory copy.
- Use common code in usb_ethersubr.[ch] and reduce duplicated code.
- Use ether_ioctl() to handle llinfo (what is it?) properly.

XXX Untested, missing hardware.
- Convert to use usbd_map_buffer_mbuf() and eliminate mbuf-memory copy.
- Use common code in usb_ethersubr.[ch] and reduce duplicated code.
- XXX Use m_copyback() to extend mbuf chain. XXX Is this the right way?

XXX Untested, missing hardware.
- Convert to use usbd_map_buffer_mbuf() and eliminate mbuf-memory copy.
- Use common code in usb_ethersubr.[ch] and reduce duplicated code.
- Use ether_ioctl() to handle llinfo (what is it?) properly.
- XXX Use m_copyback() to extend mbuf chain. XXX Is this the right way?

XXX Untested, missing hardware.
Add check after m_copyback.
Set portno in ucom_attach_args, to UCOM_UNK_PORTNO. The port number is
unused in this driver's callbacks, so this is an aesthetic rather than
functional change ("ucom0 at uslsa0" rather than "ucom0 at uslsa0
portno -848524548").
- Map audio buffer directly and eliminate memory to memory copy
  by (ab)using mbuf(9).
- Change order to fit current API: usbd_open_pipe() -> usbd_alloc_xfer;
  usbd_abort_pipe() -> usbd_free_xfer() -> usbd_close_pipe().

XXX Untested
- Change order to fit current API: usbd_open_pipe() -> usbd_alloc_xfer;
  usbd_abort_pipe() -> usbd_free_xfer() -> usbd_close_pipe().
Add dev/usb/usb_ethersubr.[ch] in comment.
caddr_t -> u_int8_t * / const u_int8_t *
Pullup 1.25 in a different way.
Pullup 1.100 in a different way.
Pullup 1.18 in a different way.
Pullup 1.13 in a different way.