LCOV - code coverage report
Current view: top level - drivers/bus/fslmc/mc - dpmng.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 17 0.0 %
Date: 2025-05-01 17:49:45 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 4 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
       2                 :            :  *
       3                 :            :  * Copyright 2013-2015 Freescale Semiconductor Inc.
       4                 :            :  * Copyright 2017 NXP
       5                 :            :  *
       6                 :            :  */
       7                 :            : #include <fsl_mc_sys.h>
       8                 :            : #include <fsl_mc_cmd.h>
       9                 :            : #include <fsl_dpmng.h>
      10                 :            : #include <fsl_dpmng_cmd.h>
      11                 :            : 
      12                 :            : #include <eal_export.h>
      13                 :            : 
      14                 :            : /**
      15                 :            :  * mc_get_version() - Retrieves the Management Complex firmware
      16                 :            :  *                      version information
      17                 :            :  * @mc_io:              Pointer to opaque I/O object
      18                 :            :  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
      19                 :            :  * @mc_ver_info:        Returned version information structure
      20                 :            :  *
      21                 :            :  * Return:      '0' on Success; Error code otherwise.
      22                 :            :  */
      23                 :            : RTE_EXPORT_INTERNAL_SYMBOL(mc_get_version)
      24                 :          0 : int mc_get_version(struct fsl_mc_io *mc_io,
      25                 :            :                    uint32_t cmd_flags,
      26                 :            :                    struct mc_version *mc_ver_info)
      27                 :            : {
      28                 :          0 :         struct mc_command cmd = { 0 };
      29                 :            :         struct dpmng_rsp_get_version *rsp_params;
      30                 :            :         int err;
      31                 :            : 
      32                 :            :         /* prepare command */
      33                 :          0 :         cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
      34                 :            :                                           cmd_flags,
      35                 :            :                                           0);
      36                 :            : 
      37                 :            :         /* send command to mc*/
      38                 :          0 :         err = mc_send_command(mc_io, &cmd);
      39         [ #  # ]:          0 :         if (err)
      40                 :            :                 return err;
      41                 :            : 
      42                 :            :         /* retrieve response parameters */
      43                 :            :         rsp_params = (struct dpmng_rsp_get_version *)cmd.params;
      44                 :          0 :         mc_ver_info->revision = le32_to_cpu(rsp_params->revision);
      45                 :          0 :         mc_ver_info->major = le32_to_cpu(rsp_params->version_major);
      46                 :          0 :         mc_ver_info->minor = le32_to_cpu(rsp_params->version_minor);
      47                 :            : 
      48                 :          0 :         return 0;
      49                 :            : }
      50                 :            : 
      51                 :            : /**
      52                 :            :  * mc_get_soc_version() - Retrieves the Management Complex firmware
      53                 :            :  *                     version information
      54                 :            :  * @mc_io               Pointer to opaque I/O object
      55                 :            :  * @cmd_flags:          Command flags; one or more of 'MC_CMD_FLAG_'
      56                 :            :  * @mc_platform_info:   Returned version information structure. The structure
      57                 :            :  *                      contains the values of SVR and PVR registers.
      58                 :            :  *                      Please consult platform specific reference manual
      59                 :            :  *                      for detailed information.
      60                 :            :  *
      61                 :            :  * Return:     '0' on Success; Error code otherwise.
      62                 :            :  */
      63                 :            : RTE_EXPORT_INTERNAL_SYMBOL(mc_get_soc_version)
      64                 :          0 : int mc_get_soc_version(struct fsl_mc_io *mc_io,
      65                 :            :                        uint32_t cmd_flags,
      66                 :            :                        struct mc_soc_version *mc_platform_info)
      67                 :            : {
      68                 :            :         struct dpmng_rsp_get_soc_version *rsp_params;
      69                 :          0 :         struct mc_command cmd = { 0 };
      70                 :            :         int err;
      71                 :            : 
      72                 :            :         /* prepare command */
      73                 :          0 :         cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_SOC_VERSION,
      74                 :            :                                           cmd_flags,
      75                 :            :                                           0);
      76                 :            : 
      77                 :            :         /* send command to mc*/
      78                 :          0 :         err = mc_send_command(mc_io, &cmd);
      79         [ #  # ]:          0 :         if (err)
      80                 :            :                 return err;
      81                 :            : 
      82                 :            :         /* retrieve response parameters */
      83                 :            :         rsp_params = (struct dpmng_rsp_get_soc_version *)cmd.params;
      84                 :          0 :         mc_platform_info->svr = le32_to_cpu(rsp_params->svr);
      85                 :          0 :         mc_platform_info->pvr = le32_to_cpu(rsp_params->pvr);
      86                 :            : 
      87                 :          0 :         return 0;
      88                 :            : }

Generated by: LCOV version 1.14