Commit Graph

130 Commits

Author SHA1 Message Date
drochner
6d35fa3886 give up some silly macros which were only used ~once, and reduce
dependency on "locators.h"
makes the code more LKM frienly
2010-02-02 16:54:40 +00:00
drochner
1921d00aaf add hooks to allow terminal emulations to be installed by LKMs
(these are not available in early bootstrap, so this is not an
option for the system's default emulation)
2010-02-02 16:18:29 +00:00
drochner
25fb8de00b -rename the "KS_GROUP_Ascii" key symbol category to "Plain" because
this is what it meant all the time -- it includes characters >127
-delegate translation of all key symbols >127 to the terminal emulation
 layer -- formerly everything non-special was passed to the tty subsystem
 directly, involving truncation to a "char", which effectively meant
 some ISO-1 assumption
2010-01-28 22:36:19 +00:00
dyoung
3022acc4eb Expand PMF_FN_* macros. 2010-01-08 19:42:11 +00:00
drochner
cf45120117 Avoid deadlock in tty code if a terminal emulation responds to
type/status/etc inquiries. (PR kern/37915)
This is clearly a design problem in tty, but we need a cheap fix now.
The problem is that ttyinput() tries to pull a spinlock which
is already held on calls to t_oproc.
The workaround is based on the fact that within wscons code, the
wsdisplay_emulinput() function is only called directly from
wsdisplaystart(). So we can be sure that the tty lock is held,
and use an inofficial entry point in ttc.c which avoids the locking.
These ate certainly more assumptions than needed by the fix
proposed in the PR, but it doesn't affect (and slow down) other
tty drivers.
2009-01-22 20:40:20 +00:00
yamt
0915dface4 - reduce the number of #ifdefs.
- build compat glues if MODULAR.
2009-01-15 04:22:11 +00:00
christos
8945a0f495 provide wscons_event compatibility with 5.0. 2009-01-13 18:05:55 +00:00
he
761f38db5c In wsdisplay_kbdholdscreen(), just return if sc->sc_focus is NULL.
There is apparently no guarantee sc->sc_focus will be non-NULL,
as proved by a crash I experienced earlier today (admittedly on 4.0.1).
2008-11-07 19:33:13 +00:00
cegger
ee1dc8ea5f use device_lookup_private to get softc
use device_lookup to get device_t
2008-06-12 23:04:37 +00:00
cegger
7028bd34e9 use device_lookup_private to get sc
ok cube
2008-06-11 16:17:01 +00:00
cube
d94699ecbb Split device_t and softc for wskbd(4), wsmouse(4) and that creepy wsmux(4). 2008-03-25 00:49:19 +00:00
drochner
3678498d59 -add a function to vga_post which can be called from DDB to get a
usable VGA console ("call ddb_vgapost")
-allow to switch from/to screens occupied by an X server if the graphics
 device is console and in polling mode (ie DDB)
This together allows to get a DDB session on a VGA console if the
system crashed while X11 was running.
As long as the protocol to tell X servers about virtual screen switches
is as primitive as it is, it is unsafe to restart an X session afterwards.
So this is basically for crash analysis.
2008-03-12 23:26:18 +00:00
dyoung
f580a3a869 Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:13:39 +00:00
drochner
0c3c5106cb -Don't detach/attach the X server in the pmf suspend/resume functions
which are called somewhere in the middle of system suspend. Since the
 X server accesses hardware directly it is outside our control whether
 the devices it accesses are already/still suspended or not, so the only
 way is to detach it before any device suspends and re-attach after
 everything is awake again.
-For that, export a function ("wsdisplay_handlex" for now) which is
 to be called from central suspend/resume code.
-The right way to handle the (normally impossible) case that the X
 server is not detached on suspend is to return an error which should
 abort the suspend process. pmf doesn't yet handle errors of device
 suspend handlers, so as a temporary measure try to suspend anyway,
 to get at least a text console.
-Improve error handling of X server attach/detach and maintain a flag
 which tracks whether the X server is really active.
2008-02-20 22:33:18 +00:00
drochner
85b70008e0 make the mutex securing a flag which controls screen switched adaptive
for sanity -- it is not yet in a code path which is called from
keyboard interrupt handlers
2008-02-13 19:01:35 +00:00
drochner
84c211c56c On suspend/resume, just detach/attach the X server (or whatever might
be using the "syncops" protocol) rather than doing a full switch
to virtual screen 1. The latter doesn't have the expected result if
the X server is running on screen 1, and is too much policy for inside
the kernel anyway.
Introduce a mutex+condvar to synchronize these operations, to replace
the spltty()/tsleep(). (for now only used by the new functions,
should be extended to the normal vt switching code)
2008-01-14 21:38:50 +00:00
joerg
1c47f4bb86 Switch to console on suspend and shutdown, switch back to where the
system was before on resume. This is the second attempt and got more
complicated due to the async nature of VT_ACTIVE. After the initial
switch, check that we ended up on the first screen and if not, wait for
the switch to happen.
2007-12-13 15:14:48 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad
dc26833bb6 - Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
2007-11-19 18:51:36 +00:00
joerg
6c51962b6c Calling device_private once is enough. Reported by macallan@ 2007-10-18 21:08:18 +00:00
joerg
d238692c3e Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
2007-10-18 18:54:56 +00:00
joerg
e4a56b252c Use aprint API for output and convert to device_t/softc separation. 2007-10-18 18:09:52 +00:00
drochner
9916a76d2e It was probably not a good idea to put that scroll stuff to accessops.
But now that it is there, keep it from crashing the box if there is
no valid focus screen.
2007-03-05 16:06:52 +00:00
christos
53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
macallan
1009b21c56 add wsdisplay_preattach() to attach an early console that can be overridden
by wsdisplay_cnattach() for instance when a hardware-specific display driver
attaches.
as discussed on tech-kern
2006-11-06 19:51:12 +00:00
dogcow
372e6ef309 now that we have -Wno-unused-parameter, back out all the tremendously ugly
code to gratuitously access said parameters.
2006-10-17 18:21:29 +00:00
dogcow
2023789a40 More -Wunused fallout. sprinkle __unused when possible; otherwise, use the
do { if (&x) {} } while (/* CONSTCOND */ 0);
construct as suggested by uwe in <20061012224845.GA9449@snark.ptc.spbu.ru>.
2006-10-13 16:53:35 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
elad
bdc51baebb Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!
Also, add forgotten splx() calls in some places.
2006-10-01 19:28:43 +00:00
ad
3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
drochner
270bc37d08 add a missing splx() in an error path 2006-06-28 16:19:01 +00:00
elad
2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
jmmv
aec18036fd Remove the getwschar and putwschar accessops from wsdisplay drivers as
requested by uwe@.  These were wrong because they were receiving an
emulcookie yet they were accessops (thus having to receive an accesscookie).
Instead, just handle the WSDISPLAYIO_{GET,PUT}WSCHAR ioctls from the
driver's ioctl accessop.

As this reduces the amount of code needed to handle these operations to
two small functions in each driver, remove the WSDISPLAY_CHARFUNCS kernel
option.

Reviewed by, at least, uwe@ and macallan@.  No objections in tech-kern@.
2006-04-15 17:48:23 +00:00
macallan
767a272758 pass the right cookie to ioctl() and mmap() instead of struct wsscreen * 2006-04-13 01:15:27 +00:00
macallan
9ba325f38a correct typo 2006-04-12 20:13:21 +00:00
jmmv
7a51d4dddc Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called.  The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place.  There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
2006-04-12 19:38:22 +00:00
drochner
5b4dd527c3 Use the existing ioctl path to call WSDISPLAYIO_GBORDER/WSDISPLAYIO_SBORDER
instead of a separate accessops entry. There is no need to introduce bloat
for the majority of drivers which don't implement this feature.
This should also resolve PR kern/33186 by Valeriy E. Ushakov.
2006-04-05 15:18:25 +00:00
thorpej
2be6494fc9 Use device_cfdata(). 2006-03-29 04:16:44 +00:00
thorpej
39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
christos
1b2709754a cleanup more SET/CLR/ISSET lossage 2006-03-05 17:33:33 +00:00
jmcneill
4baf344378 Bunch of changes to wscons in preparation for splash screen support:
* Add WSDISPLAY_TYPE_VESA for vesafb. While here, fix a typo in a comment.
 * Add WSDISPLAYIO_SSPLASH and WSDISPLAYIO_SPROGRESS ioctls. The former
   toggles the splash screen on and off, and the latter updates the progress
   animation.
 * Prevent more than one hw driver from claiming to be the console.
 * In vcons, keep two pointers to the screen's vcons_data. This lets us
   override the original (ie with null emulops during boot), and restore
   them later on.
2006-02-18 18:56:05 +00:00
jmmv
ddaa1b349e wsevent cleanup:
- Add a wsevent_inject function that atomically adds a set of events to an
  event queue and change all code that directly messed with a queue to use it.
- Replace the WSEVENT_WAKEUP macro with a regular function.
- Make WSEVENT_QSIZE, PWSEVENT and splwsevent private definitions to
  wsevent.c, instead of exposing them in the header file.
- Make the wsevent_init function take a process to attach to the queue,
  instead of leaving this task to the caller (which always did it).

Reviewed in tech-kern@.
2006-02-07 09:13:02 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
simonb
a21c456e2e Call nanotime() directly, instead of doing the
microtime()/TIMEVAL_TO_TIMESPEC() dance.
2005-11-11 07:07:42 +00:00
kleink
aece7a90fd 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.
2005-09-06 21:40:37 +00:00
ws
9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
christos
f90bcf3a23 - sprinkle const.
- avoid variable shadowing.
2005-05-29 21:56:35 +00:00
perry
f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
jmmv
2a08d54a9a Implement border color customization in wscons(4), only available for vga(4)
at the moment.

This includes the addition of two new wsdisplay ioctls, WSDISPLAY_{G,S}BORDER,
one to get the actual color and one to set it, respectively.  Possible colors
match those defined by ANSI (and listed in wsdisplayvar.h).

It also adds two accessops to the underlying graphics device, getborder and
setborder, which mach their ioctl counterparts.

Two kernel options are added: WSDISPLAY_CUSTOM_BORDER, which enables the
ioctls described above (to customize the border color from userland after
boot), and WSDISPLAY_BORDER_COLOR, which sets the color at boot time.
The former is enabled by default on the GENERIC kernel, but not on INSTALL
(among others).  The later is always commented out, leaving the usual black
border as a default.

wsconsctl is modified to allow accessing this value easily.  For example,
'wsconsctl -d -w border=blue'.
2004-07-29 22:29:35 +00:00