1/** 2 * \file 3 * \brief 4 */ 5 6/* 7 * Copyright (c) 2007, 2008, 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, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15struct monitor_binding; 16struct intermon_binding; 17 18struct lmp_conn_state { 19 uintptr_t domain_id; 20 struct monitor_binding *domain_binding; 21}; 22 23static inline errval_t 24lmp_conn_alloc(struct lmp_conn_state **con, uintptr_t *con_id) 25{ 26 struct lmp_conn_state *mem = malloc(sizeof(struct lmp_conn_state)); 27 assert(mem != NULL); 28 29 *con = mem; 30 *con_id = (uintptr_t)mem; 31 return SYS_ERR_OK; 32} 33 34static inline errval_t 35lmp_conn_free(uintptr_t con_id) 36{ 37 struct lmp_conn_state *mem = (struct lmp_conn_state*)con_id; 38 assert(mem != NULL); 39 40 free(mem); 41 return SYS_ERR_OK; 42} 43 44static inline struct lmp_conn_state * 45lmp_conn_lookup(uintptr_t con_id) 46{ 47 return (struct lmp_conn_state *)con_id; 48} 49 50struct remote_conn_state { 51 uintptr_t domain_id; 52 struct monitor_binding *domain_binding; 53 uintptr_t mon_id; 54 struct intermon_binding *mon_binding; 55 coreid_t core_id; // core id of other side of channel 56 57 // type-specific data 58 enum remote_conn_type { REMOTE_CONN_UMP } type; 59 union { 60 struct { 61 struct capref frame; // shared frame 62 } ump; 63 } x; 64}; 65 66static inline errval_t 67remote_conn_alloc(struct remote_conn_state **con, uintptr_t *con_id, 68 enum remote_conn_type type) 69{ 70 struct remote_conn_state *mem = malloc(sizeof(struct remote_conn_state)); 71 assert(mem != NULL); 72 73 *con = mem; 74 *con_id = (uintptr_t)mem; 75 mem->type = type; 76 77 return SYS_ERR_OK; 78} 79 80static inline errval_t 81remote_conn_free(uintptr_t con_id) 82{ 83 struct remote_conn_state *mem = (struct remote_conn_state*)con_id; 84 assert(mem != NULL); 85 86 free(mem); 87 return SYS_ERR_OK; 88} 89 90static inline struct remote_conn_state * 91remote_conn_lookup(uintptr_t con_id) 92{ 93 return (struct remote_conn_state *)con_id; 94} 95 96 97struct span_state { 98 uint8_t core_id; 99 struct capref vroot; 100 struct monitor_binding *mb; 101 uintptr_t domain_id; 102}; 103 104static inline errval_t 105span_state_alloc(struct span_state **state, uintptr_t *id) 106{ 107 struct span_state *mem = malloc(sizeof(struct span_state)); 108 assert(mem != NULL); 109 110 *state = mem; 111 *id = (uintptr_t)mem; 112 return SYS_ERR_OK; 113} 114 115static inline errval_t 116span_state_free(uintptr_t id) 117{ 118 struct span_state *mem = (struct span_state*)id; 119 free(mem); 120 return SYS_ERR_OK; 121} 122 123static inline struct span_state * 124span_state_lookup(uintptr_t id) 125{ 126 return (struct span_state *)id; 127} 128