| 1 |
// SPDX-License-Identifier: GPL-2.0 |
| 2 |
/* |
| 3 |
* Copyright(C) 2023 Marvell. |
| 4 |
* Based on coresight-cfg-afdo.c |
| 5 |
*/ |
| 6 |
|
| 7 |
#include "coresight-config.h" |
| 8 |
|
| 9 |
/* ETMv4 includes and features */ |
| 10 |
#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) |
| 11 |
#include "coresight-etm4x-cfg.h" |
| 12 |
|
| 13 |
/* preload configurations and features */ |
| 14 |
|
| 15 |
/* preload in features for ETMv4 */ |
| 16 |
|
| 17 |
/* panic_stop feature */ |
| 18 |
static struct cscfg_parameter_desc gen_etrig_params[] = { |
| 19 |
{ |
| 20 |
.name = "address", |
| 21 |
.value = (u64)panic, |
| 22 |
}, |
| 23 |
}; |
| 24 |
|
| 25 |
static struct cscfg_regval_desc gen_etrig_regs[] = { |
| 26 |
/* resource selector */ |
| 27 |
{ |
| 28 |
.type = CS_CFG_REG_TYPE_RESOURCE, |
| 29 |
.offset = TRCRSCTLRn(2), |
| 30 |
.hw_info = ETM4_CFG_RES_SEL, |
| 31 |
.val32 = 0x40001, |
| 32 |
}, |
| 33 |
/* single address comparator */ |
| 34 |
{ |
| 35 |
.type = CS_CFG_REG_TYPE_RESOURCE | CS_CFG_REG_TYPE_VAL_64BIT | |
| 36 |
CS_CFG_REG_TYPE_VAL_PARAM, |
| 37 |
.offset = TRCACVRn(0), |
| 38 |
.val32 = 0x0, |
| 39 |
}, |
| 40 |
{ |
| 41 |
.type = CS_CFG_REG_TYPE_RESOURCE, |
| 42 |
.offset = TRCACATRn(0), |
| 43 |
.val64 = 0xf00, |
| 44 |
}, |
| 45 |
/* Driver external output[0] with comparator out */ |
| 46 |
{ |
| 47 |
.type = CS_CFG_REG_TYPE_RESOURCE, |
| 48 |
.offset = TRCEVENTCTL0R, |
| 49 |
.val32 = 0x2, |
| 50 |
}, |
| 51 |
/* end of regs */ |
| 52 |
}; |
| 53 |
|
| 54 |
struct cscfg_feature_desc gen_etrig_etm4x = { |
| 55 |
.name = "gen_etrig", |
| 56 |
.description = "Generate external trigger on address match\n" |
| 57 |
"parameter \'address\': address of kernel address\n", |
| 58 |
.match_flags = CS_CFG_MATCH_CLASS_SRC_ETM4, |
| 59 |
.nr_params = ARRAY_SIZE(gen_etrig_params), |
| 60 |
.params_desc = gen_etrig_params, |
| 61 |
.nr_regs = ARRAY_SIZE(gen_etrig_regs), |
| 62 |
.regs_desc = gen_etrig_regs, |
| 63 |
}; |
| 64 |
|
| 65 |
/* create a panic stop configuration */ |
| 66 |
|
| 67 |
/* the total number of parameters in used features */ |
| 68 |
#define PSTOP_NR_PARAMS ARRAY_SIZE(gen_etrig_params) |
| 69 |
|
| 70 |
static const char *pstop_ref_names[] = { |
| 71 |
"gen_etrig", |
| 72 |
}; |
| 73 |
|
| 74 |
struct cscfg_config_desc pstop_etm4x = { |
| 75 |
.name = "panicstop", |
| 76 |
.description = "Stop ETM on kernel panic\n", |
| 77 |
.nr_feat_refs = ARRAY_SIZE(pstop_ref_names), |
| 78 |
.feat_ref_names = pstop_ref_names, |
| 79 |
.nr_total_params = PSTOP_NR_PARAMS, |
| 80 |
}; |
| 81 |
|
| 82 |
/* end of ETM4x configurations */ |
| 83 |
#endif /* IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X) */ |