From: James S. <jsi...@us...> - 2002-11-01 23:01:36
|
Update of /cvsroot/linuxconsole/ruby/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv27352 Modified Files: vt_kern.h Log Message: Use BK version Index: vt_kern.h =================================================================== RCS file: /cvsroot/linuxconsole/ruby/linux/include/linux/vt_kern.h,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- vt_kern.h 27 Jul 2002 19:33:27 -0000 1.66 +++ vt_kern.h 1 Nov 2002 23:01:31 -0000 1.67 @@ -2,20 +2,17 @@ #define _VT_KERN_H /* - * this really is an extension of the vc_cons structure in console.c, but - * with information needed by the vt package + * All the data structs defining the VT tty system. */ #include <linux/config.h> #include <linux/pm.h> #include <linux/vt.h> -#include <linux/kd.h> #include <linux/kbd_kern.h> -#include <linux/input.h> #define MIN_NR_CONSOLES 1 /* must be at least 1 */ #define MAX_NR_CONSOLES 63 /* serial lines start at 64 */ -#define MAX_NR_USER_CONSOLES 16 /* number of VCs per VT */ +#define MAX_NR_USER_CONSOLES 16 /* number of VCs per VT */ /* scroll */ #define SM_UP (1) @@ -42,8 +39,19 @@ /* * Low-Level Functions */ +#define IS_VISIBLE (vc == vc->display_fg->fg_console) -#define IS_VISIBLE (vc->vc_num == vc->display_fg->fg_console->vc_num) +/* + * Presently, a lot of graphics programs do not restore the contents of + * the higher font pages. Defining this flag will avoid use of them, but + * will lose support for PIO_FONTRESET. Note that many font operations are + * not likely to work with these programs anyway; they need to be + * fixed. The linux/Documentation directory includes a code snippet + * to save and restore the text font. + */ +#ifdef CONFIG_VGA_CONSOLE +#define BROKEN_GRAPHICS_PROGRAMS 1 +#endif extern unsigned char color_table[]; extern int default_red[]; @@ -51,34 +59,32 @@ extern int default_blu[]; /* - * Data structure describing single virtual console except for data - * used by vt.c. + * Data structure describing single virtual console * * Fields marked with [#] must be set by the low-level driver. * Fields marked with [!] can be changed by the low-level driver * to achieve effects such as fast scrolling by changing the origin. */ - #define NPAR 16 struct vc_data { - unsigned short vc_num; /* Console number */ - unsigned int vc_cols; /* [#] Console size */ + unsigned short vc_num; /* Console number */ + unsigned int vc_cols; /* [#] Console size */ unsigned int vc_rows; unsigned int vc_size_row; /* Bytes per row */ unsigned int vc_scan_lines; /* # of scan lines */ unsigned int vc_screensize; /* Size of screen */ - unsigned char vc_mode; /* KD_TEXT, ... */ + unsigned char vc_mode; /* KD_TEXT, ... */ unsigned long vc_origin; /* [!] Start of real screen */ unsigned long vc_scr_end; /* [!] End of real screen */ - unsigned long vc_visible_origin; /* [!] Top of visible window */ + unsigned long vc_visible_origin;/* [!] Top of visible window */ unsigned int vc_scrollback; /* [!] Scrollback size */ unsigned int vc_top, vc_bottom; /* Scrolling region */ unsigned short *vc_screenbuf; /* In-memory character/attribute buffer */ unsigned int vc_screenbuf_size; - unsigned char vc_attr; /* Current attributes */ + unsigned char vc_attr; /* Current attributes */ unsigned char vc_def_color; /* Default colors */ - unsigned char vc_color; /* Foreground & background */ + unsigned char vc_color; /* Foreground & background */ unsigned char vc_s_color; /* Saved foreground & background */ unsigned char vc_ulcolor; /* Color for underline mode */ unsigned char vc_halfcolor; /* Color for half intensity mode */ @@ -88,14 +94,15 @@ unsigned short vc_s_complement_mask; /* Saved mouse pointer mask */ unsigned short vc_video_erase_char; /* Background erase character */ unsigned int vc_x, vc_y; /* Cursor position */ - unsigned long vc_pos; /* Cursor address */ + unsigned long vc_pos; /* Cursor address */ unsigned int vc_saved_x; unsigned int vc_saved_y; - unsigned int vc_state; /* Escape sequence parser state */ + unsigned int vc_state; /* Escape sequence parser state */ unsigned int vc_npar, vc_par[NPAR]; /* Parameters of current escape sequence */ struct kbd_struct kbd_table; /* VC keyboard state */ unsigned short vc_hi_font_mask; /* [#] Attribute set for upper 256 chars of font or 0 if not supported */ struct console_font_op vc_font; /* VC current font set */ + struct vt_struct *display_fg; /* Ptr to display */ struct tty_struct *vc_tty; /* TTY we are attached to */ /* data for manual vt switching */ struct vt_mode vt_mode; @@ -110,7 +117,7 @@ unsigned int vc_decom:1; /* Origin Mode */ unsigned int vc_decawm:1; /* Autowrap Mode */ unsigned int vc_dectcem:1; /* Text Cursor Enable */ - unsigned int vc_irm:1; /* Insert/Replace Mode */ + unsigned int vc_irm:1; /* Insert/Replace Mode */ unsigned int vc_deccolm:1; /* 80/132 Column Mode */ /* attribute flags */ unsigned int vc_intensity:2; /* 0=half-bright, 1=normal, 2=bold */ @@ -133,25 +140,24 @@ unsigned int vc_need_wrap:1; unsigned int vc_can_do_color:1; unsigned int vc_report_mouse:2; - unsigned char vc_utf:1; /* Unicode UTF-8 encoding */ + unsigned char vc_utf:1; /* Unicode UTF-8 encoding */ unsigned char vc_utf_count; int vc_utf_char; unsigned int vc_tab_stop[8]; /* Tab stops. 256 columns. */ unsigned char vc_palette[16 * 3]; /* Colour palette for VGA+ */ - unsigned int vc_translate; /* Current ACM */ + unsigned short *vc_translate; unsigned char vc_G0_charset; unsigned char vc_G1_charset; unsigned char vc_saved_G0; unsigned char vc_saved_G1; unsigned int vc_bell_pitch; /* Console bell pitch */ unsigned int vc_bell_duration; /* Console bell duration */ - struct vt_struct *display_fg; /* Ptr to display */ unsigned long vc_uni_pagedir; - unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir var - iable for this console */ + unsigned long *vc_uni_pagedir_loc;/* [!] Location of uni_pagedir + variable for this console */ wait_queue_head_t paste_wait; /* For selections */ /* Internal flags */ - unsigned int vc_decscl; /* operating level */ + unsigned int vc_decscl; /* operating level */ unsigned int vc_c8bit:1; /* 8-bit controls */ unsigned int vc_d8bit:1; /* 8-bit data */ unsigned int vc_shift:1; /* single shift */ @@ -159,13 +165,12 @@ unsigned int vc_decckm:1; /* Cursor Keys */ unsigned int vc_decsclm:1; /* Scrolling */ unsigned int vc_decarm:1; /* Autorepeat */ - unsigned int vc_decnrcm:1; /* National Replacement Characte - r Set */ + unsigned int vc_decnrcm:1; /* National Replacement Character Set */ unsigned int vc_decnkm:1; /* Numeric Keypad */ /* ANSI / ISO mode flags */ - unsigned int vc_kam:1; /* Keyboard Action */ - unsigned int vc_crm:1; /* Console Representation */ - unsigned int vc_lnm:1; /* Line feed/New line */ + unsigned int vc_kam:1; /* Keyboard Action */ + unsigned int vc_crm:1; /* Console Representation */ + unsigned int vc_lnm:1; /* Line feed/New line */ /* Charset mappings */ unsigned char vc_GL_charset; unsigned char vc_GR_charset; @@ -178,59 +183,57 @@ }; struct consw { - const char *(*con_startup) (struct vt_struct *, int); - void (*con_init) (struct vc_data *); - void (*con_deinit) (struct vc_data *); - void (*con_clear) (struct vc_data *, int, int, int, int); - void (*con_putc) (struct vc_data *, int, int, int); - void (*con_putcs) (struct vc_data *, const unsigned short *, int, - int, int); - void (*con_cursor) (struct vc_data *, int); - int (*con_scroll_region) (struct vc_data *, int, int, int, int); - void (*con_bmove) (struct vc_data *, int, int, int, int, int, int); - int (*con_blank) (struct vc_data *, int); - int (*con_font_op) (struct vc_data *, struct console_font_op *); - int (*con_resize) (struct vc_data *, unsigned int, unsigned int); - int (*con_set_palette) (struct vc_data *, unsigned char *); - int (*con_scroll) (struct vc_data *, int); - int (*con_set_origin) (struct vc_data *); - u8(*con_build_attr) (struct vc_data *, u8, u8, u8, u8, u8); - void (*con_invert_region) (struct vc_data *, u16 *, int); + const char *(*con_startup)(struct vt_struct *, int); + void (*con_init)(struct vc_data *, int); + void (*con_deinit)(struct vc_data *); + void (*con_clear)(struct vc_data *, int, int, int, int); + void (*con_putc)(struct vc_data *, int, int, int); + void (*con_putcs)(struct vc_data *, const unsigned short *, int, int, int); + void (*con_cursor)(struct vc_data *, int); + int (*con_scroll_region)(struct vc_data *, int, int, int, int); + void (*con_bmove)(struct vc_data *, int, int, int, int, int, int); + int (*con_switch)(struct vc_data *); + int (*con_blank)(struct vc_data *, int); + int (*con_font_op)(struct vc_data *, struct console_font_op *); + int (*con_resize)(struct vc_data *, unsigned int, unsigned int); + int (*con_set_palette)(struct vc_data *, unsigned char *); + int (*con_scroll)(struct vc_data *, int); + int (*con_set_origin)(struct vc_data *); + void (*con_save_screen)(struct vc_data *); + u8 (*con_build_attr)(struct vc_data *, u8, u8, u8, u8, u8); + void (*con_invert_region)(struct vc_data *, u16 *, int); + u16* (*con_screen_pos)(struct vc_data *, int); + unsigned long (*con_getxy)(struct vc_data *, unsigned long, int *, int *); }; -extern const struct consw dummy_con; /* dummy console buffer */ -extern const struct consw newport_con; /* SGI Newport console */ -extern const struct consw prom_con; /* SPARC PROM console */ -extern const struct consw nvvga_con; /* NVIDIA text console */ - -void take_over_console(struct vt_struct *vt, const struct consw *sw); - struct vt_struct { struct vc_data *fg_console; /* VC being displayed */ struct vc_data *last_console; /* VC we last switched from */ struct vc_data *want_vc; /* VC we want to switch to */ int scrollback_delta; int cursor_original; - char kmalloced; + char kmalloced; /* Did we use kmalloced ? */ char vt_dont_switch; /* VC switching flag */ char vt_blanked; /* Is this display blanked */ int blank_mode; /* 0:none 1:suspendV 2:suspendH 3:powerdown */ int blank_interval; /* How long before blanking */ int off_interval; struct timer_list timer; /* Timer for VT blanking */ - struct pm_dev *pm_con; /* power management */ - /* This is a temporary buffer used to prepare a tty console write - * so that we can easily avoid touching user space while holding the - * console spinlock. It is shared by with vc_screen read/write tty calls. - */ + struct timer_list beep; /* Timer for adjusting console beeping */ + struct pm_dev *pm_con; /* power management */ + /* + * This is a temporary buffer used to prepare a tty console write + * so that we can easily avoid touching user space while holding the + * console spinlock. It is shared by with vc_screen read/write tty + * calls. + */ + struct semaphore lock; /* Lock for con_buf */ char con_buf[PAGE_SIZE]; - struct semaphore lock; /* Lock for con_buf */ - void *data_hook; /* Hook for driver data */ const struct consw *vt_sw; /* Display driver for VT */ - const struct consw *cache_sw; /* Save consw when KD_GRAPHIC */ struct vc_data *default_mode; /* Default mode */ - struct tq_struct vt_tq; /* VT task queue */ - struct input_handle *keyboard; /* Keyboard attached */ + struct work_struct vt_work; /* VT work queue */ + struct input_handle *keyboard; /* Keyboard attached */ + void *data_hook; /* Hook for driver data */ unsigned int first_vc; struct vc_data *vc_cons[MAX_NR_USER_CONSOLES]; /* VT's VC pool */ struct vt_struct *next; @@ -239,12 +242,6 @@ extern struct vt_struct *vt_cons; extern struct vt_struct *admin_vt; -static inline void set_console(struct vc_data *vc) -{ - vc->display_fg->want_vc = vc; - schedule_task(&vc->display_fg->vt_tq); -} - /* universal VT emulation functions */ void vte_ris(struct vc_data *vc, int do_clear); inline void vte_cr(struct vc_data *vc); @@ -255,30 +252,25 @@ void terminal_emulation(struct tty_struct *tty, int c); /* vt.c */ -struct console_font_op; const char *vt_map_display(struct vt_struct *vt, int init); void vt_map_input(struct vt_struct *vt); -int release_vt(struct vt_struct *vt); struct vc_data *find_vc(int currcons); struct vc_data *vc_allocate(unsigned int console); +inline void set_console(struct vc_data *vc); int vc_resize(struct vc_data *vc, unsigned int lines, unsigned int cols); int vc_disallocate(struct vc_data *vc); -void vc_init(struct vc_data *vc, int do_clear); +void reset_vc(struct vc_data *vc); void add_softcursor(struct vc_data *vc); void set_cursor(struct vc_data *vc); void hide_cursor(struct vc_data *vc); -void update_cursor_attr(struct vc_data *vc); void gotoxy(struct vc_data *vc, int new_x, int new_y); inline void gotoxay(struct vc_data *vc, int new_x, int new_y); void reset_palette(struct vc_data *vc); void set_palette(struct vc_data *vc); -inline int resize_screen(struct vc_data *vc, int width, int height); void scroll_up(struct vc_data *vc, int); void scroll_down(struct vc_data *vc, int); -void scroll_region_up(struct vc_data *vc, unsigned int t, unsigned int b, - int nr); -void scroll_region_down(struct vc_data *vc, unsigned int t, unsigned int b, - int nr); +void scroll_region_up(struct vc_data *vc, unsigned int t, unsigned int b, int nr); +void scroll_region_down(struct vc_data *vc, unsigned int t, unsigned int b, int nr); void default_attr(struct vc_data *vc); void update_attr(struct vc_data *vc); void insert_char(struct vc_data *vc, unsigned int nr); @@ -286,29 +278,25 @@ void insert_line(struct vc_data *vc, unsigned int nr); void delete_line(struct vc_data *vc, unsigned int nr); void set_origin(struct vc_data *vc); -inline void clear_region(struct vc_data *vc, int x, int y, int width, - int height); +inline void clear_region(struct vc_data *vc, int x, int y, int width, int height); void do_update_region(struct vc_data *vc, unsigned long start, int count); void update_region(struct vc_data *vc, unsigned long start, int count); void update_screen(struct vc_data *vc); -inline unsigned short *screenpos(struct vc_data *vc, int offset, - int viewed); -void invert_screen(struct vc_data *vc, int offset, int count, int viewed); -void kd_mksound(struct vc_data *vc, unsigned int hz, unsigned int ticks); -void unblank_screen(struct vt_struct *vt); +inline int resize_screen(struct vc_data *vc, int width, int height); +inline unsigned short *screenpos(struct vc_data *vc, int offset, int viewed); +inline void save_screen(struct vc_data *vc); +void do_blank_screen(int gfx_mode); +void unblank_screen(void); void poke_blanked_console(struct vt_struct *vt); -int pm_con_request(struct pm_dev *dev, pm_request_t rqst, void *data); +int con_font_op(struct vc_data *vc, struct console_font_op *op); +void take_over_console(struct vt_struct *vt, const struct consw *sw); -struct tty_struct; -void respond_string(const char *p, struct tty_struct *tty); int tioclinux(struct tty_struct *tty, unsigned long arg); /* consolemap.c */ - struct unimapinit; struct unipair; -void console_map_init(void); int con_set_trans_old(struct vc_data *vc, unsigned char *table); int con_get_trans_old(struct vc_data *vc, unsigned char *table); int con_set_trans_new(struct vc_data *vc, unsigned short *table); @@ -320,12 +308,10 @@ int con_set_default_unimap(struct vc_data *vc); void con_free_unimap(struct vc_data *vc); void con_protect_unimap(struct vc_data *vc, int rdonly); -int con_copy_unimap(struct vc_data *dstcons, struct vc_data *srccons); +int con_copy_unimap(struct vc_data *dst, struct vc_data *src); /* vt_ioctl.c */ +void complete_change_console(struct vc_data *new_vc, struct vc_data *old_vc); void change_console(struct vc_data *new_vc, struct vc_data *old_vc); -void complete_change_console(struct vc_data *new_vc, - struct vc_data *old_vc); -void reset_vc(struct vc_data *vc); #endif /* _VT_KERN_H */ |