root/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. handle_to_service

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

/* [<][>][^][v][top][bottom][index][help] */