soc: rockchip: sip: support get ddr map information

Change-Id: I3d96443d8cdfbd303d0b2dddaae04d508b2ce5f2
Signed-off-by: Simon Xue <xxm@rock-chips.com>
This commit is contained in:
Simon Xue 2021-12-30 09:24:35 +08:00 committed by Tao Huang
parent 7d2237b0ad
commit b0c33de198
3 changed files with 47 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <linux/ptrace.h>
#include <linux/sched/clock.h>
#include <linux/slab.h>
#include <soc/rockchip/rockchip_sip.h>
#ifdef CONFIG_64BIT
#define PSCI_FN_NATIVE(version, name) PSCI_##version##_FN64_##name
@ -205,6 +206,35 @@ struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2)
}
EXPORT_SYMBOL_GPL(sip_smc_bus_config);
struct dram_addrmap_info *sip_smc_get_dram_map(void)
{
struct arm_smccc_res res;
static struct dram_addrmap_info *map;
if (map)
return map;
/* Request share memory size 4KB */
res = sip_smc_request_share_mem(1, SHARE_PAGE_TYPE_DDR_ADDRMAP);
if (res.a0 != 0) {
pr_err("no ATF memory for init\n");
return NULL;
}
map = (struct dram_addrmap_info *)res.a1;
res = sip_smc_dram(SHARE_PAGE_TYPE_DDR_ADDRMAP, 0,
ROCKCHIP_SIP_CONFIG_DRAM_ADDRMAP_GET);
if (res.a0) {
pr_err("rockchip_sip_config_dram_init error:%lx\n", res.a0);
map = NULL;
return NULL;
}
return map;
}
EXPORT_SYMBOL_GPL(sip_smc_get_dram_map);
struct arm_smccc_res sip_smc_lastlog_request(void)
{
struct arm_smccc_res res;

View File

@ -109,6 +109,16 @@
/* wakeup state */
#define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf
struct dram_addrmap_info {
u64 ch_mask[2];
u64 bk_mask[4];
u64 bg_mask[2];
u64 cs_mask[2];
u32 reserved[20];
u32 bank_bit_first;
u32 bank_bit_mask;
};
enum {
FIRMWARE_NONE,
FIRMWARE_TEE_32BIT,
@ -125,6 +135,7 @@ typedef enum {
SHARE_PAGE_TYPE_DDRDBG,
SHARE_PAGE_TYPE_DDRECC,
SHARE_PAGE_TYPE_DDRFSP,
SHARE_PAGE_TYPE_DDR_ADDRMAP,
SHARE_PAGE_TYPE_LAST_LOG,
SHARE_PAGE_TYPE_MAX,
} share_page_type_t;
@ -153,6 +164,7 @@ int sip_smc_remotectl_config(u32 func, u32 data);
int sip_smc_secure_reg_write(u32 addr_phy, u32 val);
u32 sip_smc_secure_reg_read(u32 addr_phy);
struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2);
struct dram_addrmap_info *sip_smc_get_dram_map(void);
/***************************fiq debugger **************************************/
void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu);
@ -229,6 +241,10 @@ static inline int sip_smc_soc_bus_div(u32 arg0, u32 arg1, u32 arg2)
{
return 0;
}
static inline struct dram_addrmap_info *sip_smc_get_dram_map(void)
{
return NULL;
}
/***************************fiq debugger **************************************/
static inline void sip_fiq_debugger_enable_fiq

View File

@ -21,5 +21,6 @@
#define ROCKCHIP_SIP_CONFIG_DRAM_DEBUG 0x0b
#define ROCKCHIP_SIP_CONFIG_MCU_START 0x0c
#define ROCKCHIP_SIP_CONFIG_DRAM_GET_FREQ_INFO 0x0e
#define ROCKCHIP_SIP_CONFIG_DRAM_ADDRMAP_GET 0x10
#endif