Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _VT_KERN_H
0003 #define _VT_KERN_H
0004 
0005 /*
0006  * this really is an extension of the vc_cons structure in console.c, but
0007  * with information needed by the vt package
0008  */
0009 
0010 #include <linux/vt.h>
0011 #include <linux/kd.h>
0012 #include <linux/tty.h>
0013 #include <linux/mutex.h>
0014 #include <linux/console_struct.h>
0015 #include <linux/mm.h>
0016 #include <linux/consolemap.h>
0017 #include <linux/notifier.h>
0018 
0019 void kd_mksound(unsigned int hz, unsigned int ticks);
0020 int kbd_rate(struct kbd_repeat *rep);
0021 
0022 extern int fg_console, last_console, want_console;
0023 
0024 /* console.c */
0025 
0026 int vc_allocate(unsigned int console);
0027 int vc_cons_allocated(unsigned int console);
0028 int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
0029 struct vc_data *vc_deallocate(unsigned int console);
0030 void reset_palette(struct vc_data *vc);
0031 void do_blank_screen(int entering_gfx);
0032 void do_unblank_screen(int leaving_gfx);
0033 void unblank_screen(void);
0034 void poke_blanked_console(void);
0035 int con_font_op(struct vc_data *vc, struct console_font_op *op);
0036 int con_set_cmap(unsigned char __user *cmap);
0037 int con_get_cmap(unsigned char __user *cmap);
0038 void scrollback(struct vc_data *vc);
0039 void scrollfront(struct vc_data *vc, int lines);
0040 void clear_buffer_attributes(struct vc_data *vc);
0041 void update_region(struct vc_data *vc, unsigned long start, int count);
0042 void redraw_screen(struct vc_data *vc, int is_switch);
0043 #define update_screen(x) redraw_screen(x, 0)
0044 #define switch_screen(x) redraw_screen(x, 1)
0045 
0046 struct tty_struct;
0047 int tioclinux(struct tty_struct *tty, unsigned long arg);
0048 
0049 #ifdef CONFIG_CONSOLE_TRANSLATIONS
0050 /* consolemap.c */
0051 
0052 struct unipair;
0053 
0054 int con_set_trans_old(unsigned char __user * table);
0055 int con_get_trans_old(unsigned char __user * table);
0056 int con_set_trans_new(unsigned short __user * table);
0057 int con_get_trans_new(unsigned short __user * table);
0058 int con_clear_unimap(struct vc_data *vc);
0059 int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);
0060 int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);
0061 int con_set_default_unimap(struct vc_data *vc);
0062 void con_free_unimap(struct vc_data *vc);
0063 int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
0064 
0065 #else
0066 static inline int con_set_trans_old(unsigned char __user *table)
0067 {
0068     return 0;
0069 }
0070 static inline int con_get_trans_old(unsigned char __user *table)
0071 {
0072     return -EINVAL;
0073 }
0074 static inline int con_set_trans_new(unsigned short __user *table)
0075 {
0076     return 0;
0077 }
0078 static inline int con_get_trans_new(unsigned short __user *table)
0079 {
0080     return -EINVAL;
0081 }
0082 static inline int con_clear_unimap(struct vc_data *vc)
0083 {
0084     return 0;
0085 }
0086 static inline
0087 int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
0088 {
0089     return 0;
0090 }
0091 static inline
0092 int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct,
0093            struct unipair __user *list)
0094 {
0095     return -EINVAL;
0096 }
0097 static inline int con_set_default_unimap(struct vc_data *vc)
0098 {
0099     return 0;
0100 }
0101 static inline void con_free_unimap(struct vc_data *vc)
0102 {
0103 }
0104 static inline void con_protect_unimap(struct vc_data *vc, int rdonly)
0105 {
0106 }
0107 static inline
0108 int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
0109 {
0110     return 0;
0111 }
0112 
0113 #endif
0114 
0115 /* vt.c */
0116 void vt_event_post(unsigned int event, unsigned int old, unsigned int new);
0117 int vt_waitactive(int n);
0118 void change_console(struct vc_data *new_vc);
0119 void reset_vc(struct vc_data *vc);
0120 int do_unbind_con_driver(const struct consw *csw, int first, int last,
0121              int deflt);
0122 int vty_init(const struct file_operations *console_fops);
0123 
0124 extern bool vt_dont_switch;
0125 extern int default_utf8;
0126 extern int global_cursor_default;
0127 
0128 struct vt_spawn_console {
0129     spinlock_t lock;
0130     struct pid *pid;
0131     int sig;
0132 };
0133 extern struct vt_spawn_console vt_spawn_con;
0134 
0135 int vt_move_to_console(unsigned int vt, int alloc);
0136 
0137 /* Interfaces for VC notification of character events (for accessibility etc) */
0138 
0139 struct vt_notifier_param {
0140     struct vc_data *vc; /* VC on which the update happened */
0141     unsigned int c;     /* Printed char */
0142 };
0143 
0144 int register_vt_notifier(struct notifier_block *nb);
0145 int unregister_vt_notifier(struct notifier_block *nb);
0146 
0147 void hide_boot_cursor(bool hide);
0148 
0149 /* keyboard  provided interfaces */
0150 int vt_do_diacrit(unsigned int cmd, void __user *up, int eperm);
0151 int vt_do_kdskbmode(unsigned int console, unsigned int arg);
0152 int vt_do_kdskbmeta(unsigned int console, unsigned int arg);
0153 int vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc,
0154               int perm);
0155 int vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm,
0156              unsigned int console);
0157 int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm);
0158 int vt_do_kdskled(unsigned int console, int cmd, unsigned long arg, int perm);
0159 int vt_do_kdgkbmode(unsigned int console);
0160 int vt_do_kdgkbmeta(unsigned int console);
0161 void vt_reset_unicode(unsigned int console);
0162 int vt_get_shift_state(void);
0163 void vt_reset_keyboard(unsigned int console);
0164 int vt_get_leds(unsigned int console, int flag);
0165 int vt_get_kbd_mode_bit(unsigned int console, int bit);
0166 void vt_set_kbd_mode_bit(unsigned int console, int bit);
0167 void vt_clr_kbd_mode_bit(unsigned int console, int bit);
0168 void vt_set_led_state(unsigned int console, int leds);
0169 void vt_kbd_con_start(unsigned int console);
0170 void vt_kbd_con_stop(unsigned int console);
0171 
0172 void vc_scrolldelta_helper(struct vc_data *c, int lines,
0173         unsigned int rolled_over, void *_base, unsigned int size);
0174 
0175 #endif /* _VT_KERN_H */