1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
3
4 #ifndef VCHIQ_CORE_H
5 #define VCHIQ_CORE_H
6
7 #include <linux/mutex.h>
8 #include <linux/completion.h>
9 #include <linux/kthread.h>
10 #include <linux/kref.h>
11 #include <linux/rcupdate.h>
12 #include <linux/wait.h>
13 #include <linux/raspberrypi/vchiq.h>
14
15 #include "vchiq_cfg.h"
16
17
18 /* Do this so that we can test-build the code on non-rpi systems */
19 #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
20
21 #else
22
23 #ifndef dsb
24 #define dsb(a)
25 #endif
26
27 #endif /* IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE) */
28
29 #define VCHIQ_SERVICE_HANDLE_INVALID 0
30
31 #define VCHIQ_SLOT_SIZE 4096
32 #define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header))
33
34 /* Run time control of log level, based on KERN_XXX level. */
35 #define VCHIQ_LOG_DEFAULT 4
36 #define VCHIQ_LOG_ERROR 3
37 #define VCHIQ_LOG_WARNING 4
38 #define VCHIQ_LOG_INFO 6
39 #define VCHIQ_LOG_TRACE 7
40
41 #define VCHIQ_LOG_PREFIX KERN_INFO "vchiq: "
42
43 #ifndef vchiq_log_error
44 #define vchiq_log_error(cat, fmt, ...) \
45 do { if (cat >= VCHIQ_LOG_ERROR) \
46 printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
47 #endif
48 #ifndef vchiq_log_warning
49 #define vchiq_log_warning(cat, fmt, ...) \
50 do { if (cat >= VCHIQ_LOG_WARNING) \
51 printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
52 #endif
53 #ifndef vchiq_log_info
54 #define vchiq_log_info(cat, fmt, ...) \
55 do { if (cat >= VCHIQ_LOG_INFO) \
56 printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
57 #endif
58 #ifndef vchiq_log_trace
59 #define vchiq_log_trace(cat, fmt, ...) \
60 do { if (cat >= VCHIQ_LOG_TRACE) \
61 printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
62 #endif
63
64 #define vchiq_loud_error(...) \
65 vchiq_log_error(vchiq_core_log_level, "===== " __VA_ARGS__)
66
67 #ifndef vchiq_static_assert
68 #define vchiq_static_assert(cond) __attribute__((unused)) \
69 extern int vchiq_static_assert[(cond) ? 1 : -1]
70 #endif
71
72 #define IS_POW2(x) (x && ((x & (x - 1)) == 0))
73
74 /* Ensure that the slot size and maximum number of slots are powers of 2 */
75 vchiq_static_assert(IS_POW2(VCHIQ_SLOT_SIZE));
76 vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS));
77 vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS_PER_SIDE));
78
79 #define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1)
80 #define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1)
81 #define VCHIQ_SLOT_ZERO_SLOTS DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \
82 VCHIQ_SLOT_SIZE)
83
84 #define VCHIQ_MSG_PADDING 0 /* - */
85 #define VCHIQ_MSG_CONNECT 1 /* - */
86 #define VCHIQ_MSG_OPEN 2 /* + (srcport, -), fourcc, client_id */
87 #define VCHIQ_MSG_OPENACK 3 /* + (srcport, dstport) */
88 #define VCHIQ_MSG_CLOSE 4 /* + (srcport, dstport) */
89 #define VCHIQ_MSG_DATA 5 /* + (srcport, dstport) */
90 #define VCHIQ_MSG_BULK_RX 6 /* + (srcport, dstport), data, size */
91 #define VCHIQ_MSG_BULK_TX 7 /* + (srcport, dstport), data, size */
92 #define VCHIQ_MSG_BULK_RX_DONE 8 /* + (srcport, dstport), actual */
93 #define VCHIQ_MSG_BULK_TX_DONE 9 /* + (srcport, dstport), actual */
94 #define VCHIQ_MSG_PAUSE 10 /* - */
95 #define VCHIQ_MSG_RESUME 11 /* - */
96 #define VCHIQ_MSG_REMOTE_USE 12 /* - */
97 #define VCHIQ_MSG_REMOTE_RELEASE 13 /* - */
98 #define VCHIQ_MSG_REMOTE_USE_ACTIVE 14 /* - */
99
100 #define VCHIQ_PORT_MAX (VCHIQ_MAX_SERVICES - 1)
101 #define VCHIQ_PORT_FREE 0x1000
102 #define VCHIQ_PORT_IS_VALID(port) (port < VCHIQ_PORT_FREE)
103 #define VCHIQ_MAKE_MSG(type, srcport, dstport) \
104 ((type<<24) | (srcport<<12) | (dstport<<0))
105 #define VCHIQ_MSG_TYPE(msgid) ((unsigned int)msgid >> 24)
106 #define VCHIQ_MSG_SRCPORT(msgid) \
107 (unsigned short)(((unsigned int)msgid >> 12) & 0xfff)
108 #define VCHIQ_MSG_DSTPORT(msgid) \
109 ((unsigned short)msgid & 0xfff)
110
111 #define VCHIQ_FOURCC_AS_4CHARS(fourcc) \
112 ((fourcc) >> 24) & 0xff, \
113 ((fourcc) >> 16) & 0xff, \
114 ((fourcc) >> 8) & 0xff, \
115 (fourcc) & 0xff
116
117 /* Ensure the fields are wide enough */
118 vchiq_static_assert(VCHIQ_MSG_SRCPORT(VCHIQ_MAKE_MSG(0, 0, VCHIQ_PORT_MAX))
119 == 0);
120 vchiq_static_assert(VCHIQ_MSG_TYPE(VCHIQ_MAKE_MSG(0, VCHIQ_PORT_MAX, 0)) == 0);
121 vchiq_static_assert((unsigned int)VCHIQ_PORT_MAX <
122 (unsigned int)VCHIQ_PORT_FREE);
123
124 #define VCHIQ_MSGID_PADDING VCHIQ_MAKE_MSG(VCHIQ_MSG_PADDING, 0, 0)
125 #define VCHIQ_MSGID_CLAIMED 0x40000000
126
127 #define VCHIQ_FOURCC_INVALID 0x00000000
128 #define VCHIQ_FOURCC_IS_LEGAL(fourcc) (fourcc != VCHIQ_FOURCC_INVALID)
129
130 #define VCHIQ_BULK_ACTUAL_ABORTED -1
131
132 typedef uint32_t BITSET_T;
133
134 vchiq_static_assert((sizeof(BITSET_T) * 8) == 32);
135
136 #define BITSET_SIZE(b) ((b + 31) >> 5)
137 #define BITSET_WORD(b) (b >> 5)
138 #define BITSET_BIT(b) (1 << (b & 31))
139 #define BITSET_IS_SET(bs, b) (bs[BITSET_WORD(b)] & BITSET_BIT(b))
140 #define BITSET_SET(bs, b) (bs[BITSET_WORD(b)] |= BITSET_BIT(b))
141 #define BITSET_CLR(bs, b) (bs[BITSET_WORD(b)] &= ~BITSET_BIT(b))
142
143 #if VCHIQ_ENABLE_STATS
144 #define VCHIQ_STATS_INC(state, stat) (state->stats. stat++)
145 #define VCHIQ_SERVICE_STATS_INC(service, stat) (service->stats. stat++)
146 #define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) \
147 (service->stats. stat += addend)
148 #else
149 #define VCHIQ_STATS_INC(state, stat) ((void)0)
150 #define VCHIQ_SERVICE_STATS_INC(service, stat) ((void)0)
151 #define VCHIQ_SERVICE_STATS_ADD(service, stat, addend) ((void)0)
152 #endif
153
154 enum {
155 DEBUG_ENTRIES,
156 #if VCHIQ_ENABLE_DEBUG
157 DEBUG_SLOT_HANDLER_COUNT,
158 DEBUG_SLOT_HANDLER_LINE,
159 DEBUG_PARSE_LINE,
160 DEBUG_PARSE_HEADER,
161 DEBUG_PARSE_MSGID,
162 DEBUG_AWAIT_COMPLETION_LINE,
163 DEBUG_DEQUEUE_MESSAGE_LINE,
164 DEBUG_SERVICE_CALLBACK_LINE,
165 DEBUG_MSG_QUEUE_FULL_COUNT,
166 DEBUG_COMPLETION_QUEUE_FULL_COUNT,
167 #endif
168 DEBUG_MAX
169 };
170
171 #if VCHIQ_ENABLE_DEBUG
172
173 #define DEBUG_INITIALISE(local) int *debug_ptr = (local)->debug;
174 #define DEBUG_TRACE(d) \
175 do { debug_ptr[DEBUG_ ## d] = __LINE__; dsb(sy); } while (0)
176 #define DEBUG_VALUE(d, v) \
177 do { debug_ptr[DEBUG_ ## d] = (v); dsb(sy); } while (0)
178 #define DEBUG_COUNT(d) \
179 do { debug_ptr[DEBUG_ ## d]++; dsb(sy); } while (0)
180
181 #else /* VCHIQ_ENABLE_DEBUG */
182
183 #define DEBUG_INITIALISE(local)
184 #define DEBUG_TRACE(d)
185 #define DEBUG_VALUE(d, v)
186 #define DEBUG_COUNT(d)
187
188 #endif /* VCHIQ_ENABLE_DEBUG */
189
190 enum vchiq_connstate {
191 VCHIQ_CONNSTATE_DISCONNECTED,
192 VCHIQ_CONNSTATE_CONNECTING,
193 VCHIQ_CONNSTATE_CONNECTED,
194 VCHIQ_CONNSTATE_PAUSING,
195 VCHIQ_CONNSTATE_PAUSE_SENT,
196 VCHIQ_CONNSTATE_PAUSED,
197 VCHIQ_CONNSTATE_RESUMING,
198 VCHIQ_CONNSTATE_PAUSE_TIMEOUT,
199 VCHIQ_CONNSTATE_RESUME_TIMEOUT
200 };
201
202 enum {
203 VCHIQ_SRVSTATE_FREE,
204 VCHIQ_SRVSTATE_HIDDEN,
205 VCHIQ_SRVSTATE_LISTENING,
206 VCHIQ_SRVSTATE_OPENING,
207 VCHIQ_SRVSTATE_OPEN,
208 VCHIQ_SRVSTATE_OPENSYNC,
209 VCHIQ_SRVSTATE_CLOSESENT,
210 VCHIQ_SRVSTATE_CLOSERECVD,
211 VCHIQ_SRVSTATE_CLOSEWAIT,
212 VCHIQ_SRVSTATE_CLOSED
213 };
214
215 enum {
216 VCHIQ_POLL_TERMINATE,
217 VCHIQ_POLL_REMOVE,
218 VCHIQ_POLL_TXNOTIFY,
219 VCHIQ_POLL_RXNOTIFY,
220 VCHIQ_POLL_COUNT
221 };
222
223 enum vchiq_bulk_dir {
224 VCHIQ_BULK_TRANSMIT,
225 VCHIQ_BULK_RECEIVE
226 };
227
228 typedef void (*vchiq_userdata_term)(void *userdata);
229
230 struct vchiq_bulk {
231 short mode;
232 short dir;
233 void *userdata;
234 dma_addr_t data;
235 int size;
236 void *remote_data;
237 int remote_size;
238 int actual;
239 };
240
241 struct vchiq_bulk_queue {
242 int local_insert; /* Where to insert the next local bulk */
243 int remote_insert; /* Where to insert the next remote bulk (master) */
244 int process; /* Bulk to transfer next */
245 int remote_notify; /* Bulk to notify the remote client of next (mstr) */
246 int remove; /* Bulk to notify the local client of, and remove,
247 ** next */
248 struct vchiq_bulk bulks[VCHIQ_NUM_SERVICE_BULKS];
249 };
250
251 struct remote_event {
252 int armed;
253 int fired;
254 u32 __unused;
255 };
256
257 struct opaque_platform_state;
258
259 struct vchiq_slot {
260 char data[VCHIQ_SLOT_SIZE];
261 };
262
263 struct vchiq_slot_info {
264 /* Use two counters rather than one to avoid the need for a mutex. */
265 short use_count;
266 short release_count;
267 };
268
269 struct vchiq_service {
270 struct vchiq_service_base base;
271 unsigned int handle;
272 struct kref ref_count;
273 struct rcu_head rcu;
274 int srvstate;
275 vchiq_userdata_term userdata_term;
276 unsigned int localport;
277 unsigned int remoteport;
278 int public_fourcc;
279 int client_id;
280 char auto_close;
281 char sync;
282 char closing;
283 char trace;
284 atomic_t poll_flags;
285 short version;
286 short version_min;
287 short peer_version;
288
289 struct vchiq_state *state;
290 struct vchiq_instance *instance;
291
292 int service_use_count;
293
294 struct vchiq_bulk_queue bulk_tx;
295 struct vchiq_bulk_queue bulk_rx;
296
297 struct completion remove_event;
298 struct completion bulk_remove_event;
299 struct mutex bulk_mutex;
300
301 struct service_stats_struct {
302 int quota_stalls;
303 int slot_stalls;
304 int bulk_stalls;
305 int error_count;
306 int ctrl_tx_count;
307 int ctrl_rx_count;
308 int bulk_tx_count;
309 int bulk_rx_count;
310 int bulk_aborted_count;
311 uint64_t ctrl_tx_bytes;
312 uint64_t ctrl_rx_bytes;
313 uint64_t bulk_tx_bytes;
314 uint64_t bulk_rx_bytes;
315 } stats;
316
317 int msg_queue_read;
318 int msg_queue_write;
319 struct completion msg_queue_pop;
320 struct completion msg_queue_push;
321 struct vchiq_header *msg_queue[VCHIQ_MAX_SLOTS];
322 };
323
324 /* The quota information is outside struct vchiq_service so that it can
325 * be statically allocated, since for accounting reasons a service's slot
326 * usage is carried over between users of the same port number.
327 */
328 struct vchiq_service_quota {
329 unsigned short slot_quota;
330 unsigned short slot_use_count;
331 unsigned short message_quota;
332 unsigned short message_use_count;
333 struct completion quota_event;
334 int previous_tx_index;
335 };
336
337 struct vchiq_shared_state {
338
339 /* A non-zero value here indicates that the content is valid. */
340 int initialised;
341
342 /* The first and last (inclusive) slots allocated to the owner. */
343 int slot_first;
344 int slot_last;
345
346 /* The slot allocated to synchronous messages from the owner. */
347 int slot_sync;
348
349 /* Signalling this event indicates that owner's slot handler thread
350 ** should run. */
351 struct remote_event trigger;
352
353 /* Indicates the byte position within the stream where the next message
354 ** will be written. The least significant bits are an index into the
355 ** slot. The next bits are the index of the slot in slot_queue. */
356 int tx_pos;
357
358 /* This event should be signalled when a slot is recycled. */
359 struct remote_event recycle;
360
361 /* The slot_queue index where the next recycled slot will be written. */
362 int slot_queue_recycle;
363
364 /* This event should be signalled when a synchronous message is sent. */
365 struct remote_event sync_trigger;
366
367 /* This event should be signalled when a synchronous message has been
368 ** released. */
369 struct remote_event sync_release;
370
371 /* A circular buffer of slot indexes. */
372 int slot_queue[VCHIQ_MAX_SLOTS_PER_SIDE];
373
374 /* Debugging state */
375 int debug[DEBUG_MAX];
376 };
377
378 struct vchiq_slot_zero {
379 int magic;
380 short version;
381 short version_min;
382 int slot_zero_size;
383 int slot_size;
384 int max_slots;
385 int max_slots_per_side;
386 int platform_data[2];
387 struct vchiq_shared_state master;
388 struct vchiq_shared_state slave;
389 struct vchiq_slot_info slots[VCHIQ_MAX_SLOTS];
390 };
391
392 struct vchiq_state {
393 int id;
394 int initialised;
395 enum vchiq_connstate conn_state;
396 short version_common;
397
398 struct vchiq_shared_state *local;
399 struct vchiq_shared_state *remote;
400 struct vchiq_slot *slot_data;
401
402 unsigned short default_slot_quota;
403 unsigned short default_message_quota;
404
405 /* Event indicating connect message received */
406 struct completion connect;
407
408 /* Mutex protecting services */
409 struct mutex mutex;
410 struct vchiq_instance **instance;
411
412 /* Processes incoming messages */
413 struct task_struct *slot_handler_thread;
414
415 /* Processes recycled slots */
416 struct task_struct *recycle_thread;
417
418 /* Processes synchronous messages */
419 struct task_struct *sync_thread;
420
421 /* Local implementation of the trigger remote event */
422 wait_queue_head_t trigger_event;
423
424 /* Local implementation of the recycle remote event */
425 wait_queue_head_t recycle_event;
426
427 /* Local implementation of the sync trigger remote event */
428 wait_queue_head_t sync_trigger_event;
429
430 /* Local implementation of the sync release remote event */
431 wait_queue_head_t sync_release_event;
432
433 char *tx_data;
434 char *rx_data;
435 struct vchiq_slot_info *rx_info;
436
437 struct mutex slot_mutex;
438
439 struct mutex recycle_mutex;
440
441 struct mutex sync_mutex;
442
443 struct mutex bulk_transfer_mutex;
444
445 /* Indicates the byte position within the stream from where the next
446 ** message will be read. The least significant bits are an index into
447 ** the slot.The next bits are the index of the slot in
448 ** remote->slot_queue. */
449 int rx_pos;
450
451 /* A cached copy of local->tx_pos. Only write to local->tx_pos, and read
452 from remote->tx_pos. */
453 int local_tx_pos;
454
455 /* The slot_queue index of the slot to become available next. */
456 int slot_queue_available;
457
458 /* A flag to indicate if any poll has been requested */
459 int poll_needed;
460
461 /* Ths index of the previous slot used for data messages. */
462 int previous_data_index;
463
464 /* The number of slots occupied by data messages. */
465 unsigned short data_use_count;
466
467 /* The maximum number of slots to be occupied by data messages. */
468 unsigned short data_quota;
469
470 /* An array of bit sets indicating which services must be polled. */
471 atomic_t poll_services[BITSET_SIZE(VCHIQ_MAX_SERVICES)];
472
473 /* The number of the first unused service */
474 int unused_service;
475
476 /* Signalled when a free slot becomes available. */
477 struct completion slot_available_event;
478
479 struct completion slot_remove_event;
480
481 /* Signalled when a free data slot becomes available. */
482 struct completion data_quota_event;
483
484 struct state_stats_struct {
485 int slot_stalls;
486 int data_stalls;
487 int ctrl_tx_count;
488 int ctrl_rx_count;
489 int error_count;
490 } stats;
491
492 struct vchiq_service __rcu *services[VCHIQ_MAX_SERVICES];
493 struct vchiq_service_quota service_quotas[VCHIQ_MAX_SERVICES];
494 struct vchiq_slot_info slot_info[VCHIQ_MAX_SLOTS];
495
496 struct opaque_platform_state *platform_state;
497 };
498
499 struct bulk_waiter {
500 struct vchiq_bulk *bulk;
501 struct completion event;
502 int actual;
503 };
504
505 struct vchiq_config {
506 unsigned int max_msg_size;
507 unsigned int bulk_threshold; /* The message size above which it
508 is better to use a bulk transfer
509 (<= max_msg_size) */
510 unsigned int max_outstanding_bulks;
511 unsigned int max_services;
512 short version; /* The version of VCHIQ */
513 short version_min; /* The minimum compatible version of VCHIQ */
514 };
515
516
517 extern spinlock_t bulk_waiter_spinlock;
518
519 extern int vchiq_core_log_level;
520 extern int vchiq_core_msg_log_level;
521 extern int vchiq_sync_log_level;
522
523 extern struct vchiq_state *vchiq_states[VCHIQ_MAX_STATES];
524
525 extern const char *
526 get_conn_state_name(enum vchiq_connstate conn_state);
527
528 extern struct vchiq_slot_zero *
529 vchiq_init_slots(void *mem_base, int mem_size);
530
531 extern enum vchiq_status
532 vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero);
533
534 extern enum vchiq_status
535 vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance);
536
537 struct vchiq_service *
538 vchiq_add_service_internal(struct vchiq_state *state,
539 const struct vchiq_service_params_kernel *params,
540 int srvstate, struct vchiq_instance *instance,
541 vchiq_userdata_term userdata_term);
542
543 extern enum vchiq_status
544 vchiq_open_service_internal(struct vchiq_service *service, int client_id);
545
546 extern enum vchiq_status
547 vchiq_close_service_internal(struct vchiq_service *service, int close_recvd);
548
549 extern void
550 vchiq_terminate_service_internal(struct vchiq_service *service);
551
552 extern void
553 vchiq_free_service_internal(struct vchiq_service *service);
554
555 extern enum vchiq_status
556 vchiq_shutdown_internal(struct vchiq_state *state, struct vchiq_instance *instance);
557
558 extern void
559 remote_event_pollall(struct vchiq_state *state);
560
561 extern enum vchiq_status
562 vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
563 int size, void *userdata, enum vchiq_bulk_mode mode,
564 enum vchiq_bulk_dir dir);
565
566 extern int
567 vchiq_dump_state(void *dump_context, struct vchiq_state *state);
568
569 extern int
570 vchiq_dump_service_state(void *dump_context, struct vchiq_service *service);
571
572 extern void
573 vchiq_loud_error_header(void);
574
575 extern void
576 vchiq_loud_error_footer(void);
577
578 extern void
579 request_poll(struct vchiq_state *state, struct vchiq_service *service,
580 int poll_type);
581
582 static inline struct vchiq_service *
handle_to_service(unsigned int handle)583 handle_to_service(unsigned int handle)
584 {
585 int idx = handle & (VCHIQ_MAX_SERVICES - 1);
586 struct vchiq_state *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) &
587 (VCHIQ_MAX_STATES - 1)];
588
589 if (!state)
590 return NULL;
591 return rcu_dereference(state->services[idx]);
592 }
593
594 extern struct vchiq_service *
595 find_service_by_handle(unsigned int handle);
596
597 extern struct vchiq_service *
598 find_service_by_port(struct vchiq_state *state, int localport);
599
600 extern struct vchiq_service *
601 find_service_for_instance(struct vchiq_instance *instance,
602 unsigned int handle);
603
604 extern struct vchiq_service *
605 find_closed_service_for_instance(struct vchiq_instance *instance,
606 unsigned int handle);
607
608 extern struct vchiq_service *
609 __next_service_by_instance(struct vchiq_state *state,
610 struct vchiq_instance *instance,
611 int *pidx);
612
613 extern struct vchiq_service *
614 next_service_by_instance(struct vchiq_state *state,
615 struct vchiq_instance *instance,
616 int *pidx);
617
618 extern void
619 lock_service(struct vchiq_service *service);
620
621 extern void
622 unlock_service(struct vchiq_service *service);
623
624 extern enum vchiq_status
625 vchiq_queue_message(unsigned int handle,
626 ssize_t (*copy_callback)(void *context, void *dest,
627 size_t offset, size_t maxsize),
628 void *context,
629 size_t size);
630
631 /* The following functions are called from vchiq_core, and external
632 ** implementations must be provided. */
633
634 extern enum vchiq_status
635 vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset,
636 void __user *uoffset, int size, int dir);
637
638 extern void
639 vchiq_complete_bulk(struct vchiq_bulk *bulk);
640
641 extern void
642 remote_event_signal(struct remote_event *event);
643
644 extern int
645 vchiq_dump(void *dump_context, const char *str, int len);
646
647 extern int
648 vchiq_dump_platform_state(void *dump_context);
649
650 extern int
651 vchiq_dump_platform_instances(void *dump_context);
652
653 extern int
654 vchiq_dump_platform_service_state(void *dump_context,
655 struct vchiq_service *service);
656
657 extern enum vchiq_status
658 vchiq_use_service_internal(struct vchiq_service *service);
659
660 extern enum vchiq_status
661 vchiq_release_service_internal(struct vchiq_service *service);
662
663 extern void
664 vchiq_on_remote_use(struct vchiq_state *state);
665
666 extern void
667 vchiq_on_remote_release(struct vchiq_state *state);
668
669 extern enum vchiq_status
670 vchiq_platform_init_state(struct vchiq_state *state);
671
672 extern enum vchiq_status
673 vchiq_check_service(struct vchiq_service *service);
674
675 extern void
676 vchiq_on_remote_use_active(struct vchiq_state *state);
677
678 extern enum vchiq_status
679 vchiq_send_remote_use(struct vchiq_state *state);
680
681 extern enum vchiq_status
682 vchiq_send_remote_use_active(struct vchiq_state *state);
683
684 extern void
685 vchiq_platform_conn_state_changed(struct vchiq_state *state,
686 enum vchiq_connstate oldstate,
687 enum vchiq_connstate newstate);
688
689 extern void
690 vchiq_set_conn_state(struct vchiq_state *state, enum vchiq_connstate newstate);
691
692 extern void
693 vchiq_log_dump_mem(const char *label, uint32_t addr, const void *voidMem,
694 size_t numBytes);
695
696 extern enum vchiq_status vchiq_remove_service(unsigned int service);
697
698 extern int vchiq_get_client_id(unsigned int service);
699
700 extern void vchiq_get_config(struct vchiq_config *config);
701
702 extern enum vchiq_status
703 vchiq_set_service_option(unsigned int service, enum vchiq_service_option option,
704 int value);
705
706 #endif
707