1 // SPDX-License-Identifier:    GPL-2.0
2 /*
3  * Copyright (C) 2018 Marvell International Ltd.
4  *
5  * https://spdx.org/licenses
6  */
7 
8 #include <asm/global_data.h>
9 #include <asm/io.h>
10 #include <asm/psci.h>
11 #include <asm/ptrace.h>
12 #include <asm/system.h>
13 #include <asm/arch/smc.h>
14 
15 DECLARE_GLOBAL_DATA_PTR;
16 
smc_dram_size(unsigned int node)17 ssize_t smc_dram_size(unsigned int node)
18 {
19 	struct pt_regs regs;
20 
21 	regs.regs[0] = OCTEONTX2_DRAM_SIZE;
22 	regs.regs[1] = node;
23 	smc_call(&regs);
24 
25 	return regs.regs[0];
26 }
27 
smc_disable_rvu_lfs(unsigned int node)28 ssize_t smc_disable_rvu_lfs(unsigned int node)
29 {
30 	struct pt_regs regs;
31 
32 	regs.regs[0] = OCTEONTX2_DISABLE_RVU_LFS;
33 	regs.regs[1] = node;
34 	smc_call(&regs);
35 
36 	return regs.regs[0];
37 }
38 
smc_configure_ooo(unsigned int val)39 ssize_t smc_configure_ooo(unsigned int val)
40 {
41 	struct pt_regs regs;
42 
43 	regs.regs[0] = OCTEONTX2_CONFIG_OOO;
44 	regs.regs[1] = val;
45 	smc_call(&regs);
46 
47 	return regs.regs[0];
48 }
49 
smc_flsf_fw_booted(void)50 ssize_t smc_flsf_fw_booted(void)
51 {
52 	struct pt_regs regs;
53 
54 	regs.regs[0] = OCTEONTX2_FSAFE_PR_BOOT_SUCCESS;
55 	smc_call(&regs);
56 
57 	return regs.regs[0];
58 }
59