aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 21:06:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-15 21:06:13 -0500
commitdab363f938a53ddaee60bfecc1aebdbb3d3af5f0 (patch)
treeccdb11a6e6191ba71fbc7716714c47b79172070d /include/uapi
parenta68db9cb858d10820add66682ad4d412f9914288 (diff)
parent17d2c6439be65777245914be354c5a97c76ad246 (diff)
Merge tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH: "Here's the big staging tree pull request for 3.19-rc1. We continued to delete more lines than were added, always a good thing, but not at a huge rate this release, only about 70k lines removed overall mostly from removing the horrid bcm driver. Lots of normal staging driver cleanups and fixes all over the place, well over a thousand of them, the shortlog shows all the horrid details. The "contentious" thing here is the movement of the Android binder code out of staging into the "real" part of the kernel. This is code that has been stable for a few years now and is working as-is in the tens of millions of devices with no issues. Yes, the code is horrid, and the userspace api leaves a lot to be desired, but it's not going to change due to legacy issues that we have no control over. Because so many devices and companies rely on this, and the code is stable, might as well promote it out of staging. This was all discussed at the Linux Plumbers conference, and everyone participating agreed that this was the best way forward. There is work happening to replace the binder code with something new that is happening right now, but I don't expect to see the results of that work for another year at the earliest. If that ever happens, and Android switches over to it, I'll gladly remove this version. As for maintainers, I'll be glad to maintain this code, I've been doing it for the past few years with no problems. I'll send a MAINTAINERS entry for it before 3.19-final is out, still need to talk to the Google developers about if they are willing to help with it or not, last I checked they were, which was good. All of these patches have been in linux-next for a while with no reported issues" * tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits) Staging: slicoss: Fix long line issues in slicoss.c staging: rtl8712: remove unnecessary else after return staging: comedi: change some printk calls to pr_err staging: rtl8723au: hal: Removed the extra semicolon lustre: Deletion of unnecessary checks before three function calls staging: lustre: fix sparse warnings: static function declaration staging: lustre: fixed sparse warnings related to static declarations staging: unisys: remove duplicate header staging: unisys: remove unneeded structure staging: ft1000 : replace __attribute ((__packed__) with __packed drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c" Drivers:staging:rtl8192e: Fixed checkpatch warning Drivers:staging:clocking-wizard: Added a newline staging: clocking-wizard: check for a valid clk_name pointer staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1() staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB() staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation ...
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/android/Kbuild2
-rw-r--r--include/uapi/linux/android/binder.h352
3 files changed, 355 insertions, 0 deletions
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index d8e1716707ba..cea258f1d9d2 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -1,4 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += android/
2header-y += byteorder/ 3header-y += byteorder/
3header-y += can/ 4header-y += can/
4header-y += caif/ 5header-y += caif/
diff --git a/include/uapi/linux/android/Kbuild b/include/uapi/linux/android/Kbuild
new file mode 100644
index 000000000000..ca011eec252a
--- /dev/null
+++ b/include/uapi/linux/android/Kbuild
@@ -0,0 +1,2 @@
1# UAPI Header export list
2header-y += binder.h
diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h
new file mode 100644
index 000000000000..41420e341e75
--- /dev/null
+++ b/include/uapi/linux/android/binder.h
@@ -0,0 +1,352 @@
1/*
2 * Copyright (C) 2008 Google, Inc.
3 *
4 * Based on, but no longer compatible with, the original
5 * OpenBinder.org binder driver interface, which is:
6 *
7 * Copyright (c) 2005 Palmsource, Inc.
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef _UAPI_LINUX_BINDER_H
21#define _UAPI_LINUX_BINDER_H
22
23#include <linux/types.h>
24#include <linux/ioctl.h>
25
26#define B_PACK_CHARS(c1, c2, c3, c4) \
27 ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
28#define B_TYPE_LARGE 0x85
29
30enum {
31 BINDER_TYPE_BINDER = B_PACK_CHARS('s', 'b', '*', B_TYPE_LARGE),
32 BINDER_TYPE_WEAK_BINDER = B_PACK_CHARS('w', 'b', '*', B_TYPE_LARGE),
33 BINDER_TYPE_HANDLE = B_PACK_CHARS('s', 'h', '*', B_TYPE_LARGE),
34 BINDER_TYPE_WEAK_HANDLE = B_PACK_CHARS('w', 'h', '*', B_TYPE_LARGE),
35 BINDER_TYPE_FD = B_PACK_CHARS('f', 'd', '*', B_TYPE_LARGE),
36};
37
38enum {
39 FLAT_BINDER_FLAG_PRIORITY_MASK = 0xff,
40 FLAT_BINDER_FLAG_ACCEPTS_FDS = 0x100,
41};
42
43#ifdef BINDER_IPC_32BIT
44typedef __u32 binder_size_t;
45typedef __u32 binder_uintptr_t;
46#else
47typedef __u64 binder_size_t;
48typedef __u64 binder_uintptr_t;
49#endif
50
51/*
52 * This is the flattened representation of a Binder object for transfer
53 * between processes. The 'offsets' supplied as part of a binder transaction
54 * contains offsets into the data where these structures occur. The Binder
55 * driver takes care of re-writing the structure type and data as it moves
56 * between processes.
57 */
58struct flat_binder_object {
59 /* 8 bytes for large_flat_header. */
60 __u32 type;
61 __u32 flags;
62
63 /* 8 bytes of data. */
64 union {
65 binder_uintptr_t binder; /* local object */
66 __u32 handle; /* remote object */
67 };
68
69 /* extra data associated with local object */
70 binder_uintptr_t cookie;
71};
72
73/*
74 * On 64-bit platforms where user code may run in 32-bits the driver must
75 * translate the buffer (and local binder) addresses appropriately.
76 */
77
78struct binder_write_read {
79 binder_size_t write_size; /* bytes to write */
80 binder_size_t write_consumed; /* bytes consumed by driver */
81 binder_uintptr_t write_buffer;
82 binder_size_t read_size; /* bytes to read */
83 binder_size_t read_consumed; /* bytes consumed by driver */
84 binder_uintptr_t read_buffer;
85};
86
87/* Use with BINDER_VERSION, driver fills in fields. */
88struct binder_version {
89 /* driver protocol version -- increment with incompatible change */
90 __s32 protocol_version;
91};
92
93/* This is the current protocol version. */
94#ifdef BINDER_IPC_32BIT
95#define BINDER_CURRENT_PROTOCOL_VERSION 7
96#else
97#define BINDER_CURRENT_PROTOCOL_VERSION 8
98#endif
99
100#define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read)
101#define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
102#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
103#define BINDER_SET_IDLE_PRIORITY _IOW('b', 6, __s32)
104#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
105#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
106#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
107
108/*
109 * NOTE: Two special error codes you should check for when calling
110 * in to the driver are:
111 *
112 * EINTR -- The operation has been interupted. This should be
113 * handled by retrying the ioctl() until a different error code
114 * is returned.
115 *
116 * ECONNREFUSED -- The driver is no longer accepting operations
117 * from your process. That is, the process is being destroyed.
118 * You should handle this by exiting from your process. Note
119 * that once this error code is returned, all further calls to
120 * the driver from any thread will return this same code.
121 */
122
123enum transaction_flags {
124 TF_ONE_WAY = 0x01, /* this is a one-way call: async, no return */
125 TF_ROOT_OBJECT = 0x04, /* contents are the component's root object */
126 TF_STATUS_CODE = 0x08, /* contents are a 32-bit status code */
127 TF_ACCEPT_FDS = 0x10, /* allow replies with file descriptors */
128};
129
130struct binder_transaction_data {
131 /* The first two are only used for bcTRANSACTION and brTRANSACTION,
132 * identifying the target and contents of the transaction.
133 */
134 union {
135 /* target descriptor of command transaction */
136 __u32 handle;
137 /* target descriptor of return transaction */
138 binder_uintptr_t ptr;
139 } target;
140 binder_uintptr_t cookie; /* target object cookie */
141 __u32 code; /* transaction command */
142
143 /* General information about the transaction. */
144 __u32 flags;
145 pid_t sender_pid;
146 uid_t sender_euid;
147 binder_size_t data_size; /* number of bytes of data */
148 binder_size_t offsets_size; /* number of bytes of offsets */
149
150 /* If this transaction is inline, the data immediately
151 * follows here; otherwise, it ends with a pointer to
152 * the data buffer.
153 */
154 union {
155 struct {
156 /* transaction data */
157 binder_uintptr_t buffer;
158 /* offsets from buffer to flat_binder_object structs */
159 binder_uintptr_t offsets;
160 } ptr;
161 __u8 buf[8];
162 } data;
163};
164
165struct binder_ptr_cookie {
166 binder_uintptr_t ptr;
167 binder_uintptr_t cookie;
168};
169
170struct binder_handle_cookie {
171 __u32 handle;
172 binder_uintptr_t cookie;
173} __packed;
174
175struct binder_pri_desc {
176 __s32 priority;
177 __u32 desc;
178};
179
180struct binder_pri_ptr_cookie {
181 __s32 priority;
182 binder_uintptr_t ptr;
183 binder_uintptr_t cookie;
184};
185
186enum binder_driver_return_protocol {
187 BR_ERROR = _IOR('r', 0, __s32),
188 /*
189 * int: error code
190 */
191
192 BR_OK = _IO('r', 1),
193 /* No parameters! */
194
195 BR_TRANSACTION = _IOR('r', 2, struct binder_transaction_data),
196 BR_REPLY = _IOR('r', 3, struct binder_transaction_data),
197 /*
198 * binder_transaction_data: the received command.
199 */
200
201 BR_ACQUIRE_RESULT = _IOR('r', 4, __s32),
202 /*
203 * not currently supported
204 * int: 0 if the last bcATTEMPT_ACQUIRE was not successful.
205 * Else the remote object has acquired a primary reference.
206 */
207
208 BR_DEAD_REPLY = _IO('r', 5),
209 /*
210 * The target of the last transaction (either a bcTRANSACTION or
211 * a bcATTEMPT_ACQUIRE) is no longer with us. No parameters.
212 */
213
214 BR_TRANSACTION_COMPLETE = _IO('r', 6),
215 /*
216 * No parameters... always refers to the last transaction requested
217 * (including replies). Note that this will be sent even for
218 * asynchronous transactions.
219 */
220
221 BR_INCREFS = _IOR('r', 7, struct binder_ptr_cookie),
222 BR_ACQUIRE = _IOR('r', 8, struct binder_ptr_cookie),
223 BR_RELEASE = _IOR('r', 9, struct binder_ptr_cookie),
224 BR_DECREFS = _IOR('r', 10, struct binder_ptr_cookie),
225 /*
226 * void *: ptr to binder
227 * void *: cookie for binder
228 */
229
230 BR_ATTEMPT_ACQUIRE = _IOR('r', 11, struct binder_pri_ptr_cookie),
231 /*
232 * not currently supported
233 * int: priority
234 * void *: ptr to binder
235 * void *: cookie for binder
236 */
237
238 BR_NOOP = _IO('r', 12),
239 /*
240 * No parameters. Do nothing and examine the next command. It exists
241 * primarily so that we can replace it with a BR_SPAWN_LOOPER command.
242 */
243
244 BR_SPAWN_LOOPER = _IO('r', 13),
245 /*
246 * No parameters. The driver has determined that a process has no
247 * threads waiting to service incoming transactions. When a process
248 * receives this command, it must spawn a new service thread and
249 * register it via bcENTER_LOOPER.
250 */
251
252 BR_FINISHED = _IO('r', 14),
253 /*
254 * not currently supported
255 * stop threadpool thread
256 */
257
258 BR_DEAD_BINDER = _IOR('r', 15, binder_uintptr_t),
259 /*
260 * void *: cookie
261 */
262 BR_CLEAR_DEATH_NOTIFICATION_DONE = _IOR('r', 16, binder_uintptr_t),
263 /*
264 * void *: cookie
265 */
266
267 BR_FAILED_REPLY = _IO('r', 17),
268 /*
269 * The the last transaction (either a bcTRANSACTION or
270 * a bcATTEMPT_ACQUIRE) failed (e.g. out of memory). No parameters.
271 */
272};
273
274enum binder_driver_command_protocol {
275 BC_TRANSACTION = _IOW('c', 0, struct binder_transaction_data),
276 BC_REPLY = _IOW('c', 1, struct binder_transaction_data),
277 /*
278 * binder_transaction_data: the sent command.
279 */
280
281 BC_ACQUIRE_RESULT = _IOW('c', 2, __s32),
282 /*
283 * not currently supported
284 * int: 0 if the last BR_ATTEMPT_ACQUIRE was not successful.
285 * Else you have acquired a primary reference on the object.
286 */
287
288 BC_FREE_BUFFER = _IOW('c', 3, binder_uintptr_t),
289 /*
290 * void *: ptr to transaction data received on a read
291 */
292
293 BC_INCREFS = _IOW('c', 4, __u32),
294 BC_ACQUIRE = _IOW('c', 5, __u32),
295 BC_RELEASE = _IOW('c', 6, __u32),
296 BC_DECREFS = _IOW('c', 7, __u32),
297 /*
298 * int: descriptor
299 */
300
301 BC_INCREFS_DONE = _IOW('c', 8, struct binder_ptr_cookie),
302 BC_ACQUIRE_DONE = _IOW('c', 9, struct binder_ptr_cookie),
303 /*
304 * void *: ptr to binder
305 * void *: cookie for binder
306 */
307
308 BC_ATTEMPT_ACQUIRE = _IOW('c', 10, struct binder_pri_desc),
309 /*
310 * not currently supported
311 * int: priority
312 * int: descriptor
313 */
314
315 BC_REGISTER_LOOPER = _IO('c', 11),
316 /*
317 * No parameters.
318 * Register a spawned looper thread with the device.
319 */
320
321 BC_ENTER_LOOPER = _IO('c', 12),
322 BC_EXIT_LOOPER = _IO('c', 13),
323 /*
324 * No parameters.
325 * These two commands are sent as an application-level thread
326 * enters and exits the binder loop, respectively. They are
327 * used so the binder can have an accurate count of the number
328 * of looping threads it has available.
329 */
330
331 BC_REQUEST_DEATH_NOTIFICATION = _IOW('c', 14,
332 struct binder_handle_cookie),
333 /*
334 * int: handle
335 * void *: cookie
336 */
337
338 BC_CLEAR_DEATH_NOTIFICATION = _IOW('c', 15,
339 struct binder_handle_cookie),
340 /*
341 * int: handle
342 * void *: cookie
343 */
344
345 BC_DEAD_BINDER_DONE = _IOW('c', 16, binder_uintptr_t),
346 /*
347 * void *: cookie
348 */
349};
350
351#endif /* _UAPI_LINUX_BINDER_H */
352