openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

cancun.h (20474B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:    cancun.h
      8  * Purpose: Header file for CANCUN module
      9  */
     10 
     11 #ifndef _CANCUN_H_
     12 #define _CANCUN_H_
     13 
     14 #include <soc/defs.h>
     15 #include <soc/esw/flow_db_core.h>
     16 #include <bcm/types.h>
     17 #include <soc/esw/cancun_enums.h>
     18 
     19 #define CANCUN_FILENAME_SIZE        (256)
     20 #define CANCUN_VERSION_LEN_MAX      (32)
     21 #define CANCUN_LIST_BUF_LEN         (512)
     22 #define CANCUN_DEST_MEM_NUM_MAX     (16)
     23 #define CANCUN_DEST_FIELD_NUM_MAX   (16)
     24 
     25 /*
     26  * CANCUN file type enumeration
     27 */
     28 typedef enum {
     29     CANCUN_SOC_FILE_TYPE_UNKNOWN,
     30     CANCUN_SOC_FILE_TYPE_CIH,
     31     CANCUN_SOC_FILE_TYPE_CMH,
     32     CANCUN_SOC_FILE_TYPE_CCH,
     33     CANCUN_SOC_FILE_TYPE_CFH,
     34     CANCUN_SOC_FILE_TYPE_CEH,
     35 
     36     /*Note: keep CANCUN_SOC_FILE_TYPE_NUM as the latest element of this enum
     37      * and update CANCUN_FILE_TYPE_NAMES_INITIALIZER accordingly*/
     38     CANCUN_SOC_FILE_TYPE_NUM
     39 } soc_cancun_file_type_e;
     40 
     41 #define CANCUN_FILE_TYPE_NAMES_INITIALIZER { \
     42     "UNKNOWN",  \
     43     "CIH",      \
     44     "CMH",      \
     45     "CCH",      \
     46     "CFH",      \
     47     "CEH",      \
     48 }
     49 
     50 /*
     51  * CANCUN file format enumeration
     52 */
     53 typedef enum {
     54     CANCUN_SOC_FILE_FORMAT_UNKNOWN,
     55     CANCUN_SOC_FILE_FORMAT_PIO,
     56     CANCUN_SOC_FILE_FORMAT_DMA,
     57     CANCUN_SOC_FILE_FORMAT_FIFO,
     58     CANCUN_SOC_FILE_FORMAT_YAML,
     59     CANCUN_SOC_FILE_FORMAT_PACK,
     60 
     61     /*Note: keep CANCUN_SOC_FILE_FORMAT_NUM as the latest element of this enum
     62      * and update CANCUN_FILE_FORMAT_NAMES_INITIALIZER accordingly*/
     63     CANCUN_SOC_FILE_FORMAT_NUM
     64 } soc_cancun_file_format_e;
     65 
     66 #define CANCUN_FILE_FORMAT_NAMES_INITIALIZER { \
     67     "UNKNOWN",  \
     68     "PIO",      \
     69     "DMA",      \
     70     "FIFO",     \
     71     "YMAL",     \
     72     "PACK",     \
     73 }
     74 
     75 /*
     76  * CANCUN file load status enumeration
     77 */
     78 typedef enum {
     79     CANCUN_SOC_FILE_LOAD_NONE,
     80     CANCUN_SOC_FILE_LOAD_COMPLETE,
     81     CANCUN_SOC_FILE_LOAD_IN_PROGRESS,
     82     CANCUN_SOC_FILE_LOAD_FAILED,
     83 
     84     /*Note: keep CANCUN_SOC_FILE_LOAD_STATUS_NUM as the latest element of this enum
     85      * and update CANCUN_FILE_LOAD_STATUS_INITIALIZER accordingly*/
     86     CANCUN_SOC_FILE_LOAD_STATUS_NUM
     87 } soc_cancun_file_load_status_e;
     88 
     89 #define CANCUN_FILE_LOAD_STATUS_INITIALIZER { \
     90     "NOT LOADED",       \
     91     "LOADED",           \
     92     "LOAD IN PROGRESS", \
     93     "LOAD FAILED",      \
     94 }
     95 
     96 /*
     97  * CANCUN version prefix enumeration
     98 */
     99 typedef enum {
    100     CANCUN_VERSION_PREFIX_INVALID,
    101     CANCUN_VERSION_PREFIX_AV,
    102     CANCUN_VERSION_PREFIX_CC,
    103     CANCUN_VERSION_PREFIX_NONE,
    104 
    105     /*Note: keep CANCUN_VERSION_PREFIX_NUM as the latest element of this enum
    106      * and update CANCUN_VERSION_PREFIX_INITIALIZER accordingly*/
    107     CANCUN_VERSION_PREFIX_NUM
    108 } soc_cancun_version_prefix_e;
    109 
    110 #define CANCUN_VERSION_PREFIX_INITIALIZER { \
    111     "INVALID",  \
    112     "AV",       \
    113     "CC",       \
    114     "",         \
    115 }
    116 
    117 /*
    118  * CANCUN file branch ID enumeration, start with 0x01
    119 */
    120 typedef enum {
    121     CANCUN_FILE_BRANCH_ID_DEF = 0x01,
    122     CANCUN_FILE_BRANCH_ID_HGoE,
    123     CANCUN_FILE_BRANCH_ID_GSH,
    124     CANCUN_FILE_BRANCH_ID_NUM
    125 } soc_cancun_file_branch_id_e;
    126 
    127 /*
    128  * CANCUN version flags
    129 */
    130 #define CANCUN_VERSION_FLAG_TEST        0x80000000
    131 #define CANCUN_VERSION_MASK             0x7FFFFFFF
    132 #define CANCUN_VERSION_REGSFILE_MASK    0x7FFFFF00
    133 
    134 /*
    135  * CANCUN version offsets
    136 */
    137 #define CANCUN_VERSION_OFFSET_BRANCH_ID     (24)
    138 #define CANCUN_VERSION_OFFSET_MAJOR         (16)
    139 #define CANCUN_VERSION_OFFSET_MINOR         (8)
    140 #define CANCUN_VERSION_OFFSET_PATCH         (0)
    141 #define CANCUN_VERSION_OFFSET_REVISION      (20)
    142 
    143 #define CANCUN_VERSION_REVISION_MASK       (0x00F00000)
    144 
    145 /*
    146  * SDK release version offsets
    147 */
    148 #define CANCUN_SDK_VERSION_OFFSET_MAJOR     (24)
    149 #define CANCUN_SDK_VERSION_OFFSET_MINOR     (16)
    150 #define CANCUN_SDK_VERSION_OFFSET_BUILD     (8)
    151 #define CANCUN_SDK_VERSION_OFFSET_RESERVED  (0)
    152 
    153 /*
    154  * CANCUN file header structure
    155  * Contains header format of a CANCUN loadable file
    156  */
    157 typedef struct soc_cancun_file_header_s {
    158     uint32 file_identifier;     /* Cancun File identifier */
    159     uint32 file_type;           /* Cancun File Type */
    160     uint32 chip_rev_id;         /* Chip & rev id */
    161     uint32 version;             /* Cancun Version */
    162     uint32 file_length;         /* File length in 32-bit words */
    163     uint32 num_data_blobs;      /* Number of data blobs */
    164     uint32 sdk_version;         /* SDK version that builds this file */
    165     uint32 rsvd2;
    166 } soc_cancun_file_header_t;
    167 
    168 
    169 /*
    170  * CANCUN file information structure
    171  * Contains information of a CANCUN loadable file
    172  */
    173 typedef struct soc_cancun_file_s {
    174     soc_cancun_file_header_t header;        /* File header */
    175     soc_cancun_file_type_e type;            /* File type enum */
    176     soc_cancun_file_format_e format;        /* File format enum */
    177     char filename[CANCUN_FILENAME_SIZE];    /* Filename */
    178     int valid;                              /* File validity */
    179     uint32 status;                          /* Loading status*/
    180 } soc_cancun_file_t;
    181 
    182 /* FLOW DB Control Structure */
    183 typedef struct soc_flow_db_s {
    184     uint32 status;
    185     uint32 version;
    186     soc_cancun_file_t file;   /* Flow DB file entry */
    187     soc_flow_db_flow_map_t *flow_map;
    188     char *str_tbl;
    189 } soc_flow_db_t;
    190 
    191 /*
    192  * CANCUN CIH control structure
    193  * Contains information of currently loaded CIH files.
    194  */
    195 typedef struct soc_cancun_cih_s {
    196     uint32 status;            /* Loading status*/
    197     uint32 version;           /* Loaded version */
    198     soc_cancun_file_t  file;  /* CIH file entry */
    199 } soc_cancun_cih_t;
    200 
    201 /*
    202  * CANCUN hash table structure
    203  * Generalized hash table for CANCUN support
    204  *
    205  *     hash_key = (pa * field_enum + pb * mem_reg_enum + pc) % pd
    206  */
    207 typedef struct soc_cancun_hash_table_s {
    208     uint32 pa;                  /* Hash function parameter pA */
    209     uint32 pb;                  /* Hash function parameter pB */
    210     uint32 pc;                  /* Hash function parameter pC */
    211     uint32 pd;                  /* Hash function parameter pD */
    212     uint32 entry_num;           /* Total entry number in hash table */
    213     uint32 table_size;          /* Word count size for hash table */
    214     uint32 table_entry;         /* Hash table entry point */
    215 } soc_cancun_hash_table_t;
    216 
    217 /*
    218  * CANCUN generic hash entry header
    219  */
    220 typedef struct soc_cancun_entry_hdr_s {
    221     uint32 entry_size;
    222     uint32 format;
    223     uint32 src_mem;
    224     uint32 src_field;
    225     int src_app;
    226 } soc_cancun_entry_hdr_t;
    227 
    228 /*
    229  * CANCUN coverage list structure
    230  */
    231 typedef struct soc_cancun_list_s {
    232     uint32 entry_size;
    233     uint32 format;
    234     uint32 src_mem;
    235     uint32 src_field;
    236     int src_app;
    237     uint32 member_num;
    238     uint32 members;
    239 } soc_cancun_list_t;
    240 
    241 /*
    242  * CANCUN destination entry structure for reporting use
    243  */
    244 typedef struct soc_cancun_dest_entry_s {
    245     uint32 dest_index_num;      /* Destination memory table index number*/
    246     uint32 dest_field_num;      /* Destination field number in this memory*/
    247     uint32 dest_mems[CANCUN_DEST_MEM_NUM_MAX];      /* Destination memories */
    248     uint32 dest_fields[CANCUN_DEST_FIELD_NUM_MAX];  /* Destination fields */
    249     uint32 dest_values[CANCUN_DEST_FIELD_NUM_MAX];  /* Destination values */
    250 } soc_cancun_dest_entry_t;
    251 
    252 /*
    253  * CANCUN CMH map structure
    254 */
    255 typedef struct soc_cancun_cmh_map_s {
    256     uint32 entry_size;          /* Entry size in word*/
    257     uint32 format;              /* CANCUN CMH format */
    258     uint32 src_mem;             /* Source memory or register enumeration */
    259     uint32 src_field;           /* Source field enumeration */
    260     int src_app;                /* Source application enumeration */
    261     uint32 src_value_num;       /* Number of valid values */
    262     uint32 dest_mem_num;        /* Number of destination memories or registers */
    263     uint32 dest_map_entry;      /* Entry point for destination mapping */
    264 } soc_cancun_cmh_map_t;
    265 
    266 /*
    267  * CANCUN CMH control structure
    268  * Contains information of currently loaded CMH files.
    269  */
    270 typedef struct soc_cancun_cmh_s {
    271     uint32 status;                  /* Loading status*/
    272     uint32 version;                 /* Loaded version */
    273     uint32 sdk_version;             /* Built SDK version */
    274     soc_cancun_file_t file;         /* CMH file entry */
    275     uint32* cmh_table;              /* Entry of CMH hash table */
    276     uint32* cmh_list;               /* Entry of CMH list of mem/field */
    277 } soc_cancun_cmh_t;
    278 
    279 #define SOC_CANCUN_CMH_LIST_ENTRY_SIZE          (3)
    280 #define SOC_CANCUN_CMH_LIST_ENTRY_OFFSET_MEM    (0)
    281 #define SOC_CANCUN_CMH_LIST_ENTRY_OFFSET_FIELD  (1)
    282 #define SOC_CANCUN_CMH_LIST_ENTRY_OFFSET_APP    (2)
    283 
    284 
    285 #define SOC_CANCUN_PSEUDO_REGS_NUM_V0          (60)
    286 #define SOC_CANCUN_PSEUDO_REGS_BLOCK_BYTE_SIZE_V0  \
    287                                             (0x100 * SOC_CANCUN_PSEUDO_REGS_NUM_V0)
    288 #define SOC_CANCUN_PSEUDO_REGS_NUM          (60 + 100)
    289 #define SOC_CANCUN_PSEUDO_REGS_BLOCK_BYTE_SIZE  \
    290                                             (0x100 * SOC_CANCUN_PSEUDO_REGS_NUM)
    291 
    292 
    293 /*
    294  * CANCUN CCH map structure
    295 */
    296 typedef struct soc_cancun_cch_map_s {
    297     uint32 entry_size;          /* Entry size in word*/
    298     uint32 format;              /* CANCUN CCH format */
    299     uint32 src_mem;             /* Source memory or register enumeration */
    300     uint32 src_field;           /* Source field enumeration */
    301     int src_app;                /* Source application enumeration */
    302     uint32 src_value_num;       /* Number of valid values */
    303     uint32 dest_mem_num;        /* Number of destination memories or registers */
    304     uint32 dest_map_entry;      /* Entry point for destination mapping */
    305 } soc_cancun_cch_map_t;
    306 
    307 /*
    308  * CANCUN CCH control structure
    309  * Contains information of currently loaded CMH files.
    310  */
    311 typedef struct soc_cancun_cch_s {
    312     uint32 status;                  /* Loading status*/
    313     uint32 version;                 /* Loaded version */
    314     uint32 sdk_version;             /* Built SDK version */
    315     soc_cancun_file_t file;         /* CCH file entry */
    316     uint32* cch_table;              /* Entry of CCH hash table */
    317     uint64* pseudo_regs;            /* Pseudo registers in CCHBLK */
    318 } soc_cancun_cch_t;
    319 
    320 /*
    321  * CANCUN CEH control structure
    322  * Contains information of currently loaded CEH files.
    323  */
    324 typedef struct soc_cancun_ceh_s {
    325     uint32 status;                  /* Loading status*/
    326     uint32 version;                 /* Loaded version */
    327     uint32 sdk_version;             /* Built SDK version */
    328     soc_cancun_file_t file;         /* CEH file entry */
    329     uint32* ceh_table;              /* Entry of CEH hash table */
    330 } soc_cancun_ceh_t;
    331 
    332 typedef struct soc_cancun_ceh_object_s {
    333     uint32 name_addr;
    334     uint32 width;
    335     uint32 num_fields;
    336 } soc_cancun_ceh_object_t;
    337 typedef struct soc_cancun_ceh_field_s {
    338     uint32 name_addr;
    339     uint32 offset;
    340     uint32 width;
    341     uint32 value;
    342 } soc_cancun_ceh_field_t;
    343 typedef struct soc_cancun_ceh_field_info_s {
    344     uint32 offset;
    345     uint32 width;
    346     uint32 value;
    347     uint32 flags;
    348 } soc_cancun_ceh_field_info_t;
    349 
    350 #define SOC_CANCUN_CEH_BLOCK_HASH_HEADER_LEN  9
    351 
    352 /* point to the hash header table used by hash function*/
    353 #define SOC_CANCUN_CEH_HASH_HDR_TBL(_p) \
    354         ((soc_cancun_hash_table_t *)((uint32 *)(_p) + 3))
    355 
    356 /* point the string name table */
    357 #define SOC_CANCUN_CEH_STR_NAME_TBL(_p) \
    358         (&SOC_CANCUN_CEH_HASH_HDR_TBL(_p)->table_entry)
    359 
    360 /* start of object hash entry location table. Index is hash key */
    361 #define SOC_CANCUN_CEH_OBJ_ENTRY_LOC_TBL(_p) ((uint32 *) \
    362         (&(SOC_CANCUN_CEH_HASH_HDR_TBL(_p)->table_entry)) \
    363          + ((SOC_CANCUN_CEH_HASH_HDR_TBL(_p)->table_entry) / 4))
    364 
    365 /* start of object hash entry table. Each is pointed by entry location table */
    366 #define SOC_CANCUN_CEH_OBJ_ENTRY_TBL(_p) \
    367         (SOC_CANCUN_CEH_OBJ_ENTRY_LOC_TBL(_p) + \
    368         (SOC_CANCUN_CEH_HASH_HDR_TBL(_p)->pd))
    369 
    370 /*
    371  * CANCUN control structure
    372  * Contains information of currently loaded CANCUN files.
    373  */
    374 typedef struct soc_cancun_s {
    375     uint32 unit;                /* Unit ID*/
    376     uint32 flags;               /* Control flags */
    377     uint32 version;             /* Packge release version */
    378     char default_path[CANCUN_FILENAME_SIZE]; /* default path */
    379     soc_cancun_cih_t* cih;      /* CIH control structure*/
    380     soc_cancun_cmh_t* cmh;      /* CMH control structure*/
    381     soc_cancun_cch_t* cch;      /* CCH control structure*/
    382     soc_flow_db_t*  flow_db;    /* FLOW DB control structure*/
    383     soc_cancun_ceh_t* ceh;      /* CEH control structure*/
    384 } soc_cancun_t;
    385 
    386 /*
    387  * CANCUN control flags
    388 */
    389 /* Status flags */
    390 #define SOC_CANCUN_FLAG_INITIALIZED         0x00000001
    391 #define SOC_CANCUN_FLAG_CIH_LOADED          0x00000002
    392 #define SOC_CANCUN_FLAG_CMH_LOADED          0x00000004
    393 #define SOC_CANCUN_FLAG_CCH_LOADED          0x00000008
    394 #define SOC_CANCUN_FLAG_CFH_LOADED          0x00000010
    395 #define SOC_CANCUN_FLAG_CEH_LOADED          0x00000020
    396 
    397 #define SOC_CANCUN_FLAG_VERSIONS_MATCH      0x00000100
    398 /* Control flags */
    399 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_CIH    0x00010000
    400 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_CMH    0x00020000
    401 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_CCH    0x00040000
    402 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_CFH    0x00080000
    403 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_CEH    0x00100000
    404 
    405 
    406 #define SOC_CANCUN_FLAG_DEBUG_MODE          0x01000000
    407 #define SOC_CANCUN_FLAG_SKIP_VALIDITY       0x02000000
    408 #define SOC_CANCUN_FLAG_SKIP_VERSION_MATCH  0x04000000
    409 #define SOC_CANCUN_FLAG_LOAD_DEFAULT_ALL    (SOC_CANCUN_FLAG_LOAD_DEFAULT_CIH |\
    410                                              SOC_CANCUN_FLAG_LOAD_DEFAULT_CMH |\
    411                                              SOC_CANCUN_FLAG_LOAD_DEFAULT_CCH)
    412 
    413 /*
    414  * CANCUN loading status
    415 */
    416 #define SOC_CANCUN_LOAD_STATUS_NOT_LOADED   0x00000000
    417 #define SOC_CANCUN_LOAD_STATUS_LOADED       0x00000001
    418 #define SOC_CANCUN_LOAD_STATUS_IN_PROGRESS  0x00000002
    419 #define SOC_CANCUN_LOAD_STATUS_FAILED       0x00000003
    420 
    421 /*
    422  * CANCUN control flags from SOC property
    423 */
    424 #define SOC_PROPERTY_CANCUN_LOAD_SKIP_CIH   0x00000001
    425 #define SOC_PROPERTY_CANCUN_LOAD_SKIP_CMH   0x00000002
    426 #define SOC_PROPERTY_CANCUN_LOAD_SKIP_CCH   0x00000004
    427 #define SOC_PROPERTY_CANCUN_LOAD_SKIP_CFH   0x00000008
    428 #define SOC_PROPERTY_CANCUN_LOAD_SKIP_CEH   0x00000010
    429 
    430 #define SOC_PROPERTY_CANCUN_DEBUG_MODE      0x00000001
    431 #define SOC_PROPERTY_CANCUN_FILE_VALIDITY   0x00000002
    432 #define SOC_PROPERTY_CANCUN_VER_MATCH       0x00000004
    433 
    434 /*
    435  * CANCUN File identifiers
    436  */
    437 #define SOC_CANCUN_FILE_ID                  0x434E4355
    438 #define SOC_CANCUN_FILE_ID_CIH              0x00434948
    439 #define SOC_CANCUN_FILE_ID_CMH              0x00434D48
    440 #define SOC_CANCUN_FILE_ID_CCH              0x00434348
    441 #define SOC_CANCUN_FILE_ID_CFH              0x00434648
    442 #define SOC_CANCUN_FILE_ID_CEH              0x00436548
    443 
    444 /*
    445  * CANCUN File Header & Data Blob Size in Bytes
    446  */
    447 #define SOC_CANCUN_FILE_HEADER_OFFSET       (32)
    448 #define SOC_CANCUN_CIH_LENGTH_OFFSET        (8)
    449 #define SOC_CANCUN_CIH_FLAG_OFFSET          (12)
    450 #define SOC_CANCUN_CIH_PIO_DATA_BLOB_SIZE   (24)
    451 
    452 /*
    453  * CANCUN package file blob field offset
    454  */
    455 #define SOC_CANCUN_BLOB_ADDR_OFFSET     (0)
    456 #define SOC_CANCUN_BLOB_OPCODE_OFFSET   (1)
    457 #define SOC_CANCUN_BLOB_LEN_OFFSET      (2)
    458 #define SOC_CANCUN_BLOB_FLAGS_OFFSET    (3)
    459 #define SOC_CANCUN_BLOB_DATA_OFFSET     (4)
    460 
    461 /*
    462  * CANCUN package file blob flags
    463  */
    464 #define SOC_CANCUN_BLOB_FLAG_TCAM           0x00000008
    465 #define SOC_CANCUN_BLOB_FLAG_MEM_ID_PRESENT (0x00000010)
    466 
    467 #define SOC_CANCUN_BLOB_ADDR_MEM_ID_SHIFT    (17)
    468 #define SOC_CANCUN_BLOB_ADDR_MEM_IDX_MASK    (0x1FFFF)
    469 
    470 #define SOC_CANCUN_BLOB_FORMAT_MASK   (0x7)
    471 #define SOC_CANCUN_BLOB_FORMAT_PIO    (0x0)
    472 #define SOC_CANCUN_BLOB_FORMAT_DMA    (0x1)
    473 #define SOC_CANCUN_BLOB_FORMAT_FIFO   (0x2)
    474 #define SOC_CANCUN_BLOB_FORMAT_RSVD   (0x3)
    475 
    476 /*
    477  * CCH pseudo register flags
    478  */
    479 #define SOC_CANCUN_PSEUDO_REGS_FLAGS_VALID_READ (0x0001)
    480 
    481 /*
    482  * Enumeration types used in CANCUN
    483  */
    484 #define SOC_CANCUN_ENUM_TYPE_UNKNOWN    (0x0000)
    485 #define SOC_CANCUN_ENUM_TYPE_APP        (0x0001)
    486 #define SOC_CANCUN_ENUM_TYPE_MEM        (0x0002)
    487 #define SOC_CANCUN_ENUM_TYPE_REG        (0x0003)
    488 #define SOC_CANCUN_ENUM_TYPE_MEM_FIELD  (0x0004)
    489 #define SOC_CANCUN_ENUM_TYPE_REG_FIELD  (0x0005)
    490 
    491 /*
    492  * Register enumeration flag
    493  */
    494 #define SOC_CANCUN_FLAG_REG_ENUM            0x40000000
    495 
    496 /*
    497  * Misc. defines
    498  */
    499 #define SOC_CANCUN_FIELD_LISTf          (-2)
    500 
    501 #define SOC_CANCUN_VERSION_DEF_5_1_8        0x01050108
    502 #define SOC_CANCUN_VERSION_DEF_5_2_1        0x01050201
    503 #define SOC_CANCUN_VERSION_DEF_5_2_2        0x01050202
    504 #define SOC_CANCUN_VERSION_DEF_5_2_3        0x01050203
    505 #define SOC_CANCUN_VERSION_DEF_5_3_0        0x01050300
    506 #define SOC_CANCUN_VERSION_DEF_5_3_2        0x01050302
    507 #define SOC_CANCUN_VERSION_DEF_6_0_0        0x01060000
    508 #define SOC_CANCUN_VERSION_DEF_6_1_3        0x01060103
    509 #define SOC_CANCUN_VERSION_DEF_3_0_0        0x01030000
    510 #define SOC_CANCUN_VERSION_DEF_4_0_0        0x01040000
    511 #define SOC_CANCUN_VERSION_DEF_4_1_2        0x01040102
    512 #define SOC_CANCUN_VERSION(_m,_mn,_s) (((_m) << 16) | ((_mn) << 8) | \
    513 			(_s) | (1 << 24))
    514 #define SOC_CANCUN_VERSION_5_2_UNDER_SERIES(_ver) \
    515         ((_ver) <= SOC_CANCUN_VERSION(5,1,0xff))
    516 
    517 typedef struct soc_cancun_udf_stage_info_s {
    518     uint32 size;
    519     soc_mem_t policy_mem;
    520     uint32 start_pos;
    521     uint32 unavail_contbmap;
    522     uint32 flags;
    523     uint32 hfe_prof_ptr_arr_len;
    524     uint32 *hfe_profile_ptr;
    525 } soc_cancun_udf_stage_info_t;
    526 
    527 
    528 /*
    529  * CANCUN public API prototypes
    530  */
    531 int soc_cancun_init(uint32 unit);
    532 void soc_cancun_deinit(uint32 unit);
    533 int soc_cancun_info_get(uint32 unit, soc_cancun_t** cc);
    534 int soc_cancun_status_get(uint32 unit, soc_cancun_t** cc);
    535 int soc_cancun_file_info_get(int unit, soc_cancun_file_t* ccf, char *filename,
    536                              uint8 *buf, long buf_bytes);
    537 int soc_cancun_file_load(int unit, uint8* buf, long nBytes, uint32* type,
    538                          uint32* format);
    539 int soc_cancun_cmh_list (int unit, uint32** cmh_list);
    540 int soc_cancun_cmh_check (int unit, soc_mem_t mem, soc_field_t field);
    541 int soc_cancun_cmh_mem_set (int unit, soc_mem_t mem, int index,
    542                             soc_field_t field, uint32 input);
    543 int soc_cancun_cmh_mem_get (int unit, soc_mem_t mem, int index,
    544                             soc_field_t field, uint32* value);
    545 int soc_cancun_cch_list (int unit, uint32* buf, uint32 buf_len);
    546 int soc_cancun_cch_reg_set(int unit, soc_reg_t reg, int index, uint64 data);
    547 int soc_cancun_pseudo_reg_set(int unit, soc_reg_t reg, uint64 data);
    548 int soc_cancun_pseudo_reg_get(int unit, soc_reg_t reg, uint64 *data);
    549 int soc_cancun_app_dest_entry_get (int unit, soc_mem_t mem, int index,
    550                                    soc_field_t field, int app,
    551                                    soc_cancun_dest_entry_t *dest_entry);
    552 int soc_cancun_app_dest_entry_set (int unit, soc_mem_t mem, int index,
    553                                    soc_field_t field, int app, uint32 input);
    554 int _soc_cancun_load_status_clear(int unit, soc_cancun_file_type_e file_type);
    555 int soc_cancun_access_scan(int unit, soc_cancun_file_type_e file_type);
    556 uint32 soc_cancun_crc32(uint32 crc, uint8 *buf, int len_bytes);
    557 int soc_cancun_ceh_obj_field_get (int unit, char *obj_name, char *field_name,
    558                                       soc_cancun_ceh_field_info_t *info);
    559 int soc_cancun_ceh_obj_field_id_list_get (int unit, char *obj_name,
    560                                       int *size, uint32 *field_id_arr);
    561 int soc_cancun_ceh_obj_field_id_get (int unit, char *field_name,
    562                                      uint32 *field_id);
    563 int soc_cancun_ceh_obj_field_name_get (int unit, uint32 field_id,
    564                                       int *size, char *field_name);
    565 #ifdef BCM_WARM_BOOT_SUPPORT
    566 extern int soc_cancun_scache_alloc(int unit);
    567 extern int soc_cancun_scache_sync(int unit);
    568 extern int soc_cancun_scache_recovery(int unit);
    569 #endif
    570 
    571 extern int soc_cancun_generic_load(int unit, uint32 cancun_type);
    572 extern int soc_cancun_cch_app_set (int unit, uint32 src_app, uint64 data);
    573 extern int soc_cancun_branch_id_get(int unit, uint32 cancun_type,
    574     soc_cancun_file_branch_id_e *branch_id);
    575 extern int soc_cancun_udf_abstr_type_info_get(int unit,
    576         uint32 abstract_type, uint32 parser, uint32 max_stages, uint32 **hfe_prof_ptr_arr,
    577         soc_cancun_udf_stage_info_t *stage_info_arr, uint32 *actual_stage_num,
    578         uint32 *hfe_prof_ptr_arr_len);
    579 extern int soc_cancun_version_get(int unit, uint32* cancun_ver);
    580 extern int soc_cancun_revision_get(int unit, uint32* revision);
    581 
    582 #endif /* _CANCUN_H_ */