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

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright 2008-2017 Cisco Systems, Inc.  All rights reserved.
       3                 :            :  * Copyright 2007 Nuova Systems, Inc.  All rights reserved.
       4                 :            :  */
       5                 :            : 
       6                 :            : #ifndef _VNIC_INTR_H_
       7                 :            : #define _VNIC_INTR_H_
       8                 :            : 
       9                 :            : 
      10                 :            : #include "vnic_dev.h"
      11                 :            : 
      12                 :            : #define VNIC_INTR_TIMER_TYPE_ABS        0
      13                 :            : #define VNIC_INTR_TIMER_TYPE_QUIET      1
      14                 :            : 
      15                 :            : /* Interrupt control */
      16                 :            : struct vnic_intr_ctrl {
      17                 :            :         uint32_t coalescing_timer;              /* 0x00 */
      18                 :            :         uint32_t pad0;
      19                 :            :         uint32_t coalescing_value;              /* 0x08 */
      20                 :            :         uint32_t pad1;
      21                 :            :         uint32_t coalescing_type;               /* 0x10 */
      22                 :            :         uint32_t pad2;
      23                 :            :         uint32_t mask_on_assertion;             /* 0x18 */
      24                 :            :         uint32_t pad3;
      25                 :            :         uint32_t mask;                          /* 0x20 */
      26                 :            :         uint32_t pad4;
      27                 :            :         uint32_t int_credits;                   /* 0x28 */
      28                 :            :         uint32_t pad5;
      29                 :            :         uint32_t int_credit_return;             /* 0x30 */
      30                 :            :         uint32_t pad6;
      31                 :            : };
      32                 :            : 
      33                 :            : struct vnic_intr {
      34                 :            :         unsigned int index;
      35                 :            :         struct vnic_dev *vdev;
      36                 :            :         struct vnic_intr_ctrl __iomem *ctrl;            /* memory-mapped */
      37                 :            : };
      38                 :            : 
      39                 :            : static inline void vnic_intr_unmask(struct vnic_intr *intr)
      40                 :            : {
      41                 :          0 :         iowrite32(0, &intr->ctrl->mask);
      42                 :            : }
      43                 :            : 
      44                 :            : static inline void vnic_intr_mask(struct vnic_intr *intr)
      45                 :            : {
      46                 :          0 :         iowrite32(1, &intr->ctrl->mask);
      47                 :            : }
      48                 :            : 
      49                 :            : static inline int vnic_intr_masked(struct vnic_intr *intr)
      50                 :            : {
      51                 :          0 :         return ioread32(&intr->ctrl->mask);
      52                 :            : }
      53                 :            : 
      54                 :            : static inline void vnic_intr_return_credits(struct vnic_intr *intr,
      55                 :            :         unsigned int credits, int unmask, int reset_timer)
      56                 :            : {
      57                 :            : #define VNIC_INTR_UNMASK_SHIFT          16
      58                 :            : #define VNIC_INTR_RESET_TIMER_SHIFT     17
      59                 :            : 
      60                 :          0 :         uint32_t int_credit_return = (credits & 0xffff) |
      61                 :            :                 (unmask ? (1 << VNIC_INTR_UNMASK_SHIFT) : 0) |
      62                 :            :                 (reset_timer ? (1 << VNIC_INTR_RESET_TIMER_SHIFT) : 0);
      63                 :            : 
      64                 :          0 :         iowrite32(int_credit_return, &intr->ctrl->int_credit_return);
      65                 :            : }
      66                 :            : 
      67                 :            : static inline unsigned int vnic_intr_credits(struct vnic_intr *intr)
      68                 :            : {
      69                 :          0 :         return ioread32(&intr->ctrl->int_credits);
      70                 :            : }
      71                 :            : 
      72                 :            : static inline void vnic_intr_return_all_credits(struct vnic_intr *intr)
      73                 :            : {
      74                 :            :         unsigned int credits = vnic_intr_credits(intr);
      75                 :            :         int unmask = 1;
      76                 :            :         int reset_timer = 1;
      77                 :            : 
      78                 :            :         vnic_intr_return_credits(intr, credits, unmask, reset_timer);
      79                 :            : }
      80                 :            : 
      81                 :            : static inline uint32_t vnic_intr_legacy_pba(uint32_t __iomem *legacy_pba)
      82                 :            : {
      83                 :            :         /* read PBA without clearing */
      84                 :            :         return ioread32(legacy_pba);
      85                 :            : }
      86                 :            : 
      87                 :            : void vnic_intr_free(struct vnic_intr *intr);
      88                 :            : int vnic_intr_alloc(struct vnic_dev *vdev, struct vnic_intr *intr,
      89                 :            :         unsigned int index);
      90                 :            : void vnic_intr_init(struct vnic_intr *intr, uint32_t coalescing_timer,
      91                 :            :         unsigned int coalescing_type, unsigned int mask_on_assertion);
      92                 :            : void vnic_intr_coalescing_timer_set(struct vnic_intr *intr,
      93                 :            :         uint32_t coalescing_timer);
      94                 :            : void vnic_intr_clean(struct vnic_intr *intr);
      95                 :            : 
      96                 :            : #endif /* _VNIC_INTR_H_ */

Generated by: LCOV version 1.14