LCOV - code coverage report
Current view: top level - zephyr/drivers/firmware/scmi/nxp - cpu.h Coverage Total Hit
Test: new.info Lines: 26.9 % 26 7
Test Date: 2025-09-25 19:22:35

            Line data    Source code
       1            1 : /*
       2              :  * Copyright 2025 NXP
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * @brief SCMI power domain protocol helpers
      10              :  */
      11              : 
      12              : #ifndef _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_CPU_H_
      13              : #define _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_CPU_H_
      14              : 
      15              : #include <zephyr/drivers/firmware/scmi/protocol.h>
      16              : #if __has_include("scmi_cpu_soc.h")
      17              : #include <scmi_cpu_soc.h>
      18              : #endif
      19              : 
      20            0 : #define SCMI_CPU_SLEEP_FLAG_IRQ_MUX 0x1U
      21              : 
      22            0 : #define SCMI_PROTOCOL_CPU_DOMAIN 130
      23              : 
      24            0 : #define SCMI_CPU_MAX_PDCONFIGS_T 7U
      25              : 
      26            0 : #define SCMI_CPU_IRQ_WAKE_NUM   22U
      27              : 
      28              : /**
      29              :  * @struct scmi_cpu_sleep_mode_config
      30              :  *
      31              :  * @brief Describes the parameters for the CPU_STATE_SET
      32              :  * command
      33              :  */
      34            1 : struct scmi_cpu_sleep_mode_config {
      35            0 :         uint32_t cpu_id;
      36            0 :         uint32_t flags;
      37            0 :         uint32_t sleep_mode;
      38              : };
      39              : 
      40            0 : struct scmi_pd_lpm_settings {
      41            0 :         uint32_t domain_id;
      42            0 :         uint32_t lpm_setting;
      43            0 :         uint32_t ret_mask;
      44              : };
      45              : 
      46              : /**
      47              :  * @struct scmi_cpu_pd_lpm_config
      48              :  *
      49              :  * @brief Describes cpu power domain low power mode setting
      50              :  */
      51            1 : struct scmi_cpu_pd_lpm_config {
      52            0 :         uint32_t cpu_id;
      53            0 :         uint32_t num_cfg;
      54            0 :         struct scmi_pd_lpm_settings cfgs[SCMI_CPU_MAX_PDCONFIGS_T];
      55              : };
      56              : 
      57              : /**
      58              :  * @struct scmi_cpu_irq_mask_config
      59              :  *
      60              :  * @brief Describes the parameters for the CPU_IRQ_WAKE_SET command
      61              :  */
      62            1 : struct scmi_cpu_irq_mask_config {
      63            0 :         uint32_t cpu_id;
      64            0 :         uint32_t mask_idx;
      65            0 :         uint32_t num_mask;
      66            0 :         uint32_t mask[SCMI_CPU_IRQ_WAKE_NUM];
      67              : };
      68              : 
      69              : /**
      70              :  * @brief CPU domain protocol command message IDs
      71              :  */
      72            0 : enum scmi_cpu_domain_message {
      73              :         SCMI_CPU_DOMAIN_MSG_PROTOCOL_VERSION = 0x0,
      74              :         SCMI_CPU_DOMAIN_MSG_PROTOCOL_ATTRIBUTES = 0x1,
      75              :         SCMI_CPU_DOMAIN_MSG_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
      76              :         SCMI_CPU_DOMAIN_MSG_CPU_DOMAIN_ATTRIBUTES = 0x3,
      77              :         SCMI_CPU_DOMAIN_MSG_CPU_START = 0x4,
      78              :         SCMI_CPU_DOMAIN_MSG_CPU_STOP = 0x5,
      79              :         SCMI_CPU_DOMAIN_MSG_CPU_RESET_VECTOR_SET = 0x6,
      80              :         SCMI_CPU_DOMAIN_MSG_CPU_SLEEP_MODE_SET = 0x7,
      81              :         SCMI_CPU_DOMAIN_MSG_CPU_IRQ_WAKE_SET = 0x8,
      82              :         SCMI_CPU_DOMAIN_MSG_CPU_NON_IRQ_WAKE_SET = 0x9,
      83              :         SCMI_CPU_DOMAIN_MSG_CPU_PD_LPM_CONFIG_SET = 0xA,
      84              :         SCMI_CPU_DOMAIN_MSG_CPU_PER_LPM_CONFIG_SET = 0xB,
      85              :         SCMI_CPU_DOMAIN_MSG_CPU_INFO_GET = 0xC,
      86              :         SCMI_CPU_DOMAIN_MSG_NEGOTIATE_PROTOCOL_VERSION = 0x10,
      87              : };
      88              : 
      89              : /**
      90              :  * @brief Send the CPU_SLEEP_MODE_SET command and get its reply
      91              :  *
      92              :  * @param cfg pointer to structure containing configuration
      93              :  * to be set
      94              :  *
      95              :  * @retval 0 if successful
      96              :  * @retval negative errno if failure
      97              :  */
      98            1 : int scmi_cpu_sleep_mode_set(struct scmi_cpu_sleep_mode_config *cfg);
      99              : 
     100              : /**
     101              :  * @brief Send the SCMI_CPU_DOMAIN_MSG_CPU_PD_LPM_CONFIG_SET command and get its reply
     102              :  *
     103              :  * @param cfg pointer to structure containing configuration
     104              :  * to be set
     105              :  *
     106              :  * @retval 0 if successful
     107              :  * @retval negative errno if failure
     108              :  */
     109            1 : int scmi_cpu_pd_lpm_set(struct scmi_cpu_pd_lpm_config *cfg);
     110              : 
     111              : /**
     112              :  * @brief Send the CPU_IRQ_WAKE_SET command and get its reply
     113              :  *
     114              :  * @param cfg pointer to structure containing configuration to be set
     115              :  *
     116              :  * @retval 0 if successful
     117              :  * @retval negative errno if failure
     118              :  */
     119            1 : int scmi_cpu_set_irq_mask(struct scmi_cpu_irq_mask_config *cfg);
     120              : #endif /* _INCLUDE_ZEPHYR_DRIVERS_FIRMWARE_SCMI_CPU_H_ */
        

Generated by: LCOV version 2.0-1