summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
Commit message (Collapse)AuthorAgeFilesLines
* Disable processing of output data after disabling scroll lock by force.ed2008-08-311-0/+9
| | | | | | | | | | | | | The syscons code disabled scroll lock inside sc_cnputs() if it's going to print a system message. The code currently wants to process any TTY output data as well, but we cannot do this, because the TTY lock is a sleep mutex, while cnputs() picks up a spin mutex. Disable the code for now. It solves a panic when a console message is printed while scroll lock is enabled. One solution would be to initialize a task structure here. Reported by: Paul B. Mahol <onemda gmail com>
* Make syscons(4) use ttyv0 instead of consolectl as its primary window.ed2008-08-241-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I was hacking on uart(4) to make it work with the MPSAFE TTY layer, I noticed there was a difference between the way syscons and uart work with respect to consoles: - The uart(4) driver sets cn_name to the corresponding ttyu%r node, which means init(8) (which opens /dev/console) will have its output redirected to /dev/ttyu%r. After /etc/rc is done, it can spawn a getty on that device node as well. - Syscons used a little different approach. Apart from the /dev/ttyv%r nodes, it creates a /dev/consolectl node. This device node is used by moused and others to deliver their data, but for some reason it also acts as a TTY, which shares its stat structure with ttyv0. This device node is used as a console (run conscontrol). There are a couple advantages of this approach: - Because we use two different TTY's to represent the 0th syscons window, we allocate two sets of TTY buffers. Even if you don't use /dev/consolectl after the system has booted (systems that don't run moused), it seems the buffers are still allocated. - We have to apply an evil hack to redirect input to /dev/consolectl. Because each window (stat) is associated not associated with one TTY, syscons solves this by redirecting all input to closed TTY's to consolectl. This means that opening /dev/ttyv0 while in single user mode will probably cause strange things to happen with respect to keyboard input redirection. The first patch that I discussed with philip@ turned consolectl into a symlink to ttyv0, but this was not a good idea, because in theory we would want consolectl to be a simple device node, which contains all the `privileged' ioctl()'s. Apart from that, it didn't work, because each time /dev/ttyv0 got revoked, moused also lost its descriptor to deliver input, which meant you had to plug out/in your mouse to make it work again. This version just leaves the consolectl device the way it is. It can still be used to write output to ttyv0, but it can no longer receive any input. In my opinion this patch is not a complete solution, but it's already a step in the good direction. It would allow us to turn consolectl into a special (non-TTY) device node in the far future. It shaves off 15 KB of wasted TTY buffer space. Discussed with: philip
* Make sysmouse(4) use its own locks, instead of using Giant.ed2008-08-241-14/+10
| | | | | | | | | | | | | | | | | When I changed syscons(4) to work with the MPSAFE TTY code, I just locked all device nodes down using the compatibility feature that allows you to override the TTY's lock (Giant in this case). Upon closer inspection, it seems sysmouse(4) only has two internal variables that need locking: mouse_level and mouse_status. I haven't done any performance benchmarks on this, though I think it won't have any dramatic improvements on the system. It is good to get rid of Giant here, because the third argument of tty_alloc() has only been added to ease migration to MPSAFE TTY. It should not be used when not needed. While there, remove SC_MOUSE, which is a leftover from the MPSAFE TTY import.
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.ed2008-08-208-311/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* Lower the priority of the sleep in the syscons for "waitvt" wchan tokib2008-08-041-1/+1
| | | | | | | | | PZERO + 1. The sleeping process at the priority <= PZERO is counted as blocked, or, as comment states, 'disk wait'. PZERO + 1 works as well, and does not cause user confusion. Reported by: sam <samflanker at gmail com> MFC after: 1 week
* Introduce a new lock, hostname_mtx, and use it to synchronize accessrwatson2008-07-051-0/+2
| | | | | | | | | | | | to global hostname and domainname variables. Where necessary, copy to or from a stack-local buffer before performing copyin() or copyout(). A few uses, such as in cd9660 and daemon_saver, remain under-synchronized and will require further updates. Correct a bug in which a failed copyin() of domainname would leave domainname potentially corrupted. MFC after: 3 weeks
* The "free-lance" timer in the i8254 is only used for the speakerphk2008-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | these days, so de-generalize the acquire_timer/release_timer api to just deal with speakers. The new (optional) MD functions are: timer_spkr_acquire() timer_spkr_release() and timer_spkr_setfreq() the last of which configures the timer to generate a tone of a given frequency, in Hz instead of 1/1193182th of seconds. Drop entirely timer2 on pc98, it is not used anywhere at all. Move sysbeep() to kern/tty_cons.c and use the timer_spkr*() if they exist, and do nothing otherwise. Remove prototypes and empty acquire-/release-timer() and sysbeep() functions from the non-beeping archs. This eliminate the need for the speaker driver to know about i8254frequency at all. In theory this makes the speaker driver MI, contingent on the timer_spkr_*() functions existing but the driver does not know this yet and still attaches to the ISA bus. Syscons is more tricky, in one function, sc_tone(), it knows the hz and things are just fine. In the other function, sc_bell() it seems to get the period from the KDMKTONE ioctl in terms if 1/1193182th second, so we hardcode the 1193182 and leave it at that. It's probably not important. Change a few other sysbeep() uses which obviously knew that the argument was in terms of i8254 frequency, and leave alone those that look like people thought sysbeep() took frequency in hertz. This eliminates the knowledge of i8254_freq from all but the actual clock.c code and the prof_machdep.c on amd64 and i386, where I think it would be smart to ask for help from the timecounters anyway [TBD].
* Improve VT_WAITACTIVE semantics.bland2008-03-201-13/+6
| | | | | | | | - Wait for requested vty activation regardless its open state. - Remove redundant console cleanup. Approved by: kib MFC after: 1 week
* In keeping with style(9)'s recommendations on macros, use a ';'rwatson2008-03-161-1/+1
| | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink
* Mark the syscons video spin mutex as recursable since it is currentlyjhb2008-02-131-1/+2
| | | | | | recursed in a few places. MFC after: 1 week
* Do not dereference NULL scp in the case the screen is not opened.kib2008-01-241-0/+2
| | | | | | | | Instead, return ENXIO to the ioctl caller. Reported and tested by: Pawel Worach <pawel.worach gmail com> Discussed with: markus MFC after: 3 days
* Replace explicit calls to video methods with their respective variantswkoszek2007-12-2915-127/+108
| | | | | | | | | | | | | | | implemented with macros. This patch improves code readability. Reasoning behind vidd_* is a sort of "video discipline". List of macros is supposed to be complete--all methods of video_switch ought to have their respective macros from now on. Functionally, this code should be no-op. My intention is to leave current behaviour of touched code as is. No objections: rwatson Silence on: freebsd-current@ Approved by: cognet
* Remove explicit calls to keyboard methods with their respective variantswkoszek2007-12-292-48/+28
| | | | | | | | | | | | | | | implemented with macros. This patch improves code readability. Reasoning behind kbdd_* is a "keyboard discipline". List of macros is supposed to be complete--all methods of keyboard_switch should have their respective macros from now on. Functionally, this code should be no-op. My intention is to leave current behaviour of code as is. Glanced at by: rwatson Reviewed by: emax, marcel Approved by: cognet
* Add a new 'why' argument to kdb_enter(), and a set of constants to userwatson2007-12-251-1/+1
| | | | | | | | | for that argument. This will allow DDB to detect the broad category of reason why the debugger has been entered, which it can use for the purposes of deciding which DDB script to run. Assign approximate why values to all current consumers of the kdb_enter() interface.
* Serialize output routine of terminal emulator (te_puts()) by a lock.simokawa2007-09-202-1/+14
| | | | | | | | | | | | | | - The output routine of low level console is not protected by any lock by default. - Increment and decrement of sc->write_in_progress are not atomic and this may cause console hang. - We also have many other states used by emulator that should be protected by the lock. - This change does not fix interspersed messages which PRINTF_BUFR_SIZE kernel option should fix. Approved by: re (bmah) MFC after: 1 week
* Fix a bug that will cause a process that calls the VT_WAITACTIVE ioctlmarcus2007-09-191-2/+1
| | | | | | | | | | | to become unkillable when that process is sent a termination signal. The process will sit in waitvt looping in the kernel, and chewing up all available CPU until the system is rebooted. Submitted by: Jilles Tjoelker <jilles@stack.nl> Reviewed by: bde Approved by: re (kensmith) MFC after: 1 week
* According to the default font size on sparc64 provide a 12 x 22marius2007-06-181-1/+32
| | | | | | | | mouse pointer instead of a 8 x 16 one so device drivers don't need to bring there own one there and in gfb_mouse() (ab)use the pixel_mask argument of putm() to pass along on/off info as erasing the mouse cursor image by redrawing the text underneath doesn't work as we use hardware cursors on sparc64.
* - Change comments and asserts to reflect the removal of the globaljeff2007-06-041-2/+2
| | | | | | | | scheduler lock. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* Make the comparsion more obvious.delphij2007-05-251-1/+2
|
* Optimize set_origin() use in some screensavers to stop them eatingphilip2007-02-214-12/+40
| | | | | | | | cpu power when the origin hasn't changed. PR: kern/100683 Submitted by: Gareth McCaughan <gareth -dot- mccaughan -at- pobox.com> MFC after: 3 days
* Correct the VGA_NO_MODE_CHANGE end marker comment.marius2007-01-101-1/+1
|
* Replace magic numbers for console bell types with defines.ru2006-11-161-2/+2
|
* Sometimes the vty switching has to be delayed; the vtyru2006-11-061-1/+1
| | | | | | | | | | | | | | | | | | to be switched to is saved in sc->delayed_next_scr and the actual switch is performed later. It was possible to get into the endless loop when attempting to switch to a closed vty (which is not allowed and beep-alerted when attempted) and when the visual beep was in effect. This caused sc->delayed_next_scr to never be reset and endless attempts to switch to a closed vty and endless visual beeping. How to repeat: - boot into single-user - run "kbdcontrol -b visual" - quickly press Alt+F2 two times PR: kern/68016 X-MFC after: 6.2-RELEASE
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-062-3/+6
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Fix our ioctl(2) implementation when the argument is "int". Newru2006-09-272-7/+108
| | | | | | | | | | | | | ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
* Introduce a spinlock for synchronizing access to the video output hardwarescottl2006-09-133-19/+38
| | | | | | | | | in syscons. This replaces a simple access semaphore that was assumed to be protected by Giant but often was not. If two threads that were otherwise SMP-safe called printf at the same time, there was a high likelyhood that the semaphore would get corrupted and result in a permanently frozen video console. This is similar to what is already done in the serial console drivers.
* Convert to new console apiphk2006-05-261-19/+11
|
* GC the cn_dbctl_t hook for consoles, it is unused.phk2006-05-261-33/+1
| | | | | | | This used to make syscons switch to vty0 when we entered DDB but this was lost in the KDB shuffle. We may want to bring it back down the road but it should be done by calling cn_init_t/cn_term_t instead, possibly with a flag argument saying "Debugger!"
* APM was calling the suspend process from a timeout. This meant thatimp2006-05-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | other timeouts could not happen while suspending, including timeouts for things like msleep. This caused the system to hang on suspend when the cbb was enabled, since its suspend path powered down the socket which used a timeout to wait for it to be done. APM now creates a thread when it is enabled, and deletes the thread when it is disabled. This thread takes the place of the timeout by doing its polling every ~.9s. When the thread is disabled, it will wakeup early, otherwise it times out and polls the varius things the old timeout polled (APM events, suspend delays, etc). This makes my Sony VAIO 505TS suspend/resume correctly when APM is enabled (ACPI is black listed on my 505TS). This will likely fix other problems with the suspend path where drivers would sleep with msleep and/or do other timeouts. Maybe there's some special case code that would use DELAY while suspending and msleep otherwise that can be revisited and removed. This was also tested by glebius@, who pointed out that in the patch I sent him, I'd forgotten apm_saver.c MFC After: 3 weeks
* Send the pcvt(4) driver off to retirement.phk2006-05-171-1/+0
|
* Check the return code of sc_clean_up() in the only place where itkeramida2006-05-121-1/+3
| | | | | | | | | was not checked at all. There is only one case when sc_clean_up() can fail, because of wait_scrn_saver_stop(), but it doesn't hurt to check anyway. Reviewed by: rodrigc Found by: Coverity Prevent
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-123-18/+4
|
* Integrate kbdmux(4) into syscons(4) and kbd code.emax2006-02-281-4/+42
| | | | | | | | | | | | | | | | | | | | By default syscons(4) will look for the kbdmux(4) keyboard first, and then, if not found, look for any keyboard. Current kbd code is modified so if kbdmux(4) is the current keyboard, all new keyboards are automatically added to the kbdmux(4). Switch to kbdmux(4) can be done at boot time, by loading kbdmux module at the loader prompt, or at runtime, by kldload'ing the kbdmux module and releasing current active keyboard. If, for whatever reason, kbdmux(4) is not required/desired then just do not load it and everything should work as before. It is also possible to kldunload kbdmux at runtime and syscons(4) will automatically switch to the first available keyboard. No response from: freebsd-current@ MFC after: 1 day
* When SC_DISABLE_KDBKEY or SC_DISABLE_REBOOT are not defined allow thebrooks2006-01-141-4/+25
| | | | | | | | | | | | same behavior to be controlled by the sysctls, hw.syscons.kbd_kbdkey and hw.syscons.kbd_reboot respectively. Apologies to the submitter for taking so long to commit this simple change. PR: kern/72728 Submitted by: Luca Morettoni <morettoni at libero dot it> MFC After: 3 days
* Fix -Wundef.ru2005-12-045-8/+8
|
* Add a font width argument to vi_load_font_t, vi_save_font_t and vi_putm_tmarius2005-09-286-26/+31
| | | | | | | | | | | | | | | | and do some preparations for handling 12x22 fonts (currently lots of code implies and/or hardcodes a font width of 8 pixels). This will be required on sparc64 which uses a default font size of 12x22 in order to add font loading and saving support as well as to use a syscons(4)-supplied mouse pointer image. This API breakage is committed now so it can be MFC'ed in time for 6.0 and later on upcoming framebuffer drivers destined for use on sparc64 and which are expected to rely on using font loading internally and on a syscons(4)-supplied mouse pointer image can be easily MFC'ed to RELENG_6 rather than requiring a backport. Tested on: i386, sparc64, make universe MFC after: 1 week
* In set_mouse_pos(), try to avoid division by zero errors.rodrigc2005-09-071-1/+2
|
* In sc_set_text_mode(), reset fontwidth if it is <= 0.rodrigc2005-09-061-0/+2
| | | | | | | | Eliminates division by zero errors in syscons driver. Reported by: keramida, Slawa Olhovchenkov <slw at zxy dot spb dot ru>, Kyryll Mirnenko <mirya at matrix dot kiev dot ua> Tested by: keramida, rodrigc
* Prevent division by zero errors in sc_mouse_move()rodrigc2005-08-305-14/+17
| | | | | | | | | | by explicitly setting sc->font_width, in the same places where sc->font_size is set, instead of relying on the default initialized value of 0 for sc->font_width. PR: kern/84836 Reported by: Andrey V. Elsukov <bu7cher at yandex dot ru> MFC after: 2 days
* kbdmux(4) keyboard multiplexer integrationemax2005-07-131-0/+7
| | | | | | | | | | | | | | | | | | | o Add two new ioctl's KBADDKBD and KBRELKBD. These are used to add and remove keyboard to (and from) kbdmux(4) keyboard multiplexer; o Introduce new kbd_find_keyboard2() function. It does exactly the same job as kbd_find_keyboard() function except it allows to specify starting index. This function can be used to iterate over keyboards array; o Re-implement kbd_find_keyboard() as call to kbd_find_keyboard2() with starting index of zero; o Make sure syscons(4) passed KBADDKBD and KBRELKBD ioctl's onto currently active keyboard. These changes should not have any visible effect. MFC after: 1 week
* Fix syscons on amd64. The SC_PIXEL_MODE commit from May 29th added a newpeter2005-06-142-4/+4
| | | | | | | | | | | | function pointer to the vga render dispatch table and initialized it with vga_nop. The problem is that vga_nop() is a varargs function, and the table declares a non-varargs function pointer. On amd64 (and I think ppc), mixing varargs and non-varargs function pointers is fatal. Change vga_nop() and gfb_nop() from varargs to non-varargs do-nothing functions. This stops the stack corruption that only happened on amd64. Approved by: re (scottl)
* Only set mode when the incoming ioctl is IOC_VOID, until we have betterdelphij2005-06-101-1/+3
| | | | | | | solution against the ioctl collisions. Submitted by: Antoine Brodin <antoine.brodin at laposte net> PR: kern/81867
* Fix LINT by defining vga_pxlmouse_planar and vga_pxlmouse_direct.scottl2005-05-301-1/+2
|
* Deny to switch into banked video mode when it is not available. Somedelphij2005-05-301-1/+2
| | | | | | users has reported corrupted display with old video cards. Submitted by: Michal Mertl <mime traveller cz>
* Add vr_init_t member to sc_rndr_sw_t instances in order to unbreakmarius2005-05-291-0/+3
| | | | compilation after sys/dev/syscons/syscons.h rev. 1.83.
* Add VESA mode support for syscons, which enables the support of 15, 16,delphij2005-05-296-71/+479
| | | | | | | | | | | | | | | | | | | | | 24, and 32 bit modes. To use that, syscons(4) must be built with the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a. vesa.ko) must be either loaded, or be compiled into the kernel. Do not return EINVAL when the mouse state is changed to what it already is, which seems to cause problems when you have two mice attached, and applications are not likely obtain useful information through the EINVAL caused by showing the mouse pointer twice. Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is the video mode number from the vidcontrol -i mode output. Also, revert the video mode if something fails. Obtained from: DragonFlyBSD Discussed at: current@ with patch attached [1] PR: kern/71142 [2] Submitted by: Xuefeng DENG <dsnofe at msn com> [1], Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
* - Not every architecture defaults to a black background (e.g. sparc64marius2005-05-211-9/+9
| | | | | | | uses white) so base the color of the border on SC_NORM_ATTR rather than hardcoding BG_BLACK. - Use SC_DRIVER_NAME rather than hardcoding 'sc' in message strings (see also sys/dev/syscons/syscons.h rev. 1.82).
* On sparc64 use 'syscons' rather than 'sc' for SC_DRIVER_NAME somarius2005-05-211-0/+8
| | | | | | | syscons(4) and its pseudo-devices don't get confused (including by other device drivers) with the system controller devices which are also termed 'sc' in the OFW tree (and which we probably want to interface with hwpmc(4) one day).
* Remove superfluous braces and add #ifndef __sparc64__ around themarius2005-05-211-18/+41
| | | | | | | | VTB_FRAMEBUFFER specific code. On sparc64 we don't use a buffer of type VTB_FRAMEBUFFER (see syscons.c) and excluding the respective code here allows to compile syscons(4) without isa(4). Requested by: joerg, marcel, yongari
OpenPOWER on IntegriCloud