0001
0002
0003
0004
0005
0006 #ifndef CORESIGHT_SYSCFG_H
0007 #define CORESIGHT_SYSCFG_H
0008
0009 #include <linux/configfs.h>
0010 #include <linux/coresight.h>
0011 #include <linux/device.h>
0012
0013 #include "coresight-config.h"
0014
0015
0016
0017
0018
0019
0020 enum cscfg_load_ops {
0021 CSCFG_NONE,
0022 CSCFG_LOAD,
0023 CSCFG_UNLOAD
0024 };
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 struct cscfg_manager {
0047 struct device dev;
0048 struct list_head csdev_desc_list;
0049 struct list_head feat_desc_list;
0050 struct list_head config_desc_list;
0051 struct list_head load_order_list;
0052 atomic_t sys_active_cnt;
0053 struct configfs_subsystem cfgfs_subsys;
0054 u32 sysfs_active_config;
0055 int sysfs_active_preset;
0056 enum cscfg_load_ops load_state;
0057 };
0058
0059
0060 struct device *cscfg_device(void);
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071 struct cscfg_registered_csdev {
0072 struct coresight_device *csdev;
0073 u32 match_flags;
0074 struct cscfg_csdev_feat_ops ops;
0075 struct list_head item;
0076 };
0077
0078
0079 enum cscfg_load_owner_type {
0080 CSCFG_OWNER_PRELOAD,
0081 CSCFG_OWNER_MODULE,
0082 };
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095 struct cscfg_load_owner_info {
0096 struct list_head item;
0097 int type;
0098 void *owner_handle;
0099 };
0100
0101
0102 int __init cscfg_init(void);
0103 void cscfg_exit(void);
0104 int cscfg_preload(void *owner_handle);
0105 const struct cscfg_feature_desc *cscfg_get_named_feat_desc(const char *name);
0106 int cscfg_update_feat_param_val(struct cscfg_feature_desc *feat_desc,
0107 int param_idx, u64 value);
0108 int cscfg_config_sysfs_activate(struct cscfg_config_desc *cfg_desc, bool activate);
0109 void cscfg_config_sysfs_set_preset(int preset);
0110
0111
0112 int cscfg_load_config_sets(struct cscfg_config_desc **cfg_descs,
0113 struct cscfg_feature_desc **feat_descs,
0114 struct cscfg_load_owner_info *owner_info);
0115 int cscfg_unload_config_sets(struct cscfg_load_owner_info *owner_info);
0116 int cscfg_register_csdev(struct coresight_device *csdev, u32 match_flags,
0117 struct cscfg_csdev_feat_ops *ops);
0118 void cscfg_unregister_csdev(struct coresight_device *csdev);
0119 int cscfg_activate_config(unsigned long cfg_hash);
0120 void cscfg_deactivate_config(unsigned long cfg_hash);
0121 void cscfg_csdev_reset_feats(struct coresight_device *csdev);
0122 int cscfg_csdev_enable_active_config(struct coresight_device *csdev,
0123 unsigned long cfg_hash, int preset);
0124 void cscfg_csdev_disable_active_config(struct coresight_device *csdev);
0125 void cscfg_config_sysfs_get_active_cfg(unsigned long *cfg_hash, int *preset);
0126
0127 #endif