Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/luna68k/dev/lunaws.c
RevisionDateAuthorComments
 1.42  15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.41  25-Jun-2022  tsutsui Add rnd(9) entropy source from keyboard and mouse.
 1.40  09-Oct-2021  tsutsui Handle wskbd(9) .set_leds op in cngetc(9) using wskbd_cnattach(9) cookie.

XXX1: LUNA's keyboards emulate "mechanical lock" for CAP and Kana keys,
i.e. it sends "DOWN" code only when CAP/Kana LEDs are turned on
and send "UP" code only when the LEDs are turned off.
The MD omkbd_input() via wskbd_input(9) for the normal wskbd(4)
(i.e. ttyE0) devices handles this quirk, but MI wskbd_cngetc()
in sys/dev/wscons/wskbd.c can do nothing for this.

XXX2: I wonder if we should have an independent .set_leds op for cons(9)
as cnbell(9), rather than referring a device specific softc stuff
during .set_leds op in struct wskbd_accessop (registered during
autoconf(9) via struct wskbddev_attach_args passed to config_found(9))
even for wskbd cngetc(9) op in struct wskbd_consops (registered
via early wskbd_cnattach(9)).
 1.39  25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.38  20-Sep-2021  tsutsui Add a comment that .set_leds function won't work correctly on cngetc(9).

I'm afraid all other keyboard drivers that have .set_leds function
(like sgimips/dev/zs_kbd.c) have the same issue.
Maybe we needs 'polled' flag in .set_leds function, or an independent
.set_leds accessop in struct wskbd_consops for cons(9).
 1.37  19-Sep-2021  tsutsui Use more C99 designated initializer.
 1.36  19-Sep-2021  tsutsui Handle CAP and Kana modifier key specification quirk of LUNA's keyboard.

LUNA's keyboard doesn't send any keycode when these modifier keys are
released. Instead, it sends a pressed or released code per how each
modifier LED status will be changed when the modifier keys are pressed.
To handle this quirk in MI wskbd(4) layer, we have to send a faked
"pressed and released" sequence on passing keycodes to wskbd_input(9).

Tested on LUNA both on ttyE0 and WSKBD_RAW mode (on Xorg server).
 1.35  18-Sep-2021  tsutsui Implement transmitting keyboard LED and buzzer control commands.

- enable TX on uPD7201 for keyboard port
- prepare TX queue and handle it in hardware interrupt and softint(9)
- send proper LED commands on WSKBDIO_SETLEDS
(XXX: KANA LED is not handled in wscons)
- return current LED settings on WSKBDIO_GETLEDS
- implement WSKBDIO_COMPLEXBELL by parsing struct wskbd_bell_data and
send proper buzzer commands
- handle pitch, period, and volume in cnbell(9)
(XXX: no description in cnbell(9) man pages)
- use proper queued TX function for omms_enable() and omms_disable()
- add DPRINTF()s for debug
- use C99 designated initializer and misc cosmetics

Tested on LUNA and its keyboard (3W4SD-098NDT).
 1.34  04-Sep-2021  tsutsui Ignore mouse packets properly even if wsmouse(4) isn't configured.

The internal state of wskbd(4) could be mangled if mouse (which was
connected behind keyboard) was enabled by unexpected keyboard reset.
This could happen on the INSTALL kernel (no wsmouse(4) on it).

Based on a patch from moveccr, with several tweaks by me.
 1.33  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.32  24-Apr-2021  thorpej branches: 1.32.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.31  21-Aug-2015  christos branches: 1.31.32;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.30  20-Jul-2014  tsutsui branches: 1.30.4;
Pull LUNA's keyboard driver changes from OpenBSD/luna88k.

- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values

Now LUNA's keyboard works on Xorg server without tweaks by xmodmap(1) etc.
 1.29  18-Jul-2014  tsutsui Minor KNF. No binary changes.
 1.28  02-Feb-2014  tsutsui branches: 1.28.2;
Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.27  23-Sep-2013  tsutsui Tab/space cleanup.
 1.26  14-May-2013  tsutsui branches: 1.26.2;
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
 1.25  13-Oct-2012  tsutsui struct device * -> device_t, use device_xname() (from chs@)
 1.24  16-Jul-2012  tsutsui branches: 1.24.2;
Use & not && to mask bits. From OpenBSD/luna88k
 1.23  27-Jul-2011  tsutsui branches: 1.23.2; 1.23.8;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.22  27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.21  21-Jul-2011  tsutsui Add and return WSKBD_TYPE_LUNA and WSDISPLAY_TYPE_LUNA on WS*_GTYPE ioctls.

XXX: should we still sync <sys/dev/wsconsio.h> and src/sbin/wsconsctl/util.c?
 1.20  26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.19  18-Mar-2009  cegger bcopy -> memcpy
 1.18  18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.17  14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.15  13-Jun-2008  cegger branches: 1.15.4; 1.15.10;
use device_lookup_private to get softc
 1.14  28-Apr-2008  martin branches: 1.14.2; 1.14.4;
Remove clause 3 and 4 from TNF licenses
 1.13  04-Mar-2007  christos branches: 1.13.40; 1.13.42; 1.13.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12  12-Nov-2006  plunky branches: 1.12.4;
Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.11  11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10  28-Jun-2005  drochner branches: 1.10.2;
convert remaining autoconf bus "submatch" functions to use the new
signature (passing locators), and remove some which obviously don't
serve any purpose
(untested, sorry)
 1.9  02-Oct-2002  thorpej branches: 1.9.6;
Use CFATTACH_DECL().
 1.8  27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.7  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.6  17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.5  19-Oct-2000  nisimura branches: 1.5.2; 1.5.6; 1.5.10;
Fix errors in mouse event handling;
- convert LMR bit pattern into RML since wsevent counts 0 for the leftmost
mouse button.
- found hardware reports mouse button state in negated.
 1.4  14-Jan-2000  nisimura Fix an argument error of wsmouse_input() call.
 1.3  12-Jan-2000  nisimura - Fix an error in clearing entire screen.
- Add 3 byte long mouse event parsing.
- Fix errors in comments.
 1.2  07-Jan-2000  nisimura - Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1  05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.5.10.2  18-Oct-2002  nathanw Catch up to -current.
 1.5.10.1  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.6.2  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.5.6.1  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.2  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.5.2.1  19-Oct-2000  bouyer file lunaws.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.9.6.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.1  25-Jan-2005  skrll Adapt to branch.
 1.10.2.3  03-Sep-2007  yamt sync with head.
 1.10.2.2  30-Dec-2006  yamt sync with head.
 1.10.2.1  21-Jun-2006  yamt sync with head.
 1.11.22.1  10-Dec-2006  yamt sync with head.
 1.11.20.1  18-Nov-2006  ad Sync with head.
 1.12.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.13.44.3  11-Mar-2010  yamt sync with head
 1.13.44.2  04-May-2009  yamt sync with head.
 1.13.44.1  16-May-2008  yamt sync with head.
 1.13.42.2  17-Jun-2008  yamt sync with head.
 1.13.42.1  18-May-2008  yamt sync with head.
 1.13.40.2  29-Jun-2008  mjf Sync with HEAD.
 1.13.40.1  02-Jun-2008  mjf Sync with HEAD.
 1.14.4.1  18-Jun-2008  simonb Sync with head.
 1.14.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.15.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.4.1  28-Apr-2009  skrll Sync with HEAD.
 1.23.8.3  09-Nov-2014  msaitoh Pull up following revision(s) (requested by tsutsui in ticket #1182):
sys/arch/luna68k/conf/files.luna68k: revision 1.24
sys/arch/luna68k/conf/GENERIC: revision 1.113 via patch
sys/arch/luna68k/dev/omrasops.c: revision 1.17-1.19
sys/arch/luna68k/dev/lunaws.c: revision 1.30
sys/arch/luna68k/dev/omkbdmap.c: revision 1.1-1.2
sys/arch/luna68k/dev/omkbdmap.h: revision 1.1
sys/arch/luna68k/dev/lunafb.c: revision 1.31-1.36
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.3
- Setup Bt458 color palette to support ANSI color text on 8bpp framebuffer.
Mostly taken from OpenBSD/luna88k. Also sync some comments.
Tested on LUNA-II, and mlterm-fb with 8bpp wallpaper also works fine.
Thanks to Kenji Aoyama (OpenBSD/luna88k maintainer) for providing
his spare 8bpp board.
- Use C99 struct initialization for wsdisplay_accessops.
- Use kmem(9) instead of malloc(9).
- Pull LUNA's keyboard driver changes from OpenBSD/luna88k. Now LUNA's
keyboard works on Xorg server without tweaks by xmodmap(1) etc.
- split keyboard mapping definitions to new files, omkbdmap.[ch]
- add WSDISPLAY_COMPAT_RAWKBD support
(actually the name is wrong; it doesn't emit raw keycode but
converts MD code into PS/2 one as "raw keycode on x86" for Xorg server)
- allow to enter into ddb by CTRL+ALT(zenmen)+ESC
- remove unnecessary return values
- Add consistent prefix to a softc member name.
- Implement WSDISPLAYIO_SMODE ioctl for proper mmap and colormap handling.
Tested on LUNA with 4bpp framebuffer.
- allow mmap framebuffer memories only in WSDISPLAYIO_DUMBFB
- initialize palette for ANSI text colors on back to WSDISPLAYIO_MODE_EMUL
- Pull readability changes from OpenBSD/luna88k.
Tested on LUNA-II with 8bpp framebuffer.
- prepare and use unpack_attr() function to get fg and bg from attribute
- use proper variable names to clarify meanings
- Put dumb optimizations to avoid conditionals in putchar drawing loops.
~10% improvements of time cat results on LUNA-II 8bpp framebuffer.
- Fix unintended RCS Id substitution.
- Pull LUNA's framebuffer improvements by Kenji Aoyama from OpenBSD/luna88k.
This Makes 4bpp wscons putchar ~30% on LUNA-II.
http://marc.info/?l=openbsd-cvs&m=141199909120631&w=2
> Use raster(logic) operation, or ROP, function on LUNA frame buffer.
> It makes 4bpp wscons putchar ~20% faster.
Also use the similar ROP in 1bpp putchar and cursor functions
and the 1bpp putchar is also ~5% faster.
While here, reduce diffs from OpenBSD a bit.
Tested on all 1bpp/4bpp/8bpp framebuffers.
- Add options WSDISPLAY_COMPAT_RAWKBD for Xorg server.
 1.23.8.2  12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.23.8.1  25-Jul-2012  martin Pull up following revision(s) (requested by tsutsui in ticket #444):
sys/arch/luna68k/conf/GENERIC: revision 1.99
sys/arch/luna68k/dev/lunafb.c: revision 1.26
sys/arch/luna68k/luna68k/locore.s: revision 1.48
sys/arch/luna68k/dev/lunaws.c: revision 1.24
sys/arch/luna68k/dev/omron_rfont.h: file removal
sys/arch/luna68k/dev/omrasopsvar.h: revision 1.1
sys/arch/luna68k/dev/omrasops.c: revision 1.12
sys/arch/luna68k/dev/omrasops.c: revision 1.13
sys/arch/luna68k/conf/INSTALL: revision 1.6
Use & not && to mask bits. From OpenBSD/luna88k
Fix typo in comment. From OpenBSD/luna88k.
Switch luna68k wscons framebuffer driver to using rasops(9) APIs instead of
deprecated rcons(4). This allows "options FONT_foo" in kernel config files.
Mostly taken from OpenBSD/luna88k, but unnecessary MI rasops(9) stuff is
omitted since omrasops.c has own raster wsdisplay_emulops functions.
Tested on LUNA with 4bpp fb and LUNA-II with 1bpp fb.
Make reboot(2) actually work (don't access %sp after MMU is turned off).
Also cleanup spaces and #if 0'ed code. Tested on both LUNA and LUNA-II.
Should be pulled up to netbsd-6.
 1.23.2.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.23.2.1  30-Oct-2012  yamt sync with head
 1.24.2.4  03-Dec-2017  jdolecek update from HEAD
 1.24.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.24.2.2  23-Jun-2013  tls resync from head
 1.24.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.26.2.1  18-May-2014  rmind sync with head
 1.28.2.1  10-Aug-2014  tls Rebase.
 1.30.4.1  22-Sep-2015  skrll Sync with HEAD
 1.31.32.1  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.32.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed