Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Nov 2017 03:09:16 +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: r325260 - in head/sys: contrib/ncsw/Peripherals/FM contrib/ncsw/etc powerpc/conf/dpaa
Message-ID:  <201711010309.vA139GAf064293@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Nov  1 03:09:16 2017
New Revision: 325260
URL: https://svnweb.freebsd.org/changeset/base/325260

Log:
  Rename a couple files to not conflict with ZFS filenames
  
  Now a kernel can be built with both ZFS and DPAA compiled in.

Added:
  head/sys/contrib/ncsw/Peripherals/FM/fm_ncsw.c
     - copied unchanged from r325259, head/sys/contrib/ncsw/Peripherals/FM/fm.c
  head/sys/contrib/ncsw/etc/ncsw_list.c
     - copied unchanged from r325259, head/sys/contrib/ncsw/etc/list.c
Deleted:
  head/sys/contrib/ncsw/Peripherals/FM/fm.c
  head/sys/contrib/ncsw/etc/list.c
Modified:
  head/sys/powerpc/conf/dpaa/files.dpaa

Copied: head/sys/contrib/ncsw/Peripherals/FM/fm_ncsw.c (from r325259, head/sys/contrib/ncsw/Peripherals/FM/fm.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/contrib/ncsw/Peripherals/FM/fm_ncsw.c	Wed Nov  1 03:09:16 2017	(r325260, copy of r325259, head/sys/contrib/ncsw/Peripherals/FM/fm.c)
@@ -0,0 +1,5213 @@
+/*
+ * 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:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Freescale Semiconductor nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/******************************************************************************
+ @File          fm.c
+
+ @Description   FM driver routines implementation.
+*//***************************************************************************/
+#include "std_ext.h"
+#include "error_ext.h"
+#include "xx_ext.h"
+#include "string_ext.h"
+#include "sprint_ext.h"
+#include "debug_ext.h"
+#include "fm_muram_ext.h"
+#include <linux/math64.h>
+
+#include "fm_common.h"
+#include "fm_ipc.h"
+#include "fm.h"
+#include "fsl_fman.h"
+
+
+/****************************************/
+/*       static functions               */
+/****************************************/
+
+static volatile bool blockingFlag = FALSE;
+static void IpcMsgCompletionCB(t_Handle   h_Fm,
+                               uint8_t    *p_Msg,
+                               uint8_t    *p_Reply,
+                               uint32_t   replyLength,
+                               t_Error    status)
+{
+    UNUSED(h_Fm);UNUSED(p_Msg);UNUSED(p_Reply);UNUSED(replyLength);UNUSED(status);
+    blockingFlag = FALSE;
+}
+
+static void FreeInitResources(t_Fm *p_Fm)
+{
+    if (p_Fm->camBaseAddr)
+       FM_MURAM_FreeMem(p_Fm->h_FmMuram, UINT_TO_PTR(p_Fm->camBaseAddr));
+    if (p_Fm->fifoBaseAddr)
+       FM_MURAM_FreeMem(p_Fm->h_FmMuram, UINT_TO_PTR(p_Fm->fifoBaseAddr));
+    if (p_Fm->resAddr)
+       FM_MURAM_FreeMem(p_Fm->h_FmMuram, UINT_TO_PTR(p_Fm->resAddr));
+}
+
+static bool IsFmanCtrlCodeLoaded(t_Fm *p_Fm)
+{
+    t_FMIramRegs    *p_Iram;
+
+    ASSERT_COND(p_Fm);
+    p_Iram = (t_FMIramRegs *)UINT_TO_PTR(p_Fm->baseAddr + FM_MM_IMEM);
+
+    return (bool)!!(GET_UINT32(p_Iram->iready) & IRAM_READY);
+}
+
+static t_Error CheckFmParameters(t_Fm *p_Fm)
+{
+    if (IsFmanCtrlCodeLoaded(p_Fm) && !p_Fm->resetOnInit)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("Old FMan CTRL code is loaded; FM must be reset!"));
+#if (DPAA_VERSION < 11)
+    if (!p_Fm->p_FmDriverParam->dma_axi_dbg_num_of_beats ||
+        (p_Fm->p_FmDriverParam->dma_axi_dbg_num_of_beats > DMA_MODE_MAX_AXI_DBG_NUM_OF_BEATS))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE,
+                     ("axiDbgNumOfBeats has to be in the range 1 - %d", DMA_MODE_MAX_AXI_DBG_NUM_OF_BEATS));
+#endif /* (DPAA_VERSION < 11) */
+    if (p_Fm->p_FmDriverParam->dma_cam_num_of_entries % DMA_CAM_UNITS)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_cam_num_of_entries has to be divisble by %d", DMA_CAM_UNITS));
+//    if (!p_Fm->p_FmDriverParam->dma_cam_num_of_entries || (p_Fm->p_FmDriverParam->dma_cam_num_of_entries > DMA_MODE_MAX_CAM_NUM_OF_ENTRIES))
+//        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_cam_num_of_entries has to be in the range 1 - %d", DMA_MODE_MAX_CAM_NUM_OF_ENTRIES));
+    if (p_Fm->p_FmDriverParam->dma_comm_qtsh_asrt_emer > DMA_THRESH_MAX_COMMQ)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_comm_qtsh_asrt_emer can not be larger than %d", DMA_THRESH_MAX_COMMQ));
+    if (p_Fm->p_FmDriverParam->dma_comm_qtsh_clr_emer > DMA_THRESH_MAX_COMMQ)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_comm_qtsh_clr_emer can not be larger than %d", DMA_THRESH_MAX_COMMQ));
+    if (p_Fm->p_FmDriverParam->dma_comm_qtsh_clr_emer >= p_Fm->p_FmDriverParam->dma_comm_qtsh_asrt_emer)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_comm_qtsh_clr_emer must be smaller than dma_comm_qtsh_asrt_emer"));
+#if (DPAA_VERSION < 11)
+    if (p_Fm->p_FmDriverParam->dma_read_buf_tsh_asrt_emer > DMA_THRESH_MAX_BUF)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_read_buf_tsh_asrt_emer can not be larger than %d", DMA_THRESH_MAX_BUF));
+    if (p_Fm->p_FmDriverParam->dma_read_buf_tsh_clr_emer > DMA_THRESH_MAX_BUF)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_read_buf_tsh_clr_emer can not be larger than %d", DMA_THRESH_MAX_BUF));
+    if (p_Fm->p_FmDriverParam->dma_read_buf_tsh_clr_emer >= p_Fm->p_FmDriverParam->dma_read_buf_tsh_asrt_emer)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_read_buf_tsh_clr_emer must be smaller than dma_read_buf_tsh_asrt_emer"));
+    if (p_Fm->p_FmDriverParam->dma_write_buf_tsh_asrt_emer > DMA_THRESH_MAX_BUF)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_write_buf_tsh_asrt_emer can not be larger than %d", DMA_THRESH_MAX_BUF));
+    if (p_Fm->p_FmDriverParam->dma_write_buf_tsh_clr_emer > DMA_THRESH_MAX_BUF)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_write_buf_tsh_clr_emer can not be larger than %d", DMA_THRESH_MAX_BUF));
+    if (p_Fm->p_FmDriverParam->dma_write_buf_tsh_clr_emer >= p_Fm->p_FmDriverParam->dma_write_buf_tsh_asrt_emer)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_write_buf_tsh_clr_emer must be smaller than dma_write_buf_tsh_asrt_emer"));
+#else /* (DPAA_VERSION >= 11) */
+    if ((p_Fm->p_FmDriverParam->dma_dbg_cnt_mode == E_FMAN_DMA_DBG_CNT_INT_READ_EM)||
+            (p_Fm->p_FmDriverParam->dma_dbg_cnt_mode == E_FMAN_DMA_DBG_CNT_INT_WRITE_EM) ||
+            (p_Fm->p_FmDriverParam->dma_dbg_cnt_mode == E_FMAN_DMA_DBG_CNT_RAW_WAR_PROT))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_dbg_cnt_mode value not supported by this integration."));
+    if ((p_Fm->p_FmDriverParam->dma_emergency_bus_select == FM_DMA_MURAM_READ_EMERGENCY)||
+            (p_Fm->p_FmDriverParam->dma_emergency_bus_select == FM_DMA_MURAM_WRITE_EMERGENCY))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("emergencyBusSelect value not supported by this integration."));
+    if (p_Fm->p_FmDriverParam->dma_stop_on_bus_error)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_stop_on_bus_error not supported by this integration."));
+#ifdef FM_AID_MODE_NO_TNUM_SW005
+    if (p_Fm->p_FmDriverParam->dma_aid_mode != E_FMAN_DMA_AID_OUT_PORT_ID)
+            RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_aid_mode not supported by this integration."));
+#endif /* FM_AID_MODE_NO_TNUM_SW005 */
+    if (p_Fm->p_FmDriverParam->dma_axi_dbg_num_of_beats)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("dma_axi_dbg_num_of_beats not supported by this integration."));
+#endif /* (DPAA_VERSION < 11) */
+
+    if (!p_Fm->p_FmStateStruct->fmClkFreq)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("fmClkFreq must be set."));
+    if (USEC_TO_CLK(p_Fm->p_FmDriverParam->dma_watchdog, p_Fm->p_FmStateStruct->fmClkFreq) > DMA_MAX_WATCHDOG)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE,
+                     ("dma_watchdog depends on FM clock. dma_watchdog(in microseconds) * clk (in Mhz), may not exceed 0x08x", DMA_MAX_WATCHDOG));
+
+#if (DPAA_VERSION >= 11)
+    if ((p_Fm->partVSPBase + p_Fm->partNumOfVSPs) > FM_VSP_MAX_NUM_OF_ENTRIES)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("partVSPBase+partNumOfVSPs out of range!!!"));
+#endif /* (DPAA_VERSION >= 11) */
+
+    if (p_Fm->p_FmStateStruct->totalFifoSize % BMI_FIFO_UNITS)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("totalFifoSize number has to be divisible by %d", BMI_FIFO_UNITS));
+    if (!p_Fm->p_FmStateStruct->totalFifoSize ||
+        (p_Fm->p_FmStateStruct->totalFifoSize > BMI_MAX_FIFO_SIZE))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE,
+                     ("totalFifoSize (currently defined as %d) has to be in the range of 256 to %d",
+                      p_Fm->p_FmStateStruct->totalFifoSize,
+                      BMI_MAX_FIFO_SIZE));
+    if (!p_Fm->p_FmStateStruct->totalNumOfTasks ||
+        (p_Fm->p_FmStateStruct->totalNumOfTasks > BMI_MAX_NUM_OF_TASKS))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("totalNumOfTasks number has to be in the range 1 - %d", BMI_MAX_NUM_OF_TASKS));
+
+#ifdef FM_HAS_TOTAL_DMAS
+    if (!p_Fm->p_FmStateStruct->maxNumOfOpenDmas ||
+        (p_Fm->p_FmStateStruct->maxNumOfOpenDmas > BMI_MAX_NUM_OF_DMAS))
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("maxNumOfOpenDmas number has to be in the range 1 - %d", BMI_MAX_NUM_OF_DMAS));
+#endif /* FM_HAS_TOTAL_DMAS */
+
+    if (p_Fm->p_FmDriverParam->disp_limit_tsh > FPM_MAX_DISP_LIMIT)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("disp_limit_tsh can't be greater than %d", FPM_MAX_DISP_LIMIT));
+
+    if (!p_Fm->f_Exception)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("Exceptions callback not provided"));
+    if (!p_Fm->f_BusError)
+        RETURN_ERROR(MAJOR, E_INVALID_VALUE, ("Exceptions callback not provided"));
+
+#ifdef FM_NO_WATCHDOG
+    if ((p_Fm->p_FmStateStruct->revInfo.majorRev == 2) &&
+        (p_Fm->p_FmDriverParam->dma_watchdog))
+        RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("watchdog!"));
+#endif /* FM_NO_WATCHDOG */
+
+#ifdef FM_ECC_HALT_NO_SYNC_ERRATA_10GMAC_A008
+    if ((p_Fm->p_FmStateStruct->revInfo.majorRev < 6) &&
+        (p_Fm->p_FmDriverParam->halt_on_unrecov_ecc_err))
+        RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("HaltOnEccError!"));
+#endif /* FM_ECC_HALT_NO_SYNC_ERRATA_10GMAC_A008 */
+
+#ifdef FM_NO_TNUM_AGING
+    if ((p_Fm->p_FmStateStruct->revInfo.majorRev != 4) &&
+        (p_Fm->p_FmStateStruct->revInfo.majorRev < 6))
+        if (p_Fm->p_FmDriverParam->tnum_aging_period)
+        RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("Tnum aging!"));
+#endif /* FM_NO_TNUM_AGING */
+
+    /* check that user did not set revision-dependent exceptions */
+#ifdef FM_NO_DISPATCH_RAM_ECC
+    if ((p_Fm->p_FmStateStruct->revInfo.majorRev != 4) &&
+        (p_Fm->p_FmStateStruct->revInfo.majorRev < 6))
+        if (p_Fm->userSetExceptions & FM_EX_BMI_DISPATCH_RAM_ECC)
+            RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("exception e_FM_EX_BMI_DISPATCH_RAM_ECC!"));
+#endif /* FM_NO_DISPATCH_RAM_ECC */
+
+#ifdef FM_QMI_NO_ECC_EXCEPTIONS
+    if (p_Fm->p_FmStateStruct->revInfo.majorRev == 4)
+        if (p_Fm->userSetExceptions & (FM_EX_QMI_SINGLE_ECC | FM_EX_QMI_DOUBLE_ECC))
+            RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("exception e_FM_EX_QMI_SINGLE_ECC/e_FM_EX_QMI_DOUBLE_ECC!"));
+#endif /* FM_QMI_NO_ECC_EXCEPTIONS */
+
+#ifdef FM_QMI_NO_SINGLE_ECC_EXCEPTION
+    if (p_Fm->p_FmStateStruct->revInfo.majorRev >= 6)
+        if (p_Fm->userSetExceptions & FM_EX_QMI_SINGLE_ECC)
+            RETURN_ERROR(MAJOR, E_NOT_SUPPORTED, ("exception e_FM_EX_QMI_SINGLE_ECC!"));
+#endif /* FM_QMI_NO_SINGLE_ECC_EXCEPTION */
+
+    return E_OK;
+}
+
+
+static void SendIpcIsr(t_Fm *p_Fm, uint32_t macEvent, uint32_t pendingReg)
+{
+    ASSERT_COND(p_Fm->guestId == NCSW_MASTER_ID);
+
+    if (p_Fm->intrMng[macEvent].guestId == NCSW_MASTER_ID)
+        p_Fm->intrMng[macEvent].f_Isr(p_Fm->intrMng[macEvent].h_SrcHandle);
+
+    /* If the MAC is running on guest-partition and we have IPC session with it,
+       we inform him about the event through IPC; otherwise, we ignore the event. */
+    else if (p_Fm->h_IpcSessions[p_Fm->intrMng[macEvent].guestId])
+    {
+        t_Error     err;
+        t_FmIpcIsr  fmIpcIsr;
+        t_FmIpcMsg  msg;
+
+        memset(&msg, 0, sizeof(msg));
+        msg.msgId = FM_GUEST_ISR;
+        fmIpcIsr.pendingReg = pendingReg;
+        fmIpcIsr.boolErr = FALSE;
+        memcpy(msg.msgBody, &fmIpcIsr, sizeof(fmIpcIsr));
+        err = XX_IpcSendMessage(p_Fm->h_IpcSessions[p_Fm->intrMng[macEvent].guestId],
+                                (uint8_t*)&msg,
+                                sizeof(msg.msgId) + sizeof(fmIpcIsr),
+                                NULL,
+                                NULL,
+                                NULL,
+                                NULL);
+        if (err != E_OK)
+            REPORT_ERROR(MINOR, err, NO_MSG);
+    }
+    else
+        DBG(TRACE, ("FM Guest mode, without IPC - can't call ISR!"));
+}
+
+static void BmiErrEvent(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_bmi_regs *bmi_rg = p_Fm->p_FmBmiRegs;
+
+
+    event = fman_get_bmi_err_event(bmi_rg);
+
+    if (event & BMI_ERR_INTR_EN_STORAGE_PROFILE_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_BMI_STORAGE_PROFILE_ECC);
+    if (event & BMI_ERR_INTR_EN_LIST_RAM_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_BMI_LIST_RAM_ECC);
+    if (event & BMI_ERR_INTR_EN_STATISTICS_RAM_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_BMI_STATISTICS_RAM_ECC);
+    if (event & BMI_ERR_INTR_EN_DISPATCH_RAM_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_BMI_DISPATCH_RAM_ECC);
+}
+
+static void    QmiErrEvent(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_qmi_regs *qmi_rg = p_Fm->p_FmQmiRegs;
+
+    event = fman_get_qmi_err_event(qmi_rg);
+
+    if (event & QMI_ERR_INTR_EN_DOUBLE_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_QMI_DOUBLE_ECC);
+    if (event & QMI_ERR_INTR_EN_DEQ_FROM_DEF)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_QMI_DEQ_FROM_UNKNOWN_PORTID);
+}
+
+static void    DmaErrEvent(t_Fm *p_Fm)
+{
+    uint32_t            status, com_id;
+    uint8_t             tnum;
+    uint8_t             hardwarePortId;
+    uint8_t             relativePortId;
+    uint16_t            liodn;
+    struct fman_dma_regs *dma_rg = p_Fm->p_FmDmaRegs;
+
+    status = fman_get_dma_err_event(dma_rg);
+
+    if (status & DMA_STATUS_BUS_ERR)
+    {
+        com_id = fman_get_dma_com_id(dma_rg);
+        hardwarePortId = (uint8_t)(((com_id & DMA_TRANSFER_PORTID_MASK) >> DMA_TRANSFER_PORTID_SHIFT));
+        ASSERT_COND(IN_RANGE(1, hardwarePortId, 63));
+        HW_PORT_ID_TO_SW_PORT_ID(relativePortId, hardwarePortId);
+        tnum = (uint8_t)((com_id & DMA_TRANSFER_TNUM_MASK) >> DMA_TRANSFER_TNUM_SHIFT);
+        liodn = (uint16_t)(com_id & DMA_TRANSFER_LIODN_MASK);
+        ASSERT_COND(p_Fm->p_FmStateStruct->portsTypes[hardwarePortId] != e_FM_PORT_TYPE_DUMMY);
+        p_Fm->f_BusError(p_Fm->h_App,
+                         p_Fm->p_FmStateStruct->portsTypes[hardwarePortId],
+                         relativePortId,
+                         fman_get_dma_addr(dma_rg),
+                         tnum,
+                         liodn);
+    }
+        if (status & DMA_STATUS_FM_SPDAT_ECC)
+            p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_DMA_SINGLE_PORT_ECC);
+        if (status & DMA_STATUS_READ_ECC)
+            p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_DMA_READ_ECC);
+        if (status & DMA_STATUS_SYSTEM_WRITE_ECC)
+            p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_DMA_SYSTEM_WRITE_ECC);
+        if (status & DMA_STATUS_FM_WRITE_ECC)
+            p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_DMA_FM_WRITE_ECC);
+    }
+
+static void    FpmErrEvent(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_fpm_regs *fpm_rg = p_Fm->p_FmFpmRegs;
+
+    event = fman_get_fpm_err_event(fpm_rg);
+
+    if ((event  & FPM_EV_MASK_DOUBLE_ECC) && (event & FPM_EV_MASK_DOUBLE_ECC_EN))
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_FPM_DOUBLE_ECC);
+    if ((event  & FPM_EV_MASK_STALL) && (event & FPM_EV_MASK_STALL_EN))
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_FPM_STALL_ON_TASKS);
+    if ((event  & FPM_EV_MASK_SINGLE_ECC) && (event & FPM_EV_MASK_SINGLE_ECC_EN))
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_FPM_SINGLE_ECC);
+}
+
+static void    MuramErrIntr(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_fpm_regs *fpm_rg = p_Fm->p_FmFpmRegs;
+
+    event = fman_get_muram_err_event(fpm_rg);
+
+    if (event & FPM_RAM_MURAM_ECC)
+        p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_MURAM_ECC);
+}
+
+static void IramErrIntr(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_fpm_regs *fpm_rg = p_Fm->p_FmFpmRegs;
+
+    event = fman_get_iram_err_event(fpm_rg);
+
+    if (event & FPM_RAM_IRAM_ECC)
+        p_Fm->f_Exception(p_Fm->h_App, e_FM_EX_IRAM_ECC);
+}
+
+static void QmiEvent(t_Fm *p_Fm)
+{
+    uint32_t    event;
+    struct fman_qmi_regs *qmi_rg = p_Fm->p_FmQmiRegs;
+
+    event = fman_get_qmi_event(qmi_rg);
+
+    if (event & QMI_INTR_EN_SINGLE_ECC)
+        p_Fm->f_Exception(p_Fm->h_App,e_FM_EX_QMI_SINGLE_ECC);
+}
+
+static void UnimplementedIsr(t_Handle h_Arg)
+{
+    UNUSED(h_Arg);
+
+    REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("Unimplemented ISR!"));
+}
+
+static void UnimplementedFmanCtrlIsr(t_Handle h_Arg, uint32_t event)
+{
+    UNUSED(h_Arg); UNUSED(event);
+
+    REPORT_ERROR(MAJOR, E_NOT_SUPPORTED, ("Unimplemented FmCtl ISR!"));
+}
+
+static void EnableTimeStamp(t_Fm *p_Fm)
+{
+    struct fman_fpm_regs *fpm_rg = p_Fm->p_FmFpmRegs;
+
+    ASSERT_COND(p_Fm->p_FmStateStruct);
+    ASSERT_COND(p_Fm->p_FmStateStruct->count1MicroBit);
+
+    fman_enable_time_stamp(fpm_rg, p_Fm->p_FmStateStruct->count1MicroBit, p_Fm->p_FmStateStruct->fmClkFreq);
+
+    p_Fm->p_FmStateStruct->enabledTimeStamp = TRUE;
+}
+
+static t_Error ClearIRam(t_Fm *p_Fm)
+{
+    t_FMIramRegs    *p_Iram;
+    int             i;
+    int             iram_size;
+
+    ASSERT_COND(p_Fm);
+    p_Iram = (t_FMIramRegs *)UINT_TO_PTR(p_Fm->baseAddr + FM_MM_IMEM);
+    iram_size = FM_IRAM_SIZE(p_Fm->p_FmStateStruct->revInfo.majorRev,p_Fm->p_FmStateStruct->revInfo.minorRev);
+
+    /* Enable the auto-increment */
+    WRITE_UINT32(p_Iram->iadd, IRAM_IADD_AIE);
+    while (GET_UINT32(p_Iram->iadd) != IRAM_IADD_AIE) ;
+
+    for (i=0; i < (iram_size/4); i++)
+        WRITE_UINT32(p_Iram->idata, 0xffffffff);
+
+    WRITE_UINT32(p_Iram->iadd, iram_size - 4);
+    CORE_MemoryBarrier();
+    while (GET_UINT32(p_Iram->idata) != 0xffffffff) ;
+
+    return E_OK;
+}
+
+static t_Error LoadFmanCtrlCode(t_Fm *p_Fm)
+{
+    t_FMIramRegs    *p_Iram;
+    int             i;
+    uint32_t        tmp;
+    uint8_t         compTo16;
+
+    ASSERT_COND(p_Fm);
+    p_Iram = (t_FMIramRegs *)UINT_TO_PTR(p_Fm->baseAddr + FM_MM_IMEM);
+
+    /* Enable the auto-increment */
+    WRITE_UINT32(p_Iram->iadd, IRAM_IADD_AIE);
+    while (GET_UINT32(p_Iram->iadd) != IRAM_IADD_AIE) ;
+
+    for (i=0; i < (p_Fm->firmware.size / 4); i++)
+        WRITE_UINT32(p_Iram->idata, p_Fm->firmware.p_Code[i]);
+
+    compTo16 = (uint8_t)(p_Fm->firmware.size % 16);
+    if (compTo16)
+        for (i=0; i < ((16-compTo16) / 4); i++)
+            WRITE_UINT32(p_Iram->idata, 0xffffffff);
+
+    WRITE_UINT32(p_Iram->iadd,p_Fm->firmware.size-4);
+    while (GET_UINT32(p_Iram->iadd) != (p_Fm->firmware.size-4)) ;
+
+    /* verify that writing has completed */
+    while (GET_UINT32(p_Iram->idata) != p_Fm->firmware.p_Code[(p_Fm->firmware.size / 4)-1]) ;
+
+    if (p_Fm->fwVerify)
+    {
+        WRITE_UINT32(p_Iram->iadd, IRAM_IADD_AIE);
+        while (GET_UINT32(p_Iram->iadd) != IRAM_IADD_AIE) ;
+        for (i=0; i < (p_Fm->firmware.size / 4); i++)
+        {
+            tmp = GET_UINT32(p_Iram->idata);
+            if (tmp != p_Fm->firmware.p_Code[i])
+                RETURN_ERROR(MAJOR, E_WRITE_FAILED,
+                             ("UCode write error : write 0x%x, read 0x%x",
+                              p_Fm->firmware.p_Code[i],tmp));
+        }
+        WRITE_UINT32(p_Iram->iadd, 0x0);
+    }
+
+    /* Enable patch from IRAM */
+    WRITE_UINT32(p_Iram->iready, IRAM_READY);
+    XX_UDelay(1000);
+
+    DBG(INFO, ("FMan-Controller code (ver %d.%d.%d) loaded to IRAM.",
+               ((uint16_t *)p_Fm->firmware.p_Code)[2],
+               ((uint8_t *)p_Fm->firmware.p_Code)[6],
+               ((uint8_t *)p_Fm->firmware.p_Code)[7]));
+
+    return E_OK;
+}
+
+#ifdef FM_UCODE_NOT_RESET_ERRATA_BUGZILLA6173
+static t_Error FwNotResetErratumBugzilla6173WA(t_Fm *p_Fm)
+{
+    t_FMIramRegs    *p_Iram = (t_FMIramRegs *)UINT_TO_PTR(p_Fm->baseAddr + FM_MM_IMEM);
+    uint32_t        tmpReg;
+    uint32_t        savedSpliodn[63];
+
+    /* write to IRAM first location the debug instruction */
+    WRITE_UINT32(p_Iram->iadd, 0);
+    while (GET_UINT32(p_Iram->iadd) != 0) ;
+    WRITE_UINT32(p_Iram->idata, FM_FW_DEBUG_INSTRUCTION);
+
+    WRITE_UINT32(p_Iram->iadd, 0);
+    while (GET_UINT32(p_Iram->iadd) != 0) ;
+    while (GET_UINT32(p_Iram->idata) != FM_FW_DEBUG_INSTRUCTION) ;
+
+    /* Enable patch from IRAM */
+    WRITE_UINT32(p_Iram->iready, IRAM_READY);
+    CORE_MemoryBarrier();
+    XX_UDelay(100);
+    IO2MemCpy32((uint8_t *)savedSpliodn,
+                (uint8_t *)p_Fm->p_FmBmiRegs->fmbm_spliodn,
+                63*sizeof(uint32_t));
+
+    /* reset FMAN */
+    WRITE_UINT32(p_Fm->p_FmFpmRegs->fm_rstc, FPM_RSTC_FM_RESET);
+    CORE_MemoryBarrier();
+    XX_UDelay(100);
+
+    /* verify breakpoint debug status register */
+    tmpReg = GET_UINT32(*(uint32_t *)UINT_TO_PTR(p_Fm->baseAddr + FM_DEBUG_STATUS_REGISTER_OFFSET));
+    if (!tmpReg)
+        REPORT_ERROR(MAJOR, E_INVALID_STATE, ("Invalid debug status register value is '0'"));
+
+    /*************************************/
+    /* Load FMan-Controller code to IRAM */
+    /*************************************/
+    ClearIRam(p_Fm);
+    if (p_Fm->firmware.p_Code &&
+        (LoadFmanCtrlCode(p_Fm) != E_OK))
+        RETURN_ERROR(MAJOR, E_INVALID_STATE, NO_MSG);
+    XX_UDelay(100);
+
+    /* reset FMAN again to start the microcode */
+    WRITE_UINT32(p_Fm->p_FmFpmRegs->fm_rstc, FPM_RSTC_FM_RESET);
+    CORE_MemoryBarrier();
+    XX_UDelay(100);
+    Mem2IOCpy32((uint8_t *)p_Fm->p_FmBmiRegs->fmbm_spliodn,
+                (uint8_t *)savedSpliodn,
+                63*sizeof(uint32_t));
+
+    if (fman_is_qmi_halt_not_busy_state(p_Fm->p_FmQmiRegs))
+    {
+        fman_resume(p_Fm->p_FmFpmRegs);
+        CORE_MemoryBarrier();
+        XX_UDelay(100);
+    }
+
+    return E_OK;
+}
+#endif /* FM_UCODE_NOT_RESET_ERRATA_BUGZILLA6173 */
+
+static void GuestErrorIsr(t_Fm *p_Fm, uint32_t pending)
+{
+#define FM_G_CALL_1G_MAC_ERR_ISR(_id)   \
+do {                                    \
+    p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_ERR_1G_MAC0+_id)].f_Isr(p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_ERR_1G_MAC0+_id)].h_SrcHandle);\
+} while (0)
+#define FM_G_CALL_10G_MAC_ERR_ISR(_id)  \
+do {                                    \
+    p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_ERR_10G_MAC0+_id)].f_Isr(p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_ERR_10G_MAC0+_id)].h_SrcHandle);\
+} while (0)
+
+    /* error interrupts */
+    if (pending & ERR_INTR_EN_1G_MAC0)
+        FM_G_CALL_1G_MAC_ERR_ISR(0);
+    if (pending & ERR_INTR_EN_1G_MAC1)
+        FM_G_CALL_1G_MAC_ERR_ISR(1);
+    if (pending & ERR_INTR_EN_1G_MAC2)
+        FM_G_CALL_1G_MAC_ERR_ISR(2);
+    if (pending & ERR_INTR_EN_1G_MAC3)
+        FM_G_CALL_1G_MAC_ERR_ISR(3);
+    if (pending & ERR_INTR_EN_1G_MAC4)
+        FM_G_CALL_1G_MAC_ERR_ISR(4);
+    if (pending & ERR_INTR_EN_1G_MAC5)
+        FM_G_CALL_1G_MAC_ERR_ISR(5);
+    if (pending & ERR_INTR_EN_1G_MAC6)
+        FM_G_CALL_1G_MAC_ERR_ISR(6);
+    if (pending & ERR_INTR_EN_1G_MAC7)
+        FM_G_CALL_1G_MAC_ERR_ISR(7);
+    if (pending & ERR_INTR_EN_10G_MAC0)
+        FM_G_CALL_10G_MAC_ERR_ISR(0);
+    if (pending & ERR_INTR_EN_10G_MAC1)
+        FM_G_CALL_10G_MAC_ERR_ISR(1);
+}
+
+static void GuestEventIsr(t_Fm *p_Fm, uint32_t pending)
+{
+#define FM_G_CALL_1G_MAC_ISR(_id)   \
+do {                                    \
+    p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_1G_MAC0+_id)].f_Isr(p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_1G_MAC0+_id)].h_SrcHandle);\
+} while (0)
+#define FM_G_CALL_10G_MAC_ISR(_id)   \
+do {                                    \
+    p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_10G_MAC0+_id)].f_Isr(p_Fm->intrMng[(e_FmInterModuleEvent)(e_FM_EV_10G_MAC0+_id)].h_SrcHandle);\
+} while (0)
+
+    if (pending & INTR_EN_1G_MAC0)
+        FM_G_CALL_1G_MAC_ISR(0);
+    if (pending & INTR_EN_1G_MAC1)
+        FM_G_CALL_1G_MAC_ISR(1);
+    if (pending & INTR_EN_1G_MAC2)
+        FM_G_CALL_1G_MAC_ISR(2);
+    if (pending & INTR_EN_1G_MAC3)
+        FM_G_CALL_1G_MAC_ISR(3);
+    if (pending & INTR_EN_1G_MAC4)
+        FM_G_CALL_1G_MAC_ISR(4);
+    if (pending & INTR_EN_1G_MAC5)
+        FM_G_CALL_1G_MAC_ISR(5);
+    if (pending & INTR_EN_1G_MAC6)
+        FM_G_CALL_1G_MAC_ISR(6);
+    if (pending & INTR_EN_1G_MAC7)
+        FM_G_CALL_1G_MAC_ISR(7);
+    if (pending & INTR_EN_10G_MAC0)
+        FM_G_CALL_10G_MAC_ISR(0);
+    if (pending & INTR_EN_10G_MAC1)
+        FM_G_CALL_10G_MAC_ISR(1);
+    if (pending & INTR_EN_TMR)
+        p_Fm->intrMng[e_FM_EV_TMR].f_Isr(p_Fm->intrMng[e_FM_EV_TMR].h_SrcHandle);
+}
+
+#if (DPAA_VERSION >= 11)
+static t_Error SetVSPWindow(t_Handle  h_Fm,
+                            uint8_t   hardwarePortId,
+                            uint8_t   baseStorageProfile,
+                            uint8_t   log2NumOfProfiles)
+{
+    t_Fm                    *p_Fm = (t_Fm *)h_Fm;
+
+    ASSERT_COND(h_Fm);
+    ASSERT_COND(IN_RANGE(1, hardwarePortId, 63));
+
+    if ((p_Fm->guestId != NCSW_MASTER_ID) &&
+        !p_Fm->p_FmBmiRegs &&
+        p_Fm->h_IpcSessions[0])
+    {
+        t_FmIpcVspSetPortWindow fmIpcVspSetPortWindow;
+        t_FmIpcMsg              msg;
+        t_Error                 err = E_OK;
+
+        memset(&msg, 0, sizeof(msg));
+        memset(&fmIpcVspSetPortWindow, 0, sizeof(t_FmIpcVspSetPortWindow));
+        fmIpcVspSetPortWindow.hardwarePortId      = hardwarePortId;
+        fmIpcVspSetPortWindow.baseStorageProfile  = baseStorageProfile;
+        fmIpcVspSetPortWindow.log2NumOfProfiles   = log2NumOfProfiles;
+        msg.msgId                                 = FM_VSP_SET_PORT_WINDOW;
+        memcpy(msg.msgBody, &fmIpcVspSetPortWindow, sizeof(t_FmIpcVspSetPortWindow));
+
+        err = XX_IpcSendMessage(p_Fm->h_IpcSessions[0],
+                                (uint8_t*)&msg,
+                                sizeof(msg.msgId),
+                                NULL,
+                                NULL,
+                                NULL,
+                                NULL);
+        if (err != E_OK)
+            RETURN_ERROR(MINOR, err, NO_MSG);
+        return E_OK;
+    }
+    else if (!p_Fm->p_FmBmiRegs)
+        RETURN_ERROR(MINOR, E_NOT_SUPPORTED,
+                     ("Either IPC or 'baseAddress' is required!"));
+
+    fman_set_vsp_window(p_Fm->p_FmBmiRegs,
+                        hardwarePortId,
+                        baseStorageProfile,
+                        log2NumOfProfiles);
+
+    return E_OK;
+}
+
+static uint8_t AllocVSPsForPartition(t_Handle  h_Fm, uint8_t base, uint8_t numOfProfiles, uint8_t guestId)
+{
+    t_Fm        *p_Fm = (t_Fm *)h_Fm;
+    uint8_t     profilesFound = 0;
+    int         i = 0;
+    uint32_t    intFlags;
+
+    if (!numOfProfiles)
+        return E_OK;
+
+    if ((numOfProfiles > FM_VSP_MAX_NUM_OF_ENTRIES) ||
+        (base + numOfProfiles > FM_VSP_MAX_NUM_OF_ENTRIES))
+        return (uint8_t)ILLEGAL_BASE;
+
+    if (p_Fm->h_IpcSessions[0])
+    {
+        t_FmIpcResourceAllocParams  ipcAllocParams;
+        t_FmIpcMsg                  msg;
+        t_FmIpcReply                reply;
+        t_Error                     err;
+        uint32_t                    replyLength;
+
+        memset(&msg, 0, sizeof(msg));
+        memset(&reply, 0, sizeof(reply));
+        memset(&ipcAllocParams, 0, sizeof(t_FmIpcResourceAllocParams));
+        ipcAllocParams.guestId         = p_Fm->guestId;
+        ipcAllocParams.num             = p_Fm->partNumOfVSPs;
+        ipcAllocParams.base            = p_Fm->partVSPBase;
+        msg.msgId                              = FM_VSP_ALLOC;
+        memcpy(msg.msgBody, &ipcAllocParams, sizeof(t_FmIpcResourceAllocParams));
+        replyLength = sizeof(uint32_t) + sizeof(uint8_t);
+        err = XX_IpcSendMessage(p_Fm->h_IpcSessions[0],
+                                (uint8_t*)&msg,
+                                sizeof(msg.msgId) + sizeof(t_FmIpcResourceAllocParams),
+                                (uint8_t*)&reply,
+                                &replyLength,
+                                NULL,
+                                NULL);
+        if ((err != E_OK) ||
+            (replyLength != (sizeof(uint32_t) + sizeof(uint8_t))))
+            RETURN_ERROR(MAJOR, err, NO_MSG);
+        else
+            memcpy((uint8_t*)&p_Fm->partVSPBase, reply.replyBody, sizeof(uint8_t));
+        if (p_Fm->partVSPBase == (uint8_t)(ILLEGAL_BASE))
+            RETURN_ERROR(MAJOR, err, NO_MSG);
+    }
+    if (p_Fm->guestId != NCSW_MASTER_ID)
+    {
+        DBG(WARNING, ("FM Guest mode, without IPC - can't validate VSP range!"));
+        return (uint8_t)ILLEGAL_BASE;
+    }
+
+    intFlags = XX_LockIntrSpinlock(p_Fm->h_Spinlock);
+    for (i = base; i < base + numOfProfiles; i++)
+        if (p_Fm->p_FmSp->profiles[i].profilesMng.ownerId == (uint8_t)ILLEGAL_BASE)
+            profilesFound++;
+        else
+            break;
+
+    if (profilesFound == numOfProfiles)
+        for (i = base; i<base + numOfProfiles; i++)
+            p_Fm->p_FmSp->profiles[i].profilesMng.ownerId = guestId;
+    else
+    {
+        XX_UnlockIntrSpinlock(p_Fm->h_Spinlock, intFlags);
+        return (uint8_t)ILLEGAL_BASE;
+    }
+    XX_UnlockIntrSpinlock(p_Fm->h_Spinlock, intFlags);
+
+    return base;
+}
+
+static void FreeVSPsForPartition(t_Handle  h_Fm, uint8_t base, uint8_t numOfProfiles, uint8_t guestId)
+{
+    t_Fm    *p_Fm = (t_Fm *)h_Fm;
+    int     i = 0;
+
+    ASSERT_COND(p_Fm);
+
+    if (p_Fm->h_IpcSessions[0])
+    {
+        t_FmIpcResourceAllocParams  ipcAllocParams;
+        t_FmIpcMsg                  msg;
+        t_FmIpcReply                reply;
+        uint32_t                    replyLength;
+        t_Error                     err;
+
+        memset(&msg, 0, sizeof(msg));
+        memset(&reply, 0, sizeof(reply));
+        memset(&ipcAllocParams, 0, sizeof(t_FmIpcResourceAllocParams));
+        ipcAllocParams.guestId         = p_Fm->guestId;
+        ipcAllocParams.num             = p_Fm->partNumOfVSPs;
+        ipcAllocParams.base            = p_Fm->partVSPBase;
+        msg.msgId                              = FM_VSP_FREE;
+        memcpy(msg.msgBody, &ipcAllocParams, sizeof(t_FmIpcResourceAllocParams));
+        replyLength = sizeof(uint32_t) + sizeof(uint8_t);
+        err = XX_IpcSendMessage(p_Fm->h_IpcSessions[0],
+                                (uint8_t*)&msg,
+                                sizeof(msg.msgId) + sizeof(t_FmIpcResourceAllocParams),
+                                (uint8_t*)&reply,
+                                &replyLength,
+                                NULL,
+                                NULL);
+        if (err != E_OK)
+            REPORT_ERROR(MAJOR, err, NO_MSG);
+        return;
+    }
+    if (p_Fm->guestId != NCSW_MASTER_ID)
+    {
+        DBG(WARNING, ("FM Guest mode, without IPC - can't validate VSP range!"));
+        return;
+    }
+
+    ASSERT_COND(p_Fm->p_FmSp);
+
+    for (i=base; i<numOfProfiles; i++)
+    {
+        if (p_Fm->p_FmSp->profiles[i].profilesMng.ownerId == guestId)
+           p_Fm->p_FmSp->profiles[i].profilesMng.ownerId = (uint8_t)ILLEGAL_BASE;
+        else
+            DBG(WARNING, ("Request for freeing storage profile window which wasn't allocated to this partition"));
+    }
+}
+#endif /* (DPAA_VERSION >= 11) */
+
+static t_Error FmGuestHandleIpcMsgCB(t_Handle  h_Fm,
+                                     uint8_t   *p_Msg,
+                                     uint32_t  msgLength,
+                                     uint8_t   *p_Reply,
+                                     uint32_t  *p_ReplyLength)
+{
+    t_Fm            *p_Fm       = (t_Fm*)h_Fm;
+    t_FmIpcMsg      *p_IpcMsg   = (t_FmIpcMsg*)p_Msg;
+
+    UNUSED(p_Reply);
+    SANITY_CHECK_RETURN_ERROR(p_Fm, E_INVALID_HANDLE);
+    SANITY_CHECK_RETURN_ERROR((msgLength > sizeof(uint32_t)), E_INVALID_VALUE);
+
+#ifdef DISABLE_SANITY_CHECKS
+    UNUSED(msgLength);
+#endif /* DISABLE_SANITY_CHECKS */
+
+    ASSERT_COND(p_Msg);
+
+    *p_ReplyLength = 0;
+
+    switch (p_IpcMsg->msgId)
+    {
+        case (FM_GUEST_ISR):
+        {
+            t_FmIpcIsr ipcIsr;
+
+            memcpy((uint8_t*)&ipcIsr, p_IpcMsg->msgBody, sizeof(t_FmIpcIsr));
+            if (ipcIsr.boolErr)
+                GuestErrorIsr(p_Fm, ipcIsr.pendingReg);
+            else
+                GuestEventIsr(p_Fm, ipcIsr.pendingReg);
+            break;
+        }
+        default:
+            *p_ReplyLength = 0;
+            RETURN_ERROR(MINOR, E_INVALID_SELECTION, ("command not found!!!"));
+    }
+    return E_OK;
+}
+
+static t_Error FmHandleIpcMsgCB(t_Handle  h_Fm,
+                                uint8_t   *p_Msg,
+                                uint32_t  msgLength,
+                                uint8_t   *p_Reply,
+                                uint32_t  *p_ReplyLength)
+{
+    t_Error         err;
+    t_Fm            *p_Fm       = (t_Fm*)h_Fm;
+    t_FmIpcMsg      *p_IpcMsg   = (t_FmIpcMsg*)p_Msg;
+    t_FmIpcReply    *p_IpcReply = (t_FmIpcReply*)p_Reply;
+
+    SANITY_CHECK_RETURN_ERROR(p_Fm, E_INVALID_HANDLE);
+    SANITY_CHECK_RETURN_ERROR((msgLength >= sizeof(uint32_t)), E_INVALID_VALUE);
+
+#ifdef DISABLE_SANITY_CHECKS
+    UNUSED(msgLength);
+#endif /* DISABLE_SANITY_CHECKS */
+
+    ASSERT_COND(p_IpcMsg);
+
+    memset(p_IpcReply, 0, (sizeof(uint8_t) * FM_IPC_MAX_REPLY_SIZE));
+    *p_ReplyLength = 0;
+
+    switch (p_IpcMsg->msgId)
+    {
+        case (FM_GET_SET_PORT_PARAMS):
+        {
+            t_FmIpcPortInInitParams         ipcInitParams;
+            t_FmInterModulePortInitParams   initParams;
+            t_FmIpcPortOutInitParams        ipcOutInitParams;
+
+            memcpy((uint8_t*)&ipcInitParams, p_IpcMsg->msgBody, sizeof(t_FmIpcPortInInitParams));
+            initParams.hardwarePortId = ipcInitParams.hardwarePortId;
+            initParams.portType = (e_FmPortType)ipcInitParams.enumPortType;
+            initParams.independentMode = (bool)(ipcInitParams.boolIndependentMode);
+            initParams.liodnOffset = ipcInitParams.liodnOffset;
+            initParams.numOfTasks = ipcInitParams.numOfTasks;
+            initParams.numOfExtraTasks = ipcInitParams.numOfExtraTasks;
+            initParams.numOfOpenDmas = ipcInitParams.numOfOpenDmas;
+            initParams.numOfExtraOpenDmas = ipcInitParams.numOfExtraOpenDmas;
+            initParams.sizeOfFifo = ipcInitParams.sizeOfFifo;
+            initParams.extraSizeOfFifo = ipcInitParams.extraSizeOfFifo;
+            initParams.deqPipelineDepth = ipcInitParams.deqPipelineDepth;
+            initParams.maxFrameLength = ipcInitParams.maxFrameLength;
+            initParams.liodnBase = ipcInitParams.liodnBase;
+
+            p_IpcReply->error = (uint32_t)FmGetSetPortParams(h_Fm, &initParams);
+
+            ipcOutInitParams.ipcPhysAddr.high = initParams.fmMuramPhysBaseAddr.high;
+            ipcOutInitParams.ipcPhysAddr.low = initParams.fmMuramPhysBaseAddr.low;
+            ipcOutInitParams.sizeOfFifo = initParams.sizeOfFifo;
+            ipcOutInitParams.extraSizeOfFifo = initParams.extraSizeOfFifo;
+            ipcOutInitParams.numOfTasks = initParams.numOfTasks;
+            ipcOutInitParams.numOfExtraTasks = initParams.numOfExtraTasks;
+            ipcOutInitParams.numOfOpenDmas = initParams.numOfOpenDmas;
+            ipcOutInitParams.numOfExtraOpenDmas = initParams.numOfExtraOpenDmas;
+            memcpy(p_IpcReply->replyBody, (uint8_t*)&ipcOutInitParams, sizeof(ipcOutInitParams));
+            *p_ReplyLength = sizeof(uint32_t) + sizeof(t_FmIpcPortOutInitParams);
+            break;
+        }
+        case (FM_SET_SIZE_OF_FIFO):
+        {
+            t_FmIpcPortRsrcParams   ipcPortRsrcParams;
+
+            memcpy((uint8_t*)&ipcPortRsrcParams, p_IpcMsg->msgBody, sizeof(t_FmIpcPortRsrcParams));
+            p_IpcReply->error = (uint32_t)FmSetSizeOfFifo(h_Fm,
+                                                          ipcPortRsrcParams.hardwarePortId,
+                                                          &ipcPortRsrcParams.val,
+                                                          &ipcPortRsrcParams.extra,
+                                                          (bool)ipcPortRsrcParams.boolInitialConfig);
+            *p_ReplyLength = sizeof(uint32_t);
+            break;
+        }
+        case (FM_SET_NUM_OF_TASKS):
+        {
+            t_FmIpcPortRsrcParams   ipcPortRsrcParams;
+
+            memcpy((uint8_t*)&ipcPortRsrcParams, p_IpcMsg->msgBody, sizeof(t_FmIpcPortRsrcParams));
+            p_IpcReply->error = (uint32_t)FmSetNumOfTasks(h_Fm, ipcPortRsrcParams.hardwarePortId,
+                                                          (uint8_t*)&ipcPortRsrcParams.val,
+                                                          (uint8_t*)&ipcPortRsrcParams.extra,
+                                                          (bool)ipcPortRsrcParams.boolInitialConfig);
+            *p_ReplyLength = sizeof(uint32_t);
+            break;
+        }
+        case (FM_SET_NUM_OF_OPEN_DMAS):
+        {
+            t_FmIpcPortRsrcParams   ipcPortRsrcParams;
+
+            memcpy((uint8_t*)&ipcPortRsrcParams, p_IpcMsg->msgBody, sizeof(t_FmIpcPortRsrcParams));
+            p_IpcReply->error = (uint32_t)FmSetNumOfOpenDmas(h_Fm, ipcPortRsrcParams.hardwarePortId,
+                                                               (uint8_t*)&ipcPortRsrcParams.val,
+                                                               (uint8_t*)&ipcPortRsrcParams.extra,
+                                                               (bool)ipcPortRsrcParams.boolInitialConfig);
+            *p_ReplyLength = sizeof(uint32_t);
+            break;
+        }
+        case (FM_RESUME_STALLED_PORT):
+            *p_ReplyLength = sizeof(uint32_t);
+            p_IpcReply->error = (uint32_t)FmResumeStalledPort(h_Fm, p_IpcMsg->msgBody[0]);
+            break;
+        case (FM_MASTER_IS_ALIVE):
+        {
+            uint8_t guestId = p_IpcMsg->msgBody[0];
+            /* build the FM master partition IPC address */
+            memset(p_Fm->fmIpcHandlerModuleName[guestId], 0, (sizeof(char)) * MODULE_NAME_SIZE);
+            if (Sprint (p_Fm->fmIpcHandlerModuleName[guestId], "FM_%d_%d",p_Fm->p_FmStateStruct->fmId, guestId) != (guestId<10 ? 6:7))
+                RETURN_ERROR(MAJOR, E_INVALID_STATE, ("Sprint failed"));
+            p_Fm->h_IpcSessions[guestId] = XX_IpcInitSession(p_Fm->fmIpcHandlerModuleName[guestId], p_Fm->fmModuleName);
+            if (p_Fm->h_IpcSessions[guestId] == NULL)
+                RETURN_ERROR(MAJOR, E_NOT_AVAILABLE, ("FM Master IPC session for guest %d", guestId));
+            *(uint8_t*)(p_IpcReply->replyBody) = 1;
+            *p_ReplyLength = sizeof(uint32_t) + sizeof(uint8_t);
+            break;
+        }
+        case (FM_IS_PORT_STALLED):
+        {
+            bool tmp;
+
+            p_IpcReply->error = (uint32_t)FmIsPortStalled(h_Fm, p_IpcMsg->msgBody[0], &tmp);
+            *(uint8_t*)(p_IpcReply->replyBody) = (uint8_t)tmp;
+            *p_ReplyLength = sizeof(uint32_t) + sizeof(uint8_t);
+            break;
+        }
+        case (FM_RESET_MAC):
+        {
+            t_FmIpcMacParams    ipcMacParams;
+
+            memcpy((uint8_t*)&ipcMacParams, p_IpcMsg->msgBody, sizeof(t_FmIpcMacParams));
+            p_IpcReply->error = (uint32_t)FmResetMac(p_Fm,
+                                                     (e_FmMacType)(ipcMacParams.enumType),
+                                                     ipcMacParams.id);
+            *p_ReplyLength = sizeof(uint32_t);
+            break;
+        }
+        case (FM_SET_MAC_MAX_FRAME):
+        {
+            t_FmIpcMacMaxFrameParams    ipcMacMaxFrameParams;
+
+            memcpy((uint8_t*)&ipcMacMaxFrameParams, p_IpcMsg->msgBody, sizeof(t_FmIpcMacMaxFrameParams));
+            err = FmSetMacMaxFrame(p_Fm,
+                                  (e_FmMacType)(ipcMacMaxFrameParams.macParams.enumType),
+                                  ipcMacMaxFrameParams.macParams.id,
+                                  ipcMacMaxFrameParams.maxFrameLength);
+            if (err != E_OK)
+                REPORT_ERROR(MINOR, err, NO_MSG);
+            break;
+        }
+#if (DPAA_VERSION >= 11)
+        case (FM_VSP_ALLOC) :
+        {
+            t_FmIpcResourceAllocParams  ipcAllocParams;
+            uint8_t                     vspBase;
+            memcpy(&ipcAllocParams, p_IpcMsg->msgBody, sizeof(t_FmIpcResourceAllocParams));
+            vspBase =  AllocVSPsForPartition(h_Fm, (uint8_t)ipcAllocParams.base, (uint8_t)ipcAllocParams.num, ipcAllocParams.guestId);
+            memcpy(p_IpcReply->replyBody, (uint8_t*)&vspBase, sizeof(uint8_t));
+            *p_ReplyLength = sizeof(uint32_t) + sizeof(uint8_t);
+            break;
+        }
+        case (FM_VSP_FREE) :
+        {
+            t_FmIpcResourceAllocParams   ipcAllocParams;
+            memcpy(&ipcAllocParams, p_IpcMsg->msgBody, sizeof(t_FmIpcResourceAllocParams));
+            FreeVSPsForPartition(h_Fm, (uint8_t)ipcAllocParams.base, (uint8_t)ipcAllocParams.num, ipcAllocParams.guestId);
+            break;
+        }
+        case (FM_VSP_SET_PORT_WINDOW) :
+        {
+            t_FmIpcVspSetPortWindow   ipcVspSetPortWindow;
+            memcpy(&ipcVspSetPortWindow, p_IpcMsg->msgBody, sizeof(t_FmIpcVspSetPortWindow));
+            err = SetVSPWindow(h_Fm,
+                                            ipcVspSetPortWindow.hardwarePortId,
+                                            ipcVspSetPortWindow.baseStorageProfile,
+                                            ipcVspSetPortWindow.log2NumOfProfiles);
+            return err;
+        }

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711010309.vA139GAf064293>