blob: 9741d084faf3240c06f6599ffb2f585ad63aeadf [file] [log] [blame]
Varun Wadekarecd6a5a2018-04-09 17:48:58 -07001/*
Varun Wadekar55283252020-01-09 08:58:34 -08002 * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
Varun Wadekarecd6a5a2018-04-09 17:48:58 -07003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
Varun Wadekar55283252020-01-09 08:58:34 -08007#ifndef MCE_PRIVATE_H
8#define MCE_PRIVATE_H
Varun Wadekarecd6a5a2018-04-09 17:48:58 -07009
Vignesh Radhakrishnan3ad79832017-12-11 13:17:58 -080010#include <stdbool.h>
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070011#include <tegra_def.h>
12
13/*******************************************************************************
14 * Macros to prepare CSTATE info request
15 ******************************************************************************/
16/* Description of the parameters for UPDATE_CSTATE_INFO request */
Anthony Zhouc46150f2017-09-20 17:18:56 +080017#define CLUSTER_CSTATE_MASK 0x7U
18#define CLUSTER_CSTATE_SHIFT 0X0U
19#define CLUSTER_CSTATE_UPDATE_BIT (1U << 7)
Vignesh Radhakrishnan706b9fe2017-11-04 16:36:23 -070020#define CCPLEX_CSTATE_MASK 0x7U
Anthony Zhouc46150f2017-09-20 17:18:56 +080021#define CCPLEX_CSTATE_SHIFT 8U
22#define CCPLEX_CSTATE_UPDATE_BIT (1U << 15)
23#define SYSTEM_CSTATE_MASK 0xFU
24#define SYSTEM_CSTATE_SHIFT 16U
25#define SYSTEM_CSTATE_UPDATE_BIT (1U << 23)
26#define CSTATE_WAKE_MASK_UPDATE_BIT (1U << 31)
27#define CSTATE_WAKE_MASK_SHIFT 32U
28#define CSTATE_WAKE_MASK_CLEAR 0xFFFFFFFFU
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070029
30/*******************************************************************************
Steven Kao2cdb6782017-01-05 17:04:40 +080031 * Core ID mask (bits 3:0 in the online request)
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070032 ******************************************************************************/
Anthony Zhouc46150f2017-09-20 17:18:56 +080033#define MCE_CORE_ID_MASK 0xFU
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070034
35/*******************************************************************************
Krishna Sitaraman09f68172017-05-24 17:21:22 -070036 * C-state statistics macros
37 ******************************************************************************/
Anthony Zhouc46150f2017-09-20 17:18:56 +080038#define MCE_STAT_ID_SHIFT 16U
Krishna Sitaraman09f68172017-05-24 17:21:22 -070039
Dilan Lee4e7a63c2017-08-10 16:01:42 +080040/*******************************************************************************
41 * Security config macros
42 ******************************************************************************/
43#define STRICT_CHECKING_ENABLED_SET (1UL << 0)
44#define STRICT_CHECKING_LOCKED_SET (1UL << 1)
45
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070046/* declarations for NVG handler functions */
Steven Kao2cdb6782017-01-05 17:04:40 +080047uint64_t nvg_get_version(void);
48int32_t nvg_enable_power_perf_mode(void);
49int32_t nvg_disable_power_perf_mode(void);
50int32_t nvg_enable_power_saver_modes(void);
51int32_t nvg_disable_power_saver_modes(void);
52void nvg_set_wake_time(uint32_t wake_time);
53void nvg_update_cstate_info(uint32_t cluster, uint32_t ccplex,
54 uint32_t system, uint32_t wake_mask, uint8_t update_wake_mask);
Steven Kao2cdb6782017-01-05 17:04:40 +080055int32_t nvg_set_cstate_stat_query_value(uint64_t data);
56uint64_t nvg_get_cstate_stat_query_value(void);
57int32_t nvg_is_sc7_allowed(void);
58int32_t nvg_online_core(uint32_t core);
Steven Kao2cdb6782017-01-05 17:04:40 +080059int32_t nvg_update_ccplex_gsc(uint32_t gsc_idx);
Anthony Zhouacdf4112017-10-25 18:17:08 +080060int32_t nvg_roc_clean_cache(void);
61int32_t nvg_roc_flush_cache(void);
62int32_t nvg_roc_clean_cache_trbits(void);
Steven Kao2cdb6782017-01-05 17:04:40 +080063int32_t nvg_enter_cstate(uint32_t state, uint32_t wake_time);
Steven Kao2cdb6782017-01-05 17:04:40 +080064void nvg_set_request_data(uint64_t req, uint64_t data);
65void nvg_set_request(uint64_t req);
66uint64_t nvg_get_result(void);
Steven Kao238d6d22017-08-16 20:12:00 +080067uint64_t nvg_cache_clean(void);
68uint64_t nvg_cache_clean_inval(void);
69uint64_t nvg_cache_inval_all(void);
Dilan Lee4e7a63c2017-08-10 16:01:42 +080070void nvg_enable_strict_checking_mode(void);
Vignesh Radhakrishnan3ad79832017-12-11 13:17:58 -080071void nvg_system_shutdown(void);
72void nvg_system_reboot(void);
Dilan Lee4e7a63c2017-08-10 16:01:42 +080073
74/* MCE helper functions */
75void mce_enable_strict_checking(void);
Vignesh Radhakrishnan3ad79832017-12-11 13:17:58 -080076void mce_system_shutdown(void);
77void mce_system_reboot(void);
Varun Wadekarecd6a5a2018-04-09 17:48:58 -070078
Varun Wadekar55283252020-01-09 08:58:34 -080079#endif /* MCE_PRIVATE_H */