LCOV - code coverage report
Current view: top level - drivers/net/atlantic - atl_hw_regs.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 18 0.0 %
Date: 2025-03-01 20:23:48 Functions: 0 5 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 6 0.0 %

           Branch data     Line data    Source code
       1                 :            : // SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
       2                 :            : /* Copyright (C) 2014-2017 aQuantia Corporation. */
       3                 :            : 
       4                 :            : /* File aq_hw_utils.c: Definitions of helper functions used across
       5                 :            :  * hardware layer.
       6                 :            :  */
       7                 :            : 
       8                 :            : #include "atl_hw_regs.h"
       9                 :            : 
      10                 :            : #include <rte_io.h>
      11                 :            : #include <rte_byteorder.h>
      12                 :            : 
      13                 :          0 : void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
      14                 :            :                          u32 shift, u32 val)
      15                 :            : {
      16         [ #  # ]:          0 :         if (msk ^ ~0) {
      17                 :            :                 u32 reg_old, reg_new;
      18                 :            : 
      19                 :          0 :                 reg_old = aq_hw_read_reg(aq_hw, addr);
      20                 :          0 :                 reg_new = (reg_old & (~msk)) | (val << shift);
      21                 :            : 
      22         [ #  # ]:          0 :                 if (reg_old != reg_new)
      23                 :          0 :                         aq_hw_write_reg(aq_hw, addr, reg_new);
      24                 :            :         } else {
      25                 :          0 :                 aq_hw_write_reg(aq_hw, addr, val);
      26                 :            :         }
      27                 :          0 : }
      28                 :            : 
      29                 :          0 : u32 aq_hw_read_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk, u32 shift)
      30                 :            : {
      31                 :          0 :         return ((aq_hw_read_reg(aq_hw, addr) & msk) >> shift);
      32                 :            : }
      33                 :            : 
      34                 :          0 : u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg)
      35                 :            : {
      36                 :          0 :         return rte_le_to_cpu_32(rte_read32((u8 *)hw->mmio + reg));
      37                 :            : }
      38                 :            : 
      39                 :          0 : void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value)
      40                 :            : {
      41                 :          0 :         rte_write32((rte_cpu_to_le_32(value)), (u8 *)hw->mmio + reg);
      42                 :          0 : }
      43                 :            : 
      44                 :          0 : int aq_hw_err_from_flags(struct aq_hw_s *hw)
      45                 :            : {
      46                 :            :         int err = 0;
      47                 :            : 
      48         [ #  # ]:          0 :         if (aq_hw_read_reg(hw, 0x10U) == ~0U)
      49                 :          0 :                 return -ENXIO;
      50                 :            : 
      51                 :            :         return err;
      52                 :            : }

Generated by: LCOV version 1.14