18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _VT_KERN_H 38c2ecf20Sopenharmony_ci#define _VT_KERN_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * this really is an extension of the vc_cons structure in console.c, but 78c2ecf20Sopenharmony_ci * with information needed by the vt package 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/vt.h> 118c2ecf20Sopenharmony_ci#include <linux/kd.h> 128c2ecf20Sopenharmony_ci#include <linux/tty.h> 138c2ecf20Sopenharmony_ci#include <linux/mutex.h> 148c2ecf20Sopenharmony_ci#include <linux/console_struct.h> 158c2ecf20Sopenharmony_ci#include <linux/mm.h> 168c2ecf20Sopenharmony_ci#include <linux/consolemap.h> 178c2ecf20Sopenharmony_ci#include <linux/notifier.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* 208c2ecf20Sopenharmony_ci * Presently, a lot of graphics programs do not restore the contents of 218c2ecf20Sopenharmony_ci * the higher font pages. Defining this flag will avoid use of them, but 228c2ecf20Sopenharmony_ci * will lose support for PIO_FONTRESET. Note that many font operations are 238c2ecf20Sopenharmony_ci * not likely to work with these programs anyway; they need to be 248c2ecf20Sopenharmony_ci * fixed. The linux/Documentation directory includes a code snippet 258c2ecf20Sopenharmony_ci * to save and restore the text font. 268c2ecf20Sopenharmony_ci */ 278c2ecf20Sopenharmony_ci#ifdef CONFIG_VGA_CONSOLE 288c2ecf20Sopenharmony_ci#define BROKEN_GRAPHICS_PROGRAMS 1 298c2ecf20Sopenharmony_ci#endif 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_civoid kd_mksound(unsigned int hz, unsigned int ticks); 328c2ecf20Sopenharmony_ciint kbd_rate(struct kbd_repeat *rep); 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciextern int fg_console, last_console, want_console; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* console.c */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ciint vc_allocate(unsigned int console); 398c2ecf20Sopenharmony_ciint vc_cons_allocated(unsigned int console); 408c2ecf20Sopenharmony_ciint vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); 418c2ecf20Sopenharmony_cistruct vc_data *vc_deallocate(unsigned int console); 428c2ecf20Sopenharmony_civoid reset_palette(struct vc_data *vc); 438c2ecf20Sopenharmony_civoid do_blank_screen(int entering_gfx); 448c2ecf20Sopenharmony_civoid do_unblank_screen(int leaving_gfx); 458c2ecf20Sopenharmony_civoid unblank_screen(void); 468c2ecf20Sopenharmony_civoid poke_blanked_console(void); 478c2ecf20Sopenharmony_ciint con_font_op(struct vc_data *vc, struct console_font_op *op); 488c2ecf20Sopenharmony_ciint con_set_cmap(unsigned char __user *cmap); 498c2ecf20Sopenharmony_ciint con_get_cmap(unsigned char __user *cmap); 508c2ecf20Sopenharmony_civoid scrollback(struct vc_data *vc); 518c2ecf20Sopenharmony_civoid scrollfront(struct vc_data *vc, int lines); 528c2ecf20Sopenharmony_civoid clear_buffer_attributes(struct vc_data *vc); 538c2ecf20Sopenharmony_civoid update_region(struct vc_data *vc, unsigned long start, int count); 548c2ecf20Sopenharmony_civoid redraw_screen(struct vc_data *vc, int is_switch); 558c2ecf20Sopenharmony_ci#define update_screen(x) redraw_screen(x, 0) 568c2ecf20Sopenharmony_ci#define switch_screen(x) redraw_screen(x, 1) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cistruct tty_struct; 598c2ecf20Sopenharmony_ciint tioclinux(struct tty_struct *tty, unsigned long arg); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#ifdef CONFIG_CONSOLE_TRANSLATIONS 628c2ecf20Sopenharmony_ci/* consolemap.c */ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_cistruct unipair; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciint con_set_trans_old(unsigned char __user * table); 678c2ecf20Sopenharmony_ciint con_get_trans_old(unsigned char __user * table); 688c2ecf20Sopenharmony_ciint con_set_trans_new(unsigned short __user * table); 698c2ecf20Sopenharmony_ciint con_get_trans_new(unsigned short __user * table); 708c2ecf20Sopenharmony_ciint con_clear_unimap(struct vc_data *vc); 718c2ecf20Sopenharmony_ciint con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list); 728c2ecf20Sopenharmony_ciint con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list); 738c2ecf20Sopenharmony_ciint con_set_default_unimap(struct vc_data *vc); 748c2ecf20Sopenharmony_civoid con_free_unimap(struct vc_data *vc); 758c2ecf20Sopenharmony_ciint con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#else 788c2ecf20Sopenharmony_cistatic inline int con_set_trans_old(unsigned char __user *table) 798c2ecf20Sopenharmony_ci{ 808c2ecf20Sopenharmony_ci return 0; 818c2ecf20Sopenharmony_ci} 828c2ecf20Sopenharmony_cistatic inline int con_get_trans_old(unsigned char __user *table) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci return -EINVAL; 858c2ecf20Sopenharmony_ci} 868c2ecf20Sopenharmony_cistatic inline int con_set_trans_new(unsigned short __user *table) 878c2ecf20Sopenharmony_ci{ 888c2ecf20Sopenharmony_ci return 0; 898c2ecf20Sopenharmony_ci} 908c2ecf20Sopenharmony_cistatic inline int con_get_trans_new(unsigned short __user *table) 918c2ecf20Sopenharmony_ci{ 928c2ecf20Sopenharmony_ci return -EINVAL; 938c2ecf20Sopenharmony_ci} 948c2ecf20Sopenharmony_cistatic inline int con_clear_unimap(struct vc_data *vc) 958c2ecf20Sopenharmony_ci{ 968c2ecf20Sopenharmony_ci return 0; 978c2ecf20Sopenharmony_ci} 988c2ecf20Sopenharmony_cistatic inline 998c2ecf20Sopenharmony_ciint con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) 1008c2ecf20Sopenharmony_ci{ 1018c2ecf20Sopenharmony_ci return 0; 1028c2ecf20Sopenharmony_ci} 1038c2ecf20Sopenharmony_cistatic inline 1048c2ecf20Sopenharmony_ciint con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, 1058c2ecf20Sopenharmony_ci struct unipair __user *list) 1068c2ecf20Sopenharmony_ci{ 1078c2ecf20Sopenharmony_ci return -EINVAL; 1088c2ecf20Sopenharmony_ci} 1098c2ecf20Sopenharmony_cistatic inline int con_set_default_unimap(struct vc_data *vc) 1108c2ecf20Sopenharmony_ci{ 1118c2ecf20Sopenharmony_ci return 0; 1128c2ecf20Sopenharmony_ci} 1138c2ecf20Sopenharmony_cistatic inline void con_free_unimap(struct vc_data *vc) 1148c2ecf20Sopenharmony_ci{ 1158c2ecf20Sopenharmony_ci} 1168c2ecf20Sopenharmony_cistatic inline void con_protect_unimap(struct vc_data *vc, int rdonly) 1178c2ecf20Sopenharmony_ci{ 1188c2ecf20Sopenharmony_ci} 1198c2ecf20Sopenharmony_cistatic inline 1208c2ecf20Sopenharmony_ciint con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc) 1218c2ecf20Sopenharmony_ci{ 1228c2ecf20Sopenharmony_ci return 0; 1238c2ecf20Sopenharmony_ci} 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#endif 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* vt.c */ 1288c2ecf20Sopenharmony_civoid vt_event_post(unsigned int event, unsigned int old, unsigned int new); 1298c2ecf20Sopenharmony_ciint vt_waitactive(int n); 1308c2ecf20Sopenharmony_civoid change_console(struct vc_data *new_vc); 1318c2ecf20Sopenharmony_civoid reset_vc(struct vc_data *vc); 1328c2ecf20Sopenharmony_ciint do_unbind_con_driver(const struct consw *csw, int first, int last, 1338c2ecf20Sopenharmony_ci int deflt); 1348c2ecf20Sopenharmony_ciint vty_init(const struct file_operations *console_fops); 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ciextern bool vt_dont_switch; 1378c2ecf20Sopenharmony_ciextern int default_utf8; 1388c2ecf20Sopenharmony_ciextern int global_cursor_default; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_cistruct vt_spawn_console { 1418c2ecf20Sopenharmony_ci spinlock_t lock; 1428c2ecf20Sopenharmony_ci struct pid *pid; 1438c2ecf20Sopenharmony_ci int sig; 1448c2ecf20Sopenharmony_ci}; 1458c2ecf20Sopenharmony_ciextern struct vt_spawn_console vt_spawn_con; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_ciint vt_move_to_console(unsigned int vt, int alloc); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci/* Interfaces for VC notification of character events (for accessibility etc) */ 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cistruct vt_notifier_param { 1528c2ecf20Sopenharmony_ci struct vc_data *vc; /* VC on which the update happened */ 1538c2ecf20Sopenharmony_ci unsigned int c; /* Printed char */ 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ciint register_vt_notifier(struct notifier_block *nb); 1578c2ecf20Sopenharmony_ciint unregister_vt_notifier(struct notifier_block *nb); 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_civoid hide_boot_cursor(bool hide); 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* keyboard provided interfaces */ 1628c2ecf20Sopenharmony_ciint vt_do_diacrit(unsigned int cmd, void __user *up, int eperm); 1638c2ecf20Sopenharmony_ciint vt_do_kdskbmode(int console, unsigned int arg); 1648c2ecf20Sopenharmony_ciint vt_do_kdskbmeta(int console, unsigned int arg); 1658c2ecf20Sopenharmony_ciint vt_do_kbkeycode_ioctl(int cmd, struct kbkeycode __user *user_kbkc, 1668c2ecf20Sopenharmony_ci int perm); 1678c2ecf20Sopenharmony_ciint vt_do_kdsk_ioctl(int cmd, struct kbentry __user *user_kbe, int perm, 1688c2ecf20Sopenharmony_ci int console); 1698c2ecf20Sopenharmony_ciint vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm); 1708c2ecf20Sopenharmony_ciint vt_do_kdskled(int console, int cmd, unsigned long arg, int perm); 1718c2ecf20Sopenharmony_ciint vt_do_kdgkbmode(int console); 1728c2ecf20Sopenharmony_ciint vt_do_kdgkbmeta(int console); 1738c2ecf20Sopenharmony_civoid vt_reset_unicode(int console); 1748c2ecf20Sopenharmony_ciint vt_get_shift_state(void); 1758c2ecf20Sopenharmony_civoid vt_reset_keyboard(int console); 1768c2ecf20Sopenharmony_ciint vt_get_leds(int console, int flag); 1778c2ecf20Sopenharmony_ciint vt_get_kbd_mode_bit(int console, int bit); 1788c2ecf20Sopenharmony_civoid vt_set_kbd_mode_bit(int console, int bit); 1798c2ecf20Sopenharmony_civoid vt_clr_kbd_mode_bit(int console, int bit); 1808c2ecf20Sopenharmony_civoid vt_set_led_state(int console, int leds); 1818c2ecf20Sopenharmony_civoid vt_set_led_state(int console, int leds); 1828c2ecf20Sopenharmony_civoid vt_kbd_con_start(int console); 1838c2ecf20Sopenharmony_civoid vt_kbd_con_stop(int console); 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_civoid vc_scrolldelta_helper(struct vc_data *c, int lines, 1868c2ecf20Sopenharmony_ci unsigned int rolled_over, void *_base, unsigned int size); 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ci#endif /* _VT_KERN_H */ 189