^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * ebcdic keycode functions for s390 console drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright IBM Corp. 2003
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/tty.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/tty_flip.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/keyboard.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define NR_FN_HANDLER 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct kbd_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) extern int ebc_funcbufsize, ebc_funcbufleft;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) extern char *ebc_func_table[MAX_NR_FUNC];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) extern char ebc_func_buf[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) extern char *ebc_funcbufptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) extern unsigned int ebc_keymap_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern struct kbdiacruc ebc_accent_table[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) extern unsigned int ebc_accent_table_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern unsigned short *ebc_key_maps[MAX_NR_KEYMAPS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) extern unsigned short ebc_plain_map[NR_KEYS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) typedef void (fn_handler_fn)(struct kbd_data *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * FIXME: explain key_maps tricks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct kbd_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct tty_port *port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) unsigned short **key_maps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) char **func_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) fn_handler_fn **fn_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct kbdiacruc *accent_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) unsigned int accent_table_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int diacr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned short sysrq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct kbd_data *kbd_alloc(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) void kbd_free(struct kbd_data *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void kbd_ascebc(struct kbd_data *, unsigned char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void kbd_keycode(struct kbd_data *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) int kbd_ioctl(struct kbd_data *, unsigned int, unsigned long);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * Helper Functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) kbd_put_queue(struct tty_port *port, int ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) tty_insert_flip_char(port, ch, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) tty_schedule_flip(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) kbd_puts_queue(struct tty_port *port, char *cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) while (*cp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) tty_insert_flip_char(port, *cp++, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) tty_schedule_flip(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }