abc_spec_manager.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* abc_spec_manager.h
  2. *
  3. * Abnormal Behavior Catcher's spec manager module.
  4. *
  5. * Copyright 2021 Samsung Electronics
  6. *
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. */
  19. #ifndef SEC_ABC_SPEC_MANAGER_H
  20. #define SEC_ABC_SPEC_MANAGER_H
  21. #include <linux/sti/abc_common.h>
  22. #define ERROR_KEY "name_list"
  23. #define MODULE_KEY "module_list"
  24. #define THRESHOLD_CNT_KEY "threshold_cnt"
  25. #define THRESHOLD_TIME_KEY "threshold_time"
  26. extern struct list_head abc_spec_list;
  27. int abc_parse_dt(struct device *dev);
  28. void sec_abc_reset_event_buffer(struct abc_key_data *key_data);
  29. int sec_abc_make_key_data(struct abc_key_data *key_data, char *str);
  30. bool sec_abc_reached_spec(struct abc_key_data *key_data);
  31. void sec_abc_enqueue_event_data(struct abc_key_data *key_data);
  32. struct abc_common_spec_data *sec_abc_get_matched_common_spec(char *module_name, char *error_name);
  33. int sec_abc_get_buffer_size_from_threshold_cnt(int th_max);
  34. int sec_abc_parse_spec_cmd(char *str, struct abc_spec_cmd *abc_spec);
  35. int sec_abc_apply_changed_spec(char *module_name, char *error_name, char *spec);
  36. enum abc_event_group sec_abc_get_group(char *module, char *name);
  37. int sec_abc_apply_changed_group_spec(enum abc_event_group group, char *spec);
  38. int sec_abc_get_event_module(char *dst, char *src);
  39. int sec_abc_get_event_name(char *dst, char *src);
  40. int sec_abc_get_event_type(char *dst, char *src);
  41. int sec_abc_get_ext_log(char *dst, char *src);
  42. int sec_abc_get_count(int *dst, char *src);
  43. void sec_abc_reset_all_spec(void);
  44. void sec_abc_free_spec_buffer(void);
  45. void sec_abc_reset_all_buffer(void);
  46. /* spec_type1 */
  47. int abc_parse_dt_type1(struct device *dev,
  48. struct device_node *np, int idx,
  49. struct spec_data_type1 *spec_type1);
  50. bool sec_abc_is_full_type1(struct abc_event_buffer *buffer);
  51. bool sec_abc_is_empty_type1(struct abc_event_buffer *buffer);
  52. int sec_abc_get_diff_time_type1(struct abc_event_buffer *buffer);
  53. void sec_abc_reset_buffer_type1(struct spec_data_type1 *common_spec);
  54. struct abc_fault_info sec_abc_dequeue_type1(struct abc_event_buffer *buffer);
  55. void sec_abc_dequeue_event_data_type1(struct abc_common_spec_data *common_spec);
  56. void sec_abc_enqueue_type1(struct abc_event_buffer *buffer, struct abc_fault_info in);
  57. bool sec_abc_reached_spec_type1(struct abc_common_spec_data *common_spec, unsigned int cur_time);
  58. struct abc_common_spec_data *sec_abc_get_matched_common_spec_type1(char *module_name, char *error_name);
  59. void sec_abc_enqueue_event_data_type1(struct abc_common_spec_data *common_spec, unsigned int cur_time);
  60. int abc_alloc_memory_to_buffer_type1(struct spec_data_type1 *spec_type1, int size);
  61. #endif