blob: cc32ec41611ac02075aa0a624728821897aa69f0 [file] [log] [blame]
Varun Wadekarecd6a5a2018-04-09 17:48:58 -07001/*
2 * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef __MCE_PRIVATE_H__
8#define __MCE_PRIVATE_H__
9
10#include <mmio.h>
11#include <tegra_def.h>
12
13/*******************************************************************************
14 * Macros to prepare CSTATE info request
15 ******************************************************************************/
16/* Description of the parameters for UPDATE_CSTATE_INFO request */
Steven Kao2cdb6782017-01-05 17:04:40 +080017#define CLUSTER_CSTATE_MASK 0x7UL
18#define CLUSTER_CSTATE_SHIFT 0X0UL
19#define CLUSTER_CSTATE_UPDATE_BIT (1UL << 7)
20#define CCPLEX_CSTATE_MASK 0x3UL
21#define CCPLEX_CSTATE_SHIFT 8UL
22#define CCPLEX_CSTATE_UPDATE_BIT (1UL << 15)
23#define SYSTEM_CSTATE_MASK 0xFUL
24#define SYSTEM_CSTATE_SHIFT 16UL
25#define SYSTEM_CSTATE_UPDATE_BIT (1UL << 23)
26#define CSTATE_WAKE_MASK_UPDATE_BIT (1UL << 31)
27#define CSTATE_WAKE_MASK_SHIFT 32UL
28#define CSTATE_WAKE_MASK_CLEAR 0xFFFFFFFFUL
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070029
30/*******************************************************************************
31 * Auto-CC3 control macros
32 ******************************************************************************/
Steven Kao2cdb6782017-01-05 17:04:40 +080033#define MCE_AUTO_CC3_FREQ_MASK 0xFFUL
34#define MCE_AUTO_CC3_FREQ_SHIFT 0UL
35#define MCE_AUTO_CC3_ENABLE_BIT (1UL << 31)
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070036
37/*******************************************************************************
Steven Kao2cdb6782017-01-05 17:04:40 +080038 * Core ID mask (bits 3:0 in the online request)
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070039 ******************************************************************************/
Steven Kao2cdb6782017-01-05 17:04:40 +080040#define MCE_CORE_ID_MASK 0xFUL
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070041
42/*******************************************************************************
Steven Kao2cdb6782017-01-05 17:04:40 +080043 * Cache control macros
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070044 ******************************************************************************/
Steven Kao2cdb6782017-01-05 17:04:40 +080045#define CACHE_CLEAN_SET (1UL << 0)
46#define CACHE_CLEAN_INVAL_SET (1UL << 1)
47#define CACHE_CLEAN_INVAL_TR_SET (1UL << 2)
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070048
49/* declarations for NVG handler functions */
Steven Kao2cdb6782017-01-05 17:04:40 +080050uint64_t nvg_get_version(void);
51int32_t nvg_enable_power_perf_mode(void);
52int32_t nvg_disable_power_perf_mode(void);
53int32_t nvg_enable_power_saver_modes(void);
54int32_t nvg_disable_power_saver_modes(void);
55void nvg_set_wake_time(uint32_t wake_time);
56void nvg_update_cstate_info(uint32_t cluster, uint32_t ccplex,
57 uint32_t system, uint32_t wake_mask, uint8_t update_wake_mask);
58int32_t nvg_update_crossover_time(uint32_t type, uint32_t time);
59int32_t nvg_set_cstate_stat_query_value(uint64_t data);
60uint64_t nvg_get_cstate_stat_query_value(void);
61int32_t nvg_is_sc7_allowed(void);
62int32_t nvg_online_core(uint32_t core);
63int32_t nvg_cc3_ctrl(uint32_t freq, uint8_t enable);
64int32_t nvg_update_ccplex_gsc(uint32_t gsc_idx);
65int32_t nvg_roc_flush_cache(void);
66int32_t nvg_roc_clean_cache(void);
67int32_t nvg_roc_clean_cache_trbits(void);
68int32_t nvg_enter_cstate(uint32_t state, uint32_t wake_time);
69
70void nvg_set_request_data(uint64_t req, uint64_t data);
71void nvg_set_request(uint64_t req);
72uint64_t nvg_get_result(void);
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070073
74#endif /* __MCE_PRIVATE_H__ */