Lines Matching +full:j +full:- +full:to +full:- +full:k
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
3 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
15 int i = 0, j = 0, k = 0; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes() local
18 * to an ordered local array in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
20 for (i = 0; i < fm_ext_pools->num_of_pools_used; i++) { in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
22 buf_size = fm_ext_pools->ext_buf_pool[i].size; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
24 /* keep sizes in an array according to poolId in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
27 sizes_array[fm_ext_pools->ext_buf_pool[i].id] = buf_size; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
29 /* save poolId in an ordered array according to size */ in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
30 for (j = 0; j <= i; j++) { in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
32 if (j == i) in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
34 fm_ext_pools->ext_buf_pool[i].id; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
37 if (buf_size < sizes_array[ordered_array[j]]) { in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
39 * to make room for this poolId in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
41 for (k = i; k > j; k--) in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
42 ordered_array[k] = in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
43 ordered_array[k - 1]; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
45 /* now k==j, this is the place for in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
48 ordered_array[k] = in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
49 fm_ext_pools->ext_buf_pool[i].id; in fman_sp_set_buf_pools_in_asc_order_of_buf_sizes()
68 /* Align start of internal context data to 16 byte */ in fman_sp_build_buffer_struct()
69 int_context_data_copy->ext_buf_offset = (u16) in fman_sp_build_buffer_struct()
70 ((buffer_prefix_content->priv_data_size & (OFFSET_UNITS - 1)) ? in fman_sp_build_buffer_struct()
71 ((buffer_prefix_content->priv_data_size + OFFSET_UNITS) & in fman_sp_build_buffer_struct()
72 ~(u16)(OFFSET_UNITS - 1)) : in fman_sp_build_buffer_struct()
73 buffer_prefix_content->priv_data_size); in fman_sp_build_buffer_struct()
75 /* Translate margin and int_context params to FM parameters */ in fman_sp_build_buffer_struct()
77 buffer_offsets->prs_result_offset = (u32)ILLEGAL_BASE; in fman_sp_build_buffer_struct()
78 buffer_offsets->time_stamp_offset = (u32)ILLEGAL_BASE; in fman_sp_build_buffer_struct()
79 buffer_offsets->hash_result_offset = (u32)ILLEGAL_BASE; in fman_sp_build_buffer_struct()
84 * relate to it as 1). in fman_sp_build_buffer_struct()
89 /* Copy size must be in 16-byte granularity. */ in fman_sp_build_buffer_struct()
90 int_context_data_copy->size = in fman_sp_build_buffer_struct()
91 (u16)((buffer_prefix_content->pass_prs_result ? 32 : 0) + in fman_sp_build_buffer_struct()
92 ((buffer_prefix_content->pass_time_stamp || in fman_sp_build_buffer_struct()
93 buffer_prefix_content->pass_hash_result) ? 16 : 0)); in fman_sp_build_buffer_struct()
95 /* Align start of internal context data to 16 byte */ in fman_sp_build_buffer_struct()
96 int_context_data_copy->int_context_offset = in fman_sp_build_buffer_struct()
97 (u8)(buffer_prefix_content->pass_prs_result ? 32 : in fman_sp_build_buffer_struct()
98 ((buffer_prefix_content->pass_time_stamp || in fman_sp_build_buffer_struct()
99 buffer_prefix_content->pass_hash_result) ? 64 : 0)); in fman_sp_build_buffer_struct()
101 if (buffer_prefix_content->pass_prs_result) in fman_sp_build_buffer_struct()
102 buffer_offsets->prs_result_offset = in fman_sp_build_buffer_struct()
103 int_context_data_copy->ext_buf_offset; in fman_sp_build_buffer_struct()
104 if (buffer_prefix_content->pass_time_stamp) in fman_sp_build_buffer_struct()
105 buffer_offsets->time_stamp_offset = in fman_sp_build_buffer_struct()
106 buffer_prefix_content->pass_prs_result ? in fman_sp_build_buffer_struct()
107 (int_context_data_copy->ext_buf_offset + in fman_sp_build_buffer_struct()
109 int_context_data_copy->ext_buf_offset; in fman_sp_build_buffer_struct()
110 if (buffer_prefix_content->pass_hash_result) in fman_sp_build_buffer_struct()
114 buffer_offsets->hash_result_offset = in fman_sp_build_buffer_struct()
115 buffer_prefix_content->pass_prs_result ? in fman_sp_build_buffer_struct()
116 (int_context_data_copy->ext_buf_offset + in fman_sp_build_buffer_struct()
118 int_context_data_copy->ext_buf_offset + 8; in fman_sp_build_buffer_struct()
120 if (int_context_data_copy->size) in fman_sp_build_buffer_struct()
121 buf_margins->start_margins = in fman_sp_build_buffer_struct()
122 (u16)(int_context_data_copy->ext_buf_offset + in fman_sp_build_buffer_struct()
123 int_context_data_copy->size); in fman_sp_build_buffer_struct()
128 buf_margins->start_margins = in fman_sp_build_buffer_struct()
129 buffer_prefix_content->priv_data_size; in fman_sp_build_buffer_struct()
132 tmp = (u32)(buf_margins->start_margins % in fman_sp_build_buffer_struct()
133 buffer_prefix_content->data_align); in fman_sp_build_buffer_struct()
135 buf_margins->start_margins += in fman_sp_build_buffer_struct()
136 (buffer_prefix_content->data_align - tmp); in fman_sp_build_buffer_struct()
137 buffer_offsets->data_offset = buf_margins->start_margins; in fman_sp_build_buffer_struct()