Print this page
9724 qede needs updates for newer GCC


  16 * fields enclosed by brackets "[]" replaced with your own identifying
  17 * information: Portions Copyright [yyyy] [name of copyright owner]
  18 *
  19 * CDDL HEADER END
  20 */
  21 
  22 /*
  23 * Copyright 2014-2017 Cavium, Inc. 
  24 * The contents of this file are subject to the terms of the Common Development 
  25 * and Distribution License, v.1,  (the "License").
  26 
  27 * You may not use this file except in compliance with the License.
  28 
  29 * You can obtain a copy of the License at available 
  30 * at http://opensource.org/licenses/CDDL-1.0
  31 
  32 * See the License for the specific language governing permissions and 
  33 * limitations under the License.
  34 */
  35 




  36 #include "bcm_osal.h"
  37 #include "ecore.h"
  38 #include "reg_addr.h"
  39 #include "ecore_hw.h"
  40 #include "ecore_hsi_common.h"
  41 #include "ecore_mcp.h"
  42 #include "nvm_cfg.h"
  43 #include "ecore_phy_api.h"
  44 
  45 #define SERDESID 0x900e
  46 
  47 
  48 enum _ecore_status_t ecore_phy_read(struct ecore_hwfn *p_hwfn,
  49                                     struct ecore_ptt *p_ptt, u32 port, u32 lane,
  50                                     u32 addr, u32 cmd, u8 *buf)
  51 {
  52         return ecore_mcp_phy_read(p_hwfn->p_dev, cmd,
  53                         addr | (lane << 16) | (1<<29) | (port << 30), buf, 8);
  54 }
  55 


 609                         }
 610                 } else {
 611                         OSAL_SPRINTF(p_phy_result_buf, "Failed reading stat 0x%x\n\n",
 612                                      addr); 
 613                 }
 614         }
 615 
 616         if (b_false_alarm)
 617                 length += OSAL_SPRINTF(&p_phy_result_buf[length],
 618                                        "Note: GRXFCS/GRXFRERR/GRXFRG may "
 619                                        "increment when the port shuts down\n");
 620 
 621         return rc;
 622 }
 623 
 624 /* get mac status */
 625 static int ecore_ah_e5_phy_mac_stat(struct ecore_hwfn *p_hwfn,
 626                                     struct ecore_ptt *p_ptt, u32 port,
 627                                     char *p_phy_result_buf)
 628 {
 629         u32 length, reg_id, addr, data_hi, data_lo;
 630 
 631         length = OSAL_SPRINTF(p_phy_result_buf,
 632                                "MAC stats for port %d (only non-zero)\n", port);
 633 
 634         for (reg_id = 0; reg_id < OSAL_ARRAY_SIZE(ah_stat_regs); reg_id++) {
 635                 addr = ah_stat_regs[reg_id].reg;
 636                 data_lo = ecore_rd(p_hwfn, p_ptt,
 637                                    NWM_REG_MAC0_K2_E5 +
 638                                    NWM_REG_MAC0_SIZE * 4 * port +
 639                                    addr);
 640                 data_hi = ecore_rd(p_hwfn, p_ptt,
 641                                    NWM_REG_MAC0_K2_E5 +
 642                                    NWM_REG_MAC0_SIZE * 4 * port +
 643                                    addr + 4);
 644 
 645                 if (data_lo) {  /* Only non-zero */
 646                         length += OSAL_SPRINTF(&p_phy_result_buf[length],
 647                                                "%-10s: 0x%08x (%s)\n",
 648                                                ah_stat_regs[reg_id].name,
 649                                                data_lo,




  16 * fields enclosed by brackets "[]" replaced with your own identifying
  17 * information: Portions Copyright [yyyy] [name of copyright owner]
  18 *
  19 * CDDL HEADER END
  20 */
  21 
  22 /*
  23 * Copyright 2014-2017 Cavium, Inc. 
  24 * The contents of this file are subject to the terms of the Common Development 
  25 * and Distribution License, v.1,  (the "License").
  26 
  27 * You may not use this file except in compliance with the License.
  28 
  29 * You can obtain a copy of the License at available 
  30 * at http://opensource.org/licenses/CDDL-1.0
  31 
  32 * See the License for the specific language governing permissions and 
  33 * limitations under the License.
  34 */
  35 
  36 /*
  37  * Copyright 2018 Joyent, Inc.
  38  */
  39 
  40 #include "bcm_osal.h"
  41 #include "ecore.h"
  42 #include "reg_addr.h"
  43 #include "ecore_hw.h"
  44 #include "ecore_hsi_common.h"
  45 #include "ecore_mcp.h"
  46 #include "nvm_cfg.h"
  47 #include "ecore_phy_api.h"
  48 
  49 #define SERDESID 0x900e
  50 
  51 
  52 enum _ecore_status_t ecore_phy_read(struct ecore_hwfn *p_hwfn,
  53                                     struct ecore_ptt *p_ptt, u32 port, u32 lane,
  54                                     u32 addr, u32 cmd, u8 *buf)
  55 {
  56         return ecore_mcp_phy_read(p_hwfn->p_dev, cmd,
  57                         addr | (lane << 16) | (1<<29) | (port << 30), buf, 8);
  58 }
  59 


 613                         }
 614                 } else {
 615                         OSAL_SPRINTF(p_phy_result_buf, "Failed reading stat 0x%x\n\n",
 616                                      addr); 
 617                 }
 618         }
 619 
 620         if (b_false_alarm)
 621                 length += OSAL_SPRINTF(&p_phy_result_buf[length],
 622                                        "Note: GRXFCS/GRXFRERR/GRXFRG may "
 623                                        "increment when the port shuts down\n");
 624 
 625         return rc;
 626 }
 627 
 628 /* get mac status */
 629 static int ecore_ah_e5_phy_mac_stat(struct ecore_hwfn *p_hwfn,
 630                                     struct ecore_ptt *p_ptt, u32 port,
 631                                     char *p_phy_result_buf)
 632 {
 633         u32 length, reg_id, addr, data_hi __unused, data_lo;
 634 
 635         length = OSAL_SPRINTF(p_phy_result_buf,
 636                                "MAC stats for port %d (only non-zero)\n", port);
 637 
 638         for (reg_id = 0; reg_id < OSAL_ARRAY_SIZE(ah_stat_regs); reg_id++) {
 639                 addr = ah_stat_regs[reg_id].reg;
 640                 data_lo = ecore_rd(p_hwfn, p_ptt,
 641                                    NWM_REG_MAC0_K2_E5 +
 642                                    NWM_REG_MAC0_SIZE * 4 * port +
 643                                    addr);
 644                 data_hi = ecore_rd(p_hwfn, p_ptt,
 645                                    NWM_REG_MAC0_K2_E5 +
 646                                    NWM_REG_MAC0_SIZE * 4 * port +
 647                                    addr + 4);
 648 
 649                 if (data_lo) {  /* Only non-zero */
 650                         length += OSAL_SPRINTF(&p_phy_result_buf[length],
 651                                                "%-10s: 0x%08x (%s)\n",
 652                                                ah_stat_regs[reg_id].name,
 653                                                data_lo,