1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
3 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
10 #include <linux/types.h>
12 #define ILLEGAL_BASE (~0)
15 #define DFLT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64
17 /* Registers bit fields */
18 #define FMAN_SP_EXT_BUF_POOL_EN_COUNTER 0x40000000
19 #define FMAN_SP_EXT_BUF_POOL_VALID 0x80000000
20 #define FMAN_SP_EXT_BUF_POOL_BACKUP 0x20000000
21 #define FMAN_SP_DMA_ATTR_WRITE_OPTIMIZE 0x00100000
22 #define FMAN_SP_SG_DISABLE 0x80000000
25 #define FMAN_SP_EXT_BUF_MARG_START_SHIFT 16
26 #define FMAN_SP_DMA_ATTR_SWP_SHIFT 30
27 #define FMAN_SP_IC_TO_EXT_SHIFT 16
28 #define FMAN_SP_IC_FROM_INT_SHIFT 8
30 /* structure for defining internal context copying */
31 struct fman_sp_int_context_data_copy {
32 /* < Offset in External buffer to which internal
33 * context is copied to (Rx) or taken from (Tx, Op).
36 /* Offset within internal context to copy from
37 * (Rx) or to copy to (Tx, Op).
39 u8 int_context_offset;
40 /* Internal offset size to be copied */
44 /* struct for defining external buffer margins */
45 struct fman_sp_buf_margins {
46 /* Number of bytes to be left at the beginning
47 * of the external buffer (must be divisible by 16)
50 /* number of bytes to be left at the end
51 * of the external buffer(must be divisible by 16)
56 struct fman_sp_buffer_offsets {
58 u32 prs_result_offset;
59 u32 time_stamp_offset;
60 u32 hash_result_offset;
63 int fman_sp_build_buffer_struct(struct fman_sp_int_context_data_copy
64 *int_context_data_copy,
65 struct fman_buffer_prefix_content
66 *buffer_prefix_content,
67 struct fman_sp_buf_margins *buf_margins,
68 struct fman_sp_buffer_offsets
70 u8 *internal_buf_offset);
72 void fman_sp_set_buf_pools_in_asc_order_of_buf_sizes(struct fman_ext_pools
77 #endif /* __FM_SP_H */