Date: Mon, 30 Oct 2017 03:41:04 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325118 - in head/sys: contrib/ncsw/Peripherals/BM contrib/ncsw/Peripherals/FM contrib/ncsw/Peripherals/FM/HC contrib/ncsw/Peripherals/FM/MAC contrib/ncsw/Peripherals/FM/MACSEC contrib/... Message-ID: <201710300341.v9U3f4T8029819@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Mon Oct 30 03:41:04 2017 New Revision: 325118 URL: https://svnweb.freebsd.org/changeset/base/325118 Log: Update DPAA SDK to SDK 2.0 This adds some support for ARM as well as 64-bit. 64-bit on PowerPC is currently not working, and ARM support has not been completed or tested on the FreeBSD side. As this was imported from a Linux tree, it includes some Linux-isms (ioread/iowrite), so compile with the LinuxKPI for now. This may change in the future. Added: head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_crc32.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_crc32.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_dtsec.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_dtsec_mii_acc.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_memac.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_memac_mii_acc.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/fman_tgec.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/memac.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/memac.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/memac_mii_acc.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MAC/memac_mii_acc.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/ head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_guest.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_master.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_master.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_secy.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/MACSEC/fm_macsec_secy.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/crc64.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_kg.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_plcr.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_prs.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_replic.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_replic.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fman_kg.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Pcd/fman_prs.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Port/fm_port_dsar.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Port/fman_port.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/Rtc/fman_rtc.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/SP/ head/sys/contrib/ncsw/Peripherals/FM/SP/fm_sp.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/SP/fm_sp.h (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/SP/fman_sp.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/fman_ncsw.c (contents, props changed) head/sys/contrib/ncsw/Peripherals/FM/inc/fm_sp_common.h (contents, props changed) head/sys/contrib/ncsw/inc/Peripherals/fm_macsec_ext.h (contents, props changed) head/sys/contrib/ncsw/inc/Peripherals/fm_vsp_ext.h (contents, props changed) head/sys/contrib/ncsw/inc/Peripherals/mii_acc_ext.h (contents, props changed) head/sys/contrib/ncsw/inc/cores/arm_ext.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/ head/sys/contrib/ncsw/inc/flib/common/ head/sys/contrib/ncsw/inc/flib/common/arch/ head/sys/contrib/ncsw/inc/flib/common/arch/ppc_access.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/common/general.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fman_common.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_enet.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_dtsec.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_dtsec_mii_acc.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_kg.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_memac.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_memac_mii_acc.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_port.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_prs.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_rtc.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_sp.h (contents, props changed) head/sys/contrib/ncsw/inc/flib/fsl_fman_tgec.h (contents, props changed) head/sys/contrib/ncsw/inc/xx_common.h (contents, props changed) Deleted: head/sys/contrib/ncsw/Peripherals/FM/fm_guest.c head/sys/contrib/ncsw/etc/sprint.c head/sys/contrib/ncsw/inc/math_ext.h Modified: head/sys/contrib/ncsw/Peripherals/BM/bm.h head/sys/contrib/ncsw/Peripherals/BM/bm_pool.c head/sys/contrib/ncsw/Peripherals/BM/bman_low.c head/sys/contrib/ncsw/Peripherals/BM/bman_private.h head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c head/sys/contrib/ncsw/Peripherals/FM/MAC/dtsec.c head/sys/contrib/ncsw/Peripherals/FM/MAC/dtsec.h head/sys/contrib/ncsw/Peripherals/FM/MAC/dtsec_mii_acc.c head/sys/contrib/ncsw/Peripherals/FM/MAC/dtsec_mii_acc.h head/sys/contrib/ncsw/Peripherals/FM/MAC/fm_mac.c head/sys/contrib/ncsw/Peripherals/FM/MAC/fm_mac.h head/sys/contrib/ncsw/Peripherals/FM/MAC/tgec.c head/sys/contrib/ncsw/Peripherals/FM/MAC/tgec.h head/sys/contrib/ncsw/Peripherals/FM/MAC/tgec_mii_acc.c head/sys/contrib/ncsw/Peripherals/FM/MAC/tgec_mii_acc.h head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_cc.h head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_kg.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_manip.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_manip.h head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_pcd.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_pcd.h head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_pcd_ipc.h head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_plcr.c head/sys/contrib/ncsw/Peripherals/FM/Pcd/fm_prs.c head/sys/contrib/ncsw/Peripherals/FM/Port/fm_port.c head/sys/contrib/ncsw/Peripherals/FM/Port/fm_port.h head/sys/contrib/ncsw/Peripherals/FM/Port/fm_port_im.c head/sys/contrib/ncsw/Peripherals/FM/Rtc/fm_rtc.c head/sys/contrib/ncsw/Peripherals/FM/Rtc/fm_rtc.h head/sys/contrib/ncsw/Peripherals/FM/fm.c head/sys/contrib/ncsw/Peripherals/FM/fm.h head/sys/contrib/ncsw/Peripherals/FM/fm_ipc.h head/sys/contrib/ncsw/Peripherals/FM/fm_muram.c head/sys/contrib/ncsw/Peripherals/FM/inc/fm_common.h head/sys/contrib/ncsw/Peripherals/FM/inc/fm_hc.h head/sys/contrib/ncsw/Peripherals/QM/fsl_qman.h head/sys/contrib/ncsw/Peripherals/QM/qm.c head/sys/contrib/ncsw/Peripherals/QM/qm.h head/sys/contrib/ncsw/Peripherals/QM/qm_portal_fqr.c head/sys/contrib/ncsw/Peripherals/QM/qman_low.h head/sys/contrib/ncsw/Peripherals/QM/qman_private.h head/sys/contrib/ncsw/etc/error.c head/sys/contrib/ncsw/etc/list.c head/sys/contrib/ncsw/etc/memcpy.c head/sys/contrib/ncsw/etc/mm.c head/sys/contrib/ncsw/etc/mm.h head/sys/contrib/ncsw/etc/ncsw_mem.c head/sys/contrib/ncsw/inc/Peripherals/bm_ext.h head/sys/contrib/ncsw/inc/Peripherals/crc_mac_addr_ext.h head/sys/contrib/ncsw/inc/Peripherals/dpaa_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_mac_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_muram_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_pcd_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_port_ext.h head/sys/contrib/ncsw/inc/Peripherals/fm_rtc_ext.h head/sys/contrib/ncsw/inc/Peripherals/qm_ext.h head/sys/contrib/ncsw/inc/core_ext.h head/sys/contrib/ncsw/inc/cores/e500v2_ext.h head/sys/contrib/ncsw/inc/cores/ppc_ext.h head/sys/contrib/ncsw/inc/ddr_std_ext.h head/sys/contrib/ncsw/inc/debug_ext.h head/sys/contrib/ncsw/inc/endian_ext.h head/sys/contrib/ncsw/inc/enet_ext.h head/sys/contrib/ncsw/inc/error_ext.h head/sys/contrib/ncsw/inc/etc/list_ext.h head/sys/contrib/ncsw/inc/etc/mem_ext.h head/sys/contrib/ncsw/inc/etc/memcpy_ext.h head/sys/contrib/ncsw/inc/etc/mm_ext.h head/sys/contrib/ncsw/inc/etc/sprint_ext.h head/sys/contrib/ncsw/inc/integrations/dpaa_integration_ext.h head/sys/contrib/ncsw/inc/integrations/part_ext.h head/sys/contrib/ncsw/inc/ncsw_ext.h head/sys/contrib/ncsw/inc/net_ext.h head/sys/contrib/ncsw/inc/std_ext.h head/sys/contrib/ncsw/inc/stdarg_ext.h head/sys/contrib/ncsw/inc/stdlib_ext.h head/sys/contrib/ncsw/inc/string_ext.h head/sys/contrib/ncsw/inc/types_ext.h head/sys/contrib/ncsw/inc/xx_ext.h head/sys/contrib/ncsw/user/env/xx.c head/sys/dev/dpaa/bman.c head/sys/dev/dpaa/fman.c head/sys/dev/dpaa/fman.h head/sys/dev/dpaa/fman_fdt.c head/sys/dev/dpaa/if_dtsec.c head/sys/dev/dpaa/if_dtsec_im.c head/sys/dev/dpaa/if_dtsec_rm.c head/sys/dev/dpaa/portals.h head/sys/powerpc/conf/dpaa/config.dpaa head/sys/powerpc/conf/dpaa/files.dpaa Modified: head/sys/contrib/ncsw/Peripherals/BM/bm.h ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bm.h Mon Oct 30 03:25:22 2017 (r325117) +++ head/sys/contrib/ncsw/Peripherals/BM/bm.h Mon Oct 30 03:41:04 2017 (r325118) @@ -41,6 +41,7 @@ #ifndef __BM_H #define __BM_H +#include "xx_common.h" #include "bm_ext.h" #include "mm_ext.h" @@ -261,7 +262,7 @@ typedef struct { t_Handle h_Bm; struct bm_portal *p_BmPortalLow; t_BmPortalCallbacks cbs[BM_NUM_OF_RINGS]; - int irq; + uintptr_t irq; int cpu; /* This is used for any "core-affine" portals, ie. default portals * associated to the corresponding cpu. -1 implies that there is no core * affinity configured. */ @@ -303,7 +304,7 @@ typedef struct { uint32_t exceptions; t_BmExceptionsCallback *f_Exception; t_Handle h_App; - int errIrq; /**< error interrupt line; NO_IRQ if interrupts not used */ + uintptr_t errIrq; /**< error interrupt line; NO_IRQ if interrupts not used */ t_BmDriverParams *p_BmDriverParams; } t_Bm; @@ -339,7 +340,7 @@ static __inline__ void BmCommit(t_BmPortal *p_BmPortal static __inline__ uint32_t BmBpidGet(t_Bm *p_Bm, bool force, uint32_t base) { uint64_t ans, size = 1; - uint32_t alignment = 1; + uint64_t alignment = 1; if (force) { @@ -347,7 +348,7 @@ static __inline__ uint32_t BmBpidGet(t_Bm *p_Bm, bool { ans = MM_GetForce(p_Bm->h_BpidMm, base, - (int)size, + size, "BM BPID MEM"); ans = base; } @@ -394,6 +395,7 @@ static __inline__ uint32_t BmBpidGet(t_Bm *p_Bm, bool size, alignment, "BM BPID MEM"); + KASSERT(ans < UINT32_MAX, ("Oops, %lx > UINT32_MAX!\n", ans)); return (uint32_t)ans; } Modified: head/sys/contrib/ncsw/Peripherals/BM/bm_pool.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bm_pool.c Mon Oct 30 03:25:22 2017 (r325117) +++ head/sys/contrib/ncsw/Peripherals/BM/bm_pool.c Mon Oct 30 03:41:04 2017 (r325118) @@ -545,26 +545,6 @@ t_Handle BM_POOL_GetBufferContext(t_Handle h_BmPool, v return *(t_Handle *)PTR_MOVE(p_Buff, -(sizeof(t_Handle))); } -void * BM_POOL_PhysToVirt(t_Handle h_BmPool, physAddress_t addr) -{ - t_BmPool *p_BmPool = (t_BmPool *)h_BmPool; - - SANITY_CHECK_RETURN_VALUE(p_BmPool, E_INVALID_HANDLE, NULL); - SANITY_CHECK_RETURN_VALUE(!p_BmPool->p_BmPoolDriverParams, E_INVALID_HANDLE, NULL); - - return p_BmPool->bufferPoolInfo.f_PhysToVirt(addr); -} - -physAddress_t BM_POOL_VirtToPhys(t_Handle h_BmPool, void *p_Buff) -{ - t_BmPool *p_BmPool = (t_BmPool *)h_BmPool; - - SANITY_CHECK_RETURN_VALUE(p_BmPool, E_INVALID_HANDLE, (physAddress_t)0); - SANITY_CHECK_RETURN_VALUE(!p_BmPool->p_BmPoolDriverParams, E_INVALID_HANDLE, (physAddress_t)0); - - return p_BmPool->bufferPoolInfo.f_VirtToPhys(p_Buff); -} - uint32_t BM_POOL_GetCounter(t_Handle h_BmPool, e_BmPoolCounters counter) { t_BmPool *p_BmPool = (t_BmPool *)h_BmPool; Modified: head/sys/contrib/ncsw/Peripherals/BM/bman_low.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bman_low.c Mon Oct 30 03:25:22 2017 (r325117) +++ head/sys/contrib/ncsw/Peripherals/BM/bman_low.c Mon Oct 30 03:41:04 2017 (r325118) @@ -38,6 +38,10 @@ @Description BM low-level implementation *//***************************************************************************/ +#include <sys/cdefs.h> +#include <sys/types.h> +#include <machine/atomic.h> + #include "std_ext.h" #include "core_ext.h" #include "xx_ext.h" @@ -259,7 +263,7 @@ void bm_rcr_pci_commit(struct bm_portal *portal, uint8 rcr->cursor->__dont_write_directly__verb = (uint8_t)(myverb | rcr->vbit); RCR_INC(rcr); rcr->available--; - hwsync(); + mb(); bm_out(RCR_PI_CINH, RCR_PTR2IDX(rcr->cursor)); #ifdef BM_CHECKING rcr->busy = 0; @@ -281,7 +285,7 @@ void bm_rcr_pce_commit(struct bm_portal *portal, uint8 rcr->cursor->__dont_write_directly__verb = (uint8_t)(myverb | rcr->vbit); RCR_INC(rcr); rcr->available--; - lwsync(); + wmb(); bm_cl_out(RCR_PI, RCR_PTR2IDX(rcr->cursor)); #ifdef BM_CHECKING rcr->busy = 0; @@ -294,7 +298,7 @@ void bm_rcr_pvb_commit(struct bm_portal *portal, uint8 struct bm_rcr_entry *rcursor; ASSERT_COND(rcr->busy); ASSERT_COND(rcr->pmode == e_BmPortalPVB); - lwsync(); + rmb(); rcursor = rcr->cursor; rcursor->__dont_write_directly__verb = (uint8_t)(myverb | rcr->vbit); dcbf_64(rcursor); @@ -432,7 +436,7 @@ void bm_mc_commit(struct bm_portal *portal, uint8_t my { register struct bm_mc *mc = &portal->mc; ASSERT_COND(mc->state == mc_user); - lwsync(); + rmb(); mc->cr->__dont_write_directly__verb = (uint8_t)(myverb | mc->vbit); dcbf_64(mc->cr); dcbit_ro(mc->rr + mc->rridx); Modified: head/sys/contrib/ncsw/Peripherals/BM/bman_private.h ============================================================================== --- head/sys/contrib/ncsw/Peripherals/BM/bman_private.h Mon Oct 30 03:25:22 2017 (r325117) +++ head/sys/contrib/ncsw/Peripherals/BM/bman_private.h Mon Oct 30 03:41:04 2017 (r325118) @@ -54,76 +54,13 @@ * and that dcbzl(), dcbfl(), and dcbi() won't fall victim to compiler or * execution reordering with respect to other code/instructions that manipulate * the same cacheline. */ -#ifdef CORE_E500MC -#if defined(_DIAB_TOOL) -#define hwsync() \ -do { \ -__asm__ __volatile__ ("sync"); \ -} while(0) - -#define lwsync() \ -do { \ -__asm__ __volatile__ ("lwsync"); \ -} while(0) - -__asm__ __volatile__ void dcbf (volatile void * addr) -{ -%reg addr - dcbf r0, addr -} - -__asm__ __volatile__ void dcbt_ro (volatile void * addr) -{ -%reg addr - dcbt r0, addr -} - -__asm__ __volatile__ void dcbt_rw (volatile void * addr) -{ -%reg addr - dcbtst r0, addr -} - -__asm__ __volatile__ void dcbzl (volatile void * addr) -{ -%reg addr - dcbzl r0, addr -} - -#define dcbz_64(p) \ - do { \ - dcbzl(p); \ - } while (0) - -#define dcbf_64(p) \ - do { \ - dcbf(p); \ - } while (0) - -/* Commonly used combo */ -#define dcbit_ro(p) \ - do { \ - dcbi(p); \ - dcbt_ro(p); \ - } while (0) - -#else /* GNU C */ -#define hwsync() \ - do { \ - __asm__ __volatile__ ("sync" : : : "memory"); \ - } while(0) - -#define lwsync() \ - do { \ - __asm__ __volatile__ ("lwsync" : : : "memory"); \ - } while(0) - #define dcbf(addr) \ do { \ __asm__ __volatile__ ("dcbf 0, %0" : : "r" (addr)); \ } while(0) +#ifdef CORE_E500MC #define dcbt_ro(addr) \ do { \ __asm__ __volatile__ ("dcbt 0, %0" : : "r" (addr)); \ @@ -156,46 +93,34 @@ __asm__ __volatile__ void dcbzl (volatile void * addr) dcbt_ro(p); \ } while (0) -#endif /* _DIAB_TOOL */ - #else -#define hwsync CORE_MemoryBarrier -#define lwsync hwsync -#define dcbf(p) \ - do { \ - __asm__ __volatile__ ("dcbf 0,%0" : : "r" (p)); \ - } while(0) #define dcbt_ro(p) \ do { \ __asm__ __volatile__ ("dcbt 0,%0" : : "r" (p)); \ lwsync(); \ } while(0) -#define dcbt_rw(p) \ - do { \ - __asm__ __volatile__ ("dcbtst 0,%0" : : "r" (p)); \ - } while(0) #define dcbz(p) \ do { \ __asm__ __volatile__ ("dcbz 0,%0" : : "r" (p)); \ } while (0) #define dcbz_64(p) \ do { \ - dcbz((uint32_t)p + 32); \ + dcbz((char *)p + 32); \ dcbz(p); \ } while (0) #define dcbf_64(p) \ do { \ - dcbf((uint32_t)p + 32); \ + dcbf((char *)p + 32); \ dcbf(p); \ } while (0) /* Commonly used combo */ #define dcbit_ro(p) \ do { \ dcbi(p); \ - dcbi((uint32_t)p + 32); \ + dcbi((char *)p + 32); \ dcbt_ro(p); \ - dcbt_ro((uint32_t)p + 32); \ + dcbt_ro((char *)p + 32); \ } while (0) #endif /* CORE_E500MC */ Modified: head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c ============================================================================== --- head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c Mon Oct 30 03:25:22 2017 (r325117) +++ head/sys/contrib/ncsw/Peripherals/FM/HC/hc.c Mon Oct 30 03:41:04 2017 (r325118) @@ -1,5 +1,5 @@ -/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc. - * All rights reserved. +/* + * Copyright 2008-2012 Freescale Semiconductor Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -30,6 +30,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "std_ext.h" #include "error_ext.h" #include "sprint_ext.h" @@ -39,24 +40,54 @@ #include "fm_hc.h" +/**************************************************************************//** + @Description defaults +*//***************************************************************************/ +#define DEFAULT_dataMemId 0 + #define HC_HCOR_OPCODE_PLCR_PRFL 0x0 #define HC_HCOR_OPCODE_KG_SCM 0x1 #define HC_HCOR_OPCODE_SYNC 0x2 #define HC_HCOR_OPCODE_CC 0x3 +#define HC_HCOR_OPCODE_CC_AGE_MASK 0x4 #define HC_HCOR_OPCODE_CC_CAPWAP_REASSM_TIMEOUT 0x5 +#define HC_HCOR_OPCODE_CC_REASSM_TIMEOUT 0x10 +#define HC_HCOR_OPCODE_CC_IP_FRAG_INITIALIZATION 0x11 +#define HC_HCOR_OPCODE_CC_UPDATE_WITH_AGING 0x13 +#define HC_HCOR_ACTION_REG_REASSM_TIMEOUT_ACTIVE_SHIFT 24 +#define HC_HCOR_EXTRA_REG_REASSM_TIMEOUT_TSBS_SHIFT 24 +#define HC_HCOR_EXTRA_REG_CC_AGING_ADD 0x80000000 +#define HC_HCOR_EXTRA_REG_CC_AGING_REMOVE 0x40000000 +#define HC_HCOR_EXTRA_REG_CC_AGING_CHANGE_MASK 0xC0000000 +#define HC_HCOR_EXTRA_REG_CC_REMOVE_INDX_SHIFT 24 +#define HC_HCOR_EXTRA_REG_CC_REMOVE_INDX_MASK 0x1F000000 +#define HC_HCOR_ACTION_REG_REASSM_TIMEOUT_RES_SHIFT 16 +#define HC_HCOR_ACTION_REG_REASSM_TIMEOUT_RES_MASK 0xF +#define HC_HCOR_ACTION_REG_IP_FRAG_SCRATCH_POOL_CMD_SHIFT 24 +#define HC_HCOR_ACTION_REG_IP_FRAG_SCRATCH_POOL_BPID 16 #define HC_HCOR_GBL 0x20000000 -#define SIZE_OF_HC_FRAME_PORT_REGS (sizeof(t_HcFrame)-sizeof(t_FmPcdKgInterModuleSchemeRegs)+sizeof(t_FmPcdKgPortRegs)) +#define HC_HCOR_KG_SCHEME_COUNTER 0x00000400 + +#if (DPAA_VERSION == 10) +#define HC_HCOR_KG_SCHEME_REGS_MASK 0xFFFFF800 +#else +#define HC_HCOR_KG_SCHEME_REGS_MASK 0xFFFFFE00 +#endif /* (DPAA_VERSION == 10) */ + +#define SIZE_OF_HC_FRAME_PORT_REGS (sizeof(t_HcFrame)-sizeof(struct fman_kg_scheme_regs)+sizeof(t_FmPcdKgPortRegs)) #define SIZE_OF_HC_FRAME_SCHEME_REGS sizeof(t_HcFrame) -#define SIZE_OF_HC_FRAME_PROFILES_REGS (sizeof(t_HcFrame)-sizeof(t_FmPcdKgInterModuleSchemeRegs)+sizeof(t_FmPcdPlcrInterModuleProfileRegs)) -#define SIZE_OF_HC_FRAME_PROFILE_CNT (sizeof(t_HcFrame)-sizeof(t_FmPcdPlcrInterModuleProfileRegs)+sizeof(uint32_t)) +#define SIZE_OF_HC_FRAME_PROFILES_REGS (sizeof(t_HcFrame)-sizeof(struct fman_kg_scheme_regs)+sizeof(t_FmPcdPlcrProfileRegs)) +#define SIZE_OF_HC_FRAME_PROFILE_CNT (sizeof(t_HcFrame)-sizeof(t_FmPcdPlcrProfileRegs)+sizeof(uint32_t)) #define SIZE_OF_HC_FRAME_READ_OR_CC_DYNAMIC 16 +#define HC_CMD_POOL_SIZE (INTG_MAX_NUM_OF_CORES) + #define BUILD_FD(len) \ do { \ memset(&fmFd, 0, sizeof(t_DpaaFD)); \ - DPAA_FD_SET_ADDR(&fmFd, p_HcFrame); \ + DPAA_FD_SET_ADDR(&fmFd, p_HcFrame); \ DPAA_FD_SET_OFFSET(&fmFd, 0); \ DPAA_FD_SET_LENGTH(&fmFd, len); \ } while (0) @@ -65,50 +96,29 @@ do { \ #if defined(__MWERKS__) && !defined(__GNUC__) #pragma pack(push,1) #endif /* defined(__MWERKS__) && ... */ -#define MEM_MAP_START -/**************************************************************************//** - @Description PCD KG scheme registers -*//***************************************************************************/ -typedef _Packed struct t_FmPcdKgSchemeRegsWithoutCounter { - volatile uint32_t kgse_mode; /**< MODE */ - volatile uint32_t kgse_ekfc; /**< Extract Known Fields Command */ - volatile uint32_t kgse_ekdv; /**< Extract Known Default Value */ - volatile uint32_t kgse_bmch; /**< Bit Mask Command High */ - volatile uint32_t kgse_bmcl; /**< Bit Mask Command Low */ - volatile uint32_t kgse_fqb; /**< Frame Queue Base */ - volatile uint32_t kgse_hc; /**< Hash Command */ - volatile uint32_t kgse_ppc; /**< Policer Profile Command */ - volatile uint32_t kgse_gec[FM_PCD_KG_NUM_OF_GENERIC_REGS]; - /**< Generic Extract Command */ - volatile uint32_t kgse_dv0; /**< KeyGen Scheme Entry Default Value 0 */ - volatile uint32_t kgse_dv1; /**< KeyGen Scheme Entry Default Value 1 */ - volatile uint32_t kgse_ccbs; /**< KeyGen Scheme Entry Coarse Classification Bit*/ - volatile uint32_t kgse_mv; /**< KeyGen Scheme Entry Match vector */ -} _PackedType t_FmPcdKgSchemeRegsWithoutCounter; - -typedef _Packed struct t_FmPcdKgPortRegs { +typedef struct t_FmPcdKgPortRegs { volatile uint32_t spReg; volatile uint32_t cppReg; -} _PackedType t_FmPcdKgPortRegs; +} t_FmPcdKgPortRegs; -typedef _Packed struct t_HcFrame { +typedef struct t_HcFrame { volatile uint32_t opcode; volatile uint32_t actionReg; volatile uint32_t extraReg; volatile uint32_t commandSequence; union { - t_FmPcdKgInterModuleSchemeRegs schemeRegs; - t_FmPcdKgInterModuleSchemeRegs schemeRegsWithoutCounter; - t_FmPcdPlcrInterModuleProfileRegs profileRegs; + struct fman_kg_scheme_regs schemeRegs; + struct fman_kg_scheme_regs schemeRegsWithoutCounter; + t_FmPcdPlcrProfileRegs profileRegs; volatile uint32_t singleRegForWrite; /* for writing SP, CPP, profile counter */ t_FmPcdKgPortRegs portRegsForRead; volatile uint32_t clsPlanEntries[CLS_PLAN_NUM_PER_GRP]; t_FmPcdCcCapwapReassmTimeoutParams ccCapwapReassmTimeout; + t_FmPcdCcReassmTimeoutParams ccReassmTimeout; } hcSpecificData; -} _PackedType t_HcFrame; +} t_HcFrame; -#define MEM_MAP_END #if defined(__MWERKS__) && !defined(__GNUC__) #pragma pack(pop) #endif /* defined(__MWERKS__) && ... */ @@ -119,114 +129,108 @@ typedef struct t_FmHc { t_Handle h_HcPortDev; t_FmPcdQmEnqueueCallback *f_QmEnqueue; /**< A callback for enqueuing frames to the QM */ t_Handle h_QmArg; /**< A handle to the QM module */ - uint8_t padTill16; + uint8_t dataMemId; /**< Memory partition ID for data buffers */ - uint32_t seqNum; - volatile bool wait[32]; + uint32_t seqNum[HC_CMD_POOL_SIZE]; /* FIFO of seqNum to use when + taking buffer */ + uint32_t nextSeqNumLocation; /* seqNum location in seqNum[] for next buffer */ + volatile bool enqueued[HC_CMD_POOL_SIZE]; /* HC is active - frame is enqueued + and not confirmed yet */ + t_HcFrame *p_Frm[HC_CMD_POOL_SIZE]; } t_FmHc; -static __inline__ t_Error EnQFrm(t_FmHc *p_FmHc, t_DpaaFD *p_FmFd, volatile uint32_t *p_SeqNum) +static t_Error FillBufPool(t_FmHc *p_FmHc) { - t_Error err = E_OK; - uint32_t savedSeqNum; - uint32_t intFlags; - uint32_t timeout=100; + uint32_t i; - intFlags = FmPcdLock(p_FmHc->h_FmPcd); - *p_SeqNum = p_FmHc->seqNum; - savedSeqNum = p_FmHc->seqNum; - p_FmHc->seqNum = (uint32_t)((p_FmHc->seqNum+1)%32); - ASSERT_COND(!p_FmHc->wait[savedSeqNum]); - p_FmHc->wait[savedSeqNum] = TRUE; - FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); - DBG(TRACE, ("Send Hc, SeqNum %d, FD@0x%x, fd offset 0x%x", - savedSeqNum,DPAA_FD_GET_ADDR(p_FmFd),DPAA_FD_GET_OFFSET(p_FmFd))); - err = p_FmHc->f_QmEnqueue(p_FmHc->h_QmArg, (void *)p_FmFd); - if(err) - RETURN_ERROR(MINOR, err, ("HC enqueue failed")); + ASSERT_COND(p_FmHc); - while (p_FmHc->wait[savedSeqNum] && --timeout) - XX_UDelay(100); + for (i = 0; i < HC_CMD_POOL_SIZE; i++) + { +#ifdef FM_LOCKUP_ALIGNMENT_ERRATA_FMAN_SW004 + p_FmHc->p_Frm[i] = (t_HcFrame *)XX_MallocSmart((sizeof(t_HcFrame) + (16 - (sizeof(t_FmHc) % 16))), + p_FmHc->dataMemId, + 16); +#else + p_FmHc->p_Frm[i] = (t_HcFrame *)XX_MallocSmart(sizeof(t_HcFrame), + p_FmHc->dataMemId, + 16); +#endif /* FM_LOCKUP_ALIGNMENT_ERRATA_FMAN_SW004 */ + if (!p_FmHc->p_Frm[i]) + RETURN_ERROR(MAJOR, E_NO_MEMORY, ("FM HC frames!")); + } - if (!timeout) - RETURN_ERROR(MINOR, E_TIMEOUT, ("HC Callback, timeout exceeded")); + /* Initialize FIFO of seqNum to use during GetBuf */ + for (i = 0; i < HC_CMD_POOL_SIZE; i++) + { + p_FmHc->seqNum[i] = i; + } + p_FmHc->nextSeqNumLocation = 0; - return err; + return E_OK; } -static t_Error CcHcDoDynamicChange(t_FmHc *p_FmHc, t_Handle p_OldPointer, t_Handle p_NewPointer) +static __inline__ t_HcFrame * GetBuf(t_FmHc *p_FmHc, uint32_t *p_SeqNum) { - t_HcFrame *p_HcFrame; - t_DpaaFD fmFd; - t_Error err = E_OK; + uint32_t intFlags; ASSERT_COND(p_FmHc); - p_HcFrame = (t_HcFrame *)XX_MallocSmart((sizeof(t_HcFrame) + p_FmHc->padTill16), 0, 16); - if (!p_HcFrame) - RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame obj")); + intFlags = FmPcdLock(p_FmHc->h_FmPcd); - memset(p_HcFrame, 0, sizeof(t_HcFrame)); - p_HcFrame->opcode = (uint32_t)(HC_HCOR_GBL | HC_HCOR_OPCODE_CC); - p_HcFrame->actionReg = FmPcdCcGetNodeAddrOffsetFromNodeInfo(p_FmHc->h_FmPcd, p_NewPointer); - if(p_HcFrame->actionReg == (uint32_t)ILLEGAL_BASE) + if (p_FmHc->nextSeqNumLocation == HC_CMD_POOL_SIZE) { - XX_FreeSmart(p_HcFrame); - RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("Something wrong with base address")); + /* No more buffers */ + FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); + return NULL; } - p_HcFrame->actionReg |= 0xc0000000; - p_HcFrame->extraReg = FmPcdCcGetNodeAddrOffsetFromNodeInfo(p_FmHc->h_FmPcd, p_OldPointer); - if(p_HcFrame->extraReg == (uint32_t)ILLEGAL_BASE) - { - XX_FreeSmart(p_HcFrame); - RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("Something wrong with base address")); - } + *p_SeqNum = p_FmHc->seqNum[p_FmHc->nextSeqNumLocation]; + p_FmHc->nextSeqNumLocation++; - BUILD_FD(SIZE_OF_HC_FRAME_READ_OR_CC_DYNAMIC); + FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); + return p_FmHc->p_Frm[*p_SeqNum]; +} - if ((err = EnQFrm(p_FmHc, &fmFd, &p_HcFrame->commandSequence)) != E_OK) - { - XX_FreeSmart(p_HcFrame); - RETURN_ERROR(MINOR, err, NO_MSG); - } +static __inline__ void PutBuf(t_FmHc *p_FmHc, t_HcFrame *p_Buf, uint32_t seqNum) +{ + uint32_t intFlags; - XX_FreeSmart(p_HcFrame); + UNUSED(p_Buf); - return E_OK; + intFlags = FmPcdLock(p_FmHc->h_FmPcd); + ASSERT_COND(p_FmHc->nextSeqNumLocation); + p_FmHc->nextSeqNumLocation--; + p_FmHc->seqNum[p_FmHc->nextSeqNumLocation] = seqNum; + FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); } -static t_Error HcDynamicChange(t_FmHc *p_FmHc,t_List *h_OldPointersLst, t_List *h_NewPointersLst, t_Handle *h_Params) +static __inline__ t_Error EnQFrm(t_FmHc *p_FmHc, t_DpaaFD *p_FmFd, uint32_t seqNum) { - - t_List *p_PosOld, *p_PosNew; - uint16_t i = 0; t_Error err = E_OK; - uint8_t numOfModifiedPtr; + uint32_t intFlags; + uint32_t timeout=100; - SANITY_CHECK_RETURN_ERROR((LIST_NumOfObjs(h_NewPointersLst) == LIST_NumOfObjs(h_OldPointersLst)),E_INVALID_STATE); + intFlags = FmPcdLock(p_FmHc->h_FmPcd); + ASSERT_COND(!p_FmHc->enqueued[seqNum]); + p_FmHc->enqueued[seqNum] = TRUE; + FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); + DBG(TRACE, ("Send Hc, SeqNum %d, buff@0x%x, fd offset 0x%x", + seqNum, + DPAA_FD_GET_ADDR(p_FmFd), + DPAA_FD_GET_OFFSET(p_FmFd))); + err = p_FmHc->f_QmEnqueue(p_FmHc->h_QmArg, (void *)p_FmFd); + if (err) + RETURN_ERROR(MINOR, err, ("HC enqueue failed")); - numOfModifiedPtr = (uint8_t)LIST_NumOfObjs(h_NewPointersLst); - p_PosNew = NCSW_LIST_FIRST(h_NewPointersLst); - p_PosOld = NCSW_LIST_FIRST(h_OldPointersLst); - for(i = 0; i < numOfModifiedPtr; i++) - { - err = CcHcDoDynamicChange(p_FmHc, p_PosOld, p_PosNew); - if(err) - { - FmPcdCcReleaseModifiedDataStructure(p_FmHc->h_FmPcd, h_OldPointersLst, h_NewPointersLst, i, h_Params); - RETURN_ERROR(MAJOR, err, ("For part of nodes changes are done - situation is danger")); - } - p_PosNew = NCSW_LIST_NEXT(p_PosNew); - p_PosOld = NCSW_LIST_NEXT(p_PosOld); - } + while (p_FmHc->enqueued[seqNum] && --timeout) + XX_UDelay(100); - err = FmPcdCcReleaseModifiedDataStructure(p_FmHc->h_FmPcd, h_OldPointersLst, h_NewPointersLst, i, h_Params); - if(err) - RETURN_ERROR(MAJOR, err, NO_MSG); + if (!timeout) + RETURN_ERROR(MINOR, E_TIMEOUT, ("HC Callback, timeout exceeded")); - return E_OK; + return err; } @@ -234,7 +238,7 @@ t_Handle FmHcConfigAndInit(t_FmHcParams *p_FmHcParams) { t_FmHc *p_FmHc; t_FmPortParams fmPortParam; - t_Error err = E_OK; + t_Error err; p_FmHc = (t_FmHc *)XX_Malloc(sizeof(t_FmHc)); if (!p_FmHc) @@ -247,17 +251,19 @@ t_Handle FmHcConfigAndInit(t_FmHcParams *p_FmHcParams) p_FmHc->h_FmPcd = p_FmHcParams->h_FmPcd; p_FmHc->f_QmEnqueue = p_FmHcParams->params.f_QmEnqueue; p_FmHc->h_QmArg = p_FmHcParams->params.h_QmArg; + p_FmHc->dataMemId = DEFAULT_dataMemId; + err = FillBufPool(p_FmHc); + if (err != E_OK) + { + REPORT_ERROR(MAJOR, err, NO_MSG); + FmHcFree(p_FmHc); + return NULL; + } + if (!FmIsMaster(p_FmHcParams->h_Fm)) return (t_Handle)p_FmHc; -/* -TKT056919 - axi12axi0 can hang if read request follows the single byte write on the very next cycle -TKT038900 - FM dma lockup occur due to AXI slave protocol violation -*/ -#ifdef FM_LOCKUP_ALIGNMENT_ERRATA_FMAN_SW004 - p_FmHc->padTill16 = 16 - (sizeof(t_FmHc) % 16); -#endif /* FM_LOCKUP_ALIGNMENT_ERRATA_FMAN_SW004 */ memset(&fmPortParam, 0, sizeof(fmPortParam)); fmPortParam.baseAddr = p_FmHcParams->params.portBaseAddr; fmPortParam.portType = e_FM_PORT_TYPE_OH_HOST_COMMAND; @@ -270,24 +276,36 @@ TKT038900 - FM dma lockup occur due to AXI slave proto fmPortParam.specificParams.nonRxParams.qmChannel = p_FmHcParams->params.qmChannel; p_FmHc->h_HcPortDev = FM_PORT_Config(&fmPortParam); - if(!p_FmHc->h_HcPortDev) + if (!p_FmHc->h_HcPortDev) { REPORT_ERROR(MAJOR, E_INVALID_HANDLE, ("FM HC port!")); XX_Free(p_FmHc); return NULL; } + err = FM_PORT_ConfigMaxFrameLength(p_FmHc->h_HcPortDev, + (uint16_t)sizeof(t_HcFrame)); + + if (err != E_OK) + { + REPORT_ERROR(MAJOR, err, ("FM HC port init!")); + FmHcFree(p_FmHc); + return NULL; + } + /* final init */ - if ((err = FM_PORT_Init(p_FmHc->h_HcPortDev)) != E_OK) + err = FM_PORT_Init(p_FmHc->h_HcPortDev); + if (err != E_OK) { - REPORT_ERROR(MAJOR, err, ("FM HC port!")); + REPORT_ERROR(MAJOR, err, ("FM HC port init!")); FmHcFree(p_FmHc); return NULL; } - if ((err = FM_PORT_Enable(p_FmHc->h_HcPortDev)) != E_OK) + err = FM_PORT_Enable(p_FmHc->h_HcPortDev); + if (err != E_OK) { - REPORT_ERROR(MAJOR, err, ("FM HC port!")); + REPORT_ERROR(MAJOR, err, ("FM HC port enable!")); FmHcFree(p_FmHc); return NULL; } @@ -298,28 +316,40 @@ TKT038900 - FM dma lockup occur due to AXI slave proto void FmHcFree(t_Handle h_FmHc) { t_FmHc *p_FmHc = (t_FmHc*)h_FmHc; + int i; if (!p_FmHc) return; + for (i=0; i<HC_CMD_POOL_SIZE; i++) + if (p_FmHc->p_Frm[i]) + XX_FreeSmart(p_FmHc->p_Frm[i]); + else + break; + if (p_FmHc->h_HcPortDev) FM_PORT_Free(p_FmHc->h_HcPortDev); XX_Free(p_FmHc); } -#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0)) -t_Error FmHcDumpRegs(t_Handle h_FmHc) +/*****************************************************************************/ +t_Error FmHcSetFramesDataMemory(t_Handle h_FmHc, + uint8_t memId) { t_FmHc *p_FmHc = (t_FmHc*)h_FmHc; + int i; SANITY_CHECK_RETURN_ERROR(p_FmHc, E_INVALID_HANDLE); - SANITY_CHECK_RETURN_ERROR(p_FmHc->h_HcPortDev, E_INVALID_HANDLE); - return FM_PORT_DumpRegs(p_FmHc->h_HcPortDev); + p_FmHc->dataMemId = memId; + for (i=0; i<HC_CMD_POOL_SIZE; i++) + if (p_FmHc->p_Frm[i]) + XX_FreeSmart(p_FmHc->p_Frm[i]); + + return FillBufPool(p_FmHc); } -#endif /* (defined(DEBUG_ERRORS) && ... */ void FmHcTxConf(t_Handle h_FmHc, t_DpaaFD *p_Fd) { @@ -335,134 +365,55 @@ void FmHcTxConf(t_Handle h_FmHc, t_DpaaFD *p_Fd) DBG(TRACE, ("Hc Conf, SeqNum %d, FD@0x%x, fd offset 0x%x", p_HcFrame->commandSequence, DPAA_FD_GET_ADDR(p_Fd), DPAA_FD_GET_OFFSET(p_Fd))); - if (!(p_FmHc->wait[p_HcFrame->commandSequence])) + if (!(p_FmHc->enqueued[p_HcFrame->commandSequence])) REPORT_ERROR(MINOR, E_INVALID_FRAME, ("Not an Host-Command frame received!")); else - p_FmHc->wait[p_HcFrame->commandSequence] = FALSE; + p_FmHc->enqueued[p_HcFrame->commandSequence] = FALSE; FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); } -t_Handle FmHcPcdKgSetScheme(t_Handle h_FmHc, t_FmPcdKgSchemeParams *p_Scheme) +t_Error FmHcPcdKgSetScheme(t_Handle h_FmHc, + t_Handle h_Scheme, + struct fman_kg_scheme_regs *p_SchemeRegs, + bool updateCounter) { t_FmHc *p_FmHc = (t_FmHc*)h_FmHc; t_Error err = E_OK; - t_FmPcdKgInterModuleSchemeRegs schemeRegs; t_HcFrame *p_HcFrame; t_DpaaFD fmFd; - uint32_t intFlags; - uint8_t physicalSchemeId, relativeSchemeId; + uint8_t physicalSchemeId; + uint32_t seqNum; - p_HcFrame = (t_HcFrame *)XX_MallocSmart((sizeof(t_HcFrame) + p_FmHc->padTill16), 0, 16); + p_HcFrame = GetBuf(p_FmHc, &seqNum); if (!p_HcFrame) - { - REPORT_ERROR(MINOR, E_NO_MEMORY, ("HC Frame obj")); - return NULL; - } + RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame object")); - if(!p_Scheme->modify) - { - /* check that schemeId is in range */ - if(p_Scheme->id.relativeSchemeId >= FmPcdKgGetNumOfPartitionSchemes(p_FmHc->h_FmPcd)) - { - REPORT_ERROR(MAJOR, E_NOT_IN_RANGE, ("Scheme is out of range")); - XX_FreeSmart(p_HcFrame); - return NULL; - } + physicalSchemeId = FmPcdKgGetSchemeId(h_Scheme); - relativeSchemeId = p_Scheme->id.relativeSchemeId; - - if (FmPcdKgSchemeTryLock(p_FmHc->h_FmPcd, relativeSchemeId, FALSE)) - { - XX_FreeSmart(p_HcFrame); - return NULL; - } - - physicalSchemeId = FmPcdKgGetPhysicalSchemeId(p_FmHc->h_FmPcd, relativeSchemeId); - - memset(p_HcFrame, 0, sizeof(t_HcFrame)); - p_HcFrame->opcode = (uint32_t)(HC_HCOR_GBL | HC_HCOR_OPCODE_KG_SCM); - p_HcFrame->actionReg = FmPcdKgBuildReadSchemeActionReg(physicalSchemeId); - p_HcFrame->extraReg = 0xFFFFF800; - - BUILD_FD(SIZE_OF_HC_FRAME_READ_OR_CC_DYNAMIC); - - if ((err = EnQFrm(p_FmHc, &fmFd, &p_HcFrame->commandSequence)) != E_OK) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - REPORT_ERROR(MINOR, err, NO_MSG); - XX_FreeSmart(p_HcFrame); - return NULL; - } - - /* check if this scheme is already used */ - if (FmPcdKgHwSchemeIsValid(p_HcFrame->hcSpecificData.schemeRegs.kgse_mode)) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - REPORT_ERROR(MAJOR, E_ALREADY_EXISTS, ("Scheme is already used")); - XX_FreeSmart(p_HcFrame); - return NULL; - } - } - else - { - intFlags = FmPcdLock(p_FmHc->h_FmPcd); - physicalSchemeId = (uint8_t)(PTR_TO_UINT(p_Scheme->id.h_Scheme)-1); - relativeSchemeId = FmPcdKgGetRelativeSchemeId(p_FmHc->h_FmPcd, physicalSchemeId); - if( relativeSchemeId == FM_PCD_KG_NUM_OF_SCHEMES) - { - FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); - REPORT_ERROR(MAJOR, E_NOT_IN_RANGE, NO_MSG); - XX_FreeSmart(p_HcFrame); - return NULL; - } - err = FmPcdKgSchemeTryLock(p_FmHc->h_FmPcd, relativeSchemeId, TRUE); - FmPcdUnlock(p_FmHc->h_FmPcd, intFlags); - if (err) - { - XX_FreeSmart(p_HcFrame); - return NULL; - } - } - - err = FmPcdKgBuildScheme(p_FmHc->h_FmPcd, p_Scheme, &schemeRegs); - if(err) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - REPORT_ERROR(MAJOR, err, NO_MSG); - XX_FreeSmart(p_HcFrame); - return NULL; - } - memset(p_HcFrame, 0, sizeof(t_HcFrame)); p_HcFrame->opcode = (uint32_t)(HC_HCOR_GBL | HC_HCOR_OPCODE_KG_SCM); - p_HcFrame->actionReg = FmPcdKgBuildWriteSchemeActionReg(physicalSchemeId, p_Scheme->schemeCounter.update); - p_HcFrame->extraReg = 0xFFFFF800; - memcpy(&p_HcFrame->hcSpecificData.schemeRegs, &schemeRegs, sizeof(t_FmPcdKgInterModuleSchemeRegs)); - if(!p_Scheme->schemeCounter.update) + p_HcFrame->actionReg = FmPcdKgBuildWriteSchemeActionReg(physicalSchemeId, updateCounter); + p_HcFrame->extraReg = HC_HCOR_KG_SCHEME_REGS_MASK; + memcpy(&p_HcFrame->hcSpecificData.schemeRegs, p_SchemeRegs, sizeof(struct fman_kg_scheme_regs)); + if (!updateCounter) { - p_HcFrame->hcSpecificData.schemeRegs.kgse_dv0 = schemeRegs.kgse_dv0; - p_HcFrame->hcSpecificData.schemeRegs.kgse_dv1 = schemeRegs.kgse_dv1; - p_HcFrame->hcSpecificData.schemeRegs.kgse_ccbs = schemeRegs.kgse_ccbs; - p_HcFrame->hcSpecificData.schemeRegs.kgse_mv = schemeRegs.kgse_mv; + p_HcFrame->hcSpecificData.schemeRegs.kgse_dv0 = p_SchemeRegs->kgse_dv0; + p_HcFrame->hcSpecificData.schemeRegs.kgse_dv1 = p_SchemeRegs->kgse_dv1; + p_HcFrame->hcSpecificData.schemeRegs.kgse_ccbs = p_SchemeRegs->kgse_ccbs; + p_HcFrame->hcSpecificData.schemeRegs.kgse_mv = p_SchemeRegs->kgse_mv; } + p_HcFrame->commandSequence = seqNum; BUILD_FD(sizeof(t_HcFrame)); - if ((err = EnQFrm(p_FmHc, &fmFd, &p_HcFrame->commandSequence)) != E_OK) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - REPORT_ERROR(MINOR, err, NO_MSG); - XX_FreeSmart(p_HcFrame); - return NULL; - } + err = EnQFrm(p_FmHc, &fmFd, seqNum); - FmPcdKgValidateSchemeSw(p_FmHc->h_FmPcd, relativeSchemeId); + PutBuf(p_FmHc, p_HcFrame, seqNum); - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); + if (err != E_OK) + RETURN_ERROR(MINOR, err, NO_MSG); - XX_FreeSmart(p_HcFrame); - - return (t_Handle)(UINT_TO_PTR(physicalSchemeId + 1)); + return E_OK; } t_Error FmHcPcdKgDeleteScheme(t_Handle h_FmHc, t_Handle h_Scheme) @@ -471,213 +422,182 @@ t_Error FmHcPcdKgDeleteScheme(t_Handle h_FmHc, t_Handl t_Error err = E_OK; t_HcFrame *p_HcFrame; t_DpaaFD fmFd; - uint8_t relativeSchemeId; - uint8_t physicalSchemeId = (uint8_t)(PTR_TO_UINT(h_Scheme)-1); + uint8_t physicalSchemeId = FmPcdKgGetSchemeId(h_Scheme); + uint32_t seqNum; - relativeSchemeId = FmPcdKgGetRelativeSchemeId(p_FmHc->h_FmPcd, physicalSchemeId); - - if ((err = FmPcdKgSchemeTryLock(p_FmHc->h_FmPcd, relativeSchemeId, FALSE)) != E_OK) - RETURN_ERROR(MAJOR, err, NO_MSG); - - if(relativeSchemeId == FM_PCD_KG_NUM_OF_SCHEMES) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - RETURN_ERROR(MAJOR, E_NOT_IN_RANGE, NO_MSG); - } - - err = FmPcdKgCheckInvalidateSchemeSw(p_FmHc->h_FmPcd, relativeSchemeId); - if (err) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - RETURN_ERROR(MAJOR, err, NO_MSG); - } - - p_HcFrame = (t_HcFrame *)XX_MallocSmart((sizeof(t_HcFrame) + p_FmHc->padTill16), 0, 16); + p_HcFrame = GetBuf(p_FmHc, &seqNum); if (!p_HcFrame) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame obj")); - } + RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame object")); + memset(p_HcFrame, 0, sizeof(t_HcFrame)); p_HcFrame->opcode = (uint32_t)(HC_HCOR_GBL | HC_HCOR_OPCODE_KG_SCM); p_HcFrame->actionReg = FmPcdKgBuildWriteSchemeActionReg(physicalSchemeId, TRUE); - p_HcFrame->extraReg = 0xFFFFF800; - memset(&p_HcFrame->hcSpecificData.schemeRegs, 0, sizeof(t_FmPcdKgInterModuleSchemeRegs)); + p_HcFrame->extraReg = HC_HCOR_KG_SCHEME_REGS_MASK; + memset(&p_HcFrame->hcSpecificData.schemeRegs, 0, sizeof(struct fman_kg_scheme_regs)); + p_HcFrame->commandSequence = seqNum; BUILD_FD(sizeof(t_HcFrame)); - if ((err = EnQFrm(p_FmHc, &fmFd, &p_HcFrame->commandSequence)) != E_OK) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - XX_FreeSmart(p_HcFrame); - RETURN_ERROR(MINOR, err, NO_MSG); - } + err = EnQFrm(p_FmHc, &fmFd, seqNum); - FmPcdKgInvalidateSchemeSw(p_FmHc->h_FmPcd, relativeSchemeId); + PutBuf(p_FmHc, p_HcFrame, seqNum); - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); + if (err != E_OK) + RETURN_ERROR(MINOR, err, NO_MSG); - XX_FreeSmart(p_HcFrame); - return E_OK; } -t_Error FmHcPcdKgCcGetSetParams(t_Handle h_FmHc, t_Handle h_Scheme, uint32_t requiredAction) +t_Error FmHcPcdKgCcGetSetParams(t_Handle h_FmHc, t_Handle h_Scheme, uint32_t requiredAction, uint32_t value) { t_FmHc *p_FmHc = (t_FmHc*)h_FmHc; t_Error err = E_OK; t_HcFrame *p_HcFrame; t_DpaaFD fmFd; uint8_t relativeSchemeId; - uint8_t physicalSchemeId = (uint8_t)(PTR_TO_UINT(h_Scheme)-1); + uint8_t physicalSchemeId = FmPcdKgGetSchemeId(h_Scheme); uint32_t tmpReg32 = 0; + uint32_t seqNum; + /* Scheme is locked by calling routine */ + /* WARNING - this lock will not be efficient if other HC routine will attempt to change + * "kgse_mode" or "kgse_om" without locking scheme ! + */ + relativeSchemeId = FmPcdKgGetRelativeSchemeId(p_FmHc->h_FmPcd, physicalSchemeId); - if( relativeSchemeId == FM_PCD_KG_NUM_OF_SCHEMES) + if ( relativeSchemeId == FM_PCD_KG_NUM_OF_SCHEMES) RETURN_ERROR(MAJOR, E_NOT_IN_RANGE, NO_MSG); - if (FmPcdKgSchemeTryLock(p_FmHc->h_FmPcd, relativeSchemeId, FALSE)) - RETURN_ERROR(MAJOR, E_INVALID_STATE, ("Lock of the scheme FAILED")); - - if(!FmPcdKgGetPointedOwners(p_FmHc->h_FmPcd, relativeSchemeId) || + if (!FmPcdKgGetRequiredActionFlag(p_FmHc->h_FmPcd, relativeSchemeId) || !(FmPcdKgGetRequiredAction(p_FmHc->h_FmPcd, relativeSchemeId) & requiredAction)) { - - if(requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) + if ((requiredAction & UPDATE_NIA_ENQ_WITHOUT_DMA) && + (FmPcdKgGetNextEngine(p_FmHc->h_FmPcd, relativeSchemeId) == e_FM_PCD_PLCR)) + { + if ((FmPcdKgIsDirectPlcr(p_FmHc->h_FmPcd, relativeSchemeId) == FALSE) || + (FmPcdKgIsDistrOnPlcrProfile(p_FmHc->h_FmPcd, relativeSchemeId) == TRUE)) + RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("In this situation PP can not be with distribution and has to be shared")); + err = FmPcdPlcrCcGetSetParams(p_FmHc->h_FmPcd, FmPcdKgGetRelativeProfileId(p_FmHc->h_FmPcd, relativeSchemeId), requiredAction); + if (err) + RETURN_ERROR(MAJOR, err, NO_MSG); + } + else /* From here we deal with KG-Schemes only */ { - if((FmPcdKgGetNextEngine(p_FmHc->h_FmPcd, relativeSchemeId) == e_FM_PCD_DONE) && (FmPcdKgGetDoneAction(p_FmHc->h_FmPcd, relativeSchemeId) == e_FM_PCD_ENQ_FRAME)) - + /* Pre change general code */ + p_HcFrame = GetBuf(p_FmHc, &seqNum); + if (!p_HcFrame) + RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame object")); + memset(p_HcFrame, 0, sizeof(t_HcFrame)); + p_HcFrame->opcode = (uint32_t)(HC_HCOR_GBL | HC_HCOR_OPCODE_KG_SCM); + p_HcFrame->actionReg = FmPcdKgBuildReadSchemeActionReg(physicalSchemeId); + p_HcFrame->extraReg = HC_HCOR_KG_SCHEME_REGS_MASK; + p_HcFrame->commandSequence = seqNum; + BUILD_FD(SIZE_OF_HC_FRAME_READ_OR_CC_DYNAMIC); + if ((err = EnQFrm(p_FmHc, &fmFd, seqNum)) != E_OK) { - p_HcFrame = (t_HcFrame *)XX_MallocSmart((sizeof(t_HcFrame) + p_FmHc->padTill16), 0, 16); - if (!p_HcFrame) - { - FmPcdKgReleaseSchemeLock(p_FmHc->h_FmPcd, relativeSchemeId); - RETURN_ERROR(MINOR, E_NO_MEMORY, ("HC Frame obj")); - } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710300341.v9U3f4T8029819>