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

schanmsg_internal.h (5103B)


      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  * Internal S-Channel Message: data structure.
      8  */
      9 
     10 #ifndef _SOC_SCHAN_INTERNAL_H
     11 #define _SOC_SCHAN_INTERNAL_H
     12 
     13 #include <soc/schanmsg.h>
     14 #include <soc/types.h>
     15 #include <soc/drv.h>
     16 
     17 
     18 /* This is fields from SOC_CONTROL which will be passed to level schan
     19  *  module to the lower level so that structure dependency can be removed
     20  */
     21 typedef struct soc_cmic_schan_control_s {
     22     int *schanTimeout;          /* Address SOC_CONTROL(unit)->schanTimeout */
     23     int *schanIntrEnb;          /* SOC_CONTROL(unit)->schanIntrEnb */
     24                                 /* Address of SOC_CONTROL(unit)->schan_result */
     25     uint32      *schan_result[SOC_CMCS_NUM_MAX+1];
     26                                 /* SOC_CONTROL(unit)->schanIntr */
     27     sal_sem_t   *schanIntr[SOC_CMCS_NUM_MAX+1];
     28 } soc_cmic_schan_control_t;
     29 
     30 typedef struct soc_cmic_schan_drv_s {
     31     int (*soc_schan_op)(int unit, schan_msg_t *msg,
     32                        int dwc_write, int dwc_read, int intr);
     33     int (*soc_schan_deinit)(int unit);
     34     void (*soc_schan_reset)(int unit, int cmc, int ch);
     35 } soc_cmic_schan_drv_t;
     36 
     37 extern soc_cmic_schan_control_t  soc_schan_control[SOC_MAX_NUM_DEVICES];
     38 
     39 #define SOC_SCHAN_CONTROL(unit)               (soc_schan_control[unit])
     40 
     41 #define CMIC_CMCx_SCHAN_CHSELECT_TIMEOUT    (1000)
     42 
     43 #if defined(BCM_CMICM_SUPPORT) || defined(BCM_CMICDV2_SUPPORT)
     44 #define SCHAN_CH_MASK 0x1111
     45 #endif
     46 
     47 
     48 
     49 /*******************************************
     50 * @function soc_cmice_schan_init
     51 * purpose API to Initialize nocmic SCHAN
     52 *
     53 * @param unit [in] unit
     54 * @param drv [out] soc_cmic_schan_drv_t pointer
     55 *
     56 * @returns SOC_E_NONE
     57 * @returns SOC_E_XXX
     58 *
     59 * @end
     60 * @comments used for cmic which are neither cmicm or cmicx
     61  */
     62 extern int soc_cmice_schan_init(int unit, soc_cmic_schan_drv_t *drv);
     63 
     64 /*******************************************
     65 * @function soc_schan_cmicm_init
     66 * purpose API to Initialize cmicm SCHAN
     67 *
     68 * @param unit [in] unit
     69 * @param drv [out] soc_cmic_schan_drv_t pointer
     70 *
     71 * @returns SOC_E_NONE
     72 * @returns SOC_E_XXX
     73 *
     74 * @end
     75  */
     76 extern int soc_cmicm_schan_init(int unit, soc_cmic_schan_drv_t *drv);
     77 
     78 /*******************************************
     79 * @function cmicm_schan_ch_get
     80 * purpose get idle schan on cmc
     81 *
     82 * @param unit [in] unit #
     83 * @param cmc [out] cmc number 0-2 or 3 for common
     84 *
     85 * @returns SOC_E_BUSY
     86 * @returns SOC_E_NONE
     87 *
     88 * @end
     89  */
     90 extern int cmicm_schan_ch_get(int unit, int *cmc);
     91 
     92 /*******************************************
     93 * @function cmicm_schan_ch_try_get
     94 * purpose get idle channel on cmc
     95 *
     96 * @param unit [in] unit #
     97 * @param cmc [in] cmc number 0-2 or 3 for common
     98 *
     99 * @returns SOC_E_BUSY
    100 * @returns SOC_E_NONE
    101 *
    102 * @end
    103  */
    104 extern int cmicm_schan_ch_try_get(int unit, int cmc);
    105 
    106 /*******************************************
    107 * @function cmicm_schan_ch_put
    108 * purpose put back the freed channel on cmc
    109 *
    110 * @param cmc [in] cmc number 0-2 or 3 for common
    111 *
    112 * @returns SOC_E_PARAM
    113 * @returns SOC_E_NONE
    114 *
    115 * @end
    116  */
    117 extern int cmicm_schan_ch_put(int unit, int cmc);
    118 
    119 /*******************************************
    120 * @function cmicm_schan_ch_init
    121 * purpose API to Initialize schan channel seletion mechanism
    122 *
    123 * @param unit [in] unit
    124 *
    125 * @returns SOC_E_NONE
    126 * @returns SOC_E_XXX
    127 *
    128 * @end
    129  */
    130 extern int cmicm_schan_ch_init(int unit, int timeout);
    131 
    132 /*******************************************
    133 * @function soc_cmicx_schan_init
    134 * purpose API to Initialize cmicx SCHAN
    135 *
    136 * @param unit [in] unit
    137 * @param drv [out] soc_cmic_schan_drv_t pointer
    138 *
    139 * @returns SOC_E_NONE
    140 * @returns SOC_E_XXX
    141 *
    142 * @end
    143  */
    144 extern int soc_cmicx_schan_init(int unit, soc_cmic_schan_drv_t *drv);
    145 
    146 /*******************************************
    147 * @function _soc_schan_op_sanity_check
    148 * purpose API to Initialize perform sanity checks
    149 *
    150 * @param unit [in] unit
    151 * @param msg [in] pointer to Type <schan_msg_t>
    152 * @param dwc_write [in] write
    153 * @param dwc_read [in] read
    154 * @param dwc_read [out] pointer to status
    155 *
    156 * @returns TRUE if the caller should abort the call and return *rv up the stack.
    157 * @returns FALSE if the caller should continue as normal.
    158 *
    159 * @comments First, check that writing is allowed:
    160 *    If (device is ARAD) and (opcode is not a READ command) and (override flag is off)
    161 *    Then: writing is not allowed.
    162 *
    163 * Then, assert sanity checks.
    164 * Finally, log the message that schan access is beginning
    165 *
    166 * @end
    167  */
    168 extern int
    169 soc_schan_op_sanity_check(int unit, schan_msg_t *msg, int dwc_write,
    170                            int dwc_read, int *rv);
    171 
    172 /*******************************************
    173 * @function soc_schan_timeout_check
    174 * @Purpose enable special processing for timeout
    175 *
    176 * @param unit [in] unit
    177 * @param dwc_read [out] pointer to status
    178 * @param msg [in] pointer to Type <schan_msg_t>
    179 * @param cmc [in] cmc
    180 * @param ch [in] channel
    181 *
    182 * @returns SOC_E_NONE
    183 * @returns SOC_E_XXX
    184 *
    185 * @end
    186  */
    187 extern int
    188 soc_schan_timeout_check(int unit, int *rv, schan_msg_t *msg, int cmc, int ch);
    189 
    190 #endif  /* !_SOC_SCHAN_INTERNAL_H */