History log of /netbsd-current/sys/dev/ic/z8530tty.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.135 26-Oct-2022 riastradh

zs(4): Convert to ttylock/ttyunlock.


Revision tags: bouyer-sunxi-drm-base thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base 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 bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.134 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base
# 1.133 21-Jul-2019 rin

Fix panic due to inconsistent lock states of tty_lock in zsparam().
Tested on mac68k.


Revision tags: phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 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 tls-maxphys-base-20171202
# 1.132 31-Oct-2017 martin

branches: 1.132.4;
As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY

Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.


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 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.131 15-Nov-2014 christos

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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base 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-earlyentropy-base tls-maxphys-base
# 1.130 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 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.129 16-Mar-2014 dholland

branches: 1.129.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: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 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 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.128 24-Apr-2011 rmind

branches: 1.128.4; 1.128.14; 1.128.18;
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 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.127 22-May-2009 mrg

branches: 1.127.4; 1.127.6;
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base
# 1.126 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.125 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.124 20-Mar-2009 tsutsui

Try to avoid zstty hangs on higher speed:

z8530sc.c:
Check pending interrupts in a loop until all requests are handled.
The old comments said it would cause horrible latency to sun3x floppy etc,
but serial ports should have higher priority than disks anyway.

z8530tty.c:
Don't enable and disable TX interrupts on each transmit start and completion
because it could cause possible race conditions.
Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE 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 nick-hppapmap-base2 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 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.123 21-Apr-2008 ad

branches: 1.123.2; 1.123.10; 1.123.12; 1.123.16;
Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.122 29-Mar-2008 tsutsui

branches: 1.122.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.121 14-Mar-2008 martin

Remove a tty_lock for now - I know that this is wrong, but the whole
tty subsystem locking is not consistent and Andrew didn't have
time to come up (or guide to) the right fix.
This prevents machines with serial console on zs(4) from deadlocking on
first input.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.120 20-Jan-2008 joerg

branches: 1.120.2; 1.120.6;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.


Revision tags: vmlocking2-base3 bouyer-xeni386-base matt-armv6-base
# 1.119 22-Dec-2007 ad

t_linesw->l_modem would ideally be called with tty_lock held, but before
that can happen someone needs to beat all the drivers into shape.


# 1.118 22-Dec-2007 ad

Don't recursively acquire tty_lock when zstty_softint() is called directly.


Revision tags: 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.117 19-Nov-2007 ad

branches: 1.117.2; 1.117.6;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.


# 1.116 10-Nov-2007 ad

zsstart, zstty_txsoft: don't acquire tty_lock, it's already held.


# 1.115 07-Nov-2007 ad

Merge tty changes from the vmlocking branch.


Revision tags: nick-csl-alignment-base5 jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base vmlocking-base
# 1.114 09-Jul-2007 ad

branches: 1.114.6; 1.114.8; 1.114.12; 1.114.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.113 04-Mar-2007 christos

branches: 1.113.2; 1.113.4;
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 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.112 01-Oct-2006 elad

branches: 1.112.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.


# 1.111 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.110 22-Jul-2006 martin

branches: 1.110.4; 1.110.6;
Remove unused variable to make it compile again.


# 1.109 21-Jul-2006 ad

- Use the LWP cached credentials where sane.
- Minor cosmetic changes.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.108 07-Jun-2006 kardel

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.107 14-May-2006 elad

branches: 1.107.2;
integrate kauth.


Revision tags: elad-kernelauth-base
# 1.106 19-Apr-2006 tsutsui

- use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
in zstty_attach()
- check a return value of the malloc(9)

Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.105 29-Mar-2006 thorpej

Use device_cfdata().


# 1.104 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.103 05-Mar-2006 rjs

branches: 1.103.2; 1.103.4;
Remove SET/CLR/ISSET macros.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.102 27-Dec-2005 chs

branches: 1.102.4; 1.102.6; 1.102.8;
switch macppc to use the MI zstty driver.
add macppc's ZS_TXDMA hooks there.


# 1.101 11-Dec-2005 christos

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.100 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.99 30-Jun-2005 macallan

branches: 1.99.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.


# 1.98 31-May-2005 christos

- add const
- avoid variable shadow


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 kent-audio2-base
# 1.97 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.96 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.95 20-Jun-2004 thorpej

branches: 1.95.4; 1.95.6;
Define and use zsccf_channel as an alias for cf_loc[ZSCCF_CHANNEL].


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.94 23-Jan-2004 simonb

Fix NTP PPSAPI support (enabled with "options PPS_SYNC"):

From PR kern/13702 from Charles Carvalho. Tested on alpha and
i386 with a Laipac TF10 PPS-capable GPS. The com.c change was
copied wholesale from Charles' z8530tty.c patch.


# 1.93 04-Dec-2003 keihan

netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.


# 1.92 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.91 29-Jun-2003 fvdl

branches: 1.91.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.90 29-Jun-2003 darrenr

More changes for providing lwpid for ktrace (sparc GENERIC built)


# 1.89 28-Jan-2003 pk

Provide locking required by the interrupt handlers running at IPL_SERIAL.


# 1.88 24-Jan-2003 pk

zs_shutdown: lower IPL before sleeping. Also note the fact that the
effectiveness of that very tsleep() call is dubious at best.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.87 06-Jan-2003 wiz

interrupt with two rs.


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.86 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge
# 1.85 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.84 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.83 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.82 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.81 24-Sep-2002 ad

Deal with the strange SCC wiring on TC IOASIC machines. Thanks to Bill
Studenmund and Jonathan Stone for useful comments.


# 1.80 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: 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 gehenna-devsw-base eeh-devprop-base
# 1.79 17-Mar-2002 atatat

branches: 1.79.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.78 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 30-May-2001 lukem

branches: 1.77.2; 1.77.4;
add missing #include "opt_kgdb.h"


# 1.76 11-May-2001 thorpej

Add a flag to suppress SCC reset at attach time.

From Rafal K. Boni.


# 1.75 02-May-2001 scw

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.74 12-Mar-2001 tsutsui

Add some delay in zstty_attach() to wait previous console output
to complete before hardware initialization.


# 1.73 11-Mar-2001 wdk

Add missing \n during probe if port is dedicated to kgdb


# 1.72 08-Nov-2000 eeh

branches: 1.72.2;
Use the MI console magic sequence framework.


# 1.71 05-Nov-2000 chs

remove what looks to be a bit of leftover debug code.


# 1.70 01-Nov-2000 eeh

Adapt to the new line discipline scheme.


# 1.69 17-Sep-2000 toshii

Change tiocm_to_{com,zs}'s second argument to u_long to match with
the type in their caller.


# 1.68 06-Jul-2000 thorpej

Use device_lookup().


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.67 14-Apr-2000 pk

branches: 1.67.4;
Remove spurious splx() call.


# 1.66 24-Mar-2000 hannken

Fix typos from last commit (callout).


# 1.65 23-Mar-2000 thorpej

New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.


# 1.64 19-Mar-2000 pk

Check for console input and output separately.
XXX - split input/output for /dev/console is not yet supported.


# 1.63 14-Mar-2000 jdc

Add power management hooks.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.62 04-Nov-1999 jonathan

Update user-level PPS-API to match -05 draft.
Change PPS_<xxx> ioctls to PPS_IOC_<xxx>.


Revision tags: comdex-fall-1999-base
# 1.61 15-Oct-1999 jonathan

branches: 1.61.2; 1.61.4;
Fix nanosecond/microsecond botch in PPSAPI:
remove bogus TIMESPEC_TO_TIMEVAL() after applying any {assert,clear} offset.


Revision tags: chs-ubc2-base
# 1.60 22-Apr-1999 pk

branches: 1.60.2;
Don't send any data upstream if we're not open yet.


Revision tags: netbsd-1-4-base
# 1.59 27-Mar-1999 wrstuden

branches: 1.59.2;
PPS support. Copied off of com.c support, with changes as DCD interupts
are only enabled if needed and if ok'd by MD layer.


# 1.58 03-Feb-1999 mycroft

Minor changes to tiocm code.


# 1.57 03-Feb-1999 mycroft

Redo the N previous changes, plus a couple of other things:
* Move the printf() delay to just after the printf(), where it actually makes
sense.
* Use zstty_stint() and zstty_softint() from zsparam(), to force an immediate
update of the carrier and flow control status. Abuse this in the attach and
open functions to defer all of that work. This insures that we don't lose
any status updates.
* Don't screw with register 1 when closing the console.
* Fix bugs in TIOCM??? (stay semicolon, clearing DTR while transmitting).
* Add comments in a couple of places.


# 1.56 31-Jan-1999 wrstuden

Add the patch I floated on tech-kern. Andreas Eltrich <elchy@dahoam.de>
says it got pppd working for him.


# 1.55 25-Jan-1999 wrstuden

Fix thinko in part of rev 1.53.

Thanks to Scott for pointing this out to me (I got his mail and figured out
this change before seeing the discussion on tech-kern) and to Charles for
the initial explanation.


# 1.54 13-Jan-1999 christos

Put back modem control ioctl's


Revision tags: kenh-if-detach-base
# 1.53 23-Nov-1998 wrstuden

Changes to deal with mac serial ports having clock sources on DCD or CTS.

- When doing a first open, don't enable receive & status interupts before
the MD layer has had a chance to set things up.
- Enable logic to only enable DCD/CTS interupts if we are looking for/
expecting interupts on those pins. Disable otherwise.
- in zs_param, only pass up the state of ZSRR0_DCD if we have enabled
interupts on that pin.

Henry Hotz (<hotz@jpl.nasa.gov>) and Greg walsh <gwalsh@artec.com> have
tried these changes to get certain printers from hanging at boot. They
work in a 1.3.2 kernel for Greg.


Revision tags: chs-ubc-base
# 1.52 01-Oct-1998 drochner

minor changes to console handling in zstty_attach():
-wait 20ms between printf() and reconfiguring the hardware
-set cn_tab->cn_dev here because this is the place where the real minor
number is known


# 1.51 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


# 1.50 09-Aug-1998 wrstuden

Oops. We do still need to set t_dev in the first open part of zsopen,
so we get ttyXX vs cuaXX right. Leave the initialization in attach.


# 1.49 09-Aug-1998 wrstuden

Initialize the struct tty's t_dev field at attach rather than first open.
The attach routine calls zsparam if we're setting up the console, and
zsparam needs this field to tell which zstty to set up. Otherwise, we
set up zstty0 even if it's not the console!


Revision tags: eeh-paddr_t-base
# 1.48 30-Mar-1998 mycroft

Eliminate cs_heldchar. It is not necessary in my version of the driver.


# 1.47 22-Mar-1998 mycroft

Move the code to wait for carrier on a tty into a common function, since it
depends only on device-independent state bits.
Implement SunOS-style `dialout' devices.


# 1.46 21-Mar-1998 mycroft

Fix pasto.


# 1.45 21-Mar-1998 mycroft

Replace TS_WOPEN with t_wopen, per mail on tech-kern.


# 1.44 22-Feb-1998 mycroft

Fix bonehead error in previous change.


# 1.43 19-Feb-1998 mycroft

Similar changes to com driver:
Arrange to call com_break() and com_modem() at splserial().
It's simpler this way. Really.


# 1.42 12-Jan-1998 thorpej

Adjust for config changes.


# 1.41 12-Nov-1997 pk

Use a 1-character queue so polled console output can be deferred if
regular I/O has been scheduled.


# 1.40 03-Nov-1997 mycroft

Actually use TIOCFLAG_CDTRCTS.


# 1.39 03-Nov-1997 mycroft

Always leave DCD_IE and CTS_IE on for now. Needs more work in zsparam() to
make the optimization actually work right.


# 1.38 03-Nov-1997 mycroft

Leave the console running with or without DDB.


# 1.37 03-Nov-1997 mycroft

Slight optimization in soft input routine.


# 1.36 03-Nov-1997 mycroft

Set the ring size back to 2k.


# 1.35 03-Nov-1997 mycroft

Bug fixes:
* Carrier detect (TS_CARR_ON) is based on the actual DCD bit, even if it's
being ignored.
* Set TS_WOPEN early on in zsopen().
* Don't disable interrupts on the console during close if we have DDB.

Inert changes:
* Don't handle ZS_HWFLAG_NO_DCD here; the frontend does it.
* Deprecate `register'.
* Use SET(), CLR(), and ISSET().

More performance changes:
* Rototill receive handling; use a backpressure mechanism to prevent livelock.
* Output silo/ibuf overflow warnings at most once per minute, from a callout.
* When we exhaust the current transmit run, turn off transmit interrupts in
zstty_txint(), so we're fairly sure we don't get another one.


# 1.34 03-Nov-1997 gwr

Fix serial console support (did not turn on CLOCAL).


# 1.33 02-Nov-1997 mycroft

Rearrange *param() slightly to eliminate a spl.
Also fix another comment regarding DTR.


# 1.32 02-Nov-1997 mycroft

Add another splserial()/splzs().


# 1.31 02-Nov-1997 mycroft

Minimize some spl regions slightly.


# 1.30 02-Nov-1997 mycroft

If we lose HFC, assert RTS.


# 1.29 02-Nov-1997 mycroft

Set the state of DCD_IE and CTS_IE based on what's in rr0_mask.


# 1.28 01-Nov-1997 mycroft

Correct a comment regarding our behaviour with DTR.


# 1.27 01-Nov-1997 mycroft

Fix minor omission; write back reg 1 earlier in zsopen().


# 1.26 01-Nov-1997 mycroft

Need some additional splzs() in zsopen(), and nuke one that's no longer
needed.


# 1.25 01-Nov-1997 mycroft

Nuke the special case of heldchange for reg 5. We don't use it for flow
control any more, and the speed of changing DTR isn't really an issue. Also,
the old code created a bug where zsparam() might have failed to set some
registers.


# 1.24 01-Nov-1997 mycroft

Yet more changes imported from com driver:
Change the interface to zs_hwiflow(); just have it use zst_rx_blocked.
Make zs_modem() a tiny bit faster.
Do RTS updates immediately; do not allow them to be held.


# 1.23 01-Nov-1997 mycroft

Make zst_tba a u_char *.


# 1.22 01-Nov-1997 mycroft

More changes taken from com driver:
Stop output as fast as possible when DCD is deasserted.
Do *not* automatically drop DTR when DCD is deasserted.
Only check for rr0 bits that we care about (DTR and DCD).


# 1.21 01-Nov-1997 mycroft

GC some unused bits.
Also, part of the previous was copied from the com driver, so DTRT.


# 1.20 01-Nov-1997 mycroft

Rearrange open sequence to make sure we catch all line status changes.
Make sure we turn on DTR and/or RTS as appropriate during open.
Rearrange close sequence so the tty is flushed before turning off interrupts.
Deal with `softcar' and the console device by silently asserting CLOCAL and
|HUPCL, as in com driver.
Do *not* fiddle with DTR when changing the line speed.
Make sure we update the tty's carrier status when CLOCAL or MDMBUF is changed.
Only change rr1 when we actually need to turn on or off TIE.


Revision tags: netbsd-1-3-base
# 1.19 17-Oct-1997 gwr

branches: 1.19.2;
Move the ttychars() call below the if-not-raw block.
(from Bill Studenmund)


Revision tags: thorpej-signal-base marc-pcmcia-base
# 1.18 07-Aug-1997 scottr

spltty() does not drop the SPL; use splx() instead.


Revision tags: marc-pcmcia-bp
# 1.17 17-Jul-1997 jtk

branches: 1.17.2;
use locator defines in "locators.h" to index cf_loc[]


# 1.16 19-May-1997 mrg

KNF.


Revision tags: is-newarp-before-merge
# 1.15 24-Feb-1997 gwr

Tweak the KGDB glue slightly - do the printf here.


Revision tags: is-newarp-base
# 1.14 17-Dec-1996 gwr

branches: 1.14.4;
New version of the z8530 driver that should permit the mac68k port
to use this instead of its own. Also fix warnings, etc.


# 1.13 16-Oct-1996 gwr

Correct a problem with CRTSCTS flow control where output may fail to
restart if we get multiple status interrupts before the softintr()
routine gets a chance to run. The fix is to determine and accumulate
status line changes at the H/W interrupt level, and then check and zero
the accumulated changes when the softint() finally runs. Many thanks
to Bill Studenmund <wrstuden@loki.stanford.edu> for finding and fixing.


# 1.12 13-Oct-1996 christos

backout kprintf changes


# 1.11 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.10 02-Sep-1996 mycroft

tty stop functions really should return void, not int, and certainly not both.


# 1.9 13-Jun-1996 gwr

Add tty_attach(), and fix a type mismatch.


Revision tags: netbsd-1-2-base
# 1.8 17-May-1996 gwr

branches: 1.8.4;
New version that handles hardware flow-control (CRTSCTS) at the input
to the ring (or silo). This eliminates ring overrun with crtscts.
Also handle deferred register changes earlier, and misc. cleanup.
Give credit to: Bill Studenmund and Ian Dall (Thanks!)


# 1.7 17-May-1996 gwr

Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.


# 1.6 10-Apr-1996 gwr

Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).


# 1.5 18-Mar-1996 gwr

Fix two bugs pointed out by Leo Weppelman:
(1) Did not initialize cs->cs_rr0 anywhere
(2) Have to read rr1 before the data it applies to


# 1.4 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.3 19-Feb-1996 gwr

Fix two bugs found by Bill Studenmund:
Driver can not use tp->t_sc for its own purposes
Attach should take the unit number from _dev.dv_unit


# 1.2 30-Jan-1996 gwr

Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.


# 1.1 24-Jan-1996 gwr

Reorganized, machine-independent z8530 driver, based on the sparc/sun3 zs.
Uses autoconfig to attach keyboard, mouse, or tty. (See z8530.doc)


# 1.134 10-Nov-2019 chs

in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.


Revision tags: netbsd-9-base
# 1.133 21-Jul-2019 rin

Fix panic due to inconsistent lock states of tty_lock in zsparam().
Tested on mac68k.


Revision tags: phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 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 tls-maxphys-base-20171202
# 1.132 31-Oct-2017 martin

As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY

Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.


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 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.131 15-Nov-2014 christos

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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base 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-earlyentropy-base tls-maxphys-base
# 1.130 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 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.129 16-Mar-2014 dholland

branches: 1.129.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: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 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 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.128 24-Apr-2011 rmind

branches: 1.128.4; 1.128.14; 1.128.18;
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 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.127 22-May-2009 mrg

branches: 1.127.4; 1.127.6;
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base
# 1.126 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.125 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.124 20-Mar-2009 tsutsui

Try to avoid zstty hangs on higher speed:

z8530sc.c:
Check pending interrupts in a loop until all requests are handled.
The old comments said it would cause horrible latency to sun3x floppy etc,
but serial ports should have higher priority than disks anyway.

z8530tty.c:
Don't enable and disable TX interrupts on each transmit start and completion
because it could cause possible race conditions.
Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE 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 nick-hppapmap-base2 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 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.123 21-Apr-2008 ad

branches: 1.123.2; 1.123.10; 1.123.12; 1.123.16;
Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.122 29-Mar-2008 tsutsui

branches: 1.122.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.121 14-Mar-2008 martin

Remove a tty_lock for now - I know that this is wrong, but the whole
tty subsystem locking is not consistent and Andrew didn't have
time to come up (or guide to) the right fix.
This prevents machines with serial console on zs(4) from deadlocking on
first input.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.120 20-Jan-2008 joerg

branches: 1.120.2; 1.120.6;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.


Revision tags: vmlocking2-base3 bouyer-xeni386-base matt-armv6-base
# 1.119 22-Dec-2007 ad

t_linesw->l_modem would ideally be called with tty_lock held, but before
that can happen someone needs to beat all the drivers into shape.


# 1.118 22-Dec-2007 ad

Don't recursively acquire tty_lock when zstty_softint() is called directly.


Revision tags: 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.117 19-Nov-2007 ad

branches: 1.117.2; 1.117.6;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.


# 1.116 10-Nov-2007 ad

zsstart, zstty_txsoft: don't acquire tty_lock, it's already held.


# 1.115 07-Nov-2007 ad

Merge tty changes from the vmlocking branch.


Revision tags: nick-csl-alignment-base5 jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base vmlocking-base
# 1.114 09-Jul-2007 ad

branches: 1.114.6; 1.114.8; 1.114.12; 1.114.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.113 04-Mar-2007 christos

branches: 1.113.2; 1.113.4;
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 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.112 01-Oct-2006 elad

branches: 1.112.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.


# 1.111 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.110 22-Jul-2006 martin

branches: 1.110.4; 1.110.6;
Remove unused variable to make it compile again.


# 1.109 21-Jul-2006 ad

- Use the LWP cached credentials where sane.
- Minor cosmetic changes.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.108 07-Jun-2006 kardel

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.107 14-May-2006 elad

branches: 1.107.2;
integrate kauth.


Revision tags: elad-kernelauth-base
# 1.106 19-Apr-2006 tsutsui

- use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
in zstty_attach()
- check a return value of the malloc(9)

Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.105 29-Mar-2006 thorpej

Use device_cfdata().


# 1.104 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.103 05-Mar-2006 rjs

branches: 1.103.2; 1.103.4;
Remove SET/CLR/ISSET macros.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.102 27-Dec-2005 chs

branches: 1.102.4; 1.102.6; 1.102.8;
switch macppc to use the MI zstty driver.
add macppc's ZS_TXDMA hooks there.


# 1.101 11-Dec-2005 christos

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.100 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.99 30-Jun-2005 macallan

branches: 1.99.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.


# 1.98 31-May-2005 christos

- add const
- avoid variable shadow


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 kent-audio2-base
# 1.97 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.96 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.95 20-Jun-2004 thorpej

branches: 1.95.4; 1.95.6;
Define and use zsccf_channel as an alias for cf_loc[ZSCCF_CHANNEL].


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.94 23-Jan-2004 simonb

Fix NTP PPSAPI support (enabled with "options PPS_SYNC"):

From PR kern/13702 from Charles Carvalho. Tested on alpha and
i386 with a Laipac TF10 PPS-capable GPS. The com.c change was
copied wholesale from Charles' z8530tty.c patch.


# 1.93 04-Dec-2003 keihan

netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.


# 1.92 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.91 29-Jun-2003 fvdl

branches: 1.91.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.90 29-Jun-2003 darrenr

More changes for providing lwpid for ktrace (sparc GENERIC built)


# 1.89 28-Jan-2003 pk

Provide locking required by the interrupt handlers running at IPL_SERIAL.


# 1.88 24-Jan-2003 pk

zs_shutdown: lower IPL before sleeping. Also note the fact that the
effectiveness of that very tsleep() call is dubious at best.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.87 06-Jan-2003 wiz

interrupt with two rs.


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.86 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge
# 1.85 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.84 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.83 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.82 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.81 24-Sep-2002 ad

Deal with the strange SCC wiring on TC IOASIC machines. Thanks to Bill
Studenmund and Jonathan Stone for useful comments.


# 1.80 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: 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 gehenna-devsw-base eeh-devprop-base
# 1.79 17-Mar-2002 atatat

branches: 1.79.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.78 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 30-May-2001 lukem

branches: 1.77.2; 1.77.4;
add missing #include "opt_kgdb.h"


# 1.76 11-May-2001 thorpej

Add a flag to suppress SCC reset at attach time.

From Rafal K. Boni.


# 1.75 02-May-2001 scw

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.74 12-Mar-2001 tsutsui

Add some delay in zstty_attach() to wait previous console output
to complete before hardware initialization.


# 1.73 11-Mar-2001 wdk

Add missing \n during probe if port is dedicated to kgdb


# 1.72 08-Nov-2000 eeh

branches: 1.72.2;
Use the MI console magic sequence framework.


# 1.71 05-Nov-2000 chs

remove what looks to be a bit of leftover debug code.


# 1.70 01-Nov-2000 eeh

Adapt to the new line discipline scheme.


# 1.69 17-Sep-2000 toshii

Change tiocm_to_{com,zs}'s second argument to u_long to match with
the type in their caller.


# 1.68 06-Jul-2000 thorpej

Use device_lookup().


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.67 14-Apr-2000 pk

branches: 1.67.4;
Remove spurious splx() call.


# 1.66 24-Mar-2000 hannken

Fix typos from last commit (callout).


# 1.65 23-Mar-2000 thorpej

New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.


# 1.64 19-Mar-2000 pk

Check for console input and output separately.
XXX - split input/output for /dev/console is not yet supported.


# 1.63 14-Mar-2000 jdc

Add power management hooks.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.62 04-Nov-1999 jonathan

Update user-level PPS-API to match -05 draft.
Change PPS_<xxx> ioctls to PPS_IOC_<xxx>.


Revision tags: comdex-fall-1999-base
# 1.61 15-Oct-1999 jonathan

branches: 1.61.2; 1.61.4;
Fix nanosecond/microsecond botch in PPSAPI:
remove bogus TIMESPEC_TO_TIMEVAL() after applying any {assert,clear} offset.


Revision tags: chs-ubc2-base
# 1.60 22-Apr-1999 pk

branches: 1.60.2;
Don't send any data upstream if we're not open yet.


Revision tags: netbsd-1-4-base
# 1.59 27-Mar-1999 wrstuden

branches: 1.59.2;
PPS support. Copied off of com.c support, with changes as DCD interupts
are only enabled if needed and if ok'd by MD layer.


# 1.58 03-Feb-1999 mycroft

Minor changes to tiocm code.


# 1.57 03-Feb-1999 mycroft

Redo the N previous changes, plus a couple of other things:
* Move the printf() delay to just after the printf(), where it actually makes
sense.
* Use zstty_stint() and zstty_softint() from zsparam(), to force an immediate
update of the carrier and flow control status. Abuse this in the attach and
open functions to defer all of that work. This insures that we don't lose
any status updates.
* Don't screw with register 1 when closing the console.
* Fix bugs in TIOCM??? (stay semicolon, clearing DTR while transmitting).
* Add comments in a couple of places.


# 1.56 31-Jan-1999 wrstuden

Add the patch I floated on tech-kern. Andreas Eltrich <elchy@dahoam.de>
says it got pppd working for him.


# 1.55 25-Jan-1999 wrstuden

Fix thinko in part of rev 1.53.

Thanks to Scott for pointing this out to me (I got his mail and figured out
this change before seeing the discussion on tech-kern) and to Charles for
the initial explanation.


# 1.54 13-Jan-1999 christos

Put back modem control ioctl's


Revision tags: kenh-if-detach-base
# 1.53 23-Nov-1998 wrstuden

Changes to deal with mac serial ports having clock sources on DCD or CTS.

- When doing a first open, don't enable receive & status interupts before
the MD layer has had a chance to set things up.
- Enable logic to only enable DCD/CTS interupts if we are looking for/
expecting interupts on those pins. Disable otherwise.
- in zs_param, only pass up the state of ZSRR0_DCD if we have enabled
interupts on that pin.

Henry Hotz (<hotz@jpl.nasa.gov>) and Greg walsh <gwalsh@artec.com> have
tried these changes to get certain printers from hanging at boot. They
work in a 1.3.2 kernel for Greg.


Revision tags: chs-ubc-base
# 1.52 01-Oct-1998 drochner

minor changes to console handling in zstty_attach():
-wait 20ms between printf() and reconfiguring the hardware
-set cn_tab->cn_dev here because this is the place where the real minor
number is known


# 1.51 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


# 1.50 09-Aug-1998 wrstuden

Oops. We do still need to set t_dev in the first open part of zsopen,
so we get ttyXX vs cuaXX right. Leave the initialization in attach.


# 1.49 09-Aug-1998 wrstuden

Initialize the struct tty's t_dev field at attach rather than first open.
The attach routine calls zsparam if we're setting up the console, and
zsparam needs this field to tell which zstty to set up. Otherwise, we
set up zstty0 even if it's not the console!


Revision tags: eeh-paddr_t-base
# 1.48 30-Mar-1998 mycroft

Eliminate cs_heldchar. It is not necessary in my version of the driver.


# 1.47 22-Mar-1998 mycroft

Move the code to wait for carrier on a tty into a common function, since it
depends only on device-independent state bits.
Implement SunOS-style `dialout' devices.


# 1.46 21-Mar-1998 mycroft

Fix pasto.


# 1.45 21-Mar-1998 mycroft

Replace TS_WOPEN with t_wopen, per mail on tech-kern.


# 1.44 22-Feb-1998 mycroft

Fix bonehead error in previous change.


# 1.43 19-Feb-1998 mycroft

Similar changes to com driver:
Arrange to call com_break() and com_modem() at splserial().
It's simpler this way. Really.


# 1.42 12-Jan-1998 thorpej

Adjust for config changes.


# 1.41 12-Nov-1997 pk

Use a 1-character queue so polled console output can be deferred if
regular I/O has been scheduled.


# 1.40 03-Nov-1997 mycroft

Actually use TIOCFLAG_CDTRCTS.


# 1.39 03-Nov-1997 mycroft

Always leave DCD_IE and CTS_IE on for now. Needs more work in zsparam() to
make the optimization actually work right.


# 1.38 03-Nov-1997 mycroft

Leave the console running with or without DDB.


# 1.37 03-Nov-1997 mycroft

Slight optimization in soft input routine.


# 1.36 03-Nov-1997 mycroft

Set the ring size back to 2k.


# 1.35 03-Nov-1997 mycroft

Bug fixes:
* Carrier detect (TS_CARR_ON) is based on the actual DCD bit, even if it's
being ignored.
* Set TS_WOPEN early on in zsopen().
* Don't disable interrupts on the console during close if we have DDB.

Inert changes:
* Don't handle ZS_HWFLAG_NO_DCD here; the frontend does it.
* Deprecate `register'.
* Use SET(), CLR(), and ISSET().

More performance changes:
* Rototill receive handling; use a backpressure mechanism to prevent livelock.
* Output silo/ibuf overflow warnings at most once per minute, from a callout.
* When we exhaust the current transmit run, turn off transmit interrupts in
zstty_txint(), so we're fairly sure we don't get another one.


# 1.34 03-Nov-1997 gwr

Fix serial console support (did not turn on CLOCAL).


# 1.33 02-Nov-1997 mycroft

Rearrange *param() slightly to eliminate a spl.
Also fix another comment regarding DTR.


# 1.32 02-Nov-1997 mycroft

Add another splserial()/splzs().


# 1.31 02-Nov-1997 mycroft

Minimize some spl regions slightly.


# 1.30 02-Nov-1997 mycroft

If we lose HFC, assert RTS.


# 1.29 02-Nov-1997 mycroft

Set the state of DCD_IE and CTS_IE based on what's in rr0_mask.


# 1.28 01-Nov-1997 mycroft

Correct a comment regarding our behaviour with DTR.


# 1.27 01-Nov-1997 mycroft

Fix minor omission; write back reg 1 earlier in zsopen().


# 1.26 01-Nov-1997 mycroft

Need some additional splzs() in zsopen(), and nuke one that's no longer
needed.


# 1.25 01-Nov-1997 mycroft

Nuke the special case of heldchange for reg 5. We don't use it for flow
control any more, and the speed of changing DTR isn't really an issue. Also,
the old code created a bug where zsparam() might have failed to set some
registers.


# 1.24 01-Nov-1997 mycroft

Yet more changes imported from com driver:
Change the interface to zs_hwiflow(); just have it use zst_rx_blocked.
Make zs_modem() a tiny bit faster.
Do RTS updates immediately; do not allow them to be held.


# 1.23 01-Nov-1997 mycroft

Make zst_tba a u_char *.


# 1.22 01-Nov-1997 mycroft

More changes taken from com driver:
Stop output as fast as possible when DCD is deasserted.
Do *not* automatically drop DTR when DCD is deasserted.
Only check for rr0 bits that we care about (DTR and DCD).


# 1.21 01-Nov-1997 mycroft

GC some unused bits.
Also, part of the previous was copied from the com driver, so DTRT.


# 1.20 01-Nov-1997 mycroft

Rearrange open sequence to make sure we catch all line status changes.
Make sure we turn on DTR and/or RTS as appropriate during open.
Rearrange close sequence so the tty is flushed before turning off interrupts.
Deal with `softcar' and the console device by silently asserting CLOCAL and
|HUPCL, as in com driver.
Do *not* fiddle with DTR when changing the line speed.
Make sure we update the tty's carrier status when CLOCAL or MDMBUF is changed.
Only change rr1 when we actually need to turn on or off TIE.


Revision tags: netbsd-1-3-base
# 1.19 17-Oct-1997 gwr

branches: 1.19.2;
Move the ttychars() call below the if-not-raw block.
(from Bill Studenmund)


Revision tags: thorpej-signal-base marc-pcmcia-base
# 1.18 07-Aug-1997 scottr

spltty() does not drop the SPL; use splx() instead.


Revision tags: marc-pcmcia-bp
# 1.17 17-Jul-1997 jtk

branches: 1.17.2;
use locator defines in "locators.h" to index cf_loc[]


# 1.16 19-May-1997 mrg

KNF.


Revision tags: is-newarp-before-merge
# 1.15 24-Feb-1997 gwr

Tweak the KGDB glue slightly - do the printf here.


Revision tags: is-newarp-base
# 1.14 17-Dec-1996 gwr

branches: 1.14.4;
New version of the z8530 driver that should permit the mac68k port
to use this instead of its own. Also fix warnings, etc.


# 1.13 16-Oct-1996 gwr

Correct a problem with CRTSCTS flow control where output may fail to
restart if we get multiple status interrupts before the softintr()
routine gets a chance to run. The fix is to determine and accumulate
status line changes at the H/W interrupt level, and then check and zero
the accumulated changes when the softint() finally runs. Many thanks
to Bill Studenmund <wrstuden@loki.stanford.edu> for finding and fixing.


# 1.12 13-Oct-1996 christos

backout kprintf changes


# 1.11 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.10 02-Sep-1996 mycroft

tty stop functions really should return void, not int, and certainly not both.


# 1.9 13-Jun-1996 gwr

Add tty_attach(), and fix a type mismatch.


Revision tags: netbsd-1-2-base
# 1.8 17-May-1996 gwr

branches: 1.8.4;
New version that handles hardware flow-control (CRTSCTS) at the input
to the ring (or silo). This eliminates ring overrun with crtscts.
Also handle deferred register changes earlier, and misc. cleanup.
Give credit to: Bill Studenmund and Ian Dall (Thanks!)


# 1.7 17-May-1996 gwr

Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.


# 1.6 10-Apr-1996 gwr

Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).


# 1.5 18-Mar-1996 gwr

Fix two bugs pointed out by Leo Weppelman:
(1) Did not initialize cs->cs_rr0 anywhere
(2) Have to read rr1 before the data it applies to


# 1.4 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.3 19-Feb-1996 gwr

Fix two bugs found by Bill Studenmund:
Driver can not use tp->t_sc for its own purposes
Attach should take the unit number from _dev.dv_unit


# 1.2 30-Jan-1996 gwr

Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.


# 1.1 24-Jan-1996 gwr

Reorganized, machine-independent z8530 driver, based on the sparc/sun3 zs.
Uses autoconfig to attach keyboard, mouse, or tty. (See z8530.doc)


# 1.133 21-Jul-2019 rin

Fix panic due to inconsistent lock states of tty_lock in zsparam().
Tested on mac68k.


Revision tags: phil-wifi-20190609 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 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 tls-maxphys-base-20171202
# 1.132 31-Oct-2017 martin

As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY

Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.


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 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.131 15-Nov-2014 christos

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


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base 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-earlyentropy-base tls-maxphys-base
# 1.130 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 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.129 16-Mar-2014 dholland

branches: 1.129.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: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 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 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.128 24-Apr-2011 rmind

branches: 1.128.4; 1.128.14; 1.128.18;
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 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.127 22-May-2009 mrg

branches: 1.127.4; 1.127.6;
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base
# 1.126 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.125 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.124 20-Mar-2009 tsutsui

Try to avoid zstty hangs on higher speed:

z8530sc.c:
Check pending interrupts in a loop until all requests are handled.
The old comments said it would cause horrible latency to sun3x floppy etc,
but serial ports should have higher priority than disks anyway.

z8530tty.c:
Don't enable and disable TX interrupts on each transmit start and completion
because it could cause possible race conditions.
Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE 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 nick-hppapmap-base2 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 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.123 21-Apr-2008 ad

branches: 1.123.2; 1.123.10; 1.123.12; 1.123.16;
Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.122 29-Mar-2008 tsutsui

branches: 1.122.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.121 14-Mar-2008 martin

Remove a tty_lock for now - I know that this is wrong, but the whole
tty subsystem locking is not consistent and Andrew didn't have
time to come up (or guide to) the right fix.
This prevents machines with serial console on zs(4) from deadlocking on
first input.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.120 20-Jan-2008 joerg

branches: 1.120.2; 1.120.6;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.


Revision tags: vmlocking2-base3 bouyer-xeni386-base matt-armv6-base
# 1.119 22-Dec-2007 ad

t_linesw->l_modem would ideally be called with tty_lock held, but before
that can happen someone needs to beat all the drivers into shape.


# 1.118 22-Dec-2007 ad

Don't recursively acquire tty_lock when zstty_softint() is called directly.


Revision tags: 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.117 19-Nov-2007 ad

branches: 1.117.2; 1.117.6;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.


# 1.116 10-Nov-2007 ad

zsstart, zstty_txsoft: don't acquire tty_lock, it's already held.


# 1.115 07-Nov-2007 ad

Merge tty changes from the vmlocking branch.


Revision tags: nick-csl-alignment-base5 jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base vmlocking-base
# 1.114 09-Jul-2007 ad

branches: 1.114.6; 1.114.8; 1.114.12; 1.114.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.113 04-Mar-2007 christos

branches: 1.113.2; 1.113.4;
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 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.112 01-Oct-2006 elad

branches: 1.112.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.


# 1.111 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.110 22-Jul-2006 martin

branches: 1.110.4; 1.110.6;
Remove unused variable to make it compile again.


# 1.109 21-Jul-2006 ad

- Use the LWP cached credentials where sane.
- Minor cosmetic changes.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.108 07-Jun-2006 kardel

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.107 14-May-2006 elad

branches: 1.107.2;
integrate kauth.


Revision tags: elad-kernelauth-base
# 1.106 19-Apr-2006 tsutsui

- use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
in zstty_attach()
- check a return value of the malloc(9)

Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.105 29-Mar-2006 thorpej

Use device_cfdata().


# 1.104 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.103 05-Mar-2006 rjs

branches: 1.103.2; 1.103.4;
Remove SET/CLR/ISSET macros.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.102 27-Dec-2005 chs

branches: 1.102.4; 1.102.6; 1.102.8;
switch macppc to use the MI zstty driver.
add macppc's ZS_TXDMA hooks there.


# 1.101 11-Dec-2005 christos

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.100 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.99 30-Jun-2005 macallan

branches: 1.99.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.


# 1.98 31-May-2005 christos

- add const
- avoid variable shadow


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 kent-audio2-base
# 1.97 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.96 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.95 20-Jun-2004 thorpej

branches: 1.95.4; 1.95.6;
Define and use zsccf_channel as an alias for cf_loc[ZSCCF_CHANNEL].


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.94 23-Jan-2004 simonb

Fix NTP PPSAPI support (enabled with "options PPS_SYNC"):

From PR kern/13702 from Charles Carvalho. Tested on alpha and
i386 with a Laipac TF10 PPS-capable GPS. The com.c change was
copied wholesale from Charles' z8530tty.c patch.


# 1.93 04-Dec-2003 keihan

netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.


# 1.92 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.91 29-Jun-2003 fvdl

branches: 1.91.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.90 29-Jun-2003 darrenr

More changes for providing lwpid for ktrace (sparc GENERIC built)


# 1.89 28-Jan-2003 pk

Provide locking required by the interrupt handlers running at IPL_SERIAL.


# 1.88 24-Jan-2003 pk

zs_shutdown: lower IPL before sleeping. Also note the fact that the
effectiveness of that very tsleep() call is dubious at best.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.87 06-Jan-2003 wiz

interrupt with two rs.


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.86 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge
# 1.85 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.84 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.83 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.82 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.81 24-Sep-2002 ad

Deal with the strange SCC wiring on TC IOASIC machines. Thanks to Bill
Studenmund and Jonathan Stone for useful comments.


# 1.80 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: 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 gehenna-devsw-base eeh-devprop-base
# 1.79 17-Mar-2002 atatat

branches: 1.79.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.78 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 30-May-2001 lukem

branches: 1.77.2; 1.77.4;
add missing #include "opt_kgdb.h"


# 1.76 11-May-2001 thorpej

Add a flag to suppress SCC reset at attach time.

From Rafal K. Boni.


# 1.75 02-May-2001 scw

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.74 12-Mar-2001 tsutsui

Add some delay in zstty_attach() to wait previous console output
to complete before hardware initialization.


# 1.73 11-Mar-2001 wdk

Add missing \n during probe if port is dedicated to kgdb


# 1.72 08-Nov-2000 eeh

branches: 1.72.2;
Use the MI console magic sequence framework.


# 1.71 05-Nov-2000 chs

remove what looks to be a bit of leftover debug code.


# 1.70 01-Nov-2000 eeh

Adapt to the new line discipline scheme.


# 1.69 17-Sep-2000 toshii

Change tiocm_to_{com,zs}'s second argument to u_long to match with
the type in their caller.


# 1.68 06-Jul-2000 thorpej

Use device_lookup().


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.67 14-Apr-2000 pk

branches: 1.67.4;
Remove spurious splx() call.


# 1.66 24-Mar-2000 hannken

Fix typos from last commit (callout).


# 1.65 23-Mar-2000 thorpej

New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.


# 1.64 19-Mar-2000 pk

Check for console input and output separately.
XXX - split input/output for /dev/console is not yet supported.


# 1.63 14-Mar-2000 jdc

Add power management hooks.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.62 04-Nov-1999 jonathan

Update user-level PPS-API to match -05 draft.
Change PPS_<xxx> ioctls to PPS_IOC_<xxx>.


Revision tags: comdex-fall-1999-base
# 1.61 15-Oct-1999 jonathan

branches: 1.61.2; 1.61.4;
Fix nanosecond/microsecond botch in PPSAPI:
remove bogus TIMESPEC_TO_TIMEVAL() after applying any {assert,clear} offset.


Revision tags: chs-ubc2-base
# 1.60 22-Apr-1999 pk

branches: 1.60.2;
Don't send any data upstream if we're not open yet.


Revision tags: netbsd-1-4-base
# 1.59 27-Mar-1999 wrstuden

branches: 1.59.2;
PPS support. Copied off of com.c support, with changes as DCD interupts
are only enabled if needed and if ok'd by MD layer.


# 1.58 03-Feb-1999 mycroft

Minor changes to tiocm code.


# 1.57 03-Feb-1999 mycroft

Redo the N previous changes, plus a couple of other things:
* Move the printf() delay to just after the printf(), where it actually makes
sense.
* Use zstty_stint() and zstty_softint() from zsparam(), to force an immediate
update of the carrier and flow control status. Abuse this in the attach and
open functions to defer all of that work. This insures that we don't lose
any status updates.
* Don't screw with register 1 when closing the console.
* Fix bugs in TIOCM??? (stay semicolon, clearing DTR while transmitting).
* Add comments in a couple of places.


# 1.56 31-Jan-1999 wrstuden

Add the patch I floated on tech-kern. Andreas Eltrich <elchy@dahoam.de>
says it got pppd working for him.


# 1.55 25-Jan-1999 wrstuden

Fix thinko in part of rev 1.53.

Thanks to Scott for pointing this out to me (I got his mail and figured out
this change before seeing the discussion on tech-kern) and to Charles for
the initial explanation.


# 1.54 13-Jan-1999 christos

Put back modem control ioctl's


Revision tags: kenh-if-detach-base
# 1.53 23-Nov-1998 wrstuden

Changes to deal with mac serial ports having clock sources on DCD or CTS.

- When doing a first open, don't enable receive & status interupts before
the MD layer has had a chance to set things up.
- Enable logic to only enable DCD/CTS interupts if we are looking for/
expecting interupts on those pins. Disable otherwise.
- in zs_param, only pass up the state of ZSRR0_DCD if we have enabled
interupts on that pin.

Henry Hotz (<hotz@jpl.nasa.gov>) and Greg walsh <gwalsh@artec.com> have
tried these changes to get certain printers from hanging at boot. They
work in a 1.3.2 kernel for Greg.


Revision tags: chs-ubc-base
# 1.52 01-Oct-1998 drochner

minor changes to console handling in zstty_attach():
-wait 20ms between printf() and reconfiguring the hardware
-set cn_tab->cn_dev here because this is the place where the real minor
number is known


# 1.51 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


# 1.50 09-Aug-1998 wrstuden

Oops. We do still need to set t_dev in the first open part of zsopen,
so we get ttyXX vs cuaXX right. Leave the initialization in attach.


# 1.49 09-Aug-1998 wrstuden

Initialize the struct tty's t_dev field at attach rather than first open.
The attach routine calls zsparam if we're setting up the console, and
zsparam needs this field to tell which zstty to set up. Otherwise, we
set up zstty0 even if it's not the console!


Revision tags: eeh-paddr_t-base
# 1.48 30-Mar-1998 mycroft

Eliminate cs_heldchar. It is not necessary in my version of the driver.


# 1.47 22-Mar-1998 mycroft

Move the code to wait for carrier on a tty into a common function, since it
depends only on device-independent state bits.
Implement SunOS-style `dialout' devices.


# 1.46 21-Mar-1998 mycroft

Fix pasto.


# 1.45 21-Mar-1998 mycroft

Replace TS_WOPEN with t_wopen, per mail on tech-kern.


# 1.44 22-Feb-1998 mycroft

Fix bonehead error in previous change.


# 1.43 19-Feb-1998 mycroft

Similar changes to com driver:
Arrange to call com_break() and com_modem() at splserial().
It's simpler this way. Really.


# 1.42 12-Jan-1998 thorpej

Adjust for config changes.


# 1.41 12-Nov-1997 pk

Use a 1-character queue so polled console output can be deferred if
regular I/O has been scheduled.


# 1.40 03-Nov-1997 mycroft

Actually use TIOCFLAG_CDTRCTS.


# 1.39 03-Nov-1997 mycroft

Always leave DCD_IE and CTS_IE on for now. Needs more work in zsparam() to
make the optimization actually work right.


# 1.38 03-Nov-1997 mycroft

Leave the console running with or without DDB.


# 1.37 03-Nov-1997 mycroft

Slight optimization in soft input routine.


# 1.36 03-Nov-1997 mycroft

Set the ring size back to 2k.


# 1.35 03-Nov-1997 mycroft

Bug fixes:
* Carrier detect (TS_CARR_ON) is based on the actual DCD bit, even if it's
being ignored.
* Set TS_WOPEN early on in zsopen().
* Don't disable interrupts on the console during close if we have DDB.

Inert changes:
* Don't handle ZS_HWFLAG_NO_DCD here; the frontend does it.
* Deprecate `register'.
* Use SET(), CLR(), and ISSET().

More performance changes:
* Rototill receive handling; use a backpressure mechanism to prevent livelock.
* Output silo/ibuf overflow warnings at most once per minute, from a callout.
* When we exhaust the current transmit run, turn off transmit interrupts in
zstty_txint(), so we're fairly sure we don't get another one.


# 1.34 03-Nov-1997 gwr

Fix serial console support (did not turn on CLOCAL).


# 1.33 02-Nov-1997 mycroft

Rearrange *param() slightly to eliminate a spl.
Also fix another comment regarding DTR.


# 1.32 02-Nov-1997 mycroft

Add another splserial()/splzs().


# 1.31 02-Nov-1997 mycroft

Minimize some spl regions slightly.


# 1.30 02-Nov-1997 mycroft

If we lose HFC, assert RTS.


# 1.29 02-Nov-1997 mycroft

Set the state of DCD_IE and CTS_IE based on what's in rr0_mask.


# 1.28 01-Nov-1997 mycroft

Correct a comment regarding our behaviour with DTR.


# 1.27 01-Nov-1997 mycroft

Fix minor omission; write back reg 1 earlier in zsopen().


# 1.26 01-Nov-1997 mycroft

Need some additional splzs() in zsopen(), and nuke one that's no longer
needed.


# 1.25 01-Nov-1997 mycroft

Nuke the special case of heldchange for reg 5. We don't use it for flow
control any more, and the speed of changing DTR isn't really an issue. Also,
the old code created a bug where zsparam() might have failed to set some
registers.


# 1.24 01-Nov-1997 mycroft

Yet more changes imported from com driver:
Change the interface to zs_hwiflow(); just have it use zst_rx_blocked.
Make zs_modem() a tiny bit faster.
Do RTS updates immediately; do not allow them to be held.


# 1.23 01-Nov-1997 mycroft

Make zst_tba a u_char *.


# 1.22 01-Nov-1997 mycroft

More changes taken from com driver:
Stop output as fast as possible when DCD is deasserted.
Do *not* automatically drop DTR when DCD is deasserted.
Only check for rr0 bits that we care about (DTR and DCD).


# 1.21 01-Nov-1997 mycroft

GC some unused bits.
Also, part of the previous was copied from the com driver, so DTRT.


# 1.20 01-Nov-1997 mycroft

Rearrange open sequence to make sure we catch all line status changes.
Make sure we turn on DTR and/or RTS as appropriate during open.
Rearrange close sequence so the tty is flushed before turning off interrupts.
Deal with `softcar' and the console device by silently asserting CLOCAL and
|HUPCL, as in com driver.
Do *not* fiddle with DTR when changing the line speed.
Make sure we update the tty's carrier status when CLOCAL or MDMBUF is changed.
Only change rr1 when we actually need to turn on or off TIE.


Revision tags: netbsd-1-3-base
# 1.19 17-Oct-1997 gwr

branches: 1.19.2;
Move the ttychars() call below the if-not-raw block.
(from Bill Studenmund)


Revision tags: thorpej-signal-base marc-pcmcia-base
# 1.18 07-Aug-1997 scottr

spltty() does not drop the SPL; use splx() instead.


Revision tags: marc-pcmcia-bp
# 1.17 17-Jul-1997 jtk

branches: 1.17.2;
use locator defines in "locators.h" to index cf_loc[]


# 1.16 19-May-1997 mrg

KNF.


Revision tags: is-newarp-before-merge
# 1.15 24-Feb-1997 gwr

Tweak the KGDB glue slightly - do the printf here.


Revision tags: is-newarp-base
# 1.14 17-Dec-1996 gwr

branches: 1.14.4;
New version of the z8530 driver that should permit the mac68k port
to use this instead of its own. Also fix warnings, etc.


# 1.13 16-Oct-1996 gwr

Correct a problem with CRTSCTS flow control where output may fail to
restart if we get multiple status interrupts before the softintr()
routine gets a chance to run. The fix is to determine and accumulate
status line changes at the H/W interrupt level, and then check and zero
the accumulated changes when the softint() finally runs. Many thanks
to Bill Studenmund <wrstuden@loki.stanford.edu> for finding and fixing.


# 1.12 13-Oct-1996 christos

backout kprintf changes


# 1.11 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.10 02-Sep-1996 mycroft

tty stop functions really should return void, not int, and certainly not both.


# 1.9 13-Jun-1996 gwr

Add tty_attach(), and fix a type mismatch.


Revision tags: netbsd-1-2-base
# 1.8 17-May-1996 gwr

branches: 1.8.4;
New version that handles hardware flow-control (CRTSCTS) at the input
to the ring (or silo). This eliminates ring overrun with crtscts.
Also handle deferred register changes earlier, and misc. cleanup.
Give credit to: Bill Studenmund and Ian Dall (Thanks!)


# 1.7 17-May-1996 gwr

Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.


# 1.6 10-Apr-1996 gwr

Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).


# 1.5 18-Mar-1996 gwr

Fix two bugs pointed out by Leo Weppelman:
(1) Did not initialize cs->cs_rr0 anywhere
(2) Have to read rr1 before the data it applies to


# 1.4 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.3 19-Feb-1996 gwr

Fix two bugs found by Bill Studenmund:
Driver can not use tp->t_sc for its own purposes
Attach should take the unit number from _dev.dv_unit


# 1.2 30-Jan-1996 gwr

Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.


# 1.1 24-Jan-1996 gwr

Reorganized, machine-independent z8530 driver, based on the sparc/sun3 zs.
Uses autoconfig to attach keyboard, mouse, or tty. (See z8530.doc)


# 1.132 31-Oct-2017 martin

As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY

Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.


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 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.131 15-Nov-2014 christos

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


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base 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-earlyentropy-base tls-maxphys-base
# 1.130 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 riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase rmind-smpnet-base
# 1.129 16-Mar-2014 dholland

branches: 1.129.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: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 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 riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.128 24-Apr-2011 rmind

branches: 1.128.4; 1.128.14; 1.128.18;
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 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 jym-xensuspend-nbase
# 1.127 22-May-2009 mrg

branches: 1.127.4; 1.127.6;
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.

reviewed by ad and martin.


Revision tags: yamt-nfs-mp-base4 jym-xensuspend-base
# 1.126 12-May-2009 cegger

struct device * -> device_t, no functional changes intended.


# 1.125 12-May-2009 cegger

struct cfdata * -> cfdata_t, no functional changes intended.


Revision tags: yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.124 20-Mar-2009 tsutsui

Try to avoid zstty hangs on higher speed:

z8530sc.c:
Check pending interrupts in a loop until all requests are handled.
The old comments said it would cause horrible latency to sun3x floppy etc,
but serial ports should have higher priority than disks anyway.

z8530tty.c:
Don't enable and disable TX interrupts on each transmit start and completion
because it could cause possible race conditions.
Instead, set ZSWR0_RESET_TXINT on each TIE interrupt to clear the request
as other kbd drivers attached at zs(4).

Tested on cobalt, macppc, news68k, sparc, and sun3.


Revision tags: netbsd-5-1-5-RELEASE netbsd-5-1-4-RELEASE netbsd-5-1-3-RELEASE 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 nick-hppapmap-base2 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 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base yamt-nfs-mp-base mjf-devfs2-base
# 1.123 21-Apr-2008 ad

branches: 1.123.2; 1.123.10; 1.123.12; 1.123.16;
Make ntp, pmc, reboot, sysarch, time syscalls MPSAFE.


Revision tags: yamt-pf42-baseX yamt-pf42-base
# 1.122 29-Mar-2008 tsutsui

branches: 1.122.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.121 14-Mar-2008 martin

Remove a tty_lock for now - I know that this is wrong, but the whole
tty subsystem locking is not consistent and Andrew didn't have
time to come up (or guide to) the right fix.
This prevents machines with serial console on zs(4) from deadlocking on
first input.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.120 20-Jan-2008 joerg

branches: 1.120.2; 1.120.6;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.


Revision tags: vmlocking2-base3 bouyer-xeni386-base matt-armv6-base
# 1.119 22-Dec-2007 ad

t_linesw->l_modem would ideally be called with tty_lock held, but before
that can happen someone needs to beat all the drivers into shape.


# 1.118 22-Dec-2007 ad

Don't recursively acquire tty_lock when zstty_softint() is called directly.


Revision tags: 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.117 19-Nov-2007 ad

branches: 1.117.2; 1.117.6;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.


# 1.116 10-Nov-2007 ad

zsstart, zstty_txsoft: don't acquire tty_lock, it's already held.


# 1.115 07-Nov-2007 ad

Merge tty changes from the vmlocking branch.


Revision tags: nick-csl-alignment-base5 jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base nick-csl-alignment-base mjf-ufs-trans-base vmlocking-base
# 1.114 09-Jul-2007 ad

branches: 1.114.6; 1.114.8; 1.114.12; 1.114.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.113 04-Mar-2007 christos

branches: 1.113.2; 1.113.4;
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 wrstuden-fixsa-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 newlock2-base netbsd-4-base
# 1.112 01-Oct-2006 elad

branches: 1.112.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.


# 1.111 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.110 22-Jul-2006 martin

branches: 1.110.4; 1.110.6;
Remove unused variable to make it compile again.


# 1.109 21-Jul-2006 ad

- Use the LWP cached credentials where sane.
- Minor cosmetic changes.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base
# 1.108 07-Jun-2006 kardel

merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html


Revision tags: yamt-pdpolicy-base5 simonb-timecounters-base
# 1.107 14-May-2006 elad

branches: 1.107.2;
integrate kauth.


Revision tags: elad-kernelauth-base
# 1.106 19-Apr-2006 tsutsui

- use M_NOWAIT rather than M_WAITOK for malloc(9) to allocate RX buffer
in zstty_attach()
- check a return value of the malloc(9)

Taken from com.c, and somehow this seems to fix PR port-sun2/32420 on tme.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.105 29-Mar-2006 thorpej

Use device_cfdata().


# 1.104 28-Mar-2006 thorpej

Use device_unit().


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.103 05-Mar-2006 rjs

branches: 1.103.2; 1.103.4;
Remove SET/CLR/ISSET macros.


Revision tags: yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.102 27-Dec-2005 chs

branches: 1.102.4; 1.102.6; 1.102.8;
switch macppc to use the MI zstty driver.
add macppc's ZS_TXDMA hooks there.


# 1.101 11-Dec-2005 christos

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.100 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.99 30-Jun-2005 macallan

branches: 1.99.2;
Allow sparc64-style attachment of mouse and keyboard via zstty, needed for
wscons support.
Reviewed by uwe.


# 1.98 31-May-2005 christos

- add const
- avoid variable shadow


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 kent-audio2-base
# 1.97 27-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2
# 1.96 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.95 20-Jun-2004 thorpej

branches: 1.95.4; 1.95.6;
Define and use zsccf_channel as an alias for cf_loc[ZSCCF_CHANNEL].


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.94 23-Jan-2004 simonb

Fix NTP PPSAPI support (enabled with "options PPS_SYNC"):

From PR kern/13702 from Charles Carvalho. Tested on alpha and
i386 with a Laipac TF10 PPS-capable GPS. The com.c change was
copied wholesale from Charles' z8530tty.c patch.


# 1.93 04-Dec-2003 keihan

netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.


# 1.92 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.91 29-Jun-2003 fvdl

branches: 1.91.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.


# 1.90 29-Jun-2003 darrenr

More changes for providing lwpid for ktrace (sparc GENERIC built)


# 1.89 28-Jan-2003 pk

Provide locking required by the interrupt handlers running at IPL_SERIAL.


# 1.88 24-Jan-2003 pk

zs_shutdown: lower IPL before sleeping. Also note the fact that the
effectiveness of that very tsleep() call is dubious at best.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
# 1.87 06-Jan-2003 wiz

interrupt with two rs.


Revision tags: fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base
# 1.86 09-Nov-2002 thorpej

Fix signed/unsigned comparison warnings.


Revision tags: kqueue-aftermerge
# 1.85 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.84 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.83 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.82 27-Sep-2002 thorpej

Declare all cfattach structures const.


# 1.81 24-Sep-2002 ad

Deal with the strange SCC wiring on TC IOASIC machines. Thanks to Bill
Studenmund and Jonathan Stone for useful comments.


# 1.80 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: 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 gehenna-devsw-base eeh-devprop-base
# 1.79 17-Mar-2002 atatat

branches: 1.79.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.78 13-Nov-2001 lukem

add/cleanup RCSID


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.77 30-May-2001 lukem

branches: 1.77.2; 1.77.4;
add missing #include "opt_kgdb.h"


# 1.76 11-May-2001 thorpej

Add a flag to suppress SCC reset at attach time.

From Rafal K. Boni.


# 1.75 02-May-2001 scw

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.74 12-Mar-2001 tsutsui

Add some delay in zstty_attach() to wait previous console output
to complete before hardware initialization.


# 1.73 11-Mar-2001 wdk

Add missing \n during probe if port is dedicated to kgdb


# 1.72 08-Nov-2000 eeh

branches: 1.72.2;
Use the MI console magic sequence framework.


# 1.71 05-Nov-2000 chs

remove what looks to be a bit of leftover debug code.


# 1.70 01-Nov-2000 eeh

Adapt to the new line discipline scheme.


# 1.69 17-Sep-2000 toshii

Change tiocm_to_{com,zs}'s second argument to u_long to match with
the type in their caller.


# 1.68 06-Jul-2000 thorpej

Use device_lookup().


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.67 14-Apr-2000 pk

branches: 1.67.4;
Remove spurious splx() call.


# 1.66 24-Mar-2000 hannken

Fix typos from last commit (callout).


# 1.65 23-Mar-2000 thorpej

New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.


# 1.64 19-Mar-2000 pk

Check for console input and output separately.
XXX - split input/output for /dev/console is not yet supported.


# 1.63 14-Mar-2000 jdc

Add power management hooks.


Revision tags: chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base
# 1.62 04-Nov-1999 jonathan

Update user-level PPS-API to match -05 draft.
Change PPS_<xxx> ioctls to PPS_IOC_<xxx>.


Revision tags: comdex-fall-1999-base
# 1.61 15-Oct-1999 jonathan

branches: 1.61.2; 1.61.4;
Fix nanosecond/microsecond botch in PPSAPI:
remove bogus TIMESPEC_TO_TIMEVAL() after applying any {assert,clear} offset.


Revision tags: chs-ubc2-base
# 1.60 22-Apr-1999 pk

branches: 1.60.2;
Don't send any data upstream if we're not open yet.


Revision tags: netbsd-1-4-base
# 1.59 27-Mar-1999 wrstuden

branches: 1.59.2;
PPS support. Copied off of com.c support, with changes as DCD interupts
are only enabled if needed and if ok'd by MD layer.


# 1.58 03-Feb-1999 mycroft

Minor changes to tiocm code.


# 1.57 03-Feb-1999 mycroft

Redo the N previous changes, plus a couple of other things:
* Move the printf() delay to just after the printf(), where it actually makes
sense.
* Use zstty_stint() and zstty_softint() from zsparam(), to force an immediate
update of the carrier and flow control status. Abuse this in the attach and
open functions to defer all of that work. This insures that we don't lose
any status updates.
* Don't screw with register 1 when closing the console.
* Fix bugs in TIOCM??? (stay semicolon, clearing DTR while transmitting).
* Add comments in a couple of places.


# 1.56 31-Jan-1999 wrstuden

Add the patch I floated on tech-kern. Andreas Eltrich <elchy@dahoam.de>
says it got pppd working for him.


# 1.55 25-Jan-1999 wrstuden

Fix thinko in part of rev 1.53.

Thanks to Scott for pointing this out to me (I got his mail and figured out
this change before seeing the discussion on tech-kern) and to Charles for
the initial explanation.


# 1.54 13-Jan-1999 christos

Put back modem control ioctl's


Revision tags: kenh-if-detach-base
# 1.53 23-Nov-1998 wrstuden

Changes to deal with mac serial ports having clock sources on DCD or CTS.

- When doing a first open, don't enable receive & status interupts before
the MD layer has had a chance to set things up.
- Enable logic to only enable DCD/CTS interupts if we are looking for/
expecting interupts on those pins. Disable otherwise.
- in zs_param, only pass up the state of ZSRR0_DCD if we have enabled
interupts on that pin.

Henry Hotz (<hotz@jpl.nasa.gov>) and Greg walsh <gwalsh@artec.com> have
tried these changes to get certain printers from hanging at boot. They
work in a 1.3.2 kernel for Greg.


Revision tags: chs-ubc-base
# 1.52 01-Oct-1998 drochner

minor changes to console handling in zstty_attach():
-wait 20ms between printf() and reconfiguring the hardware
-set cn_tab->cn_dev here because this is the place where the real minor
number is known


# 1.51 31-Aug-1998 cgd

kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)


# 1.50 09-Aug-1998 wrstuden

Oops. We do still need to set t_dev in the first open part of zsopen,
so we get ttyXX vs cuaXX right. Leave the initialization in attach.


# 1.49 09-Aug-1998 wrstuden

Initialize the struct tty's t_dev field at attach rather than first open.
The attach routine calls zsparam if we're setting up the console, and
zsparam needs this field to tell which zstty to set up. Otherwise, we
set up zstty0 even if it's not the console!


Revision tags: eeh-paddr_t-base
# 1.48 30-Mar-1998 mycroft

Eliminate cs_heldchar. It is not necessary in my version of the driver.


# 1.47 22-Mar-1998 mycroft

Move the code to wait for carrier on a tty into a common function, since it
depends only on device-independent state bits.
Implement SunOS-style `dialout' devices.


# 1.46 21-Mar-1998 mycroft

Fix pasto.


# 1.45 21-Mar-1998 mycroft

Replace TS_WOPEN with t_wopen, per mail on tech-kern.


# 1.44 22-Feb-1998 mycroft

Fix bonehead error in previous change.


# 1.43 19-Feb-1998 mycroft

Similar changes to com driver:
Arrange to call com_break() and com_modem() at splserial().
It's simpler this way. Really.


# 1.42 12-Jan-1998 thorpej

Adjust for config changes.


# 1.41 12-Nov-1997 pk

Use a 1-character queue so polled console output can be deferred if
regular I/O has been scheduled.


# 1.40 03-Nov-1997 mycroft

Actually use TIOCFLAG_CDTRCTS.


# 1.39 03-Nov-1997 mycroft

Always leave DCD_IE and CTS_IE on for now. Needs more work in zsparam() to
make the optimization actually work right.


# 1.38 03-Nov-1997 mycroft

Leave the console running with or without DDB.


# 1.37 03-Nov-1997 mycroft

Slight optimization in soft input routine.


# 1.36 03-Nov-1997 mycroft

Set the ring size back to 2k.


# 1.35 03-Nov-1997 mycroft

Bug fixes:
* Carrier detect (TS_CARR_ON) is based on the actual DCD bit, even if it's
being ignored.
* Set TS_WOPEN early on in zsopen().
* Don't disable interrupts on the console during close if we have DDB.

Inert changes:
* Don't handle ZS_HWFLAG_NO_DCD here; the frontend does it.
* Deprecate `register'.
* Use SET(), CLR(), and ISSET().

More performance changes:
* Rototill receive handling; use a backpressure mechanism to prevent livelock.
* Output silo/ibuf overflow warnings at most once per minute, from a callout.
* When we exhaust the current transmit run, turn off transmit interrupts in
zstty_txint(), so we're fairly sure we don't get another one.


# 1.34 03-Nov-1997 gwr

Fix serial console support (did not turn on CLOCAL).


# 1.33 02-Nov-1997 mycroft

Rearrange *param() slightly to eliminate a spl.
Also fix another comment regarding DTR.


# 1.32 02-Nov-1997 mycroft

Add another splserial()/splzs().


# 1.31 02-Nov-1997 mycroft

Minimize some spl regions slightly.


# 1.30 02-Nov-1997 mycroft

If we lose HFC, assert RTS.


# 1.29 02-Nov-1997 mycroft

Set the state of DCD_IE and CTS_IE based on what's in rr0_mask.


# 1.28 01-Nov-1997 mycroft

Correct a comment regarding our behaviour with DTR.


# 1.27 01-Nov-1997 mycroft

Fix minor omission; write back reg 1 earlier in zsopen().


# 1.26 01-Nov-1997 mycroft

Need some additional splzs() in zsopen(), and nuke one that's no longer
needed.


# 1.25 01-Nov-1997 mycroft

Nuke the special case of heldchange for reg 5. We don't use it for flow
control any more, and the speed of changing DTR isn't really an issue. Also,
the old code created a bug where zsparam() might have failed to set some
registers.


# 1.24 01-Nov-1997 mycroft

Yet more changes imported from com driver:
Change the interface to zs_hwiflow(); just have it use zst_rx_blocked.
Make zs_modem() a tiny bit faster.
Do RTS updates immediately; do not allow them to be held.


# 1.23 01-Nov-1997 mycroft

Make zst_tba a u_char *.


# 1.22 01-Nov-1997 mycroft

More changes taken from com driver:
Stop output as fast as possible when DCD is deasserted.
Do *not* automatically drop DTR when DCD is deasserted.
Only check for rr0 bits that we care about (DTR and DCD).


# 1.21 01-Nov-1997 mycroft

GC some unused bits.
Also, part of the previous was copied from the com driver, so DTRT.


# 1.20 01-Nov-1997 mycroft

Rearrange open sequence to make sure we catch all line status changes.
Make sure we turn on DTR and/or RTS as appropriate during open.
Rearrange close sequence so the tty is flushed before turning off interrupts.
Deal with `softcar' and the console device by silently asserting CLOCAL and
|HUPCL, as in com driver.
Do *not* fiddle with DTR when changing the line speed.
Make sure we update the tty's carrier status when CLOCAL or MDMBUF is changed.
Only change rr1 when we actually need to turn on or off TIE.


Revision tags: netbsd-1-3-base
# 1.19 17-Oct-1997 gwr

branches: 1.19.2;
Move the ttychars() call below the if-not-raw block.
(from Bill Studenmund)


Revision tags: thorpej-signal-base marc-pcmcia-base
# 1.18 07-Aug-1997 scottr

spltty() does not drop the SPL; use splx() instead.


Revision tags: marc-pcmcia-bp
# 1.17 17-Jul-1997 jtk

branches: 1.17.2;
use locator defines in "locators.h" to index cf_loc[]


# 1.16 19-May-1997 mrg

KNF.


Revision tags: is-newarp-before-merge
# 1.15 24-Feb-1997 gwr

Tweak the KGDB glue slightly - do the printf here.


Revision tags: is-newarp-base
# 1.14 17-Dec-1996 gwr

branches: 1.14.4;
New version of the z8530 driver that should permit the mac68k port
to use this instead of its own. Also fix warnings, etc.


# 1.13 16-Oct-1996 gwr

Correct a problem with CRTSCTS flow control where output may fail to
restart if we get multiple status interrupts before the softintr()
routine gets a chance to run. The fix is to determine and accumulate
status line changes at the H/W interrupt level, and then check and zero
the accumulated changes when the softint() finally runs. Many thanks
to Bill Studenmund <wrstuden@loki.stanford.edu> for finding and fixing.


# 1.12 13-Oct-1996 christos

backout kprintf changes


# 1.11 10-Oct-1996 christos

- printf -> kprintf, sprintf -> ksprintf


# 1.10 02-Sep-1996 mycroft

tty stop functions really should return void, not int, and certainly not both.


# 1.9 13-Jun-1996 gwr

Add tty_attach(), and fix a type mismatch.


Revision tags: netbsd-1-2-base
# 1.8 17-May-1996 gwr

branches: 1.8.4;
New version that handles hardware flow-control (CRTSCTS) at the input
to the ring (or silo). This eliminates ring overrun with crtscts.
Also handle deferred register changes earlier, and misc. cleanup.
Give credit to: Bill Studenmund and Ian Dall (Thanks!)


# 1.7 17-May-1996 gwr

Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.


# 1.6 10-Apr-1996 gwr

Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).


# 1.5 18-Mar-1996 gwr

Fix two bugs pointed out by Leo Weppelman:
(1) Did not initialize cs->cs_rr0 anywhere
(2) Have to read rr1 before the data it applies to


# 1.4 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.3 19-Feb-1996 gwr

Fix two bugs found by Bill Studenmund:
Driver can not use tp->t_sc for its own purposes
Attach should take the unit number from _dev.dv_unit


# 1.2 30-Jan-1996 gwr

Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.


# 1.1 24-Jan-1996 gwr

Reorganized, machine-independent z8530 driver, based on the sparc/sun3 zs.
Uses autoconfig to attach keyboard, mouse, or tty. (See z8530.doc)