History log of /netbsd-current/sys/dev/usb/ucom.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.139 12-Apr-2024 jakllsch

include opt_ntp.h for PPS_SYNC


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 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@.


Revision tags: netbsd-10-base
# 1.134 26-Oct-2022 riastradh

branches: 1.134.2;
ucom(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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@.


Revision tags: netbsd-10-base
# 1.134 26-Oct-2022 riastradh

branches: 1.134.2;
ucom(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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@.


Revision tags: netbsd-10-base
# 1.134 26-Oct-2022 riastradh

ucom(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.134 26-Oct-2022 riastradh

ucom(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base
# 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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base
# 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].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.128 26-Oct-2020 mrg

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

XXX: pullup-[89].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.128 26-Oct-2020 mrg

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

XXX: pullup-[89].


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base phil-wifi-20200406
# 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


Revision tags: netbsd-9-1-RELEASE is-mlppp-base ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.125 09-May-2019 mrg

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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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


Revision tags: ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609
# 1.125 09-May-2019 mrg

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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.125 09-May-2019 mrg

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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.120 21-Jan-2018 skrll

branches: 1.120.2;
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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.120 21-Jan-2018 skrll

branches: 1.120.2;
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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.120 21-Jan-2018 skrll

branches: 1.120.2;
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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.


Revision tags: isaki-audio2-base
# 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


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.121 11-Dec-2018 jakllsch

restore error reporting in ucomparam() lost in 1.115


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.120 21-Jan-2018 skrll

branches: 1.120.2;
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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.120 21-Jan-2018 skrll

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


Revision tags: tls-maxphys-base-20171202
# 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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.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.


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107
# 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


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.118 14-Dec-2016 skrll

Don't hold softc lock when calling ucom_read

PR/51714: uftdi (on xhci): mutex_vector_enter: locking against myself


Revision tags: nick-nhusb-base-20161204
# 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.


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004
# 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


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 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


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 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.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606
# 1.109 13-Apr-2015 riastradh

Convert sys/dev to use <sys/rndsource.h>.


Revision tags: nick-nhusb-base-20150406 nick-nhusb-base
# 1.108 15-Nov-2014 christos

branches: 1.108.2;
centralize the dialout/call unit macros.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-maxphys-base
# 1.107 10-Aug-2014 tls

branches: 1.107.2;
Merge tls-earlyentropy branch into HEAD.


Revision tags: tls-earlyentropy-base
# 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.


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.104 04-May-2014 christos

remove hack for PR/42848


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 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.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8
# 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.


Revision tags: yamt-pagecache-base7 yamt-pagecache-base6
# 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.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 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


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.98 24-Feb-2012 mrg

remove any remnants of freebsd/openbsd code.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 mrg-ohci-jmcneill-usbmp-base jmcneill-usbmp-base
# 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.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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".


Revision tags: uebayasi-xip-base4
# 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


Revision tags: uebayasi-xip-base3 yamt-nfs-mp-base11
# 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.


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.83 20-Feb-2010 pooka

branches: 1.83.2;
printf -> aprint_normal to avoid empty linefeeds and partial messages
for AB_QUIET.


Revision tags: uebayasi-xip-base
# 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.


Revision tags: matt-premerge-20091211
# 1.81 06-Dec-2009 dyoung

Simplify device-activation hooks.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.80 30-Jul-2009 skrll

typo in comment.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: mjf-devfs2-base
# 1.78 11-Jan-2009 cegger

make this compile


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.76 28-Apr-2008 martin

branches: 1.76.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base
# 1.75 05-Apr-2008 cegger

branches: 1.75.2; 1.75.4;
use aprint_*_dev and device_xname


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 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.)


Revision tags: vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 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.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base vmlocking-base
# 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.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 itohy-usb1-base wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.69 16-Nov-2006 christos

branches: 1.69.4; 1.69.10;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 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.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.63 14-May-2006 elad

branches: 1.63.4;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 elad-kernelauth-base
# 1.62 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge kent-audio1-base
# 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"


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.49 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.48 25-Nov-2002 thorpej

Avoid strict-alias warnings.


Revision tags: kqueue-aftermerge
# 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


Revision tags: kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.43 11-Jul-2002 augustss

Get rid of trailing white space.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.41 31-Dec-2001 augustss

Make a typedef for struct proc to make portingeasier.


# 1.40 13-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base
# 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.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 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


Revision tags: comdex-fall-1999-base
# 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).


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base
# 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.