Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions | Variables
vt.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/kd.h>
#include <linux/slab.h>
#include <linux/major.h>
#include <linux/mm.h>
#include <linux/console.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/vt_kern.h>
#include <linux/selection.h>
#include <linux/tiocl.h>
#include <linux/kbd_kern.h>
#include <linux/consolemap.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/pm.h>
#include <linux/font.h>
#include <linux/bitops.h>
#include <linux/notifier.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/kdb.h>
#include <linux/ctype.h>

Go to the source code of this file.

Data Structures

struct  con_driver
 
struct  interval
 

Macros

#define MAX_NR_CON_DRIVER   16
 
#define CON_DRIVER_FLAG_MODULE   1
 
#define CON_DRIVER_FLAG_INIT   2
 
#define CON_DRIVER_FLAG_ATTR   4
 
#define CTRL_ACTION   0x0d00ff81
 
#define CTRL_ALWAYS   0x0800f501 /* Cannot be overridden by disp_ctrl */
 
#define DEFAULT_BELL_PITCH   750
 
#define DEFAULT_BELL_DURATION   (HZ/8)
 
#define IS_FG(vc)   ((vc)->vc_num == fg_console)
 
#define DO_UPDATE(vc)   (CON_IS_VISIBLE(vc) && !console_blanked)
 
#define VC_RESIZE_MAXCOL   (32767)
 
#define VC_RESIZE_MAXROW   (32767)
 
#define set_kbd(vc, x)   vt_set_kbd_mode_bit((vc)->vc_num, (x))
 
#define clr_kbd(vc, x)   vt_clr_kbd_mode_bit((vc)->vc_num, (x))
 
#define is_kbd(vc, x)   vt_get_kbd_mode_bit((vc)->vc_num, (x))
 
#define decarm   VC_REPEAT
 
#define decckm   VC_CKMODE
 
#define kbdapplic   VC_APPLIC
 
#define lnm   VC_CRLF
 
#define VT100ID   "\033[?1;2c"
 
#define VT102ID   "\033[?6c"
 
#define FLUSH
 
#define max_font_size   65536
 

Enumerations

enum  { blank_off = 0, blank_normal_wait, blank_vesa_wait }
 
enum  {
  ESnormal, ESesc, ESsquare, ESgetpars,
  ESgotpars, ESfunckey, EShash, ESsetG0,
  ESsetG1, ESpercent, ESignore, ESnonstd,
  ESpalette
}
 

Functions

 module_param (default_utf8, int, S_IRUGO|S_IWUSR)
 
 module_param (global_cursor_default, int, S_IRUGO|S_IWUSR)
 
 module_param (cur_default, int, S_IRUGO|S_IWUSR)
 
 core_param (consoleblank, blankinterval, int, 0444)
 
int register_vt_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (register_vt_notifier)
 
int unregister_vt_notifier (struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (unregister_vt_notifier)
 
void schedule_console_callback (void)
 
void update_region (struct vc_data *vc, unsigned long start, int count)
 
void invert_screen (struct vc_data *vc, int offset, int count, int viewed)
 
void complement_pos (struct vc_data *vc, int offset)
 
void redraw_screen (struct vc_data *vc, int is_switch)
 
int vc_cons_allocated (unsigned int i)
 
int vc_allocate (unsigned int currcons)
 
int vc_resize (struct vc_data *vc, unsigned int cols, unsigned int rows)
 
void vc_deallocate (unsigned int currcons)
 
 module_param_array (default_red, int, NULL, S_IRUGO|S_IWUSR)
 
 module_param_array (default_grn, int, NULL, S_IRUGO|S_IWUSR)
 
 module_param_array (default_blu, int, NULL, S_IRUGO|S_IWUSR)
 
void scrollback (struct vc_data *vc, int lines)
 
void scrollfront (struct vc_data *vc, int lines)
 
void mouse_report (struct tty_struct *tty, int butt, int mrx, int mry)
 
int mouse_reporting (void)
 
int set_console (int nr)
 
int tioclinux (struct tty_struct *tty, unsigned long arg)
 
 module_param_named (italic, default_italic_color, int, S_IRUGO|S_IWUSR)
 
 module_param_named (underline, default_underline_color, int, S_IRUGO|S_IWUSR)
 
 console_initcall (con_init)
 
int __init vty_init (const struct file_operations *console_fops)
 
int con_is_bound (const struct consw *csw)
 
 EXPORT_SYMBOL (con_is_bound)
 
int con_debug_enter (struct vc_data *vc)
 
 EXPORT_SYMBOL_GPL (con_debug_enter)
 
int con_debug_leave (void)
 
 EXPORT_SYMBOL_GPL (con_debug_leave)
 
int register_con_driver (const struct consw *csw, int first, int last)
 
 EXPORT_SYMBOL (register_con_driver)
 
int unregister_con_driver (const struct consw *csw)
 
 EXPORT_SYMBOL (unregister_con_driver)
 
int take_over_console (const struct consw *csw, int first, int last, int deflt)
 
void give_up_console (const struct consw *csw)
 
 postcore_initcall (vtconsole_class_init)
 
void do_blank_screen (int entering_gfx)
 
 EXPORT_SYMBOL (do_blank_screen)
 
void do_unblank_screen (int leaving_gfx)
 
 EXPORT_SYMBOL (do_unblank_screen)
 
void unblank_screen (void)
 
void poke_blanked_console (void)
 
int con_set_cmap (unsigned char __user *arg)
 
int con_get_cmap (unsigned char __user *arg)
 
void reset_palette (struct vc_data *vc)
 
int con_font_op (struct vc_data *vc, struct console_font_op *op)
 
u16 screen_glyph (struct vc_data *vc, int offset)
 
 EXPORT_SYMBOL_GPL (screen_glyph)
 
unsigned shortscreen_pos (struct vc_data *vc, int w_offset, int viewed)
 
void getconsxy (struct vc_data *vc, unsigned char *p)
 
void putconsxy (struct vc_data *vc, unsigned char *p)
 
u16 vcs_scr_readw (struct vc_data *vc, const u16 *org)
 
void vcs_scr_writew (struct vc_data *vc, u16 val, u16 *org)
 
void vcs_scr_updated (struct vc_data *vc)
 
 EXPORT_SYMBOL (color_table)
 
 EXPORT_SYMBOL (default_red)
 
 EXPORT_SYMBOL (default_grn)
 
 EXPORT_SYMBOL (default_blu)
 
 EXPORT_SYMBOL (update_region)
 
 EXPORT_SYMBOL (redraw_screen)
 
 EXPORT_SYMBOL (vc_resize)
 
 EXPORT_SYMBOL (fg_console)
 
 EXPORT_SYMBOL (console_blank_hook)
 
 EXPORT_SYMBOL (console_blanked)
 
 EXPORT_SYMBOL (vc_cons)
 
 EXPORT_SYMBOL (global_cursor_default)
 
 EXPORT_SYMBOL (take_over_console)
 
 EXPORT_SYMBOL (give_up_console)
 

Variables

struct conswconswitchp
 
struct vc vc_cons [MAX_NR_CONSOLES]
 
int default_utf8 = true
 
int global_cursor_default = -1
 
int do_poke_blanked_console
 
int console_blanked
 
int fg_console
 
int last_console
 
int want_console = -1
 
int(* console_blank_hook )(int)
 
unsigned char color_table []
 
int default_red []
 
int default_grn []
 
int default_blu []
 
struct tty_driverconsole_driver
 

Macro Definition Documentation

#define clr_kbd (   vc,
  x 
)    vt_clr_kbd_mode_bit((vc)->vc_num, (x))

Definition at line 1013 of file vt.c.

#define CON_DRIVER_FLAG_ATTR   4

Definition at line 110 of file vt.c.

#define CON_DRIVER_FLAG_INIT   2

Definition at line 109 of file vt.c.

#define CON_DRIVER_FLAG_MODULE   1

Definition at line 108 of file vt.c.

#define CTRL_ACTION   0x0d00ff81

Definition at line 130 of file vt.c.

#define CTRL_ALWAYS   0x0800f501 /* Cannot be overridden by disp_ctrl */

Definition at line 131 of file vt.c.

#define decarm   VC_REPEAT

Definition at line 1016 of file vt.c.

#define decckm   VC_CKMODE

Definition at line 1017 of file vt.c.

#define DEFAULT_BELL_DURATION   (HZ/8)

Definition at line 137 of file vt.c.

#define DEFAULT_BELL_PITCH   750

Definition at line 136 of file vt.c.

#define DO_UPDATE (   vc)    (CON_IS_VISIBLE(vc) && !console_blanked)

Definition at line 279 of file vt.c.

#define FLUSH
Value:
if (draw_x >= 0) { \
vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, draw_x); \
draw_x = -1; \
}
#define IS_FG (   vc)    ((vc)->vc_num == fg_console)

Definition at line 274 of file vt.c.

#define is_kbd (   vc,
  x 
)    vt_get_kbd_mode_bit((vc)->vc_num, (x))

Definition at line 1014 of file vt.c.

#define kbdapplic   VC_APPLIC

Definition at line 1018 of file vt.c.

#define lnm   VC_CRLF

Definition at line 1019 of file vt.c.

#define max_font_size   65536

Definition at line 3952 of file vt.c.

#define MAX_NR_CON_DRIVER   16

Definition at line 106 of file vt.c.

#define set_kbd (   vc,
  x 
)    vt_set_kbd_mode_bit((vc)->vc_num, (x))

Definition at line 1012 of file vt.c.

#define VC_RESIZE_MAXCOL   (32767)

Definition at line 816 of file vt.c.

#define VC_RESIZE_MAXROW   (32767)

Definition at line 817 of file vt.c.

#define VT100ID   "\033[?1;2c"

Definition at line 1024 of file vt.c.

#define VT102ID   "\033[?6c"

Definition at line 1025 of file vt.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
blank_off 
blank_normal_wait 
blank_vesa_wait 

Definition at line 228 of file vt.c.

anonymous enum
Enumerator:
ESnormal 
ESesc 
ESsquare 
ESgetpars 
ESgotpars 
ESfunckey 
EShash 
ESsetG0 
ESsetG1 
ESpercent 
ESignore 
ESnonstd 
ESpalette 

Definition at line 1581 of file vt.c.

Function Documentation

void complement_pos ( struct vc_data vc,
int  offset 
)

Definition at line 504 of file vt.c.

int con_debug_enter ( struct vc_data vc)

con_debug_enter - prepare the console for the kernel debugger : console driver

Called when the console is taken over by the kernel debugger, this function needs to save the current console state, then put the console into a state suitable for the kernel debugger.

RETURNS: Zero on success, nonzero if a failure occurred when trying to prepare the console for the debugger.

Definition at line 3417 of file vt.c.

int con_debug_leave ( void  )

con_debug_leave - restore console state : console driver

Restore the console state to what it was before the kernel debugger was invoked.

RETURNS: Zero on success, nonzero if a failure occurred when trying to restore the console.

Definition at line 3474 of file vt.c.

int con_font_op ( struct vc_data vc,
struct console_font_op op 
)

Definition at line 4116 of file vt.c.

int con_get_cmap ( unsigned char __user arg)

Definition at line 3909 of file vt.c.

int con_is_bound ( const struct consw csw)

con_is_bound - checks if driver is bound to the console : console driver

RETURNS: zero if unbound, nonzero if bound

Drivers can call this and if zero, they should release all resources allocated on con_startup()

Definition at line 3390 of file vt.c.

int con_set_cmap ( unsigned char __user arg)

Definition at line 3880 of file vt.c.

console_initcall ( con_init  )
core_param ( consoleblank  ,
blankinterval  ,
int  ,
0444   
)
void do_blank_screen ( int  entering_gfx)

Definition at line 3704 of file vt.c.

void do_unblank_screen ( int  leaving_gfx)

Definition at line 3765 of file vt.c.

EXPORT_SYMBOL ( con_is_bound  )
EXPORT_SYMBOL ( register_con_driver  )
EXPORT_SYMBOL ( unregister_con_driver  )
EXPORT_SYMBOL ( do_blank_screen  )
EXPORT_SYMBOL ( do_unblank_screen  )
EXPORT_SYMBOL ( color_table  )
EXPORT_SYMBOL ( default_red  )
EXPORT_SYMBOL ( default_grn  )
EXPORT_SYMBOL ( default_blu  )
EXPORT_SYMBOL ( update_region  )
EXPORT_SYMBOL ( redraw_screen  )
EXPORT_SYMBOL ( vc_resize  )
EXPORT_SYMBOL ( fg_console  )
EXPORT_SYMBOL ( console_blank_hook  )
EXPORT_SYMBOL ( console_blanked  )
EXPORT_SYMBOL ( vc_cons  )
EXPORT_SYMBOL ( global_cursor_default  )
EXPORT_SYMBOL ( take_over_console  )
EXPORT_SYMBOL ( give_up_console  )
EXPORT_SYMBOL_GPL ( register_vt_notifier  )
EXPORT_SYMBOL_GPL ( unregister_vt_notifier  )
EXPORT_SYMBOL_GPL ( con_debug_enter  )
EXPORT_SYMBOL_GPL ( con_debug_leave  )
EXPORT_SYMBOL_GPL ( screen_glyph  )
void getconsxy ( struct vc_data vc,
unsigned char p 
)

Definition at line 4153 of file vt.c.

void give_up_console ( const struct consw csw)

Definition at line 3646 of file vt.c.

void invert_screen ( struct vc_data vc,
int  offset,
int  count,
int  viewed 
)

Definition at line 459 of file vt.c.

module_param ( default_utf8  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param ( global_cursor_default  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param ( cur_default  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param_array ( default_red  ,
int  ,
NULL  ,
S_IRUGO S_IWUSR 
)
module_param_array ( default_grn  ,
int  ,
NULL  ,
S_IRUGO S_IWUSR 
)
module_param_array ( default_blu  ,
int  ,
NULL  ,
S_IRUGO S_IWUSR 
)
module_param_named ( italic  ,
default_italic_color  ,
int  ,
S_IRUGO S_IWUSR 
)
module_param_named ( underline  ,
default_underline_color  ,
int  ,
S_IRUGO S_IWUSR 
)
void mouse_report ( struct tty_struct tty,
int  butt,
int  mrx,
int  mry 
)

Definition at line 1360 of file vt.c.

int mouse_reporting ( void  )

Definition at line 1370 of file vt.c.

void poke_blanked_console ( void  )

Definition at line 3835 of file vt.c.

postcore_initcall ( vtconsole_class_init  )
void putconsxy ( struct vc_data vc,
unsigned char p 
)

Definition at line 4159 of file vt.c.

void redraw_screen ( struct vc_data vc,
int  is_switch 
)

Definition at line 652 of file vt.c.

int register_con_driver ( const struct consw csw,
int  first,
int  last 
)

register_con_driver - register console driver to console layer : console driver : the first console to take over, minimum value is 0 : the last console to take over, maximum value is MAX_NR_CONSOLES -1

DESCRIPTION: This function registers a console driver which can later bind to a range of consoles specified by and . It will also initialize the console driver by calling con_startup().

Definition at line 3502 of file vt.c.

int register_vt_notifier ( struct notifier_block nb)

Definition at line 247 of file vt.c.

void reset_palette ( struct vc_data vc)

Definition at line 3928 of file vt.c.

void schedule_console_callback ( void  )

Definition at line 305 of file vt.c.

u16 screen_glyph ( struct vc_data vc,
int  offset 
)

Definition at line 4136 of file vt.c.

unsigned short* screen_pos ( struct vc_data vc,
int  w_offset,
int  viewed 
)

Definition at line 4148 of file vt.c.

void scrollback ( struct vc_data vc,
int  lines 
)

Definition at line 1083 of file vt.c.

void scrollfront ( struct vc_data vc,
int  lines 
)

Definition at line 1090 of file vt.c.

int set_console ( int  nr)

Definition at line 2364 of file vt.c.

int take_over_console ( const struct consw csw,
int  first,
int  last,
int  deflt 
)

Definition at line 3625 of file vt.c.

int tioclinux ( struct tty_struct tty,
unsigned long  arg 
)

Definition at line 2552 of file vt.c.

void unblank_screen ( void  )

Definition at line 3815 of file vt.c.

int unregister_con_driver ( const struct consw csw)

unregister_con_driver - unregister console driver from console layer : console driver

DESCRIPTION: All drivers that registers to the console layer must call this function upon exit, or if the console driver is in a state where it won't be able to handle console services, such as the framebuffer console without loaded framebuffer drivers.

The driver must unbind first prior to unregistration.

Definition at line 3583 of file vt.c.

int unregister_vt_notifier ( struct notifier_block nb)

Definition at line 253 of file vt.c.

void update_region ( struct vc_data vc,
unsigned long  start,
int  count 
)

Definition at line 390 of file vt.c.

int vc_allocate ( unsigned int  currcons)

Definition at line 751 of file vt.c.

int vc_cons_allocated ( unsigned int  i)

Definition at line 719 of file vt.c.

void vc_deallocate ( unsigned int  currcons)

Definition at line 988 of file vt.c.

int vc_resize ( struct vc_data vc,
unsigned int  cols,
unsigned int  rows 
)

vc_resize - resize a VT : virtual console : columns : rows

Resize a virtual console as seen from the console end of things. We use the common vc_do_resize methods to update the structures. The caller must hold the console sem to protect console internals and vc->port.tty

Definition at line 960 of file vt.c.

u16 vcs_scr_readw ( struct vc_data vc,
const u16 org 
)

Definition at line 4166 of file vt.c.

void vcs_scr_updated ( struct vc_data vc)

Definition at line 4182 of file vt.c.

void vcs_scr_writew ( struct vc_data vc,
u16  val,
u16 org 
)

Definition at line 4173 of file vt.c.

int __init vty_init ( const struct file_operations console_fops)

Definition at line 2945 of file vt.c.

Variable Documentation

unsigned char color_table[]
Initial value:
= { 0, 4, 2, 6, 1, 5, 3, 7,
8,12,10,14, 9,13,11,15 }

Definition at line 1027 of file vt.c.

int(* console_blank_hook)(int)

Definition at line 223 of file vt.c.

int console_blanked

Definition at line 175 of file vt.c.

struct tty_driver* console_driver

Definition at line 2388 of file vt.c.

struct consw* conswitchp

Definition at line 123 of file vt.c.

int default_blu[]
Initial value:
= {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,
0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff}

Definition at line 1035 of file vt.c.

int default_grn[]
Initial value:
= {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa,
0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff}

Definition at line 1033 of file vt.c.

int default_red[]
Initial value:
= {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,
0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff}

Definition at line 1031 of file vt.c.

int default_utf8 = true

Definition at line 160 of file vt.c.

int do_poke_blanked_console

Definition at line 174 of file vt.c.

int fg_console

Definition at line 190 of file vt.c.

int global_cursor_default = -1

Definition at line 162 of file vt.c.

int last_console

Definition at line 191 of file vt.c.

Definition at line 139 of file vt.c.

int want_console = -1

Definition at line 192 of file vt.c.