summaryrefslogtreecommitdiff
path: root/include/linux/tty.h
AgeCommit message (Collapse)Author
2006-03-23[PATCH] sem2mutex: ttyIngo Molnar
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-10[PATCH] tty buffering stall fixPaul Fulghum
Prevent stalled processing of received data when a driver allocates tty buffer space but does not immediately follow the allocation with more data and a call to schedule receive tty processing. (example: hvc_console) This bug was introduced by the first locking patch for the new tty buffering. Signed-off-by: Paul Fulghum <paulkf@microgate.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-03[PATCH] new tty buffering locking fixPaul Fulghum
Change locking in the new tty buffering facility from using tty->read_lock, which is currently ignored by drivers and thus ineffective. New locking uses a new tty buffering specific lock enforced centrally in the tty buffering code. Two drivers (esp and cyclades) are updated to use the tty buffering functions instead of accessing tty buffering internals directly. This is required for the new locking to work. Minor checks for NULL buffers added to tty_prepare_flip_string/tty_prepare_flip_string_flags Signed-off-by: Paul Fulghum <paulkf@microgate.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-10[PATCH] TTY layer buffering revampAlan Cox
The API and code have been through various bits of initial review by serial driver people but they definitely need to live somewhere for a while so the unconverted drivers can get knocked into shape, existing drivers that have been updated can be better tuned and bugs whacked out. This replaces the tty flip buffers with kmalloc objects in rings. In the normal situation for an IRQ driven serial port at typical speeds the behaviour is pretty much the same, two buffers end up allocated and the kernel cycles between them as before. When there are delays or at high speed we now behave far better as the buffer pool can grow a bit rather than lose characters. This also means that we can operate at higher speeds reliably. For drivers that receive characters in blocks (DMA based, USB and especially virtualisation) the layer allows a lot of driver specific code that works around the tty layer with private secondary queues to be removed. The IBM folks need this sort of layer, the smart serial port people do, the virtualisers do (because a virtualised tty typically operates at infinite speed rather than emulating 9600 baud). Finally many drivers had invalid and unsafe attempts to avoid buffer overflows by directly invoking tty methods extracted out of the innards of work queue structs. These are no longer needed and all go away. That fixes various random hangs with serial ports on overflow. The other change in here is to optimise the receive_room path that is used by some callers. It turns out that only one ldisc uses receive room except asa constant and it updates it far far less than the value is read. We thus make it a variable not a function call. I expect the code to contain bugs due to the size alone but I'll be watching and squashing them and feeding out new patches as it goes. Because the buffers now dynamically expand you should only run out of buffering when the kernel runs out of memory for real. That means a lot of the horrible hacks high performance drivers used to do just aren't needed any more. Description: tty_insert_flip_char is an old API and continues to work as before, as does tty_flip_buffer_push() [this is why many drivers dont need modification]. It does now also return the number of chars inserted There are also tty_buffer_request_room(tty, len) which asks for a buffer block of the length requested and returns the space found. This improves efficiency with hardware that knows how much to transfer. and tty_insert_flip_string_flags(tty, str, flags, len) to insert a string of characters and flags For a smart interface the usual code is len = tty_request_buffer_room(tty, amount_hardware_says); tty_insert_flip_string(tty, buffer_from_card, len); More description! At the moment tty buffers are attached directly to the tty. This is causing a lot of the problems related to tty layer locking, also problems at high speed and also with bursty data (such as occurs in virtualised environments) I'm working on ripping out the flip buffers and replacing them with a pool of dynamically allocated buffers. This allows both for old style "byte I/O" devices and also helps virtualisation and smart devices where large blocks of data suddenely materialise and need storing. So far so good. Lots of drivers reference tty->flip.*. Several of them also call directly and unsafely into function pointers it provides. This will all break. Most drivers can use tty_insert_flip_char which can be kept as an API but others need more. At the moment I've added the following interfaces, if people think more will be needed now is a good time to say int tty_buffer_request_room(tty, size) Try and ensure at least size bytes are available, returns actual room (may be zero). At the moment it just uses the flipbuf space but that will change. Repeated calls without characters being added are not cumulative. (ie if you call it with 1, 1, 1, and then 4 you'll have four characters of space. The other functions will also try and grow buffers in future but this will be a more efficient way when you know block sizes. int tty_insert_flip_char(tty, ch, flag) As before insert a character if there is room. Now returns 1 for success, 0 for failure. int tty_insert_flip_string(tty, str, len) Insert a block of non error characters. Returns the number inserted. int tty_prepare_flip_string(tty, strptr, len) Adjust the buffer to allow len characters to be added. Returns a buffer pointer in strptr and the length available. This allows for hardware that needs to use functions like insl or mencpy_fromio. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Hirokazu Takata <takata@linux-m32r.org> Signed-off-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: John Hawkes <hawkes@sgi.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08[PATCH] Split out screen_info from tty.hBrian Gerst
This makes it possible for boot code to use screen_info without dragging in all of tty.h. Signed-off-by: Brian Gerst <bgerst@didntduck.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-09[PATCH] vesafb: Add blanking supportAntonino A. Daplas
Add rudimentary support by manipulating the VGA registers. However, not all vesa modes are VGA compatible, so VGA compatiblity is checked first. Only 2 levels are supported, powerup and powerdown. Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-23[PATCH] Introduce tty_unregister_ldisc()Alexey Dobriyan
It's a bit strange to see tty_register_ldisc call in modules' exit functions. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-10-20Update tty layer to not mix kernel and user pointers.Linus Torvalds
Instead, tty_io.c will always copy user space data to kernel space, leaving the drivers to worry only about normal kernel buffers. No more "from_user" flag, and having the user copy in each driver. This cleans up the code and also fixes a number of locking bugs.
2004-10-02[PATCH] Update termios to use per tty semaphoreAlan Cox
This makes the agreed change of termios locking to be semaphore based sleep locking. This is needed for USB in particular as it has to use messaging to issue terminal mode changes. This code passes Torvalds test grades 0, 1 and 2 (it looks ok, it compiles and it booted). It does mean that a driver cannot take an atomic peek at termios data during an interrupt. Nobody seems to be doing this although some of the driver receive paths for line disciplines will eventually want to (n_tty currently doesn't do this locked on the receive path). Since the ldisc is given a chance to copy any essential bits on the ->set_termios path this seems not to be a problem.
2004-09-29[PATCH] tty locking cleanup and fixesAlan Cox
No problems reported other than Linus typo in an unbuildable driver from the last one. This one adds tty_ldisc_flush and also makes tty_wakeup do the queue wake as discussed with Paul. I've then propagated these functions through all the drivers. This means most drivers don't know about the ldisc locking and instead call generic functions that look after it. The result is the removal of a lot of duplicate code both for ldisc referencing and historical code for handling tty ldisc wakeup semantics. A nice side effect is that by adding versions of the two helpers we can switch most of the drivers over before changing the core tty code if preferred. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2004-05-09[PATCH] mips: remove VIDEO_TYPE_SNI_RMAndrew Morton
From: Ralf Baechle <ralf@linux-mips.org> The RM200's onboard video really is a plain old boring Cyrix PCI card.
2004-04-11[PATCH] Fix VT open/close raceAndrew Morton
The race is that con_close() can sleep, and drops the BKL while tty->count==1. But another thread can come into init_dev() and will take a new ref against the tty and start using it. But con_close() doesn't notice that new ref and proceeds to null out tty->driver_data while someone else is using the resurrected tty. So the patch serialises con_close() against init_dev() with tty_sem. Here's a test app which reproduced the oops instantly on 2-way. It realy needs to be run against all tty-capable devices. /* * Run this against a tty which nobody currently has open, such as /dev/tty9 */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/kd.h> void doit(char *filename) { int fd,x; fd = open(filename, O_RDWR); if (fd < 0) { perror("open"); exit(1); } ioctl(fd, KDKBDREP, &x); close(fd); } main(int argc, char *argv[]) { char *filename = argv[1]; for ( ; ; ) doit(filename); }
2004-02-23[PATCH] tty utf8 modeAndries E. Brouwer
This sounds like a good moment to come with this patch. This is essentially a five-year-old patch by Bruno Haible. It introduces utf8 mode, and the effect it has on erasing input characters. (Side note - without stty support, this is not very useful, but now the infrastructure is in place)
2004-02-22[PATCH] dynamic pty allocationAndrew Morton
From: "H. Peter Anvin" <hpa@transmeta.com> Remove the limit of 2048 pty's - allocate them on demand up to the 12:20 dev_t limit: a million.
2003-09-23[PATCH] switch remaining serial drivers to initcallsAndrew Morton
From: Christoph Hellwig <hch@lst.de> All drivers that compile on ppc with CONFIG_ISA set (= all but some m68-only drivers), I looked at the compile warnings very closely and there are no new warnings or even errors this time :) drivers/char/Makefile needed to be reordered big time to keep the intialization order the same.
2003-09-22[PATCH] prepare for 32-bit dev_t: tty usageAlexander Viro
tty->device had been used only in a couple of places and can be calculated by tty->index and tty->driver. Field removed, its users switched to static inline dev_t tty_devnum(tty).
2003-09-21[PATCH] move some more initializations out of drivers/char/mem.cAndrew Morton
From: Christoph Hellwig <hch@lst.de> keeping init order the same..
2003-08-30[PATCH] dev_t handling cleanups (2/12)Alexander Viro
tty_paranoia_check() switched from kdev_t to struct inode.
2003-07-17[PATCH] vesafb fixAndrew Morton
From: Gerd Knorr <kraxel@suse.de> The patch below fixes some vesafb issues. Changes: * fixed struct screen_info in tty.h to use portable types. "unsigned long" for 32bit values doesn't work on hammer machines ... * limited the framebuffer memory used by vesafb to 16 MB. This avoids that vesafb's ioremap() eats plenty of kernel address space for no real benefit if the gfx card has very much memory (some have 128 MB or more, ia32 has 128 MB address space for vmalloc and ioremap ...). * mtrr is enabled by default. That should improve the vesafb performance a lot. Also added a option to disable mtrr.
2003-05-26[PATCH] Self-promotion and minor docs updatesRusty Russell
From: Pavel Machek <pavel@ucw.cz> This fixes url in ioctls, fixes some kernel parameters, kills comment in tty that is 10+ years old and wrong, and adds me a little credits.
2003-05-24[PATCH] TIOCCONS fixAlexander Viro
This fixes the TIOCCONS race; it's the same as the 2.4 patch except for a fix for a brown-paperbag bug in it.
2003-05-07TTY: add tty class support for all tty devices.Greg Kroah-Hartman
2003-04-23[PATCH] tty cleanups (11/12)Alexander Viro
tty->device switched to dev_t There are very few uses of tty->device left by now; most of them actually want dev_t (process accounting, proc/<pid>/stat, several ioctls, slip.c logics, etc.) and the rest will go away shortly.
2003-04-23[PATCH] tty cleanups (7/12)Alexander Viro
sanitized driver->driver_name initialization and use
2003-04-23[PATCH] tty cleanups (6/12)Alexander Viro
tty->tty_index added; we initialize it with minor(tty->device) - tty->driver->minor_start. Majority of remaining tty->device uses had that form and are switched to use of tty->index.
2003-04-23[PATCH] tty cleanups (5/12)Alexander Viro
new field - tty->tty_name; initialized to <driver->name><tty index+driver->base_name> when we allocate tty_struct. Drivers code switched to use of that beast (in debugging printks, mostly). Large, but trivial.
2003-04-23[PATCH] tty cleanups (2/12)Alexander Viro
Instead of copying tty_driver into tty_struct we put a reference in there. tty->driver turned into a pointer, users updated. Large, but trivial
2003-03-06Fix "con_init()" function type and stale (and incorrect) declarationLinus Torvalds
2003-03-04[PATCH] Fix time comparison typing bugs.David S. Miller
Many places use inappropriate types for comparing jiffies, int for example. Fix those places up.
2002-12-29TTY: Change tty_*register_devfs() to tty_*register_device()Greg Kroah-Hartman
Also got rid of the unused flag paramater.
2002-12-01[SERIAL] uart_get_divisor() and uart_get_baud_rate() takes termios.Russell King
Currently, uart_get_divisor() and uart_get_baud_rate() take a tty structure. We really want them to take a termios structure so we can avoid passing a tty structure all the way down to the low level drivers. In order to do this, we need to be able to convert a termios structure to a numeric baud rate - we provide tty_termios_baud_rate() in tty_io.c for this purpose. It performs a subset of the tty_get_baud_rate() functionality, but without any "alt_speed" kludge. We finally export uart_get_baud_rate() and uart_get_divisor() to for low level drivers to use. We now have all the functions in place to support ports which want to have access to the real baud rate rather than a divisor value.
2002-09-30[PATCH] Workqueue AbstractionIngo Molnar
This is the next iteration of the workqueue abstraction. The framework includes: - per-CPU queueing support. on SMP there is a per-CPU worker thread (bound to its CPU) and per-CPU work queues - this feature is completely transparent to workqueue-users. keventd automatically uses this feature. XFS can now update to work-queues and have the same per-CPU performance as it had with its per-CPU worker threads. - delayed work submission there's a new queue_delayed_work(wq, work, delay) function and a new schedule_delayed_work(work, delay) function. The later one is used to correctly fix former tq_timer users. I've reverted those changes in 2.5.40 that changed tq_timer uses to schedule_work() - eg. in the case of random.c or the tty flip queue it was definitely the wrong thing to do. delayed work means a timer embedded in struct work_struct. I considered using split struct work_struct and delayed_work_struct types, but lots of code actively uses task-queues in both delayed and non-delayed mode, so i went for the more generic approach that allows both methods of work submission. Delayed timers do not cause any other overhead in the normal submission path otherwise. - multithreaded run_workqueue() implementation the run_workqueue() function can now be called from multiple contexts, and a worker thread will only use up a single entryy - this property is used by the flushing code, and can potentially be used in the future to extend the number of per-CPU worker threads. - more reliable flushing there's now a 'pending work' counter, which is used to accurately detect when the last work-function has finished execution. It's also used to correctly flush against timed requests. I'm not convinced whether the old keventd implementation got this detail right. - i switched the arguments of the queueing function(s) per Jeff's suggestion, it's more straightforward this way. Driver fixes: i have converted almost every affected driver to the new framework. This cleaned up tons of code. I also fixed a number of drivers that were still using BHs (these drivers did not compile in 2.5.40). while this means lots of changes, it might ease the QA decision whether to put this patch into 2.5. The pach converts roughly 80% of all tqueue-using code to workqueues - and all the places that are not converted to workqueues yet are places that do not compile in vanilla 2.5.40 anyway, due to unrelated changes. I've converted a fair number of drivers that do not compile in 2.5.40, and i think i've managed to convert every driver that compiles under 2.5.40.
2002-06-15Added VBI support to VESA. ATY 128 compiles now :-)James Simmons
2002-02-04v2.4.6.1 -> v2.4.6.2Linus Torvalds
- merge with Alan (USB, zoran, sony motion-eye, rio, dmi-scan)
2002-02-04v2.4.2.6 -> v2.4.2.7Linus Torvalds
- more bugs found by the automatic stanford checker, yay! - Andrew Morton: fix SAK locking bugs by moving it into a process context - Johannes Erdfelt: USB updates - Jeff Garzik: merge Hermes driver by David Gibson - Jens Axboe: cdrom merges, ll_rw_blk proper accounting
2002-02-04Import changesetLinus Torvalds