linux/drivers/staging/fsl-mc/bus/dprc-cmd.h
<<
>>
Prefs
   1/*
   2 * Copyright 2013-2016 Freescale Semiconductor Inc.
   3 *
   4 * Redistribution and use in source and binary forms, with or without
   5 * modification, are permitted provided that the following conditions are met:
   6 *     * Redistributions of source code must retain the above copyright
   7 *       notice, this list of conditions and the following disclaimer.
   8 *     * Redistributions in binary form must reproduce the above copyright
   9 *       notice, this list of conditions and the following disclaimer in the
  10 *       documentation and/or other materials provided with the distribution.
  11 *     * Neither the name of the above-listed copyright holders nor the
  12 *       names of any contributors may be used to endorse or promote products
  13 *       derived from this software without specific prior written permission.
  14 *
  15 * ALTERNATIVELY, this software may be distributed under the terms of the
  16 * GNU General Public License ("GPL") as published by the Free Software
  17 * Foundation, either version 2 of that License or (at your option) any
  18 * later version.
  19 *
  20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
  24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30 * POSSIBILITY OF SUCH DAMAGE.
  31 */
  32
  33/*
  34 * dprc-cmd.h
  35 *
  36 * defines dprc portal commands
  37 *
  38 */
  39
  40#ifndef _FSL_DPRC_CMD_H
  41#define _FSL_DPRC_CMD_H
  42
  43/* Minimal supported DPRC Version */
  44#define DPRC_MIN_VER_MAJOR                      6
  45#define DPRC_MIN_VER_MINOR                      0
  46
  47/* Command versioning */
  48#define DPRC_CMD_BASE_VERSION                   1
  49#define DPRC_CMD_ID_OFFSET                      4
  50
  51#define DPRC_CMD(id)    (((id) << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
  52
  53/* Command IDs */
  54#define DPRC_CMDID_CLOSE                        DPRC_CMD(0x800)
  55#define DPRC_CMDID_OPEN                         DPRC_CMD(0x805)
  56#define DPRC_CMDID_GET_API_VERSION              DPRC_CMD(0xa05)
  57
  58#define DPRC_CMDID_GET_ATTR                     DPRC_CMD(0x004)
  59
  60#define DPRC_CMDID_SET_IRQ                      DPRC_CMD(0x010)
  61#define DPRC_CMDID_GET_IRQ                      DPRC_CMD(0x011)
  62#define DPRC_CMDID_SET_IRQ_ENABLE               DPRC_CMD(0x012)
  63#define DPRC_CMDID_GET_IRQ_ENABLE               DPRC_CMD(0x013)
  64#define DPRC_CMDID_SET_IRQ_MASK                 DPRC_CMD(0x014)
  65#define DPRC_CMDID_GET_IRQ_MASK                 DPRC_CMD(0x015)
  66#define DPRC_CMDID_GET_IRQ_STATUS               DPRC_CMD(0x016)
  67#define DPRC_CMDID_CLEAR_IRQ_STATUS             DPRC_CMD(0x017)
  68
  69#define DPRC_CMDID_GET_CONT_ID                  DPRC_CMD(0x830)
  70#define DPRC_CMDID_GET_OBJ_COUNT                DPRC_CMD(0x159)
  71#define DPRC_CMDID_GET_OBJ                      DPRC_CMD(0x15A)
  72#define DPRC_CMDID_GET_RES_COUNT                DPRC_CMD(0x15B)
  73#define DPRC_CMDID_GET_OBJ_REG                  DPRC_CMD(0x15E)
  74#define DPRC_CMDID_SET_OBJ_IRQ                  DPRC_CMD(0x15F)
  75#define DPRC_CMDID_GET_OBJ_IRQ                  DPRC_CMD(0x160)
  76
  77struct dprc_cmd_open {
  78        __le32 container_id;
  79};
  80
  81struct dprc_cmd_create_container {
  82        /* cmd word 0 */
  83        __le32 options;
  84        __le16 icid;
  85        __le16 pad0;
  86        /* cmd word 1 */
  87        __le32 pad1;
  88        __le32 portal_id;
  89        /* cmd words 2-3 */
  90        u8 label[16];
  91};
  92
  93struct dprc_rsp_create_container {
  94        /* response word 0 */
  95        __le64 pad0;
  96        /* response word 1 */
  97        __le32 child_container_id;
  98        __le32 pad1;
  99        /* response word 2 */
 100        __le64 child_portal_addr;
 101};
 102
 103struct dprc_cmd_destroy_container {
 104        __le32 child_container_id;
 105};
 106
 107struct dprc_cmd_reset_container {
 108        __le32 child_container_id;
 109};
 110
 111struct dprc_cmd_set_irq {
 112        /* cmd word 0 */
 113        __le32 irq_val;
 114        u8 irq_index;
 115        u8 pad[3];
 116        /* cmd word 1 */
 117        __le64 irq_addr;
 118        /* cmd word 2 */
 119        __le32 irq_num;
 120};
 121
 122struct dprc_cmd_get_irq {
 123        __le32 pad;
 124        u8 irq_index;
 125};
 126
 127struct dprc_rsp_get_irq {
 128        /* response word 0 */
 129        __le32 irq_val;
 130        __le32 pad;
 131        /* response word 1 */
 132        __le64 irq_addr;
 133        /* response word 2 */
 134        __le32 irq_num;
 135        __le32 type;
 136};
 137
 138#define DPRC_ENABLE             0x1
 139
 140struct dprc_cmd_set_irq_enable {
 141        u8 enable;
 142        u8 pad[3];
 143        u8 irq_index;
 144};
 145
 146struct dprc_cmd_get_irq_enable {
 147        __le32 pad;
 148        u8 irq_index;
 149};
 150
 151struct dprc_rsp_get_irq_enable {
 152        u8 enabled;
 153};
 154
 155struct dprc_cmd_set_irq_mask {
 156        __le32 mask;
 157        u8 irq_index;
 158};
 159
 160struct dprc_cmd_get_irq_mask {
 161        __le32 pad;
 162        u8 irq_index;
 163};
 164
 165struct dprc_rsp_get_irq_mask {
 166        __le32 mask;
 167};
 168
 169struct dprc_cmd_get_irq_status {
 170        __le32 status;
 171        u8 irq_index;
 172};
 173
 174struct dprc_rsp_get_irq_status {
 175        __le32 status;
 176};
 177
 178struct dprc_cmd_clear_irq_status {
 179        __le32 status;
 180        u8 irq_index;
 181};
 182
 183struct dprc_rsp_get_attributes {
 184        /* response word 0 */
 185        __le32 container_id;
 186        __le16 icid;
 187        __le16 pad;
 188        /* response word 1 */
 189        __le32 options;
 190        __le32 portal_id;
 191};
 192
 193struct dprc_cmd_set_res_quota {
 194        /* cmd word 0 */
 195        __le32 child_container_id;
 196        __le16 quota;
 197        __le16 pad;
 198        /* cmd words 1-2 */
 199        u8 type[16];
 200};
 201
 202struct dprc_cmd_get_res_quota {
 203        /* cmd word 0 */
 204        __le32 child_container_id;
 205        __le32 pad;
 206        /* cmd word 1-2 */
 207        u8 type[16];
 208};
 209
 210struct dprc_rsp_get_res_quota {
 211        __le32 pad;
 212        __le16 quota;
 213};
 214
 215struct dprc_cmd_assign {
 216        /* cmd word 0 */
 217        __le32 container_id;
 218        __le32 options;
 219        /* cmd word 1 */
 220        __le32 num;
 221        __le32 id_base_align;
 222        /* cmd word 2-3 */
 223        u8 type[16];
 224};
 225
 226struct dprc_cmd_unassign {
 227        /* cmd word 0 */
 228        __le32 child_container_id;
 229        __le32 options;
 230        /* cmd word 1 */
 231        __le32 num;
 232        __le32 id_base_align;
 233        /* cmd word 2-3 */
 234        u8 type[16];
 235};
 236
 237struct dprc_rsp_get_pool_count {
 238        __le32 pool_count;
 239};
 240
 241struct dprc_cmd_get_pool {
 242        __le32 pool_index;
 243};
 244
 245struct dprc_rsp_get_pool {
 246        /* response word 0 */
 247        __le64 pad;
 248        /* response word 1-2 */
 249        u8 type[16];
 250};
 251
 252struct dprc_rsp_get_obj_count {
 253        __le32 pad;
 254        __le32 obj_count;
 255};
 256
 257struct dprc_cmd_get_obj {
 258        __le32 obj_index;
 259};
 260
 261struct dprc_rsp_get_obj {
 262        /* response word 0 */
 263        __le32 pad0;
 264        __le32 id;
 265        /* response word 1 */
 266        __le16 vendor;
 267        u8 irq_count;
 268        u8 region_count;
 269        __le32 state;
 270        /* response word 2 */
 271        __le16 version_major;
 272        __le16 version_minor;
 273        __le16 flags;
 274        __le16 pad1;
 275        /* response word 3-4 */
 276        u8 type[16];
 277        /* response word 5-6 */
 278        u8 label[16];
 279};
 280
 281struct dprc_cmd_get_obj_desc {
 282        /* cmd word 0 */
 283        __le32 obj_id;
 284        __le32 pad;
 285        /* cmd word 1-2 */
 286        u8 type[16];
 287};
 288
 289struct dprc_rsp_get_obj_desc {
 290        /* response word 0 */
 291        __le32 pad0;
 292        __le32 id;
 293        /* response word 1 */
 294        __le16 vendor;
 295        u8 irq_count;
 296        u8 region_count;
 297        __le32 state;
 298        /* response word 2 */
 299        __le16 version_major;
 300        __le16 version_minor;
 301        __le16 flags;
 302        __le16 pad1;
 303        /* response word 3-4 */
 304        u8 type[16];
 305        /* response word 5-6 */
 306        u8 label[16];
 307};
 308
 309struct dprc_cmd_get_res_count {
 310        /* cmd word 0 */
 311        __le64 pad;
 312        /* cmd word 1-2 */
 313        u8 type[16];
 314};
 315
 316struct dprc_rsp_get_res_count {
 317        __le32 res_count;
 318};
 319
 320struct dprc_cmd_get_res_ids {
 321        /* cmd word 0 */
 322        u8 pad0[5];
 323        u8 iter_status;
 324        __le16 pad1;
 325        /* cmd word 1 */
 326        __le32 base_id;
 327        __le32 last_id;
 328        /* cmd word 2-3 */
 329        u8 type[16];
 330};
 331
 332struct dprc_rsp_get_res_ids {
 333        /* response word 0 */
 334        u8 pad0[5];
 335        u8 iter_status;
 336        __le16 pad1;
 337        /* response word 1 */
 338        __le32 base_id;
 339        __le32 last_id;
 340};
 341
 342struct dprc_cmd_get_obj_region {
 343        /* cmd word 0 */
 344        __le32 obj_id;
 345        __le16 pad0;
 346        u8 region_index;
 347        u8 pad1;
 348        /* cmd word 1-2 */
 349        __le64 pad2[2];
 350        /* cmd word 3-4 */
 351        u8 obj_type[16];
 352};
 353
 354struct dprc_rsp_get_obj_region {
 355        /* response word 0 */
 356        __le64 pad;
 357        /* response word 1 */
 358        __le64 base_addr;
 359        /* response word 2 */
 360        __le32 size;
 361};
 362
 363struct dprc_cmd_set_obj_label {
 364        /* cmd word 0 */
 365        __le32 obj_id;
 366        __le32 pad;
 367        /* cmd word 1-2 */
 368        u8 label[16];
 369        /* cmd word 3-4 */
 370        u8 obj_type[16];
 371};
 372
 373struct dprc_cmd_set_obj_irq {
 374        /* cmd word 0 */
 375        __le32 irq_val;
 376        u8 irq_index;
 377        u8 pad[3];
 378        /* cmd word 1 */
 379        __le64 irq_addr;
 380        /* cmd word 2 */
 381        __le32 irq_num;
 382        __le32 obj_id;
 383        /* cmd word 3-4 */
 384        u8 obj_type[16];
 385};
 386
 387struct dprc_cmd_get_obj_irq {
 388        /* cmd word 0 */
 389        __le32 obj_id;
 390        u8 irq_index;
 391        u8 pad[3];
 392        /* cmd word 1-2 */
 393        u8 obj_type[16];
 394};
 395
 396struct dprc_rsp_get_obj_irq {
 397        /* response word 0 */
 398        __le32 irq_val;
 399        __le32 pad;
 400        /* response word 1 */
 401        __le64 irq_addr;
 402        /* response word 2 */
 403        __le32 irq_num;
 404        __le32 type;
 405};
 406
 407struct dprc_cmd_connect {
 408        /* cmd word 0 */
 409        __le32 ep1_id;
 410        __le32 ep1_interface_id;
 411        /* cmd word 1 */
 412        __le32 ep2_id;
 413        __le32 ep2_interface_id;
 414        /* cmd word 2-3 */
 415        u8 ep1_type[16];
 416        /* cmd word 4 */
 417        __le32 max_rate;
 418        __le32 committed_rate;
 419        /* cmd word 5-6 */
 420        u8 ep2_type[16];
 421};
 422
 423struct dprc_cmd_disconnect {
 424        /* cmd word 0 */
 425        __le32 id;
 426        __le32 interface_id;
 427        /* cmd word 1-2 */
 428        u8 type[16];
 429};
 430
 431struct dprc_cmd_get_connection {
 432        /* cmd word 0 */
 433        __le32 ep1_id;
 434        __le32 ep1_interface_id;
 435        /* cmd word 1-2 */
 436        u8 ep1_type[16];
 437};
 438
 439struct dprc_rsp_get_connection {
 440        /* response word 0-2 */
 441        __le64 pad[3];
 442        /* response word 3 */
 443        __le32 ep2_id;
 444        __le32 ep2_interface_id;
 445        /* response word 4-5 */
 446        u8 ep2_type[16];
 447        /* response word 6 */
 448        __le32 state;
 449};
 450
 451#endif /* _FSL_DPRC_CMD_H */
 452