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: 2026-04-01 20:02:27 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                 :            : 
       5                 :            : /* File aq_hw_utils.c: Definitions of helper functions used across
       6                 :            :  * hardware layer.
       7                 :            :  */
       8                 :            : 
       9                 :            : #include "atl_hw_regs.h"
      10                 :            : 
      11                 :            : #include <rte_io.h>
      12                 :            : #include <rte_byteorder.h>
      13                 :            : 
      14                 :          0 : void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
      15                 :            :                          u32 shift, u32 val)
      16                 :            : {
      17         [ #  # ]:          0 :         if (msk ^ ~0) {
      18                 :            :                 u32 reg_old, reg_new;
      19                 :            : 
      20                 :          0 :                 reg_old = aq_hw_read_reg(aq_hw, addr);
      21                 :          0 :                 reg_new = (reg_old & (~msk)) | (val << shift);
      22                 :            : 
      23         [ #  # ]:          0 :                 if (reg_old != reg_new)
      24                 :          0 :                         aq_hw_write_reg(aq_hw, addr, reg_new);
      25                 :            :         } else {
      26                 :          0 :                 aq_hw_write_reg(aq_hw, addr, val);
      27                 :            :         }
      28                 :          0 : }
      29                 :            : 
      30                 :          0 : u32 aq_hw_read_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk, u32 shift)
      31                 :            : {
      32                 :          0 :         return ((aq_hw_read_reg(aq_hw, addr) & msk) >> shift);
      33                 :            : }
      34                 :            : 
      35                 :          0 : u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg)
      36                 :            : {
      37                 :          0 :         return rte_le_to_cpu_32(rte_read32((u8 *)hw->mmio + reg));
      38                 :            : }
      39                 :            : 
      40                 :          0 : void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value)
      41                 :            : {
      42                 :          0 :         rte_write32((rte_cpu_to_le_32(value)), (u8 *)hw->mmio + reg);
      43                 :          0 : }
      44                 :            : 
      45                 :          0 : int aq_hw_err_from_flags(struct aq_hw_s *hw)
      46                 :            : {
      47                 :            :         int err = 0;
      48                 :            : 
      49         [ #  # ]:          0 :         if (aq_hw_read_reg(hw, 0x10U) == ~0U)
      50                 :          0 :                 return -ENXIO;
      51                 :            : 
      52                 :            :         return err;
      53                 :            : }

Generated by: LCOV version 1.14