1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 /* Copyright(c) 2007-2022 Intel Corporation */ 3 /* $FreeBSD$ */ 4 #ifndef ADF_CFG_BUNDLE_H_ 5 #define ADF_CFG_BUNDLE_H_ 6 7 #include "adf_accel_devices.h" 8 #include "adf_cfg_common.h" 9 10 #define MAX_SECTIONS_PER_BUNDLE 8 11 #define MAX_SECTION_NAME_LEN 64 12 13 #define TX 0x0 14 #define RX 0x1 15 16 #define ASSIGN_SERV_TO_RINGS(bund, index, base, stype, rng_per_srv) \ 17 do { \ 18 int j = 0; \ 19 typeof(bund) b = (bund); \ 20 typeof(index) i = (index); \ 21 typeof(base) s = (base); \ 22 typeof(stype) t = (stype); \ 23 typeof(rng_per_srv) rps = (rng_per_srv); \ 24 for (j = 0; j < rps; j++) { \ 25 b->rings[i + j]->serv_type = t; \ 26 b->rings[i + j + s]->serv_type = t; \ 27 } \ 28 } while (0) 29 30 bool adf_cfg_is_free(struct adf_cfg_bundle *bundle); 31 32 int adf_cfg_get_ring_pairs_from_bundle(struct adf_cfg_bundle *bundle, 33 struct adf_cfg_instance *inst, 34 const char *process_name, 35 struct adf_cfg_instance *bundle_inst); 36 37 struct adf_cfg_instance * 38 adf_cfg_get_free_instance(struct adf_cfg_device *device, 39 struct adf_cfg_bundle *bundle, 40 struct adf_cfg_instance *inst, 41 const char *process_name); 42 43 int adf_cfg_bundle_init(struct adf_cfg_bundle *bundle, 44 struct adf_cfg_device *device, 45 int bank_num, 46 struct adf_accel_dev *accel_dev); 47 48 void adf_cfg_bundle_clear(struct adf_cfg_bundle *bundle, 49 struct adf_accel_dev *accel_dev); 50 51 void adf_cfg_init_ring2serv_mapping(struct adf_accel_dev *accel_dev, 52 struct adf_cfg_bundle *bundle); 53 54 int adf_cfg_rel_ring2serv_mapping(struct adf_cfg_bundle *bundle); 55 #endif 56