aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc64')
-rw-r--r--include/asm-sparc64/ioctls.h4
-rw-r--r--include/asm-sparc64/termbits.h17
-rw-r--r--include/asm-sparc64/termios.h42
3 files changed, 61 insertions, 2 deletions
diff --git a/include/asm-sparc64/ioctls.h b/include/asm-sparc64/ioctls.h
index 2223b6d0e5ed..083c9a0f37de 100644
--- a/include/asm-sparc64/ioctls.h
+++ b/include/asm-sparc64/ioctls.h
@@ -16,6 +16,10 @@
16#define TCSETS _IOW('T', 9, struct termios) 16#define TCSETS _IOW('T', 9, struct termios)
17#define TCSETSW _IOW('T', 10, struct termios) 17#define TCSETSW _IOW('T', 10, struct termios)
18#define TCSETSF _IOW('T', 11, struct termios) 18#define TCSETSF _IOW('T', 11, struct termios)
19#define TCGETS2 _IOR('T', 12, struct termios2)
20#define TCSETS2 _IOW('T', 13, struct termios2)
21#define TCSETSW2 _IOW('T', 14, struct termios2)
22#define TCSETSF2 _IOW('T', 15, struct termios2)
19 23
20/* Note that all the ioctls that are not available in Linux have a 24/* Note that all the ioctls that are not available in Linux have a
21 * double underscore on the front to: a) avoid some programs to 25 * double underscore on the front to: a) avoid some programs to
diff --git a/include/asm-sparc64/termbits.h b/include/asm-sparc64/termbits.h
index 705cd44b4173..ebe31c152f16 100644
--- a/include/asm-sparc64/termbits.h
+++ b/include/asm-sparc64/termbits.h
@@ -5,8 +5,6 @@
5 5
6typedef unsigned char cc_t; 6typedef unsigned char cc_t;
7typedef unsigned int speed_t; 7typedef unsigned int speed_t;
8
9/* XXX is this right for sparc64? it was an unsigned long... XXX */
10typedef unsigned int tcflag_t; 8typedef unsigned int tcflag_t;
11 9
12#define NCC 8 10#define NCC 8
@@ -33,6 +31,18 @@ struct termios {
33#endif 31#endif
34}; 32};
35 33
34struct termios2 {
35 tcflag_t c_iflag; /* input mode flags */
36 tcflag_t c_oflag; /* output mode flags */
37 tcflag_t c_cflag; /* control mode flags */
38 tcflag_t c_lflag; /* local mode flags */
39 cc_t c_line; /* line discipline */
40 cc_t c_cc[NCCS]; /* control characters */
41 cc_t _x_cc[2]; /* padding to match ktermios */
42 speed_t c_ispeed; /* input speed */
43 speed_t c_ospeed; /* output speed */
44};
45
36struct ktermios { 46struct ktermios {
37 tcflag_t c_iflag; /* input mode flags */ 47 tcflag_t c_iflag; /* input mode flags */
38 tcflag_t c_oflag; /* output mode flags */ 48 tcflag_t c_oflag; /* output mode flags */
@@ -161,6 +171,7 @@ struct ktermios {
161#define HUPCL 0x00000400 171#define HUPCL 0x00000400
162#define CLOCAL 0x00000800 172#define CLOCAL 0x00000800
163#define CBAUDEX 0x00001000 173#define CBAUDEX 0x00001000
174#define BOTHER 0x00001000
164#define B57600 0x00001001 175#define B57600 0x00001001
165#define B115200 0x00001002 176#define B115200 0x00001002
166#define B230400 0x00001003 177#define B230400 0x00001003
@@ -190,6 +201,8 @@ struct ktermios {
190#define CMSPAR 0x40000000 /* mark or space (stick) parity */ 201#define CMSPAR 0x40000000 /* mark or space (stick) parity */
191#define CRTSCTS 0x80000000 /* flow control */ 202#define CRTSCTS 0x80000000 /* flow control */
192 203
204#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
205
193/* c_lflag bits */ 206/* c_lflag bits */
194#define ISIG 0x00000001 207#define ISIG 0x00000001
195#define ICANON 0x00000002 208#define ICANON 0x00000002
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index f05d390993d5..ef527211f8a8 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -123,6 +123,8 @@ struct winsize {
123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \ 123 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \ 124 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
125 } \ 125 } \
126 err |= get_user((k)->c_ispeed, &(u)->c_ispeed); \
127 err |= get_user((k)->c_ospeed, &(u)->c_ospeed); \
126 err; \ 128 err; \
127}) 129})
128 130
@@ -142,6 +144,46 @@ struct winsize {
142 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \ 144 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
143 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \ 145 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
144 } \ 146 } \
147 err |= put_user((k)->c_ispeed, &(u)->c_ispeed); \
148 err |= put_user((k)->c_ospeed, &(u)->c_ospeed); \
149 err; \
150})
151
152#define user_termios_to_kernel_termios_1(k, u) \
153({ \
154 int err; \
155 err = get_user((k)->c_iflag, &(u)->c_iflag); \
156 err |= get_user((k)->c_oflag, &(u)->c_oflag); \
157 err |= get_user((k)->c_cflag, &(u)->c_cflag); \
158 err |= get_user((k)->c_lflag, &(u)->c_lflag); \
159 err |= get_user((k)->c_line, &(u)->c_line); \
160 err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
161 if((k)->c_lflag & ICANON) { \
162 err |= get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
163 err |= get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
164 } else { \
165 err |= get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
166 err |= get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
167 } \
168 err; \
169})
170
171#define kernel_termios_to_user_termios_1(u, k) \
172({ \
173 int err; \
174 err = put_user((k)->c_iflag, &(u)->c_iflag); \
175 err |= put_user((k)->c_oflag, &(u)->c_oflag); \
176 err |= put_user((k)->c_cflag, &(u)->c_cflag); \
177 err |= put_user((k)->c_lflag, &(u)->c_lflag); \
178 err |= put_user((k)->c_line, &(u)->c_line); \
179 err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
180 if(!((k)->c_lflag & ICANON)) { \
181 err |= put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
182 err |= put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
183 } else { \
184 err |= put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
185 err |= put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
186 } \
145 err; \ 187 err; \
146}) 188})
147 189