blob: 81408702f9922ba4c487cedef866e5f5758f9526 [file] [log] [blame]
Varun Wadekarb5568282016-12-13 18:04:35 -08001/*
Anthony Zhou59fd6152017-03-13 15:34:08 +08002 * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
Varun Wadekarb5568282016-12-13 18:04:35 -08003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Varun Wadekarb5568282016-12-13 18:04:35 -08005 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef MCE_H
8#define MCE_H
Varun Wadekarb5568282016-12-13 18:04:35 -08009
10#include <mmio.h>
11#include <tegra_def.h>
12
13/*******************************************************************************
14 * MCE commands
15 ******************************************************************************/
16typedef enum mce_cmd {
Anthony Zhou59fd6152017-03-13 15:34:08 +080017 MCE_CMD_ENTER_CSTATE = 0U,
18 MCE_CMD_UPDATE_CSTATE_INFO = 1U,
19 MCE_CMD_UPDATE_CROSSOVER_TIME = 2U,
20 MCE_CMD_READ_CSTATE_STATS = 3U,
21 MCE_CMD_WRITE_CSTATE_STATS = 4U,
22 MCE_CMD_IS_SC7_ALLOWED = 5U,
23 MCE_CMD_ONLINE_CORE = 6U,
24 MCE_CMD_CC3_CTRL = 7U,
25 MCE_CMD_ECHO_DATA = 8U,
26 MCE_CMD_READ_VERSIONS = 9U,
27 MCE_CMD_ENUM_FEATURES = 10U,
28 MCE_CMD_ROC_FLUSH_CACHE_TRBITS = 11U,
29 MCE_CMD_ENUM_READ_MCA = 12U,
30 MCE_CMD_ENUM_WRITE_MCA = 13U,
31 MCE_CMD_ROC_FLUSH_CACHE = 14U,
32 MCE_CMD_ROC_CLEAN_CACHE = 15U,
33 MCE_CMD_ENABLE_LATIC = 16U,
34 MCE_CMD_UNCORE_PERFMON_REQ = 17U,
35 MCE_CMD_MISC_CCPLEX = 18U,
36 MCE_CMD_IS_CCX_ALLOWED = 0xFEU,
37 MCE_CMD_MAX = 0xFFU,
Varun Wadekarb5568282016-12-13 18:04:35 -080038} mce_cmd_t;
39
Anthony Zhou59fd6152017-03-13 15:34:08 +080040#define MCE_CMD_MASK 0xFFU
Varun Wadekarb5568282016-12-13 18:04:35 -080041
42/*******************************************************************************
43 * Timeout value used to powerdown a core
44 ******************************************************************************/
Anthony Zhou59fd6152017-03-13 15:34:08 +080045#define MCE_CORE_SLEEP_TIME_INFINITE 0xFFFFFFFFU
Varun Wadekarb5568282016-12-13 18:04:35 -080046
47/*******************************************************************************
48 * Struct to prepare UPDATE_CSTATE_INFO request
49 ******************************************************************************/
50typedef struct mce_cstate_info {
51 /* cluster cstate value */
52 uint32_t cluster;
53 /* ccplex cstate value */
54 uint32_t ccplex;
55 /* system cstate value */
56 uint32_t system;
57 /* force system state? */
58 uint8_t system_state_force;
59 /* wake mask value */
60 uint32_t wake_mask;
61 /* update the wake mask? */
62 uint8_t update_wake_mask;
63} mce_cstate_info_t;
64
65/* public interfaces */
Anthony Zhou1ab31402017-03-06 16:06:45 +080066int mce_command_handler(uint64_t cmd, uint64_t arg0, uint64_t arg1,
Varun Wadekarb5568282016-12-13 18:04:35 -080067 uint64_t arg2);
68int mce_update_reset_vector(void);
69int mce_update_gsc_videomem(void);
70int mce_update_gsc_tzdram(void);
71int mce_update_gsc_tzram(void);
72__dead2 void mce_enter_ccplex_state(uint32_t state_idx);
Anthony Zhou1ab31402017-03-06 16:06:45 +080073void mce_update_cstate_info(const mce_cstate_info_t *cstate);
Varun Wadekarb5568282016-12-13 18:04:35 -080074void mce_verify_firmware_version(void);
75
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000076#endif /* MCE_H */