Home | History | Annotate | Download | only in usb
History log of /src/sys/dev/usb/ucom.c
RevisionDateAuthorComments
 1.144  10-Oct-2025  skrll Revery previous.

I was still reviewing and providing feedback and it breaks the build.
 1.143  10-Oct-2025  manu Console support for USB-to-serial adapters

Of course nothing can happen before the USB device is attached. Early
boot is silent, and kernel outputs start when ucom gets attached.

boot -a and DDB work. boot -c for userconf prompt cannot work, because
it happens before USB attachment.
 1.142  10-Oct-2025  manu Fix ucom input queue corruption on open-after-close

When closing ucom(4) while a transfer was in progress, ucomreadcb()
is called with USBD_CANCELLED. Previously, the ucom_buffer was not
removed from sc->sc_ibuff_empty, leading to queue corruption when
reopening the device: ucomopen() calls ucomsubmitread(), which
queues the ucom_buffer again.

We fix this by making sure the ucom_buffer is removed from queue
on USBD_CANCELLED or USBD_IOERROR.

Approved by Nick Hudson, who rewrote the comment.
 1.141  30-Sep-2025  skrll spaces to tabs
 1.140  10-Apr-2025  bad convert two printf's to device_printf

so that we know on what device we get e.g. "ucomreadcb: wonky status".
 1.139  12-Apr-2024  jakllsch branches: 1.139.2;
include opt_ntp.h for PPS_SYNC
 1.138  05-Mar-2023  riastradh ucom(4): Simplify logic fixing PR kern/57259.

cv_timedwait only ever returns 0 or EWOULDBLOCK, so this would always
return ERESTART anyway.

No functional change intended.
 1.137  05-Mar-2023  thorpej In the HUP-wait path in ucomopen():
- Use cv_timedwait() rather than cv_timedwait_sig(); the wait here is
bounded (and fairly short besides) and seems appropriate to treat like
other uninterruptible waits. The behavior is now consistent with com(4)
in this regard.
- Map EWOULDBLOCK return from cv_timedwait() to 0, as the successful passage
of time is not an error in this case.
- If the HUP-wait time has passed, clear the HUP-wait timestamp.

kern/57259 (although insufficient -- another change to vfs_syscalls.c
is required)
 1.136  17-Feb-2023  riastradh ucom(4): Missed a spot in previous -- nix now-unused local.
 1.135  17-Feb-2023  riastradh ucom(4): Nix broken error branch.

This error branch was introduced to make the system act, when a USB
serial adapter is yanked, as if the other end had spat out a line
feed in an attempt to wake any sleeping readers so they will stop
using the USB serial port.

This is no longer necessary, because ttycancel will wake them anyway,
and it is actually harmful because it puts stuff in the output queue
(CR LF) that will never be processed, causing subsequent users to
hang trying to open the device.

Problem found and patch tested by tih@.
 1.134  26-Oct-2022  riastradh branches: 1.134.2;
ucom(4): Convert to ttylock/ttyunlock.
 1.133  17-Apr-2022  riastradh ucom(4): Make sure rndsource is attached before use and detach.

Reported-by: syzbot+04fb6786e0cf873905e8@syzkaller.appspotmail.com
 1.132  07-Apr-2022  riastradh ucom(4): Use tty_unit -- save a couple lines of code.
 1.131  07-Apr-2022  riastradh ucom(4): Fix unit numbering for devsw/autoconf cross-wiring.

Should introduce a tty_unit function to use here but this'll do for
now to fix the bug I introduced in ucom(4).
 1.130  28-Mar-2022  riastradh ucom(4): Rework open/close/attach/detach logic.

- Defer sleep after hangup until open.

No need to make close hang; we just need to make sure some time has
passed before we next try to open.

This changes the wchan for the sleep. Oh well.

- Use .d_cfdriver/devtounit/cancel to resolve races between attach,
detach, open, close, and revoke.

- Use a separate .sc_closing flag instead of a UCOM_CLOSING state.
ucomcancel/ucomclose owns this flag, and it may be set in any state
(except UCOM_DEAD). UCOM_OPENING remains owned by ucomopen, which
might be interrupted by cancel/close.

- Rework error branches in ucomopen. Much simpler this way.

- Nix unnecessary reference counting.
 1.129  24-Jun-2021  riastradh ucom(4): Fix earlier mistake causing pipes not to be closed.

In revision 1.123, mrg@ changed what he thought was a double-close,
but was actually abort&close (as is appropriate) to just abort (which
is not enough -- leaks the pipe). This restores the abort&close.

The original `bug' was found by code inspection, whereas this bug was
found by asserting in usb_subr.c that no pipes are open on device
disconnection after detach; the asserts actually triggered with
several ucom(4) devices, and no longer trigger with this change.

XXX pullup-9
 1.128  26-Oct-2020  mrg branches: 1.128.6;
properly wait for refcounts to drain.
fixes panic at detach that jmnceill saw.

XXX: pullup-[89].
 1.127  14-Mar-2020  christos revert the 0x% -> %# change for fixed width formats pointed out by uwe.
 1.126  13-Mar-2020  christos PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log
 1.125  09-May-2019  mrg branches: 1.125.2;
clean up ucom parents some more:
- it's always "bool sc_dying" now, with true/false
- heavy use of static functions
- remove all ucom parent ca_activate callbacks. they're never called.
- callbacks should generally do little to nothing if sc_dying is set
- open resources should be released in detach after setting sc_dying
- don't complain about usbd_abort_pipe() or usbd_close_pipe() failure
- when releasing resources, zero the softc member as well
- remove ucom_methods members no longer destined to be filled in
- generally, DPRINTF() before sc_dying short circuit
- use EIO when dying, not ENXIO or 0
- add some ucom_open() callbacks that simply return EIO if dying
 1.124  05-May-2019  mrg remove explicit 'extern struct cfdriver <my>_cd;' and use ioconf.h
 1.123  01-May-2019  mrg fix a locking botch in ucomhwiflow():

tty.c always calls t_hwiflow() with tty_lock held, and the caller
of this for ucom always holds sc->sc_lock when calling down into
the tty layer.

don't try to re-take the sc_lock in ucomhwiflow() (locking against
myself is triggered here currently), but instead assert that the
lock is already held _and_ that tty_lock is held.


in ucom_detach(), when closing pipes set sc_bulkin_pipe and
sc_bulkout_pipe to NULL. fixes bug noticed by code inspection:
a failed detach would attempt to close them a second time.
 1.122  20-Apr-2019  mrg fix umodem(4) detach:

- ucom(4) needs kpreempt disabled around softint_schedule()
- switch a copied printf() to aprint_error_dev()
- use static normally in umodem_common.c
- remove unused sc_openings in softc, convert sc_dying to real bool
- add sc_refcnt, sc_lock and sc_detach_cv to softc. usage is:
- sc_dying is protected by sc_lock
- sc_detach_cv is matched with sc_lock for cv operations
- sc_refcnt is increased in open and decreased in close, any time
it is decreased, it is checked for less than zero, and a broadcast
performed on sc_detach_cv. detach waits for sc_refcnt.
- umodem_param() and umodem_set() check for sc_dying

this fixes pullout out an open ucom@umodem.

@skrll.

XXX: pullup
 1.121  11-Dec-2018  jakllsch restore error reporting in ucomparam() lost in 1.115
 1.120  21-Jan-2018  skrll branches: 1.120.2; 1.120.4;
PR kern/52931 Kernel panics with Atheros usb wireless interface

Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs
 1.119  28-Oct-2017  pgoyette Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.
 1.118  14-Dec-2016  skrll branches: 1.118.6; 1.118.8;
Don't hold softc lock when calling ucom_read

PR/51714: uftdi (on xhci): mutex_vector_enter: locking against myself
 1.117  04-Dec-2016  skrll Whitespace
 1.116  29-Nov-2016  skrll Ensure the softc lock is not held in ucom_shutdown as the call to ucom_dtr
can sleep.
 1.115  19-Nov-2016  skrll Pull across various locking and reference counting fixes from nick-nhusb.
 1.114  03-Oct-2016  skrll Do not hold the softc lock (IPL_SOFTUSB) unnecessarily and specifically
across ucomparam (and the ucom_param method). The method can sleep wait-
ing for transfers... any input/output will try to acquire the lock and get
stuck
 1.113  14-May-2016  mlelstv branches: 1.113.2;
All com devices have an issue that they sleep in the final close
when they signal a hangup while still using the device. This allows
a concurrent open to succeed without proper locking because it
only checks the state of the tty layer.

This issue triggers an assertion in ucom due to a reused USB xfer,
but it can also cause misbehaviour in other com devices.

For now in ucom:
- make open block while close is in progress
- also serialize close operations
 1.112  10-May-2016  skrll Fixup ucom_cleanup to not forget our pipe handles.

Simplify ucomreadcb by dealing with the USBD_CANCELLED separately and
not taking sc_lock. We can't hold sc_lock while aborting now.
 1.111  23-Apr-2016  skrll Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.110  08-Nov-2015  joerg Add the port number to the device properties to make it easier to relate
a specific ucom instance with the physical port of multi-port devices
like the FTDI 4232.
 1.109  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.108  15-Nov-2014  christos branches: 1.108.2;
centralize the dialout/call unit macros.
 1.107  10-Aug-2014  tls branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.
 1.106  25-Jul-2014  gdt Add PPS support to ucom(4).

This is basically cribbed from regular serial ports, and just adds
hooks to call the pps support routines.

Also, note in the ucom(4) man page that there is about 1 ms of
latency. Discussed on tech-kern in October of 2013, with the only
concern being that someone who didn't know what they were doing might
set up a stratum 1 server, and that somehow might have worse
timekeeping than whatever else that person might have done; the man
page comment is a mitigation for this.

This patch has been live-tested in netbsd-5/i386 and netbsd-6/i386,
and has been running on machines without a USB-serial GPS device for
most of a year with no adverse consequences (very little happens if
the PPS ioctls are not invoked).
 1.105  25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.104  04-May-2014  christos remove hack for PR/42848
 1.103  16-Mar-2014  dholland branches: 1.103.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.102  15-Dec-2012  jakllsch branches: 1.102.2;
drop trailing whitespace.
 1.101  15-Dec-2012  jakllsch Sometimes the device disappears out from under us and device_lookup_private()
will return NULL. Be paranoid about this to prevent NULL pointer dereferences.
 1.100  17-Oct-2012  mlelstv Don't rely on TS_BUSY to determine wether there is a buffer
available. Instead handle a possible buffer shortage.
Also aquire lock when modifying t_state.
 1.99  06-Mar-2012  mrg branches: 1.99.2;
pull down from usbmp branch:

- rename usb_detach_{wake,waitup}() to usb_detach_{wake,waitup}old()
- use some c99 struct .initialisers
 1.98  24-Feb-2012  mrg remove any remnants of freebsd/openbsd code.
 1.97  02-Feb-2012  tls Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.96  14-Jan-2012  jakllsch Stopgap XXX kludge for PR kern/42848 and PR kern/45013.

Someone should really find and fix the real problem,
but it's better to not crash in the meantime.
 1.95  14-Jan-2012  jakllsch Don't notify about zero length reads without UCOM_DEBUG && ucomdebug > 0.
It's typical for uslsa(4) hardware to do this occasionally.
 1.94  14-Jan-2012  jakllsch In ucompoll() also bail out if we don't have a valid softc.
Seems to prevent occasional crashes when a open ucom is removed.
 1.93  23-Dec-2011  jakllsch Revert previous due to active usbmp branch(es).
 1.92  22-Dec-2011  jakllsch Adjust-away inconsistent and trailing whitespace.
 1.91  19-Dec-2011  jakllsch It's tp->t_dev, not tp->tp_dev. Corrects commit prior to previous.
 1.90  19-Dec-2011  jakllsch const-ify struct ucom_methods pointer within ucom(4).
 1.89  19-Dec-2011  jakllsch Make commented-out code in ucomstop() compilable.
 1.88  19-Nov-2011  tls branches: 1.88.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.87  24-Apr-2011  rmind branches: 1.87.4;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.86  30-Nov-2010  bsh branches: 1.86.2;
don't clear TS_BUSY in ucomclose().
This fixes kernel crash in ucomstart() with "echo Hello > /dev/ttyU0".
 1.85  03-Nov-2010  dyoung Stop using the compatibility macros USB_ATTACH(), USB_DETACH(),
USB_MATCH(), et cetera. These files produce the same assembly
(according to objdump -d) before and after the change
 1.84  01-Oct-2010  christos remove debugging statements that have no chance of working (they crash)
since they are called from a context where we cannot log.
 1.83  20-Feb-2010  pooka branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.
 1.82  06-Jan-2010  martin branches: 1.82.2;
Optimize for higher speeds, e.g. when used as part of a 3G modem.
Contributed anonymously.
 1.81  06-Dec-2009  dyoung Simplify device-activation hooks.
 1.80  30-Jul-2009  skrll typo in comment.
 1.79  20-Jan-2009  drochner Change major()/minor() to return 32-bit types again, called
devmajor_t/devminor_t, as proposed on tech-kern.
This avoids 64-bit arithmetics and 64-bit printf formats in parts
of the kernel where it is not really useful, and helps clarity.
 1.78  11-Jan-2009  cegger make this compile
 1.77  24-May-2008  cube branches: 1.77.6;
Split device_t and softc for all USB device drivers, and related cosmetic
changes.

Matthias Drochner kindly reviewed this patch, and tested ums, ubt, uaudio
and ral. I tested umass myself.
 1.76  28-Apr-2008  martin branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses
 1.75  05-Apr-2008  cegger branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname
 1.74  30-Dec-2007  smb branches: 1.74.6;
Add pmf register/deregister to ucom and ugensa. (Addtionally, let a
Sierra wireless card be recognized as a ugensa.)
 1.73  19-Nov-2007  ad branches: 1.73.6;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.72  12-Nov-2007  ad Call ttwakeup() with tty_lock held.
 1.71  10-Nov-2007  ad Call ttyflush() with tty_lock held.
 1.70  04-Mar-2007  christos branches: 1.70.14; 1.70.16; 1.70.20; 1.70.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.69  16-Nov-2006  christos branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.
 1.68  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.67  01-Oct-2006  elad More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.66  01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.65  21-Jul-2006  ad branches: 1.65.4; 1.65.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.64  12-Jul-2006  gson Assert RTS on open. Fixes PR kern/33929.
 1.63  14-May-2006  elad branches: 1.63.4;
integrate kauth.
 1.62  28-Mar-2006  thorpej Use device_unit().
 1.61  20-Feb-2006  thorpej branches: 1.61.2; 1.61.4; 1.61.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
 1.60  11-Dec-2005  christos branches: 1.60.2; 1.60.4; 1.60.6;
merge ktrace-lwp.
 1.59  23-Sep-2005  itohy Remove duplicated "portno %d" from the attach message.
 1.58  06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.57  26-Aug-2005  drochner s/locdesc_t/int/g
 1.56  21-Jun-2005  ws branches: 1.56.2;
PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
 1.55  30-May-2005  christos - const poisoning
- eliminate variable shadowing
 1.54  18-May-2005  augustss Handle DCD differently so it's not always asserted. From kern/30268 from
Wolfgang Stukenbrock.
 1.53  13-Sep-2004  drochner a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
on "locators.h"
 1.52  24-Nov-2003  nathanw Make the DPRINTF text for bulk in/out opening errors match which one
is in and which one is out.
 1.51  29-Jun-2003  fvdl branches: 1.51.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.50  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.49  01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.48  25-Nov-2002  thorpej Avoid strict-alias warnings.
 1.47  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.46  27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.45  23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.44  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.43  11-Jul-2002  augustss Get rid of trailing white space.
 1.42  17-Mar-2002  atatat branches: 1.42.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.41  31-Dec-2001  augustss Make a typedef for struct proc to make portingeasier.
 1.40  13-Nov-2001  lukem add RCSIDs
 1.39  16-Aug-2001  augustss branches: 1.39.2;
Clear busy flag on write error. From PR 13731, IWAMOTO Toshihiro.
 1.38  02-May-2001  scw branches: 1.38.2;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.37  02-Apr-2001  augustss Print portno when attaching.
 1.36  23-Jan-2001  augustss branches: 1.36.2;
Fiddle enough with the tty so that it wakes up on detach and drops
the reference count on the ucom.
 1.35  23-Jan-2001  augustss Ad support for an extra message in the ucom attach code.
 1.34  23-Jan-2001  augustss Null out pointers when closing pipes.
Try to wake upper layer on error.
 1.33  23-Jan-2001  augustss Rearrange detach code so it is more likely to survive detaching an open
device (it's still not waking up readers properly).
 1.32  02-Nov-2000  eeh Adapt to the new line discipline scheme.
 1.31  22-Oct-2000  explorer make ucom into a random source, type TTY
 1.30  23-Sep-2000  augustss Remove some // type comments.
 1.29  15-Sep-2000  toshii Change the second argument of tiocm_to_ucom to u_long,
since the second argument of ioctl is a u_long value.
 1.28  13-Sep-2000  toshii Cleanup the error handling code introduced in rev. 1.26. Commented by jhawk.
No functional change.
 1.27  10-Sep-2000  toshii Make the control line handling a little better. Avoid a DTR/RTS issue
from uninitialized sc_mcr by not calling ucom_{dtr,rts} if possible.

XXX Flow control is still incomplete and needs more work.
 1.26  08-Sep-2000  toshii In ucomopen(), make sure to call splx() before returning
when initialization fails.
 1.25  03-Sep-2000  augustss Handle output packet headers in a cleaner way. From IWAMOTO Toshihiro
<iwamoto@sat.t.u-tokyo.ac.jp>, fixes kern/10573.
 1.24  01-Jun-2000  augustss branches: 1.24.2;
Bring the coding style into the 80s, i.e., get rid of __P and use
ANSI prototypes and declarations.
 1.23  27-Apr-2000  augustss branches: 1.23.2;
Change my email address.
 1.22  14-Apr-2000  augustss Add a capability for pre/post processing on write/read.
 1.21  08-Apr-2000  itojun fix build of ucom. (static/non-static)
 1.20  07-Apr-2000  augustss Remove a couple of Static that shouldn't be there.
 1.19  06-Apr-2000  augustss Let the parent device of a ucom decide what size the read and write
buffers should be since it knows about the speed.
Increase the buffer size of uvisor.
XXX The uvisor is still pitifully slow. There must be a problem somewhere.
 1.18  05-Apr-2000  augustss Make it compile without USB_DEBUG. From Chris Jones.
 1.17  05-Apr-2000  augustss Use reference counting on the softc so detach doesn't blow it away prematurely.
 1.16  27-Mar-2000  augustss Change (almost) all static to Static. The symbol `Static' can then be defined
to `' or `static' depending on if you want to debug or not.
 1.15  08-Feb-2000  augustss Use NULL instead of 0.
 1.14  08-Feb-2000  augustss Add methods for ucom to call back on open/close.
 1.13  25-Jan-2000  augustss Make it compile even if you leave out the ucom attachment.
 1.12  25-Jan-2000  augustss Split the umodem driver into two parts: the part that emulates a tty over
two bulk pipes, and the setup and status fiddling goo.
This allows the former part to be shared by other drivers that need to
look like a tty.
 1.11  12-Nov-1999  augustss A number of stylistic changes to increase readability (many suggested
by Nick Hibma):
use NULL not 0
declare all local definitions static
rename s/usbd_request/usbd_xfer/ s/reqh/xfer/
rename s/r/err/
use implicit test for no err
KNF
 1.10  09-Sep-1999  augustss branches: 1.10.2; 1.10.4; 1.10.8;
Change the internal API to allow DMA buffers to be pre-allocated by
the device driver instead of happening automagically in the HC driver.
This affects both the HC-USBD interface as well as the USBD-device
interface.
This change will allow DMA buffers to be reused e.g. in isochronous
traffic.

Add isochronous support to the UHCI driver (not for OHCI yet).
 1.9  14-Aug-1999  augustss Some changes from FreeBSD (no functional differences).
 1.8  30-Jun-1999  augustss Totally redo the way device detach is done. It now uses a kernel event
thread and the config detach method.
Squish a number of space leaks on detach.
 1.7  10-Jan-1999  augustss branches: 1.7.4;
Some minor updates from FreeBSD.
 1.6  08-Jan-1999  augustss Various little fixes from the FreeBSD version.
 1.5  07-Jan-1999  augustss Fix some FreeBSD compiler warnings.
 1.4  30-Dec-1998  augustss Remove #include that slipped in at FreeBSD merge.
 1.3  26-Dec-1998  augustss Merge changes to make the USB stack work with FreeBSD. The original
diffs from Nick Hibma <n_hibma@freebsd.org>, but with substantial
changes from me.
XXX Not tested on FreeBSD yet.
 1.2  09-Dec-1998  augustss Improvement to the ugen driver.
Better error checking.
Some code rearrengment.
 1.1  02-Dec-1998  augustss Add stub for a modem driver.
 1.7.4.1  01-Jul-1999  thorpej Sync w/ -current.
 1.10.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.4.1  15-Nov-1999  fvdl Sync with -current
 1.10.2.4  21-Apr-2001  bouyer Sync with HEAD
 1.10.2.3  11-Feb-2001  bouyer Sync with HEAD.
 1.10.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.10.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.24.2.4  21-Sep-2000  tron Pull up from current (approved by thorpej):

Change the second argument of tiocm_to_ucom to u_long,
since the second argument of ioctl is a u_long value.

syssrc/sys/dev/usb/ucom.c 1.29
 1.24.2.3  12-Sep-2000  toshii Pullup revision 1.27 (approved by thorpej):
Make the control line handling a little better. Avoid a DTR/RTS issue
from uninitialized sc_mcr by not calling ucom_{dtr,rts} if possible.
 1.24.2.2  09-Sep-2000  toshii Pullup revision 1.26 (approved by jhawk):
In ucomopen(), make sure to call splx() before returning
when initialization fails.
 1.24.2.1  04-Sep-2000  augustss Pull up (approved by thorpej).

Handle output packet headers in a cleaner way. From IWAMOTO Toshihiro
<iwamoto@sat.t.u-tokyo.ac.jp>, fixes kern/10573.
 1.36.2.12  03-Jan-2003  thorpej Sync with HEAD.
 1.36.2.11  11-Dec-2002  thorpej Sync with HEAD.
 1.36.2.10  11-Nov-2002  nathanw Catch up to -current
 1.36.2.9  18-Oct-2002  nathanw Catch up to -current.
 1.36.2.8  17-Sep-2002  nathanw Catch up to -current.
 1.36.2.7  01-Aug-2002  nathanw Catch up to -current.
 1.36.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.36.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.36.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.36.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.36.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.36.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.38.2.5  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.38.2.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.38.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.38.2.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.39.2.3  13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.39.2.2  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.39.2.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.42.4.2  15-Jul-2002  gehenna catch up with -current.
 1.42.4.1  16-May-2002  gehenna Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
 1.51.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.51.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.51.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.51.2.2  03-Aug-2004  skrll Sync with HEAD
 1.51.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.56.2.6  21-Jan-2008  yamt sync with head
 1.56.2.5  07-Dec-2007  yamt sync with head
 1.56.2.4  15-Nov-2007  yamt sync with head.
 1.56.2.3  03-Sep-2007  yamt sync with head.
 1.56.2.2  30-Dec-2006  yamt sync with head.
 1.56.2.1  21-Jun-2006  yamt sync with head.
 1.60.6.2  01-Jun-2006  kardel Sync with head.
 1.60.6.1  22-Apr-2006  simonb Sync with head.
 1.60.4.1  09-Sep-2006  rpaulo sync with head
 1.60.2.1  01-Mar-2006  yamt sync with head.
 1.61.6.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.61.6.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.61.4.4  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.61.4.3  19-Apr-2006  elad sync with head.
 1.61.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.61.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.61.2.3  11-Aug-2006  yamt sync with head
 1.61.2.2  24-May-2006  yamt sync with head.
 1.61.2.1  01-Apr-2006  yamt sync with head.
 1.63.4.1  13-Jul-2006  gdamore Merge from HEAD.
 1.65.6.2  10-Dec-2006  yamt sync with head.
 1.65.6.1  22-Oct-2006  yamt sync with head
 1.65.4.1  18-Nov-2006  ad Sync with head.
 1.69.10.3  17-Jun-2007  itohy - Pullup 1.70 in a different way.
- Use p for parameter name of type usb_proc_ptr.
 1.69.10.2  16-Jun-2007  itohy - Change order to fit current API: usbd_open_pipe() -> usbd_alloc_xfer;
usbd_abort_pipe() -> usbd_free_xfer() -> usbd_close_pipe().
 1.69.10.1  22-May-2007  itohy 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
 1.69.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.70.22.3  18-Feb-2008  mjf Sync with HEAD.
 1.70.22.2  08-Dec-2007  mjf Sync with HEAD.
 1.70.22.1  19-Nov-2007  mjf Sync with HEAD.
 1.70.20.2  21-Nov-2007  bouyer Sync with HEAD
 1.70.20.1  13-Nov-2007  bouyer Sync with HEAD
 1.70.16.1  09-Jan-2008  matt sync with HEAD
 1.70.14.3  21-Nov-2007  joerg Sync with HEAD.
 1.70.14.2  14-Nov-2007  joerg Sync with HEAD.
 1.70.14.1  11-Nov-2007  joerg Sync with HEAD.
 1.73.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.74.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.74.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.75.4.5  09-Oct-2010  yamt sync with head
 1.75.4.4  11-Mar-2010  yamt sync with head
 1.75.4.3  19-Aug-2009  yamt sync with head.
 1.75.4.2  04-May-2009  yamt sync with head.
 1.75.4.1  16-May-2008  yamt sync with head.
 1.75.2.2  04-Jun-2008  yamt sync with head
 1.75.2.1  18-May-2008  yamt sync with head.
 1.76.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.77.6.2  03-Mar-2009  skrll Sync with HEAD.
 1.77.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.82.2.3  06-Nov-2010  uebayasi Sync with HEAD.
 1.82.2.2  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.82.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.83.2.2  31-May-2011  rmind sync with head
 1.83.2.1  05-Mar-2011  rmind sync with head
 1.86.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.87.4.4  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.87.4.3  23-Jan-2013  yamt sync with head
 1.87.4.2  30-Oct-2012  yamt sync with head
 1.87.4.1  17-Apr-2012  yamt sync with head
 1.88.2.3  26-Feb-2012  mrg rename old usb_detach_wakeup/wait to usb_detach_{wake,wakeup}old().
 1.88.2.2  24-Feb-2012  mrg sync to -current.
 1.88.2.1  18-Feb-2012  mrg merge to -current.
 1.99.2.4  03-Dec-2017  jdolecek update from HEAD
 1.99.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.99.2.2  25-Feb-2013  tls resync with head
 1.99.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.102.2.1  18-May-2014  rmind sync with head
 1.103.2.2  10-Aug-2014  tls Rebase.
 1.103.2.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.107.2.3  19-Feb-2018  snj Pull up following revision(s) (requested by skrll in ticket #1556):
sys/dev/usb/if_athn_usb.c: 1.25
sys/dev/usb/if_atu.c: 1.56
sys/dev/usb/if_aue.c: 1.142
sys/dev/usb/if_axe.c: 1.84
sys/dev/usb/if_axen.c: 1.12
sys/dev/usb/if_cdce.c: 1.45
sys/dev/usb/if_cue.c: 1.77
sys/dev/usb/if_kue.c: 1.91
sys/dev/usb/if_otus.c: 1.32
sys/dev/usb/if_rum.c: 1.59
sys/dev/usb/if_run.c: 1.25
sys/dev/usb/if_smsc.c: 1.33
sys/dev/usb/if_udav.c: 1.52
sys/dev/usb/if_upgt.c: 1.18
sys/dev/usb/if_upl.c: 1.61
sys/dev/usb/if_ural.c: 1.53
sys/dev/usb/if_url.c: 1.57
sys/dev/usb/if_urndis.c: 1.17
sys/dev/usb/if_urtw.c: 1.14
sys/dev/usb/if_urtwn.c: 1.56
sys/dev/usb/if_zyd.c: 1.45
sys/dev/usb/irmce.c: 1.4
sys/dev/usb/pseye.c: 1.24
sys/dev/usb/ubt.c: 1.60
sys/dev/usb/ucom.c: 1.120
sys/dev/usb/udsir.c: 1.6
sys/dev/usb/ugen.c: 1.137
sys/dev/usb/uhso.c: 1.27
sys/dev/usb/uirda.c: 1.43
sys/dev/usb/ulpt.c: 1.99
sys/dev/usb/umass.c: 1.163
sys/dev/usb/umidi.c: 1.74
sys/dev/usb/uscanner.c: 1.82
sys/dev/usb/usscanner.c: 1.43
sys/dev/usb/ustir.c: 1.39
sys/dev/usb/utoppy.c: 1.30
sys/dev/usb/uvideo.c: 1.46
PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs
 1.107.2.2  05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.107.2.1  16-Nov-2015  msaitoh branches: 1.107.2.1.2;
Pull up following revision(s) (requested by joerg in ticket #1031):
sys/dev/usb/ucom.c: revision 1.110
Add the port number to the device properties to make it easier to relate
a specific ucom instance with the physical port of multi-port devices
like the FTDI 4232.
 1.107.2.1.2.3  26-Jan-2017  skrll Sync with HEAD/nhusb
 1.107.2.1.2.2  29-Nov-2016  skrll Sync with HEAD
 1.107.2.1.2.1  06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.108.2.36  27-Dec-2016  skrll Another merge botch
 1.108.2.35  27-Dec-2016  skrll Update copyright notice
 1.108.2.34  27-Dec-2016  skrll Fix merge botch
 1.108.2.33  27-Dec-2016  skrll Open pipes with USBD_MPSAFE - we don't need the KERNEL_LOCK to be held.
 1.108.2.32  05-Dec-2016  skrll Sync with HEAD
 1.108.2.31  06-Nov-2016  skrll Reduce the scope of the softc lock further and track device state via
sc_state.

All ucom methods apart from ucom_{read,write} are called without the
softc lock held.

ucom_close is called on last close only to match ucom_open being called
on first open only.

Fix ucom_detach where refcnt wasn't being decremented.

More DEBUG.

XXX still not sure where tty_lock needs to be held.
 1.108.2.30  06-Nov-2016  skrll Add #include "opt_usb.h"
 1.108.2.29  02-Nov-2016  skrll Whitespace
 1.108.2.28  02-Nov-2016  skrll Reduce the scope of a variable and style. No functional change.
 1.108.2.27  02-Nov-2016  skrll Make ucomsubmitread return int instead of usbd_status.
 1.108.2.26  01-Nov-2016  skrll Style... No functional change.
 1.108.2.25  27-Oct-2016  skrll Style and sprinkle const.
 1.108.2.24  27-Oct-2016  skrll Retire usb_detach_{wait,broadcast} and simply use condvar(9) instead
 1.108.2.23  25-Oct-2016  skrll Misc whitespace changes. No functional change.
 1.108.2.22  25-Oct-2016  skrll Conver sc_dying to a bool. No functional change.
 1.108.2.21  25-Oct-2016  skrll Formatting. No functional change.
 1.108.2.20  25-Oct-2016  skrll Style
 1.108.2.19  12-Oct-2016  skrll Don't need '\n' in DPRINTF format
 1.108.2.18  05-Oct-2016  skrll Sync with HEAD
 1.108.2.17  29-Jun-2016  skrll Comment out incorrect KASSERTs
 1.108.2.16  28-Jun-2016  skrll Make sure ub_data has the transfer buffer
 1.108.2.15  30-May-2016  skrll WIP ucom support for devices with interrupt endpoints like umct
 1.108.2.14  29-May-2016  skrll Sync with HEAD
 1.108.2.13  16-Apr-2016  skrll Prefix ucom_attach_args struct members with ucaa_ and rename variables
for consistency.

No functional change.
 1.108.2.12  06-Feb-2016  skrll No need to use mutex_obj_alloc here
 1.108.2.11  28-Dec-2015  skrll Strictly follow the sequence abort pipe, destroy xfers, and close pipe as
API now requires. Plug some memory leaks in some drivers while doing
this.

Also, remove up_refcnt as it was broken and helped leak more memory.
 1.108.2.10  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.108.2.9  06-Oct-2015  skrll Move from usbd_{alloc,free}_xfer and usbd_{alloc,free}_buffer to
usbd_{create,destroy}_xfer. The API change will allow future changes
to HCDs to simplify the transfer resource allocation and activation.

Several devices tested including ucom, umass, smsc, uvideo, and uaudio.
 1.108.2.8  19-Sep-2015  skrll Make ucom(4) MP safe
 1.108.2.7  23-Jul-2015  skrll Convert to usbhist
 1.108.2.6  06-Jun-2015  skrll Sync with HEAD
 1.108.2.5  19-Mar-2015  skrll Do the same as OpenBSD and get rid of the *_handle typedefs and use
plain structures insteads
 1.108.2.4  23-Dec-2014  skrll KNF. No brackets around return value.
 1.108.2.3  05-Dec-2014  skrll KNF. Remove ( ) from return statements.
 1.108.2.2  02-Dec-2014  skrll Step #1 of memory allocation re-organisation.

Centralised the buffer allocation routine which now supports DMA
and non-DMA capable host controllers. Remove the
ubm_{alloc,free}m methods from usbd_bus_methods.

The buffer allocation is only allowed in thread context and,
therefore, negates the usefulness of the reserve dma code which
is removed in this change.

USBD_NO_COPY is also no longer required as usbd_transfer and
usbd_transfer_complete now track buffer usage and handle any
copying.
 1.108.2.1  30-Nov-2014  skrll Use C99 types. u_int{8,16,32,64}_t to uint{8,16,32,64}_t.

No functional change.
 1.113.2.5  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.113.2.4  04-Nov-2016  pgoyette Sync with HEAD
 1.113.2.3  26-Jul-2016  pgoyette Rename LOCALCOUNT_INITIALIZER to DEVSW_MODULE_INIT. This better describes
what we're doing, and why.
 1.113.2.2  19-Jul-2016  pgoyette Instead of repeatedly typing the conditional initialization of the
.d_localcount members in the various {b,c}devsw, define an initializer
macro and use it. This also removes the need for defining new symbols
for each 'struct localcount'.

As suggested by riastradh@
 1.113.2.1  18-Jul-2016  pgoyette Rump drivers are always installed via devsw_attach() so we need to
always allocate a 'struct localcount' for these drivers whenever they
are built as modules.
 1.118.8.5  12-Dec-2020  martin Pull up following revision(s) (requested by mrg in ticket #1636):

sys/dev/usb/ucom.c: revision 1.128

properly wait for refcounts to drain.
fixes panic at detach that jmnceill saw.

XXX: pullup-[89].
 1.118.8.4  07-May-2019  martin Backout the following changes (requested by mrg in ticket #1240):

sys/dev/usb/umodem_common.c: revision 1.27
sys/dev/usb/umodemvar.h: revision 1.10
sys/dev/usb/ucom.c: revision 1.122

fix umodem(4) detach.
There are different fixes upcoming.
 1.118.8.3  22-Apr-2019  martin Pull up following revision(s) (requested by mrg in ticket #1240):

sys/dev/usb/umodem_common.c: revision 1.27
sys/dev/usb/umodemvar.h: revision 1.10
sys/dev/usb/ucom.c: revision 1.122

fix umodem(4) detach:

- ucom(4) needs kpreempt disabled around softint_schedule()
- switch a copied printf() to aprint_error_dev()
- use static normally in umodem_common.c
- remove unused sc_openings in softc, convert sc_dying to real bool
- add sc_refcnt, sc_lock and sc_detach_cv to softc. usage is:
- sc_dying is protected by sc_lock
- sc_detach_cv is matched with sc_lock for cv operations
- sc_refcnt is increased in open and decreased in close, any time
it is decreased, it is checked for less than zero, and a broadcast
performed on sc_detach_cv. detach waits for sc_refcnt.
- umodem_param() and umodem_set() check for sc_dying

this fixes pullout out an open ucom@umodem.

@skrll.

XXX: pullup
 1.118.8.2  31-Jan-2018  martin Pull up following revision(s) (requested by skrll in ticket #509):
sys/dev/usb/if_ural.c: revision 1.53
sys/dev/usb/if_run.c: revision 1.25
sys/dev/usb/ustir.c: revision 1.39
sys/dev/usb/irmce.c: revision 1.4
sys/dev/usb/if_urtwn.c: revision 1.56
sys/dev/usb/pseye.c: revision 1.24
sys/dev/usb/if_rum.c: revision 1.59
sys/dev/usb/if_upl.c: revision 1.61
sys/dev/usb/ucom.c: revision 1.120
sys/dev/usb/if_zyd.c: revision 1.45
sys/dev/usb/if_axen.c: revision 1.12
sys/dev/usb/umidi.c: revision 1.74
sys/dev/usb/if_udav.c: revision 1.52
sys/dev/usb/if_athn_usb.c: revision 1.25
sys/dev/usb/usscanner.c: revision 1.43
sys/dev/usb/ualea.c: revision 1.6 - 1.9
sys/dev/usb/if_upgt.c: revision 1.18
sys/dev/usb/if_atu.c: revision 1.56
sys/dev/usb/utoppy.c: revision 1.30
sys/dev/usb/ubt.c: revision 1.60
sys/dev/usb/if_urtw.c: revision 1.14
sys/dev/usb/uirda.c: revision 1.43
sys/dev/usb/umass.c: revision 1.163
sys/dev/usb/if_cdce.c: revision 1.45
sys/dev/usb/if_cue.c: revision 1.77
sys/dev/usb/if_kue.c: revision 1.91
sys/dev/usb/uvideo.c: revision 1.46
sys/dev/usb/uhso.c: revision 1.27
sys/dev/usb/if_smsc.c: revision 1.33
sys/dev/usb/ugen.c: revision 1.137
sys/dev/usb/if_axe.c: revision 1.84
sys/dev/usb/if_aue.c: revision 1.142
sys/dev/usb/uscanner.c: revision 1.82
sys/dev/usb/if_urndis.c: revision 1.17
sys/dev/usb/udsir.c: revision 1.6
sys/dev/usb/if_url.c: revision 1.57
sys/dev/usb/if_otus.c: revision 1.32
sys/dev/usb/ulpt.c: revision 1.99

PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup. We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs

ualea: Tidy up a bit. Fulfil requests completely.
Don't subtract uninitialized pktsize in error path.
 1.118.8.1  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3)
format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
but it is possible that I've missed some of them. I would be glad
to
update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.118.6.2  29-Apr-2017  pgoyette Remove more unnecessary #include for sys/localcount.h
 1.118.6.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.120.4.1  10-Jun-2019  christos Sync with HEAD
 1.120.2.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.125.2.2  03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1493):

sys/dev/usb/ucom.c: revision 1.129

ucom(4): Fix earlier mistake causing pipes not to be closed.

In revision 1.123, mrg@ changed what he thought was a double-close,
but was actually abort&close (as is appropriate) to just abort (which
is not enough -- leaks the pipe). This restores the abort&close.

The original `bug' was found by code inspection, whereas this bug was
found by asserting in usb_subr.c that no pipes are open on device
disconnection after detach; the asserts actually triggered with
several ucom(4) devices, and no longer trigger with this change.

XXX pullup-9
 1.125.2.1  12-Dec-2020  martin Pull up following revision(s) (requested by mrg in ticket #1147):

sys/dev/usb/ucom.c: revision 1.128

properly wait for refcounts to drain.
fixes panic at detach that jmnceill saw.

XXX: pullup-[89].
 1.128.6.1  01-Aug-2021  thorpej Sync with HEAD.
 1.134.2.3  20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #877):

sys/dev/usb/ucom.c: revision 1.138

ucom(4): Simplify logic fixing PR kern/57259.
cv_timedwait only ever returns 0 or EWOULDBLOCK, so this would always
return ERESTART anyway.

No functional change intended.
 1.134.2.2  07-Mar-2023  martin Pull up following revision(s) (requested by thorpej in ticket #113):

sys/dev/usb/ucom.c: revision 1.137

In the HUP-wait path in ucomopen():
- Use cv_timedwait() rather than cv_timedwait_sig(); the wait here is
bounded (and fairly short besides) and seems appropriate to treat like
other uninterruptible waits. The behavior is now consistent with com(4)
in this regard.
- Map EWOULDBLOCK return from cv_timedwait() to 0, as the successful passage
of time is not an error in this case.
- If the HUP-wait time has passed, clear the HUP-wait timestamp.

PR kern/57259 (although insufficient -- another change to vfs_syscalls.c
is required)
 1.134.2.1  22-Feb-2023  martin Pull up following revision(s) (requested by riastradh in ticket #92):

sys/dev/usb/ucom.c: revision 1.136
sys/dev/usb/ucom.c: revision 1.135

ucom(4): Nix broken error branch.

This error branch was introduced to make the system act, when a USB
serial adapter is yanked, as if the other end had spat out a line
feed in an attempt to wake any sleeping readers so they will stop
using the USB serial port.

This is no longer necessary, because ttycancel will wake them anyway,
and it is actually harmful because it puts stuff in the output queue
(CR LF) that will never be processed, causing subsequent users to
hang trying to open the device.

Problem found and patch tested by tih@.

ucom(4): Missed a spot in previous -- nix now-unused local.
 1.139.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed