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

pm4x10td.c (2278B)


      1 /*
      2  *
      3  * 
      4  * 
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      8  */
      9 
     10 #include <soc/types.h>
     11 #include <soc/error.h>
     12 #include <soc/drv.h>
     13 #include <soc/wb_engine.h>
     14 #include <soc/portmod/portmod_internal.h>
     15 #include <soc/portmod/portmod.h>
     16 #include <soc/portmod/portmod_dispatch.h>
     17 #include <soc/portmod/portmod_chain.h>
     18 #include <soc/portmod/portmod_common.h>
     19 #include <soc/mcm/memregs.h>
     20 
     21 #ifdef _ERR_MSG_MODULE_NAME 
     22 #error "_ERR_MSG_MODULE_NAME redefined" 
     23 #endif
     24 #define _ERR_MSG_MODULE_NAME BSL_LS_SOC_PORT
     25 
     26 #ifdef PORTMOD_PM4X10TD_SUPPORT
     27 
     28 #include <soc/portmod/xlmac.h>
     29 #include <soc/portmod/pm4x10.h>
     30 
     31 int pm4x10td_port_cntmaxsize_get(int unit, int port, pm_info_t pm_info, int *val)
     32 {
     33     return (READ_PGW_CNTMAXSIZEr(unit, port, (uint32_t *)val));
     34 }
     35 
     36 int pm4x10td_port_cntmaxsize_set(int unit, int port, pm_info_t pm_info, int val)
     37 {
     38     int rv = 0;
     39     uint32 reg_val;
     40 
     41     rv = READ_PGW_CNTMAXSIZEr(unit, port, &reg_val);
     42     if (rv) return (rv);
     43 
     44     soc_reg_field_set(unit, PGW_CNTMAXSIZEr, &reg_val, CNTMAXSIZEf, val);
     45 
     46     return(WRITE_PGW_CNTMAXSIZEr(unit, port, reg_val));
     47 }
     48 
     49 int pm4x10td_port_mac_rsv_mask_set(int unit, int port, pm_info_t pm_info, uint32 rsv_mask)
     50 {
     51         return(WRITE_PGW_MAC_RSV_MASKr(unit, port, rsv_mask));
     52 }
     53 
     54 int pm4x10td_port_mib_reset_toggle(int unit, int port, pm_info_t pm_info, int port_index)
     55 {
     56     /* PGW_MIB_RESET needs to be controlled in portctrl layer
     57        Do nothing in Portmod */
     58     return 0;
     59 }
     60 
     61 int pm4x10td_port_pfc_config_set (int unit, int port,pm_info_t pm_info,
     62                            const portmod_pfc_config_t* pfc_cfg)
     63 {
     64     SOC_INIT_FUNC_DEFS;
     65 
     66     if (pfc_cfg->classes != 8) {
     67         return SOC_E_PARAM;
     68     }
     69     _SOC_IF_ERR_EXIT(xlmac_pfc_config_set(unit, port, pfc_cfg));
     70 exit:
     71     SOC_FUNC_RETURN;
     72 }
     73 
     74 int pm4x10td_port_pfc_config_get (int unit, int port,pm_info_t pm_info,
     75                                 portmod_pfc_config_t* pfc_cfg)
     76 {
     77     SOC_INIT_FUNC_DEFS;
     78 
     79     pfc_cfg->classes = 8;
     80     _SOC_IF_ERR_EXIT(xlmac_pfc_config_get(unit, port, pfc_cfg));
     81 
     82 exit:
     83     SOC_FUNC_RETURN;
     84 }
     85 
     86 #endif /* PORTMOD_PM4X10TD_SUPPORT */
     87 
     88 #undef _ERR_MSG_MODULE_NAME