"git@web.lueluesay.top:root/ohmyzsh.git" did not exist on "6bec3c6719f17898b6504a6189424bc23cc10c65"
plat_sip_calls.c 1.7 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
#include <common/bl_common.h>
#include <lib/el3_runtime/context_mgmt.h>
#include <common/debug.h>
#include <errno.h>
#include <mce.h>
#include <memctrl.h>
#include <common/runtime_svc.h>
#include <tegra_private.h>
18
19
#include <tegra_platform.h>
#include <stdbool.h>
20

21
22
extern bool tegra_fake_system_suspend;

23
24
25
/*******************************************************************************
 * Tegra186 SiP SMCs
 ******************************************************************************/
26
#define TEGRA_SIP_ENABLE_FAKE_SYSTEM_SUSPEND		0xC2FFFE03
27
28
29
30

/*******************************************************************************
 * This function is responsible for handling all T186 SiP calls
 ******************************************************************************/
31
int32_t plat_sip_handler(uint32_t smc_fid,
32
33
34
35
		     uint64_t x1,
		     uint64_t x2,
		     uint64_t x3,
		     uint64_t x4,
36
		     const void *cookie,
37
38
39
		     void *handle,
		     uint64_t flags)
{
40
	int32_t ret = -ENOTSUP;
41

42
	(void)x1;
43
44
45
	(void)x4;
	(void)cookie;
	(void)flags;
46

47
	if (smc_fid == TEGRA_SIP_ENABLE_FAKE_SYSTEM_SUSPEND) {
48
		/*
49
50
51
52
53
54
		 * System suspend mode is set if the platform ATF is
		 * running on VDK and there is a debug SIP call. This mode
		 * ensures that the debug path is exercised, instead of
		 * regular code path to suit the pre-silicon platform needs.
		 * This includes replacing the call to WFI, with calls to
		 * system suspend exit procedures.
55
56
57
		 */
		if (tegra_platform_is_virt_dev_kit()) {
			tegra_fake_system_suspend = true;
58
			ret = 0;
59
		}
60
61
	}

62
	return ret;
63
}