diff mbox series

[1/4] linux-user: alpha: Synchronize termbits.h with kernel

Message ID 1579227117-6310-2-git-send-email-aleksandar.markovic@rt-rk.com
State New
Headers show
Series linux-user: Fix some issues in termbits.h files | expand

Commit Message

Aleksandar Markovic Jan. 17, 2020, 2:11 a.m. UTC
From: Aleksandar Markovic <amarkovic@wavecomp.com>

Synchronize all elements of alpha's termbits.h with kernel and
make sure that all applicable macros and other definitions are
expressed in terms of target, not the host.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/alpha/termbits.h | 82 +++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 76 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
index a714251..d15f26e 100644
--- a/linux-user/alpha/termbits.h
+++ b/linux-user/alpha/termbits.h
@@ -17,6 +17,32 @@  struct target_termios {
 	target_speed_t c_ospeed;		/* output speed */
 };
 
+/* Alpha has identical termios and termios2 */
+
+struct target_termios2 {
+    target_tcflag_t c_iflag;            /* input mode flags */
+    target_tcflag_t c_oflag;            /* output mode flags */
+    target_tcflag_t c_cflag;            /* control mode flags */
+    target_tcflag_t c_lflag;            /* local mode flags */
+    target_cc_t c_cc[TARGET_NCCS];      /* control characters */
+    target_cc_t c_line;                 /* line discipline (== c_cc[19]) */
+    target_speed_t c_ispeed;            /* input speed */
+    target_speed_t c_ospeed;            /* output speed */
+};
+
+/* Alpha has matching termios and ktermios */
+
+struct target_ktermios {
+    target_tcflag_t c_iflag;            /* input mode flags */
+    target_tcflag_t c_oflag;            /* output mode flags */
+    target_tcflag_t c_cflag;            /* control mode flags */
+    target_tcflag_t c_lflag;            /* local mode flags */
+    target_cc_t c_cc[TARGET_NCCS];      /* control characters */
+    target_cc_t c_line;                 /* line discipline (== c_cc[19]) */
+    target_speed_t c_ispeed;            /* input speed */
+    target_speed_t c_ospeed;            /* output speed */
+};
+
 /* c_cc characters */
 #define TARGET_VEOF 0
 #define TARGET_VEOL 1
@@ -88,7 +114,11 @@  struct target_termios {
 #define TARGET_VTDLY	00200000
 #define   TARGET_VT0	00000000
 #define   TARGET_VT1	00200000
-#define TARGET_XTABS	01000000 /* Hmm.. Linux/i386 considers this part of TABDLY.. */
+/*
+ * Should be equivalent to TAB3, see description of TAB3 in
+ * POSIX.1-2008, Ch. 11.2.3 "Output Modes"
+ */
+#define TARGET_XTABS    TARGET_TAB3
 
 /* c_cflag bit meaning */
 #define TARGET_CBAUD	0000037
@@ -108,8 +138,8 @@  struct target_termios {
 #define  TARGET_B9600	0000015
 #define  TARGET_B19200	0000016
 #define  TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CBAUDEX 0000000
 #define  TARGET_B57600   00020
 #define  TARGET_B115200  00021
@@ -143,6 +173,9 @@  struct target_termios {
 #define TARGET_CMSPAR	  010000000000		/* mark or space (stick) parity */
 #define TARGET_CRTSCTS	  020000000000		/* flow control */
 
+#define TARGET_CIBAUD   07600000
+#define TARGET_IBSHIFT  16
+
 /* c_lflag bits */
 #define TARGET_ISIG	0x00000080
 #define TARGET_ICANON	0x00000100
@@ -159,13 +192,30 @@  struct target_termios {
 #define TARGET_FLUSHO	0x00800000
 #define TARGET_PENDIN	0x20000000
 #define TARGET_IEXTEN	0x00000400
+#define TARGET_EXTPROC  0x10000000
+
+/* Values for the ACTION argument to `tcflow'.  */
+#define TCOOFF          0
+#define TCOON           1
+#define TCIOFF          2
+#define TCION           3
+
+/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
+#define TCIFLUSH        0
+#define TCOFLUSH        1
+#define TCIOFLUSH       2
+
+/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
+#define TCSANOW         0
+#define TCSADRAIN       1
+#define TCSAFLUSH       2
 
 #define TARGET_FIOCLEX		TARGET_IO('f', 1)
 #define TARGET_FIONCLEX	TARGET_IO('f', 2)
 #define TARGET_FIOASYNC	TARGET_IOW('f', 125, int)
 #define TARGET_FIONBIO		TARGET_IOW('f', 126, int)
 #define TARGET_FIONREAD	TARGET_IOR('f', 127, int)
-#define TARGET_TIOCINQ		FIONREAD
+#define TARGET_TIOCINQ  TARGET_FIONREAD
 #define TARGET_FIOQSIZE	TARGET_IOR('f', 128, loff_t)
 
 #define TARGET_TIOCGETP	TARGET_IOR('t', 8, struct target_sgttyb)
@@ -188,6 +238,11 @@  struct target_termios {
 #define TARGET_TCXONC		TARGET_IO('t', 30)
 #define TARGET_TCFLSH		TARGET_IO('t', 31)
 
+#define TARGET_TCGETS2          TARGET_IOR('T', 42, struct target_termios2)
+#define TARGET_TCSETS2          TARGET_IOW('T', 43, struct target_termios2)
+#define TARGET_TCSETSW2         TARGET_IOW('T', 44, struct target_termios2)
+#define TARGET_TCSETSF2         TARGET_IOW('T', 45, struct target_termios2)
+
 #define TARGET_TIOCSWINSZ	TARGET_IOW('t', 103, struct target_winsize)
 #define TARGET_TIOCGWINSZ	TARGET_IOR('t', 104, struct target_winsize)
 #define	TARGET_TIOCSTART	TARGET_IO('t', 110)		/* start output, like ^Q */
@@ -217,8 +272,8 @@  struct target_termios {
 # define TARGET_TIOCM_CAR	0x040
 # define TARGET_TIOCM_RNG	0x080
 # define TARGET_TIOCM_DSR	0x100
-# define TARGET_TIOCM_CD	TIOCM_CAR
-# define TARGET_TIOCM_RI	TIOCM_RNG
+# define TARGET_TIOCM_CD        TARGET_TIOCM_CAR
+# define TARGET_TIOCM_RI        TARGET_TIOCM_RNG
 # define TARGET_TIOCM_OUT1	0x2000
 # define TARGET_TIOCM_OUT2	0x4000
 # define TARGET_TIOCM_LOOP	0x8000
@@ -246,9 +301,24 @@  struct target_termios {
 #define TARGET_TIOCSBRK	0x5427  /* BSD compatibility */
 #define TARGET_TIOCCBRK	0x5428  /* BSD compatibility */
 #define TARGET_TIOCGSID	0x5429  /* Return the session ID of FD */
+#define TARGET_TIOCGRS485       TARGET_IOR('T', 0x2E, struct serial_rs485)
+#define TARGET_TIOCSRS485       TARGET_IOWR('T', 0x2F, struct serial_rs485)
 #define TARGET_TIOCGPTN	TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
 #define TARGET_TIOCSPTLCK	TARGET_IOW('T',0x31, int)  /* Lock/unlock Pty */
+                                /* Get primary device node of /dev/console */
+#define TARGET_TIOCGDEV         TARGET_IOR('T', 0x32, unsigned int)
+                                /* Generate signal on Pty slave */
+#define TARGET_TIOCSIG          TARGET_IOW('T', 0x36, int)
+#define TARGET_TIOCVHANGUP      0x5437
+                                 /* Get packet mode state */
+#define TARGET_TIOCGPKT         TARGET_IOR('T', 0x38, int)
+                                /* Get Pty lock state */
+#define TARGET_TIOCGPTLCK       TARGET_IOR('T', 0x39, int)
+                                /* Get exclusive mode state */
+#define TARGET_TIOCGEXCL        TARGET_IOR('T', 0x40, int)
 #define TARGET_TIOCGPTPEER      TARGET_IO('T', 0x41) /* Safely open the slave */
+#define TARGET_TIOCGISO7816     TARGET_IOR('T', 0x42, struct serial_iso7816)
+#define TARGET_TIOCSISO7816     TARGET_IOWR('T', 0x43, struct serial_iso7816)
 
 #define TARGET_TIOCSERCONFIG	0x5453
 #define TARGET_TIOCSERGWILD	0x5454