1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 /* $FreeBSD$ */
4 #ifndef ADF_CFG_H_
5 #define ADF_CFG_H_
6
7 #include <linux/rwsem.h>
8 #include "adf_accel_devices.h"
9 #include "adf_cfg_common.h"
10 #include "adf_cfg_strings.h"
11
12 struct adf_cfg_key_val {
13 char key[ADF_CFG_MAX_KEY_LEN_IN_BYTES];
14 char val[ADF_CFG_MAX_VAL_LEN_IN_BYTES];
15 enum adf_cfg_val_type type;
16 struct list_head list;
17 };
18
19 struct adf_cfg_section {
20 char name[ADF_CFG_MAX_SECTION_LEN_IN_BYTES];
21 bool processed;
22 bool is_derived;
23 struct list_head list;
24 struct list_head param_head;
25 };
26
27 struct adf_cfg_device_data {
28 struct adf_cfg_device *dev;
29 struct list_head sec_list;
30 struct sysctl_oid *debug;
31 struct sx lock;
32 };
33
34 struct adf_cfg_depot_list {
35 struct list_head sec_list;
36 };
37
38 int adf_cfg_dev_add(struct adf_accel_dev *accel_dev);
39 void adf_cfg_dev_remove(struct adf_accel_dev *accel_dev);
40 int adf_cfg_depot_restore_all(struct adf_accel_dev *accel_dev,
41 struct adf_cfg_depot_list *dev_hp_cfg);
42 int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name);
43 void adf_cfg_del_all(struct adf_accel_dev *accel_dev);
44 void adf_cfg_depot_del_all(struct list_head *head);
45 int adf_cfg_add_key_value_param(struct adf_accel_dev *accel_dev,
46 const char *section_name,
47 const char *key,
48 const void *val,
49 enum adf_cfg_val_type type);
50 int adf_cfg_get_param_value(struct adf_accel_dev *accel_dev,
51 const char *section,
52 const char *name,
53 char *value);
54 int adf_cfg_save_section(struct adf_accel_dev *accel_dev,
55 const char *name,
56 struct adf_cfg_section *section);
57 int adf_cfg_depot_save_all(struct adf_accel_dev *accel_dev,
58 struct adf_cfg_depot_list *dev_hp_cfg);
59 struct adf_cfg_section *adf_cfg_sec_find(struct adf_accel_dev *accel_dev,
60 const char *sec_name);
61 int adf_cfg_derived_section_add(struct adf_accel_dev *accel_dev,
62 const char *name);
63 int adf_cfg_remove_key_param(struct adf_accel_dev *accel_dev,
64 const char *section_name,
65 const char *key);
66 int adf_cfg_setup_irq(struct adf_accel_dev *accel_dev);
67 void adf_cfg_set_asym_rings_mask(struct adf_accel_dev *accel_dev);
68 void adf_cfg_gen_dispatch_arbiter(struct adf_accel_dev *accel_dev,
69 const u32 *thrd_to_arb_map,
70 u32 *thrd_to_arb_map_gen,
71 u32 total_engines);
72 int adf_cfg_get_fw_image_type(struct adf_accel_dev *accel_dev,
73 enum adf_cfg_fw_image_type *fw_image_type);
74 int adf_cfg_get_services_enabled(struct adf_accel_dev *accel_dev,
75 u16 *ring_to_svc_map);
76 int adf_cfg_restore_section(struct adf_accel_dev *accel_dev,
77 struct adf_cfg_section *section);
78 void adf_cfg_keyval_del_all(struct list_head *head);
79
80 static inline int
81 adf_cy_inst_cross_banks(struct adf_accel_dev *accel_dev)
82 {
83 if (accel_dev->hw_device->num_rings_per_bank == 2)
84 return 1;
85 else
86 return 0;
87 }
88
89 #endif
Cache object: bc19a3d310807307133018bdf27d9b9c
|