1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright(C) 2020 Linaro Limited. All rights reserved.
4  * Author: Mike Leach <mike.leach@linaro.org>
5  */
6 
7 #include "coresight-cfg-preload.h"
8 #include "coresight-config.h"
9 #include "coresight-syscfg.h"
10 
11 /* Basic features and configurations pre-loaded on initialisation */
12 
13 static struct cscfg_feature_desc *preload_feats[] = {
14 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)
15 	&strobe_etm4x,
16 	&gen_etrig_etm4x,
17 #endif
18 	NULL
19 };
20 
21 static struct cscfg_config_desc *preload_cfgs[] = {
22 #if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM4X)
23 	&afdo_etm4x,
24 	&pstop_etm4x,
25 #endif
26 	NULL
27 };
28 
29 static struct cscfg_load_owner_info preload_owner = {
30 	.type = CSCFG_OWNER_PRELOAD,
31 };
32 
33 /* preload called on initialisation */
cscfg_preload(void * owner_handle)34 int cscfg_preload(void *owner_handle)
35 {
36 	preload_owner.owner_handle = owner_handle;
37 	return cscfg_load_config_sets(preload_cfgs, preload_feats, &preload_owner);
38 }
39