LCOV - code coverage report
Current view: top level - zephyr/drivers/pcie - vc.h Coverage Total Hit
Test: new.info Lines: 18.8 % 16 3
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2023 Intel Corporation
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #ifndef ZEPHYR_INCLUDE_DRIVERS_PCIE_VC_H_
       8              : #define ZEPHYR_INCLUDE_DRIVERS_PCIE_VC_H_
       9              : 
      10              : /**
      11              :  * @brief PCIe Virtual Channel Host Interface
      12              :  * @defgroup pcie_vc_host_interface PCIe Virtual Channel Host Interface
      13              :  * @ingroup pcie_host_interface
      14              :  * @{
      15              :  */
      16              : 
      17              : #ifdef __cplusplus
      18              : extern "C" {
      19              : #endif
      20              : 
      21              : #include <zephyr/kernel.h>
      22              : #include <zephyr/types.h>
      23              : #include <stdbool.h>
      24              : 
      25              : #include <zephyr/drivers/pcie/pcie.h>
      26              : 
      27              : /*
      28              :  * 1 default VC + 7 extended VCs
      29              :  */
      30            0 : #define PCIE_VC_MAX_COUNT 8U
      31              : 
      32            0 : #define PCIE_VC_SET_TC0 BIT(0)
      33            0 : #define PCIE_VC_SET_TC1 BIT(1)
      34            0 : #define PCIE_VC_SET_TC2 BIT(2)
      35            0 : #define PCIE_VC_SET_TC3 BIT(3)
      36            0 : #define PCIE_VC_SET_TC4 BIT(4)
      37            0 : #define PCIE_VC_SET_TC5 BIT(5)
      38            0 : #define PCIE_VC_SET_TC6 BIT(6)
      39            0 : #define PCIE_VC_SET_TC7 BIT(7)
      40              : 
      41            0 : struct pcie_vctc_map {
      42              :         /*
      43              :          * Map the TCs for each VC by setting bits relevantly
      44              :          * Note: one bit cannot be set more than once among the VCs
      45              :          */
      46            0 :         uint8_t vc_tc[PCIE_VC_MAX_COUNT];
      47              :         /*
      48              :          * Number of VCs being addressed
      49              :          */
      50            0 :         int vc_count;
      51              : };
      52              : 
      53              : /**
      54              :  * @brief Enable PCIe Virtual Channel handling
      55              :  * @param bdf the target PCI endpoint
      56              :  * @return 0 on success, a negative error code otherwise
      57              :  *
      58              :  * Note: Not being able to enable such feature is a non-fatal error
      59              :  * and any code using it should behave accordingly (displaying some info,
      60              :  * and ignoring it for instance).
      61              :  */
      62            1 : int pcie_vc_enable(pcie_bdf_t bdf);
      63              : 
      64              : /**
      65              :  * @brief Disable PCIe Virtual Channel handling
      66              :  * @param bdf the target PCI endpoint
      67              :  * @return 0 on success, a negative error code otherwise
      68              :  */
      69            1 : int pcie_vc_disable(pcie_bdf_t bdf);
      70              : 
      71              : /**
      72              :  * @brief Map PCIe TC/VC
      73              :  * @param bdf the target PCI endpoint
      74              :  * @param map the tc/vc map to apply
      75              :  * @return 0 on success, a negative error code otherwise
      76              :  *
      77              :  * Note: VC must be disabled prior to call this function and
      78              :  * enabled afterward in order for the endpoint to take advandage of the map.
      79              :  *
      80              :  * Note: Not being able to enable such feature is a non-fatal error
      81              :  * and any code using it should behave accordingly (displaying some info,
      82              :  * and ignoring it for instance).
      83              :  */
      84            1 : int pcie_vc_map_tc(pcie_bdf_t bdf, struct pcie_vctc_map *map);
      85              : 
      86              : 
      87              : #ifdef __cplusplus
      88              : }
      89              : #endif
      90              : 
      91              : /**
      92              :  * @}
      93              :  */
      94              : 
      95              : #endif /* ZEPHYR_INCLUDE_DRIVERS_PCIE_VC_H_ */
        

Generated by: LCOV version 2.0-1