Commit Graph

734 Commits

Author SHA1 Message Date
jmcneill c04c24dbf0 Call cn_halt for old console in wsdisplay_preattach too 2019-07-24 19:40:55 +00:00
rin 80a8c0d4ef Enable us to enter DDB from serial console when WSDISPLAY_MULTICONS
is enabled. This is necessary for machines on which framebuffer
console cannot be disabled at run time.

opt_wsdisplay_compat.h is generated for all ports including those
that do not support wscons.

OK Jared
2019-07-23 17:39:36 +00:00
jmcneill 0d0e1e46ad Call cn_halt on the old console device 2019-07-23 15:55:49 +00:00
ryoon e77d389b55 Do not overflow int64_t on HP Spectre x360 13-inch ae019TU
The machine has pen touch panel with (18344, 10544) -> (3840, 2160)
conversion.
2019-07-09 12:55:45 +00:00
isaki 8931eb3bca Add missing SETBELL() for WSKBDIO_COMPLEXBELL.
wskbd_bell_data structure has value fields and operation bitmask field.
"xset b * * 0" doesn't touch period field (and doesn't initialized it)
and doesn't set DOPERIOD flag (this means that period field should not
be used).  SETBELL() handles this situation appropliately.
This happened during copying wsbell.c from wskbd.c.
Fix PR xsrc/54245.
2019-06-22 08:03:01 +00:00
nonaka 13deebddb0 Added drivers for Hyper-V Synthetic Keyboard and Video device. 2019-05-24 14:28:48 +00:00
isaki e3f9b603a2 Fix the bell period. 2019-04-18 14:01:28 +00:00
isaki 12824b7ed9 White space and indent fix. 2019-04-18 13:01:38 +00:00
tnn 9c1e592a28 allocate wsdisplay type 66 for ssdfb(4) 2019-03-17 00:30:55 +00:00
pgoyette 8c2f80f160 Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
2019-03-01 11:06:55 +00:00
msaitoh ba9226f13c Whitespace change. 2019-02-26 10:30:28 +00:00
mlelstv 3be3d3e247 be consistent in checking cn_getc return value. 2019-02-07 06:10:29 +00:00
mrg 5aac6dba60 - call update_modifier() explicitly for the scrolling keys up event. 2019-02-05 10:04:49 +00:00
mrg fbffadb9f8 - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily
2019-02-03 03:19:25 +00:00
jmcneill f4f87c9927 Suspend multicons output to the old console device while replaying
the vcons msgbuf.
2019-01-30 11:24:48 +00:00
jmcneill d4afd86dec Revert previous as it does not completely solve the problem of detaching a wsdisplay device 2019-01-30 10:54:52 +00:00
jmcneill 5582fd0bcd Remove KASSERT in wsdisplay_cndetach. The caller likely doesn't know the
state of the console, so simply do cleanup if a previous console has been
attached.
2019-01-30 02:43:47 +00:00
pgoyette c1283e70fa Normalize all the compat hooks' names to the form
<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
2019-01-29 09:28:50 +00:00
pgoyette d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
christos 29ca71246d - Use kmem_intr_{alloc,free}, because on time out we need to free from an
interrupt context.
- Remove parens from returns and useless casts from void.
2018-12-15 22:05:23 +00:00
uwe daa7ad8402 #ifdef _KERNEL_OPT 2018-12-06 01:42:20 +00:00
mlelstv 0d215aac02 rasops reused wscons attribute bits for internal control.
- make upper 4 attribute bits available for such use
- use wscons flag names instead of literal constants.
2018-12-04 09:27:59 +00:00
msaitoh 9820da104d Don't abuse config_interrupts()'s first argument. Use kthread instead of
config_interrupt(). OK'd by jmcneill and macallan.
2018-12-01 00:28:45 +00:00
msaitoh 0420beedc7 Remove extra whitespaces. 2018-11-30 05:20:34 +00:00
jmcneill 0c3a3fed64 Add hw.wsdisplay.multicons sysctl that can be used to disable mirroring wsdisplay output to serial port. 2018-11-29 23:18:40 +00:00
jmcneill 5d8748607d WSDISPLAYIO_SFONT: Do not attempt to print to the console in the middle of
resizing when DEBUG is defined.
2018-11-15 13:50:51 +00:00
bouyer 4d36eda8b0 Introduce wsdisplay_isconsole(struct wsdisplay_softc *), which
returns sc->sc_isconsole
2018-09-26 09:04:12 +00:00
mrg 5fd899306d fix wsdisplay/wskbd and cngetc() return value issues:
- return -1 for error / no character
- allow 0 as a character

cngetc() itself considers any value >= 0 valid, and this matches
the usage in other drivers that return -1 for "not data", vs
polling until something arrives.

removes ^G from spewing out the askname/etc prompts when no key
has been pressed (these come from cngetsn(), ignoring unknown
non printable characters.)

from @skrll with help from @mlelstv.
2018-09-18 06:19:28 +00:00
riastradh d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
uwe 4ac70e4d2b timespec_to_timespec50 - don't leak kernel memory in struct padding.
On 64-bit machines struct timespec50 has padding between 32-bit tv_sec
and long tv_nsec that is not affected by normal assignment.  Scrub it.
The result is most likely about to be passed to the user space by the
caller, so do it here to take care of them all.
2018-06-14 10:30:55 +00:00
uwe f946e9bde2 wsevent_copyout_events50 - don't leak garbage from the kernel stack.
On 64-bit machines struct timespec50 has padding between 32-bit tv_sec
and long tv_nsec that is not affected by normal assignment.  Scrub it
before we uiomove struct owscons_event.
2018-06-13 02:09:09 +00:00
uwe 531effc63e PR kern/53245 - support SGR 39 (default foreground) and 49 (background). 2018-06-05 21:11:50 +00:00
khorben a8074f194a Fix spello in a comment 2018-03-10 23:25:59 +00:00
maya abbdd87862 Add Turkish keyboard layout.
from berte in PR kern/53011.
2018-02-19 14:34:17 +00:00
martin 23330eabff Try to fix previous to make it compile. 2018-01-21 10:30:51 +00:00
christos 7501cd820d make check cleaner, and simplify the code. 2018-01-21 01:18:48 +00:00
rin 25b3b2dc56 Correct wrong assertion code introduced by rev 1.41:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/wscons/wsemul_vt100.c#rev1.41

Fix kernel panic reported in PR kern/52935.
2018-01-20 23:27:06 +00:00
christos ff6f120736 ifdef speeding ticket. 2017-12-18 22:44:30 +00:00
jmcneill 409fe00142 Add WSDISPLAY_MULTICONS option which allows wsdisplay to cooperate with
the console device being overridden. This allows for simultaneous console
output on fb and debug uart.
2017-12-18 18:59:32 +00:00
jmcneill 830d1bb205 If the wskbd driver returns type 0, return "no data" from wskbd_cngetc 2017-12-18 18:57:21 +00:00
christos e5e66fc581 use sizeof(*var) instead of sizeof(type) 2017-11-04 01:52:09 +00:00
maya 348d501f38 Remove redundant includes of malloc.h 2017-11-03 19:49:23 +00:00
maya 97aa582348 Use __arraycount a bunch
Also, DIAGNOSTIC panic -> KASSERT
2017-11-03 19:20:27 +00:00
maya e33400acb4 Use M_WAITOK if we aren't going to check for NULL before dereferencing
Same function already uses M_WAITOK unconditionally, so this is a safe change

While here, drop null check of M_WAITOK. it shouldn't fail.
2017-11-03 18:49:37 +00:00
maya dba91e0480 Use c99 initializer for wsemul_ops 2017-11-03 18:42:35 +00:00
maya abe5abe4d9 Don't #ifdef DIAGNOSTIC around KASSERTs.
the definition of KASSERT does the same thing
2017-11-03 17:57:58 +00:00
maya 4ccb5b370b use kmem, don't check for allocation failure with KM_SLEEP 2017-11-03 13:34:56 +00:00
maya 18b796d442 Use C99 initializer for filterops
Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- 	{ a, b, c, d
+ 	{
+ 	.f_isfd = a,
+ 	.f_attach = b,
+ 	.f_detach = c,
+ 	.f_event = d,
};
2017-10-25 08:12:37 +00:00
jmcneill 66995669d3 Instead of a Linux keymap, convert Linux event codes to USB scan codes and
use the ukbd keymaps instead.
2017-08-31 19:55:43 +00:00
jmcneill fd3aded8b4 Add a keymap for converting Linux event codes to wscons keysyms. 2017-08-30 00:39:27 +00:00
jmcneill 9cc94ca9d8 add WSKBD_TYPE_TCAKP for Texas Instruments TCA8418 2017-08-26 21:16:54 +00:00
pgoyette cb952c82da wsbellmux.c doesn't need a needs-flag 2017-06-18 05:57:58 +00:00
nat 0e2e153aff Implement missing ioctls for the default bell. 2017-06-13 05:49:48 +00:00
nat 5e64cb4915 Change sc_dying from u_char to bool. 2017-06-13 00:54:37 +00:00
nat 301cb45f21 Remove dying ftom vb_args and use sc_dying instead. 2017-06-13 00:49:05 +00:00
nat e258f5cee2 Move duplicate definition of SETBELL macro into wsbelldata.h. 2017-06-13 00:42:27 +00:00
pgoyette c381efe7d6 There is no longer a NWSBELL (since nothing depends on it), so there's no
need to #include wsbell.h (which is where it used to be defined, as a
result of a needs-flag in files.wscons).

Remove the #include
2017-06-12 08:19:22 +00:00
pgoyette 645a655791 Revert previous - it's no longer needed since data structure sizes no
longer depend on which wscons child devices exist
2017-06-12 07:12:49 +00:00
pgoyette 1d3c574d62 Always include declarations/definitions for NWSMUX and NWSDISPLAY even
if they aren't needed.  This enables us to have structures of a fixed
size regardless of which child devices are configured, which enables
better modularization.
2017-06-12 07:10:07 +00:00
pgoyette 0725a7c34f Nothing needs the NWSBELL flag, so don't bother creating it 2017-06-12 07:06:45 +00:00
pgoyette 744813ec82 For now, #include wsdisplay.h to get the definition of NWSDISPLAY
The symbol is currently used to conditionally include members of a
data structure, so without this include there could be different
structure definitions, with different sizes, and data corruption is
likely.

XXX For cleaner modularization, all of the needs-flag entries in
XXX wscons should be removed.
2017-06-12 06:59:19 +00:00
pgoyette 18b626fce6 Add module infrastructure for wsbell(4) 2017-06-11 22:14:55 +00:00
nat b377bbb391 New device wsbell - allows for a console beep for non pckbds (usb etc).
Works for platforms without pcppi - can work with spkr at audio and spkr
at pcppi.

To use add the following to your kernel config:
wsbell* at spkr? console?

Ok pgoyette@.
2017-06-11 03:55:56 +00:00
nat 148319a3c6 Seperate the definitions for the console beep. This code will be shared
with a new device.

Ok pgoyette@.
2017-06-11 03:38:12 +00:00
jmcneill b07b4d6982 Add type for ARM PrimeCell PL11x 2017-06-03 14:49:42 +00:00
macallan 9dac688052 - add a cookie to show_screen_cb()
- call show_screen_cb() when loading a font into a visible screen, so this can
  be used to track parameters by drivers that use the glyph cache
2017-06-02 19:33:51 +00:00
macallan 6743ac6be4 make glyph caches reconfigurable 2017-06-02 19:30:10 +00:00
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +00:00
macallan c5fb1a74ab add support for loading fonts in vcons and subsequently resizing screens
- drivers can use this by setting VCONS_LOADFONT and WSSCREEN_RESIZE
- each vcons screen can now have its own font and geometry
- while there, add support for xterm's ESC[18t to report the text buffer's
  size

With this tou can:
wsfontload -N foo  /usr/share/wscons/fonts/flori.816
wsconsctl -dw font=foo
currently this is limited to drivers that don't use the glyph cache, like genfb
2017-05-19 19:22:33 +00:00
macallan 5d27161240 properly optimize drawing stretches of blanks that are interrupted only by
a change in background colour or flags
2017-04-26 21:03:52 +00:00
macallan 07d3115680 don't forget to store bounds rectangle in raw mode 2017-04-06 20:44:39 +00:00
macallan 9afb5f0fb5 add fbinfo flag for wildcat split framebuffer workaround 2017-03-24 00:45:27 +00:00
jakllsch a943ceca49 Double size of WSDISPLAYIO_SFONT name buffer to 32 characters.
We've got a font known as "DejaVu Sans Mono", and that is 17 bytes
by the time it's NUL terminated.
2017-01-25 15:40:31 +00:00
christos 995970bea7 Needed <sys/time.h> that it got in the past by side-effect loading
of <sys/stat.h> from <fcntl.h>. Go figure.
2017-01-10 20:08:52 +00:00
christos c57a477f70 remove VAUDIOSPEAKER, needs to be done differently. 2016-12-10 22:36:28 +00:00
nat 03783bb56a Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
2016-12-08 11:31:08 +00:00
msaitoh 8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
macallan c21ade0ee3 add WSDISPLAY_TYPE_PLATINUM, for platinumfb 2016-06-10 21:26:43 +00:00
macallan b45b59eb74 provide a default attribute 2016-06-02 21:17:14 +00:00
christos c6f31c2045 Untangle. 2015-11-08 16:49:41 +00:00
christos c47f805a35 PR/50413: Vicente Chaves: Check the allocattr return and return an error. 2015-11-08 16:49:20 +00:00
dholland 1fbab01a93 More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
2015-09-06 06:00:59 +00:00
pooka d8e04c9094 to garnish, dust with _KERNEL_OPT 2015-08-24 22:50:32 +00:00
christos e7ae23fd9e include "ioconf.h" to get the 'void <driver>attach(int count);' prototype. 2015-08-20 14:40:16 +00:00
mlelstv 80529807e9 use optimized refresh with VCONS_DRAW_INTR even when in polling mode. 2015-07-19 13:22:42 +00:00
jmcneill d490219c31 add WSDISPLAY_TYPE_TEGRA 2015-05-18 14:27:49 +00:00
jmcneill b9f35a65b7 add WSDISPLAY_TYPE_MESON 2015-03-20 21:42:31 +00:00
christos ca77f03d28 add MGX 2015-01-06 19:19:10 +00:00
christos f44f27dc8e tab police 2015-01-06 19:18:21 +00:00
ozaki-r 433c9fcdef Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.

Discussed with martin@ and riastradh@.
2014-11-16 16:20:00 +00:00
jmcneill 0d06f659c0 allocate char and attr buffers with M_ZERO 2014-11-10 20:52:47 +00:00
jmcneill 8bac408286 add WSDISPLAY_TYPE_ALLWINNER 2014-11-09 14:33:21 +00:00
uebayasi 68083a77ea Give up making wscons modular for now.
My intent is to make "no" handle dependency right so that you can simplely do:

no wsdisplay*
2014-10-17 10:09:21 +00:00
uebayasi d424d94564 Normalize wscons devices (except leaving one strange definition). 2014-10-10 17:53:08 +00:00
dholland f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
dholland a68f9396b6 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.
2014-03-16 05:20:22 +00:00
khorben 4a9c7f6c2b Fixed wrong cast and invalid array access in the calibration framework, as
documented in PR kern/45872. The AA() macro accessed sample coordinates as
long integers, whereas they are really stored as signed integers.

Fixes calibration on my Wetab device.
2014-03-14 05:03:19 +00:00
mlelstv 5fe0c7679f fix build 2014-01-21 00:36:11 +00:00
mlelstv 4066bef8de keep track of VCONS_DRAW_INTR screen cache also in erasecols/rows and
copycols/rows methods.
2014-01-21 00:10:46 +00:00