blob: 3994b2d75514f2f2b421bda125cc22fc7e0ce468 [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
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070010#include <tegra_def.h>
11
12/*******************************************************************************
13 * Macros to prepare CSTATE info request
14 ******************************************************************************/
15/* Description of the parameters for UPDATE_CSTATE_INFO request */
Anthony Zhouc46150f2017-09-20 17:18:56 +080016#define CLUSTER_CSTATE_MASK 0x7U
17#define CLUSTER_CSTATE_SHIFT 0X0U
18#define CLUSTER_CSTATE_UPDATE_BIT (1U << 7)
Vignesh Radhakrishnan706b9fe2017-11-04 16:36:23 -070019#define CCPLEX_CSTATE_MASK 0x7U
Anthony Zhouc46150f2017-09-20 17:18:56 +080020#define CCPLEX_CSTATE_SHIFT 8U
21#define CCPLEX_CSTATE_UPDATE_BIT (1U << 15)
22#define SYSTEM_CSTATE_MASK 0xFU
23#define SYSTEM_CSTATE_SHIFT 16U
24#define SYSTEM_CSTATE_UPDATE_BIT (1U << 23)
25#define CSTATE_WAKE_MASK_UPDATE_BIT (1U << 31)
26#define CSTATE_WAKE_MASK_SHIFT 32U
27#define CSTATE_WAKE_MASK_CLEAR 0xFFFFFFFFU
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070028
29/*******************************************************************************
Steven Kao2cdb6782017-01-05 17:04:40 +080030 * Core ID mask (bits 3:0 in the online request)
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070031 ******************************************************************************/
Anthony Zhouc46150f2017-09-20 17:18:56 +080032#define MCE_CORE_ID_MASK 0xFU
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070033
34/*******************************************************************************
Krishna Sitaraman09f68172017-05-24 17:21:22 -070035 * C-state statistics macros
36 ******************************************************************************/
Anthony Zhouc46150f2017-09-20 17:18:56 +080037#define MCE_STAT_ID_SHIFT 16U
Krishna Sitaraman09f68172017-05-24 17:21:22 -070038
Dilan Lee4e7a63c2017-08-10 16:01:42 +080039/*******************************************************************************
40 * Security config macros
41 ******************************************************************************/
42#define STRICT_CHECKING_ENABLED_SET (1UL << 0)
43#define STRICT_CHECKING_LOCKED_SET (1UL << 1)
44
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070045/* declarations for NVG handler functions */
Steven Kao2cdb6782017-01-05 17:04:40 +080046uint64_t nvg_get_version(void);
47int32_t nvg_enable_power_perf_mode(void);
48int32_t nvg_disable_power_perf_mode(void);
49int32_t nvg_enable_power_saver_modes(void);
50int32_t nvg_disable_power_saver_modes(void);
51void nvg_set_wake_time(uint32_t wake_time);
52void nvg_update_cstate_info(uint32_t cluster, uint32_t ccplex,
53 uint32_t system, uint32_t wake_mask, uint8_t update_wake_mask);
Steven Kao2cdb6782017-01-05 17:04:40 +080054int32_t nvg_set_cstate_stat_query_value(uint64_t data);
55uint64_t nvg_get_cstate_stat_query_value(void);
56int32_t nvg_is_sc7_allowed(void);
57int32_t nvg_online_core(uint32_t core);
Steven Kao2cdb6782017-01-05 17:04:40 +080058int32_t nvg_update_ccplex_gsc(uint32_t gsc_idx);
Anthony Zhouacdf4112017-10-25 18:17:08 +080059int32_t nvg_roc_clean_cache(void);
60int32_t nvg_roc_flush_cache(void);
61int32_t nvg_roc_clean_cache_trbits(void);
Steven Kao2cdb6782017-01-05 17:04:40 +080062int32_t nvg_enter_cstate(uint32_t state, uint32_t wake_time);
Steven Kao2cdb6782017-01-05 17:04:40 +080063void nvg_set_request_data(uint64_t req, uint64_t data);
64void nvg_set_request(uint64_t req);
65uint64_t nvg_get_result(void);
Steven Kao238d6d22017-08-16 20:12:00 +080066uint64_t nvg_cache_clean(void);
67uint64_t nvg_cache_clean_inval(void);
68uint64_t nvg_cache_inval_all(void);
Dilan Lee4e7a63c2017-08-10 16:01:42 +080069int32_t nvg_roc_clean_cache_trbits(void);
70void nvg_enable_strict_checking_mode(void);
71
72/* MCE helper functions */
73void mce_enable_strict_checking(void);
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070074
75#endif /* __MCE_PRIVATE_H__ */