1/**
2 * \file
3 * \brief IDC export declarations
4 */
5
6/*
7 * Copyright (c) 2010, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef LIBBARRELFISH_IDC_EXPORT_H
16#define LIBBARRELFISH_IDC_EXPORT_H
17
18#include <sys/cdefs.h>
19#include <barrelfish/idc.h>
20
21__BEGIN_DECLS
22
23typedef void idc_export_callback_fn(void *st, errval_t err, iref_t iref);
24
25#ifdef CONFIG_INTERCONNECT_DRIVER_LOCAL
26typedef errval_t local_connect_callback_fn(void *st, void *binding,
27                                           void **ret_binding);
28#endif // CONFIG_INTERCONNECT_DRIVER_LOCAL
29
30#ifdef CONFIG_INTERCONNECT_DRIVER_LMP
31typedef errval_t lmp_connect_callback_fn(void *st, size_t buflen_words,
32                                         struct capref endpoint,
33                                         struct lmp_chan **retlc);
34#endif // CONFIG_INTERCONNECT_DRIVER_LMP
35
36#ifdef CONFIG_INTERCONNECT_DRIVER_UMP
37typedef errval_t ump_connect_callback_fn(void *st, struct monitor_binding *mb,
38                                         uintptr_t mon_id, struct capref frame,
39                                         size_t inchanlength,
40                                         size_t outchanlength,
41                                         struct capref notify_cap);
42#endif // CONFIG_INTERCONNECT_DRIVER_UMP
43
44#ifdef CONFIG_INTERCONNECT_DRIVER_MULTIHOP
45typedef errval_t multihop_connect_callback_fn(void *st, uint64_t vci);
46#endif // CONFIG_INTERCONNECT_DRIVER_MULTIHOP
47
48struct idc_export {
49    iref_t iref;
50    idc_export_flags_t flags;
51    idc_export_callback_fn *export_callback;
52    void *export_cb_st; // state passed to export_callback
53    void *connect_cb_st; // state passed to (driver-specific) connect callback
54
55    /* for each configured channel type, we need a binding-specific
56     * connect callback */
57#ifdef CONFIG_INTERCONNECT_DRIVER_LOCAL
58    local_connect_callback_fn *local_connect_callback;
59#endif
60#ifdef CONFIG_INTERCONNECT_DRIVER_LMP
61    lmp_connect_callback_fn *lmp_connect_callback;
62#endif
63#ifdef CONFIG_INTERCONNECT_DRIVER_UMP
64    ump_connect_callback_fn *ump_connect_callback;
65#endif
66#ifdef CONFIG_INTERCONNECT_DRIVER_MULTIHOP
67  multihop_connect_callback_fn *multihop_connect_callback;
68#endif
69};
70
71errval_t idc_export_service(struct idc_export *e);
72errval_t idc_get_service(iref_t iref, struct idc_export **e);
73void idc_export_init(void);
74
75__END_DECLS
76
77#endif
78