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

dnxc_ha.h (2645B)


      1 /** \file dnxc_ha.h
      2  * General HA routines.
      3  */
      4 /*
      5  * 
      6  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      7  * 
      8  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      9  */
     10 
     11 #ifndef _DNXC_HA_H
     12 /* { */
     13 #define _DNXC_HA_H
     14 
     15 /*
     16  * Include files
     17  * {
     18  */
     19 
     20 #include <soc/types.h>
     21 #include <sal/core/alloc.h>
     22 #include <soc/error.h>
     23 #include <assert.h>
     24 #include <sal/core/thread.h>
     25 
     26 /*
     27  * }
     28  */
     29 
     30 /*
     31  * types
     32  * {
     33  */
     34 
     35 /* If you add entries to this enum you will need to update .c file with some strings
     36    representing the access name and mutex name */
     37 typedef enum
     38 {
     39     DNXC_HA_ALLOW_DBAL = 0,
     40     DNXC_HA_ALLOW_SW_STATE,
     41     DNXC_HA_ALLOW_SCHAN,
     42     DNXC_HA_ALLOW_NOF
     43 } dnxc_ha_allow_access_e;
     44 
     45 /*
     46  * }
     47  */
     48 
     49 /*
     50  * MACROs
     51  * {
     52  */
     53 
     54 /*
     55  * }
     56  */
     57 
     58 /**
     59  * \brief
     60  *  Init HA utilities module
     61  * \param [in] unit    - Device Id
     62  * \return
     63  *   int - Error Type
     64  * \remark
     65  *   * None
     66  * \see
     67  *   * None
     68  */
     69 int dnxc_ha_init(
     70     int unit);
     71 
     72 /**
     73  * \brief
     74  *  Deinit HA utilities module
     75  * \param [in] unit    - Device Id
     76  * \return
     77  *   int - Error Type
     78  * \remark
     79  *   * None
     80  * \see
     81  *   * None
     82  */
     83 int dnxc_ha_deinit(
     84     int unit);
     85 
     86 /**
     87  * \brief
     88  *  Change status if appl is currently deinitializing.
     89  *  Used for sanity checking.
     90  * \param [in] unit    - Device Id
     91  * \param [in] is_start    - Indicates if beginning or end of region
     92  * \return
     93  *   int - Error Type
     94  * \remark
     95  *   * None
     96  * \see
     97  *   * None
     98  */
     99 int dnxc_ha_appl_deinit_state_change(
    100     int unit,
    101     uint8 is_start);
    102 
    103 /**
    104  * \brief
    105  *  Query if HW access is disabled
    106  * \param [in] unit    - Device Id 
    107  * \param [in] access_type - Access Type
    108  * \return
    109  *   int - TRUE if disabled FALSE if enabled.
    110  * \remark
    111  *   * None
    112  * \see
    113  *   * None
    114  */
    115 int dnxc_ha_is_access_disabled(
    116     int unit,
    117     dnxc_ha_allow_access_e access_type);
    118 
    119 /**
    120  * \brief
    121  *  Temporarily allow HW writes for current thread even if it's
    122  *  generally disabled
    123  * \param [in] unit    - Device Id 
    124  * \param [in] access_type - Access Type
    125  * \return
    126  *   int - Error ID.
    127  * \remark
    128  *   * None
    129  * \see
    130  *   * None
    131  */
    132 int dnxc_ha_tmp_allow_access_enable(
    133     int unit,
    134     dnxc_ha_allow_access_e access_type);
    135 
    136 /**
    137  * \brief
    138  *  disallow HW writes for current thread, to be used tho revert
    139  *  dnxc_allow_hw_write_enable after done writing
    140  * \param [in] unit    - Device Id
    141  * \param [in] access_type - Access Type
    142  * \return
    143  *   int - Error ID.
    144  * \remark
    145  *   * None
    146  * \see
    147  *   * None
    148  */
    149 int dnxc_ha_tmp_allow_access_disable(
    150     int unit,
    151     dnxc_ha_allow_access_e access_type);
    152 
    153 /* } */
    154 #endif /* _DNXC_HA_H */