Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Freescale Layerscape MC I/O wrapper |
| 4 | * |
Yogesh Gaur | 1a0c4ae | 2018-05-09 10:52:17 +0530 | [diff] [blame] | 5 | * Copyright 2013-2016 Freescale Semiconductor, Inc. |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 6 | * Copyright 2017 NXP |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 7 | */ |
| 8 | #ifndef _FSL_DPRC_H |
| 9 | #define _FSL_DPRC_H |
| 10 | |
| 11 | /* DPRC Version */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 12 | #define DPRC_VER_MAJOR 6 |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 13 | #define DPRC_VER_MINOR 1 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 14 | |
| 15 | /* Command IDs */ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 16 | #define DPRC_CMDID_CLOSE 0x8001 |
| 17 | #define DPRC_CMDID_OPEN 0x8051 |
| 18 | #define DPRC_CMDID_CREATE 0x9051 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 19 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 20 | #define DPRC_CMDID_GET_ATTR 0x0041 |
| 21 | #define DPRC_CMDID_RESET_CONT 0x0051 |
| 22 | #define DPRC_CMDID_GET_API_VERSION 0xa051 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 23 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 24 | #define DPRC_CMDID_CREATE_CONT 0x1511 |
| 25 | #define DPRC_CMDID_DESTROY_CONT 0x1521 |
| 26 | #define DPRC_CMDID_GET_CONT_ID 0x8301 |
| 27 | #define DPRC_CMDID_GET_OBJ_COUNT 0x1591 |
| 28 | #define DPRC_CMDID_GET_OBJ 0x15A1 |
| 29 | #define DPRC_CMDID_GET_RES_COUNT 0x15B1 |
| 30 | #define DPRC_CMDID_GET_RES_IDS 0x15C1 |
| 31 | #define DPRC_CMDID_GET_OBJ_REG 0x15E1 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 32 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 33 | #define DPRC_CMDID_CONNECT 0x1671 |
| 34 | #define DPRC_CMDID_DISCONNECT 0x1681 |
| 35 | #define DPRC_CMDID_GET_CONNECTION 0x16C1 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 36 | |
| 37 | /* cmd, param, offset, width, type, arg_name */ |
| 38 | #define DPRC_RSP_GET_CONTAINER_ID(cmd, container_id) \ |
| 39 | MC_RSP_OP(cmd, 0, 0, 32, int, container_id) |
| 40 | |
| 41 | /* cmd, param, offset, width, type, arg_name */ |
| 42 | #define DPRC_CMD_OPEN(cmd, container_id) \ |
| 43 | MC_CMD_OP(cmd, 0, 0, 32, int, container_id) |
| 44 | |
| 45 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 46 | #define DPRC_CMD_CREATE_CONTAINER(cmd, cfg) \ |
| 47 | do { \ |
| 48 | MC_CMD_OP(cmd, 0, 32, 16, uint16_t, cfg->icid); \ |
| 49 | MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->options); \ |
| 50 | MC_CMD_OP(cmd, 1, 32, 32, int, cfg->portal_id); \ |
| 51 | MC_CMD_OP(cmd, 2, 0, 8, char, cfg->label[0]);\ |
| 52 | MC_CMD_OP(cmd, 2, 8, 8, char, cfg->label[1]);\ |
| 53 | MC_CMD_OP(cmd, 2, 16, 8, char, cfg->label[2]);\ |
| 54 | MC_CMD_OP(cmd, 2, 24, 8, char, cfg->label[3]);\ |
| 55 | MC_CMD_OP(cmd, 2, 32, 8, char, cfg->label[4]);\ |
| 56 | MC_CMD_OP(cmd, 2, 40, 8, char, cfg->label[5]);\ |
| 57 | MC_CMD_OP(cmd, 2, 48, 8, char, cfg->label[6]);\ |
| 58 | MC_CMD_OP(cmd, 2, 56, 8, char, cfg->label[7]);\ |
| 59 | MC_CMD_OP(cmd, 3, 0, 8, char, cfg->label[8]);\ |
| 60 | MC_CMD_OP(cmd, 3, 8, 8, char, cfg->label[9]);\ |
| 61 | MC_CMD_OP(cmd, 3, 16, 8, char, cfg->label[10]);\ |
| 62 | MC_CMD_OP(cmd, 3, 24, 8, char, cfg->label[11]);\ |
| 63 | MC_CMD_OP(cmd, 3, 32, 8, char, cfg->label[12]);\ |
| 64 | MC_CMD_OP(cmd, 3, 40, 8, char, cfg->label[13]);\ |
| 65 | MC_CMD_OP(cmd, 3, 48, 8, char, cfg->label[14]);\ |
| 66 | MC_CMD_OP(cmd, 3, 56, 8, char, cfg->label[15]);\ |
| 67 | } while (0) |
| 68 | |
| 69 | /* cmd, param, offset, width, type, arg_name */ |
| 70 | #define DPRC_RSP_CREATE_CONTAINER(cmd, child_container_id, child_portal_offset)\ |
| 71 | do { \ |
| 72 | MC_RSP_OP(cmd, 1, 0, 32, int, child_container_id); \ |
| 73 | MC_RSP_OP(cmd, 2, 0, 64, uint64_t, child_portal_offset);\ |
| 74 | } while (0) |
| 75 | |
| 76 | /* cmd, param, offset, width, type, arg_name */ |
| 77 | #define DPRC_CMD_DESTROY_CONTAINER(cmd, child_container_id) \ |
| 78 | MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id) |
| 79 | |
| 80 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 81 | #define DPRC_CMD_RESET_CONTAINER(cmd, child_container_id) \ |
| 82 | MC_CMD_OP(cmd, 0, 0, 32, int, child_container_id) |
| 83 | |
| 84 | /* cmd, param, offset, width, type, arg_name */ |
| 85 | #define DPRC_RSP_GET_ATTRIBUTES(cmd, attr) \ |
| 86 | do { \ |
| 87 | MC_RSP_OP(cmd, 0, 0, 32, int, attr->container_id); \ |
| 88 | MC_RSP_OP(cmd, 0, 32, 16, uint16_t, attr->icid); \ |
| 89 | MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options);\ |
| 90 | MC_RSP_OP(cmd, 1, 32, 32, int, attr->portal_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 91 | } while (0) |
| 92 | |
| 93 | /* cmd, param, offset, width, type, arg_name */ |
| 94 | #define DPRC_RSP_GET_OBJ_COUNT(cmd, obj_count) \ |
| 95 | MC_RSP_OP(cmd, 0, 32, 32, int, obj_count) |
| 96 | |
| 97 | /* cmd, param, offset, width, type, arg_name */ |
| 98 | #define DPRC_CMD_GET_OBJ(cmd, obj_index) \ |
| 99 | MC_CMD_OP(cmd, 0, 0, 32, int, obj_index) |
| 100 | |
| 101 | /* cmd, param, offset, width, type, arg_name */ |
| 102 | #define DPRC_RSP_GET_OBJ(cmd, obj_desc) \ |
| 103 | do { \ |
| 104 | MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \ |
| 105 | MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \ |
| 106 | MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \ |
| 107 | MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \ |
| 108 | MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\ |
| 109 | MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\ |
| 110 | MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 111 | MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 112 | MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\ |
| 113 | MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\ |
| 114 | MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\ |
| 115 | MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\ |
| 116 | MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\ |
| 117 | MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\ |
| 118 | MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\ |
| 119 | MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\ |
| 120 | MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\ |
| 121 | MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\ |
| 122 | MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\ |
| 123 | MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\ |
| 124 | MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\ |
| 125 | MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\ |
| 126 | MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\ |
| 127 | MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 128 | MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\ |
| 129 | MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\ |
| 130 | MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\ |
| 131 | MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\ |
| 132 | MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\ |
| 133 | MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\ |
| 134 | MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\ |
| 135 | MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\ |
| 136 | MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\ |
| 137 | MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\ |
| 138 | MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\ |
| 139 | MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\ |
| 140 | MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\ |
| 141 | MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\ |
| 142 | MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\ |
| 143 | MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 144 | } while (0) |
| 145 | |
| 146 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 147 | #define DPRC_CMD_GET_OBJ_DESC(cmd, obj_type, obj_id) \ |
| 148 | do { \ |
| 149 | MC_CMD_OP(cmd, 0, 0, 32, int, obj_id);\ |
| 150 | MC_CMD_OP(cmd, 1, 0, 8, char, obj_type[0]);\ |
| 151 | MC_CMD_OP(cmd, 1, 8, 8, char, obj_type[1]);\ |
| 152 | MC_CMD_OP(cmd, 1, 16, 8, char, obj_type[2]);\ |
| 153 | MC_CMD_OP(cmd, 1, 24, 8, char, obj_type[3]);\ |
| 154 | MC_CMD_OP(cmd, 1, 32, 8, char, obj_type[4]);\ |
| 155 | MC_CMD_OP(cmd, 1, 40, 8, char, obj_type[5]);\ |
| 156 | MC_CMD_OP(cmd, 1, 48, 8, char, obj_type[6]);\ |
| 157 | MC_CMD_OP(cmd, 1, 56, 8, char, obj_type[7]);\ |
| 158 | MC_CMD_OP(cmd, 2, 0, 8, char, obj_type[8]);\ |
| 159 | MC_CMD_OP(cmd, 2, 8, 8, char, obj_type[9]);\ |
| 160 | MC_CMD_OP(cmd, 2, 16, 8, char, obj_type[10]);\ |
| 161 | MC_CMD_OP(cmd, 2, 24, 8, char, obj_type[11]);\ |
| 162 | MC_CMD_OP(cmd, 2, 32, 8, char, obj_type[12]);\ |
| 163 | MC_CMD_OP(cmd, 2, 40, 8, char, obj_type[13]);\ |
| 164 | MC_CMD_OP(cmd, 2, 48, 8, char, obj_type[14]);\ |
| 165 | MC_CMD_OP(cmd, 2, 56, 8, char, obj_type[15]);\ |
| 166 | } while (0) |
| 167 | |
| 168 | /* cmd, param, offset, width, type, arg_name */ |
| 169 | #define DPRC_RSP_GET_OBJ_DESC(cmd, obj_desc) \ |
| 170 | do { \ |
| 171 | MC_RSP_OP(cmd, 0, 32, 32, int, obj_desc->id); \ |
| 172 | MC_RSP_OP(cmd, 1, 0, 16, uint16_t, obj_desc->vendor); \ |
| 173 | MC_RSP_OP(cmd, 1, 16, 8, uint8_t, obj_desc->irq_count); \ |
| 174 | MC_RSP_OP(cmd, 1, 24, 8, uint8_t, obj_desc->region_count); \ |
| 175 | MC_RSP_OP(cmd, 1, 32, 32, uint32_t, obj_desc->state);\ |
| 176 | MC_RSP_OP(cmd, 2, 0, 16, uint16_t, obj_desc->ver_major);\ |
| 177 | MC_RSP_OP(cmd, 2, 16, 16, uint16_t, obj_desc->ver_minor);\ |
| 178 | MC_RSP_OP(cmd, 2, 32, 16, uint16_t, obj_desc->flags); \ |
| 179 | MC_RSP_OP(cmd, 3, 0, 8, char, obj_desc->type[0]);\ |
| 180 | MC_RSP_OP(cmd, 3, 8, 8, char, obj_desc->type[1]);\ |
| 181 | MC_RSP_OP(cmd, 3, 16, 8, char, obj_desc->type[2]);\ |
| 182 | MC_RSP_OP(cmd, 3, 24, 8, char, obj_desc->type[3]);\ |
| 183 | MC_RSP_OP(cmd, 3, 32, 8, char, obj_desc->type[4]);\ |
| 184 | MC_RSP_OP(cmd, 3, 40, 8, char, obj_desc->type[5]);\ |
| 185 | MC_RSP_OP(cmd, 3, 48, 8, char, obj_desc->type[6]);\ |
| 186 | MC_RSP_OP(cmd, 3, 56, 8, char, obj_desc->type[7]);\ |
| 187 | MC_RSP_OP(cmd, 4, 0, 8, char, obj_desc->type[8]);\ |
| 188 | MC_RSP_OP(cmd, 4, 8, 8, char, obj_desc->type[9]);\ |
| 189 | MC_RSP_OP(cmd, 4, 16, 8, char, obj_desc->type[10]);\ |
| 190 | MC_RSP_OP(cmd, 4, 24, 8, char, obj_desc->type[11]);\ |
| 191 | MC_RSP_OP(cmd, 4, 32, 8, char, obj_desc->type[12]);\ |
| 192 | MC_RSP_OP(cmd, 4, 40, 8, char, obj_desc->type[13]);\ |
| 193 | MC_RSP_OP(cmd, 4, 48, 8, char, obj_desc->type[14]);\ |
| 194 | MC_RSP_OP(cmd, 4, 56, 8, char, obj_desc->type[15]);\ |
| 195 | MC_RSP_OP(cmd, 5, 0, 8, char, obj_desc->label[0]);\ |
| 196 | MC_RSP_OP(cmd, 5, 8, 8, char, obj_desc->label[1]);\ |
| 197 | MC_RSP_OP(cmd, 5, 16, 8, char, obj_desc->label[2]);\ |
| 198 | MC_RSP_OP(cmd, 5, 24, 8, char, obj_desc->label[3]);\ |
| 199 | MC_RSP_OP(cmd, 5, 32, 8, char, obj_desc->label[4]);\ |
| 200 | MC_RSP_OP(cmd, 5, 40, 8, char, obj_desc->label[5]);\ |
| 201 | MC_RSP_OP(cmd, 5, 48, 8, char, obj_desc->label[6]);\ |
| 202 | MC_RSP_OP(cmd, 5, 56, 8, char, obj_desc->label[7]);\ |
| 203 | MC_RSP_OP(cmd, 6, 0, 8, char, obj_desc->label[8]);\ |
| 204 | MC_RSP_OP(cmd, 6, 8, 8, char, obj_desc->label[9]);\ |
| 205 | MC_RSP_OP(cmd, 6, 16, 8, char, obj_desc->label[10]);\ |
| 206 | MC_RSP_OP(cmd, 6, 24, 8, char, obj_desc->label[11]);\ |
| 207 | MC_RSP_OP(cmd, 6, 32, 8, char, obj_desc->label[12]);\ |
| 208 | MC_RSP_OP(cmd, 6, 40, 8, char, obj_desc->label[13]);\ |
| 209 | MC_RSP_OP(cmd, 6, 48, 8, char, obj_desc->label[14]);\ |
| 210 | MC_RSP_OP(cmd, 6, 56, 8, char, obj_desc->label[15]);\ |
| 211 | } while (0) |
| 212 | |
| 213 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 214 | #define DPRC_CMD_GET_RES_COUNT(cmd, type) \ |
| 215 | do { \ |
| 216 | MC_CMD_OP(cmd, 1, 0, 8, char, type[0]);\ |
| 217 | MC_CMD_OP(cmd, 1, 8, 8, char, type[1]);\ |
| 218 | MC_CMD_OP(cmd, 1, 16, 8, char, type[2]);\ |
| 219 | MC_CMD_OP(cmd, 1, 24, 8, char, type[3]);\ |
| 220 | MC_CMD_OP(cmd, 1, 32, 8, char, type[4]);\ |
| 221 | MC_CMD_OP(cmd, 1, 40, 8, char, type[5]);\ |
| 222 | MC_CMD_OP(cmd, 1, 48, 8, char, type[6]);\ |
| 223 | MC_CMD_OP(cmd, 1, 56, 8, char, type[7]);\ |
| 224 | MC_CMD_OP(cmd, 2, 0, 8, char, type[8]);\ |
| 225 | MC_CMD_OP(cmd, 2, 8, 8, char, type[9]);\ |
| 226 | MC_CMD_OP(cmd, 2, 16, 8, char, type[10]);\ |
| 227 | MC_CMD_OP(cmd, 2, 24, 8, char, type[11]);\ |
| 228 | MC_CMD_OP(cmd, 2, 32, 8, char, type[12]);\ |
| 229 | MC_CMD_OP(cmd, 2, 40, 8, char, type[13]);\ |
| 230 | MC_CMD_OP(cmd, 2, 48, 8, char, type[14]);\ |
| 231 | MC_CMD_OP(cmd, 2, 56, 8, char, type[15]);\ |
| 232 | } while (0) |
| 233 | |
| 234 | /* cmd, param, offset, width, type, arg_name */ |
| 235 | #define DPRC_RSP_GET_RES_COUNT(cmd, res_count) \ |
| 236 | MC_RSP_OP(cmd, 0, 0, 32, int, res_count) |
| 237 | |
| 238 | /* cmd, param, offset, width, type, arg_name */ |
| 239 | #define DPRC_CMD_GET_RES_IDS(cmd, range_desc, type) \ |
| 240 | do { \ |
| 241 | MC_CMD_OP(cmd, 0, 42, 7, enum dprc_iter_status, \ |
| 242 | range_desc->iter_status); \ |
| 243 | MC_CMD_OP(cmd, 1, 0, 32, int, range_desc->base_id); \ |
| 244 | MC_CMD_OP(cmd, 1, 32, 32, int, range_desc->last_id);\ |
| 245 | MC_CMD_OP(cmd, 2, 0, 8, char, type[0]);\ |
| 246 | MC_CMD_OP(cmd, 2, 8, 8, char, type[1]);\ |
| 247 | MC_CMD_OP(cmd, 2, 16, 8, char, type[2]);\ |
| 248 | MC_CMD_OP(cmd, 2, 24, 8, char, type[3]);\ |
| 249 | MC_CMD_OP(cmd, 2, 32, 8, char, type[4]);\ |
| 250 | MC_CMD_OP(cmd, 2, 40, 8, char, type[5]);\ |
| 251 | MC_CMD_OP(cmd, 2, 48, 8, char, type[6]);\ |
| 252 | MC_CMD_OP(cmd, 2, 56, 8, char, type[7]);\ |
| 253 | MC_CMD_OP(cmd, 3, 0, 8, char, type[8]);\ |
| 254 | MC_CMD_OP(cmd, 3, 8, 8, char, type[9]);\ |
| 255 | MC_CMD_OP(cmd, 3, 16, 8, char, type[10]);\ |
| 256 | MC_CMD_OP(cmd, 3, 24, 8, char, type[11]);\ |
| 257 | MC_CMD_OP(cmd, 3, 32, 8, char, type[12]);\ |
| 258 | MC_CMD_OP(cmd, 3, 40, 8, char, type[13]);\ |
| 259 | MC_CMD_OP(cmd, 3, 48, 8, char, type[14]);\ |
| 260 | MC_CMD_OP(cmd, 3, 56, 8, char, type[15]);\ |
| 261 | } while (0) |
| 262 | |
| 263 | /* cmd, param, offset, width, type, arg_name */ |
| 264 | #define DPRC_RSP_GET_RES_IDS(cmd, range_desc) \ |
| 265 | do { \ |
| 266 | MC_RSP_OP(cmd, 0, 42, 7, enum dprc_iter_status, \ |
| 267 | range_desc->iter_status);\ |
| 268 | MC_RSP_OP(cmd, 1, 0, 32, int, range_desc->base_id); \ |
| 269 | MC_RSP_OP(cmd, 1, 32, 32, int, range_desc->last_id);\ |
| 270 | } while (0) |
| 271 | |
| 272 | /* cmd, param, offset, width, type, arg_name */ |
| 273 | #define DPRC_CMD_GET_OBJ_REGION(cmd, obj_type, obj_id, region_index) \ |
| 274 | do { \ |
| 275 | MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \ |
| 276 | MC_CMD_OP(cmd, 0, 48, 8, uint8_t, region_index);\ |
| 277 | MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\ |
| 278 | MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\ |
| 279 | MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\ |
| 280 | MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\ |
| 281 | MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\ |
| 282 | MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\ |
| 283 | MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\ |
| 284 | MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\ |
| 285 | MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\ |
| 286 | MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\ |
| 287 | MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\ |
| 288 | MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\ |
| 289 | MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\ |
| 290 | MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\ |
| 291 | MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\ |
| 292 | MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\ |
| 293 | } while (0) |
| 294 | |
| 295 | /* param, offset, width, type, arg_name */ |
| 296 | #define DPRC_RSP_GET_OBJ_REGION(cmd, region_desc) \ |
| 297 | do { \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 298 | MC_RSP_OP(cmd, 1, 0, 32, uint32_t, region_desc->base_offset);\ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 299 | MC_RSP_OP(cmd, 2, 0, 32, uint32_t, region_desc->size); \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 300 | MC_RSP_OP(cmd, 2, 32, 4, enum dprc_region_type, region_desc->type);\ |
| 301 | MC_RSP_OP(cmd, 3, 0, 32, uint32_t, region_desc->flags);\ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 302 | } while (0) |
| 303 | |
| 304 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 305 | #define DPRC_CMD_SET_OBJ_LABEL(cmd, obj_type, obj_id, label) \ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 306 | do { \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 307 | MC_CMD_OP(cmd, 0, 0, 32, int, obj_id); \ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 308 | MC_CMD_OP(cmd, 1, 0, 8, char, label[0]);\ |
| 309 | MC_CMD_OP(cmd, 1, 8, 8, char, label[1]);\ |
| 310 | MC_CMD_OP(cmd, 1, 16, 8, char, label[2]);\ |
| 311 | MC_CMD_OP(cmd, 1, 24, 8, char, label[3]);\ |
| 312 | MC_CMD_OP(cmd, 1, 32, 8, char, label[4]);\ |
| 313 | MC_CMD_OP(cmd, 1, 40, 8, char, label[5]);\ |
| 314 | MC_CMD_OP(cmd, 1, 48, 8, char, label[6]);\ |
| 315 | MC_CMD_OP(cmd, 1, 56, 8, char, label[7]);\ |
| 316 | MC_CMD_OP(cmd, 2, 0, 8, char, label[8]);\ |
| 317 | MC_CMD_OP(cmd, 2, 8, 8, char, label[9]);\ |
| 318 | MC_CMD_OP(cmd, 2, 16, 8, char, label[10]);\ |
| 319 | MC_CMD_OP(cmd, 2, 24, 8, char, label[11]);\ |
| 320 | MC_CMD_OP(cmd, 2, 32, 8, char, label[12]);\ |
| 321 | MC_CMD_OP(cmd, 2, 40, 8, char, label[13]);\ |
| 322 | MC_CMD_OP(cmd, 2, 48, 8, char, label[14]);\ |
| 323 | MC_CMD_OP(cmd, 2, 56, 8, char, label[15]);\ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 324 | MC_CMD_OP(cmd, 3, 0, 8, char, obj_type[0]);\ |
| 325 | MC_CMD_OP(cmd, 3, 8, 8, char, obj_type[1]);\ |
| 326 | MC_CMD_OP(cmd, 3, 16, 8, char, obj_type[2]);\ |
| 327 | MC_CMD_OP(cmd, 3, 24, 8, char, obj_type[3]);\ |
| 328 | MC_CMD_OP(cmd, 3, 32, 8, char, obj_type[4]);\ |
| 329 | MC_CMD_OP(cmd, 3, 40, 8, char, obj_type[5]);\ |
| 330 | MC_CMD_OP(cmd, 3, 48, 8, char, obj_type[6]);\ |
| 331 | MC_CMD_OP(cmd, 3, 56, 8, char, obj_type[7]);\ |
| 332 | MC_CMD_OP(cmd, 4, 0, 8, char, obj_type[8]);\ |
| 333 | MC_CMD_OP(cmd, 4, 8, 8, char, obj_type[9]);\ |
| 334 | MC_CMD_OP(cmd, 4, 16, 8, char, obj_type[10]);\ |
| 335 | MC_CMD_OP(cmd, 4, 24, 8, char, obj_type[11]);\ |
| 336 | MC_CMD_OP(cmd, 4, 32, 8, char, obj_type[12]);\ |
| 337 | MC_CMD_OP(cmd, 4, 40, 8, char, obj_type[13]);\ |
| 338 | MC_CMD_OP(cmd, 4, 48, 8, char, obj_type[14]);\ |
| 339 | MC_CMD_OP(cmd, 4, 56, 8, char, obj_type[15]);\ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 340 | } while (0) |
| 341 | |
| 342 | /* cmd, param, offset, width, type, arg_name */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 343 | #define DPRC_CMD_CONNECT(cmd, endpoint1, endpoint2, cfg) \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 344 | do { \ |
| 345 | MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 346 | MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 347 | MC_CMD_OP(cmd, 1, 0, 32, int, endpoint2->id); \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 348 | MC_CMD_OP(cmd, 1, 32, 32, int, endpoint2->if_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 349 | MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[0]); \ |
| 350 | MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[1]); \ |
| 351 | MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[2]); \ |
| 352 | MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[3]); \ |
| 353 | MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[4]); \ |
| 354 | MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[5]); \ |
| 355 | MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[6]); \ |
| 356 | MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[7]); \ |
| 357 | MC_CMD_OP(cmd, 3, 0, 8, char, endpoint1->type[8]); \ |
| 358 | MC_CMD_OP(cmd, 3, 8, 8, char, endpoint1->type[9]); \ |
| 359 | MC_CMD_OP(cmd, 3, 16, 8, char, endpoint1->type[10]); \ |
| 360 | MC_CMD_OP(cmd, 3, 24, 8, char, endpoint1->type[11]); \ |
| 361 | MC_CMD_OP(cmd, 3, 32, 8, char, endpoint1->type[12]); \ |
| 362 | MC_CMD_OP(cmd, 3, 40, 8, char, endpoint1->type[13]); \ |
| 363 | MC_CMD_OP(cmd, 3, 48, 8, char, endpoint1->type[14]); \ |
| 364 | MC_CMD_OP(cmd, 3, 56, 8, char, endpoint1->type[15]); \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 365 | MC_CMD_OP(cmd, 4, 0, 32, uint32_t, cfg->max_rate); \ |
| 366 | MC_CMD_OP(cmd, 4, 32, 32, uint32_t, cfg->committed_rate); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 367 | MC_CMD_OP(cmd, 5, 0, 8, char, endpoint2->type[0]); \ |
| 368 | MC_CMD_OP(cmd, 5, 8, 8, char, endpoint2->type[1]); \ |
| 369 | MC_CMD_OP(cmd, 5, 16, 8, char, endpoint2->type[2]); \ |
| 370 | MC_CMD_OP(cmd, 5, 24, 8, char, endpoint2->type[3]); \ |
| 371 | MC_CMD_OP(cmd, 5, 32, 8, char, endpoint2->type[4]); \ |
| 372 | MC_CMD_OP(cmd, 5, 40, 8, char, endpoint2->type[5]); \ |
| 373 | MC_CMD_OP(cmd, 5, 48, 8, char, endpoint2->type[6]); \ |
| 374 | MC_CMD_OP(cmd, 5, 56, 8, char, endpoint2->type[7]); \ |
| 375 | MC_CMD_OP(cmd, 6, 0, 8, char, endpoint2->type[8]); \ |
| 376 | MC_CMD_OP(cmd, 6, 8, 8, char, endpoint2->type[9]); \ |
| 377 | MC_CMD_OP(cmd, 6, 16, 8, char, endpoint2->type[10]); \ |
| 378 | MC_CMD_OP(cmd, 6, 24, 8, char, endpoint2->type[11]); \ |
| 379 | MC_CMD_OP(cmd, 6, 32, 8, char, endpoint2->type[12]); \ |
| 380 | MC_CMD_OP(cmd, 6, 40, 8, char, endpoint2->type[13]); \ |
| 381 | MC_CMD_OP(cmd, 6, 48, 8, char, endpoint2->type[14]); \ |
| 382 | MC_CMD_OP(cmd, 6, 56, 8, char, endpoint2->type[15]); \ |
| 383 | } while (0) |
| 384 | |
| 385 | /* cmd, param, offset, width, type, arg_name */ |
| 386 | #define DPRC_CMD_DISCONNECT(cmd, endpoint) \ |
| 387 | do { \ |
| 388 | MC_CMD_OP(cmd, 0, 0, 32, int, endpoint->id); \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 389 | MC_CMD_OP(cmd, 0, 32, 16, uint16_t, endpoint->if_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 390 | MC_CMD_OP(cmd, 1, 0, 8, char, endpoint->type[0]); \ |
| 391 | MC_CMD_OP(cmd, 1, 8, 8, char, endpoint->type[1]); \ |
| 392 | MC_CMD_OP(cmd, 1, 16, 8, char, endpoint->type[2]); \ |
| 393 | MC_CMD_OP(cmd, 1, 24, 8, char, endpoint->type[3]); \ |
| 394 | MC_CMD_OP(cmd, 1, 32, 8, char, endpoint->type[4]); \ |
| 395 | MC_CMD_OP(cmd, 1, 40, 8, char, endpoint->type[5]); \ |
| 396 | MC_CMD_OP(cmd, 1, 48, 8, char, endpoint->type[6]); \ |
| 397 | MC_CMD_OP(cmd, 1, 56, 8, char, endpoint->type[7]); \ |
| 398 | MC_CMD_OP(cmd, 2, 0, 8, char, endpoint->type[8]); \ |
| 399 | MC_CMD_OP(cmd, 2, 8, 8, char, endpoint->type[9]); \ |
| 400 | MC_CMD_OP(cmd, 2, 16, 8, char, endpoint->type[10]); \ |
| 401 | MC_CMD_OP(cmd, 2, 24, 8, char, endpoint->type[11]); \ |
| 402 | MC_CMD_OP(cmd, 2, 32, 8, char, endpoint->type[12]); \ |
| 403 | MC_CMD_OP(cmd, 2, 40, 8, char, endpoint->type[13]); \ |
| 404 | MC_CMD_OP(cmd, 2, 48, 8, char, endpoint->type[14]); \ |
| 405 | MC_CMD_OP(cmd, 2, 56, 8, char, endpoint->type[15]); \ |
| 406 | } while (0) |
| 407 | |
| 408 | /* cmd, param, offset, width, type, arg_name */ |
| 409 | #define DPRC_CMD_GET_CONNECTION(cmd, endpoint1) \ |
| 410 | do { \ |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 411 | MC_CMD_OP(cmd, 0, 0, 32, int, endpoint1->id); \ |
| 412 | MC_CMD_OP(cmd, 0, 32, 32, int, endpoint1->if_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 413 | MC_CMD_OP(cmd, 1, 0, 8, char, endpoint1->type[0]); \ |
| 414 | MC_CMD_OP(cmd, 1, 8, 8, char, endpoint1->type[1]); \ |
| 415 | MC_CMD_OP(cmd, 1, 16, 8, char, endpoint1->type[2]); \ |
| 416 | MC_CMD_OP(cmd, 1, 24, 8, char, endpoint1->type[3]); \ |
| 417 | MC_CMD_OP(cmd, 1, 32, 8, char, endpoint1->type[4]); \ |
| 418 | MC_CMD_OP(cmd, 1, 40, 8, char, endpoint1->type[5]); \ |
| 419 | MC_CMD_OP(cmd, 1, 48, 8, char, endpoint1->type[6]); \ |
| 420 | MC_CMD_OP(cmd, 1, 56, 8, char, endpoint1->type[7]); \ |
| 421 | MC_CMD_OP(cmd, 2, 0, 8, char, endpoint1->type[8]); \ |
| 422 | MC_CMD_OP(cmd, 2, 8, 8, char, endpoint1->type[9]); \ |
| 423 | MC_CMD_OP(cmd, 2, 16, 8, char, endpoint1->type[10]); \ |
| 424 | MC_CMD_OP(cmd, 2, 24, 8, char, endpoint1->type[11]); \ |
| 425 | MC_CMD_OP(cmd, 2, 32, 8, char, endpoint1->type[12]); \ |
| 426 | MC_CMD_OP(cmd, 2, 40, 8, char, endpoint1->type[13]); \ |
| 427 | MC_CMD_OP(cmd, 2, 48, 8, char, endpoint1->type[14]); \ |
| 428 | MC_CMD_OP(cmd, 2, 56, 8, char, endpoint1->type[15]); \ |
| 429 | } while (0) |
| 430 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 431 | /* cmd, param, offset, width, type, arg_name */ |
| 432 | #define DPRC_RSP_GET_CONNECTION(cmd, endpoint2, state) \ |
| 433 | do { \ |
| 434 | MC_RSP_OP(cmd, 3, 0, 32, int, endpoint2->id); \ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 435 | MC_RSP_OP(cmd, 3, 32, 16, uint16_t, endpoint2->if_id); \ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 436 | MC_RSP_OP(cmd, 4, 0, 8, char, endpoint2->type[0]); \ |
| 437 | MC_RSP_OP(cmd, 4, 8, 8, char, endpoint2->type[1]); \ |
| 438 | MC_RSP_OP(cmd, 4, 16, 8, char, endpoint2->type[2]); \ |
| 439 | MC_RSP_OP(cmd, 4, 24, 8, char, endpoint2->type[3]); \ |
| 440 | MC_RSP_OP(cmd, 4, 32, 8, char, endpoint2->type[4]); \ |
| 441 | MC_RSP_OP(cmd, 4, 40, 8, char, endpoint2->type[5]); \ |
| 442 | MC_RSP_OP(cmd, 4, 48, 8, char, endpoint2->type[6]); \ |
| 443 | MC_RSP_OP(cmd, 4, 56, 8, char, endpoint2->type[7]); \ |
| 444 | MC_RSP_OP(cmd, 5, 0, 8, char, endpoint2->type[8]); \ |
| 445 | MC_RSP_OP(cmd, 5, 8, 8, char, endpoint2->type[9]); \ |
| 446 | MC_RSP_OP(cmd, 5, 16, 8, char, endpoint2->type[10]); \ |
| 447 | MC_RSP_OP(cmd, 5, 24, 8, char, endpoint2->type[11]); \ |
| 448 | MC_RSP_OP(cmd, 5, 32, 8, char, endpoint2->type[12]); \ |
| 449 | MC_RSP_OP(cmd, 5, 40, 8, char, endpoint2->type[13]); \ |
| 450 | MC_RSP_OP(cmd, 5, 48, 8, char, endpoint2->type[14]); \ |
| 451 | MC_RSP_OP(cmd, 5, 56, 8, char, endpoint2->type[15]); \ |
| 452 | MC_RSP_OP(cmd, 6, 0, 32, int, state); \ |
| 453 | } while (0) |
| 454 | |
| 455 | /* Data Path Resource Container API |
| 456 | * Contains DPRC API for managing and querying DPAA resources |
| 457 | */ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 458 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 459 | struct fsl_mc_io; |
| 460 | |
| 461 | /** |
| 462 | * Set this value as the icid value in dprc_cfg structure when creating a |
| 463 | * container, in case the ICID is not selected by the user and should be |
| 464 | * allocated by the DPRC from the pool of ICIDs. |
| 465 | */ |
| 466 | #define DPRC_GET_ICID_FROM_POOL (uint16_t)(~(0)) |
| 467 | |
| 468 | /** |
| 469 | * Set this value as the portal_id value in dprc_cfg structure when creating a |
| 470 | * container, in case the portal ID is not specifically selected by the |
| 471 | * user and should be allocated by the DPRC from the pool of portal ids. |
| 472 | */ |
| 473 | #define DPRC_GET_PORTAL_ID_FROM_POOL (int)(~(0)) |
| 474 | |
| 475 | /** |
| 476 | * dprc_get_container_id() - Get container ID associated with a given portal. |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 477 | * @mc_io: Pointer to MC portal's I/O object |
| 478 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 479 | * @container_id: Requested container ID |
| 480 | * |
| 481 | * Return: '0' on Success; Error code otherwise. |
| 482 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 483 | int dprc_get_container_id(struct fsl_mc_io *mc_io, |
| 484 | uint32_t cmd_flags, |
| 485 | int *container_id); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 486 | |
| 487 | /** |
| 488 | * dprc_open() - Open DPRC object for use |
| 489 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 490 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 491 | * @container_id: Container ID to open |
| 492 | * @token: Returned token of DPRC object |
| 493 | * |
| 494 | * Return: '0' on Success; Error code otherwise. |
| 495 | * |
| 496 | * @warning Required before any operation on the object. |
| 497 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 498 | int dprc_open(struct fsl_mc_io *mc_io, |
| 499 | uint32_t cmd_flags, |
| 500 | int container_id, |
| 501 | uint16_t *token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 502 | |
| 503 | /** |
| 504 | * dprc_close() - Close the control session of the object |
| 505 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 506 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 507 | * @token: Token of DPRC object |
| 508 | * |
| 509 | * After this function is called, no further operations are |
| 510 | * allowed on the object without opening a new control session. |
| 511 | * |
| 512 | * Return: '0' on Success; Error code otherwise. |
| 513 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 514 | int dprc_close(struct fsl_mc_io *mc_io, |
| 515 | uint32_t cmd_flags, |
| 516 | uint16_t token); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 517 | |
| 518 | /** |
| 519 | * Container general options |
| 520 | * |
| 521 | * These options may be selected at container creation by the container creator |
| 522 | * and can be retrieved using dprc_get_attributes() |
| 523 | */ |
| 524 | |
| 525 | /* Spawn Policy Option allowed - Indicates that the new container is allowed |
| 526 | * to spawn and have its own child containers. |
| 527 | */ |
| 528 | #define DPRC_CFG_OPT_SPAWN_ALLOWED 0x00000001 |
| 529 | |
| 530 | /* General Container allocation policy - Indicates that the new container is |
| 531 | * allowed to allocate requested resources from its parent container; if not |
| 532 | * set, the container is only allowed to use resources in its own pools; Note |
| 533 | * that this is a container's global policy, but the parent container may |
| 534 | * override it and set specific quota per resource type. |
| 535 | */ |
| 536 | #define DPRC_CFG_OPT_ALLOC_ALLOWED 0x00000002 |
| 537 | |
| 538 | /* Object initialization allowed - software context associated with this |
| 539 | * container is allowed to invoke object initialization operations. |
| 540 | */ |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 541 | #define DPRC_CFG_OPT_OBJ_CREATE_ALLOWED 0x00000004 |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 542 | |
| 543 | /* Topology change allowed - software context associated with this |
| 544 | * container is allowed to invoke topology operations, such as attach/detach |
| 545 | * of network objects. |
| 546 | */ |
| 547 | #define DPRC_CFG_OPT_TOPOLOGY_CHANGES_ALLOWED 0x00000008 |
| 548 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 549 | |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 550 | /* AIOP - Indicates that container belongs to AIOP. */ |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 551 | #define DPRC_CFG_OPT_AIOP 0x00000020 |
| 552 | |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 553 | /* IRQ Config - Indicates that the container allowed to configure its IRQs.*/ |
| 554 | #define DPRC_CFG_OPT_IRQ_CFG_ALLOWED 0x00000040 |
| 555 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 556 | /** |
| 557 | * struct dprc_cfg - Container configuration options |
| 558 | * @icid: Container's ICID; if set to 'DPRC_GET_ICID_FROM_POOL', a free |
| 559 | * ICID value is allocated by the DPRC |
| 560 | * @portal_id: Portal ID; if set to 'DPRC_GET_PORTAL_ID_FROM_POOL', a free |
| 561 | * portal ID is allocated by the DPRC |
| 562 | * @options: Combination of 'DPRC_CFG_OPT_<X>' options |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 563 | * @label: Object's label |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 564 | */ |
| 565 | struct dprc_cfg { |
| 566 | uint16_t icid; |
| 567 | int portal_id; |
| 568 | uint64_t options; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 569 | char label[16]; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 570 | }; |
| 571 | |
| 572 | /** |
Prabhakar Kushwaha | cf0c8cf | 2015-11-04 12:25:53 +0530 | [diff] [blame] | 573 | * dprc_create_container() - Create child container |
| 574 | * @mc_io: Pointer to MC portal's I/O object |
| 575 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 576 | * @token: Token of DPRC object |
| 577 | * @cfg: Child container configuration |
| 578 | * @child_container_id: Returned child container ID |
| 579 | * @child_portal_offset: Returned child portal offset from MC portal base |
| 580 | * |
| 581 | * |
| 582 | * Return: '0' on Success; Error code otherwise. |
| 583 | */ |
| 584 | int dprc_create_container(struct fsl_mc_io *mc_io, |
| 585 | uint32_t cmd_flags, |
| 586 | uint16_t token, |
| 587 | struct dprc_cfg *cfg, |
| 588 | int *child_container_id, |
| 589 | uint64_t *child_portal_offset); |
| 590 | |
| 591 | /** |
| 592 | * dprc_destroy_container() - Destroy child container. |
| 593 | * @mc_io: Pointer to MC portal's I/O object |
| 594 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 595 | * @token: Token of DPRC object |
| 596 | * @child_container_id: ID of the container to destroy |
| 597 | * |
| 598 | * This function terminates the child container, so following this call the |
| 599 | * child container ID becomes invalid. |
| 600 | * |
| 601 | * Notes: |
| 602 | * - All resources and objects of the destroyed container are returned to the |
| 603 | * parent container or destroyed if were created be the destroyed container. |
| 604 | * - This function destroy all the child containers of the specified |
| 605 | * container prior to destroying the container itself. |
| 606 | * |
| 607 | * warning: Only the parent container is allowed to destroy a child policy |
| 608 | * Container 0 can't be destroyed |
| 609 | * |
| 610 | * Return: '0' on Success; Error code otherwise. |
| 611 | * |
| 612 | */ |
| 613 | int dprc_destroy_container(struct fsl_mc_io *mc_io, |
| 614 | uint32_t cmd_flags, |
| 615 | uint16_t token, |
| 616 | int child_container_id); |
| 617 | |
| 618 | /** |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 619 | * dprc_reset_container - Reset child container. |
| 620 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 621 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 622 | * @token: Token of DPRC object |
| 623 | * @child_container_id: ID of the container to reset |
| 624 | * |
| 625 | * In case a software context crashes or becomes non-responsive, the parent |
| 626 | * may wish to reset its resources container before the software context is |
| 627 | * restarted. |
| 628 | * |
| 629 | * This routine informs all objects assigned to the child container that the |
| 630 | * container is being reset, so they may perform any cleanup operations that are |
| 631 | * needed. All objects handles that were owned by the child container shall be |
| 632 | * closed. |
| 633 | * |
| 634 | * Note that such request may be submitted even if the child software context |
| 635 | * has not crashed, but the resulting object cleanup operations will not be |
| 636 | * aware of that. |
| 637 | * |
| 638 | * Return: '0' on Success; Error code otherwise. |
| 639 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 640 | int dprc_reset_container(struct fsl_mc_io *mc_io, |
| 641 | uint32_t cmd_flags, |
| 642 | uint16_t token, |
| 643 | int child_container_id); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 644 | |
| 645 | /** |
| 646 | * struct dprc_attributes - Container attributes |
| 647 | * @container_id: Container's ID |
| 648 | * @icid: Container's ICID |
| 649 | * @portal_id: Container's portal ID |
| 650 | * @options: Container's options as set at container's creation |
| 651 | * @version: DPRC version |
| 652 | */ |
| 653 | struct dprc_attributes { |
| 654 | int container_id; |
| 655 | uint16_t icid; |
| 656 | int portal_id; |
| 657 | uint64_t options; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 658 | }; |
| 659 | |
| 660 | /** |
| 661 | * dprc_get_attributes() - Obtains container attributes |
| 662 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 663 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 664 | * @token: Token of DPRC object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 665 | * @attributes: Returned container attributes |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 666 | * |
| 667 | * Return: '0' on Success; Error code otherwise. |
| 668 | */ |
| 669 | int dprc_get_attributes(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 670 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 671 | uint16_t token, |
| 672 | struct dprc_attributes *attributes); |
| 673 | |
| 674 | /** |
| 675 | * dprc_get_obj_count() - Obtains the number of objects in the DPRC |
| 676 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 677 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 678 | * @token: Token of DPRC object |
| 679 | * @obj_count: Number of objects assigned to the DPRC |
| 680 | * |
| 681 | * Return: '0' on Success; Error code otherwise. |
| 682 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 683 | int dprc_get_obj_count(struct fsl_mc_io *mc_io, |
| 684 | uint32_t cmd_flags, |
| 685 | uint16_t token, |
| 686 | int *obj_count); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 687 | |
| 688 | /* Objects Attributes Flags */ |
| 689 | |
| 690 | /* Opened state - Indicates that an object is open by at least one owner */ |
| 691 | #define DPRC_OBJ_STATE_OPEN 0x00000001 |
| 692 | /* Plugged state - Indicates that the object is plugged */ |
| 693 | #define DPRC_OBJ_STATE_PLUGGED 0x00000002 |
| 694 | |
| 695 | /** |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 696 | * Shareability flag - Object flag indicating no memory shareability. |
| 697 | * the object generates memory accesses that are non coherent with other |
| 698 | * masters; |
| 699 | * user is responsible for proper memory handling through IOMMU configuration. |
| 700 | */ |
| 701 | #define DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001 |
| 702 | |
| 703 | /** |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 704 | * struct dprc_obj_desc - Object descriptor, returned from dprc_get_obj() |
| 705 | * @type: Type of object: NULL terminated string |
| 706 | * @id: ID of logical object resource |
| 707 | * @vendor: Object vendor identifier |
| 708 | * @ver_major: Major version number |
| 709 | * @ver_minor: Minor version number |
| 710 | * @irq_count: Number of interrupts supported by the object |
| 711 | * @region_count: Number of mappable regions supported by the object |
| 712 | * @state: Object state: combination of DPRC_OBJ_STATE_ states |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 713 | * @label: Object label |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 714 | * @flags: Object's flags |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 715 | */ |
| 716 | struct dprc_obj_desc { |
| 717 | char type[16]; |
| 718 | int id; |
| 719 | uint16_t vendor; |
| 720 | uint16_t ver_major; |
| 721 | uint16_t ver_minor; |
| 722 | uint8_t irq_count; |
| 723 | uint8_t region_count; |
| 724 | uint32_t state; |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 725 | char label[16]; |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 726 | uint16_t flags; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 727 | }; |
| 728 | |
| 729 | /** |
| 730 | * dprc_get_obj() - Get general information on an object |
| 731 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 732 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 733 | * @token: Token of DPRC object |
| 734 | * @obj_index: Index of the object to be queried (< obj_count) |
| 735 | * @obj_desc: Returns the requested object descriptor |
| 736 | * |
| 737 | * The object descriptors are retrieved one by one by incrementing |
| 738 | * obj_index up to (not including) the value of obj_count returned |
| 739 | * from dprc_get_obj_count(). dprc_get_obj_count() must |
| 740 | * be called prior to dprc_get_obj(). |
| 741 | * |
| 742 | * Return: '0' on Success; Error code otherwise. |
| 743 | */ |
| 744 | int dprc_get_obj(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 745 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 746 | uint16_t token, |
| 747 | int obj_index, |
| 748 | struct dprc_obj_desc *obj_desc); |
| 749 | |
| 750 | /** |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 751 | * dprc_get_res_count() - Obtains the number of free resources that are |
| 752 | * assigned to this container, by pool type |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 753 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 754 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 755 | * @token: Token of DPRC object |
| 756 | * @type: pool type |
| 757 | * @res_count: Returned number of free resources of the given |
| 758 | * resource type that are assigned to this DPRC |
| 759 | * |
| 760 | * Return: '0' on Success; Error code otherwise. |
| 761 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 762 | int dprc_get_res_count(struct fsl_mc_io *mc_io, |
| 763 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 764 | uint16_t token, |
| 765 | char *type, |
| 766 | int *res_count); |
| 767 | |
| 768 | /** |
| 769 | * enum dprc_iter_status - Iteration status |
| 770 | * @DPRC_ITER_STATUS_FIRST: Perform first iteration |
| 771 | * @DPRC_ITER_STATUS_MORE: Indicates more/next iteration is needed |
| 772 | * @DPRC_ITER_STATUS_LAST: Indicates last iteration |
| 773 | */ |
| 774 | enum dprc_iter_status { |
| 775 | DPRC_ITER_STATUS_FIRST = 0, |
| 776 | DPRC_ITER_STATUS_MORE = 1, |
| 777 | DPRC_ITER_STATUS_LAST = 2 |
| 778 | }; |
| 779 | |
| 780 | /** |
| 781 | * struct dprc_res_ids_range_desc - Resource ID range descriptor |
| 782 | * @base_id: Base resource ID of this range |
| 783 | * @last_id: Last resource ID of this range |
| 784 | * @iter_status: Iteration status - should be set to DPRC_ITER_STATUS_FIRST at |
| 785 | * first iteration; while the returned marker is DPRC_ITER_STATUS_MORE, |
| 786 | * additional iterations are needed, until the returned marker is |
| 787 | * DPRC_ITER_STATUS_LAST |
| 788 | */ |
| 789 | struct dprc_res_ids_range_desc { |
| 790 | int base_id; |
| 791 | int last_id; |
| 792 | enum dprc_iter_status iter_status; |
| 793 | }; |
| 794 | |
| 795 | /** |
| 796 | * dprc_get_res_ids() - Obtains IDs of free resources in the container |
| 797 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 798 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 799 | * @token: Token of DPRC object |
| 800 | * @type: pool type |
| 801 | * @range_desc: range descriptor |
| 802 | * |
| 803 | * Return: '0' on Success; Error code otherwise. |
| 804 | */ |
| 805 | int dprc_get_res_ids(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 806 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 807 | uint16_t token, |
| 808 | char *type, |
| 809 | struct dprc_res_ids_range_desc *range_desc); |
| 810 | |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 811 | /* Region flags */ |
| 812 | /* Cacheable - Indicates that region should be mapped as cacheable */ |
| 813 | #define DPRC_REGION_CACHEABLE 0x00000001 |
| 814 | |
| 815 | /** |
| 816 | * enum dprc_region_type - Region type |
| 817 | * @DPRC_REGION_TYPE_MC_PORTAL: MC portal region |
| 818 | * @DPRC_REGION_TYPE_QBMAN_PORTAL: Qbman portal region |
| 819 | */ |
| 820 | enum dprc_region_type { |
| 821 | DPRC_REGION_TYPE_MC_PORTAL, |
| 822 | DPRC_REGION_TYPE_QBMAN_PORTAL |
| 823 | }; |
| 824 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 825 | /** |
| 826 | * struct dprc_region_desc - Mappable region descriptor |
Prabhakar Kushwaha | fd5d127 | 2015-07-02 11:28:59 +0530 | [diff] [blame] | 827 | * @base_offset: Region offset from region's base address. |
| 828 | * For DPMCP and DPRC objects, region base is offset from SoC MC portals |
| 829 | * base address; For DPIO, region base is offset from SoC QMan portals |
| 830 | * base address |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 831 | * @size: Region size (in bytes) |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 832 | * @flags: Region attributes |
| 833 | * @type: Portal region type |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 834 | */ |
| 835 | struct dprc_region_desc { |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 836 | uint32_t base_offset; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 837 | uint32_t size; |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 838 | uint32_t flags; |
| 839 | enum dprc_region_type type; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 840 | }; |
| 841 | |
| 842 | /** |
| 843 | * dprc_get_obj_region() - Get region information for a specified object. |
| 844 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 845 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 846 | * @token: Token of DPRC object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 847 | * @obj_type: Object type as returned in dprc_get_obj() |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 848 | * @obj_id: Unique object instance as returned in dprc_get_obj() |
| 849 | * @region_index: The specific region to query |
| 850 | * @region_desc: Returns the requested region descriptor |
| 851 | * |
| 852 | * Return: '0' on Success; Error code otherwise. |
| 853 | */ |
| 854 | int dprc_get_obj_region(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 855 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 856 | uint16_t token, |
| 857 | char *obj_type, |
| 858 | int obj_id, |
| 859 | uint8_t region_index, |
| 860 | struct dprc_region_desc *region_desc); |
| 861 | /** |
| 862 | * struct dprc_endpoint - Endpoint description for link connect/disconnect |
| 863 | * operations |
| 864 | * @type: Endpoint object type: NULL terminated string |
| 865 | * @id: Endpoint object ID |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 866 | * @if_id: Interface ID; should be set for endpoints with multiple |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 867 | * interfaces ("dpsw", "dpdmux"); for others, always set to 0 |
| 868 | */ |
| 869 | struct dprc_endpoint { |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 870 | char type[16]; |
| 871 | int id; |
| 872 | uint16_t if_id; |
| 873 | }; |
| 874 | |
| 875 | /** |
| 876 | * struct dprc_connection_cfg - Connection configuration. |
| 877 | * Used for virtual connections only |
| 878 | * @committed_rate: Committed rate (Mbits/s) |
| 879 | * @max_rate: Maximum rate (Mbits/s) |
| 880 | */ |
| 881 | struct dprc_connection_cfg { |
| 882 | uint32_t committed_rate; |
| 883 | uint32_t max_rate; |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 884 | }; |
| 885 | |
| 886 | /** |
| 887 | * dprc_connect() - Connect two endpoints to create a network link between them |
| 888 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 889 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 890 | * @token: Token of DPRC object |
| 891 | * @endpoint1: Endpoint 1 configuration parameters |
| 892 | * @endpoint2: Endpoint 2 configuration parameters |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 893 | * @cfg: Connection configuration. The connection configuration is ignored for |
| 894 | * connections made to DPMAC objects, where rate is retrieved from the |
| 895 | * MAC configuration. |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 896 | * |
| 897 | * Return: '0' on Success; Error code otherwise. |
| 898 | */ |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 899 | int dprc_connect(struct fsl_mc_io *mc_io, |
| 900 | uint32_t cmd_flags, |
| 901 | uint16_t token, |
| 902 | const struct dprc_endpoint *endpoint1, |
| 903 | const struct dprc_endpoint *endpoint2, |
| 904 | const struct dprc_connection_cfg *cfg); |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 905 | |
| 906 | /** |
| 907 | * dprc_disconnect() - Disconnect one endpoint to remove its network connection |
| 908 | * @mc_io: Pointer to MC portal's I/O object |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 909 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 910 | * @token: Token of DPRC object |
| 911 | * @endpoint: Endpoint configuration parameters |
| 912 | * |
| 913 | * Return: '0' on Success; Error code otherwise. |
| 914 | */ |
| 915 | int dprc_disconnect(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 916 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 917 | uint16_t token, |
| 918 | const struct dprc_endpoint *endpoint); |
| 919 | |
| 920 | /** |
| 921 | * dprc_get_connection() - Get connected endpoint and link status if connection |
| 922 | * exists. |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 923 | * @mc_io: Pointer to MC portal's I/O object |
| 924 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 925 | * @token: Token of DPRC object |
| 926 | * @endpoint1: Endpoint 1 configuration parameters |
| 927 | * @endpoint2: Returned endpoint 2 configuration parameters |
Prabhakar Kushwaha | c3d06e3 | 2015-12-24 15:32:49 +0530 | [diff] [blame] | 928 | * @state: Returned link state: |
| 929 | * 1 - link is up; |
| 930 | * 0 - link is down; |
| 931 | * -1 - no connection (endpoint2 information is irrelevant) |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 932 | * |
| 933 | * Return: '0' on Success; -ENAVAIL if connection does not exist. |
| 934 | */ |
| 935 | int dprc_get_connection(struct fsl_mc_io *mc_io, |
Prabhakar Kushwaha | 9564df6 | 2015-07-07 15:40:06 +0530 | [diff] [blame] | 936 | uint32_t cmd_flags, |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 937 | uint16_t token, |
| 938 | const struct dprc_endpoint *endpoint1, |
| 939 | struct dprc_endpoint *endpoint2, |
| 940 | int *state); |
| 941 | |
Yogesh Gaur | 318c32f | 2017-11-15 11:59:31 +0530 | [diff] [blame] | 942 | /** |
| 943 | * dprc_get_api_version - Retrieve DPRC Major and Minor version info. |
| 944 | * |
| 945 | * @mc_io: Pointer to MC portal's I/O object |
| 946 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
| 947 | * @major_ver: DPRC major version |
| 948 | * @minor_ver: DPRC minor version |
| 949 | * |
| 950 | * Return: '0' on Success; Error code otherwise. |
| 951 | */ |
| 952 | int dprc_get_api_version(struct fsl_mc_io *mc_io, |
| 953 | u32 cmd_flags, |
| 954 | u16 *major_ver, |
| 955 | u16 *minor_ver); |
| 956 | |
Prabhakar Kushwaha | cfd9fbf | 2015-03-19 09:20:45 -0700 | [diff] [blame] | 957 | #endif /* _FSL_DPRC_H */ |