Path: blob/main/sys/contrib/ncsw/inc/flib/fsl_fman_sp.h
48375 views
/*1* Copyright 2013 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/3132#ifndef __FSL_FMAN_SP_H33#define __FSL_FMAN_SP_H3435#include "common/general.h"36#include "fsl_fman.h"373839struct fm_pcd_storage_profile_regs{40uint32_t fm_sp_ebmpi[8];41/*offset 0 - 0xc*/42/**< Buffer Manager pool Information */4344uint32_t fm_sp_acnt; /*offset 0x20*/45uint32_t fm_sp_ebm; /*offset 0x24*/46uint32_t fm_sp_da; /*offset 0x28*/47uint32_t fm_sp_icp; /*offset 0x2c*/48uint32_t fm_sp_mpd; /*offset 0x30*/49uint32_t res1[2]; /*offset 0x34 - 0x38*/50uint32_t fm_sp_spliodn; /*offset 0x3c*/51};5253/**************************************************************************//**54@Description structure for defining internal context copying55*//***************************************************************************/56struct fman_sp_int_context_data_copy{57uint16_t ext_buf_offset; /**< Offset in External buffer to which58internal context is copied to (Rx)59or taken from (Tx, Op). */60uint8_t int_context_offset; /**< Offset within internal context to copy61from (Rx) or to copy to (Tx, Op).*/62uint16_t size; /**< Internal offset size to be copied */63};6465/**************************************************************************//**66@Description struct for defining external buffer margins67*//***************************************************************************/68struct fman_sp_buf_margins{69uint16_t start_margins; /**< Number of bytes to be left at the70beginning of the external buffer (must be71divisible by 16) */72uint16_t end_margins; /**< number of bytes to be left at the end of73the external buffer(must be divisible by 16)*/74};7576struct fm_storage_profile_params {77struct fman_ext_pools fm_ext_pools;78struct fman_backup_bm_pools backup_pools;79struct fman_sp_int_context_data_copy *int_context;80struct fman_sp_buf_margins *buf_margins;81enum fman_dma_swap_option dma_swap_data;82enum fman_dma_cache_option int_context_cache_attr;83enum fman_dma_cache_option header_cache_attr;84enum fman_dma_cache_option scatter_gather_cache_attr;85bool dma_write_optimize;86uint16_t liodn_offset;87bool no_scather_gather;88struct fman_buf_pool_depletion buf_pool_depletion;89};9091/**************************************************************************//**92@Description Registers bit fields93*//***************************************************************************/94#define FMAN_SP_EXT_BUF_POOL_EN_COUNTER 0x4000000095#define FMAN_SP_EXT_BUF_POOL_VALID 0x8000000096#define FMAN_SP_EXT_BUF_POOL_BACKUP 0x2000000097#define FMAN_SP_DMA_ATTR_WRITE_OPTIMIZE 0x0010000098#define FMAN_SP_SG_DISABLE 0x8000000099100/* shifts */101#define FMAN_SP_EXT_BUF_POOL_ID_SHIFT 16102#define FMAN_SP_POOL_DEP_NUM_OF_POOLS_SHIFT 16103#define FMAN_SP_EXT_BUF_MARG_START_SHIFT 16104#define FMAN_SP_EXT_BUF_MARG_END_SHIFT 0105#define FMAN_SP_DMA_ATTR_SWP_SHIFT 30106#define FMAN_SP_DMA_ATTR_IC_CACHE_SHIFT 28107#define FMAN_SP_DMA_ATTR_HDR_CACHE_SHIFT 26108#define FMAN_SP_DMA_ATTR_SG_CACHE_SHIFT 24109#define FMAN_SP_IC_TO_EXT_SHIFT 16110#define FMAN_SP_IC_FROM_INT_SHIFT 8111#define FMAN_SP_IC_SIZE_SHIFT 0112113/**************************************************************************//**114@Description defaults115*//***************************************************************************/116#define DEFAULT_FMAN_SP_DMA_SWAP_DATA FMAN_DMA_NO_SWP117#define DEFAULT_FMAN_SP_DMA_INT_CONTEXT_CACHE_ATTR FMAN_DMA_NO_STASH118#define DEFAULT_FMAN_SP_DMA_HEADER_CACHE_ATTR FMAN_DMA_NO_STASH119#define DEFAULT_FMAN_SP_DMA_SCATTER_GATHER_CACHE_ATTR FMAN_DMA_NO_STASH120#define DEFAULT_FMAN_SP_DMA_WRITE_OPTIMIZE TRUE121#define DEFAULT_FMAN_SP_NO_SCATTER_GATHER FALSE122123void fman_vsp_defconfig(struct fm_storage_profile_params *cfg);124125void fman_vsp_init(struct fm_pcd_storage_profile_regs *regs,126uint16_t index, struct fm_storage_profile_params *fm_vsp_params,127int port_max_num_of_ext_pools, int bm_max_num_of_pools,128int max_num_of_pfc_priorities);129130uint32_t fman_vsp_get_statistics(struct fm_pcd_storage_profile_regs *regs,131uint16_t index);132133void fman_vsp_set_statistics(struct fm_pcd_storage_profile_regs *regs,134uint16_t index, uint32_t value);135136137#endif /* __FSL_FMAN_SP_H */138139140