coresight-etm4x: add code to allocate memory for dump table
Add code to allocate and register memory dump entry for dumping etm registers. Change-Id: I0487e1c0d4e0fffc5df1456d53567762d7b18d51 Signed-off-by: Shashank Mittal <mittals@codeaurora.org>
This commit is contained in:
parent
14bc610d32
commit
ce3d488fbe
2 changed files with 42 additions and 0 deletions
|
@ -2548,6 +2548,41 @@ static void etm4_init_default_data(struct etmv4_drvdata *drvdata)
|
||||||
drvdata->trcid = 0x1 + drvdata->cpu;
|
drvdata->trcid = 0x1 + drvdata->cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int etm4_set_reg_dump(struct etmv4_drvdata *drvdata)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
void *baddr;
|
||||||
|
struct amba_device *adev;
|
||||||
|
struct resource *res;
|
||||||
|
struct device *dev = drvdata->dev;
|
||||||
|
struct msm_dump_entry dump_entry;
|
||||||
|
uint32_t size;
|
||||||
|
|
||||||
|
adev = to_amba_device(dev);
|
||||||
|
if (!adev)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
res = &adev->res;
|
||||||
|
size = resource_size(res);
|
||||||
|
|
||||||
|
baddr = devm_kzalloc(dev, size, GFP_KERNEL);
|
||||||
|
if (!baddr)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
drvdata->reg_data.addr = virt_to_phys(baddr);
|
||||||
|
drvdata->reg_data.len = size;
|
||||||
|
|
||||||
|
dump_entry.id = MSM_DUMP_DATA_ETM_REG + drvdata->cpu;
|
||||||
|
dump_entry.addr = virt_to_phys(&drvdata->reg_data);
|
||||||
|
|
||||||
|
ret = msm_dump_data_register(MSM_DUMP_TABLE_APPS,
|
||||||
|
&dump_entry);
|
||||||
|
if (ret)
|
||||||
|
devm_kfree(dev, baddr);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int etm4_late_init(struct etmv4_drvdata *drvdata)
|
static int etm4_late_init(struct etmv4_drvdata *drvdata)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -2559,6 +2594,10 @@ static int etm4_late_init(struct etmv4_drvdata *drvdata)
|
||||||
|
|
||||||
etm4_init_default_data(drvdata);
|
etm4_init_default_data(drvdata);
|
||||||
|
|
||||||
|
ret = etm4_set_reg_dump(drvdata);
|
||||||
|
if (ret)
|
||||||
|
dev_err(dev, "ETM REG dump setup failed. ret %d\n", ret);
|
||||||
|
|
||||||
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
|
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include "coresight-priv.h"
|
#include "coresight-priv.h"
|
||||||
|
#include <soc/qcom/memory_dump.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device registers:
|
* Device registers:
|
||||||
|
@ -283,6 +284,7 @@
|
||||||
* @ns_ex_level:In non-secure state, indicates whether instruction tracing is
|
* @ns_ex_level:In non-secure state, indicates whether instruction tracing is
|
||||||
* supported for the corresponding Exception level.
|
* supported for the corresponding Exception level.
|
||||||
* @ext_inp: External input selection.
|
* @ext_inp: External input selection.
|
||||||
|
* @reg_data: MSM memory dump data
|
||||||
*/
|
*/
|
||||||
struct etmv4_drvdata {
|
struct etmv4_drvdata {
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
@ -371,6 +373,7 @@ struct etmv4_drvdata {
|
||||||
u8 s_ex_level;
|
u8 s_ex_level;
|
||||||
u8 ns_ex_level;
|
u8 ns_ex_level;
|
||||||
u32 ext_inp;
|
u32 ext_inp;
|
||||||
|
struct msm_dump_data reg_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Address comparator access types */
|
/* Address comparator access types */
|
||||||
|
|
Loading…
Add table
Reference in a new issue