qcom: common_log: add support to dump VSENSE registers

Allocate memory to dump VSENSE registers at the time of crash.

Change-Id: Ibd896873bc40b723071c66ca7cf1a4bc9b38ad5e
Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
This commit is contained in:
Shashank Mittal 2015-05-20 14:37:36 -07:00 committed by Jeevan Shriram
parent ef0aa942f0
commit eb3bb2fc33
2 changed files with 39 additions and 2 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -20,6 +20,7 @@
#define MISC_DUMP_DATA_LEN 4096
#define PMIC_DUMP_DATA_LEN 4096
#define VSENSE_DUMP_DATA_LEN 4096
void register_misc_dump(void)
{
@ -84,6 +85,40 @@ err0:
}
}
static void register_vsense_dump(void)
{
static void *dump_addr;
int ret;
struct msm_dump_entry dump_entry;
struct msm_dump_data *dump_data;
if (MSM_DUMP_MAJOR(msm_dump_table_version()) > 1) {
dump_data = kzalloc(sizeof(struct msm_dump_data), GFP_KERNEL);
if (!dump_data) {
pr_err("dump data structure allocation failed for vsense data\n");
return;
}
dump_addr = kzalloc(VSENSE_DUMP_DATA_LEN, GFP_KERNEL);
if (!dump_addr)
goto err0;
dump_data->addr = virt_to_phys(dump_addr);
dump_data->len = VSENSE_DUMP_DATA_LEN;
dump_entry.id = MSM_DUMP_DATA_VSENSE;
dump_entry.addr = virt_to_phys(dump_data);
ret = msm_dump_data_register(MSM_DUMP_TABLE_APPS, &dump_entry);
if (ret) {
pr_err("Registering vsense dump region failed\n");
goto err1;
}
return;
err1:
kfree(dump_addr);
err0:
kfree(dump_data);
}
}
static void __init common_log_register_log_buf(void)
{
char **log_bufp;
@ -148,6 +183,7 @@ static int __init msm_common_log_init(void)
common_log_register_log_buf();
register_misc_dump();
register_pmic_dump();
register_vsense_dump();
return 0;
}
late_initcall(msm_common_log_init);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -77,6 +77,7 @@ enum msm_dump_data_ids {
MSM_DUMP_DATA_PMIC = 0xE4,
MSM_DUMP_DATA_DBGUI_REG = 0xE5,
MSM_DUMP_DATA_MISC = 0xE8,
MSM_DUMP_DATA_VSENSE = 0xE9,
MSM_DUMP_DATA_TMC_ETF = 0xF0,
MSM_DUMP_DATA_TMC_REG = 0x100,
MSM_DUMP_DATA_LOG_BUF = 0x110,