Path: blob/main/sys/contrib/ncsw/Peripherals/BM/bman_private.h
48375 views
/******************************************************************************12� 1995-2003, 2004, 2005-2011 Freescale Semiconductor, Inc.3All rights reserved.45This is proprietary source code of Freescale Semiconductor Inc.,6and its use is subject to the NetComm Device Drivers EULA.7The copyright notice above does not evidence any actual or intended8publication of such source code.910ALTERNATIVELY, redistribution and use in source and binary forms, with11or without modification, are permitted provided that the following12conditions are met:13* Redistributions of source code must retain the above copyright14notice, this list of conditions and the following disclaimer.15* Redistributions in binary form must reproduce the above copyright16notice, this list of conditions and the following disclaimer in the17documentation and/or other materials provided with the distribution.18* Neither the name of Freescale Semiconductor nor the19names of its contributors may be used to endorse or promote products20derived from this software without specific prior written permission.2122THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY23EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED24WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE25DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY26DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES27(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;28LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND29ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT30(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS31SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.32*3334**************************************************************************/35/******************************************************************************36@File bman_private.h3738@Description BM header39*//***************************************************************************/40#ifndef __BMAN_PRIV_H41#define __BMAN_PRIV_H4243#include "fsl_bman.h"4445#define __ERR_MODULE__ MODULE_BM4647#if defined(DEBUG) || !defined(DISABLE_ASSERTIONS)48/* Optionally compile-in assertion-checking */49#define BM_CHECKING50#endif /* defined(DEBUG) || ... */5152/* TODO: NB, we currently assume that CORE_MemoryBarier() and lwsync() imply compiler barriers53* and that dcbzl(), dcbfl(), and dcbi() won't fall victim to compiler or54* execution reordering with respect to other code/instructions that manipulate55* the same cacheline. */5657#define dcbf(addr) \58do { \59__asm__ __volatile__ ("dcbf 0, %0" : : "r" (addr)); \60} while(0)6162#ifdef CORE_E500MC63#define dcbt_ro(addr) \64do { \65__asm__ __volatile__ ("dcbt 0, %0" : : "r" (addr)); \66} while(0)6768#define dcbt_rw(addr) \69do { \70__asm__ __volatile__ ("dcbtst 0, %0" : : "r" (addr)); \71} while(0)7273#define dcbzl(p) \74do { \75__asm__ __volatile__ ("dcbzl 0,%0" : : "r" (p)); \76} while(0)7778#define dcbz_64(p) \79do { \80dcbzl(p); \81} while (0)8283#define dcbf_64(p) \84do { \85dcbf(p); \86} while (0)8788/* Commonly used combo */89#define dcbit_ro(p) \90do { \91dcbi(p); \92dcbt_ro(p); \93} while (0)9495#else9697#define dcbt_ro(p) \98do { \99__asm__ __volatile__ ("dcbt 0,%0" : : "r" (p)); \100lwsync(); \101} while(0)102#define dcbz(p) \103do { \104__asm__ __volatile__ ("dcbz 0,%0" : : "r" (p)); \105} while (0)106#define dcbz_64(p) \107do { \108dcbz((char *)p + 32); \109dcbz(p); \110} while (0)111#define dcbf_64(p) \112do { \113dcbf((char *)p + 32); \114dcbf(p); \115} while (0)116/* Commonly used combo */117#define dcbit_ro(p) \118do { \119dcbi(p); \120dcbi((char *)p + 32); \121dcbt_ro(p); \122dcbt_ro((char *)p + 32); \123} while (0)124125#endif /* CORE_E500MC */126127#define dcbi(p) dcbf(p)128129struct bm_addr {130void *addr_ce; /* cache-enabled */131void *addr_ci; /* cache-inhibited */132};133134/* RCR state */135struct bm_rcr {136struct bm_rcr_entry *ring, *cursor;137uint8_t ci, available, ithresh, vbit;138#ifdef BM_CHECKING139uint32_t busy;140e_BmPortalProduceMode pmode;141e_BmPortalRcrConsumeMode cmode;142#endif /* BM_CHECKING */143};144145/* MC state */146struct bm_mc {147struct bm_mc_command *cr;148struct bm_mc_result *rr;149uint8_t rridx, vbit;150#ifdef BM_CHECKING151enum {152/* Can only be _mc_start()ed */153mc_idle,154/* Can only be _mc_commit()ed or _mc_abort()ed */155mc_user,156/* Can only be _mc_retry()ed */157mc_hw158} state;159#endif /* BM_CHECKING */160};161162/********************/163/* Portal structure */164/********************/165166struct bm_portal {167struct bm_addr addr;168struct bm_rcr rcr;169struct bm_mc mc;170};171172173#endif /* __BMAN_PRIV_H */174175176