Home | History | Annotate | Download | only in sun
History log of /src/sys/dev/sun/kbd.c
RevisionDateAuthorComments
 1.73  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.72  24-Apr-2021  thorpej branches: 1.72.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.71  18-Jan-2020  tsutsui branches: 1.71.8;
Fix panic on sun3 when any key is typed when kbd is not console. PR/54873

Should be pulled up to netbsd-9.
 1.70  10-Nov-2019  chs branches: 1.70.2;
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.
 1.69  08-Feb-2018  mrg branches: 1.69.4; 1.69.10;
update for GCC 6:

kbd_input_wskbd() has a missing {} issue.
 1.68  25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.67  16-Mar-2014  dholland branches: 1.67.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.66  02-May-2012  christos branches: 1.66.2; 1.66.4;
make this compile again.
 1.65  27-Apr-2012  martin Make it compilable without envsys
 1.64  26-Apr-2012  macallan report power button events to sysmon
also send pwm events for volume control keys directly with
options KBD_HIJACK_VOLUME_BUTTONS
so they work in X as well
 1.63  12-May-2009  cegger branches: 1.63.12; 1.63.16;
struct device * -> device_t, no functional changes intended.
 1.62  11-Jan-2009  christos branches: 1.62.2;
retain compatibility with old firm_event. Perhaps we should bump the protocol
version with an ioctl?
 1.61  20-Apr-2008  tsutsui branches: 1.61.2; 1.61.10;
- use device_lookup_private() where appropriate
- some KNF and cosmetics
 1.60  29-Mar-2008  tsutsui branches: 1.60.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.59  09-Jul-2007  ad branches: 1.59.28;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.58  04-Mar-2007  christos branches: 1.58.2; 1.58.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.57  15-Oct-2006  martin branches: 1.57.4;
Missing initializer
 1.56  07-Jun-2006  kardel branches: 1.56.6; 1.56.8;
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
 1.55  14-Dec-2005  christos branches: 1.55.4; 1.55.6; 1.55.8; 1.55.14;
whitespace.
 1.54  12-Dec-2005  christos welcome to the new lwp world.
 1.53  11-Dec-2005  christos merge ktrace-lwp.
 1.52  28-Sep-2005  martin Remove spurious debug output accidently commited in revision 1.44.
 1.51  14-Sep-2005  martin Ignore KBD_IDLE one layer earlier - wskbd does not like it [and complains
in DEBUG kernels], and we already ignored it for raw mode.
 1.50  08-Jun-2005  martin branches: 1.50.2;
Use KBD_IDLE instead of magic constants
 1.49  07-Jun-2005  martin Do not bother to post "keyboard idle" events to userland when we are
in wskbd raw input mode.
 1.48  17-May-2005  martin Fix indentation.
 1.47  16-May-2005  martin Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.46  16-May-2005  martin Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.45  29-Apr-2005  martin Add a missing #if to allow non-wscons compilation.
Noted by Juergen Hannken-Illjes.
 1.44  28-Apr-2005  martin Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.43  27-Feb-2005  perry branches: 1.43.2;
nuke trailing whitespace
 1.42  04-Feb-2005  perry de-__P
 1.41  31-Dec-2004  bjh21 branches: 1.41.2; 1.41.4;
Go back to filtering out KBD_IDLE events by default. The Xsun shipped with
NetBSD 2.0 gets confused by them (generating events for keycode 134 when
all keys are released), and even when that's fixed we should keep one release
worth of backward compatibility.
 1.40  22-Apr-2004  itojun sprintf -> snprintf
 1.39  21-Sep-2003  jdolecek branches: 1.39.4;
cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
the owner of descriptor, according to appropriate sematics
of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
 1.38  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.37  29-Jun-2003  fvdl branches: 1.37.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.36  29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.35  26-Oct-2002  martin Allow attaching wskbd at kbd, idea from Valeriy Ushakov.
This allows us to use both the old sun keyboard events (/dev/kbd) as
new wscons events (/dev/wskbd*).

TODO: Not implemented for the kbd at zstty attachment.
Wskbd as console does not yet work.
 1.34  23-Oct-2002  jdolecek merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.33  21-Oct-2002  uwe Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.32  03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.31  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.30  13-May-2002  pk branches: 1.30.2;
Check whether a console is attached before sending data upstream.
 1.29  13-Nov-2001  lukem add RCSIDs
 1.28  08-Jun-2001  mrg branches: 1.28.2; 1.28.4;
#endif /* takes no argument */
 1.27  21-Sep-2000  eeh branches: 1.27.2;
Support for Sun Keyboard/Mouse line disciplines.
 1.26  24-Mar-2000  hannken branches: 1.26.4;
Fix typos from last commit (callout).
 1.25  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.24  22-Mar-2000  pk Make kbd_iopen/kbd_iclose internal routines; introduce kbd_cc_{open,close}
for opening and closing the device when attached to /dev/console.
 1.23  19-Mar-2000  pk Use a somewhat more flexible method to hook up the keyboard driver
as the console input device.
 1.22  14-May-1999  mrg branches: 1.22.2;
split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.21  03-Feb-1999  mycroft branches: 1.21.4;
Catch up with a change to the stint interface.
 1.20  12-Jan-1998  thorpej Update for changes to config.
 1.19  03-Nov-1997  mycroft Trivial change; use KB_SUN4 rather than the constant in one place.
 1.18  03-Nov-1997  gwr KIOCSLED ioctl takes a char (from Krister Walfridsson).
 1.17  28-Oct-1997  gwr Print more helpful information if we get unexpected keysyms.
Call kbd_xlate_init() after we know the keyboard type so it
has a chance to install the RIGHT keymap pointers! (Duh!)
 1.16  21-Oct-1997  gwr Clean up kbdioctl():
* Make sure all uses of the data pointer are type-cast appropriately.
* Eliminate the super-user check in the KIOCSKEY case (back as it was).
* Return ENOTTY if the ioctl command code is unrecognized.
 1.15  03-Oct-1997  gwr branches: 1.15.2;
Export kbd_docmd() because the sparc fb.c wants it.
 1.14  17-Jul-1997  jtk branches: 1.14.2;
use locator defines in "locators.h" to index cf_loc[]
 1.13  17-Dec-1996  gwr Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.12  16-Oct-1996  gwr Replace the field cs_rr0_new with cs_rr0_delta (keep changes instead).
 1.11  13-Oct-1996  christos backout kprintf changes
 1.10  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9  09-Oct-1996  mrg select -> poll
 1.8  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.7  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.6  21-Mar-1996  gwr Fix typo
 1.5  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.4  29-Feb-1996  gwr Add support for CapsLock and NumLock toggles.
 1.3  19-Feb-1996  gwr Attach should get unit from _dev.dv_unit not sc_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 branches: 1.1.1;
Initial revision
 1.1.1.1  24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.14.2.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.3  03-Nov-1997  mellon Pull rev 1.18 up from trunk (gwr)
 1.15.2.2  28-Oct-1997  mellon Pull rev 1.17 up from trunk (gwr)
 1.15.2.1  22-Oct-1997  mellon pull up from main trunk
 1.21.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.22.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.4.1  06-Jun-2002  he Pull up revision 1.30 (requested by pk):
Avoid a NULL pointer dereference if a workstation keyboard is
connected but not configured as the console input device.
 1.27.2.6  11-Nov-2002  nathanw Catch up to -current
 1.27.2.5  18-Oct-2002  nathanw Catch up to -current.
 1.27.2.4  17-Sep-2002  nathanw Catch up to -current.
 1.27.2.3  20-Jun-2002  nathanw Catch up to -current.
 1.27.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.27.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.28.4.2  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.28.4.1  10-Oct-2001  fvdl Convert all remaining devices.
 1.28.2.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.28.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.28.2.2  17-Jun-2002  jdolecek add kqfilter hook, using ev_kqfilter()
 1.28.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1  16-May-2002  gehenna Add the character device switch.
 1.37.2.8  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.37.2.7  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.37.2.6  04-Feb-2005  skrll Sync with HEAD.
 1.37.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.37.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.37.2.2  26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.37.2.1  03-Aug-2004  skrll Sync with HEAD
 1.39.4.1  16-Apr-2005  tron Pull up revision 1.41 (requested by bjh21 in ticket #1075):
Go back to filtering out KBD_IDLE events by default. The Xsun shipped with
NetBSD 2.0 gets confused by them (generating events for keycode 134 when
all keys are released), and even when that's fixed we should keep one release
worth of backward compatibility.
 1.41.4.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.41.4.1  12-Feb-2005  yamt sync with head.
 1.41.2.1  29-Apr-2005  kent sync with -current
 1.43.2.9  01-Oct-2005  tron Pull up following revision(s) (requested by martin in ticket #841):
sys/dev/sun/kbd.c: revision 1.52
Remove spurious debug output accidently commited in revision 1.44.
 1.43.2.8  15-Sep-2005  tron Pull up following revision(s) (requested by martin in ticket #785):
sys/dev/sun/kbd.c: revision 1.51
Ignore KBD_IDLE one layer earlier - wskbd does not like it [and complains
in DEBUG kernels], and we already ignored it for raw mode.
 1.43.2.7  09-Jun-2005  snj Pull up revision 1.50 (requested by martin in ticket #430):
Use KBD_IDLE instead of magic constants
 1.43.2.6  09-Jun-2005  snj Pull up revision 1.49 (requested by martin in ticket #430):
Do not bother to post "keyboard idle" events to userland when we are
in wskbd raw input mode.
 1.43.2.5  09-Jun-2005  snj Pull up revision 1.48 (requested by martin in ticket #380):
Fix indentation.
 1.43.2.4  09-Jun-2005  snj Pull up revision 1.47 (requested by martin in ticket #380):
Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.43.2.3  09-Jun-2005  snj Pull up revision 1.46 (requested by martin in ticket #380):
Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.43.2.2  09-Jun-2005  snj Pull up revision 1.45 (requested by martin in ticket #380):
Add a missing #if to allow non-wscons compilation.
Noted by Juergen Hannken-Illjes.
 1.43.2.1  09-Jun-2005  snj Pull up revision 1.44 (requested by martin in ticket #380):
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.50.2.3  03-Sep-2007  yamt sync with head.
 1.50.2.2  30-Dec-2006  yamt sync with head.
 1.50.2.1  21-Jun-2006  yamt sync with head.
 1.55.14.1  19-Jun-2006  chap Sync with head.
 1.55.8.1  26-Jun-2006  yamt sync with head.
 1.55.6.1  27-May-2006  kardel convert to timecounters
 1.55.4.1  09-Sep-2006  rpaulo sync with head
 1.56.8.1  22-Oct-2006  yamt sync with head
 1.56.6.1  18-Nov-2006  ad Sync with head.
 1.57.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.58.4.1  11-Jul-2007  mjf Sync with head.
 1.58.2.1  01-Jul-2007  ad Adapt to callout API change.
 1.59.28.3  17-Jan-2009  mjf Sync with HEAD.
 1.59.28.2  02-Jun-2008  mjf Sync with HEAD.
 1.59.28.1  03-Apr-2008  mjf Sync with HEAD.
 1.60.2.1  18-May-2008  yamt sync with head.
 1.61.10.1  19-Jan-2009  skrll Sync with HEAD.
 1.61.2.2  16-May-2009  yamt sync with head
 1.61.2.1  04-May-2009  yamt sync with head.
 1.62.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.63.16.2  02-Jun-2012  mrg sync to latest -current.
 1.63.16.1  29-Apr-2012  mrg sync to latest -current.
 1.63.12.2  22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.12.1  23-May-2012  yamt sync with head.
 1.66.4.1  18-May-2014  rmind sync with head
 1.66.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.2.1  10-Aug-2014  tls Rebase.
 1.69.10.1  21-Jan-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #637):

sys/dev/sun/kbd.c: revision 1.71

Fix panic on sun3 when any key is typed when kbd is not console. PR/54873
Should be pulled up to netbsd-9.
 1.69.4.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.69.4.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.70.2.1  25-Jan-2020  ad Sync with head.
 1.71.8.1  21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.72.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed