aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@evo.osdl.org>2005-09-06 08:16:24 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-06 08:16:24 -0400
commit4706df3d3c42af802597d82c8b1542c3d52eab23 (patch)
tree4c11ca2a72158cacce93ef6d2976af3a11ed314f /include/asm-powerpc
parent5bcaa155797ab62ed363932ec0f02fbcb5db1ef1 (diff)
parentcebb2b156319990fc2fba615bbfeac81be62a86a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/paulus/ppc64-2.6
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r--include/asm-powerpc/bugs.h18
-rw-r--r--include/asm-powerpc/mc146818rtc.h36
-rw-r--r--include/asm-powerpc/mman.h52
-rw-r--r--include/asm-powerpc/module.h77
-rw-r--r--include/asm-powerpc/sembuf.h36
-rw-r--r--include/asm-powerpc/shmbuf.h59
-rw-r--r--include/asm-powerpc/siginfo.h18
-rw-r--r--include/asm-powerpc/socket.h59
-rw-r--r--include/asm-powerpc/sockios.h19
-rw-r--r--include/asm-powerpc/termbits.h191
-rw-r--r--include/asm-powerpc/termios.h236
11 files changed, 801 insertions, 0 deletions
diff --git a/include/asm-powerpc/bugs.h b/include/asm-powerpc/bugs.h
new file mode 100644
index 000000000000..310187d0e33a
--- /dev/null
+++ b/include/asm-powerpc/bugs.h
@@ -0,0 +1,18 @@
1#ifndef _POWERPC_BUGS_H
2#define _POWERPC_BUGS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * This file is included by 'init/main.c' to check for
13 * architecture-dependent bugs.
14 */
15
16extern void check_bugs(void);
17
18#endif /* _POWERPC_BUGS_H */
diff --git a/include/asm-powerpc/mc146818rtc.h b/include/asm-powerpc/mc146818rtc.h
new file mode 100644
index 000000000000..a5619a2a1393
--- /dev/null
+++ b/include/asm-powerpc/mc146818rtc.h
@@ -0,0 +1,36 @@
1#ifndef _POWERPC_MC146818RTC_H
2#define _POWERPC_MC146818RTC_H
3
4/*
5 * Machine dependent access functions for RTC registers.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#ifdef __KERNEL__
14
15#include <asm/io.h>
16
17#ifndef RTC_PORT
18#define RTC_PORT(x) (0x70 + (x))
19#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */
20#endif
21
22/*
23 * The yet supported machines all access the RTC index register via
24 * an ISA port access but the way to access the date register differs ...
25 */
26#define CMOS_READ(addr) ({ \
27outb_p((addr),RTC_PORT(0)); \
28inb_p(RTC_PORT(1)); \
29})
30#define CMOS_WRITE(val, addr) ({ \
31outb_p((addr),RTC_PORT(0)); \
32outb_p((val),RTC_PORT(1)); \
33})
34
35#endif /* __KERNEL__ */
36#endif /* _POWERPC_MC146818RTC_H */
diff --git a/include/asm-powerpc/mman.h b/include/asm-powerpc/mman.h
new file mode 100644
index 000000000000..f2d55988d749
--- /dev/null
+++ b/include/asm-powerpc/mman.h
@@ -0,0 +1,52 @@
1#ifndef _POWERPC_MMAN_H
2#define _POWERPC_MMAN_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#define PROT_READ 0x1 /* page can be read */
12#define PROT_WRITE 0x2 /* page can be written */
13#define PROT_EXEC 0x4 /* page can be executed */
14#define PROT_SEM 0x8 /* page may be used for atomic ops */
15#define PROT_NONE 0x0 /* page can not be accessed */
16#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
17#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
18
19#define MAP_SHARED 0x01 /* Share changes */
20#define MAP_PRIVATE 0x02 /* Changes are private */
21#define MAP_TYPE 0x0f /* Mask for type of mapping */
22#define MAP_FIXED 0x10 /* Interpret addr exactly */
23#define MAP_ANONYMOUS 0x20 /* don't use a file */
24#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */
25#define MAP_NORESERVE 0x40 /* don't reserve swap pages */
26#define MAP_LOCKED 0x80
27
28#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
29#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
30#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
31
32#define MS_ASYNC 1 /* sync memory asynchronously */
33#define MS_INVALIDATE 2 /* invalidate the caches */
34#define MS_SYNC 4 /* synchronous memory sync */
35
36#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
37#define MCL_FUTURE 0x4000 /* lock all additions to address space */
38
39#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
40#define MAP_NONBLOCK 0x10000 /* do not block on IO */
41
42#define MADV_NORMAL 0x0 /* default page-in behavior */
43#define MADV_RANDOM 0x1 /* page-in minimum required */
44#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */
45#define MADV_WILLNEED 0x3 /* pre-fault pages */
46#define MADV_DONTNEED 0x4 /* discard these pages */
47
48/* compatibility flags */
49#define MAP_ANON MAP_ANONYMOUS
50#define MAP_FILE 0
51
52#endif /* _POWERPC_MMAN_H */
diff --git a/include/asm-powerpc/module.h b/include/asm-powerpc/module.h
new file mode 100644
index 000000000000..4438f4fd6524
--- /dev/null
+++ b/include/asm-powerpc/module.h
@@ -0,0 +1,77 @@
1#ifndef _POWERPC_MODULE_H
2#define _POWERPC_MODULE_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <linux/list.h>
12#include <asm/bug.h>
13
14
15#ifndef __powerpc64__
16/*
17 * Thanks to Paul M for explaining this.
18 *
19 * PPC can only do rel jumps += 32MB, and often the kernel and other
20 * modules are furthur away than this. So, we jump to a table of
21 * trampolines attached to the module (the Procedure Linkage Table)
22 * whenever that happens.
23 */
24
25struct ppc_plt_entry {
26 /* 16 byte jump instruction sequence (4 instructions) */
27 unsigned int jump[4];
28};
29#endif /* __powerpc64__ */
30
31
32struct mod_arch_specific {
33#ifdef __powerpc64__
34 unsigned int stubs_section; /* Index of stubs section in module */
35 unsigned int toc_section; /* What section is the TOC? */
36#else
37 /* Indices of PLT sections within module. */
38 unsigned int core_plt_section;
39 unsigned int init_plt_section;
40#endif
41
42 /* List of BUG addresses, source line numbers and filenames */
43 struct list_head bug_list;
44 struct bug_entry *bug_table;
45 unsigned int num_bugs;
46};
47
48extern struct bug_entry *module_find_bug(unsigned long bugaddr);
49
50/*
51 * Select ELF headers.
52 * Make empty section for module_frob_arch_sections to expand.
53 */
54
55#ifdef __powerpc64__
56# define Elf_Shdr Elf64_Shdr
57# define Elf_Sym Elf64_Sym
58# define Elf_Ehdr Elf64_Ehdr
59# ifdef MODULE
60 asm(".section .stubs,\"ax\",@nobits; .align 3; .previous");
61# endif
62#else
63# define Elf_Shdr Elf32_Shdr
64# define Elf_Sym Elf32_Sym
65# define Elf_Ehdr Elf32_Ehdr
66# ifdef MODULE
67 asm(".section .plt,\"ax\",@nobits; .align 3; .previous");
68 asm(".section .init.plt,\"ax\",@nobits; .align 3; .previous");
69# endif /* MODULE */
70#endif
71
72
73struct exception_table_entry;
74void sort_ex_table(struct exception_table_entry *start,
75 struct exception_table_entry *finish);
76
77#endif /* _POWERPC_MODULE_H */
diff --git a/include/asm-powerpc/sembuf.h b/include/asm-powerpc/sembuf.h
new file mode 100644
index 000000000000..c98fc18fe805
--- /dev/null
+++ b/include/asm-powerpc/sembuf.h
@@ -0,0 +1,36 @@
1#ifndef _POWERPC_SEMBUF_H
2#define _POWERPC_SEMBUF_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The semid64_ds structure for PPC architecture.
13 * Note extra padding because this structure is passed back and forth
14 * between kernel and user space.
15 *
16 * Pad space is left for:
17 * - 64-bit time_t to solve y2038 problem
18 * - 2 miscellaneous 32-bit values
19 */
20
21struct semid64_ds {
22 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
23#ifndef __powerpc64__
24 unsigned long __unused1;
25#endif
26 __kernel_time_t sem_otime; /* last semop time */
27#ifndef __powerpc64__
28 unsigned long __unused2;
29#endif
30 __kernel_time_t sem_ctime; /* last change time */
31 unsigned long sem_nsems; /* no. of semaphores in array */
32 unsigned long __unused3;
33 unsigned long __unused4;
34};
35
36#endif /* _POWERPC_SEMBUF_H */
diff --git a/include/asm-powerpc/shmbuf.h b/include/asm-powerpc/shmbuf.h
new file mode 100644
index 000000000000..29632db3b178
--- /dev/null
+++ b/include/asm-powerpc/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef _POWERPC_SHMBUF_H
2#define _POWERPC_SHMBUF_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/*
12 * The shmid64_ds structure for PPC architecture.
13 *
14 * Note extra padding because this structure is passed back and forth
15 * between kernel and user space.
16 *
17 * Pad space is left for:
18 * - 64-bit time_t to solve y2038 problem
19 * - 2 miscellaneous 32-bit values
20 */
21
22struct shmid64_ds {
23 struct ipc64_perm shm_perm; /* operation perms */
24#ifndef __power64__
25 unsigned long __unused1;
26#endif
27 __kernel_time_t shm_atime; /* last attach time */
28#ifndef __power64__
29 unsigned long __unused2;
30#endif
31 __kernel_time_t shm_dtime; /* last detach time */
32#ifndef __power64__
33 unsigned long __unused3;
34#endif
35 __kernel_time_t shm_ctime; /* last change time */
36#ifndef __power64__
37 unsigned long __unused4;
38#endif
39 size_t shm_segsz; /* size of segment (bytes) */
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused5;
44 unsigned long __unused6;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* _POWERPC_SHMBUF_H */
diff --git a/include/asm-powerpc/siginfo.h b/include/asm-powerpc/siginfo.h
new file mode 100644
index 000000000000..ae70b8010b19
--- /dev/null
+++ b/include/asm-powerpc/siginfo.h
@@ -0,0 +1,18 @@
1#ifndef _POWERPC_SIGINFO_H
2#define _POWERPC_SIGINFO_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#ifdef __powerpc64__
12# define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
13# define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
14#endif
15
16#include <asm-generic/siginfo.h>
17
18#endif /* _POWERPC_SIGINFO_H */
diff --git a/include/asm-powerpc/socket.h b/include/asm-powerpc/socket.h
new file mode 100644
index 000000000000..51a0cf5ee9f0
--- /dev/null
+++ b/include/asm-powerpc/socket.h
@@ -0,0 +1,59 @@
1#ifndef _POWERPC_SOCKET_H
2#define _POWERPC_SOCKET_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#include <asm/sockios.h>
12
13/* For setsockopt(2) */
14#define SOL_SOCKET 1
15
16#define SO_DEBUG 1
17#define SO_REUSEADDR 2
18#define SO_TYPE 3
19#define SO_ERROR 4
20#define SO_DONTROUTE 5
21#define SO_BROADCAST 6
22#define SO_SNDBUF 7
23#define SO_RCVBUF 8
24#define SO_SNDBUFFORCE 32
25#define SO_RCVBUFFORCE 33
26#define SO_KEEPALIVE 9
27#define SO_OOBINLINE 10
28#define SO_NO_CHECK 11
29#define SO_PRIORITY 12
30#define SO_LINGER 13
31#define SO_BSDCOMPAT 14
32/* To add :#define SO_REUSEPORT 15 */
33#define SO_RCVLOWAT 16
34#define SO_SNDLOWAT 17
35#define SO_RCVTIMEO 18
36#define SO_SNDTIMEO 19
37#define SO_PASSCRED 20
38#define SO_PEERCRED 21
39
40/* Security levels - as per NRL IPv6 - don't actually do anything */
41#define SO_SECURITY_AUTHENTICATION 22
42#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
43#define SO_SECURITY_ENCRYPTION_NETWORK 24
44
45#define SO_BINDTODEVICE 25
46
47/* Socket filtering */
48#define SO_ATTACH_FILTER 26
49#define SO_DETACH_FILTER 27
50
51#define SO_PEERNAME 28
52#define SO_TIMESTAMP 29
53#define SCM_TIMESTAMP SO_TIMESTAMP
54
55#define SO_ACCEPTCONN 30
56
57#define SO_PEERSEC 31
58
59#endif /* _POWERPC_SOCKET_H */
diff --git a/include/asm-powerpc/sockios.h b/include/asm-powerpc/sockios.h
new file mode 100644
index 000000000000..ef7ff664167e
--- /dev/null
+++ b/include/asm-powerpc/sockios.h
@@ -0,0 +1,19 @@
1#ifndef _POWERPC_SOCKIOS_H
2#define _POWERPC_SOCKIOS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11/* Socket-level I/O control calls. */
12#define FIOSETOWN 0x8901
13#define SIOCSPGRP 0x8902
14#define FIOGETOWN 0x8903
15#define SIOCGPGRP 0x8904
16#define SIOCATMARK 0x8905
17#define SIOCGSTAMP 0x8906 /* Get stamp */
18
19#endif /* _POWERPC_SOCKIOS_H */
diff --git a/include/asm-powerpc/termbits.h b/include/asm-powerpc/termbits.h
new file mode 100644
index 000000000000..2c5bf85a8c3c
--- /dev/null
+++ b/include/asm-powerpc/termbits.h
@@ -0,0 +1,191 @@
1#ifndef _POWERPC_TERMBITS_H
2#define _POWERPC_TERMBITS_H
3
4/*
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11typedef unsigned char cc_t;
12typedef unsigned int speed_t;
13typedef unsigned int tcflag_t;
14
15/*
16 * termios type and macro definitions. Be careful about adding stuff
17 * to this file since it's used in GNU libc and there are strict rules
18 * concerning namespace pollution.
19 */
20
21#define NCCS 19
22struct termios {
23 tcflag_t c_iflag; /* input mode flags */
24 tcflag_t c_oflag; /* output mode flags */
25 tcflag_t c_cflag; /* control mode flags */
26 tcflag_t c_lflag; /* local mode flags */
27 cc_t c_cc[NCCS]; /* control characters */
28 cc_t c_line; /* line discipline (== c_cc[19]) */
29 speed_t c_ispeed; /* input speed */
30 speed_t c_ospeed; /* output speed */
31};
32
33/* c_cc characters */
34#define VINTR 0
35#define VQUIT 1
36#define VERASE 2
37#define VKILL 3
38#define VEOF 4
39#define VMIN 5
40#define VEOL 6
41#define VTIME 7
42#define VEOL2 8
43#define VSWTC 9
44#define VWERASE 10
45#define VREPRINT 11
46#define VSUSP 12
47#define VSTART 13
48#define VSTOP 14
49#define VLNEXT 15
50#define VDISCARD 16
51
52/* c_iflag bits */
53#define IGNBRK 0000001
54#define BRKINT 0000002
55#define IGNPAR 0000004
56#define PARMRK 0000010
57#define INPCK 0000020
58#define ISTRIP 0000040
59#define INLCR 0000100
60#define IGNCR 0000200
61#define ICRNL 0000400
62#define IXON 0001000
63#define IXOFF 0002000
64#define IXANY 0004000
65#define IUCLC 0010000
66#define IMAXBEL 0020000
67#define IUTF8 0040000
68
69/* c_oflag bits */
70#define OPOST 0000001
71#define ONLCR 0000002
72#define OLCUC 0000004
73
74#define OCRNL 0000010
75#define ONOCR 0000020
76#define ONLRET 0000040
77
78#define OFILL 00000100
79#define OFDEL 00000200
80#define NLDLY 00001400
81#define NL0 00000000
82#define NL1 00000400
83#define NL2 00001000
84#define NL3 00001400
85#define TABDLY 00006000
86#define TAB0 00000000
87#define TAB1 00002000
88#define TAB2 00004000
89#define TAB3 00006000
90#define XTABS 00006000 /* required by POSIX to == TAB3 */
91#define CRDLY 00030000
92#define CR0 00000000
93#define CR1 00010000
94#define CR2 00020000
95#define CR3 00030000
96#define FFDLY 00040000
97#define FF0 00000000
98#define FF1 00040000
99#define BSDLY 00100000
100#define BS0 00000000
101#define BS1 00100000
102#define VTDLY 00200000
103#define VT0 00000000
104#define VT1 00200000
105
106/* c_cflag bit meaning */
107#define CBAUD 0000377
108#define B0 0000000 /* hang up */
109#define B50 0000001
110#define B75 0000002
111#define B110 0000003
112#define B134 0000004
113#define B150 0000005
114#define B200 0000006
115#define B300 0000007
116#define B600 0000010
117#define B1200 0000011
118#define B1800 0000012
119#define B2400 0000013
120#define B4800 0000014
121#define B9600 0000015
122#define B19200 0000016
123#define B38400 0000017
124#define EXTA B19200
125#define EXTB B38400
126#define CBAUDEX 0000000
127#define B57600 00020
128#define B115200 00021
129#define B230400 00022
130#define B460800 00023
131#define B500000 00024
132#define B576000 00025
133#define B921600 00026
134#define B1000000 00027
135#define B1152000 00030
136#define B1500000 00031
137#define B2000000 00032
138#define B2500000 00033
139#define B3000000 00034
140#define B3500000 00035
141#define B4000000 00036
142
143#define CSIZE 00001400
144#define CS5 00000000
145#define CS6 00000400
146#define CS7 00001000
147#define CS8 00001400
148
149#define CSTOPB 00002000
150#define CREAD 00004000
151#define PARENB 00010000
152#define PARODD 00020000
153#define HUPCL 00040000
154
155#define CLOCAL 00100000
156#define CRTSCTS 020000000000 /* flow control */
157
158/* c_lflag bits */
159#define ISIG 0x00000080
160#define ICANON 0x00000100
161#define XCASE 0x00004000
162#define ECHO 0x00000008
163#define ECHOE 0x00000002
164#define ECHOK 0x00000004
165#define ECHONL 0x00000010
166#define NOFLSH 0x80000000
167#define TOSTOP 0x00400000
168#define ECHOCTL 0x00000040
169#define ECHOPRT 0x00000020
170#define ECHOKE 0x00000001
171#define FLUSHO 0x00800000
172#define PENDIN 0x20000000
173#define IEXTEN 0x00000400
174
175/* Values for the ACTION argument to `tcflow'. */
176#define TCOOFF 0
177#define TCOON 1
178#define TCIOFF 2
179#define TCION 3
180
181/* Values for the QUEUE_SELECTOR argument to `tcflush'. */
182#define TCIFLUSH 0
183#define TCOFLUSH 1
184#define TCIOFLUSH 2
185
186/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */
187#define TCSANOW 0
188#define TCSADRAIN 1
189#define TCSAFLUSH 2
190
191#endif /* _POWERPC_TERMBITS_H */
diff --git a/include/asm-powerpc/termios.h b/include/asm-powerpc/termios.h
new file mode 100644
index 000000000000..237533bb0e9f
--- /dev/null
+++ b/include/asm-powerpc/termios.h
@@ -0,0 +1,236 @@
1#ifndef _POWERPC_TERMIOS_H
2#define _POWERPC_TERMIOS_H
3
4/*
5 * Liberally adapted from alpha/termios.h. In particular, the c_cc[]
6 * fields have been reordered so that termio & termios share the
7 * common subset in the same order (for brain dead programs that don't
8 * know or care about the differences).
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#include <asm/ioctls.h>
17#include <asm/termbits.h>
18
19struct sgttyb {
20 char sg_ispeed;
21 char sg_ospeed;
22 char sg_erase;
23 char sg_kill;
24 short sg_flags;
25};
26
27struct tchars {
28 char t_intrc;
29 char t_quitc;
30 char t_startc;
31 char t_stopc;
32 char t_eofc;
33 char t_brkc;
34};
35
36struct ltchars {
37 char t_suspc;
38 char t_dsuspc;
39 char t_rprntc;
40 char t_flushc;
41 char t_werasc;
42 char t_lnextc;
43};
44
45struct winsize {
46 unsigned short ws_row;
47 unsigned short ws_col;
48 unsigned short ws_xpixel;
49 unsigned short ws_ypixel;
50};
51
52#define NCC 10
53struct termio {
54 unsigned short c_iflag; /* input mode flags */
55 unsigned short c_oflag; /* output mode flags */
56 unsigned short c_cflag; /* control mode flags */
57 unsigned short c_lflag; /* local mode flags */
58 unsigned char c_line; /* line discipline */
59 unsigned char c_cc[NCC]; /* control characters */
60};
61
62/* c_cc characters */
63#define _VINTR 0
64#define _VQUIT 1
65#define _VERASE 2
66#define _VKILL 3
67#define _VEOF 4
68#define _VMIN 5
69#define _VEOL 6
70#define _VTIME 7
71#define _VEOL2 8
72#define _VSWTC 9
73
74/* line disciplines */
75#define N_TTY 0
76#define N_SLIP 1
77#define N_MOUSE 2
78#define N_PPP 3
79#define N_STRIP 4
80#define N_AX25 5
81#define N_X25 6 /* X.25 async */
82#define N_6PACK 7
83#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
84#define N_R3964 9 /* Reserved for Simatic R3964 module */
85#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */
86#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */
87#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */
88#define N_HDLC 13 /* synchronous HDLC */
89#define N_SYNC_PPP 14
90#define N_HCI 15 /* Bluetooth HCI UART */
91
92#ifdef __KERNEL__
93/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */
94#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025"
95#endif
96
97#define FIOCLEX _IO('f', 1)
98#define FIONCLEX _IO('f', 2)
99#define FIOASYNC _IOW('f', 125, int)
100#define FIONBIO _IOW('f', 126, int)
101#define FIONREAD _IOR('f', 127, int)
102#define TIOCINQ FIONREAD
103
104#define TIOCGETP _IOR('t', 8, struct sgttyb)
105#define TIOCSETP _IOW('t', 9, struct sgttyb)
106#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */
107
108#define TIOCSETC _IOW('t', 17, struct tchars)
109#define TIOCGETC _IOR('t', 18, struct tchars)
110#define TCGETS _IOR('t', 19, struct termios)
111#define TCSETS _IOW('t', 20, struct termios)
112#define TCSETSW _IOW('t', 21, struct termios)
113#define TCSETSF _IOW('t', 22, struct termios)
114
115#define TCGETA _IOR('t', 23, struct termio)
116#define TCSETA _IOW('t', 24, struct termio)
117#define TCSETAW _IOW('t', 25, struct termio)
118#define TCSETAF _IOW('t', 28, struct termio)
119
120#define TCSBRK _IO('t', 29)
121#define TCXONC _IO('t', 30)
122#define TCFLSH _IO('t', 31)
123
124#define TIOCSWINSZ _IOW('t', 103, struct winsize)
125#define TIOCGWINSZ _IOR('t', 104, struct winsize)
126#define TIOCSTART _IO('t', 110) /* start output, like ^Q */
127#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
128#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
129
130#define TIOCGLTC _IOR('t', 116, struct ltchars)
131#define TIOCSLTC _IOW('t', 117, struct ltchars)
132#define TIOCSPGRP _IOW('t', 118, int)
133#define TIOCGPGRP _IOR('t', 119, int)
134
135#define TIOCEXCL 0x540C
136#define TIOCNXCL 0x540D
137#define TIOCSCTTY 0x540E
138
139#define TIOCSTI 0x5412
140#define TIOCMGET 0x5415
141#define TIOCMBIS 0x5416
142#define TIOCMBIC 0x5417
143#define TIOCMSET 0x5418
144#define TIOCGSOFTCAR 0x5419
145#define TIOCSSOFTCAR 0x541A
146#define TIOCLINUX 0x541C
147#define TIOCCONS 0x541D
148#define TIOCGSERIAL 0x541E
149#define TIOCSSERIAL 0x541F
150#define TIOCPKT 0x5420
151
152#define TIOCNOTTY 0x5422
153#define TIOCSETD 0x5423
154#define TIOCGETD 0x5424
155#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
156
157#define TIOCSERCONFIG 0x5453
158#define TIOCSERGWILD 0x5454
159#define TIOCSERSWILD 0x5455
160#define TIOCGLCKTRMIOS 0x5456
161#define TIOCSLCKTRMIOS 0x5457
162#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
163#define TIOCSERGETLSR 0x5459 /* Get line status register */
164#define TIOCSERGETMULTI 0x545A /* Get multiport config */
165#define TIOCSERSETMULTI 0x545B /* Set multiport config */
166
167#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
168#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
169
170/* Used for packet mode */
171#define TIOCPKT_DATA 0
172#define TIOCPKT_FLUSHREAD 1
173#define TIOCPKT_FLUSHWRITE 2
174#define TIOCPKT_STOP 4
175#define TIOCPKT_START 8
176#define TIOCPKT_NOSTOP 16
177#define TIOCPKT_DOSTOP 32
178
179/* modem lines */
180#define TIOCM_LE 0x001
181#define TIOCM_DTR 0x002
182#define TIOCM_RTS 0x004
183#define TIOCM_ST 0x008
184#define TIOCM_SR 0x010
185#define TIOCM_CTS 0x020
186#define TIOCM_CAR 0x040
187#define TIOCM_RNG 0x080
188#define TIOCM_DSR 0x100
189#define TIOCM_CD TIOCM_CAR
190#define TIOCM_RI TIOCM_RNG
191#define TIOCM_OUT1 0x2000
192#define TIOCM_OUT2 0x4000
193#define TIOCM_LOOP 0x8000
194
195/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
196#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
197
198#ifdef __KERNEL__
199
200/*
201 * Translate a "termio" structure into a "termios". Ugh.
202 */
203#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
204 unsigned short __tmp; \
205 get_user(__tmp,&(termio)->x); \
206 (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \
207}
208
209#define user_termio_to_kernel_termios(termios, termio) \
210({ \
211 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
212 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
213 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
214 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
215 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
216})
217
218/*
219 * Translate a "termios" structure into a "termio". Ugh.
220 */
221#define kernel_termios_to_user_termio(termio, termios) \
222({ \
223 put_user((termios)->c_iflag, &(termio)->c_iflag); \
224 put_user((termios)->c_oflag, &(termio)->c_oflag); \
225 put_user((termios)->c_cflag, &(termio)->c_cflag); \
226 put_user((termios)->c_lflag, &(termio)->c_lflag); \
227 put_user((termios)->c_line, &(termio)->c_line); \
228 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
229})
230
231#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
232#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
233
234#endif /* __KERNEL__ */
235
236#endif /* _POWERPC_TERMIOS_H */