summaryrefslogtreecommitdiffstats
path: root/sys/dev/pms/RefTisa/tisa/sassata/common
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pms/RefTisa/tisa/sassata/common')
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/ossa.h87
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/ossacmnapi.c9093
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tddefs.h1309
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tddmcmnapi.c1300
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdesgl.c543
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdhw.c95
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdinit.c3496
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdint.c263
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c3682
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.h687
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdlist.h168
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdmisc.c2901
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdport.c8044
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdproto.h2269
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h387
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdsmcmnapi.c1410
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdtimers.c302
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/tdutil.h105
-rw-r--r--sys/dev/pms/RefTisa/tisa/sassata/common/wcs.h8305
19 files changed, 44446 insertions, 0 deletions
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/ossa.h b/sys/dev/pms/RefTisa/tisa/sassata/common/ossa.h
new file mode 100644
index 0000000..9de1837
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/ossa.h
@@ -0,0 +1,87 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * The file defines the declaration of OS types
+ *
+ */
+
+#ifndef __OS_SA_H__
+#define __OS_SA_H__
+
+#define DEBUG_LEVEL OSSA_DEBUG_LEVEL_1
+#define ossaLogDebugString TIDEBUG_MSG
+#define ossaAssert OS_ASSERT
+
+#define tddmLogDebugString TIDEBUG_MSG
+#define DM_ASSERT OS_ASSERT
+
+#define tdsmLogDebugString TIDEBUG_MSG
+#define SM_ASSERT OS_ASSERT
+
+#ifdef NOT_YET /* no longer valid */
+#define ossaLogDebugString(agRoot, level, string, ptr1, ptr2, value1, value2) \
+ do { \
+ if ( level <= DEBUG_LEVEL ) \
+ { \
+ printk("%s:", __FUNCTION__); \
+ if ( agNULL != string ) \
+ { \
+ printk("%s:", string); \
+ } \
+ if ( agNULL != ptr1 ) \
+ { \
+ printk("ptr1=%p,", ptr1); \
+ } \
+ if ( agNULL != ptr2 ) \
+ { \
+ printk("ptr2=%p,", ptr2); \
+ } \
+ if ( OSSA_DEBUG_PRINT_INVALID_NUMBER != value1 ) \
+ { \
+ printk("value1=0x%08x ", value1); \
+ } \
+ if ( OSSA_DEBUG_PRINT_INVALID_NUMBER != value2 ) \
+ { \
+ printk("value2=0x%08x ", value2); \
+ } \
+ printk("\n"); \
+ } \
+ } while (0);
+
+#ifndef ossaAssert
+#define ossaAssert(agRoot, expr, message) \
+ do { \
+ if (agFALSE == (expr)) \
+ { \
+ printk("ossaAssert: %s", (message)); \
+ printk(" - file %s, line %d\n", __FILE__, __LINE__); \
+ } \
+ } while (0);
+#endif
+#endif /* 0 */
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#endif /* __OS_SA_H__ */
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/ossacmnapi.c b/sys/dev/pms/RefTisa/tisa/sassata/common/ossacmnapi.c
new file mode 100644
index 0000000..591db4c
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/ossacmnapi.c
@@ -0,0 +1,9093 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ *
+ *
+ * This file contains CB functions used by lower layer in SAS/SATA TD layer
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+#ifdef ECHO_TESTING
+/* temporary to test saEchoCommand() */
+extern bit8 gEcho;
+#endif
+
+#if defined(SALLSDK_DEBUG)
+extern bit32 gLLDebugLevel;
+#endif
+
+
+#include <dev/pms/RefTisa/sallsdk/spc/mpidebug.h>
+
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+
+#ifdef siTraceFileID
+#undef siTraceFileID
+#endif
+#define siTraceFileID 'R'
+#endif
+/*
+ functions that are common to SAS and SATA
+*/
+
+FORCEINLINE
+void ossaCacheInvalidate(
+ agsaRoot_t *agRoot,
+ void *osMemHandle,
+ void *virtPtr,
+ bit32 length
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG6(("ossaCacheInvalidate: start\n"));
+ ostiCacheInvalidate(tiRoot, osMemHandle, virtPtr, length);
+ return;
+}
+
+FORCEINLINE
+void ossaCacheFlush(
+ agsaRoot_t *agRoot,
+ void *osMemHandle,
+ void *virtPtr,
+ bit32 length
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG6(("ossaCacheFlush: start\n"));
+ ostiCacheFlush(tiRoot, osMemHandle, virtPtr, length);
+ return;
+}
+
+FORCEINLINE
+void ossaCachePreFlush(
+ agsaRoot_t *agRoot,
+ void *osMemHandle,
+ void *virtPtr,
+ bit32 length
+ )
+
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG6(("ossaCachePreFlush: start\n"));
+ ostiCachePreFlush(tiRoot, osMemHandle, virtPtr, length);
+ return;
+}
+
+/*****************************************************************************
+*! \brief ossaDeviceHandleAccept
+*
+* Purpose: This function is called by lower layer to inform TD layer of
+* a new SAS device arrival. Used only at the target
+*
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param agDevHandle Pointer to the device handle of the device
+* \param agDevInfo Pointer to the device info structure
+* \param agPortContext Pointer to a port context
+*
+* \return:
+* OSSA_RC_REJECT A device is accpeted
+* OSSA_RC_ACCEPT A device is rejected
+*
+* \note - For details, refer to SAS/SATA Low-Level API Specification
+*
+*****************************************************************************/
+osGLOBAL bit32 ossaDeviceHandleAccept(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaSASDeviceInfo_t *agDevInfo,
+ agsaPortContext_t *agPortContext,
+ bit32 *hostAssignedDeviceId
+ )
+{
+#ifdef TARGET_DRIVER
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ tdsaPortContext_t *onePortContext = agNULL;
+ tiPortalContext_t *tiPortalContext = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tiDeviceHandle_t *tiDeviceHandle = agNULL;
+ tdsaSASSubID_t agSASSubID;
+ bit32 option;
+ bit32 param;
+ /*
+ at target only
+ by default TD layer accpets all devices
+ */
+ /*
+ at this point,
+ by LINK_UP event tdsaPortContext should have been created
+ */
+ smTraceFuncEnter(hpDBG_VERY_LOUD, "Y0");
+ TI_DBG1(("ossaDeviceHandleAccept: start hostAssignedDeviceId 0x%X\n",*hostAssignedDeviceId));
+
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleAccept: NULL agsaPortContext; wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y0");
+ return OSSA_RC_REJECT;
+ }
+
+
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleAccept: NULL oneportcontext; wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Y0");
+ return OSSA_RC_REJECT;
+ }
+
+ tiPortalContext = (tiPortalContext_t *)onePortContext->tiPortalContext;
+
+ if (tiPortalContext == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleAccept: NULL tiPortalContext; wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "Y0");
+ return OSSA_RC_REJECT;
+ }
+
+ /*
+ add the device to device list
+ cf) OSSA_DISCOVER_FOUND_DEVICE
+ */
+ TI_DBG4(("ossaDeviceHandleAccept: sasAddressHi 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSHI(&agDevInfo->commonDevInfo)));
+ TI_DBG4(("ossaDeviceHandleAccept: sasAddressLo 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSLO(&agDevInfo->commonDevInfo)));
+ TI_DBG4(("ossaDeviceHandleAccept: device type 0x%x\n", DEVINFO_GET_DEVICETTYPE(&agDevInfo->commonDevInfo)));
+ TI_DBG4(("ossaDeviceHandleAccept: phys %d\n", agDevInfo->numOfPhys));
+ TI_DBG4(("ossaDeviceHandleAccept: pid %d\n", onePortContext->id));
+
+ if (DEVINFO_GET_DEVICETTYPE(&agDevInfo->commonDevInfo) == SAS_END_DEVICE)
+ {
+ TI_DBG4(("ossaDeviceHandleAccept: SAS_END_DEVICE\n"));
+ }
+ else if (DEVINFO_GET_DEVICETTYPE(&agDevInfo->commonDevInfo) == SAS_EDGE_EXPANDER_DEVICE)
+ {
+ TI_DBG4(("ossaDeviceHandleAccept: SAS_EDGE_EXPANDER_DEVICE\n"));
+ }
+ else /* SAS_FANOUT_EXPANDER_DEVICE */
+ {
+ TI_DBG4(("ossaDeviceHandleAccept: SAS_FANOUT_EXPANDER_DEVICE\n"));
+ }
+ agSASSubID.sasAddressHi = SA_DEVINFO_GET_SAS_ADDRESSHI(&agDevInfo->commonDevInfo);
+ agSASSubID.sasAddressLo = SA_DEVINFO_GET_SAS_ADDRESSLO(&agDevInfo->commonDevInfo);
+ agSASSubID.initiator_ssp_stp_smp = agDevInfo->initiator_ssp_stp_smp;
+ agSASSubID.target_ssp_stp_smp = agDevInfo->target_ssp_stp_smp;
+
+
+ tdssAddSASToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle,
+ &agSASSubID,
+ agTRUE,
+ 0xFF,
+ TD_OPERATION_TARGET
+ );
+
+ /* at this point devicedata for new device exists */
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleAccept: NULL oneDeviceData; wrong\n"));
+ return OSSA_RC_REJECT;
+ }
+
+ oneDeviceData->registered = agTRUE;
+
+ tiDeviceHandle = &(oneDeviceData->tiDeviceHandle);
+
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleAccept: NULL tiDeviceHandle; wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "Y0");
+ return OSSA_RC_REJECT;
+ }
+
+ /* setting MCN in agsaDeviceInfo_t*/
+ agDevInfo->commonDevInfo.flag = agDevInfo->commonDevInfo.flag | (tdsaAllShared->MCN << 16);
+ /* increment RegisteredDevNums */
+ onePortContext->RegisteredDevNums++;
+
+ *hostAssignedDeviceId |= 0xBEEF0000;
+
+ TI_DBG1(("ossaDeviceHandleAccept: Now hostAssignedDeviceId 0x%X\n", *hostAssignedDeviceId));
+
+
+ /* no login in SAS */
+ /*
+ osGLOBAL bit32 ostiTargetEvent (
+ tiRoot_t *tiRoot,
+ tiPortalContext_t *portalContext,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiTgtEventType_t eventType,
+ bit32 eventStatus,
+ void *parm
+ );
+ */
+
+ ostiTargetEvent(
+ tiRoot,
+ tiPortalContext,
+ tiDeviceHandle,
+ tiTgtEventTypeDeviceChange,
+ tiDeviceArrival,
+ agNULL
+ );
+ /* set MCN and initiator role bit using saSetDeviceInfo */
+ option = 24; /* setting MCN and initiator role 1 1000b*/
+ param = (1 << 18) | (tdsaAllShared->MCN << 24);
+ TI_DBG1(("ossaDeviceHandleAccept: option 0x%x param 0x%x MCN 0x%x\n", option, param, tdsaAllShared->MCN));
+ saSetDeviceInfo(agRoot, agNULL, 0, agDevHandle, option, param, ossaSetDeviceInfoCB);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "Y0");
+ return OSSA_RC_ACCEPT;
+#endif
+
+#ifdef INITIATOR_DRIVER
+ /* this function is not used in case of Initiator */
+ return OSSA_RC_ACCEPT;
+#endif
+}
+
+#ifdef INITIATOR_DRIVER
+/*****************************************************************************
+*! \brief ossaDiscoverSasCB
+*
+* Purpose: This function is called by lower layer to inform TD layer of
+* SAS discovery results
+*
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param agPortContext Pointer to the port context of TD and Lower layer
+* \param event event type
+* \param pParm1 Pointer to data associated with event
+* \param pParm2 Pointer to data associated with event
+*
+* \return: none
+*
+* \note - For details, refer to SAS/SATA Low-Level API Specification
+*
+*****************************************************************************/
+osGLOBAL void ossaDiscoverSasCB(agsaRoot_t *agRoot,
+ agsaPortContext_t *agPortContext,
+ bit32 event,
+ void *pParm1,
+ void *pParm2
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)osData->tdsaAllShared;
+
+ tdsaPortContext_t *onePortContext = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+
+ agsaDevHandle_t *agDevHandle = agNULL;
+ agsaSASDeviceInfo_t *agDeviceInfo = agNULL;
+ tiPortalContext_t *tiPortalContext = agNULL;
+ tdList_t *DeviceListList;
+ tdsaSASSubID_t agSASSubID;
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y1");
+ TI_DBG2(("ossaDiscoverSasCB: start\n"));
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaDiscoverSasCB: NULL agsaPortContext; wrong\n"));
+ return;
+ }
+
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ tiPortalContext = (tiPortalContext_t *)onePortContext->tiPortalContext;
+
+ switch ( event )
+ {
+ case OSSA_DISCOVER_STARTED:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: STARTED pid %d\n", onePortContext->id));
+ /*
+ invalidate all devices in current device list
+ */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ TI_DBG3(("ossaDiscoverSasCB: loop did %d\n", oneDeviceData->id));
+ TI_DBG3(("ossaDiscoverSasCB: loop sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG6(("ossaDiscoverSasCB: loop sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ if (oneDeviceData->tdPortContext == onePortContext)
+ {
+ TI_DBG3(("ossaDiscoverSasCB: did %d is invalidated \n", oneDeviceData->id));
+ /* temporary solution: only for sata direct attached */
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ onePortContext->DiscoveryState = ITD_DSTATE_STARTED;
+ break;
+ }
+
+ case OSSA_DISCOVER_FOUND_DEVICE:
+ {
+ TI_DBG4(("ossaDiscoverSasCB: $$$$$ FOUND_DEVICE pid %d\n", onePortContext->id));
+ agDevHandle = (agsaDevHandle_t *)pParm1;
+ agDeviceInfo = (agsaSASDeviceInfo_t *)pParm2;
+ TI_DBG5(("ossaDiscoverSasCB: sasAddressHi 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSHI(&agDeviceInfo->commonDevInfo)));
+ TI_DBG5(("ossaDiscoverSasCB: sasAddressLo 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSLO(&agDeviceInfo->commonDevInfo)));
+ TI_DBG5(("ossaDiscoverSasCB: device type 0x%x\n", DEVINFO_GET_DEVICETTYPE(&agDeviceInfo->commonDevInfo)));
+
+ TI_DBG6(("ossaDiscoverSasCB: phys %d\n", agDeviceInfo->numOfPhys));
+ TI_DBG4(("ossaDiscoverSasCB: pid %d\n", onePortContext->id));
+
+
+ /* Add only target devices; do not add expander device */
+ if (DEVINFO_GET_DEVICETTYPE(&agDeviceInfo->commonDevInfo) == SAS_END_DEVICE)
+ {
+ agSASSubID.sasAddressHi = SA_DEVINFO_GET_SAS_ADDRESSHI(&agDeviceInfo->commonDevInfo);
+ agSASSubID.sasAddressLo = SA_DEVINFO_GET_SAS_ADDRESSLO(&agDeviceInfo->commonDevInfo);
+ agSASSubID.initiator_ssp_stp_smp = agDeviceInfo->initiator_ssp_stp_smp;
+ agSASSubID.target_ssp_stp_smp = agDeviceInfo->target_ssp_stp_smp;
+
+ TI_DBG2(("ossaDiscoverSasCB: adding ....\n"));
+
+ tdssAddSASToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle,
+ &agSASSubID,
+ agTRUE,
+ agDeviceInfo->phyIdentifier,
+ TD_OPERATION_INITIATOR
+ );
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceArrival,
+ agNULL
+ );
+ }
+ else
+ {
+ TI_DBG5(("ossaDiscoverSasCB: $$$$$ not end device. not adding....\n"));
+ }
+
+
+ break;
+ }
+
+ case OSSA_DISCOVER_REMOVED_DEVICE:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: REMOVED_DEVICE\n"));
+ agDevHandle = (agsaDevHandle_t *)pParm1;
+ agDeviceInfo = (agsaSASDeviceInfo_t *)pParm2;
+ oneDeviceData = (tdsaDeviceData_t *) agDevHandle->osData;
+
+ TI_DBG6(("ossaDiscoverSasCB: sasAddressHi 0x%08x\n",
+ SA_DEVINFO_GET_SAS_ADDRESSHI(&agDeviceInfo->commonDevInfo)));
+ TI_DBG6(("ossaDiscoverSasCB: sasAddressLo 0x%08x\n",
+ SA_DEVINFO_GET_SAS_ADDRESSLO(&agDeviceInfo->commonDevInfo)));
+ TI_DBG6(("ossaDiscoverSasCB: phys %d\n", agDeviceInfo->numOfPhys));
+ TI_DBG6(("ossaDiscoverSasCB: onePortContext->id %d\n", onePortContext->id));
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaDiscoverSasCB: Wrong. DevHandle->osData is NULL but is being removed\n"));
+ }
+ else
+ {
+ tdssRemoveSASFromSharedcontext(onePortContext,
+ oneDeviceData,
+ agRoot);
+ agDevHandle->osData = agNULL;
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceRemoval,
+ agNULL
+ );
+ }
+
+ break;
+ }
+ case OSSA_DISCOVER_COMPLETE:
+ {
+ TI_DBG2(("ossaDiscoverSasCB: SAS COMPLETE pid %d\n", onePortContext->id));
+ /*
+ note:
+ SAS discovery must be called before SATA discovery
+ "onePortContext->DiscoveryState = ITD_DSTATE_COMPLETED" is
+ in ossaDiscoverSataCB not in ossaDiscoverSasCB when SATA_ENABLE
+ */
+#ifndef SATA_ENABLE
+ onePortContext->DiscoveryState = ITD_DSTATE_COMPLETED;
+ TI_DBG6(("ossaDiscoverSasCB: COMPLETE pid %d\n", onePortContext->id));
+#endif
+
+#ifdef SATA_ENABLE
+ TI_DBG2(("ossaDiscoverSasCB: calling SATA discovery\n"));
+
+ /* Continue with SATA discovery */
+ saDiscover(agRoot, agPortContext, AG_SA_DISCOVERY_TYPE_SATA,
+ onePortContext->discoveryOptions);
+
+#else /* SATA not enable */
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging */
+ /* dump device list */
+ DeviceListList = tdsaAllShared->MainPortContextList.flink;
+
+ while (DeviceListList != &(tdsaAllShared->MainPortContextList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ TI_DBG2(("ossaDiscoverSasCB: did %d valid %d\n", oneDeviceData->id, oneDeviceData->valid));
+ TI_DBG2(("ossaDiscoverSasCB: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG2(("ossaDiscoverSasCB: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ DeviceListList = DeviceListList->flink;
+ }
+#endif
+
+ /* letting OS layer know discovery has been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscOK,
+ agNULL
+ );
+#endif /* SATA_ENABLE */
+
+ break;
+ }
+ case OSSA_DISCOVER_ABORT:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ABORT\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_1:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 1\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+
+ case OSSA_DISCOVER_ABORT_ERROR_2:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 2\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+
+ case OSSA_DISCOVER_ABORT_ERROR_3:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 3\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_4:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 4\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_5:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 5\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_6:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 6\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_7:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 7\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_8:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 8\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ case OSSA_DISCOVER_ABORT_ERROR_9:
+ {
+ TI_DBG3(("ossaDiscoverSasCB: ERROR 9\n"));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ }
+ default:
+ TI_DBG3(("ossaDiscoverSasCB: ERROR default event 0x%x\n", event));
+ /* letting OS layer know discovery has not been successfully complete */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ break;
+ } /* end of switch */
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y1");
+ return;
+}
+#endif // #ifdef INITIATOR_DRIVER
+
+osGLOBAL void ossaLogTrace0(
+ agsaRoot_t *agRoot,
+ bit32 traceCode
+ )
+{
+ return;
+}
+
+osGLOBAL void ossaLogTrace1(
+ agsaRoot_t *agRoot,
+ bit32 traceCode,
+ bit32 value1
+ )
+{
+ return;
+}
+
+osGLOBAL void ossaLogTrace2(
+ agsaRoot_t *agRoot,
+ bit32 traceCode,
+ bit32 value1,
+ bit32 value2
+ )
+{
+ return;
+}
+
+osGLOBAL void ossaLogTrace3(
+ agsaRoot_t *agRoot,
+ bit32 traceCode,
+ bit32 value1,
+ bit32 value2,
+ bit32 value3
+ )
+{
+ return;
+}
+
+
+osGLOBAL void
+ossaLogTrace4(
+ agsaRoot_t *agRoot,
+ bit32 traceCode,
+ bit32 value1,
+ bit32 value2,
+ bit32 value3,
+ bit32 value4
+ )
+{
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief ossaHwCB
+*
+* Purpose: This function is called by lower layer to inform TD layer of
+* HW related results
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param agPortContext Pointer to the port context of TD and Lower layer
+* \param event event type
+* \param eventParm1 event-specific parameter
+* \param eventParm2 event-specific parameter
+* \param eventParm3 event-specific parameter of pointer type
+*
+* \return: none
+*
+* \note - For details, refer to SAS/SATA Low-Level API Specification
+*
+*****************************************************************************/
+osGLOBAL void ossaHwCB(
+ agsaRoot_t *agRoot,
+ agsaPortContext_t *agPortContext,
+ bit32 event,
+ bit32 eventParm1,
+ void *eventParm2,
+ void *eventParm3
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)osData->tdsaAllShared;
+ tdList_t *PortContextList = agNULL;
+ tdsaPortContext_t *onePortContext = agNULL;
+ agsaDevHandle_t *agDevHandle = agNULL;
+ agsaSASIdentify_t *IDframe = agNULL;
+ int i = 0;
+#ifdef INITIATOR_DRIVER
+ tdsaSASSubID_t agSASSubID;
+#endif
+ bit32 PhyID;
+ bit32 PhyStatus;
+ bit32 LinkRate;
+ bit32 PortState;
+ bit32 HwAckSatus = AGSA_RC_SUCCESS;
+
+// #ifdef INITIATOR_DRIVER
+#ifdef INITIATOR_DRIVER
+ agsaFisRegDeviceToHost_t *RegD2H = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+#endif
+#ifdef REMOVED
+ bit32 found = agFALSE;
+#endif
+ agsaHWEventEncrypt_t *pEncryptCBData;
+ agsaEncryptInfo_t *pEncryptInfo;
+ agsaHWEventMode_t *pModeEvent;
+ tiEncryptPort_t encryptEventData;
+ tiEncryptInfo_t encryptInfo;
+ bit32 *pModePage;
+ bit32 securityMode;
+ bit32 cipherMode;
+ bit32 encryptStatus;
+ bit32 securitySetModeStatus;
+ bit32 securityModeStatus;
+
+// #endif /* INITIATOR_DRIVER */
+ agsaPhyErrCountersPage_t *agPhyErrCountersPage;
+ agsaEventSource_t eventSource;
+
+#ifdef FDS_DM
+ dmRoot_t *dmRoot = &(tdsaAllShared->dmRoot);
+ dmPortContext_t *dmPortContext = agNULL;
+ bit32 status = DM_RC_FAILURE;
+ dmPortInfo_t dmPortInfo;
+// bit32 discStatus = dmDiscInProgress;
+#endif
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y2");
+
+ TI_DBG2(("ossaHwCB: agPortContext %p event 0x%x eventParm1 0x%x eventParm2 %p eventParm3 %p\n",
+ agPortContext,event,eventParm1,eventParm2,eventParm3 ));
+
+ switch ( event )
+ {
+ case OSSA_HW_EVENT_SAS_PHY_UP:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ LinkRate = TD_GET_LINK_RATE(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agDevHandle = agNULL;
+ IDframe = (agsaSASIdentify_t *)eventParm3;
+
+
+ TI_DBG2(("ossaHwCB: Phy%d SAS link Up\n", PhyID));
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y2");
+ return;
+ }
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG3(("ossaHwCB: agDevHandle null by design change\n"));
+ }
+
+ if (IDframe == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: IDframe null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Y2");
+ return;
+ }
+ /* debugging only */
+ if (LinkRate == 0x01)
+ {
+ TI_DBG1(("ossaHwCB: SAS Link Rate is 1.5 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x02)
+ {
+ TI_DBG1(("ossaHwCB: SAS Link Rate is 3.0 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x04)
+ {
+ TI_DBG1(("ossaHwCB: SAS Link Rate is 6.0 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x08)
+ {
+ TI_DBG1(("ossaHwCB: SAS Link Rate is 12.0 Gbps PhyID %d\n",PhyID));
+ }
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with SAS link up\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "Y2");
+ return;
+ }
+
+ if ( agPortContext->osData == agNULL)
+ {/* if */
+ TI_DBG6 (("ossaHwCB: PhyID %d tdsaAllShared %p\n", PhyID, tdsaAllShared));
+ if (tdsaAllShared->Ports[PhyID].tiPortalContext == agNULL)
+ {
+ TI_DBG6(("ossaHwCB: NULL portalcontext\n"));
+ }
+ else
+ {
+ TI_DBG6(("ossaHwCB: NOT NULL portalcontext\n"));
+ }
+
+ if (IDframe == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: IDFrame is NULL; SATA !!!!\n"));
+ }
+ else
+ {
+ TI_DBG3(("ossaHwCB: IDframe->sasAddressHi 0x%08x \n",
+ SA_IDFRM_GET_SAS_ADDRESSHI(IDframe)));
+ TI_DBG3(("ossaHwCB: IDframe->sasAddressLo 0x%08x \n",
+ SA_IDFRM_GET_SAS_ADDRESSLO(IDframe)));
+
+ }
+ /*
+ setting tdsaPortContext fields
+ take the head from the FreeLink of tdsaPortContext_t
+ then modify it
+ then put it in MainLink of tdsaPortContext_t
+ */
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ if (TDLIST_NOT_EMPTY(&(tdsaAllShared->FreePortContextList)))
+ {
+ TDLIST_DEQUEUE_FROM_HEAD(&PortContextList, &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, PortContextList);
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+ TI_DBG6(("ossaHwCB: onePortContext %p\n", onePortContext));
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is NULL in allocation, wrong!\n"));
+ return;
+ }
+
+ /* sets fields of tdsaportcontext */
+#ifdef INITIATOR_DRIVER
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+#endif
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+ if (IDframe == agNULL)
+ {
+ onePortContext->sasRemoteAddressHi = 0xFFFFFFFF;
+ onePortContext->sasRemoteAddressLo = 0xFFFFFFFF;
+ onePortContext->directAttatchedSAS = agTRUE;
+ }
+ else
+ {
+ onePortContext->sasRemoteAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(IDframe);
+ onePortContext->sasRemoteAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(IDframe);
+ /* Create ID frame and storing ID frame */
+ osti_memcpy(&onePortContext->sasIDframe, IDframe, sizeof(agsaSASIdentify_t));
+ tdhexdump("ossaHWCB: sasIDframe", (bit8 *)(&onePortContext->sasIDframe), sizeof(agsaSASIdentify_t));
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_END_DEVICE)
+ {
+ onePortContext->directAttatchedSAS = agTRUE;
+ }
+#ifdef FDS_DM
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_EDGE_EXPANDER_DEVICE ||
+ SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_FANOUT_EXPANDER_DEVICE
+ )
+ {
+ onePortContext->UseDM = agTRUE;
+ }
+#endif
+ }
+
+ onePortContext->sasLocalAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->sasLocalAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->tiPortalContext = tdsaAllShared->Ports[PhyID].tiPortalContext;
+ onePortContext->agRoot = agRoot;
+ onePortContext->agPortContext = agPortContext;
+ tdsaAllShared->Ports[PhyID].portContext = onePortContext;
+ agPortContext->osData = onePortContext;
+ onePortContext->valid = agTRUE;
+ if (LinkRate == 0x01)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_1_5G;
+ }
+ else if (LinkRate == 0x02)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_3_0G;
+ }
+ else if (LinkRate == 0x04)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_6_0G;
+ }
+ else /* (LinkRate == 0x08) */
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_12_0G;
+ }
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->MainLink), &(tdsaAllShared->MainPortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+#ifdef FDS_DM
+ dmPortContext = &(onePortContext->dmPortContext);
+ dmPortContext->tdData = onePortContext;
+ /* set up dmPortInfo_t */
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSLO(&dmPortInfo, onePortContext->sasRemoteAddressLo);
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSHI(&dmPortInfo, onePortContext->sasRemoteAddressHi);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSLO(&dmPortInfo, onePortContext->sasLocalAddressLo);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSHI(&dmPortInfo, onePortContext->sasLocalAddressHi);
+
+ TI_DBG2(("ossaHwCB: phy %d hi 0x%x lo 0x%x\n", PhyID,
+ SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[PhyID].SASID)),
+ SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[PhyID].SASID))));
+ TI_DBG2(("ossaHwCB: LocalAddrHi 0x%08x LocaAddrLo 0x%08x\n", onePortContext->sasLocalAddressHi, onePortContext->sasLocalAddressLo));
+
+ dmPortInfo.flag = onePortContext->LinkRate;
+
+ if (onePortContext->UseDM == agTRUE)
+ {
+ TI_DBG1(("ossaHwCB: calling dmCreatePort\n"));
+ status = dmCreatePort(dmRoot, dmPortContext, &dmPortInfo);
+ if (status != DM_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: dmCreatePort failed!!! 0x%x\n", status));
+ }
+ }
+#endif
+
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ TI_DBG1(("\nossaHwCB: Attention!!! no more free PortContext.\n"));
+ }
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+
+ print_tdlist_flink(&(tdsaPortContext->FreeLink), 1, 1);
+ print_tdlist_flink(&(tdsaPortContext->MainLink), 1, 2);
+ print_tdlist_flink(&(tdsaDeviceData->FreeLink), 2, 1);
+ print_tdlist_flink(&(tdsaDeviceData->MainLink), 2, 2);
+#endif
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging */
+ PortContextList = tdsaPortContext->MainLink.flink;
+ while (PortContextList != &(tdsaPortContext->MainLink))
+ {
+ twoPortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ TI_DBG6(("ossaHwCB: in while portContext ID %d\n", twoPortContext->id));
+ TI_DBG6(("ossaHwCB: in while PortContext %p\n", twoPortContext));
+ PortContextList = PortContextList->flink;
+ }
+#endif
+ /* add agDevHandle */
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) != SAS_NO_DEVICE)
+ {
+#ifdef INITIATOR_DRIVER
+ agSASSubID.sasAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(IDframe);
+ agSASSubID.sasAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(IDframe);
+ agSASSubID.initiator_ssp_stp_smp = IDframe->initiator_ssp_stp_smp;
+ agSASSubID.target_ssp_stp_smp = IDframe->target_ssp_stp_smp;
+#endif
+
+ TI_DBG2(("ossaHwCB: adding ....\n"));
+ /* uses only SASIDframe not agsaSASDeviceInfo_t */
+#ifdef INITIATOR_DRIVER
+ tdssAddSASToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle, /* agNULL */
+ &agSASSubID,
+ agTRUE,
+ (bit8)PhyID,
+ TD_OPERATION_INITIATOR
+ );
+#endif
+
+#ifdef FDS_DM
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_END_DEVICE &&
+ SA_IDFRM_IS_SSP_TARGET(IDframe) )
+ {
+ TI_DBG2(("ossaHwCB: NOTIFY_ENABLE_SPINUP PhyID %d \n", PhyID));
+
+ for (i=0;i<TD_MAX_NUM_NOTIFY_SPINUP;i++)
+ {
+ saLocalPhyControl(agRoot, agNULL, 0, PhyID, AGSA_PHY_NOTIFY_ENABLE_SPINUP, agNULL);
+ }
+ }
+
+ /* update MCN */
+ tdsaUpdateMCN(dmRoot, onePortContext);
+#endif
+
+#ifdef TARGET_DRIVER
+ TI_DBG1(("ossaHwCB: target, link up PhyID 0x%x\n",PhyID));
+
+ /* notifying link up */
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#endif
+ }
+ else
+ {
+ TI_DBG5(("ossaHwCB: $$$$$ not end device. not adding....\n"));
+ }
+
+ saPortControl(agRoot, /* AGSA_PORT_SET_PORT_RECOVERY_TIME */
+ agNULL,
+ 0,
+ agPortContext,
+ AGSA_PORT_SET_PORT_RECOVERY_TIME,
+ tdsaAllShared->portTMO, //PORT_RECOVERY_TIMEOUT
+ 0
+ );
+ /* setting SAS PORT RESET TMO and SATA PORT RESET TMO*/
+ if (tIsSPCV12G(agRoot))
+ {
+ saPortControl(agRoot, /* AGSA_PORT_SET_PORT_RESET_TIME */
+ agNULL,
+ 0,
+ agPortContext,
+ AGSA_PORT_SET_PORT_RESET_TIME,
+ SAS_12G_PORT_RESET_TMO, // 800 ms
+ 0
+ );
+ }
+ else
+ {
+ saPortControl(agRoot, /* AGSA_PORT_SET_PORT_RESET_TIME */
+ agNULL,
+ 0,
+ agPortContext,
+ AGSA_PORT_SET_PORT_RESET_TIME,
+ SAS_PORT_RESET_TMO, // 300 ms
+ 0
+ );
+ }
+ }
+ else
+ {
+ /*
+ an existing portcontext
+ to be tested
+ */
+
+ TI_DBG2(("ossaHwCB: SAS existing portcontext returned\n"));
+
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is NULL, wrong!\n"));
+ return;
+ }
+ if (onePortContext->valid == agFALSE)
+ {
+ /* port has been invalidated; needs to be allocated */
+ TI_DBG2(("ossaHwCB: SAS allocating port context\n"));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ if (TDLIST_NOT_EMPTY(&(tdsaAllShared->FreePortContextList)))
+ {
+ TDLIST_DEQUEUE_FROM_HEAD(&PortContextList, &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, PortContextList);
+ TI_DBG2(("ossaHwCB: allocating pid %d\n", onePortContext->id));
+ TI_DBG6(("ossaHwCB: allocating onePortContext %p\n", onePortContext));
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is NULL in allocation, wrong!\n"));
+ return;
+ }
+ /* sets fields of tdsaportcontext */
+#ifdef INITIATOR_DRIVER
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+#endif
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+ if (IDframe == agNULL)
+ {
+ onePortContext->sasRemoteAddressHi = 0xFFFFFFFF;
+ onePortContext->sasRemoteAddressLo = 0xFFFFFFFF;
+ onePortContext->directAttatchedSAS = agTRUE;
+ }
+ else
+ {
+ onePortContext->sasRemoteAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(IDframe);
+ onePortContext->sasRemoteAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(IDframe);
+ /* Create ID frame and storing ID frame */
+ osti_memcpy(&onePortContext->sasIDframe, IDframe, sizeof(agsaSASIdentify_t));
+ tdhexdump("ossaHWCB: sasIDframe", (bit8 *)(&onePortContext->sasIDframe), sizeof(agsaSASIdentify_t));
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_END_DEVICE)
+ {
+ onePortContext->directAttatchedSAS = agTRUE;
+ }
+ }
+
+ onePortContext->sasLocalAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->sasLocalAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->tiPortalContext = tdsaAllShared->Ports[PhyID].tiPortalContext;
+ onePortContext->agRoot = agRoot;
+ onePortContext->agPortContext = agPortContext;
+ tdsaAllShared->Ports[PhyID].portContext = onePortContext;
+ agPortContext->osData = onePortContext;
+ onePortContext->valid = agTRUE;
+ if (LinkRate == 0x01)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_1_5G;
+ }
+ else if (LinkRate == 0x02)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_3_0G;
+ }
+ else if (LinkRate == 0x04)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_6_0G;
+ }
+ else /* (LinkRate == 0x08) */
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_12_0G;
+ }
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->MainLink), &(tdsaAllShared->MainPortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ TI_DBG1(("\nossaHwCB: Attention!!! no more free PortContext.\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "Y2");
+ return;
+ }
+ } /* invalidated port */
+ else
+ {
+ /* already alloacated */
+ TI_DBG2(("ossaHwCB: SAS already allocated port context\n"));
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainPortContextList)))
+ {
+ TI_DBG1(("ossaHwCB: wrong!!! null tdsaPortContext list\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "Y2");
+ return;
+ }
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: wrong !!! No corressponding tdsaPortContext\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'f', "Y2");
+ return;
+ }
+
+ TI_DBG2(("ossaHwCB: existing pid %d\n", onePortContext->id));
+ if (tdsaAllShared->Ports[PhyID].portContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: existing allshared pid is NULL\n"));
+ }
+ else
+ {
+ TI_DBG2(("ossaHwCB: existing allshared pid %d\n", tdsaAllShared->Ports[PhyID].portContext->id));
+ }
+ /* updates PhyID belong to a port */
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+#ifdef FDS_DM
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) == SAS_END_DEVICE &&
+ SA_IDFRM_IS_SSP_TARGET(IDframe) )
+ {
+ TI_DBG2(("ossaHwCB: NOTIFY_ENABLE_SPINUP PhyID %d \n", PhyID));
+
+ for (i=0;i<TD_MAX_NUM_NOTIFY_SPINUP;i++)
+ {
+ saLocalPhyControl(agRoot, agNULL, 0, PhyID, AGSA_PHY_NOTIFY_ENABLE_SPINUP, agNULL);
+ }
+ }
+
+ /* update MCN */
+ tdsaUpdateMCN(dmRoot, onePortContext);
+#endif
+ }
+ onePortContext->SeenLinkUp = agTRUE;
+ } /* else, old portcontext */
+
+ break;
+ }
+#ifdef INITIATOR_DRIVER
+ case OSSA_HW_EVENT_SATA_PHY_UP:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ LinkRate = TD_GET_LINK_RATE(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agDevHandle = agNULL;
+ RegD2H = ( agsaFisRegDeviceToHost_t *)eventParm3;
+
+ TI_DBG2(("ossaHwCB: Phy%d SATA link Up\n", PhyID));
+
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG3(("ossaHwCB: agDevHandle null by design change\n"));
+ }
+
+ if (RegD2H == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: RegD2H null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'g', "Y2");
+ return;
+ }
+
+
+ TI_DBG2(("ossaHwCB: agDevHandle %p\n", agDevHandle));
+ tdhexdump("ossaHWCB RegD2H", (bit8 *)RegD2H, sizeof(agsaFisRegDeviceToHost_t));
+ TI_DBG2(("ossaHwCB: Sector Count %d\n", RegD2H->d.sectorCount));
+ TI_DBG2(("ossaHwCB: LBA LOW %d\n", RegD2H->d.lbaLow));
+ TI_DBG2(("ossaHwCB: LBA MID %d\n", RegD2H->d.lbaMid));
+ TI_DBG2(("ossaHwCB: LBA HIGH %d\n", RegD2H->d.lbaHigh));
+ TI_DBG2(("ossaHwCB: DEVICE %d\n", RegD2H->d.device));
+
+ /* debugging only */
+ if (LinkRate == 0x01)
+ {
+ TI_DBG1(("ossaHwCB: SATA Link Rate is 1.5 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x02)
+ {
+ TI_DBG1(("ossaHwCB: SATA Link Rate is 3.0 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x04)
+ {
+ TI_DBG1(("ossaHwCB: SATA Link Rate is 6.0 Gbps PhyID %d\n",PhyID));
+ }
+ if (LinkRate == 0x08)
+ {
+ TI_DBG1(("ossaHwCB: SATA Link Rate is 12.0 Gbps PhyID %d\n",PhyID));
+ }
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with SATA link up\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'h', "Y2");
+ return;
+ }
+
+ if ( agPortContext->osData == agNULL)
+ {/* if */
+ TI_DBG6 (("ossaHwCB: PhyID %d tdsaAllShared %p\n", PhyID, tdsaAllShared));
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ if (TDLIST_NOT_EMPTY(&(tdsaAllShared->FreePortContextList)))
+ {
+ TDLIST_DEQUEUE_FROM_HEAD(&PortContextList, &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, PortContextList);
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+ TI_DBG6(("ossaHwCB: onePortContext %p\n", onePortContext));
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is NULL in allocation, wrong!\n"));
+ return;
+ }
+
+ /* sets fields of tdsaportcontext */
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+ /* NO sas address for SATA */
+ onePortContext->sasRemoteAddressHi = 0xFFFFFFFF;
+ onePortContext->sasRemoteAddressLo = 0xFFFFFFFF;
+ /* copying the signature */
+ onePortContext->remoteSignature[0] = RegD2H->d.sectorCount;
+ onePortContext->remoteSignature[1] = RegD2H->d.lbaLow;
+ onePortContext->remoteSignature[2] = RegD2H->d.lbaMid;
+ onePortContext->remoteSignature[3] = RegD2H->d.lbaHigh;
+ onePortContext->remoteSignature[4] = RegD2H->d.device;
+
+ onePortContext->sasLocalAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->sasLocalAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->tiPortalContext = tdsaAllShared->Ports[PhyID].tiPortalContext;
+ onePortContext->agRoot = agRoot;
+ onePortContext->agPortContext = agPortContext;
+ tdsaAllShared->Ports[PhyID].portContext = onePortContext;
+ agPortContext->osData = onePortContext;
+ onePortContext->nativeSATAMode = agTRUE;
+ onePortContext->valid = agTRUE;
+ if (LinkRate == 0x01)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_1_5G;
+ }
+ else if (LinkRate == 0x02)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_3_0G;
+ }
+ else if (LinkRate == 0x04)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_6_0G;
+ }
+ else /* (LinkRate == 0x08) */
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_12_0G;
+ }
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->MainLink), &(tdsaAllShared->MainPortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ TI_DBG1(("\nossaHwCB: Attention!!! no more free PortContext.\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'i', "Y2");
+ return;
+ }
+#ifdef SATA_ENABLE
+ /* tdssAddSATAToSharedcontext() sends identify device data to find out the uniqueness of
+ target. In identify device data CB fn (satAddSATAIDDevCB()),
+ tiPortLinkUp and tiPortDiscoveryReady happen
+ */
+ tdssAddSATAToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle, /* agNULL */
+ agNULL,
+ agTRUE,
+ (bit8)PhyID
+ );
+#endif
+ /* setting SAS PORT RESET TMO and SATA PORT RESET TMO*/
+ saPortControl(agRoot, /* AGSA_PORT_SET_PORT_RESET_TIME */
+ agNULL,
+ 0,
+ agPortContext,
+ AGSA_PORT_SET_PORT_RESET_TIME,
+ 0,
+ SATA_PORT_RESET_TMO // 8000 ms
+ );
+
+ }
+ else
+ {
+ /*
+ an existing portcontext
+ to be tested
+ */
+
+ TI_DBG1(("ossaHwCB: SATA existing portcontext returned. need testing\n"));
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ /* for debugging only */
+ if (onePortContext->valid == agFALSE)
+ {
+ /* port has been invalidated; needs to be allocated */
+ TI_DBG2(("ossaHwCB: SATA allocating port context\n"));
+ }
+ else
+ {
+ /* already alloacated */
+ TI_DBG1(("ossaHwCB: Wrong!!! SATA already allocated port context\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'j', "Y2");
+ return;
+ }
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ if (TDLIST_NOT_EMPTY(&(tdsaAllShared->FreePortContextList)))
+ {
+ TDLIST_DEQUEUE_FROM_HEAD(&PortContextList, &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, PortContextList);
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+ TI_DBG6(("ossaHwCB: onePortContext %p\n", onePortContext));
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is NULL in allocation, wrong!\n"));
+ return;
+ }
+
+ /* sets fields of tdsaportcontext */
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+ /* NO sas address for SATA */
+ onePortContext->sasRemoteAddressHi = 0xFFFFFFFF;
+ onePortContext->sasRemoteAddressLo = 0xFFFFFFFF;
+ /* copying the signature */
+ onePortContext->remoteSignature[0] = RegD2H->d.sectorCount;
+ onePortContext->remoteSignature[1] = RegD2H->d.lbaLow;
+ onePortContext->remoteSignature[2] = RegD2H->d.lbaMid;
+ onePortContext->remoteSignature[3] = RegD2H->d.lbaHigh;
+ onePortContext->remoteSignature[4] = RegD2H->d.device;
+
+ onePortContext->sasLocalAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->sasLocalAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(&tdsaAllShared->Ports[PhyID].SASID);
+ onePortContext->tiPortalContext = tdsaAllShared->Ports[PhyID].tiPortalContext;
+ onePortContext->agRoot = agRoot;
+ onePortContext->agPortContext = agPortContext;
+ tdsaAllShared->Ports[PhyID].portContext = onePortContext;
+ agPortContext->osData = onePortContext;
+ onePortContext->nativeSATAMode = agTRUE;
+ onePortContext->valid = agTRUE;
+ if (LinkRate == 0x01)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_1_5G;
+ }
+ else if (LinkRate == 0x02)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_3_0G;
+ }
+ else if (LinkRate == 0x04)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_6_0G;
+ }
+ else /* (LinkRate == 0x08) */
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_12_0G;
+ }
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->MainLink), &(tdsaAllShared->MainPortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ TI_DBG1(("\nossaHwCB: Attention!!! no more free PortContext.\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'k', "Y2");
+ return;
+ }
+
+
+ /*hotplug */
+#ifdef SATA_ENABLE
+ tdssAddSATAToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle, /* agNULL */
+ agNULL,
+ agTRUE,
+ (bit8)PhyID
+ );
+#endif
+ /* end hotplug */
+ }
+
+ break;
+ }
+#endif
+ case OSSA_HW_EVENT_SATA_SPINUP_HOLD:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+
+ TI_DBG2(("ossaHwCB: spinup hold PhyID %d\n", PhyID));
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_DOWN:
+ {
+ bit32 AllPhyDown = agTRUE;
+
+ /* 4/15/08 spec */
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ LinkRate = TD_GET_LINK_RATE(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+
+ TI_DBG2(("ossaHwCB: Phy%d link Down\n", PhyID));
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'l', "Y2");
+ return;
+ }
+
+ if ( agPortContext->osData == agNULL)
+ { /* if */
+ /* PortContext must exit at this point */
+ TI_DBG1(("ossaHwCB: NULL portalcontext. Error. Can't be NULL\n"));
+ }
+ else
+ {
+ TI_DBG3(("ossaHwCB: NOT NULL portalcontext\n"));
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: wrong !!! No corressponding tdsaPortContext\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'm', "Y2");
+ return;
+ }
+ onePortContext->PhyIDList[PhyID] = agFALSE;
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ TI_DBG3(("ossaHwCB: Phy %d is still up\n", i));
+ AllPhyDown = agFALSE;
+ break;
+ }
+ }
+
+ /* last phy belong to the portcontext */
+ if (AllPhyDown == agTRUE)
+ {
+#ifdef NOT_YET
+ TI_DBG1(("ossaHwCB: calling tiPortLinkDown\n"));
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+ }
+
+ if (PortState == OSSA_PORT_VALID)
+ {
+ /* do nothing */
+ /* no ack for every phy down */
+#ifdef FDS_DM
+ /* update MCN for all devices belong to this port */
+ tdsaUpdateMCN(dmRoot, onePortContext);
+#endif
+ }
+ else if (PortState == OSSA_PORT_LOSTCOMM)
+ {
+ /*
+ 1. Mark the port as invalid and stop the io for that port and its device
+ No ack here. Otherwise, port will be released by FW.
+ */
+ TI_DBG2(("ossaHwCB: phy Down and OSSA_PORT_LOSTCOMM\n"));
+ /* save eventSource related information in tdsaAllShared */
+ tdsaAllShared->eventSource[PhyID].EventValid = agTRUE;
+ tdsaAllShared->eventSource[PhyID].Source.agPortContext = agPortContext;
+ tdsaAllShared->eventSource[PhyID].Source.event = OSSA_HW_EVENT_PHY_DOWN;
+ /* phy ID */
+ tdsaAllShared->eventSource[PhyID].Source.param = PhyID;
+ /* phy ID */
+ onePortContext->eventPhyID = PhyID;
+ /* to stop IO's */
+ onePortContext->valid = agFALSE;
+ break;
+ }
+ else if (PortState == OSSA_PORT_IN_RESET)
+ {
+ TI_DBG2(("ossaHwCB: phy Down and OSSA_PORT_IN_RESET\n"));
+ /* save eventSource related information in tdsaAllShared */
+ tdsaAllShared->eventSource[PhyID].EventValid = agTRUE;
+ tdsaAllShared->eventSource[PhyID].Source.agPortContext = agPortContext;
+ tdsaAllShared->eventSource[PhyID].Source.event = OSSA_HW_EVENT_PHY_DOWN;
+ /* phy ID */
+ tdsaAllShared->eventSource[PhyID].Source.param = PhyID;
+ /* phy ID */
+ onePortContext->eventPhyID = PhyID;
+ /* to stop IO's */
+ onePortContext->valid = agFALSE;
+ break;
+ }
+ else if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Last phy Down and port invalid OSSA_PORT_INVALID\n"));
+ /*
+ invalidate port
+ then, saHwEventAck() in ossaDeregisterDeviceHandleCB()
+ */
+
+ /* save eventSource related information in tdsaAllShared */
+ tdsaAllShared->eventSource[PhyID].EventValid = agTRUE;
+ tdsaAllShared->eventSource[PhyID].Source.agPortContext = agPortContext;
+ tdsaAllShared->eventSource[PhyID].Source.event = OSSA_HW_EVENT_PHY_DOWN;
+ /* phy ID */
+ tdsaAllShared->eventSource[PhyID].Source.param = PhyID;
+ /* phy ID */
+ onePortContext->eventPhyID = PhyID;
+
+ onePortContext->valid = agFALSE;
+
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+#ifdef INITIATOR_DRIVER
+ /* notifying link down (all links belonging to a port are down) */
+ ostiPortEvent(
+ tiRoot,
+ tiPortStopped,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+
+#ifdef TARGET_DRIVER
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+
+#endif
+
+#ifdef INITIATOR_DRIVER
+ tdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+#endif
+#ifdef TARGET_DRIVER
+ ttdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+
+#endif
+
+ /* find a PhyID and reset for portContext in tdssSASShared */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ }
+ }
+ /* portcontext is removed from MainLink to FreeLink in tdssReportRemovals or
+ ossaDeregisterDeviceHandleCB
+ */
+ }/* OSSA_PORT_INVALID */
+ else
+ {
+ /* other newly defined port state */
+ /* do nothing */
+ TI_DBG2(("ossaHwCB: portstate 0x%x\n", PortState));
+ }
+ } /* big else */
+ break;
+ }
+ case OSSA_HW_EVENT_PHY_START_STATUS:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PhyStatus = TD_GET_PHY_STATUS(eventParm1);
+
+ TI_DBG6(("ossaHwCB: OSSA_HW_EVENT_PHY_START_STATUS\n"));
+ if (PhyStatus == 0x00)
+ {
+ TI_DBG6(("ossaHwCB: OSSA_HW_EVENT_PHY_START_STATUS, SUCCESS\n"));
+ }
+ else if (PhyStatus == 0x01)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_START_STATUS, INVALID_PHY\n"));
+ }
+ else if (PhyStatus == 0x02)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_START_STATUS, PHY_NOT_DISABLED\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_START_STATUS, OTHER_FAILURE %d\n", PhyStatus));
+ }
+ break;
+ }
+ case OSSA_HW_EVENT_PHY_STOP_STATUS:
+ {
+ agsaContext_t *agContext;
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PhyStatus = TD_GET_PHY_STATUS(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS\n"));
+ if (PhyStatus == 0x00)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, SUCCESS\n"));
+ agContext = (agsaContext_t *)eventParm2;
+ onePortContext = (tdsaPortContext_t *)agContext->osData;;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: onePortContext is null, wrong!!!\n"));
+ return;
+ }
+ onePortContext->PhyIDList[PhyID] = agFALSE;
+ if (PortState == OSSA_PORT_INVALID) /* invalid port */
+ {
+ TI_DBG1(("ossaHwCB: OSSA_PORT_INVALID\n"));
+ tdsaAllShared->eventSource[PhyID].EventValid = NO_ACK;
+ onePortContext->eventPhyID = PhyID;
+ onePortContext->valid = agFALSE;
+
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+#ifdef INITIATOR_DRIVER
+ /* notifying link down (all links belonging to a port are down) */
+ ostiPortEvent(
+ tiRoot,
+ tiPortStopped,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+
+#ifdef TARGET_DRIVER
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+
+#endif
+
+#ifdef INITIATOR_DRIVER
+ tdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+#endif
+#ifdef TARGET_DRIVER
+ ttdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+
+#endif
+
+ /* find a PhyID and reset for portContext in tdssSASShared */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ }
+ }
+ /* portcontext is removed from MainLink to FreeLink in tdssReportRemovals or
+ ossaDeregisterDeviceHandleCB
+ */
+ } /* invalid port */
+ }
+ else if (PhyStatus == 0x01)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, INVALID_PHY\n"));
+ }
+ else if (PhyStatus == 0x02)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, DEVICES_ATTACHED\n"));
+ }
+ else if (PhyStatus == 0x03)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, OTHER_FAILURE\n"));
+ }
+ else if (PhyStatus == 0x04)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, PHY_NOT_DISABLED\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_STOP_STATUS, Unknown %d\n", PhyStatus));
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_RESET_START:
+ {
+ bit32 new_status = TD_GET_RESET_STATUS(eventParm1);
+ TI_DBG2(("ossaHwCB: RESET_START, status %d\n", new_status));
+ if (new_status == OSSA_SUCCESS)
+ {
+ tdsaAllShared->flags.resetInProgress = agTRUE;
+ TI_DBG2(("ossaHwCB: RESET_START, SUCCESS\n"));
+ }
+ else if (new_status == OSSA_FAILURE)
+ {
+ TI_DBG1(("ossaHwCB: RESET_START, FAILURE\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: RESET_START, PENDING\n"));
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_RESET_COMPLETE:
+ {
+ bit32 new_status = TD_GET_RESET_STATUS(eventParm1);
+#ifdef SOFT_RESET_TEST
+ DbgPrint("Reset Complete\n");
+#endif
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_RESET_COMPLETE, status %d\n", new_status));
+ if (new_status == OSSA_SUCCESS)
+ {
+ /* remove all portcontext and devices */
+#ifdef INITIATOR_DRIVER
+ tdssRemoveSASSATAFromSharedcontextByReset(agRoot);
+#endif
+ tdsaAllShared->flags.resetInProgress = agFALSE;
+ /*
+ a callback notifying reset completion
+ */
+ ostiPortEvent(
+ tiRoot,
+ tiPortResetComplete,
+ tiSuccess,
+ agNULL
+ );
+ }
+ else
+ {
+ /*
+ a callback notifying reset completion
+ */
+ tdsaAllShared->flags.resetInProgress = agFALSE;
+ ostiPortEvent(
+ tiRoot,
+ tiPortResetComplete,
+ tiError,
+ agNULL
+ );
+
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC from PhyID %d; to be tested\n", PhyID));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'n', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: iDw %d rDE %d cV %d lS %d rP %d iCRC %d\n",
+ agPhyErrCountersPage->invalidDword,
+ agPhyErrCountersPage->runningDisparityError,
+ agPhyErrCountersPage->codeViolation,
+ agPhyErrCountersPage->lossOfDwordSynch,
+ agPhyErrCountersPage->phyResetProblem,
+ agPhyErrCountersPage->inboundCRCError ));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'o', "Y2");
+ return;
+ }
+ break;
+ }
+#ifdef REMOVED
+ case OSSA_HW_EVENT_PORT_INVALID:
+ {
+ TI_DBG1(("ossaHwCB: PORT_INVALID\n"));
+
+ if ( agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext is NULL, wrong.\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'p', "Y2");
+ return;
+ }
+ if ( agPortContext->osData != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: NOT NULL osDATA\n"));
+ /*
+ put the old portcontext back to free list
+ */
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ TI_DBG1(("ossaHwCB: pid %d\n", onePortContext->id));
+
+#ifdef INITIATOR_DRIVER
+ /* notifying link down (all links belonging to a port are down) */
+ ostiPortEvent (
+ tiRoot,
+ tiPortStopped,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+
+ );
+#endif /* INITIATOR_DRIVER */
+#ifdef TARGET_DRIVER
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+
+#endif /*TARGET_DRIVER */
+
+ /* find the device belonging to the port and remove it from the device list */
+ //tdssRemoveSASSATAFromSharedcontext(agRoot, tdsaDeviceData, onePortContext);
+
+
+#ifdef INITIATOR_DRIVER
+ /* reset the fields of portcontext */
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ tdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+ onePortContext->DiscoveryRdyGiven = agFALSE;
+ onePortContext->SeenLinkUp = agFALSE;
+
+#endif /* INITIATOR_DRIVER */
+
+
+
+ /* for hotplug */
+
+ /* find a PhyID and reset for portContext in tdssSASShared */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ }
+ }
+
+ /* reset PhyIDList in portcontext */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ onePortContext->PhyIDList[i] = agFALSE;
+ }
+
+// onePortContext->tiPortalContext = agNULL;
+// onePortContext->agRoot = agNULL;
+ onePortContext->agPortContext = agNULL;
+ onePortContext->valid = agFALSE;
+
+ TI_DBG4(("ossaHwCB: pid %d count %d\n", onePortContext->id, onePortContext->Count));
+
+ /* resets the number of devices in onePortContext */
+ onePortContext->Count = 0;
+ onePortContext->discovery.pendingSMP = 0;
+ onePortContext->discovery.SeenBC = agFALSE;
+
+
+ /*
+ put all devices belonging to the onePortContext
+ back to the free link
+ */
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaPortContext->FreeLink));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: NULL osDATA: wrong\n"));
+ }
+ TI_DBG6(("ossaHwCB: PORT_INVALID end\n"));
+ break;
+ }
+#endif /* REMOVED */
+
+ case OSSA_HW_EVENT_BROADCAST_CHANGE:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE from PhyID %d\n", PhyID));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with BROADCAST_CHANGE\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'q', "Y2");
+ return;
+ }
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_BROADCAST_CHANGE;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ TI_DBG4(("ossaHwCB: calling saHwEventAck\n"));
+
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'r', "Y2");
+ return;
+ }
+ if (tIsSPC12SATA(agRoot))
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE received for SATA Controller\n"));
+ break;
+ }
+ /*
+ * incremental discovery is to be tested and debugged further
+ */
+
+ /* just for testing discovery abort */
+#ifdef FDS_DM_NO
+ if (agPortContext == agNULL)
+ {
+ /* this case happens when broadcase is received first before the link up */
+ TI_DBG2(("ossaHwCB: agPortContext is NULL. Do nothing.\n"));
+ }
+ else if ( agPortContext->osData != agNULL)
+ {
+ dmRoot = &(tdsaAllShared->dmRoot);
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ dmPortContext = &(onePortContext->dmPortContext);
+
+ dmQueryDiscovery(dmRoot, dmPortContext);
+// dmDiscover(dmRoot, dmPortContext, DM_DISCOVERY_OPTION_ABORT);
+
+#if 1
+ if (onePortContext->DMDiscoveryState == dmDiscInProgress)
+ {
+ dmDiscover(dmRoot, dmPortContext, DM_DISCOVERY_OPTION_ABORT);
+ }
+#endif /* 1 */
+
+ TI_DBG2(("ossaHwCB: portcontext pid %d\n", onePortContext->id));
+ if (onePortContext->DMDiscoveryState == dmDiscCompleted ||
+ onePortContext->DMDiscoveryState == dmDiscAborted ||
+ onePortContext->DMDiscoveryState == dmDiscAbortInvalid )
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE; calling dmNotifyBC and does incremental discovery\n"));
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ dmDiscover(dmRoot, dmPortContext, DM_DISCOVERY_OPTION_INCREMENTAL_START);
+
+ }
+ else
+ {
+ TI_DBG2(("ossaHwCB: pid %d BROADCAST_CHANGE; updating SeenBC. calling dmNotifyBC\n", onePortContext->id));
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE NULL osDATA wrong !!! \n"));
+ }
+
+
+#endif /* FDS_DM_NO */
+
+#ifdef FDS_DM
+ if (agPortContext == agNULL)
+ {
+ /* this case happens when broadcase is received first before the link up */
+ TI_DBG2(("ossaHwCB: agPortContext is NULL. Do nothing.\n"));
+ }
+ else if ( agPortContext->osData != agNULL)
+ {
+ dmRoot = &(tdsaAllShared->dmRoot);
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ dmPortContext = &(onePortContext->dmPortContext);
+
+ dmQueryDiscovery(dmRoot, dmPortContext);
+
+ TI_DBG2(("ossaHwCB: portcontext pid %d\n", onePortContext->id));
+ if (onePortContext->DMDiscoveryState == dmDiscCompleted ||
+ onePortContext->DMDiscoveryState == dmDiscAborted ||
+ onePortContext->DMDiscoveryState == dmDiscAbortInvalid )
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE; calling dmNotifyBC and does incremental discovery, pid %d\n", onePortContext->id));
+ onePortContext->DiscoveryState = ITD_DSTATE_STARTED;
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ dmDiscover(dmRoot, dmPortContext, DM_DISCOVERY_OPTION_INCREMENTAL_START);
+
+ }
+ else if (onePortContext->DMDiscoveryState == dmDiscFailed )
+ {
+ TI_DBG1(("ossaHwCB: dmDiscFailed; pid %d BROADCAST_CHANGE; updating SeenBC. calling dmNotifyBC\n", onePortContext->id));
+ onePortContext->DiscFailNSeenBC = agTRUE;
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ }
+ else
+ {
+ TI_DBG2(("ossaHwCB: pid %d BROADCAST_CHANGE; updating SeenBC. calling dmNotifyBC\n", onePortContext->id));
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE NULL osDATA wrong !!! \n"));
+ }
+#endif /* FDS_DM */
+
+#ifdef FDS_DM_WORKED
+ if (agPortContext == agNULL)
+ {
+ /* this case happens when broadcase is received first before the link up */
+ TI_DBG2(("ossaHwCB: agPortContext is NULL. Do nothing.\n"));
+ }
+ else if ( agPortContext->osData != agNULL)
+ {
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ TI_DBG2(("ossaHwCB: calling dmNotifyBC\n"));
+ dmRoot = &(tdsaAllShared->dmRoot);
+ dmPortContext = &(onePortContext->dmPortContext);
+ dmNotifyBC(dmRoot, dmPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE);
+ }
+#endif /* FDS_DM_WORKED */
+
+#ifndef FDS_DM
+#ifdef INITIATOR_DRIVER
+ if (agPortContext == agNULL)
+ {
+ /* this case happens when broadcase is received first before the link up */
+ TI_DBG2(("ossaHwCB: agPortContext is NULL. Do nothing.\n"));
+ }
+ else if ( agPortContext->osData != agNULL)
+ {
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ TI_DBG2(("ossaHwCB: portcontext pid %d\n", onePortContext->id));
+ if (onePortContext->DiscoveryState == ITD_DSTATE_COMPLETED)
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE; does incremental discovery\n"));
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_INCREMENTAL_START;
+ /* processed broadcast change */
+ onePortContext->discovery.SeenBC = agFALSE;
+#ifdef TD_DISCOVER
+ if (tdsaAllShared->ResetInDiscovery != 0 &&
+ onePortContext->discovery.ResetTriggerred == agTRUE)
+ {
+ TI_DBG2(("ossaHwCB: tdsaBCTimer\n"));
+ tdsaBCTimer(tiRoot, onePortContext);
+ }
+ else
+ {
+ tdsaDiscover(
+ tiRoot,
+ onePortContext,
+ TDSA_DISCOVERY_TYPE_SAS,
+ TDSA_DISCOVERY_OPTION_INCREMENTAL_START
+ );
+ }
+#else
+ saDiscover(agRoot,
+ agPortContext,
+ AG_SA_DISCOVERY_TYPE_SAS,
+ onePortContext->discoveryOptions);
+#endif
+ }
+ else
+ {
+ TI_DBG2(("ossaHwCB: pid %d BROADCAST_CHANGE; updating SeenBC. Do nothing.\n", onePortContext->id));
+ onePortContext->discovery.SeenBC = agTRUE;
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_CHANGE NULL osDATA wrong !!! \n"));
+ }
+#endif
+#endif /* ifndef FDS_DM */
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ /*
+ 1. tear town the portcontext just like link down last phy down
+ 2. ack
+ port state must be invalid
+ */
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO\n"));
+
+ if (PortState == OSSA_PORT_VALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 's', "Y2");
+ return;
+ }
+
+ TD_ASSERT(agPortContext, "agPortContext");
+ if ( agPortContext->osData == agNULL)
+ { /* if */
+ /* PortContext must exit at this point */
+ TI_DBG1(("ossaHwCB: NULL portalcontext. Error. Can't be NULL\n"));
+ }
+ else
+ {
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ onePortContext->valid = agFALSE;
+
+ TI_DBG1(("ossaHwCB: tiPortStopped pid %d\n", onePortContext->id));
+#ifdef INITIATOR_DRIVER
+ /* notifying link down (all links belonging to a port are down) */
+ ostiPortEvent(
+ tiRoot,
+ tiPortStopped,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+
+#ifdef TARGET_DRIVER
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+
+#endif
+
+#ifdef INITIATOR_DRIVER
+ tdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+#endif
+#ifdef TARGET_DRIVER
+ ttdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+
+#endif
+ /* find a PhyID and reset for portContext in tdssSASShared */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ }
+ }
+ /* portcontext is removed from MainLink to FreeLink in tdssReportRemovals or
+ ossaDeregisterDeviceHandleCB
+ */
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PORT_RESET_TIMER_TMO:
+ {
+ /*
+ clean up
+ */
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PORT_RESET_TIMER_TMO\n"));
+
+ if (PortState == OSSA_PORT_VALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 't', "Y2");
+ return;
+ }
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext is NULL, error\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'u', "Y2");
+ return;
+ }
+
+ if ( agPortContext->osData == agNULL)
+ { /* if */
+ /* PortContext must exit at this point */
+ TI_DBG1(("ossaHwCB: NULL portalcontext. Error. Can't be NULL\n"));
+ }
+ else
+ {
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ onePortContext->valid = agFALSE;
+
+ TI_DBG1(("ossaHwCB: pid %d tiPortStopped\n", onePortContext->id));
+
+#ifdef INITIATOR_DRIVER
+ /* notifying link down (all links belonging to a port are down) */
+ ostiPortEvent(
+ tiRoot,
+ tiPortStopped,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+
+#ifdef TARGET_DRIVER
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkDown,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+
+#endif
+
+#ifdef INITIATOR_DRIVER
+ tdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+#endif
+#ifdef TARGET_DRIVER
+ ttdssReportRemovals(agRoot,
+ onePortContext,
+ agFALSE
+ );
+
+#endif
+ /* find a PhyID and reset for portContext in tdssSASShared */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ }
+ }
+ /* portcontext is removed from MainLink to FreeLink in tdssReportRemovals or
+ ossaDeregisterDeviceHandleCB
+ */
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PORT_RESET_COMPLETE:
+ {
+#ifdef INITIATOR_DRIVER
+ tiIORequest_t *currentTaskTag = agNULL;
+#endif
+
+#ifdef REMOVED
+ smRoot_t *smRoot = &(tdsaAllShared->smRoot);
+#endif
+
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ IDframe = (agsaSASIdentify_t *)eventParm3;
+
+ /* completes for Lun Reset and Target reset for directly attached SATA */
+ /* completes for Target reset for directly attached SAS */
+
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PORT_RESET_COMPLETE, phyID %d\n", PhyID));
+
+ /* error check */
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'v', "Y2");
+ return;
+ }
+
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'w', "Y2");
+ return;
+ }
+ if ( agPortContext->osData == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: agPortContext->osData null, wrong\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'x', "Y2");
+ return;
+ }
+
+ /* find a corresponding portcontext */
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: oneportContext is NULL; wrong??????\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: oneportContext %p pid %d\n", onePortContext, onePortContext->id));
+ onePortContext->valid = agTRUE;
+#ifdef INITIATOR_DRIVER
+#ifdef REMOVED
+ if (tdsaAllShared->ResetInDiscovery != 0)
+ {
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData->tdPortContext != onePortContext)
+ {
+ DeviceListList = DeviceListList->flink;
+ }
+ else
+ {
+ found = agTRUE;
+ break;
+ }
+ } /* while */
+ if (found == agTRUE)
+ {
+ /* applied to only SATA devices */
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ #ifdef FDS_SM
+ tdIDStart(tiRoot, agRoot, smRoot, oneDeviceData, onePortContext);
+ #else
+ tdssRetrySATAID(tiRoot, oneDeviceData);
+ #endif
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: no onedevicedata found!\n"));
+ }
+ }
+#endif
+ /* completed TM */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if ( oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+
+ if ( (oneDeviceData->tdPortContext == onePortContext) &&
+ (oneDeviceData->directlyAttached == agTRUE) &&
+ (oneDeviceData->phyID == PhyID) )
+ {
+ TI_DBG1(("ossaHwCB: found the onePortContext and oneDeviceData!!\n"));
+
+ currentTaskTag = (tiIORequest_t *)oneDeviceData->agDeviceResetContext.osData;
+ if (currentTaskTag != agNULL )
+ {
+ /* applied to only SATA devices */
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData))
+ {
+ tdIORequestBody_t *SMTMtdIORequestBody = agNULL;
+ SMTMtdIORequestBody = (tdIORequestBody_t *)currentTaskTag->tdData;
+ if (SMTMtdIORequestBody != agNULL)
+ {
+ /* free the SMTMtdIORequestBody memory allocated in tiINITaskManagement function */
+ ostiFreeMemory(
+ tiRoot,
+ SMTMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: SATA device but SMTMtdIORequestBody is NULL!!!\n"));
+ }
+ }
+ /* set device state to DS_OPERATIONAL */
+ saSetDeviceState(agRoot,
+ agNULL,
+ tdsaRotateQnumber(tiRoot, oneDeviceData),
+ oneDeviceData->agDevHandle,
+ SA_DS_OPERATIONAL
+ );
+ /* notify OS layer to complete the TMF IO */
+ ostiInitiatorEvent(tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMOK,
+ currentTaskTag
+ );
+
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: currentTaskTag is NULL!!!\n"));
+ }
+
+ break;
+ }
+ else
+ {
+ DeviceListList = DeviceListList->flink;
+ }
+ }
+#endif
+ }
+ break;
+ }
+ case OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT\n"));
+ if (tIsSPC12SATA(agRoot))
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_ASYNCH_EVENT received for SATA Controller\n"));
+ break;
+ }
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: Error!!! agPortContext is NULL %d\n", PhyID));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'y', "Y2");
+ return;
+ }
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: Error!!! onePortContext is NULL %d\n", PhyID));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'z', "Y2");
+ return;
+ }
+
+ if (onePortContext->tiPortalContext != agNULL)
+ {
+#if 0
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT,
+ agNULL
+ );
+#endif
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: Error!!! onePortContext->tiPortalContext is NULL\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'A', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PORT_RECOVER:
+ {
+
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("ossaHwCB: Error!!! agPortContext is NULL %d\n", PhyID));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'B', "Y2");
+ return;
+ }
+
+ LinkRate = TD_GET_LINK_RATE(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agDevHandle = agNULL;
+ IDframe = (agsaSASIdentify_t *)eventParm3;
+
+ /*
+ 1. this is like link up
+ 2. handle the phyID
+ 3. no trigger discovery (broadcast change will do this later)
+ port state must be valid
+ */
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PORT_RECOVER, phyID %d\n", PhyID));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'C', "Y2");
+ return;
+ }
+ if ( agPortContext->osData == agNULL)
+ { /* if */
+ /* PortContext must exit at this point */
+ TI_DBG1(("ossaHwCB: NULL portalcontext. Error. Can't be NULL\n"));
+ }
+ else
+ {
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ TI_DBG2(("ossaHwCB: pid %d\n", onePortContext->id));
+ onePortContext->PhyIDList[PhyID] = agTRUE;
+ onePortContext->valid = agTRUE;
+ tdsaAllShared->Ports[PhyID].portContext = onePortContext;
+ onePortContext->tiPortalContext = tdsaAllShared->Ports[PhyID].tiPortalContext;
+ onePortContext->PortRecoverPhyID = PhyID;
+ if (LinkRate == 0x01)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_1_5G;
+ }
+ else if (LinkRate == 0x02)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_3_0G;
+ }
+ else if (LinkRate == 0x04)
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_6_0G;
+ }
+ else /* (LinkRate == 0x08) */
+ {
+ onePortContext->LinkRate = SAS_CONNECTION_RATE_12_0G;
+ }
+
+ if (SA_IDFRM_GET_DEVICETTYPE(&onePortContext->sasIDframe) == SAS_END_DEVICE &&
+ SA_IDFRM_IS_SSP_TARGET(&onePortContext->sasIDframe) )
+ {
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PORT_RECOVER, sending spinup on phyID %d\n", PhyID));
+ for (i=0;i<TD_MAX_NUM_NOTIFY_SPINUP;i++)
+ {
+ saLocalPhyControl(agRoot, agNULL, 0, PhyID, AGSA_PHY_NOTIFY_ENABLE_SPINUP, agNULL);
+ }
+ }
+
+ /* transient period between link up and link down/port recovery */
+ if (onePortContext->Transient == agTRUE && onePortContext->RegisteredDevNums == 0)
+ {
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PORT_RECOVER transient period"));
+ if (SA_IDFRM_GET_DEVICETTYPE(IDframe) != SAS_NO_DEVICE)
+ {
+#ifdef INITIATOR_DRIVER
+ agSASSubID.sasAddressHi = SA_IDFRM_GET_SAS_ADDRESSHI(IDframe);
+ agSASSubID.sasAddressLo = SA_IDFRM_GET_SAS_ADDRESSLO(IDframe);
+ agSASSubID.initiator_ssp_stp_smp = IDframe->initiator_ssp_stp_smp;
+ agSASSubID.target_ssp_stp_smp = IDframe->target_ssp_stp_smp;
+ tdssAddSASToSharedcontext(
+ onePortContext,
+ agRoot,
+ agDevHandle, /* agNULL */
+ &agSASSubID,
+ agTRUE,
+ (bit8)PhyID,
+ TD_OPERATION_INITIATOR
+ );
+#endif
+ }
+ onePortContext->Transient = agFALSE;
+ }
+
+
+
+
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_BROADCAST_SES:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: BROADCAST_SES from PhyID %d; to be tested\n", PhyID));
+ if (tIsSPC12SATA(agRoot))
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_SES received for SATA Controller\n"));
+ break;
+ }
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with BROADCAST_SES\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'D', "Y2");
+ return;
+ }
+
+ /*
+ let os layer read payload
+ */
+ break;
+ }
+ case OSSA_HW_EVENT_BROADCAST_EXP:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: BROADCAST_EXP from PhyID %d; to be tested\n", PhyID));
+ if (tIsSPC12SATA(agRoot))
+ {
+ TI_DBG1(("ossaHwCB: BROADCAST_EXP received for SATA Controller\n"));
+ break;
+ }
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with BROADCAST_EXP\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'E', "Y2");
+ return;
+ }
+ /* to-do:
+ let os layer read payload
+ */
+ break;
+ }
+
+ case OSSA_HW_EVENT_HARD_RESET_RECEIVED:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: HARD_RESET_RECEIVED from PhyID %d\n", PhyID));
+
+ if (PortState == OSSA_PORT_VALID && tiIS_SPC(agRoot))
+ {
+ TI_DBG1(("ossaHwCB: calling saPortControl and OSSA_PORT_VALID\n"));
+ saPortControl(agRoot, agNULL, 0, agPortContext, AGSA_PORT_HARD_RESET, 0,0);
+ }
+ else if (PortState == OSSA_PORT_3RDPARTY_RESET && (tIsSPCV12or6G(agRoot)) )
+ {
+ TI_DBG1(("ossaHwCB: calling saPortControl and OSSA_PORT_3RDPARTY_RESET\n"));
+ saPortControl(agRoot, agNULL, 0, agPortContext, AGSA_PORT_HARD_RESET, 0,0);
+ }
+ else /* PortState == OSSA_PORT_INVALID */
+ {
+ TI_DBG1(("ossaHwCB: Error. Port state is invalid\n"));
+#ifdef REMOVED
+ TI_DBG1(("ossaHwCB: calling saLocalPhyControl on phyID %d\n", PhyID));
+ saLocalPhyControl(agRoot, agNULL, 0, PhyID, AGSA_PHY_LINK_RESET, agNULL);
+#endif
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_MALFUNCTION:
+ {
+#ifdef TD_DEBUG_ENABLE
+ agsaFatalErrorInfo_t *FatalError = (agsaFatalErrorInfo_t *)eventParm2;
+#endif
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_MALFUNCTION \n"));
+ TI_DBG1(("ossaHwCB: errorInfo0 %8X errorInfo1 %8X\n", FatalError->errorInfo0, FatalError->errorInfo1));
+ TI_DBG1(("ossaHwCB: errorInfo2 %8X errorInfo3 %8X\n", FatalError->errorInfo2, FatalError->errorInfo3));
+ TI_DBG1(("ossaHwCB: regDumpBusBaseNum0 %8X regDumpOffset0 %8X regDumpLen0 %8X\n", FatalError->regDumpBusBaseNum0, FatalError->regDumpOffset0, FatalError->regDumpLen0));
+ TI_DBG1(("ossaHwCB: regDumpBusBaseNum1 %8X regDumpOffset1 %8X regDumpLen1 %8X\n", FatalError->regDumpBusBaseNum1, FatalError->regDumpOffset1, FatalError->regDumpLen1));
+
+
+ if (eventParm1 == agTRUE)
+ {
+ TI_DBG1(("ossaHwCB: fatal error\n"));
+ /* port panic */
+ ostiPortEvent (
+ tiRoot,
+ tiPortPanic,
+ 0,
+ agNULL
+ );
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: non-fatal error \n"));
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_ID_FRAME_TIMEOUT:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_ID_FRAME_TIMEOUT from PhyID %d\n", PhyID));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_ID_FRAME_TIMEOUT\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'F', "Y2");
+ return;
+ }
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'G', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: invalidDword %d\n", agPhyErrCountersPage->invalidDword));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'H', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'I', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: runningDisparityError %d\n", agPhyErrCountersPage->runningDisparityError));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'J', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'K', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: codeViolation %d\n", agPhyErrCountersPage->codeViolation));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'L', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+#ifdef REMOVED
+ case OSSA_HW_EVENT_LINK_ERR_CODE_VIOLATION1:
+ {
+ PhyID = eventParm1 & 0xFF;
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_LINK_ERR_CODE_VIOLATION1 from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: invalidDword %d\n", agPhyErrCountersPage->invalidDword));
+ TI_DBG1(("ossaHwCB: runningDisparityError %d\n", agPhyErrCountersPage->runningDisparityError));
+ TI_DBG1(("ossaHwCB: codeViolation %d\n", agPhyErrCountersPage->codeViolation));
+ TI_DBG1(("ossaHwCB: lostOfDwordSynch %d\n", agPhyErrCountersPage->lossOfDwordSynch));
+ TI_DBG1(("ossaHwCB: phyResetProblem %d\n", agPhyErrCountersPage->phyResetProblem));
+ TI_DBG1(("ossaHwCB: inboundCRCError %d\n", agPhyErrCountersPage->inboundCRCError));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_LINK_ERR_CODE_VIOLATION1: Error!!! eventParm2 is NULL\n"));
+ }
+ break;
+ }
+#endif /* REMOVED */
+
+ case OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'M', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: lostOfDwordSynch %d\n", agPhyErrCountersPage->lossOfDwordSynch));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'N', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+ case OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+ agPhyErrCountersPage = (agsaPhyErrCountersPage_t *)eventParm2;
+
+ TI_DBG2(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: Wrong port state with OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'O', "Y2");
+ return;
+ }
+
+ if (agPhyErrCountersPage != agNULL)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED from PhyID %d\n", PhyID));
+ TI_DBG1(("ossaHwCB: phyResetProblem %d\n", agPhyErrCountersPage->phyResetProblem));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED: Error!!! eventParm2 is NULL\n"));
+ }
+
+ /* saHwEventAck() */
+ eventSource.agPortContext = agPortContext;
+ eventSource.event = OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED;
+ /* phy ID */
+ eventSource.param = PhyID;
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ &eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaHwCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'P', "Y2");
+ return;
+ }
+
+ break;
+ }
+
+// #ifdef INITIATOR_DRIVER
+ case OSSA_HW_EVENT_ENCRYPTION:
+ {
+ pEncryptCBData = (agsaHWEventEncrypt_t *) eventParm2;
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_ENCRYPTION: encryptOperation 0x%x\n",pEncryptCBData->encryptOperation));
+ TI_DBG1(("ossaHwCB: event 0x%x eventParm1 0x%x eventParm2 %p eventParm3 %p\n",event,eventParm1,eventParm2,eventParm3));
+
+ /*
+ * All events and status need to be translated from
+ * SAS specific values to TISA specific values. This
+ * is effectively a NOP, but the OS layer won't want to
+ * look for SAS values.
+ */
+ if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE\n"));
+ encryptEventData.encryptEvent = tiEncryptKekStore;
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_KEK_UPDATE)
+ {
+ TI_DBG1(("ossaHwCB:OSSA_HW_ENCRYPT_KEK_UPDATE \n"));
+ encryptEventData.encryptEvent = tiEncryptKekAdd;
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_KEK_INVALIDTE)
+ {
+ TI_DBG1(("ossaHwCB:OSSA_HW_ENCRYPT_KEK_INVALIDTE \n"));
+ /* none */
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_DEK_UPDATE)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_ENCRYPT_DEK_UPDATE\n"));
+ encryptEventData.encryptEvent = tiEncryptDekAdd;
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_DEK_INVALIDTE)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_ENCRYPT_DEK_INVALIDTE\n"));
+ encryptEventData.encryptEvent = tiEncryptDekInvalidate;
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_OPERATOR_MANAGEMENT)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_ENCRYPT_OPERATOR_MANAGEMENT\n"));
+ encryptEventData.encryptEvent = tiEncryptOperatorManagement;
+ }
+ else if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_TEST_EXECUTE)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_ENCRYPT_TEST_EXECUTE\n"));
+ encryptEventData.encryptEvent = tiEncryptSelfTest;
+ encryptEventData.subEvent = pEncryptCBData->eq;
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: unknown encryptOperation 0x%x\n",pEncryptCBData->encryptOperation));
+ }
+
+ if (pEncryptCBData->status != OSSA_SUCCESS)
+ {
+ encryptStatus = tiError;
+
+ /* prints out status and error qualifier */
+ TI_DBG1(("ossaHwCB: encrypt response status 0x%x error qualifier 0x%x\n", pEncryptCBData->status, pEncryptCBData->eq));
+ }
+ else
+ {
+ encryptStatus = tiSuccess;
+ }
+
+ if (pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE ||
+ pEncryptCBData->encryptOperation == OSSA_HW_ENCRYPT_KEK_UPDATE )
+ {
+ /* returning new KEK index */
+ encryptEventData.pData = pEncryptCBData->handle;
+ }
+ else
+ {
+ /* returning current KEK index or DEK index */
+ encryptEventData.pData = pEncryptCBData->param;
+ }
+
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ encryptStatus,
+ &encryptEventData);
+ break;
+ }
+ case OSSA_HW_EVENT_SECURITY_MODE:
+ {
+ securitySetModeStatus = eventParm1;
+ pEncryptInfo = (agsaEncryptInfo_t *) eventParm2;
+
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_SECURITY_MODE\n"));
+ if (securitySetModeStatus == OSSA_SUCCESS)
+ {
+ securityModeStatus = tiSuccess;
+ }
+ else
+ {
+ securityModeStatus = tiError;
+ }
+
+ encryptEventData.encryptEvent = tiEncryptSetMode;
+ /* process status to fill in subevent */
+ /* See PM 4.26.12.6 */
+ TI_DBG1(("ossaHwCB: pEncryptInfo->status 0x%x\n", pEncryptInfo->status));
+ if ( pEncryptInfo->status == OSSA_SUCCESS)
+ {
+ encryptEventData.subEvent = tiNVRAMSuccess;
+ }
+ else if (pEncryptInfo->status == 0x24)
+ {
+ encryptEventData.subEvent = tiNVRAMNotFound;
+ }
+ else if (pEncryptInfo->status == 0x05 || pEncryptInfo->status == 0x20 || pEncryptInfo->status == 0x21)
+ {
+ encryptEventData.subEvent = tiNVRAMAccessTimeout;
+ }
+ else
+ {
+ encryptEventData.subEvent = tiNVRAMWriteFail;
+ }
+
+ encryptEventData.pData = agNULL;
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ securityModeStatus,
+ &encryptEventData);
+
+ break;
+ }
+ case OSSA_HW_EVENT_MODE:
+ {
+ pModeEvent = (agsaHWEventMode_t *) eventParm2;
+ pModePage = (bit32 *) pModeEvent->modePage;
+
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_MODE modePageOperation 0x%x status 0x%x modePageLen 0x%x\n",
+ pModeEvent->modePageOperation, pModeEvent->status, pModeEvent->modePageLen));
+
+ if (pModeEvent->modePageOperation == agsaModePageSet)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_MODE page code 0x%x error qualifier 0x%x\n", (eventParm1 & 0xFF), (eventParm1 >> 16)));
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2);
+ }
+ else if (pModeEvent->modePageOperation == agsaModePageGet)
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_MODE error qualifier 0x%x\n", eventParm1));
+ switch ((*pModePage) & 0xFF)
+ {
+ case AGSA_ENCRYPTION_GENERAL_CONFIG_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_ENCRYPTION_GENERAL_CONFIG_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+ TI_DBG1(("ossaHwCB:modePageOperation 0x%x status 0x%x modePageLen 0x%x modePage %p context %p\n",
+ pModeEvent->modePageOperation,
+ pModeEvent->status,
+ pModeEvent->modePageLen,
+ pModeEvent->modePage,
+ pModeEvent->context));
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2);
+ break;
+ case AGSA_ENCRYPTION_DEK_CONFIG_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_ENCRYPTION_DEK_CONFIG_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2);
+ break;
+ case AGSA_ENCRYPTION_HMAC_CONFIG_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_ENCRYPTION_HMAC_CONFIG_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2);
+ break;
+ case AGSA_ENCRYPTION_CONTROL_PARM_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_ENCRYPTION_CONTROL_PARM_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+ /*
+ * This page is directly related to tiCOMEncryptGetInfo() and
+ * will be translated into a tiEncrytOperation for the OS layer.
+ */
+
+ /* Fill out tiEncryptInfo_t */
+ securityMode = *pModePage & 0x0F00 >> 8;
+ cipherMode = *pModePage & 0xF000 >> 12;
+
+ if (securityMode == agsaEncryptSMA)
+ {
+ encryptInfo.securityCipherMode = TI_ENCRYPT_SEC_MODE_A;
+ }
+ else if (securityMode == agsaEncryptSMB)
+ {
+ encryptInfo.securityCipherMode = TI_ENCRYPT_SEC_MODE_B;
+ }
+ else
+ {
+ encryptInfo.securityCipherMode = TI_ENCRYPT_SEC_MODE_FACT_INIT;
+ }
+
+ if (cipherMode == agsaEncryptCipherModeECB)
+ {
+ encryptInfo.securityCipherMode |= TI_ENCRYPT_ATTRIB_CIPHER_ECB;
+ }
+
+ if (cipherMode == agsaEncryptCipherModeXTS)
+ {
+ encryptInfo.securityCipherMode |= TI_ENCRYPT_ATTRIB_CIPHER_XTS;
+ }
+
+ /* How will subEvents be tracked? */
+ encryptInfo.status = 0;
+
+ encryptInfo.sectorSize[0] = 512; /* DIF is allowed on 512 BPS SATA drives */
+ encryptInfo.sectorSize[1] = 520;
+ encryptInfo.sectorSize[2] = 528;
+ encryptInfo.sectorSize[3] = 4104;
+ encryptInfo.sectorSize[4] = 4168;
+ encryptInfo.sectorSize[5] = 4232;
+
+ encryptEventData.encryptEvent = tiEncryptGetInfo;
+ encryptEventData.subEvent = 0;
+ encryptEventData.pData = &encryptInfo;
+
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ pModeEvent->status,
+ &encryptEventData);
+ break;
+ case AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+
+#ifdef IOCTL_INTERRUPT_TIME_CONFIG
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2
+ );
+#endif /* IOCTL_INTERRUPT_TIME_CONFIG */
+
+ /*ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ &encryptEventData);*/
+ break;
+ case AGSA_INTERRUPT_CONFIGURATION_PAGE:
+ TI_DBG1(("ossaHwCB: AGSA_INTERRUPT_CONFIGURATION_PAGE 0x%x %p\n", pModeEvent->status,eventParm2));
+
+#ifdef IOCTL_INTERRUPT_TIME_CONFIG
+ ostiPortEvent(tiRoot,
+ tiModePageOperation,
+ pModeEvent->status,
+ eventParm2
+ );
+#endif /* IOCTL_INTERRUPT_TIME_CONFIG */
+
+ break;
+ default:
+ TI_DBG1(("ossaHwCB: Unknown Mode Event %x\n", *pModePage));
+ break;
+ }
+
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: Unknown modePageOperation %x\n", pModeEvent->modePageOperation));
+ }
+ break;
+ }
+
+// #endif /* INITIATOR_DRIVER */
+
+#ifdef REMOVED
+ case OSSA_HW_EVENT_PHY_UNRECOVERABLE_ERROR:
+ {
+ PhyID = TD_GET_PHY_ID(eventParm1);
+ PortState = TD_GET_PORT_STATE(eventParm1);
+
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_PHY_UNRECOVERABLE_ERROR\n"));
+
+ if (PortState == OSSA_PORT_INVALID)
+ {
+ TI_DBG1(("ossaHwCB: INVALID port state\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwCB: VALID port state\n"));
+ }
+ break;
+ }
+#endif /* REMOVED */
+ case OSSA_HW_EVENT_OPEN_RETRY_BACKOFF_THR_ADJUSTED:
+ {
+ TI_DBG1(("ossaHwCB: OSSA_HW_EVENT_OPEN_RETRY_BACKOFF_THR_ADJUSTED\n"));
+ break;
+ }
+
+ default:
+ {
+ TI_DBG1(("ossaHwCB: default error (0x%X)!!!!!\n",event));
+ break;
+ }
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'R', "Y2");
+ return;
+}
+
+osGLOBAL void ossaPortControlCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaPortContext_t *agPortContext,
+ bit32 portOperation,
+ bit32 status)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaPortContext_t *onePortContext = agNULL;
+
+ TI_DBG6(("ossaPortControlCB: start\n"));
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y3");
+ if (portOperation == AGSA_PORT_SET_SMP_PHY_WIDTH)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_SET_SMP_PHY_WIDTH\n"));
+ }
+ else if (portOperation == AGSA_PORT_SET_PORT_RECOVERY_TIME)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_SET_PORT_RECOVERY_TIME\n"));
+ }
+ else if (portOperation == AGSA_PORT_IO_ABORT)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_IO_ABORT\n"));
+ /* code is here because disocvery failed
+ deregister all targets. Then, later call discovery if broacast is seen in ossaDeregisterDeviceHandleCB.
+ */
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaPortControlCB: onePortContext is NULL\n"));
+ return;
+ }
+ /* qqqqq deregister all devices */
+ tdsaDeregisterDevicesInPort(tiRoot, onePortContext);
+
+ }
+ else if (portOperation == AGSA_PORT_SET_PORT_RESET_TIME)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_SET_PORT_RESET_TIME\n"));
+ }
+ else if (portOperation == AGSA_PORT_HARD_RESET)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_HARD_RESET\n"));
+ }
+ else if (portOperation == AGSA_PORT_CLEAN_UP)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_PORT_CLEAN_UP\n"));
+ }
+ else if (portOperation == AGSA_STOP_PORT_RECOVERY_TIMER)
+ {
+ TI_DBG1(("ossaPortControlCB: portOperation AGSA_STOP_PORT_RECOVERY_TIMER\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaPortControlCB: undefined portOperation %d\n", portOperation));
+ }
+
+ TI_DBG1(("ossaPortControlCB: status %d\n", status));
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y3");
+ return;
+}
+
+/*****************************************************************************
+*! \brief ossaHwRegRead
+*
+* Purpose: This routine is called to read a 32-bit value from the PCI
+* registers of the controller
+*
+* \param agRoot: Pointer to chip/driver Instance.
+* \param regOffset: Byte offset to chip register from which to read a 32-bit
+* value.
+*
+* \return: 32-bit value.
+*
+* \note - The scope is shared target and initiator.
+*
+*****************************************************************************/
+FORCEINLINE
+bit32
+ossaHwRegRead(agsaRoot_t *agRoot,
+ bit32 regOffset
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+ bit32 return_value;
+
+
+ return_value = ostiChipReadBit32 (
+ osData->tiRoot,
+ regOffset
+ );
+ if( agNULL != agRoot->sdkData )
+ {
+ smTrace(hpDBG_REGISTERS,"RR",regOffset);
+ /* TP:RR regOffset */
+ smTrace(hpDBG_REGISTERS,"RV",return_value);
+ /* TP:RV value read */
+ }
+
+ return(return_value);
+
+}
+
+/*****************************************************************************
+*! \brief ossaHwRegWrite
+*
+* Purpose: This routine is called to write a 32-bit value to the PCI
+* registers of the controller.
+*
+* \param agRoot: Pointer to chip/driver Instance.
+* \param regOffset: Byte offset to chip register to which chipIOValue is
+* written.
+* \param regValue: 32-bit value to write at chipIOOffset in host byte order.
+*
+* \return: None.
+*
+* \note - The scope is shared target and initiator.
+*
+*****************************************************************************/
+FORCEINLINE
+void
+ossaHwRegWrite(agsaRoot_t *agRoot,
+ bit32 regOffset,
+ bit32 regValue
+ )
+{
+
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+ if( agNULL != agRoot->sdkData )
+ {
+ smTrace(hpDBG_REGISTERS,"RW",regOffset);
+ /* TP:RW regOffset */
+ smTrace(hpDBG_REGISTERS,"VW",regValue);
+ /* TP:VW value written */
+ }
+
+ ostiChipWriteBit32 (
+ osData->tiRoot,
+ regOffset,
+ regValue
+ );
+ return;
+}
+
+/*****************************************************************************
+*! \brief ossaHwRegReadExt
+*
+* Purpose: This routine is called to read a 32-bit value from a bus-specific
+* mapped registers of the controller
+*
+* \param agRoot: Pointer to chip/driver Instance.
+* \param regOffset: Byte offset to chip register from which to read a 32-bit
+* value.
+*
+* \return: 32-bit value.
+*
+* \note - The scope is shared target and initiator.
+*
+*****************************************************************************/
+FORCEINLINE
+bit32
+ossaHwRegReadExt(
+ agsaRoot_t *agRoot,
+ bit32 busBaseNumber,
+ bit32 regOffset
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+
+ bit32 return_value;
+
+ return_value = ostiChipReadBit32Ext(
+ osData->tiRoot,
+ busBaseNumber,
+ regOffset
+ );
+
+ /* TI_DBG4(("#_R: 0x%x:0x%x=0x%x\n",busBaseNumber,regOffset,return_value)); */
+
+ if( agNULL != agRoot->sdkData )
+ {
+ smTrace(hpDBG_REGISTERS,"EB",busBaseNumber);
+ /* TP:EB EX read busBaseNumber */
+ smTrace(hpDBG_REGISTERS,"EO",regOffset);
+ /* TP:EO regOffset */
+ smTrace(hpDBG_REGISTERS,"ER",return_value);
+ /* TP:ER value read */
+ }
+ return(return_value);
+}
+
+void ossaPCI_TRIGGER(agsaRoot_t *agRoot )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+ ostiPCI_TRIGGER(osData->tiRoot);
+
+}
+
+
+
+/*****************************************************************************
+*! \brief ossaHwRegWriteExt
+*
+* Purpose: This routine is called to write a 32-bit value to a bus specific
+* mapped registers of the controller.
+*
+* \param agRoot: Pointer to chip/driver Instance.
+* \param regOffset: Byte offset to chip register to which chipIOValue is
+* written.
+* \param regValue: 32-bit value to write at chipIOOffset in host byte order.
+*
+* \return: None.
+*
+* \note - The scope is shared target and initiator.
+*
+*****************************************************************************/
+FORCEINLINE
+void
+ossaHwRegWriteExt(
+ agsaRoot_t *agRoot,
+ bit32 busBaseNumber,
+ bit32 regOffset,
+ bit32 regValue
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+ ostiChipWriteBit32Ext(
+ osData->tiRoot,
+ busBaseNumber,
+ regOffset,
+ regValue
+ );
+
+ /* TI_DBG4(("#_W: 0x%x:0x%x=0x%x\n",busBaseNumber,regOffset,regValue)); */
+
+ if( agNULL != agRoot->sdkData )
+ {
+ smTrace(hpDBG_REGISTERS,"Eb",busBaseNumber);
+ /* TP:Eb Ex Write busBaseNumber */
+ smTrace(hpDBG_REGISTERS,"Eo",regOffset);
+ /* TP:Eo regOffset */
+ smTrace(hpDBG_REGISTERS,"Ew",regValue);
+ /* TP:Ew value written regValue*/
+ }
+ return;
+}
+
+
+osGLOBAL bit32 ossaHwRegReadConfig32(
+ agsaRoot_t *agRoot,
+ bit32 regOffset
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+ bit32 to_ret;
+ to_ret= ostiChipConfigReadBit32( osData->tiRoot, regOffset);
+ TI_DBG4(("ossaHwRegReadConfig32: regOffset 0x%x returns 0x%x\n",regOffset,to_ret));
+ return(to_ret);
+}
+
+
+
+
+#ifdef TD_INT_COALESCE
+void
+ossaIntCoalesceInitCB(
+ agsaRoot_t *agRoot,
+ agsaIntCoalesceContext_t *agIntCoContext,
+ bit32 status
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)osData->tdsaAllShared;
+ tiIntCoalesceContext_t *tiIntCoalesceCxt;
+ tdsaIntCoalesceContext_t *tdsaIntCoalCxt;
+ tdsaIntCoalesceContext_t *tdsaIntCoalCxtHead
+ = (tdsaIntCoalesceContext_t *)tdsaAllShared->IntCoalesce;;
+ bit32 tiStatus;
+
+ TI_DBG2(("ossaIntCoalesceInitCB: start\n"));
+
+ tdsaIntCoalCxt = (tdsaIntCoalesceContext_t *)agIntCoContext->osData;
+ tiIntCoalesceCxt = tdsaIntCoalCxt->tiIntCoalesceCxt;
+ switch (status)
+ {
+ case AGSA_RC_SUCCESS:
+ tiStatus = tiSuccess;
+ break;
+ case AGSA_RC_BUSY:
+ tiStatus = tiBusy;
+ break;
+ case AGSA_RC_FAILURE:
+ tiStatus = tiError;
+ break;
+ default:
+ TI_DBG1(("ossaIntCoalesceInitCB: unknown status %d\n", status));
+ tiStatus = tiError;
+ break;
+ }
+
+ TI_DBG2(("ossaIntCoalesceInitCB: status %d\n", tiStatus));
+
+ /* enqueue tdsaIntCoalCxt to freelink */
+ tdsaIntCoalCxt->tiIntCoalesceCxt = agNULL;
+ TI_DBG2(("ossaIntCoalesceInitCB: id %d\n", tdsaIntCoalCxt->id));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_INTCOAL_LOCK);
+ TDLIST_DEQUEUE_THIS(&(tdsaIntCoalCxt->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(tdsaIntCoalCxt->FreeLink), &(tdsaIntCoalCxtHead->FreeLink));
+ tdsaSingleThreadedLeave(tiRoot, TD_INTCOAL_LOCK);
+
+#ifdef OS_INT_COALESCE
+ ostiInitiatorIntCoalesceInitCB(tiRoot,
+ tiIntCoalesceCxt,
+ tiStatus);
+#endif
+
+ TI_DBG2(("ossaIntCoalesceInitCB: return end\n"));
+
+ return;
+}
+#endif /* TD_INT_COALESCE */
+
+/*****************************************************************************/
+/*! \brief ossaSingleThreadedEnter
+ *
+ *
+ * Purpose: This routine is called to ensure that only a single thread of
+ * the given port instance executes code in the region protected by
+ * this function.
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param syncLockId to be explained.
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ *
+ */
+/*****************************************************************************/
+FORCEINLINE
+void ossaSingleThreadedEnter(
+ agsaRoot_t *agRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRootOsData_t *pOsData = agNULL;
+ tiRoot_t *ptiRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+
+ TD_ASSERT(agRoot, "agRoot");
+ pOsData = (tdsaRootOsData_t *) (agRoot->osData);
+ TD_ASSERT(pOsData, "pOsData");
+ ptiRoot = pOsData->tiRoot;
+ TD_ASSERT(ptiRoot, "ptiRoot");
+
+ tdsaAllShared = (tdsaContext_t *)pOsData->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+
+ ostiSingleThreadedEnter(ptiRoot, syncLockId + tdsaAllShared->MaxNumOSLocks);
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaSingleThreadedLeave
+ *
+ *
+ * Purpose: This routine is called to leave a critical region of code
+ * previously protected by a call to osSingleThreadedEnter()
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param syncLockId to be explained.
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ *
+ */
+/*****************************************************************************/
+FORCEINLINE
+void ossaSingleThreadedLeave(
+ agsaRoot_t *agRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRootOsData_t *pOsData = agNULL;
+ tiRoot_t *ptiRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+
+ TD_ASSERT(agRoot, "agRoot");
+ pOsData = (tdsaRootOsData_t *) (agRoot->osData);
+ TD_ASSERT(pOsData, "pOsData");
+ ptiRoot = pOsData->tiRoot;
+ TD_ASSERT(ptiRoot, "ptiRoot");
+
+ tdsaAllShared = (tdsaContext_t *)pOsData->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+
+ ostiSingleThreadedLeave(ptiRoot, syncLockId + tdsaAllShared->MaxNumOSLocks);
+ return;
+}
+
+#ifdef PERF_COUNT
+osGLOBAL void ossaEnter(agsaRoot_t *agRoot, int io)
+{
+ ostiEnter(((tdsaRootOsData_t*)(agRoot->osData))->tiRoot, 0, io);
+ return;
+}
+
+osGLOBAL void ossaLeave(agsaRoot_t *agRoot, int io)
+{
+ ostiLeave(((tdsaRootOsData_t*)(agRoot->osData))->tiRoot, 0, io);
+ return;
+}
+#endif
+
+
+osGLOBAL void
+ossaSSPIoctlCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit16 sspTag,
+ bit32 agOtherInfo
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ agsaSASRequestBody_t *agSASRequestBody = agNULL;
+ agsaSSPInitiatorRequest_t *agSSPFrame = agNULL;
+ bit8 scsiOpcode = 0;
+
+ agSASRequestBody = &(tdIORequestBody->transport.SAS.agSASRequestBody);
+ agSSPFrame = &(agSASRequestBody->sspInitiatorReq);
+ scsiOpcode = agSSPFrame->sspCmdIU.cdb[0];
+
+ TI_DBG2(("ossaSSPIoctlCompleted: start\n"));
+
+ if (agIOStatus == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaSSPIoctlCompleted: Success status\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaSSPIoctlCompleted: Status 0x%x\n", agIOStatus));
+ }
+ switch(scsiOpcode)
+ {
+ case REPORT_LUN_OPCODE:
+ ostiNumOfLUNIOCTLRsp(tiRoot, agIOStatus);
+ break;
+
+ default:
+ TI_DBG1(("ossaSSPIoctlCompleted: Unsupported SCSI command Response 0x%x\n",scsiOpcode));
+ break;
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yi");
+ return;
+
+}
+
+osGLOBAL void
+ossaSMPIoctlCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ TI_DBG2(("ossaSMPIoctlCompleted: start\n"));
+
+ if (agIOStatus == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaSMPIoctlCompleted: Success status\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaSMPIoctlCompleted: Status 0x%x\n", agIOStatus));
+ }
+
+ ostiSendSMPIOCTLRsp(tiRoot, agIOStatus);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yi");
+ return;
+
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSMPCompleted
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the completion of
+ * SMP request
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agIORequest Pointer to SMP request handle
+ * \param agIOStatus Status
+ * \param agFrameHeader:Pointer to SMP frame header.
+ * \param agIOInfoLen IO information length assoicated with the IO
+ * \param agFrameHandle A Handle used to refer to the response frame
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSMPCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ )
+{
+#ifdef PASSTHROUGH
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdPassthroughCmndBody_t *tdPTCmndBody = (tdPassthroughCmndBody_t *)agIORequest->osData;
+ bit32 tiStatus = tiPassthroughError;
+ bit8 SMPframe[agIOInfoLen + sizeof(agsaSMPFrameHeader_t)];
+ bit8 SMPpayload[agIOInfoLen];
+
+ TI_DBG2(("ossaSMPCompleted: start and passthrough\n"));
+#else /* not PASSTHROUGH */
+
+ tdssSMPRequestBody_t *pSMPRequestBody = (tdssSMPRequestBody_t *) agIORequest->osData;
+ TI_DBG4(("ossaSMPCompleted: start\n"));
+#endif /* end not PASSTHROUGH */
+
+ TDSA_OUT_ENTER((tiRoot_t *)((tdsaRootOsData_t *)agRoot->osData)->tiRoot);
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y4");
+
+#ifdef PASSTHROUGH
+ if (tdPTCmndBody == agNULL)
+ {
+ TI_DBG1(("ossaSMPCompleted: tdPTCmndBody is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y4");
+ goto ext;
+ }
+
+ if (tdPTCmndBody->EventCB == agNULL)
+ {
+ TI_DBG1(("ossaSMPCompleted: tdPTCmndBody->EventCB is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Y4");
+ goto ext;
+ }
+
+ if (agIOStatus == OSSA_IO_SUCCESS)
+ {
+ tiStatus = tiPassthroughSuccess;
+ }
+ else if (agIOStatus == OSSA_IO_ABORTED)
+ {
+ tiStatus = tiPassthroughAborted;
+ }
+ else
+ {
+ tiStatus = tiPassthroughError;
+ }
+
+ osti_memset(SMPpayload, 0, agIOInfoLen);
+ osti_memset(SMPframe, 0, agIOInfoLen + sizeof(agsaSMPFrameHeader_t));
+
+ /* combine the header and payload */
+ saFrameReadBlock(agRoot, agFrameHandle, 0, &SMPpayload, agIOInfoLen);
+ osti_memcpy(SMPframe, agFrameHeader, sizeof(agsaSMPFrameHeader_t));
+ osti_memcpy(SMPframe+sizeof(agsaSMPFrameHeader_t), SMPpayload, agIOInfoLen);
+
+ tdPTCmndBody->EventCB(tiRoot,
+ tdPTCmndBody->tiPassthroughRequest,
+ tiStatus,
+ SMPframe,
+ agIOInfoLen + sizeof(agsaSMPFrameHeader_t)
+ );
+
+
+#else /* not PASSTHROUGH */
+
+ /*
+ At initiator, passing SMP to TD layer, itdssSMPCompleted(), which does nothing.
+ At target, passing SMP to TD layer, ttdsaSMPCompleted()
+ */
+ /*
+ how to use agFrameHandle, when saFrameReadBlock() is used
+ */
+
+ /* SPC can't be SMP target */
+
+ TI_DBG4(("ossaSMPCompleted: start\n"));
+
+ if (pSMPRequestBody == agNULL)
+ {
+ TI_DBG1(("ossaSMPCompleted: pSMPRequestBody is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "Y4");
+ goto ext;
+ }
+
+ if (pSMPRequestBody->SMPCompletionFunc == agNULL)
+ {
+ TI_DBG1(("ossaSMPCompleted: pSMPRequestBody->SMPCompletionFunc is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "Y4");
+ goto ext;
+ }
+#ifdef TD_INTERNAL_DEBUG /* debugging */
+ TI_DBG4(("ossaSMPCompleted: agIOrequest %p\n", agIORequest->osData));
+ TI_DBG4(("ossaSMPCompleted: sizeof(tdIORequestBody_t) %d 0x%x\n", sizeof(tdIORequestBody_t),
+ sizeof(tdIORequestBody_t)));
+ TI_DBG4(("ossaSMPCompleted: SMPRequestbody %p\n", pSMPRequestBody));
+ TI_DBG4(("ossaSMPCompleted: calling callback fn\n"));
+ TI_DBG4(("ossaSMPCompleted: callback fn %p\n",pSMPRequestBody->SMPCompletionFunc));
+#endif /* TD_INTERNAL_DEBUG */
+ /*
+ if initiator, calling itdssSMPCompleted() in itdcb.c
+ if target, calling ttdsaSMPCompleted() in ttdsmp.c
+ */
+ pSMPRequestBody->SMPCompletionFunc(
+ agRoot,
+ agIORequest,
+ agIOStatus,
+ agIOInfoLen,
+ agFrameHandle
+ );
+
+#endif /* Not PASSTHROUGH */
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "Y4");
+ext:
+ TDSA_OUT_LEAVE((tiRoot_t *)((tdsaRootOsData_t *)agRoot->osData)->tiRoot);
+ return;
+}
+
+osGLOBAL void
+ossaSMPReqReceived(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaFrameHandle_t agFrameHandle,
+ bit32 agIOInfoLen,
+ bit32 phyId
+ )
+{
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y5");
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y5");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaSMPCAMCompleted
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the completion of
+ * SMP request
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agIORequest Pointer to SMP request handle
+ * \param agIOStatus Status
+ * \param agIOInfoLen IO information length assoicated with the IO
+ * \param agFrameHandle A Handle used to refer to the response frame
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSMPCAMCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdSMPRequestBody = agNULL;
+ bit32 context = osData->IntContext;
+ tiSMPStatus_t status;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+ bit32 *SMPpayload;
+ TI_DBG2(("ossaSMPCAMCompleted: start\n"));
+ TI_DBG2(("ossaSMPCAMCompleted: agIOInfoLen %d\n", agIOInfoLen));
+ if (!agIORequest->osData)
+ {
+ TD_ASSERT((0), "ossaSMPCAMCompleted agIORequest->osData");
+ goto ext;
+ }
+ tdSMPRequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ if (tdSMPRequestBody->tiIORequest->osData == agNULL)
+ {
+ TI_DBG1(("ossaSMPCAMCompleted: tdIORequestBody->tiIORequest->osData is null, wrong\n"));
+ goto ext;
+ }
+ /* allocating agIORequest for SMP Payload itself */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&SMPpayload,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ agIOInfoLen,
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("ossaSMPCAMCompleted: ostiAllocMemory failed...\n"));
+ goto ext;
+ }
+ if (SMPpayload == agNULL)
+ {
+ TI_DBG1(("ossaSMPCAMCompleted: ostiAllocMemory returned NULL SMPpayload\n"));
+ goto ext;
+ }
+ if (agIOStatus == OSSA_IO_SUCCESS)
+ {
+ TI_DBG1(("ossaSMPCAMCompleted: Success status\n"));
+ osti_memset(SMPpayload, 0, agIOInfoLen);
+ TI_DBG1(("ossaSMPCAMCompleted: after memset\n"));
+ saFrameReadBlock(agRoot, agFrameHandle, 0, SMPpayload, agIOInfoLen);
+ TI_DBG1(("ossaSMPCAMCompleted: after read \n"));
+ status = tiSMPSuccess;
+ }
+ else if (agIOStatus == OSSA_IO_ABORTED)
+ {
+ TI_DBG1(("ossaSMPCAMCompleted: SMP Aborted status\n"));
+ status = tiSMPAborted;
+ TI_DBG1(("ossaSMPCAMCompleted: failed status=%d\n", status));
+ //failed to send smp command, we need to free the memory
+ ostiFreeMemory(
+ tiRoot,
+ osMemHandle,
+ agIOInfoLen
+ );
+ }
+ else
+ {
+ TI_DBG1(("ossaSMPCAMCompleted: SMP failed status\n"));
+ status = tiSMPFailed;
+ TI_DBG1(("ossaSMPCAMCompleted: failed status=%d\n", status));
+ //failed to send smp command, we need to free the memory
+ ostiFreeMemory(
+ tiRoot,
+ osMemHandle,
+ agIOInfoLen
+ );
+ }
+ ostiInitiatorSMPCompleted(tiRoot,
+ tdSMPRequestBody->tiIORequest,
+ status,
+ agIOInfoLen,
+ SMPpayload,
+ context
+ );
+ ext:
+ TDSA_OUT_LEAVE((tiRoot_t*)((tdsaRootOsData_t*)agRoot->osData)->tiRoot);
+ return;
+}
+#ifdef REMOVED
+#ifdef TARGET_DRIVER
+/*****************************************************************************/
+/*! \brief ossaSMPReqReceived
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the reception of
+ * SMP request
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param agFrameHandle A Handle used to refer to the response frame
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is target only
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSMPReqReceived(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaFrameHandle_t agFrameHandle,
+ bit32 agFrameLength,
+ bit32 phyId
+ )
+{
+ bit8 smpHeader[4];
+ agsaSMPFrameHeader_t *agFrameHeader;
+#ifdef PASSTHROUGH
+ /* call the registered function(parameter in tiTGTPassthroughCmndRegister() by target */
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ ttdsaTgt_t *Target = (ttdsaTgt_t *)osData->ttdsaTgt;
+
+ bit8 SMPframe[agIOInfoLen + sizeof(agsaSMPFrameHeader_t)];
+ bit8 SMPpayload[agIOInfoLen];
+
+ TI_DBG2(("ossaSMPReqReceived: start and passthrough\n"));
+ osti_memset(SMPpayload, 0, agIOInfoLen);
+ osti_memset(SMPframe, 0, agIOInfoLen + sizeof(agsaSMPFrameHeader_t));
+ /* combine smp header and payload */
+ saFrameReadBlock(agRoot, agFrameHandle, 0, &SMPpayload, agIOInfoLen);
+ osti_memcpy(SMPframe, agFrameHeader, sizeof(agsaSMPFrameHeader_t));
+ osti_memcpy(SMPframe+sizeof(agsaSMPFrameHeader_t), SMPpayload, agIOInfoLen);
+
+ Target->PasthroughCB(
+ tiRoot,
+ tiSASATA,
+ tiSMP,
+ tiSMPResponse,
+ SMPframe,
+ agIOInfoLen + sizeof(agsaSMPFrameHeader_t),
+ phyId
+ );
+
+#else
+
+ /*
+ agDevHandle_t->osData points to tdssDeviceData_t
+ */
+ tdsaDeviceData_t *pDeviceData = (tdsaDeviceData_t *) agDevHandle->osData;
+
+ saFrameReadBlock(agRoot, agFrameHandle, 0, smpHeader, 4);
+ agFrameHeader = (agsaSMPFrameHeader_t *)smpHeader;
+ TI_DBG4(("ossaSMPReqReceived: start\n"));
+
+ /* tdtypes.h, calling ttdsaSMPReqReceived in ttdsmp.c */
+ pDeviceData->pJumpTable->pSMPReqReceived (
+ agRoot,
+ agDevHandle,
+ agFrameHeader,
+ agFrameHandle,
+ agFrameLength,
+ phyId
+ );
+#endif
+ return;
+}
+#endif
+#endif
+
+/*****************************************************************************/
+/*! \brief ossaSSPCompleted
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the completion of
+ * SSP request
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agIORequest Pointer to SMP request handle
+ * \param agIOStatus Status
+ * \param agIOInfoLen IO information length assoicated with the IO
+ * \param agFrameHandle A Handle used to refer to the response frame
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+FORCEINLINE
+void ossaSSPCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit16 sspTag,
+ bit32 agOtherInfo
+ )
+{
+ tdIORequestBody_t *pIORequestBody;
+#ifdef TD_DEBUG_ENABLE
+ tiDeviceHandle_t *tiDeviceHandle = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+#endif
+
+ TDSA_OUT_ENTER((tiRoot_t*)((tdsaRootOsData_t*)agRoot->osData)->tiRoot);
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"2L");
+
+ if(!agIORequest->osData)
+ {
+ TD_ASSERT((0), "ossaSSPCompleted agIORequest->osData");
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2L");
+ goto ext;
+ }
+ pIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+
+
+ TI_DBG4(("ossaSSPCompleted: start\n"));
+
+ if (pIORequestBody == agNULL)
+ {
+ TI_DBG1(("ossaSSPCompleted: pIORequestBody is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2L");
+ goto ext;
+ }
+ if (pIORequestBody->IOCompletionFunc == agNULL)
+ {
+#ifdef TD_DEBUG_ENABLE
+ tiDeviceHandle = pIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+#endif
+ TI_DBG1(("ossaSSPCompleted: IOCompletionFunc is NULL \n"));
+ TI_DBG1(("ossaSSPCompleted: did %d \n", oneDeviceData->id));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2L");
+ goto ext;
+ }
+
+ /*
+ if initiator, calling itdssIOCompleted() in itdcb.c
+ if initiator, calling itdssTaskCompleted in itdcb.c
+ if target, calling ttdsaIOCompleted() in ttdio.c
+ */
+ pIORequestBody->IOCompletionFunc(
+ agRoot,
+ agIORequest,
+ agIOStatus,
+ agIOInfoLen,
+ agParam,
+ agOtherInfo
+ );
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2L");
+ext:
+ TDSA_OUT_LEAVE((tiRoot_t*)((tdsaRootOsData_t*)agRoot->osData)->tiRoot);
+ return;
+}
+
+#ifdef FAST_IO_TEST
+GLOBAL void ossaFastSSPCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *cbArg,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit16 sspTag,
+ bit32 agOtherInfo
+ )
+{
+ agsaFastCBBuf_t *safb = (agsaFastCBBuf_t*)cbArg;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t*)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t*)osData->tiRoot;
+ bit32 scsi_status;
+ bit32 data_status;
+ bit32 respLen;
+ bit8 respData[128];
+ bit32 senseLen;
+ agsaSSPResponseInfoUnit_t agSSPRespIU;
+
+ TDSA_OUT_ENTER((tiRoot_t*)((tdsaRootOsData_t*)agRoot->osData)->tiRoot);
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y6");
+
+ TI_DBG4(("ossaSSPCompleted: start\n"));
+
+ if (safb->cb == agNULL || safb->cbArg == agNULL)
+ {
+ TI_DBG1(("ossaFastSSPCompleted: pIORequestBody is NULL \n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y6");
+ TD_ASSERT((0), "");
+ goto ext;
+ }
+
+ switch (agIOStatus)
+ {
+ case OSSA_IO_SUCCESS:
+
+ /* ~ itdssIOSuccessHandler */
+ if ((agIOInfoLen < sizeof(agsaSSPResponseInfoUnit_t)))
+ {
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, OSSA_IO_SUCCESS, 0);
+ break;
+ }
+
+ /* reads agsaSSPResponseInfoUnit_t */
+ saFrameReadBlock(agRoot, agParam, 0, &agSSPRespIU,
+ sizeof(agsaSSPResponseInfoUnit_t));
+
+ data_status = SA_SSPRESP_GET_DATAPRES(&agSSPRespIU);
+ scsi_status = agSSPRespIU.status;
+
+ TI_DBG1(("itdssIOSuccessHandler: scsi_status %d\n", scsi_status));
+
+ /* endianess is invovled here */
+ senseLen = SA_SSPRESP_GET_SENSEDATALEN(&agSSPRespIU);
+ respLen = SA_SSPRESP_GET_RESPONSEDATALEN(&agSSPRespIU);
+ TI_DBG2(("itdssIOSuccessHandler: scsi status=0x%x, senselen=0x%x resplen "
+ "0x%x\n", scsi_status, senseLen, respLen));
+
+ if (agIOInfoLen < sizeof(agsaSSPResponseInfoUnit_t) + senseLen + respLen)
+ {
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ tiDetailOtherError);
+ break;
+ }
+
+ /* reads response data */
+ saFrameReadBlock(agRoot, agParam, sizeof(agsaSSPResponseInfoUnit_t),
+ respData, respLen);
+ /* reads sense data */
+ saFrameReadBlock(agRoot, agParam, sizeof(agsaSSPResponseInfoUnit_t)
+ + respLen, safb->pSenseData, senseLen);
+
+ if (data_status == 0)
+ {
+ /* NO_DATA */
+ TI_DBG2(("ossaFastSSPCompleted: no data\n"));
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOSuccess,
+ scsi_status);
+ break;
+ }
+
+ if (data_status == 1)
+ {
+ /* RESPONSE_DATA */
+ TI_DBG1(("ossaFastSSPCompleted: response data \n"));
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOSuccess, 0);
+ break;
+ }
+
+ if (data_status == 2)
+ {
+ tiSenseData_t senseData;
+
+ /* SENSE_DATA */
+ TI_DBG2(("itdssIOSuccessHandler: sense data \n"));
+
+ senseData.senseData = safb->pSenseData;
+ senseData.senseLen = MIN(*(safb->senseLen), senseLen);
+
+ /* when ASC = 0x04 - Log Unit Not Ready,
+ and ASCQ = 0x11 - Enable Spinup Required:
+ call saLocalPhyControl to notify spinup */
+ if (((char*)safb->pSenseData)[12] == 0x04 &&
+ ((char*)safb->pSenseData)[13] == 0x11)
+ {
+ int i;
+
+ TI_DBG2(("ossaFastSSPCompleted: sending notfify spinup\n"));
+
+ if (((tdsaDeviceData_t*)safb->oneDeviceData)->directlyAttached ==
+ agTRUE)
+ {
+ for (i = 0; i < TD_MAX_NUM_NOTIFY_SPINUP; i++)
+ {
+ saLocalPhyControl(agRoot, agNULL, 0,
+ ((tdsaDeviceData_t*)safb->oneDeviceData)->phyID,
+ AGSA_PHY_NOTIFY_ENABLE_SPINUP,
+ agNULL);
+ }
+ }
+ }
+
+ if (*(safb->senseLen) > senseData.senseLen)
+ *(safb->senseLen) = senseData.senseLen;
+// memcpy((void *)safb->pSenseData, senseData.senseData, safb->senseLen);
+
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOSuccess,
+ scsi_status);
+ break;
+ }
+
+ if (data_status == 3)
+ {
+ /* RESERVED */
+ TI_DBG1(("ossaFastSSPCompleted: reserved wrong!!!\n"));
+
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ scsi_status);
+ break;
+ }
+ break;
+#ifdef REMOVED
+ case OSSA_IO_OVERFLOW:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOOverRun,
+ agIOInfoLen);
+ break;
+#endif /* REMOVED */
+ case OSSA_IO_UNDERFLOW:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOUnderRun,
+ agIOInfoLen);
+ break;
+
+ case OSSA_IO_ABORTED:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ tiDetailAborted);
+ break;
+ case OSSA_IO_ABORT_RESET:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ tiDetailAbortReset);
+ break;
+ case OSSA_IO_NO_DEVICE:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ tiDetailNoLogin);
+ break;
+ case OSSA_IO_DS_NON_OPERATIONAL:
+ {
+
+ tdsaDeviceData_t *oneDeviceData;
+
+ oneDeviceData = (tdsaDeviceData_t*)safb->oneDeviceData;
+ if (oneDeviceData->valid == agTRUE &&
+ oneDeviceData->registered == agTRUE &&
+ oneDeviceData->tdPortContext != agNULL)
+ {
+ saSetDeviceState(oneDeviceData->agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData),
+ oneDeviceData->agDevHandle, SA_DS_OPERATIONAL);
+ }
+ /* fall through */
+ }
+
+ default:
+ ((ostiFastSSPCb_t)safb->cb)(tiRoot, safb->cbArg, tiIOFailed,
+ tiDetailOtherError);
+ break;
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Y6");
+
+ext:
+ TDSA_OUT_LEAVE((tiRoot_t*)((tdsaRootOsData_t*)agRoot->osData)->tiRoot);
+ return;
+} /* ossaFastSSPCompleted */
+#endif
+
+/*****************************************************************************/
+/*! \brief ossaSSPReqReceived
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the reception of
+ * SMP request
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param agFrameHandle A Handle used to refer to the response frame
+ * \param agInitiatorTag the initiator tag
+ * \param agFrameType SSP frame type
+ *
+ * \return none.
+ *
+ * \note - The scope is target only
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSSPReqReceived(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaFrameHandle_t agFrameHandle,
+ bit16 agInitiatorTag,
+ bit32 parameter,
+ bit32 agFrameLen
+ )
+{
+ /*
+ at target only
+ uses jumptable, not callback
+ */
+ /*
+ agDevHandle_t->osData points to tdssDeviceData_t
+ */
+ tdsaDeviceData_t *pDeviceData = (tdsaDeviceData_t *) agDevHandle->osData;
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y7");
+
+ /* tdtypes.h, calling ttdsaSSPReqReceived() in ttdio.c */
+ pDeviceData->pJumpTable->pSSPReqReceived (
+ agRoot,
+ agDevHandle,
+ agFrameHandle,
+ agInitiatorTag,
+ parameter,
+ agFrameLen
+ );
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y7");
+ return;
+}
+/*****************************************************************************/
+/*! \brief ossaStallThread
+ *
+ *
+ * Purpose: This routine is called to stall this thread for a number of
+ * microseconds.
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param microseconds: Micro second to stall.
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaStallThread(agsaRoot_t *agRoot,
+ bit32 microseconds
+ )
+{
+ tdsaRootOsData_t *pOsData = (tdsaRootOsData_t *) (agRoot->osData);
+
+ ostiStallThread (
+ pOsData->tiRoot,
+ microseconds
+ );
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief ossaSSPEvent
+*
+* This routine is called to notify the OS Layer of an event associated with
+* SAS port or SAS device
+*
+* \param agRoot: Handles for this instance of SAS/SATA hardware
+* \param agIORequest Pointer to IO request
+* \param event: event type
+* \param agIOInfoLen: not in use
+* \param agFrameHandle: not in use
+*
+* \return: none
+*
+*****************************************************************************/
+/* in case of CMD ACK_NAK timeout, send query task */
+osGLOBAL void ossaSSPEvent(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ agsaPortContext_t *agPortContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 event,
+ bit16 sspTag,
+ bit32 agIOInfoLen,
+ void *agParam
+ )
+{
+#ifdef INITIATOR_DRIVER
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ /* bit32 intContext = osData->IntContext; */
+ void *osMemHandle;
+ tdIORequestBody_t *TMtdIORequestBody;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ bit32 agRequestType;
+ agsaIORequest_t *agTMIORequest = agNULL; /* task management itself */
+ agsaSASRequestBody_t *agSASRequestBody = agNULL;
+ agsaSSPScsiTaskMgntReq_t *agSSPTaskMgntRequest;
+ bit32 saStatus;
+ bit32 agIORequestType; /* type of IO recevied */
+ tiIORequest_t *taskTag; /* being task managed one */
+ tdIORequestBody_t *tdIORequestBody;
+#endif
+
+#ifdef REMOVED
+ tiDeviceHandle_t *tiDeviceHandle;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdIORequestBody_t *tdAbortIORequestBody;
+#endif
+ agsaDifDetails_t agDifDetails;
+ bit8 framePayload[256];
+#ifdef REMOVED
+ bit16 frameOffset = 0;
+#endif
+ bit16 frameLen = 0;
+
+ TI_DBG6(("ossaSSPEvent: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Y9");
+
+
+
+ if (event == OSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT ||
+ event == OSSA_IO_XFER_ERROR_BREAK ||
+ event == OSSA_IO_XFER_ERROR_PHY_NOT_READY
+ )
+ {
+
+ /* IO being task managed(the original IO) depending on event */
+#ifdef INITIATOR_DRIVER
+ tdIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ taskTag = tdIORequestBody->tiIORequest;
+#endif
+#ifdef REMOVED
+ tiDeviceHandle = tdIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+#endif
+
+#ifdef INITIATOR_DRIVER
+ agIORequestType = tdIORequestBody->agRequestType;
+
+ /* error checking; only command is expected here */
+ if (agIORequestType == AGSA_REQ_TYPE_UNKNOWN)
+ {
+ TI_DBG1(("ossaSSPEvent: incorrect frame 0x%x. Should be command\n", agIORequestType));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Y9");
+ return;
+ }
+
+ /* Allocate memory for query task management */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&TMtdIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("ossaSSPEvent: ostiAllocMemory failed...\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Y9");
+ return;
+ }
+
+ if (TMtdIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("ossaSSPEvent: ostiAllocMemory returned NULL TMIORequestBody\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "Y9");
+ return;
+ }
+
+ /* setup task management structure */
+ TMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ /* TD generates Query Task not OS layer */
+ TMtdIORequestBody->IOType.InitiatorTMIO.CurrentTaskTag = agNULL;
+ TMtdIORequestBody->IOType.InitiatorTMIO.TaskTag = taskTag;
+
+ /* initialize callback function */
+ TMtdIORequestBody->IOCompletionFunc = itdssQueryTaskCompleted;
+
+ /* initialize tiDevhandle */
+ TMtdIORequestBody->tiDevHandle = tdIORequestBody->tiDevHandle;
+
+
+ /* initialize agIORequest */
+ agTMIORequest = &(TMtdIORequestBody->agIORequest);
+ agTMIORequest->osData = (void *) TMtdIORequestBody;
+ agTMIORequest->sdkData = agNULL; /* LL takes care of this */
+
+ /* request type */
+ agRequestType = AGSA_SSP_TASK_MGNT_REQ;
+ TMtdIORequestBody->agRequestType = AGSA_SSP_TASK_MGNT_REQ;
+
+ /*
+ initialize
+ tdIORequestBody_t tdIORequestBody -> agSASRequestBody
+ */
+ agSASRequestBody = &(TMtdIORequestBody->transport.SAS.agSASRequestBody);
+ agSSPTaskMgntRequest = &(agSASRequestBody->sspTaskMgntReq);
+
+ /* fill up LUN field */
+ osti_memset(agSSPTaskMgntRequest->lun, 0, 8);
+
+ /* sets taskMgntFunction field */
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_QUERY_TASK;
+ /* debugging */
+ if (TMtdIORequestBody->IOCompletionFunc == agNULL)
+ {
+ TI_DBG1(("ossaSSPEvent: Error !!! IOCompletionFunc is NULL\n"));
+ }
+ /* send query task management */
+ saStatus = saSSPStart(agRoot,
+ agTMIORequest,
+ 0,
+ agDevHandle,
+ agRequestType,
+ agSASRequestBody,
+ agIORequest,
+ &ossaSSPCompleted);
+
+ if (saStatus != AGSA_RC_SUCCESS)
+ {
+ /* free up allocated memory */
+ ostiFreeMemory(
+ tiRoot,
+ TMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ TI_DBG1(("ossaSSPEvent: saSSPStart failed\n"));
+ return;
+ }
+#endif
+ }
+#ifdef REMOVED
+ else if (event == OSSA_IO_ABORTED)
+ {
+ TI_DBG2(("ossaSSPEvent: OSSA_IO_ABORTED\n"));
+ /* clean up TD layer's IORequestBody */
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (event == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_NOT_VALID\n"));
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+
+ }
+#endif
+ else if (event == OSSA_IO_XFER_CMD_FRAME_ISSUED)
+ {
+ TI_DBG2(("ossaSSPEvent: OSSA_IO_XFER_CMD_FRAME_ISSUED\n"));
+ }
+ else if (event == OSSA_IO_XFER_ERROR_OFFSET_MISMATCH)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_XFER_ERROR_OFFSET_MISMATCH\n"));
+ }
+ else if (event == OSSA_IO_OVERFLOW)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OVERFLOW\n"));
+ /*
+ ??? can't call; missing agIOInfoLen
+ ostiInitiatorIOCompleted (
+ tiRoot,
+ tdIORequestBody->tiIORequest,
+ tiIOOverRun,
+ agIOInfoLen,
+ agNULL,
+ intContext
+ );
+
+ */
+
+ }
+ else if (event == OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED\n"));
+ }
+ else if (event == OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO\n"));
+ }
+ else if (event == OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST\n"));
+ }
+ else if (event == OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE\n"));
+ }
+ else if (event == OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED\n"));
+ }
+ else if (event == OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH\n"));
+ }
+ else if (event == OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN)
+ {
+ TI_DBG1(("ossaSSPEvent: OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN\n"));
+ }
+ else if (event == OSSA_IO_XFR_ERROR_DIF_MISMATCH ||
+ event == OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH ||
+ event == OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH ||
+ event == OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH )
+ {
+ TI_DBG1(("ossaSSPEvent: DIF related, event 0x%x\n", event));
+ /* process DIF detail information */
+ TI_DBG2(("ossaSSPEvent: agIOInfoLen %d\n", agIOInfoLen));
+ if (agParam == agNULL)
+ {
+ TI_DBG2(("ossaSSPEvent: agParam is NULL!!!\n"));
+ return;
+ }
+ if (agIOInfoLen < sizeof(agsaDifDetails_t))
+ {
+ TI_DBG2(("ossaSSPEvent: wrong agIOInfoLen!!! agIOInfoLen %d sizeof(agsaDifDetails_t) %d\n", agIOInfoLen, (int)sizeof(agsaDifDetails_t)));
+ return;
+ }
+ /* reads agsaDifDetails_t */
+ saFrameReadBlock(agRoot, agParam, 0, &agDifDetails, sizeof(agsaDifDetails_t));
+#ifdef REMOVED
+ frameOffset = (agDifDetails.ErrBoffsetEDataLen & 0xFFFF);
+#endif
+ frameLen = (bit16)((agDifDetails.ErrBoffsetEDataLen & 0xFFFF0000) >> 16);
+
+ TI_DBG2(("ossaSSPEvent: UpperLBA 0x%08x LowerLBA 0x%08x\n", agDifDetails.UpperLBA, agDifDetails.LowerLBA));
+ TI_DBG2(("ossaSSPEvent: SASAddrHI 0x%08x SASAddrLO 0x%08x\n",
+ TD_GET_SAS_ADDRESSHI(agDifDetails.sasAddressHi), TD_GET_SAS_ADDRESSLO(agDifDetails.sasAddressLo)));
+ TI_DBG2(("ossaSSPEvent: DIF error mask 0x%x Device ID 0x%x\n",
+ (agDifDetails.DIFErrDevID) & 0xFF, (agDifDetails.DIFErrDevID & 0xFFFF0000) >> 16));
+ if (frameLen != 0 && frameLen <= 256)
+ {
+ saFrameReadBlock(agRoot, agParam, sizeof(agsaDifDetails_t), framePayload, frameLen);
+ tdhexdump("ossaSSPEvent frame", framePayload, frameLen);
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaSSPEvent: other event 0x%x\n", event));
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "Y9");
+ return;
+}
+
+#ifdef FDS_SM
+osGLOBAL void ossaSATAIDAbortCB(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 flag,
+ bit32 status)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdAbortIORequestBody;
+
+ TI_DBG1(("ossaSATAIDAbortCB: start flag %d status %d\n", flag, status));
+
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+
+ /*
+ triggered by tdIDStartTimerCB
+ */
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+}
+#endif
+
+#ifdef INITIATOR_DRIVER
+osGLOBAL void ossaSSPAbortCB(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 flag,
+ bit32 status)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdAbortIORequestBody = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tiDeviceHandle_t *tiDeviceHandle = agNULL;
+ tiIORequest_t *taskTag = agNULL;
+
+ TI_DBG2(("ossaSSPAbortCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Ya");
+
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ if (tdAbortIORequestBody == agNULL)
+ {
+ TI_DBG1(("ossaSSPAbortCB: tdAbortIORequestBody is NULL warning!!!!\n"));
+ return;
+ }
+
+ if (flag == 2)
+ {
+ /* abort per port */
+ TI_DBG1(("ossaSSPAbortCB: abort per port\n"));
+ }
+ else if (flag == 1)
+ {
+ TI_DBG2(("ossaSSPAbortCB: abort all\n"));
+
+ tiDeviceHandle = (tiDeviceHandle_t *)tdAbortIORequestBody->tiDevHandle;
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("ossaSSPAbortCB: tiDeviceHandle is NULL warning!!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaSSPAbortCB: oneDeviceData is NULL warning!!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSSPAbortCB: OSSA_IO_SUCCESS\n"));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortOK,
+ agNULL);
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NOT_VALID\n"));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortFailed,
+ agNULL );
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NO_DEVICE\n"));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortInProgress,
+ agNULL );
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortInProgress,
+ agNULL );
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortDelayed,
+ agNULL );
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: other status %d\n", status));
+ /* clean up TD layer's IORequestBody */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortInProgress,
+ agNULL );
+ }
+ else
+ {
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else if (flag == 0)
+ {
+ TI_DBG2(("ossaSSPAbortCB: abort one\n"));
+ taskTag = tdAbortIORequestBody->tiIOToBeAbortedRequest;
+
+ if ( taskTag == agNULL)
+ {
+ TI_DBG1(("ossaSSPAbortCB: taskTag is NULL; triggered by itdssQueryTaskCompleted\n"));
+ }
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSSPAbortCB: OSSA_IO_SUCCESS\n"));
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortOK,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NOT_VALID\n"));
+
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortFailed,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NO_DEVICE\n"));
+
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortInProgress,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortInProgress,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortDelayed,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: other status %d\n", status));
+
+ if (taskTag != agNULL)
+ {
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ agNULL,
+ tiIntrEventTypeLocalAbort,
+ tiAbortFailed,
+ taskTag );
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: wrong flag %d\n", flag));
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Ya");
+ return;
+
+}
+#endif
+
+
+#ifdef TARGET_DRIVER
+osGLOBAL void ossaSSPAbortCB(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 flag,
+ bit32 status)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdAbortIORequestBody;
+ tdsaDeviceData_t *oneDeviceData;
+ tiDeviceHandle_t *tiDeviceHandle;
+
+ TI_DBG3(("ossaSSPAbortCB: start\n"));
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+
+ if (flag == 2)
+ {
+ /* abort per port */
+ TI_DBG2(("ossaSSPAbortCB: abort per port\n"));
+ }
+ else if (flag == 1)
+ {
+ TI_DBG2(("ossaSSPAbortCB: abort all\n"));
+ tiDeviceHandle = (tiDeviceHandle_t *)tdAbortIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSSPAbortCB: OSSA_IO_SUCCESS\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG3(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NOT_VALID\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NO_DEVICE\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: other status %d\n", status));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG2(("ossaSSPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSSPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else if (flag == 0)
+ {
+ TI_DBG2(("ossaSSPAbortCB: abort one\n"));
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSSPAbortCB: OSSA_IO_SUCCESS\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NOT_VALID\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_NO_DEVICE\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSSPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: other status %d\n", status));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaSSPAbortCB: wrong flag %d\n", flag));
+ }
+
+ return;
+
+}
+#endif
+
+
+/*****************************************************************************/
+/*! \brief ossaLocalPhyControlCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to indicate the status of
+ * phy operations
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param phyId Phy id
+ * \param phyOperation Operation to be done on the phy
+ * \param status Phy operation specific completion status
+ * \param parm Additional parameter, phy operation and status specific
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaLocalPhyControlCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 phyId,
+ bit32 phyOperation,
+ bit32 status,
+ void *parm
+ )
+{
+#ifdef REMVOED
+ agsaPhyErrCounters_t *agPhyErrCounters;
+#endif
+#ifdef INITIATOR_DRIVER
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tiIORequest_t *currentTaskTag;
+ tdsaDeviceData_t *TargetDeviceData;
+ satDeviceData_t *pSatDevData;
+ agsaDevHandle_t *agDevHandle = agNULL;
+ agsaContext_t *agContextDevice;
+#endif
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yb");
+ TI_DBG3(("ossaLocalPhyControlCB: start phyID %d\n", phyId));
+ TI_DBG3(("ossaLocalPhyControlCB: phyOperation %d status 0x%x\n", phyOperation, status));
+ switch (phyOperation)
+ {
+ case AGSA_PHY_LINK_RESET: /* fall through */
+ case AGSA_PHY_HARD_RESET:
+ if (phyOperation == AGSA_PHY_LINK_RESET)
+ {
+ TI_DBG1(("ossaLocalPhyControlCB: AGSA_PHY_LINK_RESET, status 0x%x\n", status));
+ }
+ else
+ {
+ TI_DBG1(("ossaLocalPhyControlCB: AGSA_PHY_HARD_RESET, status 0x%x\n", status));
+ }
+#ifdef INITIATOR_DRIVER
+ if (agContext != agNULL)
+ {
+ currentTaskTag = (tiIORequest_t *)agContext->osData;
+ if (status == OSSA_SUCCESS)
+ {
+ if (currentTaskTag != agNULL)
+ {
+ TI_DBG2(("ossaLocalPhyControlCB: callback to OS layer with success\n"));
+ TargetDeviceData = (tdsaDeviceData_t *)currentTaskTag->tdData;
+ pSatDevData = (satDeviceData_t *)&(TargetDeviceData->satDevData);
+ agDevHandle = TargetDeviceData->agDevHandle;
+ TI_DBG2(("ossaLocalPhyControlCB: satPendingIO %d satNCQMaxIO %d\n", pSatDevData->satPendingIO, pSatDevData->satNCQMaxIO ));
+ TI_DBG2(("ossaLocalPhyControlCB: satPendingNCQIO %d satPendingNONNCQIO %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
+ pSatDevData->satDriveState = SAT_DEV_STATE_NORMAL;
+
+ if (TargetDeviceData->TRflag == agTRUE)
+ {
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, TargetDeviceData), agDevHandle, SA_DS_OPERATIONAL);
+ TargetDeviceData->TRflag = agFALSE;
+ ostiInitiatorEvent(tiRoot,
+ TargetDeviceData->tdPortContext->tiPortalContext,
+ &(TargetDeviceData->tiDeviceHandle),
+ tiIntrEventTypeTransportRecovery,
+ tiRecOK,
+ agNULL
+ );
+ }
+ else
+ {
+ agDevHandle = TargetDeviceData->agDevHandle;
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG1(("ossaLocalPhyControlCB: wrong, agDevHandle is NULL\n"));
+ }
+ /* move this to OSSA_HW_EVENT_PORT_RESET_COMPLETE in ossaHwCB() */
+ agContextDevice = &(TargetDeviceData->agDeviceResetContext);
+ agContextDevice->osData = currentTaskTag;
+
+#ifdef REMOVED
+ ostiInitiatorEvent( tiRoot,
+ NULL,
+ NULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMOK,
+ currentTaskTag );
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (currentTaskTag != agNULL)
+ {
+ TI_DBG1(("ossaLocalPhyControlCB: callback to OS layer with failure\n"));
+ TargetDeviceData = (tdsaDeviceData_t *)currentTaskTag->tdData;
+ pSatDevData = (satDeviceData_t *)&(TargetDeviceData->satDevData);
+ TI_DBG1(("ossaLocalPhyControlCB: satPendingIO %d satNCQMaxIO %d\n", pSatDevData->satPendingIO, pSatDevData->satNCQMaxIO ));
+ TI_DBG1(("ossaLocalPhyControlCB: satPendingNCQIO %d satPendingNONNCQIO %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
+ if (TargetDeviceData->TRflag == agTRUE)
+ {
+ TargetDeviceData->TRflag = agFALSE;
+ ostiInitiatorEvent(tiRoot,
+ TargetDeviceData->tdPortContext->tiPortalContext,
+ &(TargetDeviceData->tiDeviceHandle),
+ tiIntrEventTypeTransportRecovery,
+ tiRecFailed ,
+ agNULL
+ );
+ }
+ else
+ {
+ ostiInitiatorEvent( tiRoot,
+ NULL,
+ NULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMFailed,
+ currentTaskTag );
+ }
+ }
+ }
+ }
+#endif
+ break;
+#ifdef REMOVED
+ case AGSA_PHY_GET_ERROR_COUNTS:
+
+ TI_DBG2(("ossaLocalPhyControlCB: AGSA_PHY_GET_ERROR_COUNTS, status 0x%x\n", status));
+ if(parm !=agNULL )
+ {
+ agPhyErrCounters = (agsaPhyErrCounters_t *)parm;
+ TI_DBG2(("ossaLocalPhyControlCB: invalidDword %d\n", agPhyErrCounters->invalidDword));
+ TI_DBG2(("ossaLocalPhyControlCB: runningDisparityError %d\n", agPhyErrCounters->runningDisparityError));
+ TI_DBG2(("ossaLocalPhyControlCB: lostOfDwordSynch %d\n", agPhyErrCounters->lossOfDwordSynch));
+ TI_DBG2(("ossaLocalPhyControlCB: phyResetProblem %d\n", agPhyErrCounters->phyResetProblem));
+ TI_DBG2(("ossaLocalPhyControlCB: elasticityBufferOverflow %d\n", agPhyErrCounters->elasticityBufferOverflow));
+ TI_DBG2(("ossaLocalPhyControlCB: receivedErrorPrimitive %d\n", agPhyErrCounters->receivedErrorPrimitive));
+ }
+ break;
+ case AGSA_PHY_CLEAR_ERROR_COUNTS:
+ TI_DBG2(("ossaLocalPhyControlCB: AGSA_PHY_CLEAR_ERROR_COUNTS, status 0x%x\n", status));
+ break;
+#endif
+ case AGSA_PHY_NOTIFY_ENABLE_SPINUP:
+ TI_DBG2(("ossaLocalPhyControlCB: AGSA_PHY_NOTIFY_ENABLE_SPINUP, status 0x%x\n", status));
+ break;
+ case AGSA_PHY_BROADCAST_ASYNCH_EVENT:
+ TI_DBG2(("ossaLocalPhyControlCB: AGSA_PHY_BROADCAST_ASYNCH_EVENT, status 0x%x\n", status));
+ if (tIsSPC12SATA(agRoot))
+ {
+ TI_DBG1(("ossaLocalPhyControlCB: BROADCAST_ASYNCH_EVENT received for SATA Controller\n"));
+ break;
+ }
+ break;
+ case AGSA_PHY_COMINIT_OOB :
+ TI_DBG2(("ossaLocalPhyControlCB: AGSA_PHY_COMINIT_OOB, status 0x%x\n", status));
+ break;
+ default:
+ TI_DBG1(("ossaLocalPhyControlCB: UNKNOWN default case. phyOperation %d status 0x%x\n", phyOperation, status));
+ break;
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yb");
+ return;
+}
+
+GLOBAL void ossaGetPhyProfileCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 ppc,
+ bit32 phyID,
+ void *parm )
+{
+
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef CCFLAGS_PHYCONTROL_COUNTS
+ agsaPhyAnalogSettingsPage_t *analog;
+#endif /* CCFLAGS_PHYCONTROL_COUNTS */
+ tdPhyCount_t *PhyBlob = agNULL;
+
+ agsaPhyBWCountersPage_t *agBWCounters;
+ agsaPhyErrCountersPage_t *agPhyErrCounters;
+ TI_DBG1(("ossaGetPhyProfileCB: agContext %p parm %p\n", agContext, parm));
+/*
+ if( tdsaAllShared->tdFWControlEx.inProgress )
+ {
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ PhyBlob = (tdPhyCount_t *)tdsaAllShared->tdFWControlEx.usrAddr;
+ }
+*/
+ switch(ppc)
+ {
+ case AGSA_SAS_PHY_BW_COUNTERS_PAGE:
+ TI_DBG1(("ossaGetPhyProfileCB: AGSA_SAS_PHY_BW_COUNTERS_PAGE, status 0x%x phyID %d\n", status, phyID));
+ if(parm !=agNULL )
+ {
+ agBWCounters = (agsaPhyBWCountersPage_t *)parm;
+ TI_DBG1(("ossaGetPhyProfileCB: RX %d TX %d\n", agBWCounters->RXBWCounter,agBWCounters->TXBWCounter));
+ if(PhyBlob !=agNULL )
+ {
+ PhyBlob->InvalidDword = 0;
+ PhyBlob->runningDisparityError = 0;
+ PhyBlob->codeViolation = 0;
+ PhyBlob->phyResetProblem = 0;
+ PhyBlob->inboundCRCError = 0;
+ PhyBlob->BW_rx = agBWCounters->RXBWCounter;
+ PhyBlob->BW_tx = agBWCounters->TXBWCounter;
+ }
+
+ }
+ break;
+ case AGSA_SAS_PHY_ERR_COUNTERS_PAGE:
+ if( tdsaAllShared->tdFWControlEx.inProgress )
+ {
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ PhyBlob = (tdPhyCount_t *)tdsaAllShared->tdFWControlEx.usrAddr;
+ }
+ TI_DBG1(("ossaGetPhyProfileCB: AGSA_SAS_PHY_ERR_COUNTERS_PAGE, status 0x%x phyID %d\n", status, phyID));
+ if(parm !=agNULL )
+ {
+ agPhyErrCounters = (agsaPhyErrCountersPage_t *)parm;
+ if(PhyBlob !=agNULL )
+ {
+
+ PhyBlob->InvalidDword = agPhyErrCounters->invalidDword;
+ PhyBlob->runningDisparityError = agPhyErrCounters->runningDisparityError;
+ PhyBlob->LossOfSyncDW = agPhyErrCounters->lossOfDwordSynch;
+ PhyBlob->codeViolation = agPhyErrCounters->codeViolation;
+ PhyBlob->phyResetProblem = agPhyErrCounters->phyResetProblem;
+ PhyBlob->inboundCRCError = agPhyErrCounters->inboundCRCError;
+ PhyBlob->BW_rx = 0;
+ PhyBlob->BW_tx = 0;
+
+ TI_DBG2(("ossaGetPhyProfileCB: invalidDword %d\n", agPhyErrCounters->invalidDword));
+ TI_DBG2(("ossaGetPhyProfileCB: runningDisparityError %d\n", agPhyErrCounters->runningDisparityError));
+ TI_DBG2(("ossaGetPhyProfileCB: lostOfDwordSynch %d\n", agPhyErrCounters->lossOfDwordSynch));
+ TI_DBG2(("ossaGetPhyProfileCB: phyResetProblem %d\n", agPhyErrCounters->phyResetProblem));
+ TI_DBG2(("ossaGetPhyProfileCB: inboundCRCError %d\n", agPhyErrCounters->inboundCRCError));
+ }
+ }
+ break;
+ case AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE:
+ TI_DBG1(("ossaGetPhyProfileCB: AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE status 0x%x phyID %d\n", status, phyID));
+ break;
+ case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE:
+ TI_DBG1(("ossaGetPhyProfileCB:AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE status 0x%x phyID %d\n", status, phyID));
+#ifdef CCFLAGS_PHYCONTROL_COUNTS
+ if(parm !=agNULL )
+ {
+ analog = (agsaPhyAnalogSettingsPage_t *)parm;
+ TI_DBG1(("ossaGetPhyProfileCB: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x\n",
+ analog->Dword0, analog->Dword1, analog->Dword2, analog->Dword3, analog->Dword4,
+ analog->Dword5, analog->Dword6, analog->Dword7, analog->Dword8, analog->Dword9));
+ tdsaAllShared->analog[phyID].spaRegister0 = analog->Dword0;
+ tdsaAllShared->analog[phyID].spaRegister1 = analog->Dword1;
+ tdsaAllShared->analog[phyID].spaRegister2 = analog->Dword2;
+ tdsaAllShared->analog[phyID].spaRegister3 = analog->Dword3;
+ tdsaAllShared->analog[phyID].spaRegister4 = analog->Dword4;
+ saSetPhyProfile( agRoot,agContext,tdsaRotateQnumber(tiRoot, agNULL), AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE,sizeof(agsaPhyAnalogSetupRegisters_t),&tdsaAllShared->analog[phyID],phyID);
+ }
+#endif /* CCFLAGS_PHYCONTROL_COUNTS */
+ break;
+ case AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE:
+ {
+ TI_DBG1(("ossaGetPhyProfileCB:AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE status 0x%x phyID %d\n", status, phyID));
+ if( parm !=agNULL )
+ {
+#ifdef TD_DEBUG_ENABLE
+ agsaSASPhyOpenRejectRetryBackOffThresholdPage_t *Backoff =
+ (agsaSASPhyOpenRejectRetryBackOffThresholdPage_t *)parm;
+#endif
+ TI_DBG2(("ossaGetPhyProfileCB: DW0 0x%X DW1 0x%X DW2 0x%X DW3 0x%X\n",
+ Backoff->Dword0,Backoff->Dword1,
+ Backoff->Dword2,Backoff->Dword3));
+ }
+ break;
+ }
+
+ case AGSA_SAS_PHY_GENERAL_STATUS_PAGE:
+ {
+ agsaSASPhyGeneralStatusPage_t * GenStatus = NULL;
+
+ TI_DBG1(("ossaGetPhyProfileCB: AGSA_SAS_PHY_GENERAL_STATUS_PAGE status 0x%x phyID %d\n",
+ status, phyID));
+ if( parm !=agNULL )
+ {
+ GenStatus=
+ (agsaSASPhyGeneralStatusPage_t *)parm;
+ TI_DBG2(("ossaGetPhyProfileCB: "
+ "AGSA_SAS_PHY_GENERAL_STATUS_PAGE status %d DW0 0x%x DW1 0x%x\n",
+ status, GenStatus->Dword0, GenStatus->Dword1));
+ }
+ ostiGetPhyGeneralStatusRsp(tiRoot, GenStatus, phyID);
+// break;
+ return ;
+ }
+
+ default:
+ TI_DBG1(("ossaGetPhyProfileCB: UNKNOWN default case. phyOperation %d status 0x%x\n", ppc, status));
+ break;
+
+ }
+
+ ostiGetPhyProfileIOCTLRsp(tiRoot, status);
+
+}
+
+
+GLOBAL void ossaSetPhyProfileCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 ppc,
+ bit32 phyID,
+ void *parm )
+{
+ TI_DBG1(("ossaSetPhyProfileCB:agContext %p status 0x%x ppc %d phyID %d parm %p\n",agContext, status, ppc, phyID,parm));
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaGetDeviceHandlesCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGetDeviceHandles()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the get device handle request originally passed into
+ * saGetDeviceHandles().
+ * \param agPortContext:Pointer to this instance of a port context
+ * \param agDev: Array containing pointers to the device handles
+
+ * \param validDevs Number of valid device handles
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGetDeviceHandlesCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaPortContext_t *agPortContext,
+ agsaDevHandle_t *agDev[],
+ bit32 validDevs
+ )
+{
+ TI_DBG2(("ossaGetDeviceHandlesCB: start\n"));
+ TI_DBG2(("ossaGetDeviceHandlesCB: validDevs %d\n", validDevs));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yc");
+#ifdef TO_DO
+ for (i = 0 ; i < validDevs ; i++)
+ {
+ agDev[i];
+ }
+#endif
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yc");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGetDeviceInfoCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGetDeviceInfo()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agDevHandle: Handle of the device
+ * \param status: status
+ * \param agInfo: Pointer to the structure that describes device information
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ * For details, refer to SAS/SATA Low-Level API Specification
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGetDeviceInfoCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ void *agInfo
+ )
+{
+
+#ifdef TD_DEBUG_ENABLE
+ agsaDeviceInfo_t *agDeviceInfo;
+ agsaSASDeviceInfo_t *agSASDeviceInfo;
+ agsaSATADeviceInfo_t *agSATADeviceInfo;
+#endif
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yd");
+
+ TI_DBG1(("ossaGetDeviceInfoCB: start agContext %p\n",agContext));
+ switch (status)
+ {
+ case OSSA_DEV_INFO_INVALID_HANDLE:
+ TI_DBG1(("ossaGetDeviceInfoCB: OSSA_DEV_INFO_INVALID_HANDLE\n"));
+ /*ostiGetDeviceInfoIOCTLRsp(tiRoot, status, agNULL);*/
+ break;
+ case OSSA_DEV_INFO_NO_EXTENDED_INFO:
+#ifdef TD_DEBUG_ENABLE
+ agDeviceInfo = (agsaDeviceInfo_t *)agInfo;
+#endif
+ TI_DBG1(("ossaGetDeviceInfoCB: OSSA_DEV_INFO_NO_EXTENDED_INFO\n"));
+ TI_DBG1(("ossaGetDeviceInfoCB: sasAddressHi 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSHI(agDeviceInfo)));
+ TI_DBG1(("ossaGetDeviceInfoCB: sasAddressLo 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSLO(agDeviceInfo)));
+ TI_DBG1(("ossaGetDeviceInfoCB: devType_S_Rate 0x%08x\n", agDeviceInfo->devType_S_Rate));
+ TI_DBG1(("ossaGetDeviceInfoCB: firstBurstSize 0x%08x\n", agDeviceInfo->firstBurstSize));
+
+ /*ostiPortEvent (tiRoot, tiGetDevInfo, tiSuccess,(void *)agContext );*/
+ /*ostiGetDeviceInfoIOCTLRsp(tiRoot, status, agDeviceInfo);*/
+ break;
+ case OSSA_DEV_INFO_SAS_EXTENDED_INFO:
+#ifdef TD_DEBUG_ENABLE
+ agSASDeviceInfo = (agsaSASDeviceInfo_t *)agInfo;
+#endif
+ TI_DBG2(("ossaGetDeviceInfoCB: OSSA_DEV_INFO_SAS_EXTENDED_INFO\n"));
+ TI_DBG2(("ossaGetDeviceInfoCB: sasAddressHi 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSHI(&agSASDeviceInfo->commonDevInfo)));
+ TI_DBG2(("ossaGetDeviceInfoCB: sasAddressLo 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSLO(&agSASDeviceInfo->commonDevInfo)));
+ TI_DBG2(("ossaGetDeviceInfoCB: initiator_ssp_stp_smp %d\n", agSASDeviceInfo->initiator_ssp_stp_smp));
+ TI_DBG2(("ossaGetDeviceInfoCB: target_ssp_stp_smp %d\n", agSASDeviceInfo->target_ssp_stp_smp));
+ TI_DBG2(("ossaGetDeviceInfoCB: numOfPhys %d\n", agSASDeviceInfo->numOfPhys));
+ TI_DBG2(("ossaGetDeviceInfoCB: phyIdentifier %d\n", agSASDeviceInfo->phyIdentifier));
+
+ break;
+ case OSSA_DEV_INFO_SATA_EXTENDED_INFO:
+#ifdef TD_DEBUG_ENABLE
+ agSATADeviceInfo = (agsaSATADeviceInfo_t *)agInfo;
+#endif
+ TI_DBG2(("ossaGetDeviceInfoCB: OSSA_DEV_INFO_SATA_EXTENDED_INFO\n"));
+ TI_DBG2(("ossaGetDeviceInfoCB: sasAddressHi 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSHI(&agSATADeviceInfo->commonDevInfo)));
+ TI_DBG2(("ossaGetDeviceInfoCB: sasAddressLo 0x%08x\n", SA_DEVINFO_GET_SAS_ADDRESSLO(&agSATADeviceInfo->commonDevInfo)));
+ TI_DBG2(("ossaGetDeviceInfoCB: connection %d\n", agSATADeviceInfo->connection));
+ TI_DBG2(("ossaGetDeviceInfoCB: portMultiplierField %d\n", agSATADeviceInfo->portMultiplierField));
+ TI_DBG2(("ossaGetDeviceInfoCB: stpPhyIdentifier %d\n", agSATADeviceInfo->stpPhyIdentifier));
+#ifdef TD_DEBUG_ENABLE
+ tdhexdump("ossaGetDeviceInfoCB: signature", (bit8 *)agSATADeviceInfo->signature, 8);
+#endif
+ break;
+ default:
+ TI_DBG2(("ossaGetDeviceInfoCB: error default case, status is %d\n", status));
+ break;
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yd");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaDeviceRegistrationCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saRegisterNewDevice()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the get device handle request originally
+ * passed into saRegisterNewDevice().
+ * \param status: status
+ * \param agDevHandle: Pointer to the assigned device handle for the
+ * registered device.
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaDeviceRegistrationCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaDevHandle_t *agDevHandle,
+ bit32 deviceID
+ )
+{
+#ifdef INITIATOR_DRIVER
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 Indenom = tdsaAllShared->QueueConfig.numInboundQueues;
+ bit32 Outdenom = tdsaAllShared->QueueConfig.numOutboundQueues;
+ tdsaDeviceData_t *oneDeviceData = (tdsaDeviceData_t *)agContext->osData;
+ tdsaPortContext_t *onePortContext = oneDeviceData->tdPortContext;
+ tiPortalContext_t *tiPortalContext = onePortContext->tiPortalContext;
+#ifdef FDS_DM
+ dmRoot_t *dmRoot = &(tdsaAllShared->dmRoot);
+ dmPortContext_t *dmPortContext = &(onePortContext->dmPortContext);
+ dmDeviceInfo_t dmDeviceInfo;
+ bit32 DMstatus = DM_RC_FAILURE;
+ bit16 ext = 0;
+ bit32 expanderType = 1;
+#endif
+
+#if defined(FDS_DM) && !defined(FDS_SM)
+ bit32 IDstatus;
+#endif
+
+#ifdef FDS_SM
+ smRoot_t *smRoot = &(tdsaAllShared->smRoot);
+ bit32 SMstatus = SM_RC_FAILURE;
+#endif
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Ye");
+ TI_DBG3(("ossaDeviceRegistrationCB: start status 0x%x\n",status));
+ TI_DBG3(("ossaDeviceRegistrationCB: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("ossaDeviceRegistrationCB: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ TI_DBG3(("ossaDeviceRegistrationCB: did 0x%x\n", oneDeviceData->id));
+ TI_DBG3(("ossaDeviceRegistrationCB: deviceID 0x%x\n", deviceID));
+ TI_DBG3(("ossaDeviceRegistrationCB: agDevHandle %p %p %p\n",agDevHandle,agDevHandle->osData,agDevHandle->sdkData ));
+
+ /* transient period caused by tdssReportRemovals(), device was in the middle
+ of registration but port is invalidated
+ */
+ if (oneDeviceData->valid == agFALSE && oneDeviceData->valid2 == agFALSE
+ && oneDeviceData->DeviceType == TD_DEFAULT_DEVICE)
+ {
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: transient, calling saDeregisterDeviceHandle, did %d\n", oneDeviceData->id));
+ oneDeviceData->agDevHandle = agDevHandle;
+ agDevHandle->osData = oneDeviceData;
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ if (oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, 0);
+ }
+ else
+ {
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ }
+ else
+ {
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ }
+ else if (status == OSSA_FAILURE_PORT_NOT_VALID_STATE || status == OSSA_ERR_PORT_STATE_NOT_VALID)
+ {
+ /* do nothing */
+ TI_DBG2(("ossaDeviceRegistrationCB: transient, do nothing did %d\n", oneDeviceData->id));
+ }
+ return;
+ }
+
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG3(("ossaDeviceRegistrationCB: agDevHandle is NULL\n"));
+ }
+ else
+ {
+ TI_DBG3(("ossaDeviceRegistrationCB: agDevHandle is NOT NULL\n"));
+ }
+
+ switch (status)
+ {
+ case OSSA_SUCCESS:
+ TI_DBG3(("ossaDeviceRegistrationCB: success\n"));
+ TI_DBG2(("ossaDeviceRegistrationCB: Success did %d FW did 0x%x\n", oneDeviceData->id, deviceID));
+ TI_DBG2(("ossaDeviceRegistrationCB: Success pid %d\n", onePortContext->id));
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: agDevHandle is NULL, wrong!\n"));
+ return;
+ }
+ oneDeviceData->agDevHandle = agDevHandle;
+ agDevHandle->osData = oneDeviceData;
+ oneDeviceData->registered = agTRUE;
+ oneDeviceData->InQID = oneDeviceData->id % Indenom;
+ oneDeviceData->OutQID = oneDeviceData->id % Outdenom;
+ onePortContext->RegisteredDevNums++;
+
+ TI_DBG3(("ossaDeviceRegistrationCB: direct %d STP target %d target_ssp_stp_smp %d\n", oneDeviceData->directlyAttached, DEVICE_IS_STP_TARGET(oneDeviceData), oneDeviceData->target_ssp_stp_smp));
+ TI_DBG3(("ossaDeviceRegistrationCB: pid %d registeredNumDevice %d\n", onePortContext->id, onePortContext->RegisteredDevNums));
+ TI_DBG3(("ossaDeviceRegistrationCB: pid %d Count %d\n", onePortContext->id, onePortContext->Count));
+
+#ifdef FDS_DM
+ /* if device is an expander, register it to DM */
+ if (onePortContext->valid == agTRUE)
+ {
+ if (DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: calling dmRegisterDevice\n"));
+ TI_DBG1(("ossaDeviceRegistrationCB: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("ossaDeviceRegistrationCB: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ /* set up dmDeviceInfo */
+ osti_memset(&dmDeviceInfo, 0, sizeof(dmDeviceInfo_t));
+ DEVINFO_PUT_SAS_ADDRESSLO(&dmDeviceInfo, oneDeviceData->SASAddressID.sasAddressLo);
+ DEVINFO_PUT_SAS_ADDRESSHI(&dmDeviceInfo, oneDeviceData->SASAddressID.sasAddressHi);
+ dmDeviceInfo.initiator_ssp_stp_smp = oneDeviceData->initiator_ssp_stp_smp;
+ dmDeviceInfo.target_ssp_stp_smp = oneDeviceData->target_ssp_stp_smp;
+ dmDeviceInfo.devType_S_Rate = oneDeviceData->agDeviceInfo.devType_S_Rate;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ /* setting SMP bit */
+ ext = (bit16)(ext | 0x100);
+ expanderType = SA_IDFRM_GET_DEVICETTYPE(&onePortContext->sasIDframe);
+ ext = (bit16)( ext | (expanderType << 9));
+ /* setting MCN field to 0xF */
+ ext = (bit16)(ext | (bit16)(0xF << 11));
+ TI_DBG1(("ossaDeviceRegistrationCB: directlyAttached ext 0x%x\n", ext));
+ dmDeviceInfo.ext = ext;
+ }
+ DMstatus = dmRegisterDevice(dmRoot, dmPortContext, &dmDeviceInfo, oneDeviceData->agDevHandle);
+ if (DMstatus != DM_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: dmRegisterDevice failed!!! 0x%x\n", DMstatus));
+ }
+ }
+ }
+#endif /* FDS_DM */
+#ifdef FDS_SM
+ /* if device is SATA, register it to SM */
+ if (onePortContext->valid == agTRUE)
+ {
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: calling smRegisterDevice\n"));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ SMstatus = smRegisterDevice(smRoot,
+ agDevHandle,
+ &(oneDeviceData->smDeviceHandle),
+ agNULL,
+ (bit32)oneDeviceData->phyID,
+ oneDeviceData->satDevData.satDeviceType);
+ }
+ else
+ {
+ if (oneDeviceData->ExpDevice == agNULL)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: oneDeviceData->ExpDevice NULL!!!\n"));
+ return;
+ }
+ if (oneDeviceData->ExpDevice->agDevHandle == agNULL)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: oneDeviceData->ExpDevice->agDevHandle NULL!!!\n"));
+ }
+ SMstatus = smRegisterDevice(smRoot,
+ agDevHandle,
+ &(oneDeviceData->smDeviceHandle),
+ oneDeviceData->ExpDevice->agDevHandle,
+ (bit32)oneDeviceData->phyID,
+ oneDeviceData->satDevData.satDeviceType);
+ }
+ if (SMstatus != SM_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: smRegisterDevice failed!!! 0x%x\n", DMstatus));
+ }
+ }
+ }
+#endif /* FDS_SM */
+ /* special case for directly attached targets */
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG3(("ossaDeviceRegistrationCB: directly attached did %d\n", oneDeviceData->id));
+ if (oneDeviceData->DeviceType == TD_SAS_DEVICE)
+ {
+ TI_DBG3(("ossaDeviceRegistrationCB: SAS target\n"));
+ if (onePortContext->valid == agTRUE)
+ {
+ if (onePortContext->PortRecoverPhyID != 0xFF)
+ {
+ oneDeviceData->phyID = (bit8)onePortContext->PortRecoverPhyID;
+ onePortContext->PortRecoverPhyID = 0xFF;
+ TI_DBG3(("ossaDeviceRegistrationCB: PortRecoverPhyID %d\n", oneDeviceData->phyID));
+ }
+ /* link up and discovery ready event */
+ if (onePortContext->DiscoveryRdyGiven == agFALSE)
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: link up and discovery ready\n"));
+ TI_DBG3(("ossaDeviceRegistrationCB: phyID %d pid %d\n", oneDeviceData->phyID, onePortContext->id));
+ TI_DBG3(("ossaDeviceRegistrationCB: tiPortalContext %p\n", tdsaAllShared->Ports[oneDeviceData->phyID].tiPortalContext));
+ TI_DBG3(("ossaDeviceRegistrationCB: onePortContext->tiPortalContext %p\n", onePortContext->tiPortalContext));
+ onePortContext->DiscoveryRdyGiven = agTRUE;
+ if (onePortContext->DiscoveryState != ITD_DSTATE_NOT_STARTED)
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: wrong discovery state 0x%x\n", onePortContext->DiscoveryState));
+ }
+ /* notifying link up */
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#endif
+ }
+ }
+ else
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: abort call\n"));
+ /* abort all followed by deregistration of sas target */
+ tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ }
+ }
+ else
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: SATA target\n"));
+ if (onePortContext->valid == agTRUE)
+ {
+ if (oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+#ifdef FDS_SM
+ /* send identify device data */
+ tdIDStart(tiRoot, agRoot, smRoot, oneDeviceData, onePortContext);
+
+#else
+ /* send identify device data */
+ tdssSubAddSATAToSharedcontext(tiRoot, oneDeviceData);
+#endif
+ }
+ }
+ else
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: abort call\n"));
+ /* abort all followed by deregistration of sas target */
+ tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ }
+ }
+ }
+ else /* behind the expander */
+ {
+#if defined(FDS_DM) && defined(FDS_SM)
+ /* send ID to SATA targets
+ needs go allocate tdIORequestBody_t for smIORequest
+ */
+
+ if ( (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ &&
+ oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+ tdIDStart(tiRoot, agRoot, smRoot, oneDeviceData, onePortContext);
+ }
+
+#elif defined(FDS_DM) /* worked with DM */
+ if ( (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ &&
+ oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+ IDstatus = tdsaDiscoveryStartIDDev(tiRoot,
+ agNULL,
+ &(oneDeviceData->tiDeviceHandle),
+ agNULL,
+ oneDeviceData);
+
+ if (IDstatus != tiSuccess)
+ {
+ /* identify device data is not valid */
+ TI_DBG1(("ossaDeviceRegistrationCB: fail or busy %d\n", IDstatus));
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ }
+ }
+#endif
+
+
+ }
+ /* after discovery is finished */
+ if (onePortContext->DiscoveryState == ITD_DSTATE_COMPLETED)
+ {
+ TI_DBG2(("ossaDeviceRegistrationCB: calling new device arrival\n"));
+ if (DEVICE_IS_SSP_TARGET(oneDeviceData))
+ {
+ /* in case registration is finished after discovery is finished */
+#ifdef AGTIAPI_CTL
+ if (tdsaAllShared->SASConnectTimeLimit)
+ tdsaCTLSet(tiRoot, onePortContext, tiIntrEventTypeDeviceChange,
+ tiDeviceArrival);
+ else
+#endif
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceArrival,
+ agNULL
+ );
+ }
+ else if ( (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ &&
+ oneDeviceData->satDevData.IDDeviceValid == agTRUE )
+ {
+ /* in case registration is finished after discovery is finished */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceArrival,
+ agNULL
+ );
+ }
+ }
+ break;
+ case OSSA_FAILURE_OUT_OF_RESOURCE: /* fall through */
+ case OSSA_ERR_DEVICE_HANDLE_UNAVAILABLE:
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_OUT_OF_RESOURCE or OSSA_ERR_DEVICE_HANDLE_UNAVAILABLE\n"));
+ oneDeviceData->registered = agFALSE;
+ break;
+ case OSSA_FAILURE_DEVICE_ALREADY_REGISTERED: /* fall through */
+ case OSSA_ERR_DEVICE_ALREADY_REGISTERED:
+ /* do nothing */
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_DEVICE_ALREADY_REGISTERED or OSSA_ERR_DEVICE_ALREADY_REGISTERED\n"));
+ break;
+ case OSSA_FAILURE_INVALID_PHY_ID: /* fall through */
+ case OSSA_ERR_PHY_ID_INVALID:
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_INVALID_PHY_ID or OSSA_ERR_PHY_ID_INVALID\n"));
+ oneDeviceData->registered = agFALSE;
+ break;
+ case OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED: /* fall through */
+ case OSSA_ERR_PHY_ID_ALREADY_REGISTERED:
+ /* do nothing */
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED or OSSA_ERR_PHY_ID_ALREADY_REGISTERED\n"));
+ break;
+ case OSSA_FAILURE_PORT_ID_OUT_OF_RANGE: /* fall through */
+ case OSSA_ERR_PORT_INVALID:
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_PORT_ID_OUT_OF_RANGE or OSSA_ERR_PORT_INVALID\n"));
+ oneDeviceData->registered = agFALSE;
+ break;
+ case OSSA_FAILURE_PORT_NOT_VALID_STATE: /* fall through */
+ case OSSA_ERR_PORT_STATE_NOT_VALID:
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_PORT_NOT_VALID_STATE or OSSA_ERR_PORT_STATE_NOT_VALID\n"));
+ TI_DBG2(("ossaDeviceRegistrationCB: did %d pid %d\n", oneDeviceData->id, onePortContext->id));
+ oneDeviceData->registered = agFALSE;
+ /* transient period between link up and link down/port recovery */
+ onePortContext->Transient = agTRUE;
+ if (onePortContext->valid == agTRUE && (oneDeviceData->valid == agTRUE || oneDeviceData->valid2 == agTRUE))
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: retries regisration\n"));
+#ifdef REMOVED
+ //temp; setting MCN to tdsaAllShared->MCN
+ oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | (tdsaAllShared->MCN << 16);
+ //end temp
+#endif
+ saRegisterNewDevice( /* ossaDeviceRegistrationCB */
+ agRoot,
+ &oneDeviceData->agContext,
+ 0,
+ &oneDeviceData->agDeviceInfo,
+ onePortContext->agPortContext,
+ 0
+ );
+ }
+ else if (oneDeviceData->directlyAttached == agTRUE && DEVICE_IS_SATA_DEVICE(oneDeviceData))
+ {
+ TI_DBG1(("ossaDeviceRegistrationCB: directly attached SATA, put back into free list\n"));
+ tdsaDeviceDataReInit(tiRoot, oneDeviceData);
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ }
+ break;
+ case OSSA_FAILURE_DEVICE_TYPE_NOT_VALID: /* fall through */
+ case OSSA_ERR_DEVICE_TYPE_NOT_VALID:
+ TI_DBG1(("ossaDeviceRegistrationCB: OSSA_FAILURE_DEVICE_TYPE_NOT_VALID or OSSA_ERR_DEVICE_TYPE_NOT_VALID\n"));
+ oneDeviceData->registered = agFALSE;
+ break;
+ default:
+ TI_DBG1(("ossaDeviceRegistrationCB: wrong. default status is %d\n", status));
+ break;
+
+
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Ye");
+ return;
+#endif
+}
+
+/*****************************************************************************/
+/*! \brief ossaDeregisterDeviceHandleCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saDeregisterDeviceHandle()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agDevHandle: Pointer to the assigned device handle for the
+ * registered device.
+ * \param status: status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaDeregisterDeviceHandleCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdsaPortContext_t *onePortContext = agNULL;
+ agsaEventSource_t *eventSource;
+ bit32 HwAckSatus;
+ bit32 PhyID;
+#ifdef FDS_DM
+ dmRoot_t *dmRoot = &(tdsaAllShared->dmRoot);
+ dmPortContext_t *dmPortContext = agNULL;
+ dmPortInfo_t dmPortInfo;
+ bit32 DMstatus = DM_RC_FAILURE;
+#endif
+#ifdef FDS_SM
+ smRoot_t *smRoot = &(tdsaAllShared->smRoot);
+#endif
+
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yf");
+
+ if (status == OSSA_ERR_DEVICE_HANDLE_INVALID)
+ {
+ /* there is no device handle to process */
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: OSSA_ERR_DEVICE_HANDLE_INVALID\n"));
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+ onePortContext = oneDeviceData->tdPortContext;
+#ifdef FDS_DM
+ dmPortContext = &(onePortContext->dmPortContext);
+#endif
+
+ if (oneDeviceData->valid == agFALSE && oneDeviceData->valid2 == agFALSE &&
+ oneDeviceData->DeviceType == TD_DEFAULT_DEVICE && onePortContext->valid == agTRUE)
+ {
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: transient did %d\n", oneDeviceData->id));
+ return;
+ }
+
+ if (onePortContext != agNULL)
+ {
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: pid %d registeredNumDevice %d\n", onePortContext->id, onePortContext->RegisteredDevNums));
+ }
+
+ switch (status)
+ {
+ case OSSA_SUCCESS:
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: Success\n"));
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: onePortContext is NULL, wrong!\n"));
+ return;
+ }
+ /* port is going down */
+ if (onePortContext->valid == agFALSE)
+ {
+ if (!(oneDeviceData->valid == agFALSE && oneDeviceData->valid2 == agFALSE && oneDeviceData->DeviceType == TD_DEFAULT_DEVICE))
+ {
+ /* remove oneDevice from MainLink */
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: delete from MainLink\n"));
+#ifdef FDS_SM
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: did %d calling smDeregisterDevice\n", oneDeviceData->id));
+ smDeregisterDevice(smRoot, oneDeviceData->agDevHandle, &(oneDeviceData->smDeviceHandle));
+ }
+#endif
+ tdsaDeviceDataReInit(tiRoot, oneDeviceData);
+ osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ }
+ /* for portcontext */
+ PhyID = onePortContext->eventPhyID;
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: PhyID %d\n", PhyID));
+ onePortContext->RegisteredDevNums--;
+ /*
+ check if valid in tdsaAllShared and the last registered device in a portcontext;
+ if so, call saHwEventAck()
+ */
+ if (tdsaAllShared->eventSource[PhyID].EventValid == agTRUE &&
+ onePortContext->RegisteredDevNums == 0 &&
+ PhyID != 0xFF
+ )
+ {
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: calling saHwEventAck\n"));
+ eventSource = &(tdsaAllShared->eventSource[PhyID].Source);
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ }
+
+ /* toggle */
+ tdsaAllShared->eventSource[PhyID].EventValid = agFALSE;
+
+#ifdef FDS_DM
+ if (onePortContext->UseDM == agTRUE)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: calling dmDestroyPort\n"));
+ /* setup dmPortInfo */
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSLO(&dmPortInfo, onePortContext->sasRemoteAddressLo);
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSHI(&dmPortInfo, onePortContext->sasRemoteAddressHi);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSLO(&dmPortInfo, onePortContext->sasLocalAddressLo);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSHI(&dmPortInfo, onePortContext->sasLocalAddressHi);
+ DMstatus = dmDestroyPort(dmRoot, dmPortContext, &dmPortInfo);
+ if (DMstatus != DM_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: dmDestroyPort failed!!! 0x%x\n", DMstatus));
+ }
+ }
+#endif
+ tdsaPortContextReInit(tiRoot, onePortContext);
+ /*
+ put all devices belonging to the onePortContext
+ back to the free link
+ */
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else if (tdsaAllShared->eventSource[PhyID].EventValid == NO_ACK &&
+ onePortContext->RegisteredDevNums == 0
+ )
+ {
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: NO ACK case\n"));
+#ifdef FDS_DM
+ if (onePortContext->UseDM == agTRUE)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: calling dmDestroyPort\n"));
+ /* setup dmPortInfo */
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSLO(&dmPortInfo, onePortContext->sasRemoteAddressLo);
+ PORTINFO_PUT_SAS_REMOTE_ADDRESSHI(&dmPortInfo, onePortContext->sasRemoteAddressHi);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSLO(&dmPortInfo, onePortContext->sasLocalAddressLo);
+ PORTINFO_PUT_SAS_LOCAL_ADDRESSHI(&dmPortInfo, onePortContext->sasLocalAddressHi);
+ DMstatus = dmDestroyPort(dmRoot, dmPortContext, &dmPortInfo);
+ if (DMstatus != DM_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: dmDestroyPort failed!!! 0x%x\n", DMstatus));
+ }
+ }
+#endif
+ tdsaPortContextReInit(tiRoot, onePortContext);
+ /*
+ put all devices belonging to the onePortContext
+ back to the free link
+ */
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ else
+ {
+ if (PhyID < TD_MAX_NUM_PHYS)
+ {
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: pid %d eventvalid %d registeredNumDevice %d\n", onePortContext->id, tdsaAllShared->eventSource[PhyID].EventValid , onePortContext->RegisteredDevNums));
+ }
+ else
+ {
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: pid %d registeredNumDevice %d wrong phyid %d\n", onePortContext->id, onePortContext->RegisteredDevNums, PhyID));
+ }
+ }
+ }
+ else
+ {
+ PhyID = onePortContext->eventPhyID;
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: PhyID %d\n", PhyID));
+ onePortContext->RegisteredDevNums--;
+#ifdef FDS_SM
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ smDeregisterDevice(smRoot, oneDeviceData->agDevHandle, &(oneDeviceData->smDeviceHandle));
+ }
+#endif
+ /*
+ check if valid in tdsaAllShared and the last registered device in a portcontext;
+ if so, call saHwEventAck()
+ */
+ if (tdsaAllShared->eventSource[PhyID].EventValid == agTRUE &&
+ onePortContext->RegisteredDevNums == 0 &&
+ PhyID != 0xFF
+ )
+ {
+ TI_DBG2(("ossaDeregisterDeviceHandleCB: calling saHwEventAck\n"));
+ eventSource = &(tdsaAllShared->eventSource[PhyID].Source);
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: failing in saHwEventAck; status %d\n", HwAckSatus));
+ }
+
+ /* toggle */
+ tdsaAllShared->eventSource[PhyID].EventValid = agFALSE;
+ }
+#ifdef INITIATOR_DRIVER
+ else if (onePortContext->RegisteredDevNums == 1)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: all devices have been deregistered except directly attached EXP\n"));
+ /* qqqqq If broadcast has been seen, call incremental discovery*/
+ if (onePortContext->DiscFailNSeenBC == agTRUE)
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: calling dmDiscover, incremental, pid %d\n", onePortContext->id));
+ dmDiscover(dmRoot, dmPortContext, DM_DISCOVERY_OPTION_INCREMENTAL_START);
+ onePortContext->DiscFailNSeenBC = agFALSE;
+ }
+ else
+ {
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: not calling dmDiscover\n"));
+ /* qqqqq needs to change discovery state to onePortContext->DMDiscoveryState == dmDiscCompleted
+ in dmQueryDiscovery
+ change the discovery state from dmDiscFailed to dmDiscCompleted
+ */
+ dmResetFailedDiscovery(dmRoot, dmPortContext);
+
+ }
+ }
+#endif
+ else
+ {
+ if (PhyID < TD_MAX_NUM_PHYS)
+ {
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: pid %d eventvalid %d registeredNumDevice %d\n", onePortContext->id, tdsaAllShared->eventSource[PhyID].EventValid , onePortContext->RegisteredDevNums));
+ }
+ else
+ {
+ TI_DBG3(("ossaDeregisterDeviceHandleCB: pid %d registeredNumDevice %d wrong phyid %d\n", onePortContext->id, onePortContext->RegisteredDevNums, PhyID));
+ }
+ }
+ }
+ break;
+ case OSSA_INVALID_HANDLE:
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: OSSA_INVALID_HANDLE\n"));
+ break;
+#ifdef REMOVED
+ case OSSA_FAILURE_DEVICE_DIRECT_ATTACH:
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: OSSA_FAILURE_DEVICE_DIRECT_ATTACH\n"));
+ break;
+#endif
+ case OSSA_ERR_DEVICE_HANDLE_INVALID:
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: OSSA_ERR_DEVICE_HANDLE_INVALID\n"));
+ break;
+ case OSSA_ERR_DEVICE_BUSY:
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: OSSA_ERR_DEVICE_BUSY\n"));
+ break;
+ default:
+ TI_DBG1(("ossaDeregisterDeviceHandleCB: unknown status 0x%x\n", status));
+ break;
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yf");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaDeviceHandleRemovedEvent
+ *
+ *
+ * Purpose: This routine is called by lower layer to notify the device removal
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agDevHandle: Pointer to the assigned device handle for the
+ * registered device.
+ * \param agPortContext:Pointer to this instance of port context.
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaDeviceHandleRemovedEvent (
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaPortContext_t *agPortContext
+ )
+{
+#ifdef NOT_YET
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+#endif
+ tdsaPortContext_t *onePortContext = agNULL;
+ tdsaDeviceData_t *oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yg");
+ TI_DBG2(("ossaDeviceHandleRemovedEvent: start\n"));
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleRemovedEvent: Wrong! oneDeviceData is NULL\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yg");
+ return;
+ }
+ TI_DBG2(("ossaDeviceHandleRemovedEvent: did %d\n", oneDeviceData->id));
+ oneDeviceData->registered = agFALSE;
+ onePortContext = (tdsaPortContext_t *)agPortContext->osData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("ossaDeviceHandleRemovedEvent: Wrong! onePortContext is NULL\n"));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "Yg");
+ return;
+ }
+ TI_DBG2(("ossaDeviceHandleRemovedEvent: pid %d\n", onePortContext->id));
+ onePortContext->RegisteredDevNums--;
+#ifdef NOT_YET
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceRemoval,
+ agNULL
+ );
+#endif
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "Yg");
+ return;
+}
+
+#ifdef SPC_ENABLE_PROFILE
+/*****************************************************************************/
+/*! \brief ossaFwProfileCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saFwProfile()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saFwProfile()
+ * \param status: status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaFwProfileCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 len)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG2(("ossaFwProfileCB: start\n"));
+
+ switch (status)
+ {
+ case AGSA_RC_SUCCESS:
+ {
+ TI_DBG2(("ossaFwProfileCB: SUCCESS\n"));
+ break;
+ }
+ case AGSA_RC_FAILURE:
+ {
+ TI_DBG1(("ossaFwProfileCB: FAIL\n"));
+ break;
+ }
+ default:
+ {
+ TI_DBG1(("ossaFwProfileCB: !!! default, status %d\n", status));
+ break;
+ }
+ }
+
+ ostiFWProfileIOCTLRsp(tiRoot, status, len);
+ return;
+}
+#endif
+/*****************************************************************************/
+/*! \brief ossaFwFlashUpdateCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saFwFlashUpdate()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saFwFlashUpdate()
+ * \param status: status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaFwFlashUpdateCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG2(("ossaFwFlashUpdateCB: start\n"));
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yh");
+ switch (status)
+ {
+ case OSSA_FLASH_UPDATE_COMPLETE_PENDING_REBOOT:
+ {
+ TI_DBG2(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_COMPLETE_PENDING_REBOOT\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_IN_PROGRESS:
+ {
+ TI_DBG2(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_IN_PROGRESS\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_HDR_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_HDR_ERR\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_OFFSET_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_OFFSET_ERR\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_CRC_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_CRC_ERR\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_LENGTH_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_LENGTH_ERR\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_HW_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_HW_ERR\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_DNLD_NOT_SUPPORTED:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_DNLD_NOT_SUPPORTED\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_DISABLED:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_DISABLED\n"));
+ break;
+ }
+ case OSSA_FLASH_FWDNLD_DEVICE_UNSUPPORT:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_FWDNLD_DEVICE_UNSUPPORT\n"));
+ break;
+ }
+ case OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE\n"));
+ break;
+ }
+ case OSSA_FLASH_UPDATE_HMAC_ERR:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: OSSA_FLASH_UPDATE_HMAC_ERR\n"));
+ break;
+ }
+
+ default:
+ {
+ TI_DBG1(("ossaFwFlashUpdateCB: !!! default, status 0x%X\n", status));
+ break;
+ }
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yh");
+ ostiCOMMgntIOCTLRsp(tiRoot, status);
+ return;
+
+}
+
+
+GLOBAL void ossaFlashExtExecuteCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 command,
+ agsaFlashExtResponse_t *agFlashExtRsp)
+{
+ TI_DBG1(("ossaFlashExtExecuteCB: command 0x%X status 0x%X\n",command, status));
+
+}
+
+
+
+/*****************************************************************************/
+/*! \brief ossaGetNVMDResponseCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGetNVMDCommand()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saGetVPDCommand()
+ * \param status: status
+ * \param indirectPayload: The value passed in agsaNVMDData_t when
+ * calling saGetNVMDCommand()
+ * \param agInfoLen: the length of VPD information
+ * \param agFrameHandle: handler of VPD information
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGetNVMDResponseCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit8 indirectPayload,
+ bit32 agInfoLen,
+ agsaFrameHandle_t agFrameHandle
+)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ TI_DBG2(("ossaGetNVMDResponseCB: start\n"));
+ TI_DBG2(("ossaGetNVMDResponseCB: agInfoLen %d\n", agInfoLen));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yi");
+
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaGetNVMDResponseCB: Success status\n"));
+ if (indirectPayload == 0 && agInfoLen != 0)
+ {
+ TI_DBG2(("ossaGetNVMDResponseCB: direct\n"));
+ tdhexdump("ossaGetNVMDResponseCB", (bit8 *)agFrameHandle, agInfoLen);
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaGetNVMDResponseCB: Status 0x%x\n", status));
+ }
+
+ if (indirectPayload == 0)
+ {
+ TI_DBG2(("ossaGetNVMDResponseCB: direct\n"));
+ }
+ else
+ {
+ TI_DBG2(("ossaGetNVMDResponseCB: indirect\n"));
+ }
+
+ ostiGetNVMDIOCTLRsp(tiRoot, status);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yi");
+ return;
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSetNVMDResponseCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saSetNVMDCommand()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saSetVPDCommand()
+ * \param status: status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSetNVMDResponseCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ TI_DBG2(("ossaSetNVMDResponseCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yj");
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaSetNVMDResponseCB: success\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaSetNVMDResponseCB: fail or undefined staus %d\n", status));
+ }
+ ostiSetNVMDIOCTLRsp(tiRoot, status);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yj");
+ return;
+}
+
+
+#ifdef REMOVED
+/*****************************************************************************/
+/*! \brief ossaGetVPDResponseCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGetVPDCommand()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saGetVPDCommand()
+ * \param status: status
+ * \param agInfoLen: the length of VPD information
+ * \param agFrameHandle:handler of VPD information
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGetVPDResponseCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit8 indirectMode,
+ bit32 agInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ )
+{
+ bit8 VPDData[48];
+
+ TI_DBG2(("ossaGetVPDResponseCB: start\n"));
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yk");
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaGetVPDResponseCB: agInfoLen %d\n", agInfoLen));
+ osti_memset(VPDData, 0, 48);
+ /* We can read only in case of Direct */
+ saFrameReadBlock(agRoot, agFrameHandle, 0, VPDData, agInfoLen);
+ tdhexdump("ossaGetVPDResponseCB", (bit8 *)VPDData, agInfoLen);
+ /*
+ callback osti....
+ */
+ }
+ else
+ {
+ TI_DBG1(("ossaGetVPDResponseCB: fail or undefined staus %d\n", status));
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yk");
+ return;
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSetVPDResponseCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saSetVPDCommand()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saSetVPDCommand()
+ * \param status: status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSetVPDResponseCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG2(("ossaSetVPDResponseCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yl");
+
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaSetVPDResponseCB: success\n"));
+ ostiCOMMgntVPDSetIOCTLRsp(tiRoot, 0);
+ /*
+ callback osti.....
+ */
+
+#ifdef VPD_TESTING
+ /* temporary to test saSetVPDCommand() and saGetVPDCommand */
+ tdsaVPDGet(tiRoot);
+#endif
+
+ }
+ else
+ {
+ TI_DBG1(("ossaSetVPDResponseCB: fail or undefined staus %d\n", status));
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yl");
+ return;
+}
+#endif
+
+/*****************************************************************************/
+/*! \brief ossaEchoCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saEchoCommand()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * into saEchoCommand()
+ * \param echoPayload: Pointer to the echo payload
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaEchoCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ void *echoPayload
+ )
+{
+#ifdef ECHO_TESTING
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ bit8 payload[56];
+#endif
+
+ TI_DBG2(("ossaEchoCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Ym");
+
+ /* dumping received echo payload is 56 bytes */
+ tdhexdump("ossaEchoCB: echoPayload", (bit8 *)(echoPayload), 56);
+
+#ifdef ECHO_TESTING
+ /* temporary to test saEchoCommand() */
+
+ /* new echo payload */
+ osti_memset(payload,0, sizeof(payload));
+
+ payload[0] = gEcho;
+ payload[55] = gEcho;
+
+ TI_DBG2(("ossaEchoCB: gEcho %d\n", gEcho));
+
+ saEchoCommand(agRoot, agNULL, tdsaRotateQnumber(tiRoot, agNULL), (void *)&payload);
+
+ if (gEcho == 0xFF)
+ {
+ gEcho = 0;
+ }
+ else
+ {
+ gEcho++;
+ }
+#endif
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Ym");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGpioResponseCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGpioEventSetup(), saGpioPinSetup(), saGpioRead(), or
+ * saGpioWrite()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in.
+ * \param status: GPIO operation completion status
+ * \param gpioReadValue: a bit map containing the corresponding
+ * value for each GPIO pin.
+ * \param gpioPinSetupInfo: Pointer to agsaGpioPinSetupInfo_t structure
+ * describing the GPIO pin setup
+ * \param gpioEventSetupInfo Pointer to agsaGpioEventSetupInfo_t structure
+ * describing the GPIO event setups
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGpioResponseCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 gpioReadValue,
+ agsaGpioPinSetupInfo_t *gpioPinSetupInfo,
+ agsaGpioEventSetupInfo_t *gpioEventSetupInfo
+ )
+{
+ TI_DBG2(("ossaGpioResponseCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yn");
+ if (status == OSSA_SUCCESS)
+ {
+ TI_DBG2(("ossaGpioResponseCB: Success\n"));
+ /* printing gpioReadValue, agsaGpioPinSetupInfo_t and agsaGpioEventSetupInfo_t */
+ TI_DBG2(("ossaGpioResponseCB: gpioReadValue 0x%x\n", gpioReadValue));
+ TI_DBG2(("ossaGpioResponseCB: PinSetupInfo gpioInputEnabled 0x%x\n", gpioPinSetupInfo->gpioInputEnabled));
+ TI_DBG2(("ossaGpioResponseCB: PinSetupInfo gpioTypePart1 0x%x\n", gpioPinSetupInfo->gpioTypePart1));
+ TI_DBG2(("ossaGpioResponseCB: PinSetupInfo gpioTypePart2 0x%x\n", gpioPinSetupInfo->gpioTypePart2));
+ TI_DBG2(("ossaGpioResponseCB: EventSetupInfo gpioEventLevel 0x%x\n", gpioEventSetupInfo->gpioEventLevel));
+ TI_DBG2(("ossaGpioResponseCB: EventSetupInfo gpioEventRisingEdge 0x%x\n", gpioEventSetupInfo->gpioEventRisingEdge));
+ TI_DBG2(("ossaGpioResponseCB: EventSetupInfo gpioEventFallingEdge 0x%x\n", gpioEventSetupInfo->gpioEventFallingEdge));
+ }
+ else
+ {
+ TI_DBG1(("ossaGpioResponseCB: Failure\n"));
+ }
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yn");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGpioEvent
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGpioEventSetup(), saGpioPinSetup(), saGpioRead(), or
+ * saGpioWrite()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param gpioEvent: a bit map that indicates which GPIO
+ * input pins have generated the event.
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaGpioEvent(
+ agsaRoot_t *agRoot,
+ bit32 gpioEvent
+ )
+{
+ TI_DBG2(("ossaGpioEvent: start\n"));
+ TI_DBG2(("ossaGpioEvent: gpioEvent 0x%x\n", gpioEvent));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yo");
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yo");
+ return;
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSASDiagExecuteCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saSASDiagExecute()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in.
+ * \param status: Diagnostic operation completion status
+ * \param command: SAS diagnostic command field in agsaSASDiagExecute_t
+ * structure passed in saSASDiagExecute().
+ * \param reportData: Report Diagnostic Data
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSASDiagExecuteCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 command,
+ bit32 reportData)
+{
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yq");
+ TI_DBG2(("ossaSASDiagExecuteCB: start\n"));
+ TI_DBG2(("ossaSASDiagExecuteCB: status %d\n", status));
+ TI_DBG2(("ossaSASDiagExecuteCB: command %d\n", command));
+ TI_DBG2(("ossaSASDiagExecuteCB: reportData %d\n", reportData));
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yq");
+ return;
+
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSASDiagStartEndCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saSASDiagExecute()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in.
+ * \param status: Diagnostic operation completion status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaSASDiagStartEndCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status)
+{
+ TI_DBG2(("ossaSASDiagStartEndCB: start\n"));
+ TI_DBG2(("ossaSASDiagStartEndCB: status %d\n", status));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yr");
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yr");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaReconfigSASParamsCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saReconfigSASParams()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in saReconfigSASParams().
+ * \param status: saReconfigSASParams() completion status
+ * \param agSASConfig: Pointer to the data structure agsaSASReconfig_t
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void ossaReconfigSASParamsCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaSASReconfig_t *agSASConfig)
+{
+ TI_DBG2(("ossaReconfigSASParamsCB: status %d\n", status));
+ return;
+}
+
+GLOBAL void ossaPCIeDiagExecuteCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 command,
+ agsaPCIeDiagResponse_t *resp )
+{
+ TI_DBG2(("ossaPCIeDiagExecuteCB: status %d\n", status));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: ERR_BLKH 0x%X\n",resp->ERR_BLKH ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: ERR_BLKL 0x%X\n",resp->ERR_BLKL ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: DWord8 0x%X\n",resp->DWord8 ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: DWord9 0x%X\n",resp->DWord9 ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: DWord10 0x%X\n",resp->DWord10 ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: DWord11 0x%X\n",resp->DWord11 ));
+ TI_DBG2(("ossaPCIeDiagExecuteCB: DIF_ERR 0x%X\n",resp->DIF_ERR ));
+
+ return;
+}
+
+
+#ifndef BIOS
+GLOBAL void ossaSGpioCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaSGpioReqResponse_t *pSgpioResponse
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG2(("ossaSGpioCB: smpFrameType: 0x%02x \n", pSgpioResponse->smpFrameType));
+ // printf("SS:ossaSGpioCB: smpFrameType: 0x%02x \n", pSgpioResponse->smpFrameType);
+ TI_DBG2(("ossaSGpioCB: function: 0x%02x \n", pSgpioResponse->function));
+ TI_DBG2(("ossaSGpioCB: functionResult: 0x%02x \n", pSgpioResponse->functionResult));
+ //printf("SS:ossaSGpioCB: functionResult: 0x%02x \n", pSgpioResponse->functionResult);
+
+ tdhexdump("ossaSGpioCB Response", (bit8 *)pSgpioResponse, sizeof(agsaSGpioReqResponse_t));
+ ostiSgpioIoctlRsp(tiRoot, pSgpioResponse);
+}
+
+#endif /* BIOS */
+
+/*****************************************************************************/
+/*! \brief ossaLogDebugString
+ *
+ *
+ * Purpose: This routine is called by lower layer to log.
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param level: Detail of information desired.
+ * \param string: Pointer to the character string.
+ * \param ptr1: First pointer value.
+ * \param ptr2: Second pointer value.
+ * \param value1: First 32-bit value related to the specific information.
+ * \param value2: Second 32-bit value related to the specific information.
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaLogDebugString(
+ agsaRoot_t *agRoot,
+ bit32 level,
+ char *string,
+ void *ptr1,
+ void *ptr2,
+ bit32 value1,
+ bit32 value2
+ )
+{
+#if defined(SALLSDK_DEBUG)
+ TIDEBUG_MSG(gLLDebugLevel, level, ("%s %p %p %d %d\n", string, ptr1, ptr2, value1, value2));
+#endif
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaHwEventAckCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saHwEventAck(()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in.
+ * \param status: Status
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaHwEventAckCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status
+ )
+{
+ TI_DBG3(("ossaHwEventAckCB: start\n"));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Ys");
+ if (status == tiSuccess)
+ {
+ TI_DBG3(("ossaHwEventAckCB: SUCCESS status\n"));
+ }
+ else
+ {
+ TI_DBG1(("ossaHwEventAckCB: FAIL status 0x%X\n", status));
+ TI_DBG1(("ossaHwEventAckCB: invalid event status bit0 %d\n", status & 0x01));
+ TI_DBG1(("ossaHwEventAckCB: invalid phyid status bit1 %d\n", (status & 0x02) >> 1 ));
+ TI_DBG1(("ossaHwEventAckCB: invalid portcontext status bit2 %d\n", (status & 0x04) >> 2));
+ TI_DBG1(("ossaHwEventAckCB: invalid param0 status bit3 %d\n", (status & 0x08) >> 3));
+ }
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Ys");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGetTimeStampCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saGetTimeStamp()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally passed
+ * in.
+ * \param timeStampLower: The controller lower 32-bit of internal time
+ * stamp associated with event log.
+ * \param timeStampUpper: The controller upper 32-bit of internal time
+ * stamp associated with event log.
+ *
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaGetTimeStampCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 timeStampLower,
+ bit32 timeStampUpper
+ )
+{
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yt");
+ TI_DBG4(("ossaGetTimeStampCB: start\n"));
+ TI_DBG4(("ossaGetTimeStampCB: timeStampUpper 0x%x timeStampLower 0x%x\n", timeStampUpper, timeStampLower));
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yt");
+ return;
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaSMPAbortCB
+ *
+ *
+ * Purpose: This routine is called by lower layer to corresponding to
+ * saSMPAbort()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agIORequest: This is the agIORequest parameter passed in
+ * saSMPAbort()
+ * \param status: Status of abort
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaSMPAbortCB(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 flag,
+ bit32 status)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdIORequestBody_t *tdAbortIORequestBody = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tiDeviceHandle_t *tiDeviceHandle = agNULL;
+
+ TI_DBG4(("ossaSMPAbortCB: start\n"));
+ TI_DBG4(("ossaSMPAbortCB: flag %d\n", flag));
+ TI_DBG4(("ossaSMPAbortCB: status %d\n", status));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yu");
+
+ tdAbortIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ if (tdAbortIORequestBody == agNULL)
+ {
+ TI_DBG1(("ossaSMPAbortCB: tdAbortIORequestBody is NULL warning!!!!\n"));
+ return;
+ }
+
+ if (flag == 2)
+ {
+ /* abort per port */
+ TI_DBG2(("ossaSMPAbortCB: abort per port\n"));
+ }
+ else if (flag == 1)
+ {
+ TI_DBG2(("ossaSMPAbortCB: abort all\n"));
+
+ tiDeviceHandle = (tiDeviceHandle_t *)tdAbortIORequestBody->tiDevHandle;
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("ossaSMPAbortCB: tiDeviceHandle is NULL warning!!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaSMPAbortCB: oneDeviceData is NULL warning!!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSMPAbortCB: OSSA_IO_SUCCESS\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG3(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG2(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_NOT_VALID\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG1(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_NO_DEVICE\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG1(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG1(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG1(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSMPAbortCB: other status %d\n", status));
+ /* clean up TD layer's IORequestBody */
+ TI_DBG1(("ossaSMPAbortCB: calling saDeregisterDeviceHandle\n"));
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ TI_DBG1(("ossaSMPAbortCB: did %d\n", oneDeviceData->id));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else if (flag == 0)
+ {
+ TI_DBG2(("ossaSMPAbortCB: abort one\n"));
+ if (status == OSSA_IO_SUCCESS)
+ {
+ TI_DBG2(("ossaSMPAbortCB: OSSA_IO_SUCCESS\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if (status == OSSA_IO_NOT_VALID)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_NOT_VALID\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_NO_DEVICE)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_NO_DEVICE\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ else if (status == OSSA_IO_ABORT_IN_PROGRESS)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_ABORT_IN_PROGRESS\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#ifdef REMOVED
+ else if (status == OSSA_IO_ABORT_DELAYED)
+ {
+ TI_DBG1(("ossaSMPAbortCB: OSSA_IO_ABORT_DELAYED\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+#endif
+ else
+ {
+ TI_DBG1(("ossaSMPAbortCB: other status %d\n", status));
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ }
+ else
+ {
+ TI_DBG1(("ossaSMPAbortCB: wrong flag %d\n", flag));
+ }
+
+
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yu");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGeneralEvent
+ *
+ *
+ * Purpose: This is the event notification for debugging purposes sent to
+ * inform the OS layer of some general error related to a specific
+ * inbound operation.
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param status: Status associated with this event
+ * \param msg: Pointer to controller specific command
+ * massage that caused the error
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaGeneralEvent(
+ agsaRoot_t *agRoot,
+ bit32 status,
+ agsaContext_t *agContext,
+ bit32 *msg)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG1(("ossaGeneralEvent: start\n"));
+ TI_DBG1(("ossaGeneralEvent: status %d\n", status));
+
+ if(msg)
+ {
+ TI_DBG1(("ossaGeneralEvent: *msg %X\n", *msg));
+ }
+
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yv");
+ ostiGenEventIOCTLRsp(tiRoot, status);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yv");
+ return;
+}
+
+GLOBAL void ossaGetForensicDataCB (
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaForensicData_t *forensicData)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ ostiGetForensicDataIOCTLRsp(tiRoot, status, forensicData);
+ return;
+}
+
+
+#ifdef INITIATOR_DRIVER
+
+GLOBAL void ossaGetIOErrorStatsCB (
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaIOErrorEventStats_t *stats)
+
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ ostiGetIoErrorStatsIOCTLRsp(tiRoot, status, stats);
+}
+#else
+GLOBAL void ossaGetIOErrorStatsCB (
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaIOErrorEventStats_t *stats)
+
+{
+
+}
+
+#endif
+
+GLOBAL void ossaGetIOEventStatsCB (
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaIOErrorEventStats_t *stats)
+
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ ostiGetIoEventStatsIOCTLRsp(tiRoot, status, stats);
+}
+
+
+/*****************************************************************************/
+/*! \brief ossaGetRegisterDumpCB
+ *
+ *
+ * Purpose: ossaGetRegisterDumpCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saGetRegisterDump()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saGetRegisterDump()
+ * \param status: status
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaGetRegisterDumpCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status
+)
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+
+ TI_DBG4(("ossaGetRegisterDumpCB: start\n"));
+ TI_DBG4(("ossaGetRegisterDumpCB: status %d\n", status));
+ smTraceFuncEnter(hpDBG_VERY_LOUD,"Yw");
+
+ ostiRegDumpIOCTLRsp(tiRoot, status);
+ smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "Yw");
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaSetDeviceStateCB
+ *
+ *
+ * Purpose: ossaSetDeviceStateCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saSetDeviceState()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saGetRegisterDump()
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param status: status
+ * \param newDeviceState: newly set device status
+ * \param previousDeviceState: old device status
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaSetDeviceStateCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ bit32 newDeviceState,
+ bit32 previousDeviceState
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+
+ TI_DBG2(("ossaSetDeviceStateCB: start\n"));
+ TI_DBG2(("ossaSetDeviceStateCB: status %d\n", status));
+ TI_DBG2(("ossaSetDeviceStateCB: newDeviceState %d\n", newDeviceState));
+ TI_DBG2(("ossaSetDeviceStateCB: previousDeviceState %d\n", previousDeviceState));
+
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG4(("ossaSetDeviceStateCB: agDevHandle is NULL\n"));
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaSetDeviceStateCB: wrong; oneDeviceData is NULL\n"));
+ }
+ else
+ {
+ TI_DBG2(("ossaSetDeviceStateCB: did %d\n", oneDeviceData->id));
+ }
+
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGetDeviceStateCB
+ *
+ *
+ * Purpose: ossaGetDeviceStateCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saGetDeviceState()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saGetRegisterDump()
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param status: status
+ * \param deviceState: device status
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaGetDeviceStateCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ bit32 deviceState
+ )
+{
+ TI_DBG4(("ossaGetDeviceStateCB: start\n"));
+ TI_DBG4(("ossaGetDeviceStateCB: status %d\n", status));
+ TI_DBG4(("ossaGetDeviceStateCB: deviceState %d\n", deviceState));
+
+ return;
+}
+
+#ifdef INITIATOR_DRIVER
+/*****************************************************************************/
+/*! \brief ossaIniSetDeviceInfoCB
+ *
+ *
+ * Purpose: ossaIniSetDeviceInfoCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saSetDeviceInfo()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saSetDeviceInfo()
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param status: status
+ * \param option: option parameter passed in saSetDeviceInfo()
+ * \param param: param parameter passed in saSetDeviceInfo()
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+osGLOBAL void
+ossaIniSetDeviceInfoCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ bit32 option,
+ bit32 param
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ itdsaIni_t *Initiator = (itdsaIni_t *)tdsaAllShared->itdsaIni;
+ bit32 intContext = osData->IntContext;
+ tdIORequestBody_t *tdIORequestBody = agNULL;
+ agsaIORequest_t *agIORequest = agNULL;
+ bit32 saStatus = AGSA_RC_FAILURE;
+ bit8 devType_S_Rate;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+
+ TI_DBG4(("ossaIniSetDeviceInfoCB: start\n"));
+ TI_DBG4(("ossaIniSetDeviceInfoCB: status 0x%x\n", status));
+ TI_DBG4(("ossaIniSetDeviceInfoCB: option 0x%x\n", option));
+ TI_DBG4(("ossaIniSetDeviceInfoCB: param 0x%x\n", param));
+
+ if (status != OSSA_SUCCESS)
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: status %d\n", status));
+ TI_DBG1(("ossaIniSetDeviceInfoCB: option 0x%x\n", option));
+ TI_DBG1(("ossaIniSetDeviceInfoCB: param 0x%x\n", param));
+ if (option == 32) /* set connection rate */
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: IO failure\n"));
+ agIORequest = (agsaIORequest_t *)agContext->osData;
+ tdIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ ostiInitiatorIOCompleted(
+ tiRoot,
+ tdIORequestBody->tiIORequest,
+ tiIOFailed,
+ tiDetailOtherError,
+ agNULL,
+ intContext
+ );
+ }
+ }
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG4(("ossaIniSetDeviceInfoCB: agDevHandle is NULL\n"));
+ return;
+ }
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: wrong; oneDeviceData is NULL\n"));
+ return;
+ }
+ else
+ {
+ TI_DBG4(("ossaIniSetDeviceInfoCB: did %d\n", oneDeviceData->id));
+ }
+
+ /* retry IOs */
+ if (option == 32) /* set connection rate */
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: set connection rate option\n"));
+ agIORequest = (agsaIORequest_t *)agContext->osData;
+ tdIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ devType_S_Rate = oneDeviceData->agDeviceInfo.devType_S_Rate;
+ devType_S_Rate = (devType_S_Rate & 0xF0) | (param >> 28);
+ oneDeviceData->agDeviceInfo.devType_S_Rate = devType_S_Rate;
+ TI_DBG1(("ossaIniSetDeviceInfoCB: new rate is 0x%x\n", DEVINFO_GET_LINKRATE(&oneDeviceData->agDeviceInfo)));
+ if (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE &&
+ oneDeviceData->tdPortContext != agNULL )
+ {
+ saStatus = saSSPStart(agRoot,
+ agIORequest,
+ tdsaRotateQnumber(tiRoot, oneDeviceData),
+ agDevHandle,
+ tdIORequestBody->agRequestType,
+ &(tdIORequestBody->transport.SAS.agSASRequestBody),
+ agNULL,
+ &ossaSSPCompleted);
+ if (saStatus == AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: retried\n"));
+ Initiator->NumIOsActive++;
+ tdIORequestBody->ioStarted = agTRUE;
+ tdIORequestBody->ioCompleted = agFALSE;
+ return;
+ }
+ else
+ {
+ TI_DBG1(("ossaIniSetDeviceInfoCB: retry failed\n"));
+ tdIORequestBody->ioStarted = agFALSE;
+ tdIORequestBody->ioCompleted = agTRUE;
+ ostiInitiatorIOCompleted(
+ tiRoot,
+ tdIORequestBody->tiIORequest,
+ tiIOFailed,
+ tiDetailOtherError,
+ agNULL,
+ intContext
+ );
+ }
+ }
+ }
+ return;
+}
+#endif
+/*****************************************************************************/
+/*! \brief ossaSetDeviceInfoCB
+ *
+ *
+ * Purpose: ossaSetDeviceInfoCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saSetDeviceInfo()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saSetDeviceInfo()
+ * \param agDevHandle Pointer to the device handle of the device
+ * \param status: status
+ * \param option: option parameter passed in saSetDeviceInfo()
+ * \param param: param parameter passed in saSetDeviceInfo()
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaSetDeviceInfoCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ bit32 option,
+ bit32 param
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+
+ TI_DBG4(("ossaSetDeviceInfoCB: start\n"));
+ TI_DBG4(("ossaSetDeviceInfoCB: status 0x%x\n", status));
+ TI_DBG4(("ossaSetDeviceInfoCB: option 0x%x\n", option));
+ TI_DBG4(("ossaSetDeviceInfoCB: param 0x%x\n", param));
+
+ if (status != OSSA_SUCCESS)
+ {
+ TI_DBG1(("ossaSetDeviceInfoCB: status %d\n", status));
+ TI_DBG1(("ossaSetDeviceInfoCB: option 0x%x\n", option));
+ TI_DBG1(("ossaSetDeviceInfoCB: param 0x%x\n", param));
+ }
+
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG4(("ossaSetDeviceInfoCB: agDevHandle is NULL\n"));
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("ossaSetDeviceInfoCB: wrong; oneDeviceData is NULL\n"));
+ }
+ else
+ {
+ TI_DBG4(("ossaSetDeviceInfoCB: did %d\n", oneDeviceData->id));
+ }
+
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaGetDFEDataCB
+ *
+ *
+ * Purpose: ossaGetDFEDataCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saGetDFEData()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into saGetDFEData()
+ * \param status: status
+ * \param agInfoLen: length in bytes of DFE data captured and transferred
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+GLOBAL void ossaGetDFEDataCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 agInfoLen)
+{
+ TI_DBG1(("ossaGetDFEDataCB: start\n"));
+ TI_DBG1(("ossaGetDFEDataCB: status 0x%x agInfoLen 0x%x\n", status, agInfoLen));
+ return;
+}
+
+/*****************************************************************************/
+/*! \brief ossaVhistCaptureCB
+ *
+ *
+ * Purpose: ossaVhistCaptureCB() is the response callback function
+ * called by the LL Layer to indicate a response to
+ * saGetDFEData()
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param agContext: Context of the operation originally
+ * passed into ()
+ * \param status: status
+ * \param len: length in bytes of Vis data captured and transferred
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+
+void ossaVhistCaptureCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 len)
+{
+ TI_DBG1(("ossaVhistCaptureCB: start\n"));
+ TI_DBG1(("ossaVhistCaptureCB: status 0x%x agInfoLen 0x%x\n", status,len ));
+ return;
+}
+
+GLOBAL void ossaOperatorManagementCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 eq
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tiEncryptPort_t encryptEventData;
+
+ TI_DBG1(("ossaOperatorManagementCB: status 0x%x eq 0x%x\n", status, eq));
+
+ osti_memset(&encryptEventData, 0, sizeof(tiEncryptPort_t));
+ encryptEventData.encryptEvent = tiEncryptOperatorManagement;
+ encryptEventData.subEvent = eq;
+ encryptEventData.pData = agNULL;
+
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ status,
+ &encryptEventData);
+}
+
+GLOBAL void ossaEncryptSelftestExecuteCB (
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 type,
+ bit32 length,
+ void *TestResult
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tiEncryptPort_t encryptEventData;
+
+ TI_DBG1(("ossaEncryptSelftestExecuteCB: status 0x%x type 0x%x length 0x%x\n", status, type, length));
+
+ osti_memset(&encryptEventData, 0, sizeof(tiEncryptPort_t));
+ encryptEventData.encryptEvent = tiEncryptSelfTest;
+ encryptEventData.subEvent = type;
+ encryptEventData.pData = (void*)TestResult;
+
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ status,
+ &encryptEventData);
+}
+
+GLOBAL void ossaGetOperatorCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 option,
+ bit32 num,
+ bit32 role,
+ agsaID_t *id
+ )
+{
+
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tiEncryptPort_t encryptEventData;
+
+ TI_DBG1(("ossaGetOperatorCB: status 0x%x option 0x%x num 0x%x role 0x%x\n",
+ status, option, num, role));
+ TI_DBG1(("ossaGetOperatorCB: agContext %p id %p\n",agContext,id));
+ osti_memset(&encryptEventData, 0, sizeof(tiEncryptPort_t));
+ encryptEventData.encryptEvent = tiEncryptGetOperator;
+ encryptEventData.subEvent = option;
+ encryptEventData.pData = agNULL;
+
+ switch(status)
+ {
+ case OSSA_IO_SUCCESS:
+ TI_DBG1(("ossaGetOperatorCB: OSSA_IO_SUCCESS option 0x%x\n", option));
+ if(option == 1)
+ {
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[0], id->ID[1], id->ID[2], id->ID[3]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[4], id->ID[5], id->ID[6], id->ID[7]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[8], id->ID[9], id->ID[10],id->ID[11]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[12],id->ID[13],id->ID[14],id->ID[15]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[16],id->ID[17],id->ID[18],id->ID[19]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[20],id->ID[21],id->ID[22],id->ID[23]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x 0x%02x\n",id->ID[24],id->ID[25],id->ID[26],id->ID[27]));
+ TI_DBG2(("ossaGetOperatorCB: 0x%02x 0x%02x 0x%02x\n", id->ID[28],id->ID[29],id->ID[30]));
+ }else if(option == 2)
+ {
+ TI_DBG1(("ossaGetOperatorCB: number operators 0x%02x\n", num ));
+ }
+
+ encryptEventData.pData = id;
+ break;
+ case OSSA_MPI_ENC_ERR_UNSUPPORTED_OPTION:
+ TI_DBG1(("ossaGetOperatorCB: OSSA_MPI_ENC_ERR_UNSUPPORTED_OPTION 0x%x\n",option));
+ break;
+ case OSSA_MPI_ENC_ERR_ID_TRANSFER_FAILURE:
+ TI_DBG1(("ossaGetOperatorCB: OSSA_MPI_ENC_ERR_ID_TRANSFER_FAILURE 0x%x\n",option));
+ break;
+ default:
+ TI_DBG1(("ossaGetOperatorCB: Unknown status 0x%x\n",status));
+ }
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ status,
+ &encryptEventData);
+
+}
+
+GLOBAL void ossaSetOperatorCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ bit32 eq
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tiEncryptPort_t encryptEventData;
+
+ TI_DBG1(("ossaSetOperatorCB: agContext %p status 0x%x eq 0x%x\n",agContext, status, eq));
+
+ osti_memset(&encryptEventData, 0, sizeof(tiEncryptPort_t));
+ encryptEventData.encryptEvent = tiEncryptSetOperator;
+ encryptEventData.subEvent = 0;
+ switch(status)
+ {
+ case OSSA_IO_SUCCESS:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_IO_SUCCESS\n"));
+ encryptEventData.pData = agNULL;
+ break;
+ case OSSA_MPI_ENC_ERR_CONTROLLER_NOT_IDLE:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_ERR_CONTROLLER_NOT_IDLE\n"));
+ break;
+ case OSSA_MPI_ENC_OPERATOR_AUTH_FAILURE:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_OPERATOR_AUTH_FAILURE error qualifier 0x%x\n",eq));
+ break;
+ case OSSA_MPI_ENC_OPERATOR_OPERATOR_ALREADY_LOGGED_IN:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_OPERATOR_OPERATOR_ALREADY_LOGGED_IN\n"));
+ break;
+ case OSSA_MPI_ENC_OPERATOR_ILLEGAL_PARAMETER:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_OPERATOR_ILLEGAL_PARAMETER\n"));
+ break;
+ case OSSA_MPI_ENC_ERR_UNSUPPORTED_OPTION:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_ERR_UNSUPPORTED_OPTION\n"));
+ break;
+ case OSSA_MPI_ENC_ERR_ID_TRANSFER_FAILURE:
+ TI_DBG1(("ossaSetOperatorCB: OSSA_MPI_ENC_ERR_ID_TRANSFER_FAILURE\n"));
+ break;
+ default:
+ TI_DBG1(("ossaGetOperatorCB: Unknown status 0x%x\n",status));
+ }
+ ostiPortEvent(tiRoot,
+ tiEncryptOperation,
+ status,
+ &encryptEventData);
+}
+
+GLOBAL void ossaDIFEncryptionOffloadStartCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaOffloadDifDetails_t *agsaOffloadDifDetails)
+{
+ TI_DBG1(("ossaDIFEncryptionOffloadStartCB: start\n"));
+ TI_DBG1(("ossaDIFEncryptionOffloadStartCB: status 0x%x agsaOffloadDifDetails=%p\n", status, agsaOffloadDifDetails));
+ return;
+}
+
+GLOBAL bit32 ossaTimeStamp( agsaRoot_t *agRoot )
+{
+ tdsaRootOsData_t *osData= agNULL;
+ tiRoot_t *tiRoot= agNULL;
+ if(agRoot)
+ {
+ osData = (tdsaRootOsData_t *)agRoot->osData;
+ }
+ if(osData)
+ {
+ tiRoot = (tiRoot_t *)osData->tiRoot;
+ }
+ return(ostiTimeStamp(tiRoot));
+}
+
+GLOBAL bit64 ossaTimeStamp64( agsaRoot_t *agRoot)
+{
+ tdsaRootOsData_t *osData= agNULL;
+ tiRoot_t *tiRoot= agNULL;
+ if(agRoot)
+ {
+ osData = (tdsaRootOsData_t *)agRoot->osData;
+ }
+ if(osData)
+ {
+ tiRoot = (tiRoot_t *)osData->tiRoot;
+ }
+ return(ostiTimeStamp64(tiRoot));
+}
+
+#ifdef FDS_SM
+osGLOBAL void
+tdIDStartTimer(tiRoot_t *tiRoot,
+ smIORequest_t *smIORequest,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ itdsaIni_t *Initiator = (itdsaIni_t *)tdsaAllShared->itdsaIni;
+
+ TI_DBG1(("tdIDStartTimer: start\n"));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ if (oneDeviceData->tdIDTimer.timerRunning == agTRUE)
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ tdsaKillTimer(
+ tiRoot,
+ &oneDeviceData->tdIDTimer
+ );
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ }
+
+ tdsaSetTimerRequest(
+ tiRoot,
+ &oneDeviceData->tdIDTimer,
+ SATA_ID_DEVICE_DATA_TIMER_VALUE/Initiator->OperatingOption.UsecsPerTick,
+ tdIDStartTimerCB,
+ smIORequest,
+ oneDeviceData,
+ agNULL
+ );
+
+ tdsaAddTimer(
+ tiRoot,
+ &Initiator->timerlist,
+ &oneDeviceData->tdIDTimer
+ );
+ TI_DBG1(("tdIDStartTimer: end\n"));
+ return;
+}
+
+osGLOBAL void
+tdIDStartTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ smIORequest_t *smIORequest;
+ tdsaDeviceData_t *oneDeviceData;
+ smRoot_t *smRoot;
+ tdIORequestBody_t *tdIORequestBody;
+ smDeviceHandle_t *smDeviceHandle;
+ tdsaPortContext_t *onePortContext;
+#ifdef REMOVED
+ agsaRoot_t *agRoot;
+ bit32 IDstatus;
+//#endif
+//#ifdef REMOVED
+ agsaIORequest_t *agAbortIORequest = agNULL;
+ tdIORequestBody_t *tdAbortIORequestBody = agNULL;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+#endif // REMOVED
+#ifdef TD_DEBUG_ENABLE
+ bit32 status = AGSA_RC_FAILURE;
+#endif
+
+ TI_DBG1(("tdIDStartTimerCB start\n"));
+ smIORequest = (smIORequest_t *)timerData1;
+ oneDeviceData = (tdsaDeviceData_t *)timerData2;
+ smRoot = &(tdsaAllShared->smRoot);
+#ifdef REMOVED
+ agRoot = oneDeviceData->agRoot;
+#endif // REMOVED
+
+ if (smIORequest == agNULL)
+ {
+ TI_DBG1(("tdIDStartTimerCB: smIORequest == agNULL !!!!!!\n"));
+ return;
+ }
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdIDStartTimerCB: oneDeviceData == agNULL !!!!!!\n"));
+ return;
+ }
+
+ if (oneDeviceData->satDevData.IDPending == agFALSE || oneDeviceData->satDevData.IDDeviceValid == agTRUE)
+ {
+ /*the Identify Device command already normally completed, just return*/
+ return;
+ }
+
+ tdIORequestBody = (tdIORequestBody_t *)smIORequest->tdData;
+ smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
+ onePortContext = oneDeviceData->tdPortContext;
+ if (tdIORequestBody == agNULL)
+ {
+ TI_DBG1(("tdIDStartTimerCB: tdIORequestBody == agNULL !!!!!!\n"));
+ return;
+ }
+
+ if (smDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tdIDStartTimerCB: smDeviceHandle == agNULL !!!!!!\n"));
+ return;
+ }
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdIDStartTimerCB: onePortContext == agNULL !!!!!!\n"));
+ return;
+ }
+
+ TI_DBG1(("tdIDStartTimerCB: did %d\n", oneDeviceData->id));
+ /*
+ 1. smIOabort()
+ 2. in tdsmIDCompletedCB(), retry
+ */
+ if (oneDeviceData->valid == agFALSE)
+ {
+ TI_DBG1(("tdIDStartTimerCB: invalid device\n"));
+ return;
+ }
+#ifdef TD_DEBUG_ENABLE
+ status = smIOAbort( smRoot, smIORequest );
+#else
+ smIOAbort( smRoot, smIORequest );
+#endif
+
+#ifdef REMOVED
+ /* allocating agIORequest for abort itself */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&tdAbortIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdIDStartTimerCB: ostiAllocMemory failed...; can't retry ID data \n"));
+ return;
+ }
+ if (tdAbortIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdIDStartTimerCB: ostiAllocMemory returned NULL tdAbortIORequestBody; can't retry ID data\n"));
+ return;
+ }
+ /* setup task management structure */
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ /* setting callback but not used later */
+ tdAbortIORequestBody->IOCompletionFunc = agNULL;
+ //tdAbortIORequestBody->IOCompletionFunc = itdssIOAbortedHandler;
+ tdAbortIORequestBody->tiDevHandle = (tiDeviceHandle_t *)&(oneDeviceData->tiDeviceHandle);
+ /* initialize agIORequest */
+ agAbortIORequest = &(tdAbortIORequestBody->agIORequest);
+ agAbortIORequest->osData = (void *) tdAbortIORequestBody;
+ agAbortIORequest->sdkData = agNULL; /* LL takes care of this */
+//#endif
+//#ifdef REMOVED
+ status = saSATAAbort(agRoot,
+ agAbortIORequest,
+ 0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ ossaSATAIDAbortCB
+ );
+ status = saSATAAbort(agRoot,
+ agAbortIORequest,
+ 0,
+ oneDeviceData->agDevHandle,
+ 0, /* abort one */
+ agIORequest,
+ ossaSATAIDAbortCB
+ );
+//#endif
+//#ifdef REMOVED
+ if (status != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("tdIDStartTimerCB: saSATAAbort failed; can't retry ID data\n"));
+ }
+ if (oneDeviceData->satDevData.IDDeviceValid == agTRUE)
+ {
+ TI_DBG1(("tdIDStartTimerCB: IDDeviceValid is valid, no need to retry\n"));
+ return;
+ }
+ if (tdIORequestBody->reTries <= SM_RETRIES)
+ {
+ tdIORequestBody->tiIORequest = agNULL; /* not in use */
+ tdIORequestBody->pid = onePortContext->id;
+ smIORequest->tdData = tdIORequestBody;
+ smIORequest->smData = &tdIORequestBody->smIORequestBody;
+ smDeviceHandle->tdData = oneDeviceData;
+ IDstatus = smIDStart(smRoot, smIORequest, smDeviceHandle );
+ if (IDstatus == SM_RC_SUCCESS)
+ {
+ TI_DBG1(("tdIDStartTimerCB: being retried!!!\n"));
+ tdIORequestBody->reTries++;
+ tdIORequestBody->ioCompleted = agFALSE;
+ tdIORequestBody->ioStarted = agTRUE;
+ tdIDStartTimer(tiRoot, smIORequest, oneDeviceData);
+ }
+ else
+ {
+ /* identify device data is not valid */
+ TI_DBG1(("tdIDStartTimerCB: smIDStart fail or busy %d!!!\n", IDstatus));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory( tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ return;
+ }
+ }
+ else
+ {
+ /* give up */
+ TI_DBG1(("tdIDStartTimerCB: retries are over!!!\n"));
+ if (oneDeviceData->tdIDTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer( tiRoot, &oneDeviceData->tdIDTimer );
+ }
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+
+ if (oneDeviceData->SMNumOfID <= 0) /* does SMP HARD RESET only upto one time */
+ {
+ TI_DBG1(("tdIDStartTimerCB: fail; sending HARD_RESET\n"));
+ oneDeviceData->SMNumOfID++;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ saLocalPhyControl(agRoot, agNULL, 0, oneDeviceData->phyID, AGSA_PHY_HARD_RESET, agNULL);
+ }
+ else
+ {
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ agNULL);
+ }
+ }
+ else
+ {
+ /* given up after one time of SMP HARD RESET; */
+ TI_DBG1(("tdIDStartTimerCB: fail; but giving up sending HARD_RESET!!!\n"));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ smReportRemovalDirect(tiRoot, agRoot, oneDeviceData);
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ }
+ }
+#endif // REMOVED
+
+ TI_DBG1(("tdIDStartTimerCB: end, smIOAbort status %d\n", status));
+ return;
+}
+#endif // FDS_SM
+
+
+#if defined(FDS_DM) && defined(FDS_SM)
+//start here
+GLOBAL void
+tdIDStart(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ smRoot_t *smRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 SMstatus = SM_RC_FAILURE;
+ tdIORequestBody_t *tdIORequestBody;
+ smIORequest_t *smIORequest;
+ smDeviceHandle_t *smDeviceHandle;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+
+
+ TI_DBG1(("tdIDStart: start, did %d\n",oneDeviceData->id));
+
+ if ( (DEVICE_IS_SATA_DEVICE(oneDeviceData)|| DEVICE_IS_STP_TARGET(oneDeviceData))
+ &&
+ oneDeviceData->satDevData.IDDeviceValid == agFALSE
+ &&
+ oneDeviceData->satDevData.IDPending == agFALSE
+ )
+ {
+ TI_DBG2(("tdIDStart: in loop, did %d\n", oneDeviceData->id));
+ /* allocating tdIORequestBody */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&tdIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess || tdIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdIDStart: ostiAllocMemory failed... or ostiAllocMemory returned NULL tdIORequestBody!!!\n"));
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ /* notifying link up */
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *) onePortContext->tiPortalContext
+ );
+#endif
+ }
+ }
+ else
+ {
+ /* initialize */
+ osti_memset(tdIORequestBody, 0, sizeof(tdIORequestBody_t));
+
+ tdIORequestBody->osMemHandle = osMemHandle;
+ TI_DBG2(("tdIDStart: tdIORequestBody %p tdIORequestBody->osMemHandle %p\n", tdIORequestBody, tdIORequestBody->osMemHandle));
+
+ /* not in use */
+ tdIORequestBody->IOCompletionFunc = agNULL;
+ tdIORequestBody->tiDevHandle = agNULL;
+
+ tdIORequestBody->tiIORequest = agNULL; /* not in use */
+ tdIORequestBody->pid = onePortContext->id;
+ tdIORequestBody->reTries = 0;
+ smIORequest = (smIORequest_t *)&(tdIORequestBody->smIORequest);
+ smIORequest->tdData = tdIORequestBody;
+ smIORequest->smData = &tdIORequestBody->smIORequestBody;
+
+ smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
+ smDeviceHandle->tdData = oneDeviceData;
+
+ TI_DBG2(("tdIDStart: smIORequest %p\n", smIORequest));
+
+ SMstatus = smIDStart(smRoot,
+ smIORequest,
+ &(oneDeviceData->smDeviceHandle)
+ );
+
+ if (SMstatus == SM_RC_SUCCESS)
+ {
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG2(("tdIDStart: successfully sent identify device data\n"));
+
+ /* Add the devicedata to the mainlink */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG6(("tdIDStart: one case did %d \n", oneDeviceData->id));
+ }
+ oneDeviceData->satDevData.IDPending = agTRUE;
+ /* start a timer */
+ tdIDStartTimer(tiRoot, smIORequest, oneDeviceData);
+ }
+ else
+ {
+ /* failed to send */
+ TI_DBG1(("tdIDStart: smIDStart fail or busy %d\n", SMstatus));
+
+ /* free up allocated memory */
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG1(("tdIDStart: failed in sending identify device data\n"));
+ /* put onedevicedata back to free list */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ /* notifying link up */
+ ostiPortEvent(
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)onePortContext->tiPortalContext
+ );
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *) onePortContext->tiPortalContext
+ );
+#endif
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ }
+ }
+ }
+ TI_DBG1(("tdIDStart: exit\n"));
+ return;
+}
+
+#endif
+
+#ifdef SALLSDK_OS_IOMB_LOG_ENABLE
+GLOBAL void ossaLogIomb(agsaRoot_t *agRoot,
+ bit32 queueNum,
+ agBOOLEAN isInbound,
+ void *pMsg,
+ bit32 msgLength)
+{
+ return;
+}
+#endif /* SALLSDK_OS_IOMB_LOG_ENABLE */
+
+#ifndef SATA_ENABLE
+/*
+ * These callback routines are defined in ossasat.c which are included in the
+ * compilation if SATA_ENABLED is defined.
+ */
+
+/*****************************************************************************
+*! \brief ossaDiscoverSataCB
+*
+* Purpose: This function is called by lower layer to inform TD layer of
+* STP/SATA discovery results
+*
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param agPortContext Pointer to the port context of TD and Lower layer
+* \param event event type
+* \param pParm1 Pointer to data associated with event
+* \param pParm2 Pointer to data associated with event
+*
+* \return: none
+*
+* \note - For details, refer to SAS/SATA Low-Level API Specification
+*
+*****************************************************************************/
+
+osGLOBAL void ossaDiscoverSataCB( agsaRoot_t *agRoot,
+ agsaPortContext_t *agPortContext,
+ bit32 event,
+ void *pParm1,
+ void *pParm2
+ )
+{
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief ossaSATACompleted
+*
+* This routine is called to complete a SATA request previously issued to the
+* LL Layer in saSATAStart()
+*
+* \param agRoot: Handles for this instance of SAS/SATA hardware
+* \param agIORequest: Pointer to the LL I/O request context for this I/O.
+* \param agIOStatus: Status of completed I/O.
+* \param agFirstDword:Pointer to the four bytes of FIS.
+* \param agIOInfoLen: Length in bytes of overrun/underrun residual or FIS
+* length.
+* \param agParam: Additional info based on status.
+*
+* \return: none
+*
+*****************************************************************************/
+GLOBAL void ossaSATACompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ void *agFirstDword,
+ bit32 agIOInfoLen,
+ void *agParam
+ )
+{
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief ossaSATAEvent
+*
+* This routine is called to notify the OS Layer of an event associated with
+* SATA port or SATA device
+*
+* \param agRoot: Handles for this instance of SAS/SATA hardware
+* \param agIORequest: Pointer to the LL I/O request context for this I/O.
+* \param agPortContext Pointer to the port context of TD and Lower layer
+* \param agDevHandle: Pointer to a device handle
+* \param event: event type
+*
+* \return: none
+*
+*****************************************************************************/
+osGLOBAL void ossaSATAEvent(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ agsaPortContext_t *agPortContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 event,
+ bit32 agIOInfoLen,
+ void *agParam
+ )
+{
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief ossaSATADeviceResetCB
+*
+* This routine is called to complete a SATA device reset request previously
+* issued to the LL Layer in saSATADeviceReset().
+*
+* \param agRoot: Handles for this instance of SAS/SATA hardware
+* \param agDevHandle: Pointer to a device handle
+* \param resetStatus: Reset status:
+* OSSA_SUCCESS: The reset operation completed successfully.
+* OSSA_FAILURE: The reset operation failed.
+* \param resetparm: Pointer to the Device-To-Host FIS received from the device.
+*
+* \return: none
+*
+*****************************************************************************/
+osGLOBAL void ossaSATADeviceResetCB(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ bit32 resetStatus,
+ void *resetparm)
+{
+
+ return;
+
+}
+
+/*****************************************************************************
+*! \brief ossaDiscoverSasCB
+*
+* Purpose: This function is called by lower layer to inform TD layer of
+* SAS discovery results
+*
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param agPortContext Pointer to the port context of TD and Lower layer
+* \param event event type
+* \param pParm1 Pointer to data associated with event
+* \param pParm2 Pointer to data associated with event
+*
+* \return: none
+*
+* \note - For details, refer to SAS/SATA Low-Level API Specification
+*
+*****************************************************************************/
+osGLOBAL void ossaDiscoverSasCB(agsaRoot_t *agRoot,
+ agsaPortContext_t *agPortContext,
+ bit32 event,
+ void *pParm1,
+ void *pParm2
+ )
+{
+ return;
+}
+#endif
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tddefs.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tddefs.h
new file mode 100644
index 0000000..91aadb3
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tddefs.h
@@ -0,0 +1,1309 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * The file contains defines and data structures for SAS/SATA TD layer
+ *
+ */
+
+#ifndef __TDDEFS_H__
+#define __TDDEFS_H__
+
+
+
+#ifndef agTRUE
+#define agTRUE 1
+#endif
+
+#ifndef agFALSE
+#define agFALSE 0
+#endif
+
+#ifndef agNULL
+#define agNULL ((void *)0)
+#endif
+
+#ifndef IN
+#define IN
+#endif
+
+#ifndef OUT
+#define OUT
+#endif
+
+#ifndef IN_OUT
+#define IN_OUT
+#endif
+
+#ifndef os_bit8
+#define os_bit8 bit8
+#endif
+
+#ifndef os_bit16
+#define os_bit16 bit16
+#endif
+
+#ifndef os_bit32
+#define os_bit32 bit32
+#endif
+
+#ifndef OFF
+#define OFF 0
+#endif
+
+#ifndef ON
+#define ON 1
+#endif
+
+#ifndef MIN
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
+#define MAX(a,b) ((a) < (b) ? (b) : (a))
+#endif
+
+#define TD_OPERATION_INITIATOR 0x1
+#define TD_OPERATION_TARGET 0x2
+
+/* indices for mem_t structures */
+#define DEK_MEM_INDEX_1 15
+#define DEK_MEM_INDEX_2 16
+
+/* some useful macros */
+#ifndef AG_ALIGNSIZE
+#define AG_ALIGNSIZE(count, alignment) (bit32) ( (bitptr)(count)+(bitptr)(alignment) )
+#endif
+
+#define DEFAULT_KEY_BUFFER_SIZE 64
+
+/**< the default maximum number of phys */
+#ifdef FPGA_CARD
+
+#define TD_MAX_NUM_PHYS 2
+
+#else
+#define TD_MAX_NUM_PHYS 16
+#define TD_MAX_CARD_NUM 20
+#endif
+
+#define TD_CARD_ID_FREE 0
+#define TD_CARD_ID_ALLOC 1
+#define TD_CARD_ID_LEN 128
+
+/**< the maximum number of port context */
+/* should be the number of phyical phys in chip + 1 */
+#define TD_MAX_PORT_CONTEXT 16
+/**< the maximum number of target device */
+/* For Initiator and Target
+ this is initial value for MaxTargets in the configuration(adj) file */
+#define DEFAULT_MAX_DEV 256
+/* the maximum number of interrupt coalesce context */
+#define TD_MAX_INT_COALESCE 512
+
+#if (defined(__FreeBSD__))
+#define MAX_OUTSTANDING_IO_PER_LUN 64
+#else
+#define MAX_OUTSTANDING_IO_PER_LUN 254 //64
+#endif
+
+/* default values */
+#define DEFAULT_MAX_ACTIVE_IOS 128
+#define DEFAULT_NUM_REG_CLIENTS 256
+#define DEFAULT_NUM_INBOUND_QUEUE 1
+#define DEFAULT_NUM_OUTBOUND_QUEUE 1
+#define DEFAULT_INBOUND_QUEUE_SIZE 512
+#define DEFAULT_INBOUND_QUEUE_ELE_SIZE 128
+#define DEFAULT_OUTBOUND_QUEUE_SIZE 512
+#define DEFAULT_OUTBOUND_QUEUE_ELE_SIZE 128
+#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY 0
+#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT 1
+#define DEFAULT_OUTBOUND_INTERRUPT_ENABLE 1
+#define DEFAULT_INBOUND_QUEUE_PRIORITY 0
+#define DEFAULT_QUEUE_OPTION 0
+#define DEFAULT_FW_MAX_PORTS 8
+
+
+
+/* SAS device type definition. SAS spec(r.7) p206 */
+#define SAS_NO_DEVICE 0
+#define SAS_END_DEVICE 1
+#define SAS_EDGE_EXPANDER_DEVICE 2
+#define SAS_FANOUT_EXPANDER_DEVICE 3
+
+/* routing attributes */
+#define SAS_ROUTING_DIRECT 0x00
+#define SAS_ROUTING_SUBTRACTIVE 0x01
+#define SAS_ROUTING_TABLE 0x02
+
+#define SAS_CONNECTION_RATE_1_5G 0x08
+#define SAS_CONNECTION_RATE_3_0G 0x09
+#define SAS_CONNECTION_RATE_6_0G 0x0A
+#define SAS_CONNECTION_RATE_12_0G 0x0B
+
+/**< defines the maximum number of expanders */
+#define TD_MAX_EXPANDER_PHYS 256
+/**< the maximum number of expanders at TD */
+#define TD_MAX_EXPANDER 128
+
+/*****************************************************************************
+** SCSI Operation Codes (first byte in CDB)
+*****************************************************************************/
+
+
+#define SCSIOPC_TEST_UNIT_READY 0x00
+#define SCSIOPC_INQUIRY 0x12
+#define SCSIOPC_MODE_SENSE_6 0x1A
+#define SCSIOPC_MODE_SENSE_10 0x5A
+#define SCSIOPC_MODE_SELECT_6 0x15
+#define SCSIOPC_START_STOP_UNIT 0x1B
+#define SCSIOPC_READ_CAPACITY_10 0x25
+#define SCSIOPC_READ_CAPACITY_16 0x9E
+#define SCSIOPC_READ_6 0x08
+#define SCSIOPC_READ_10 0x28
+#define SCSIOPC_READ_12 0xA8
+#define SCSIOPC_READ_16 0x88
+#define SCSIOPC_WRITE_6 0x0A
+#define SCSIOPC_WRITE_10 0x2A
+#define SCSIOPC_WRITE_12 0xAA
+#define SCSIOPC_WRITE_16 0x8A
+#define SCSIOPC_WRITE_VERIFY 0x2E
+#define SCSIOPC_VERIFY_10 0x2F
+#define SCSIOPC_VERIFY_12 0xAF
+#define SCSIOPC_VERIFY_16 0x8F
+#define SCSIOPC_REQUEST_SENSE 0x03
+#define SCSIOPC_REPORT_LUN 0xA0
+#define SCSIOPC_FORMAT_UNIT 0x04
+#define SCSIOPC_SEND_DIAGNOSTIC 0x1D
+#define SCSIOPC_WRITE_SAME_10 0x41
+#define SCSIOPC_WRITE_SAME_16 0x93
+#define SCSIOPC_READ_BUFFER 0x3C
+#define SCSIOPC_WRITE_BUFFER 0x3B
+
+#define SCSIOPC_GET_CONFIG 0x46
+#define SCSIOPC_GET_EVENT_STATUS_NOTIFICATION 0x4a
+#define SCSIOPC_REPORT_KEY 0xA4
+#define SCSIOPC_SEND_KEY 0xA3
+#define SCSIOPC_READ_DVD_STRUCTURE 0xAD
+#define SCSIOPC_TOC 0x43
+#define SCSIOPC_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
+#define SCSIOPC_READ_VERIFY 0x42
+
+#define SCSIOPC_LOG_SENSE 0x4D
+#define SCSIOPC_LOG_SELECT 0x4C
+#define SCSIOPC_MODE_SELECT_6 0x15
+#define SCSIOPC_MODE_SELECT_10 0x55
+#define SCSIOPC_SYNCHRONIZE_CACHE_10 0x35
+#define SCSIOPC_SYNCHRONIZE_CACHE_16 0x91
+#define SCSIOPC_WRITE_AND_VERIFY_10 0x2E
+#define SCSIOPC_WRITE_AND_VERIFY_12 0xAE
+#define SCSIOPC_WRITE_AND_VERIFY_16 0x8E
+#define SCSIOPC_READ_MEDIA_SERIAL_NUMBER 0xAB
+#define SCSIOPC_REASSIGN_BLOCKS 0x07
+
+
+
+
+
+/*****************************************************************************
+** SCSI GENERIC 6 BYTE CDB
+*****************************************************************************/
+typedef struct CBD6_s {
+ bit8 opcode;
+ bit8 rsv; /* not 100% correct */
+ bit8 lba[2]; /* not 100% correct */
+ bit8 len;
+ bit8 control;
+} CDB6_t;
+
+
+
+/*****************************************************************************
+** SCSI GENERIC 10 BYTE CDB
+*****************************************************************************/
+typedef struct CBD10_s {
+ bit8 opcode;
+ bit8 rsv_service;
+ bit8 lba[4];
+ bit8 rsv;
+ bit8 len[2];
+ bit8 control;
+} CDB10_t;
+
+/*****************************************************************************
+** SCSI GENERIC 12 BYTE CDB
+*****************************************************************************/
+typedef struct CBD12_s {
+ bit8 opcode;
+ bit8 rsv_service;
+ bit8 lba[4];
+ bit8 len[4];
+ bit8 rsv;
+ bit8 control;
+} CDB12_t;
+
+
+/*****************************************************************************
+** SCSI GENERIC 16 BYTE CDB
+*****************************************************************************/
+typedef struct CBD16_s {
+ bit8 opcode;
+ bit8 rsv_service;
+ bit8 lba[4];
+ bit8 add_cdb[4];
+ bit8 len[4];
+ bit8 rsv;
+ bit8 control;
+} CDB16_t;
+
+#define BLOCK_BYTE_LENGTH 512
+
+/*****************************************************************************
+** SCSI STATUS BYTES
+*****************************************************************************/
+
+#define SCSI_STATUS_GOOD 0x00
+#define SCSI_STATUS_CHECK_CONDITION 0x02
+#define SCSI_STATUS_BUSY 0x08
+#define SCSI_STATUS_COMMAND_TERMINATED 0x22
+#define SCSI_STATUS_TASK_SET_FULL 0x28
+
+/*****************************************************************************
+** SAS TM Function data present see SAS spec p311 Table 109 (Revision 7)
+*****************************************************************************/
+#define NO_DATA 0
+#define RESPONSE_DATA 1
+#define SENSE_DATA 2
+
+/* 4 bytes, SAS spec p312 Table 110 (Revision 7) */
+#define RESPONSE_DATA_LEN 4
+
+#define SAS_CMND 0
+#define SAS_TM 1
+
+/* SMP frame type */
+#define SMP_REQUEST 0x40
+#define SMP_RESPONSE 0x41
+
+#define SMP_INITIATOR 0x01
+#define SMP_TARGET 0x02
+
+/* default SMP timeout: 0xFFFF is the Maximum Allowed */
+#define DEFAULT_SMP_TIMEOUT 0xFFFF
+
+/* SMP direct payload size limit: IOMB direct payload size = 48 */
+#define SMP_DIRECT_PAYLOAD_LIMIT 44
+
+/* SMP function */
+#define SMP_REPORT_GENERAL 0x00
+#define SMP_REPORT_MANUFACTURE_INFORMATION 0x01
+#define SMP_READ_GPIO_REGISTER 0x02
+#define SMP_DISCOVER 0x10
+#define SMP_REPORT_PHY_ERROR_LOG 0x11
+#define SMP_REPORT_PHY_SATA 0x12
+#define SMP_REPORT_ROUTING_INFORMATION 0x13
+#define SMP_WRITE_GPIO_REGISTER 0x82
+#define SMP_CONFIGURE_ROUTING_INFORMATION 0x90
+#define SMP_PHY_CONTROL 0x91
+#define SMP_PHY_TEST_FUNCTION 0x92
+#define SMP_PMC_SPECIFIC 0xC0
+
+
+/* SMP function results */
+#define SMP_FUNCTION_ACCEPTED 0x00
+#define UNKNOWN_SMP_FUNCTION 0x01
+#define SMP_FUNCTION_FAILED 0x02
+#define INVALID_REQUEST_FRAME_LENGTH 0x03
+#define INVALID_EXPANDER_CHANGE_COUNT 0x04
+#define SMP_FN_BUSY 0x05
+#define INCOMPLETE_DESCRIPTOR_LIST 0x06
+#define PHY_DOES_NOT_EXIST 0x10
+#define INDEX_DOES_NOT_EXIST 0x11
+#define PHY_DOES_NOT_SUPPORT_SATA 0x12
+#define UNKNOWN_PHY_OPERATION 0x13
+#define UNKNOWN_PHY_TEST_FUNCTION 0x14
+#define PHY_TEST_FUNCTION_IN_PROGRESS 0x15
+#define PHY_VACANT 0x16
+#define UNKNOWN_PHY_EVENT_SOURCE 0x17
+#define UNKNOWN_DESCRIPTOT_TYPE 0x18
+#define UNKNOWN_PHY_FILETER 0x19
+#define AFFILIATION_VIOLATION 0x1A
+#define SMP_ZONE_VIOLATION 0x20
+#define NO_MANAGEMENT_ACCESS_RIGHTS 0x21
+#define UNKNOWN_ENABLE_DISABLE_ZONING_VALUE 0x22
+#define ZONE_LOCK_VIOLATION 0x23
+#define NOT_ACTIVATED 0x24
+#define ZONE_GROUP_OUT_OF_RANGE 0x25
+#define NO_PHYSICAL_PRESENCE 0x26
+#define SAVING_NOT_SUPPORTED 0x27
+#define SOURCE_ZONE_GROUP_DOES_NOT_EXIST 0x28
+#define DISABLED_PASSWORD_NOT_SUPPORTED 0x29
+
+/* SMP PHY CONTROL OPERATION */
+#define SMP_PHY_CONTROL_NOP 0x00
+#define SMP_PHY_CONTROL_LINK_RESET 0x01
+#define SMP_PHY_CONTROL_HARD_RESET 0x02
+#define SMP_PHY_CONTROL_DISABLE 0x03
+#define SMP_PHY_CONTROL_CLEAR_ERROR_LOG 0x05
+#define SMP_PHY_CONTROL_CLEAR_AFFILIATION 0x06
+#define SMP_PHY_CONTROL_XMIT_SATA_PS_SIGNAL 0x07
+
+
+#define IT_NEXUS_TIMEOUT 0x7D0 /* 2000 ms; old value was 0xFFFF */
+
+#define PORT_RECOVERY_TIMEOUT ((IT_NEXUS_TIMEOUT/100) + 30) /* 5000 ms; in 100ms; should be large than IT_NEXUS_TIMEOUT */
+
+#define STP_IDLE_TIME 5 /* 5 us; the defaulf of the controller */
+
+#define SET_ESGL_EXTEND(val) \
+ ((val) = (val) | 0x80000000)
+
+#define CLEAR_ESGL_EXTEND(val) \
+ ((val) = (val) & 0x7FFFFFFF)
+
+#define DEVINFO_GET_SAS_ADDRESSLO(devInfo) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(devInfo)->sasAddressLo)
+
+#define DEVINFO_GET_SAS_ADDRESSHI(devInfo) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(devInfo)->sasAddressHi)
+
+/* this macro is based on SAS spec, not sTSDK 0xC0 */
+#define DEVINFO_GET_DEVICETTYPE(devInfo) \
+ (((devInfo)->devType_S_Rate & 0xC0) >> 6)
+
+#define DEVINFO_GET_LINKRATE(devInfo) \
+ ((devInfo)->devType_S_Rate & 0x0F)
+
+#define DEVINFO_GET_EXT_MCN(devInfo) \
+ (((devInfo)->ext & 0x7800) >> 11)
+
+
+#define DEVINFO_PUT_SMPTO(devInfo, smpto) \
+ ((devInfo)->smpTimeout) = smpto
+
+#define DEVINFO_PUT_ITNEXUSTO(devInfo, itnexusto) \
+ ((devInfo)->it_NexusTimeout) = itnexusto
+
+#define DEVINFO_PUT_FBS(devInfo, fbs) \
+ ((devInfo)->firstBurstSize) = fbs
+
+#define DEVINFO_PUT_FLAG(devInfo, tlr) \
+ ((devInfo)->flag) = tlr
+
+#define DEVINFO_PUT_DEV_S_RATE(devInfo, dev_s_rate) \
+ ((devInfo)->devType_S_Rate) = dev_s_rate
+
+#define DEVINFO_PUT_SAS_ADDRESSLO(devInfo, src32) \
+ *(bit32 *)((devInfo)->sasAddressLo) = BIT32_TO_DMA_BEBIT32(src32)
+
+#define DEVINFO_PUT_SAS_ADDRESSHI(devInfo, src32) \
+ *(bit32 *)((devInfo)->sasAddressHi) = BIT32_TO_DMA_BEBIT32(src32)
+
+#define DEVICE_SSP_BIT 0x8 /* SSP Initiator port */
+#define DEVICE_STP_BIT 0x4 /* STP Initiator port */
+#define DEVICE_SMP_BIT 0x2 /* SMP Initiator port */
+#define DEVICE_SATA_BIT 0x1 /* SATA device, valid in the discovery response only */
+
+#define DEVICE_IS_SSP_INITIATOR(DeviceData) \
+ (((DeviceData)->initiator_ssp_stp_smp & DEVICE_SSP_BIT) == DEVICE_SSP_BIT)
+
+#define DEVICE_IS_STP_INITIATOR(DeviceData) \
+ (((DeviceData)->initiator_ssp_stp_smp & DEVICE_STP_BIT) == DEVICE_STP_BIT)
+
+#define DEVICE_IS_SMP_INITIATOR(DeviceData) \
+ (((DeviceData)->initiator_ssp_stp_smp & DEVICE_SMP_BIT) == DEVICE_SMP_BIT)
+
+#define DEVICE_IS_SSP_TARGET(DeviceData) \
+ (((DeviceData)->target_ssp_stp_smp & DEVICE_SSP_BIT) == DEVICE_SSP_BIT)
+
+#define DEVICE_IS_STP_TARGET(DeviceData) \
+ (((DeviceData)->target_ssp_stp_smp & DEVICE_STP_BIT) == DEVICE_STP_BIT)
+
+#define DEVICE_IS_SMP_TARGET(DeviceData) \
+ (((DeviceData)->target_ssp_stp_smp & DEVICE_SMP_BIT) == DEVICE_SMP_BIT)
+
+#define DEVICE_IS_SATA_DEVICE(DeviceData) \
+ (((DeviceData)->target_ssp_stp_smp & DEVICE_SATA_BIT) == DEVICE_SATA_BIT)
+
+
+
+
+/* Negotiated Phyical Link Rate
+#define Phy_ENABLED_UNKNOWN
+*/
+/* old SMP header definition */
+typedef struct tdssSMPFrameHeader_s
+{
+ bit8 smpFrameType; /* The first byte of SMP frame represents the SMP FRAME TYPE */
+ bit8 smpFunction; /* The second byte of the SMP frame represents the SMP FUNCTION */
+ bit8 smpFunctionResult; /* The third byte of SMP frame represents FUNCTION RESULT of the SMP response. */
+ bit8 smpReserved; /* reserved */
+} tdssSMPFrameHeader_t;
+
+/****************************************************************
+ * report general request
+ ****************************************************************/
+#ifdef FOR_COMPLETENESS
+typedef struct smpReqReportGeneral_s
+{
+ /* nothing. some compiler disallowed structure with no member */
+} smpReqReportGeneral_t;
+#endif
+
+/****************************************************************
+ * report general response
+ ****************************************************************/
+#define REPORT_GENERAL_CONFIGURING_BIT 0x2
+#define REPORT_GENERAL_CONFIGURABLE_BIT 0x1
+
+typedef struct smpRespReportGeneral_s
+{
+ bit8 expanderChangeCount16[2];
+ bit8 expanderRouteIndexes16[2];
+ bit8 reserved1;
+ bit8 numOfPhys;
+ bit8 configuring_configurable;
+ /* B7-2 : reserved */
+ /* B1 : configuring */
+ /* B0 : configurable */
+ bit8 reserved4[17];
+} smpRespReportGeneral_t;
+
+#define REPORT_GENERAL_IS_CONFIGURING(pResp) \
+ (((pResp)->configuring_configurable & REPORT_GENERAL_CONFIGURING_BIT) == \
+ REPORT_GENERAL_CONFIGURING_BIT)
+
+#define REPORT_GENERAL_IS_CONFIGURABLE(pResp) \
+ (((pResp)->configuring_configurable & REPORT_GENERAL_CONFIGURABLE_BIT) == \
+ REPORT_GENERAL_CONFIGURABLE_BIT)
+
+#define REPORT_GENERAL_GET_ROUTEINDEXES(pResp) \
+ DMA_BEBIT16_TO_BIT16(*(bit16 *)((pResp)->expanderRouteIndexes16))
+
+
+/****************************************************************
+ * report manufacturer info response
+ ****************************************************************/
+typedef struct smpRespReportManufactureInfo_s
+{
+ bit8 reserved1[8];
+ bit8 vendorIdentification[8];
+ bit8 productIdentification[16];
+ bit8 productRevisionLevel[4];
+ bit8 vendorSpecific[20];
+} smpRespReportManufactureInfo_t;
+
+/****************************************************************
+ * discover request
+ ****************************************************************/
+typedef struct smpReqDiscover_s
+{
+ bit32 reserved1;
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 ignored;
+ bit8 reserved3;
+} smpReqDiscover_t;
+
+/****************************************************************
+ * discover response
+ ****************************************************************/
+typedef struct smpRespDiscover_s
+{
+ bit8 reserved1[4];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3[2];
+ bit8 attachedDeviceType;
+ /* B7 : reserved */
+ /* B6-4 : attachedDeviceType */
+ /* B3-0 : reserved */
+ bit8 negotiatedPhyLinkRate;
+ /* B7-4 : reserved */
+ /* B3-0 : negotiatedPhyLinkRate */
+ bit8 attached_Ssp_Stp_Smp_Sata_Initiator;
+ /* B7-4 : reserved */
+ /* B3 : attachedSspInitiator */
+ /* B2 : attachedStpInitiator */
+ /* B1 : attachedSmpInitiator */
+ /* B0 : attachedSataHost */
+ bit8 attached_SataPS_Ssp_Stp_Smp_Sata_Target;
+ /* B7 : attachedSataPortSelector */
+ /* B6-4 : reserved */
+ /* B3 : attachedSspTarget */
+ /* B2 : attachedStpTarget */
+ /* B1 : attachedSmpTarget */
+ /* B0 : attachedSatadevice */
+ bit8 sasAddressHi[4];
+ bit8 sasAddressLo[4];
+ bit8 attachedSasAddressHi[4];
+ bit8 attachedSasAddressLo[4];
+ bit8 attachedPhyIdentifier;
+ bit8 reserved9[7];
+ bit8 programmedAndHardware_MinPhyLinkRate;
+ /* B7-4 : programmedMinPhyLinkRate */
+ /* B3-0 : hardwareMinPhyLinkRate */
+ bit8 programmedAndHardware_MaxPhyLinkRate;
+ /* B7-4 : programmedMaxPhyLinkRate */
+ /* B3-0 : hardwareMaxPhyLinkRate */
+ bit8 phyChangeCount;
+ bit8 virtualPhy_partialPathwayTimeout;
+ /* B7 : virtualPhy*/
+ /* B6-4 : reserved */
+ /* B3-0 : partialPathwayTimeout */
+ bit8 routingAttribute;
+ /* B7-4 : reserved */
+ /* B3-0 : routingAttribute */
+ bit8 reserved13[5];
+ bit8 vendorSpecific[2];
+} smpRespDiscover_t;
+
+#define DISCRSP_SSP_BIT 0x08
+#define DISCRSP_STP_BIT 0x04
+#define DISCRSP_SMP_BIT 0x02
+#define DISCRSP_SATA_BIT 0x01
+
+#define DISCRSP_SATA_PS_BIT 0x80
+
+#define DISCRSP_GET_ATTACHED_DEVTYPE(pResp) \
+ (((pResp)->attachedDeviceType & 0x70) >> 4)
+#define DISCRSP_GET_LINKRATE(pResp) \
+ ((bit8)((pResp)->negotiatedPhyLinkRate & 0x0F))
+
+#define DISCRSP_IS_SSP_INITIATOR(pResp) \
+ (((pResp)->attached_Ssp_Stp_Smp_Sata_Initiator & DISCRSP_SSP_BIT) == DISCRSP_SSP_BIT)
+#define DISCRSP_IS_STP_INITIATOR(pResp) \
+ (((pResp)->attached_Ssp_Stp_Smp_Sata_Initiator & DISCRSP_STP_BIT) == DISCRSP_STP_BIT)
+#define DISCRSP_IS_SMP_INITIATOR(pResp) \
+ (((pResp)->attached_Ssp_Stp_Smp_Sata_Initiator & DISCRSP_SMP_BIT) == DISCRSP_SMP_BIT)
+#define DISCRSP_IS_SATA_HOST(pResp) \
+ (((pResp)->attached_Ssp_Stp_Smp_Sata_Initiator & DISCRSP_SATA_BIT) == DISCRSP_SATA_BIT)
+
+#define DISCRSP_IS_SSP_TARGET(pResp) \
+ (((pResp)->attached_SataPS_Ssp_Stp_Smp_Sata_Target & DISCRSP_SSP_BIT) == DISCRSP_SSP_BIT)
+#define DISCRSP_IS_STP_TARGET(pResp) \
+ (((pResp)->attached_SataPS_Ssp_Stp_Smp_Sata_Target & DISCRSP_STP_BIT) == DISCRSP_STP_BIT)
+#define DISCRSP_IS_SMP_TARGET(pResp) \
+ (((pResp)->attached_SataPS_Ssp_Stp_Smp_Sata_Target & DISCRSP_SMP_BIT) == DISCRSP_SMP_BIT)
+#define DISCRSP_IS_SATA_DEVICE(pResp) \
+ (((pResp)->attached_SataPS_Ssp_Stp_Smp_Sata_Target & DISCRSP_SATA_BIT) == DISCRSP_SATA_BIT)
+#define DISCRSP_IS_SATA_PORTSELECTOR(pResp) \
+ (((pResp)->attached_SataPS_Ssp_Stp_Smp_Sata_Target & DISCRSP_SATA_PS_BIT) == DISCRSP_SATA_PS_BIT)
+
+#define DISCRSP_GET_SAS_ADDRESSHI(pResp) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(pResp)->sasAddressHi)
+#define DISCRSP_GET_SAS_ADDRESSLO(pResp) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(pResp)->sasAddressLo)
+
+#define DISCRSP_GET_ATTACHED_SAS_ADDRESSHI(pResp) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(pResp)->attachedSasAddressHi)
+#define DISCRSP_GET_ATTACHED_SAS_ADDRESSLO(pResp) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)(pResp)->attachedSasAddressLo)
+
+#define DISCRSP_VIRTUALPHY_BIT 0x80
+#define DISCRSP_IS_VIRTUALPHY(pResp) \
+ (((pResp)->virtualPhy_partialPathwayTimeout & DISCRSP_VIRTUALPHY_BIT) == DISCRSP_VIRTUALPHY_BIT)
+
+#define DISCRSP_GET_ROUTINGATTRIB(pResp) \
+ ((bit8)((pResp)->routingAttribute & 0x0F))
+
+/****************************************************************
+ * report route table request
+ ****************************************************************/
+typedef struct smpReqReportRouteTable_s
+{
+ bit8 reserved1[2];
+ bit8 expanderRouteIndex16[20];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3[2];
+} smpReqReportRouteTable_t;
+
+/****************************************************************
+ * report route response
+ ****************************************************************/
+typedef struct smpRespReportRouteTable_s
+{
+ bit8 reserved1[2];
+ bit8 expanderRouteIndex16[2];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3[2];
+ bit8 disabled;
+ /* B7 : expander route entry disabled */
+ /* B6-0 : reserved */
+ bit8 reserved5[3];
+ bit8 routedSasAddressHi32[4];
+ bit8 routedSasAddressLo32[4];
+ bit8 reserved6[16];
+} smpRespReportRouteTable_t;
+
+/****************************************************************
+ * configure route information request
+ ****************************************************************/
+typedef struct smpReqConfigureRouteInformation_s
+{
+ bit8 reserved1[2];
+ bit8 expanderRouteIndex[2];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3[2];
+ bit8 disabledBit_reserved4;
+ bit8 reserved5[3];
+ bit8 routedSasAddressHi[4];
+ bit8 routedSasAddressLo[4];
+ bit8 reserved6[16];
+} smpReqConfigureRouteInformation_t;
+
+/****************************************************************
+ * configure route response
+ ****************************************************************/
+#ifdef FOR_COMPLETENESS
+typedef struct smpRespConfigureRouteInformation_s
+{
+ /* nothing. some compiler disallowed structure with no member */
+} smpRespConfigureRouteInformation_t;
+#endif
+
+/****************************************************************
+ * report Phy Sata request
+ ****************************************************************/
+typedef struct smpReqReportPhySata_s
+{
+ bit8 reserved1[4];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3[2];
+} smpReqReportPhySata_t;
+
+/****************************************************************
+ * report Phy Sata response
+ ****************************************************************/
+typedef struct smpRespReportPhySata_s
+{
+ bit8 reserved1[4];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 reserved3;
+ bit8 affiliations_sup_valid;
+ /* b7-2 : reserved */
+ /* b1 : Affiliations supported */
+ /* b0 : Affiliation valid */
+ bit8 reserved5[4];
+ bit8 stpSasAddressHi[4];
+ bit8 stpSasAddressLo[4];
+ bit8 regDevToHostFis[20];
+ bit8 reserved6[4];
+ bit8 affiliatedStpInitiatorSasAddressHi[4];
+ bit8 affiliatedStpInitiatorSasAddressLo[4];
+} smpRespReportPhySata_t;
+
+
+/****************************************************************
+ * Phy Control request
+ ****************************************************************/
+typedef struct smpReqPhyControl_s
+{
+ bit8 reserved1[4];
+ bit8 reserved2;
+ bit8 phyIdentifier;
+ bit8 phyOperation;
+ bit8 updatePartialPathwayTOValue;
+ /* b7-1 : reserved */
+ /* b0 : update partial pathway timeout value */
+ bit8 reserved3[20];
+ bit8 programmedMinPhysicalLinkRate;
+ /* b7-4 : programmed Minimum Physical Link Rate*/
+ /* b3-0 : reserved */
+ bit8 programmedMaxPhysicalLinkRate;
+ /* b7-4 : programmed Maximum Physical Link Rate*/
+ /* b3-0 : reserved */
+ bit8 reserved4[2];
+ bit8 partialPathwayTOValue;
+ /* b7-4 : reserved */
+ /* b3-0 : partial Pathway TO Value */
+ bit8 reserved5[3];
+} smpReqPhyControl_t;
+
+/****************************************************************
+ * Phy Control response
+ ****************************************************************/
+#ifdef FOR_COMPLETENESS
+typedef struct smpRespPhyControl_s
+{
+ /* nothing. some compiler disallowed structure with no member */
+} smpRespPhyControl_t;
+#endif
+
+
+/*****************************************************************************
+** SCSI SENSE KEY VALUES
+*****************************************************************************/
+
+#define SCSI_SNSKEY_NO_SENSE 0x00
+#define SCSI_SNSKEY_RECOVERED_ERROR 0x01
+#define SCSI_SNSKEY_NOT_READY 0x02
+#define SCSI_SNSKEY_MEDIUM_ERROR 0x03
+#define SCSI_SNSKEY_HARDWARE_ERROR 0x04
+#define SCSI_SNSKEY_ILLEGAL_REQUEST 0x05
+#define SCSI_SNSKEY_UNIT_ATTENTION 0x06
+#define SCSI_SNSKEY_DATA_PROTECT 0x07
+#define SCSI_SNSKEY_ABORTED_COMMAND 0x0B
+#define SCSI_SNSKEY_MISCOMPARE 0x0E
+
+/*****************************************************************************
+** SCSI Additional Sense Codes and Qualifiers combo two-bytes
+*****************************************************************************/
+
+#define SCSI_SNSCODE_NO_ADDITIONAL_INFO 0x0000
+#define SCSI_SNSCODE_LUN_CRC_ERROR_DETECTED 0x0803
+#define SCSI_SNSCODE_INVALID_COMMAND 0x2000
+#define SCSI_SNSCODE_LOGICAL_BLOCK_OUT 0x2100
+#define SCSI_SNSCODE_INVALID_FIELD_IN_CDB 0x2400
+#define SCSI_SNSCODE_LOGICAL_NOT_SUPPORTED 0x2500
+#define SCSI_SNSCODE_POWERON_RESET 0x2900
+#define SCSI_SNSCODE_EVERLAPPED_CMDS 0x4e00
+#define SCSI_SNSCODE_INTERNAL_TARGET_FAILURE 0x4400
+#define SCSI_SNSCODE_MEDIUM_NOT_PRESENT 0x3a00
+#define SCSI_SNSCODE_UNRECOVERED_READ_ERROR 0x1100
+#define SCSI_SNSCODE_RECORD_NOT_FOUND 0x1401
+#define SCSI_SNSCODE_NOT_READY_TO_READY_CHANGE 0x2800
+#define SCSI_SNSCODE_OPERATOR_MEDIUM_REMOVAL_REQUEST 0x5a01
+#define SCSI_SNSCODE_INFORMATION_UNIT_CRC_ERROR 0x4703
+#define SCSI_SNSCODE_LOGICAL_UNIT_NOT_READY_FORMAT_IN_PROGRESS 0x0404
+#define SCSI_SNSCODE_HARDWARE_IMPENDING_FAILURE 0x5d10
+#define SCSI_SNSCODE_LOW_POWER_CONDITION_ON 0x5e00
+#define SCSI_SNSCODE_LOGICAL_UNIT_NOT_READY_INIT_REQUIRED 0x0402
+#define SCSI_SNSCODE_INVALID_FIELD_PARAMETER_LIST 0x2600
+#define SCSI_SNSCODE_ATA_DEVICE_FAILED_SET_FEATURES 0x4471
+#define SCSI_SNSCODE_ATA_DEVICE_FEATURE_NOT_ENABLED 0x670B
+#define SCSI_SNSCODE_LOGICAL_UNIT_FAILED_SELF_TEST 0x3E03
+#define SCSI_SNSCODE_COMMAND_SEQUENCE_ERROR 0x2C00
+#define SCSI_SNSCODE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x2100
+#define SCSI_SNSCODE_LOGICAL_UNIT_FAILURE 0x3E01
+#define SCSI_SNSCODE_MEDIA_LOAD_OR_EJECT_FAILED 0x5300
+#define SCSI_SNSCODE_LOGICAL_UNIT_NOT_READY_INITIALIZING_COMMAND_REQUIRED 0x0402
+#define SCSI_SNSCODE_LOGICAL_UNIT_NOT_READY_CAUSE_NOT_REPORTABLE 0x0400
+#define SCSI_SNSCODE_LOGICAL_UNIT_DOES_NOT_RESPOND_TO_SELECTION 0x0500
+#define SCSI_SNSCODE_DIAGNOSTIC_FAILURE_ON_COMPONENT_NN 0x4000
+#define SCSI_SNSCODE_COMMANDS_CLEARED_BY_ANOTHER_INITIATOR 0x2F00
+#define SCSI_SNSCODE_WRITE_ERROR_AUTO_REALLOCATION_FAILED 0x0C02
+/*****************************************************************************
+** SCSI Additional Sense Codes and Qualifiers saparate bytes
+*****************************************************************************/
+
+#define SCSI_ASC_NOTREADY_INIT_CMD_REQ 0x04
+#define SCSI_ASCQ_NOTREADY_INIT_CMD_REQ 0x02
+
+
+/*****************************************************************************
+** Inquiry command fields and response sizes
+*****************************************************************************/
+#define SCSIOP_INQUIRY_CMDDT 0x02
+#define SCSIOP_INQUIRY_EVPD 0x01
+#define STANDARD_INQUIRY_SIZE 36
+#define SATA_PAGE83_INQUIRY_WWN_SIZE 16 /* SAT, revision8, Table81, p78, 12 + 4 */
+#define SATA_PAGE83_INQUIRY_NO_WWN_SIZE 76 /* SAT, revision8, Table81, p78, 72 + 4 */
+#define SATA_PAGE89_INQUIRY_SIZE 572 /* SAT, revision8, Table87, p84 */
+#define SATA_PAGE0_INQUIRY_SIZE 8 /* SPC-4, 7.6.9 Table331, p345 */
+#define SATA_PAGE80_INQUIRY_SIZE 24 /* SAT, revision8, Table79, p77 */
+
+
+/* not sure here */
+/* define byte swap macro */
+#define AGSA_FLIP_2_BYTES(_x) ((bit16)(((((bit16)(_x))&0x00FF)<<8)| \
+ ((((bit16)(_x))&0xFF00)>>8)))
+
+#define AGSA_FLIP_4_BYTES(_x) ((bit32)(((((bit32)(_x))&0x000000FF)<<24)| \
+ ((((bit32)(_x))&0x0000FF00)<<8)| \
+ ((((bit32)(_x))&0x00FF0000)>>8)| \
+ ((((bit32)(_x))&0xFF000000)>>24)))
+
+
+/*********************************************************************
+** BUFFER CONVERTION MACROS
+*********************************************************************/
+
+/*********************************************************************
+* CPU buffer access macro *
+* *
+*/
+
+#define OSSA_OFFSET_OF(STRUCT_TYPE, FEILD) \
+ (bitptr)&(((STRUCT_TYPE *)0)->FEILD)
+
+
+#if defined(SA_CPU_LITTLE_ENDIAN)
+
+#define OSSA_WRITE_LE_16(AGROOT, DMA_ADDR, OFFSET, VALUE16) \
+ (*((bit16 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit16)(VALUE16);
+
+#define OSSA_WRITE_LE_32(AGROOT, DMA_ADDR, OFFSET, VALUE32) \
+ (*((bit32 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit32)(VALUE32);
+
+#define OSSA_READ_LE_16(AGROOT, ADDR16, DMA_ADDR, OFFSET) \
+ (*((bit16 *)ADDR16)) = (*((bit16 *)(((bit8 *)DMA_ADDR)+(OFFSET))))
+
+#define OSSA_READ_LE_32(AGROOT, ADDR32, DMA_ADDR, OFFSET) \
+ (*((bit32 *)ADDR32)) = (*((bit32 *)(((bit8 *)DMA_ADDR)+(OFFSET))))
+
+#define OSSA_WRITE_BE_16(AGROOT, DMA_ADDR, OFFSET, VALUE16) \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit8)((((bit16)VALUE16)>>8)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))) = (bit8)(((bit16)VALUE16)&0xFF);
+
+#define OSSA_WRITE_BE_32(AGROOT, DMA_ADDR, OFFSET, VALUE32) \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit8)((((bit32)VALUE32)>>24)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))) = (bit8)((((bit32)VALUE32)>>16)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+2))) = (bit8)((((bit32)VALUE32)>>8)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+3))) = (bit8)(((bit32)VALUE32)&0xFF);
+
+#define OSSA_READ_BE_16(AGROOT, ADDR16, DMA_ADDR, OFFSET) \
+ (*(bit8 *)(((bit8 *)ADDR16)+1)) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))); \
+ (*(bit8 *)(((bit8 *)ADDR16))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1)));
+
+#define OSSA_READ_BE_32(AGROOT, ADDR32, DMA_ADDR, OFFSET) \
+ (*(bit8 *)(((bit8 *)ADDR32)+3)) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))); \
+ (*(bit8 *)(((bit8 *)ADDR32)+2)) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))); \
+ (*(bit8 *)(((bit8 *)ADDR32)+1)) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+2))); \
+ (*(bit8 *)(((bit8 *)ADDR32))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+3)));
+
+#define OSSA_WRITE_BYTE_STRING(AGROOT, DEST_ADDR, SRC_ADDR, LEN) \
+ si_memcpy(DEST_ADDR, SRC_ADDR, LEN);
+
+
+#elif defined(SA_CPU_BIG_ENDIAN)
+
+#define OSSA_WRITE_LE_16(AGROOT, DMA_ADDR, OFFSET, VALUE16) \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))) = (bit8)((((bit16)VALUE16)>>8)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit8)(((bit16)VALUE16)&0xFF);
+
+#define OSSA_WRITE_LE_32(AGROOT, DMA_ADDR, OFFSET, VALUE32) \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+3))) = (bit8)((((bit32)VALUE32)>>24)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+2))) = (bit8)((((bit32)VALUE32)>>16)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))) = (bit8)((((bit32)VALUE32)>>8)&0xFF); \
+ (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit8)(((bit32)VALUE32)&0xFF);
+
+#define OSSA_READ_LE_16(AGROOT, ADDR16, DMA_ADDR, OFFSET) \
+ (*(bit8 *)(((bit8 *)ADDR16)+1)) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))); \
+ (*(bit8 *)(((bit8 *)ADDR16))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1)));
+
+#define OSSA_READ_LE_32(AGROOT, ADDR32, DMA_ADDR, OFFSET) \
+ (*((bit8 *)(((bit8 *)ADDR32)+3))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)))); \
+ (*((bit8 *)(((bit8 *)ADDR32)+2))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+1))); \
+ (*((bit8 *)(((bit8 *)ADDR32)+1))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+2))); \
+ (*((bit8 *)(((bit8 *)ADDR32)))) = (*((bit8 *)(((bit8 *)DMA_ADDR)+(OFFSET)+3)));
+
+#define OSSA_WRITE_BE_16(AGROOT, DMA_ADDR, OFFSET, VALUE16) \
+ (*((bit16 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit16)(VALUE16);
+
+#define OSSA_WRITE_BE_32(AGROOT, DMA_ADDR, OFFSET, VALUE32) \
+ (*((bit32 *)(((bit8 *)DMA_ADDR)+(OFFSET)))) = (bit32)(VALUE32);
+
+#define OSSA_READ_BE_16(AGROOT, ADDR16, DMA_ADDR, OFFSET) \
+ (*((bit16 *)ADDR16)) = (*((bit16 *)(((bit8 *)DMA_ADDR)+(OFFSET))));
+
+#define OSSA_READ_BE_32(AGROOT, ADDR32, DMA_ADDR, OFFSET) \
+ (*((bit32 *)ADDR32)) = (*((bit32 *)(((bit8 *)DMA_ADDR)+(OFFSET))));
+
+#define OSSA_WRITE_BYTE_STRING(AGROOT, DEST_ADDR, SRC_ADDR, LEN) \
+ si_memcpy(DEST_ADDR, SRC_ADDR, LEN);
+
+#else
+
+#error (Host CPU endianess undefined!!)
+
+#endif
+
+
+#if defined(SA_CPU_LITTLE_ENDIAN)
+
+#ifndef LEBIT16_TO_BIT16
+#define LEBIT16_TO_BIT16(_x) (_x)
+#endif
+
+#ifndef BIT16_TO_LEBIT16
+#define BIT16_TO_LEBIT16(_x) (_x)
+#endif
+
+#ifndef BIT16_TO_BEBIT16
+#define BIT16_TO_BEBIT16(_x) AGSA_FLIP_2_BYTES(_x)
+#endif
+
+#ifndef BEBIT16_TO_BIT16
+#define BEBIT16_TO_BIT16(_x) AGSA_FLIP_2_BYTES(_x)
+#endif
+
+#ifndef LEBIT32_TO_BIT32
+#define LEBIT32_TO_BIT32(_x) (_x)
+#endif
+
+#ifndef BIT32_TO_LEBIT32
+#define BIT32_TO_LEBIT32(_x) (_x)
+#endif
+
+
+#ifndef BEBIT32_TO_BIT32
+#define BEBIT32_TO_BIT32(_x) AGSA_FLIP_4_BYTES(_x)
+#endif
+
+#ifndef BIT32_TO_BEBIT32
+#define BIT32_TO_BEBIT32(_x) AGSA_FLIP_4_BYTES(_x)
+#endif
+
+#elif defined(SA_CPU_BIG_ENDIAN)
+
+#ifndef LEBIT16_TO_BIT16
+#define LEBIT16_TO_BIT16(_x) AGSA_FLIP_2_BYTES(_x)
+#endif
+
+#ifndef BIT16_TO_LEBIT16
+#define BIT16_TO_LEBIT16(_x) AGSA_FLIP_2_BYTES(_x)
+#endif
+
+#ifndef BIT16_TO_BEBIT16
+#define BIT16_TO_BEBIT16(_x) (_x)
+#endif
+
+#ifndef BEBIT16_TO_BIT16
+#define BEBIT16_TO_BIT16(_x) (_x)
+#endif
+
+#ifndef LEBIT32_TO_BIT32
+#define LEBIT32_TO_BIT32(_x) AGSA_FLIP_4_BYTES(_x)
+#endif
+
+#ifndef BIT32_TO_LEBIT32
+#define BIT32_TO_LEBIT32(_x) AGSA_FLIP_4_BYTES(_x)
+#endif
+
+#ifndef BEBIT32_TO_BIT32
+#define BEBIT32_TO_BIT32(_x) (_x)
+#endif
+
+#ifndef BIT32_TO_BEBIT32
+#define BIT32_TO_BEBIT32(_x) (_x)
+#endif
+
+#else
+
+#error No definition of SA_CPU_BIG_ENDIAN or SA_CPU_LITTLE_ENDIAN
+
+#endif
+
+
+#define TargetUnknown 0
+#define TargetRead 1
+#define TargetWrite 2
+
+
+#define CDB_GRP_MASK 0xE0 /* 1110 0000 */
+#define CDB_6BYTE 0x00
+#define CDB_10BYTE1 0x20
+#define CDB_10BYTE2 0x40
+#define CDB_12BYTE 0xA0
+#define CDB_16BYTE 0x80
+
+/* ATA device type */
+#define SATA_ATA_DEVICE 0x01 /**< ATA ATA device type */
+#define SATA_ATAPI_DEVICE 0x02 /**< ATA ATAPI device type */
+#define SATA_PM_DEVICE 0x03 /**< ATA PM device type */
+#define SATA_SEMB_DEVICE 0x04 /**< ATA SEMB device type */
+#define SATA_SEMB_WO_SEP_DEVICE 0x05 /**< ATA SEMB without SEP device type */
+#define UNKNOWN_DEVICE 0xFF
+
+/****************************************************************
+ * SATA Specification related defines *
+ ****************************************************************/
+#define SATA_MAX_QUEUED_COMMANDS 32
+#define SATA_MAX_PM_PORTS 15
+
+
+/* PMC IOCTL signature */
+#define PMC_IOCTL_SIGNATURE 0x1234
+
+
+
+/*
+ * FIS type
+ */
+#define PIO_SETUP_DEV_TO_HOST_FIS 0x5F
+#define REG_DEV_TO_HOST_FIS 0x34
+#define SET_DEV_BITS_FIS 0xA1
+
+#define TD_ASSERT OS_ASSERT
+
+#ifdef TD_DISCOVER
+#define TDSA_DISCOVERY_OPTION_FULL_START 0
+#define TDSA_DISCOVERY_OPTION_INCREMENTAL_START 1
+#define TDSA_DISCOVERY_OPTION_ABORT 2
+
+#define TDSA_DISCOVERY_TYPE_SAS 0
+#define TDSA_DISCOVERY_TYPE_SATA 1
+
+
+#define DISCOVERY_TIMER_VALUE (2 * 1000 * 1000) /* 2 seconds */
+#define DISCOVERY_RETRIES 3
+#define CONFIGURE_ROUTE_TIMER_VALUE (1 * 1000 * 1000) /* 1 seconds */
+#define DEVICE_REGISTRATION_TIMER_VALUE (2 * 1000 * 1000) /* 2 seconds */
+#define SMP_RETRIES 5
+#define SMP_BUSY_TIMER_VALUE (1 * 1000 * 1000) /* 1 second */
+#define SMP_BUSY_RETRIES 5
+#define SATA_ID_DEVICE_DATA_TIMER_VALUE (3 * 1000 * 1000) /* 3 second */
+#define SATA_ID_DEVICE_DATA_RETRIES 3
+#define BC_TIMER_VALUE (5 * 1000 * 1000 ) /* 5 second */
+#define SMP_TIMER_VALUE (10 * 1000 * 1000) /* 10 second */
+
+#endif
+#define STP_DEVICE_TYPE 0 /* SATA behind expander 00*/
+#define SAS_DEVICE_TYPE 1 /* SSP or SMP 01 */
+#define SATA_DEVICE_TYPE 2 /* direct SATA 10 */
+
+#define ATAPI_DEVICE_FLAG 0x200000 /* ATAPI device flag*/
+
+#define TD_INTERNAL_TM_RESET 0xFF
+
+/* in terms of Kbytes*/
+#define HOST_EVENT_LOG_SIZE 128
+#define DEFAULT_EVENT_LOG_OPTION 3
+
+/* Device state */
+#define SAT_DEV_STATE_NORMAL 0 /* Normal */
+#define SAT_DEV_STATE_IN_RECOVERY 1 /* SAT in recovery mode */
+#define SAT_DEV_STATE_FORMAT_IN_PROGRESS 2 /* Format unit in progress */
+#define SAT_DEV_STATE_SMART_THRESHOLD 3 /* SMART Threshold Exceeded Condition*/
+#define SAT_DEV_STATE_LOW_POWER 4 /* Low Power State*/
+
+#define TD_GET_PHY_ID(input) (input & 0x0F)
+#define TD_GET_PHY_NUMS(input) ((input & 0xF0) >> 4)
+#define TD_GET_LINK_RATE(input) ((input & 0xFF00) >> 8)
+#define TD_GET_PORT_STATE(input) ((input & 0xF0000) >> 16)
+#define TD_GET_PHY_STATUS(input) ((input & 0xFF00) >> 8)
+#define TD_GET_RESET_STATUS(input) ((input & 0xFF00) >> 8)
+
+#define TD_MAX_NUM_NOTIFY_SPINUP 20
+
+#define SPC_VPD_SIGNATURE 0xFEDCBA98
+
+#define TD_GET_FRAME_TYPE(input) (input & 0xFF)
+#define TD_GET_TLR(input) ((input & 0x300) >> 8)
+
+/* PORT RESET TMO is in 100ms */
+#define SAS_PORT_RESET_TMO 3 /* 300 ms */
+#define SATA_PORT_RESET_TMO 80 /* 8000 ms = 8 sec */
+#define SAS_12G_PORT_RESET_TMO 8 /* 800 ms */
+
+/* task attribute based on sTSDK API */
+#define TD_TASK_SIMPLE 0x0 /* Simple */
+#define TD_TASK_ORDERED 0x2 /* Ordered */
+#define TD_TASK_HEAD_OF_QUEUE 0x1 /* Head of Queue */
+#define TD_TASK_ACA 0x4 /* ACA */
+
+/* compiler flag for direct smp */
+#define DIRECT_SMP
+//#undef DIRECT_SMP
+
+#define CONFIGURE_FW_MAX_PORTS 0x20000000
+
+#define NO_ACK 0xFFFF
+
+#define OPEN_RETRY_RETRIES 10
+
+#ifdef AGTIAPI_CTL
+/* scsi command/page */
+#define MODE_SELECT 0x15
+#define PAGE_FORMAT 0x10
+#define DR_MODE_PG_SZ 16
+#define DR_MODE_PG_CODE 0x02
+#define DR_MODE_PG_LENGTH 0x0e
+#endif /* AGTIAPI_CTL */
+
+enum td_locks_e
+{
+ /* for tdsaAllShared->FreeDeviceList, tdsaAllShared->MainDeviceList,
+ oneDeviceData->MainLink, oneDeviceData->FreeLink */
+ TD_DEVICE_LOCK,
+ /* for tdsaAllShared->FreePortContextList, tdsaAllShared->MainPortContextList,
+ onePortContext->MainLink, onePortContext->FreeLink */
+ TD_PORT_LOCK,
+ /* for onePortContext->discovery.discoveringExpanderList,
+ onePortContext->discovery.UpdiscoveringExpanderList,
+ tdsaAllShared->freeExpanderList */
+ TD_DISC_LOCK,
+ /* for onePortContext->discovery.DiscoverySMPTimer,
+ oneDeviceData->SATAIDDeviceTimer, discovery->discoveryTimer,
+ discovery->SMPBusyTimer, discovery->BCTimer,
+ discovery->deviceRegistrationTimer, discovery->configureRouteTimer,
+ tdsaAllShared->itdsaIni->timerlist, tdsaAllShared->timerlist */
+ TD_TIMER_LOCK,
+#ifdef INITIATOR_DRIVER
+ /* for tdsaAllShared->pEsglAllInfo->freelist
+ tdsaAllShared->pEsglAllInfo->NumFreeEsglPages
+ tdsaAllShared->pEsglPageInfo->tdlist */
+ TD_ESGL_LOCK,
+ /* for satIOContext->pSatDevData->satVerifyState,
+ satIOContext->pSatDevData->satSectorDone,
+ satIOContext->pSatDevData->satPendingNCQIO,
+ satIOContext->pSatDevData->satPendingIO,
+ satIOContext->pSatDevData->satPendingNONNCQIO,
+ satIOContext->pSatDevData->satFreeIntIoLinkList,
+ satIOContext->pSatDevData->satActiveIntIoLinkList,
+ satIOContext->pSatDevData->freeSATAFDMATagBitmap,
+ satIOContext->satIoContextLink,
+ oneDeviceData->satDevData.satIoLinkList */
+ TD_SATA_LOCK,
+#ifdef TD_INT_COALESCE
+ /* for tdsaIntCoalCxt->FreeLink, tdsaIntCoalCxt->MainLink,
+ tdsaIntCoalCxtHead->FreeLink, tdsaIntCoalCxtHead->MainLink */
+ TD_INTCOAL_LOCK,
+#endif
+#endif
+#ifdef TARGET_DRIVER
+ /* for tdsaAllShared->ttdsaTgt->ttdsaXchgData.xchgFreeList,
+ tdsaAllShared->ttdsaTgt->ttdsaXchgData.xchgBusyList */
+ TD_TGT_LOCK,
+#endif
+ TD_MAX_LOCKS
+};
+
+#define TD_GET_SAS_ADDRESSLO(sasAddressLo) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)sasAddressLo)
+
+#define TD_GET_SAS_ADDRESSHI(sasAddressHi) \
+ DMA_BEBIT32_TO_BIT32(*(bit32 *)sasAddressHi)
+
+#define TD_XFER_RDY_PRIORTY_DEVICE_FLAG (1 << 22)
+
+
+#ifdef FDS_DM
+/* bit32 -> bit8 array[4] */
+#define PORTINFO_PUT_SAS_LOCAL_ADDRESSLO(portInfo, src32) \
+ *(bit32 *)((portInfo)->sasLocalAddressLo) = BIT32_TO_DMA_BEBIT32(src32)
+
+#define PORTINFO_PUT_SAS_LOCAL_ADDRESSHI(portInfo, src32) \
+ *(bit32 *)((portInfo)->sasLocalAddressHi) = BIT32_TO_DMA_BEBIT32(src32)
+/* bit32 -> bit8 array[4] */
+#define PORTINFO_PUT_SAS_REMOTE_ADDRESSLO(portInfo, src32) \
+ *(bit32 *)((portInfo)->sasRemoteAddressLo) = BIT32_TO_DMA_BEBIT32(src32)
+#define PORTINFO_PUT_SAS_REMOTE_ADDRESSHI(portInfo, src32) \
+ *(bit32 *)((portInfo)->sasRemoteAddressHi) = BIT32_TO_DMA_BEBIT32(src32)
+#endif /* FDS_DM */
+
+#ifdef FDS_SM
+/* this applies to ID data and all other SATA IOs */
+#define SM_RETRIES 10
+#endif
+
+#define TI_TIROOT_TO_tdsaRoot(t_r) (((tdsaRoot_t *)((tiRoot_t *)t_r)->tdData) )
+
+#define TI_TIROOT_TO_tdsaAllShared(t_r1) (tdsaContext_t *)&(t_r1->tdsaAllShared)
+
+#define TI_TIROOT_TO_agroot(t_r2) (agsaRoot_t *)&((t_r2)->agRootNonInt)
+
+
+#define TI_TIROOT_TO_AGROOT(t_root) (TI_TIROOT_TO_agroot(TI_TIROOT_TO_tdsaAllShared(TI_TIROOT_TO_tdsaRoot(t_root)) ))
+
+#define TI_VEN_DEV_SPC 0x80010000
+#define TI_VEN_DEV_SPCADAP 0x80810000
+#define TI_VEN_DEV_SPCv 0x80080000
+#define TI_VEN_DEV_SPCve 0x80090000
+#define TI_VEN_DEV_SPCvplus 0x80180000
+#define TI_VEN_DEV_SPCveplus 0x80190000
+#define TI_VEN_DEV_SPCADAPvplus 0x80880000
+#define TI_VEN_DEV_SPCADAPveplus 0x80890000
+
+#define TI_VEN_DEV_SPC12Gv 0x80700000
+#define TI_VEN_DEV_SPC12Gve 0x80710000
+#define TI_VEN_DEV_SPC12Gvplus 0x80720000
+#define TI_VEN_DEV_SPC12Gveplus 0x80730000
+#define TI_VEN_DEV_9015 0x90150000
+#define TI_VEN_DEV_SPC12ADP 0x80740000 /* 8 ports KBP added*/
+#define TI_VEN_DEV_SPC12ADPP 0x80760000 /* 16 ports */
+#define TI_VEN_DEV_SPC12SATA 0x80060000 /* SATA HBA */
+#define TI_VEN_DEV_9060 0x90600000
+
+#define tIsSPC(agr) (TI_VEN_DEV_SPC == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC */
+#define tIsSPCHIL(agr) (TI_VEN_DEV_SPCADAP == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC */
+#define tIsSPCv(agr) (TI_VEN_DEV_SPCv == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCv */
+#define tIsSPCve(agr) (TI_VEN_DEV_SPCve == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCve */
+#define tIsSPCvplus(agr) (TI_VEN_DEV_SPCvplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCv+ */
+#define tIsSPCveplus(agr) (TI_VEN_DEV_SPCveplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCve+ */
+#define tIsSPCADAPvplus(agr) (TI_VEN_DEV_SPCADAPvplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCv+ */
+#define tIsSPCADAPveplus(agr) (TI_VEN_DEV_SPCADAPveplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPCve+ */
+
+#define tIsSPC12Gv(agr) (TI_VEN_DEV_SPC12Gv == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gv */
+#define tIsSPC12Gve(agr) (TI_VEN_DEV_SPC12Gve == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gve */
+#define tIsSPC12Gvplus(agr) (TI_VEN_DEV_SPC12Gvplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gv+ */
+#define tIsSPC12Gveplus(agr) (TI_VEN_DEV_SPC12Gveplus == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gve+ */
+#define tIsSPC9015(agr) (TI_VEN_DEV_9015 == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gve+ */
+#define tIsSPC9060(agr) (TI_VEN_DEV_9060 == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0) /* returns true config space read is SPC12Gve+ */
+#define tIsSPC12ADP(agr) (TI_VEN_DEV_SPC12ADP == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0)
+#define tIsSPC12ADPP(agr) (TI_VEN_DEV_SPC12ADPP == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0)
+#define tIsSPC12SATA(agr) (TI_VEN_DEV_SPC12SATA == (ossaHwRegReadConfig32(agr,0 ) & 0xFFFF0000) ? 1 : 0)
+
+#define tiIS_SPC(agr) (( tIsSPC((agr)) == 1) ? 1 : \
+ ( tIsSPCHIL((agr)) == 1) ? 1 : 0 )
+
+#define tiIS_HIL(agr) ((tIsSPCHIL ((agr)) == 1) ? 1 : \
+ (tIsSPCADAPvplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPveplus((agr)) == 1) ? 1 : 0 )
+
+#define tiIS_SPC6V(agr) ((tIsSPCv((agr)) == 1) ? 1 : \
+ (tIsSPCve((agr)) == 1) ? 1 : \
+ (tIsSPCvplus((agr)) == 1) ? 1 : \
+ (tIsSPCveplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPvplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPveplus((agr)) == 1) ? 1 : 0 )
+
+#define tIsSPCV12G(agr) ((tIsSPC12Gv(agr) == 1) ? 1 : \
+ (tIsSPC12Gve(agr) == 1) ? 1 : \
+ (tIsSPC12Gvplus(agr)== 1) ? 1 : \
+ (tIsSPC12Gveplus(agr)== 1) ? 1 : \
+ (tIsSPC9015(agr)== 1) ? 1 : \
+ (tIsSPC12ADP(agr)== 1) ? 1 : \
+ (tIsSPC12ADPP(agr)== 1) ? 1 : \
+ (tIsSPC12SATA(agr) == 1) ? 1 : \
+ (tIsSPC9060(agr) == 1) ? 1 : 0)
+
+#define tiIS_8PHY(agr) ((tIsSPCv((agr)) == 1) ? 1 : \
+ (tIsSPCve((agr)) == 1) ? 1 : \
+ (tIsSPC12Gv((agr)) == 1) ? 1 : \
+ (tIsSPC12Gve((agr)) == 1) ? 1 : \
+ (tIsSPC12ADP(agr) == 1) ? 1 : 0 )
+
+#define tiIS_16PHY(agr) ((tIsSPCvplus((agr)) == 1) ? 1 : \
+ (tIsSPCveplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPvplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPveplus((agr)) == 1) ? 1 : \
+ (tIsSPC12ADPP(agr) == 1) ? 1 : \
+ (tIsSPC12SATA(agr) == 1) ? 1 : 0 )
+
+#define tiIS_SPC_ENC(agr)((tIsSPCve((agr)) == 1) ? 1 : \
+ (tIsSPCveplus((agr)) == 1) ? 1 : \
+ (tIsSPCADAPveplus((agr)) == 1) ? 1 : 0 )
+
+#define tIsSPCV12or6G(agr) ((tiIS_SPC6V(agr) == 1) ? 1 : \
+ (tIsSPCV12G(agr) == 1) ? 1 : 0)
+
+#endif /* __TDDEFS_H__ */
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tddmcmnapi.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tddmcmnapi.c
new file mode 100644
index 0000000..55f9032
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tddmcmnapi.c
@@ -0,0 +1,1300 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+
+********************************************************************************/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+/* for TIDEBUG_MSG */
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_DM
+
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#endif
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+#if defined(DM_DEBUG)
+extern bit32 gDMDebugLevel;
+#endif
+
+osGLOBAL bit32
+tddmRotateQnumber(
+ dmRoot_t *dmRoot,
+ agsaDevHandle_t *agDevHandle
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ TI_DBG1(("tddmRotateQnumber: start\n"));
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG1(("tddmRotateQnumber: agDevHandle is NULL!!!\n"));
+ return 0;
+ }
+ oneDeviceData = (tdsaDeviceData_t *)agDevHandle->osData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmRotateQnumber: oneDeviceData is NULL!!!\n"));
+ return 0;
+ }
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tddmRotateQnumber: tdsaRoot is NULL\n"));
+ return 0;
+ }
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tddmRotateQnumber: tdsaAllShared is NULL\n"));
+ return 0;
+ }
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tddmRotateQnumber: tiRoot is NULL\n"));
+ return 0;
+ }
+ return tdsaRotateQnumber(tiRoot, oneDeviceData);
+}
+osGLOBAL bit32
+tdsaFindLocalMCN(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ bit32 i, localMCN = 0;
+
+ TI_DBG2(("tdsaFindLocalMCN: start\n"));
+
+ if (onePortContext->valid == agFALSE)
+ {
+ TI_DBG1(("tdsaFindLocalMCN: invalid portcontext id %d\n", onePortContext->id));
+ return 0;
+ }
+
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ localMCN++;
+ }
+ }
+
+ return localMCN;
+}
+
+
+/*
+ on success,
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscOK,
+ agNULL
+ );
+else
+ remove(de-register) all devices
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+
+
+ dmRoot->tdData is tdsaRoot_t (just like current TD layer)
+ dmPortContext->tdData is tdsaPortContext_t
+
+*/
+osGLOBAL void
+tddmDiscoverCB(
+ dmRoot_t *dmRoot,
+ dmPortContext_t *dmPortContext,
+ bit32 eventStatus
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdsaPortContext_t *onePortContext;
+ agsaRoot_t *agRoot;
+ agsaPortContext_t *agPortContext;
+
+ TI_DBG1(("tddmDiscoverCB: start\n"));
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: tiRoot is NULL\n"));
+ return;
+ }
+
+ onePortContext = (tdsaPortContext_t *)dmPortContext->tdData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: onePortContext is NULL\n"));
+ return;
+ }
+
+ TI_DBG2(("tddmDiscoverCB: localMCN 0x%x\n", tdsaFindLocalMCN(tiRoot, onePortContext)));
+
+ if (eventStatus == dmDiscCompleted)
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscCompleted\n"));
+ onePortContext->DiscoveryState = ITD_DSTATE_COMPLETED;
+ onePortContext->DMDiscoveryState = dmDiscCompleted;
+ TI_DBG1(("tddmDiscoverCB: pid %d tiPortalContext %p\n", onePortContext->id, onePortContext->tiPortalContext));
+
+ /* update onePortContext->UpdateMCN = agFALSE */
+ if ( onePortContext->UpdateMCN == agTRUE)
+ {
+ TI_DBG2(("tddmDiscoverCB: calling tdsaUpdateMCN\n"));
+ onePortContext->UpdateMCN = agFALSE;
+ tdsaUpdateMCN(dmRoot, onePortContext);
+ }
+
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscOK,
+ agNULL
+ );
+ }
+ else if (eventStatus == dmDiscFailed )
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscFailed \n"));
+ onePortContext->DiscoveryState = ITD_DSTATE_COMPLETED;
+ onePortContext->DMDiscoveryState = dmDiscFailed;
+ TI_DBG1(("tddmDiscoverCB: pid %d tiPortalContext %p\n", onePortContext->id, onePortContext->tiPortalContext));
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ if (agRoot == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: agRoot is NULL\n"));
+ return;
+ }
+ agPortContext = onePortContext->agPortContext;
+ if (agPortContext == agNULL)
+ {
+ TI_DBG1(("tddmDiscoverCB: agPortContext is NULL\n"));
+ return;
+ }
+ /*
+ invalidate all devices in this port
+ */
+ tddmInvalidateDevicesInPort(tiRoot, onePortContext);
+
+ saPortControl(agRoot,
+ agNULL,
+ 0,
+ agPortContext,
+ AGSA_PORT_IO_ABORT,
+ 0 /*quarantine */,
+ 0 /* unused */);
+
+
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDiscovery,
+ tiDiscFailed,
+ agNULL
+ );
+ }
+ else if (eventStatus == dmDiscAborted )
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscAborted \n"));
+ onePortContext->DMDiscoveryState = dmDiscAborted;
+ }
+ else if (eventStatus == dmDiscAbortFailed )
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscAbortFailed \n"));
+ onePortContext->DMDiscoveryState = dmDiscAbortFailed;
+ }
+ else if (eventStatus == dmDiscAbortInvalid )
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscAbortInvalid \n"));
+ onePortContext->DMDiscoveryState = dmDiscAbortInvalid;
+ }
+ else if (eventStatus == dmDiscAbortInProgress )
+ {
+ TI_DBG1(("tddmDiscoverCB: dmDiscAbortInProgress \n"));
+ onePortContext->DMDiscoveryState = dmDiscAbortInProgress;
+ }
+ else
+ {
+ TI_DBG1(("tddmDiscoverCB: undefined eventStatus 0x%x\n", eventStatus));
+ onePortContext->DMDiscoveryState = dmDiscFailed;
+ }
+
+ return;
+}
+
+
+osGLOBAL void
+tddmQueryDiscoveryCB(
+ dmRoot_t *dmRoot,
+ dmPortContext_t *dmPortContext,
+ bit32 discType,
+ bit32 discState
+ )
+{
+ tdsaPortContext_t *onePortContext = agNULL;
+
+ TI_DBG2(("tddmQueryDiscoveryCB: start\n"));
+ onePortContext = (tdsaPortContext_t *)dmPortContext->tdData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tddmQueryDiscoveryCB: onePortContext is NULL\n"));
+ return;
+ }
+ TI_DBG2(("tddmQueryDiscoveryCB: discType %d discState %d\n", discType, discState));
+
+ onePortContext->DMDiscoveryState = discState;
+ return;
+}
+
+osGLOBAL void
+tddmInvalidateDevicesInPort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+
+ TI_DBG1(("tddmInvalidateDevicesInPort: start\n"));
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmInvalidateDevicesInPort: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if ((oneDeviceData->registered == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+
+ TI_DBG3(("tddmInvalidateDevicesInPort: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ if (oneDeviceData->SASAddressID.sasAddressHi == onePortContext->sasRemoteAddressHi &&
+ oneDeviceData->SASAddressID.sasAddressLo == onePortContext->sasRemoteAddressLo
+ )
+ {
+ TI_DBG1(("tddmInvalidateDevicesInPort: keeping\n"));
+ oneDeviceData->valid = agTRUE;
+ oneDeviceData->valid2 = agFALSE;
+ }
+ else if (oneDeviceData->valid == agTRUE)
+ {
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ oneDeviceData->registered = agFALSE;
+ }
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ TI_DBG3(("tddmInvalidateDevicesInPort: end\n"));
+
+ return;
+}
+
+osGLOBAL bit32
+tddmNewSASorNot(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ bit32 ret = agTRUE;
+
+ TI_DBG3(("tddmNewSASorNot: start\n"));
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmNewSASorNot: oneDeviceData is NULL!!!\n"));
+ return agFALSE;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->registered == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG3(("tddmNewSASorNot: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ ret = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+
+
+ TI_DBG3(("tddmNewSASorNot: end\n"));
+
+ return ret;
+}
+
+osGLOBAL tdsaDeviceData_t *
+tddmPortSASDeviceFind(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 sasAddrLo,
+ bit32 sasAddrHi
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData, *RetDeviceData=agNULL;
+ tdList_t *DeviceListList;
+
+ TI_DBG2(("tddmPortSASDeviceFind: start\n"));
+
+ TD_ASSERT((agNULL != tiRoot), "");
+ TD_ASSERT((agNULL != onePortContext), "");
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmPortSASDeviceFind: oneDeviceData is NULL!!!\n"));
+ return agNULL;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == sasAddrHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == sasAddrLo) &&
+ (oneDeviceData->valid == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG2(("tddmPortSASDeviceFind: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ TI_DBG2(("tddmPortSASDeviceFind: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG2(("tddmPortSASDeviceFind: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ RetDeviceData = oneDeviceData;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+
+ return RetDeviceData;
+}
+
+/* not in use yet */
+osGLOBAL tdsaDeviceData_t *
+tddmAddToSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 new_device = agTRUE;
+
+ TI_DBG1(("tddmAddToSharedcontext: start\n"));
+
+ TI_DBG1(("tddmAddToSharedcontext: oneportContext ID %d\n", onePortContext->id));
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmAddToSharedcontext: oneDeviceData is NULL!!!\n"));
+ return agNULL;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG1(("tddmAddToSharedcontext: pid %dtddmAddToSharedcontext did %d\n", onePortContext->id, oneDeviceData->id));
+ new_device = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ /* new device */
+ if (new_device == agTRUE)
+ {
+ TI_DBG1(("tddmAddToSharedcontext: new device\n"));
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG1(("tddmAddToSharedcontext: empty DeviceData FreeLink\n"));
+ return agNULL;
+ }
+
+ TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
+
+ TI_DBG1(("tddmAddToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
+
+ onePortContext->Count++;
+ oneDeviceData->agRoot = agRoot;
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+ oneDeviceData->tdPortContext = onePortContext;
+ /* handles both SAS target and STP-target, SATA-device */
+ if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ }
+ else
+ {
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ }
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ /* set phyID only when it has initial value of 0xFF */
+ if (oneDeviceData->phyID == 0xFF)
+ {
+ oneDeviceData->phyID = phyID;
+ }
+
+ oneDeviceData->valid = agTRUE;
+
+ /* add the devicedata to the portcontext */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG1(("tddmAddToSharedcontext: one case pid %d did %d \n", onePortContext->id, oneDeviceData->id));
+ TI_DBG1(("tddmAddToSharedcontext: new case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+ }
+ else /* old device */
+ {
+ TI_DBG1(("tddmAddToSharedcontext: old device\n"));
+ TI_DBG1(("tddmAddToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
+
+ oneDeviceData->agRoot = agRoot;
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+ oneDeviceData->tdPortContext = onePortContext;
+ /* handles both SAS target and STP-target, SATA-device */
+ if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ }
+ else
+ {
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ }
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ /* set phyID only when it has initial value of 0xFF */
+ if (oneDeviceData->phyID == 0xFF)
+ {
+ oneDeviceData->phyID = phyID;
+ }
+
+ oneDeviceData->valid = agTRUE;
+ TI_DBG1(("tddmAddToSharedcontext: old case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+
+ }
+ return oneDeviceData;
+
+}
+
+
+/*
+ calls saRegisterNewDevice()
+ in ossaDeviceRegistrationCB(), if an expander, register to DM
+#define DEVICE_IS_SMP_TARGET(DeviceData) \
+ (((DeviceData)->target_ssp_stp_smp & DEVICE_SMP_BIT) == DEVICE_SMP_BIT)
+*/
+osGLOBAL tdsaDeviceData_t *
+tddmPortDeviceAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ dmDeviceInfo_t *dmDeviceInfo,
+ tdsaDeviceData_t *oneExpDeviceData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdsaSASSubID_t agSASSubID;
+ bit8 phyID;
+
+ TI_DBG2(("tddmPortDeviceAdd: start\n"));
+
+
+ agSASSubID.sasAddressHi = TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi);
+ agSASSubID.sasAddressLo = TD_GET_SAS_ADDRESSLO(dmDeviceInfo->sasAddressLo);
+ agSASSubID.initiator_ssp_stp_smp = dmDeviceInfo->initiator_ssp_stp_smp;
+ agSASSubID.target_ssp_stp_smp = dmDeviceInfo->target_ssp_stp_smp;
+ phyID = (dmDeviceInfo->ext) & 0xFF;
+
+ /* old device and already registered to LL; added by link-up event */
+ if ( agFALSE == tdssNewSASorNot(
+ onePortContext->agRoot,
+ onePortContext,
+ &agSASSubID
+ )
+ )
+ {
+ /* old device and already registered to LL; added by link-up event */
+ TI_DBG2(("tddmPortDeviceAdd: OLD qqqq initiator_ssp_stp_smp %d target_ssp_stp_smp %d\n", agSASSubID.initiator_ssp_stp_smp, agSASSubID.target_ssp_stp_smp));
+ /* find the old device */
+ oneDeviceData = tdssNewAddSASToSharedcontext(
+ onePortContext->agRoot,
+ onePortContext,
+ &agSASSubID,
+ oneExpDeviceData,
+ phyID
+ );
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmPortDeviceAdd: no more device!!! oneDeviceData is null\n"));
+ }
+
+ /* If a device is allocated */
+ if ( oneDeviceData != agNULL )
+ {
+
+ TI_DBG2(("tddmPortDeviceAdd: sasAddressHi 0x%08x\n", agSASSubID.sasAddressHi));
+ TI_DBG2(("tddmPortDeviceAdd: sasAddressLo 0x%08x\n", agSASSubID.sasAddressLo));
+ TI_DBG2(("tddmPortDeviceAdd: phyID 0x%x\n", phyID));
+
+ /* copy dmDeviceInfo to oneDeviceData->agDeviceInfo except ext field */
+ oneDeviceData->agDeviceInfo.smpTimeout = dmDeviceInfo->smpTimeout;
+ oneDeviceData->agDeviceInfo.it_NexusTimeout = dmDeviceInfo->it_NexusTimeout;
+ oneDeviceData->agDeviceInfo.firstBurstSize = dmDeviceInfo->firstBurstSize;
+ oneDeviceData->agDeviceInfo.devType_S_Rate = dmDeviceInfo->devType_S_Rate;
+ osti_memcpy(&(oneDeviceData->agDeviceInfo.sasAddressHi), &(dmDeviceInfo->sasAddressHi), 4);
+ osti_memcpy(&(oneDeviceData->agDeviceInfo.sasAddressLo), &(dmDeviceInfo->sasAddressLo), 4);
+ if (dmDeviceInfo->sataDeviceType == SATA_ATAPI_DEVICE)
+ {
+ oneDeviceData->agDeviceInfo.flag |= ATAPI_DEVICE_FLAG;
+ }
+
+ oneDeviceData->satDevData.satDeviceType = dmDeviceInfo->sataDeviceType;
+
+
+
+ oneDeviceData->agContext.osData = oneDeviceData;
+ oneDeviceData->agContext.sdkData = agNULL;
+
+ }
+ return oneDeviceData;
+ } /* old device */
+
+ /* new device */
+
+ TI_DBG2(("tddmPortDeviceAdd: NEW qqqq initiator_ssp_stp_smp %d target_ssp_stp_smp %d\n", agSASSubID.initiator_ssp_stp_smp, agSASSubID.target_ssp_stp_smp));
+
+ /* allocate a new device and set the valid bit */
+ oneDeviceData = tdssNewAddSASToSharedcontext(
+ onePortContext->agRoot,
+ onePortContext,
+ &agSASSubID,
+ oneExpDeviceData,
+ phyID
+ );
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmPortDeviceAdd: no more device!!! oneDeviceData is null\n"));
+ }
+
+ /* If a device is allocated */
+ if ( oneDeviceData != agNULL )
+ {
+
+ TI_DBG2(("tddmPortDeviceAdd: sasAddressHi 0x%08x\n", agSASSubID.sasAddressHi));
+ TI_DBG2(("tddmPortDeviceAdd: sasAddressLo 0x%08x\n", agSASSubID.sasAddressLo));
+ TI_DBG2(("tddmPortDeviceAdd: phyID 0x%x\n", phyID));
+
+ /* copy dmDeviceInfo to oneDeviceData->agDeviceInfo except ext field */
+ oneDeviceData->agDeviceInfo.smpTimeout = dmDeviceInfo->smpTimeout;
+ oneDeviceData->agDeviceInfo.it_NexusTimeout = dmDeviceInfo->it_NexusTimeout;
+ oneDeviceData->agDeviceInfo.firstBurstSize = dmDeviceInfo->firstBurstSize;
+ oneDeviceData->agDeviceInfo.devType_S_Rate = dmDeviceInfo->devType_S_Rate;
+ osti_memcpy(&(oneDeviceData->agDeviceInfo.sasAddressHi), &(dmDeviceInfo->sasAddressHi), 4);
+ osti_memcpy(&(oneDeviceData->agDeviceInfo.sasAddressLo), &(dmDeviceInfo->sasAddressLo), 4);
+
+ oneDeviceData->satDevData.satDeviceType = dmDeviceInfo->sataDeviceType;
+ if (dmDeviceInfo->sataDeviceType == SATA_ATAPI_DEVICE)
+ {
+ oneDeviceData->agDeviceInfo.flag |= ATAPI_DEVICE_FLAG;
+ }
+
+ oneDeviceData->agContext.osData = oneDeviceData;
+ oneDeviceData->agContext.sdkData = agNULL;
+
+ TI_DBG2(("tddmPortDeviceAdd: did %d\n", oneDeviceData->id));
+
+ /* don't add and register initiator for T2D */
+ if ( (((oneDeviceData->initiator_ssp_stp_smp & DEVICE_SSP_BIT) == DEVICE_SSP_BIT) &&
+ ((oneDeviceData->target_ssp_stp_smp & DEVICE_SSP_BIT) != DEVICE_SSP_BIT))
+ ||
+ (((oneDeviceData->initiator_ssp_stp_smp & DEVICE_STP_BIT) == DEVICE_STP_BIT) &&
+ ((oneDeviceData->target_ssp_stp_smp & DEVICE_SSP_BIT) != DEVICE_SSP_BIT))
+ )
+ {
+ TI_DBG1(("tddmPortDeviceAdd: initiator. no add and registration\n"));
+ TI_DBG1(("tddmPortDeviceAdd: sasAddressHi 0x%08x\n", agSASSubID.sasAddressHi));
+ TI_DBG1(("tddmPortDeviceAdd: sasAddressLo 0x%08x\n", agSASSubID.sasAddressLo));
+
+ }
+ else
+ {
+ if (oneDeviceData->registered == agFALSE)
+ {
+#ifdef REMOVED
+ //temp; setting MCN to tdsaAllShared->MCN
+ oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | (tdsaAllShared->MCN << 16);
+ //end temp
+#endif
+ if( tdsaAllShared->sflag )
+ {
+ if( ! DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("tddmPortDeviceAdd: saRegisterNewDevice sflag %d\n", tdsaAllShared->sflag));
+ oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | TD_XFER_RDY_PRIORTY_DEVICE_FLAG;
+ }
+ }
+ saRegisterNewDevice( /* tddmPortDeviceAdd */
+ onePortContext->agRoot,
+ &oneDeviceData->agContext,
+ 0,
+ &oneDeviceData->agDeviceInfo,
+ onePortContext->agPortContext,
+ 0
+ );
+ }
+ }
+ }
+
+ return oneDeviceData;
+}
+
+
+/*
+ each call, add the device to the device list
+ typedef struct{
+ bit16 smpTimeout;
+ bit16 it_NexusTimeout;
+ bit16 firstBurstSize;
+ bit8 flag;
+ bit8 devType_S_Rate;
+ bit8 sasAddressHi[4];
+ bit8 sasAddressLo[4];
+} dmDeviceInfo_t;
+
+ find oneExpDeviceData (expander device data) from dmExpDeviceInfo and
+ pass it to tddmPortDeviceAdd()
+ start here - change spec from bit32 to void
+
+ phyID = ((dmDeviceInfo->flag) & 0xFC) >> 2;
+ Initiators are not registered
+*/
+//start here
+osGLOBAL void
+tddmReportDevice(
+ dmRoot_t *dmRoot,
+ dmPortContext_t *dmPortContext,
+ dmDeviceInfo_t *dmDeviceInfo, /* device */
+ dmDeviceInfo_t *dmExpDeviceInfo, /* expander the device is attached to */
+ bit32 flag
+
+ )
+{
+ agsaRoot_t *agRoot;
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdsaDeviceData_t *oneExpDeviceData = agNULL;
+ bit32 sasAddressHi, sasAddressLo;
+ tdsaPortContext_t *onePortContext;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ bit32 localMCN = 0, finalMCN = 0;
+ bit32 devMCN = 1;
+ bit32 DLR = 0xA;
+ bit32 option;
+ bit32 param;
+
+#ifdef FDS_SM
+ smRoot_t *smRoot;
+#endif
+
+ TI_DBG2(("tddmReportDevice: start\n"));
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: tiRoot is NULL\n"));
+ return;
+ }
+
+ onePortContext = (tdsaPortContext_t *)dmPortContext->tdData;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: onePortContext is NULL\n"));
+ return;
+ }
+
+#ifdef FDS_SM
+ smRoot = &(tdsaAllShared->smRoot);
+#endif
+
+ TI_DBG2(("tddmReportDevice: device addrHi 0x%08x addrLo 0x%08x\n",
+ TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi), TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressLo)));
+
+ if (dmExpDeviceInfo != agNULL)
+ {
+ TI_DBG2(("tddmReportDevice: attached expander addrHi 0x%08x addrLo 0x%08x\n",
+ TD_GET_SAS_ADDRESSHI(dmExpDeviceInfo->sasAddressHi), TD_GET_SAS_ADDRESSLO(dmExpDeviceInfo->sasAddressLo)));
+ }
+ else
+ {
+ TI_DBG2(("tddmReportDevice: No attached expander\n"));
+ }
+
+ /* initiators only (e.g. SPC or SPCv) are discarded */
+ if ( (dmDeviceInfo->target_ssp_stp_smp == 0) &&
+ ( DEVICE_IS_SSP_INITIATOR(dmDeviceInfo) || DEVICE_IS_STP_INITIATOR(dmDeviceInfo) || DEVICE_IS_SMP_INITIATOR(dmDeviceInfo))
+ )
+ {
+ TI_DBG3(("tddmReportDevice: Initiators are not added\n"));
+ TI_DBG3(("tddmReportDevice: device addrHi 0x%08x addrLo 0x%08x\n",
+ TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi), TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressLo)));
+ return;
+ }
+
+ if (flag == dmDeviceArrival)
+ {
+ TI_DBG2(("tddmReportDevice: arrival\n"));
+ if (dmExpDeviceInfo != agNULL)
+ {
+ sasAddressHi = TD_GET_SAS_ADDRESSHI(dmExpDeviceInfo->sasAddressHi);
+ sasAddressLo = TD_GET_SAS_ADDRESSLO(dmExpDeviceInfo->sasAddressLo);
+
+ oneExpDeviceData = tddmPortSASDeviceFind(tiRoot, onePortContext, sasAddressLo, sasAddressHi);
+ }
+
+ tddmPortDeviceAdd(tiRoot, onePortContext, dmDeviceInfo, oneExpDeviceData);
+
+ }
+ else if (flag == dmDeviceRemoval)
+ {
+ TI_DBG2(("tddmReportDevice: removal\n"));
+ sasAddressHi = TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi);
+ sasAddressLo = TD_GET_SAS_ADDRESSLO(dmDeviceInfo->sasAddressLo);
+ oneDeviceData = tddmPortSASDeviceFind(tiRoot, onePortContext, sasAddressLo, sasAddressHi);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG2(("tddmReportDevice: oneDeviceData is NULL!!!\n"));
+ }
+ else
+ {
+ /* invalidate device */
+ TI_DBG2(("tddmReportDevice: invalidating\n"));
+ TI_DBG2(("tddmReportDevice: agDevHandle %p\n", oneDeviceData->agDevHandle));
+ if ( oneDeviceData->agDevHandle != agNULL)
+ {
+ TI_DBG2(("tddmReportDevice: agDevHandle->sdkData %p\n", oneDeviceData->agDevHandle->sdkData));
+ }
+ else
+ {
+ TI_DBG2(("tddmReportDevice: agDevHandle->sdkData is NULL\n"));
+ }
+ oneDeviceData->valid = agFALSE;
+//to do; to be tested
+ agRoot = oneDeviceData->agRoot;
+ if ( (oneDeviceData->registered == agTRUE) &&
+ ( DEVICE_IS_SSP_TARGET(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData)
+ || DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_SMP_TARGET(oneDeviceData) )
+ )
+ {
+ if ( !( DEVICE_IS_SMP_TARGET(oneDeviceData) && oneDeviceData->directlyAttached == agTRUE))
+ {
+ tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ oneDeviceData->registered = agFALSE;
+ }
+ else
+ {
+ TI_DBG2(("tddmReportDevice: keeping\n"));
+ oneDeviceData->registered = agTRUE;
+ }
+ }
+ else if (oneDeviceData->registered == agTRUE)
+ {
+ if ( oneDeviceData->agDevHandle == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: agDevHandle->sdkData is NULL. Error!!! \n"));
+ }
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ oneDeviceData->registered = agFALSE;
+ }
+//to do remove
+#ifdef FDS_SM_WRONG
+ if (DEVICE_IS_SATA_DEVICE(oneDeviceData))
+ {
+ TI_DBG2(("tddmReportDevice: smDeregisterDevice\n"));
+ smDeregisterDevice(smRoot, agNULL, oneDeviceData->agDevHandle, &(oneDeviceData->smDeviceHandle));
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ }
+#endif
+ }
+ }
+ else if (flag == dmDeviceNoChange)
+ {
+ TI_DBG2(("tddmReportDevice: no change; do nothing \n"));
+#ifdef FDS_SM
+ sasAddressHi = TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi);
+ sasAddressLo = TD_GET_SAS_ADDRESSLO(dmDeviceInfo->sasAddressLo);
+ oneDeviceData = tddmPortSASDeviceFind(tiRoot, onePortContext, sasAddressLo, sasAddressHi);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG2(("tddmReportDevice: oneDeviceData is NULL!!!\n"));
+ }
+ else
+ {
+ agRoot = oneDeviceData->agRoot;
+ if ( (DEVICE_IS_SATA_DEVICE(oneDeviceData) || DEVICE_IS_STP_TARGET(oneDeviceData))
+ &&
+ oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+ tdIDStart(tiRoot, agRoot, smRoot, oneDeviceData, onePortContext);
+ }
+ }
+#endif
+ }
+ else if (flag == dmDeviceMCNChange)
+ {
+ TI_DBG2(("tddmReportDevice: dmDeviceMCNChange \n"));
+ localMCN = tdsaFindLocalMCN(tiRoot, onePortContext);
+ devMCN = DEVINFO_GET_EXT_MCN(dmDeviceInfo);
+ TI_DBG2(("tddmReportDevice: devMCN 0x%08x localMCN 0x%08x\n", devMCN, localMCN));
+
+ sasAddressHi = TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi);
+ sasAddressLo = TD_GET_SAS_ADDRESSLO(dmDeviceInfo->sasAddressLo);
+ oneDeviceData = tddmPortSASDeviceFind(tiRoot, onePortContext, sasAddressLo, sasAddressHi);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: oneDeviceData is NULL!!!\n"));
+ }
+ else
+ {
+ agRoot = oneDeviceData->agRoot;
+ oneDeviceData->devMCN = devMCN;
+ TI_DBG2(("tddmReportDevice: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", sasAddressHi, sasAddressLo));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ finalMCN = localMCN;
+ TI_DBG2(("tddmReportDevice: directlyAttached, Final MCN 0x%08x\n", finalMCN));
+ }
+ else
+ {
+ finalMCN = MIN(devMCN, localMCN);
+ TI_DBG2(("tddmReportDevice: Not directlyAttached, Final MCN 0x%08x\n", finalMCN));
+ }
+ if ( oneDeviceData->registered == agTRUE)
+ {
+ /* saSetDeviceInfo to change MCN, using finalMCN */
+ option = 8; /* setting only MCN 1000b */
+ param = finalMCN << 24;
+ TI_DBG2(("tddmReportDevice: option 0x%x param 0x%x MCN 0x%x\n", option, param, finalMCN));
+ saSetDeviceInfo(agRoot, agNULL, 0, oneDeviceData->agDevHandle, option, param, ossaSetDeviceInfoCB);
+ }
+ else
+ {
+ TI_DBG1(("tddmReportDevice: oneDeviceData is not yet registered !!!\n"));
+ }
+ oneDeviceData->finalMCN = finalMCN;
+ }
+ }
+ else if (flag == dmDeviceRateChange)
+ {
+ TI_DBG1(("tddmReportDevice: dmDeviceRateChange \n"));
+ sasAddressHi = TD_GET_SAS_ADDRESSHI(dmDeviceInfo->sasAddressHi);
+ sasAddressLo = TD_GET_SAS_ADDRESSLO(dmDeviceInfo->sasAddressLo);
+ oneDeviceData = tddmPortSASDeviceFind(tiRoot, onePortContext, sasAddressLo, sasAddressHi);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tddmReportDevice: oneDeviceData is NULL!!!\n"));
+ }
+ else
+ {
+ agRoot = oneDeviceData->agRoot;
+ if ( oneDeviceData->registered == agTRUE)
+ {
+ option = 0x20; /* bit 5 */
+ DLR = DEVINFO_GET_LINKRATE(dmDeviceInfo);
+ param = DLR << 28;
+ TI_DBG1(("tddmReportDevice: option 0x%x param 0x%x DLR 0x%x\n", option, param, DLR));
+ saSetDeviceInfo(agRoot, agNULL, 0, oneDeviceData->agDevHandle, option, param, ossaSetDeviceInfoCB);
+
+ }
+ else
+ {
+ TI_DBG1(("tddmReportDevice: oneDeviceData is not yet registered !!!\n"));
+ }
+
+ }
+ }
+ else
+ {
+ TI_DBG1(("tddmReportDevice: unknown flag 0x%x, wrong\n", flag));
+ }
+
+ return;
+}
+
+osGLOBAL void
+tdsaUpdateMCN(
+ dmRoot_t *dmRoot,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ bit32 localMCN = 0, finalMCN = 0;
+ bit32 devMCN = 1;
+ bit32 option;
+ bit32 param;
+
+ TI_DBG3(("tdsaUpdateMCN: start\n"));
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsaUpdateMCN: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsaUpdateMCN: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsaUpdateMCN: tiRoot is NULL\n"));
+ return;
+ }
+
+ if (onePortContext->valid == agFALSE)
+ {
+ TI_DBG1(("tdsaUpdateMCN: onePortContext is invalid\n"));
+ return;
+ }
+
+ TI_DBG3(("tdsaUpdateMCN: pid %d\n", onePortContext->id));
+
+ localMCN = tdsaFindLocalMCN(tiRoot, onePortContext);
+
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainDeviceList)))
+ {
+ TI_DBG1(("tdsaUpdateMCN: empty device list\n"));
+ return;
+ }
+
+ /* update directly and behind expander device */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaUpdateMCN: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ TI_DBG3(("tdsaUpdateMCN: loop did %d\n", oneDeviceData->id));
+ TI_DBG3(("tdsaUpdateMCN: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
+ devMCN = oneDeviceData->devMCN;
+ if ( oneDeviceData->tdPortContext == onePortContext)
+ {
+ if (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE && oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG3(("tdsaUpdateMCN: found directly attached\n"));
+ finalMCN = localMCN;
+ TI_DBG3(("tdsaUpdateMCN: devMCN 0x%08x localMCN 0x%08x\n", devMCN, localMCN));
+ TI_DBG3(("tdsaUpdateMCN: finalMCN 0x%08x\n", finalMCN));
+ if (oneDeviceData->finalMCN != finalMCN)
+ {
+ /* saSetDeviceInfo using finalMCN */
+ option = 8; /* setting only MCN 1000b */
+ param = finalMCN << 24;
+ TI_DBG3(("tdsaUpdateMCN: option 0x%x param 0x%x MCN 0x%x\n", option, param, finalMCN));
+ saSetDeviceInfo(oneDeviceData->agRoot, agNULL, 0, oneDeviceData->agDevHandle, option, param, ossaSetDeviceInfoCB);
+ oneDeviceData->finalMCN = finalMCN;
+ }
+
+ }
+ else if (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE && oneDeviceData->directlyAttached == agFALSE)
+ {
+ TI_DBG3(("tdsaUpdateMCN: found behind expander device\n"));
+ finalMCN = MIN(localMCN, devMCN);
+ TI_DBG3(("tdsaUpdateMCN: devMCN 0x%08x localMCN 0x%08x\n", devMCN, localMCN));
+ TI_DBG3(("tdsaUpdateMCN: finalMCN 0x%08x\n", finalMCN));
+ if (oneDeviceData->finalMCN != finalMCN)
+ {
+ /* saSetDeviceInfo using finalMCN */
+ option = 8; /* setting only MCN 1000b */
+ param = finalMCN << 24;
+ TI_DBG3(("tdsaUpdateMCN: option 0x%x param 0x%x MCN 0x%x\n", option, param, finalMCN));
+ saSetDeviceInfo(oneDeviceData->agRoot, agNULL, 0, oneDeviceData->agDevHandle, option, param, ossaSetDeviceInfoCB);
+ oneDeviceData->finalMCN = finalMCN;
+ }
+
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ else
+ {
+ if (oneDeviceData->tdPortContext != agNULL)
+ {
+ TI_DBG3(("tdsaUpdateMCN: different portcontext; oneDeviceData->tdPortContext pid %d oneportcontext pid %d\n", oneDeviceData->tdPortContext->id, onePortContext->id));
+ }
+ else
+ {
+ TI_DBG3(("tdsaUpdateMCN: different portcontext; oneDeviceData->tdPortContext pid NULL oneportcontext pid %d\n", onePortContext->id));
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ } /* while */
+
+ return;
+}
+
+osGLOBAL bit8
+tddmSATADeviceTypeDecode(bit8 * pSignature)
+{
+ return (bit8)tdssSATADeviceTypeDecode(pSignature);
+}
+
+
+osGLOBAL void
+tddmSingleThreadedEnter(
+ dmRoot_t *dmRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 offset = 0;
+
+ TI_DBG7(("tddmSingleThreadedEnter: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedEnter: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedEnter: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedEnter: tiRoot is NULL\n"));
+ return;
+ }
+ offset = tdsaAllShared->MaxNumLLLocks + tdsaAllShared->MaxNumOSLocks + TD_MAX_LOCKS;
+
+ ostiSingleThreadedEnter(tiRoot, syncLockId + offset);
+ return;
+}
+
+osGLOBAL void
+tddmSingleThreadedLeave(
+ dmRoot_t *dmRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 offset = 0;
+
+ TI_DBG7(("tddmSingleThreadedLeave: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)dmRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedLeave: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedLeave: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tddmSingleThreadedLeave: tiRoot is NULL\n"));
+ return;
+ }
+ offset = tdsaAllShared->MaxNumLLLocks + tdsaAllShared->MaxNumOSLocks + TD_MAX_LOCKS;
+
+ ostiSingleThreadedLeave(tiRoot, syncLockId + offset);
+
+ return;
+}
+
+osGLOBAL bit32 tddmGetTransportParam(
+ dmRoot_t *dmRoot,
+ char *key,
+ char *subkey1,
+ char *subkey2,
+ char *subkey3,
+ char *subkey4,
+ char *subkey5,
+ char *valueName,
+ char *buffer,
+ bit32 bufferLen,
+ bit32 *lenReceived
+ )
+{
+ bit32 ret = tiError;
+
+ TI_DBG7(("tddmGetTransportParam: start\n"));
+ ret = ostiGetTransportParam(agNULL,
+ key,
+ subkey1,
+ subkey2,
+ subkey3,
+ subkey4,
+ subkey5,
+ valueName,
+ buffer,
+ bufferLen,
+ lenReceived
+ );
+
+ return ret;
+}
+
+#endif /* FDS_DM */
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdesgl.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdesgl.c
new file mode 100644
index 0000000..3b7fc05
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdesgl.c
@@ -0,0 +1,543 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ *
+ * This file contains ESGL realted functions
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+/* no more esgl related functions */
+#ifdef REMOVED
+/*****************************************************************************
+*! \brief tdsaEsglInit
+*
+* Purpose: This function initializes the linked list of ESGL pool
+*
+* \param tiRoot: Pointer to root data structure.
+*
+* \return: None
+*
+* \note
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaEsglInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaEsglAllInfo_t *pEsglAllInfo = (tdsaEsglAllInfo_t *)&(tdsaAllShared->EsglAllInfo);
+ tdsaEsglPagePool_t *pEsglPagePool;
+
+ bit32 pageno;
+ bit32 PagePhysAddrUpper;
+ bit32 PagePhysAddrLower;
+ bit32 prev_PagePhysAddrLower;
+ tdsaEsglPageInfo_t *pEsglPageInfo;
+ void *PageVirtAddr;
+ bit32 PageSizeInBytes;
+
+ /* for memory index requirement */
+ agsaRoot_t agRoot;
+ bit32 maxSALocks = 0;
+ bit32 usecsPerTick = 0;
+ agsaSwConfig_t SwConfig;
+ agsaMemoryRequirement_t memRequirement;
+ agsaQueueConfig_t *QueueConfig;
+ bit32 i;
+
+ TI_DBG6(("tdsaEsglInit: start\n"));
+
+ tdsaGetSwConfigParams(tiRoot);
+ QueueConfig = &tdsaAllShared->QueueConfig;
+
+ for(i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ QueueConfig->inboundQueues[i].elementCount = tdsaAllShared->InboundQueueSize;
+ QueueConfig->inboundQueues[i].elementSize = tdsaAllShared->InboundQueueEleSize;
+ QueueConfig->inboundQueues[i].priority = tdsaAllShared->InboundQueuePriority[i];
+ QueueConfig->inboundQueues[i].reserved = 0;
+ }
+ for(i=0;i<QueueConfig->numOutboundQueues;i++)
+ {
+ QueueConfig->outboundQueues[i].elementCount = tdsaAllShared->OutboundQueueSize;
+ QueueConfig->outboundQueues[i].elementSize = tdsaAllShared->OutboundQueueEleSize;
+ QueueConfig->outboundQueues[i].interruptDelay = tdsaAllShared->OutboundQueueInterruptDelay[i]; /* default 0; no interrupt delay */
+ QueueConfig->outboundQueues[i].interruptCount = tdsaAllShared->OutboundQueueInterruptCount[i]; /* default 1*/
+ QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
+ }
+
+ /*
+ hardcoded Queue numbers
+ */
+ QueueConfig->sasHwEventQueue = 0;
+ QueueConfig->sataNCQErrorEventQueue = 0;
+ SwConfig.sizefEventLog1 = HOST_EVENT_LOG_SIZE;
+ SwConfig.sizefEventLog2 = HOST_EVENT_LOG_SIZE;
+ SwConfig.eventLog1Option = 0;
+ SwConfig.eventLog2Option = 0;
+ SwConfig.fatalErrorInterrtuptEnable = 1;
+ SwConfig.fatalErrorInterruptVector = 1;
+ SwConfig.reserved = 0;
+
+
+ SwConfig.param3 = (void *)&(tdsaAllShared->QueueConfig);
+ /* to find out memRequirement */
+ saGetRequirements(&agRoot, &SwConfig, &memRequirement, &usecsPerTick, &maxSALocks);
+
+ /* initializes tdsaEsglAllInfo_t */
+ pEsglAllInfo->physAddrUpper = tdsaAllShared->loResource.loLevelMem.mem[memRequirement.count].physAddrUpper;
+ pEsglAllInfo->physAddrLower = tdsaAllShared->loResource.loLevelMem.mem[memRequirement.count].physAddrLower;
+ pEsglAllInfo->virtPtr = tdsaAllShared->loResource.loLevelMem.mem[memRequirement.count].virtPtr;
+ pEsglAllInfo->NumEsglPages = tdsaAllShared->loResource.loLevelMem.mem[memRequirement.count].numElements; /* NUM_ESGL_PAGES; number of esgl pages; configurable */
+ pEsglAllInfo->EsglPageSize = tdsaAllShared->loResource.loLevelMem.mem[memRequirement.count].singleElementLength; /* sizeof(agsaEsgl_t) */
+ pEsglAllInfo->NumFreeEsglPages = pEsglAllInfo->NumEsglPages;
+ pEsglPagePool = pEsglAllInfo->EsglPagePool;
+
+ TI_DBG6(("tdsaEsglInit: pEsglPagePool %p\n", pEsglPagePool));
+ TI_DBG6(("tdsaEsglInit: tdsaAllShared->loResource.loLevelMem.mem[18].singleElementLength %d\n", tdsaAllShared->loResource.loLevelMem.mem[18].singleElementLength));
+ TI_DBG6(("tdsaEsglInit: NumEsglPage %d EsglPageSize %d\n", pEsglAllInfo->NumEsglPages, pEsglAllInfo->EsglPageSize)); /* ?, 128 */
+ TI_DBG6(("tdsaEsglInit: NumFreeEsglPages %d\n", pEsglAllInfo->NumFreeEsglPages));
+ /* initialize the linked lists */
+ TDLIST_INIT_HDR(&pEsglAllInfo->freelist);
+
+
+ PageVirtAddr = pEsglAllInfo->virtPtr;
+ PagePhysAddrUpper = pEsglAllInfo->physAddrUpper;
+ PagePhysAddrLower = pEsglAllInfo->physAddrLower;
+ PageSizeInBytes = pEsglAllInfo->EsglPageSize;
+
+ TI_DBG6(("tdsaEsglInit: PageSizeInBytes 0x%x\n", PageSizeInBytes));
+ for (pageno = 0 ; pageno < pEsglAllInfo->NumEsglPages ; pageno++)
+ {
+ pEsglPageInfo = &(pEsglPagePool->EsglPages[pageno]);
+ OSSA_WRITE_LE_32(agRoot, pEsglPageInfo, OSSA_OFFSET_OF(pEsglPageInfo, physAddressUpper), PagePhysAddrUpper);
+ OSSA_WRITE_LE_32(agRoot, pEsglPageInfo, OSSA_OFFSET_OF(pEsglPageInfo, physAddressLower), PagePhysAddrLower);
+ pEsglPageInfo->len = PageSizeInBytes;
+ /* for debugging onlye*/
+ pEsglPageInfo->id = pageno+123;
+ pEsglPageInfo->agEsgl = (agsaEsgl_t *)PageVirtAddr;
+
+ /* for debugging only */
+ TI_DBG6(("tdsaEsglInit: index %d upper 0x%8x lower 0x%8x PageVirtAddr %p\n", pageno, PagePhysAddrUpper, PagePhysAddrLower, PageVirtAddr));
+
+
+ /* updates addresses */
+ prev_PagePhysAddrLower = PagePhysAddrLower;
+ PagePhysAddrLower += pEsglAllInfo->EsglPageSize;
+ /* if lower wraps around, increment upper */
+ if (PagePhysAddrLower <= prev_PagePhysAddrLower)
+ {
+ PagePhysAddrUpper++;
+ }
+
+ if (pageno == pEsglAllInfo->NumEsglPages - 1) /* last page */
+ {
+ pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].len = 0;
+ /* set bit31 to zero */
+ CLEAR_ESGL_EXTEND(pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].extReserved);
+ }
+ else
+ {
+ /* first and so on */
+ pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].sgLower = PagePhysAddrLower;
+ pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].sgUpper = PagePhysAddrUpper;
+ pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].len = PageSizeInBytes; /* sizeof (agsaEsgl_t)*/
+ /* set bit31 to one */
+ SET_ESGL_EXTEND(pEsglPageInfo->agEsgl->descriptor[MAX_ESGL_ENTRIES-1].extReserved);
+ }
+
+ TDLIST_INIT_ELEMENT(&pEsglPageInfo->tdlist);
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&pEsglPageInfo->tdlist, &pEsglAllInfo->freelist);
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+
+ PageVirtAddr = (bit8 *)PageVirtAddr + PageSizeInBytes;
+ } /* end for */
+
+
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only, for keep now */
+ for (pageno = 0 ; pageno < pEsglAllInfo->NumEsglPages ; pageno++)
+ {
+ TI_DBG6(("tdsaEsglInit: index %d EsglPages %p\n", pageno, &pEsglPagePool->EsglPages[pageno]));
+ TI_DBG6(("tdsaEsglInit: nextupper 0x%8x nextlower 0x%8x\n", pEsglPagePool->EsglPages[pageno].agEsgl->nextPageUpper, pEsglPagePool->EsglPages[pageno].agEsgl->nextPageLower));
+ }
+ TI_DBG6(("tdsaEsglInit: tdsaEsglPageInfo_t size %d 0x%x\n", sizeof(tdsaEsglPageInfo_t), sizeof(tdsaEsglPageInfo_t)));
+ TI_DBG6(("tdsaEsglInit: sizeof(SASG_DESCRIPTOR) %d 0x%x\n", sizeof(SASG_DESCRIPTOR), sizeof(SASG_DESCRIPTOR)));
+#endif
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaGetEsglPages
+*
+* Purpose: This function prepares linked list of ESGL pages from
+* the given scatter-gather list.
+*
+* \param tiRoot: Pointer to root data structure.
+* \param EsglListHdr: pointer to list header where the list needs to be stored.
+* \param ptiSgl: Pointer to scatter-gather list.
+* \param virtSgl: virtual pointer to scatter-gather list.
+*
+* \return None
+*
+* \note -
+* 1. If we are out of ESGL pages, then no pages will be added to the list
+* pointed to by EsglListHdr. The list should be empty before calling
+* this function, so that after returning from this function, the
+* function can check for the emptyness of the list and find out if
+* any pages were added or not.
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetEsglPages(
+ tiRoot_t *tiRoot,
+ tdList_t *EsglListHdr,
+ tiSgl_t *ptiSgl,
+ tiSgl_t *virtSgl
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ tdsaEsglAllInfo_t *pEsglAllInfo = &(tdsaAllShared->EsglAllInfo);
+ bit32 numSgElements = ptiSgl->len;
+ bit32 numEntriesPerPage = MAX_ESGL_ENTRIES;
+ bit32 numPagesRequired = ((numSgElements - 1) / numEntriesPerPage) + 1;
+ bit32 i, j;
+ tdList_t *tdlist_to_fill;
+ tdsaEsglPageInfo_t *page_to_fill;
+ tiSgl_t *tmp_tiSgl = (tiSgl_t *)virtSgl;
+ agsaSgl_t *pDesc;
+ agsaEsgl_t *agEsgl, *PrevagEsgl = agNULL;
+
+ TI_DBG6(("tdsaGetEsglPages: start\n"));
+ TI_DBG6(("tdsaGetEsglPages: pEsglPagePool %p\n", pEsglAllInfo->EsglPagePool));
+ TI_DBG6(("tdsaGetEsglPages: &(pEsglAllInfo->freelist) %p\n", &pEsglAllInfo->freelist));
+ TI_DBG6(("tdsaGetEsglPages: numSgElements %d numEntriesPerPage %d\n", numSgElements, numEntriesPerPage)); /* ?, 10 */
+ TI_DBG6(("tdsaGetEsglPages: numPagesRequired %d NumFreeEsglPages %d\n", numPagesRequired, pEsglAllInfo->NumFreeEsglPages)); /* 1, 2 */
+ TI_DBG6(("tdsaGetEsglPages: free Pages %d\n", pEsglAllInfo->NumFreeEsglPages));
+
+ if (numPagesRequired > pEsglAllInfo->NumFreeEsglPages)
+ {
+ TI_DBG1(("tdsaGetEsglPages:don't have enough freepages. required %d free %d\n", numPagesRequired, pEsglAllInfo->NumFreeEsglPages));
+ return;
+ }
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ pEsglAllInfo->NumFreeEsglPages -= numPagesRequired;
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+
+
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ for (i=0; i < 2; i++)
+ {
+ /* remove one page from freelist */
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ TDLIST_DEQUEUE_FROM_HEAD(&tdlist_to_fill, &pEsglAllInfo->freelist);
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+
+ /* get the pointer to the page from list pointer */
+ page_to_fill = TDLIST_OBJECT_BASE(tdsaEsglPageInfo_t, tdlist, tdlist_to_fill);
+ /* for debugging */
+ TI_DBG6(("tdsaGetEsglPages:page ID %d\n", page_to_fill->id));
+ agEsgl = page_to_fill->agEsgl;
+
+ pDesc = (SASG_DESCRIPTOR *)agEsgl;
+
+ for (j=0; j <numEntriesPerPage; j++)
+ {
+ TI_DBG6(("tdsaGetEsglPages: lower %d upper %d\n", pDesc->sgLower, pDesc->sgUpper));
+ TI_DBG6(("tdsaGetEsglPages: len %d\n", pDesc->len));
+ pDesc++;
+ }
+ TI_DBG6(("tdsaGetEsglPages: next lower %d next upper %d\n", agEsgl->nextPageLower, agEsgl->nextPageUpper));
+
+ }
+#endif /* for debugging only */
+
+ for (i = 0 ; i < numPagesRequired; i++)
+ {
+ /* remove one page from freelist */
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ TDLIST_DEQUEUE_FROM_HEAD(&tdlist_to_fill, &pEsglAllInfo->freelist);
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+
+ /* get the pointer to the page from list pointer */
+ page_to_fill = TDLIST_OBJECT_BASE(tdsaEsglPageInfo_t, tdlist, tdlist_to_fill);
+ /* for debugging */
+ TI_DBG6(("tdsaGetEsglPages:page ID %d\n", page_to_fill->id));
+
+ agEsgl = page_to_fill->agEsgl;
+ pDesc = (agsaSgl_t *)agEsgl;
+
+ /*
+ adjust next page's address in the followings so that
+ the last entry must be (0,0,0)
+ */
+ if (i == numPagesRequired - 1) /* only one page of last page */
+ {
+ for (j=0; j < numSgElements; j++)
+ {
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, sgLower), tmp_tiSgl->lower);
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, sgUpper), tmp_tiSgl->upper);
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, len), tmp_tiSgl->len);
+ CLEAR_ESGL_EXTEND(pDesc->extReserved);
+ pDesc++;
+ tmp_tiSgl++;
+ }
+ for (j=numSgElements; j < numEntriesPerPage; j++)
+ {
+ /* left over(unused) in the page */
+ pDesc->sgLower = 0x0;
+ pDesc->sgUpper = 0x0;
+ pDesc->len = 0x0;
+ CLEAR_ESGL_EXTEND(pDesc->extReserved);
+ pDesc++;
+ }
+ }
+ else
+ {
+ /* in case of muliple pages, first and later, except one page only or last page */
+ for (j=0; j <numEntriesPerPage - 1; j++) /* else */
+ {
+ /* do this till (last - 1) */
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, sgLower), tmp_tiSgl->lower);
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, sgUpper), tmp_tiSgl->upper);
+ OSSA_WRITE_LE_32(agRoot, pDesc, OSSA_OFFSET_OF(pDesc, len), tmp_tiSgl->len);
+ CLEAR_ESGL_EXTEND(pDesc->extReserved);
+ pDesc++;
+ tmp_tiSgl++;
+ }
+ numSgElements -= (numEntriesPerPage - 1);
+ }
+ if (PrevagEsgl != agNULL)
+ {
+ /* subsequent pages (second or later pages) */
+ PrevagEsgl->descriptor[MAX_ESGL_ENTRIES-1].sgLower = page_to_fill->physAddressLower;
+ PrevagEsgl->descriptor[MAX_ESGL_ENTRIES-1].sgUpper = page_to_fill->physAddressUpper;
+ PrevagEsgl->descriptor[MAX_ESGL_ENTRIES-1].len = numSgElements;
+ /* set bit31 to one */
+ SET_ESGL_EXTEND(PrevagEsgl->descriptor[MAX_ESGL_ENTRIES-1].extReserved);
+ }
+ PrevagEsgl = agEsgl;
+ /* put ESGL onto the EsglListHdr */
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(tdlist_to_fill, EsglListHdr);
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+
+
+ } /* end for */
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaFreeEsglPages
+*
+* Purpose: This function frees the ESGL pages pointed to by EsglListHdr
+* and puts them back onto the free list.
+*
+* \param tiRoot: Pointer to root data structure.
+* \param EsglListHdr: pointer to list header where the pages to be freed
+* are stored.
+*
+* \return: None
+*
+* \note -
+* 1. This function removes all the pages from the list until the list
+* empty and chains them at the end of the free list.
+*****************************************************************************/
+osGLOBAL void
+tdsaFreeEsglPages(
+ tiRoot_t *tiRoot,
+ tdList_t *EsglListHdr
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaEsglAllInfo_t *pEsglAllInfo = (tdsaEsglAllInfo_t *)&(tdsaAllShared->EsglAllInfo);
+ tdList_t *tdlist_to_free;
+
+ TI_DBG6(("tdsaFreeEsglPages: start\n"));
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsaFreeEsglPages: tiRoot is NULL\n"));
+ return;
+ }
+
+ if (EsglListHdr == agNULL)
+ {
+ TI_DBG1(("tdsaFreeEsglPages: EsglListHdr is NULL\n"));
+ return;
+ }
+
+ TI_DBG6(("tdsaFreeEsglPages: EsglListHdr %p\n", EsglListHdr));
+ tdsaSingleThreadedEnter(tiRoot, TD_ESGL_LOCK);
+ while (TDLIST_NOT_EMPTY(EsglListHdr))
+ {
+ TDLIST_DEQUEUE_FROM_HEAD(&tdlist_to_free, EsglListHdr);
+ TDLIST_ENQUEUE_AT_TAIL(tdlist_to_free, &pEsglAllInfo->freelist);
+ pEsglAllInfo->NumFreeEsglPages++;
+ }
+ tdsaSingleThreadedLeave(tiRoot, TD_ESGL_LOCK);
+ TI_DBG6(("tdsaFreeEsglPages: NumFreeEsglPages %d\n", pEsglAllInfo->NumFreeEsglPages));
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaGetEsglPagesInfo
+*
+* Purpose: This function gets the information about the size of ESGL pages
+* and number pages to be configured.
+*
+* \param tiRoot: Pointer to root data structure.
+* \param pPageSize: pointer to bit32 where pagesize information is to be
+* stored
+* \param pNumPages: Pointer to bit32 where number of pages information is
+* to be stored
+*
+* \return: None
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetEsglPagesInfo(
+ tiRoot_t *tiRoot,
+ bit32 *pPageSize,
+ bit32 *pNumPages
+ )
+{
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char globalStr[] = "Global";
+ char SwParmsStr[] = "ESGLParms";
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ /* default value, defined in tdsatypes.h */
+ bit32 NumEsglPages = NUM_ESGL_PAGES;
+ TI_DBG6(("tdsaGetEsglPagesInfo: start \n"));
+
+ /*
+ calls ostiGetTransportParam which parses the configuration file to get
+ parameters.
+ */
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumESGLPg", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+
+ NumEsglPages = osti_strtoul(buffer, &pLastUsedChar, 10);
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ TI_DBG6(("tdsaGetEsglPagesInfo: esgl page number %d\n",NumEsglPages));
+ *pPageSize = ESGL_PAGES_SIZE;/* sizeof(agsaEsgl_t); defined in tdsatypes.h */
+ *pNumPages = NumEsglPages;
+
+ return;
+}
+#endif
+
+
+
+
+
+
+
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdhw.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdhw.c
new file mode 100644
index 0000000..059b1af
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdhw.c
@@ -0,0 +1,95 @@
+/*******************************************************************************
+**
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ * This file contains hardware related functions
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+/*****************************************************************************
+*! \biref tdsaReadHardwareInfo
+*
+* Purpose: This function reads the hardware information. This includes,
+* PCI DeviceID, PCI VendorID, PCI Chip Revision, PCI Function
+* Number.
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+* \note - just a place holder for now
+*****************************************************************************/
+osGLOBAL void
+tdsaReadHardwareInfo(
+ tiRoot_t *tiRoot
+ )
+{
+ return;
+}
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdinit.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdinit.c
new file mode 100644
index 0000000..89ac376
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdinit.c
@@ -0,0 +1,3496 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ * This file contains the SAS/SATA TD layer initialization functions
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+LOCAL bit32 tdsaGetCardID(tiRoot_t * tiRoot);
+
+
+bit32 tdCardIDList[TD_MAX_CARD_NUM] = {
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE ,
+ TD_CARD_ID_FREE , TD_CARD_ID_FREE
+};
+
+/*****************************************************************************
+*
+* tdsaGetCardID
+*
+* Purpose:
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess : CardIDString was successfully read
+* tiError : CardIDString reading failed
+*
+*****************************************************************************/
+bit32 tdsaGetCardID(tiRoot_t * tiRoot)
+{
+ bit32 i;
+ bit32 RetVal = 0xFFFFFFFF;
+
+ for (i = 0 ; i < TD_MAX_CARD_NUM ; i++)
+ {
+ if (tdCardIDList[i] == TD_CARD_ID_FREE)
+ {
+ tdCardIDList[i] = TD_CARD_ID_ALLOC;
+ RetVal = i;
+ break;
+ }
+ }
+
+ return RetVal;
+
+} /* tdsaGetCardID() */
+
+/*****************************************************************************
+*
+* tdsaFreeCardID
+*
+* Purpose:
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess : CardIDString was successfully read
+* tiError : CardIDString reading failed
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaFreeCardID(tiRoot_t *tiRoot, bit32 CardID)
+{
+ OS_ASSERT(CardID < TD_MAX_CARD_NUM, "Invalid CardID\n");
+
+ tdCardIDList[CardID] = TD_CARD_ID_FREE;
+
+ return;
+
+} /* tdFreeCardID() */
+
+/*****************************************************************************
+*
+* tdsaGetCardIDString
+*
+* Purpose:
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess : CardIDString was successfully read
+* tiError : CardIDString reading failed
+*
+*****************************************************************************/
+bit32 tdsaGetCardIDString(tiRoot_t *tiRoot)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ bit32 ret = tiError;
+ bit32 thisCardID = tdsaGetCardID(tiRoot);
+ char CardNum[10];
+
+ TI_DBG3(("tdsaGetCardIDString: start\n"));
+
+ TI_DBG3(("tdsaGetCardIDString: thisCardID 0x%x\n", thisCardID));
+
+
+ if (thisCardID == 0xFFFFFFFF)
+ {
+ TI_DBG1(("tdGetCardIDString: No more CardIDs available\n"));
+ ret = tiError;
+ }
+ else
+ {
+ tdsaAllShared->CardID = thisCardID;
+ osti_sprintf(CardNum,"CardNum%d", thisCardID);
+ TI_DBG3(("tdsaGetCardIDString: CardNum is %s\n", CardNum));
+ osti_strcpy(tdsaAllShared->CardIDString, CardNum);
+ TI_DBG3(("tdsaGetCardIDString: tdsaAllShared->CardIDString is %s\n", tdsaAllShared->CardIDString));
+ ret = tiSuccess;
+
+ }
+ return ret;
+}
+/*****************************************************************************
+*! \brief tiCOMGetResource
+*
+* Purpose: This function is called to determine the Transport
+* Dependent Layer internal resource requirement.
+* This function will internally call the initiator specific,
+* target specific and shared TD resource requirement calls.
+*
+* \param tiRoot: Pointer to driver/port instance.
+* \param loResource: Pointer to low level TSDK resource requirement.
+* \param initiatorResource: Pointer to initiator functionality memory and
+* option requirement.
+* \param targetResource: Pointer to target functionality memory and
+* option requirement.
+* \param tdSharedMem: Pointer to cached memory required by the
+* target/initiator shared functionality.
+*
+* \return None
+*
+* \note - This function only return the memory requirement in the tiMem_t
+* structure in loResource, initiatorResource, targetResource
+* and tdSharedMem. It does not allocate memory, so the address
+* fields in tiMem_t are not used.
+*
+*****************************************************************************/
+osGLOBAL void
+tiCOMGetResource(
+ tiRoot_t *tiRoot,
+ tiLoLevelResource_t *loResource,
+ tiInitiatorResource_t *initiatorResource,
+ tiTargetResource_t *targetResource,
+ tiTdSharedMem_t *tdSharedMem
+ )
+{
+ TI_DBG6(("tiCOMGetResource start\n"));
+ TI_DBG6(("tiCOMGetResource: loResource %p\n", loResource));
+
+ if(loResource != agNULL)
+ {
+ tdsaLoLevelGetResource(tiRoot, loResource);
+ }
+ if(tdSharedMem != agNULL)
+ {
+ tdsaSharedMemCalculate(tiRoot, loResource, tdSharedMem);
+ }
+
+#ifdef INITIATOR_DRIVER
+ /* initiator */
+ if(initiatorResource != agNULL)
+ {
+ itdssGetResource(tiRoot, initiatorResource);
+ /*
+ * for the time being set the initiator usecsPerTick
+ * same as lolevel usecsPerTick
+ */
+ if (loResource == agNULL)
+ {
+ TI_DBG1(("tiCOMGetResource: loResource is NULL, wrong\n"));
+ return;
+ }
+ }
+#endif
+
+#ifdef TARGET_DRIVER
+ /* target */
+ if(targetResource != agNULL)
+ {
+ ttdssGetResource(tiRoot, targetResource);
+ }
+#endif
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tiCOMInit
+*
+* Purpose: This function is called to initialize Transport Dependent Layer.
+* This function will internally call the initiator specific,
+* target specific and shared TD initialization calls.
+*
+* \param tiRoot: Pointer to target driver/port instance.
+* \param loResource: Pointer to low level TSDK resource requirement.
+* \param initiatorResource: Pointer to initiator functionality memory and
+* option requirement.
+* \param targetResource: Pointer to target functionality memory and
+* option requirement.
+* \param tdSharedMem: Pointer to cached memory required by the
+* target/initiator shared functionality.
+*
+* \return: tiSuccess - if successful
+* tiError - if failed
+*
+*****************************************************************************/
+osGLOBAL bit32
+tiCOMInit(
+ tiRoot_t *tiRoot,
+ tiLoLevelResource_t *loResource,
+ tiInitiatorResource_t *initiatorResource,
+ tiTargetResource_t *targetResource,
+ tiTdSharedMem_t *tdSharedMem )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaPortContext_t *tdsaPortContext;
+ tdsaDeviceData_t *tdsaDeviceData;
+
+#ifdef TD_INT_COALESCE
+ tdsaIntCoalesceContext_t *tdsaIntCoalCxt;
+#endif
+
+#ifdef TD_DISCOVER
+ tdsaExpander_t *tdsaExpander;
+#endif
+
+ bit32 status = tiSuccess;
+ void *IniAddr = agNULL;
+ void *TgtAddr = agNULL;
+ tdsaContext_t *tdsaAllShared;
+#if defined(TD_INT_COALESCE) || defined(TD_DISCOVER) || defined(TD_INTERNAL_DEBUG)
+ bit32 MaxTargets;
+#endif
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ tdsaEsglAllInfo_t *pEsglAllInfo;
+ tdList_t *tdlist_to_fill;
+ tdsaEsglPageInfo_t *page_to_fill;
+#endif
+ bit32 i;
+#ifdef FDS_DM
+ dmSwConfig_t dmSwConfig;
+ static dmMemoryRequirement_t dmMemRequirement;
+ bit32 dmUsecsPerTick = 0;
+ bit32 dmMaxNumLocks = 0;
+#endif
+ #ifdef FDS_SM
+ smSwConfig_t smSwConfig;
+ static smMemoryRequirement_t smMemRequirement;
+ bit32 smUsecsPerTick = 0;
+ bit32 smMaxNumLocks = 0;
+#endif
+
+
+ /* for memory analysis */
+ TI_DBG6(("ticominit: tdsaroot\n"));
+ TI_DBG6(("ticominit: tdsaRoot_t %d\n", (int)sizeof(tdsaRoot_t)));
+ TI_DBG6(("ticominit: tdsaEsglAllInfo_t %d\n", (int)sizeof(tdsaEsglAllInfo_t)));
+ TI_DBG6(("ticominit: portcontext\n"));
+ TI_DBG6(("ticominit: tdsaPortContext_t %d\n", (int)sizeof(tdsaPortContext_t)));
+ TI_DBG6(("ticominit: device data\n"));
+ TI_DBG6(("ticominit: tdsaDeviceData_t %d\n", (int)sizeof(tdsaDeviceData_t)));
+ TI_DBG6(("ticominit: agsaSASDeviceInfo_t %d\n", (int)sizeof(agsaSASDeviceInfo_t)));
+ TI_DBG6(("ticominit: satDeviceData_t %d\n", (int)sizeof(satDeviceData_t)));
+ TI_DBG6(("ticominit: agsaSATAIdentifyData_t %d\n", (int)sizeof(agsaSATAIdentifyData_t)));
+
+ TI_DBG6(("ticominit: IO request body\n"));
+ TI_DBG6(("ticominit: tdIORequestBody_t %d\n", (int)sizeof(tdIORequestBody_t)));
+ TI_DBG6(("ticominit: tdssIOCompleted_t %d\n", (int)sizeof(tdssIOCompleted_t)));
+ TI_DBG6(("ticominit: agsaIORequest_t %d\n", (int)sizeof(agsaIORequest_t)));
+
+ TI_DBG6(("ticominit: FOR SAS\n"));
+ TI_DBG6(("ticominit: agsaSASRequestBody_t %d\n", (int)sizeof(agsaSASRequestBody_t)));
+ TI_DBG6(("ticominit: FOR SATA\n"));
+ TI_DBG6(("ticominit: agsaSATAInitiatorRequest_t %d\n", (int)sizeof(agsaSATAInitiatorRequest_t)));
+ TI_DBG6(("ticominit: scsiRspSense_t %d\n", (int)sizeof(scsiRspSense_t)));
+ TI_DBG6(("ticominit: tiSenseData_t %d\n", (int)sizeof(tiSenseData_t)));
+ TI_DBG6(("ticominit: satIOContext_t %d\n", (int)sizeof(satIOContext_t)));
+ TI_DBG6(("ticominit: satInternalIo_t %d\n", (int)sizeof(satInternalIo_t)));
+
+
+ /*************************************************************************
+ * TD SHARED AREA
+ *************************************************************************/
+
+ TI_DBG6(("ticominit: start\n"));
+
+
+#if defined(TD_INT_COALESCE) && defined(TD_DISCOVER)
+
+ /* Let's start from the tdsaRoot */
+ tdsaRoot = tdSharedMem->tdSharedCachedMem1.virtPtr;
+ tdsaPortContext = (tdsaPortContext_t *)((bitptr)tdSharedMem->tdSharedCachedMem1.virtPtr + sizeof(tdsaRoot_t));
+ tdsaDeviceData = (tdsaDeviceData_t *)((bitptr)tdsaPortContext + (sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT));
+
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tiCOMInit: MaxTargets %d\n", MaxTargets));
+
+ tdsaIntCoalCxt =
+ (tdsaIntCoalesceContext_t *)((bitptr)tdsaDeviceData
+ + (sizeof(tdsaDeviceData_t) * MaxTargets));
+
+ tdsaExpander =
+ (tdsaExpander_t *)((bitptr)tdsaIntCoalCxt
+ + (sizeof(tdsaIntCoalesceContext_t) * TD_MAX_INT_COALESCE));
+
+
+#elif defined(TD_INT_COALESCE)
+
+
+
+ /* Let's start from the tdsaRoot */
+ tdsaRoot = tdSharedMem->tdSharedCachedMem1.virtPtr;
+ tdsaPortContext = (tdsaPortContext_t *)((bitptr)tdSharedMem->tdSharedCachedMem1.virtPtr + sizeof(tdsaRoot_t));
+ tdsaDeviceData = (tdsaDeviceData_t *)((bitptr)tdsaPortContext + (sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT));
+
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tiCOMInit: MaxTargets %d\n", MaxTargets));
+
+ tdsaIntCoalCxt =
+ (tdsaIntCoalesceContext_t *)((bitptr)tdsaDeviceData
+ + (sizeof(tdsaDeviceData_t) * MaxTargets));
+
+
+#elif defined(TD_DISCOVER)
+
+
+ /* Let's start from the tdsaRoot */
+ tdsaRoot = tdSharedMem->tdSharedCachedMem1.virtPtr;
+ tdsaPortContext = (tdsaPortContext_t *)((bitptr)tdSharedMem->tdSharedCachedMem1.virtPtr + sizeof(tdsaRoot_t));
+ tdsaDeviceData = (tdsaDeviceData_t *)((bitptr)tdsaPortContext + (sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT));
+
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tiCOMInit: MaxTargets %d\n", MaxTargets));
+
+ tdsaExpander =
+ (tdsaExpander_t *)((bitptr)tdsaDeviceData
+ + (sizeof(tdsaDeviceData_t) * MaxTargets));
+
+
+
+#else
+
+ /* Let's start from the tdsaRoot */
+ tdsaRoot = tdSharedMem->tdSharedCachedMem1.virtPtr;
+ tdsaPortContext = (tdsaPortContext_t *)((bitptr)tdSharedMem->tdSharedCachedMem1.virtPtr + sizeof(tdsaRoot_t));
+ tdsaDeviceData = (tdsaDeviceData_t *)((bitptr)tdsaPortContext + (sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT));
+
+#endif
+
+ TI_DBG6(("tiCOMInit: ******* tdsaRoot %p tdsaPortContext %p tdsaDeviceData %p\n", tdsaRoot, tdsaPortContext, tdsaDeviceData));
+
+
+ tiRoot->tdData = tdsaRoot;
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+
+
+#ifdef INITIATOR_DRIVER
+ /**< Initialize initiator; itdssIni_t itself */
+ if(initiatorResource)
+ {
+ IniAddr = initiatorResource->initiatorMem.tdCachedMem[0].virtPtr;
+ tdsaRoot->itdsaIni = IniAddr;
+ tdsaRoot->itdsaIni->tdsaAllShared = tdsaAllShared;
+ tdsaAllShared->itdsaIni = tdsaRoot->itdsaIni;
+ }
+#endif
+
+#ifdef TARGET_DRIVER
+ /**< Initialize target; ttdssTgt_t itself */
+ if(targetResource)
+ {
+ TgtAddr = targetResource->targetMem.tdMem[0].virtPtr;
+ tdsaRoot->ttdsaTgt = TgtAddr;
+ tdsaRoot->ttdsaTgt->tdsaAllShared = tdsaAllShared;
+ tdsaAllShared->ttdsaTgt = tdsaRoot->ttdsaTgt;
+ }
+#endif /* target driver */
+
+ TI_DBG5(("tiCOMInit: IniAddr %p TgtAddr %p\n", IniAddr, TgtAddr));
+
+ TI_DBG3(("tiCOMInit: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
+
+ /**< Initialize the OS data part of the interrupt context agRoot */
+ tdsaAllShared->agRootOsDataForInt.tiRoot = tiRoot;
+ tdsaAllShared->agRootOsDataForInt.tdsaAllShared = (void *) tdsaAllShared;
+ tdsaAllShared->agRootOsDataForInt.itdsaIni = (void *) IniAddr;
+ tdsaAllShared->agRootOsDataForInt.ttdsaTgt = (void *) TgtAddr;
+ /* for sata */
+ tdsaAllShared->agRootOsDataForInt.tdstHost = agNULL;
+ tdsaAllShared->agRootOsDataForInt.tdstDevice = agNULL;
+
+ /* tiInterruptContext is an enum value */
+ tdsaAllShared->agRootOsDataForInt.IntContext = tiInterruptContext;
+ /* queueId or lockid in TD layer; LL maxlock + 1 since TD uses only one lock */
+
+ /* agsaRoot_t */
+ tdsaAllShared->agRootInt.osData =
+ (void *) &(tdsaAllShared->agRootOsDataForInt);
+ tdsaAllShared->agRootInt.sdkData = agNULL;
+
+ /**< Initialize the OS data part of the non-interrupt context agRoot */
+ tdsaAllShared->agRootOsDataForNonInt.tiRoot = tiRoot;
+ tdsaAllShared->agRootOsDataForNonInt.tdsaAllShared = (void *) tdsaAllShared;
+ tdsaAllShared->agRootOsDataForNonInt.itdsaIni = (void *) IniAddr;
+ tdsaAllShared->agRootOsDataForNonInt.ttdsaTgt = (void *) TgtAddr;
+ /* for sata */
+ tdsaAllShared->agRootOsDataForNonInt.tdstHost = agNULL;
+ tdsaAllShared->agRootOsDataForNonInt.tdstDevice = agNULL;
+
+ tdsaAllShared->agRootOsDataForNonInt.IntContext = tiNonInterruptContext;
+ /* queueId or lockid in TD layer; LL maxlock + 1 since TD uses only one lock */
+
+ /* agsaRoot_t */
+ tdsaAllShared->agRootNonInt.osData =
+ (void *) &(tdsaAllShared->agRootOsDataForNonInt);
+ tdsaAllShared->agRootNonInt.sdkData = agNULL;
+
+ tdsaAllShared->loResource = *loResource;
+
+ tdsaAllShared->PortContextMem = tdsaPortContext;
+ tdsaAllShared->DeviceMem = tdsaDeviceData;
+
+ tdsaAllShared->IBQnumber = 0;
+ tdsaAllShared->OBQnumber = 0;
+
+#ifdef TD_INT_COALESCE
+ tdsaAllShared->IntCoalesce = tdsaIntCoalCxt;
+#endif
+
+#ifdef TD_DISCOVER
+ tdsaAllShared->ExpanderHead = tdsaExpander;
+#endif
+
+ tdsaAllShared->MaxNumLocks = loResource->loLevelOption.numOfQueuesPerPort;
+
+ tdsaAllShared->MaxNumOSLocks = loResource->loLevelOption.maxNumOSLocks;
+
+#if defined(FDS_DM) && defined(FDS_SM)
+ dmGetRequirements(agNULL,
+ &dmSwConfig,
+ &dmMemRequirement,
+ &dmUsecsPerTick,
+ &dmMaxNumLocks
+ );
+
+ tdsaAllShared->MaxNumDMLocks = dmMaxNumLocks;
+ TI_DBG2(("tiCOMInit: DM MaxNumDMLocks 0x%x\n", tdsaAllShared->MaxNumDMLocks));
+
+ smGetRequirements(agNULL,
+ &smSwConfig,
+ &smMemRequirement,
+ &smUsecsPerTick,
+ &smMaxNumLocks
+ );
+
+ tdsaAllShared->MaxNumSMLocks = smMaxNumLocks;
+ TI_DBG2(("tiCOMInit: SM MaxNumSMLocks 0x%x\n", tdsaAllShared->MaxNumSMLocks));
+
+ tdsaAllShared->MaxNumLLLocks = tdsaAllShared->MaxNumLocks - TD_MAX_LOCKS - tdsaAllShared->MaxNumDMLocks - tdsaAllShared->MaxNumSMLocks;
+ TI_DBG2(("tiCOMInit: LL MaxNumLLLocks 0x%x\n", tdsaAllShared->MaxNumLLLocks));
+
+#elif defined(FDS_DM)
+ dmGetRequirements(agNULL,
+ &dmSwConfig,
+ &dmMemRequirement,
+ &dmUsecsPerTick,
+ &dmMaxNumLocks
+ );
+
+ tdsaAllShared->MaxNumDMLocks = dmMaxNumLocks;
+ TI_DBG2(("tiCOMInit: DM MaxNumDMLocks 0x%x\n", tdsaAllShared->MaxNumDMLocks));
+
+ tdsaAllShared->MaxNumLLLocks = tdsaAllShared->MaxNumLocks - TD_MAX_LOCKS - tdsaAllShared->MaxNumDMLocks;
+ TI_DBG2(("tiCOMInit: LL MaxNumLLLocks 0x%x\n", tdsaAllShared->MaxNumLLLocks));
+#elif defined(FDS_SM)
+ smGetRequirements(agNULL,
+ &smSwConfig,
+ &smMemRequirement,
+ &smUsecsPerTick,
+ &smMaxNumLocks
+ );
+
+ tdsaAllShared->MaxNumSMLocks = smMaxNumLocks;
+ TI_DBG2(("tiCOMInit: SM MaxNumSMLocks 0x%x\n", tdsaAllShared->MaxNumSMLocks));
+
+ tdsaAllShared->MaxNumLLLocks = tdsaAllShared->MaxNumLocks - TD_MAX_LOCKS - tdsaAllShared->MaxNumSMLocks;
+ TI_DBG2(("tiCOMInit: LL MaxNumLLLocks 0x%x\n", tdsaAllShared->MaxNumLLLocks));
+#else
+ tdsaAllShared->MaxNumLLLocks = tdsaAllShared->MaxNumLocks - TD_MAX_LOCKS;
+ TI_DBG2(("tiCOMInit: LL MaxNumLLLocks 0x%x\n", tdsaAllShared->MaxNumLLLocks));
+#endif
+
+#ifdef TBD
+ tdsaAllShared->MaxNumLLLocks = loResource->loLevelOption.numOfQueuesPerPort - TD_MAX_LOCKS;
+#endif
+
+ tdsaAllShared->resetCount = 0;
+
+ /* used for saHwEventAck() and ossaDeregisterDeviceHandleCB() */
+// tdsaAllShared->EventValid = agFALSE;
+ for(i=0; i<TD_MAX_NUM_PHYS; i++)
+ {
+ tdsaAllShared->eventSource[i].EventValid = agFALSE;
+ tdsaAllShared->eventSource[i].Source.agPortContext = agNULL;
+ tdsaAllShared->eventSource[i].Source.event = 0;
+ /* phy ID */
+ tdsaAllShared->eventSource[i].Source.param = 0xFF;
+ }
+
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ pEsglAllInfo = (tdsaEsglAllInfo_t *)&(tdsaAllShared->EsglAllInfo);
+#endif
+
+ /* initialize CardIDString */
+ osti_strcpy(tdsaAllShared->CardIDString,"");
+
+
+#ifdef FDS_DM
+ tdsaAllShared->dmRoot.tdData = tdsaRoot;
+#endif
+
+#ifdef FDS_SM
+ tdsaAllShared->smRoot.tdData = tdsaRoot;
+#endif
+
+ /* get card ID */
+ if (tdsaGetCardIDString(tiRoot) == tiError)
+ {
+ TI_DBG1(("tdsaGetCardIDString() failed\n"));
+ return tiError;
+ }
+
+ /**< initializes jumptable */
+ tdsaJumpTableInit(tiRoot);
+
+ /**< initializes tdsaPortStartInfo_s including flags */
+ tdssInitSASPortStartInfo(tiRoot);
+
+ /* resets all the relevant flags */
+ tdsaResetComMemFlags(tiRoot);
+
+ /**< initializes timers */
+ tdsaInitTimers(tiRoot);
+
+ TI_DBG6(("ticominit: ******* before tdsaRoot %p tdsaPortContext %p tdsaDeviceData %p\n", tdsaRoot, tdsaPortContext, tdsaDeviceData));
+
+
+ /**< initializes tdsaPortContext_t */
+ tdsaPortContextInit(tiRoot);
+
+ /**< initializes devicelist in tdsaPortContext_t */
+ tdsaDeviceDataInit(tiRoot);
+
+#ifdef TD_INT_COALESCE
+ tdsaIntCoalCxtInit(tiRoot);
+#endif
+
+#ifdef TD_DISCOVER
+ tdsaExpanderInit(tiRoot);
+#endif
+
+ tdsaQueueConfigInit(tiRoot);
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ TI_DBG6(("ticominit: temp 1\n"));
+ TDLIST_DEQUEUE_FROM_HEAD(&tdlist_to_fill, &pEsglAllInfo->freelist);
+ /* get the pointer to the page from list pointer */
+ page_to_fill = TDLIST_OBJECT_BASE(tdsaEsglPageInfo_t, tdlist, tdlist_to_fill);
+ TI_DBG6(("ticominit: pageinfo ID %d\n", page_to_fill->id));
+ /* this does not work */
+ TDLIST_ENQUEUE_AT_HEAD(tdlist_to_fill, &pEsglAllInfo->freelist);
+
+ TI_DBG6(("ticominit: devide\n"));
+ TDLIST_DEQUEUE_FROM_HEAD(&tdlist_to_fill, &pEsglAllInfo->freelist);
+ /* get the pointer to the page from list pointer */
+ page_to_fill = TDLIST_OBJECT_BASE(tdsaEsglPageInfo_t, tdlist, tdlist_to_fill);
+ TDINIT_PRINT("ticominit: second pageinfo ID %d\n", page_to_fill->id);
+
+ TDLIST_ENQUEUE_AT_HEAD(tdlist_to_fill, &pEsglAllInfo->freelist);
+
+#endif
+
+
+#ifdef INITIATOR_DRIVER
+ if(initiatorResource != agNULL)
+ {
+ tdsaAllShared->currentOperation |= TD_OPERATION_INITIATOR;
+ TI_DBG5(("tiCOMInit: calling itdssInit\n"));
+ status = itdssInit(tiRoot, initiatorResource, tdSharedMem);
+
+ if(status != tiSuccess)
+ {
+ TI_DBG1(("tiCOMInit: itdInit FAILED\n"));
+ return status;
+ }
+ }
+#endif
+
+#ifdef TARGET_DRIVER
+ if(targetResource != agNULL)
+ {
+ tdsaAllShared->currentOperation |= TD_OPERATION_TARGET;
+ TI_DBG5 (("tiCOMInit: calling ttdssInit\n"));
+ status = ttdssInit(tiRoot, targetResource, tdSharedMem);
+
+ if(status != tiSuccess)
+ {
+ TI_DBG1(("tiCOMInit: ttdInit FAILED\n"));
+ return status;
+ }
+ }
+#endif
+
+ return status;
+}
+
+/*****************************************************************************
+*! \brief tdsaLoLevelGetResource
+*
+* Purpose: This function is called to determine the Transport
+* Dependent Layer internal resource requirement used by the
+* lower layer TSDK.
+*
+* \param tiRoot: Pointer to driver/port instance.
+* \param loResource: Pointer to low level TSDK resource requirement.
+*
+* \return: None
+*
+* \note - currenlty mem[0] - mem[18] are being used
+*
+*****************************************************************************/
+/*
+ this calls ostiGetTransportParam which parses the configuration file to get
+ parameters.
+*/
+osGLOBAL void
+tdsaLoLevelGetResource(
+ tiRoot_t * tiRoot,
+ tiLoLevelResource_t * loResource)
+{
+ agsaRoot_t agRoot;
+ bit32 usecsPerTick = 0;
+ agsaSwConfig_t SwConfig;
+ static agsaQueueConfig_t QueueConfig;
+ static agsaMemoryRequirement_t memRequirement;
+ bit32 maxQueueSets = 0;
+ bit32 maxNumOSLocks = 0;
+ bit32 i;
+
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char globalStr[] = "Global";
+ char iniParmsStr[] = "InitiatorParms";
+ char SwParmsStr[] = "SWParms";
+ char OBQueueProps[] = "OBQueueProps";
+ char IBQueueProps[] = "IBQueueProps";
+
+ static char IBQueueSize[30];
+ static char OBQueueSize[30];
+ static char IBQueueEleSize[30];
+ static char OBQueueEleSize[30];
+
+ static char OBQueueInterruptCount[30];
+ static char OBQueueInterruptDelay[30];
+ static char OBQueueInterruptEnable[30];
+ static char IBQueuePriority[30];
+
+
+ static char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ static bit32 InboundQueueSize[AGSA_MAX_OUTBOUND_Q];
+ static bit32 OutboundQueueSize[AGSA_MAX_OUTBOUND_Q];
+ static bit32 InboundQueueEleSize[AGSA_MAX_OUTBOUND_Q];
+ static bit32 OutboundQueueEleSize[AGSA_MAX_OUTBOUND_Q];
+ static bit32 InboundQueuePriority[AGSA_MAX_INBOUND_Q];
+ static bit32 OutboundQueueInterruptDelay[AGSA_MAX_OUTBOUND_Q];
+ static bit32 OutboundQueueInterruptCount[AGSA_MAX_OUTBOUND_Q];
+ static bit32 OutboundQueueInterruptEnable[AGSA_MAX_OUTBOUND_Q];
+ static bit32 cardID = 0;
+ char CardNum[10];
+
+#ifdef FDS_DM
+ dmRoot_t dmRoot;
+ dmSwConfig_t dmSwConfig;
+ static dmMemoryRequirement_t dmMemRequirement;
+ bit32 dmUsecsPerTick = 0;
+ bit32 dmMaxNumLocks = 0;
+#endif
+
+#ifdef FDS_SM
+ smRoot_t smRoot;
+ smSwConfig_t smSwConfig;
+ static smMemoryRequirement_t smMemRequirement;
+ bit32 smUsecsPerTick = 0;
+ bit32 smMaxNumLocks = 0;
+#endif
+
+ TI_DBG1(("tdsaLoLevelGetResource: start \n"));
+ TI_DBG6(("tdsaLoLevelGetResource: loResource %p\n", loResource));
+
+ osti_memset(&agRoot, 0, sizeof(agsaRoot_t));
+ osti_memset(&QueueConfig, 0, sizeof(QueueConfig));
+ osti_memset(&memRequirement, 0, sizeof(memRequirement));
+ osti_memset(InboundQueueSize, 0, sizeof(InboundQueueSize));
+ osti_memset(OutboundQueueSize, 0, sizeof(OutboundQueueSize));
+ osti_memset(InboundQueueEleSize, 0, sizeof(InboundQueueEleSize));
+ osti_memset(OutboundQueueEleSize, 0, sizeof(OutboundQueueEleSize));
+
+ memRequirement.count = 0;
+
+ /* default values which are overwritten later */
+ /* The followings are default values */
+ SwConfig.maxActiveIOs = DEFAULT_MAX_ACTIVE_IOS;
+ SwConfig.numDevHandles = DEFAULT_MAX_DEV;
+ SwConfig.smpReqTimeout = DEFAULT_SMP_TIMEOUT; /* DEFAULT_VALUE; */
+ SwConfig.numberOfEventRegClients = DEFAULT_NUM_REG_CLIENTS;
+ SwConfig.sizefEventLog1 = HOST_EVENT_LOG_SIZE; /* in KBytes */
+ SwConfig.sizefEventLog2 = HOST_EVENT_LOG_SIZE; /* in KBytes */
+ SwConfig.eventLog1Option = DEFAULT_EVENT_LOG_OPTION;
+ SwConfig.eventLog2Option = DEFAULT_EVENT_LOG_OPTION;
+ SwConfig.fatalErrorInterruptEnable = 1;
+ SwConfig.fatalErrorInterruptVector = 0; /* Was 1 */
+ SwConfig.hostDirectAccessSupport = 0;
+ SwConfig.hostDirectAccessMode = 0;
+ SwConfig.FWConfig = 0;
+ SwConfig.enableDIF = agFALSE;
+ SwConfig.enableEncryption = agFALSE;
+
+#ifdef SA_CONFIG_MDFD_REGISTRY
+ SwConfig.disableMDF = agFALSE;
+#endif /*SA_CONFIG_MDFD_REGISTRY*/
+
+#if defined(SALLSDK_DEBUG)
+ SwConfig.sallDebugLevel = 1; /* DEFAULT_VALUE; */
+#endif
+
+
+#ifdef SA_ENABLE_PCI_TRIGGER
+ SwConfig.PCI_trigger = 0; /* DEFAULT_VALUE; */
+ #endif /* SA_ENABLE_PCI_TRIGGER */
+
+#ifdef FDS_DM
+ /* defaults */
+ dmMemRequirement.count = 0;
+ dmSwConfig.numDevHandles = DEFAULT_MAX_DEV;
+#ifdef DM_DEBUG
+ dmSwConfig.DMDebugLevel = 1;
+#endif
+#endif
+
+#ifdef FDS_SM
+ /* defaults */
+ smMemRequirement.count = 0;
+ smSwConfig.maxActiveIOs = DEFAULT_MAX_ACTIVE_IOS;
+ smSwConfig.numDevHandles = DEFAULT_MAX_DEV;
+#ifdef SM_DEBUG
+ smSwConfig.SMDebugLevel = 1;
+#endif
+#endif
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ /* param3 points to QueueConfig; tdsaAllShared does not exit at this point yet */
+ SwConfig.param3 = (void *)&QueueConfig;
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr,
+ iniParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "MaxTargets",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaLoLevelGetResource: MaxTargets %d\n", SwConfig.numDevHandles));
+ }
+
+
+ /*
+ * read the NumInboundQueue parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ QueueConfig.numInboundQueues = DEFAULT_NUM_INBOUND_QUEUE; /* default 1 Inbound queue */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumInboundQueues", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig.numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig.numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+ if (QueueConfig.numInboundQueues > AGSA_MAX_INBOUND_Q)
+ {
+ QueueConfig.numInboundQueues = AGSA_MAX_INBOUND_Q;
+ }
+ }
+
+ /*
+ * read the NumOutboundQueue parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ QueueConfig.numOutboundQueues = DEFAULT_NUM_OUTBOUND_QUEUE; /* default 1 Outbound queue */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumOutboundQueues", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig.numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig.numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+ if (QueueConfig.numOutboundQueues > AGSA_MAX_OUTBOUND_Q)
+ {
+ QueueConfig.numOutboundQueues = AGSA_MAX_OUTBOUND_Q;
+ }
+ }
+
+ /*
+ * read the MaxActiveIO parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MaxActiveIO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+
+
+ /*
+ * read the SMPTO parameter (SMP Timeout)
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SMPTO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ /*
+ * read the NumRegClients parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumRegClients", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+#if defined(SALLSDK_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "LLDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+
+#if defined(DM_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "DMDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ dmSwConfig.DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ dmSwConfig.DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+#if defined(SM_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SMDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ smSwConfig.SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ smSwConfig.SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig.numInboundQueues;i++)
+ {
+ osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
+ osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
+ osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
+
+
+
+ /*
+ * read the IBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ InboundQueueSize[i] = DEFAULT_INBOUND_QUEUE_SIZE; /* default 256 Inbound queue size */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueSize[i]));
+ }
+ }
+
+
+ /*
+ * read the IBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ InboundQueueEleSize[i] = DEFAULT_INBOUND_QUEUE_ELE_SIZE; /* default 128 Inbound queue element */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d IB queue ele size %d\n", i, InboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the IBQueuePriority
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ InboundQueuePriority[i] = DEFAULT_INBOUND_QUEUE_PRIORITY; /* default 0 Inbound queue priority */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueuePriority, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d priority %d\n", i, InboundQueuePriority[i]));
+ }
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }/* end of loop */
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig.numOutboundQueues;i++)
+ {
+ osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
+ osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
+ osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
+ osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
+ osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
+
+ /*
+ * read the OBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ OutboundQueueSize[i] = DEFAULT_OUTBOUND_QUEUE_SIZE; /* default 256 Outbound queue size */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d OB queue size %d\n", i, OutboundQueueSize[i]));
+ }
+ }
+
+
+ /*
+ * read the OBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ OutboundQueueEleSize[i] = DEFAULT_OUTBOUND_QUEUE_ELE_SIZE; /* default 128 Outbound queue element */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d OB queue ele size %d\n", i, OutboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptDelay
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ OutboundQueueInterruptDelay[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY; /* default 1 Outbound interrupt delay */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptDelay, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d interrupt delay %d\n", i, OutboundQueueInterruptDelay[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptCount
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ OutboundQueueInterruptCount[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT; /* default 1 Outbound interrupt count */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptCount, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d interrupt count %d\n", i, OutboundQueueInterruptCount[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptEnable
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ OutboundQueueInterruptEnable[i] = DEFAULT_OUTBOUND_INTERRUPT_ENABLE; /* default 1 Outbound interrupt is enabled */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptEnable, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+#ifdef SPC_POLLINGMODE
+ OutboundQueueInterruptEnable[i] = 0;
+#endif /* SPC_POLLINGMODE */
+
+ }
+ else
+ {
+ OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+#ifdef SPC_POLLINGMODE
+ OutboundQueueInterruptEnable[i] = 0;
+#endif /* SPC_POLLINGMODE */
+ }
+ TI_DBG2(("tdsaLoLevelGetResource: queue number %d interrupt enable %d\n", i, OutboundQueueInterruptEnable[i]));
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ }/* end of loop */
+
+
+
+ /************************************************************
+ * READ CARD Specific
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig.numInboundQueues;i++)
+ {
+ osti_sprintf(CardNum,"CardNum%d", cardID);
+ osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
+ osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
+ osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
+
+ /*
+ * read the IBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueSize[i]));
+ }
+ }
+
+
+ /*
+ * read the IBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d IB queue size %d\n", i, InboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the IBQueuePriority
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueuePriority, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: card number %d queue number %d priority %d\n", cardID, i, InboundQueuePriority[i]));
+ }
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }/* end of loop */
+
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig.numOutboundQueues;i++)
+ {
+ osti_sprintf(CardNum,"CardNum%d", cardID);
+ osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
+ osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
+ osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
+ osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
+ osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
+
+ /*
+ * read the OBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d OB queue size %d\n", i, OutboundQueueSize[i]));
+ }
+ }
+
+
+ /*
+ * read the OBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: queue number %d OB queue ele size %d\n", i, OutboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptDelay
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptDelay, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: card number %d queue number %d interrupt delay %d\n", cardID, i, OutboundQueueInterruptDelay[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptCount
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptCount, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaLoLevelGetResource: card number %d queue number %d interrupt count %d\n", cardID, i, OutboundQueueInterruptCount[i]));
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptEnable
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ CardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptEnable, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+#ifdef SPC_POLLINGMODE
+ OutboundQueueInterruptEnable[i] = 0;
+#endif /* SPC_POLLINGMODE */
+
+ }
+ else
+ {
+ OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+#ifdef SPC_POLLINGMODE
+ OutboundQueueInterruptEnable[i] = 0;
+#endif /* SPC_POLLINGMODE */
+ }
+ TI_DBG2(("tdsaLoLevelGetResource: card number %d queue number %d interrupt count %d\n", cardID, i, OutboundQueueInterruptEnable[i]));
+ }
+
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ }/* end of loop */
+
+
+ TI_DBG6(("tdsaLoLevelGetResource: \n"));
+ tdsaPrintSwConfig(&SwConfig);
+
+ /* fills in queue related parameters */
+ for (i=0;i<QueueConfig.numInboundQueues;i++)
+ {
+ QueueConfig.inboundQueues[i].elementCount = InboundQueueSize[i];
+ QueueConfig.inboundQueues[i].elementSize = InboundQueueEleSize[i];
+ QueueConfig.inboundQueues[i].priority = InboundQueuePriority[i];
+ }
+ for (i=0;i<QueueConfig.numOutboundQueues;i++)
+ {
+ QueueConfig.outboundQueues[i].elementCount = OutboundQueueSize[i];
+ QueueConfig.outboundQueues[i].elementSize = OutboundQueueEleSize[i];
+ QueueConfig.outboundQueues[i].interruptDelay = OutboundQueueInterruptDelay[i];
+ QueueConfig.outboundQueues[i].interruptCount = OutboundQueueInterruptCount[i];
+ QueueConfig.outboundQueues[i].interruptEnable = OutboundQueueInterruptEnable[i];
+ }
+
+
+ /* process event log related parameters */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogSize1", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogOption1", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogSize2", /* valueName */ /* size in K Dwords */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogOption2", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* end of event log related parameters */
+
+ /*
+ HDA parameters
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HDASupport", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /***********************************************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HDAMode", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /***********************************************************************/
+ /* the end of HDA parameters */
+
+
+ /* FW configuration */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "FWConfig", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.FWConfig = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.FWConfig = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* The end of FW configuration */
+
+
+
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+
+ TI_DBG2(("tdsaLoLevelGetResource: SA_ENABLE_TRACE_FUNCTIONS\n"));
+
+/*
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+*/
+
+ SwConfig.TraceBufferSize = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "TraceBufferSize", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig.TraceBufferSize = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig.TraceBufferSize = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaLoLevelGetResource: SwConfig.TraceBufferSize %d\n",SwConfig.TraceBufferSize));
+ }
+
+#endif /*# SA_ENABLE_TRACE_FUNCTIONS */
+
+ SwConfig.mpiContextTable = agNULL;
+ SwConfig.mpiContextTablelen = 0;
+
+ /* default */
+ for (i=0;i<8;i++)
+ {
+ QueueConfig.sasHwEventQueue[i] = 0;
+ QueueConfig.sataNCQErrorEventQueue[i] = 0;
+ }
+
+#ifdef TARGET_DRIVER
+ for (i=0;i<8;i++)
+ {
+ QueueConfig.tgtITNexusEventQueue[i] = 0;
+ QueueConfig.tgtSSPEventQueue[i] = 0;
+ QueueConfig.tgtSMPEventQueue[i] = 0;
+ }
+#endif
+
+ QueueConfig.iqNormalPriorityProcessingDepth = 0;
+ QueueConfig.iqHighPriorityProcessingDepth = 0;
+ QueueConfig.generalEventQueue = 0;
+
+ /*
+ * can agRoot be agNULL below? Yes.
+ * saGetRequirements(agRoot, IN, OUT, OUT, OUT);
+ */
+ saGetRequirements(&agRoot,
+ &SwConfig,
+ &memRequirement,
+ &usecsPerTick,
+ &maxQueueSets
+ );
+#ifdef FDS_DM
+ dmGetRequirements(&dmRoot,
+ &dmSwConfig,
+ &dmMemRequirement,
+ &dmUsecsPerTick,
+ &dmMaxNumLocks
+ );
+
+
+#endif
+
+#ifdef FDS_SM
+ smGetRequirements(
+ &smRoot,
+ &smSwConfig,
+ &smMemRequirement,
+ &smUsecsPerTick,
+ &smMaxNumLocks
+ );
+
+#endif
+
+ /* initialization */
+ maxNumOSLocks = loResource->loLevelOption.maxNumOSLocks;
+ /*
+ MAX_LL_LAYER_MEM_DESCRIPTORS is 24. see tidefs.h and tiLoLevelMem_t
+ in titypes.h
+ */
+#if defined (FDS_DM) && defined (FDS_SM)
+ /* for LL */
+ TI_DBG1(("tdsaLoLevelGetResource:MAX_LL_LAYER_MEM_DESCRIPTORS %d\n", MAX_LL_LAYER_MEM_DESCRIPTORS));
+ for(i=0;i<MAX_LL_LAYER_MEM_DESCRIPTORS;i++)
+ {
+ loResource->loLevelMem.mem[i].numElements = 0;
+ loResource->loLevelMem.mem[i].totalLength = 0;
+ loResource->loLevelMem.mem[i].singleElementLength = 0;
+ loResource->loLevelMem.mem[i].alignment = 0;
+ loResource->loLevelMem.mem[i].type = 0;
+ loResource->loLevelMem.mem[i].reserved = 0;
+ loResource->loLevelMem.mem[i].virtPtr = agNULL;
+ loResource->loLevelMem.mem[i].osHandle = agNULL;
+ loResource->loLevelMem.mem[i].physAddrUpper = 0;
+ loResource->loLevelMem.mem[i].physAddrLower = 0;
+ }
+
+ TI_DBG1(("tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.count));
+ /* using the returned value from saGetRequirements */
+ for (i=0;i< memRequirement.count;i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = memRequirement.agMemory[i].numElements;
+ loResource->loLevelMem.mem[i].totalLength = memRequirement.agMemory[i].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = memRequirement.agMemory[i].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = memRequirement.agMemory[i].alignment;
+ TI_DBG2(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+ /* for DM */
+ TI_DBG1(("tdsaLoLevelGetResource:dmMemRequirement.count %d\n", dmMemRequirement.count));
+ /* using the returned value from dmGetRequirements */
+ for (i=memRequirement.count;i< (memRequirement.count + dmMemRequirement.count);i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = dmMemRequirement.dmMemory[i-memRequirement.count].numElements;
+ loResource->loLevelMem.mem[i].totalLength = dmMemRequirement.dmMemory[i-memRequirement.count].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = dmMemRequirement.dmMemory[i-memRequirement.count].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = dmMemRequirement.dmMemory[i-memRequirement.count].alignment;
+ TI_DBG2(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+ /* for SM */
+ TI_DBG1(("tdsaLoLevelGetResource:smMemRequirement.count %d\n", smMemRequirement.count));
+ /* using the returned value from dmGetRequirements */
+ for (i=(memRequirement.count + dmMemRequirement.count);i< (memRequirement.count + dmMemRequirement.count + smMemRequirement.count);i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].numElements;
+ loResource->loLevelMem.mem[i].totalLength = smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].alignment;
+ TI_DBG2(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == smMemRequirement.smMemory[i-memRequirement.count-dmMemRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+ /* sets the low level options */
+ loResource->loLevelOption.usecsPerTick = MIN(MIN(usecsPerTick, dmUsecsPerTick), smUsecsPerTick);
+ loResource->loLevelOption.numOfQueuesPerPort = maxQueueSets + dmMaxNumLocks + smMaxNumLocks + TD_MAX_LOCKS + maxNumOSLocks;
+ loResource->loLevelOption.mutexLockUsage = tiOneMutexLockPerQueue;
+ /* no more ESGL */
+ loResource->loLevelMem.count = memRequirement.count + dmMemRequirement.count + smMemRequirement.count;
+ /* setting interrupt requirements */
+ loResource->loLevelOption.maxInterruptVectors = SwConfig.max_MSIX_InterruptVectors;
+ loResource->loLevelOption.max_MSI_InterruptVectors = SwConfig.max_MSI_InterruptVectors;
+ loResource->loLevelOption.flag = SwConfig.legacyInt_X;
+ TI_DBG2(("tdsaLoLevelGetResource: asking maxInterruptVectors(MSIX) %d \n", loResource->loLevelOption.maxInterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking max_MSI_InterruptVectors %d \n", loResource->loLevelOption.max_MSI_InterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking flag - legacyInt_X %d \n", loResource->loLevelOption.flag));
+
+// TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n",memRequirement.count, loResource->loLevelMem.mem[memRequirement.count].numElements,loResource->loLevelMem.mem[memRequirement.count].totalLength, loResource->loLevelMem.mem[memRequirement.count].singleElementLength,loResource->loLevelMem.mem[memRequirement.count].alignment ));
+ TI_DBG6(("tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->loLevelMem.count));
+
+#elif defined(FDS_DM)
+ TI_DBG1(("tdsaLoLevelGetResource:MAX_LL_LAYER_MEM_DESCRIPTORS %d\n", MAX_LL_LAYER_MEM_DESCRIPTORS));
+ for(i=0;i<MAX_LL_LAYER_MEM_DESCRIPTORS;i++)
+ {
+ loResource->loLevelMem.mem[i].numElements = 0;
+ loResource->loLevelMem.mem[i].totalLength = 0;
+ loResource->loLevelMem.mem[i].singleElementLength = 0;
+ loResource->loLevelMem.mem[i].alignment = 0;
+ loResource->loLevelMem.mem[i].type = 0;
+ loResource->loLevelMem.mem[i].reserved = 0;
+ loResource->loLevelMem.mem[i].virtPtr = agNULL;
+ loResource->loLevelMem.mem[i].osHandle = agNULL;
+ loResource->loLevelMem.mem[i].physAddrUpper = 0;
+ loResource->loLevelMem.mem[i].physAddrLower = 0;
+ }
+
+ TI_DBG1(("tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.count));
+ /* using the returned value from saGetRequirements */
+ for (i=0;i< memRequirement.count;i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = memRequirement.agMemory[i].numElements;
+ loResource->loLevelMem.mem[i].totalLength = memRequirement.agMemory[i].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = memRequirement.agMemory[i].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = memRequirement.agMemory[i].alignment;
+ TI_DBG2(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+ TI_DBG1(("tdsaLoLevelGetResource:dmMemRequirement.count %d\n", dmMemRequirement.count));
+ /* using the returned value from dmGetRequirements */
+ for (i=memRequirement.count;i< (memRequirement.count + dmMemRequirement.count);i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = dmMemRequirement.dmMemory[i-memRequirement.count].numElements;
+ loResource->loLevelMem.mem[i].totalLength = dmMemRequirement.dmMemory[i-memRequirement.count].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = dmMemRequirement.dmMemory[i-memRequirement.count].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = dmMemRequirement.dmMemory[i-memRequirement.count].alignment;
+ TI_DBG2(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == dmMemRequirement.dmMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+
+
+ /* sets the low level options */
+ loResource->loLevelOption.usecsPerTick = MIN(usecsPerTick, dmUsecsPerTick);
+ loResource->loLevelOption.numOfQueuesPerPort = maxQueueSets + dmMaxNumLocks + TD_MAX_LOCKS + maxNumOSLocks;
+ loResource->loLevelOption.mutexLockUsage = tiOneMutexLockPerQueue;
+ /* no more ESGL */
+ loResource->loLevelMem.count = memRequirement.count + dmMemRequirement.count;
+ /* setting interrupt requirements */
+ loResource->loLevelOption.maxInterruptVectors = SwConfig.max_MSIX_InterruptVectors;
+ loResource->loLevelOption.max_MSI_InterruptVectors = SwConfig.max_MSI_InterruptVectors;
+ loResource->loLevelOption.flag = SwConfig.legacyInt_X;
+ TI_DBG2(("tdsaLoLevelGetResource: asking maxInterruptVectors(MSIX) %d \n", loResource->loLevelOption.maxInterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking max_MSI_InterruptVectors %d \n", loResource->loLevelOption.max_MSI_InterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking flag - legacyInt_X %d \n", loResource->loLevelOption.flag));
+
+// TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n",memRequirement.count, loResource->loLevelMem.mem[memRequirement.count].numElements,loResource->loLevelMem.mem[memRequirement.count].totalLength, loResource->loLevelMem.mem[memRequirement.count].singleElementLength,loResource->loLevelMem.mem[memRequirement.count].alignment ));
+ TI_DBG6(("tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->loLevelMem.count));
+
+#elif defined(FDS_SM)
+ TI_DBG1(("tdsaLoLevelGetResource:MAX_LL_LAYER_MEM_DESCRIPTORS %d\n", MAX_LL_LAYER_MEM_DESCRIPTORS));
+ for(i=0;i<MAX_LL_LAYER_MEM_DESCRIPTORS;i++)
+ {
+ loResource->loLevelMem.mem[i].numElements = 0;
+ loResource->loLevelMem.mem[i].totalLength = 0;
+ loResource->loLevelMem.mem[i].singleElementLength = 0;
+ loResource->loLevelMem.mem[i].alignment = 0;
+ loResource->loLevelMem.mem[i].type = 0;
+ loResource->loLevelMem.mem[i].reserved = 0;
+ loResource->loLevelMem.mem[i].virtPtr = agNULL;
+ loResource->loLevelMem.mem[i].osHandle = agNULL;
+ loResource->loLevelMem.mem[i].physAddrUpper = 0;
+ loResource->loLevelMem.mem[i].physAddrLower = 0;
+ }
+
+ TI_DBG1(("tdsaLoLevelGetResource:memRequirement.count %d\n", memRequirement.count));
+ /* using the returned value from saGetRequirements */
+ for (i=0;i< memRequirement.count;i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = memRequirement.agMemory[i].numElements;
+ loResource->loLevelMem.mem[i].totalLength = memRequirement.agMemory[i].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = memRequirement.agMemory[i].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = memRequirement.agMemory[i].alignment;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+ TI_DBG1(("tdsaLoLevelGetResource:smMemRequirement.count %d\n", smMemRequirement.count));
+ /* using the returned value from smGetRequirements */
+ for (i=memRequirement.count;i< (memRequirement.count + smMemRequirement.count);i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = smMemRequirement.smMemory[i-memRequirement.count].numElements;
+ loResource->loLevelMem.mem[i].totalLength = smMemRequirement.smMemory[i-memRequirement.count].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = smMemRequirement.smMemory[i-memRequirement.count].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = smMemRequirement.smMemory[i-memRequirement.count].alignment;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == smMemRequirement.smMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == smMemRequirement.smMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == smMemRequirement.smMemory[i-memRequirement.count].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+
+
+ /* sets the low level options */
+ loResource->loLevelOption.usecsPerTick = MIN(usecsPerTick, smUsecsPerTick);
+ loResource->loLevelOption.numOfQueuesPerPort = maxQueueSets + smMaxNumLocks + TD_MAX_LOCKS + maxNumOSLocks;
+ loResource->loLevelOption.mutexLockUsage = tiOneMutexLockPerQueue;
+ /* no more ESGL */
+ loResource->loLevelMem.count = memRequirement.count + smMemRequirement.count;
+ /* setting interrupt requirements */
+ loResource->loLevelOption.maxInterruptVectors = SwConfig.max_MSIX_InterruptVectors;
+ loResource->loLevelOption.max_MSI_InterruptVectors = SwConfig.max_MSI_InterruptVectors;
+ loResource->loLevelOption.flag = SwConfig.legacyInt_X;
+ TI_DBG2(("tdsaLoLevelGetResource: asking maxInterruptVectors(MSIX) %d \n", loResource->loLevelOption.maxInterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking max_MSI_InterruptVectors %d \n", loResource->loLevelOption.max_MSI_InterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking flag - legacyInt_X %d \n", loResource->loLevelOption.flag));
+
+// TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n",memRequirement.count, loResource->loLevelMem.mem[memRequirement.count].numElements,loResource->loLevelMem.mem[memRequirement.count].totalLength, loResource->loLevelMem.mem[memRequirement.count].singleElementLength,loResource->loLevelMem.mem[memRequirement.count].alignment ));
+ TI_DBG6(("tdsaLoLevelGetResource: total memRequirement count %d TI_DMA_MEM\n", loResource->loLevelMem.count));
+
+
+#else
+ TI_DBG6(("tdsaLoLevelGetResource:MAX_LL_LAYER_MEM_DESCRIPTORS %d\n", MAX_LL_LAYER_MEM_DESCRIPTORS));
+ for(i=0;i<MAX_LL_LAYER_MEM_DESCRIPTORS;i++)
+ {
+ loResource->loLevelMem.mem[i].numElements = 0;
+ loResource->loLevelMem.mem[i].totalLength = 0;
+ loResource->loLevelMem.mem[i].singleElementLength = 0;
+ loResource->loLevelMem.mem[i].alignment = 0;
+ loResource->loLevelMem.mem[i].type = 0;
+ loResource->loLevelMem.mem[i].reserved = 0;
+ loResource->loLevelMem.mem[i].virtPtr = agNULL;
+ loResource->loLevelMem.mem[i].osHandle = agNULL;
+ loResource->loLevelMem.mem[i].physAddrUpper = 0;
+ loResource->loLevelMem.mem[i].physAddrLower = 0;
+ }
+
+ /* using the returned value from saGetRequirements */
+ for (i=0;i< memRequirement.count;i++)
+ {
+ /* hardcoded values for now */
+ loResource->loLevelMem.mem[i].numElements = memRequirement.agMemory[i].numElements;
+ loResource->loLevelMem.mem[i].totalLength = memRequirement.agMemory[i].totalLength;
+ loResource->loLevelMem.mem[i].singleElementLength = memRequirement.agMemory[i].singleElementLength;
+ loResource->loLevelMem.mem[i].alignment = memRequirement.agMemory[i].alignment;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].numElements, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].singleElementLength,loResource->loLevelMem.mem[i].alignment ));
+ if ( AGSA_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_DMA_MEM\n", i));
+
+ }
+ else if ( AGSA_CACHED_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_MEM\n", i));
+ }
+ else if ( AGSA_CACHED_DMA_MEM == memRequirement.agMemory[i].type )
+ {
+ loResource->loLevelMem.mem[i].type = TI_CACHED_DMA_MEM;
+ TI_DBG6(("tdsaLoLevelGetResource: index %d TI_CACHED_DMA_MEM\n", i));
+ }
+ }
+
+
+
+ /* sets the low level options */
+ loResource->loLevelOption.usecsPerTick = usecsPerTick;
+ loResource->loLevelOption.numOfQueuesPerPort = maxQueueSets + TD_MAX_LOCKS + maxNumOSLocks;
+ loResource->loLevelOption.mutexLockUsage = tiOneMutexLockPerQueue;
+ /* no more ESGL */
+ loResource->loLevelMem.count = memRequirement.count;
+ /* setting interrupt requirements */
+ loResource->loLevelOption.maxInterruptVectors = SwConfig.max_MSIX_InterruptVectors;
+ loResource->loLevelOption.max_MSI_InterruptVectors = SwConfig.max_MSI_InterruptVectors;
+ loResource->loLevelOption.flag = SwConfig.legacyInt_X;
+ TI_DBG2(("tdsaLoLevelGetResource: asking maxInterruptVectors(MSIX) %d \n", loResource->loLevelOption.maxInterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking max_MSI_InterruptVectors %d \n", loResource->loLevelOption.max_MSI_InterruptVectors));
+ TI_DBG2(("tdsaLoLevelGetResource: asking flag - legacyInt_X %d \n", loResource->loLevelOption.flag));
+
+ TI_DBG6(("tdsaLoLevelGetResource: index %d numElements %d totalLength %d singleElementLength %d alignment %d\n",memRequirement.count, loResource->loLevelMem.mem[memRequirement.count].numElements,loResource->loLevelMem.mem[memRequirement.count].totalLength, loResource->loLevelMem.mem[memRequirement.count].singleElementLength,loResource->loLevelMem.mem[memRequirement.count].alignment ));
+ TI_DBG6(("tdsaLoLevelGetResource: memRequirement.count %d TI_DMA_MEM\n", memRequirement.count));
+#endif
+
+
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaSharedMemCalculate
+*
+* Purpose: This function is called to determine the Transport
+* Dependent Layer internal resource requirement
+* for shared memory between target and initiator
+* functionality.
+*
+* \param tiRoot: Pointer to driver/port instance.
+* \param tdSharedMem: Pointer to shared memory structure
+*
+* \return: None
+*
+* \note - The shared memory is composed of like the followings
+* sizeof(tdsaRoot_t)
+* + sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT
+* + sizeof(tdsaDeviceData_t) * MaxTargets
+* + sizeof(tdsaEsglPageInfo_t) * NumEsglPages
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaSharedMemCalculate(
+ tiRoot_t * tiRoot,
+ tiLoLevelResource_t * loResource,
+ tiTdSharedMem_t * tdSharedMem
+ )
+{
+ bit32 MaxTargets;
+
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tdsaSharedMemCalculate: MaxTargets %d\n", MaxTargets));
+
+ /*
+ * Cached mem for the shared TD Layer functionality
+ */
+ tdSharedMem->tdSharedCachedMem1.singleElementLength =
+ sizeof(tdsaRoot_t) + (sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT) +
+ (sizeof(tdsaDeviceData_t) * MaxTargets);
+
+#ifdef TD_INT_COALESCE
+ /* adding TD interrupt coalesce data structure to the shared TD layer */
+ /* TD_MAX_INT_COALESCE is defined to be 512 */
+ tdSharedMem->tdSharedCachedMem1.singleElementLength +=
+ sizeof(tdsaIntCoalesceContext_t) * TD_MAX_INT_COALESCE;
+#endif
+
+#ifdef TD_DISCOVER
+ /* adding expander data strutures */
+ tdSharedMem->tdSharedCachedMem1.singleElementLength +=
+ sizeof(tdsaExpander_t) * MaxTargets;
+#endif
+
+ tdSharedMem->tdSharedCachedMem1.numElements = 1;
+
+ tdSharedMem->tdSharedCachedMem1.totalLength =
+ tdSharedMem->tdSharedCachedMem1.singleElementLength *
+ tdSharedMem->tdSharedCachedMem1.numElements;
+
+ tdSharedMem->tdSharedCachedMem1.alignment = 8;
+
+ tdSharedMem->tdSharedCachedMem1.type = TI_CACHED_MEM;
+
+ tdSharedMem->tdSharedCachedMem1.virtPtr = agNULL;
+ tdSharedMem->tdSharedCachedMem1.osHandle = agNULL;
+ tdSharedMem->tdSharedCachedMem1.physAddrUpper = 0;
+ tdSharedMem->tdSharedCachedMem1.physAddrLower = 0;
+ tdSharedMem->tdSharedCachedMem1.reserved = 0;
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \biref tdResetComMemFlags
+*
+* Purpose: This function is called to reset all the flags for the port
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaResetComMemFlags(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+ TI_DBG6(("tdsaResetComMemFlags: start\n"));
+ TI_DBG6(("tdsaResetComMemFlag:: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdsaResetComMemFlag:: ******* tdsaPortContext %p \n",tdsaPortContext));
+#endif
+
+ tdsaAllShared->flags.sysIntsActive = agFALSE;
+ tdsaAllShared->flags.resetInProgress = agFALSE;
+
+ return;
+}
+
+/*****************************************************************************
+*! \biref tdssInitSASPortStartInfo
+*
+* Purpose: This function sets information related to staring a port
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdssInitSASPortStartInfo(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ int i;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+ TI_DBG6(("tdssInitSASPortStartInfo: start\n"));
+
+ TI_DBG6(("tdssInitSASPortStartInfo: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdssInitSASPortStartInfo: ******* tdsaPortContext %p \n",tdsaPortContext));
+#endif
+
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ tdsaAllShared->Ports[i].tiPortalContext = agNULL;
+ tdsaAllShared->Ports[i].portContext = agNULL;
+ tdsaAllShared->Ports[i].SASID.sasAddressHi[0] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressHi[1] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressHi[2] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressHi[3] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressLo[0] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressLo[1] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressLo[2] = 0;
+ tdsaAllShared->Ports[i].SASID.sasAddressLo[3] = 0;
+ tdsaAllShared->Ports[i].SASID.phyIdentifier = (bit8) i;
+ /* continue .... */
+
+ tdsaAllShared->Ports[i].flags.portStarted = agFALSE;
+ tdsaAllShared->Ports[i].flags.portInitialized = agFALSE;
+ tdsaAllShared->Ports[i].flags.portReadyForDiscoverySent = agFALSE;
+ tdsaAllShared->Ports[i].flags.portStoppedByOSLayer = agFALSE;
+ tdsaAllShared->Ports[i].flags.failPortInit = agFALSE;
+ }
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaInitTimers
+*
+* Purpose: This function is called to initialize the timers
+* for initiator
+*
+* \param tiRoot: pointer to the driver instance
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+
+osGLOBAL void
+tdsaInitTimers(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+
+ TI_DBG6(("tdsaInitTimers: start \n"));
+ TI_DBG6(("tdsaInitTimers: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdsaInitTimers: ******* tdsaPortContext %p \n",tdsaPortContext));
+#endif
+
+ /* initialize the timerlist */
+ TDLIST_INIT_HDR(&(tdsaAllShared->timerlist));
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaJumpTableInit
+*
+* Purpose: This function initializes SAS related callback functions
+*
+* \param tiRoot: pointer to the driver instance
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaJumpTableInit(
+ tiRoot_t *tiRoot
+ )
+{
+
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+
+ TI_DBG6(("tdsaJumpTableInit: start \n"));
+ TI_DBG6(("tdsaJumpTableInit:: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdsaJumpTableInit:: ******* tdsaPortContext %p \n",tdsaPortContext));
+#endif
+
+ /* tdtype.h */
+ /*
+ For combo,
+ pSSPIOCompleted, pSMPCompleted; use callback
+ pSSPReqReceive, pSMPReqReceived; use jumptable
+ */
+
+#ifdef INITIATOR_DRIVER
+ tdsaAllShared->tdJumpTable.pSSPIOCompleted = agNULL; /* initiator */
+ tdsaAllShared->tdJumpTable.pSMPCompleted =agNULL; /* initiator */
+#endif
+#ifdef TARGET_DRIVER
+ tdsaAllShared->tdJumpTable.pSSPIOCompleted = agNULL;
+ tdsaAllShared->tdJumpTable.pSSPReqReceived = &ttdsaSSPReqReceived;
+ tdsaAllShared->tdJumpTable.pSMPReqReceived = &ttdsaSMPReqReceived;
+ tdsaAllShared->tdJumpTable.pSMPCompleted =agNULL;
+#endif
+ tdsaAllShared->tdJumpTable.pGetSGLChunk = agNULL;
+ return;
+
+}
+
+
+/*****************************************************************************
+*! \brief tdsaPortContextInit
+*
+* Purpose: This function initializes port contexts.
+*
+* \param tiRoot: pointer to the driver instance
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaPortContextInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+ int i = 0;
+ int j = 0;
+
+ TI_DBG6(("tdsaPortContextInit: start\n"));
+ TI_DBG6(("tdsaPortContextInit: ******* sizeof(tdsaPortContext) %d %x\n", (int)sizeof(tdsaPortContext_t), (unsigned int)sizeof(tdsaPortContext_t)));
+ TI_DBG6(("tdsaPortContextInit: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdsaPortContextInit: ******* tdsaPortContext %p \n",tdsaPortContext));
+ TI_DBG6(("tdsaPortContextInit: ******* tdsaPortContext+1 %p \n",tdsaPortContext + 1));
+ TI_DBG6(("tdsaPortContextInit: ******* &tdsaPortContext[0] %p &tdsaPortContext[1] %p\n", &(tdsaPortContext[0]), &(tdsaPortContext[1])));
+
+ TDLIST_INIT_HDR(&(tdsaAllShared->MainPortContextList));
+ TDLIST_INIT_HDR(&(tdsaAllShared->FreePortContextList));
+
+ for(i=0;i<TD_MAX_PORT_CONTEXT;i++)
+ {
+ TDLIST_INIT_ELEMENT(&(tdsaPortContext[i].FreeLink));
+ TDLIST_INIT_ELEMENT(&(tdsaPortContext[i].MainLink));
+
+#ifdef TD_DISCOVER
+ TDLIST_INIT_HDR(&(tdsaPortContext[i].discovery.discoveringExpanderList));
+ TDLIST_INIT_HDR(&(tdsaPortContext[i].discovery.UpdiscoveringExpanderList));
+ tdsaPortContext[i].discovery.type = TDSA_DISCOVERY_OPTION_FULL_START;
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.discoveryTimer));
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.configureRouteTimer));
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.deviceRegistrationTimer));
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.SMPBusyTimer));
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.BCTimer));
+ tdsaInitTimerRequest(tiRoot, &(tdsaPortContext[i].discovery.DiscoverySMPTimer));
+ tdsaPortContext[i].discovery.retries = 0;
+ tdsaPortContext[i].discovery.configureRouteRetries = 0;
+ tdsaPortContext[i].discovery.deviceRetistrationRetries = 0;
+ tdsaPortContext[i].discovery.pendingSMP = 0;
+ tdsaPortContext[i].discovery.SeenBC = agFALSE;
+ tdsaPortContext[i].discovery.forcedOK = agFALSE;
+ tdsaPortContext[i].discovery.SMPRetries = 0;
+// tdsaPortContext[i].discovery.doIncremental = agFALSE;
+ tdsaPortContext[i].discovery.ResetTriggerred = agFALSE;
+#endif
+
+
+#ifdef INITIATOR_DRIVER
+ tdsaPortContext[i].DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ tdsaPortContext[i].nativeSATAMode = agFALSE;
+ tdsaPortContext[i].directAttatchedSAS = agFALSE;
+ tdsaPortContext[i].DiscoveryRdyGiven = agFALSE;
+ tdsaPortContext[i].SeenLinkUp = agFALSE;
+
+#endif
+ tdsaPortContext[i].id = i;
+ tdsaPortContext[i].agPortContext = agNULL;
+ tdsaPortContext[i].LinkRate = 0;
+ tdsaPortContext[i].Count = 0;
+ tdsaPortContext[i].valid = agFALSE;
+ for (j=0;j<TD_MAX_NUM_PHYS;j++)
+ {
+ tdsaPortContext[i].PhyIDList[j] = agFALSE;
+ }
+ tdsaPortContext[i].RegisteredDevNums = 0;
+ tdsaPortContext[i].eventPhyID = 0xFF;
+ tdsaPortContext[i].Transient = agFALSE;
+ tdsaPortContext[i].PortRecoverPhyID = 0xFF;
+ tdsaPortContext[i].DiscFailNSeenBC = agFALSE;
+#ifdef FDS_DM
+ tdsaPortContext[i].dmPortContext.tdData = &(tdsaPortContext[i]);
+ tdsaPortContext[i].DMDiscoveryState = dmDiscCompleted;
+ tdsaPortContext[i].UseDM = agFALSE;
+ tdsaPortContext[i].UpdateMCN = agFALSE;
+#endif
+ /* add more variables later */
+ TDLIST_ENQUEUE_AT_TAIL(&(tdsaPortContext[i].FreeLink), &(tdsaAllShared->FreePortContextList));
+ }
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ for(i=0;i<TD_MAX_PORT_CONTEXT;i++)
+ {
+ TI_DBG6(("tdsaPortContextInit: index %d &tdsaPortContext[] %p\n", i, &(tdsaPortContext[i])));
+ }
+ TI_DBG6(("tdsaPortContextInit: sizeof(tdsaPortContext_t) %d 0x%x\n", sizeof(tdsaPortContext_t), sizeof(tdsaPortContext_t)));
+#endif
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaPortContextReInit
+*
+* Purpose: This function re-initializes port contexts for reuse.
+*
+* \param tiRoot: pointer to the driver instance
+* \param onePortContext: pointer to the portcontext
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaPortContextReInit(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ int j=0;
+#ifdef TD_DISCOVER
+ tdsaDiscovery_t *discovery;
+#endif
+
+ TI_DBG3(("tdsaPortContextReInit: start\n"));
+
+#ifdef TD_DISCOVER
+ discovery = &(onePortContext->discovery);
+
+ onePortContext->discovery.type = TDSA_DISCOVERY_OPTION_FULL_START;
+ onePortContext->discovery.retries = 0;
+ onePortContext->discovery.configureRouteRetries = 0;
+ onePortContext->discovery.deviceRetistrationRetries = 0;
+ onePortContext->discovery.pendingSMP = 0;
+ onePortContext->discovery.SeenBC = agFALSE;
+ onePortContext->discovery.forcedOK = agFALSE;
+ onePortContext->discovery.SMPRetries = 0;
+ onePortContext->discovery.ResetTriggerred = agFALSE;
+ /* free expander lists */
+ tdsaFreeAllExp(tiRoot, onePortContext);
+ /* kill the discovery-related timers if they are running */
+ if (discovery->discoveryTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->discoveryTimer
+ );
+ }
+ if (discovery->configureRouteTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->configureRouteTimer
+ );
+ }
+ if (discovery->deviceRegistrationTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->deviceRegistrationTimer
+ );
+ }
+ if (discovery->BCTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->BCTimer
+ );
+ }
+ if (discovery->SMPBusyTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->SMPBusyTimer
+ );
+ }
+ if (discovery->DiscoverySMPTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &discovery->DiscoverySMPTimer
+ );
+ }
+#endif
+
+#ifdef INITIATOR_DRIVER
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->nativeSATAMode = agFALSE;
+ onePortContext->directAttatchedSAS = agFALSE;
+ onePortContext->DiscoveryRdyGiven = agFALSE;
+ onePortContext->SeenLinkUp = agFALSE;
+#endif
+ onePortContext->agPortContext->osData = agNULL;
+ onePortContext->agPortContext = agNULL;
+ onePortContext->tiPortalContext = agNULL;
+ onePortContext->agRoot = agNULL;
+ onePortContext->LinkRate = 0;
+ onePortContext->Count = 0;
+ onePortContext->valid = agFALSE;
+ for (j=0;j<TD_MAX_NUM_PHYS;j++)
+ {
+ onePortContext->PhyIDList[j] = agFALSE;
+ }
+ onePortContext->RegisteredDevNums = 0;
+ onePortContext->eventPhyID = 0xFF;
+ onePortContext->Transient = agFALSE;
+ onePortContext->PortRecoverPhyID = 0xFF;
+ onePortContext->DiscFailNSeenBC = agFALSE;
+
+#ifdef FDS_DM
+ onePortContext->dmPortContext.tdData = onePortContext;
+ onePortContext->DMDiscoveryState = dmDiscCompleted;
+ onePortContext->UseDM = agFALSE;
+ onePortContext->UpdateMCN = agFALSE;
+#endif
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaDeviceDataInit
+*
+* Purpose: This function initializes devices
+*
+* \param tiRoot: pointer to the driver instance
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaDeviceDataInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContextMem;
+#endif
+ tdsaDeviceData_t *tdsaDeviceData =
+ (tdsaDeviceData_t *)tdsaAllShared->DeviceMem;
+ int i;
+#ifdef SATA_ENABLE
+ bit32 j;
+ satInternalIo_t *satIntIO;
+#endif
+ bit32 MaxTargets;
+
+ TI_DBG6(("tdsaDeviceDataInit: start\n"));
+ TI_DBG6(("tdsaDeviceDataInit: ******* tdsaPortContext %p \n",tdsaPortContext));
+ TI_DBG6(("tdsaDeviceDataInit: ******* tdsaDeviceData %p\n", tdsaDeviceData));
+ TI_DBG6(("tdsaDeviceDataInit: ******* tdsaDeviceData+1 %p\n", tdsaDeviceData+1));
+ TI_DBG6(("tdsaDeviceDataInit: ******* &tdsaDeviceData[0] %p &tdsaDeviceData[1] %p\n", &(tdsaDeviceData[0]), &(tdsaDeviceData[1])));
+
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tdsaDeviceDataInit: MaxTargets %d\n", MaxTargets));
+
+ TDLIST_INIT_HDR(&(tdsaAllShared->MainDeviceList));
+ TDLIST_INIT_HDR(&(tdsaAllShared->FreeDeviceList));
+
+ for(i=0;i<(int)MaxTargets;i++)
+ {
+ TDLIST_INIT_ELEMENT(&(tdsaDeviceData[i].FreeLink));
+ TDLIST_INIT_ELEMENT(&(tdsaDeviceData[i].MainLink));
+ TDLIST_INIT_ELEMENT(&(tdsaDeviceData[i].IncDisLink));
+ tdsaDeviceData[i].id = i;
+ tdsaDeviceData[i].InQID = 0;
+ tdsaDeviceData[i].OutQID = 0;
+ tdsaDeviceData[i].DeviceType = TD_DEFAULT_DEVICE;
+ tdsaDeviceData[i].agRoot = agNULL;
+ tdsaDeviceData[i].agDevHandle = agNULL;
+
+ tdsaDeviceData[i].pJumpTable = &(tdsaAllShared->tdJumpTable);
+ tdsaDeviceData[i].tiDeviceHandle.osData = agNULL;
+ tdsaDeviceData[i].tiDeviceHandle.tdData = &(tdsaDeviceData[i]);
+ tdsaDeviceData[i].tdPortContext = agNULL;
+ tdsaDeviceData[i].tdExpander = agNULL;
+ tdsaDeviceData[i].ExpDevice = agNULL;
+ tdsaDeviceData[i].phyID = 0xFF;
+ tdsaDeviceData[i].SASAddressID.sasAddressHi = 0;
+ tdsaDeviceData[i].SASAddressID.sasAddressLo = 0;
+ tdsaDeviceData[i].valid = agFALSE;
+ tdsaDeviceData[i].valid2 = agFALSE;
+ tdsaDeviceData[i].processed = agFALSE;
+ tdsaDeviceData[i].initiator_ssp_stp_smp = 0;
+ tdsaDeviceData[i].target_ssp_stp_smp = 0;
+ tdsaDeviceData[i].numOfPhys = 0;
+ tdsaDeviceData[i].registered = agFALSE;
+ tdsaDeviceData[i].directlyAttached = agFALSE;
+ tdsaDeviceData[i].SASSpecDeviceType = 0xFF;
+ tdsaDeviceData[i].IOStart = 0;
+ tdsaDeviceData[i].IOResponse = 0;
+ tdsaDeviceData[i].agDeviceResetContext.osData = agNULL;
+ tdsaDeviceData[i].agDeviceResetContext.sdkData = agNULL;
+ tdsaDeviceData[i].TRflag = agFALSE;
+ tdsaDeviceData[i].ResetCnt = 0;
+ tdsaDeviceData[i].OSAbortAll = agFALSE;
+
+#ifdef FDS_DM
+ tdsaDeviceData[i].devMCN = 1;
+ tdsaDeviceData[i].finalMCN = 1;
+#endif
+
+#ifdef FDS_SM
+ tdsaDeviceData[i].SMNumOfFCA = 0;
+ tdsaDeviceData[i].SMNumOfID = 0;
+#endif
+
+#ifdef SATA_ENABLE
+ TDLIST_INIT_HDR(&(tdsaDeviceData[i].satDevData.satIoLinkList));
+ TDLIST_INIT_HDR(&(tdsaDeviceData[i].satDevData.satFreeIntIoLinkList));
+ TDLIST_INIT_HDR(&(tdsaDeviceData[i].satDevData.satActiveIntIoLinkList));
+
+ /* default */
+ tdsaDeviceData[i].satDevData.satDriveState = SAT_DEV_STATE_NORMAL;
+ tdsaDeviceData[i].satDevData.satNCQMaxIO =SAT_NCQ_MAX;
+ tdsaDeviceData[i].satDevData.satPendingIO = 0;
+ tdsaDeviceData[i].satDevData.satPendingNCQIO = 0;
+ tdsaDeviceData[i].satDevData.satPendingNONNCQIO = 0;
+ tdsaDeviceData[i].satDevData.IDDeviceValid = agFALSE;
+ tdsaDeviceData[i].satDevData.freeSATAFDMATagBitmap = 0;
+ tdsaDeviceData[i].satDevData.NumOfFCA = 0;
+ tdsaDeviceData[i].satDevData.NumOfIDRetries = 0;
+ tdsaDeviceData[i].satDevData.ID_Retries = 0;
+ tdsaDeviceData[i].satDevData.IDPending = agFALSE;
+ tdsaInitTimerRequest(tiRoot, &(tdsaDeviceData[i].SATAIDDeviceTimer));
+#ifdef FDS_SM
+ tdsaInitTimerRequest(tiRoot, &(tdsaDeviceData[i].tdIDTimer));
+#endif
+ osti_memset(tdsaDeviceData[i].satDevData.satMaxLBA, 0, sizeof(tdsaDeviceData[i].satDevData.satMaxLBA));
+
+ tdsaDeviceData[i].satDevData.satSaDeviceData = &tdsaDeviceData[i];
+ satIntIO = &tdsaDeviceData[i].satDevData.satIntIo[0];
+ for (j = 0; j < SAT_MAX_INT_IO; j++)
+ {
+ TDLIST_INIT_ELEMENT (&satIntIO->satIntIoLink);
+ TDLIST_ENQUEUE_AT_TAIL (&satIntIO->satIntIoLink,
+ &tdsaDeviceData[i].satDevData.satFreeIntIoLinkList);
+ satIntIO->satOrgTiIORequest = agNULL;
+ satIntIO->id = j;
+ satIntIO = satIntIO + 1;
+ }
+#endif
+ /* some other variables */
+ TDLIST_ENQUEUE_AT_TAIL(&(tdsaDeviceData[i].FreeLink), &(tdsaAllShared->FreeDeviceList));
+ }
+
+#ifdef TD_INTERNAL_DEBUG /* for debugging only */
+ for(i=0;i<MaxTargets;i++)
+ {
+ TI_DBG6(("tdsaDeviceDataInit: index %d &tdsaDeviceData[] %p\n", i, &(tdsaDeviceData[i])));
+
+ }
+ TI_DBG6(("tdsaDeviceDataInit: sizeof(tdsaDeviceData_t) %d 0x%x\n", sizeof(tdsaDeviceData_t), sizeof(tdsaDeviceData_t)));
+#endif
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaDeviceDataReInit
+*
+* Purpose: This function re-initializes device data for reuse.
+*
+* \param tiRoot: pointer to the driver instance
+* \param onePortContext: pointer to the device data
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaDeviceDataReInit(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef SATA_ENABLE
+ int j=0;
+ satInternalIo_t *satIntIO;
+#endif
+
+ TI_DBG3(("tdsaDeviceDataReInit: start\n"));
+
+ oneDeviceData->InQID = 0;
+ oneDeviceData->OutQID = 0;
+ oneDeviceData->DeviceType = TD_DEFAULT_DEVICE;
+ oneDeviceData->agDevHandle = agNULL;
+
+ oneDeviceData->pJumpTable = &(tdsaAllShared->tdJumpTable);
+ oneDeviceData->tiDeviceHandle.osData = agNULL;
+ oneDeviceData->tiDeviceHandle.tdData = oneDeviceData;
+ oneDeviceData->tdPortContext = agNULL;
+ oneDeviceData->tdExpander = agNULL;
+ oneDeviceData->ExpDevice = agNULL;
+ oneDeviceData->phyID = 0xFF;
+ oneDeviceData->SASAddressID.sasAddressHi = 0;
+ oneDeviceData->SASAddressID.sasAddressLo = 0;
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ oneDeviceData->processed = agFALSE;
+ oneDeviceData->initiator_ssp_stp_smp = 0;
+ oneDeviceData->target_ssp_stp_smp = 0;
+ oneDeviceData->numOfPhys = 0;
+ oneDeviceData->registered = agFALSE;
+ oneDeviceData->directlyAttached = agFALSE;
+ oneDeviceData->SASSpecDeviceType = 0xFF;
+ oneDeviceData->IOStart = 0;
+ oneDeviceData->IOResponse = 0;
+ oneDeviceData->agDeviceResetContext.osData = agNULL;
+ oneDeviceData->agDeviceResetContext.sdkData = agNULL;
+ oneDeviceData->TRflag = agFALSE;
+ oneDeviceData->ResetCnt = 0;
+ oneDeviceData->OSAbortAll = agFALSE;
+
+#ifdef FDS_DM
+ oneDeviceData->devMCN = 1;
+ oneDeviceData->finalMCN = 1;
+#endif
+
+#ifdef FDS_SM
+ oneDeviceData->SMNumOfFCA = 0;
+ oneDeviceData->SMNumOfID = 0;
+ if (oneDeviceData->tdIDTimer.timerRunning == agTRUE)
+ {
+ tdsaKillTimer(
+ tiRoot,
+ &oneDeviceData->tdIDTimer
+ );
+ }
+#endif
+
+#ifdef SATA_ENABLE
+ /* default */
+ oneDeviceData->satDevData.satDriveState = SAT_DEV_STATE_NORMAL;
+ oneDeviceData->satDevData.satNCQMaxIO =SAT_NCQ_MAX;
+ oneDeviceData->satDevData.satPendingIO = 0;
+ oneDeviceData->satDevData.satPendingNCQIO = 0;
+ oneDeviceData->satDevData.satPendingNONNCQIO = 0;
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ oneDeviceData->satDevData.freeSATAFDMATagBitmap = 0;
+ oneDeviceData->satDevData.NumOfFCA = 0;
+ oneDeviceData->satDevData.NumOfIDRetries = 0;
+ oneDeviceData->satDevData.ID_Retries = 0;
+ oneDeviceData->satDevData.IDPending = agFALSE;
+
+ osti_memset(oneDeviceData->satDevData.satMaxLBA, 0, sizeof(oneDeviceData->satDevData.satMaxLBA));
+ osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
+
+ oneDeviceData->satDevData.satSaDeviceData = oneDeviceData;
+
+ satIntIO = (satInternalIo_t *)&(oneDeviceData->satDevData.satIntIo[0]);
+ for (j = 0; j < SAT_MAX_INT_IO; j++)
+ {
+ TI_DBG3(("tdsaDeviceDataReInit: in loop of internal io free, id %d\n", satIntIO->id));
+ satFreeIntIoResource(tiRoot, &(oneDeviceData->satDevData), satIntIO);
+ satIntIO = satIntIO + 1;
+ }
+#endif
+ return;
+}
+
+#ifdef TD_INT_COALESCE
+/*****************************************************************************
+*! \brief tdsaIntCoalCxtInit(
+*
+* Purpose: This function initializes interrupt coalesce contexts.
+*
+* \param tiRoot: pointer to the driver instance
+*
+* \return: None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaIntCoalCxtInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaPortContext_t *tdsaPortContext = (tdsaPortContext_t *)tdsaAllShared->PortContext;
+ tdsaDeviceData_t *tdsaDeviceData = (tdsaDeviceData_t *)tdsaAllShared->DeviceDataHead;
+ tdsaIntCoalesceContext_t *tdsaIntCoalCxt = (tdsaIntCoalesceContext_t *)tdsaAllShared->IntCoalesce;
+ int i = 0;
+ int j = 0;
+ bit32 MaxTargets;
+
+ TI_DBG2(("tdsaIntCoalCxtInit: start\n"));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* sizeof(tdsaPortContext) %d 0x%x\n", sizeof(tdsaPortContext_t), sizeof(tdsaPortContext_t)));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* sizeof(tdsaIntCoalCxt) %d 0x%x\n", sizeof(tdsaDeviceData_t), sizeof(tdsaDeviceData_t)));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* sizeof(tdsaIntCoalCxt) %d 0x%x\n", sizeof(tdsaIntCoalesceContext_t), sizeof(tdsaIntCoalesceContext_t)));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* tdsaRoot %p \n", tdsaRoot));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* tdsaPortContext %p \n",tdsaPortContext));
+ TI_DBG6(("tdsaDeviceDataInit: ******* tdsaDeviceData %p\n", tdsaDeviceData));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* tdsaIntCoalCxt+1 %p \n", tdsaIntCoalCxt + 1));
+ TI_DBG6(("tdsaIntCoalCxtInit: ******* &tdsaIntCoalCxt[0] %p &tdsaIntCoalCxt[1] %p\n", &(tdsaIntCoalCxt[0]), &(tdsaIntCoalCxt[1])));
+
+ /* for debug */
+ TI_DBG6(("tdsaIntCoalCxtInit: TD_MAX_PORT_CONTEXT %d\n", TD_MAX_PORT_CONTEXT));
+ /* the following fn fills in MaxTargets */
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tdsaIntCoalCxtInit: MaxTargets %d\n", MaxTargets));
+
+ TI_DBG6(("tdsaIntCoalCxtInit: portcontext in sum 0x%x\n", sizeof(tdsaPortContext_t) * TD_MAX_PORT_CONTEXT));
+ TI_DBG6(("tdsaIntCoalCxtInit: devicedata in sum 0x%x\n", sizeof(tdsaDeviceData_t) * MaxTargets));
+
+ /*
+ tdsaIntCoalCx[0] is just head, not an element
+ */
+ TDLIST_INIT_HDR(&(tdsaIntCoalCxt[0].MainLink));
+ TDLIST_INIT_HDR(&(tdsaIntCoalCxt[0].FreeLink));
+
+ tdsaIntCoalCxt[0].tdsaAllShared = tdsaAllShared;
+ tdsaIntCoalCxt[0].tiIntCoalesceCxt = agNULL;
+ tdsaIntCoalCxt[0].id = 0;
+
+
+ for(i=1;i<TD_MAX_INT_COALESCE;i++)
+ {
+ TDLIST_INIT_ELEMENT(&(tdsaIntCoalCxt[i].FreeLink));
+ TDLIST_INIT_ELEMENT(&(tdsaIntCoalCxt[i].MainLink));
+
+ tdsaIntCoalCxt[i].tdsaAllShared = tdsaAllShared;
+ tdsaIntCoalCxt[i].tiIntCoalesceCxt = agNULL;
+ tdsaIntCoalCxt[i].id = i;
+
+ /* enqueue */
+ TDLIST_ENQUEUE_AT_TAIL(&(tdsaIntCoalCxt[i].FreeLink), &(tdsaIntCoalCxt[0].FreeLink));
+ }
+ return;
+}
+#endif /* TD_INT_COALESCE */
+
+
+osGLOBAL void
+tdsaExpanderInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ tdsaExpander_t *tdsaExpander =
+ (tdsaExpander_t *)tdsaAllShared->ExpanderHead;
+ bit32 MaxTargets;
+
+
+ int i;
+
+ TI_DBG6(("tdsaExpanderInit: start\n"));
+ tdssGetMaxTargetsParams(tiRoot, &MaxTargets);
+ TI_DBG6(("tdsaExpanderInit: MaxTargets %d\n", MaxTargets));
+
+ // TDLIST_INIT_HDR(&(tdsaAllShared->discoveringExpanderList));
+ TDLIST_INIT_HDR(&(tdsaAllShared->freeExpanderList));
+
+ for(i=0;i<(int)MaxTargets;i++)
+ {
+ TDLIST_INIT_ELEMENT(&(tdsaExpander[i].linkNode));
+ TDLIST_INIT_ELEMENT(&(tdsaExpander[i].upNode));
+ /* initialize expander fields */
+ tdsaExpander[i].tdDevice = agNULL;
+ tdsaExpander[i].tdUpStreamExpander = agNULL;
+ tdsaExpander[i].tdDeviceToProcess = agNULL;
+ tdsaExpander[i].tdCurrentDownStreamExpander = agNULL;
+ tdsaExpander[i].hasUpStreamDevice = agFALSE;
+ tdsaExpander[i].numOfUpStreamPhys = 0;
+ tdsaExpander[i].currentUpStreamPhyIndex = 0;
+ tdsaExpander[i].numOfDownStreamPhys = 0;
+ tdsaExpander[i].currentDownStreamPhyIndex = 0;
+ tdsaExpander[i].discoveringPhyId = 0;
+ tdsaExpander[i].underDiscovering = agFALSE;
+ tdsaExpander[i].id = i;
+ tdsaExpander[i].tdReturnginExpander = agNULL;
+ tdsaExpander[i].discoverSMPAllowed = agTRUE;
+ osti_memset( &(tdsaExpander[i].currentIndex), 0, sizeof(tdsaExpander[i].currentIndex));
+ osti_memset( &(tdsaExpander[i].upStreamPhys), 0, sizeof(tdsaExpander[i].upStreamPhys));
+ osti_memset( &(tdsaExpander[i].downStreamPhys), 0, sizeof(tdsaExpander[i].downStreamPhys));
+ osti_memset( &(tdsaExpander[i].routingAttribute), 0, sizeof(tdsaExpander[i].routingAttribute));
+ tdsaExpander[i].configSASAddrTableIndex = 0;
+ osti_memset( &(tdsaExpander[i].configSASAddressHiTable), 0, sizeof(tdsaExpander[i].configSASAddressHiTable));
+ osti_memset( &(tdsaExpander[i].configSASAddressLoTable), 0, sizeof(tdsaExpander[i].configSASAddressLoTable));
+
+
+ TDLIST_ENQUEUE_AT_TAIL(&(tdsaExpander[i].linkNode), &(tdsaAllShared->freeExpanderList));
+ }
+ return;
+}
+
+osGLOBAL void
+tdsaQueueConfigInit(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ /* for memory index requirement */
+ agsaQueueConfig_t *QueueConfig;
+ bit32 i;
+
+ TI_DBG2(("tdsaQueueConfigInit: start\n"));
+ tdsaGetSwConfigParams(tiRoot);
+ QueueConfig = &tdsaAllShared->QueueConfig;
+
+ for(i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ QueueConfig->inboundQueues[i].elementCount = tdsaAllShared->InboundQueueSize[i];
+ QueueConfig->inboundQueues[i].elementSize = tdsaAllShared->InboundQueueEleSize[i];
+ QueueConfig->inboundQueues[i].priority = tdsaAllShared->InboundQueuePriority[i];
+ QueueConfig->inboundQueues[i].reserved = 0;
+ }
+ for(i=0;i<QueueConfig->numOutboundQueues;i++)
+ {
+ QueueConfig->outboundQueues[i].elementCount = tdsaAllShared->OutboundQueueSize[i];
+ QueueConfig->outboundQueues[i].elementSize = tdsaAllShared->OutboundQueueEleSize[i];
+ QueueConfig->outboundQueues[i].interruptDelay = tdsaAllShared->OutboundQueueInterruptDelay[i]; /* default 0; no interrupt delay */
+ QueueConfig->outboundQueues[i].interruptCount = tdsaAllShared->OutboundQueueInterruptCount[i]; /* default 1*/
+ QueueConfig->outboundQueues[i].interruptEnable = tdsaAllShared->OutboundQueueInterruptEnable[i]; /* default 1*/
+ QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
+ }
+ /* default */
+ for (i=0;i<8;i++)
+ {
+ QueueConfig->sasHwEventQueue[i] = 0;
+ QueueConfig->sataNCQErrorEventQueue[i] = 0;
+ }
+
+#ifdef TARGET_DRIVER
+ for (i=0;i<8;i++)
+ {
+ QueueConfig->tgtITNexusEventQueue[i] = 0;
+ QueueConfig->tgtSSPEventQueue[i] = 0;
+ QueueConfig->tgtSMPEventQueue[i] = 0;
+ }
+#endif
+ QueueConfig->iqNormalPriorityProcessingDepth = 0;
+ QueueConfig->iqHighPriorityProcessingDepth = 0;
+ QueueConfig->generalEventQueue = 0;
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdssGetMaxTargetsParams
+*
+* Purpose: This function is called to get default parameters from the
+* OS Specific area. This function is called in the context of
+* tiCOMGetResource() and tiCOMInit().
+*
+*
+* \param tiRoot: Pointer to initiator driver/port instance.
+* \param option: Pointer to bit32 where the max target number is saved
+*
+* \return: None
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL void
+tdssGetMaxTargetsParams(
+ tiRoot_t *tiRoot,
+ bit32 *pMaxTargets
+ )
+{
+ char *key = agNULL;
+ char *subkey1 = agNULL;
+ char *subkey2 = agNULL;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char iniParmsStr[] = "InitiatorParms";
+ bit32 MaxTargets;
+
+ TI_DBG6(("tdssGetMaxTargetsParams: start\n"));
+
+ *pMaxTargets = DEFAULT_MAX_DEV;
+
+ /* to remove compiler warnings */
+ pLastUsedChar = pLastUsedChar;
+ lenRecv = lenRecv;
+ subkey2 = subkey2;
+ subkey1 = subkey1;
+ key = key;
+ buffer = &tmpBuffer[0];
+ buffLen = sizeof (tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+
+ /* defaults are overwritten in the following */
+ /* Get MaxTargets */
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr,
+ iniParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "MaxTargets",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ MaxTargets = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ MaxTargets = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ *pMaxTargets = MaxTargets;
+ TI_DBG2(("tdssGetMaxTargetsParams: MaxTargets %d\n", MaxTargets ));
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ return;
+}
+
+/* temporary to distinguish SAS and SATA mode */
+osGLOBAL void
+tdssGetSATAOnlyModeParams(
+ tiRoot_t *tiRoot,
+ bit32 *pSATAOnlyMode
+ )
+{
+ char *key = agNULL;
+ char *subkey1 = agNULL;
+ char *subkey2 = agNULL;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char iniParmsStr[] = "InitiatorParms";
+ bit32 SATAOnlyMode;
+
+ TI_DBG6(("tdssGetSATAOnlyModeParams: start\n"));
+
+ *pSATAOnlyMode = agFALSE; /* default SAS and SATA */
+
+ /* to remove compiler warnings */
+ pLastUsedChar = pLastUsedChar;
+ lenRecv = lenRecv;
+ subkey2 = subkey2;
+ subkey1 = subkey1;
+ key = key;
+ buffer = &tmpBuffer[0];
+ buffLen = sizeof (tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+
+ /* defaults are overwritten in the following */
+ /* Get SATAOnlyMode */
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr,
+ iniParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "SATAOnlyMode",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SATAOnlyMode = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SATAOnlyMode = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ *pSATAOnlyMode = SATAOnlyMode;
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ return;
+}
+
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdint.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdint.c
new file mode 100644
index 0000000..44bbe0f
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdint.c
@@ -0,0 +1,263 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ *
+ * This file contains interrupt related functions in the SAS/SATA TD layer
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+/*****************************************************************************
+*! \biref tiCOMInterruptHandler
+*
+* Purpose: This function is called to service the hardware interrupt of the
+* hardware.
+*
+* \param tiRoot: Pointer to initiator specific root data structure for this
+* instance of the driver.
+*
+* \param channelNum: The zero-base channel number of the controller.
+* 0xFFFFFFFF indicates that the OS-App Specific layer does
+* not provide the channel number. The TD/LL Layer needs to
+* discover of any of its own channels that are causing the
+* interrupt.
+*
+* \return None
+*
+* \note - The only thing that this API will do is to acknowledge and mask
+* the necessary hardware interrupt register. The actual processing
+* of the interrupt handler is done in tiCOMDelayedInterruptHandler().
+*
+*****************************************************************************/
+FORCEINLINE bit32
+tiCOMInterruptHandler(
+ tiRoot_t * tiRoot,
+ bit32 channelNum)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
+ bit32 interruptPending = agFALSE;
+
+ interruptPending = saInterruptHandler(agRoot, channelNum);
+
+ return interruptPending;
+
+} /* tiCOMInterruptHandler() */
+
+
+/*****************************************************************************
+*! \brief tiCOMDelayedInterruptHandler
+*
+* Purpose: This function is called to process the task associated with the
+* interrupt handler. The task that this handler needs to do includes:
+* completion of I/O, login event, error event, etc
+*
+* \param tiRoot: Pointer to initiator specific root data structure for
+* this instance of the driver.
+* \param channelNum: The zero-base channel number of the controller.
+* 0xFFFFFFFF indicates that the OS-App Specific layer does
+* not provide the channel number. The TD/LL Layer needs to
+* discover of any of its own channels that are causing the
+* interrupt.
+* \param count: Count on how many items (such as IO completion) need to
+* be processed in this context.
+* \param interruptContext: The thread/process context within which this
+* function is called.
+*
+* tiInterruptContext: this function is called within an
+* interrupt context.
+* tiNonInterruptContext: this function is called outside an
+* interrupt context.
+* \return None
+*
+*****************************************************************************/
+FORCEINLINE
+bit32
+tiCOMDelayedInterruptHandler(
+ tiRoot_t *tiRoot,
+ bit32 channelNum,
+ bit32 count,
+ bit32 context
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot = agNULL;
+ bit32 completed = 0;
+
+ TDSA_OUT_ENTER(tiRoot);
+
+ if(context == tiInterruptContext)
+ {
+ agRoot = &(tdsaAllShared->agRootInt);
+ }
+ else
+ {
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ }
+
+ completed = saDelayedInterruptHandler(agRoot, channelNum, count);
+
+ if(completed == 0)
+ {
+ TI_DBG3(("tiCOMDelayedInterruptHandler: processedMsgCount zero\n"));
+ }
+
+
+ TDSA_OUT_LEAVE(tiRoot);
+
+ return(completed);
+} /* tiCOMDelayedInterruptHandler() */
+
+
+/*****************************************************************************
+*! \brief tiCOMSystemInterruptsActive
+*
+* Purpose: This function is called to indicate whether interrupts are
+* active or not from this point in time.
+*
+* \param tiRoot: Pointer to initiator specific root data structure for
+* this instance of the driver.
+* \param sysIntsActive: Boolean value either true or false
+*
+* \return None
+*
+*****************************************************************************/
+osGLOBAL void
+tiCOMSystemInterruptsActive(
+ tiRoot_t * tiRoot,
+ bit32 sysIntsActive
+ )
+{
+
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot;
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+#ifdef SPC_POLLINGMODE
+ if(sysIntsActive) return;
+#endif /* SPC_POLLINGMODE */
+
+ tdsaAllShared->flags.sysIntsActive = sysIntsActive;
+
+ TI_DBG6(("tiCOMSystemInterruptsActive: start\n"));
+ /* enable low level interrupts */
+ if(agRoot->sdkData != agNULL)
+ {
+ saSystemInterruptsActive(
+ agRoot,
+ (agBOOLEAN) tdsaAllShared->flags.sysIntsActive
+ );
+ }
+
+ TI_DBG6(("tiCOMSystemInterruptsActive: end\n"));
+} /* tiCOMSystemInterruptsActive */
+
+
+osGLOBAL void
+tiComCountActiveIORequests(
+ tiRoot_t * tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot;
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ saCountActiveIORequests(agRoot );
+}
+
+/*****************************************************************************
+*! \brief tiCOMInterruptEnable
+*
+* Purpose: This function is called to enable an interrupts on the specified channel
+* active or not from this point in time.
+*
+* \param tiRoot: Pointer to initiator specific root data structure for
+* this instance of the driver.
+* \param : channelNum vector number for MSIX Zero for legacy interrupt
+*
+* \return None
+*
+*****************************************************************************/
+osGLOBAL FORCEINLINE
+void
+tiCOMInterruptEnable(
+ tiRoot_t * tiRoot,
+ bit32 channelNum)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot;
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ saSystemInterruptsEnable(agRoot, channelNum);
+}
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c
new file mode 100644
index 0000000..f192680
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.c
@@ -0,0 +1,3682 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ *
+ * This file contains Management IOCTL APIs
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+#include <dev/pms/RefTisa/sallsdk/spc/mpidebug.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdioctl.h>
+
+#include <dev/pms/RefTisa/sallsdk/spc/sadefs.h>
+#include <dev/pms/RefTisa/sallsdk/spc/spcdefs.h>
+#include <dev/pms/RefTisa/sallsdk/spc/mpi.h>
+#include <dev/pms/RefTisa/sallsdk/spc/sallist.h>
+#include <dev/pms/RefTisa/sallsdk/spc/satypes.h>
+
+
+#define agFieldOffset(baseType,fieldName) \
+ /*lint -e545 */ \
+ ((bit32)((bitptr)(&(((baseType *)0)->fieldName)))) \
+
+#ifdef SA_LL_API_TEST
+osGLOBAL bit32 tdLlApiTestIoctl(tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3);
+#endif /* SA_LL_API_TEST */
+
+
+extern bit32 volatile sgpioResponseSet;
+
+#ifdef SPC_ENABLE_PROFILE
+/*****************************************************************************
+*
+* tdipFWProfileIoctl
+*
+* Purpose: This routine is called to process the FW Profile IOCTL function.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32 tdipFWProfileIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+
+ bit32 status = IOCTL_CALL_SUCCESS;
+ bit32 bufAddrUpper = 0;
+ bit32 bufAddrLower = 0;
+ tdFWProfile_t *fwProfile;
+
+ void *osMemHandle = agNULL;
+ void *buffer = agNULL;
+ agsaFwProfile_t fwProfileInfo = {0};
+
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+
+ fwProfile = (tdFWProfile_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+
+
+ fwProfileInfo.processor = fwProfile->processor;
+ fwProfileInfo.cmd = fwProfile->cmd;
+ fwProfileInfo.len = fwProfile->len;
+ fwProfileInfo.tcid = fwProfile->tcid;
+ if(fwProfile->cmd == START_CODE_PROFILE)
+ {
+ fwProfileInfo.codeStartAdd = fwProfile->codeStartAdd;
+ fwProfileInfo.codeEndAdd = fwProfile->codeEndAdd;
+ }
+ if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
+ {
+ if(fwProfile->len != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &bufAddrUpper,
+ &bufAddrLower,
+ 8,
+ fwProfile->len,
+ agFALSE))
+ {
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, fwProfile->len);
+ }
+ fwProfileInfo.agSgl.sgLower = bufAddrLower;
+ fwProfileInfo.agSgl.sgUpper = bufAddrUpper;
+ fwProfileInfo.agSgl.len = fwProfile->len;
+ fwProfileInfo.agSgl.extReserved = 0;
+ tdsaAllShared->tdFWProfileEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWProfileEx.virtAddr = buffer;
+ tdsaAllShared->tdFWProfileEx.len = fwProfile->len;
+ }
+ tdsaAllShared->tdFWProfileEx.tdFWProfile = fwProfile;
+ tdsaAllShared->tdFWProfileEx.param1 = agParam1;
+ tdsaAllShared->tdFWProfileEx.param2 = agParam2;
+ tdsaAllShared->tdFWProfileEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWProfileEx.inProgress = 1;
+ status = saFwProfile(agRoot,
+ agNULL,
+ 0,
+ &fwProfileInfo
+ );
+ if(status)
+ {
+ if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
+ ostiFreeMemory(tiRoot, osMemHandle, fwProfile->len);
+ status = IOCTL_CALL_FAIL;
+ }
+ else
+ status = IOCTL_CALL_PENDING;
+ return status;
+}
+
+
+#endif
+
+/*****************************************************************************
+*
+* tdipFWControlIoctl
+*
+* Purpose: This routine is called to process the FW control IOCTL function.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32 tdipFWControlIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ ) {
+
+ bit32 status = IOCTL_CALL_PENDING;
+ bit32 bufAddrUpper = 0;
+ bit32 bufAddrLower = 0;
+ tdFWControl_t *fwControl;
+ void *osMemHandle = agNULL;
+ void *buffer = agNULL;
+ agsaUpdateFwFlash_t flashUpdateInfo;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+
+ if( agIOCTLPayload->Length <
+ ( agFieldOffset(tiIOCTLPayload_t, FunctionSpecificArea) +
+ sizeof(tdFWControl_t) ) ) {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ status = IOCTL_CALL_FAIL;
+ return status;
+ }
+ fwControl = (tdFWControl_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+
+ if(fwControl->len != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &bufAddrUpper,
+ &bufAddrLower,
+ 8,
+ fwControl->len,
+ agFALSE) )
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset( (void *)buffer, 0, fwControl->len );
+ osti_memcpy( (void *)buffer,
+ fwControl->buffer,
+ fwControl->len );
+ flashUpdateInfo.agSgl.sgLower = bufAddrLower;
+ flashUpdateInfo.agSgl.sgUpper = bufAddrUpper;
+ flashUpdateInfo.agSgl.len = fwControl->len;
+ flashUpdateInfo.agSgl.extReserved = 0;
+ flashUpdateInfo.currentImageOffset = fwControl->offset;
+ flashUpdateInfo.currentImageLen = fwControl->len;
+ flashUpdateInfo.totalImageLen = fwControl->size;
+ switch (agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_FW_DOWNLOAD_DATA:
+ {
+ TI_DBG6(("tdipFWControlIoctl: calling saFwFlashUpdate\n"));
+ tdsaAllShared->tdFWControlEx.tdFWControl = fwControl;
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = saFwFlashUpdate( agRoot,
+ agNULL,
+ 0,
+ &flashUpdateInfo );
+ if(status) {
+ status = IOCTL_CALL_FAIL;
+ fwControl->retcode = IOCTL_CALL_TIMEOUT;
+ }
+ else {
+ status = IOCTL_CALL_PENDING;
+ }
+ break;
+ }
+ default:
+ status = IOCTL_CALL_INVALID_CODE;
+ TI_DBG1( ("tdipFWControlIoctl: ERROR: Wrong IOCTL code %d\n",
+ agIOCTLPayload->MinorFunction) );
+ ostiFreeMemory(tiRoot, osMemHandle, fwControl->len);
+ return status;
+ } /* end IOCTL switch */
+ return status;
+} /* tdipFWControlIoctl */
+
+
+/*****************************************************************************
+*
+* tiCOMMgntIOCTL
+*
+* Purpose: This routine is a TISA API for processing the PMC specific
+* IOCTL function.
+*
+* Each IOCTL function is identified by the IOCTL header
+* specified in the data payload as the following:
+* Field Description
+* ----- -----------
+* Signature PMC IOCTL signature.
+* #define PMC_IOCTL_SIGNATURE 0x1234
+* MajorFunction Major function number.
+* MinorFunction Minor function number.
+* Length Length of this structure in bytes.
+* Status Return status for this IOCTL function.
+* FunctionSpecificArea Variable length function specific area.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+* IOCTL_CALL_INVALID_DEVICE Invalid target or destination device.
+*
+* Note:
+* Used ostiAllocMemory() OS layer callback function to allocate memory
+* for DMA operaion. Then use ostiFreeMemory() to deallocate the memory.
+*
+*****************************************************************************/
+osGLOBAL bit32
+tiCOMMgntIOCTL(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ bit32 status = IOCTL_CALL_INVALID_CODE;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
+ bit32 EventLogLength = 0;
+ bit32 EventLogOption;
+ bit32 ReadLength = 0;
+ bit32 Offset = 0;
+ bit32 RequestLength = 0; /* user request on how much data to pass to application */
+ agsaContext_t *agContext = NULL;
+ bit8 *loc = 0;
+
+ TI_DBG3(("tiCOMMgntIOCTL: start\n"));
+
+ TI_DBG3(("tiCOMMgntIOCTL: tiRoot %p agIOCTLPayload %p agParam1 %p agParam2 %p agParam3 %p\n",
+ tiRoot,agIOCTLPayload,agParam1,agParam2,agParam3 ));
+
+ TI_DBG3(("tiCOMMgntIOCTL: Signature %X\ntiCOMMgntIOCTL: MajorFunction 0x%X\ntiCOMMgntIOCTL: MinorFunction 0x%X\ntiCOMMgntIOCTL: Length 0x%X\ntiCOMMgntIOCTL: Status 0x%X\ntiCOMMgntIOCTL: Reserved 0x%X\ntiCOMMgntIOCTL: FunctionSpecificArea 0x%X\n",
+ agIOCTLPayload->Signature,
+ agIOCTLPayload->MajorFunction,
+ agIOCTLPayload->MinorFunction,
+ agIOCTLPayload->Length,
+ agIOCTLPayload->Status,
+ agIOCTLPayload->Reserved,
+ agIOCTLPayload->FunctionSpecificArea[0] ));
+
+ /* PMC IOCTL signatures matched ? */
+ if(agIOCTLPayload->Signature != PMC_IOCTL_SIGNATURE)
+ {
+ TI_DBG1(("tiCOMMgntIOCTL:agIOCTLPayload->Signature %x IOCTL_CALL_INVALID_CODE\n",agIOCTLPayload->Signature ));
+ status = IOCTL_CALL_INVALID_CODE;
+ return (status);
+ }
+
+ switch (agIOCTLPayload->MajorFunction)
+ {
+//TODO: make the card identification more robust. For now - just to keep going with FW download
+#ifdef IOCTL_INTERRUPT_TIME_CONFIG
+ case IOCTL_MJ_CARD_PARAMETER:
+ {
+ switch( agIOCTLPayload->MinorFunction )
+ {
+ case IOCTL_MN_CARD_GET_INTERRUPT_CONFIG:
+ {
+ agsaInterruptConfigPage_t *pInterruptConfig = (agsaInterruptConfigPage_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+ status = saGetControllerConfig(agRoot,
+ 0,
+ AGSA_INTERRUPT_CONFIGURATION_PAGE,
+ pInterruptConfig->vectorMask0,
+ pInterruptConfig->vectorMask1,
+ agParam2);
+ if(status == AGSA_RC_SUCCESS) {
+ status = IOCTL_CALL_PENDING;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ } else {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+ break;
+ }
+ case IOCTL_MN_CARD_GET_TIMER_CONFIG:
+ status = saGetControllerConfig(agRoot, 0, AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE, 0, 0, agParam2);
+ if(status == AGSA_RC_SUCCESS) {
+ status = IOCTL_CALL_PENDING;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ } else {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+ break;
+ }
+ break;
+ }
+#endif /* IOCTL_INTERRUPT_TIME_CONFIG */
+ case IOCTL_MJ_INI_DRIVER_IDENTIFY:
+ {
+ status=IOCTL_CALL_SUCCESS;
+ break;
+ }
+ case IOCTL_MJ_GET_DEVICE_LUN:
+ status = tdsaGetNumOfLUNIOCTL(tiRoot,agIOCTLPayload, agParam1, agParam2, agParam3);
+ if(status == IOCTL_CALL_SUCCESS)
+ {
+ status = IOCTL_CALL_PENDING;
+ }
+ break;
+case IOCTL_MJ_SMP_REQUEST:
+ status = tdsaSendSMPIoctl(tiRoot, agIOCTLPayload,
+ agParam1,agParam2,agParam3);
+ break;
+
+ case IOCTL_MJ_FW_CONTROL:
+ {
+ //ostiIOCTLClearSignal (tiRoot, &agParam1, &agParam2, &agParam3);
+ status = tdipFWControlIoctl( tiRoot, agIOCTLPayload,
+ agParam1, agParam2, agParam3);
+
+ break;
+ }
+//#ifdef EVENT_LOG_INFO_TESTING
+ /* Reserved field in tiIOCTLPayload_t is used as offset */
+ case IOCTL_MJ_GET_EVENT_LOG1:
+ {
+ switch (agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_FW_GET_TRACE_BUFFER:
+ {
+ agsaControllerEventLog_t EventLog;
+ saGetControllerEventLogInfo(agRoot, &EventLog);
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_EVENT_LOG1 Length %d\n", agIOCTLPayload->Length));
+ RequestLength = agIOCTLPayload->Length;
+ Offset = agIOCTLPayload->Reserved;
+ EventLogLength = EventLog.eventLog1.totalLength;
+ EventLogOption = EventLog.eventLog1Option;
+ if (EventLogLength <= Offset)
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: 1 out of range Requestlength %d Offset %d event log length %d\n", RequestLength, Offset, EventLogLength));
+ // out of range
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ if(EventLogOption == 0)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_FW_EVENTLOG_DISABLED;
+ }
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ ReadLength = MIN(EventLogLength - Offset, RequestLength);
+ loc = (bit8 *)EventLog.eventLog1.virtPtr + Offset;
+ osti_memcpy(&(agIOCTLPayload->FunctionSpecificArea), loc, ReadLength);
+ // tdhexdump("IOCTL_MJ_GET_EVENT_LOG1 first 32bytes", (bit8 *)&(agIOCTLPayload->FunctionSpecificArea), 32);
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ agIOCTLPayload->Length = (bit16)ReadLength;
+ status=IOCTL_CALL_SUCCESS;
+ break;
+ }
+ case IOCTL_MN_FW_GET_EVENT_FLASH_LOG1:
+ {
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MN_FW_GET_EVENT_FLASH_LOG1\n"));
+ status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+ }
+ break;
+ }
+
+ case IOCTL_MJ_GET_EVENT_LOG2:
+ {
+ switch (agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_FW_GET_TRACE_BUFFER:
+ {
+ agsaControllerEventLog_t EventLog;
+ saGetControllerEventLogInfo(agRoot, &EventLog);
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_EVENT_LOG2 Length %d\n", agIOCTLPayload->Length));
+ RequestLength = agIOCTLPayload->Length;
+ Offset = agIOCTLPayload->Reserved;
+ EventLogLength = EventLog.eventLog2.totalLength;
+ EventLogOption = EventLog.eventLog2Option;
+ if (EventLogLength <= Offset)
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: 2 out of range Requestlength %d Offset %d event log length %d\n", RequestLength, Offset, EventLogLength));
+ /* out of range */
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ if(EventLogOption == 0)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_FW_EVENTLOG_DISABLED;
+ }
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ ReadLength = MIN(EventLogLength - Offset, RequestLength);
+ loc = (bit8 *)EventLog.eventLog2.virtPtr + Offset;
+ osti_memcpy(&(agIOCTLPayload->FunctionSpecificArea), loc, ReadLength);
+ // tdhexdump("IOCTL_MJ_GET_EVENT_LOG2 first 32bytes", (bit8 *)&(agIOCTLPayload->FunctionSpecificArea), 32);
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ agIOCTLPayload->Length = (bit16)ReadLength;
+ status=IOCTL_CALL_SUCCESS;
+ break;
+ }
+ case IOCTL_MN_FW_GET_EVENT_FLASH_LOG2:
+ {
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MN_FW_GET_EVENT_FLASH_LOG2\n"));
+ status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+ }
+ break;
+ }
+
+
+ case IOCTL_MJ_FW_INFO:
+ {
+ agsaControllerInfo_t ControllerInfo;
+ saGetControllerInfo(agRoot, &ControllerInfo);
+ TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_FW_INFO Length %d\n", agIOCTLPayload->Length));
+ RequestLength = agIOCTLPayload->Length;
+ Offset = agIOCTLPayload->Reserved;
+ if (RequestLength == 0)
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_FW_INFO: No more Data!\n"));
+ /* out of range */
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+
+ osti_memcpy((bit8*)&(agIOCTLPayload->FunctionSpecificArea), (bit8*)&ControllerInfo, sizeof(agsaControllerInfo_t));
+
+ TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo signature 0x%X\n",ControllerInfo.signature));
+ TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo PCILinkRate 0x%X\n",ControllerInfo.PCILinkRate));
+ TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo PCIWidth 0x%X\n",ControllerInfo.PCIWidth));
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status=IOCTL_CALL_SUCCESS;
+ break;
+
+ }
+
+ case IOCTL_MJ_GET_FW_REV:
+ {
+ agsaControllerInfo_t ControllerInfo;
+ saGetControllerInfo(agRoot, &ControllerInfo);
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FW_REV Length %d\n", agIOCTLPayload->Length));
+ RequestLength = agIOCTLPayload->Length;
+ Offset = agIOCTLPayload->Reserved;
+ if (RequestLength == 0)
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FW_REV: No more Data!\n"));
+ /* out of range */
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+
+ osti_memcpy((bit8*)&(agIOCTLPayload->FunctionSpecificArea), (bit8*)&ControllerInfo.fwRevision, sizeof(bit32));
+ loc = (bit8 *)&(agIOCTLPayload->FunctionSpecificArea)+ sizeof(bit32);
+ osti_memcpy(loc, (bit8*)&ControllerInfo.sdkRevision, sizeof(bit32));
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status=IOCTL_CALL_SUCCESS;
+ break;
+
+ }
+
+#ifdef SPC_ENABLE_PROFILE
+ case IOCTL_MJ_FW_PROFILE:
+ {
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_FW_PROFILE\n"));
+ status = tdipFWProfileIoctl( tiRoot, agIOCTLPayload,
+ agParam1, agParam2, agParam3);
+ break;
+ }
+#endif /* SPC_ENABLE_PROFILE */
+
+ case IOCTL_MJ_GET_CORE_DUMP:
+ {
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_CORE_DUMP\n"));
+ if (tiIS_SPC(agRoot))
+ {
+ status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ }
+ else
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
+ status = IOCTL_CALL_SUCCESS;
+ }
+ break;
+ }
+//#endif
+ case IOCTL_MJ_NVMD_SET:
+ {
+ bit8 nvmDev;
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_NVMD_SET\n"));
+ nvmDev = (bit8) agIOCTLPayload->Status;
+ agIOCTLPayload->Status = 0;
+ status = tdsaNVMDSetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, &nvmDev);
+ break;
+ }
+#if 0
+case IOCTL_MJ_GPIO:
+ {
+ bit32 sVid =0;
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GPIO\n"));
+
+ /* Get Subsystem vendor */
+ sVid = ostiChipConfigReadBit32(tiRoot,0x2C);
+ sVid = sVid & 0xFFFF;
+
+ /* GPIO is only intended for chip down design
+ * therefore it's only applies to 8H/SPCv product family
+ */
+ if(sVid == 0x9005)
+ return IOCTL_CALL_INVALID_DEVICE;
+
+ status = tdsaGpioSetup(tiRoot, agContext, agIOCTLPayload, agParam1, agParam2);
+ if(status == IOCTL_CALL_SUCCESS)
+ status = IOCTL_CALL_PENDING; /* Wait for response from the Controller */
+ else
+ return status;
+
+ break;
+ }
+#endif
+
+ case IOCTL_MJ_SGPIO:
+ {
+ TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_SGPIO\n"));
+ status = tdsaSGpioIoctlSetup(tiRoot, agContext, agIOCTLPayload, agParam1, agParam2);
+ break;
+ }
+
+ case IOCTL_MJ_NVMD_GET:
+ {
+ bit8 nvmDev;
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_NVMD_GET\n"));
+ nvmDev = (bit8) agIOCTLPayload->Status;
+ agIOCTLPayload->Status = 0;
+ status = tdsaNVMDGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, &nvmDev);
+ break;
+ }
+
+ case IOCTL_MJ_GET_FORENSIC_DATA:
+ {
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FORENSIC_DATA\n"));
+ status = tdsaForensicDataGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+ case IOCTL_MJ_GET_DEVICE_INFO:
+ {
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_DEVICE_INFO\n"));
+ status = tdsaDeviceInfoGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+
+ case IOCTL_MJ_GET_IO_ERROR_STATISTIC:
+ {
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_IO_ERROR_STATISTIC\n"));
+ status = tdsaIoErrorStatisticGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+
+ case IOCTL_MJ_GET_IO_EVENT_STATISTIC:
+ {
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_IO_EVENT_STATISTIC\n"));
+ status = tdsaIoEventStatisticGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+
+ case IOCTL_MJ_SEND_BIST:
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_SEND_BIST\n"));
+ status = tdsaSendBISTIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+
+#if 0
+ case IOCTL_MJ_SET_OR_GET_REGISTER:
+ {
+ TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_SET_OR_GET_REGISTER\n"));
+ status = tdsaRegisterIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+
+#endif
+ case IOCTL_MJ_PHY_DETAILS:
+ {
+ PhyDetails_t *PhyDetails = (PhyDetails_t*)&agIOCTLPayload->FunctionSpecificArea;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
+ agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
+ bit8 *sasAddressHi;
+ bit8 *sasAddressLo;
+ bit8 sas_dev_type;
+ int i = 0;
+
+ tiIniGetDirectSataSasAddr(tiRoot, i , &sasAddressHi, &sasAddressLo);
+ for( i = 0; i < saRoot->phyCount ; i++)
+ {
+ PhyDetails[i].attached_phy = saRoot->phys[i].sasIdentify.phyIdentifier;
+ /* deice types
+ * SAS
+ * 0x01 - Sas end device
+ * 0x02 - Expander device
+ * SATA
+ * 0x11 - Sata
+ * NO DEVICE 0x00
+ */
+ sas_dev_type = (saRoot->phys[i].sasIdentify.deviceType_addressFrameType & 0x70 ) >> 4 ;
+ if ((saRoot->phys[i].status == 1) && (sas_dev_type == 0)){ //status 1 - Phy Up
+ //Sata phy
+ PhyDetails[i].attached_dev_type = SAS_PHY_SATA_DEVICE;//0x11 for sata end device
+ osti_memcpy(&PhyDetails[i].attached_sasAddressHi, tdsaAllShared->Ports[i].SASID.sasAddressHi, sizeof(bit32));
+ osti_memcpy(&PhyDetails[i].attached_sasAddressLo, tdsaAllShared->Ports[i].SASID.sasAddressLo, sizeof(bit32));
+ PhyDetails[i].attached_sasAddressLo[3] += i + 16;
+ }
+ else {
+ PhyDetails[i].attached_dev_type = sas_dev_type;
+ osti_memcpy(&PhyDetails[i].attached_sasAddressHi, saRoot->phys[i].sasIdentify.sasAddressHi, sizeof(bit32));
+ osti_memcpy(&PhyDetails[i].attached_sasAddressLo, saRoot->phys[i].sasIdentify.sasAddressLo, sizeof(bit32));
+ }
+ osti_memcpy(&PhyDetails[i].sasAddressLo,&(tdsaAllShared->Ports[i].SASID.sasAddressLo), sizeof(bit32));
+ osti_memcpy(&PhyDetails[i].sasAddressHi,&(tdsaAllShared->Ports[i].SASID.sasAddressHi), sizeof(bit32));
+ }
+
+// osti_memcpy(&agIoctlPayload->FunctionSpecificArea,&PhyInfo, sizeof(agsaSGpioReqResponse_t));
+// printk("Ioctl success\n");
+ return IOCTL_CALL_SUCCESS;
+ }
+
+ case IOCTL_MJ_PHY_GENERAL_STATUS:
+ {
+ agsaPhyGeneralState_t *PhyData=NULL;
+ bit32 ret = AGSA_RC_FAILURE;
+ PhyData = (agsaPhyGeneralState_t*) &agIOCTLPayload->FunctionSpecificArea[0];
+
+ PhyData->Reserved2 = 0;
+ /* Validate the length */
+ if (agIOCTLPayload->Length < sizeof(agsaPhyGeneralState_t))
+ {
+ status = IOCTL_CALL_FAIL;
+ break;
+ }
+
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ //tdsaAllShared->tdFWControlEx.usrAddr = PhyData;
+
+ ret = tdsaGetPhyGeneralStatusIoctl(tiRoot,PhyData);
+ if(ret == AGSA_RC_FAILURE)
+ {
+ status = IOCTL_CALL_FAIL;
+ tdsaAllShared->tdFWControlEx.payload = NULL;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ break;
+ }
+ else if(ret == IOCTL_ERR_STATUS_NOT_SUPPORTED)
+ {
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
+ status = IOCTL_CALL_SUCCESS;
+ break;
+ }
+
+ //status = IOCTL_CALL_PENDING;
+ status = IOCTL_CALL_PENDING;
+ }
+
+ break;
+#if 1
+ case IOCTL_MJ_GET_PHY_PROFILE:
+ {
+ TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_GET_PHY_PROFILE %p %p %p\n",agParam1,agParam2,agParam3));
+ status = tdsaPhyProfileIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
+ break;
+ }
+#endif
+ case IOCTL_MJ_LL_TRACING:
+ {
+ void * stu = &agIOCTLPayload->FunctionSpecificArea[0];
+ switch(agIOCTLPayload->MinorFunction)
+ {
+
+ case IOCTL_MN_LL_RESET_TRACE_INDEX:
+ {
+
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+ TSTMTID_TRACE_BUFFER_RESET *llist = (TSTMTID_TRACE_BUFFER_RESET *)stu;
+ hpTraceBufferParms_t BufferParms;
+ TI_DBG5(("tdReturnIOCTL_Info: hpIOCTL_ResetTraceIndex\n"));
+
+ BufferParms.TraceCompiled = 0;
+ BufferParms.TraceWrap = 0;
+ BufferParms.CurrentTraceIndexWrapCount = 0;
+ BufferParms.BufferSize = 0;
+ BufferParms.CurrentIndex = 0;
+ BufferParms.pTrace = NULL;
+ BufferParms.pTraceIndexWrapCount = NULL;
+ BufferParms.pTraceMask = NULL;
+ BufferParms.pCurrentTraceIndex = NULL;
+
+ smTraceGetInfo(agRoot,&BufferParms);
+ TI_DBG5(("tdReturnIOCTL_Info: pTrace %p\n",BufferParms.pTrace));
+ TI_DBG5(("tdReturnIOCTL_Info: pCurrentTraceIndex %p %X\n",BufferParms.pCurrentTraceIndex,*BufferParms.pCurrentTraceIndex));
+ TI_DBG5(("tdReturnIOCTL_Info: pTraceIndexWrapCount %p %X\n",BufferParms.pTraceIndexWrapCount,*BufferParms.pTraceIndexWrapCount));
+ TI_DBG5(("tdReturnIOCTL_Info: pTraceMask %p %X\n",BufferParms.pTraceMask,*BufferParms.pTraceMask));
+
+ if( llist->Flag != 0)
+ {
+ if( llist->TraceMask != *BufferParms.pTraceMask)
+ {
+ smTraceSetMask(agRoot, llist->TraceMask );
+ }
+ }
+ if( llist->Reset)
+ {
+
+ *BufferParms.pCurrentTraceIndex = 0;
+ smResetTraceBuffer(agRoot);
+
+ *BufferParms.pCurrentTraceIndex = 0;
+ *BufferParms.pTraceIndexWrapCount =0;
+ llist->TraceMask = *BufferParms.pTraceMask;
+ }
+#endif /* SA_ENABLE_TRACE_FUNCTIONS */
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status = IOCTL_CALL_SUCCESS;
+
+ }
+ break;
+
+ case IOCTL_MN_LL_GET_TRACE_BUFFER_INFO:
+ {
+ hpTraceBufferParms_t BufferParms;
+ TSTMTID_TRACE_BUFFER_INFO *llist = (TSTMTID_TRACE_BUFFER_INFO *)stu;
+ TI_DBG5(("tdReturnIOCTL_Info: hpIOCTL_GetTraceBufferInfo\n"));
+
+
+ BufferParms.TraceCompiled = 0;
+ BufferParms.TraceWrap = 0;
+ BufferParms.CurrentTraceIndexWrapCount = 0;
+ BufferParms.BufferSize = 0;
+ BufferParms.CurrentIndex = 0;
+ BufferParms.pTrace = NULL;
+ BufferParms.pTraceMask = NULL;
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+ smTraceGetInfo(agRoot,&BufferParms);
+#endif /* SA_ENABLE_TRACE_FUNCTIONS not enabled */
+ llist->TraceCompiled = BufferParms.TraceCompiled;
+ llist->BufferSize = BufferParms.BufferSize;
+ llist->CurrentIndex = BufferParms.CurrentIndex ;
+ llist->CurrentTraceIndexWrapCount = BufferParms.CurrentTraceIndexWrapCount;
+ llist->TraceWrap = BufferParms.TraceWrap;
+ if(BufferParms.pTraceMask != NULL)
+ {
+ llist->TraceMask = *BufferParms.pTraceMask;
+ }
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status = IOCTL_CALL_SUCCESS;
+ }
+ break;
+
+ case IOCTL_MN_LL_GET_TRACE_BUFFER:
+ {
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+ TSTMTID_TRACE_BUFFER_FETCH *llist = (TSTMTID_TRACE_BUFFER_FETCH *)stu;
+
+ hpTraceBufferParms_t BufferParms;
+ bit32 c= 0;
+
+ BufferParms.TraceCompiled = 0;
+ BufferParms.TraceWrap = 0;
+ BufferParms.CurrentTraceIndexWrapCount = 0;
+ BufferParms.BufferSize = 0;
+ BufferParms.CurrentIndex = 0;
+ BufferParms.pTrace = NULL;
+ smTraceGetInfo(agRoot,&BufferParms);
+
+ TI_DBG6(("tdReturnIOCTL_Info: hpIOCTL_GetTraceBuffer\n"));
+
+ if(llist->LowFence != LowFence32Bits)
+ {
+ break;
+ }
+ if(llist->HighFence != HighFence32Bits)
+ {
+ break;
+ }
+
+ if(llist->BufferOffsetBegin + FetchBufferSIZE > BufferParms.BufferSize )
+ {
+ }
+
+ for ( c=0; c < FetchBufferSIZE;c++)
+ {
+ llist->Data[c] = *(BufferParms.pTrace+( c + llist->BufferOffsetBegin));
+ }
+#endif /* SA_ENABLE_TRACE_FUNCTIONS not enabled */
+ }
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status = IOCTL_CALL_SUCCESS;
+ break;
+ }
+ break;
+ }
+
+#ifdef SA_LL_API_TEST
+ case IOCTL_MJ_LL_API_TEST:
+ {
+ status = tdLlApiTestIoctl( tiRoot, agIOCTLPayload,
+ agParam1,agParam2,agParam3 );
+ break;
+ }
+
+#endif /* SA_LL_API_TEST */
+
+ case IOCTL_MJ_MODE_CTL_PAGE:
+ {
+ /* The SPCv controller has some options accessed via mode pages */
+ tiEncryptDekConfigPage_t *pModePage= (tiEncryptDekConfigPage_t *) &agIOCTLPayload->FunctionSpecificArea[0];
+ bit32 pageLength = 0;
+ bit32 pageCode;
+ bit32 modeOperation;
+
+ pageCode = pModePage->pageCode & 0xFF;
+ modeOperation = *(bit32 *) agParam2;
+
+ switch(modeOperation)
+ {
+
+ case tiModePageSet:
+ switch (pageCode)
+ {
+ case TI_ENCRYPTION_DEK_CONFIG_PAGE:
+ pageLength = sizeof(tiEncryptDekConfigPage_t);
+ break;
+
+ case TI_ENCRYPTION_CONTROL_PARM_PAGE:
+ pageLength = sizeof(tiEncryptControlParamPage_t);
+ break;
+
+ case TI_ENCRYPTION_GENERAL_CONFIG_PAGE:
+ /* Pages are currently unsupported */
+ pageLength = 0;
+ break;
+ }
+
+ status = saSetControllerConfig(agRoot, 0, pageCode, pageLength, pModePage, (agsaContext_t *)agIOCTLPayload);
+ break;
+
+ case tiModePageGet:
+ status = saGetControllerConfig(agRoot, 0, pageCode, 0, 0, (agsaContext_t *)agIOCTLPayload);
+ break;
+
+ default:
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
+ }
+ }
+ break;
+#ifdef PHY_RESTART_TEST
+ case IOCTL_MJ_PORT_START:
+ {
+ bit32 portID, tiStatus;
+ bit32 *data = (bit32*) &agIOCTLPayload->FunctionSpecificArea[0];
+ portID = *data;
+
+ tiStatus = tiCOMPortStart(tiRoot, portID, tdsaAllShared->Ports[portID].tiPortalContext, 0);
+
+ if (tiStatus == tiSuccess)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ }
+ else
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+ status = IOCTL_CALL_SUCCESS;
+ break;
+ }
+
+ case IOCTL_MJ_PORT_STOP:
+ {
+ bit32 portID, tiStatus;
+ bit32 *data = (bit32*) &agIOCTLPayload->FunctionSpecificArea[0];
+ portID = *data;
+
+ tiStatus = tiCOMPortStop(tiRoot, tdsaAllShared->Ports[portID].tiPortalContext);
+ if (tiStatus == tiSuccess)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ }
+ else
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+
+ status = IOCTL_CALL_SUCCESS;
+ break;
+ }
+#endif
+ case IOCTL_MJ_SEND_TMF:
+ switch(agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_TMF_DEVICE_RESET:
+ status = tdsaSendTMFIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, AG_TARGET_WARM_RESET);
+ break;
+ case IOCTL_MN_TMF_LUN_RESET:
+ status = tdsaSendTMFIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, AG_LOGICAL_UNIT_RESET);
+ break;
+ }
+ break;
+ case IOCTL_MJ_GET_DRIVER_VERSION:
+ osti_sprintf(agIOCTLPayload->FunctionSpecificArea, "%s", AGTIAPI_DRIVER_VERSION);
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ status=IOCTL_CALL_SUCCESS;
+ break;
+ default:
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
+ break;
+ }
+
+ return status;
+}
+
+#if 0
+/*****************************************************************************
+*
+* tdsaGpioSetup
+*
+* Purpose: This routine is called to set Gpio parameters to the controller.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agsaContext_t :
+* tiIOCTLPayload_t : ioctl header with payload gpio info
+* agParam1,agParam2 : Generic parameters
+*
+* Return: status
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaGpioSetup(
+ tiRoot_t *tiRoot,
+ agsaContext_t *agContext,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2
+ )
+{
+
+ tdsaTimerRequest_t *osIoctlTimer;
+ agsaGpioEventSetupInfo_t *gpioEventSetupInfo;
+ agsaGpioWriteSetupInfo_t *gpioWriteSetupInfo;
+ agsaGpioPinSetupInfo_t *gpioPinSetupInfo;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ TI_DBG3(("tdsaGpioSetup: start\n"));
+
+ if(tiRoot == agNULL || agIOCTLPayload == agNULL )
+ return IOCTL_CALL_FAIL;
+
+ osIoctlTimer = &tdsaAllShared->osIoctlTimer;
+ tdsaInitTimerRequest(tiRoot, osIoctlTimer);
+ tdIoctlStartTimer(tiRoot, osIoctlTimer); /* Start the timout handler for both ioctl and controller response */
+ tdsaAllShared->tdFWControlEx.virtAddr = (bit8 *)osIoctlTimer;
+
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8 *)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+
+ switch (agIOCTLPayload->MinorFunction)
+ {
+
+ case IOCTL_MN_GPIO_PINSETUP:
+ {
+ TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_PINSETUP\n"));
+ gpioPinSetupInfo =(agsaGpioPinSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+ status = saGpioPinSetup(agRoot, agContext, 0, gpioPinSetupInfo);
+
+ break;
+ }
+ case IOCTL_MN_GPIO_EVENTSETUP:
+ {
+ TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_EVENTSETUP\n"));
+ gpioEventSetupInfo = (agsaGpioEventSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+ status = saGpioEventSetup(agRoot, agContext, 0, gpioEventSetupInfo);
+
+ break;
+ }
+
+ case IOCTL_MN_GPIO_READ:
+ {
+ TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_READ\n"));
+ status = saGpioRead(agRoot, agContext, 0);
+
+ break;
+ }
+
+ case IOCTL_MN_GPIO_WRITE:
+ {
+ TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_WRITE\n"));
+ gpioWriteSetupInfo = (agsaGpioWriteSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+ status = saGpioWrite(agRoot, agContext, 0, gpioWriteSetupInfo->gpioWritemask, gpioWriteSetupInfo->gpioWriteVal);
+
+ break;
+ }
+
+ default :
+ return status;
+ }
+
+ if(status != AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ if (osIoctlTimer->timerRunning == agTRUE)
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ tdsaKillTimer(tiRoot, osIoctlTimer);
+
+ }else{
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ }
+ }
+
+ TI_DBG3(("tdsaGpioPinSetup: End\n"));
+ return status;
+
+}
+#endif
+
+/*****************************************************************************
+*
+* ostiGetGpioIOCTLRsp
+*
+* Purpose: This routine is called for Get Gpio IOCTL reaponse has been received.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiGetGpioIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ bit32 gpioReadValue,
+ agsaGpioPinSetupInfo_t *gpioPinSetupInfo,
+ agsaGpioEventSetupInfo_t *gpioEventSetupInfo
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIoctlPayload ;
+ agsaGpioReadInfo_t *gpioReadInfo;
+
+ tdsaTimerRequest_t *osIoctlTimer;
+ osIoctlTimer = (tdsaTimerRequest_t *)tdsaAllShared->tdFWControlEx.virtAddr;
+
+ TI_DBG2(("ostiGetGpioIOCTLRsp: start, status = %d \n", status));
+
+ agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+
+ if(agIoctlPayload == agNULL){
+ return;
+ }
+
+ agIoctlPayload->Status =(bit16) status;
+
+ if( (status != IOCTL_CALL_TIMEOUT) && (osIoctlTimer != NULL))
+ {
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ if (osIoctlTimer->timerRunning == agTRUE)
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ tdsaKillTimer(tiRoot, osIoctlTimer);
+
+ }else{
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ }
+ }else {
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ agIoctlPayload->Status = (bit16)status;
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2, NULL);
+ return;
+ }
+
+ if(status == SUCCESS)
+ TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response from OUTBuf"));
+ else {
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2, NULL);
+ return;
+ }
+
+ switch (agIoctlPayload->MinorFunction)
+ {
+
+ case IOCTL_MN_GPIO_PINSETUP:
+ {
+ TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_PINSETUP"));
+
+ break;
+ }
+ case IOCTL_MN_GPIO_EVENTSETUP:
+ {
+ TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_EVENTSETUP"));
+
+ break;
+ }
+
+ case IOCTL_MN_GPIO_WRITE:
+ {
+ TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_WRITE"));
+
+ break;
+ }
+
+ case IOCTL_MN_GPIO_READ:
+ {
+ gpioReadInfo = ( agsaGpioReadInfo_t *)tdsaAllShared->tdFWControlEx.usrAddr;
+
+ gpioReadInfo->gpioReadValue = gpioReadValue;
+ gpioReadInfo->gpioInputEnabled = gpioPinSetupInfo->gpioInputEnabled ; /* GPIOIE */
+ gpioReadInfo->gpioEventLevelChangePart1 = gpioPinSetupInfo->gpioTypePart1; /* GPIEVCHANGE (pins 11-0) */
+ gpioReadInfo->gpioEventLevelChangePart2 = gpioPinSetupInfo->gpioTypePart2; /* GPIEVCHANGE (pins 23-20) */
+ gpioReadInfo->gpioEventRisingEdgePart1 = 0xFFF & gpioEventSetupInfo->gpioEventRisingEdge; /* GPIEVRISE (pins 11-0) */
+ gpioReadInfo->gpioEventRisingEdgePart2 = 0x00F00000 & (gpioEventSetupInfo->gpioEventRisingEdge); /* GPIEVRISE (pins 23-20) */
+ gpioReadInfo->gpioEventFallingEdgePart1 = 0xFFF & gpioEventSetupInfo->gpioEventFallingEdge; /* GPIEVALL (pins 11-0) */
+ gpioReadInfo->gpioEventFallingEdgePart2 = 0x00F00000 & gpioEventSetupInfo->gpioEventFallingEdge; /* GPIEVALL (pins 23-20 */
+
+ break;
+ }
+
+ default :
+ break;
+ }
+
+ if(tdsaAllShared->tdFWControlEx.inProgress)
+ {
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2, NULL);
+ }
+ TI_DBG2(("ostiGetGpioIOCTLRsp: end \n"));
+
+ return ;
+}
+
+/*****************************************************************************
+*
+* tdsaSGpioIoctlSetup
+*
+* Purpose: This routine is called to send SGPIO request to the controller.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agsaContext_t: Context for this request
+* tiIOCTLPayload_t: ioctl header with payload sgpio info
+* agParam1,agParam2: Generic parameters
+*
+* Return: status
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaSGpioIoctlSetup(
+ tiRoot_t *tiRoot,
+ agsaContext_t *agContext,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ bit32 status = IOCTL_CALL_FAIL;
+ agsaSGpioReqResponse_t *pSGpioReq = (agsaSGpioReqResponse_t *)&agIOCTLPayload->FunctionSpecificArea[0];
+
+ TI_DBG3(("tdsaSGpioIoctlSetup: start\n"));
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+
+ do
+ {
+ if (tiRoot == agNULL || agIOCTLPayload == agNULL)
+ {
+ break;
+ }
+
+ /* Validate the length */
+ if (agIOCTLPayload->Length < sizeof(agsaSGpioReqResponse_t))
+ {
+ TI_DBG3(("Invalid length\n"));
+ break;
+ }
+
+ /* Validate the SMP Frame Type, Function and Register Type fields */
+ if ((pSGpioReq->smpFrameType != SMP_REQUEST) || \
+ ((pSGpioReq->function != SMP_READ_GPIO_REGISTER) && (pSGpioReq->function != SMP_WRITE_GPIO_REGISTER)) || \
+ (pSGpioReq->registerType > AGSA_SGPIO_GENERAL_PURPOSE_TRANSMIT_REG))
+ {
+ TI_DBG4(("Invalid Parameter\n"));
+ break;
+ }
+
+ /* Specific validation for configuration register type */
+ if (AGSA_SGPIO_CONFIG_REG == pSGpioReq->registerType)
+ {
+ if ((pSGpioReq->registerIndex > 0x01) || \
+ ((0x00 == pSGpioReq->registerIndex) && (pSGpioReq->registerCount > 0x02)) || \
+ ((0x01 == pSGpioReq->registerIndex) && (pSGpioReq->registerCount > 0x01)))
+ {
+ break;
+ }
+ }
+
+ /* Use FW control place in shared structure to keep the necessary information */
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+
+ status = saSgpio(agRoot, agContext, 0, pSGpioReq);
+ if (status != AGSA_RC_SUCCESS)
+ {
+ break;
+ }
+
+ status = IOCTL_CALL_PENDING;
+
+ } while (0);
+
+ TI_DBG3(("tdsaGpioPinSetup: End\n"));
+ return status;
+}
+
+/*****************************************************************************
+*
+* ostiSgpioIoctlRsp
+*
+* Purpose: This routine is called when a SGPIO IOCTL response is received.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* pSgpioResponse: Pointer to the SGPIO response
+*
+* Return: none
+*
+*
+*****************************************************************************/
+osGLOBAL void ostiSgpioIoctlRsp(
+ tiRoot_t *tiRoot,
+ agsaSGpioReqResponse_t *pSgpioResponse
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIoctlPayload = agNULL;
+
+ TI_DBG3(("ostiSgpioIoctlRsp: start\n"));
+
+ if (tdsaAllShared->tdFWControlEx.inProgress)
+ {
+ agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ if (agIoctlPayload)
+ {
+ tdsaAllShared->tdFWControlEx.payload = NULL;
+ osti_memcpy(&agIoctlPayload->FunctionSpecificArea[0], pSgpioResponse, sizeof(agsaSGpioReqResponse_t));
+ agIoctlPayload->Status = IOCTL_ERR_STATUS_OK;
+ sgpioResponseSet = 1;
+ }
+ tdsaAllShared->sgpioResponseSet = 1; //Sunitha:Check if needed?
+
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2, agNULL);
+
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ }
+
+ TI_DBG3(("ostiSgpioIoctlRsp: end\n"));
+}
+/*****************************************************************************
+*
+* ostiCOMMgntIOCTLRsp
+*
+* Purpose: This routine is called when FW control IOCTL reaponse has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiCOMMgntIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ TI_DBG1(("ostiCOMMgntIOCTLRsp: status 0x%x\n",status));
+ (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.tdFWControl->len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+}
+
+
+/*****************************************************************************
+*
+* ostiRegDumpIOCTLRsp
+*
+* Purpose: This routine is called when Register Dump from flash IOCTL reaponse has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiRegDumpIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ TI_DBG1(("ostiRegDumpIOCTLRsp: start\n"));
+// (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
+ osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
+ (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+}
+
+/*****************************************************************************
+*
+* ostiSetNVMDIOCTLRsp
+*
+* Purpose: This routine is called for Set NVMD IOCTL reaponse has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiSetNVMDIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+
+ if(status)
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ agIOCTLPayload->Status = (bit16)status;
+ }
+
+ TI_DBG1(("ostiSetNVMDIOCTLRsp: start, status = %d\n", status));
+// (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+}
+#ifdef SPC_ENABLE_PROFILE
+/*****************************************************************************
+*
+* ostiFWProfileIOCTLRsp
+*
+* Purpose: This routine is called for Fw Profile IOCTL reaponse has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* status:
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiFWProfileIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ bit32 len)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdFWProfile_t *fwProfile;
+
+ TI_DBG1(("ostiFWProfileIOCTLRsp: start\n"));
+ fwProfile = (tdFWProfile_t *)tdsaAllShared->tdFWProfileEx.tdFWProfile;
+ // (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
+ if (status == AGSA_RC_SUCCESS)
+ {
+ if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
+ {
+ osti_memcpy((void *)(fwProfile->buffer),
+ (void *)(tdsaAllShared->tdFWProfileEx.virtAddr),
+ len);
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWProfileEx.buffer,
+ tdsaAllShared->tdFWProfileEx.len);
+ }
+ }
+ fwProfile->status = status;
+ fwProfile->len = len;
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWProfileEx.param1,
+ tdsaAllShared->tdFWProfileEx.param2,
+ NULL);
+}
+#endif
+/*****************************************************************************
+*
+* ostiGetNVMDIOCTLRsp
+*
+* Purpose: This routine is called for Get NVMD IOCTL reaponse has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiGetNVMDIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+
+ if(status)
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ agIOCTLPayload->Status = (bit16)status;
+ }
+
+ TI_DBG1(("ostiGetNVMDIOCTLRsp: start, status = %d\n", status));
+ tdsaAllShared->NvmdResponseSet = 1;
+
+ if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
+ {
+ osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
+ (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+ }
+}
+
+
+/*****************************************************************************
+*
+* ostiGetPhyProfileIOCTLRsp
+*
+* Purpose: This routine is called for phy response has been received.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiGetPhyProfileIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+ tdPhyCount_t *PhyBlob = agNULL;
+ if(status)
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ agIOCTLPayload->Status = (bit16)status;
+
+ PhyBlob = (tdPhyCount_t*)&agIOCTLPayload->FunctionSpecificArea[0];
+ if(PhyBlob)
+ {
+// PhyBlob->Phy |= 0x800;
+ if(PhyBlob->phyResetProblem == 0 )
+ {
+ PhyBlob->phyResetProblem = -1;
+ }
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->Phy 0x%x\n",PhyBlob->Phy));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->BW_rx 0x%x\n",PhyBlob->BW_rx));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->BW_tx 0x%x\n",PhyBlob->BW_tx));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->InvalidDword 0x%x\n",PhyBlob->InvalidDword));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->runningDisparityError 0x%x\n",PhyBlob->runningDisparityError));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->codeViolation 0x%x\n",PhyBlob->codeViolation));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->phyResetProblem 0x%x\n",PhyBlob->phyResetProblem));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->inboundCRCError 0x%x\n",PhyBlob->inboundCRCError));
+
+ }
+
+
+ }
+
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: start, status = %d\n", status));
+ TI_DBG1(("ostiGetPhyProfileIOCTLRsp: start, len = %d %p %p\n", tdsaAllShared->tdFWControlEx.len,tdsaAllShared->tdFWControlEx.usrAddr,tdsaAllShared->tdFWControlEx.virtAddr));
+
+// osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
+// (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
+// tdsaAllShared->tdFWControlEx.len);
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+}
+
+
+/*****************************************************************************
+*
+* ostiGenEventIOCTLRsp
+*
+* Purpose: This routine is called when General Event happened while waiting for IOCTL response.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* payloadRsp: Pointer to the FW download IOMB's payload.
+*
+* Return: none
+*
+*
+*
+*****************************************************************************/
+
+osGLOBAL void ostiGenEventIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+
+ TI_DBG1(("ostiGenEventIOCTLRsp: start\n"));
+
+ if(tdsaAllShared->tdFWControlEx.inProgress) /*Free only if our IOCTL is in progress*/
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ }
+#ifdef SPC_ENABLE_PROFILE
+ if(tdsaAllShared->tdFWProfileEx.inProgress)
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWProfileEx.payload);
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ if(tdsaAllShared->tdFWProfileEx.virtAddr != NULL) /*Free only if our IOCTL is in progress*/
+ {
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWProfileEx.buffer,
+ tdsaAllShared->tdFWProfileEx.len);
+ tdsaAllShared->tdFWProfileEx.virtAddr = NULL;
+ }
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWProfileEx.param1,
+ tdsaAllShared->tdFWProfileEx.param2,
+ NULL);
+ tdsaAllShared->tdFWProfileEx.inProgress = 0;
+
+ }
+#endif /*SPC_ENABLE_PROFILE*/
+
+}
+
+osGLOBAL void
+ostiGetDeviceInfoIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ void *param
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload = agNULL;
+ tdDeviceInfoPayload_t *pTDDeviceInfo = agNULL;
+ agsaDeviceInfo_t *pSADeviceInfo = agNULL;
+
+ TI_DBG1(("ostiGetDeviceInfoIOCTLRsp: start\n"));
+
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ pSADeviceInfo = (agsaDeviceInfo_t*)param;
+ pTDDeviceInfo = (tdDeviceInfoPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ if (pSADeviceInfo != agNULL)
+ {
+ /* fill the device information in IOCTL payload */
+ osti_memcpy(&pTDDeviceInfo->devInfo.sasAddressHi, pSADeviceInfo->sasAddressHi, sizeof(bit32));
+ osti_memcpy(&pTDDeviceInfo->devInfo.sasAddressLo, pSADeviceInfo->sasAddressLo, sizeof(bit32));
+
+ pTDDeviceInfo->devInfo.sasAddressHi = DMA_BEBIT32_TO_BIT32(pTDDeviceInfo->devInfo.sasAddressHi);
+ pTDDeviceInfo->devInfo.sasAddressLo = DMA_BEBIT32_TO_BIT32(pTDDeviceInfo->devInfo.sasAddressLo);
+
+ pTDDeviceInfo->devInfo.deviceType = (pSADeviceInfo->devType_S_Rate & 0x30) >> 4;
+ pTDDeviceInfo->devInfo.linkRate = pSADeviceInfo->devType_S_Rate & 0x0F;
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ }
+ else
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
+ }
+
+ if(tdsaAllShared->tdFWControlEx.inProgress) /*Free only if our IOCTL is in progress*/
+ {
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ }
+}
+
+
+#ifdef INITIATOR_DRIVER
+osGLOBAL void
+ostiGetIoErrorStatsIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ void *param
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ itdsaIni_t *Initiator = (itdsaIni_t *)tdsaAllShared->itdsaIni;
+ tiIOCTLPayload_t *agIOCTLPayload = agNULL;
+ tdIoErrorStatisticPayload_t *pIoErrorPayload = agNULL;
+ agsaIOErrorEventStats_t *pIoErrorCount = agNULL;
+
+ OS_ASSERT(sizeof(agsaIOErrorEventStats_t) == sizeof(tdIoErrorEventStatisticIOCTL_t), "agsaIOErrorEventStats_t tdIoErrorEventStatisticIOCTL_t\n");
+ TI_DBG1(("ostiGetIoErrorStatsIOCTLRsp: start\n"));
+
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ pIoErrorPayload = (tdIoErrorStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+ pIoErrorCount = (agsaIOErrorEventStats_t*)param;
+
+ osti_memcpy(&pIoErrorPayload->IoError, pIoErrorCount, sizeof(agsaIOErrorEventStats_t));
+ /*copy SCSI status and sense key count from OS layer to TD layer*/
+ osti_memcpy(&pIoErrorPayload->ScsiStatusCounter, &Initiator->ScsiStatusCounts, sizeof(tdSCSIStatusCount_t));
+ osti_memcpy(&pIoErrorPayload->SenseKeyCounter, &Initiator->SenseKeyCounter, sizeof(tdSenseKeyCount_t));
+ if (pIoErrorPayload->flag)
+ {
+ osti_memset(&Initiator->ScsiStatusCounts, 0,sizeof(tdSCSIStatusCount_t) );
+ osti_memset(&Initiator->SenseKeyCounter, 0,sizeof(tdSenseKeyCount_t) );
+ }
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+}
+#endif /* INITIATOR_DRIVER */
+
+osGLOBAL void
+ostiGetIoEventStatsIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ void *param
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload = agNULL;
+ tdIoEventStatisticPayload_t *pIoEventPayload = agNULL;
+ agsaIOErrorEventStats_t *pIoEventCount = agNULL;
+
+ TI_DBG1(("ostiGetIoEventStatsIOCTLRsp: start\n"));
+
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ pIoEventPayload = (tdIoEventStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+ pIoEventCount = (agsaIOErrorEventStats_t*)param;
+
+ osti_memcpy(&pIoEventPayload->IoEvent, pIoEventCount, sizeof(agsaIOErrorEventStats_t));
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+}
+
+osGLOBAL void
+ostiGetForensicDataIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ void *param
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload = agNULL;
+ tdForensicDataPayload_t *pForensicDataPayload = agNULL;
+ agsaForensicData_t *pForensicData = agNULL;
+
+ TI_DBG3(("ostiGetForensicDataIOCTLRsp: start, status = %d\n", status));
+
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ pForensicDataPayload = (tdForensicDataPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+ pForensicData = (agsaForensicData_t*)param;
+
+ if (agNULL == agIOCTLPayload)
+ {
+ return;
+ }
+
+ if (FORENSIC_DATA_TYPE_CHECK_FATAL == pForensicData->DataType)
+ {
+ agIOCTLPayload->Status = (bit16)status;
+ return;
+ }
+
+ if (status == AGSA_RC_SUCCESS)
+ {
+ switch (pForensicData->DataType)
+ {
+ case FORENSIC_DATA_TYPE_NON_FATAL:
+ case FORENSIC_DATA_TYPE_FATAL:
+ pForensicDataPayload->dataBuffer.directOffset = pForensicData->BufferType.dataBuf.directOffset;
+ pForensicDataPayload->dataBuffer.readLen = pForensicData->BufferType.dataBuf.readLen;
+ break;
+ case FORENSIC_DATA_TYPE_GSM_SPACE:
+ pForensicDataPayload->gsmBuffer.directOffset = pForensicData->BufferType.gsmBuf.directOffset;
+ pForensicDataPayload->gsmBuffer.readLen = pForensicData->BufferType.gsmBuf.readLen;
+ break;
+
+ case FORENSIC_DATA_TYPE_QUEUE:
+ break;
+
+ default:
+ TI_DBG1(("ostiGetForensicDataIOCTLRsp: forensic data type error %d\n", pForensicData->DataType));
+ break;
+ }
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ }
+ else if(status == IOCTL_ERROR_NO_FATAL_ERROR)
+ {
+ agIOCTLPayload->Status = (bit16)status;
+ }
+ else
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+
+ /*Free only if our IOCTL is in progress*/
+ if(tdsaAllShared->tdFWControlEx.inProgress)
+ {
+ TI_DBG3(("ostiGetForensicDataIOCTLRsp: Waiting for the signal \n"));
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+ TI_DBG3(("ostiGetForensicDataIOCTLRsp: Signal wait completed \n"));
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ }
+}
+
+/*****************************************************************************
+*
+* tdsaRegDumpGetIoctl
+*
+* Purpose: This routine is called to get Register Dump information.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaRegDumpGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+// agsaControllerStatus_t RegDump;
+ bit32 Offset = 0;
+ bit32 RequestLength = 0; /* user request on how much data to pass to application */
+ agsaRegDumpInfo_t regDumpInfo;
+ void *buffer = agNULL;
+ void *osMemHandle = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+ bit32 CoreDumpLength = 16384; /* change it once data is available */
+ bit32 EventLogOffset = 65536;
+
+ ///saGetControllerStatus(agRoot, &RegDump);
+ /* length of FSA as provided by application */
+ RequestLength = agIOCTLPayload->Length;
+/// FunctionSpecificOffset = 0; /* Offset into the FunctionSpecificArea of payload */
+ /* offset into core dump that was passed from application */
+ Offset = agIOCTLPayload->Reserved;
+
+ if((CoreDumpLength <= Offset)&&
+ (agIOCTLPayload->MinorFunction != IOCTL_MN_FW_GET_EVENT_FLASH_LOG1)&&
+ (agIOCTLPayload->MinorFunction != IOCTL_MN_FW_GET_EVENT_FLASH_LOG2))
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ regDumpInfo.regDumpOffset = Offset;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ /* dump either aap1 or iop registers */
+ switch(agIOCTLPayload->MinorFunction){
+
+ /*Coredump*/
+ case IOCTL_MN_FW_GET_CORE_DUMP_AAP1:
+ //CoreDumpBAROffset = RegDump.fatalErrorInfo.regDumpOffset0; /* get this from mpi config table */
+ //CoreDumpLength = RegDump.fatalErrorInfo.regDumpLen0;
+ /*changes for added Call back*/
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ regDumpInfo.regDumpSrc = 0;
+ regDumpInfo.regDumpNum = 0;
+ regDumpInfo.directLen = RequestLength;
+ regDumpInfo.directData = &agIOCTLPayload->FunctionSpecificArea[0];
+ /*changes for added Call back*/
+ //status = IOCTL_CALL_SUCCESS;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ case IOCTL_MN_FW_GET_CORE_DUMP_IOP:
+ //CoreDumpBAROffset = RegDump.fatalErrorInfo.regDumpOffset1; /* get this from mpi config table */
+ //CoreDumpLength = RegDump.fatalErrorInfo.regDumpLen1;
+ /*changes for added Call back*/
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ regDumpInfo.regDumpSrc = 0;
+ regDumpInfo.regDumpNum = 1;
+ regDumpInfo.directLen = RequestLength;
+ regDumpInfo.directData = &agIOCTLPayload->FunctionSpecificArea[0];
+ /*changes for added Call back*/
+ //status = IOCTL_CALL_SUCCESS;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ case IOCTL_MN_FW_GET_CORE_DUMP_FLASH_AAP1:
+ regDumpInfo.regDumpSrc = 1;
+ regDumpInfo.regDumpNum = 0;
+ if(RequestLength != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &(regDumpInfo.indirectAddrUpper32),
+ &(regDumpInfo.indirectAddrLower32),
+ 8,
+ RequestLength,
+ agFALSE))
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, RequestLength);
+ regDumpInfo.indirectLen = RequestLength;
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ case IOCTL_MN_FW_GET_CORE_DUMP_FLASH_IOP:
+ regDumpInfo.regDumpSrc = 1;
+ regDumpInfo.regDumpNum = 1;
+ if(RequestLength != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &(regDumpInfo.indirectAddrUpper32),
+ &(regDumpInfo.indirectAddrLower32),
+ 8,
+ RequestLength,
+ agFALSE))
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, RequestLength);
+ regDumpInfo.indirectLen = RequestLength;
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ /*EventLog from Flash*/
+ case IOCTL_MN_FW_GET_EVENT_FLASH_LOG1: //aap1 Eventlog
+ if(CoreDumpLength + EventLogOffset <= Offset)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ regDumpInfo.regDumpSrc = 1;
+ regDumpInfo.regDumpNum = 0;
+ if(RequestLength != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &(regDumpInfo.indirectAddrUpper32),
+ &(regDumpInfo.indirectAddrLower32),
+ 8,
+ RequestLength,
+ agFALSE))
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, RequestLength);
+ regDumpInfo.indirectLen = RequestLength;
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ case IOCTL_MN_FW_GET_EVENT_FLASH_LOG2: //iop Eventlog
+ if(CoreDumpLength + EventLogOffset <= Offset)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ regDumpInfo.regDumpSrc = 1;
+ regDumpInfo.regDumpNum = 1;
+ if(RequestLength != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &(regDumpInfo.indirectAddrUpper32),
+ &(regDumpInfo.indirectAddrLower32),
+ 8,
+ RequestLength,
+ agFALSE))
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, RequestLength);
+ regDumpInfo.indirectLen = RequestLength;
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ default:
+ status = IOCTL_CALL_INVALID_CODE;
+ TI_DBG1(("tiCOMMgntIOCTL: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
+ break;
+ }
+ if(saGetRegisterDump(agRoot, agNULL, 0, &regDumpInfo) != AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+
+ return status;
+}
+
+osGLOBAL void
+ostiCOMMgntVPDSetIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+// agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+
+ TI_DBG1(("ostiCOMMgntVPDSetIOCTLRsp: start\n"));
+ (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
+
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+}
+
+/*****************************************************************************
+*
+* tdsaNVMDSetIoctl
+*
+* Purpose: This routine is called to set Config. SEEPROM information.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaNVMDSetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ bit32 RequestLength = 0;
+ bit32 bufAddrUpper = 0;
+ bit32 bufAddrLower = 0;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ void *buffer = agNULL;
+ void *osMemHandle = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+ agsaNVMDData_t nvmdInfo;
+
+
+ TI_DBG2(("tdsaNVMDSetIoctl: start\n"));
+
+ RequestLength = agIOCTLPayload->Length;
+
+ osti_memset(&nvmdInfo, 0, sizeof(agsaNVMDData_t));
+
+ switch(agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_NVMD_SET_CONFIG:
+
+ //nvmdInfo.NVMDevice = 1;
+ nvmdInfo.NVMDevice = *((bit8*)agParam3);
+ nvmdInfo.signature = 0xFEDCBA98;
+ nvmdInfo.dataOffsetAddress = agIOCTLPayload->Reserved;
+ nvmdInfo.indirectPayload = 1;
+ nvmdInfo.indirectLen = RequestLength;
+
+ if (nvmdInfo.NVMDevice == 0) {
+ nvmdInfo.TWIDeviceAddress = 0xa0;
+ nvmdInfo.TWIBusNumber = 0;
+ nvmdInfo.TWIDevicePageSize = 0;
+ nvmdInfo.TWIDeviceAddressSize = 1;
+ }
+
+ if(RequestLength != 0)
+ {
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &bufAddrUpper,
+ &bufAddrLower,
+ 8,
+ RequestLength,
+ agFALSE))
+ return IOCTL_CALL_FAIL;
+ }
+ else
+ {
+ return IOCTL_CALL_FAIL;
+ }
+
+ osti_memset((void *)buffer, 0, RequestLength);
+
+ osti_memcpy((void *)buffer,
+ agIOCTLPayload->FunctionSpecificArea,
+ RequestLength);
+
+ nvmdInfo.indirectAddrLower32 = bufAddrLower;
+ nvmdInfo.indirectAddrUpper32 = bufAddrUpper;
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ default:
+ status = IOCTL_CALL_INVALID_CODE;
+ TI_DBG1(("tdsaNVMDSetIoctl: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
+ break;
+ }
+
+ if(saSetNVMDCommand(agRoot, agNULL, 0, &nvmdInfo) != AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+
+ return status;
+
+}
+
+/*****************************************************************************
+*
+* tdsaNVMDGetIoctl
+*
+* Purpose: This routine is called to get Config. SEEPROM information.
+* This function is used for both target and initiator.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaNVMDGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ void *buffer = agNULL;
+ void *osMemHandle = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+ agsaNVMDData_t nvmdInfo;
+ bit32 Offset = 0;
+ bit32 RequestLength = 0;
+ bit32 ostiMemoryStatus = 0;
+ bit32 i,j;
+ bit8* seepromBuffer;
+ bit8* phySettingsBuffer;
+
+
+ TI_DBG2(("tdsaNVMDGetIoctl: start\n"));
+
+ RequestLength = agIOCTLPayload->Length;
+ Offset = agIOCTLPayload->Reserved;
+
+ osti_memset(&nvmdInfo, 0, sizeof(agsaNVMDData_t));
+ /* This condition is not valid for direct read so commenting */
+ /*if(!tiIS_SPC(agRoot)) {
+ if( RequestLength <= Offset ) //4096-max seeprom size
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
+ agIOCTLPayload->Length = 0;
+ status=IOCTL_CALL_SUCCESS;
+ return status;
+ }
+ }*/
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+
+ switch(agIOCTLPayload->MinorFunction)
+ {
+ case IOCTL_MN_NVMD_GET_CONFIG:
+
+ // nvmdInfo.NVMDevice = 1;
+ nvmdInfo.NVMDevice = *((bit8*)agParam3);
+ nvmdInfo.signature = 0xFEDCBA98;
+ nvmdInfo.dataOffsetAddress = Offset;
+ nvmdInfo.indirectPayload = 1;
+ nvmdInfo.indirectLen = RequestLength;
+
+ if (nvmdInfo.NVMDevice == 0) {
+ nvmdInfo.TWIDeviceAddress = 0xa0;
+ nvmdInfo.TWIBusNumber = 0;
+ nvmdInfo.TWIDevicePageSize = 0;
+ nvmdInfo.TWIDeviceAddressSize = 1;
+ }
+
+ if(RequestLength != 0)
+ {
+ ostiMemoryStatus = ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &(nvmdInfo.indirectAddrUpper32),
+ &(nvmdInfo.indirectAddrLower32),
+ 8,
+ RequestLength,
+ agFALSE);
+ if((ostiMemoryStatus != tiSuccess) && (buffer == agNULL))
+ return IOCTL_CALL_FAIL;
+ }
+ else
+ {
+ return IOCTL_CALL_FAIL;
+ }
+ osti_memset((void *)buffer, 0, RequestLength);
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = RequestLength;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+ break;
+ default:
+ status = IOCTL_CALL_INVALID_CODE;
+ TI_DBG1(("tiCOMMgntIOCTL: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
+ break;
+ }
+ tdsaAllShared->NvmdResponseSet = 0;
+
+ if(saGetNVMDCommand(agRoot, agNULL, 0, &nvmdInfo) != AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ return status;
+ }
+ /* Copy the SAS address */
+ if(agParam1 == agNULL)
+
+ {
+ while(!tdsaAllShared->NvmdResponseSet)
+ {
+ // tiCOMDelayedInterruptHandler(tiRoot, 0, 1, tiNonInterruptContext);
+ }
+ if(nvmdInfo.NVMDevice == 4 || nvmdInfo.NVMDevice == 1)
+ {
+ seepromBuffer = buffer;
+ /*Get Initiator SAS address*/
+
+ if(tiIS_SPC(agRoot))
+ {
+ for(j=0,i=ADAPTER_WWN_SPC_START_OFFSET; i<= ADAPTER_WWN_SPC_END_OFFSET; i++,j++)
+ agIOCTLPayload->FunctionSpecificArea[j] = seepromBuffer[i];
+ }
+ else
+ {
+ for(j=0,i=ADAPTER_WWN_START_OFFSET; i<= ADAPTER_WWN_END_OFFSET; i++,j++)
+ agIOCTLPayload->FunctionSpecificArea[j] = seepromBuffer[i];
+ }
+ }
+ /* Copy the Phy settings */
+ else if(nvmdInfo.NVMDevice == 6)
+ {
+ phySettingsBuffer = buffer;
+ for(i=0; i<PHY_SETTINGS_LEN; i++)
+ agIOCTLPayload->FunctionSpecificArea[i] = phySettingsBuffer[i];
+ }
+ tdsaAllShared->NvmdResponseSet = 0;
+ ostiFreeMemory(tiRoot, tdsaAllShared->tdFWControlEx.buffer, tdsaAllShared->tdFWControlEx.len);
+
+ }
+ return status;
+
+}
+
+/*****************************************************************************
+*
+* tdsaDeviceInfoGetIoctl
+*
+* Purpose: This routine is called to get the specified device information.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaDeviceInfoGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tiDeviceHandle_t *tiDeviceHandle = agNULL;
+ tdDeviceInfoPayload_t *pDeviceInfo = agNULL;
+ /*agsaDevHandle_t *agDevHandle = agNULL;*/
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ pDeviceInfo = (tdDeviceInfoPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ TI_DBG3(("tdsaDeviceInfoGetIoctl: %d:%3d:%d %p %p %p\n",
+ (bit8)pDeviceInfo->PathId,
+ (bit8)pDeviceInfo->TargetId,
+ (bit8)pDeviceInfo->Lun,
+ agParam1,
+ agParam2,
+ agParam3));
+
+ tiDeviceHandle = ostiMapToDevHandle(tiRoot,
+ (bit8)pDeviceInfo->PathId,
+ (bit8)pDeviceInfo->TargetId,
+ (bit8)pDeviceInfo->Lun
+ );
+
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle is NULL !!!! SCSI address = %d:%3d:%d\n",
+ pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
+ status = IOCTL_CALL_FAIL;
+ return status;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if(oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle=%p DeviceData is NULL!!! SCSI address = %d:%3d:%d\n",
+ tiDeviceHandle, pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
+ status = IOCTL_CALL_FAIL;
+ return status;
+ }
+
+ /* for hotplug */
+ if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
+ oneDeviceData->tdPortContext == agNULL )
+ {
+ TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle=%p did %d DeviceData was removed!!! SCSI address = %d:%3d:%d\n",
+ tiDeviceHandle, oneDeviceData->id, pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
+ status = IOCTL_CALL_FAIL;
+ return status;
+ }
+
+ /* fill the device information in IOCTL payload */
+ pDeviceInfo->devInfo.phyId = oneDeviceData->phyID;
+ osti_memcpy(&pDeviceInfo->devInfo.sasAddressHi, oneDeviceData->agDeviceInfo.sasAddressHi, sizeof(bit32));
+ osti_memcpy(&pDeviceInfo->devInfo.sasAddressLo, oneDeviceData->agDeviceInfo.sasAddressLo, sizeof(bit32));
+
+ pDeviceInfo->devInfo.sasAddressHi = DMA_BEBIT32_TO_BIT32(pDeviceInfo->devInfo.sasAddressHi);
+ pDeviceInfo->devInfo.sasAddressLo = DMA_BEBIT32_TO_BIT32(pDeviceInfo->devInfo.sasAddressLo);
+
+ pDeviceInfo->devInfo.deviceType = (oneDeviceData->agDeviceInfo.devType_S_Rate & 0x30) >> 4;
+ pDeviceInfo->devInfo.linkRate = oneDeviceData->agDeviceInfo.devType_S_Rate & 0x0F;
+
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+
+ TI_DBG3(("tdsaDeviceInfoGetIoctl:IOCTL_CALL_SUCCESS\n"));
+
+ /*saGetDeviceInfo(agRoot, agNULL, 0, 0, agDevHandle);*/
+
+ status = IOCTL_CALL_SUCCESS;
+
+ return status;
+}
+/*****************************************************************************
+*
+* tdsaIoErrorStatisticGetIoctl
+*
+* Purpose: This routine is called to get the IO error statistic.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaIoErrorStatisticGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdIoErrorStatisticPayload_t *pIoErrorPayload = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ pIoErrorPayload = (tdIoErrorStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ tdsaAllShared->tdFWControlEx.buffer = agNULL;
+ tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 0;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+
+ saGetIOErrorStats(agRoot, agNULL, pIoErrorPayload->flag);
+
+ return status;
+}
+
+/*****************************************************************************
+*
+* tdsaIoEventStatisticGetIoctl
+*
+* Purpose: This routine is called to get the IO event statistic.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaIoEventStatisticGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdIoEventStatisticPayload_t *pIoEventPayload = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ pIoEventPayload = (tdIoEventStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ tdsaAllShared->tdFWControlEx.buffer = agNULL;
+ tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 0;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+
+ saGetIOEventStats(agRoot, agNULL, pIoEventPayload->flag);
+
+ return status;
+}
+
+/*****************************************************************************
+*
+* tdsaRegisterIoctl
+*
+* Purpose: This routine is called to get Forensic Data.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaRegisterIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+// agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdRegisterPayload_t *pRegisterPayload = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ pRegisterPayload = (tdRegisterPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ tdsaAllShared->tdFWControlEx.buffer = agNULL;
+ tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 0;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+
+ TI_DBG1(("tdsaRegisterIoctl: Flag %d RegAddr 0x%x RegValue 0x%x\n",
+ pRegisterPayload->flag, pRegisterPayload->RegAddr, pRegisterPayload->RegValue));
+
+ if (pRegisterPayload->flag)
+ {
+ /* set register */
+ ostiChipWriteBit32Ext(tiRoot, 0, pRegisterPayload->RegAddr, pRegisterPayload->RegValue);
+ }
+ else
+ {
+ /* get register */
+ pRegisterPayload->RegValue = ostiChipReadBit32Ext(tiRoot, 0, pRegisterPayload->RegAddr);
+ }
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ return status;
+}
+
+osGLOBAL bit32
+tdsaGetPhyGeneralStatusIoctl(
+ tiRoot_t *tiRoot,
+ agsaPhyGeneralState_t *PhyData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
+// agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
+// bit8 totalValidPhys;
+ bit32 status = AGSA_RC_SUCCESS;
+ bit32 i = 0;
+ agsaControllerInfo_t ControllerInfo;
+ saGetControllerInfo(agRoot,&ControllerInfo);
+
+ TI_DBG3(("tdsaGetPhyGeneralStatusIoctl: start\n"));
+ do
+ {
+ if(tIsSPC(agRoot)||tIsSPCHIL(agRoot))
+ {
+ status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
+ break;
+ }
+
+ PhyData->Reserved1 = ControllerInfo.phyCount;
+ for(i=0;i<PhyData->Reserved1;i++)
+ {
+ status = saGetPhyProfile( agRoot,agNULL,tdsaRotateQnumber(tiRoot, agNULL), AGSA_SAS_PHY_GENERAL_STATUS_PAGE,i);
+ if(status == AGSA_RC_FAILURE)
+ {
+ break;
+ }
+ }
+ }while(0);
+ TI_DBG3(("tdsaGetPhyGeneralStatusIoctl: End\n"));
+ return status;
+}
+/*****************************************************************************
+*
+* ostiGetPhyGeneralStatusRsp
+*
+* Purpose: This routine is called when a PhyStatus IOCTL response is received.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agsaSASPhyGeneralStatusPage_t: Status of the phy.
+* bit32: phyID
+*
+* Return: none
+*
+*
+*****************************************************************************/
+osGLOBAL void ostiGetPhyGeneralStatusRsp(
+ tiRoot_t *tiRoot,
+ agsaSASPhyGeneralStatusPage_t *GenStatus,
+ bit32 phyID
+ )
+{
+
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIoctlPayload = agNULL;
+ agsaPhyGeneralState_t *pSetPhyStatusRes = agNULL;
+
+
+ TI_DBG1(("ostiGetPhyGeneralStatusRsp: start\n"));
+
+ if (tdsaAllShared->tdFWControlEx.inProgress)
+ {
+ agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ if ((agIoctlPayload) && (PMC_IOCTL_SIGNATURE == agIoctlPayload->Signature)&&
+ (IOCTL_MJ_PHY_GENERAL_STATUS == agIoctlPayload->MajorFunction))
+ {
+ pSetPhyStatusRes = (agsaPhyGeneralState_t*) &agIoctlPayload->FunctionSpecificArea[0];
+ osti_memcpy(&pSetPhyStatusRes->PhyGenData[phyID], GenStatus, sizeof(agsaSASPhyGeneralStatusPage_t));
+ pSetPhyStatusRes->Reserved2++;
+ if(pSetPhyStatusRes->Reserved1 == pSetPhyStatusRes->Reserved2)
+ {
+ tdsaAllShared->tdFWControlEx.payload = NULL;
+ ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2, agNULL);
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ agIoctlPayload->Status = IOCTL_ERR_STATUS_OK;
+
+ }
+ }
+ }
+
+ TI_DBG1(("ostiGetPhyGeneralStatusRsp: end\n"));
+}
+
+
+osGLOBAL bit32
+tdsaPhyProfileIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ void *buffer = agNULL;
+ void *osMemHandle = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+ bit32 retcode = AGSA_RC_FAILURE;
+ bit32 RequestLength= agIOCTLPayload->Length;
+ bit32 bufAddrUpper = 0;
+ bit32 bufAddrLower = 0;
+
+ tdPhyCount_t *PhyBlob = (tdPhyCount_t*)&agIOCTLPayload->FunctionSpecificArea[0];
+
+
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &bufAddrUpper,
+ &bufAddrLower,
+ RequestLength,
+ RequestLength,
+ agTRUE))
+ return IOCTL_CALL_FAIL;
+
+
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = buffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 32;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+
+ TI_DBG1(("tdsaPhyProfileIoctl: MinorFunction %d\n",agIOCTLPayload->MinorFunction));
+// PhyBlob->Phy |= 0x100;
+
+ if( tiIS_SPC(agRoot) )
+ {
+ TI_DBG1(("tdsaPhyProfileIoctl: SPC operation 0x%x PHY %d\n",agIOCTLPayload->MinorFunction,PhyBlob->Phy));
+ retcode = saLocalPhyControl(agRoot,agNULL,0 ,PhyBlob->Phy ,agIOCTLPayload->MinorFunction , agNULL);
+ if(retcode == AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_PENDING;
+ }
+ }
+ else
+ {
+ TI_DBG1(("tdsaPhyProfileIoctl: SPCv operation 0x%x PHY %d\n",agIOCTLPayload->MinorFunction,PhyBlob->Phy));
+ retcode = saGetPhyProfile( agRoot,agNULL,0,agIOCTLPayload->MinorFunction , PhyBlob->Phy);
+
+ if(retcode == AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_PENDING;
+ }
+
+ }
+
+ TI_DBG2(("tdsaPhyProfileIoctl: after\n"));
+
+
+ return status;
+}
+
+/*****************************************************************************
+*
+* tdsaForensicDataGetIoctl
+*
+* Purpose: This routine is called to get Forensic Data.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaForensicDataGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdForensicDataPayload_t *pForensicDataPayload = agNULL;
+ agsaForensicData_t ForensicData;
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ pForensicDataPayload = (tdForensicDataPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ tdsaAllShared->tdFWControlEx.buffer = agNULL;
+ tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 0;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+
+ osti_memset(&ForensicData, 0, sizeof(agsaForensicData_t));
+
+ ForensicData.DataType = pForensicDataPayload->DataType;
+
+ switch (ForensicData.DataType)
+ {
+ case FORENSIC_DATA_TYPE_NON_FATAL:
+ case FORENSIC_DATA_TYPE_FATAL:
+ ForensicData.BufferType.dataBuf.directLen = pForensicDataPayload->dataBuffer.directLen;
+ ForensicData.BufferType.dataBuf.directOffset = pForensicDataPayload->dataBuffer.directOffset;
+ ForensicData.BufferType.dataBuf.readLen = pForensicDataPayload->dataBuffer.readLen;
+ ForensicData.BufferType.dataBuf.directData = (void*)pForensicDataPayload->dataBuffer.directData;
+ break;
+ case FORENSIC_DATA_TYPE_GSM_SPACE:
+ ForensicData.BufferType.gsmBuf.directLen = pForensicDataPayload->gsmBuffer.directLen;
+ ForensicData.BufferType.gsmBuf.directOffset = pForensicDataPayload->gsmBuffer.directOffset;
+ ForensicData.BufferType.dataBuf.readLen = pForensicDataPayload->gsmBuffer.readLen;
+ ForensicData.BufferType.gsmBuf.directData = (void*)pForensicDataPayload->gsmBuffer.directData;
+ break;
+
+ case FORENSIC_DATA_TYPE_IB_QUEUE:
+ ForensicData.BufferType.queueBuf.directLen = pForensicDataPayload->queueBuffer.directLen;
+ //ForensicData.BufferType.queueBuf.queueType = pForensicDataPayload->queueBuffer.queueType;
+ ForensicData.BufferType.queueBuf.queueType = FORENSIC_DATA_TYPE_IB_QUEUE;
+ ForensicData.BufferType.queueBuf.queueIndex = pForensicDataPayload->queueBuffer.queueIndex;
+ ForensicData.BufferType.queueBuf.directData = (void*)pForensicDataPayload->queueBuffer.directData;
+ break;
+ case FORENSIC_DATA_TYPE_OB_QUEUE:
+ ForensicData.BufferType.queueBuf.directLen = pForensicDataPayload->queueBuffer.directLen;
+ ForensicData.BufferType.queueBuf.queueType = FORENSIC_DATA_TYPE_OB_QUEUE;
+ ForensicData.BufferType.queueBuf.queueIndex = pForensicDataPayload->queueBuffer.queueIndex;
+ ForensicData.BufferType.queueBuf.directData = (void*)pForensicDataPayload->queueBuffer.directData;
+ break;
+
+ default:
+ TI_DBG1(("tdsaGetForensicDataIoctl: forensic data type error %d\n", pForensicDataPayload->DataType));
+ status = IOCTL_CALL_INVALID_CODE;
+ return status;
+ }
+
+ if ( saGetForensicData(agRoot, agNULL, &ForensicData) != AGSA_RC_SUCCESS )
+ {
+ status = IOCTL_CALL_FAIL;
+ }
+
+ return status;
+}
+
+osGLOBAL bit32
+tdsaSendSMPIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ void *reqBuffer = agNULL;
+ void *respBuffer = agNULL;
+ void *osMemHandle = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+// bit32 Offset = 0;
+// bit32 RequestLength = 0;
+ bit32 ostiMemoryStatus = 0;
+ smp_pass_through_req_t *smp_pass_through_req;
+
+ tiDeviceHandle_t *devHandle;
+ agsaSMPFrame_t agSMPFrame;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ bit32 i;
+
+ TI_DBG2(("tdsaSendSMPIoctl: start\n"));
+
+ smp_pass_through_req = (smp_pass_through_req_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ for(i=0;i<8;i++)
+ TI_DBG2(("SAS Address[%d]:%x",i,smp_pass_through_req->exp_sas_addr[i]));
+ TI_DBG2(("SAS Request Length:%d",smp_pass_through_req->smp_req_len));
+ TI_DBG2(("SAS Response Length:%d",smp_pass_through_req->smp_resp_len));
+ for(i=0;i<smp_pass_through_req->smp_req_len;i++)
+ TI_DBG2(("SAS request + %d:%x",i,smp_pass_through_req->smp_req_resp[i]));
+
+ devHandle = ostiGetDevHandleFromSasAddr(tiRoot, smp_pass_through_req->exp_sas_addr);
+ if(devHandle == NULL)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ return status;
+ }
+
+
+
+ //agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_RESPONDING;
+
+
+
+ if((ostiMemoryStatus != tiSuccess) && (reqBuffer == agNULL ))
+ return IOCTL_CALL_FAIL;
+
+
+ tdsaAllShared->tdFWControlEx.param3 = osMemHandle;
+
+
+ agSMPFrame.outFrameBuf = smp_pass_through_req->smp_req_resp;
+ agSMPFrame.expectedRespLen = smp_pass_through_req->smp_resp_len;
+ agSMPFrame.inFrameLen = smp_pass_through_req->smp_resp_len - 4;
+
+ if(!(smp_pass_through_req->smp_req_len - 8) && !tiIS_SPC(agRoot))
+ {
+ agSMPFrame.flag = 1; // Direct request Indirect response
+ agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 4; //Exclude header
+ }
+ else
+ {
+
+ agSMPFrame.flag = 3; //Indirect request and Indirect response
+ ostiMemoryStatus = ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&reqBuffer,
+ &(agSMPFrame.outFrameAddrUpper32),
+ &(agSMPFrame.outFrameAddrLower32),
+ 8,
+ smp_pass_through_req->smp_req_len,
+ agFALSE);
+ tdsaAllShared->tdFWControlEx.param3 = osMemHandle;
+ if(tiIS_SPC(agRoot))
+ {
+ agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 4; //Exclude crc
+ osti_memcpy((void *)reqBuffer, (void *)(smp_pass_through_req->smp_req_resp), smp_pass_through_req->smp_req_len);
+ }
+ else
+ {
+ agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 8; //Exclude header and crc
+ osti_memcpy((void *)reqBuffer, (void *)(smp_pass_through_req->smp_req_resp + 4), smp_pass_through_req->smp_req_len - 4);
+ }
+ }
+
+ ostiMemoryStatus = ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&respBuffer,
+ &(agSMPFrame.inFrameAddrUpper32),
+ &(agSMPFrame.inFrameAddrLower32),
+ 8,
+ smp_pass_through_req->smp_resp_len + 4,
+ agFALSE);
+ if((ostiMemoryStatus != tiSuccess) && (respBuffer == agNULL ))
+ return IOCTL_CALL_FAIL;
+
+
+ osti_memset((void *)respBuffer, 0, smp_pass_through_req->smp_resp_len);
+
+ // use FW control place in shared structure to keep the neccesary information
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.virtAddr = respBuffer;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)smp_pass_through_req->smp_req_resp + smp_pass_through_req->smp_req_len;
+ tdsaAllShared->tdFWControlEx.len = smp_pass_through_req->smp_resp_len;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 1;
+ status = IOCTL_CALL_PENDING;
+
+ oneDeviceData = (tdsaDeviceData_t *)devHandle->tdData;
+ if(saSendSMPIoctl(agRoot, oneDeviceData->agDevHandle, 0, &agSMPFrame, &ossaSMPIoctlCompleted) != AGSA_RC_SUCCESS)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ }
+ return status;
+}
+
+osGLOBAL void ostiSendSMPIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ agIOCTLPayload->Status = (bit16)status;
+
+ TI_DBG1(("ostiSendSMPIOCTLRsp: start, status = %d\n", status));
+
+// if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
+// {
+ osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
+ (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
+ tdsaAllShared->tdFWControlEx.len);
+// }
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.buffer,
+ tdsaAllShared->tdFWControlEx.len);
+ ostiFreeMemory(tiRoot,
+ tdsaAllShared->tdFWControlEx.param3,
+ tdsaAllShared->tdFWControlEx.len);
+ //if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
+// {
+ ostiIOCTLComplete(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+// }
+}
+
+
+
+
+/*****************************************************************************
+*
+* tdsaSendBISTIoctl
+*
+* Purpose: This routine is called to get Forensic Data.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* agIOCTLPayload: Pointer to the IOCTL payload.
+* agParam1: Pointer to pass context handle for IOCTL DMA operation
+* agParam2: Pointer to pass context handle for IOCTL DMA operation
+* agParam3: Pointer to pass context handle for IOCTL DMA operation
+*
+* Return:
+*
+* IOCTL_CALL_SUCCESS The requested operation completed successfully.
+* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
+* Detail error code is function specific and
+* defined by the specific IOCTL function.
+* IOCTL_CALL_PENDING This request is asynchronous and completed
+* in some other context.
+* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaSendBISTIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdBistPayload_t *pBistPayload;
+// bit32 length = 0;
+// bit32 status = IOCTL_CALL_SUCCESS;
+ bit32 status = IOCTL_CALL_FAIL;
+
+ pBistPayload = (tdBistPayload_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ tdsaAllShared->tdFWControlEx.buffer = agNULL;
+ tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
+ tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
+ tdsaAllShared->tdFWControlEx.len = 0;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+ tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+
+ TI_DBG1(("tdsaSendBISTIoctl: Type %d Length %d Data %p\n",
+ pBistPayload->testType,
+ pBistPayload->testLength,
+ pBistPayload->testData ));
+
+
+ // pBistPayload->testtype = AGSA_BIST_TEST;
+
+ if( pBistPayload->testType == AGSA_BIST_TEST)
+ {
+ if( pBistPayload->testLength != sizeof(agsaEncryptSelfTestBitMap_t))
+ {
+ return status;
+ }
+ }
+ else if( pBistPayload->testType == AGSA_SHA_TEST)
+ {
+ if( pBistPayload->testLength != sizeof(agsaEncryptSHATestDescriptor_t) )
+ {
+ return status;
+ }
+ }
+ else if( pBistPayload->testType == AGSA_HMAC_TEST )
+ {
+ if( pBistPayload->testLength != sizeof(agsaEncryptHMACTestDescriptor_t))
+ {
+ return status;
+ }
+ }
+
+/*
+GLOBAL bit32 saEncryptSelftestExecute(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 queueNum,
+ bit32 type,
+ bit32 length,
+ void *TestDescriptor);
+
+*/
+ if ( saEncryptSelftestExecute(agRoot,
+ agNULL,
+ 0,
+ pBistPayload->testType,
+ pBistPayload->testLength,
+ pBistPayload->testData ) != AGSA_RC_SUCCESS )
+ {
+ status = IOCTL_CALL_FAIL;
+ }
+
+ return status;
+}
+
+
+osGLOBAL bit32
+tdsaSendTMFIoctl( tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ unsigned long resetType
+ )
+{
+ bit32 status;
+ tmf_pass_through_req_t *tmf_req = (tmf_pass_through_req_t*)agIOCTLPayload->FunctionSpecificArea;
+#if !(defined(__FreeBSD__))
+ status = ostiSendResetDeviceIoctl(tiRoot, agParam2, tmf_req->pathId, tmf_req->targetId, tmf_req->lun, resetType);
+#endif
+ TI_DBG3(("Status returned from ostiSendResetDeviceIoctl is %d\n",status));
+ if(status != IOCTL_CALL_SUCCESS)
+ {
+ agIOCTLPayload->Status = status;
+ return status;
+ }
+ status = IOCTL_CALL_SUCCESS;
+ return status;
+}
+
+
+#ifdef VPD_TESTING
+/* temporary to test saSetVPDCommand() and saGetVPDCommand */
+osGLOBAL bit32
+tdsaVPDSet(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ bit32 status = IOCTL_CALL_SUCCESS;
+ agsaVPD_t VPDInfo;
+ bit32 ret = AGSA_RC_SUCCESS;
+
+ bit32 bufAddrUpper = 0;
+ bit32 bufAddrLower = 0;
+ tdVPDControl_t *VPDControl;
+
+ void *osMemHandle = agNULL;
+ void *buffer;
+ bit32 timeCount=0;
+ bit8 ioctlErr=0;
+ bit8 VPDPayload[32];
+ bit8 i;
+ TI_DBG2(("tdsaVPDSet: start\n"));
+
+ for(i=0;i<sizeof(VPDPayload);i++)
+ {
+ VPDPayload[i] = i;
+ }
+ if(ostiAllocMemory( tiRoot,
+ &osMemHandle,
+ (void **)&buffer,
+ &bufAddrUpper,
+ &bufAddrLower,
+ 8,
+ sizeof(VPDPayload),
+ agFALSE))
+ {
+ return tiError;
+ }
+ osti_memcpy((void *)buffer,
+ VPDPayload,
+ sizeof(VPDPayload));
+
+
+ osti_memset(&VPDInfo, 0, sizeof(agsaVPD_t));
+#ifdef NOT_YET /* direct mode worked */
+ /* For now, only direct mode */
+ VPDInfo.indirectMode = 0; /* direct mode */
+ VPDInfo.VPDDevice = 1; /* SEEPROM-1 */
+ VPDInfo.directLen = (bit8)sizeof(VPDPayload);
+ VPDInfo.VPDOffset = 0;
+ VPDInfo.directData = buffer;
+ VPDInfo.indirectAddrUpper32 = bufAddrUpper;
+ VPDInfo.indirectAddrLower32 = bufAddrLower;
+ VPDInfo.indirectLen = sizeof(VPDPayload);
+#endif
+
+ /* indirect mode */
+ VPDInfo.indirectMode = 1; /* indirect mode */
+ VPDInfo.VPDDevice = 1; /* SEEPROM-1 */
+ VPDInfo.directLen = 0;
+ VPDInfo.VPDOffset = 0;
+ VPDInfo.directData = agNULL;
+ VPDInfo.indirectAddrUpper32 = bufAddrUpper;
+ VPDInfo.indirectAddrLower32 = bufAddrLower;
+ VPDInfo.indirectLen = sizeof(VPDPayload);
+
+ tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
+ tdsaAllShared->tdFWControlEx.param1 = agParam1;
+ tdsaAllShared->tdFWControlEx.param2 = agParam2;
+
+ /* for testing only */
+ tdsaAllShared->addrUpper = bufAddrUpper;
+ tdsaAllShared->addrLower = bufAddrLower;
+
+ ret = saSetVPDCommand(agRoot, agNULL, 0, &VPDInfo);
+
+ if (ret == AGSA_RC_SUCCESS)
+ {
+ status = tiSuccess;
+ }
+ else
+ {
+ status = tiError;
+ }
+
+ ostiFreeMemory(tiRoot, osMemHandle, sizeof(VPDPayload));
+ return status;
+}
+
+/* temporary to test saSetVPDCommand() and saGetVPDCommand */
+osGLOBAL bit32
+tdsaVPDGet(tiRoot_t *tiRoot)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ bit32 status = IOCTL_CALL_SUCCESS;
+ agsaVPD_t VPDInfo;
+ bit32 ret = AGSA_RC_SUCCESS;
+
+
+ TI_DBG2(("tdsaVPDGet: start\n"));
+
+ osti_memset(&VPDInfo, 0, sizeof(agsaVPD_t));
+
+ /* direct mode worked */
+ VPDInfo.indirectMode = 0; /* direct mode */
+ VPDInfo.VPDDevice = 1; /* SEEPROM-1*/
+ VPDInfo.directLen = 32;
+ VPDInfo.VPDOffset = 0;
+ VPDInfo.directData = agNULL;
+ VPDInfo.indirectAddrUpper32 = 0;
+ VPDInfo.indirectAddrLower32 = 0;
+ VPDInfo.indirectLen = 0;
+
+
+#ifdef NOT_YET /* worked; can't read VPD in ossaGetVPDResponseCB() because of indirect */
+ VPDInfo.indirectMode = 1; /* direct mode */
+ VPDInfo.VPDDevice = 1; /* SEEPROM-1*/
+ VPDInfo.directLen = 0;
+ VPDInfo.VPDOffset = 0;
+ VPDInfo.directData = agNULL;
+ VPDInfo.indirectAddrUpper32 = tdsaAllShared->addrUpper;
+ VPDInfo.indirectAddrLower32 = tdsaAllShared->addrLower;
+ VPDInfo.indirectLen = 32;
+#endif
+ ret = saGetVPDCommand(agRoot, agNULL, 0, &VPDInfo);
+
+ if (ret == AGSA_RC_SUCCESS)
+ {
+ status = tiSuccess;
+ }
+ else
+ {
+ status = tiError;
+ }
+ return status;
+}
+#endif
+/*****************************************************************************
+*
+* tdsaGetNumOfLUNIOCTL
+*
+* Purpose: This routine is called to send Report LUN SSP command request.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* tiIOCTLPayload_t: Status of the Controller Reset.
+* agParam1: Void pointer to device extension
+* agParam2: Void pointer to SRB
+* agParam3: NULL
+*
+* Return: status
+*
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaGetNumOfLUNIOCTL(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
+ tdDeviceLUNInfoIOCTL_t *pDeviceLUNInfo = agNULL;
+ tiDeviceHandle_t *devHandle = agNULL;
+ void *tiRequestBody = agNULL;
+ tiIORequest_t *tiIORequest = agNULL;
+ bit32 status = IOCTL_CALL_SUCCESS;
+
+ TI_DBG2(("tdsaGetNumOfLUNIOCTL: Start\n"));
+ do
+ {
+ pDeviceLUNInfo = (tdDeviceLUNInfoIOCTL_t*)agIOCTLPayload->FunctionSpecificArea;
+
+ if (agIOCTLPayload->Length < sizeof(tdDeviceLUNInfoIOCTL_t))
+ {
+ status = IOCTL_CALL_FAIL;
+ break;
+ }
+ if(!pDeviceLUNInfo->tiDeviceHandle)
+ {
+ status = IOCTL_CALL_FAIL;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ break;
+ }
+ devHandle = (tiDeviceHandle_t*)pDeviceLUNInfo->tiDeviceHandle;
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
+
+ status = ostiNumOfLUNIOCTLreq(tiRoot,agParam1,agParam2,&tiRequestBody,&tiIORequest);
+
+
+ if(status != AGSA_RC_SUCCESS)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ break;
+ }
+ status = tiNumOfLunIOCTLreq(tiRoot,tiIORequest,devHandle,tiRequestBody,agIOCTLPayload,agParam1,agParam2);
+
+ if(status != AGSA_RC_SUCCESS)
+ {
+ agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
+ break;
+ }
+// ostiIOCTLWaitForSignal (tiRoot, agParam1, agParam2, agParam3);
+
+ }while(0);
+ TI_DBG2(("tdsaGetNumOfLUNIOCTL: End\n"));
+ return status;
+}
+
+
+/*****************************************************************************
+*
+* ostiNumOfLUNIOCTLRsp
+*
+* Purpose: This routine is called when a Report LUN SSP command response id recieved.
+*
+* Parameters:
+* tiRoot: Pointer to driver instance
+* bit32 status
+*
+* Return: none
+*
+*
+*****************************************************************************/
+osGLOBAL void ostiNumOfLUNIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tiIOCTLPayload_t *agIOCTLPayload;
+ tdDeviceLUNInfoIOCTL_t *pDeviceLUNInfo = NULL;
+ bit32 count = 0;
+ bit32 numOfLUN =0;
+
+ TI_DBG1(("ostiNumOfLUNIOCTLRsp: start, status = %d\n", status));
+
+ if(tdsaAllShared->tdFWControlEx.inProgress == 1)
+ {
+ agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
+ if ((agIOCTLPayload) && (PMC_IOCTL_SIGNATURE == agIOCTLPayload->Signature)&&
+ (IOCTL_MJ_GET_DEVICE_LUN == agIOCTLPayload->MajorFunction))
+ {
+ agIOCTLPayload->Status = (bit16)status;
+ pDeviceLUNInfo = (tdDeviceLUNInfoIOCTL_t*)agIOCTLPayload->FunctionSpecificArea;
+ numOfLUN = ((tdsaAllShared->tdFWControlEx.virtAddr[0] << 24)|(tdsaAllShared->tdFWControlEx.virtAddr[1] << 16)|\
+ (tdsaAllShared->tdFWControlEx.virtAddr[2] << 8)|(tdsaAllShared->tdFWControlEx.virtAddr[3]));
+ numOfLUN = numOfLUN/8;
+ pDeviceLUNInfo->numOfLun = numOfLUN;
+// ostiFreeMemory(tiRoot,
+// tdsaAllShared->tdFWControlEx.virtAddr,
+// tdsaAllShared->tdFWControlEx.len);
+ // if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
+ // {
+ ostiIOCTLSetSignal(tiRoot,
+ tdsaAllShared->tdFWControlEx.param1,
+ tdsaAllShared->tdFWControlEx.param2,
+ NULL);
+ tdsaAllShared->tdFWControlEx.payload = NULL;
+ // }
+
+ tdsaAllShared->tdFWControlEx.inProgress = 0;
+ }
+ }
+ TI_DBG1(("ostiNumOfLUNIOCTLRsp: End\n"));
+}
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.h
new file mode 100644
index 0000000..8c1b42f
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdioctl.h
@@ -0,0 +1,687 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+*******************************************************************************/
+/*****************************************************************************
+*
+* tdioctl.h
+*
+* Abstract: This module contains data structure definition used
+* by the Transport Dependent (TD) Layer IOCTL.
+*
+*
+* Notes:
+*
+*
+** MODIFICATION HISTORY ******************************************************
+*
+* NAME DATE DESCRIPTION
+* ---- ---- -----------
+* IWN 12/11/02 Initial creation.
+*
+*
+*****************************************************************************/
+
+
+#ifndef TD_IOCTL_H
+
+#define TD_IOCTL_H
+
+//#include "global.h"
+
+/*
+ * PMC-Sierra IOCTL signature
+ */
+#define PMC_SIERRA_SIGNATURE 0x1234
+#define PMC_SIERRA_IOCTL_SIGNATURE "PMC-STRG"
+
+/*
+ * Major function code of IOCTL functions, common to target and initiator.
+ */
+#define IOCTL_MJ_CARD_PARAMETER 0x01
+#define IOCTL_MJ_FW_CONTROL 0x02
+#define IOCTL_MJ_NVMD_GET 0x03
+#define IOCTL_MJ_NVMD_SET 0x04
+#define IOCTL_MJ_GET_EVENT_LOG1 0x05
+#define IOCTL_MJ_GET_EVENT_LOG2 0x06
+#define IOCTL_MJ_GET_CORE_DUMP 0x07
+#define IOCTL_MJ_LL_TRACING 0x08
+#define IOCTL_MJ_FW_PROFILE 0x09
+#define IOCTL_MJ_MNID 0x0A
+#define IOCTL_MJ_ENCRYPTION_CTL 0x0B
+
+#define IOCTL_MJ_FW_INFO 0x0C
+
+#define IOCTL_MJ_LL_API_TEST 0x11
+#define IOCTL_MJ_CHECK_DPMC_EVENT 0x16
+#define IOCTL_MJ_GET_FW_REV 0x1A
+#define IOCTL_MJ_GET_DEVICE_INFO 0x1B
+#define IOCTL_MJ_GET_IO_ERROR_STATISTIC 0x1C
+#define IOCTL_MJ_GET_IO_EVENT_STATISTIC 0x1D
+#define IOCTL_MJ_GET_FORENSIC_DATA 0x1E
+#define IOCTL_MJ_GET_DEVICE_LIST 0x1F
+#define IOCTL_MJ_SMP_REQUEST 0x6D
+#define IOCTL_MJ_GET_DEVICE_LUN 0x7A1
+#define IOCTL_MJ_PHY_GENERAL_STATUS 0x7A6
+#define IOCTL_MJ_PHY_DETAILS 0x7A7
+#define IOCTL_MJ_SEND_BIST 0x20
+#define IOCTL_MJ_CHECK_FATAL_ERROR 0x70
+#define IOCTL_MJ_FATAL_ERROR_DUMP_COMPLETE 0x71
+#define IOCTL_MJ_GPIO 0x41
+#define IOCTL_MJ_SGPIO 0x42
+#define IOCTL_MJ_SEND_TMF 0x6E
+#define IOCTL_MJ_FATAL_ERROR_SOFT_RESET_TRIG 0x72
+#define IOCTL_MJ_FATAL_ERR_CHK_RET_FALSE 0x76
+#define IOCTL_MJ_FATAL_ERR_CHK_SEND_FALSE 0x76
+#define IOCTL_MJ_FATAL_ERR_CHK_SEND_TRUE 0x77
+
+
+/*
+ * Major function code of IOCTL functions, specific to initiator.
+ */
+#define IOCTL_MJ_INI_ISCSI_DISCOVERY 0x21
+#define IOCTL_MJ_INI_SESSION_CONTROL 0x22
+#define IOCTL_MJ_INI_SNIA_IMA 0x23
+#define IOCTL_MJ_INI_SCSI 0x24
+#define IOCTL_MJ_INI_WMI 0x25
+#define IOCTL_MJ_INI_DRIVER_EVENT_LOG 0x26
+#define IOCTL_MJ_INI_PERSISTENT_BINDING 0x27
+#define IOCTL_MJ_INI_DRIVER_IDENTIFY 0x28
+
+/* temp */
+#define IOCTL_MJ_PORT_STOP 0x29
+#define IOCTL_MJ_PORT_START 0x30
+
+/* SPCv controller configuration page commands */
+#define IOCTL_MJ_MODE_CTL_PAGE 0x40
+
+#define IOCTL_MJ_SET_OR_GET_REGISTER 0x41
+
+#define IOCTL_MJ_GET_PHY_PROFILE 0x44
+#define IOCTL_MJ_SET_PHY_PROFILE 0x43
+
+#define IOCTL_MJ_GET_DRIVER_VERSION 0x101
+
+#define IOCTL_MN_PHY_PROFILE_COUNTERS 0x01
+#define IOCTL_MN_PHY_PROFILE_COUNTERS_CLR 0x02
+#define IOCTL_MN_PHY_PROFILE_BW_COUNTERS 0x03
+#define IOCTL_MN_PHY_PROFILE_ANALOG_SETTINGS 0x04
+
+/*
+ * Minor functions for Card parameter IOCTL functions.
+ */
+#define IOCTL_MN_CARD_GET_VPD_INFO 0x01
+#define IOCTL_MN_CARD_GET_PORTSTART_INFO 0x02
+#define IOCTL_MN_CARD_GET_INTERRUPT_CONFIG 0x03
+#define IOCTL_MN_CARD_GET_PHY_ANALOGSETTING 0x04
+#define IOCTL_MN_CARD_GET_TIMER_CONFIG 0x05
+#define IOCTL_MN_CARD_GET_TYPE_FATAL_DUMP 0x06
+
+/*
+ * Minor functions for FW control IOCTL functions.
+ */
+
+/* Send FW data requests.
+ */
+#define IOCTL_MN_FW_DOWNLOAD_DATA 0x01
+
+/* Send the request for burning the new firmware.
+ */
+#define IOCTL_MN_FW_DOWNLOAD_BURN 0x02
+
+/* Poll for the flash burn phases. Sequences of poll function calls are
+ * needed following the IOCTL_MN_FW_DOWNLOAD_BURN, IOCTL_MN_FW_BURN_OSPD
+ * and IOCTL_MN_FW_ROLL_BACK_FW functions.
+ */
+#define IOCTL_MN_FW_BURN_POLL 0x03
+
+/* Instruct the FW to roll back FW to prior revision.
+ */
+#define IOCTL_MN_FW_ROLL_BACK_FW 0x04
+
+/* Instruct the FW to return the current firmware revision number.
+ */
+#define IOCTL_MN_FW_VERSION 0x05
+
+/* Retrieve the maximum size of the OS Persistent Data stored on the card.
+ */
+#define IOCTL_MN_FW_GET_OSPD_SIZE 0x06
+
+/* Retrieve the OS Persistent Data from the card.
+ */
+#define IOCTL_MN_FW_GET_OSPD 0x07
+
+/* Send a new OS Persistent Data to the card and burn in flash.
+ */
+#define IOCTL_MN_FW_BURN_OSPD 0x08
+
+/* Retrieve the trace buffer from the card FW. Only available on the debug
+ * version of the FW.
+ */
+#define IOCTL_MN_FW_GET_TRACE_BUFFER 0x0f
+
+#define IOCTL_MN_NVMD_GET_CONFIG 0x0A
+#define IOCTL_MN_NVMD_SET_CONFIG 0x0B
+
+#define IOCTL_MN_FW_GET_CORE_DUMP_AAP1 0x0C
+#define IOCTL_MN_FW_GET_CORE_DUMP_IOP 0x0D
+#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_AAP1 0x12
+#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_IOP 0x13
+
+#define IOCTL_MN_LL_RESET_TRACE_INDEX 0x0e
+#define IOCTL_MN_LL_GET_TRACE_BUFFER_INFO 0x0f
+#define IOCTL_MN_LL_GET_TRACE_BUFFER 0x10
+
+#define IOCTL_MN_ENCRYPTION_GET_INFO 0x13
+#define IOCTL_MN_ENCRYPTION_SET_MODE 0x14
+#define IOCTL_MN_ENCRYPTION_KEK_ADD 0x15
+#define IOCTL_MN_ENCRYPTION_DEK_ADD 0x16
+#define IOCTL_MN_ENCRYPTION_DEK_INVALID 0x17
+#define IOCTL_MN_ENCRYPTION_KEK_NVRAM 0x18
+#define IOCTL_MN_ENCRYPTION_DEK_ASSIGN 0x19
+#define IOCTL_MN_ENCRYPTION_LUN_QUERY 0x1A
+#define IOCTL_MN_ENCRYPTION_KEK_LOAD_NVRAM 0x1B
+#define IOCTL_MN_ENCRYPTION_ERROR_QUERY 0x1C
+#define IOCTL_MN_ENCRYPTION_DEK_TABLE_INIT 0x1D
+#define IOCTL_MN_ENCRYPT_LUN_VERIFY 0x1E
+#define IOCTL_MN_ENCRYPT_OPERATOR_MGMT 0x1F
+#define IOCTL_MN_ENCRYPT_SET_DEK_CONFIG_PAGE 0x21
+#define IOCTL_MN_ENCRYPT_SET_CONTROL_PAGE 0x22
+#define IOCTL_MN_ENCRYPT_SET_OPERATOR_CMD 0x23
+#define IOCTL_MN_ENCRYPT_TEST_EXECUTE 0x24
+#define IOCTL_MN_ENCRYPT_SET_HMAC_CONFIG_PAGE 0x25
+#define IOCTL_MN_ENCRYPT_GET_OPERATOR_CMD 0x26
+#define IOCTL_MN_ENCRYPT_RESCAN 0x27
+#ifdef SOFT_RESET_TEST
+#define IOCTL_MN_SOFT_RESET 0x28
+#endif
+/* SPCv configuration pages */
+#define IOCTL_MN_MODE_SENSE 0x30
+#define IOCTL_MN_MODE_SELECT 0x31
+
+#define IOCTL_MN_TISA_TEST_ENCRYPT_DEK_DUMP 0x51
+
+#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG1 0x5A
+#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG2 0x6A
+#define IOCTL_MN_GET_EVENT_LOG1 0x5B
+#define IOCTL_MN_GET_EVENT_LOG2 0x6B
+
+#define IOCTL_MN_GPIO_PINSETUP 0x01
+#define IOCTL_MN_GPIO_EVENTSETUP 0x02
+#define IOCTL_MN_GPIO_READ 0x03
+#define IOCTL_MN_GPIO_WRITE 0x04
+
+#define IOCTL_MN_TMF_DEVICE_RESET 0x6F
+#define IOCTL_MN_TMF_LUN_RESET 0x70
+typedef struct tdFWControl
+{
+ bit32 retcode; /* ret code (status) = (bit32)oscmCtrlEvnt_e */
+ bit32 phase; /* ret code phase = (bit32)agcmCtrlFwPhase_e */
+ bit32 phaseCmplt; /* percent complete for the current update phase */
+ bit32 version; /* Hex encoded firmware version number */
+ bit32 offset; /* Used for downloading firmware */
+ bit32 len; /* len of buffer */
+ bit32 size; /* Used in OS VPD and Trace get size operations. */
+ bit32 reserved; /* padding required for 64 bit alignment */
+ bit8 buffer[1]; /* Start of buffer */
+} tdFWControl_t;
+
+
+typedef struct tdFWControlEx
+{
+ tdFWControl_t *tdFWControl;
+ bit8 *buffer; // keep buffer pointer to be freed when the responce comes
+ bit8 *virtAddr; /* keep virtual address of the data */
+ bit8 *usrAddr; /* keep virtual address of the user data */
+ bit32 len; /* len of buffer */
+ void *payload; /* pointer to IOCTL Payload */
+ bit8 inProgress; /* if 1 - the IOCTL request is in progress */
+ void *param1;
+ void *param2;
+ void *param3;
+} tdFWControlEx_t;
+
+/************************************************************/
+//This flag and datastructure are specific for fw profiling, Now defined as
+// compiler flag
+//#define SPC_ENABLE_PROFILE
+
+#ifdef SPC_ENABLE_PROFILE
+typedef struct tdFWProfile
+{
+ bit32 status;
+ bit32 tcid;
+ bit32 processor; /* processor name "iop/aap1" */
+ bit32 cmd; /* cmd to fw */
+ bit32 len; /* len of buffer */
+ bit32 codeStartAdd;
+ bit32 codeEndAdd;
+ bit32 reserved; /* padding required for 64 bit alignment */
+ bit8 buffer[1]; /* Start of buffer */
+} tdFWProfile_t;
+
+/************************************************/
+/**Definations for FW profile*/
+#define FW_PROFILE_PROCESSOR_ID_IOP 0x00
+#define FW_PROFILE_PROCESSOR_ID_AAP1 0x02
+/* definitions for sub operation */
+#define START_TIMER_PROFILE 0x01
+#define START_CODE_PROFILE 0x02
+#define STOP_TIMER_PROFILE 0x81
+#define STOP_CODE_PROFILE 0x82
+/************************************************/
+
+typedef struct tdFWProfileEx
+{
+ tdFWProfile_t *tdFWProfile;
+ bit8 *buffer; // keep buffer pointer to be freed when the responce comes
+ bit8 *virtAddr; /* keep virtual address of the data */
+ bit8 *usrAddr; /* keep virtual address of the user data */
+ bit32 len; /* len of buffer */
+ void *payload; /* pointer to IOCTL Payload */
+ bit8 inProgress; /* if 1 - the IOCTL request is in progress */
+ void *param1;
+ void *param2;
+ void *param3;
+} tdFWProfileEx_t;
+#endif
+/************************************************************/
+typedef struct tdVPDControl
+{
+ bit32 retcode; /* ret code (status) */
+ bit32 phase; /* ret code phase */
+ bit32 phaseCmplt; /* percent complete for the current update phase */
+ bit32 version; /* Hex encoded firmware version number */
+ bit32 offset; /* Used for downloading firmware */
+ bit32 len; /* len of buffer */
+ bit32 size; /* Used in OS VPD and Trace get size operations. */
+ bit8 deviceID; /* padding required for 64 bit alignment */
+ bit8 reserved1;
+ bit16 reserved2;
+ bit32 signature;
+ bit8 buffer[1]; /* Start of buffer */
+} tdVPDControl_t;
+
+typedef struct tdDeviceInfoIOCTL_s
+{
+ bit8 deviceType; // TD_SATA_DEVICE or TD_SAS_DEVICE
+ bit8 linkRate; // 0x08: 1.5 Gbit/s; 0x09: 3.0; 0x0A: 6.0 Gbit/s.
+ bit8 phyId;
+ bit8 reserved;
+ bit32 sasAddressHi; // SAS address high
+ bit32 sasAddressLo; // SAS address low
+ bit32 up_sasAddressHi; // upstream SAS address high
+ bit32 up_sasAddressLo; // upstream SAS address low
+ bit32 ishost;
+ bit32 isEncryption; // is encryption enabled
+ bit32 isDIF; // is DIF enabled
+ unsigned long DeviceHandle;
+ bit32 host_num;
+ bit32 channel;
+ bit32 id;
+ bit32 lun;
+}tdDeviceInfoIOCTL_t;
+
+/* Payload of IOCTL dump device list at OS layer */
+typedef struct tdDeviceInfoPayload_s
+{
+ bit32 PathId;
+ bit32 TargetId;
+ bit32 Lun;
+ bit32 Reserved; /* Had better aligned to 64-bit. */
+
+ /* output */
+ tdDeviceInfoIOCTL_t devInfo;
+}tdDeviceInfoPayload_t;
+
+typedef struct tdDeviceListPayload_s
+{
+ bit32 realDeviceCount;// the real device out in the array, returned by driver
+ bit32 deviceLength; // the length of tdDeviceInfoIOCTL_t array
+ bit8 pDeviceInfo[1]; // point to tdDeviceInfoIOCTL_t array
+}tdDeviceListPayload_t;
+
+// Payload of IO error and event statistic IOCTL.
+typedef struct tdIoErrorEventStatisticIOCTL_s
+{
+ bit32 agOSSA_IO_COMPLETED_ERROR_SCSI_STATUS;
+ bit32 agOSSA_IO_ABORTED;
+ bit32 agOSSA_IO_OVERFLOW;
+ bit32 agOSSA_IO_UNDERFLOW;
+ bit32 agOSSA_IO_FAILED;
+ bit32 agOSSA_IO_ABORT_RESET;
+ bit32 agOSSA_IO_NOT_VALID;
+ bit32 agOSSA_IO_NO_DEVICE;
+ bit32 agOSSA_IO_ILLEGAL_PARAMETER;
+ bit32 agOSSA_IO_LINK_FAILURE;
+ bit32 agOSSA_IO_PROG_ERROR;
+ bit32 agOSSA_IO_DIF_IN_ERROR;
+ bit32 agOSSA_IO_DIF_OUT_ERROR;
+ bit32 agOSSA_IO_ERROR_HW_TIMEOUT;
+ bit32 agOSSA_IO_XFER_ERROR_BREAK;
+ bit32 agOSSA_IO_XFER_ERROR_PHY_NOT_READY;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_BREAK;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_UNKNOWN_ERROR;
+ bit32 agOSSA_IO_XFER_ERROR_NAK_RECEIVED;
+ bit32 agOSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT;
+ bit32 agOSSA_IO_XFER_ERROR_PEER_ABORTED;
+ bit32 agOSSA_IO_XFER_ERROR_RX_FRAME;
+ bit32 agOSSA_IO_XFER_ERROR_DMA;
+ bit32 agOSSA_IO_XFER_ERROR_CREDIT_TIMEOUT;
+ bit32 agOSSA_IO_XFER_ERROR_SATA_LINK_TIMEOUT;
+ bit32 agOSSA_IO_XFER_ERROR_SATA;
+ bit32 agOSSA_IO_XFER_ERROR_ABORTED_DUE_TO_SRST;
+ bit32 agOSSA_IO_XFER_ERROR_REJECTED_NCQ_MODE;
+ bit32 agOSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE;
+ bit32 agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT;
+ bit32 agOSSA_IO_XFER_SMP_RESP_CONNECTION_ERROR;
+ bit32 agOSSA_IO_XFER_ERROR_UNEXPECTED_PHASE;
+ bit32 agOSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN;
+ bit32 agOSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED;
+ bit32 agOSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT;
+ bit32 agOSSA_IO_XFER_ERROR_CMD_ISSUE_BREAK_BEFORE_ACK_NAK;
+ bit32 agOSSA_IO_XFER_ERROR_CMD_ISSUE_PHY_DOWN_BEFORE_ACK_NAK;
+ bit32 agOSSA_IO_XFER_ERROR_OFFSET_MISMATCH;
+ bit32 agOSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN;
+ bit32 agOSSA_IO_XFER_CMD_FRAME_ISSUED;
+ bit32 agOSSA_IO_ERROR_INTERNAL_SMP_RESOURCE;
+ bit32 agOSSA_IO_PORT_IN_RESET;
+ bit32 agOSSA_IO_DS_NON_OPERATIONAL;
+ bit32 agOSSA_IO_DS_IN_RECOVERY;
+ bit32 agOSSA_IO_TM_TAG_NOT_FOUND;
+ bit32 agOSSA_IO_XFER_PIO_SETUP_ERROR;
+ bit32 agOSSA_IO_SSP_EXT_IU_ZERO_LEN_ERROR;
+ bit32 agOSSA_IO_DS_IN_ERROR;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY;
+ bit32 agOSSA_IO_ABORT_IN_PROGRESS;
+ bit32 agOSSA_IO_ABORT_DELAYED;
+ bit32 agOSSA_IO_INVALID_LENGTH;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED;
+ bit32 agOSSA_IO_DS_INVALID;
+ bit32 agOSSA_IO_XFER_READ_COMPL_ERR;
+ bit32 agOSSA_IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR;
+ bit32 agOSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR;
+ bit32 agOSSA_MPI_IO_RQE_BUSY_FULL;
+ bit32 agOSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE;
+ bit32 agOSSA_MPI_ERR_ATAPI_DEVICE_BUSY;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_IV_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR;
+ bit32 agOSSA_IO_XFR_ERROR_INTERNAL_RAM;
+ bit32 agOSSA_IO_XFR_ERROR_DIF_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH;
+ bit32 agOSSA_IO_XFR_ERROR_INVALID_SSP_RSP_FRAME;
+ bit32 agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS;
+ bit32 agOSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED;
+ bit32 agOSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE;
+ bit32 agOSSA_IO_XFER_ERROR_DIF_INTERNAL_ERROR;
+ bit32 agOSSA_MPI_ERR_OFFLOAD_DIF_OR_ENC_NOT_ENABLED;
+ bit32 agOSSA_IO_UNKNOWN_ERROR;
+
+} tdIoErrorEventStatisticIOCTL_t;
+
+/*
+01: soft error
+02: not ready
+03: medium error
+04: hardware error
+05: illegal request
+06: unit attention
+0b: abort command
+*/
+typedef struct tdSenseKeyCount_s{
+ bit32 SoftError;
+ bit32 MediumNotReady;
+ bit32 MediumError;
+ bit32 HardwareError;
+ bit32 IllegalRequest;
+ bit32 UnitAttention;
+ bit32 AbortCommand;
+ bit32 OtherKeyType;
+}tdSenseKeyCount_t;
+
+/*
+Code Status Command completed Service response
+00h GOOD Yes COMMAND COMPLETE
+02h CHECK CONDITION Yes COMMAND COMPLETE
+04h CONDITION MET Yes COMMAND COMPLETE
+08h BUSY Yes COMMAND COMPLETE
+10h Obsolete
+14h Obsolete
+18h RESERVATION CONFLICT Yes COMMAND COMPLETE
+22h Obsolete
+28h TASK SET FULL Yes COMMAND COMPLETE
+30h ACA ACTIVE Yes COMMAND COMPLETE
+40h TASK ABORTED Yes COMMAND COMPLETE
+*/
+typedef struct tdSCSIStatusCount_s{
+ bit32 GoodStatus;
+ bit32 CheckCondition;
+ bit32 ConditionMet;
+ bit32 BusyStatus;
+ bit32 ResvConflict;
+ bit32 TaskSetFull;
+ bit32 AcaActive;
+ bit32 TaskAborted;
+ bit32 ObsoleteStatus;
+}tdSCSIStatusCount_t;
+
+/* Payload of Io Error Statistic IOCTL. */
+typedef struct tdIoErrorStatisticPayload_s
+{
+ bit32 flag;
+ bit32 Reserved; /* Had better aligned to 64-bit. */
+
+ /* output */
+ tdIoErrorEventStatisticIOCTL_t IoError;
+ tdSCSIStatusCount_t ScsiStatusCounter;
+ tdSenseKeyCount_t SenseKeyCounter;
+} tdIoErrorStatisticPayload_t;
+
+/* Payload of Io Error Statistic IOCTL. */
+typedef struct tdIoEventStatisticPayload_s
+{
+ bit32 flag;
+ bit32 Reserved; /* Had better aligned to 64-bit. */
+
+ /* output */
+ tdIoErrorEventStatisticIOCTL_t IoEvent;
+} tdIoEventStatisticPayload_t;
+
+/* Payload of Register IOCTL. */
+typedef struct tdRegisterPayload_s
+{
+ bit32 flag;
+ bit32 busNum;
+ bit32 RegAddr; /* Register address */
+ bit32 RegValue; /* Register value */
+
+} tdRegisterPayload_t;
+
+
+#define FORENSIC_DATA_TYPE_GSM_SPACE 1
+#define FORENSIC_DATA_TYPE_QUEUE 2
+#define FORENSIC_DATA_TYPE_FATAL 3
+#define FORENSIC_DATA_TYPE_NON_FATAL 4
+#define FORENSIC_DATA_TYPE_IB_QUEUE 5
+#define FORENSIC_DATA_TYPE_OB_QUEUE 6
+#define FORENSIC_DATA_TYPE_CHECK_FATAL 0x70
+
+#define FORENSIC_Q_TYPE_INBOUND 1
+#define FORENSIC_Q_TYPE_OUTBOUND 2
+
+/* get forensic data IOCTL payload */
+typedef struct tdForensicDataPayload_s
+{
+ bit32 DataType;
+ union
+ {
+ struct
+ {
+ bit32 directLen;
+ bit32 directOffset;
+ bit32 readLen;
+ bit8 directData[1];
+ } gsmBuffer;
+
+ struct
+ {
+ bit16 queueType;
+ bit16 queueIndex;
+ bit32 directLen;
+ bit8 directData[1];
+ } queueBuffer;
+
+ struct
+ {
+ bit32 directLen;
+ bit32 directOffset;
+ bit32 readLen;
+ bit8 directData[1];
+ } dataBuffer;
+ };
+}tdForensicDataPayload_t;
+
+typedef struct tdBistPayload_s
+{
+ bit32 testType;
+ bit32 testLength;
+ bit32 testData[29];
+}tdBistPayload_t;
+
+typedef struct _TSTMTID_CARD_LOCATION_INFO
+{
+ bit32 CardNo;
+ bit32 Bus;
+ bit32 Slot;
+ bit32 Device;
+ bit32 Function;
+ bit32 IOLower;
+ bit32 IO_Upper;
+ bit32 VidDid;
+ bit32 PhyMem;
+ bit32 Flag;
+
+} TSTMTID_CARD_LOCATION_INFO;
+
+typedef struct _TSTMTID_TRACE_BUFFER_INFO
+{
+ bit32 CardNo;
+ bit32 TraceCompiled;
+ bit32 BufferSize;
+ bit32 CurrentIndex;
+ bit32 TraceWrap;
+ bit32 CurrentTraceIndexWrapCount;
+ bit32 TraceMask;
+ bit32 Flag;
+
+} TSTMTID_TRACE_BUFFER_INFO;
+
+#define FetchBufferSIZE 32
+#define LowFence32Bits 0xFCFD1234
+#define HighFence32Bits 0x5678ABDC
+
+typedef struct _TSTMTID_TRACE_BUFFER_FETCH
+{
+ bit32 CardNo;
+ bit32 BufferOffsetBegin;
+ bit32 LowFence;
+ bit8 Data[FetchBufferSIZE];
+ bit32 HighFence;
+ bit32 Flag;
+
+} TSTMTID_TRACE_BUFFER_FETCH;
+
+
+typedef struct _TSTMTID_TRACE_BUFFER_RESET
+{
+ bit32 CardNo;
+ bit32 Reset;
+ bit32 TraceMask;
+ bit32 Flag;
+
+} TSTMTID_TRACE_BUFFER_RESET;
+
+
+
+typedef struct tdPhyCount_s{
+ bit32 Phy;
+ bit32 BW_tx;
+ bit32 BW_rx;
+ bit32 InvalidDword;
+ bit32 runningDisparityError;
+ bit32 codeViolation;
+ bit32 LossOfSyncDW;
+ bit32 phyResetProblem;
+ bit32 inboundCRCError;
+}tdPhyCount_t;
+
+
+typedef struct _PHY_GENERAL_STATE
+{
+ bit32 Dword0;
+ bit32 Dword1;
+
+}GetPhyGenState_t;
+typedef struct agsaPhyGeneralState_s
+{
+ GetPhyGenState_t PhyGenData[16];
+ bit32 Reserved1;
+ bit32 Reserved2;
+} agsaPhyGeneralState_t;
+
+typedef struct _PHY_DETAILS_
+{
+ bit8 sasAddressLo[4];
+ bit8 sasAddressHi[4];
+ bit8 attached_sasAddressLo[4];
+ bit8 attached_sasAddressHi[4];
+ bit8 attached_phy;
+ bit8 attached_dev_type ;
+}PhyDetails_t;
+
+enum SAS_SATA_DEVICE_TYPE {
+ SAS_PHY_NO_DEVICE ,
+ SAS_PHY_END_DEVICE,
+ SAS_PHY_EXPANDER_DEVICE,
+ SAS_PHY_SATA_DEVICE = 0x11,
+};
+#define PHY_SETTINGS_LEN 1024
+
+#endif /* TD_IOCTL_H */
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdlist.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tdlist.h
new file mode 100644
index 0000000..e304dcf
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdlist.h
@@ -0,0 +1,168 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * The file defines list data structures for SAS/SATA TD layer
+ *
+ */
+
+#ifndef __TDLIST_H__
+#define __TDLIST_H__
+
+
+typedef struct tdList_s tdList_t;
+
+struct tdList_s {
+ tdList_t *flink;
+ tdList_t *blink;
+};
+
+#define TDLIST_NEXT_ENTRY(ptr, type, member) \
+ container_of((ptr)->flink, type, member)
+
+#define TDLIST_INIT_HDR(hdr) \
+ do { \
+ ((tdList_t *)(hdr))->flink = (tdList_t *)(hdr); \
+ ((tdList_t *)(hdr))->blink = (tdList_t *)(hdr); \
+ } while (0)
+
+#define TDLIST_INIT_ELEMENT(hdr) \
+ do { \
+ ((tdList_t *)(hdr))->flink = (tdList_t *)agNULL; \
+ ((tdList_t *)(hdr))->blink = (tdList_t *)agNULL; \
+ } while (0)
+
+#define TDLIST_ENQUEUE_AT_HEAD(toAddHdr,listHdr) \
+ do { \
+ ((tdList_t *)(toAddHdr))->flink = ((tdList_t *)(listHdr))->flink; \
+ ((tdList_t *)(toAddHdr))->blink = (tdList_t *)(listHdr) ; \
+ ((tdList_t *)(listHdr))->flink->blink = (tdList_t *)(toAddHdr); \
+ ((tdList_t *)(listHdr))->flink = (tdList_t *)(toAddHdr); \
+ } while (0)
+
+#define TDLIST_ENQUEUE_AT_TAIL(toAddHdr,listHdr) \
+ do { \
+ ((tdList_t *)(toAddHdr))->flink = (tdList_t *)(listHdr); \
+ ((tdList_t *)(toAddHdr))->blink = ((tdList_t *)(listHdr))->blink; \
+ ((tdList_t *)(listHdr))->blink->flink = (tdList_t *)(toAddHdr); \
+ ((tdList_t *)(listHdr))->blink = (tdList_t *)(toAddHdr); \
+ } while (0)
+
+#define TDLIST_EMPTY(listHdr) \
+ (((tdList_t *)(listHdr))->flink == ((tdList_t *)(listHdr)))
+
+#define TDLIST_NOT_EMPTY(listHdr) \
+ (!TDLIST_EMPTY(listHdr))
+
+#define TDLIST_DEQUEUE_THIS(hdr) \
+ do { \
+ ((tdList_t *)(hdr))->blink->flink = ((tdList_t *)(hdr))->flink; \
+ ((tdList_t *)(hdr))->flink->blink = ((tdList_t *)(hdr))->blink; \
+ ((tdList_t *)(hdr))->flink = ((tdList_t *)(hdr))->blink = agNULL; \
+ } while (0)
+
+#define TDLIST_DEQUEUE_FROM_HEAD_FAST(atHeadHdr,listHdr) \
+ do { \
+ *((tdList_t **)(atHeadHdr)) = ((tdList_t *)(listHdr))->flink; \
+ (*((tdList_t **)(atHeadHdr)))->flink->blink = (tdList_t *)(listHdr); \
+ ((tdList_t *)(listHdr))->flink = (*(tdList_t **)(atHeadHdr))->flink; \
+ } while (0)
+
+#define TDLIST_DEQUEUE_FROM_HEAD(atHeadHdr,listHdr) \
+do { \
+ if (TDLIST_NOT_EMPTY((listHdr))) \
+ { \
+ TDLIST_DEQUEUE_FROM_HEAD_FAST(atHeadHdr,listHdr); \
+ } \
+ else \
+ { \
+ (*((tdList_t **)(atHeadHdr))) = (tdList_t *)agNULL; \
+ } \
+} while (0)
+
+#define TDLIST_DEQUEUE_FROM_TAIL_FAST(atTailHdr,listHdr) \
+ do { \
+ (*((tdList_t **)(atTailHdr))) = ((tdList_t *)(listHdr))->blink; \
+ (*((tdList_t **)(atTailHdr)))->blink->flink = (tdList_t *)(listHdr); \
+ ((tdList_t *)(listHdr))->blink = (*((tdList_t **)(atTailHdr)))->blink; \
+ } while (0)
+
+#define TDLIST_DEQUEUE_FROM_TAIL(atTailHdr,listHdr) \
+ do { \
+ if (TDLIST_NOT_EMPTY((listHdr))) \
+ { \
+ TDLIST_DEQUEUE_FROM_TAIL_FAST(atTailHdr,listHdr); \
+ } \
+ else \
+ { \
+ (*((tdList_t **)(atTailHdr))) = (tdList_t *)agNULL; \
+ } \
+ } while (0)
+
+#define TDLIST_ENQUEUE_LIST_AT_TAIL_FAST(toAddListHdr, listHdr) \
+ do { \
+ ((tdList_t *)toAddListHdr)->blink->flink = ((tdList_t *)listHdr); \
+ ((tdList_t *)toAddListHdr)->flink->blink = ((tdList_t *)listHdr)->blink; \
+ ((tdList_t *)listHdr)->blink->flink = ((tdList_t *)toAddListHdr)->flink; \
+ ((tdList_t *)listHdr)->blink = ((tdList_t *)toAddListHdr)->blink; \
+ TDLIST_INIT_HDR(toAddListHdr); \
+ } while (0)
+
+#define TDLIST_ENQUEUE_LIST_AT_TAIL(toAddListHdr, listHdr) \
+ do { \
+ if (TDLIST_NOT_EMPTY(toAddListHdr)) \
+ { \
+ TDLIST_ENQUEUE_LIST_AT_TAIL_FAST(toAddListHdr, listHdr); \
+ } \
+ } while (0)
+
+#define TDLIST_ENQUEUE_LIST_AT_HEAD_FAST(toAddListHdr, listHdr) \
+ do { \
+ ((tdList_t *)toAddListHdr)->blink->flink = ((tdList_t *)listHdr)->flink; \
+ ((tdList_t *)toAddListHdr)->flink->blink = ((tdList_t *)listHdr); \
+ ((tdList_t *)listHdr)->flink->blink = ((tdList_t *)toAddListHdr)->blink; \
+ ((tdList_t *)listHdr)->flink = ((tdList_t *)toAddListHdr)->flink; \
+ TDLIST_INIT_HDR(toAddListHdr); \
+ } while (0)
+
+#define TDLIST_ENQUEUE_LIST_AT_HEAD(toAddListHdr, listHdr) \
+ do { \
+ if (TDLIST_NOT_EMPTY(toAddListHdr)) \
+ { \
+ TDLIST_ENQUEUE_LIST_AT_HEAD_FAST(toAddListHdr, listHdr); \
+ } \
+ } while (0)
+
+#define TD_FIELD_OFFSET(baseType,fieldName) \
+ ((bit32)((bitptr)(&(((baseType *)0)->fieldName))))
+
+#define TDLIST_OBJECT_BASE(baseType,fieldName,fieldPtr) \
+ (void *)fieldPtr == (void *)0 ? (baseType *)0 : \
+ ((baseType *)((bit8 *)(fieldPtr) - ((bitptr)(&(((baseType *)0)->fieldName)))))
+
+
+
+#endif /* __TDLIST_H__ */
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdmisc.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdmisc.c
new file mode 100644
index 0000000..302a116
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdmisc.c
@@ -0,0 +1,2901 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ *
+ * This file contains TB misc. functions
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+/*****************************************************************************
+*! \brief tiINIIOAbort
+*
+* Purpose: This function is called to abort an I/O request previously started
+* by a call to tiINIIOStart() or tiINIIOStartDif() .
+*
+* \param tiRoot: Pointer to initiator driver/port instance.
+* \param taskTag: Pointer to the associated task to be aborted
+*
+* \return:
+*
+* tiSuccess: I/O request successfully initiated.
+* tiBusy: No resources available, try again later.
+* tiIONoDevice: Invalid device handle.
+* tiError: Other errors that prevent the I/O request to be
+* started.
+*
+*****************************************************************************/
+#ifdef INITIATOR_DRIVER /*TBD: INITIATOR SPECIFIC API in tiapi.h (TP)*/
+osGLOBAL bit32
+tiINIIOAbort(
+ tiRoot_t *tiRoot,
+ tiIORequest_t *taskTag
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = agNULL;
+ tdIORequestBody_t *tdIORequestBody = agNULL;
+ agsaIORequest_t *agIORequest = agNULL;
+ bit32 sasStatus = AGSA_RC_FAILURE;
+ tdsaDeviceData_t *oneDeviceData;
+ bit32 status= tiError;
+ agsaIORequest_t *agAbortIORequest;
+ tdIORequestBody_t *tdAbortIORequestBody;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+ agsaDevHandle_t *agDevHandle = agNULL;
+#ifdef FDS_SM
+ smRoot_t *smRoot;
+ tdIORequestBody_t *ToBeAbortedtdIORequestBody;
+ smIORequest_t *ToBeAborted = agNULL;
+#endif
+ TI_DBG2(("tiINIIOAbort: start\n"));
+
+ if(taskTag == agNULL)
+ {
+ TI_DBG1(("tiINIIOAbort: taskTag is NULL\n"));
+ return tiError;
+ }
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ tdIORequestBody = (tdIORequestBody_t *)taskTag->tdData;
+ agIORequest = &(tdIORequestBody->agIORequest);
+ oneDeviceData = tdIORequestBody->tiDevHandle->tdData;
+
+ if(oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tiINIIOAbort: DeviceData is NULL\n"));
+ return tiSuccess;
+ }
+
+ agDevHandle = oneDeviceData->agDevHandle;
+
+ TI_DBG2(("tiINIIOAbort: did %d\n", oneDeviceData->id));
+
+ /* for hotplug */
+ if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
+ oneDeviceData->tdPortContext == agNULL )
+ {
+ TI_DBG1(("tiINIIOAbort: NO Device did %d\n", oneDeviceData->id ));
+ TI_DBG1(("tiINIIOAbort: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("tiINIIOAbort: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ return tiError;
+ }
+
+ /* allocating agIORequest for abort itself */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&tdAbortIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("tiINIIOAbort: ostiAllocMemory failed...\n"));
+ return tiError;
+ }
+
+ if (tdAbortIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("tiINIIOAbort: ostiAllocMemory returned NULL tdAbortIORequestBody\n"));
+ return tiError;
+ }
+
+ /* setup task management structure */
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ /* setting callback */
+ tdAbortIORequestBody->IOCompletionFunc = itdssIOAbortedHandler;
+ tdAbortIORequestBody->tiDevHandle = tdIORequestBody->tiDevHandle;
+
+ /* initialize agIORequest */
+ agAbortIORequest = &(tdAbortIORequestBody->agIORequest);
+ agAbortIORequest->osData = (void *) tdAbortIORequestBody;
+ agAbortIORequest->sdkData = agNULL; /* LL takes care of this */
+
+ /* remember IO to be aborted */
+ tdAbortIORequestBody->tiIOToBeAbortedRequest = taskTag;
+
+ if (oneDeviceData->DeviceType == TD_SAS_DEVICE)
+ {
+ sasStatus = saSSPAbort(agRoot,
+ agAbortIORequest,
+ tdsaRotateQnumber(tiRoot, oneDeviceData),
+ agDevHandle,
+ 0/* flag */,
+ agIORequest,
+ agNULL);
+
+ if (sasStatus == AGSA_RC_SUCCESS)
+ {
+ return tiSuccess;
+ }
+ else
+ {
+ return tiError;
+ }
+ }
+
+ else if (oneDeviceData->DeviceType == TD_SATA_DEVICE)
+ {
+ TI_DBG2(("tiINIIOAbort: calling satIOAbort() oneDeviceData=%p\n", oneDeviceData));
+#ifdef FDS_SM
+ smRoot = &(tdsaAllShared->smRoot);
+ if ( taskTag != agNULL)
+ {
+ ToBeAbortedtdIORequestBody = (tdIORequestBody_t *)taskTag->tdData;
+ ToBeAborted = &(ToBeAbortedtdIORequestBody->smIORequest);
+ status = smIOAbort(smRoot, ToBeAborted);
+ return status;
+ }
+ else
+ {
+ TI_DBG1(("tiINIIOAbort: taskTag is NULL!!!\n"));
+ return tiError;
+ }
+
+#else
+
+#ifdef SATA_ENABLE
+ status = satIOAbort(tiRoot, taskTag );
+#endif
+
+ return status;
+#endif /* else FDS_SM */
+ }
+
+ else
+ {
+ return tiError;
+ }
+
+}
+
+osGLOBAL bit32
+tiINIIOAbortAll(
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle
+ )
+{
+ agsaRoot_t *agRoot = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ bit32 status = tiError;
+#ifdef FDS_SM
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ smRoot_t *smRoot = &(tdsaAllShared->smRoot);
+ smDeviceHandle_t *smDeviceHandle;
+#endif
+
+ TI_DBG1(("tiINIIOAbortAll: start\n"));
+
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tiINIIOAbortAll: tiDeviceHandle is NULL!!!\n"));
+ return tiError;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tiINIIOAbortAll: oneDeviceData is NULL!!!\n"));
+ return tiError;
+ }
+
+ /* for hotplug */
+ if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
+ oneDeviceData->tdPortContext == agNULL )
+ {
+ TI_DBG1(("tiINIIOAbortAll: NO Device did %d\n", oneDeviceData->id ));
+ TI_DBG1(("tiINIIOAbortAll: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("tiINIIOAbortAll: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ return tiError;
+ }
+
+ agRoot = oneDeviceData->agRoot;
+
+ if (agRoot == agNULL)
+ {
+ TI_DBG1(("tiINIIOAbortAll: agRoot is NULL!!!\n"));
+ return tiError;
+ }
+
+ /* this is processed in ossaSSPAbortCB, ossaSATAAbortCB, ossaSMPAbortCB */
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ TI_DBG1(("tiINIIOAbortAll: already pending!!!\n"));
+ return tiBusy;
+ }
+ else
+ {
+ oneDeviceData->OSAbortAll = agTRUE;
+ }
+
+#ifdef FDS_SM
+ if ( DEVICE_IS_SSP_TARGET(oneDeviceData) || DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ status = tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ }
+ else if (DEVICE_IS_SATA_DEVICE(oneDeviceData) ||
+ DEVICE_IS_STP_TARGET(oneDeviceData)
+ )
+ {
+ TI_DBG2(("tiINIIOAbortAll: calling smIOAbortAll\n"));
+ smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
+ smDeviceHandle->tdData = oneDeviceData;
+ status = smIOAbortAll(smRoot, smDeviceHandle);
+ }
+ else
+ {
+ TI_DBG1(("tiINIIOAbortAll: unknow device type!!! 0x%x\n", oneDeviceData->target_ssp_stp_smp));
+ status = AGSA_RC_FAILURE;
+ }
+#else
+ status = tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+#endif
+
+ return status;
+
+}
+#endif /* INITIATOR_DRIVER */
+
+/*****************************************************************************
+*! \brief tdsaAbortAll
+*
+* Purpose: This function is called to abort an all pending I/O request on a
+* device
+*
+* \param tiRoot: Pointer to initiator driver/port instance.
+* \param agRoot: Pointer to chip/driver Instance.
+* \param oneDeviceData: Pointer to the device
+*
+* \return:
+*
+* None
+*
+*****************************************************************************/
+osGLOBAL bit32
+tdsaAbortAll(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ agsaIORequest_t *agAbortIORequest = agNULL;
+ tdIORequestBody_t *tdAbortIORequestBody = agNULL;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+ bit32 status = AGSA_RC_FAILURE;
+
+ TI_DBG1(("tdsaAbortAll: did %d\n", oneDeviceData->id));
+
+ /* allocating agIORequest for abort itself */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&tdAbortIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdsaAbortAll: ostiAllocMemory failed...\n"));
+ return tiError;
+ }
+
+ if (tdAbortIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdsaAbortAll: ostiAllocMemory returned NULL tdAbortIORequestBody\n"));
+ return tiError;
+ }
+
+ /* setup task management structure */
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ /* setting callback but not used later */
+ tdAbortIORequestBody->IOCompletionFunc = agNULL;
+ //tdAbortIORequestBody->IOCompletionFunc = itdssIOAbortedHandler;
+
+ tdAbortIORequestBody->tiDevHandle = (tiDeviceHandle_t *)&(oneDeviceData->tiDeviceHandle);
+
+ /* initialize agIORequest */
+ agAbortIORequest = &(tdAbortIORequestBody->agIORequest);
+ agAbortIORequest->osData = (void *) tdAbortIORequestBody;
+ agAbortIORequest->sdkData = agNULL; /* LL takes care of this */
+
+ if ( DEVICE_IS_SSP_TARGET(oneDeviceData))
+ {
+ /* SSPAbort */
+ status = saSSPAbort(agRoot,
+ agAbortIORequest,
+ tdsaRotateQnumber(tiRoot, oneDeviceData), //0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ agNULL
+ );
+ }
+ else if (DEVICE_IS_SATA_DEVICE(oneDeviceData) ||
+ DEVICE_IS_STP_TARGET(oneDeviceData)
+ )
+ {
+ /* SATAAbort*/
+ if (oneDeviceData->satDevData.IDDeviceValid == agFALSE)
+ {
+ TI_DBG2(("tdsaAbortAll: saSATAAbort\n"));
+ status = saSATAAbort(agRoot,
+ agAbortIORequest,
+ 0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ agNULL
+ );
+ }
+ else
+ {
+ TI_DBG2(("tdsaAbortAll: saSATAAbort IDDeviceValid\n"));
+ status = saSATAAbort(agRoot,
+ agAbortIORequest,
+ tdsaRotateQnumber(tiRoot, oneDeviceData), //0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ agNULL
+ );
+ }
+ }
+ else if (DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ /* SMPAbort*/
+ TI_DBG2(("tdsaAbortAll: saSMPAbort \n"));
+ status = saSMPAbort(agRoot,
+ agAbortIORequest,
+ tdsaRotateQnumber(tiRoot, oneDeviceData), //0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ agNULL
+ );
+ }
+ else
+ {
+ TI_DBG1(("tdsaAbortAll: unknown device type!!! 0x%x\n", oneDeviceData->target_ssp_stp_smp));
+ status = AGSA_RC_FAILURE;
+ }
+
+ if (status == AGSA_RC_SUCCESS)
+ {
+ return tiSuccess;
+ }
+ else
+ {
+ TI_DBG1(("tdsaAbortAll: failed status=%d\n", status));
+ //failed to send abort command, we need to free the memory
+ ostiFreeMemory(
+ tiRoot,
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return tiError;
+ }
+
+}
+
+
+
+/*****************************************************************************
+*! \brief tiCOMReset
+*
+* Purpose: This function is called to trigger soft or hard reset
+*
+* \param tiRoot: Pointer to initiator driver/port instance.
+* \param option: Options
+*
+* \return:
+*
+* None
+*
+*****************************************************************************/
+osGLOBAL void
+tiCOMReset(
+ tiRoot_t *tiRoot,
+ bit32 option
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = agNULL;
+
+
+#ifdef TI_GETFOR_ONRESET
+ agsaControllerStatus_t controllerStatus;
+ agsaForensicData_t forensicData;
+ bit32 once = 1;
+ bit32 status;
+#endif /* TI_GETFOR_ONRESET */
+
+ TI_DBG1(("tiCOMReset: start option 0x%x\n",option));
+ tdsaAllShared->resetCount++;
+ TI_DBG2(("tiCOMReset: reset count %d\n", tdsaAllShared->resetCount));
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ if (tdsaAllShared->flags.resetInProgress == agTRUE)
+ {
+ TI_DBG1(("tiCOMReset : Reset is already in progress : \n"));
+
+ /* don't do anything : just return */
+ return;
+ }
+
+ tdsaAllShared->flags.resetInProgress = agTRUE;
+
+#ifdef TI_GETFOR_ONRESET
+ saGetControllerStatus(agRoot, &controllerStatus);
+ if(controllerStatus.fatalErrorInfo.errorInfo1)
+ {
+
+ bit8 * DirectData = (bit8 * )tdsaAllShared->FatalErrorData;
+ forensicData.DataType = TYPE_FATAL;
+ forensicData.dataBuf.directLen = (8 * 1024);
+ forensicData.dataBuf.directOffset = 0; /* current offset */
+ forensicData.dataBuf.readLen = 0; /* Data read */
+ getmoreData:
+ forensicData.dataBuf.directData = DirectData;
+ status = saGetForensicData( agRoot, agNULL, &forensicData);
+ TI_DBG1(("tiCOMReset:status %d readLen 0x%x directLen 0x%x directOffset 0x%x\n",
+ status,
+ forensicData.dataBuf.readLen,
+ forensicData.dataBuf.directLen,
+ forensicData.dataBuf.directOffset));
+
+ if( forensicData.dataBuf.readLen == forensicData.dataBuf.directLen && !status && once)
+ {
+ DirectData += forensicData.dataBuf.readLen;
+ goto getmoreData;
+ }
+ TI_DBG1(("tiCOMReset:saGetForensicData type %d read 0x%x bytes\n", forensicData.DataType, forensicData.dataBuf.directOffset ));
+ }
+
+#endif /* TI_GETFOR_ONRESET */
+ if (option == tiSoftReset)
+ {
+ /* soft reset */
+ TI_DBG6(("tiCOMReset: soft reset\n"));
+ saHwReset(agRoot, AGSA_SOFT_RESET, 0);
+ return;
+ }
+ else
+ {
+ saHwReset(agRoot, AGSA_SOFT_RESET, 0);
+#ifdef NOT_YET
+ /* hard reset */
+ saHwReset(agRoot, AGSA_CHIP_RESET, 0);
+#endif
+ }
+ return;
+}
+
+
+/*****************************************************************************/
+/*! \biref tiINIReportErrorToEventLog
+ *
+ * Purpose: This function is called to report errors that needs to be logged
+ * into event log.
+ *
+ * \param tiRoot: Pointer to initiator specific root data structure for this
+ * instance of the driver.
+ * \param agEventData: Event data structure.
+ *
+ * \return None.
+ *
+ */
+/*****************************************************************************/
+#ifdef INITIATOR_DRIVER
+osGLOBAL bit32
+tiINIReportErrorToEventLog(
+ tiRoot_t *tiRoot,
+ tiEVTData_t *agEventData
+ )
+{
+ TI_DBG6(("tiINIReportErrorToEventLog: start\n"));
+ return tiError;
+}
+#endif /* INITIATOR_DRIVER */
+
+/*****************************************************************************/
+/*! \brief ossaReenableInterrupts
+ *
+ *
+ * Purpose: This routine is called to enable interrupt
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param outboundChannelNum: Zero-base channel number
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ *
+ */
+/*****************************************************************************/
+#ifndef ossaReenableInterrupts
+osGLOBAL void
+ossaReenableInterrupts(
+ agsaRoot_t *agRoot,
+ bit32 outboundChannelNum
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+
+ ostiInterruptEnable(
+ osData->tiRoot,
+ outboundChannelNum
+ );
+ return;
+}
+
+#endif
+
+
+
+
+/*
+1. initiator
+ send task management
+ call saSSPAbort()
+
+2. Target
+ call saSSPAbort()
+
+*/
+
+/*****************************************************************************
+*! \brief tiINITaskManagement
+*
+* Purpose: This routine is called to explicitly ask the Transport Dependent
+* Layer to issue a Task Management command to a device.
+*
+* \param tiRoot: Pointer to driver instance
+* \param tiDeviveHandle: Pointer to the device handle for this session.
+* \param task: SAM-2 task management request.
+* \param lun: Pointer to the SCSI-3 LUN information
+* when applicable. Set to zero when not applicable.
+* \param taskTag: Pointer to the associated task where the task
+* management command is to be applied. Set to agNULL
+* if not applicable for the specific Task Management
+* task.
+* \param currentTaskTag: The current context or task tag for this task. This
+* task tag will be passed back in ostiInitiatorEvent()
+* when this task management is completed.
+*
+* \return:
+* tiSuccess TM request successfully initiated.
+* tiBusy No resources available, try again later.
+* tiIONoDevice Invalid device handle.
+* tiError Other errors that prevent the TM request to be started.
+*
+*****************************************************************************/
+/*
+ warm reset->smp phy control(hard reset) or saLocalPhyControl(AGSA_PHY_HARD_RESET)
+
+*/
+#ifdef INITIATOR_DRIVER
+osGLOBAL bit32
+tiINITaskManagement (
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle,
+ bit32 task,
+ tiLUN_t *lun,
+ tiIORequest_t *taskTag, /* being aborted one */
+ tiIORequest_t *currentTaskTag /* task management itself */
+ )
+{
+
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ itdsaIni_t *Initiator = (itdsaIni_t *)tdsaAllShared->itdsaIni;
+ agsaRoot_t *agRoot = agNULL;
+ bit32 tiStatus = tiError;
+ bit32 notImplemented = agFALSE;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ void *osMemHandle;
+ tdIORequestBody_t *TMtdIORequestBody;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ bit32 agRequestType;
+ agsaIORequest_t *agIORequest = agNULL; /* task management itself */
+ agsaIORequest_t *agTMRequest = agNULL; /* IO being task managed */
+ agsaDevHandle_t *agDevHandle = agNULL;
+ agsaSASRequestBody_t *agSASRequestBody = agNULL;
+ agsaSSPScsiTaskMgntReq_t *agSSPTaskMgntRequest;
+ bit32 saStatus;
+ tdIORequestBody_t *tdIORequestBody;
+#ifdef FDS_SM
+ smRoot_t *smRoot;
+ smDeviceHandle_t *smDeviceHandle;
+ smIORequest_t *ToBeAborted = agNULL;
+ smIORequest_t *TaskManagement;
+ tdIORequestBody_t *ToBeAbortedtdIORequestBody;
+ tdIORequestBody_t *SMTMtdIORequestBody;
+ void *SMosMemHandle;
+ bit32 SMPhysUpper32;
+ bit32 SMPhysLower32;
+ bit32 SMmemAllocStatus;
+#endif
+
+ TI_DBG2(("tiINITaskManagement: start\n"));
+
+ /* just for testing only */
+#ifdef REMOVED
+//start temp
+ if(tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: tiDeviceHandle is NULL\n"));
+ return tiError;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if(oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: tiDeviceHandle=%p DeviceData is NULL\n", tiDeviceHandle));
+ return tiError;
+ }
+ TI_DBG1(("tiINITaskManagement: did %d\n", oneDeviceData->id ));
+ return tiError;
+//end temp
+
+// just for testing
+ if (task == AG_LOGICAL_UNIT_RESET)
+ {
+ TI_DBG1(("tiINITaskManagement: failing LUN RESET for testing\n"));
+ return tiError;
+ }
+
+#endif
+
+ switch(task)
+ {
+ case AG_ABORT_TASK:
+ TI_DBG6(("tiINITaskManagement: ABORT_TASK\n"));
+ break;
+ case AG_ABORT_TASK_SET:
+ TI_DBG6(("tiINITaskManagement: ABORT_TASK_SET\n"));
+ break;
+ case AG_CLEAR_ACA:
+ TI_DBG6(("tiINITaskManagement: CLEAR_ACA\n"));
+ break;
+ case AG_CLEAR_TASK_SET:
+ TI_DBG6(("tiINITaskManagement: CLEAR_TASK_SET\n"));
+ break;
+ case AG_LOGICAL_UNIT_RESET:
+ TI_DBG6(("tiINITaskManagement: LOGICAL_UNIT_RESET\n"));
+ break;
+ case AG_TARGET_WARM_RESET:
+ TI_DBG6(("tiINITaskManagement: TARGET_WARM_RESET\n"));
+ break;
+ case AG_QUERY_TASK:
+ TI_DBG6(("tiINITaskManagement: QUERY_TASK\n"));
+ break;
+ default:
+ TI_DBG1(("tiINITaskManagement: notImplemented 0x%0x !!!\n",task));
+ notImplemented = agTRUE;
+ break;
+ }
+
+ if (notImplemented)
+ {
+ TI_DBG1(("tiINITaskManagement: not implemented 0x%0x !!!\n",task));
+ return tiStatus;
+ }
+
+ if(tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: tiDeviceHandle is NULL\n"));
+ return tiError;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if(oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: tiDeviceHandle=%p DeviceData is NULL\n", tiDeviceHandle));
+ return tiIONoDevice;
+ }
+
+ /* for hotplug */
+ if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
+ oneDeviceData->tdPortContext == agNULL )
+ {
+ TI_DBG1(("tiINITaskManagement: NO Device did %d Addr 0x%08x:0x%08x\n", oneDeviceData->id , oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
+ return tiIONoDevice;
+ }
+
+ /* 1. call tiINIOAbort()
+ 2. call tdssTaskXmit()
+ */
+
+ if (oneDeviceData->DeviceType == TD_SAS_DEVICE)
+ {
+ agRoot = oneDeviceData->agRoot;
+ agDevHandle = oneDeviceData->agDevHandle;
+ TI_DBG1(("tiINITaskManagement: SAS Device\n"));
+
+ /*
+ WARM_RESET is experimental code.
+ Needs more testing and debugging
+ */
+ if (task == AG_TARGET_WARM_RESET)
+ {
+ agsaContext_t *agContext;
+ tdsaDeviceData_t *tdsaDeviceData;
+
+ tdsaDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ currentTaskTag->tdData = tdsaDeviceData;
+ agContext = &(tdsaDeviceData->agDeviceResetContext);
+ agContext->osData = currentTaskTag;
+
+ TI_DBG2(("tiINITaskManagement: did %d device reset for SAS\n", oneDeviceData->id));
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), agDevHandle, SA_DS_IN_RECOVERY);
+
+ /* warm reset by saLocalPhyControl or SMP PHY control */
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG2(("tiINITaskManagement: device reset directly attached\n"));
+ saLocalPhyControl(agRoot,
+ agContext,
+ tdsaRotateQnumber(tiRoot, oneDeviceData),
+ oneDeviceData->phyID,
+ AGSA_PHY_HARD_RESET,
+ agNULL
+ );
+ return tiSuccess;
+ }
+ else
+ {
+ TI_DBG2(("tiINITaskManagement: device reset expander attached\n"));
+ saStatus = tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ currentTaskTag,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ return saStatus;
+ }
+ }
+ else
+ {
+ /* task management */
+ TI_DBG6(("tiINITaskManagement: making task management frame \n"));
+ /* 1. create task management frame
+ 2. sends it using "saSSPStart()"
+ */
+ /* Allocate memory for task management */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&TMtdIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+
+ if (memAllocStatus != tiSuccess)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory failed...\n"));
+ return tiError;
+ }
+
+ if (TMtdIORequestBody == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory returned NULL TMIORequestBody\n"));
+ return tiError;
+ }
+
+ /* initialize */
+ osti_memset(TMtdIORequestBody, 0, sizeof(tdIORequestBody_t));
+
+ /* setup task management structure */
+ TMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ TMtdIORequestBody->IOType.InitiatorTMIO.CurrentTaskTag = currentTaskTag;
+ TMtdIORequestBody->IOType.InitiatorTMIO.TaskTag = taskTag;
+
+ /* let's initialize tdIOrequestBody */
+ /* initialize jump table */
+
+ /* direct callback for task management */
+ TMtdIORequestBody->IOCompletionFunc = itdssTaskCompleted;
+ /* to be removed */
+ /* TMtdIORequestBody->IOCompletionFunc = itdssIOCompleted; */
+
+ /* initialize tiDevhandle */
+ TMtdIORequestBody->tiDevHandle = tiDeviceHandle;
+
+ /* initialize tiIORequest */
+ TMtdIORequestBody->tiIORequest = currentTaskTag;
+ /* save context if we need to abort later */
+ currentTaskTag->tdData = TMtdIORequestBody;
+
+ /* initialize agIORequest */
+ agIORequest = &(TMtdIORequestBody->agIORequest);
+ agIORequest->osData = (void *) TMtdIORequestBody;
+ agIORequest->sdkData = agNULL; /* SA takes care of this */
+
+ /* request type */
+ agRequestType = AGSA_SSP_TASK_MGNT_REQ;
+ TMtdIORequestBody->agRequestType = AGSA_SSP_TASK_MGNT_REQ;
+ /*
+ initialize
+ tdIORequestBody_t tdIORequestBody -> agSASRequestBody
+ */
+ agSASRequestBody = &(TMtdIORequestBody->transport.SAS.agSASRequestBody);
+ agSSPTaskMgntRequest = &(agSASRequestBody->sspTaskMgntReq);
+
+ TI_DBG2(("tiINITaskManagement: did %d LUN reset for SAS\n", oneDeviceData->id));
+ /* fill up LUN field */
+ if (lun == agNULL)
+ {
+ osti_memset(agSSPTaskMgntRequest->lun, 0, 8);
+ }
+ else
+ {
+ osti_memcpy(agSSPTaskMgntRequest->lun, lun->lun, 8);
+ }
+
+ /* default: unconditionally set device state to SA_DS_IN_RECOVERY
+ bit1 (DS) bit0 (ADS)
+ bit1: 1 bit0: 0
+ */
+ agSSPTaskMgntRequest->tmOption = 2;
+
+ /* sets taskMgntFunction field */
+ switch(task)
+ {
+ case AG_ABORT_TASK:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_ABORT_TASK;
+ /* For abort task management, unconditionally set device state to SA_DS_IN_RECOVERY
+ and if can't find, set device state to SA_DS_IN_RECOVERY
+ bit1 (DS) bit0 (ADS)
+ bit1: 1; bit0: 1
+ */
+ agSSPTaskMgntRequest->tmOption = 3;
+ break;
+ case AG_ABORT_TASK_SET:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_ABORT_TASK_SET;
+ break;
+ case AG_CLEAR_ACA:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_CLEAR_ACA;
+ break;
+ case AG_CLEAR_TASK_SET:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_CLEAR_TASK_SET;
+ break;
+ case AG_LOGICAL_UNIT_RESET:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_LOGICAL_UNIT_RESET;
+ break;
+ case AG_QUERY_TASK:
+ agSSPTaskMgntRequest->taskMgntFunction = AGSA_QUERY_TASK;
+ break;
+ default:
+ TI_DBG1(("tiINITaskManagement: notImplemented task\n"));
+ break;
+ }
+
+ if (task == AGSA_ABORT_TASK || task == AGSA_QUERY_TASK)
+ {
+ /* set agTMRequest, which is IO being task managed */
+ tdIORequestBody = (tdIORequestBody_t *)taskTag->tdData;
+ if (tdIORequestBody == agNULL)
+ {
+ /* to be aborted IO has been completed. */
+ /* free up allocated memory */
+ TI_DBG1(("tiINITaskManagement: IO has been completed\n"));
+ ostiFreeMemory(
+ tiRoot,
+ osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return tiIONoDevice;
+ }
+ else
+ {
+ agTMRequest = &(tdIORequestBody->agIORequest);
+ }
+ }
+ else
+ {
+ /*
+ For LUN RESET, WARM_RESET, ABORT_TASK_SET, CLEAR_ACA and CLEAR_TASK_SET
+ no tag to be managed.
+ Therefore, set it to zero.
+ */
+ agSSPTaskMgntRequest->tagOfTaskToBeManaged = 0;
+ agTMRequest = agNULL;
+
+ }
+
+ TDLIST_INIT_HDR(&TMtdIORequestBody->EsglPageList);
+ /* debuggging */
+ if (TMtdIORequestBody->IOCompletionFunc == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: Error!!!!! IOCompletionFunc is NULL\n"));
+ }
+ saStatus = saSSPStart(agRoot,
+ agIORequest, /* task management itself */
+ tdsaRotateQnumber(tiRoot, oneDeviceData),
+ agDevHandle,
+ agRequestType,
+ agSASRequestBody, /* task management itself */
+ agTMRequest, /* io to be aborted if exits */
+ &ossaSSPCompleted);
+
+
+ if (saStatus == AGSA_RC_SUCCESS)
+ {
+ Initiator->NumIOsActive++;
+ tiStatus = tiSuccess;
+ }
+ else
+ {
+ TI_DBG1(("tiINITaskManagement: saSSPStart failed 0x%x\n",saStatus));
+ /* free up allocated memory */
+ ostiFreeMemory(
+ tiRoot,
+ TMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ if (saStatus == AGSA_RC_FAILURE)
+ {
+ tiStatus = tiError;
+ }
+ else
+ {
+ /* AGSA_RC_BUSY */
+ tiStatus = tiBusy;
+ }
+ }
+ }
+ } /* end of sas device */
+
+#ifdef FDS_SM
+ else if (oneDeviceData->DeviceType == TD_SATA_DEVICE)
+ {
+ agsaContext_t *agContext = agNULL;
+
+ /* save the task tag in tdsaDeviceData_t structure, for handling PORT_RESET_COMPLETE hw event */
+ agContext = &(oneDeviceData->agDeviceResetContext);
+ agContext->osData = currentTaskTag;
+
+#ifdef REMOVED
+ /* for directly attached SATA, do localphycontrol for LUN and target reset, not smTaskManagement*/
+ if (oneDeviceData->directlyAttached == agTRUE &&
+ (task == AG_LOGICAL_UNIT_RESET || task == AG_TARGET_WARM_RESET))
+ {
+ agRoot = oneDeviceData->agRoot;
+ agDevHandle = oneDeviceData->agDevHandle;
+
+ currentTaskTag->tdData = oneDeviceData;
+
+ if (task == AG_LOGICAL_UNIT_RESET)
+ {
+ if ( (lun->lun[0] | lun->lun[1] | lun->lun[2] | lun->lun[3] |
+ lun->lun[4] | lun->lun[5] | lun->lun[6] | lun->lun[7] ) != 0 )
+ {
+ TI_DBG1(("tiINITaskManagement: *** REJECT *** LUN not zero, tiDeviceHandle=%p\n",
+ tiDeviceHandle));
+ return tiError;
+ }
+ }
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), agDevHandle, SA_DS_IN_RECOVERY);
+ tiStatus = saLocalPhyControl(agRoot, agContext, tdsaRotateQnumber(tiRoot, oneDeviceData), oneDeviceData->phyID, AGSA_PHY_HARD_RESET, agNULL);
+ }
+ else
+#endif
+ {
+ smRoot = &(tdsaAllShared->smRoot);
+ smDeviceHandle = &(oneDeviceData->smDeviceHandle);
+ TI_DBG1(("tiINITaskManagement: FDS_SM SATA Device\n"));
+
+ if ( taskTag != agNULL)
+ {
+ ToBeAbortedtdIORequestBody = (tdIORequestBody_t *)taskTag->tdData;
+ ToBeAborted = &(ToBeAbortedtdIORequestBody->smIORequest);
+ }
+ SMmemAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &SMosMemHandle,
+ (void **)&SMTMtdIORequestBody,
+ &SMPhysUpper32,
+ &SMPhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (SMmemAllocStatus != tiSuccess)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory failed... loc 2\n"));
+ return tiError;
+ }
+
+ if (SMTMtdIORequestBody == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory returned NULL TMIORequestBody loc 2\n"));
+ return tiError;
+ }
+
+ /* initialize */
+ osti_memset(SMTMtdIORequestBody, 0, sizeof(tdIORequestBody_t));
+
+ /* setup task management structure */
+ SMTMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle = SMosMemHandle;
+ SMTMtdIORequestBody->IOType.InitiatorTMIO.CurrentTaskTag = currentTaskTag;
+ SMTMtdIORequestBody->IOType.InitiatorTMIO.TaskTag = taskTag;
+
+ /* initialize tiDevhandle */
+ SMTMtdIORequestBody->tiDevHandle = tiDeviceHandle;
+
+ /* initialize tiIORequest */
+ SMTMtdIORequestBody->tiIORequest = currentTaskTag;
+ /* save context if we need to abort later */
+ currentTaskTag->tdData = SMTMtdIORequestBody;
+
+ TaskManagement = &(SMTMtdIORequestBody->smIORequest);
+
+ TaskManagement->tdData = SMTMtdIORequestBody;
+ TaskManagement->smData = &SMTMtdIORequestBody->smIORequestBody;
+
+ tiStatus = smTaskManagement(smRoot,
+ smDeviceHandle,
+ task,
+ (smLUN_t*)lun,
+ ToBeAborted,
+ TaskManagement
+ );
+ if (tiStatus != SM_RC_SUCCESS)
+ {
+ TI_DBG1(("tiINITaskManagement: smTaskManagement failed... loc 2\n"));
+ /* free up allocated memory */
+ ostiFreeMemory(
+ tiRoot,
+ SMTMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ }
+ } /* else */
+ }
+#else
+ else if (oneDeviceData->DeviceType == TD_SATA_DEVICE)
+ {
+ agRoot = oneDeviceData->agRoot;
+ agDevHandle = oneDeviceData->agDevHandle;
+ TI_DBG1(("tiINITaskManagement: not FDS_SM SATA Device\n"));
+ /*
+ WARM_RESET is experimental
+ Needs more testing and debugging
+ Soft reset for SATA as LUN RESET tends not to work.
+ Let's do hard reset
+ */
+ if (task == AG_LOGICAL_UNIT_RESET || task == AG_TARGET_WARM_RESET)
+ {
+
+ agsaContext_t *agContext;
+ satDeviceData_t *satDevData;
+ tdsaDeviceData_t *tdsaDeviceData;
+
+ TI_DBG2(("tiINITaskManagement: did %d LUN reset or device reset for SATA\n", oneDeviceData->id));
+ tdsaDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ satDevData = &tdsaDeviceData->satDevData;
+ currentTaskTag->tdData = tdsaDeviceData;
+ agContext = &(tdsaDeviceData->agDeviceResetContext);
+ agContext->osData = currentTaskTag;
+
+
+ if (task == AG_LOGICAL_UNIT_RESET)
+ {
+ if ( (lun->lun[0] | lun->lun[1] | lun->lun[2] | lun->lun[3] |
+ lun->lun[4] | lun->lun[5] | lun->lun[6] | lun->lun[7] ) != 0 )
+ {
+ TI_DBG1(("tiINITaskManagement: *** REJECT *** LUN not zero, tiDeviceHandle=%p\n",
+ tiDeviceHandle));
+ return tiError;
+ }
+
+ /*
+ * Check if there is other TM request pending
+ */
+ if (satDevData->satTmTaskTag != agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: *** REJECT *** other TM pending, tiDeviceHandle=%p\n",
+ tiDeviceHandle));
+ return tiError;
+ }
+ }
+ satDevData->satDriveState = SAT_DEV_STATE_IN_RECOVERY;
+ satDevData->satAbortAfterReset = agFALSE;
+
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), agDevHandle, SA_DS_IN_RECOVERY);
+
+ /*
+ warm reset by saLocalPhyControl or SMP PHY control
+ */
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG1(("tiINITaskManagement: LUN reset or device reset directly attached\n"));
+ saLocalPhyControl(agRoot, agContext, tdsaRotateQnumber(tiRoot, oneDeviceData), oneDeviceData->phyID, AGSA_PHY_HARD_RESET, agNULL);
+ return tiSuccess;
+ }
+ else
+ {
+ TI_DBG1(("tiINITaskManagement: LUN reset or device reset expander attached\n"));
+ saStatus = tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ currentTaskTag,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ return saStatus;
+ }
+ }
+ else
+ {
+ TI_DBG2(("tiINITaskManagement: calling satTM().\n"));
+ /* allocation tdIORequestBody and pass it to satTM() */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&TMtdIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+
+ if (memAllocStatus != tiSuccess)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory failed... loc 2\n"));
+ return tiError;
+ }
+
+ if (TMtdIORequestBody == agNULL)
+ {
+ TI_DBG1(("tiINITaskManagement: ostiAllocMemory returned NULL TMIORequestBody loc 2\n"));
+ return tiError;
+
+ }
+
+ /* initialize */
+ osti_memset(TMtdIORequestBody, 0, sizeof(tdIORequestBody_t));
+
+ /* setup task management structure */
+ TMtdIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ TMtdIORequestBody->IOType.InitiatorTMIO.CurrentTaskTag = currentTaskTag;
+ TMtdIORequestBody->IOType.InitiatorTMIO.TaskTag = taskTag;
+
+ /* initialize tiDevhandle */
+ TMtdIORequestBody->tiDevHandle = tiDeviceHandle;
+
+ /* initialize tiIORequest */
+ TMtdIORequestBody->tiIORequest = currentTaskTag;
+ /* save context if we need to abort later */
+ currentTaskTag->tdData = TMtdIORequestBody;
+
+ /* initialize agIORequest */
+ agIORequest = &(TMtdIORequestBody->agIORequest);
+ agIORequest->osData = (void *) TMtdIORequestBody;
+ agIORequest->sdkData = agNULL; /* SA takes care of this */
+
+
+#ifdef SATA_ENABLE
+ tiStatus = satTM( tiRoot,
+ tiDeviceHandle,
+ task,
+ lun,
+ taskTag,
+ currentTaskTag,
+ TMtdIORequestBody,
+ agTRUE
+ );
+#endif
+ }
+ }
+#endif /* FDS_SM else*/
+
+ return tiStatus;
+}
+#endif /* INITIATOR_DRIVER */
+
+#ifdef PASSTHROUGH
+osGLOBAL bit32
+tiCOMPassthroughCmndStart(
+ tiRoot_t *tiRoot,
+ tiPassthroughRequest_t *tiPassthroughRequest,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiPassthroughCmnd_t *tiPassthroughCmnd,
+ void *tiPassthroughBody,
+ tiPortalContext_t *tiportalContext,
+ ostiPassthroughCmndEvent_t agEventCB
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData;
+ agsaRoot_t *agRoot = agNULL;
+ agsaIORequest_t *agIORequest = agNULL;
+ agsaDevHandle_t *agDevHandle = agNULL;
+ bit32 agRequestType;
+ agsaSASRequestBody_t *agSASRequestBody = agNULL;
+
+ tdPassthroughCmndBody_t *tdPTCmndBody;
+ tdssSMPRequestBody_t *tdssSMPRequestBody;
+ agsaSMPFrame_t *agSMPFrame;
+ agsaSSPVSFrame_t *agSSPVendorFrame; /* RMC */
+ bit32 SMPFn, SMPFnResult, SMPFrameLen;
+ bit32 tiStatus = tiError;
+ bit32 saStatus = AGSA_RC_FAILURE;
+ tdsaPortStartInfo_t *tdsaPortStartInfo;
+ tdsaPortContext_t *tdsaPortContext;
+
+ TI_DBG2(("tiCOMPassthroughCmndStart: start\n"));
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+
+ TI_DBG6(("tiCOMPassthroughCmndStart: onedevicedata %p\n", oneDeviceData));
+
+
+ tdPTCmndBody = (tdPassthroughCmndBody_t *)tiPassthroughBody;
+
+
+ if (tiPassthroughCmnd->passthroughCmnd != tiSMPCmnd ||
+ tiPassthroughCmnd->passthroughCmnd != tiRMCCmnd)
+ {
+ return tiNotSupported;
+ }
+
+
+ if (oneDeviceData == agNULL && tiPassthroughCmnd->passthroughCmnd != tiSMPCmnd)
+ {
+ TI_DBG1(("tiCOMPassthroughCmndStart: tiDeviceHandle=%p DeviceData is NULL\n", tiDeviceHandle ));
+ return tiIONoDevice;
+ }
+
+ /* starting IO with SAS device */
+ if (oneDeviceData->DeviceType == TD_SAS_DEVICE)
+ {
+ if (tiPassthroughCmnd->passthroughCmnd == tiSMPCmnd)
+ {
+ TI_DBG2(("tiCOMPassthroughCmndStart: SMP\n"));
+ if (oneDeviceData == agNULL)
+ {
+ tdsaPortStartInfo = (tdsaPortStartInfo_t *)tiportalContext->tdData;
+ tdsaPortContext = tdsaPortStartInfo->portContext;
+ agRoot = tdsaPortContext->agRoot;
+ }
+ else
+ {
+ agRoot = oneDeviceData->agRoot;
+ agDevHandle = oneDeviceData->agDevHandle;
+ }
+
+
+ tdssSMPRequestBody = &(tdPTCmndBody->protocol.SMP.SMPBody);
+ agSASRequestBody = &(tdssSMPRequestBody->agSASRequestBody);
+ agSMPFrame = &(agSASRequestBody->smpFrame);
+
+ /* saves callback function */
+ tdPTCmndBody->EventCB = agEventCB;
+
+ /* initialize command type */
+ tdPTCmndBody->tiPassthroughCmndType = tiSMPCmnd;
+
+ /* initialize tipassthroughrequest */
+ tdPTCmndBody->tiPassthroughRequest = tiPassthroughRequest;
+ tiPassthroughRequest->tdData = tdPTCmndBody;
+
+ /* initialize tiDevhandle */
+ tdPTCmndBody->tiDevHandle = tiDeviceHandle;
+
+ /* fill in SMP header */
+ agSMPFrame->frameHeader.smpFrameType
+ = tiPassthroughCmnd->protocol.SMP.SMPHeader.smpFrameType;
+ agSMPFrame->frameHeader.smpFunction
+ = tiPassthroughCmnd->protocol.SMP.SMPHeader.smpFunction;
+ agSMPFrame->frameHeader.smpFunctionResult
+ = tiPassthroughCmnd->protocol.SMP.SMPHeader.smpFunctionResult;
+ agSMPFrame->frameHeader.smpReserved
+ = tiPassthroughCmnd->protocol.SMP.SMPHeader.smpReserved;
+
+ if (tiPassthroughCmnd->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ agRequestType = AGSA_SMP_INIT_REQ;
+ }
+ else
+ {
+ agRequestType = AGSA_SMP_TGT_RESPONSE;
+ /* this is only for SMP target */
+ agSMPFrame->phyId = tiPassthroughCmnd->protocol.SMP.phyID;
+ }
+
+ /* fill in payload */
+ /* assumption: SMP payload is in tisgl1 */
+ agSMPFrame->frameAddrUpper32 = tiPassthroughCmnd->tiSgl.upper;
+ agSMPFrame->frameAddrLower32 = tiPassthroughCmnd->tiSgl.lower;
+
+ /* This length excluding SMP header (4 bytes) and CRC field */
+ agSMPFrame->frameLen = tiPassthroughCmnd->tiSgl.len;
+
+ /* initialize agIORequest */
+ /*
+ Compare:
+ tdIORequestBody = (tdIORequestBody_t *)agIORequest->osData;
+ */
+ agIORequest = &(tdssSMPRequestBody->agIORequest);
+ agIORequest->osData = (void *) tdPTCmndBody;
+ agIORequest->sdkData = agNULL; /* LL takes care of this */
+
+
+
+ /* not work yet because of high priority q */
+ saStatus = saSMPStart(
+ agRoot,
+ agIORequest,
+ agDevHandle,
+ agRequestType,
+ agSASRequestBody,
+ &ossaSMPCompleted
+ );
+
+ if (saStatus == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (saStatus == AGSA_RC_FAILURE)
+ {
+ TI_DBG1(("tiCOMPassthroughCmndStart: saSMPStart failed\n"));
+ tiStatus = tiError;
+ }
+ else
+ {
+ /* AGSA_RC_BUSY */
+ TI_DBG1(("tiCOMPassthroughCmndStart: saSMPStart busy\n"));
+ tiStatus = tiBusy;
+ }
+ return tiStatus;
+
+
+#ifdef TO_DO
+ /* fill in SMP header */
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ agSMPFrame->frameHeader.smpFrameType = SMP_REQUEST; /* SMP REQUEST */
+ agRequestType = AGSA_SMP_INIT_REQ;
+ }
+ else
+ {
+ /* SMP target */
+ agSMPFrame->frameHeader.smpFrameType = SMP_RESPONSE; /* SMP RESPONSE */
+ agRequestType = AGSA_SMP_TGT_RESPONSE;
+ switch (tdPTCmndBody->protocol.SMP.SMPFnResult)
+ {
+ case tiSMPFunctionAccepted:
+ SMPFnResult = SMP_FUNCTION_ACCEPTED;
+ break;
+ case tiUnknownSMPFunction:
+ SMPFnResult = UNKNOWN_SMP_FUNCTION;
+ break;
+ case tiSMPFunctionFailed:
+ SMPFnResult = SMP_FUNCTION_FAILED;
+ break;
+ case tiInvalidRequestFrameLength:
+ SMPFnResult = INVALID_REQUEST_FRAME_LENGTH;
+ break;
+ case tiPhyDoesNotExist:
+ SMPFnResult =PHY_DOES_NOT_EXIST;
+ break;
+ case tiIndexDoesNotExist:
+ SMPFnResult = INDEX_DOES_NOT_EXIST;
+ break;
+ case tiPhyDoesNotSupportSATA:
+ SMPFnResult = PHY_DOES_NOT_SUPPORT_SATA;
+ break;
+ case tiUnknownPhyOperation:
+ SMPFnResult = UNKNOWN_PHY_OPERATION;
+ break;
+ case tiUnknownPhyTestFunction:
+ SMPFnResult = UNKNOWN_PHY_TEST_FUNCTION;
+ break;
+ case tiPhyTestFunctionInProgress:
+ SMPFnResult = PHY_TEST_FUNCTION_IN_PROGRESS;
+ break;
+ case tiPhyVacant:
+ SMPFnResult = PHY_VACANT;
+ break;
+
+ default:
+ TI_DBG1(("tiCOMPassthroughCmndStart: unknown SMP function result %d\n", tdPTCmndBody->protocol.SMP.SMPFnResult));
+ return tiError;
+ }
+ agSMPFrame->frameHeader.smpFunctionResult = SMPFnResult;
+ }
+
+ /* common */
+ switch (tdPTCmndBody->protocol.SMP.SMPFn)
+ {
+ case tiGeneral:
+ SMPFn = SMP_REPORT_GENERAL;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = 0;
+ }
+ else
+ {
+ SMPFrameLen = sizeof(smpRespReportGeneral_t);
+ }
+ break;
+
+ case tiManufacturerInfo:
+ SMPFn = SMP_REPORT_MANUFACTURE_INFORMATION;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = 0;
+ }
+ else
+ {
+ SMPFrameLen = sizeof(smpRespReportManufactureInfo_t);
+ }
+ break;
+
+ case tiDiscover:
+ SMPFn = SMP_DISCOVER;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = sizeof(smpReqDiscover_t);
+ }
+ else
+ {
+ SMPFrameLen = sizeof(smpRespDiscover_t);
+ }
+ break;
+
+ case tiReportPhyErrLog:
+ SMPFn = SMP_REPORT_PHY_ERROR_LOG;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = 8;
+ }
+ else
+ {
+ SMPFrameLen = 24;
+ }
+ break;
+
+ case tiReportPhySATA:
+ SMPFn = SMP_REPORT_PHY_SATA;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = sizeof(SmpReqReportPhySata_t);
+ }
+ else
+ {
+ SMPFrameLen = sizeof(SmpRespReportPhySata_t);
+ }
+ break;
+
+ case tiReportRteInfo:
+ SMPFn = SMP_REPORT_ROUTING_INFORMATION;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = sizeof(SmpReqReportRouteTable_t);
+ }
+ else
+ {
+ SMPFrameLen = sizeof(SmpRespReportRouteTable_t);
+ }
+ break;
+
+ case tiConfigureRteInfo:
+ SMPFn = SMP_CONFIGURE_ROUTING_INFORMATION;;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = sizeof(SmpReqConfigureRouteInformation_t);
+ }
+ else
+ {
+ SMPFrameLen = 0;
+ }
+ break;
+
+ case tiPhyCtrl:
+ SMPFn = SMP_PHY_CONTROL;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = sizeof(SmpReqPhyControl_t);
+ }
+ else
+ {
+ SMPFrameLen = 0;
+ }
+ break;
+
+ case tiPhyTestFn:
+ SMPFn = SMP_PHY_TEST_FUNCTION;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = 36;
+ }
+ else
+ {
+ SMPFrameLen = 0;
+ }
+ break;
+
+ case tiPMC:
+ SMPFn = SMP_PMC_SPECIFIC;
+ if (tdPTCmndBody->protocol.SMP.IT == SMP_INITIATOR)
+ {
+ SMPFrameLen = 0;
+ }
+ else
+ {
+ SMPFrameLen = 0;
+ }
+ break;
+
+
+ default:
+ TI_DBG1(("tiCOMPassthroughCmndStart: unknown SMP function %d\n", tdPTCmndBody->protocol.SMP.SMPFn));
+ return tiError;
+ }
+ agSMPFrame->frameHeader.smpFunction = SMPFn;
+
+
+ /* assumption: SMP payload is in tisgl1 */
+ agSMPFrame->frameAddrUpper32 = tdPTCmndBody->tiSgl.upper;
+ agSMPFrame->frameAddrLower32 = tdPTCmndBody->tiSgl.lower;
+
+ /* This length excluding SMP header (4 bytes) and CRC field */
+ agSMPFrame->frameLen = SMPFrameLen;
+
+
+
+
+
+
+#endif
+
+
+ }
+ else if (tiPassthroughCmnd->passthroughCmnd == tiRMCCmnd)
+ {
+ TI_DBG2(("tiCOMPassthroughCmndStart: RMC\n"));
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPassthroughCmndStart: unknown protocol %d\n", tiPassthroughCmnd->passthroughCmnd));
+ }
+
+
+ }
+ else if (oneDeviceData->DeviceType == TD_SATA_DEVICE)
+ {
+ TI_DBG1(("tiCOMPassthroughCmndStart: error !!! no SATA support\n"));
+ return tiError;
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPassthroughCmndStart: error !!! unknown devietype %d\n", oneDeviceData->DeviceType));
+ return tiError;
+
+ }
+
+ return tiSuccess;
+}
+
+
+osGLOBAL bit32
+tiCOMPassthroughCmndAbort(
+ tiRoot_t *tiRoot,
+ tiPassthroughRequest_t *taskTag
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = agNULL;
+ tdPassthroughCmndBody_t *tdPTCmndBody = agNULL;
+ tdssSMPRequestBody_t *tdssSMPRequestBody = agNULL;
+ agsaIORequest_t *agIORequest = agNULL;
+ bit32 saStatus, tiStatus = tiError;
+
+ TI_DBG2(("tiCOMPassthroughCmndAbort: start\n"));
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ tdPTCmndBody = (tdPassthroughCmndBody_t *)taskTag->tdData;
+
+ if (tdPTCmndBody->tiPassthroughCmndType == tiSMPCmnd)
+ {
+ tdssSMPRequestBody = &(tdPTCmndBody->protocol.SMP.SMPBody);
+ agIORequest = &(tdssSMPRequestBody->agIORequest);
+
+ saStatus = saSMPAbort(agRoot, agIORequest);
+
+ if (saStatus == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (saStatus == AGSA_RC_FAILURE)
+ {
+ TI_DBG1(("tiCOMPassthroughCmndAbort: saSMPAbort failed\n"));
+ tiStatus = tiError;
+ }
+ else
+ {
+ /* AGSA_RC_BUSY */
+ TI_DBG1(("tiCOMPassthroughCmndAbort: saSMPAbort busy\n"));
+ tiStatus = tiBusy;
+ }
+ return tiStatus;
+ }
+ else if (tdPTCmndBody->tiPassthroughCmndType == tiRMCCmnd)
+ {
+ TI_DBG1(("tiCOMPassthroughCmndAbort: RMC passthrough command type, not yet\n"));
+
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPassthroughCmndAbort: unknown passthrough command type %d\n", tdPTCmndBody->tiPassthroughCmndType));
+ return tiStatus;
+ }
+
+
+}
+
+osGLOBAL bit32
+tiINIPassthroughCmndRemoteAbort(
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiPassthroughRequest_t *taskTag,
+ tiPassthroughRequest_t *currentTaskTag,
+ tiPortalContext_t *tiportalContext
+ )
+{
+ TI_DBG2(("tiINIPassthroughCmndRemoteAbort: start\n"));
+ /*
+ for SMP, nothing. Can't abot remotely
+ */
+ return tiSuccess;
+}
+#endif /* PASSTHROUGH */
+
+
+/*****************************************************************************
+*! \brief tiCOMShutDown
+*
+* Purpose: This function is called to shutdown the initiator and/or target
+* operation. Following the completion of this call, the state is
+* equivalent to the state prior to tiCOMInit()
+*
+* \param tiRoot: Pointer to root data structure.
+*
+* \return None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tiCOMShutDown( tiRoot_t *tiRoot)
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+// #define TI_GETFOR_ONSHUTDOWN
+#ifdef TI_GETFOR_ONSHUTDOWN
+ agsaForensicData_t forensicData;
+ bit32 once = 1;
+ bit32 status;
+#endif /* TI_GETFOR_ONSHUTDOWN */
+
+ agsaRoot_t *agRoot = agNULL;
+
+ TI_DBG1(("tiCOMShutDown: start\n"));
+
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ /*
+ 1. free up cardID
+ 2. call saHwShutdown()
+ 3. tdInitEsgl(tiRoot);
+ 4. tdsaResetComMemFlags(tiRoot)
+ 5. ostiPortEvent()
+ */
+
+ tdsaFreeCardID(tiRoot, tdsaAllShared->CardID);
+
+#ifdef TI_GETFOR_ONSHUTDOWN
+ forensicData.DataType = TYPE_NON_FATAL;
+ forensicData.dataBuf.directLen = (8 * 1024);
+ forensicData.dataBuf.directOffset = 0; /* current offset */
+ forensicData.dataBuf.directData = agNULL;
+ forensicData.dataBuf.readLen = 0; /* Data read */
+
+ getmoreData:
+ status = saGetForensicData( agRoot, agNULL, &forensicData);
+
+ TI_DBG1(("tiCOMShutDown:readLen 0x%x directLen 0x%x directOffset 0x%x\n",
+ forensicData.dataBuf.readLen,
+ forensicData.dataBuf.directLen,
+ forensicData.dataBuf.directOffset));
+ if( forensicData.dataBuf.readLen == forensicData.dataBuf.directLen && !status && once)
+ {
+ goto getmoreData;
+ }
+
+ TI_DBG1(("tiCOMShutDown:saGetForensicData type %d read 0x%x bytes\n", forensicData.DataType, forensicData.dataBuf.directOffset ));
+#endif /* TI_GETFOR_ONSHUTDOWN */
+
+ saHwShutdown(agRoot);
+
+ /* resets all the relevant flags */
+ tdsaResetComMemFlags(tiRoot);
+
+ /*
+ * send an event to the oslayer
+ */
+ ostiPortEvent (
+ tiRoot,
+ tiPortShutdown,
+ tiSuccess,
+ agNULL
+ );
+
+ return;
+}
+
+#ifdef INITIATOR_DRIVER
+osGLOBAL void
+tiINITimerTick( tiRoot_t *tiRoot )
+{
+ /*
+ no timer is used in SAS TD layer.
+ Therefore, this function is null.
+ */
+ // TI_DBG2(("tiINITimerTick: start\n"));
+ /*itdsaProcessTimers(tiRoot);*/
+ return;
+}
+#endif
+
+/*****************************************************************************/
+/*! \brief ossaDisableInterrupts
+ *
+ *
+ * Purpose: This routine is called to disable interrupt
+ *
+ *
+ * \param agRoot: Pointer to chip/driver Instance.
+ * \param outboundChannelNum: Zero-base channel number
+ *
+ *
+ * \return None.
+ *
+ * \note - The scope is shared target and initiator.
+ *
+ */
+/*****************************************************************************/
+#ifndef ossaDisableInterrupts
+osGLOBAL void
+ossaDisableInterrupts(
+ agsaRoot_t *agRoot,
+ bit32 outboundChannelNum
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *) (agRoot->osData);
+
+ ostiInterruptDisable(
+ osData->tiRoot,
+ outboundChannelNum
+ );
+ return;
+}
+
+#endif
+
+
+osGLOBAL void
+tiCOMFrameReadBlock(
+ tiRoot_t *tiRoot,
+ void *agFrame,
+ bit32 FrameOffset,
+ void *FrameBuffer,
+ bit32 FrameBufLen )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = agNULL;
+
+ TI_DBG6(("tiCOMFrameReadBlock: start\n"));
+
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+
+ TI_DBG6(("tiCOMFrameReadBlock: start\n"));
+
+ saFrameReadBlock(agRoot, agFrame, FrameOffset, FrameBuffer, FrameBufLen);
+
+ return;
+}
+
+
+
+/*****************************************************************************
+*! \brief tiINITransportRecovery
+*
+* Purpose: This routine is called to explicitly ask the Transport Dependent
+* Layer to initiate the recovery for the transport/protocol specific
+* error for a specific device connection.
+*
+* \param tiRoot: Pointer to driver instance
+* \param tiDeviveHandle: Pointer to the device handle for this session.
+*
+* \return: None
+*
+*
+*****************************************************************************/
+#ifdef INITIATOR_DRIVER
+osGLOBAL void
+tiINITransportRecovery (
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle
+ )
+{
+ agsaRoot_t *agRoot = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdsaPortContext_t *onePortContext = agNULL;
+ tiPortalContext_t *tiPortalContext = agNULL;
+ tiIORequest_t *currentTaskTag;
+ agsaDevHandle_t *agDevHandle = agNULL;
+
+ TI_DBG1(("tiINITransportRecovery: start\n"));
+
+ if (tiDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tiINITransportRecovery: tiDeviceHandle is NULL\n"));
+
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tiINITransportRecovery: oneDeviceData is NULL\n"));
+ return;
+ }
+
+ /* for hotplug */
+ if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
+ oneDeviceData->tdPortContext == agNULL )
+ {
+ TI_DBG1(("tiINITransportRecovery: NO Device did %d\n", oneDeviceData->id ));
+ TI_DBG1(("tiINITransportRecovery: device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("tiINITransportRecovery: device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ return;
+ }
+
+ onePortContext = oneDeviceData->tdPortContext;
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tiINITransportRecovery: onePortContext is NULL\n"));
+ return;
+ }
+
+ tiPortalContext = onePortContext->tiPortalContext;
+ currentTaskTag = &(oneDeviceData->TransportRecoveryIO);
+ currentTaskTag->osData = agNULL;
+ agRoot = oneDeviceData->agRoot;
+ agDevHandle = oneDeviceData->agDevHandle;
+
+ if (oneDeviceData->DeviceType == TD_SAS_DEVICE)
+ {
+ agsaContext_t *agContext;
+ currentTaskTag->tdData = oneDeviceData;
+ agContext = &(oneDeviceData->agDeviceResetContext);
+ agContext->osData = currentTaskTag;
+ oneDeviceData->TRflag = agTRUE;
+
+ TI_DBG2(("tiINITransportRecovery: SAS device\n"));
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), agDevHandle, SA_DS_IN_RECOVERY);
+
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG2(("tiINITransportRecovery: saLocalPhyControl\n"));
+ saLocalPhyControl(agRoot, agContext, tdsaRotateQnumber(tiRoot, oneDeviceData), oneDeviceData->phyID, AGSA_PHY_HARD_RESET, agNULL);
+ ostiInitiatorEvent(tiRoot,
+ tiPortalContext,
+ tiDeviceHandle,
+ tiIntrEventTypeTransportRecovery,
+ tiRecStarted,
+ agNULL
+ );
+
+ return;
+ }
+ else
+ {
+ TI_DBG2(("tiINITransportRecovery: device reset expander attached\n"));
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ currentTaskTag,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ ostiInitiatorEvent(tiRoot,
+ tiPortalContext,
+ tiDeviceHandle,
+ tiIntrEventTypeTransportRecovery,
+ tiRecStarted,
+ agNULL
+ );
+ return;
+ }
+ }
+ else if (oneDeviceData->DeviceType == TD_SATA_DEVICE)
+ {
+ agsaContext_t *agContext;
+ currentTaskTag->tdData = oneDeviceData;
+ agContext = &(oneDeviceData->agDeviceResetContext);
+ agContext->osData = currentTaskTag;
+ oneDeviceData->TRflag = agTRUE;
+
+ TI_DBG2(("tiINITransportRecovery: SATA device\n"));
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), agDevHandle, SA_DS_IN_RECOVERY);
+
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG2(("tiINITransportRecovery: saLocalPhyControl\n"));
+ saLocalPhyControl(agRoot, agContext, tdsaRotateQnumber(tiRoot, oneDeviceData), oneDeviceData->phyID, AGSA_PHY_LINK_RESET, agNULL);
+ ostiInitiatorEvent(tiRoot,
+ tiPortalContext,
+ tiDeviceHandle,
+ tiIntrEventTypeTransportRecovery,
+ tiRecStarted,
+ agNULL
+ );
+
+ return;
+ }
+ else
+ {
+ TI_DBG2(("tiINITransportRecovery: device reset expander attached\n"));
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_LINK_RESET,
+ currentTaskTag,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ ostiInitiatorEvent(tiRoot,
+ tiPortalContext,
+ tiDeviceHandle,
+ tiIntrEventTypeTransportRecovery,
+ tiRecStarted,
+ agNULL
+ );
+ return;
+ }
+ }
+ else
+ {
+ TI_DBG1(("tiINITransportRecovery: wrong device type %d\n", oneDeviceData->DeviceType));
+ }
+
+
+ return;
+}
+#endif
+
+#if defined (INITIATOR_DRIVER) && defined (TARGET_DRIVER)
+/*****************************************************************************
+*! \brief tdsaPhyControlSend
+*
+* Purpose: This function sends Phy Control to a device.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param oneDeviceData: Pointer to the device data.
+* \param phyId: Phy Identifier.
+* \param queueNumber: bits 0-15: inbound queue number.
+* bits 16-31: outbound queue number.
+*
+* \return:
+* Status
+*
+* \note:
+*
+*****************************************************************************/
+/* phyop of interest
+SMP_PHY_CONTROL_HARD_RESET or SMP_PHY_CONTROL_CLEAR_AFFILIATION
+if CurrentTaskTag == agNULL, clear affiliation
+if CurrentTaskTag != agNULL, PHY_CONTROL (device reset)
+
+*/
+osGLOBAL bit32
+tdsaPhyControlSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData, /* taget disk */
+ bit8 phyOp,
+ tiIORequest_t *CurrentTaskTag,
+ bit32 queueNumber
+ )
+{
+ return 0;
+}
+#endif
+
+#ifdef TARGET_DRIVER
+/*****************************************************************************
+*! \brief tdsaPhyControlSend
+*
+* Purpose: This function sends Phy Control to a device.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param oneDeviceData: Pointer to the device data.
+* \param phyId: Phy Identifier.
+* \param queueNumber: bits 0-15: inbound queue number.
+* bits 16-31: outbound queue number.
+*
+* \return:
+* Status
+*
+* \note:
+*
+*****************************************************************************/
+/* phyop of interest
+SMP_PHY_CONTROL_HARD_RESET or SMP_PHY_CONTROL_CLEAR_AFFILIATION
+if CurrentTaskTag == agNULL, clear affiliation
+if CurrentTaskTag != agNULL, PHY_CONTROL (device reset)
+
+*/
+osGLOBAL bit32
+tdsaPhyControlSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData, /* taget disk */
+ bit8 phyOp,
+ tiIORequest_t *CurrentTaskTag,
+ bit32 queueNumber
+ )
+{
+ return 0;
+}
+#endif
+
+
+#ifdef INITIATOR_DRIVER
+/*****************************************************************************
+*! \brief tdsaPhyControlSend
+*
+* Purpose: This function sends Phy Control to a device.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param oneDeviceData: Pointer to the device data.
+* \param phyId: Phy Identifier.
+* \param queueNumber: bits 0-15: inbound queue number.
+* bits 16-31: outbound queue number.
+*
+* \return:
+* Status
+*
+* \note:
+*
+*****************************************************************************/
+/* phyop of interest
+SMP_PHY_CONTROL_HARD_RESET or SMP_PHY_CONTROL_CLEAR_AFFILIATION
+if CurrentTaskTag == agNULL, clear affiliation
+if CurrentTaskTag != agNULL, PHY_CONTROL (device reset)
+
+*/
+osGLOBAL bit32
+tdsaPhyControlSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData, /* taget disk */
+ bit8 phyOp,
+ tiIORequest_t *CurrentTaskTag,
+ bit32 queueNumber
+ )
+{
+ agsaRoot_t *agRoot;
+ tdsaDeviceData_t *oneExpDeviceData;
+ tdsaPortContext_t *onePortContext;
+ smpReqPhyControl_t smpPhyControlReq;
+ bit8 phyID;
+ bit32 status;
+
+ TI_DBG3(("tdsaPhyControlSend: start\n"));
+
+ agRoot = oneDeviceData->agRoot;
+ onePortContext = oneDeviceData->tdPortContext;
+ oneExpDeviceData = oneDeviceData->ExpDevice;
+ phyID = oneDeviceData->phyID;
+
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG1(("tdsaPhyControlSend: Error!!! deivce is directly attached\n"));
+ return AGSA_RC_FAILURE;
+ }
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdsaPhyControlSend: Error!!! portcontext is NULL\n"));
+ return AGSA_RC_FAILURE;
+ }
+
+ if (oneExpDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaPhyControlSend: Error!!! expander is NULL\n"));
+ return AGSA_RC_FAILURE;
+ }
+
+ if (phyOp == SMP_PHY_CONTROL_HARD_RESET)
+ {
+ TI_DBG3(("tdsaPhyControlSend: SMP_PHY_CONTROL_HARD_RESET\n"));
+ }
+ if (phyOp == SMP_PHY_CONTROL_LINK_RESET)
+ {
+ TI_DBG3(("tdsaPhyControlSend: SMP_PHY_CONTROL_LINK_RESET\n"));
+ }
+ if (phyOp == SMP_PHY_CONTROL_CLEAR_AFFILIATION)
+ {
+ TI_DBG3(("tdsaPhyControlSend: SMP_PHY_CONTROL_CLEAR_AFFILIATION\n"));
+ }
+ TI_DBG3(("tdsaPhyControlSend: target device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaPhyControlSend: target device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ TI_DBG3(("tdsaPhyControlSend: expander AddrHi 0x%08x\n", oneExpDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaPhyControlSend: expander AddrLo 0x%08x\n", oneExpDeviceData->SASAddressID.sasAddressLo));
+ TI_DBG3(("tdsaPhyControlSend: did %d expander did %d phyid %d\n", oneDeviceData->id, oneExpDeviceData->id, phyID));
+
+
+ osti_memset(&smpPhyControlReq, 0, sizeof(smpReqPhyControl_t));
+
+ /* fill in SMP payload */
+ smpPhyControlReq.phyIdentifier = phyID;
+ smpPhyControlReq.phyOperation = phyOp;
+
+ status = tdSMPStart(
+ tiRoot,
+ agRoot,
+ oneExpDeviceData,
+ SMP_PHY_CONTROL,
+ (bit8 *)&smpPhyControlReq,
+ sizeof(smpReqPhyControl_t),
+ AGSA_SMP_INIT_REQ,
+ CurrentTaskTag,
+ queueNumber
+ );
+ return status;
+}
+#endif
+
+/*****************************************************************************
+*! \brief tdsaPhyControlFailureRespRcvd
+*
+* Purpose: This function processes the failure of Phy Control response.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param agRoot: Pointer to chip/driver Instance.
+* \param oneDeviceData: Pointer to the device data.
+* \param frameHeader: Pointer to SMP frame header.
+* \param frameHandle: A Handle used to refer to the response frame
+*
+* \return:
+* None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaPhyControlFailureRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle,
+ tiIORequest_t *CurrentTaskTag
+ )
+{
+#if defined(INITIATOR_DRIVER) || defined(TD_DEBUG_ENABLE)
+ tdsaDeviceData_t *TargetDeviceData = agNULL;
+#endif
+#ifdef TD_DEBUG_ENABLE
+ satDeviceData_t *pSatDevData = agNULL;
+#endif
+// agsaDevHandle_t *agDevHandle = agNULL;
+
+ TI_DBG1(("tdsaPhyControlFailureRespRcvd: start\n"));
+
+ TI_DBG3(("tdsaPhyControlFailureRespRcvd: expander device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaPhyControlFailureRespRcvd: expander device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+
+ if (CurrentTaskTag != agNULL )
+ {
+ /* This was set in tiINITaskmanagement() */
+#if defined(INITIATOR_DRIVER) || defined(TD_DEBUG_ENABLE)
+ TargetDeviceData = (tdsaDeviceData_t *)CurrentTaskTag->tdData;
+#endif
+#ifdef TD_DEBUG_ENABLE
+ pSatDevData = (satDeviceData_t *)&(TargetDeviceData->satDevData);
+#endif
+// agDevHandle = TargetDeviceData->agDevHandle;
+ TI_DBG2(("tdsaPhyControlFailureRespRcvd: target AddrHi 0x%08x\n", TargetDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG2(("tdsaPhyControlFailureRespRcvd: target AddrLo 0x%08x\n", TargetDeviceData->SASAddressID.sasAddressLo));
+
+#ifdef TD_DEBUG_ENABLE
+ TI_DBG2(("tdsaPhyControlFailureRespRcvd: satPendingIO %d satNCQMaxIO %d\n", pSatDevData->satPendingIO, pSatDevData->satNCQMaxIO ));
+ TI_DBG2(("tdsaPhyControlFailureRespRcvd: satPendingNCQIO %d satPendingNONNCQIO %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
+#endif
+ }
+
+#ifdef INITIATOR_DRIVER
+ if (CurrentTaskTag != agNULL )
+ {
+ TI_DBG1(("tdsaPhyControlRespRcvd: callback to OS layer with failure\n"));
+ if (TargetDeviceData->TRflag == agTRUE)
+ {
+ TargetDeviceData->TRflag = agFALSE;
+ ostiInitiatorEvent(tiRoot,
+ TargetDeviceData->tdPortContext->tiPortalContext,
+ &(TargetDeviceData->tiDeviceHandle),
+ tiIntrEventTypeTransportRecovery,
+ tiRecFailed ,
+ agNULL
+ );
+ }
+ else
+ {
+ ostiInitiatorEvent( tiRoot,
+ NULL,
+ NULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMFailed,
+ CurrentTaskTag );
+ }
+ }
+#endif
+ return;
+}
+/*****************************************************************************
+*! \brief tdsaPhyControlRespRcvd
+*
+* Purpose: This function processes Phy Control response.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param agRoot: Pointer to chip/driver Instance.
+* \param oneDeviceData: Pointer to the device data.
+* \param frameHeader: Pointer to SMP frame header.
+* \param frameHandle: A Handle used to refer to the response frame
+*
+* \return:
+* None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaPhyControlRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle,
+ tiIORequest_t *CurrentTaskTag
+ )
+{
+#if defined(INITIATOR_DRIVER) || defined(TD_DEBUG_ENABLE)
+ tdsaDeviceData_t *TargetDeviceData = agNULL;
+#endif
+#ifdef INITIATOR_DRIVER
+ satDeviceData_t *pSatDevData = agNULL;
+ agsaDevHandle_t *agDevHandle = agNULL;
+#endif
+
+ TI_DBG3(("tdsaPhyControlRespRcvd: start\n"));
+
+ TI_DBG3(("tdsaPhyControlRespRcvd: expander device AddrHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaPhyControlRespRcvd: expander device AddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+
+ if (CurrentTaskTag != agNULL )
+ {
+ /* This was set in tiINITaskmanagement() */
+#if defined(INITIATOR_DRIVER) || defined(TD_DEBUG_ENABLE)
+ TargetDeviceData = (tdsaDeviceData_t *)CurrentTaskTag->tdData;
+#endif
+#ifdef INITIATOR_DRIVER
+ pSatDevData = (satDeviceData_t *)&(TargetDeviceData->satDevData);
+ agDevHandle = TargetDeviceData->agDevHandle;
+#endif
+ TI_DBG2(("tdsaPhyControlRespRcvd: target AddrHi 0x%08x\n", TargetDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG2(("tdsaPhyControlRespRcvd: target AddrLo 0x%08x\n", TargetDeviceData->SASAddressID.sasAddressLo));
+
+#ifdef INITIATOR_DRIVER
+ TI_DBG2(("tdsaPhyControlRespRcvd: satPendingIO %d satNCQMaxIO %d\n", pSatDevData->satPendingIO, pSatDevData->satNCQMaxIO ));
+ TI_DBG2(("tdsaPhyControlRespRcvd: satPendingNCQIO %d satPendingNONNCQIO %d\n", pSatDevData->satPendingNCQIO, pSatDevData->satPendingNONNCQIO));
+#endif
+ }
+
+#ifdef INITIATOR_DRIVER
+ /* no payload */
+ if (frameHeader->smpFunctionResult == SMP_FUNCTION_ACCEPTED)
+ {
+ TI_DBG3(("tdsaPhyControlRespRcvd: SMP success\n"));
+
+ /* warm reset or clear affiliation is done
+ call ostiInitiatorEvent()
+ */
+ if (CurrentTaskTag != agNULL )
+ {
+ TI_DBG3(("tdsaPhyControlRespRcvd: callback to OS layer with success\n"));
+ pSatDevData->satDriveState = SAT_DEV_STATE_NORMAL;
+ saSetDeviceState(agRoot, agNULL, tdsaRotateQnumber(tiRoot, TargetDeviceData), agDevHandle, SA_DS_OPERATIONAL);
+
+ if (TargetDeviceData->TRflag == agTRUE)
+ {
+ TargetDeviceData->TRflag = agFALSE;
+ ostiInitiatorEvent(tiRoot,
+ TargetDeviceData->tdPortContext->tiPortalContext,
+ &(TargetDeviceData->tiDeviceHandle),
+ tiIntrEventTypeTransportRecovery,
+ tiRecOK,
+ agNULL
+ );
+ }
+ else
+ {
+ agDevHandle = TargetDeviceData->agDevHandle;
+ if (agDevHandle == agNULL)
+ {
+ TI_DBG1(("tdsaPhyControlRespRcvd: wrong, agDevHandle is NULL\n"));
+ }
+ ostiInitiatorEvent( tiRoot,
+ NULL,
+ NULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMOK,
+ CurrentTaskTag );
+ }
+ }
+
+ }
+ else
+ {
+ TI_DBG1(("tdsaPhyControlRespRcvd: SMP failure; result %d\n", frameHeader->smpFunctionResult));
+ /* warm reset or clear affiliation is done
+ */
+ if (CurrentTaskTag != agNULL )
+ {
+ TI_DBG1(("tdsaPhyControlRespRcvd: callback to OS layer with failure\n"));
+ if (TargetDeviceData->TRflag == agTRUE)
+ {
+ TargetDeviceData->TRflag = agFALSE;
+ ostiInitiatorEvent(tiRoot,
+ TargetDeviceData->tdPortContext->tiPortalContext,
+ &(TargetDeviceData->tiDeviceHandle),
+ tiIntrEventTypeTransportRecovery,
+ tiRecFailed ,
+ agNULL
+ );
+ }
+ else
+ {
+ ostiInitiatorEvent( tiRoot,
+ NULL,
+ NULL,
+ tiIntrEventTypeTaskManagement,
+ tiTMFailed,
+ CurrentTaskTag );
+ }
+ }
+
+ }
+#endif
+ return;
+}
+
+
+#ifdef TARGET_DRIVER
+/*****************************************************************************
+*! \brief ttdsaAbortAll
+*
+* Purpose: This function is called to abort an all pending I/O request on a
+* device
+*
+* \param tiRoot: Pointer to initiator driver/port instance.
+* \param agRoot: Pointer to chip/driver Instance.
+* \param oneDeviceData: Pointer to the device
+*
+* \return:
+*
+* None
+*
+*****************************************************************************/
+/*
+ for abort itself,
+ should we allocate tdAbortIORequestBody or get one from ttdsaXchg_t?
+ Currently, we allocate tdAbortIORequestBody.
+*/
+osGLOBAL void
+ttdsaAbortAll(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ agsaIORequest_t *agAbortIORequest = agNULL;
+ tdIORequestBody_t *tdAbortIORequestBody = agNULL;
+ bit32 PhysUpper32;
+ bit32 PhysLower32;
+ bit32 memAllocStatus;
+ void *osMemHandle;
+
+ TI_DBG3(("tdsaAbortAll: start\n"));
+
+ TI_DBG3(("tdsaAbortAll: did %d\n", oneDeviceData->id));
+
+
+ /* allocating agIORequest for abort itself */
+ memAllocStatus = ostiAllocMemory(
+ tiRoot,
+ &osMemHandle,
+ (void **)&tdAbortIORequestBody,
+ &PhysUpper32,
+ &PhysLower32,
+ 8,
+ sizeof(tdIORequestBody_t),
+ agTRUE
+ );
+ if (memAllocStatus != tiSuccess)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdsaAbortAll: ostiAllocMemory failed...\n"));
+ return;
+ }
+
+ if (tdAbortIORequestBody == agNULL)
+ {
+ /* let os process IO */
+ TI_DBG1(("tdsaAbortAll: ostiAllocMemory returned NULL tdAbortIORequestBody\n"));
+ return;
+ }
+
+ /* setup task management structure */
+ tdAbortIORequestBody->IOType.InitiatorTMIO.osMemHandle = osMemHandle;
+ /* setting callback */
+ /* not needed; it is already set to be ossaSSPAbortCB() */
+ tdAbortIORequestBody->IOCompletionFunc = ttdssIOAbortedHandler;
+
+ tdAbortIORequestBody->tiDevHandle = (tiDeviceHandle_t *)&(oneDeviceData->tiDeviceHandle);
+
+ /* initialize agIORequest */
+ agAbortIORequest = &(tdAbortIORequestBody->agIORequest);
+ agAbortIORequest->osData = (void *) tdAbortIORequestBody;
+ agAbortIORequest->sdkData = agNULL; /* LL takes care of this */
+
+ /* SSPAbort */
+ saSSPAbort(agRoot,
+ agAbortIORequest,
+ 0,
+ oneDeviceData->agDevHandle,
+ 1, /* abort all */
+ agNULL,
+ agNULL
+ );
+ return;
+}
+#endif /* TARGET_DRIVER */
+
+
+osGLOBAL void
+tdsaDeregisterDevicesInPort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ agsaRoot_t *agRoot = agNULL;
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ TI_DBG1(("tdsaDeregisterDevicesInPort: start\n"));
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaDeregisterDevicesInPort: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if (oneDeviceData->tdPortContext == onePortContext)
+ {
+ TI_DBG3(("tdsaDeregisterDevicesInPort: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ if ( !( DEVICE_IS_SMP_TARGET(oneDeviceData) && oneDeviceData->directlyAttached == agTRUE))
+ {
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+ }
+ else
+ {
+ TI_DBG1(("tdsaDeregisterDevicesInPort: keeping\n"));
+ oneDeviceData->registered = agTRUE;
+ }
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ TI_DBG3(("tdsaDeregisterDevicesInPort: end\n"));
+
+ return;
+}
+
+/******************** for debugging only ***************************/
+osGLOBAL void
+tdsaPrintSwConfig(
+ agsaSwConfig_t *SwConfig
+ )
+{
+ if (SwConfig == agNULL)
+ {
+ TI_DBG6(("tdsaPrintSwConfig: SwConfig is NULL\n"));
+ return;
+ }
+ else
+ {
+ TI_DBG6(("SwConfig->maxActiveIOs %d\n", SwConfig->maxActiveIOs));
+ TI_DBG6(("SwConfig->smpReqTimeout %d\n", SwConfig->smpReqTimeout));
+ }
+
+ return;
+
+}
+
+osGLOBAL void
+tdsaPrintHwConfig(
+ agsaHwConfig_t *HwConfig
+ )
+{
+ if (HwConfig == agNULL)
+ {
+ TI_DBG6(("tdsaPrintHwConfig: HwConfig is NULL\n"));
+ return;
+ }
+ else
+ {
+ TI_DBG6(("HwConfig->phyCount %d\n", HwConfig->phyCount));
+ }
+ return;
+}
+
+osGLOBAL void
+tdssPrintSASIdentify(
+ agsaSASIdentify_t *id
+ )
+{
+ if (id == agNULL)
+ {
+ TI_DBG1(("tdsaPrintSASIdentify: ID is NULL\n"));
+ return;
+ }
+ else
+ {
+ TI_DBG6(("SASID->sspTargetPort %d\n", SA_IDFRM_IS_SSP_TARGET(id)?1:0));
+ TI_DBG6(("SASID->stpTargetPort %d\n", SA_IDFRM_IS_STP_TARGET(id)?1:0));
+ TI_DBG6(("SASID->smpTargetPort %d\n", SA_IDFRM_IS_SMP_TARGET(id)?1:0));
+ TI_DBG6(("SASID->sspInitiatorPort %d\n", SA_IDFRM_IS_SSP_INITIATOR(id)?1:0));
+ TI_DBG6(("SASID->stpInitiatorPort %d\n", SA_IDFRM_IS_STP_INITIATOR(id)?1:0));
+ TI_DBG6(("SASID->smpInitiatorPort %d\n", SA_IDFRM_IS_SMP_INITIATOR(id)?1:0));
+ TI_DBG6(("SASID->deviceType %d\n", SA_IDFRM_GET_DEVICETTYPE(id)));
+ TI_DBG6(("SASID->sasAddressHi 0x%x\n", SA_IDFRM_GET_SAS_ADDRESSHI(id)));
+ TI_DBG6(("SASID->sasAddressLo 0x%x\n", SA_IDFRM_GET_SAS_ADDRESSLO(id)));
+ TI_DBG6(("SASID->phyIdentifier 0x%x\n", id->phyIdentifier));
+
+ }
+
+ return;
+}
+
+osGLOBAL void
+tdsaInitTimerHandler(
+ tiRoot_t *tiRoot,
+ void *timerData
+ )
+{
+
+ TI_DBG6(("tdsaInitTimerHandler: start\n"));
+ return;
+}
+
+/*
+ type: 1 portcontext 2 devicedata
+ flag: 1 FreeLink 2 MainLink
+*/
+
+osGLOBAL void
+print_tdlist_flink(tdList_t *hdr, int type, int flag)
+{
+ tdList_t *hdr_tmp1 = NULL;
+#ifdef TD_DEBUG_ENABLE
+ tdsaPortContext_t *ele1;
+#endif
+#ifdef REMOVED
+ tdsaDeviceData_t *ele2;
+#endif
+ hdr_tmp1 = hdr;
+
+ if (type == 1 && flag == 1)
+ {
+ TI_DBG6(("PortContext and FreeLink\n"));
+ }
+ else if (type != 1 && flag == 1)
+ {
+ TI_DBG6(("DeviceData and FreeLink\n"));
+ }
+ else if (type == 1 && flag != 1)
+ {
+ TI_DBG6(("PortContext and MainLink\n"));
+ }
+ else
+ {
+ TI_DBG6(("DeviceData and MainLink\n"));
+ }
+ if (type == 1)
+ {
+ do
+ {
+ /* data structure type variable = (data structure type, file name, header of the tdList) */
+ if (flag == 1)
+ {
+#ifdef TD_DEBUG_ENABLE
+ ele1 = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, hdr_tmp1);
+#endif
+ }
+ else
+ {
+#ifdef TD_DEBUG_ENABLE
+ ele1 = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, hdr_tmp1);
+#endif
+ }
+ TI_DBG6(("flist ele %d\n", ele1->id));
+ TI_DBG6(("flist ele %p\n", ele1));
+ hdr_tmp1 = hdr_tmp1->flink;
+ } while (hdr_tmp1 != hdr);
+ }
+ else
+ {
+ do
+ {
+ /* data structure type variable = (data structure type, file name, header of the tdList) */
+#ifdef REMOVED
+ if (flag == 1)
+ {
+ ele2 = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, hdr_tmp1);
+ }
+ else
+ {
+ ele2 = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, hdr_tmp1);
+ }
+ TI_DBG6(("flist ele %d\n", ele2->id));
+ TI_DBG6(("flist ele %p\n", ele2));
+#endif
+ hdr_tmp1 = hdr_tmp1->flink;
+ } while (hdr_tmp1 != hdr);
+ }
+ TI_DBG6(("\n"));
+}
+
+/* not verified yet. 6/15/2005 */
+osGLOBAL void
+print_tdlist_blink(tdList_t *hdr, int flag)
+{
+ tdList_t *hdr_tmp1 = NULL;
+#ifdef REMOVED
+ tdsaPortContext_t *ele1;
+#endif
+ hdr_tmp1 = hdr;
+
+ do
+ {
+ /* data structure type variable = (data structure type, file name, header of the tdList) */
+#ifdef REMOVED
+ if (flag == 1)
+ {
+ ele1 = TDLIST_OBJECT_BASE(tdsaPortContext_t, FreeLink, hdr_tmp1);
+ }
+ else
+ {
+ ele1 = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, hdr_tmp1);
+ }
+ TI_DBG6(("blist ele %d\n", ele1->id));
+#endif
+
+ hdr_tmp1 = hdr_tmp1->blink;
+ } while (hdr_tmp1 != hdr);
+}
+
+
+/** hexidecimal dump */
+void tdhexdump(const char *ptitle, bit8 *pbuf, int len)
+{
+ int i;
+ TI_DBG2(("%s - hexdump(len=%d):\n", ptitle, (int)len));
+ if (!pbuf)
+ {
+ TI_DBG1(("pbuf is NULL\n"));
+ return;
+ }
+ for (i = 0; i < len; )
+ {
+ if (len - i > 4)
+ {
+ TI_DBG2((" 0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", pbuf[i], pbuf[i+1], pbuf[i+2], pbuf[i+3]));
+ i += 4;
+ }
+ else
+ {
+ TI_DBG2((" 0x%02x,", pbuf[i]));
+ i++;
+ }
+ }
+ TI_DBG2(("\n"));
+}
+
+void
+tdsaSingleThreadedEnter(tiRoot_t *ptiRoot, bit32 queueId)
+{
+ tdsaRoot_t * tiroot = agNULL;
+ bit32 offset = 0;
+ TD_ASSERT(ptiRoot,"ptiRoot");
+ tiroot = ptiRoot->tdData;
+
+ offset = tiroot->tdsaAllShared.MaxNumLLLocks + tiroot->tdsaAllShared.MaxNumOSLocks;
+
+ ostiSingleThreadedEnter(ptiRoot, queueId + offset);
+}
+
+void
+tdsaSingleThreadedLeave(tiRoot_t *ptiRoot, bit32 queueId)
+{
+ tdsaRoot_t * tiroot = agNULL;
+ bit32 offset = 0;
+
+ TD_ASSERT(ptiRoot,"ptiRoot");
+ tiroot = ptiRoot->tdData;
+
+ offset = tiroot->tdsaAllShared.MaxNumLLLocks + tiroot->tdsaAllShared.MaxNumOSLocks;
+
+ ostiSingleThreadedLeave(ptiRoot, queueId + offset);
+}
+
+#ifdef PERF_COUNT
+void
+tdsaEnter(tiRoot_t *ptiRoot, int io)
+{
+ ostiEnter(ptiRoot, 1, io);
+}
+
+void
+tdsaLeave(tiRoot_t *ptiRoot, int io)
+{
+ ostiLeave(ptiRoot, 1, io);
+}
+#endif
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdport.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdport.c
new file mode 100644
index 0000000..9a0a21c
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdport.c
@@ -0,0 +1,8044 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ * tdport.c
+ * This file contains port realted functions such as tiCOMPortStart()
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/spc/sadefs.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+#ifndef TURN_OFF_HDA
+#include <dev/pms/RefTisa/sallsdk/hda/64k/aap1img.h> /* SPC HDA */
+#include <dev/pms/RefTisa/sallsdk/hda/64k/ilaimg.h>
+#include <dev/pms/RefTisa/sallsdk/hda/64k/iopimg.h>
+#include <dev/pms/RefTisa/sallsdk/hda/64k/istrimg.h>
+
+#include <dev/pms/RefTisa/sallsdk/hda/64k/aap18008.h> /* SPCv HDA */
+#include <dev/pms/RefTisa/sallsdk/hda/64k/iop8008.h>
+
+#include <dev/pms/RefTisa/sallsdk/hda/64k/ila8008.h> /* Ila common to SPCv SPCvp versions */
+
+#include <dev/pms/RefTisa/sallsdk/hda/64k/raae8070.h> /* SPCv 12g HDA */
+#include <dev/pms/RefTisa/sallsdk/hda/64k/iop8070.h>
+#include <dev/pms/RefTisa/sallsdk/hda/64k/ila8070.h> /* Ila 12g SPCv SPCvp versions */
+
+#endif /* TURN_OFF_HDA */
+
+
+bit32 gSSC_Disable = 0;
+bit32 volatile sgpioResponseSet = 0;
+
+#ifdef ECHO_TESTING
+/* temporary to test saEchoCommand() */
+bit8 gEcho;
+#endif
+bit32 tiCOMConfigureSgpio(
+ tiRoot_t *tiRoot,
+ bit8 enableSgpio
+ );
+
+
+/*****************************************************************************
+*! \brief tdsaGetSwConfigParams
+*
+* Purpose: This function reads software configuration parameters from the
+* configuration file
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetSwConfigParams(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaSwConfig_t *SwConfig;
+ agsaQueueConfig_t *QueueConfig;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char iniParmsStr[] = "InitiatorParms";
+ char SwParmsStr[] = "SWParms";
+ char OBQueueProps[] = "OBQueueProps";
+ char IBQueueProps[] = "IBQueueProps";
+ char IBQueueSize[40];
+ char OBQueueSize[40];
+ char IBQueueEleSize[40];
+ char OBQueueEleSize[40];
+ char OBQueueInterruptCount[40];
+ char OBQueueInterruptDelay[40];
+ char OBQueueInterruptEnable[40];
+ char IBQueuePriority[40];
+ char *cardNum = tdsaAllShared->CardIDString;
+ bit32 i;
+ bit32 enableDIF;
+ bit32 enableEncryption;
+#ifdef SA_CONFIG_MDFD_REGISTRY
+ bit32 disableMDF;
+#endif
+
+#ifdef FDS_DM
+ dmSwConfig_t *dmSwConfig;
+#endif
+#ifdef FDS_SM
+ smSwConfig_t *smSwConfig;
+#endif
+
+ TI_DBG6(("tdsaGetSwConfigParams: start\n"));
+ TI_DBG6(("tdsaGetSwConfigParams: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+
+ /* the followings are the default values */
+ SwConfig = (agsaSwConfig_t *)&(tdsaAllShared->SwConfig);
+ QueueConfig = (agsaQueueConfig_t *)&(tdsaAllShared->QueueConfig);
+
+#ifdef FDS_DM
+ dmSwConfig = (dmSwConfig_t *)&(tdsaAllShared->dmSwConfig);
+#endif
+#ifdef FDS_SM
+ smSwConfig = (smSwConfig_t *)&(tdsaAllShared->smSwConfig);
+#endif
+
+ /*
+ just default values
+ and are overwritten later by the configuration file contents
+ */
+ SwConfig->numDevHandles = DEFAULT_MAX_DEV;
+
+ SwConfig->maxActiveIOs = DEFAULT_MAX_ACTIVE_IOS;
+ SwConfig->smpReqTimeout = DEFAULT_SMP_TIMEOUT; /* DEFAULT_VALUE; */
+ SwConfig->numberOfEventRegClients = DEFAULT_NUM_REG_CLIENTS;
+ SwConfig->sizefEventLog1 = HOST_EVENT_LOG_SIZE;
+ SwConfig->sizefEventLog2 = HOST_EVENT_LOG_SIZE;
+ SwConfig->eventLog1Option = DEFAULT_EVENT_LOG_OPTION;
+ SwConfig->eventLog2Option = DEFAULT_EVENT_LOG_OPTION;
+ SwConfig->fatalErrorInterruptEnable = 1;
+ SwConfig->fatalErrorInterruptVector = 0; /* Was 1 */
+ SwConfig->hostDirectAccessSupport = 0;
+ SwConfig->hostDirectAccessMode = 0;
+ SwConfig->FWConfig = 0;
+ SwConfig->enableDIF = agFALSE;
+ SwConfig->enableEncryption = agFALSE;
+
+#ifdef SA_CONFIG_MDFD_REGISTRY
+ SwConfig->disableMDF = agFALSE;
+#endif
+
+ SwConfig->param1 = tdsaAllShared->tdDeviceIdVendId;
+ SwConfig->param2 = tdsaAllShared->tdSubVendorId;
+
+
+#if defined(SALLSDK_DEBUG)
+ SwConfig->sallDebugLevel = 1; /* DEFAULT_VALUE; */
+#endif
+#if defined(DM_DEBUG)
+ dmSwConfig->DMDebugLevel = 1; /* DEFAULT_VALUE; */
+#endif
+#if defined(SM_DEBUG)
+ smSwConfig->SMDebugLevel = 1; /* DEFAULT_VALUE; */
+#endif
+
+ tdsaAllShared->portTMO = PORT_RECOVERY_TIMEOUT; /* default 5 sec */
+ tdsaAllShared->stp_idle_time = STP_IDLE_TIME; /* default 5 us */
+ tdsaAllShared->itNexusTimeout = IT_NEXUS_TIMEOUT; /* default 2000 ms */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr,
+ iniParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "MaxTargets",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: MaxTargets %d\n",SwConfig->numDevHandles ));
+ }
+
+ /*
+ * read the NumInboundQueue parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ QueueConfig->numInboundQueues = DEFAULT_NUM_INBOUND_QUEUE; /* default 1 Inbound queue */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumInboundQueues", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig->numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig->numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+ if (QueueConfig->numInboundQueues > AGSA_MAX_INBOUND_Q)
+ {
+ QueueConfig->numInboundQueues = AGSA_MAX_INBOUND_Q;
+ }
+ }
+
+ /*
+ * read the NumOutboundQueue parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ QueueConfig->numOutboundQueues = DEFAULT_NUM_OUTBOUND_QUEUE; /* default 1 Outbound queue */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumOutboundQueues", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig->numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig->numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+ if (QueueConfig->numOutboundQueues > AGSA_MAX_OUTBOUND_Q)
+ {
+ QueueConfig->numOutboundQueues = AGSA_MAX_OUTBOUND_Q;
+ }
+ }
+
+ /*
+ * read the outbound queue option
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->QueueOption = DEFAULT_QUEUE_OPTION; /* default 0 Outbound queue element */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "QueueOption", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->QueueOption = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->QueueOption = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ /*
+ * read the MaxActiveIO parameter
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MaxActiveIO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 0);
+ TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 1 !!!\n"));
+ }
+ else
+ {
+ SwConfig->maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 2 !!!\n"));
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 3 !!!\n"));
+ }
+
+
+
+ /*
+ * read the SMPTO parameter (SMP Timeout)
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SMPTO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+
+ /*
+ * read the NumRegClients parameter (SMP Timeout)
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "NumRegClients", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+#if defined(SALLSDK_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "LLDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+#if defined(DM_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "DMDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ dmSwConfig->DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ dmSwConfig->DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+#if defined(SM_DEBUG)
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SMDebugLevel", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ smSwConfig->SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ smSwConfig->SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+#endif
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
+ osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
+ osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
+
+ /*
+ * read the IBQueueSize
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->InboundQueueSize[i] = DEFAULT_INBOUND_QUEUE_SIZE; /* default 256 Inbound queue size */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue size %d\n", i, tdsaAllShared->InboundQueueSize[i]));
+ }
+ }
+
+
+ /*
+ * read the IBQueueEleSize
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->InboundQueueEleSize[i] = DEFAULT_INBOUND_QUEUE_ELE_SIZE; /* default 128 Inbound queue element */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue ele size %d\n", i, tdsaAllShared->InboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the IBQueuePriority
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->InboundQueuePriority[i] = DEFAULT_INBOUND_QUEUE_PRIORITY; /* default 0 Inbound queue priority */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueuePriority, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d priority %d\n", i, tdsaAllShared->InboundQueuePriority[i]));
+ }
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }/* end of loop */
+
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig->numOutboundQueues;i++)
+ {
+ osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
+ osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
+ osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
+ osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
+ osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
+
+ /*
+ * read the OBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ tdsaAllShared->OutboundQueueSize[i] = DEFAULT_OUTBOUND_QUEUE_SIZE; /* default 256 Outbound queue size */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue size %d\n", i, tdsaAllShared->OutboundQueueSize[i]));
+
+ }
+ }
+
+
+ /*
+ * read the OBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ tdsaAllShared->OutboundQueueEleSize[i] = DEFAULT_OUTBOUND_QUEUE_ELE_SIZE; /* default 128 Outbound queue element */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue ele size %d\n", i, tdsaAllShared->OutboundQueueEleSize[i]));
+
+ }
+ }
+
+
+ /*
+ * read the OBQueueInterruptDelay
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ tdsaAllShared->OutboundQueueInterruptDelay[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY; /* default 1 Outbound interrupt delay */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptDelay, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt delay %d\n", i, tdsaAllShared->OutboundQueueInterruptDelay[i]));
+
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptCount
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->OutboundQueueInterruptCount[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT; /* default 1 Outbound interrupt count */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptCount, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt count %d\n", i, tdsaAllShared->OutboundQueueInterruptCount[i]));
+ }
+ }
+
+
+ /*
+ * read the OBQueueInterruptEnable
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->OutboundQueueInterruptEnable[i] = DEFAULT_OUTBOUND_INTERRUPT_ENABLE; /* default 1 Outbound interrupt is enabled */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptEnable, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt enable %d\n", i, tdsaAllShared->OutboundQueueInterruptEnable[i]));
+ }
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ }/* end of loop */
+
+
+
+ /********************READ CARD SPECIFIC *******************************************************/
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
+ osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
+ osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
+
+ /*
+ * read the IBQueueSize
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue size %d\n", i, tdsaAllShared->InboundQueueSize[i]));
+ }
+ }
+
+ /*
+ * read the IBQueueEleSize
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue ele size %d\n", i, tdsaAllShared->InboundQueueEleSize[i]));
+ }
+ }
+
+ /*
+ * read the IBQueuePriority
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ IBQueuePriority, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d priority %d\n", cardNum, i, tdsaAllShared->InboundQueuePriority[i]));
+ }
+ }
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }/* end of loop */
+
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<QueueConfig->numOutboundQueues;i++)
+ {
+ osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
+ osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
+ osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
+ osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
+ osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
+
+ /*
+ * read the OBQueueSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue size %d\n", i, tdsaAllShared->OutboundQueueSize[i]));
+
+ }
+ }
+
+ /*
+ * read the OBQueueEleSize
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueEleSize, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue ele size %d\n", i, tdsaAllShared->OutboundQueueEleSize[i]));
+
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptDelay
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptDelay, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt delay %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptDelay[i]));
+
+ }
+ }
+
+ /*
+ * read the OBQueueInterruptCount
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptCount, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt count %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptCount[i]));
+ }
+ }
+
+
+ /*
+ * read the OBQueueInterruptEnable
+ */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ cardNum, /* key */
+ SwParmsStr, /* subkey1 */
+ OBQueueProps, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ OBQueueInterruptEnable, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt enable %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptEnable[i]));
+ }
+ }
+
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ }/* end of loop */
+
+ /* process event log related parameters */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogSize1", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogOption1", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogSize2", /* valueName *//* IOP size in K dWords */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "EventLogOption2", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* end of event log related parameters */
+
+ /*
+ HDA parameters
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HDASupport", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HDAMode", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* the end of HDA parameters */
+
+ /* FW configuration */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "FWConfig", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->FWConfig = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->FWConfig = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* The end of FW configuration */
+
+ /* IQ Normal priority and High priority */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "IQNQDepth", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig->iqNormalPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig->iqNormalPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ IBQueueProps,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "IQHQDepth", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ QueueConfig->iqHighPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ QueueConfig->iqHighPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* End IQ Normal priority and High priority */
+
+ /* Start port timeout value */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "PortTMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->portTMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->portTMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* End port timeout value */
+
+#ifdef SA_ENABLE_TRACE_FUNCTIONS
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "TraceDestination", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->TraceDestination = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->TraceDestination = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: SwConfig->TraceDestination %d\n",SwConfig->TraceDestination));
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "TraceMask", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->TraceMask = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->TraceMask = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: SwConfig->TraceMask %d %X\n",SwConfig->TraceMask,SwConfig->TraceMask));
+ }
+#endif /*# SA_ENABLE_TRACE_FUNCTIONS */
+
+#ifdef AGTIAPI_CTL
+ /*
+ * read the SAS Connection Time Limit parameter
+ */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->SASConnectTimeLimit = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SASCTL", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ tdsaAllShared->SASConnectTimeLimit = osti_strtoul (buffer, &pLastUsedChar, 0);
+ else
+ tdsaAllShared->SASConnectTimeLimit = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+#endif
+
+ /* Start FCA value */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->FCA = 1; /* No FCA by default */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ "InitiatorParms", /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "FCA", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->FCA = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->FCA = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* End FCA value */
+
+ /* Start ResetInDiscovery value */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->ResetInDiscovery = 0; /* No ResetInDiscovery by default */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ "InitiatorParms", /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "ResetInDiscovery", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->ResetInDiscovery = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->ResetInDiscovery = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+ /* End ResetInDiscovery value */
+
+ /* Start MCN value */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->MCN = 1; /* default MCN */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MCN", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->MCN = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->MCN = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: MCN %d\n", tdsaAllShared->MCN));
+ }
+ /* End MCN value */
+
+ /* Start sflag value */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->sflag = 0; /* default sflag */
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "Sflag", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->sflag = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->sflag = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG1(("tdsaGetSwConfigParams: sflag %d\n", tdsaAllShared->sflag));
+ }
+ /* End sflag value */
+
+ /* Start enable DIF */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "enableDIF", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ enableDIF = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ enableDIF = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: enableDIF %d\n", enableDIF));
+ if (enableDIF)
+ {
+ SwConfig->enableDIF = agTRUE;
+ }
+ else
+ {
+ SwConfig->enableDIF = agFALSE;
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: SwConfig->enableDIF %d\n", SwConfig->enableDIF));
+ }
+ /* End enable DIF */
+
+
+ /* Start enable Encryption */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "enableEncryption", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ enableEncryption = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ enableEncryption = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: enableEncryption %d\n", enableEncryption));
+ if (enableEncryption)
+ {
+ SwConfig->enableEncryption = agTRUE;
+ }
+ else
+ {
+ SwConfig->enableEncryption = agFALSE;
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: SwConfig->enableEncryption %d\n", SwConfig->enableEncryption));
+ }
+ /* End enable Encryption */
+
+ /* Start allow connection rate change */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->RateAdjust = 0; /* No rate adjust by default */
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "RateAdjust", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->RateAdjust = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->RateAdjust = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: tdsaAllShared->RateAdjust %d\n", tdsaAllShared->RateAdjust));
+ }
+ /* End allow connection rate change */
+
+
+#ifdef SA_CONFIG_MDFD_REGISTRY
+ /* Start disable MDF */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "disableMDF", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ disableMDF = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ disableMDF = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: disableMDF %d\n", disableMDF));
+ if (disableMDF)
+ {
+ SwConfig->disableMDF = agTRUE;
+ }
+ else
+ {
+ SwConfig->disableMDF = agFALSE;
+ }
+ TI_DBG6(("tdsaGetSwConfigParams: SwConfig->disableMDF %d\n", SwConfig->disableMDF));
+ }
+ /* End disable MDF */
+#endif /*SA_CONFIG_MDFD_REGISTRY*/
+
+ /* Start IT_NEXUS_TIMEOUT */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "IT_NEXUS_TIMEOUT", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->itNexusTimeout = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->itNexusTimeout = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG1(("tdsaGetSwConfigParams: tdsaAllShared->itNexusTimeout %d\n", tdsaAllShared->itNexusTimeout));
+ }
+ /* End IT_NEXUS_TIMEOUT */
+
+ /* Start stp idle time */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "STPIdleTime", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->stp_idle_time = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->stp_idle_time = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: STPIdleTime %d\n", tdsaAllShared->stp_idle_time));
+ }
+ /* End stp idle time */
+
+ /* Start STP_MCT_TMO */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ tdsaAllShared->STP_MCT_TMO = 32;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_STP_MCT_TMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->STP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->STP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: STP_MCT_TMO %d\n", tdsaAllShared->STP_MCT_TMO));
+ }
+ /* End STP_MCT_TMO */
+
+ /* Start SSP_MCT_TMO */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->SSP_MCT_TMO = 32;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_SSP_MCT_TMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->SSP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->SSP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: SSP_MCT_TMO %d\n", tdsaAllShared->SSP_MCT_TMO));
+ }
+ /* End SSP_MCT_TMO */
+
+
+ /* Start MAX_OPEN_TIME */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->MAX_OPEN_TIME = 5;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_MAX_OPEN_TIME", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->MAX_OPEN_TIME = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->MAX_OPEN_TIME = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: MAX_OPEN_TIME %d\n", tdsaAllShared->MAX_OPEN_TIME));
+ }
+ /* End MAX_OPEN_TIME */
+
+
+ /* Start SMP_MAX_CONN_TIMER */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->SMP_MAX_CONN_TIMER = 0xFF;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_SMP_MAX_CONN_TIMER", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->SMP_MAX_CONN_TIMER = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->SMP_MAX_CONN_TIMER = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: SMP_MAX_CONN_TIMER %d\n", tdsaAllShared->SMP_MAX_CONN_TIMER));
+ }
+ /* End SMP_MAX_CONN_TIMER */
+
+ /* Start STP_FRM_TMO */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->STP_FRM_TMO = 0;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_STP_FRM_TMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->STP_FRM_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->STP_FRM_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: STP_FRM_TMO %d\n", tdsaAllShared->STP_FRM_TMO));
+ }
+ /* End STP_FRM_TMO */
+
+ /* Start MFD_OPNRJT_RTRY_INTVL */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->MFD = 1; /* disabled by default */
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_MFD", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->MFD = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->MFD = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: MFD %d\n", tdsaAllShared->MFD));
+ }
+ /* End MFD_OPNRJT_RTRY_INTVL */
+
+ /* Start MFD_OPNRJT_RTRY_INTVL */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->OPNRJT_RTRY_INTVL = 2;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_OPNRJT_RTRY_INTVL", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->OPNRJT_RTRY_INTVL = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->OPNRJT_RTRY_INTVL = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: OPNRJT_RTRY_INTVL %d\n", tdsaAllShared->OPNRJT_RTRY_INTVL));
+ }
+ /* End MFD_OPNRJT_RTRY_INTVL */
+
+ /* Start DOPNRJT_RTRY_TMO */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->DOPNRJT_RTRY_TMO = 128;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_DOPNRJT_RTRY_TMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->DOPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->DOPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: DOPNRJT_RTRY_TMO %d\n", tdsaAllShared->DOPNRJT_RTRY_TMO));
+ }
+ /* End DOPNRJT_RTRY_TMO */
+
+ /* Start COPNRJT_RTRY_TMO */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+// tdsaAllShared->COPNRJT_RTRY_TMO = 32;
+ tdsaAllShared->COPNRJT_RTRY_TMO = 128;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_COPNRJT_RTRY_TMO", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->COPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->COPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: COPNRJT_RTRY_TMO %d\n", tdsaAllShared->COPNRJT_RTRY_TMO));
+ }
+ /* End COPNRJT_RTRY_TMO */
+
+ /* Start DOPNRJT_RTRY_THR */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+// tdsaAllShared->DOPNRJT_RTRY_THR = 16; /* FW default */
+ /*
+ Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
+ Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 is tdsaAllShared->DOPNRJT_RTRY_TMO
+ */
+ tdsaAllShared->DOPNRJT_RTRY_THR = 23438;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_DOPNRJT_RTRY_THR", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->DOPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->DOPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: DOPNRJT_RTRY_THR %d\n", tdsaAllShared->DOPNRJT_RTRY_THR));
+ }
+ /* End DOPNRJT_RTRY_THR */
+
+ /* Start COPNRJT_RTRY_THR */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+// tdsaAllShared->COPNRJT_RTRY_THR = 1024; /* FW default */
+ /*
+ Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
+ Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 is tdsaAllShared->COPNRJT_RTRY_TMO
+ */
+ tdsaAllShared->COPNRJT_RTRY_THR = 23438;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_COPNRJT_RTRY_THR", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->COPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->COPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: COPNRJT_RTRY_THR %d\n", tdsaAllShared->COPNRJT_RTRY_THR));
+ }
+ /* End COPNRJT_RTRY_THR */
+
+ /* Start MAX_AIP */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ tdsaAllShared->MAX_AIP = 0x200000;
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL,/* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "SAS_MAX_AIP", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->MAX_AIP = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->MAX_AIP = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG2(("tdsaGetSwConfigParams: MAX_AIP %d\n", tdsaAllShared->MAX_AIP));
+ }
+ /* End MAX_AIP */
+
+ /***********************************************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ /*
+ typedef struct agsaMPIContext_s
+ {
+ bit32 MPITableType;
+ bit32 offset;
+ bit32 value;
+ } agsaMPIContext_t;
+ */
+
+ {
+ bit32 MpiContextvalue = 0;
+ SwConfig->mpiContextTable = agNULL;
+ SwConfig->mpiContextTablelen = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MpiContext", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ MpiContextvalue = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ MpiContextvalue = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+
+ if (MpiContextvalue == 0)
+ {
+ SwConfig->mpiContextTable = agNULL;
+ SwConfig->mpiContextTablelen = 0;
+ }
+ else
+ {
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ if(agNULL != tdsaRoot)
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = 0xFF;
+ tdsaRoot->tdsaAllShared.MpiOverride.offset = 0;
+ tdsaRoot->tdsaAllShared.MpiOverride.value = 0;
+
+ SwConfig->mpiContextTable = &(tdsaRoot->tdsaAllShared.MpiOverride);
+ SwConfig->mpiContextTablelen = sizeof(agsaMPIContext_t);
+ }
+
+ TI_DBG1(("tdsaGetSwConfigParams: MpiContext %p Len %d\n", SwConfig->mpiContextTable, SwConfig->mpiContextTablelen));
+
+ }
+ }
+
+ if(SwConfig->mpiContextTable != agNULL )
+ {
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
+ if(agNULL != tdsaRoot)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MpiTableType", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.MPITableType 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.MPITableType ));
+ }
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MpiTableOffset", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.offset = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.offset = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+
+ TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.offset 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.offset ));
+ }
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MpiTableValue", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.value = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaRoot->tdsaAllShared.MpiOverride.value = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.value 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.value ));
+ }
+ }
+ }
+ }
+ /***********************************************************************/
+
+#ifdef SA_ENABLE_PCI_TRIGGER
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ SwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "PciTrigger", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ SwConfig->PCI_trigger = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ SwConfig->PCI_trigger = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG1(("tdsaGetSwConfigParams: PciTrigger %d\n",SwConfig->PCI_trigger));
+ }
+#endif /* SA_ENABLE_PCI_TRIGGER */
+
+
+ TI_DBG6(("tdsaGetSwConfigParams: $$$$$$$$$$$$$$$$$ merge $$$$$$$$$$$$$\n"));
+#if defined(SALLSDK_DEBUG)
+ TI_DBG2(("tdsaGetSwConfigParams: SwConfig->sallDebugLevel %d\n", SwConfig->sallDebugLevel));
+#endif
+
+#ifdef SA_ENABLE_PCI_TRIGGER
+ TI_DBG1(("tdsaGetSwConfigParams: SwConfig->PCI_trigger 0x%x 0x%x\n",SwConfig->PCI_trigger, tdsaRoot->itdsaIni->tdsaAllShared->SwConfig.PCI_trigger));
+#endif /* SA_ENABLE_PCI_TRIGGER */
+
+
+#ifdef AGTIAPI_CTL
+ TI_DBG6(("tdsaLoLevelGetResource: SASConnectTimeLimit 0x%x\n",
+ tdsaAllShared->SASConnectTimeLimit));
+#endif
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaParseLinkRateMode
+*
+* Purpose: This function parses link rate and mode.
+*
+* \param LinkRate: Link rate specified by user.
+* \param Mode: Link rate specified by user.
+*
+* \return:
+* Value combined with Linkrate and Mode
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaParseLinkRateMode(
+ tiRoot_t *tiRoot,
+ bit32 index,
+ bit32 LinkRateRead,
+ bit32 ModeRead,
+ bit32 OpticalModeRead,
+ bit32 LinkRate,
+ bit32 Mode,
+ bit32 OpticalMode
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+
+ TI_DBG3(("tdsaParseLinkRateMode: index 0x%X\n",index));
+ TI_DBG3(("tdsaParseLinkRateMode: LinkRateRead 0x%X LinkRate 0x%X\n",LinkRateRead,LinkRate));
+ TI_DBG3(("tdsaParseLinkRateMode: ModeRead 0x%X Mode 0x%X\n",ModeRead,Mode));
+ TI_DBG3(("tdsaParseLinkRateMode: OpticalModeRead 0x%X OpticalMode 0x%X\n",OpticalModeRead,OpticalMode));
+
+
+ if (LinkRateRead == agTRUE)
+ {
+ /* link rate */
+ if (LinkRate & 0x1)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x1;
+ }
+ if (LinkRate & 0x2)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x2;
+ }
+ if (LinkRate & 0x4)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x4;
+ }
+ if (LinkRate & 0x8)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x8;
+ }
+ if (LinkRate == 0 || LinkRate > 0xF )
+ {
+ /* not allowed, set the rate to default 1.5 G */
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = 0;
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x1;
+ TI_DBG1(("tdsaParseLinkRateMode: LinkRate == 0 || LinkRate >= 0x%x\n",tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+ TI_DBG2(("tdsaParseLinkRateMode:A index 0x%x LinkRate 0x%x Mode 0x%x\n",index,LinkRate,Mode));
+
+ }
+
+ if ( ModeRead == agTRUE)
+ {
+ /* mode */
+ if (Mode & 0x1)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x10;
+ }
+ if (Mode & 0x2)
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x20;
+ }
+ if (Mode == 0 || Mode >= 4 )
+ {
+ /* not allowed, set the mode to default SAS/SATA */
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties & 0xf;
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x30;
+ }
+ TI_DBG2(("tdsaParseLinkRateMode:1 index 0x%x Mode 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+
+ if ( OpticalModeRead == agTRUE)
+ {
+ /* setting bit20 */
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+
+ if (OpticalMode == 0)
+ {
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 0 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+ else if(OpticalMode == 1)
+ {
+ if(tIsSPCV12or6G(agRoot))
+ {
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 1 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 22);
+ }
+ else
+ {
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 22);
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties &= 0xFFFFFFF0;
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties |= 0x4;
+ }
+ }
+ else if(OpticalMode == 2 )
+ {
+ if(tIsSPCV12or6G(agRoot))
+ {
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 2 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 20);
+ }
+ else
+ {
+ TD_ASSERT(0, "SPC optical mode 2");
+ }
+
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode %d phy %d phyProperties 0x%x\n",OpticalMode,index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+ else
+ {
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode unknown %d phy %d phyProperties 0x%x\n",OpticalMode,index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+ }
+ else
+ {
+ TI_DBG1(("tdsaParseLinkRateMode: OpticalMode off phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+ }
+
+ TI_DBG1(("tdsaParseLinkRateMode: phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
+
+
+ return;
+}
+
+
+/*****************************************************************************
+*! \brief tdsaGetHwConfigParams
+*
+* Purpose: This function reads hardware configuration parameters from the
+* configuration file
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetHwConfigParams(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaHwConfig_t *HwConfig;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char HwParmsStr[] = "HWParms";
+ char phyReg[10];
+ int i,j;
+ agsaPhyAnalogSetupTable_t *phyRegTable;
+
+ TI_DBG6(("tdsaGetHwConfigParams: start\n"));
+ TI_DBG6(("tdsaGetHwConfigParams: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+
+ HwConfig = (agsaHwConfig_t *)&(tdsaAllShared->HwConfig);
+ phyRegTable = (agsaPhyAnalogSetupTable_t *)&(HwConfig->phyAnalogConfig);
+
+ osti_memset(HwConfig, 0, sizeof(agsaHwConfig_t));
+
+ /*
+ just default values
+ and are overwritten later by the configuration file contents
+ turning off hw control interrupt coalescing
+ */
+ tdsaAllShared->FWMaxPorts = DEFAULT_FW_MAX_PORTS; /* 8, applicable only to SPC not to SPCv */
+ HwConfig->phyCount = TD_MAX_NUM_PHYS;
+ HwConfig->hwInterruptCoalescingTimer = 1;
+ HwConfig->hwInterruptCoalescingControl = 0;
+ tdsaAllShared->phyCalibration = 0;
+ HwConfig->hwOption = 0; /* default: PI/CI addresses are 32-bit */
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HwIntCoalTimer", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ HwConfig->hwInterruptCoalescingTimer = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ HwConfig->hwInterruptCoalescingTimer = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HwIntCoalControl", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ HwConfig->hwInterruptCoalescingControl = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ HwConfig->hwInterruptCoalescingControl = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ /* For hwInterruptCoalescingTimer, 0 disables interrrupt, not allowed */
+ if (HwConfig->hwInterruptCoalescingControl == 1 && HwConfig->hwInterruptCoalescingTimer == 0)
+ {
+ HwConfig->hwInterruptCoalescingTimer = 1;
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ /* interrupt reassetion field*/
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "IntReassertionOpt", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ HwConfig->intReassertionOption = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ HwConfig->intReassertionOption = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ /* interrupt reassetion field*/
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "HwOption", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ HwConfig->hwOption = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ HwConfig->hwOption = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ /* interrupt reassetion field*/
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "MaxFWPorts", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->FWMaxPorts = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->FWMaxPorts = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ "phyCalibration", /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->phyCalibration = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->phyCalibration = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+
+ /* phy calibration */
+ for (i=0;i<MAX_INDEX;i++)
+ {
+ for(j=0;j<10;j++)
+ {
+ osti_sprintf(phyReg,"spaReg%d%d",i,j);
+ TI_DBG6(("tdsaGetHwConfigParams: phyReg %s\n", phyReg));
+
+ if (j == 0)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister0 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister0 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 1)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister1 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister1 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 2)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister2 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister2 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 3)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister3 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister3 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 4)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister4 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister4 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 5)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister5 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister5 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 6)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister6 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister6 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 7)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister7 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister7 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 8)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister8 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister8 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+ else if (j == 9)
+ {
+ if ((ostiGetTransportParam(
+ tiRoot,
+ globalStr, /* key */
+ HwParmsStr, /* subkey1 */
+ agNULL, /* subkey2 */
+ agNULL,
+ agNULL,
+ agNULL, /* subkey5 */
+ phyReg, /* valueName */
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister9 = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ phyRegTable->phyAnalogSetupRegisters[i].spaRegister9 = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ }
+
+ } /* inner loop */
+ } /* outer loop */
+ return;
+}
+/*****************************************************************************
+*! \brief tdsaGetCardPhyParams
+*
+* Purpose: This function reads phy-related configuration parameters from the
+* configuration file
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+* \note - just a place holder for now
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetCardPhyParams(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char *globalStr = tdsaAllShared->CardIDString;
+ char phyParmsStr[12];
+ int i;
+ bit32 LinkRate = 15, Mode = 3, OpticalMode = 0; //VG
+ bit32 LinkRateRead = agTRUE, ModeRead = agFALSE, OpticalModeRead = agFALSE;
+ bit32 flag = agFALSE; /* true only for PM8008 or PM8009 (SPCv and SPCve) controller */
+
+ TI_DBG6(("tdsaGetCardPhyParams: start \n"));
+ TI_DBG6(("tdsaGetCardPhyParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
+
+ if (tiIS_8PHY(agRoot))
+ {
+ TI_DBG6(("tdsaGetCardPhyParams: SPCv or SPCve \n"));
+ flag = agTRUE;
+ }
+ TI_DBG6(("tdsaGetCardPhyParams: flag %d\n", flag));
+
+#ifdef REMOVED
+#ifdef FPGA_CARD
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
+ /* 1.5G only, SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 */
+ }
+#else
+#ifdef INITIATOR_DRIVER
+ /* ASIC */
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
+ /* 1.5G/3G , SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x37; /* 55 */
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+ }
+#endif
+
+#ifdef TARGET_DRIVER
+ /* ASIC */
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
+ /* 1.5G/3G , SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x37; /* 55 */
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+ }
+#endif
+
+#endif
+#endif /* REMOVED */
+
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (flag == agFALSE)
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i);
+ }
+ else
+ {
+ if (i >= 4)
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i+4);
+ }
+ else
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i);
+ }
+ }
+
+ TI_DBG6(("tdsaGetCardPhyParams: i %d PhyParms %s\n", i, phyParmsStr));
+
+ TI_DBG2(("tdsaGetCardPhyParams: phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
+
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "AddrHi",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d hi %d \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ }
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "AddrLow",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d lo %d\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ }
+ TI_DBG6(("tdsaGetCardPhyParams: loop phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+
+ /* phy properties */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+/*
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "LinkRate",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ LinkRateRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ LinkRate = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d linkrate 0x%x \n", i, LinkRate));
+ }
+ else
+ {
+ LinkRate = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d linkrate %d \n", i, LinkRate));
+ }
+ }
+
+ TI_DBG2(("tdsaGetCardPhyParams: phy %d linkrate %d \n", i, LinkRate));
+*/
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "Mode",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ ModeRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ Mode = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d Mode 0x%x \n", i, Mode));
+ }
+ else
+ {
+ Mode = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d Mode %d \n", i, Mode));
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "OpticalMode",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ OpticalModeRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d OpticalMode 0x%x \n", i, OpticalMode));
+ }
+ else
+ {
+ OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG6(("tdsaGetCardPhyParams: phy %d OpticalMode %d \n", i, OpticalMode));
+ }
+ }
+
+ tdsaParseLinkRateMode(tiRoot, i, LinkRateRead, ModeRead, OpticalModeRead, LinkRate, Mode, OpticalMode);
+
+ TI_DBG2(("tdsaGetCardPhyParams: phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
+
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ LinkRateRead = agTRUE;//VG
+ ModeRead = agFALSE;
+ OpticalModeRead = agFALSE;
+
+ } /* end for */
+ return;
+}
+
+
+
+
+
+/*****************************************************************************
+*! \brief tdsaGetGlobalPhyParams
+*
+* Purpose: This function reads phy-related configuration parameters from the
+* configuration file
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+* \note - just a place holder for now
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetGlobalPhyParams(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char phyParmsStr[12];
+ int i;
+ bit32 LinkRate = 15/*7*/, Mode = 3, OpticalMode = 0;
+ bit32 LinkRateRead = agFALSE, ModeRead = agFALSE, OpticalModeRead = agFALSE;
+ bit32 flag = agFALSE; /* true only for PM8008 or PM8009 (SPCv and SPCve) controller */
+
+ TI_DBG6(("tdsaGetGlobalPhyParams: start \n"));
+ TI_DBG6(("tdsaGetGlobalPhyParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
+
+ if (tiIS_8PHY(agRoot) )
+ {
+ TI_DBG6(("tdsaGetGlobalPhyParams: SPCv or SPCve \n"));
+ flag = agTRUE;
+ }
+
+ TI_DBG6(("tdsaGetGlobalPhyParams: flag %d\n", flag));
+
+#ifdef FPGA_CARD
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
+ /* 1.5G only, SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 */
+ }
+#else
+ /* ASIC */
+#ifdef INITIATOR_DRIVER
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ if (flag == agFALSE) /* SPC or SPCv+ */
+ {
+ if (0 <= i && i <= 7)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01010101);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x02020202);
+ }
+ }
+ else /* SPCv or SPCve */
+ {
+ if (0 <= i && i <= 3)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
+ }
+ else if (4 <= i && i <= 7)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x02020202);
+ }
+ else /* don't care */
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01010101);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x0f0f0f0f);
+ }
+
+ }
+ /* 1.5G/3G , SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 55 */
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+
+ }
+#endif
+#ifdef TARGET_DRIVER
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ /* setting default phy properties */
+ /* SPC; narrow ports; 8 ports
+ SPCv, SPCve wide port; 8 ports
+ SPCv+ wide port; 16 ports
+ */
+ if (tiIS_SPC(agRoot))
+ {
+ if (0 <= i && i <= 7)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
+ }
+ }
+ else if (tiIS_16PHY(agRoot))
+ {
+ if (0 <= i && i <= 7)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
+ }
+ }
+ else
+ {
+ if (0 <= i && i <= 3)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
+ }
+ else if (4 <= i && i <= 7)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
+ }
+ else /* don't care */
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x0f0f0f0f+i);
+ }
+ }
+ /* 1.5G/3G , SAS/SATA, no spin-up control */
+ tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 The default is 1.5G and will be changed based on the registry value */
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+
+ }
+#endif
+#endif
+
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ /* needs to read Phy's id frame */
+ for (i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (flag == agFALSE)
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i);
+ }
+ else
+ {
+ if (i >= 4)
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i+4);
+ }
+ else
+ {
+ osti_sprintf(phyParmsStr,"PhyParms%d", i);
+ }
+ }
+
+ TI_DBG6(("tdsaGetGlobalPhyParams: i %d PhyParms %s\n", i, phyParmsStr));
+
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "AddrHi",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi %d \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
+
+ }
+ }
+
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "AddrLow",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+ }
+ else
+ {
+ OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
+ TI_DBG6(("tdsaGetGlobalPhyParams: phy %d lo %d\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+
+ }
+ }
+ TI_DBG6(("tdsaGetGlobalPhyParams: loop phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
+
+ /* phy properties */
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+/*
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "LinkRate",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ LinkRateRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ LinkRate = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d linkrate 0x%x \n", i, LinkRate));
+ }
+ else
+ {
+ LinkRate = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d linkrate %d \n", i, LinkRate));
+ }
+ }
+*/
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "Mode",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ ModeRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ Mode = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d Mode 0x%x \n", i, Mode));
+ }
+ else
+ {
+ Mode = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d Mode %d \n", i, Mode));
+ }
+ }
+
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ phyParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "OpticalMode",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ OpticalModeRead = agTRUE;
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 0);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d OpticalMode 0x%x \n", i, OpticalMode));
+ }
+ else
+ {
+ OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 10);
+ TI_DBG2(("tdsaGetGlobalPhyParams: phy %d OpticalMode %d \n", i, OpticalMode));
+ }
+ }
+
+ TI_DBG2(("tdsaGetGlobalPhyParams:A phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
+ tdsaParseLinkRateMode(tiRoot, i, LinkRateRead, ModeRead, OpticalModeRead, LinkRate, Mode, OpticalMode);
+
+ TI_DBG2(("tdsaGetGlobalPhyParams:B phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
+
+
+
+ /**********************************************/
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+ /* restore default */
+ LinkRate = 15;
+ Mode = 3;
+ OpticalMode = 0;
+ LinkRateRead = agTRUE;//VG
+ ModeRead = agFALSE;
+ OpticalModeRead = agFALSE;
+
+
+ } /* end for */
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdsaGetPortParams
+*
+* Purpose: This function reads port-related configuration parameters from the
+* configuration file
+*
+* \param tiRoot: Pointer to driver/port instance.
+*
+* \return: None
+*
+* \note - just a place holder for now
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaGetPortParams(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+
+
+ char *buffer;
+ bit32 buffLen;
+ bit32 lenRecv = 0;
+ char *pLastUsedChar = agNULL;
+ char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
+ char globalStr[] = "Global";
+ char portParmsStr[] = "PortParms";
+
+ TI_DBG6(("tdsaGetPortParams: start \n"));
+ TI_DBG6(("tdsaGetPortParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
+
+ buffer = tmpBuffer;
+ buffLen = sizeof(tmpBuffer);
+ osti_memset(buffer, 0, buffLen);
+
+ if ((ostiGetTransportParam (
+ tiRoot,
+ globalStr,
+ portParmsStr,
+ agNULL,
+ agNULL,
+ agNULL,
+ agNULL,
+ "InterruptDelay",
+ buffer,
+ buffLen,
+ &lenRecv
+ ) == tiSuccess) && (lenRecv != 0))
+ {
+ if (osti_strncmp(buffer, "0x", 2) == 0)
+ {
+ tdsaAllShared->currentInterruptDelay = osti_strtoul (buffer, &pLastUsedChar, 0);
+ }
+ else
+ {
+ tdsaAllShared->currentInterruptDelay = osti_strtoul (buffer, &pLastUsedChar, 10);
+ }
+ TI_DBG6(("tdsaGetPortParams: in \n"));
+ }
+ osti_memset(buffer, 0, buffLen);
+ lenRecv = 0;
+
+ TI_DBG6(("tdsaGetPortParams: out \n"));
+
+ /* and more .... */
+
+
+ return;
+}
+
+#ifdef FW_EVT_LOG_TST
+void saLogDump(agsaRoot_t *agRoot,
+ U32 *eventLogSize,
+ U32 **eventLogAddress);
+
+void tiLogDump(tiRoot_t *tiRoot, U32 *size, U32 **addr)
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+
+ tdsaRoot = (tdsaRoot_t*)tiRoot->tdData;
+ tdsaAllShared = (tdsaContext_t*)&(tdsaRoot->tdsaAllShared);
+ saLogDump(&tdsaAllShared->agRootNonInt, size, addr);
+}
+#endif
+
+
+
+/*****************************************************************************
+*! \brief tiCOMPortInit
+*
+* Purpose: This function is called to initialize the port hardware.
+* This call could only be called until after the successful
+* completion tiCOMInit().
+*
+* \param tiRoot: Pointer to root data structure.
+* \param sysIntsActive: system interrupt flag
+*
+* \return:
+* tiSuccess: Successful.
+* Others: Fail.
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL bit32
+tiCOMPortInit(
+ tiRoot_t *tiRoot,
+ bit32 sysIntsActive
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ agsaRoot_t *agRoot;
+ tiLoLevelResource_t *loResource;
+ bit32 status = tiError;
+ bit32 i;
+
+ agsaQueueConfig_t *QueueConfig;
+
+#ifdef CONTROLLER_STATUS_TESTING
+ static agsaControllerStatus_t agcontrollerStatus;
+#endif /* CONTROLLER_STATUS_TESTING */
+
+#ifdef CONTROLLER_INFO_TESTING
+ static agsaControllerInfo_t agcontrollerInfo;
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_ENCRYPT_TESTING
+ static agsaEncryptInfo_t agsaEncryptInfo;
+#endif /* CONTROLLER_INFO_TESTING */
+
+ static agsaMemoryRequirement_t agMemoryRequirement;
+#ifdef ECHO_TESTING
+ /* temp */
+ static bit8 payload[56];
+#endif
+
+#if defined(FDS_DM) || defined(FDS_SM)
+ static agsaMemoryRequirement_t memRequirement;
+ bit32 maxQueueSets = 0;
+ bit32 LLMemCount = 0;
+ bit32 usecsPerTick = 0;
+ static agsaSwConfig_t tmpLLSwConfig;
+#endif
+
+#ifdef FDS_DM
+ static dmRoot_t *dmRoot = agNULL;
+#ifdef FDS_SM
+ static dmSwConfig_t dmSwConfig;
+#endif
+ static dmMemoryRequirement_t dmMemRequirement;
+ bit32 DMMemCount = 0;
+#endif
+
+#if defined(FDS_DM) && defined(FDS_SM)
+ bit32 dmUsecsPerTick = 0;
+ bit32 dmMaxNumLocks = 0;
+#endif
+
+#ifdef FDS_SM
+ smRoot_t *smRoot = agNULL;
+// smSwConfig_t smSwConfig;
+ static smMemoryRequirement_t smMemRequirement;
+ bit32 SMMemCount = 0;
+#endif
+
+#ifndef TURN_OFF_HDA
+ static agsaFwImg_t HDAImg;
+#endif /* TURN_OFF_HDA */
+
+ TI_DBG3(("tiCOMPortInit: start\n"));
+ TI_DBG6(("tiCOMPortInit: sizeof agsaMemoryRequirement_t %d\n", (int)sizeof(agsaMemoryRequirement_t)));
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
+
+ osti_memset(&agMemoryRequirement, 0, sizeof(agsaMemoryRequirement_t));
+ /*
+ * don't do anything if reset is in progress
+ */
+ if (tdsaAllShared->flags.resetInProgress == agTRUE)
+ {
+ TI_DBG1(("tiCOMPortInit: resetinProgress error\n"));
+ return tiError;
+ }
+
+ loResource = &(tdsaAllShared->loResource);
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ tdsaAllShared->flags.sysIntsActive = sysIntsActive;
+
+ /*
+ gets port-related parameters; not in use for now
+ tdsaGetPortParams(tiRoot);
+ */
+
+ /* call these before agroot is created for testing */
+
+
+#ifdef CONTROLLER_STATUS_TESTING
+ TI_DBG1(("tiCOMPortInit: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_INFO_TESTING
+ TI_DBG1(("tiCOMPortInit: saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_ENCRYPT_TESTING
+ TI_DBG1(("tiCOMPortInit: saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+
+ tdsaGetSwConfigParams(tiRoot);
+ tdsaPrintSwConfig(&(tdsaAllShared->SwConfig));
+
+ /* setting interrupt requirements */
+ tdsaAllShared->SwConfig.max_MSIX_InterruptVectors = loResource->loLevelOption.maxInterruptVectors;
+ tdsaAllShared->SwConfig.max_MSI_InterruptVectors = loResource->loLevelOption.max_MSI_InterruptVectors;
+ tdsaAllShared->SwConfig.legacyInt_X = loResource->loLevelOption.flag;
+ TI_DBG2(("tiCOMPortInit: got max_MSIX_InterruptVectors %d \n", tdsaAllShared->SwConfig.max_MSIX_InterruptVectors));
+ TI_DBG2(("tiCOMPortInit: got max_MSI_InterruptVectors %d \n", tdsaAllShared->SwConfig.max_MSI_InterruptVectors));
+ TI_DBG2(("tiCOMPortInit: got flag - legacyInt_X %d \n", tdsaAllShared->SwConfig.legacyInt_X));
+
+ /* error checking for interrupt types */
+ if (
+ ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.legacyInt_X == 0))
+ ||
+ ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors != 0) &&
+ (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.legacyInt_X == 0))
+ ||
+ ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.max_MSI_InterruptVectors != 0) &&
+ (tdsaAllShared->SwConfig.legacyInt_X == 0))
+ ||
+ ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
+ (tdsaAllShared->SwConfig.legacyInt_X != 0))
+ )
+ {
+ /* do nothing */
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPortInit: incorrect interrupt\n"));
+ return tiError;
+ }
+
+ QueueConfig = &tdsaAllShared->QueueConfig;
+
+ for(i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ QueueConfig->inboundQueues[i].elementCount = tdsaAllShared->InboundQueueSize[i];
+ QueueConfig->inboundQueues[i].elementSize = tdsaAllShared->InboundQueueEleSize[i];
+ QueueConfig->inboundQueues[i].priority = tdsaAllShared->InboundQueuePriority[i];
+ QueueConfig->inboundQueues[i].reserved = 0;
+ TI_DBG6(("tiCOMPortInit: InboundQueuePriroity %d \n", tdsaAllShared->InboundQueuePriority[i]));
+ }
+ for(i=0;i<QueueConfig->numOutboundQueues;i++)
+ {
+ QueueConfig->outboundQueues[i].elementCount = tdsaAllShared->OutboundQueueSize[i];
+ QueueConfig->outboundQueues[i].elementSize = tdsaAllShared->OutboundQueueEleSize[i];
+ QueueConfig->outboundQueues[i].interruptDelay = tdsaAllShared->OutboundQueueInterruptDelay[i]; /* default 0; no interrupt delay */
+ QueueConfig->outboundQueues[i].interruptCount = tdsaAllShared->OutboundQueueInterruptCount[i]; /* default 1 */
+ QueueConfig->outboundQueues[i].interruptEnable = tdsaAllShared->OutboundQueueInterruptEnable[i]; /* default 1 */
+ QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
+ if (tdsaAllShared->SwConfig.max_MSIX_InterruptVectors != 0)
+ {
+ QueueConfig->outboundQueues[i].interruptVectorIndex = i % tdsaAllShared->SwConfig.max_MSIX_InterruptVectors;
+ }
+ else if (tdsaAllShared->SwConfig.max_MSI_InterruptVectors != 0)
+ {
+ QueueConfig->outboundQueues[i].interruptVectorIndex = i % tdsaAllShared->SwConfig.max_MSI_InterruptVectors;
+ }
+ else
+ {
+ QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
+ }
+ TI_DBG6(("tiCOMPortInit: OutboundQueueInterruptDelay %d OutboundQueueInterruptCount %d OutboundQueueInterruptEnable %d\n", tdsaAllShared->OutboundQueueInterruptDelay[i], tdsaAllShared->OutboundQueueInterruptCount[i], tdsaAllShared->OutboundQueueInterruptEnable[i]));
+
+ }
+ /* queue option */
+ QueueConfig->queueOption = tdsaAllShared->QueueOption;
+
+ tdsaAllShared->SwConfig.param3 = (void *)QueueConfig;
+ tdsaAllShared->SwConfig.stallUsec = 10;
+
+ /* finds a first high priority queue for SMP */
+ tdsaAllShared->SMPQNum = 0; /* default */
+ for(i=0;i<QueueConfig->numInboundQueues;i++)
+ {
+ if (QueueConfig->inboundQueues[i].priority != DEFAULT_INBOUND_QUEUE_PRIORITY) /* 0 */
+ {
+ tdsaAllShared->SMPQNum = i;
+ break;
+ }
+ }
+
+ tdsaGetHwConfigParams(tiRoot);
+
+ tdsaPrintHwConfig(&(tdsaAllShared->HwConfig));
+
+#ifdef TARGET_DRIVER
+ /* target, not yet */
+ if (tdsaAllShared->currentOperation & TD_OPERATION_TARGET)
+ {
+ ttdssGetTargetParams(tiRoot);
+ }
+#endif
+
+#if defined(FDS_DM) && defined(FDS_SM)
+ /*
+ needs to call saGetRequirements() to find out agMemoryRequirement.count requested by LL
+ */
+ osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
+
+ saGetRequirements(agRoot,
+ &tmpLLSwConfig,
+ &memRequirement,
+ &usecsPerTick,
+ &maxQueueSets
+ );
+ TI_DBG1(("tiCOMPortInit: usecsPerTick %d\n", usecsPerTick));
+
+ TI_DBG1(("tiCOMPortInit: LL memRequirement.count %d\n", memRequirement.count));
+ TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
+ LLMemCount = memRequirement.count;
+
+ /*
+ needs to call dmGetRequirements() to find out dmMemoryRequirement.count requested by DM
+ */
+
+ dmGetRequirements(dmRoot,
+ &dmSwConfig,
+ &dmMemRequirement,
+ &dmUsecsPerTick,
+ &dmMaxNumLocks
+ );
+
+ TI_DBG1(("tiCOMPortInit: DM dmmemRequirement.count %d\n", dmMemRequirement.count));
+ TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
+
+ DMMemCount = dmMemRequirement.count;
+ SMMemCount = loResource->loLevelMem.count - LLMemCount - DMMemCount;
+ agMemoryRequirement.count = LLMemCount;
+
+ TI_DBG1(("tiCOMPortInit: SMMemCount %d\n", SMMemCount));
+
+
+#elif defined(FDS_DM)
+ /*
+ needs to call saGetRequirements() to find out agMemoryRequirement.count requested by LL
+ */
+ osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
+
+ saGetRequirements(agRoot,
+ &tmpLLSwConfig,
+ &memRequirement,
+ &usecsPerTick,
+ &maxQueueSets
+ );
+
+ TI_DBG1(("tiCOMPortInit: memRequirement.count %d\n", memRequirement.count));
+ TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
+
+ LLMemCount = memRequirement.count;
+ DMMemCount = loResource->loLevelMem.count - LLMemCount;
+
+ agMemoryRequirement.count = LLMemCount;
+
+#elif defined(FDS_SM)
+ osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
+
+ saGetRequirements(agRoot,
+ &tmpLLSwConfig,
+ &memRequirement,
+ &usecsPerTick,
+ &maxQueueSets
+ );
+
+ TI_DBG1(("tiCOMPortInit: memRequirement.count %d\n", memRequirement.count));
+ TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
+
+ LLMemCount = memRequirement.count;
+ SMMemCount = loResource->loLevelMem.count - LLMemCount;
+
+ agMemoryRequirement.count = LLMemCount;
+
+#else
+
+ agMemoryRequirement.count = loResource->loLevelMem.count;
+
+#endif
+
+#if defined(FDS_DM) && defined(FDS_SM)
+ /* for debugging */
+ for(i=0;i<(int)(LLMemCount + DMMemCount + SMMemCount);i++)
+ {
+ TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
+ TI_DBG2(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
+ }
+#endif
+
+ /* initialize */
+ TI_DBG6(("tiCOMPortInit: AGSA_NUM_MEM_CHUNKS %d\n", AGSA_NUM_MEM_CHUNKS));
+ for(i=0;i<AGSA_NUM_MEM_CHUNKS;i++)
+ {
+ agMemoryRequirement.agMemory[i].virtPtr = agNULL;
+ agMemoryRequirement.agMemory[i].osHandle = agNULL;
+ agMemoryRequirement.agMemory[i].phyAddrUpper = 0;
+ agMemoryRequirement.agMemory[i].phyAddrLower = 0;
+ agMemoryRequirement.agMemory[i].totalLength = 0;
+ agMemoryRequirement.agMemory[i].numElements = 0;
+ agMemoryRequirement.agMemory[i].singleElementLength = 0;
+ agMemoryRequirement.agMemory[i].alignment = 0;
+ agMemoryRequirement.agMemory[i].type = 0;
+ agMemoryRequirement.agMemory[i].reserved = 0;
+ }
+
+ for(i=0;i<(int)agMemoryRequirement.count;i++)
+ {
+ TI_DBG2(("tiCOMPortInit: LL copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
+ agMemoryRequirement.agMemory[i].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
+ agMemoryRequirement.agMemory[i].osHandle = loResource->loLevelMem.mem[i].osHandle;
+ agMemoryRequirement.agMemory[i].phyAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
+ agMemoryRequirement.agMemory[i].phyAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
+ agMemoryRequirement.agMemory[i].totalLength = loResource->loLevelMem.mem[i].totalLength;
+ agMemoryRequirement.agMemory[i].numElements = loResource->loLevelMem.mem[i].numElements;
+ agMemoryRequirement.agMemory[i].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
+ agMemoryRequirement.agMemory[i].alignment = loResource->loLevelMem.mem[i].alignment;
+ if (loResource->loLevelMem.mem[i].type == TI_DMA_MEM)
+ {
+ agMemoryRequirement.agMemory[i].type = AGSA_DMA_MEM;
+ }
+ else if (loResource->loLevelMem.mem[i].type == TI_CACHED_MEM)
+ {
+ agMemoryRequirement.agMemory[i].type = AGSA_CACHED_MEM;
+
+ }
+ else if (loResource->loLevelMem.mem[i].type == TI_CACHED_DMA_MEM)
+ {
+ agMemoryRequirement.agMemory[i].type = AGSA_CACHED_DMA_MEM;
+ }
+
+ agMemoryRequirement.agMemory[i].reserved = loResource->loLevelMem.mem[i].reserved;
+ TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
+ TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
+ loResource->loLevelMem.mem[i].physAddrUpper,
+ loResource->loLevelMem.mem[i].physAddrLower,
+ loResource->loLevelMem.mem[i].totalLength,
+ loResource->loLevelMem.mem[i].numElements));
+ TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
+ loResource->loLevelMem.mem[i].singleElementLength,
+ loResource->loLevelMem.mem[i].alignment,
+ loResource->loLevelMem.mem[i].type,
+ loResource->loLevelMem.mem[i].reserved));
+
+ }
+ osti_memset(&(tdsaAllShared->tdFWControlEx), 0, sizeof(tdFWControlEx_t));
+
+ /*
+ * Note: Be sure to call this only once since sallsdk does initialization only once
+ * saInitialize(IN, IN, IN, IN, IN);
+ */
+
+ TI_DBG1(("tiCOMPortInit: tdsaAllShared->tdDeviceIdVendId %x\n",tdsaAllShared->tdDeviceIdVendId));
+ TI_DBG1(("tiCOMPortInit: tdsaAllShared->tdSubVendorId= SUB_VEN_ID %x\n",tdsaAllShared->tdSubVendorId));
+
+ TI_DBG1(("tiCOMPortInit: swConfig->param1 hwDEVICE_ID_VENDID %x\n", tdsaAllShared->SwConfig.param1 ));
+ TI_DBG1(("tiCOMPortInit: swConfig->param2 hwSVID %x\n", tdsaAllShared->SwConfig.param2));
+
+ /*
+ 1. Read hostDirectAccessSupport
+ 2. If set, read HDA images based on chip ID
+ */
+
+ t_MacroCheck(agRoot);
+
+#ifndef TURN_OFF_HDA
+ if (tdsaAllShared->SwConfig.hostDirectAccessSupport != 0)
+ {
+ osti_memset(&HDAImg, 0, sizeof(HDAImg));
+ if (tiIS_SPC(agRoot))
+ {
+ TI_DBG1(("tiCOMPortInit: SPC HDA\n"));
+ HDAImg.aap1Img = (bit8*)(&aap1array);
+ HDAImg.aap1Len = sizeof( aap1array);
+ HDAImg.iopImg = (bit8*)(&ioparray);
+ HDAImg.iopLen = sizeof( ioparray);
+ HDAImg.istrImg = (bit8*)(&istrarray);
+ HDAImg.istrLen = sizeof( istrarray);
+
+ HDAImg.ilaImg = (bit8*)(&ilaarray);
+ HDAImg.ilaLen = sizeof(ilaarray);
+ }
+ else if (tiIS_SPC6V(agRoot))
+ {
+ TI_DBG1(("tiCOMPortInit: SPCv HDA\n"));
+ HDAImg.aap1Img = (bit8*)(&spcv_aap1array);
+ HDAImg.aap1Len = sizeof( spcv_aap1array);
+ HDAImg.iopImg = (bit8*)(&spcv_ioparray);
+ HDAImg.iopLen = sizeof( spcv_ioparray);
+
+ HDAImg.ilaImg = (bit8*)(&spcv_ilaarray);
+ HDAImg.ilaLen = sizeof(spcv_ilaarray);
+ }
+ else if (tIsSPCV12G(agRoot))
+ {
+ TI_DBG1(("tiCOMPortInit: SPCv12G HDA\n"));
+ HDAImg.aap1Img = (bit8*)(&spcv12g_raaearray);
+ HDAImg.aap1Len = sizeof( spcv12g_raaearray);
+ HDAImg.iopImg = (bit8*)(&spcv12g_ioparray);
+ HDAImg.iopLen = sizeof( spcv12g_ioparray);
+
+ HDAImg.ilaImg = (bit8*)(&spcv12g_ilaarray);
+ HDAImg.ilaLen = sizeof(spcv12g_ilaarray);
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPortInit: HDA Mode Unknown chip type 0x%08x\n",ossaHwRegReadConfig32(agRoot,0 )));
+ return tiError;
+ }
+ TI_DBG1(("tiCOMPortInit: HDA aap1Len 0x%08x iopLen 0x%08x ilaLen 0x%08x\n",HDAImg.aap1Len,HDAImg.iopLen,HDAImg.ilaLen ));
+ tdsaAllShared->SwConfig.param4 = &(HDAImg);
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPortInit: HDA off\n"));
+ tdsaAllShared->SwConfig.param4 = agNULL;
+ }
+#endif /* TURN_OFF_HDA */
+
+ if (tiIS_SPC(agRoot))
+ {
+ /* FW config is only for SPC */
+ tdsaAllShared->SwConfig.FWConfig = 0;
+ /* default port recovery timer 0x32 = 50 = 5000ms and port reset timer 3 (300 ms)*/
+ tdsaAllShared->SwConfig.PortRecoveryResetTimer = 0x30032;
+ TI_DBG1(("tiCOMPortInit:only for SPC FWConfig set\n"));
+ }
+
+ tdsaAllShared->SwConfig.fatalErrorInterruptVector = loResource->loLevelOption.maxInterruptVectors > 31 ? 31 : loResource->loLevelOption.maxInterruptVectors -1;
+
+ TI_DBG1(("tiCOMPortInit: SwConfig->FWConfig 0x%x\n", tdsaAllShared->SwConfig.FWConfig));
+ TI_DBG1(("tiCOMPortInit: SwConfig->fatalErrorInterruptVector 0x%x\n", tdsaAllShared->SwConfig.fatalErrorInterruptVector));
+ TI_DBG1(("tiCOMPortInit: loResource->loLevelOption.usecsPerTick %d\n", loResource->loLevelOption.usecsPerTick));
+
+ status = saInitialize(agRoot,
+ &agMemoryRequirement,
+ &(tdsaAllShared->HwConfig),
+ /* &temp_HwConfig, */
+ &(tdsaAllShared->SwConfig),
+ loResource->loLevelOption.usecsPerTick);
+
+ TI_DBG6(("tiCOMPortInit: loResource->loLevelOption.usecsPerTick %d 0x%x\n", loResource->loLevelOption.usecsPerTick, loResource->loLevelOption.usecsPerTick));
+
+ /*TI_DBG6(("tiCOMPortInit: tdsaAllShared->SwConfig.enableDIF %d\n", tdsaAllShared->SwConfig.enableDIF)); */
+ /*TI_DBG6(("tiCOMPortInit: tdsaAllShared->SwConfig.enableEncryption %d\n", tdsaAllShared->SwConfig.enableEncryption)); */
+
+ if(status == AGSA_RC_FAILURE )
+ {
+ TI_DBG1(("tiCOMPortInit: saInitialize AGSA_RC_FAILURE, status 0x%x\n", status));
+ return tiError;
+ }
+
+ if( status == AGSA_RC_VERSION_INCOMPATIBLE)
+ {
+ TI_DBG1(("tiCOMPortInit: saInitialize AGSA_RC_VERSION_INCOMPATIBLE, status 0x%x\n", status));
+ return tiError;
+ }
+
+ /* let's make sdkData same for Int and Non-int agRoots */
+ tdsaAllShared->agRootInt.sdkData = tdsaAllShared->agRootNonInt.sdkData;
+
+
+ /* mark the port as initialized */
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ tdsaAllShared->Ports[i].flags.portInitialized = agTRUE;
+ }
+
+#ifdef INITIATOR_DRIVER //ini. only in stsdkll spec (TP)
+ /* register device registration callback function */
+ TI_DBG6(("tiCOMPortInit: calling saRegisterEventCallback for device registration\n"));
+ status = saRegisterEventCallback(agRoot, OSSA_EVENT_SOURCE_DEVICE_HANDLE_ADDED, (void *)ossaDeviceRegistrationCB);
+ if (status == AGSA_RC_FAILURE)
+ {
+ TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Register failed\n"));
+ }
+ else
+ {
+ TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Register succeeded\n"));
+ }
+#endif
+
+ /* register device deregistration callback function */
+ TI_DBG6(("tiCOMPortInit: calling saRegisterEventCallback for device de-registration\n"));
+ status = saRegisterEventCallback(agRoot, OSSA_EVENT_SOURCE_DEVICE_HANDLE_REMOVED, (void *)ossaDeregisterDeviceHandleCB);
+ if (status == AGSA_RC_FAILURE)
+ {
+ TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Deregister failed\n"));
+ }
+ else
+ {
+ TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Deregister succeeded\n"));
+ }
+
+#ifdef ECHO_TESTING
+ /* temporary to test saEchoCommand() */
+ /*
+ send echo
+ */
+ payload[0] = gEcho;
+ payload[55] = gEcho;
+ TI_DBG2(("tiCOMPortInit: calling saEchoCommand gEcho %d\n", gEcho));
+ saEchoCommand(agRoot, agNULL, tdsaRotateQnumber(tiRoot, agNULL), (void *)&payload);
+ gEcho++;
+#endif
+
+#ifdef CONTROLLER_STATUS_TESTING
+ TI_DBG1(("tiCOMPortInit: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_INFO_TESTING
+ TI_DBG1(("tiCOMPortInit: saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_ENCRYPT_TESTING
+ TI_DBG1(("tiCOMPortInit: saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL,&agsaEncryptInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+
+#ifdef VPD_TESTING
+ /* temporary to test saSetVPDCommand() and saGetVPDCommand */
+ tdsaVPDSet(tiRoot);
+#endif /* VPD_TESTING */
+
+#if defined(FDS_DM) && defined(FDS_SM)
+ /* initialize DM then SM */
+ /* DM */
+ dmRoot = &(tdsaAllShared->dmRoot);
+ osti_memset(&dmMemRequirement, 0, sizeof(dmMemoryRequirement_t));
+
+ dmMemRequirement.count = DMMemCount;
+
+ for(i=LLMemCount;i<(int)(LLMemCount + DMMemCount);i++)
+ {
+ TI_DBG2(("tiCOMPortInit: DM copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
+ dmMemRequirement.dmMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
+ dmMemRequirement.dmMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
+ dmMemRequirement.dmMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
+ dmMemRequirement.dmMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
+ dmMemRequirement.dmMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
+ dmMemRequirement.dmMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
+ dmMemRequirement.dmMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
+ dmMemRequirement.dmMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
+ dmMemRequirement.dmMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
+ dmMemRequirement.dmMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
+ TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
+ TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
+ loResource->loLevelMem.mem[i].physAddrUpper,
+ loResource->loLevelMem.mem[i].physAddrLower,
+ loResource->loLevelMem.mem[i].totalLength,
+ loResource->loLevelMem.mem[i].numElements));
+ TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
+ loResource->loLevelMem.mem[i].singleElementLength,
+ loResource->loLevelMem.mem[i].alignment,
+ loResource->loLevelMem.mem[i].type,
+ loResource->loLevelMem.mem[i].reserved));
+
+ }
+
+ status = dmInitialize(dmRoot,
+ agRoot,
+ &dmMemRequirement,
+ &(tdsaAllShared->dmSwConfig), //&dmSwConfig, /* start here */
+ loResource->loLevelOption.usecsPerTick);
+
+ if(status == DM_RC_FAILURE || status == DM_RC_VERSION_INCOMPATIBLE)
+ {
+ TI_DBG1(("tiCOMPortInit: dmInitialize FAILED, status 0x%x\n", status));
+ return tiError;
+ }
+
+ /* SM */
+ smRoot = &(tdsaAllShared->smRoot);
+ osti_memset(&smMemRequirement, 0, sizeof(smMemoryRequirement_t));
+
+ smMemRequirement.count = SMMemCount;
+
+ for(i=(LLMemCount + DMMemCount);i<(int)(LLMemCount + DMMemCount + SMMemCount);i++)
+ {
+ TI_DBG1(("tiCOMPortInit: SM copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].type = loResource->loLevelMem.mem[i].type;
+ smMemRequirement.smMemory[i-LLMemCount-DMMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
+ TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
+ TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
+ loResource->loLevelMem.mem[i].physAddrUpper,
+ loResource->loLevelMem.mem[i].physAddrLower,
+ loResource->loLevelMem.mem[i].totalLength,
+ loResource->loLevelMem.mem[i].numElements));
+ TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
+ loResource->loLevelMem.mem[i].singleElementLength,
+ loResource->loLevelMem.mem[i].alignment,
+ loResource->loLevelMem.mem[i].type,
+ loResource->loLevelMem.mem[i].reserved));
+
+ }
+
+ status = smInitialize(smRoot,
+ agRoot,
+ &smMemRequirement,
+ &(tdsaAllShared->smSwConfig), //&smSwConfig, /* start here */
+ loResource->loLevelOption.usecsPerTick);
+
+ if(status == SM_RC_FAILURE || status == SM_RC_VERSION_INCOMPATIBLE)
+ {
+ TI_DBG1(("tiCOMPortInit: smInitialize FAILED, status 0x%x\n", status));
+ return tiError;
+ }
+
+#elif defined(FDS_DM)
+ dmRoot = &(tdsaAllShared->dmRoot);
+ osti_memset(&dmMemRequirement, 0, sizeof(dmMemoryRequirement_t));
+
+ dmMemRequirement.count = DMMemCount;
+
+ for(i=LLMemCount;i<(int)(LLMemCount + DMMemCount);i++)
+ {
+ TI_DBG6(("tiCOMPortInit: copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
+ dmMemRequirement.dmMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
+ dmMemRequirement.dmMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
+ dmMemRequirement.dmMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
+ dmMemRequirement.dmMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
+ dmMemRequirement.dmMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
+ dmMemRequirement.dmMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
+ dmMemRequirement.dmMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
+ dmMemRequirement.dmMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
+ dmMemRequirement.dmMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
+ dmMemRequirement.dmMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
+ TI_DBG6(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
+ TI_DBG6(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
+
+ }
+
+ status = dmInitialize(dmRoot,
+ agRoot,
+ &dmMemRequirement,
+ &(tdsaAllShared->dmSwConfig), //&dmSwConfig, /* start here */
+ loResource->loLevelOption.usecsPerTick);
+
+ if(status == DM_RC_FAILURE || status == DM_RC_VERSION_INCOMPATIBLE)
+ {
+ TI_DBG1(("tiCOMPortInit: dmInitialize FAILED, status 0x%x\n", status));
+ return tiError;
+ }
+
+#elif defined(FDS_SM)
+ smRoot = &(tdsaAllShared->smRoot);
+ osti_memset(&smMemRequirement, 0, sizeof(smMemoryRequirement_t));
+
+ smMemRequirement.count = SMMemCount;
+
+ for(i=LLMemCount;i<(int)(LLMemCount + SMMemCount);i++)
+ {
+ TI_DBG6(("tiCOMPortInit: copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
+ smMemRequirement.smMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
+ smMemRequirement.smMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
+ smMemRequirement.smMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
+ smMemRequirement.smMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
+ smMemRequirement.smMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
+ smMemRequirement.smMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
+ smMemRequirement.smMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
+ smMemRequirement.smMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
+ smMemRequirement.smMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
+ smMemRequirement.smMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
+ TI_DBG6(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
+ TI_DBG6(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
+
+ }
+
+ status = smInitialize(smRoot,
+ agRoot,
+ &smMemRequirement,
+ &(tdsaAllShared->smSwConfig), //&smSwConfig, /* start here */
+ loResource->loLevelOption.usecsPerTick);
+
+ if(status == SM_RC_FAILURE || status == SM_RC_VERSION_INCOMPATIBLE)
+ {
+ TI_DBG1(("tiCOMPortInit: smInitialize FAILED, status 0x%x\n", status));
+ return tiError;
+ }
+#else
+ /* nothing */
+#endif /* FDS_DM && FDS_SM */
+
+ /* call these again after agroot is created for testing */
+#ifdef CONTROLLER_STATUS_TESTING
+ TI_DBG1(("tiCOMPortInit:again saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_INFO_TESTING
+ TI_DBG1(("tiCOMPortInit:again saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+#ifdef CONTROLLER_ENCRYPT_TESTING
+ TI_DBG1(("tiCOMPortInit:again saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL,&agsaEncryptInfo ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+/* Enable SGPIO */
+ if (tiSuccess == tiCOMConfigureSgpio(tiRoot, agTRUE))
+ {
+ TI_DBG2(("tiCOMPortInit: Successfully sent request to enable SGPIO\n"));
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPortInit: Failed to enable SGPIO\n"));
+ }
+
+ return tiSuccess;
+}
+
+/*****************************************************************************
+*! \brief SendSgpioRequest
+*
+* Purpose: This function is used to send SGPIO request during initialization
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param regType: Register Type
+* \param regIndex: Register Index
+* \param regCount: Register Count
+* \param writeData: Part of the request
+*
+* \return:
+* tiSuccess on success
+* Other status on failure
+*
+*****************************************************************************/
+static bit32 SendSgpioRequest(
+ tiRoot_t *tiRoot,
+ bit8 regType,
+ bit8 regIndex,
+ bit8 regCount,
+ bit32 *writeData
+ )
+{
+ static bit32 buffer[128] = {0};
+ bit32 status = tiError;
+ bit32 retVal = IOCTL_CALL_FAIL;
+ tiIOCTLPayload_t *agIOCTLPayload = (tiIOCTLPayload_t *) buffer;
+ agsaSGpioReqResponse_t *pSGpioReq = (agsaSGpioReqResponse_t *) &agIOCTLPayload->FunctionSpecificArea[0];
+ agsaSGpioReqResponse_t *pSgpioResponse = (agsaSGpioReqResponse_t *) &agIOCTLPayload->FunctionSpecificArea[0];
+
+ do{
+
+ /* Frame the Ioctl payload */
+ agIOCTLPayload->MajorFunction = IOCTL_MJ_SGPIO;
+ agIOCTLPayload->Length = sizeof(agsaSGpioReqResponse_t);
+
+ /* Frame the SGPIO request */
+ pSGpioReq->smpFrameType = SMP_REQUEST;
+ pSGpioReq->function = AGSA_WRITE_SGPIO_REGISTER;
+ pSGpioReq->registerType = regType;
+ pSGpioReq->registerIndex = regIndex;
+ pSGpioReq->registerCount = regCount;
+ memcpy(pSGpioReq->readWriteData, writeData, regCount * 4);
+
+ /* Send the SGPIO request */
+ sgpioResponseSet = 0;
+ retVal = tdsaSGpioIoctlSetup(tiRoot, agNULL, agIOCTLPayload, agNULL, agNULL);
+ if (retVal != IOCTL_CALL_PENDING)
+ {
+ break;
+ }
+ /* Waiting for SGPIO Response */
+ while(!sgpioResponseSet)
+ {
+ tiCOMDelayedInterruptHandler(tiRoot, 0, 1, tiNonInterruptContext);
+ }
+ sgpioResponseSet = 0;
+ /* Check the ioctl result */
+ if(agIOCTLPayload->Status != IOCTL_ERR_STATUS_OK)
+ {
+ break;
+ }
+ /* Check the sgpio function result */
+ if(pSgpioResponse->functionResult != 0x00)
+ {
+ break;
+ }
+
+ status = tiSuccess;
+
+ }while(0);
+
+ return status;
+}
+
+/*****************************************************************************
+*! \brief tiCOMConfigureSgpio
+*
+* Purpose: This function is used to configure SGPIO during initialization
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param enableSgpio: Enable / Disable SGPIO
+*
+* \return:
+* tiSuccess on success
+* Other status on failure
+*
+*****************************************************************************/
+bit32 tiCOMConfigureSgpio(
+ tiRoot_t *tiRoot,
+ bit8 enableSgpio
+ )
+{
+ bit32 status = tiError;
+ bit32 i;
+ bit8 regCount;
+ bit32 writeData[OSSA_SGPIO_MAX_READ_DATA_COUNT] = {0};
+ agsaSGpioCfg0_t *pCfg0 = (agsaSGpioCfg0_t *) &writeData[0];
+ agsaSGpioCfg1_t *pCfg1 = (agsaSGpioCfg1_t *) &writeData[1];
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *) &tdsaRoot->tdsaAllShared;
+ bit32 phyCount = tdsaAllShared->phyCount;
+
+ if (enableSgpio)
+ {
+ /* Configure both CFG[0] and CFG[1] */
+ regCount = 2;
+
+ /* Enable SGPIO */
+ pCfg0->gpioEnable = 1;
+
+ /* The following are the default values for CFG[1] suggested by SFF-8485 spec */
+ /* Maximum Activity ON: 2 */
+ /* Forced Activity OFF: 1 */
+ pCfg1->maxActOn = 2;
+ pCfg1->forceActOff = 1;
+ }
+ else
+ {
+ /* Configure CFG[0] only */
+ regCount = 1;
+
+ /* Disable SGPIO */
+ pCfg0->gpioEnable = 0;
+ }
+
+ status = SendSgpioRequest(tiRoot, AGSA_SGPIO_CONFIG_REG, 0, regCount, writeData);
+ if((tiSuccess == status) && (enableSgpio))
+ {
+ /* Write default values to transmit registers */
+ /* RegisterCount = Number of phys present in HBA / 4 */
+ regCount = phyCount / 4;
+ for(i = 0; i < regCount; i++)
+ {
+ /* Following are the default values specified in SFF-8485 spec */
+ /* Activity: 5 */
+ /* Locate: 0 */
+ /* Error: 0 */
+ writeData[i] = 0xA0A0A0A0;
+ }
+ status = SendSgpioRequest(tiRoot, AGSA_SGPIO_DRIVE_BY_DRIVE_TRANSMIT_REG, 0, regCount, writeData);
+ }
+
+ return status;
+}
+
+
+/*****************************************************************************
+*! \brief tiCOMPortStart
+*
+* Purpose: This function is called to bring the port hardware online. This
+* call could only be called until after the successful completion
+* tiCOMPortInit().
+*
+* \param tiRoot: Pointer to root data structure.
+* \param portID: A ID for this portal to be used by the TD Layer
+* to get the portal configuration information.
+* \param portalContext: Pointer to the context for this portal.
+* \param option: An option for starting a port
+*
+* \return:
+* tiSuccess: Successful.
+* Others: Fail.
+*
+* \note -
+* If sas or sata initiator, this will be called 8 (the number of phys) times.
+* If both sas and sata initiator, this will be called 16 times
+*
+*****************************************************************************/
+/* portID is used as PhyID
+ Should return always tiSuccess. PortStarted is returned in ossaHwCB()
+*/
+osGLOBAL bit32
+tiCOMPortStart(
+ tiRoot_t * tiRoot,
+ bit32 portID,
+ tiPortalContext_t * portalContext,
+ bit32 option
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
+ agsaSASProtocolTimerConfigurationPage_t SASConfigPage;
+ bit32 status = AGSA_RC_FAILURE;
+ static bit32 IsSendSASConfigPage = agFALSE;
+
+
+ TI_DBG3(("tiCOMPortStart: start portID %d\n", portID));
+
+ /*
+ * return error if reset is in progress
+ */
+ if (tdsaAllShared->flags.resetInProgress == agTRUE)
+ {
+ TI_DBG1(("tiCOMPortStart: reset error\n"));
+ return tiError;
+ }
+
+ /*
+ *
+ * port is not initialized, return error
+ */
+ if (tdsaAllShared->Ports[portID].flags.portInitialized == agFALSE)
+ {
+ TI_DBG1(("tiCOMPortStart: not intialized error\n"));
+ return tiError;
+ }
+
+ /* portal has been started. */
+ if (portalContext->tdData != NULL)
+ {
+ if (tdsaAllShared->Ports[portID].flags.portStarted == agTRUE)
+ {
+ TI_DBG3 (("tiCOMPortStart : Cannot start port again: Port has already been started\n"));
+ ostiPortEvent (
+ tiRoot,
+ tiPortStarted,
+ tiSuccess,
+ (void *) tdsaAllShared->Ports[portID].tiPortalContext
+ );
+ return tiSuccess;
+ }
+ }
+
+ portalContext->tdData = &(tdsaAllShared->Ports[portID]);
+ TI_DBG4 (("tiCOMPortStart : saving portalconext portID %d tdsaAllShared %p\n", portID, tdsaAllShared));
+ /* saving tiportalContext_t */
+ tdsaAllShared->Ports[portID].tiPortalContext = portalContext;
+ TI_DBG4(("tiCOMPortStart : portID/phyID %d tiPortalContext %p\n", portID, tdsaAllShared->Ports[portID].tiPortalContext));
+
+ /*
+ where is "tdsaAllShared->Ports[0].portContext" set?
+ in ossaHWCB
+ */
+ if (tdsaAllShared->Ports[portID].flags.portStarted == agTRUE)
+ {
+ TI_DBG1(("tiCOMPortStart: port already has been started \n"));
+ return tiSuccess;
+ }
+
+
+ /*
+ hardcode sasID frame. It should be read by ostigettransportparams later from configuration file
+ */
+#ifdef INITIATOR_DRIVER
+
+ tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = 0;
+ tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp
+ = SA_IDFRM_SSP_BIT | SA_IDFRM_STP_BIT | SA_IDFRM_SMP_BIT;
+ tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
+
+ tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
+
+#endif
+
+#ifdef TARGET_DRIVER
+
+ tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = SA_IDFRM_SSP_BIT;
+ tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp = 0;
+ tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
+ tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
+
+#endif
+
+#if defined (INITIATOR_DRIVER) && defined (TARGET_DRIVER)
+
+ /* for combo testing */
+ tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = SA_IDFRM_SSP_BIT;
+ tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp
+ = SA_IDFRM_SSP_BIT | SA_IDFRM_STP_BIT | SA_IDFRM_SMP_BIT;
+ tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
+
+ tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
+
+#endif
+
+
+ TI_DBG6(("tiCOMPortStart: before pid %d\n", portID));
+ tdssPrintSASIdentify(&(tdsaAllShared->Ports[portID].SASID));
+
+ TI_DBG6(("tiCOMPortStart: sysIntsActive %s\n",
+ (tdsaAllShared->flags.sysIntsActive == agTRUE) ? "agTRUE" : "agFALSE"));
+
+ /* Read global configuration first then card-specific configuration */
+
+ /* the following must be processed only once */
+ if ( tdsaAllShared->first_process == agFALSE)
+ {
+ tdsaGetGlobalPhyParams(tiRoot);
+ tdsaGetCardPhyParams(tiRoot);
+ tdsaAllShared->first_process = agTRUE;
+ }
+
+ TI_DBG6(("tiCOMPortStart: after pid %d\n", portID));
+ tdssPrintSASIdentify(&(tdsaAllShared->Ports[portID].SASID));
+
+ /*
+ Phy Calibration
+ */
+ if (tdsaAllShared->phyCalibration)
+ {
+ /* Change default phy calibration */
+ tdsaAllShared->Ports[portID].agPhyConfig.phyProperties =
+ (tdsaAllShared->Ports[portID].agPhyConfig.phyProperties) | 0x80;
+ /* Setting index of phy calibration table index
+ portID is used as phy calibration table index
+ */
+ tdsaAllShared->Ports[portID].agPhyConfig.phyProperties =
+ (tdsaAllShared->Ports[portID].agPhyConfig.phyProperties) | (portID << 8);
+ }
+ TI_DBG2(("tiCOMPortStart: tdsaAllShared->Ports[0x%x].agPhyConfig.phyProperties 0x%x\n",
+ portID, tdsaAllShared->Ports[portID].agPhyConfig.phyProperties));
+
+
+ if(gSSC_Disable)
+ {
+ tdsaAllShared->Ports[portID].agPhyConfig.phyProperties = tdsaAllShared->Ports[portID].agPhyConfig.phyProperties | 0x40000;
+ TI_DBG1(("tiCOMPortStart:gSSC_Disable tdsaAllShared->Ports[portID].agPhyConfig.phyProperties 0x%x\n", tdsaAllShared->Ports[portID].agPhyConfig.phyProperties));
+
+ }
+
+ if(tIsSPCV12or6G(agRoot) && !IsSendSASConfigPage) /* Not SPC */
+ {
+ /* call saSetControllerConfig() to set STP_IDLE_TIME; All others are the defaults */
+ osti_memset(&SASConfigPage, 0, sizeof(agsaSASProtocolTimerConfigurationPage_t));
+ SASConfigPage.pageCode = AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE;
+ SASConfigPage.MST_MSI = 3 << 15; /* enables both MCT for SSP target and initiator */
+ SASConfigPage.STP_SSP_MCT_TMO = (tdsaAllShared->STP_MCT_TMO << 16) | tdsaAllShared->SSP_MCT_TMO; /* default of 3200 us for STP and SSP maximum connection time */
+ SASConfigPage.STP_FRM_TMO = (tdsaAllShared->MAX_OPEN_TIME << 24) | (tdsaAllShared->SMP_MAX_CONN_TIMER << 16) | tdsaAllShared->STP_FRM_TMO; /* MAX_OPEN_TIME, SMP_MAX_CONN_TIMER, STP frame timeout */
+ SASConfigPage.STP_IDLE_TMO = tdsaAllShared->stp_idle_time;
+ if (SASConfigPage.STP_IDLE_TMO > 0x3FFFFFF)
+ {
+ SASConfigPage.STP_IDLE_TMO = 0x3FFFFFF;
+ }
+ SASConfigPage.OPNRJT_RTRY_INTVL = (tdsaAllShared->MFD << 16) | tdsaAllShared->OPNRJT_RTRY_INTVL; /* Multi Data Fetach enabled and 2 us for Open Reject Retry interval */
+ SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (tdsaAllShared->DOPNRJT_RTRY_TMO << 16) | tdsaAllShared->COPNRJT_RTRY_TMO; /* 128 us for ORR Timeout for DATA phase and 32 us for ORR Timeout for command phase */
+ SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (tdsaAllShared->DOPNRJT_RTRY_THR << 16) | tdsaAllShared->COPNRJT_RTRY_THR; /* 16 for ORR backoff threshold for DATA phase and 1024 for ORR backoff threshold for command phase */
+ SASConfigPage.MAX_AIP = tdsaAllShared->MAX_AIP; /* MAX AIP. Default is 0x200000 */
+
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.pageCode 0x%08x\n",SASConfigPage.pageCode));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.MST_MSI 0x%08x\n",SASConfigPage.MST_MSI));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n",SASConfigPage.STP_SSP_MCT_TMO));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_FRM_TMO 0x%08x\n",SASConfigPage.STP_FRM_TMO));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_IDLE_TMO 0x%08x\n",SASConfigPage.STP_IDLE_TMO));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n",SASConfigPage.OPNRJT_RTRY_INTVL));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n",SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n",SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR));
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.MAX_AIP 0x%08x\n",SASConfigPage.MAX_AIP));
+
+ status = saSetControllerConfig(agRoot,
+ 0,
+ AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE,
+ sizeof(agsaSASProtocolTimerConfigurationPage_t),
+ &SASConfigPage,
+ agNULL);
+ if (status != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("tiCOMPortStart: calling saSetControllerConfig() failed\n"));
+ }
+ else
+ {
+ TI_DBG2(("tiCOMPortStart: calling saSetControllerConfig() is OK\n"));
+ }
+ IsSendSASConfigPage = agTRUE;
+ }
+ else
+ {
+ TI_DBG1(("tiCOMPortStart: saSetControllerConfig not called tIsSPCV12or6G %d IsSendSASConfigPage %d\n",tIsSPCV12or6G(agRoot),IsSendSASConfigPage));
+ }
+
+ /* maps portID to phyID */
+ status = saPhyStart(agRoot,
+ agNULL,
+ 0,
+ portID,
+ &(tdsaAllShared->Ports[portID].agPhyConfig),
+ &(tdsaAllShared->Ports[portID].SASID)
+ );
+
+ TI_DBG6(("tiCOMPortStart: saPhyStart status %d\n", status));
+
+ if (status == AGSA_RC_SUCCESS)
+ {
+ TI_DBG3(("tiCOMPortStart : calling portstarted\n"));
+ ostiPortEvent(
+ tiRoot,
+ tiPortStarted,
+ tiSuccess,
+ (void *) tdsaAllShared->Ports[portID].tiPortalContext
+ );
+ return tiSuccess;
+ }
+ else
+ {
+ TI_DBG3(("tiCOMPortStart : cant' start port\n"));
+ return tiError;
+ }
+
+}
+
+/*****************************************************************************
+*! \brief tiCOMPortStop
+*
+* Purpose: This function is called to bring the port hardware down.
+*
+* \param tiRoot: Pointer to root data structure.
+* \param portalContext: Pointer to the context for this portal.
+*
+* \return:
+* tiSuccess: Successful.
+* Others: Fail.
+*
+* \note -
+*
+*****************************************************************************/
+osGLOBAL bit32
+tiCOMPortStop (
+ tiRoot_t *tiRoot,
+ tiPortalContext_t *portalContext
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdList_t *PortContextList;
+ tdsaPortContext_t *onePortContext = agNULL;
+ agsaRoot_t *agRoot = agNULL;
+ bit32 i;
+ bit32 found = agFALSE;
+
+#ifdef CONTROLLER_STATUS_TESTING
+ agsaControllerStatus_t agcontrollerStatus;
+#endif /* CONTROLLER_STATUS_TESTING */
+
+
+ TI_DBG3(("tiCOMPortStop: start\n"));
+ /*
+ find the portcontext
+ find phys belonging to that portcotext
+ call saPhyStop for all those phys
+ call saPhyStop()
+ remove the portcontext from the portcontext list
+ */
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+#ifdef CONTROLLER_STATUS_TESTING
+ TI_DBG1(("tiCOMPortStop: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
+#endif /* CONTROLLER_INFO_TESTING */
+
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainPortContextList)))
+ {
+ TI_DBG1(("tiCOMPortStop: empty tdsaPortContext\n"));
+ return tiError;
+ }
+
+ /* find a right portcontext */
+ PortContextList = tdsaAllShared->MainPortContextList.flink;
+ while (PortContextList != &(tdsaAllShared->MainPortContextList))
+ {
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tiCOMPortStop: onePortContext is NULL!!!\n"));
+ return tiError;
+ }
+ if (onePortContext->tiPortalContext == portalContext)
+ {
+ TI_DBG6(("tiCOMPortStop: found; oneportContext ID %d\n", onePortContext->id));
+ found = agTRUE;
+ break;
+ }
+ PortContextList = PortContextList->flink;
+ }
+
+ if (found == agFALSE)
+ {
+ TI_DBG1(("tiCOMPortStop: No corressponding tdsaPortContext\n"));
+ return tiError;
+ }
+
+#ifdef INITIATOR_DRIVER
+ /* reset the fields of portcontext */
+ onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
+ onePortContext->discoveryOptions = AG_SA_DISCOVERY_OPTION_FULL_START;
+#endif /* INITIATOR_DRIVER */
+
+ onePortContext->Count = 0;
+ onePortContext->agContext.osData = onePortContext;
+ for(i=0;i<TD_MAX_NUM_PHYS;i++)
+ {
+ if (onePortContext->PhyIDList[i] == agTRUE)
+ {
+ tdsaAllShared->Ports[i].portContext = agNULL;
+#ifdef CCFLAGS_PHYCONTROL_COUNTS
+ if( tiIS_SPC(agRoot) )
+ {
+
+ saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_GET_ERROR_COUNTS, agNULL);
+ saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_CLEAR_ERROR_COUNTS, agNULL);
+ saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_GET_BW_COUNTS, agNULL);
+ }
+ else
+ {
+ TI_DBG1(("\ntiCOMPortStop: CCFLAGS_PHYCONTROL_COUNTS PHY %d\n",i));
+ saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ERR_COUNTERS_PAGE, i);
+ saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_BW_COUNTERS_PAGE,i);
+ saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE,i);
+ saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_GENERAL_STATUS_PAGE,i);
+ saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE,i);
+
+ TI_DBG1(("tiCOMPortStop: CCFLAGS_PHYCONTROL_COUNTS PHY %d\n",i));
+
+ }
+
+#endif /* CCFLAGS_PHYCONTROL_COUNTS */
+ saPhyStop(agRoot, &onePortContext->agContext, 0, i);
+ }
+ }
+
+ return tiSuccess;
+}
+
+
+/*****************************************************************************
+*! \brief tiCOMGetPortInfo
+*
+* Purpose: This function is called to return information about the specific
+* port instant
+*
+*
+* \param tiRoot: Pointer to driver/port instance.
+* \param portalContext Pointer to the context for this portal.
+* \param tiPortInfo: Pointer to port information structure.
+*
+* \Return: tiSuccess
+*
+*****************************************************************************/
+/*
+ can't find tdsaportcontext in this function
+ since discovery has not been called by OS layer yet
+ Therefore, hardcoded value are being returned for now
+*/
+osGLOBAL bit32 tiCOMGetPortInfo(
+ tiRoot_t *tiRoot,
+ tiPortalContext_t *portalContext,
+ tiPortInfo_t *tiPortInfo
+ )
+
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdList_t *PortContextList;
+ tdsaPortContext_t *onePortContext = agNULL;
+ bit32 found = agFALSE;
+ static bit8 localname[68], remotename[68];
+
+ TI_DBG6(("tiCOMGetPortInfo: start\n"));
+
+
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainPortContextList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ TI_DBG1(("tiCOMGetPortInfo: No tdsaPortContext\n"));
+ return tiError;
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+
+ /* find a corresponding portcontext */
+ PortContextList = tdsaAllShared->MainPortContextList.flink;
+ while (PortContextList != &(tdsaAllShared->MainPortContextList))
+ {
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ TI_DBG3(("tiCOMGetPortInfo: oneportContext pid %d\n", onePortContext->id));
+ if (onePortContext->tiPortalContext == portalContext && onePortContext->valid == agTRUE)
+ {
+ TI_DBG3(("tiCOMGetPortInfo: found; oneportContext pid %d\n", onePortContext->id));
+ found = agTRUE;
+ break;
+ }
+ PortContextList = PortContextList->flink;
+ }
+
+ if (found == agFALSE)
+ {
+ TI_DBG1(("tiCOMGetPortInfo: First, No corresponding tdsaPortContext\n"));
+ return tiError;
+ }
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tiCOMGetPortInfo: Second, No corressponding tdsaPortContext\n"));
+ return tiError;
+ }
+
+ osti_memset(localname, 0, sizeof(localname));
+ osti_memset(remotename, 0, sizeof(remotename));
+
+ /*
+ Parse the type of port then fill in the information
+ */
+ if ( onePortContext->sasRemoteAddressHi == 0xFFFFFFFF && onePortContext->sasRemoteAddressLo == 0xFFFFFFFF)
+ {
+ /* directly attached SATA port */
+ osti_memcpy(localname, &(onePortContext->sasLocalAddressHi), 4);
+ osti_memcpy(&(localname[4]), &(onePortContext->sasLocalAddressLo), 4);
+ tiPortInfo->localNameLen = 8;
+ /* information is from SATA ID device data. remoteName is serial number, firmware version, model number */
+ osti_memcpy(remotename, onePortContext->remoteName, 68);
+ tiPortInfo->remoteNameLen = 68;
+ }
+ else
+ {
+ /* copy hi address and low address */
+ osti_memcpy(localname, &(onePortContext->sasLocalAddressHi), 4);
+ osti_memcpy(&(localname[4]), &(onePortContext->sasLocalAddressLo), 4);
+ tiPortInfo->localNameLen = 8;
+ osti_memcpy(remotename, &(onePortContext->sasRemoteAddressHi), 4);
+ osti_memcpy(&(remotename[4]), &(onePortContext->sasRemoteAddressLo), 4);
+ tiPortInfo->remoteNameLen = 8;
+ }
+
+ tiPortInfo->localName = (char *)&localname;
+ tiPortInfo->remoteName = (char *)&remotename;
+
+
+ return tiSuccess;
+
+}
+
+/*****************************************************************************
+*
+* tiCOMSetControllerConfig
+*
+* Purpose: This function is called to set the controller's advanced configuration.
+* The status is reported via ostiPortEvent().
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess: The setting controller configuration was started.
+* tiError: The setting controller configuration was not started.
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMSetControllerConfig (
+ tiRoot_t *tiRoot,
+ bit32 modePage,
+ bit32 length,
+ void *buffer,
+ void *context)
+{
+ agsaRoot_t *agRoot;
+ bit32 returnCode = AGSA_RC_BUSY;
+ bit32 tiStatus = tiSuccess;
+ tdsaRoot_t *tdsaRoot ;
+ tdsaContext_t *tdsaAllShared ;
+
+ TD_ASSERT(tiRoot, "tiRoot");
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot, "tdsaRoot");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot, "agRoot");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ TI_DBG1(("tiCOMSetControllerConfig:\n" ));
+
+ /*do some sanity checking */
+ if ( ((modePage == TI_INTERRUPT_CONFIGURATION_PAGE) && (length != sizeof(tiInterruptConfigPage_t ))) ||
+ ((modePage == TI_ENCRYPTION_GENERAL_CONFIG_PAGE) && (length != sizeof(tiEncryptGeneralPage_t ))) ||
+ ((modePage == TI_ENCRYPTION_DEK_CONFIG_PAGE) && (length != sizeof(tiEncryptDekConfigPage_t))) ||
+ ((modePage == TI_ENCRYPTION_CONTROL_PARM_PAGE) && (length != sizeof(tiEncryptControlParamPage_t ))) ||
+ ((modePage == TI_ENCRYPTION_HMAC_CONFIG_PAGE) && (length != sizeof(tiEncryptHMACConfigPage_t ))) ||
+ ((modePage == TI_SAS_PROTOCOL_TIMER_CONFIG_PAGE) && (length != sizeof(tiSASProtocolTimerConfigurationPage_t ))) )
+ {
+ tiStatus = tiError;
+ }
+ else
+ {
+ returnCode = saSetControllerConfig(agRoot, 0, modePage, length, buffer, context);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+ }
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMGetControllerConfig
+*
+* Purpose: This function is called to get the controller's advanced configuration.
+* The status is reported via ostiPortEvent().
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* flag: Interrupt Vector Mask
+* This parameter is valid only when modePage is set to TI_INTERRUPT_CONFIGURATION_PAGE.
+* When the modePage field is set to TI_INTERRUPT_CONFIGURATION_PAGE,
+* this field contains a bitmap of interrupt vectors for which interrupt coalescing parameters are retrieved.
+* Return:
+* tiSuccess: The controller configuration retrival was started.
+* tiError: The controller configuration retrival was not started.
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMGetControllerConfig (
+ tiRoot_t *tiRoot,
+ bit32 modePage,
+ bit32 flag,
+ void *context)
+
+{
+ agsaRoot_t *agRoot;
+ bit32 returnCode = AGSA_RC_BUSY;
+ bit32 tiStatus = tiSuccess;
+ tdsaRoot_t *tdsaRoot ;
+ tdsaContext_t *tdsaAllShared ;
+
+ TD_ASSERT(tiRoot, "tiRoot");
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot, "tdsaRoot");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot, "agRoot");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ TI_DBG1(("tiCOMGetControllerConfig: modePage 0x%x context %p\n",modePage,context ));
+
+ returnCode = saGetControllerConfig(agRoot, 0, modePage, flag, 0, context);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiSuccess\n",modePage ));
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiBusy\n",modePage ));
+ }
+ else
+ {
+ tiStatus = tiError;
+ TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiError\n",modePage ));
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptGetInfo
+*
+* Purpose: This function is called to return information about the encryption
+* engine for the specified port.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess The request is being processed
+* tiNotSupported Encryption is not supported
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMEncryptGetInfo(tiRoot_t *tiRoot)
+{
+ tiEncryptInfo_t tiEncryptInfo;
+ agsaEncryptInfo_t agsaEncryptInfo;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot;
+ tiEncryptPort_t tiEncryptPort;
+ bit32 returnCode;
+ bit32 tiStatus;
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ returnCode = saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo);
+ TI_DBG1(("tiCOMEncryptGetInfo: returnCode 0x%x\n", returnCode));
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+
+ /*
+ * The data encoded in the agsaEncryptInfo must be converted
+ * to match the fields of the tiEncryptInfo structure.
+ *
+ * No sector information is currently available.
+ */
+ osti_memset(&tiEncryptInfo, 0x0, sizeof(tiEncryptInfo_t));
+
+ /* cipher mode */
+ if (agsaEncryptInfo.encryptionCipherMode == agsaEncryptCipherModeXTS)
+ {
+ tiEncryptInfo.securityCipherMode = TI_ENCRYPT_ATTRIB_CIPHER_XTS;
+ }
+ /* security mode */
+ if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMF)
+ {
+ tiEncryptInfo.securityCipherMode |= TI_ENCRYPT_SEC_MODE_FACT_INIT;
+ }
+ else if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMA)
+ {
+ tiEncryptInfo.securityCipherMode |= TI_ENCRYPT_SEC_MODE_A;
+ }
+ else if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMB)
+ {
+ tiEncryptInfo.securityCipherMode |= TI_ENCRYPT_SEC_MODE_B;
+ }
+
+ tiEncryptInfo.status = agsaEncryptInfo.status;
+
+ tiEncryptPort.pData = &tiEncryptInfo;
+
+ /* The low level returns synchronously, so fake a port event now.*/
+ tiEncryptPort.encryptEvent = tiEncryptGetInfo;
+ tiEncryptPort.subEvent = 0;
+
+ ostiPortEvent(tiRoot,tiEncryptOperation,tiStatus,&tiEncryptPort);
+ }
+ else
+ {
+ if (returnCode == AGSA_RC_NOT_SUPPORTED)
+ {
+ tiStatus = tiNotSupported;
+ TI_DBG1(("tiCOMEncryptGetInfo: tiNotSupported\n"));
+ }
+ else
+ {
+ TI_DBG1(("tiCOMEncryptGetInfo: tiError returnCode 0x%x\n",returnCode));
+ tiStatus = tiError;
+ }
+
+ tiEncryptPort.pData = NULL;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptSetMode
+*
+* Purpose: This function is called to set the encryption security and cipher modes
+* for the encryption engine.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError The encryption engine is not in factory init mode or multiple
+* security modes were specified.
+*
+*****************************************************************************/
+
+osGLOBAL bit32 tiCOMEncryptSetMode(tiRoot_t *tiRoot,
+ bit32 securityCipherMode)
+{
+ bit32 returnCode;
+ bit32 tiStatus;
+ agsaEncryptInfo_t mode;
+ agsaEncryptInfo_t *pmode = &mode;
+
+ tdsaRoot_t *tdsaRoot ;
+ tdsaContext_t *tdsaAllShared;
+ agsaRoot_t *agRoot;
+
+ TD_ASSERT(tiRoot, "tiRoot");
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot, "tdsaRoot");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot, "agRoot");
+
+ pmode->encryptionSecurityMode = 0;
+ pmode->encryptionCipherMode = 0;
+ pmode->status = 0;
+
+ TI_DBG1(("tiCOMEncryptSetMode:\n"));
+
+
+ if(( securityCipherMode & TI_ENCRYPT_SEC_MODE_A ) == TI_ENCRYPT_SEC_MODE_A)
+ {
+ pmode->encryptionSecurityMode = agsaEncryptSMA;
+ }
+
+ if(( securityCipherMode & TI_ENCRYPT_SEC_MODE_B ) == TI_ENCRYPT_SEC_MODE_B)
+ {
+ pmode->encryptionSecurityMode = agsaEncryptSMB;
+ }
+
+ if( (securityCipherMode & TI_ENCRYPT_ATTRIB_CIPHER_XTS) == TI_ENCRYPT_ATTRIB_CIPHER_XTS)
+ {
+ pmode->encryptionCipherMode |= agsaEncryptCipherModeXTS;
+ }
+
+ /* ECB is not supported in SPCv */
+ if(( securityCipherMode & TI_ENCRYPT_ATTRIB_CIPHER_ECB) == TI_ENCRYPT_ATTRIB_CIPHER_ECB)
+ {
+ return tiError;
+ }
+
+ returnCode = saEncryptSetMode(agRoot,agNULL, 0, pmode );
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ TI_DBG1(("tiCOMEncryptSetMode:tiBusy\n"));
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ TI_DBG1(("tiCOMEncryptSetMode:tiError\n"));
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptDekAdd
+*
+* Purpose: This function is called to add a DEK to the controller cache.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* kekIndext: Index of the KEK table
+* dekTableSelect: Number of the DEK table receiving a new entry
+* dekAddrHi: Upper 32-bits of the DEK table physical address
+* dekAddrLo: Lower 32-bits of the DEK table physical address
+* dekIndex: Number of the first entry in the DEK table that will inserted in the cache
+* dekNumberOfEntries: Number of entries to be inserted in the cache
+* dekBlobFormat: Specifies the DEK blob format
+* dekTableKeyEntrySize: Encoded value for DEK Entry Size in the DEK Table
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMEncryptDekAdd(tiRoot_t *tiRoot,
+ bit32 kekIndex,
+ bit32 dekTableSelect,
+ bit32 dekAddrHi,
+ bit32 dekAddrLo,
+ bit32 dekIndex,
+ bit32 dekNumberOfEntries,
+ bit32 dekBlobFormat,
+ bit32 dekTableKeyEntrySize
+
+ )
+{
+ agsaRoot_t *agRoot;
+ bit32 returnCode;
+ bit32 tiStatus;
+ tdsaRoot_t *tdsaRoot ;
+ tdsaContext_t *tdsaAllShared ;
+
+ TD_ASSERT(tiRoot, "tiRoot");
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot, "tdsaRoot");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot, "agRoot");
+
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+
+ TI_DBG1(("tiCOMEncryptDekAdd:\n" ));
+
+ returnCode = saEncryptDekCacheUpdate(agRoot,
+ agNULL,
+ 0,
+ kekIndex,
+ dekTableSelect,
+ dekAddrHi,
+ dekAddrLo,
+ dekIndex,
+ dekNumberOfEntries,
+ dekBlobFormat,
+ dekTableKeyEntrySize
+ );
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptDekInvalidate
+*
+* Purpose: This function is called to remove a DEK entry from the hardware cache.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* dekTable DEK table that will be affected
+* dekIndex: DEK table entry that will be affected. The value 0xfffffff clears the cache.
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy An operation is already in progress
+*
+*****************************************************************************/
+
+osGLOBAL bit32 tiCOMEncryptDekInvalidate(tiRoot_t *tiRoot,
+ bit32 dekTable,
+ bit32 dekIndex)
+{
+
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+
+ agsaRoot_t *agRoot;
+ tiEncryptPort_t tiEncryptPort;
+ tiEncryptDek_t tiEncryptDek;
+ bit32 returnCode;
+ bit32 tiStatus;
+
+ TD_ASSERT(tiRoot, "tiRoot");
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot, "tdsaRoot");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared, "tdsaAllShared");
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot, "agRoot");
+
+ TI_DBG1(("tiCOMEncryptDekInvalidate:dekTable 0x%x dekIndex 0x%x\n", dekTable, dekIndex));
+
+ returnCode = saEncryptDekCacheInvalidate(agRoot, agNULL, 0, dekTable, dekIndex);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else
+ {
+ if (returnCode == AGSA_RC_NOT_SUPPORTED)
+ {
+ tiStatus = tiNotSupported;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ tiEncryptDek.dekTable = dekTable;
+ tiEncryptDek.dekIndex = dekIndex;
+
+ tiEncryptPort.encryptEvent = tiEncryptDekInvalidate;
+ tiEncryptPort.subEvent = 0;
+ tiEncryptPort.pData = (void *) &tiEncryptDek;
+
+ ostiPortEvent(tiRoot,tiEncryptOperation,tiStatus,&tiEncryptPort);
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptKekAdd
+*
+* Purpose: This function is called to add a KEK in the register specified by
+* the index parameter.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* kekIndex: KEK table entry that will be affected
+* wrapperKekIndex KEK table entry that encrypt the KEK blob
+* encryptKekBlob KEK blob that will be added
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy A KEK operation is already in progress
+*
+*****************************************************************************/
+
+osGLOBAL bit32 tiCOMEncryptKekAdd(tiRoot_t *tiRoot,
+ bit32 kekIndex,
+ bit32 wrapperKekIndex,
+ bit32 blobFormat,
+ tiEncryptKekBlob_t *encryptKekBlob)
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ agsaRoot_t *agRoot;
+
+ bit32 returnCode= AGSA_RC_BUSY;
+ bit32 tiStatus= tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+ TI_DBG1(("tiCOMEncryptDekInvalidate: kekIndex 0x%x wrapperKekIndex 0x%x\n", kekIndex , wrapperKekIndex));
+
+ returnCode = saEncryptKekUpdate(agRoot,
+ agNULL,
+ 0,
+ AGSA_ENCRYPT_STORE_NVRAM,
+ kekIndex,
+ wrapperKekIndex,
+ blobFormat,
+ (agsaEncryptKekBlob_t *) encryptKekBlob);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+#ifdef HIALEAH_ENCRYPTION
+
+osGLOBAL bit32 tiCOMEncryptHilSet(tiRoot_t *tiRoot )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ agsaRoot_t *agRoot;
+ agsaEncryptInfo_t agsaEncryptInfo;
+
+ bit32 returnCode= tiBusy;
+ bit32 tiStatus= tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+
+
+ returnCode = saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo);
+ TI_DBG1(("tiCOMEncryptHilSet: saEncryptGetMode returnCode 0x%x agsaEncryptInfo status 0x%x Smode 0x%x CMode 0x%x\n",
+ returnCode,
+ agsaEncryptInfo.status,
+ agsaEncryptInfo.encryptionSecurityMode,
+ agsaEncryptInfo.encryptionCipherMode ));
+
+ if (returnCode == AGSA_RC_FAILURE)
+ {
+ TI_DBG1(("tiCOMEncryptHilSet:agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
+ if(agsaEncryptInfo.status == 0x81)
+ {
+ TI_DBG1(("tiCOMEncryptHilSet: status 0x80 KEY CARD MISMATCH agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
+ returnCode = saEncryptHilUpdate(agRoot,
+ agNULL,
+ 0 );
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("tiCOMEncryptHilSet:AGSA_RC_SUCCESS\n"));
+ }
+ }
+ else if(agsaEncryptInfo.status == 0x80)
+ {
+ ostidisableEncryption(tiRoot);
+ TI_DBG1(("tiCOMEncryptHilSet: status 0x80 KEY CARD MISSING agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
+ returnCode = AGSA_RC_SUCCESS;
+ }
+ else
+ {
+ TI_DBG1(("tiCOMEncryptHilSet: not status 0x81 agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
+ returnCode = AGSA_RC_FAILURE;
+ }
+ }
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ TI_DBG1(("tiCOMEncryptHilSet:AGSA_RC_BUSY\n"));
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ TI_DBG1(("tiCOMEncryptHilSet:tiError\n"));
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+#endif /* HIALEAH_ENCRYPTION */
+
+/*****************************************************************************
+*
+* tiCOMEncryptKekStore
+*
+* Purpose: This function is called to store a KEK in NVRAM. If -1 is specified
+* as the KEK index, then all KEKs will be stored.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* kekIndex: The KEK to be stored in NVRAM
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy A KEK operation is already in progress
+*
+*****************************************************************************/
+
+osGLOBAL bit32 tiCOMEncryptKekStore(tiRoot_t *tiRoot,
+ bit32 kekIndex)
+{
+#ifdef NOT_YET
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ agsaRoot_t *agRoot;
+#endif
+/*
+ bit32 returnCode= AGSA_RC_BUSY;
+*/
+ bit32 tiStatus = tiError;
+
+#ifdef NOT_YET
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+#endif
+
+ TI_DBG1(("tiCOMEncryptKekStore: Needs code !!!! kekIndex 0x%x\n", kekIndex ));
+/*
+ returnCode = fcEncryptKekStore(agRoot, kekIndex);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus;
+ }
+*/
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptKekLoad
+*
+* Purpose: This function is called to load a KEK from NVRAM. If -1 is specified
+* as the KEK index, then all KEKs will be loaded.
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* kekIndex: The KEK to be loaded in NVRAM
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy A KEK operation is already in progress
+*
+*****************************************************************************/
+
+osGLOBAL bit32 tiCOMEncryptKekLoad(tiRoot_t *tiRoot,
+ bit32 kekIndex)
+{
+#ifdef NOT_YET
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaRoot_t *agRoot;
+ //bit32 returnCode;
+#endif
+ bit32 tiStatus = tiError;
+
+#ifdef NOT_YET
+ agRoot = &(tdsaAllShared->agRootNonInt);
+#endif
+/*
+ returnCode = fcEncryptKekLoad(agRoot, kekIndex);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+*/
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMEncryptSelfTest
+*
+* Purpose: This function starts the encryption self test. For the encryption self test, IOs must be quiesced.
+* The completion of this function is via ostiPortEvent().
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* type: Types of test
+ 0x1: tiBISTTest
+ 0x2: tiHMACTest
+ Others are reserved.
+* length:
+ Size of the test descriptor in bytes, e.g.,
+ Sizeof(tiEncryptSelfTestDescriptor_t)
+ Sizeof(tiEncryptHMACTestDescriptor_t)
+* TestDescriptor address of the test descriptor structure.
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy A encrytion operation is already in progress
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMEncryptSelfTest(
+ tiRoot_t *tiRoot,
+ bit32 type,
+ bit32 length,
+ void *TestDescriptor
+ )
+{
+ tdsaRoot_t *tdsaRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+ agsaRoot_t *agRoot = agNULL;
+
+ bit32 returnCode = AGSA_RC_BUSY;
+ bit32 tiStatus = tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
+
+ TI_DBG1(("tiCOMEncryptSelfTest: type = 0x%x length = 0x%x\n", type, length));
+
+ /*do some sanity checking */
+ if ( ((type == TI_ENCRYPTION_TEST_TYPE_BIST) && (length != sizeof(tiEncryptSelfTestDescriptor_t ))) ||
+ ((type == TI_ENCRYPTION_TEST_TYPE_HMAC) && (length != sizeof(tiEncryptHMACTestDescriptor_t))) )
+ {
+ TI_DBG1(("tiCOMEncryptSelfTest: type or length error, type 0x%x length 0x%x\n", type, length));
+ tiStatus = tiError;
+ }
+ else
+ {
+ returnCode = saEncryptSelftestExecute(agRoot,
+ agNULL,
+ 0,
+ type,
+ length,
+ TestDescriptor
+ );
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMSetOperator
+*
+* Purpose: This function is called to login to or logout out from the controller by an operator.
+ The status is reported via ostiPortEvent().
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* flag: operator flag.
+ Bits 0-3: Access type (ACS)
+ 0x1: Login
+ 0x2: Logout
+ All others are reserved.
+ Bit 4: KEYopr pinned in the KEK table (PIN)
+ 0: Not pinned. Operator ID table will be searched during authentication.
+ 1: Pinned. OPRIDX is referenced to unwrap the certificate.
+ Bits 5-7: Reserved
+ Bits 8-15: KEKopr Index in the KEK Table (OPRIDX). If KEKopr is pinned in the KEK table, OPRIDX is to reference the KEK for authentication
+ Bits 16-31: Reserved.
+
+ cert: The pointer to the operator's certificate. The size of the certificate is 40 bytes.
+*
+* Return:
+* tiSuccess Log in or log out was started.
+* tiError Log in or log out was not started.
+* tiBusy A operator management operation is already in progress
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMSetOperator(
+ tiRoot_t *tiRoot,
+ bit32 flag,
+ void *cert
+ )
+{
+ tdsaRoot_t *tdsaRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+ agsaRoot_t *agRoot = agNULL;
+
+ bit32 returnCode = AGSA_RC_FAILURE;
+ bit32 tiStatus = tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
+
+ TI_DBG1(("tiCOMSetOperator: flag = 0x%x \n", flag));
+
+ returnCode = saSetOperator(agRoot,
+ agNULL,
+ 0,
+ flag,
+ cert);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMGetOperator
+*
+* Purpose: This function is used to retrieve the role and ID of the current operator or all operators.
+ The status is reported via ostiPortEvent().
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* option: Types of get operations
+ 0x1: Current operator only
+ 0x2: All operators
+ All others are reserved.
+ AddrHi Upper 32-bit host physical address to store operator certificates.
+ This field is used only when option is 0x2
+ AddrLo Lower 32-bit host physical address to store operator certificates.
+ This field is used only when option is 0x2
+*
+* Return:
+* tiSuccess The operation was started..
+* tiError The operation was not started.
+* tiBusy A operator management operation is already in progress
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMGetOperator(
+ tiRoot_t *tiRoot,
+ bit32 option,
+ bit32 AddrHi,
+ bit32 AddrLo
+ )
+{
+ tdsaRoot_t *tdsaRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+ agsaRoot_t *agRoot = agNULL;
+
+ bit32 returnCode = AGSA_RC_FAILURE;
+ bit32 tiStatus = tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
+
+ TI_DBG1(("tiCOMGetOperator: option = 0x%x \n", option));
+
+ returnCode = saGetOperator(agRoot,
+ agNULL,
+ 0,
+ option,
+ AddrHi,
+ AddrLo);
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*
+* tiCOMOperationManagement
+*
+* Purpose: this function is used to manage operators, e.g. adding or deleting an operator..
+*
+* Parameters:
+*
+* tiRoot: Pointer to driver/port instance.
+* flag: operation flag.
+ Bits 0-7: Operator Management Operation(OMO)
+ 0: Add an operator.
+ 1: Delete an operator.
+ 2: Delete all operators.
+ Others are reserved.
+ Bit 8: Pinned to KEK RAM (PKR)
+ 0: Operator's KEK is stored in the operator ID table(OID_TLB) only.
+ 1: Operator's KEK is pinned to the internal KEK RAM (1 of the 16 entries) and is also stored in OID_TLB.
+ Bits 9-10: KEKopr blob format (KBF)
+ 00b: Reserved.
+ 01b: AGSA_ENCRYPTED_KEK_PMCA.
+ 10b: AGSA_ENCRYPTED_KEK_PMCB.
+ 11b: Reserved.
+ Bits 11-15: Reserved
+ Bits 16-23: KEKauth Index in the KEK Table (AUTIDX)
+ Bits 24-31: KEKopr Index in the KEK Table (OPRIDX). This field is valid only when PKR is 1.
+
+ role Role
+ 01b: Crypto officer role.
+ 10b: User role.
+ All others are reserved.
+
+* idString: Pointer to the tiID_t structure describing the ID string
+* kekBlob Pointer to the tiEncryptKekBlob_t structure describing KBLOB.
+*
+* Return:
+* tiSuccess The request is being processed
+* tiError An invalid parameter was specified
+* tiBusy A operator management operation is already in progress
+*
+*****************************************************************************/
+osGLOBAL bit32 tiCOMOperatorManagement(
+ tiRoot_t *tiRoot,
+ bit32 flag,
+ bit8 role,
+ tiID_t *idString,
+ tiEncryptKekBlob_t *kekBlob
+ )
+{
+ tdsaRoot_t *tdsaRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+ agsaRoot_t *agRoot = agNULL;
+
+ bit32 returnCode = AGSA_RC_BUSY;
+ bit32 tiStatus = tiError;
+
+ tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
+
+ tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
+
+ agRoot = &(tdsaAllShared->agRootNonInt);
+ TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
+
+ TI_DBG1(("tiCOMOperatorManagement: flag = 0x%x role = 0x%x\n", flag, role));
+
+ returnCode = saOperatorManagement(agRoot,
+ agNULL,
+ 0,
+ flag,
+ role,
+ (agsaID_t*)idString,
+ (agsaEncryptKekBlob_t *)kekBlob
+ );
+
+ if (returnCode == AGSA_RC_SUCCESS)
+ {
+ tiStatus = tiSuccess;
+ }
+ else if (returnCode == AGSA_RC_BUSY)
+ {
+ tiStatus = tiBusy;
+ }
+ else
+ {
+ tiStatus = tiError;
+ }
+
+ return(tiStatus);
+}
+
+/*****************************************************************************
+*! \brief tdssRemoveSASSATAFromSharedcontext
+*
+* Purpose: This function removes all discovered devices belonging to
+* a given portcontext from device list
+*
+*
+* \param agRoot Pointer to the root data structure of
+* TD and Lower layer
+* \param tsddPortContext_Instance Pointer to the target port context
+*
+* \Return: none
+*
+*****************************************************************************/
+#ifdef INITIATOR_DRIVER /*TBD: added to compile tgt_drv. (TP)*/
+osGLOBAL void
+tdssRemoveSASSATAFromSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *PortContext_Instance
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: start\n"));
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: pid %d\n", PortContext_Instance->id));
+
+ /* find oneDeviceData belonging to the portcontext */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if (oneDeviceData->tdPortContext == PortContext_Instance)
+ {
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: pid %d did %d\n", PortContext_Instance->id, oneDeviceData->id));
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+
+ /* reset valid bit */
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ oneDeviceData->registered = agFALSE;
+ /* notify only reported devices to OS layer*/
+ if ( DEVICE_IS_SSP_TARGET(oneDeviceData) ||
+ DEVICE_IS_STP_TARGET(oneDeviceData) ||
+ DEVICE_IS_SATA_DEVICE(oneDeviceData)
+ )
+ {
+ ostiInitiatorEvent(
+ tiRoot,
+ PortContext_Instance->tiPortalContext,
+ &(oneDeviceData->tiDeviceHandle),
+ tiIntrEventTypeDeviceChange,
+ tiDeviceRemoval,
+ agNULL
+ );
+ }
+ DeviceListList = DeviceListList->flink;
+ /* to-do: deregister */
+#ifdef REMOVED /* don't remove device from the device list. May screw up ordering */
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+#endif
+ }
+ else
+ {
+ TI_DBG6(("tdssRemoveSASSATAFromSharedcontext: move to the next\n"));
+ DeviceListList = DeviceListList->flink;
+ }
+ } /* while */
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdssRemoveSASSATAFromSharedcontextByReset
+*
+* Purpose: This function removes all ports and discovered devices
+*
+*
+* \param agRoot Pointer to the root data structure of
+* TD and Lower layer
+*
+* \Return: none
+*
+*****************************************************************************/
+osGLOBAL void
+tdssRemoveSASSATAFromSharedcontextByReset(
+ agsaRoot_t *agRoot
+ )
+{
+ tdsaPortContext_t *onePortContext = agNULL;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *PortContextList;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef FDS_DM
+ dmRoot_t *dmRoot = agNULL;
+ dmPortContext_t *dmPortContext = agNULL;
+ dmPortInfo_t dmPortInfo;
+#endif
+#ifdef FDS_SM
+ smRoot_t *smRoot = &(tdsaAllShared->smRoot);
+ smDeviceHandle_t *smDeviceHandle = agNULL;
+ agsaDevHandle_t *agDevHandle = agNULL;
+#endif
+
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: start\n"));
+
+#ifdef FDS_DM
+ dmRoot = &(tdsaAllShared->dmRoot);
+#endif
+ /* looping throuhg all portcontext */
+ PortContextList = tdsaAllShared->MainPortContextList.flink;
+ while (PortContextList != &(tdsaAllShared->MainPortContextList))
+ {
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: onePortContext is NULL!!!\n"));
+ return;
+ }
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: oneportContext pid %d\n", onePortContext->id));
+ TI_DBG3(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressHi 0x%08x\n", onePortContext->sasLocalAddressHi));
+ TI_DBG3(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressLo 0x%08x\n", onePortContext->sasLocalAddressLo));
+#ifdef FDS_DM
+ if (onePortContext->UseDM == agTRUE)
+ {
+ dmPortContext = &(onePortContext->dmPortContext);
+ dmDestroyPort(dmRoot, dmPortContext, &dmPortInfo);
+ }
+#endif
+
+ tdsaPortContextReInit(tiRoot, onePortContext);
+
+ PortContextList = PortContextList->flink;
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+
+ /* reinitialize the device data belonging to this portcontext */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: did %d\n", oneDeviceData->id));
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+
+#ifdef FDS_SM
+ agDevHandle = oneDeviceData->agDevHandle;
+ smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
+ smDeregisterDevice(smRoot, agDevHandle, smDeviceHandle);
+#endif
+
+ tdsaDeviceDataReInit(tiRoot, oneDeviceData);
+
+ DeviceListList = DeviceListList->flink;
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ /* no dequeue from Mainlink for consistant ordering of devices */
+ }
+
+
+ return;
+}
+
+#endif
+
+
+/*****************************************************************************
+*! \brief tdssAddSASToSharedcontext
+*
+* Purpose: This function adds a discovered device to a device list of
+* a shared context
+*
+* \param tsddPortContext_Instance Pointer to the target port context
+* \param agRoot Pointer to the root data structure of
+* TD and Lower layer
+* \param agDevHandle Pointer to a device handle
+*
+* \Return: none
+*
+*****************************************************************************/
+osGLOBAL void
+tdssAddSASToSharedcontext(
+ tdsaPortContext_t *tdsaPortContext_Instance,
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle, /* this is NULL */
+ tdsaSASSubID_t *agSASSubID,
+ bit32 registered, /* no longer in use */
+ bit8 phyID,
+ bit32 flag
+ )
+{
+
+ tdsaPortContext_t *onePortContext = agNULL;
+ tdList_t *PortContextList;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 new_device = agTRUE;
+ bit32 Indenom = tdsaAllShared->QueueConfig.numInboundQueues;
+ bit32 Outdenom = tdsaAllShared->QueueConfig.numOutboundQueues;
+ bit8 dev_s_rate = 0;
+ bit8 sasorsata = 1;
+ bit8 connectionRate;
+ bit32 found = agFALSE;
+
+ TI_DBG3(("tdssAddSASToSharedcontext: start\n"));
+ /*
+ find a right portcontext
+ then, get devicedata from FreeLink in DeviceList
+ then, do pointer operations
+ then, add the devicedata to the portcontext
+ */
+
+ /* find a right portcontext */
+ PortContextList = tdsaAllShared->MainPortContextList.flink;
+ while (PortContextList != &(tdsaAllShared->MainPortContextList))
+ {
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ if (onePortContext == tdsaPortContext_Instance)
+ {
+ TI_DBG3(("tdssAddSASToSharedContext: found; oneportContext ID %d\n", onePortContext->id));
+ found = agTRUE;
+ break;
+ }
+ PortContextList = PortContextList->flink;
+ }
+
+ if (found == agTRUE)
+ {
+ TI_DBG3(("tdssAddSASToSharedcontext: found pid %d\n", onePortContext->id));
+ }
+ else
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: Error!!! no portcontext found!!!\n"));
+ return;
+ }
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ new_device = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ /* new device */
+ if (new_device == agTRUE)
+ {
+ TI_DBG3(("tdssAddSASToSharedcontext: new device\n"));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG1(("tdssAddSASToSharedContext: empty DeviceData FreeLink\n"));
+ return;
+ }
+
+ TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
+
+ TI_DBG3(("tdssAddSASToSharedcontext: oneDeviceData %p\n", oneDeviceData));
+
+ onePortContext->Count++;
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ oneDeviceData->agRoot = agRoot;
+
+ if (flag == TD_OPERATION_TARGET)
+ {
+ oneDeviceData->agDevHandle = agDevHandle;
+ agDevHandle->osData = oneDeviceData; /* TD layer */
+ }
+
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+
+ oneDeviceData->tdPortContext = onePortContext;
+ oneDeviceData->valid = agTRUE;
+
+ /* new */
+ oneDeviceData->directlyAttached = agTRUE;
+ /* parse sasIDframe to fill in agDeviceInfo */
+ DEVINFO_PUT_SMPTO(&oneDeviceData->agDeviceInfo, DEFAULT_SMP_TIMEOUT);
+ DEVINFO_PUT_ITNEXUSTO(&oneDeviceData->agDeviceInfo, (bit16)tdsaAllShared->itNexusTimeout);
+ DEVINFO_PUT_FBS(&oneDeviceData->agDeviceInfo, 0);
+ /* enable TLR */
+ DEVINFO_PUT_FLAG(&oneDeviceData->agDeviceInfo, 1);
+
+ sasorsata = SAS_DEVICE_TYPE; /* SAS target (SAS disk or expander) */
+ connectionRate = onePortContext->LinkRate;
+ dev_s_rate = (bit8)(dev_s_rate | (sasorsata << 4));
+ dev_s_rate = (bit8)(dev_s_rate | connectionRate);
+ DEVINFO_PUT_DEV_S_RATE(&oneDeviceData->agDeviceInfo, dev_s_rate);
+
+
+ DEVINFO_PUT_SAS_ADDRESSLO(
+ &oneDeviceData->agDeviceInfo,
+ agSASSubID->sasAddressLo
+ );
+ DEVINFO_PUT_SAS_ADDRESSHI(
+ &oneDeviceData->agDeviceInfo,
+ agSASSubID->sasAddressHi
+ );
+
+ oneDeviceData->agContext.osData = oneDeviceData;
+ oneDeviceData->agContext.sdkData = agNULL;
+
+ if (flag == TD_OPERATION_INITIATOR)
+ {
+ if (oneDeviceData->registered == agFALSE )
+ {
+ if( tdsaAllShared->sflag )
+ {
+ if( ! DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: First, saRegisterNewDevice sflag %d\n", tdsaAllShared->sflag));
+ oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | TD_XFER_RDY_PRIORTY_DEVICE_FLAG;
+ }
+ }
+
+ saRegisterNewDevice( /* tdssAddSASToSharedcontext */
+ agRoot,
+ &oneDeviceData->agContext,
+ 0,
+ &oneDeviceData->agDeviceInfo,
+ onePortContext->agPortContext,
+ 0
+ );
+ }
+ }
+ oneDeviceData->phyID = phyID;
+ oneDeviceData->InQID = oneDeviceData->id % Indenom;
+
+#ifdef TARGET_DRIVER
+ {
+ bit32 localId = oneDeviceData->id;
+ localId += 1;
+ oneDeviceData->OutQID = localId % Outdenom;
+ TI_DBG1(("tdssAddSASToSharedcontext: OutQID %d\n", oneDeviceData->OutQID)); /* tdsaRotateQnumber for tgt*/
+
+ }
+#endif /* TARGET_DRIVER */
+
+ TI_DBG4(("tdssAddSASToSharedcontext: SSP target %d STP target %d SATA device %d\n", DEVICE_IS_SSP_TARGET(oneDeviceData), DEVICE_IS_STP_TARGET(oneDeviceData), DEVICE_IS_SATA_DEVICE(oneDeviceData)));
+ /* add the devicedata to the portcontext */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG4(("tdssAddSASToSharedContext: one case pid %d did %d \n", onePortContext->id, oneDeviceData->id));
+ TI_DBG4(("tdssAddSASToSharedContext: new case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+
+ }
+ else /* old device */
+ {
+ TI_DBG3(("tdssAddSASToSharedcontext: old device\n"));
+ TI_DBG3(("tdssAddSASToSharedcontext: oneDeviceData %p\n", oneDeviceData));
+
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ oneDeviceData->agRoot = agRoot;
+
+ if (flag == TD_OPERATION_TARGET)
+ {
+ oneDeviceData->agDevHandle = agDevHandle;
+ agDevHandle->osData = oneDeviceData; /* TD layer */
+ }
+
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+
+
+ oneDeviceData->tdPortContext = onePortContext;
+ oneDeviceData->valid = agTRUE;
+
+ oneDeviceData->directlyAttached = agTRUE;
+ /* new */
+ if (oneDeviceData->registered == agFALSE)
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: registering\n"));
+ /* parse sasIDframe to fill in agDeviceInfo */
+ DEVINFO_PUT_SMPTO(&oneDeviceData->agDeviceInfo, DEFAULT_SMP_TIMEOUT);
+ DEVINFO_PUT_ITNEXUSTO(&oneDeviceData->agDeviceInfo, (bit16)tdsaAllShared->itNexusTimeout);
+ DEVINFO_PUT_FBS(&oneDeviceData->agDeviceInfo, 0);
+ DEVINFO_PUT_FLAG(&oneDeviceData->agDeviceInfo, 1);
+
+ sasorsata = SAS_DEVICE_TYPE; /* SAS target (SAS disk or expander) */
+ connectionRate = onePortContext->LinkRate;
+ dev_s_rate = (bit8)(dev_s_rate | (sasorsata << 4));
+ dev_s_rate = (bit8)(dev_s_rate | connectionRate);
+ DEVINFO_PUT_DEV_S_RATE(&oneDeviceData->agDeviceInfo, dev_s_rate);
+
+
+ DEVINFO_PUT_SAS_ADDRESSLO(
+ &oneDeviceData->agDeviceInfo,
+ agSASSubID->sasAddressLo
+ );
+ DEVINFO_PUT_SAS_ADDRESSHI(
+ &oneDeviceData->agDeviceInfo,
+ agSASSubID->sasAddressHi
+ );
+
+ oneDeviceData->agContext.osData = oneDeviceData;
+ oneDeviceData->agContext.sdkData = agNULL;
+
+ if (flag == TD_OPERATION_INITIATOR)
+ {
+ if( tdsaAllShared->sflag )
+ {
+ if( ! DEVICE_IS_SMP_TARGET(oneDeviceData))
+ {
+ TI_DBG1(("tdssAddSASToSharedcontext: Second, saRegisterNewDevice sflag %d\n", tdsaAllShared->sflag));
+ oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | TD_XFER_RDY_PRIORTY_DEVICE_FLAG;
+ }
+ }
+ saRegisterNewDevice( /* tdssAddSASToSharedcontext */
+ agRoot,
+ &oneDeviceData->agContext,
+ 0,
+ &oneDeviceData->agDeviceInfo,
+ onePortContext->agPortContext,
+ 0
+ );
+ }
+ }
+
+
+
+
+
+
+ oneDeviceData->phyID = phyID;
+ oneDeviceData->InQID = oneDeviceData->id % Indenom;
+ oneDeviceData->OutQID = oneDeviceData->id % Outdenom;
+
+ TI_DBG1(("tdssAddSASToSharedcontext: A OutQID %d\n", oneDeviceData->OutQID));
+ TI_DBG4(("tdssAddSASToSharedcontext: SSP target %d STP target %d SATA device %d\n", DEVICE_IS_SSP_TARGET(oneDeviceData), DEVICE_IS_STP_TARGET(oneDeviceData), DEVICE_IS_SATA_DEVICE(oneDeviceData)));
+ TI_DBG4(("tdssAddSASToSharedContext: old case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+ }
+
+ return;
+}
+
+
+
+
+/*****************************************************************************
+*! \brief tdssRemoveDevicedataFromSharedcontext
+*
+* Purpose: This function removes a discovered device from a device list of
+* a port context
+*
+* \param tsddPortContext_Ins Pointer to the target port context
+* \param tdsaDeviceData_Ins Pointer to the target device
+* \param agRoot Pointer to the root data structure of
+* TD and Lower layer
+
+*
+* \Return: none
+*
+*****************************************************************************/
+osGLOBAL void
+tdssRemoveSASFromSharedcontext(
+ tdsaPortContext_t *tdsaPortContext_Ins,
+ tdsaDeviceData_t *tdsaDeviceData_Ins,
+ agsaRoot_t *agRoot
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaPortContext_t *onePortContext = agNULL;
+ tdList_t *PortContextList;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ bit32 found = agTRUE;
+
+ TI_DBG3(("tdssRemoveSASFromSharedcontext: start\n"));
+ /* find a right portcontext */
+ PortContextList = tdsaAllShared->MainPortContextList.flink;
+ while (PortContextList != &(tdsaAllShared->MainPortContextList))
+ {
+ onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdssRemoveDevicedataFromSharedcontext: onePortContext is NULL!!!\n"));
+ return;
+ }
+ if (onePortContext == tdsaPortContext_Ins)
+ {
+ TI_DBG4(("tdssRemoveDevicedataFromSharedcontext: found; oneportContext ID %d\n", onePortContext->id));
+ break;
+ }
+ PortContextList = PortContextList->flink;
+ }
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssRemoveDevicedataFromSharedcontext: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi
+ == SA_DEVINFO_GET_SAS_ADDRESSHI(&tdsaDeviceData_Ins->agDeviceInfo))
+ &&
+ (oneDeviceData->SASAddressID.sasAddressLo ==
+ SA_DEVINFO_GET_SAS_ADDRESSLO(&tdsaDeviceData_Ins->agDeviceInfo)))
+ {
+ TI_DBG4(("tdssRemoveDevicedataFromSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ found = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ if (found == agFALSE)
+ {
+ TI_DBG6(("tdssRemoveDevicedataFromSharedcontext: can't find the right devicedata in MainLink\n"));
+ return;
+ }
+
+ /* remove it and put it back to FreeLink of Devicedata */
+ TI_DBG6(("tdssRemoveDevicedataFromSharedcontext: removing ... pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+
+ /* invalidate the device but keep it on the list for persistency */
+ oneDeviceData->valid = agFALSE;
+
+ return;
+}
+
+/*****************************************************************************
+*! \brief tdssRemoveAllDevicedataFromPortcontext
+*
+* Purpose: This function removes all discovered devices from a device list of
+* a port context
+*
+* \param tdsaDeviceData Pointer to a device header
+*
+* \Return: none
+*
+*****************************************************************************/
+osGLOBAL void
+tdssRemoveAllDevicelistFromPortcontext(
+ tdsaPortContext_t *PortContext_Ins,
+ agsaRoot_t *agRoot
+ )
+{
+
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+
+ TI_DBG6(("tdssRemoveAllDevicedataFromPortcontext: start\n"));
+
+ /*
+ loop through device list and find the matching portcontext. Then invalidate the
+ matching devices
+ */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssRemoveAllDevicelistFromPortcontext: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+ if (oneDeviceData->tdPortContext == PortContext_Ins)
+ {
+ TI_DBG4(("tdssRemoveAllDevicelistFromPortcontext: pid %d did %d\n", PortContext_Ins->id, oneDeviceData->id));
+ PortContext_Ins->Count--;
+ oneDeviceData->valid = agFALSE;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ return;
+}
+
+
+#ifdef INITIATOR_DRIVER
+#ifdef TD_DISCOVER
+/*****************************************************************************
+*! \brief tdssNewAddSASToSharedcontext
+*
+* Purpose: This function adds a discovered SAS device to a device list of
+* a shared context. Used only in discovery.
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param onePortContext Pointer to the target port context
+* \param agSASSubID Pointer to the SAS identification.
+*
+* \Return:
+* Pointer to the device data
+*
+*****************************************************************************/
+osGLOBAL tdsaDeviceData_t *
+tdssNewAddSASToSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 new_device = agTRUE;
+
+ TI_DBG3(("tdssNewAddSASToSharedcontext: start\n"));
+ /*
+ find a right portcontext
+ then, get devicedata from FreeLink in DeviceList
+ then, do pointer operations
+ then, add the devicedata to the portcontext
+ */
+
+
+ TI_DBG3(("tdssNewAddSASToSharedcontext: oneportContext ID %d\n", onePortContext->id));
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdssNewAddSASToSharedcontext: oneDeviceData is NULL!!!\n"));
+ return agNULL;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ new_device = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+ /* new device */
+ if (new_device == agTRUE)
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: new device\n"));
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG1(("tdssNewAddSASToSharedcontext: empty DeviceData FreeLink\n"));
+ return agNULL;
+ }
+
+ TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
+
+ TI_DBG3(("tdssNewAddSASToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
+
+ onePortContext->Count++;
+ oneDeviceData->agRoot = agRoot;
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+ oneDeviceData->tdPortContext = onePortContext;
+ /* handles both SAS target and STP-target, SATA-device */
+ if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ }
+ else
+ {
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ }
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ /* set phyID only when it has initial value of 0xFF */
+ if (oneDeviceData->phyID == 0xFF)
+ {
+ oneDeviceData->phyID = phyID;
+ }
+#ifdef FDS_DM
+ oneDeviceData->valid = agTRUE;
+#else
+
+ /* incremental discovery */
+ /* add device to incremental-related link. Report using this link
+ when incremental discovery is done */
+ if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_INCREMENTAL_START)
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: incremental discovery\n"));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
+ oneDeviceData->valid2 = agTRUE;
+ }
+ else
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: full discovery\n"));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
+ oneDeviceData->valid = agTRUE;
+ }
+#endif
+ /* add the devicedata to the portcontext */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG4(("tdssNewAddSASToSharedcontext: one case pid %d did %d \n", onePortContext->id, oneDeviceData->id));
+ TI_DBG4(("tdssNewAddSASToSharedcontext: new case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+ }
+ else /* old device */
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: old device\n"));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
+
+ oneDeviceData->agRoot = agRoot;
+ /* saving sas address */
+ oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
+ oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
+ oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
+ oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
+ oneDeviceData->tdPortContext = onePortContext;
+ /* handles both SAS target and STP-target, SATA-device */
+ if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
+ {
+ oneDeviceData->DeviceType = TD_SAS_DEVICE;
+ }
+ else
+ {
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ }
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ /* set phyID only when it has initial value of 0xFF */
+ if (oneDeviceData->phyID == 0xFF)
+ {
+ oneDeviceData->phyID = phyID;
+ }
+
+#ifdef FDS_DM
+ oneDeviceData->valid = agTRUE;
+#else
+ if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_INCREMENTAL_START)
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: incremental discovery\n"));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
+ oneDeviceData->valid2 = agTRUE;
+ }
+ else
+ {
+ TI_DBG3(("tdssNewAddSASToSharedcontext: full discovery\n"));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
+ oneDeviceData->valid = agTRUE;
+ }
+#endif
+ TI_DBG4(("tdssNewAddSASToSharedcontext: old case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
+
+ }
+ return oneDeviceData;
+}
+
+/*****************************************************************************
+*! \brief tdsaFindRegNValid
+*
+* Purpose: This function finds a device which is registered and valid in
+* the device list. Used only in incremental discovery.
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param onePortContext Pointer to the target port context
+* \param tdsaDeviceData Pointer to a device list header
+* \param agSASSubID Pointer to the SAS identification.
+*
+* \Return:
+* Pointer to the device data
+*
+*****************************************************************************/
+osGLOBAL tdsaDeviceData_t *
+tdsaFindRegNValid(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ bit32 found = agFALSE;
+
+ TI_DBG3(("tdsaFindRegNValid: start\n"));
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_FULL_START)
+ {
+ TI_DBG3(("tdsaFindRegNValid: Full discovery\n"));
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaFindRegNValid: oneDeviceData is NULL!!!\n"));
+ return agNULL;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->registered == agTRUE) &&
+ (oneDeviceData->valid == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG3(("tdsaFindRegNValid: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ TI_DBG3(("tdsaFindRegNValid: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaFindRegNValid: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ found = agTRUE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ }
+ else
+ {
+ /* incremental discovery */
+ TI_DBG3(("tdsaFindRegNValid: Incremental discovery\n"));
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsaFindRegNValid: oneDeviceData is NULL!!!\n"));
+ return agNULL;
+ }
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->registered == agTRUE) &&
+ (oneDeviceData->valid2 == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG3(("tdsaFindRegNValid: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ TI_DBG3(("tdsaFindRegNValid: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdsaFindRegNValid: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+ found = agTRUE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ }
+
+
+
+ if (found == agFALSE)
+ {
+ TI_DBG3(("tdsaFindRegNValid: end returning NULL\n"));
+ return agNULL;
+ }
+ else
+ {
+ TI_DBG3(("tdsaFindRegNValid: end returning NOT NULL\n"));
+ return oneDeviceData;
+ }
+
+}
+
+//registered to LL or not
+/*****************************************************************************
+*! \brief tdssNewSASorNot
+*
+* Purpose: This function finds whether a device is registered or not
+*
+* \param agRoot Pointer to chip/driver Instance.
+* \param onePortContext Pointer to the target port context
+* \param agSASSubID Pointer to the SAS identification.
+*
+* \Return:
+* agTRUE Device is not registered (New device).
+* agFALSE Device is registered (Old device).
+*
+*****************************************************************************/
+bit32
+tdssNewSASorNot(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ )
+{
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ bit32 ret = agTRUE;
+
+ TI_DBG3(("tdssNewSASorNot: start\n"));
+
+ /* find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
+ (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
+ (oneDeviceData->registered == agTRUE) &&
+ (oneDeviceData->tdPortContext == onePortContext)
+ )
+ {
+ TI_DBG3(("tdssNewSASorNot: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
+ ret = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+
+
+ TI_DBG3(("tdssNewSASorNot: end\n"));
+
+ return ret;
+}
+
+
+
+/*****************************************************************************
+*! \brief tdssSASDiscoveringExpanderAlloc
+*
+* Purpose: This function allocates an expander from the pre-allocated memory
+* pool.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param onePortContext: Pointer to the portal context instance.
+* \param oneDeviceData: Pointer to the device data.
+*
+* \return:
+* Pointer to expander on success
+* agNULL on failure
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL tdsaExpander_t *
+tdssSASDiscoveringExpanderAlloc(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaExpander_t *oneExpander = agNULL;
+ tdList_t *ExpanderList;
+
+ /*
+ move the expander from freeExpanderList
+ and ground the expander by TDLIST_DEQUEUE_THIS
+ */
+
+
+ TI_DBG3(("tdssSASDiscoveringExpanderAlloc: start\n"));
+ TI_DBG3(("tdssSASDiscoveringExpanderAlloc: did %d\n", oneDeviceData->id));
+ TI_DBG3(("tdssSASDiscoveringExpanderAlloc: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssSASDiscoveringExpanderAlloc: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
+
+ if (onePortContext->valid == agFALSE)
+ {
+ TI_DBG1(("tdssSASDiscoveringExpanderAlloc: aborting discovery\n"));
+ tdsaSASDiscoverAbort(tiRoot, onePortContext);
+ return agNULL;
+ }
+
+ tdsaDumpAllFreeExp(tiRoot);
+
+ if (TDLIST_EMPTY(&(tdsaAllShared->freeExpanderList)))
+ {
+ TI_DBG1(("tdssSASDiscoveringExpanderAlloc: no free expanders\n"));
+ return agNULL;
+ }
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DISC_LOCK);
+ TDLIST_DEQUEUE_FROM_HEAD(&ExpanderList, &(tdsaAllShared->freeExpanderList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DISC_LOCK);
+ // oneExpander = TDLIST_OBJECT_BASE(tdsaContext_t, freeExpanderList, ExpanderList);
+ oneExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
+
+ if (oneExpander != agNULL)
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAlloc: expander id %d\n", oneExpander->id));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DISC_LOCK);
+ TDLIST_DEQUEUE_THIS(&(oneExpander->linkNode));
+ tdsaSingleThreadedLeave(tiRoot, TD_DISC_LOCK);
+
+ oneExpander->tdDevice = oneDeviceData;
+ oneExpander->tdUpStreamExpander = agNULL;
+ oneExpander->tdCurrentDownStreamExpander = agNULL;
+ oneExpander->tdReturnginExpander = agNULL;
+ oneExpander->hasUpStreamDevice = agFALSE;
+ oneExpander->numOfUpStreamPhys = 0;
+ oneExpander->currentUpStreamPhyIndex = 0;
+ oneExpander->discoveringPhyId = 0;
+ oneExpander->underDiscovering = agFALSE;
+ osti_memset( &(oneExpander->currentIndex), 0, sizeof(oneExpander->currentIndex));
+
+ oneDeviceData->tdExpander = oneExpander;
+ }
+
+ return oneExpander;
+}
+
+/*****************************************************************************
+*! \brief tdssSASDiscoveringExpanderAdd
+*
+* Purpose: This function adds an expander to the expander list.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param onePortContext: Pointer to the portal context instance.
+* \param oneExpander: Pointer to the expander data.
+*
+* \return:
+* None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdssSASDiscoveringExpanderAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ )
+{
+#ifdef TD_INTERNAL_DEBUG
+ tdList_t *ExpanderList;
+ tdsaExpander_t *tempExpander;
+#endif
+
+ /* move the expander to discoveringExpanderList */
+
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: start\n"));
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: expander id %d\n", oneExpander->id));
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
+
+ if (onePortContext->valid == agFALSE)
+ {
+ TI_DBG1(("tdssSASDiscoveringExpanderAdd: aborting discovery\n"));
+ tdsaSASDiscoverAbort(tiRoot, onePortContext);
+ return;
+ }
+
+
+ if (onePortContext->discovery.status == DISCOVERY_UP_STREAM)
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: UPSTREAM\n"));
+ }
+ else if (onePortContext->discovery.status == DISCOVERY_DOWN_STREAM)
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: DOWNSTREAM\n"));
+ }
+ else
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: status %d\n", onePortContext->discovery.status));
+ }
+
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: BEFORE\n"));
+ tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
+
+
+ if ( oneExpander->underDiscovering == agFALSE)
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: ADDED \n"));
+
+ oneExpander->underDiscovering = agTRUE;
+ tdsaSingleThreadedEnter(tiRoot, TD_DISC_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->linkNode), &(onePortContext->discovery.discoveringExpanderList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DISC_LOCK);
+ }
+
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: AFTER\n"));
+ tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
+
+#ifdef TD_INTERNAL_DEBUG
+ /* debugging */
+ if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: empty discoveringExpanderList\n"));
+ return;
+ }
+ ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
+ while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
+ {
+ tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
+ TI_DBG3(("tdssSASDiscoveringExpanderAdd: expander id %d\n", tempExpander->id));
+ ExpanderList = ExpanderList->flink;
+ }
+#endif
+
+ return;
+}
+
+/* temp */
+osGLOBAL bit32
+tdssSASFindDiscoveringExpander(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ )
+{
+ tdList_t *ExpanderList;
+ tdsaExpander_t *tempExpander;
+ tdsaPortContext_t *tmpOnePortContext = onePortContext;
+ bit32 ret = agFALSE;
+
+ TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
+
+ if (TDLIST_EMPTY(&(tmpOnePortContext->discovery.discoveringExpanderList)))
+ {
+ TI_DBG1(("tdssSASFindDiscoveringExpander: empty discoveringExpanderList\n"));
+ return ret;
+ }
+ ExpanderList = tmpOnePortContext->discovery.discoveringExpanderList.flink;
+ while (ExpanderList != &(tmpOnePortContext->discovery.discoveringExpanderList))
+ {
+ tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
+ if (tempExpander == oneExpander)
+ {
+ TI_DBG3(("tdssSASFindDiscoveringExpander: match!!! expander id %d\n", tempExpander->id));
+ TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrHi 0x%08x\n", tempExpander->tdDevice->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrLo 0x%08x\n", tempExpander->tdDevice->SASAddressID.sasAddressLo));
+ ret = agTRUE;
+ break;
+ }
+
+ ExpanderList = ExpanderList->flink;
+ }
+
+
+ return ret;
+
+}
+/* to be tested */
+/* move the expander to freeExpanderList */
+/*****************************************************************************
+*! \brief tdssSASDiscoveringExpanderRemove
+*
+* Purpose: This function removes an expander from the expander list.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param onePortContext: Pointer to the portal context instance.
+* \param oneExpander: Pointer to the expander data.
+*
+* \return:
+* None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+tdssSASDiscoveringExpanderRemove(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+#ifdef TD_INTERNAL_DEBUG
+ tdList_t *ExpanderList;
+ tdsaExpander_t *tempExpander;
+#endif
+
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: start\n"));
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", oneExpander->id));
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
+
+
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: BEFORE\n"));
+ tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
+ tdsaDumpAllUpExp(tiRoot, onePortContext, oneExpander);
+ tdsaDumpAllFreeExp(tiRoot);
+
+#ifdef TD_INTERNAL_DEBUG
+ /* debugging */
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: BEFORE\n"));
+ if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: empty discoveringExpanderList\n"));
+ }
+ ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
+ while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
+ {
+ tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", tempExpander->id));
+ ExpanderList = ExpanderList->flink;
+ }
+#endif
+
+ // if is temporary till smp problem is fixed
+ if (tdssSASFindDiscoveringExpander(tiRoot, onePortContext, oneExpander) == agTRUE)
+ {
+ oneExpander->underDiscovering = agFALSE;
+ oneExpander->discoveringPhyId = 0;
+ tdsaSingleThreadedEnter(tiRoot, TD_DISC_LOCK);
+ TDLIST_DEQUEUE_THIS(&(oneExpander->linkNode));
+
+ if (onePortContext->discovery.status == DISCOVERY_UP_STREAM)
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: DISCOVERY_UP_STREAM\n"));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->upNode), &(onePortContext->discovery.UpdiscoveringExpanderList));
+ onePortContext->discovery.NumOfUpExp++;
+ }
+ else
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: Status %d\n", onePortContext->discovery.status));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->linkNode), &(tdsaAllShared->freeExpanderList));
+ }
+
+ tdsaSingleThreadedLeave(tiRoot, TD_DISC_LOCK);
+ } //end temp if
+ else
+ {
+ TI_DBG1(("tdssSASDiscoveringExpanderRemove: !!! problem !!!\n"));
+ }
+
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: AFTER\n"));
+ tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
+ tdsaDumpAllUpExp(tiRoot, onePortContext, oneExpander);
+
+ tdsaDumpAllFreeExp(tiRoot);
+
+#ifdef TD_INTERNAL_DEBUG
+ /* debugging */
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: AFTER\n"));
+ if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
+ {
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: empty discoveringExpanderList\n"));
+ }
+ ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
+ while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
+ {
+ tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
+ TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", tempExpander->id));
+ ExpanderList = ExpanderList->flink;
+ }
+#endif
+
+ return;
+}
+
+#ifdef SATA_ENABLE
+
+/*****************************************************************************
+*! \brief tdssNewAddSATAToSharedcontext
+*
+* Purpose: This function adds a discovered SATA device to a device list of
+* a shared context. Used only in discovery.
+*
+* \param tiRoot Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+* \param agRoot Pointer to chip/driver Instance.
+* \param onePortContext Pointer to the target port context
+* \param tdsaDeviceData Pointer to a device list header
+* \param agSATADeviceInfo Pointer to the SATA device information.
+* \param Signature Pointer to SATA signature
+* \param pm Port multiplier
+* \param pmField Port multiplier field
+* \param connectionRate Connection rate
+*
+* \Return:
+* Pointer to the device data
+*
+*****************************************************************************/
+osGLOBAL tdsaDeviceData_t *
+tdssNewAddSATAToSharedcontext(tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ agsaSATADeviceInfo_t *agSATADeviceInfo,
+ bit8 *Signature,
+ bit8 pm,
+ bit8 pmField,
+ bit32 connectionRate,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ int new_device = agTRUE;
+
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: start\n"));
+
+
+
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: oneportContext ID %d\n", onePortContext->id));
+
+
+#ifdef RPM_SOC
+ /* Find a device's existence */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+
+ if ((osti_memcmp (((char *)&oneDeviceData->satDevData.satIdentifyData),
+ ((char *)&agSATADeviceInfo->sataIdentifyData),
+ sizeof(agsaSATAIdentifyData_t)) == 0))
+ {
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: pid %d did %d\n",
+ onePortContext->id, oneDeviceData->id));
+ new_device = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+#else
+
+
+#endif
+
+ /* New device */
+ if (new_device == agTRUE)
+ {
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: new device\n"));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG1(("tdssNewAddSATAToSharedcontext: ERROR empty DeviceData FreeLink\n"));
+ return oneDeviceData;
+ }
+
+ TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
+
+ onePortContext->Count++;
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ oneDeviceData->agRoot = agRoot;
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: oneDeviceData %p\n", oneDeviceData));
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: pSatDevData=%p\n", &oneDeviceData->satDevData));
+
+
+ /* saving PortMultiplier(PM) field */
+ oneDeviceData->satDevData.satPMField = pmField;
+
+ /* saving signature */
+ osti_memcpy(&(oneDeviceData->satDevData.satSignature), Signature, 8);
+
+ /*
+ saving device type
+ ATA device type; here should be either ATA_ATA_DEVICE or ATA_ATAPI_DEVICE
+ */
+ oneDeviceData->satDevData.satDeviceType = tdssSATADeviceTypeDecode(agSATADeviceInfo->signature);
+ TI_DBG3(("tdssNewAddSATAToSharedcontext: device type %d\n", oneDeviceData->satDevData.satDeviceType));
+
+#ifdef RPM_SOC_REMOVED
+ /* print device signature - Word8 */
+ TI_DBG3(("tdssNewAddSATAToSharedcontext: Word8 %x signature: %x %x %x %x %x %x %x %x\n",
+ agSATADeviceInfo->sataIdentifyData.word1_9[7],
+ agSATADeviceInfo->signature[0], agSATADeviceInfo->signature[1],
+ agSATADeviceInfo->signature[2], agSATADeviceInfo->signature[3],
+ agSATADeviceInfo->signature[4], agSATADeviceInfo->signature[5],
+ agSATADeviceInfo->signature[6], agSATADeviceInfo->signature[7] ));
+#endif
+
+
+
+ oneDeviceData->tdPortContext = onePortContext;
+ oneDeviceData->valid = agTRUE;
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ oneDeviceData->phyID = phyID;
+
+ /* Add the devicedata to the portcontext */
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: one case pid %d did %d \n",
+ onePortContext->id, oneDeviceData->id));
+ }
+ else /* old device */
+ {
+ TI_DBG5(("tdssNewAddSATAToSharedcontext: old device\n"));
+
+ onePortContext->Count++;
+
+ oneDeviceData->DeviceType = TD_SATA_DEVICE;
+ oneDeviceData->agRoot = agRoot;
+
+ oneDeviceData->tdPortContext = onePortContext;
+ oneDeviceData->valid = agTRUE;
+
+ oneDeviceData->ExpDevice = oneExpDeviceData;
+ oneDeviceData->phyID = phyID;
+
+ }
+
+ return oneDeviceData;
+
+}
+#endif /* SATA_ENABLE */
+#endif /* TD_DISCOVER */
+#endif /* INITIATOR_DRIVER */
+
+#ifdef TARGET_DRIVER
+/*****************************************************************************
+*! \brief tdssReportRemovals
+*
+* Purpose: This function goes through device list and removes all devices
+* belong to the portcontext. This function also deregiters those
+* devices. This function is called in case of incremental discovery
+* failure.
+*
+* \param agRoot : Pointer to chip/driver Instance.
+* \param onePortContext: Pointer to the portal context instance.
+* \param oneDeviceData: Pointer to the device data.
+*
+* \return:
+* None
+*
+* \note:
+*
+*****************************************************************************/
+osGLOBAL void
+ttdssReportRemovals(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 flag
+ )
+{
+ tdsaDeviceData_t *oneDeviceData = agNULL;
+ tdList_t *DeviceListList;
+ tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
+ tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 removed = agFALSE;
+ agsaEventSource_t *eventSource;
+ bit32 PhyID;
+ bit32 HwAckSatus;
+ tdsaDeviceData_t *tmpDeviceData = agNULL;
+
+ TI_DBG1(("ttdssReportRemovals: start\n"));
+ /* in case nothing was registered */
+ PhyID = onePortContext->eventPhyID;
+ if (tdsaAllShared->eventSource[PhyID].EventValid == agTRUE &&
+ onePortContext->RegisteredDevNums == 0 &&
+ PhyID != 0xFF
+ )
+ {
+ TI_DBG1(("ttdssReportRemovals: calling saHwEventAck\n"));
+ eventSource = &(tdsaAllShared->eventSource[PhyID].Source);
+ HwAckSatus = saHwEventAck(
+ agRoot,
+ agNULL, /* agContext */
+ 0,
+ eventSource, /* agsaEventSource_t */
+ 0,
+ 0
+ );
+ if ( HwAckSatus != AGSA_RC_SUCCESS)
+ {
+ TI_DBG1(("ttdssReportRemovals: failing in saHwEventAck; status %d\n", HwAckSatus));
+ }
+
+ /* toggle */
+ tdsaAllShared->eventSource[PhyID].EventValid = agFALSE;
+ if (onePortContext->valid == agFALSE)
+ {
+ tdsaPortContextReInit(tiRoot, onePortContext);
+ /*
+ put all devices belonging to the onePortContext
+ back to the free link
+ */
+ tdsaSingleThreadedEnter(tiRoot, TD_PORT_LOCK);
+ TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
+ tdsaSingleThreadedLeave(tiRoot, TD_PORT_LOCK);
+ }
+ }
+ else
+ {
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainDeviceList)))
+ {
+ TI_DBG1(("ttdssReportRemovals: empty device list\n"));
+ return;
+ }
+
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if( oneDeviceData == agNULL )
+ {
+ break;
+ }
+ TI_DBG1(("ttdssReportRemovals: loop did %d\n", oneDeviceData->id));
+ TI_DBG1(("ttdssReportRemovals: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
+ TI_DBG1(("ttdssReportRemovals: valid %d valid2 %d\n", oneDeviceData->valid, oneDeviceData->valid2));
+ TI_DBG1(("ttdssReportRemovals: directlyAttached %d registered %d\n", oneDeviceData->directlyAttached, oneDeviceData->registered));
+ if ( oneDeviceData->tdPortContext == onePortContext)
+ {
+ TI_DBG1(("ttdssReportRemovals: right portcontext pid %d\n", onePortContext->id));
+ if (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE)
+ {
+ TI_DBG1(("ttdssReportRemovals: removing\n"));
+
+ /* notify only reported devices to OS layer*/
+ removed = agTRUE;
+
+ /* all targets except expanders */
+ TI_DBG1(("ttdssReportRemovals: calling tdsaAbortAll\n"));
+ TI_DBG1(("ttdssReportRemovals: did %d\n", oneDeviceData->id));
+ TI_DBG1(("ttdssReportRemovals: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
+ tmpDeviceData = oneDeviceData;
+ ttdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+
+
+ /* reset valid bit */
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ oneDeviceData->registered = agFALSE;
+ }
+ /* called by port invalid case */
+ if (flag == agTRUE)
+ {
+ oneDeviceData->tdPortContext = agNULL;
+ }
+#ifdef REMOVED /* removed */
+ /* directly attached SATA -> always remove it */
+ if (oneDeviceData->DeviceType == TD_SATA_DEVICE &&
+ oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG1(("ttdssReportRemovals: device did %d\n", oneDeviceData->id));
+ tdsaSingleThreadedEnter(tiRoot, TD_DEVICE_LOCK);
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceLis));
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ if (TDLIST_EMPTY(&(tdsaAllShared->MainDeviceList)))
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ break;
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_DEVICE_LOCK);
+ }
+ }
+ else
+ {
+ DeviceListList = DeviceListList->flink;
+ }
+#endif /* REMOVED */
+ DeviceListList = DeviceListList->flink;
+ }
+ else
+ {
+ if (oneDeviceData->tdPortContext != agNULL)
+ {
+ TI_DBG1(("ttdssReportRemovals: different portcontext; oneDeviceData->tdPortContext pid %d oneportcontext pid %d\n", oneDeviceData->tdPortContext->id, onePortContext->id));
+ }
+ else
+ {
+ TI_DBG1(("ttdssReportRemovals: different portcontext; oneDeviceData->tdPortContext pid NULL oneportcontext pid %d\n", onePortContext->id));
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+ }
+
+ if (removed == agTRUE)
+ {
+ TI_DBG1(("ttdssReportRemovals: removed at the end\n"));
+ ostiTargetEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ &(tmpDeviceData->tiDeviceHandle),
+ tiTgtEventTypeDeviceChange,
+ tiDeviceRemoval,
+ agNULL
+ );
+ }
+ } /* big else */
+ return;
+}
+#endif /* TARGET_DRIVER */
+
+
+/*****************************************************************************
+*! \brief tdsaRotateQnumber
+*
+* Purpose: This function generates inbound queue number.
+*
+* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
+* instance.
+*
+* \return:
+* Queue number
+*
+* \note:
+*
+*****************************************************************************/
+FORCEINLINE bit32
+tdsaRotateQnumber(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData )
+{
+ bit32 ret = 0;
+
+ TI_DBG6(("tdsaRotateQnumber: start\n"));
+ if (oneDeviceData == agNULL)
+ {
+ return 0;
+ }
+ ret = (oneDeviceData->OutQID << 16) | oneDeviceData->InQID;
+ return ret;
+}
+
+osGLOBAL bit32
+tdsaRotateQnumber1(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+// static int Last_Q;
+// bit32 denom = tdsaAllShared->QueueConfig.numOutboundQueues;
+ bit32 ret = 0;
+ if (oneDeviceData == agNULL)
+ {
+// Last_Q= 0;
+ return 0;
+ }
+
+/* alway use highest Q number */
+ ret = ((tdsaAllShared->QueueConfig.numOutboundQueues-1) << 16) | (tdsaAllShared->QueueConfig.numInboundQueues-1);
+
+ return(ret);
+}
+
+#ifdef REMOVED
+osGLOBAL bit32
+tdsaRotateQnumber(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit32 denom = tdsaAllShared->QueueConfig.numInboundQueues;
+ bit32 ret = 0;
+
+ /* inbound queue number */
+ tdsaAllShared->IBQnumber++;
+ if (tdsaAllShared->IBQnumber % denom == 0) /* % Qnumber*/
+ {
+ tdsaAllShared->IBQnumber = 0;
+ }
+ TI_DBG6(("tdsaRotateQnumber: IBQnumber %d\n", tdsaAllShared->IBQnumber));
+
+
+ /* outbound queue number */
+ tdsaAllShared->OBQnumber++;
+ denom = tdsaAllShared->QueueConfig.numOutboundQueues;
+ if (tdsaAllShared->OBQnumber % denom == 0) /* % Qnumber*/
+ {
+ tdsaAllShared->OBQnumber = 0;
+ }
+ TI_DBG6(("tdsaRotateQnumber: OBQnumber %d\n", tdsaAllShared->OBQnumber));
+
+ ret = (tdsaAllShared->OBQnumber << 16) | tdsaAllShared->IBQnumber;
+ return ret;
+}
+#endif
+
+
+void t_MacroCheck( agsaRoot_t *agRoot)
+{
+ TI_DBG1(("t_MacroCheck:tIsSPC %d\n",tIsSPC(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCHIL %d\n",tIsSPCHIL(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCv %d\n",tIsSPCv(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCve %d\n",tIsSPCve(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCvplus %d\n",tIsSPCvplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCveplus %d\n",tIsSPCveplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCADAPvplus %d\n",tIsSPCADAPvplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPCADAPveplus %d\n",tIsSPCADAPveplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPC12Gv %d\n",tIsSPC12Gv(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPC12Gve %d\n",tIsSPC12Gve(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPC12Gvplus %d\n",tIsSPC12Gvplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tIsSPC12Gveplus %d\n",tIsSPC12Gveplus(agRoot)));
+ TI_DBG1(("t_MacroCheck:tiIS_SPC %d\n",tiIS_SPC(agRoot) ));
+ TI_DBG1(("t_MacroCheck:tiIS_HIL %d\n",tiIS_HIL(agRoot) ));
+ TI_DBG1(("t_MacroCheck:tiIS_SPC6V %d\n",tiIS_SPC6V(agRoot) ));
+ TI_DBG1(("t_MacroCheck:tiIS_SPC_ENC %d\n",tiIS_SPC_ENC(agRoot) ));
+ TI_DBG1(("t_MacroCheck:tIsSPCV12G %d\n",tIsSPCV12G(agRoot) ));
+}
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdproto.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tdproto.h
new file mode 100644
index 0000000..50c7706
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdproto.h
@@ -0,0 +1,2269 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * function definitions used in SAS/SATA TD layer
+ *
+ */
+
+#ifndef __TDPROTO_H__
+#define __TDPROTO_H__
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#endif
+
+/*****************************************************************************
+*
+* SA SHARED PROTOTYPES
+*
+*****************************************************************************/
+
+osGLOBAL void
+tdsaQueueConfigInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaEsglInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaResetComMemFlags(
+ tiRoot_t *tiRoot
+ );
+
+
+osGLOBAL void
+tdsaInitTimerRequest(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest
+ );
+
+osGLOBAL void
+tdsaSetTimerRequest(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest,
+ bit32 timeout,
+ tdsaTimerCBFunc_t CBFunc,
+ void *timerData1,
+ void *timerData2,
+ void *timerData3
+ );
+
+osGLOBAL void
+tdsaAddTimer (
+ tiRoot_t *tiRoot,
+ tdList_t *timerListHdr,
+ tdsaTimerRequest_t *timerRequest
+ );
+
+osGLOBAL void
+tdsaKillTimer(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest
+ );
+
+
+
+
+
+osGLOBAL void
+tdsaLoLevelGetResource (
+ tiRoot_t * tiRoot,
+ tiLoLevelResource_t * loResource
+ );
+
+osGLOBAL void
+tdsaSharedMemCalculate (
+ tiRoot_t * tiRoot,
+ tiLoLevelResource_t * loResource,
+ tiTdSharedMem_t * tdSharedMem
+ );
+
+osGLOBAL void
+tdsaGetEsglPagesInfo(
+ tiRoot_t *tiRoot,
+ bit32 *PageSize,
+ bit32 *NumPages
+ );
+
+osGLOBAL void
+tdsaGetPortParams(
+ tiRoot_t *tiRoot
+ );
+
+
+
+osGLOBAL void
+tdsaGetSwConfigParams(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaGetHwConfigParams(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaGetCardPhyParams(
+ tiRoot_t *tiRoot
+ );
+
+
+osGLOBAL void
+tdsaGetGlobalPhyParams(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL bit32
+tdsaGetCardIDString(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaParseLinkRateMode(
+ tiRoot_t *tiRoot,
+ bit32 index,
+ bit32 LinkRateRead,
+ bit32 ModeRead,
+ bit32 OpticalModeRead,
+ bit32 LinkRate,
+ bit32 Mode,
+ bit32 OpticalMode
+ );
+
+osGLOBAL void
+tdsaInitTimers(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaProcessTimers(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaInitTimerHandler(
+ tiRoot_t *tiRoot,
+ void *timerData
+ );
+
+osGLOBAL void
+tdsaGetEsglPages(
+ tiRoot_t *tiRoot,
+ tdList_t *EsglListHdr,
+ tiSgl_t *ptiSgl,
+ tiSgl_t *virtSgl
+ );
+
+osGLOBAL void
+tdsaFreeEsglPages(
+ tiRoot_t *tiRoot,
+ tdList_t *EsglListHdr
+ );
+
+osGLOBAL void
+tdssGetMaxTargetsParams(
+ tiRoot_t *tiRoot,
+ bit32 *pMaxTargets
+ );
+
+osGLOBAL void
+tdssGetSATAOnlyModeParams(
+ tiRoot_t *tiRoot,
+ bit32 *pMaxTargets
+ );
+
+osGLOBAL bit32
+tdipFWControlIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaVPDGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaVPDSetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL void
+ostiCOMMgntVPDSetIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status
+ );
+
+osGLOBAL void
+tdsaFreeCardID(tiRoot_t *tiRoot,
+ bit32 CardID
+ );
+
+
+osGLOBAL bit32
+tdsaAbortAll(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL bit32
+tdsaFindLocalMCN(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL bit32
+tdsaRegDumpGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaNVMDSetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaNVMDGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL void ostiGetGpioIOCTLRsp(
+ tiRoot_t *tiRoot,
+ bit32 status,
+ bit32 gpioReadValue,
+ agsaGpioPinSetupInfo_t *gpioPinSetupInfo,
+ agsaGpioEventSetupInfo_t *gpioEventSetupInfo
+ );
+
+osGLOBAL bit32
+tdsaGpioSetup(
+ tiRoot_t *tiRoot,
+ agsaContext_t *agContext,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2
+ );
+
+
+osGLOBAL bit32
+tdsaSGpioIoctlSetup(
+ tiRoot_t *tiRoot,
+ agsaContext_t *agContext,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2
+ );
+
+osGLOBAL void ostiSgpioIoctlRsp(
+ tiRoot_t *tiRoot,
+ agsaSGpioReqResponse_t *pSgpioResponse
+ );
+osGLOBAL bit32
+tdsaDeviceInfoGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaIoErrorStatisticGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaIoEventStatisticGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaForensicDataGetIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaSendSMPIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaSendBISTIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaSendTMFIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ unsigned long resetType
+ );
+
+
+osGLOBAL bit32
+tdsaRegisterIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL bit32
+tdsaGetPhyGeneralStatusIoctl(
+ tiRoot_t *tiRoot,
+ agsaPhyGeneralState_t *PhyData
+ );
+
+osGLOBAL void ostiGetPhyGeneralStatusRsp(
+ tiRoot_t *tiRoot,
+ agsaSASPhyGeneralStatusPage_t *GenStatus,
+ bit32 phyID
+ );
+
+
+osGLOBAL bit32
+tdsaPhyProfileIoctl(
+ tiRoot_t *tiRoot,
+ tiIOCTLPayload_t *agIOCTLPayload,
+ void *agParam1,
+ void *agParam2,
+ void *agParam3
+ );
+
+osGLOBAL void
+tdsaDeregisterDevicesInPort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+#ifdef VPD_TESTING
+osGLOBAL bit32
+tdsaVPDGet(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL bit32
+tdsaVPDSet(
+ tiRoot_t *tiRoot
+ );
+
+#endif
+
+/*****************************************************************************
+*
+* SAS SHARED PROTOTYPES
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaJumpTableInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaPortContextInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaPortContextReInit(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL void
+tdsaDeviceDataInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaDeviceDataReInit(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+#ifdef TD_INT_COALESCE
+osGLOBAL void
+tdsaIntCoalCxtInit(
+ tiRoot_t *tiRoot
+ );
+#endif
+
+osGLOBAL FORCEINLINE bit32
+tdsaRotateQnumber(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData);
+
+osGLOBAL bit32
+tdsaRotateQnumber1(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData );
+osGLOBAL void
+tdssRemoveSASSATAFromSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *PortContext_Instance
+ );
+osGLOBAL void
+tdssRemoveSASSATAFromSharedcontextByReset(
+ agsaRoot_t *agRoot
+ );
+osGLOBAL bit32
+tdssSASFindDiscoveringExpander(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+
+osGLOBAL void
+tdssAddSASToSharedcontext(
+ tdsaPortContext_t *tdsaPortContext_Instance,
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ tdsaSASSubID_t *agSASSubID,
+ bit32 registered,
+ bit8 phyID,
+ bit32 flag
+ );
+
+osGLOBAL void
+tdssRemoveSASFromSharedcontext(
+ tdsaPortContext_t *tdsaPortContext_Ins,
+ tdsaDeviceData_t *tdsaDeviceData_ins,
+ agsaRoot_t *agRoot
+ );
+
+osGLOBAL void
+tdssRemoveAllDevicelistFromPortcontext(
+ tdsaPortContext_t *PortContext_Ins,
+ agsaRoot_t *agRoot
+ );
+
+osGLOBAL void
+tdssAddSATAToSharedcontext( tdsaPortContext_t *tdsaPortContext_Instance,
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaSATADeviceInfo_t *agSATADeviceInfo,
+ bit32 registered,
+ bit8 phyID
+ );
+
+osGLOBAL void
+tdssSubAddSATAToSharedcontext( tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdssRetrySATAID( tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdssInitSASPortStartInfo(
+ tiRoot_t *tiRoot
+ );
+#ifndef ossaDeviceRegistrationCB
+osGLOBAL void
+ossaDeviceRegistrationCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ bit32 status,
+ agsaDevHandle_t *agDevHandle,
+ bit32 deviceID);
+#endif
+
+#ifndef ossaDeregisterDeviceHandleCB
+osGLOBAL void
+ossaDeregisterDeviceHandleCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status
+ );
+#endif
+
+#ifdef INITIATOR_DRIVER
+/*****************************************************************************
+*
+* SAS Initiator only PROTOTYPES
+*
+*****************************************************************************/
+osGLOBAL bit32
+itdssInit(
+ tiRoot_t *tiRoot,
+ tiInitiatorResource_t *initiatorResource,
+ tiTdSharedMem_t *tdSharedMem
+ );
+
+osGLOBAL void
+itdssInitTimers (
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL FORCEINLINE void
+itdssIOCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssTaskCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssQueryTaskCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssSMPCompleted (
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ );
+
+osGLOBAL void
+ossaSMPCAMCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ );
+
+osGLOBAL void
+itdssIOSuccessHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssIOAbortedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+#ifdef REMOVED
+osGLOBAL void
+itdssIOOverFlowHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam
+ );
+#endif
+
+osGLOBAL void
+itdssIOUnderFlowHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIOFailedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIOAbortResetHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssIONotValidHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIONoDeviceHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+#ifdef REMOVED /* removed from spec */
+osGLOBAL void
+itdssIllegalParameterHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam
+ );
+#endif
+
+osGLOBAL void
+itdssLinkFailureHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssProgErrorHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorBreakHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorPhyNotReadyHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorProtocolNotSupprotedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorZoneViolationHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorBreakHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorITNexusLossHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorBadDestinationHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorConnectionRateNotSupportedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssOpenCnxErrorSTPResourceBusyHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorWrongDestinationHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorUnknownErrorHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorNAKReceivedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorACKNAKTimeoutHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorPeerAbortedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorRxFrameHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorDMAHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorCreditTimeoutHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssXferErrorCMDIssueACKNAKTimeoutHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorCMDIssueBreakBeforeACKNAKHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorCMDIssuePhyDownBeforeACKNAKHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorDisruptedPhyDownHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorOffsetMismatchHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorXferZeroDataLenHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssXferOpenRetryTimeoutHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssPortInResetHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssDsNonOperationalHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssDsInRecoveryHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssTmTagNotFoundHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssSSPExtIUZeroLenHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssXferErrorUnexpectedPhaseHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+#ifdef REMOVED
+osGLOBAL void
+itdssIOUnderFlowWithChkConditionHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam
+ );
+#endif
+
+osGLOBAL void
+itdssEncryptionHandler (
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssXferOpenRetryBackoffThresholdReachedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssOpenCnxErrorItNexusLossOpenTmoHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorItNexusLossNoDestHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorItNexusLossOpenCollideHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssOpenCnxErrorItNexusLossOpenPathwayBlockedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssDifHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIOResourceUnavailableHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIORQEBusyFullHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssXferErrorInvalidSSPRspFrameHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssXferErrorEOBDataOverrunHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssOpenCnxErrorOpenPreemptedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+/* default handler */
+osGLOBAL void
+itdssIODefaultHandler (
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+osGLOBAL void
+itdssIOForDebugging1Completed(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIOForDebugging2Completed(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssIOForDebugging3Completed(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+itdssInitDiscoveryModule (
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+itdssGetResource (
+ tiRoot_t *tiRoot,
+ tiInitiatorResource_t *initiatorResource
+ );
+
+
+osGLOBAL void
+itdssGetOperatingOptionParams(
+ tiRoot_t *tiRoot,
+ itdssOperatingOption_t *OperatingOption
+ );
+
+
+osGLOBAL FORCEINLINE bit32
+itdssIOPrepareSGL(
+ tiRoot_t *tiRoot,
+ tdIORequestBody_t *IORequestBody,
+ tiSgl_t *tiSgl1,
+ void *sglVirtualAddr
+ );
+
+#ifdef FDS_SM
+osGLOBAL void
+smReportRemoval(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdsaPortContext_t *onePortContext
+ );
+osGLOBAL void
+smReportRemovalDirect(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+osGLOBAL void
+smHandleDirect(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ void *IDdata
+ );
+
+osGLOBAL void
+ossaSATAIDAbortCB(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 flag,
+ bit32 status
+ );
+
+osGLOBAL void
+ossaIniSetDeviceInfoCB(
+ agsaRoot_t *agRoot,
+ agsaContext_t *agContext,
+ agsaDevHandle_t *agDevHandle,
+ bit32 status,
+ bit32 option,
+ bit32 param
+ );
+
+#endif /* FDS_SM */
+
+#endif /* INITIATOR_DRIVER */
+
+#ifdef TARGET_DRIVER
+/*****************************************************************************
+*
+* SAS Target only PROTOTYPES (ttdproto.h)
+*
+*****************************************************************************/
+osGLOBAL bit32
+ttdssInit(
+ tiRoot_t *tiRoot,
+ tiTargetResource_t *targetResource,
+ tiTdSharedMem_t *tdSharedMem
+ );
+
+osGLOBAL void
+ttdssGetResource (
+ tiRoot_t *tiRoot,
+ tiTargetResource_t *targetResource
+ );
+
+osGLOBAL void
+ttdssGetTargetParams(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+ttdssGetOperatingOptionParams(
+ tiRoot_t *tiRoot,
+ ttdssOperatingOption_t *OperatingOption
+ );
+
+osGLOBAL agBOOLEAN
+ttdsaXchgInit(
+ tiRoot_t *tiRoot,
+ ttdsaXchgData_t *ttdsaXchgData,
+ tiTargetMem_t *tgtMem,
+ bit32 maxNumXchgs
+ );
+
+osGLOBAL void
+ttdsaXchgLinkInit(
+ tiRoot_t *tiRoot,
+ ttdsaXchg_t *ttdsaXchg
+ );
+
+
+osGLOBAL void
+ttdsaXchgFreeStruct(
+ tiRoot_t *tiRoot,
+ ttdsaXchg_t *ttdsaXchg
+ );
+osGLOBAL void
+ttdsaSSPReqReceived(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaFrameHandle_t agFrameHandle,
+ bit32 agInitiatorTag,
+ bit32 parameter,
+ bit32 agFrameLen
+ );
+
+osGLOBAL ttdsaXchg_t
+*ttdsaXchgGetStruct(
+ agsaRoot_t *agRoot
+ );
+osGLOBAL void
+ttdsaDumpallXchg(tiRoot_t *tiRoot);
+
+osGLOBAL void
+tdsaProcessCDB(
+ agsaSSPCmdInfoUnit_t *cmdIU,
+ ttdsaXchg_t *ttdsaXchg
+ );
+
+osGLOBAL bit32
+ttdssIOPrepareSGL(
+ tiRoot_t *tiRoot,
+ tdIORequestBody_t *tdIORequestBody,
+ tiSgl_t *tiSgl1,
+ tiSgl_t *tiSgl2,
+ void *sglVirtualAddr);
+
+osGLOBAL void
+ttdsaIOCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle,
+ bit32 agOtherInfo
+ );
+
+osGLOBAL void
+ttdsaTMProcess(
+ tiRoot_t *tiRoot,
+ ttdsaXchg_t *ttdsaXchg
+ );
+
+osGLOBAL void
+ttdsaSMPReqReceived(
+ agsaRoot_t *agRoot,
+ agsaDevHandle_t *agDevHandle,
+ agsaSMPFrameHeader_t *agFrameHeader,
+ agsaFrameHandle_t agFrameHandle,
+ bit32 agFrameLength,
+ bit32 phyId
+ );
+osGLOBAL void
+ttdsaSMPCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ //agsaSMPFrameHeader_t *agFrameHeader, (TP)
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ );
+osGLOBAL bit32
+ttdsaSendResp(
+ agsaRoot_t *agRoot,
+ ttdsaXchg_t *ttdsaXchg
+ );
+
+osGLOBAL void
+ttdssReportRemovals(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 flag
+ );
+
+
+osGLOBAL void
+ttdsaAbortAll(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+ttdssIOAbortedHandler(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit32 agOtherInfo
+ );
+
+#endif /* TARGET_DRIVER */
+
+
+
+/*****************************************************************************
+*
+* For debugging only
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaPrintSwConfig(
+ agsaSwConfig_t *SwConfig
+ );
+
+osGLOBAL void
+tdsaPrintHwConfig(
+ agsaHwConfig_t *HwConfig
+ );
+osGLOBAL void
+tdssPrintSASIdentify(
+ agsaSASIdentify_t *id
+ );
+osGLOBAL void
+print_tdlist_flink(tdList_t *hdr, int type, int flag);
+
+osGLOBAL void
+print_tdlist_blink(tdList_t *hdr, int flag);
+
+osGLOBAL void
+tdhexdump(const char *ptitle, bit8 *pbuf, int len);
+
+
+/*****************************************************************************
+*
+* SAT only PROTOTYPE
+*
+*****************************************************************************/
+
+#ifdef SATA_ENABLE
+
+/*****************************************************************************
+ *! \brief satIOStart
+ *
+ * This routine is called to initiate a new SCSI request to SATL.
+ *
+ * \param tiRoot: Pointer to TISA initiator driver/port instance.
+ * \param tiIORequest: Pointer to TISA I/O request context for this I/O.
+ * \param tiDeviceHandle: Pointer to TISA device handle for this I/O.
+ * \param tiScsiRequest: Pointer to TISA SCSI I/O request and SGL list.
+ * \param satIOContext_t: Pointer to the SAT IO Context
+ *
+ * \return:
+ *
+ * \e tiSuccess: I/O request successfully initiated.
+ * \e tiBusy: No resources available, try again later.
+ * \e tiIONoDevice: Invalid device handle.
+ * \e tiError: Other errors that prevent the I/O request to be started.
+ *
+ *
+ *****************************************************************************/
+
+GLOBAL bit32 satIOStart(
+ tiRoot_t *tiRoot,
+ tiIORequest_t *tiIORequest,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiScsiInitiatorRequest_t *tiScsiRequest,
+ satIOContext_t *satIOContext
+ );
+
+/*****************************************************************************
+ *! \brief satIOAbort
+ *
+ * This routine is called to initiate a I/O abort to SATL.
+ * This routine is independent of HW/LL API.
+ *
+ * \param tiRoot: Pointer to TISA initiator driver/port instance.
+ * \param taskTag: Pointer to TISA I/O request context/tag to be aborted.
+ *
+ * \return:
+ *
+ * \e tiSuccess: I/O request successfully initiated.
+ * \e tiBusy: No resources available, try again later.
+ * \e tiError: Other errors that prevent the I/O request to be started.
+ *
+ *
+ *****************************************************************************/
+
+GLOBAL bit32 satIOAbort(
+ tiRoot_t *tiRoot,
+ tiIORequest_t *taskTag );
+
+
+/*****************************************************************************
+ *! \brief satTM
+ *
+ * This routine is called to initiate a TM request to SATL.
+ * This routine is independent of HW/LL API.
+ *
+ * \param tiRoot: Pointer to TISA initiator driver/port instance.
+ * \param tiDeviceHandle: Pointer to TISA device handle for this I/O.
+ * \param task: SAM-3 task management request.
+ * \param lun: Pointer to LUN.
+ * \param taskTag: Pointer to the associated task where the TM
+ * command is to be applied.
+ * \param currentTaskTag: Pointer to tag/context for this TM request.
+ *
+ * \return:
+ *
+ * \e tiSuccess: I/O request successfully initiated.
+ * \e tiBusy: No resources available, try again later.
+ * \e tiIONoDevice: Invalid device handle.
+ * \e tiError: Other errors that prevent the I/O request to be started.
+ *
+ *
+ *****************************************************************************/
+
+osGLOBAL bit32 satTM(
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle,
+ bit32 task,
+ tiLUN_t *lun,
+ tiIORequest_t *taskTag,
+ tiIORequest_t *currentTaskTag,
+ tdIORequestBody_t *tiRequestBody,
+ bit32 NotifyOS
+ );
+
+
+#endif /* SAT only */
+
+#ifdef INITIATOR_DRIVER
+#ifdef TD_DISCOVER
+
+osGLOBAL void
+tdsaExpanderInit(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL bit32
+tdsaDiscover(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 type,
+ bit32 option
+ );
+
+osGLOBAL bit32
+tdsaSASFullDiscover(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL bit32
+tdsaSATAFullDiscover(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+osGLOBAL bit32
+tdsaSASIncrementalDiscover(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL bit32
+tdsaSATAIncrementalDiscover(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL void
+tdsaSASUpStreamDiscoverStart(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaSASUpStreamDiscovering(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+
+osGLOBAL void
+tdsaSASDownStreamDiscoverStart(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaSASDownStreamDiscovering(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaSASDiscoverDone(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 flag
+ );
+
+osGLOBAL void
+tdsaSATADiscoverDone(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 flag
+ );
+
+osGLOBAL void
+tdsaAckBC(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL void
+tdsaDiscoveryResetProcessed(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+
+
+osGLOBAL void
+tdsaSASUpStreamDiscoverExpanderPhy(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander,
+ smpRespDiscover_t *pDiscoverResp
+ );
+osGLOBAL tdsaExpander_t *
+tdsaFindUpStreamConfigurableExp(tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander);
+
+osGLOBAL void
+tdsaSASDownStreamDiscoverExpanderPhy(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander,
+ smpRespDiscover_t *pDiscoverResp
+ );
+osGLOBAL void
+tdsaSASUpStreamDiscoverExpanderPhySkip(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+osGLOBAL tdsaExpander_t *
+tdsaFindDownStreamConfigurableExp(tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander);
+
+osGLOBAL void
+tdsaSASDownStreamDiscoverExpanderPhySkip(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+osGLOBAL void
+tdsaDiscoveringStpSATADevice(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+
+osGLOBAL void
+tdsaSASExpanderUpStreamPhyAdd(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander,
+ bit8 phyId
+ );
+
+osGLOBAL void
+tdsaSASExpanderDownStreamPhyAdd(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander,
+ bit8 phyId
+ );
+osGLOBAL bit16
+tdsaFindCurrentDownStreamPhyIndex(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander
+ );
+
+osGLOBAL tdsaDeviceData_t *
+tdsaPortSASDeviceFind(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 sasAddrLo,
+ bit32 sasAddrHi
+ );
+
+GLOBAL tdsaDeviceData_t *
+tdsaPortSASDeviceAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ agsaSASIdentify_t sasIdentify,
+ bit32 sasInitiator,
+ bit8 connectionRate,
+ bit32 itNexusTimeout,
+ bit32 firstBurstSize,
+ bit32 deviceType,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ );
+
+
+
+
+
+/* in tdport.c */
+osGLOBAL tdsaDeviceData_t *
+tdssNewAddSASToSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ );
+osGLOBAL void
+tdsaResetValidDeviceData(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+
+osGLOBAL void
+tdssReportChanges(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext );
+
+osGLOBAL void
+tdssReportRemovals(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 flag
+ );
+osGLOBAL void
+tdssInternalRemovals(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext
+ );
+osGLOBAL void
+tdssDiscoveryErrorRemovals(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL void
+tdsaSASDiscoverAbort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+
+osGLOBAL tdsaDeviceData_t *
+tdsaFindRegNValid(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ );
+bit32
+tdssNewSASorNot(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ );
+
+
+osGLOBAL tdsaExpander_t *
+tdssSASDiscoveringExpanderAlloc(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdssSASDiscoveringExpanderAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+
+osGLOBAL void
+tdssSASDiscoveringExpanderRemove(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+
+GLOBAL bit32
+tdssSATADeviceTypeDecode(
+ bit8 *pSignature
+ );
+
+
+GLOBAL tdsaDeviceData_t *
+tdsaPortSATADeviceAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneSTPBridge,
+ bit8 *Signature,
+ bit8 pm,
+ bit8 pmField,
+ bit8 connectionRate,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ );
+
+/* in tdport.c */
+osGLOBAL tdsaDeviceData_t *
+tdssNewAddSATAToSharedcontext(tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ agsaSATADeviceInfo_t *agSATADeviceInfo,
+ bit8 *Signature,
+ bit8 pm,
+ bit8 pmField,
+ bit32 connectionRate,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ );
+
+osGLOBAL tdsaDeviceData_t *
+tdsaFindRightDevice(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *tdsaDeviceData
+ );
+GLOBAL void
+ossaIDCDiscoverCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ void *agFirstDword,
+ bit32 agIOInfoLen,
+ agsaFrameHandle_t agFrameHandle
+ );
+
+osGLOBAL bit8
+tdsaFindLocalLinkRate(
+ tiRoot_t *tiRoot,
+ tdsaPortStartInfo_t *tdsaPortStartInfo
+ );
+
+/* SMP related */
+
+osGLOBAL bit32
+tdSMPStart(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ bit32 functionCode,
+ bit8 *pSmpBody,
+ bit32 smpBodySize,
+ bit32 agRequestType,
+ tiIORequest_t *CurrentTaskTag,
+ bit32 queueNumber
+ );
+//temp for testing
+osGLOBAL void
+tdsaReportManInfoSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaReportManInfoRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle
+ );
+
+//end temp for testing
+
+osGLOBAL void
+tdsaReportGeneralSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaReportGeneralRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle
+ );
+osGLOBAL void
+tdsaDiscoverSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaDiscoverRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle
+ );
+
+
+osGLOBAL void
+tdsaReportPhySataSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ bit8 phyId
+ );
+
+
+
+osGLOBAL void
+tdsaReportPhySataRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle
+ );
+
+osGLOBAL bit32
+tdsaSASRoutingEntryAdd(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander,
+ bit32 phyId,
+ bit32 configSASAddressHi,
+ bit32 configSASAddressLo
+ );
+
+
+osGLOBAL void
+tdsaConfigRoutingInfoRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle
+ );
+
+osGLOBAL bit32
+tdsaPhyControlSend(
+ tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ bit8 phyOp,
+ tiIORequest_t *CurrentTaskTag,
+ bit32 queueNumber
+ );
+
+osGLOBAL void
+tdsaPhyControlRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle,
+ tiIORequest_t *CurrentTaskTag
+ );
+
+osGLOBAL void
+tdsaPhyControlFailureRespRcvd(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPFrameHeader_t *frameHeader,
+ agsaFrameHandle_t frameHandle,
+ tiIORequest_t *CurrentTaskTag
+ );
+
+
+osGLOBAL void
+tdsaDumpAllExp(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+osGLOBAL void
+tdsaDumpAllUpExp(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+osGLOBAL void
+tdsaCleanAllExp(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+osGLOBAL void
+tdsaFreeAllExp(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+osGLOBAL void
+tdsaDumpAllFreeExp(
+ tiRoot_t *tiRoot
+ );
+
+osGLOBAL void
+tdsaDiscoveryTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaDiscoveryTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaConfigureRouteTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander,
+ smpRespDiscover_t *ptdSMPDiscoverResp
+ );
+
+osGLOBAL void
+tdsaConfigureRouteTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaDeviceRegistrationTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+osGLOBAL void
+tdsaDeviceRegistrationTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaSMPBusyTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaDeviceData_t *oneDeviceData,
+ tdssSMPRequestBody_t *tdSMPRequestBody
+ );
+
+osGLOBAL void
+tdsaSMPBusyTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaSATAIDDeviceTimer(tiRoot_t *tiRoot,
+ tdsaDeviceData_t *oneDeviceData
+ );
+#ifdef FDS_SM
+osGLOBAL void
+tdIDStartTimer(tiRoot_t *tiRoot,
+ smIORequest_t *smIORequest,
+ tdsaDeviceData_t *oneDeviceData
+ );
+osGLOBAL void
+tdIDStartTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+#endif
+osGLOBAL void
+tdsaBCTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL void
+tdsaBCTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaSATAIDDeviceTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+tdsaDiscoverySMPTimer(tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 functionCode,
+ tdssSMPRequestBody_t *tdSMPRequestBody
+ );
+
+osGLOBAL void
+tdsaDiscoverySMPTimerCB(
+ tiRoot_t * tiRoot,
+ void * timerData1,
+ void * timerData2,
+ void * timerData3
+ );
+
+osGLOBAL void
+dumpRoutingAttributes(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander,
+ bit8 phyID
+ );
+
+osGLOBAL bit32
+tdsaDuplicateConfigSASAddr(
+ tiRoot_t *tiRoot,
+ tdsaExpander_t *oneExpander,
+ bit32 configSASAddressHi,
+ bit32 configSASAddressLo
+ );
+
+osGLOBAL tdsaExpander_t *
+tdsaFindConfigurableExp(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaExpander_t *oneExpander
+ );
+
+GLOBAL bit32
+tdsaDiscoveryStartIDDev(
+ tiRoot_t *tiRoot,
+ tiIORequest_t *tiIORequest,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiScsiInitiatorRequest_t *tiScsiRequest,
+ tdsaDeviceData_t *oneDeviceData
+ );
+
+GLOBAL void satFreeIntIoResource(
+ tiRoot_t *tiRoot,
+ satDeviceData_t *satDevData,
+ satInternalIo_t *satIntIo);
+osGLOBAL void
+tddmDeregisterDevicesInPort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+#ifdef AGTIAPI_CTL
+osGLOBAL void
+tdsaCTLSet(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tiIntrEventType_t eventType,
+ bit32 eventStatus);
+
+STATIC void
+tdsaCTLNextDevice(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdIORequest_t *tdIORequest,
+ tdList_t *DeviceList);
+
+STATIC int
+tdsaCTLModeSelect(
+ tiRoot_t *tiRoot,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tdIORequest_t *tdIORequest);
+
+STATIC void
+tdsaCTLIOCompleted(
+ agsaRoot_t *agRoot,
+ agsaIORequest_t *agIORequest,
+ bit32 agIOStatus,
+ bit32 agIOInfoLen,
+ void *agParam,
+ bit16 sspTag,
+ bit32 agOtherInfo);
+#endif /* AGTIAPI_CTL */
+
+#endif /* TD_DISCOVER */
+#endif /* INITIATOR_DRIVER */
+
+#ifdef FDS_DM
+/********** For DM *******/
+osGLOBAL tdsaDeviceData_t *
+tddmPortDeviceAdd(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ dmDeviceInfo_t *dmDeviceInfo,
+ tdsaDeviceData_t *oneExpDeviceData
+ );
+
+osGLOBAL void
+tddmInvalidateDevicesInPort(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext
+ );
+
+osGLOBAL bit32
+tddmNewSASorNot(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID
+ );
+
+osGLOBAL tdsaDeviceData_t *
+tddmPortSASDeviceFind(
+ tiRoot_t *tiRoot,
+ tdsaPortContext_t *onePortContext,
+ bit32 sasAddrLo,
+ bit32 sasAddrHi
+ );
+
+osGLOBAL tdsaDeviceData_t *
+tddmAddToSharedcontext(
+ agsaRoot_t *agRoot,
+ tdsaPortContext_t *onePortContext,
+ tdsaSASSubID_t *agSASSubID,
+ tdsaDeviceData_t *oneExpDeviceData,
+ bit8 phyID
+ );
+
+osGLOBAL void
+tdsaUpdateMCN(
+ dmRoot_t *dmRoot,
+ tdsaPortContext_t *onePortContext
+ );
+#endif
+
+GLOBAL void
+tdsaSingleThreadedEnter(tiRoot_t *ptiRoot, bit32 queueId);
+
+GLOBAL void
+tdsaSingleThreadedLeave(tiRoot_t *ptiRoot, bit32 queueId);
+
+#ifdef PERF_COUNT
+GLOBAL void
+tdsaEnter(tiRoot_t *ptiRoot, int io);
+
+GLOBAL void
+tdsaLeave(tiRoot_t *ptiRoot, int io);
+
+#define TDSA_INP_ENTER(root) tdsaEnter(root, 0)
+#define TDSA_INP_LEAVE(root) tdsaLeave(root, 0)
+#define TDSA_OUT_ENTER(root) tdsaEnter(root, 1)
+#define TDSA_OUT_LEAVE(root) tdsaLeave(root, 1)
+#else
+#define TDSA_INP_ENTER(root)
+#define TDSA_INP_LEAVE(root)
+#define TDSA_OUT_ENTER(root)
+#define TDSA_OUT_LEAVE(root)
+#endif
+
+#if defined(FDS_DM) && defined(FDS_SM)
+GLOBAL void
+tdIDStart(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ smRoot_t *smRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdsaPortContext_t *onePortContext
+ );
+#endif
+
+void t_MacroCheck( agsaRoot_t *agRoot);
+
+#endif /* __TDPROTO_H__ */
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h
new file mode 100644
index 0000000..9f56775
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h
@@ -0,0 +1,387 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ *
+ * The file defines data structures for SAS/SATA TD layer
+ *
+ */
+
+#ifndef __TDSATYPES_H
+#define __TDSATYPES_H
+
+#define ESGL_PAGES_SIZE sizeof(agsaEsgl_t) /** the esgl page size */
+#define NUM_ESGL_PAGES 0 /* old value 512 */ /**< the default number of esgl pages */
+
+
+/**< target device type */
+#define TD_DEFAULT_DEVICE 0
+#define TD_SAS_DEVICE 1
+#define TD_SATA_DEVICE 2
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdioctl.h>
+
+
+/** \brief data structure for SATA Host
+ *
+ * to be developed
+ *
+ */
+typedef struct itdstHost_s
+{
+ int i;
+} itdstHost_t;
+
+/** \brief data structure for SATA Device
+ *
+ * to be developed
+ *
+ */
+typedef struct ttdstDevice_s
+{
+ int i;
+} ttdstDevice_t;
+
+#ifdef INITIATOR_DRIVER
+typedef struct itdsaIni_s {
+ /**< point to the shared structure bothe SAS and SATA */
+ struct tdsaContext_s *tdsaAllShared;
+ itdssOperatingOption_t OperatingOption;
+ tdSCSIStatusCount_t ScsiStatusCounts;
+ tdSenseKeyCount_t SenseKeyCounter;
+ bit32 NumIOsActive;
+ /* the list of initiator timer; upon expiration timer CB fn is called
+ eg) itdProcessTimers()
+ */
+ tdList_t timerlist;
+} itdsaIni_t;
+#endif
+
+struct ttdsaXchgAllocFreeInfoList_s;
+
+#ifdef TARGET_DRIVER
+typedef struct ttdsaTgt_s {
+ /* point to the shared across SAS and SATA */
+ struct tdsaContext_s *tdsaAllShared;
+ ttdssOperatingOption_t OperatingOption;
+ tiTargetOption_t tiOperatingOption;
+ ttdsaXchgData_t ttdsaXchgData;
+#ifdef PASSTHROUGH
+ /* registered passthrough CB */
+ ostiProcessPassthroughCmnd_t PasthroughCB;
+#endif
+} ttdsaTgt_t;
+#endif
+
+
+/** \brief data structure for SATA Device
+ *
+ * not in use yet. just a place holderto be develped
+ *
+ */
+typedef struct tdHardwareInfo_s {
+ bit16 DeviceID;
+ bit16 VendorID;
+ bit8 ChipRev;
+ bit32 PciFunctionNumber;
+ bit32 FlashRomPresent;
+} tdHardwareInfo_t;
+
+
+/** \brief data structure for ESLG page
+ *
+ * This data structure describes the ESGL page maintained in TD layer.
+ * One important field is agEsgl which is pointer to assaEsgl_t data structure,
+ * which describes ESGL used in lower layer.
+ * Memory for this data structure is allocated using tiTdSharedMem_t data
+ * structure. However, Memory for agsaEsgl_t data structure is allocated using
+ * tiLoLevelResource_t.
+ *
+ */
+typedef struct tdsaEsglPageInfo_s {
+ tdList_t tdlist; /**< pointers to next and previous pages */
+ bit32 physAddressUpper; /**< upper physical address of the page */
+ bit32 physAddressLower; /**< lower physical address of the page */
+ bit32 len;
+ agsaEsgl_t *agEsgl;
+ bit32 id; /**< for debugging only */
+} tdsaEsglPageInfo_t;
+
+/** \brief data structure for ESLG page pool
+ *
+ * This data structure describes the pool of esgl pages
+ *
+ */
+typedef struct tdsaEsglPagePool_s {
+ tdsaEsglPageInfo_t EsglPages[1]; /**< variable size array */
+} tdsaEsglPagePool_t;
+
+
+/** \brief data structure for ESGL pool information
+ *
+ * This data structure maintains information about ESGL pool. For example, this
+ * data structure maintains the number of free and total ESGL pages and uses
+ * tdList_t data structure for listing of ESGL pages.
+ *
+ */
+typedef struct tdsaEsglAllInfo_s {
+ /*
+ used in tdGetEsglPages()
+ */
+ tdList_t mainlist; /* not used */
+ tdList_t freelist;
+ bit32 NumEsglPages;
+ bit32 NumFreeEsglPages;
+ bit32 EsglPageSize;
+ bit32 physAddrUpper;
+ bit32 physAddrLower;
+ void *virtPtr;
+ tdsaEsglPagePool_t *EsglPagePool;
+} tdsaEsglAllInfo_t;
+
+typedef struct smp_pass_through_req
+{
+ bit8 exp_sas_addr[8]; //Storing the 16 digit expander SAS-address
+ bit32 smp_req_len; //Length of the request frame
+ bit32 smp_resp_len; //Length of the response frame
+ bit8 smp_req_resp[1]; //Pointer to the request-response frame
+}smp_pass_through_req_t;
+
+#ifdef TD_INT_COALESCE
+typedef struct tdsaIntCoalesceContext_s {
+ tdList_t MainLink; /* free */
+ tdList_t FreeLink; /* in use */
+ struct tdsaContext_s *tdsaAllShared;
+#ifdef OS_INT_COALESCE
+ tiIntCoalesceContext_t *tiIntCoalesceCxt;
+#endif
+ agsaIntCoalesceContext_t agIntCoalCxt;
+ /* for debug */
+ bit32 id;
+
+} tdsaIntCoalesceContext_t;
+#endif
+
+typedef struct tdsaHwEventSource_s {
+ bit32 EventValid;
+ agsaEventSource_t Source;
+} tdsaHwEventSource_t;
+
+/** \brief data structure for SAS/SATA context at TD layer
+ *
+ * This data structure is used for both SAS and SATA.
+ * In addition, this is the data structure used mainly to communicate with
+ * lower layer.
+ *
+ */
+typedef struct tdsaContext_s {
+ bit32 currentOperation;
+
+ /**< agsaRoot_t->osData points to this */
+ struct tdsaRootOsData_s agRootOsDataForInt; /* for interrupt */
+ struct tdsaRootOsData_s agRootOsDataForNonInt; /* for non-interrupt */
+
+ agsaRoot_t agRootInt; /* for interrupt */
+ agsaRoot_t agRootNonInt; /* for non-interrupt */
+
+ /* flags values commonly used for both SAS and SATA */
+ struct tdsaComMemFlags_s flags;
+
+
+ /**< software-related initialization params used in saInitialize() */
+ agsaSwConfig_t SwConfig;
+
+ /**< Queue-related initialization params used in saInitialize() */
+ agsaQueueConfig_t QueueConfig;
+
+ /**< hardware-related initialization params used in saInitialize() */
+ agsaHwConfig_t HwConfig;
+
+
+ /**< Copy of TI low level resoure */
+ tiLoLevelResource_t loResource;
+
+ /* information of ESGL pages allocated
+ tdsaEsglAllInfo_t EsglAllInfo;
+ */
+
+ /* hardware information; just place holder
+ tdHardwareInfo_t hwInfo;
+ */
+
+ bit32 currentInterruptDelay;
+
+ /**< timers used commonly in SAS/SATA */
+ tdList_t timerlist;
+ /***********************************************************************/
+ /* used to be in tdssContext_t tdssSASShared;*/
+ struct itdsaIni_s *itdsaIni; /* Initiator; */
+ struct ttdsaTgt_s *ttdsaTgt; /* Target */
+ /**< pointer to PortContext memory; */
+ tdsaPortContext_t *PortContextMem;
+ /**< pointer to Device memory */
+ tdsaDeviceData_t *DeviceMem;
+
+ tdList_t FreePortContextList;
+ tdList_t MainPortContextList;
+ tdList_t FreeDeviceList;
+ tdList_t MainDeviceList;
+
+ /**< actual storage for jump table */
+ tdsaJumpTable_t tdJumpTable;
+ /**< Local SAS port start information such as ID addr */
+ tdsaPortStartInfo_t Ports[TD_MAX_NUM_PHYS];
+ /***********************************************************************/
+ /**< storage for FW download contents */
+ tdFWControlEx_t tdFWControlEx;
+#ifdef SPC_ENABLE_PROFILE
+ tdFWProfileEx_t tdFWProfileEx;
+#endif
+#ifdef TD_INT_COALESCE
+ tdsaIntCoalesceContext_t *IntCoalesce;
+#endif
+
+ /* first time a card is processed set this true */
+ bit32 first_process;
+
+ /* expander list */
+ tdsaExpander_t *ExpanderHead;
+ // tdList_t discoveringExpanderList;
+ tdList_t freeExpanderList;
+ bit32 phyCount;
+ bit32 IBQnumber;
+ bit32 OBQnumber;
+ bit32 InboundQueueSize[AGSA_MAX_OUTBOUND_Q];
+ bit32 InboundQueueEleSize[AGSA_MAX_OUTBOUND_Q];
+ bit32 OutboundQueueSize[AGSA_MAX_OUTBOUND_Q];
+ bit32 OutboundQueueEleSize[AGSA_MAX_OUTBOUND_Q];
+ bit32 OutboundQueueInterruptDelay[AGSA_MAX_OUTBOUND_Q];
+ bit32 OutboundQueueInterruptCount[AGSA_MAX_OUTBOUND_Q];
+ bit32 OutboundQueueInterruptEnable[AGSA_MAX_OUTBOUND_Q];
+ bit32 InboundQueuePriority[AGSA_MAX_INBOUND_Q];
+ bit32 QueueOption;
+ bit32 tdDeviceIdVendId;
+ bit32 tdSubVendorId;
+ /* instance number */
+ bit8 CardIDString[TD_CARD_ID_LEN];
+ bit32 CardID;
+#ifdef VPD_TESTING
+ /* temp; for testing VPD indirect */
+ bit32 addrUpper;
+ bit32 addrLower;
+#endif
+
+ bit32 resetCount;
+ tdsaHwEventSource_t eventSource[TD_MAX_NUM_PHYS];
+ bit32 portTMO; /* in 100ms */
+ bit32 phyCalibration; /* enables or disables phy calibration */
+ bit32 FCA; /* force to clear affiliation by sending SMP HARD RESET */
+ bit32 SMPQNum; /* first high priority queue number for SMP */
+ bit32 ResetInDiscovery; /* hard/link reset in discovery */
+ bit32 FWMaxPorts;
+ bit32 IDRetry; /* SATA ID failurs are retired */
+ bit32 RateAdjust; /* allow retry open with lower connection rate */
+#ifdef AGTIAPI_CTL
+ bit16 SASConnectTimeLimit; /* used by tdsaCTLSet() */
+#endif
+ bit32 MaxNumOSLocks; /* max number of OS layer locks */
+ bit32 MaxNumLLLocks; /* max num of LL locks */
+ bit32 MaxNumLocks; /* max num of locks for layers and modules (LL, TDM, SATM, DM) */
+#ifdef FDS_DM
+ bit32 MaxNumDMLocks; /* max num of DM locks */
+ dmRoot_t dmRoot; /* discovery root */
+ dmSwConfig_t dmSwConfig;
+#endif
+#ifdef FDS_SM
+ bit32 MaxNumSMLocks; /* max num of SM locks */
+ smRoot_t smRoot; /* SATM root */
+ smSwConfig_t smSwConfig;
+#endif
+ bit32 MCN; /* temp; only for testing and to be set by registry or adj file */
+ bit32 sflag; /* Sflag bit */
+#ifdef CCFLAGS_PHYCONTROL_COUNTS
+ agsaPhyAnalogSetupRegisters_t analog[TD_MAX_NUM_PHYS];
+#endif /* CCFLAGS_PHYCONTROL_COUNTS */
+ bit32 stp_idle_time; /* stp idle time for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 STP_MCT_TMO; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 SSP_MCT_TMO; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 MAX_OPEN_TIME; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 SMP_MAX_CONN_TIMER; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 STP_FRM_TMO; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 MFD; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 OPNRJT_RTRY_INTVL; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 DOPNRJT_RTRY_TMO; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 COPNRJT_RTRY_TMO; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 DOPNRJT_RTRY_THR; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 COPNRJT_RTRY_THR; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ bit32 itNexusTimeout; /* set by registry */
+ bit32 MAX_AIP; /* for agsaSASProtocolTimerConfigurationPage_t; set by registry or adj file */
+ agsaMPIContext_t MpiOverride;
+#ifdef TI_GETFOR_ONRESET
+ bit8 FatalErrorData[(5 * (1024 * 1024))];
+#endif /* TI_GETFOR_ONRESET */
+ bit32 sgpioResponseSet; /*Used to sync between SGPIO Req and Resp */
+ volatile NvmdResponseSet;
+} tdsaContext_t;
+
+#ifdef FAST_IO_TEST
+#define CMDS_PER_IO_IOPS 1
+#define CMDS_PER_IO_DUP 1 //4
+#endif
+
+/** \brief the root data structure for TD layer
+ *
+ * This data structure is the main data structure used in communicating
+ * with OS layer. For example, tiRoot_t->tdData points to this data structure
+ * From this data structure, SATA host/Device and SAS initiator/target are found.
+ *
+ */
+typedef struct tdsaRoot_s
+{
+ /**<< common data structure for SAS/SATA */
+ tdsaContext_t tdsaAllShared;
+ bit32 autoGoodRSP;
+#ifdef INITIATOR_DRIVER
+ itdsaIni_t *itdsaIni; /**< SAS/SATA initiator */
+#endif
+#ifdef TARGET_DRIVER
+ ttdsaTgt_t *ttdsaTgt; /**< SAS/SATA target */
+#endif
+} tdsaRoot_t;
+
+typedef struct tmf_pass_through_req
+{
+ bit8 pathId;
+ bit8 targetId;
+ bit8 lun;
+}tmf_pass_through_req_t;
+
+/* Context Field accessors */
+#define TD_GET_TIROOT(sa_root) (((tdsaRootOsData_t *)(sa_root)->osData)->tiRoot)
+#define TD_GET_TDROOT(ti_root) ((tdsaRoot_t *)(ti_root)->tdData)
+#define TD_GET_TICONTEXT(ti_root) ((tdsaContext_t *)&TD_GET_TDROOT(ti_root)->tdsaAllShared)
+#define TD_GET_TIINI_CONTEXT(ti_root) ((itdsaIni_t *)TD_GET_TICONTEXT(ti_root)->itdsaIni)
+#define TD_GET_TITGT_CONTEXT(ti_root) ((ttdsaTgt_t *)TD_GET_TICONTEXT(ti_root)->ttdsaTgt)
+#endif /* __TDSATYPES_H */
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdsmcmnapi.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdsmcmnapi.c
new file mode 100644
index 0000000..8c32b81
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdsmcmnapi.c
@@ -0,0 +1,1410 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+
+********************************************************************************/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+/* for TIDEBUG_MSG */
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#endif
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+#if defined(SM_DEBUG)
+extern bit32 gSMDebugLevel;
+#endif
+
+osGLOBAL void
+smReportRemovalDirect(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ bit8 PhyID;
+
+ TI_DBG2(("smReportRemovalDirect: start\n"));
+
+ PhyID = oneDeviceData->phyID;
+
+ tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ /* put onedevicedata back to free list */
+ osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+
+ /* notifying link up */
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *) tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#endif
+ return;
+}
+
+osGLOBAL void
+smReportRemoval(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ tdsaPortContext_t *onePortContext
+ )
+{
+ TI_DBG2(("smReportRemoval: start\n"));
+
+ if (oneDeviceData->registered == agTRUE)
+ {
+ /*
+ 1. remove this device
+ 2. device removal event
+ */
+ tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ oneDeviceData->valid = agFALSE;
+ oneDeviceData->valid2 = agFALSE;
+ oneDeviceData->registered = agFALSE;
+ ostiInitiatorEvent(
+ tiRoot,
+ onePortContext->tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceRemoval,
+ agNULL
+ );
+ }
+
+ return;
+}
+osGLOBAL void
+smHandleDirect(
+ tiRoot_t *tiRoot,
+ agsaRoot_t *agRoot,
+ tdsaDeviceData_t *oneDeviceData,
+ void *IDdata
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ agsaSATAIdentifyData_t *pSATAIdData;
+ tdList_t *DeviceListList;
+ tdsaDeviceData_t *tmpOneDeviceData = agNULL;
+ int new_device = agTRUE;
+ bit8 PhyID;
+
+ TI_DBG2(("smHandleDirect: start\n"));
+ PhyID = oneDeviceData->phyID;
+
+ pSATAIdData = (agsaSATAIdentifyData_t *)IDdata;
+ //tdhexdump("satAddSATAIDDevCB after", (bit8 *)pSATAIdData, sizeof(agsaSATAIdentifyData_t));
+
+ /* compare idenitfy device data to the exiting list */
+ DeviceListList = tdsaAllShared->MainDeviceList.flink;
+ while (DeviceListList != &(tdsaAllShared->MainDeviceList))
+ {
+ tmpOneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
+ if (tmpOneDeviceData == agNULL)
+ {
+ TI_DBG1(("smHandleDirect: tmpOneDeviceData is NULL!!!\n"));
+ return;
+ }
+ TI_DBG1(("smHandleDirect: LOOP tmpOneDeviceData %p did %d\n", tmpOneDeviceData, tmpOneDeviceData->id));
+ //tdhexdump("smHandleDirect LOOP", (bit8 *)&tmpOneDeviceData->satDevData.satIdentifyData, sizeof(agsaSATAIdentifyData_t));
+
+ /* what is unique ID for sata device -> response of identify devicedata; not really
+ Let's compare serial number, firmware version, model number
+ */
+ if ( tmpOneDeviceData->DeviceType == TD_SATA_DEVICE &&
+ (osti_memcmp (tmpOneDeviceData->satDevData.satIdentifyData.serialNumber,
+ pSATAIdData->serialNumber,
+ 20) == 0) &&
+ (osti_memcmp (tmpOneDeviceData->satDevData.satIdentifyData.firmwareVersion,
+ pSATAIdData->firmwareVersion,
+ 8) == 0) &&
+ (osti_memcmp (tmpOneDeviceData->satDevData.satIdentifyData.modelNumber,
+ pSATAIdData->modelNumber,
+ 40) == 0)
+ )
+ {
+ TI_DBG2(("smHandleDirect: did %d\n", tmpOneDeviceData->id));
+ new_device = agFALSE;
+ break;
+ }
+ DeviceListList = DeviceListList->flink;
+ }
+
+
+ if (new_device == agFALSE)
+ {
+ TI_DBG2(("smHandleDirect: old device data\n"));
+ tmpOneDeviceData->valid = agTRUE;
+ tmpOneDeviceData->valid2 = agTRUE;
+ /* save data field from new device data */
+ tmpOneDeviceData->agRoot = agRoot;
+ tmpOneDeviceData->agDevHandle = oneDeviceData->agDevHandle;
+ tmpOneDeviceData->agDevHandle->osData = tmpOneDeviceData; /* TD layer */
+ tmpOneDeviceData->tdPortContext = oneDeviceData->tdPortContext;
+ tmpOneDeviceData->phyID = oneDeviceData->phyID;
+
+ /*
+ one SATA directly attached device per phy;
+ Therefore, deregister then register
+ */
+ saDeregisterDeviceHandle(agRoot, agNULL, oneDeviceData->agDevHandle, tdsaRotateQnumber(tiRoot, oneDeviceData));
+
+ if (tmpOneDeviceData->registered == agFALSE)
+ {
+ TI_DBG2(("smHandleDirect: re-registering old device data\n"));
+ /* already has old information; just register it again */
+ saRegisterNewDevice( /* smHandleDirect */
+ agRoot,
+ &tmpOneDeviceData->agContext,
+ 0,/*tdsaRotateQnumber(tiRoot, tmpOneDeviceData),*/
+ &tmpOneDeviceData->agDeviceInfo,
+ tmpOneDeviceData->tdPortContext->agPortContext,
+ 0
+ );
+ }
+
+// tdsaAbortAll(tiRoot, agRoot, oneDeviceData);
+ /* put tmpOneDeviceData back to free list */
+ osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
+ TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
+ TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
+
+ TI_DBG2(("smHandleDirect: pid %d\n", tdsaAllShared->Ports[PhyID].portContext->id));
+ /* notifying link up */
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+
+
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *) tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#endif
+ return;
+ }
+
+ TI_DBG2(("smHandleDirect: new device data\n"));
+ oneDeviceData->satDevData.satIdentifyData = *pSATAIdData;
+ /* notifying link up */
+ ostiPortEvent (
+ tiRoot,
+ tiPortLinkUp,
+ tiSuccess,
+ (void *)tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#ifdef INITIATOR_DRIVER
+ /* triggers discovery */
+ ostiPortEvent(
+ tiRoot,
+ tiPortDiscoveryReady,
+ tiSuccess,
+ (void *) tdsaAllShared->Ports[PhyID].tiPortalContext
+ );
+#endif
+
+ return;
+}
+
+/*
+ combine satAddSATAIDDevCB(expander) and satAddSATAIDDevCB(directly attached)
+*/
+osGLOBAL void
+tdsmIDCompletedCB(
+ smRoot_t *smRoot,
+ smIORequest_t *smIORequest,
+ smDeviceHandle_t *smDeviceHandle,
+ bit32 status,
+ void *IDdata
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ agsaRoot_t *agRoot;
+ tdIORequestBody_t *tdIORequestBody;
+ tdsaDeviceData_t *oneDeviceData;
+ tdsaPortContext_t *onePortContext;
+ tiPortalContext_t *tiPortalContext;
+ bit32 pid = 0xff;
+ bit32 IDstatus;
+ agsaSATAIdentifyData_t *pSATAIdData;
+
+ TI_DBG2(("tdsmIDCompletedCB: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ tdIORequestBody = (tdIORequestBody_t *)smIORequest->tdData;
+
+ if (smDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: smDeviceHandle is NULL !!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ oneDeviceData = (tdsaDeviceData_t *)smDeviceHandle->tdData;
+ onePortContext = oneDeviceData->tdPortContext;
+ agRoot = oneDeviceData->agRoot;
+ pid = tdIORequestBody->pid;
+
+
+// oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ oneDeviceData->satDevData.IDPending = agFALSE;
+
+ TI_DBG2(("tdsmIDCompletedCB: tdIORequestBody %p tdIORequestBody->osMemHandle %p\n", tdIORequestBody, tdIORequestBody->osMemHandle));
+
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+
+ if (oneDeviceData->tdIDTimer.timerRunning == agTRUE)
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ tdsaKillTimer(
+ tiRoot,
+ &oneDeviceData->tdIDTimer
+ );
+ }
+ else
+ {
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ }
+
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: onePortContext is NULL!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ /* check port id */
+ if (pid != onePortContext->id)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: not matching pid; pid %d onePortContext->id %d!!!\n", pid, onePortContext->id));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ smReportRemovalDirect(tiRoot, agRoot, oneDeviceData);
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ tiPortalContext= onePortContext->tiPortalContext;
+
+ if (tiPortalContext == agNULL)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: tiPortalContext is NULL!!!\n"));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ smReportRemovalDirect(tiRoot, agRoot, oneDeviceData);
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ if (agRoot == agNULL)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: agRoot is NULL!!!\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ return;
+ }
+
+ if (status == smIOSuccess)
+ {
+ TI_DBG2(("tdsmIDCompletedCB: smIOSuccess\n"));
+
+ oneDeviceData->satDevData.IDDeviceValid = agTRUE;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ TI_DBG2(("tdsmIDCompletedCB: directlyAttached\n"));
+ pSATAIdData = (agsaSATAIdentifyData_t *)IDdata;
+ smHandleDirect(tiRoot, agRoot, oneDeviceData, IDdata);
+ /* filling in */
+ osti_memcpy(onePortContext->remoteName, pSATAIdData->serialNumber, 20);
+ osti_memcpy(&(onePortContext->remoteName[20]), pSATAIdData->firmwareVersion, 8);
+ osti_memcpy(&(onePortContext->remoteName[28]), pSATAIdData->modelNumber, 40);
+ }
+ else /* expander attached */
+ {
+
+ TI_DBG2(("tdsmIDCompletedCB: expander attached\n"));
+
+ if (onePortContext->DiscoveryState == ITD_DSTATE_COMPLETED)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: ID completed after discovery is done; tiDeviceArrival\n"));
+ /* ID data completed after discovery is completed */
+ ostiInitiatorEvent(
+ tiRoot,
+ tiPortalContext,
+ agNULL,
+ tiIntrEventTypeDeviceChange,
+ tiDeviceArrival,
+ agNULL
+ );
+ }
+ }
+ TI_DBG2(("tdsmIDCompletedCB: tdIORequestBody %p tdIORequestBody->osMemHandle %p\n", tdIORequestBody, tdIORequestBody->osMemHandle));
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+ }
+ else if ( status == smIORetry)
+ {
+ TI_DBG1(("tdsmIDCompletedCB: smIORetry!!!\n"));
+ if ( !(oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE &&
+ oneDeviceData->tdPortContext != agNULL)
+ )
+ {
+ TI_DBG1(("tdsmIDCompletedCB: smIORetry but device is not valid!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ return;
+ }
+
+ if (tdIORequestBody->reTries <= SM_RETRIES)
+ {
+ tdIORequestBody->tiIORequest = agNULL; /* not in use */
+ tdIORequestBody->pid = onePortContext->id;
+ smIORequest->tdData = tdIORequestBody;
+ smIORequest->smData = &tdIORequestBody->smIORequestBody;
+
+ smDeviceHandle->tdData = oneDeviceData;
+
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+
+ IDstatus = smIDStart(smRoot,
+ smIORequest,
+ smDeviceHandle
+ );
+ if (IDstatus != SM_RC_SUCCESS)
+ {
+ /* identify device data is not valid */
+ TI_DBG1(("tdsmIDCompletedCB: smIDStart fail or busy %d!!!\n", IDstatus));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ return;
+ }
+ tdIORequestBody->reTries++;
+ tdIORequestBody->ioCompleted = agFALSE;
+ tdIORequestBody->ioStarted = agTRUE;
+ oneDeviceData->satDevData.IDPending = agTRUE;
+ /* start a timer */
+ tdIDStartTimer(tiRoot, smIORequest, oneDeviceData);
+ TI_DBG1(("tdsmIDCompletedCB: being retried!!!\n"));
+ }
+ else
+ {
+ /* give up */
+ TI_DBG1(("tdsmIDCompletedCB: retries are over!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ /* SATA device is not usable; remove it */
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ }
+ else if ( status == smIOSTPResourceBusy)
+ {
+ /* decides to send smp hard reset or not */
+ TI_DBG1(("tdsmIDCompletedCB: smIOSTPResourceBusy\n"));
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ if (tdsaAllShared->FCA)
+ {
+ if (oneDeviceData->SMNumOfFCA <= 0) /* does SMP HARD RESET only upto one time */
+ {
+ TI_DBG1(("tdsmIDCompletedCB: OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY; sending HARD_RESET\n"));
+ oneDeviceData->SMNumOfFCA++;
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ agNULL,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ }
+ else
+ {
+ /* given up after one time of SMP HARD RESET; */
+ TI_DBG1(("tdsmIDCompletedCB: OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY; but giving up sending HARD_RESET!!!\n"));
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ }
+ else
+ {
+ /* do nothing */
+ }
+ }
+ else
+ {
+ TI_DBG1(("tdsmIDCompletedCB: smIDStart fail, status 0x%x!!!\n", status));
+ TI_DBG1(("tdsmIDCompletedCB: did %d!!!\n", oneDeviceData->id));
+ if ( !(oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE &&
+ oneDeviceData->tdPortContext != agNULL)
+ )
+ {
+ TI_DBG1(("tdsmIDCompletedCB: fail but device is not valid!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ return;
+ }
+ tdsaAllShared->IDRetry = agTRUE;
+ if (tdsaAllShared->IDRetry)
+ {
+ if (tdIORequestBody->reTries <= SM_RETRIES)
+ {
+ tdIORequestBody->tiIORequest = agNULL; /* not in use */
+ tdIORequestBody->pid = onePortContext->id;
+ smIORequest->tdData = tdIORequestBody;
+ smIORequest->smData = &tdIORequestBody->smIORequestBody;
+
+ smDeviceHandle->tdData = oneDeviceData;
+ IDstatus = smIDStart(smRoot,
+ smIORequest,
+ smDeviceHandle
+ );
+ if (IDstatus != SM_RC_SUCCESS)
+ {
+ /* identify device data is not valid */
+ TI_DBG1(("tdsmIDCompletedCB: smIDStart fail or busy %d!!!\n", IDstatus));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ smReportRemovalDirect(tiRoot, agRoot, oneDeviceData);
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ return;
+ }
+ tdIORequestBody->reTries++;
+ tdIORequestBody->ioCompleted = agFALSE;
+ tdIORequestBody->ioStarted = agTRUE;
+ oneDeviceData->satDevData.IDPending = agTRUE;
+ /* start a timer */
+ tdIDStartTimer(tiRoot, smIORequest, oneDeviceData);
+ TI_DBG1(("tdsmIDCompletedCB: being retried!!!\n"));
+ }
+ else
+ {
+ /* give up */
+ TI_DBG1(("tdsmIDCompletedCB: retries are over; sending hard reset!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiFreeMemory(
+ tiRoot,
+ tdIORequestBody->osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+ oneDeviceData->satDevData.IDDeviceValid = agFALSE;
+
+ if (oneDeviceData->SMNumOfID <= 0) /* does SMP HARD RESET only upto one time */
+ {
+ TI_DBG1(("tdsmIDCompletedCB: fail; sending HARD_RESET\n"));
+ oneDeviceData->SMNumOfID++;
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ saLocalPhyControl(agRoot, agNULL, tdsaRotateQnumber(tiRoot, oneDeviceData), oneDeviceData->phyID, AGSA_PHY_HARD_RESET, agNULL);
+ }
+ else
+ {
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ agNULL,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ }
+ }
+ else
+ {
+ /* given up after one time of SMP HARD RESET; */
+ TI_DBG1(("tdsmIDCompletedCB: fail; but giving up sending HARD_RESET!!!\n"));
+ if (oneDeviceData->directlyAttached == agTRUE)
+ {
+ smReportRemovalDirect(tiRoot, agRoot, oneDeviceData);
+ }
+ else
+ {
+ smReportRemoval(tiRoot, agRoot, oneDeviceData, onePortContext);
+ }
+ }
+ }
+ }
+ else
+ {
+ /* do nothing */
+ }
+
+
+ }
+
+
+ return;
+}
+
+FORCEINLINE void
+tdsmIOCompletedCB(
+ smRoot_t *smRoot,
+ smIORequest_t *smIORequest,
+ bit32 status,
+ bit32 statusDetail,
+ smSenseData_t *senseData,
+ bit32 interruptContext
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ tdsaContext_t *tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ tiRoot_t *tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ tdIORequestBody_t *tdIORequestBody = (tdIORequestBody_t *)smIORequest->tdData;
+ tiIORequest_t *tiIORequest = tdIORequestBody->tiIORequest;
+
+ tdsaDeviceData_t *oneDeviceData;
+ tiDeviceHandle_t *tiDeviceHandle;
+ smDeviceHandle_t *smDeviceHandle;
+ smScsiInitiatorRequest_t *smSCSIRequest;
+ smSuperScsiInitiatorRequest_t *smSuperSCSIRequest;
+
+ bit32 SMStatus = SM_RC_FAILURE;
+
+
+ TI_DBG5(("tdsmIOCompletedCB: start\n"));
+
+ if (status == smIOSuccess)
+ {
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ }
+ else if (status == smIORetry)
+ {
+ TI_DBG1(("tdsmIOCompletedCB: smIORetry!!!\n"));
+ smIORequest = (smIORequest_t *)&(tdIORequestBody->smIORequest);
+ tiDeviceHandle = tdIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+
+ if (! (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE &&
+ oneDeviceData->tdPortContext != agNULL)
+ )
+ {
+ TI_DBG1(("tdsmIOCompletedCB: smIORetry but device is not valid!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ return;
+ }
+ if (tdIORequestBody->reTries <= SM_RETRIES)
+ {
+ smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
+ if (tdIORequestBody->superIOFlag == agTRUE)
+ {
+ smSuperSCSIRequest = (smSuperScsiInitiatorRequest_t *)&(tdIORequestBody->SM.smSuperSCSIRequest);
+ SMStatus = smSuperIOStart(smRoot,
+ smIORequest,
+ smDeviceHandle,
+ smSuperSCSIRequest,
+ oneDeviceData->SASAddressID.sasAddressHi,
+ oneDeviceData->SASAddressID.sasAddressLo,
+ interruptContext);
+ }
+ else
+ {
+ smSCSIRequest = (smScsiInitiatorRequest_t *)&(tdIORequestBody->SM.smSCSIRequest);
+ SMStatus = smIOStart(smRoot,
+ smIORequest,
+ smDeviceHandle,
+ smSCSIRequest,
+ interruptContext);
+ }
+
+
+ if (SMStatus != SM_RC_SUCCESS)
+ {
+ TI_DBG1(("tdsmIOCompletedCB: smIDStart fail or busy %d!!!\n", SMStatus));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ return;
+ }
+ else
+ {
+ TI_DBG1(("tdsmIOCompletedCB: being retried!!!\n"));
+ tdIORequestBody->reTries++;
+ tdIORequestBody->ioCompleted = agFALSE;
+ tdIORequestBody->ioStarted = agTRUE;
+ }
+ }
+ else
+ {
+ /* give up; complete IO */
+ TI_DBG1(("tdsmIOCompletedCB: retries are over!!!\n"));
+ tdIORequestBody->reTries = 0;
+ tdIORequestBody->ioCompleted = agTRUE;
+ tdIORequestBody->ioStarted = agFALSE;
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ return;
+ }
+
+ }
+ else if ( status == smIOSTPResourceBusy)
+ {
+ /* decides to send smp hard reset or not */
+ TI_DBG1(("tdsmIOCompletedCB: smIOSTPResourceBusy\n"));
+ if (tdsaAllShared->FCA)
+ {
+ smIORequest = (smIORequest_t *)&(tdIORequestBody->smIORequest);
+ tiDeviceHandle = tdIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ if (oneDeviceData->SMNumOfFCA <= 0) /* does SMP HARD RESET only upto one time */
+ {
+ TI_DBG1(("tdsmIOCompletedCB: OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY; sending HARD_RESET\n"));
+ oneDeviceData->SMNumOfFCA++;
+ tdsaPhyControlSend(tiRoot,
+ oneDeviceData,
+ SMP_PHY_CONTROL_HARD_RESET,
+ agNULL,
+ tdsaRotateQnumber(tiRoot, oneDeviceData)
+ );
+ }
+ else
+ {
+ /* given up after one time of SMP HARD RESET; */
+ TI_DBG1(("tdsmIOCompletedCB: OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY; but giving up sending HARD_RESET!!!\n"));
+ }
+ }
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ return;
+ }
+ else
+ {
+ if (statusDetail == smDetailAborted)
+ {
+ tiDeviceHandle = tdIORequestBody->tiDevHandle;
+ oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
+ TI_DBG1(("tdsmIOCompletedCB: agIOStatus = OSSA_IO_ABORTED did %d\n", oneDeviceData->id));
+ }
+ ostiInitiatorIOCompleted( tiRoot,
+ tiIORequest,
+ status,
+ statusDetail,
+ (tiSenseData_t *)senseData,
+ interruptContext);
+ }
+
+ return;
+}
+
+/* completion of taskmanagement
+osGLOBAL void ostiInitiatorEvent (
+ tiRoot_t *tiRoot,
+ tiPortalContext_t *portalContext,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiIntrEventType_t eventType,
+ bit32 eventStatus,
+ void *parm
+ );
+
+*/
+//qqq1
+osGLOBAL void
+tdsmEventCB(
+ smRoot_t *smRoot,
+ smDeviceHandle_t *smDeviceHandle,
+ smIntrEventType_t eventType,
+ bit32 eventStatus,
+ void *parm
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdIORequestBody_t *tdIORequestBody;
+ smIORequest_t *SMcurrentTaskTag;
+ tiIORequest_t *currentTaskTag;
+ tdsaDeviceData_t *oneDeviceData;
+ void *osMemHandle;
+ tdsaPortContext_t *onePortContext;
+ tiPortalContext_t *tiportalContext;
+ tiDeviceHandle_t *tiDeviceHandle;
+
+ /* be sure to free using tdIORequestBody->->IOType.InitiatorTMIO.osMemHandle but how???
+ parm = pSatDevData->satTmTaskTag (currentTaskTag in tiINITaskManagement)
+ In this case, parm is smIORequest_t
+ */
+
+ TI_DBG2(("tdsmEventCB: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+
+
+ if (eventType == smIntrEventTypeLocalAbort)
+ {
+ oneDeviceData = (tdsaDeviceData_t *)smDeviceHandle->tdData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsmEventCB: oneDeviceData is NULL\n"));
+ return;
+ }
+ else
+ {
+ tiDeviceHandle = &(oneDeviceData->tiDeviceHandle);
+ if (oneDeviceData->OSAbortAll == agTRUE)
+ {
+ oneDeviceData->OSAbortAll = agFALSE;
+ ostiInitiatorEvent( tiRoot,
+ agNULL,
+ tiDeviceHandle,
+ tiIntrEventTypeLocalAbort,
+ tiAbortOK,
+ agNULL);
+ }
+ }
+ }
+ else
+ {
+
+ SMcurrentTaskTag = (smIORequest_t *)parm;
+ if (SMcurrentTaskTag == agNULL)
+ {
+ TI_DBG1(("tdsmEventCB: SMcurrentTaskTag is NULL!!!\n"));
+ return;
+ }
+
+ tdIORequestBody = (tdIORequestBody_t *)SMcurrentTaskTag->tdData;
+ if (tdIORequestBody == agNULL)
+ {
+ TI_DBG1(("tdsmEventCB: tdIORequestBody is NULL!!!\n"));
+ return;
+ }
+
+ osMemHandle = tdIORequestBody->IOType.InitiatorTMIO.osMemHandle;
+ currentTaskTag = tdIORequestBody->IOType.InitiatorTMIO.CurrentTaskTag;
+
+
+ oneDeviceData = (tdsaDeviceData_t *)smDeviceHandle->tdData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsmEventCB: oneDeviceData is NULL!!!\n"));
+ return;
+ }
+
+ tiDeviceHandle = &(oneDeviceData->tiDeviceHandle);
+ onePortContext = oneDeviceData->tdPortContext;
+ if (onePortContext == agNULL)
+ {
+ TI_DBG1(("tdsmEventCB: onePortContext is NULL!!!\n"));
+ return;
+ }
+ tiportalContext = onePortContext->tiPortalContext;
+
+ /* free tdIORequestBody */
+ ostiFreeMemory(
+ tiRoot,
+ osMemHandle,
+ sizeof(tdIORequestBody_t)
+ );
+
+
+ TI_DBG2(("tdsmEventCB: calling ostiInitiatorEvent\n"));
+ ostiInitiatorEvent(
+ tiRoot,
+ tiportalContext,
+ tiDeviceHandle,
+ eventType,
+ eventStatus,
+ (void *)currentTaskTag
+ );
+
+
+ /* completion of taskmanagement
+ osGLOBAL void ostiInitiatorEvent (
+ tiRoot_t *tiRoot,
+ tiPortalContext_t *portalContext,
+ tiDeviceHandle_t *tiDeviceHandle,
+ tiIntrEventType_t eventType,
+ bit32 eventStatus,
+ void *parm
+ );
+
+
+ ostiFreeAlloc()
+ */
+
+ }
+
+ return;
+}
+
+
+FORCEINLINE void
+tdsmSingleThreadedEnter(
+ smRoot_t *smRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 offset = 0;
+
+ TI_DBG7(("tdsmSingleThreadedEnter: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedEnter: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedEnter: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedEnter: tiRoot is NULL\n"));
+ return;
+ }
+
+ offset = tdsaAllShared->MaxNumLLLocks + tdsaAllShared->MaxNumOSLocks + TD_MAX_LOCKS + tdsaAllShared->MaxNumDMLocks;
+
+ ostiSingleThreadedEnter(tiRoot, syncLockId + offset);
+
+ return;
+}
+
+FORCEINLINE void
+tdsmSingleThreadedLeave(
+ smRoot_t *smRoot,
+ bit32 syncLockId
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 offset = 0;
+
+ TI_DBG7(("tdsmSingleThreadedLeave: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedLeave: tdsaRoot is NULL\n"));
+ return;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedLeave: tdsaAllShared is NULL\n"));
+ return;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsmSingleThreadedLeave: tiRoot is NULL\n"));
+ return;
+ }
+ offset = tdsaAllShared->MaxNumLLLocks + tdsaAllShared->MaxNumOSLocks + TD_MAX_LOCKS + tdsaAllShared->MaxNumDMLocks;
+
+ ostiSingleThreadedLeave(tiRoot, syncLockId + offset);
+
+ return;
+}
+
+osGLOBAL FORCEINLINE bit8
+tdsmBitScanForward(
+ smRoot_t *smRoot,
+ bit32 *Index,
+ bit32 Mask
+ )
+{
+ return ostiBitScanForward(agNULL, Index, Mask);
+}
+
+#ifdef LINUX_VERSION_CODE
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedIncrement(
+ smRoot_t *smRoot,
+ sbit32 volatile *Addend
+ )
+{
+ return ostiAtomicIncrement(agNULL, Addend);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedDecrement(
+ smRoot_t *smRoot,
+ sbit32 volatile *Addend
+ )
+{
+ return ostiAtomicDecrement(agNULL, Addend);
+}
+
+
+
+osGLOBAL FORCEINLINE sbit32
+tdsmAtomicBitClear(
+ smRoot_t *smRoot,
+ sbit32 volatile *Destination,
+ sbit32 Value
+ )
+{
+ return ostiAtomicBitClear(agNULL, Destination, Value);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmAtomicBitSet(
+ smRoot_t *smRoot,
+ sbit32 volatile *Destination,
+ sbit32 Value
+ )
+{
+ return ostiAtomicBitSet(agNULL, Destination, Value);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmAtomicExchange(
+ smRoot_t *smRoot,
+ sbit32 volatile *Target,
+ sbit32 Value
+ )
+{
+ return ostiAtomicExchange(agNULL, Target, Value);
+}
+
+#else
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedIncrement(
+ smRoot_t *smRoot,
+ sbit32 volatile *Addend
+ )
+{
+ return ostiInterlockedIncrement(agNULL, Addend);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedDecrement(
+ smRoot_t *smRoot,
+ sbit32 volatile *Addend
+ )
+{
+ return ostiInterlockedDecrement(agNULL, Addend);
+}
+
+
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedAnd(
+ smRoot_t *smRoot,
+ sbit32 volatile *Destination,
+ sbit32 Value
+ )
+{
+
+ return ostiInterlockedAnd(agNULL, Destination, Value);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedOr(
+ smRoot_t *smRoot,
+ sbit32 volatile *Destination,
+ sbit32 Value
+ )
+{
+ return ostiInterlockedOr(agNULL, Destination, Value);
+}
+
+osGLOBAL FORCEINLINE sbit32
+tdsmInterlockedExchange(
+ smRoot_t *smRoot,
+ sbit32 volatile *Target,
+ sbit32 Value
+ )
+{
+ return ostiInterlockedExchange(agNULL, Target, Value);
+}
+
+#endif /*LINUX_VERSION_CODE*/
+
+osGLOBAL bit32
+tdsmAllocMemory(
+ smRoot_t *smRoot,
+ void **osMemHandle,
+ void ** virtPtr,
+ bit32 * physAddrUpper,
+ bit32 * physAddrLower,
+ bit32 alignment,
+ bit32 allocLength,
+ smBOOLEAN isCacheable
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 status;
+
+ TI_DBG5(("tdsmAllocMemory: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsmAllocMemory: tdsaRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsmAllocMemory: tdsaAllShared is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsmAllocMemory: tiRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ status = ostiAllocMemory(tiRoot,
+ osMemHandle,
+ virtPtr,
+ physAddrUpper,
+ physAddrLower,
+ alignment,
+ allocLength,
+ isCacheable);
+
+ if (status == tiSuccess)
+ {
+ return SM_RC_SUCCESS;
+ }
+ else
+ {
+ return SM_RC_FAILURE;
+ }
+
+}
+
+osGLOBAL bit32
+tdsmFreeMemory(
+ smRoot_t *smRoot,
+ void *osDMAHandle,
+ bit32 allocLength
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ bit32 status;
+
+ TI_DBG5(("tdsmFreeMemory: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsmFreeMemory: tdsaRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsmFreeMemory: tdsaAllShared is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsmFreeMemory: tiRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ status = ostiFreeMemory(tiRoot,
+ osDMAHandle,
+ allocLength);
+
+ if (status == tiSuccess)
+ {
+ return SM_RC_SUCCESS;
+ }
+ else
+ {
+ return SM_RC_FAILURE;
+ }
+}
+
+FORCEINLINE bit32
+tdsmRotateQnumber(smRoot_t *smRoot,
+ smDeviceHandle_t *smDeviceHandle
+ )
+{
+ tdsaRoot_t *tdsaRoot;
+ tdsaContext_t *tdsaAllShared;
+ tiRoot_t *tiRoot;
+ tdsaDeviceData_t *oneDeviceData;
+ bit32 ret = 0;
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+
+
+ TI_DBG6(("tdsmRotateQnumber: start\n"));
+
+ if (smDeviceHandle == agNULL)
+ {
+ TI_DBG1(("tdsmRotateQnumber: smDeviceHandle is NULL !!!!\n"));
+ return ret;
+ }
+ oneDeviceData = (tdsaDeviceData_t *)smDeviceHandle->tdData;
+ if (oneDeviceData == agNULL)
+ {
+ TI_DBG1(("tdsmRotateQnumber: oneDeviceData is NULL !!!!\n"));
+ return ret;
+ }
+ return tdsaRotateQnumber(tiRoot, oneDeviceData);
+}
+
+osGLOBAL bit32
+tdsmSetDeviceQueueDepth(smRoot_t *smRoot,
+ smIORequest_t *smIORequest,
+ bit32 QueueDepth
+ )
+{
+ tdsaRoot_t *tdsaRoot = agNULL;
+ tdsaContext_t *tdsaAllShared = agNULL;
+ tiRoot_t *tiRoot = agNULL;
+ tdIORequestBody_t *tdIORequestBody = (tdIORequestBody_t *)smIORequest->tdData;
+ tiIORequest_t *tiIORequest = tdIORequestBody->tiIORequest;
+
+
+ TI_DBG5(("tdsmSetDeviceQueueDepth: start\n"));
+
+ tdsaRoot = (tdsaRoot_t *)smRoot->tdData;
+ if (tdsaRoot == agNULL)
+ {
+ TI_DBG1(("tdsmSetDeviceQueueDepth: tdsaRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tdsaAllShared = &(tdsaRoot->tdsaAllShared);
+ if (tdsaAllShared == agNULL)
+ {
+ TI_DBG1(("tdsmSetDeviceQueueDepth: tdsaAllShared is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ tiRoot = tdsaAllShared->agRootOsDataForInt.tiRoot;
+ if (tiRoot == agNULL)
+ {
+ TI_DBG1(("tdsmFreeMemory: tiRoot is NULL\n"));
+ return SM_RC_FAILURE;
+ }
+
+ return ostiSetDeviceQueueDepth(tiRoot, tiIORequest, QueueDepth);
+}
+
+osGLOBAL bit32 tdsmGetTransportParam(
+ smRoot_t *smRoot,
+ char *key,
+ char *subkey1,
+ char *subkey2,
+ char *subkey3,
+ char *subkey4,
+ char *subkey5,
+ char *valueName,
+ char *buffer,
+ bit32 bufferLen,
+ bit32 *lenReceived
+ )
+{
+ bit32 ret = tiError;
+
+ TI_DBG7(("tdsmGetTransportParam: start\n"));
+ ret = ostiGetTransportParam(agNULL,
+ key,
+ subkey1,
+ subkey2,
+ subkey3,
+ subkey4,
+ subkey5,
+ valueName,
+ buffer,
+ bufferLen,
+ lenReceived
+ );
+ return ret;
+}
+#endif /* FDS_SM */
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdtimers.c b/sys/dev/pms/RefTisa/tisa/sassata/common/tdtimers.c
new file mode 100644
index 0000000..86d1fec
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdtimers.c
@@ -0,0 +1,302 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+ *
+ * This file contains timer functions in TD layer
+ *
+ */
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#include <dev/pms/config.h>
+
+#include <dev/pms/freebsd/driver/common/osenv.h>
+#include <dev/pms/freebsd/driver/common/ostypes.h>
+#include <dev/pms/freebsd/driver/common/osdebug.h>
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/sallsdk/api/saapi.h>
+#include <dev/pms/RefTisa/sallsdk/api/saosapi.h>
+
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/ostiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/api/tiglobal.h>
+
+#ifdef FDS_SM
+#include <dev/pms/RefTisa/sat/api/sm.h>
+#include <dev/pms/RefTisa/sat/api/smapi.h>
+#include <dev/pms/RefTisa/sat/api/tdsmapi.h>
+#endif
+
+#ifdef FDS_DM
+#include <dev/pms/RefTisa/discovery/api/dm.h>
+#include <dev/pms/RefTisa/discovery/api/dmapi.h>
+#include <dev/pms/RefTisa/discovery/api/tddmapi.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/sas/common/tdtypes.h>
+#include <dev/pms/freebsd/driver/common/osstring.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdutil.h>
+
+#ifdef INITIATOR_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdtypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itddefs.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/ini/itdglobl.h>
+#endif
+
+#ifdef TARGET_DRIVER
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdglobl.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
+#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdtypes.h>
+#endif
+
+#include <dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdproto.h>
+
+/*****************************************************************************
+*! \brief tiCOMTimerTick
+*
+* Purpose: This function is called to every usecsPerTick interval
+*
+* \param tiRoot: Pointer to initiator specific root data structure for this
+* instance of the driver.
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tiCOMTimerTick (
+ tiRoot_t * tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)(tiRoot->tdData);
+ agsaRoot_t *agRoot = &tdsaRoot->tdsaAllShared.agRootNonInt;
+#ifdef FDS_DM
+ dmRoot_t *dmRoot = &tdsaRoot->tdsaAllShared.dmRoot;
+#endif
+
+#ifdef FDS_SM_NOT_YET
+ smRoot_t *smRoot = &tdsaRoot->tdsaAllShared.smRoot;
+#endif
+ /* checking the lower layer */
+ saTimerTick(agRoot);
+
+#ifdef FDS_DM
+ /* checking the DM */
+ dmTimerTick(dmRoot);
+#endif
+
+#ifdef FDS_SM_NOT_YET
+ /* checking the SM */
+ smTimerTick(smRoot);
+#endif
+
+ /*
+ timers for discovery
+ checking tdsaRoot_t timers
+ */
+
+ tdsaProcessTimers(tiRoot);
+
+}
+
+/*****************************************************************************
+*! \brief tdsaInitTimerRequest
+*
+* Purpose: This function initiallizes timer request
+*
+* \param tiRoot: Pointer to initiator specific root data structure
+* for this instance of the driver.
+* \param timerrequest Pointer to timer request
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaInitTimerRequest(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest
+ )
+{
+ timerRequest->timeout = 0;
+ timerRequest->timerCBFunc = agNULL;
+ timerRequest->timerData1 = agNULL;
+ timerRequest->timerData2 = agNULL;
+ timerRequest->timerData3 = agNULL;
+ TDLIST_INIT_ELEMENT((&timerRequest->timerLink));
+}
+
+/*****************************************************************************
+*! \brief tdsaSetTimerRequest
+*
+* Purpose: This function sets timer request
+*
+* \param tiRoot: Pointer to initiator specific root data structure
+* for this instance of the driver.
+* \param timerrequest Pointer to timer request
+* \param timeout timeout value
+* \param CBFunc timer CB function
+* \param timerData1 Data associated with the timer
+* \param timerData2 Data associated with the timer
+* \param timerData3 Data associated with the timer
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaSetTimerRequest(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest,
+ bit32 timeout,
+ tdsaTimerCBFunc_t CBFunc,
+ void *timerData1,
+ void *timerData2,
+ void *timerData3
+ )
+{
+ timerRequest->timeout = timeout;
+ timerRequest->timerCBFunc = CBFunc;
+ timerRequest->timerData1 = timerData1;
+ timerRequest->timerData2 = timerData2;
+ timerRequest->timerData3 = timerData3;
+}
+
+/*****************************************************************************
+*! \brief tdsaAddTimer
+*
+* Purpose: This function adds timer request to timer list
+*
+* \param tiRoot: Pointer to initiator specific root data structure
+* for this instance of the driver.
+* \param timerListHdr Pointer to the timer list
+* \param timerrequest Pointer to timer request
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaAddTimer(
+ tiRoot_t *tiRoot,
+ tdList_t *timerListHdr,
+ tdsaTimerRequest_t *timerRequest
+ )
+{
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ TDLIST_ENQUEUE_AT_TAIL(&(timerRequest->timerLink), timerListHdr);
+ timerRequest->timerRunning = agTRUE;
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+}
+
+/*****************************************************************************
+*! \brief tdsaKillTimer
+*
+* Purpose: This function kills timer request.
+*
+* \param tiRoot: Pointer to initiator specific root data structure
+* for this instance of the driver.
+* \param timerrequest Pointer to timer request
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaKillTimer(
+ tiRoot_t *tiRoot,
+ tdsaTimerRequest_t *timerRequest
+ )
+{
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ timerRequest->timerRunning = agFALSE;
+ TDLIST_DEQUEUE_THIS(&(timerRequest->timerLink));
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+}
+
+/*****************************************************************************
+*! \brief tdsaProcessTimers
+*
+* Purpose: This function processes timer request.
+*
+* \param tiRoot: Pointer to initiator specific root data structure
+* for this instance of the driver.
+*
+* \return: None
+*
+*
+*****************************************************************************/
+osGLOBAL void
+tdsaProcessTimers(
+ tiRoot_t *tiRoot
+ )
+{
+ tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)(tiRoot->tdData);
+ tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
+ tdsaTimerRequest_t *timerRequest_to_process = agNULL;
+ tdList_t *timerlist_to_process, *nexttimerlist = agNULL;
+
+
+ timerlist_to_process = &tdsaAllShared->timerlist;
+
+ timerlist_to_process = timerlist_to_process->flink;
+
+ while ((timerlist_to_process != agNULL) && (timerlist_to_process != &tdsaAllShared->timerlist))
+ {
+ nexttimerlist = timerlist_to_process->flink;
+
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ timerRequest_to_process = TDLIST_OBJECT_BASE(tdsaTimerRequest_t, timerLink, timerlist_to_process);
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+
+ if (timerRequest_to_process == agNULL)
+ {
+ TI_DBG1(("tdsaProcessTimers: timerRequest_to_process is NULL! Error!!!\n"));
+ return;
+ }
+
+ timerRequest_to_process->timeout--;
+
+ if (timerRequest_to_process->timeout == 0)
+ {
+ tdsaSingleThreadedEnter(tiRoot, TD_TIMER_LOCK);
+ if (timerRequest_to_process->timerRunning == agTRUE)
+ {
+ timerRequest_to_process->timerRunning = agFALSE;
+ TDLIST_DEQUEUE_THIS(timerlist_to_process);
+ }
+ tdsaSingleThreadedLeave(tiRoot, TD_TIMER_LOCK);
+ /* calling call back function */
+ (timerRequest_to_process->timerCBFunc)(tiRoot,
+ timerRequest_to_process->timerData1,
+ timerRequest_to_process->timerData2,
+ timerRequest_to_process->timerData3
+ );
+ }
+ timerlist_to_process = nexttimerlist;
+ }
+ return;
+}
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/tdutil.h b/sys/dev/pms/RefTisa/tisa/sassata/common/tdutil.h
new file mode 100644
index 0000000..6cba0fa
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/tdutil.h
@@ -0,0 +1,105 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * The file defines utilities for SAS/SATA TD layer
+ *
+ */
+
+#ifndef __TDUTIL_H__
+#define __TDUTIL_H__
+
+#include <dev/pms/RefTisa/sallsdk/api/sa.h>
+#include <dev/pms/RefTisa/tisa/api/tidefs.h>
+#include <dev/pms/RefTisa/tisa/api/titypes.h>
+#include <dev/pms/RefTisa/tisa/api/tiapi.h>
+#include <dev/pms/RefTisa/tisa/sassata/common/tdlist.h>
+
+
+#define HEXDIGIT2CHAR(x) (((x) < 10) ? ('0' + (x)) : ('A' + ((x) - 10)))
+/*****************************************************************************
+*! \brief tdDecimal2String
+*
+* Purpose: This function converts a given number into a decimal string.
+*
+* \param s: string to be generated
+* \param num: number to be converted
+*
+* \return None
+*
+* \note - string s should be large enough to store decimal string of
+* num and a '\0' character
+*
+*****************************************************************************/
+void
+tdDecimal2String(
+ char *s,
+ bit32 num
+ );
+
+void
+tdHexToString (
+ char *String,
+ bit32 Value1,
+ bit32 Value2,
+ bit32 Strlength
+ );
+
+bit8 tdStr2Bit8 (char *buffer);
+
+bit32 tdStr2ALPA (char *buffer);
+
+void tdStr2WWN (char *buffer, bit8 * NodeName);
+
+void tdWWN2Str (char *buffer, bit8 * NodeName);
+
+/*****************************************************************************
+*! \brief tdNextPowerOf2
+*
+* Purpose: This function is called to calculate the next power of 2
+* value of given value.
+*
+*
+* \param Value: The value for which next power of 2 is requested
+*
+* \return: The next power of 2 value of given Value
+*
+*****************************************************************************/
+bit32
+tdNextPowerOf2 (
+ bit32 Value
+ );
+
+osGLOBAL agBOOLEAN
+tdListElementOnList(
+ tdList_t *toFindHdr,
+ tdList_t *listHdr
+ );
+
+
+#endif /* __TDUTIL_H__ */
+
+
+
diff --git a/sys/dev/pms/RefTisa/tisa/sassata/common/wcs.h b/sys/dev/pms/RefTisa/tisa/sassata/common/wcs.h
new file mode 100644
index 0000000..167b1a0
--- /dev/null
+++ b/sys/dev/pms/RefTisa/tisa/sassata/common/wcs.h
@@ -0,0 +1,8305 @@
+/*******************************************************************************
+*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
+*
+*Redistribution and use in source and binary forms, with or without modification, are permitted provided
+*that the following conditions are met:
+*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
+*following disclaimer.
+*2. 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.
+*
+*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR OR CONTRIBUTORS 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
+*
+* $FreeBSD$
+*
+********************************************************************************/
+/*******************************************************************************/
+/** \file
+ *
+ * This file contains wcs code
+ *
+ */
+
+/* wcsImage */
+bit32 oldwcsImage[] =
+{
+ 0x011, // 00000 = 0 - PHY_RESET_START
+ 0x0ca, // 0x001 = 1 - JUMP_IF_PHY_READY
+ 0x009, // 0x002 = 2 -
+ 0x0ba, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x004 = 4 -
+ 0x0bb, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01e, // 0x006 = 6 -
+ 0x0ff, // 0x007 = 7 - JUMP
+ 0x001, // 0x008 = 8 -
+ 0x010, // 0x009 = 9 - SEND_ID_FRAME
+ 0x0ba, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x00b = 11 -
+ 0x0bb, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x00d = 13 -
+ 0x0ff, // 0x00e = 14 - JUMP
+ 0x00a, // 0x00f = 15 -
+ 0x033, // 0x010 = 16 - SOFT_RESET
+ 0x011, // 0x011 = 17 - PHY_RESET_START
+ 0x0ca, // 0x012 = 18 - JUMP_IF_PHY_READY
+ 0x016, // 0x013 = 19 -
+ 0x0bb, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01b, // 0x015 = 21 -
+ 0x010, // 0x016 = 22 - SEND_ID_FRAME
+ 0x0bb, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x018 = 24 -
+ 0x0ff, // 0x019 = 25 - JUMP
+ 0x017, // 0x01a = 26 -
+ 0x010, // 0x01b = 27 - SEND_ID_FRAME
+ 0x0ff, // 0x01c = 28 - JUMP
+ 0x023, // 0x01d = 29 -
+ 0x0ca, // 0x01e = 30 - JUMP_IF_PHY_READY
+ 0x022, // 0x01f = 31 -
+ 0x0ff, // 0x020 = 32 - JUMP
+ 0x01e, // 0x021 = 33 -
+ 0x010, // 0x022 = 34 - SEND_ID_FRAME
+ 0x000, // 0x023 = 35 - NO_OP
+ 0x000, // 0x024 = 36 - NO_OP
+ 0x000, // 0x025 = 37 - NO_OP
+ 0x000, // 0x026 = 38 - NO_OP
+ 0x000, // 0x027 = 39 - NO_OP
+ 0x000, // 0x028 = 40 - NO_OP
+ 0x0ff, // 0x029 = 41 - JUMP
+ 0x0ff, // 0x02a = 42 -
+ 0x01b, // 0x02b = 43 - START_IT_NEXUS_LOSS_TIMER_SFO
+ 0x017, // 0x02c = 44 - PATHWAY_BLOCKED_CNT_SFO_RESET
+ 0x013, // 0x02d = 45 - START_ARB_WAIT_TIMER_SFO
+ 0x001, // 0x02e = 46 - OPEN_REQUEST_SFO
+ 0x000, // 0x02f = 47 - NO_OP
+ 0x000, // 0x030 = 48 - NO_OP
+ 0x000, // 0x031 = 49 - NO_OP
+ 0x000, // 0x032 = 50 - NO_OP
+ 0x000, // 0x033 = 51 - NO_OP
+ 0x091, // 0x034 = 52 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x056, // 0x035 = 53 -
+ 0x097, // 0x036 = 54 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x059, // 0x037 = 55 -
+ 0x09b, // 0x038 = 56 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x05c, // 0x039 = 57 -
+ 0x09d, // 0x03a = 58 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x05f, // 0x03b = 59 -
+ 0x096, // 0x03c = 60 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x062, // 0x03d = 61 -
+ 0x095, // 0x03e = 62 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x065, // 0x03f = 63 -
+ 0x0a1, // 0x040 = 64 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_SFO
+ 0x068, // 0x041 = 65 -
+ 0x09c, // 0x042 = 66 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x02b, // 0x043 = 67 -
+ 0x098, // 0x044 = 68 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x0ff, // 0x045 = 69 -
+ 0x099, // 0x046 = 70 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x06b, // 0x047 = 71 -
+ 0x09a, // 0x048 = 72 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x02e, // 0x049 = 73 -
+ 0x094, // 0x04a = 74 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x02e, // 0x04b = 75 -
+ 0x0a7, // 0x04c = 76 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x114, // 0x04d = 77 -
+ 0x092, // 0x04e = 78 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x02e, // 0x04f = 79 -
+ 0x0ca, // 0x050 = 80 - JUMP_IF_PHY_READY
+ 0x034, // 0x051 = 81 -
+ 0x031, // 0x052 = 82 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x053 = 83 - SOFT_RESET
+ 0x0ff, // 0x054 = 84 - JUMP
+ 0x001, // 0x055 = 85 -
+ 0x021, // 0x056 = 86 - SET_OPEN_STATUS_NORMAL_SFO
+ 0x0ff, // 0x057 = 87 - JUMP
+ 0x06e, // 0x058 = 88 -
+ 0x025, // 0x059 = 89 - SET_OPEN_STATUS_BAD_RATE_SFO
+ 0x0ff, // 0x05a = 90 - JUMP
+ 0x0ff, // 0x05b = 91 -
+ 0x026, // 0x05c = 92 - SET_OPEN_STATUS_BAD_PROTOCOL_SFO
+ 0x0ff, // 0x05d = 93 - JUMP
+ 0x0ff, // 0x05e = 94 -
+ 0x028, // 0x05f = 95 - SET_OPEN_STATUS_WRONG_DEST_SFO
+ 0x0ff, // 0x060 = 96 - JUMP
+ 0x0ff, // 0x061 = 97 -
+ 0x024, // 0x062 = 98 - SET_OPEN_STATUS_BREAK_SFO
+ 0x0ff, // 0x063 = 99 - JUMP
+ 0x0ff, // 0x064 = 100 -
+ 0x023, // 0x065 = 101 - SET_OPEN_STATUS_BAD_DEST_SFO
+ 0x0ff, // 0x066 = 102 - JUMP
+ 0x0ff, // 0x067 = 103 -
+ 0x022, // 0x068 = 104 - SET_OPEN_STATUS_IT_NEXUS_LOSS_SFO
+ 0x0ff, // 0x069 = 105 - JUMP
+ 0x0ff, // 0x06a = 106 -
+ 0x019, // 0x06b = 107 - PATHWAY_BLOCKED_CNT_SFO_INC
+ 0x0ff, // 0x06c = 108 - JUMP
+ 0x02e, // 0x06d = 109 -
+ 0x000, // 0x06e = 110 - NO_OP
+ 0x0aa, // 0x06f = 111 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x08e, // 0x070 = 112 -
+ 0x0ab, // 0x071 = 113 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x080, // 0x072 = 114 -
+ 0x0ac, // 0x073 = 115 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x083, // 0x074 = 116 -
+ 0x0ad, // 0x075 = 117 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x083, // 0x076 = 118 -
+ 0x0af, // 0x077 = 119 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x087, // 0x078 = 120 -
+ 0x0ae, // 0x079 = 121 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x080, // 0x07a = 122 -
+ 0x0ca, // 0x07b = 123 - JUMP_IF_PHY_READY
+ 0x06f, // 0x07c = 124 -
+ 0x033, // 0x07d = 125 - SOFT_RESET
+ 0x0ff, // 0x07e = 126 - JUMP
+ 0x001, // 0x07f = 127 -
+ 0x006, // 0x080 = 128 - CLOSE_NORMAL
+ 0x0ff, // 0x081 = 129 - JUMP
+ 0x08b, // 0x082 = 130 -
+ 0x009, // 0x083 = 131 - CLOSE_BREAK
+ 0x034, // 0x084 = 132 - ADVANCE_SFO
+ 0x0ff, // 0x085 = 133 - JUMP
+ 0x0ff, // 0x086 = 134 -
+ 0x009, // 0x087 = 135 - CLOSE_BREAK
+ 0x034, // 0x088 = 136 - ADVANCE_SFO
+ 0x0ff, // 0x089 = 137 - JUMP
+ 0x0ff, // 0x08a = 138 -
+ 0x034, // 0x08b = 139 - ADVANCE_SFO
+ 0x0ff, // 0x08c = 140 - JUMP
+ 0x12d, // 0x08d = 141 -
+ 0x034, // 0x08e = 142 - ADVANCE_SFO
+ 0x0ff, // 0x08f = 143 - JUMP
+ 0x0ff, // 0x090 = 144 -
+ 0x01c, // 0x091 = 145 - START_IT_NEXUS_LOSS_TIMER_DOC
+ 0x018, // 0x092 = 146 - PATHWAY_BLOCKED_CNT_DOC_RESET
+ 0x014, // 0x093 = 147 - START_ARB_WAIT_TIMER_DOC
+ 0x002, // 0x094 = 148 - OPEN_REQUEST_DOC
+ 0x000, // 0x095 = 149 - NO_OP
+ 0x000, // 0x096 = 150 - NO_OP
+ 0x000, // 0x097 = 151 - NO_OP
+ 0x000, // 0x098 = 152 - NO_OP
+ 0x000, // 0x099 = 153 - NO_OP
+ 0x091, // 0x09a = 154 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x0bc, // 0x09b = 155 -
+ 0x097, // 0x09c = 156 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x0bf, // 0x09d = 157 -
+ 0x09b, // 0x09e = 158 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x0c2, // 0x09f = 159 -
+ 0x09d, // 0x0a0 = 160 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x0c5, // 0x0a1 = 161 -
+ 0x096, // 0x0a2 = 162 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x0c8, // 0x0a3 = 163 -
+ 0x095, // 0x0a4 = 164 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x0cb, // 0x0a5 = 165 -
+ 0x0a2, // 0x0a6 = 166 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_DOC
+ 0x0ce, // 0x0a7 = 167 -
+ 0x09c, // 0x0a8 = 168 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x091, // 0x0a9 = 169 -
+ 0x098, // 0x0aa = 170 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x0ff, // 0x0ab = 171 -
+ 0x099, // 0x0ac = 172 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x0d1, // 0x0ad = 173 -
+ 0x09a, // 0x0ae = 174 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x094, // 0x0af = 175 -
+ 0x094, // 0x0b0 = 176 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x094, // 0x0b1 = 177 -
+ 0x0a7, // 0x0b2 = 178 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x122, // 0x0b3 = 179 -
+ 0x092, // 0x0b4 = 180 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x094, // 0x0b5 = 181 -
+ 0x0ca, // 0x0b6 = 182 - JUMP_IF_PHY_READY
+ 0x09a, // 0x0b7 = 183 -
+ 0x032, // 0x0b8 = 184 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x0b9 = 185 - SOFT_RESET
+ 0x0ff, // 0x0ba = 186 - JUMP
+ 0x001, // 0x0bb = 187 -
+ 0x029, // 0x0bc = 188 - SET_OPEN_STATUS_NORMAL_DOC
+ 0x0ff, // 0x0bd = 189 - JUMP
+ 0x0d4, // 0x0be = 190 -
+ 0x02d, // 0x0bf = 191 - SET_OPEN_STATUS_BAD_RATE_DOC
+ 0x0ff, // 0x0c0 = 192 - JUMP
+ 0x0ff, // 0x0c1 = 193 -
+ 0x02e, // 0x0c2 = 194 - SET_OPEN_STATUS_BAD_PROTOCOL_DOC
+ 0x0ff, // 0x0c3 = 195 - JUMP
+ 0x0ff, // 0x0c4 = 196 -
+ 0x030, // 0x0c5 = 197 - SET_OPEN_STATUS_WRONG_DEST_DOC
+ 0x0ff, // 0x0c6 = 198 - JUMP
+ 0x0ff, // 0x0c7 = 199 -
+ 0x02c, // 0x0c8 = 200 - SET_OPEN_STATUS_BREAK_DOC
+ 0x0ff, // 0x0c9 = 201 - JUMP
+ 0x0ff, // 0x0ca = 202 -
+ 0x02b, // 0x0cb = 203 - SET_OPEN_STATUS_BAD_DEST_DOC
+ 0x0ff, // 0x0cc = 204 - JUMP
+ 0x0ff, // 0x0cd = 205 -
+ 0x02a, // 0x0ce = 206 - SET_OPEN_STATUS_IT_NEXUS_LOSS_DOC
+ 0x0ff, // 0x0cf = 207 - JUMP
+ 0x0ff, // 0x0d0 = 208 -
+ 0x01a, // 0x0d1 = 209 - PATHWAY_BLOCKED_CNT_DOC_INC
+ 0x0ff, // 0x0d2 = 210 - JUMP
+ 0x094, // 0x0d3 = 211 -
+ 0x000, // 0x0d4 = 212 - NO_OP
+ 0x0b1, // 0x0d5 = 213 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x0fc, // 0x0d6 = 214 -
+ 0x0b2, // 0x0d7 = 215 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x0ee, // 0x0d8 = 216 -
+ 0x0b3, // 0x0d9 = 217 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x0f1, // 0x0da = 218 -
+ 0x0b4, // 0x0db = 219 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x0f1, // 0x0dc = 220 -
+ 0x0b6, // 0x0dd = 221 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x0f5, // 0x0de = 222 -
+ 0x0b5, // 0x0df = 223 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x0ee, // 0x0e0 = 224 -
+ 0x0ca, // 0x0e1 = 225 - JUMP_IF_PHY_READY
+ 0x0e6, // 0x0e2 = 226 -
+ 0x033, // 0x0e3 = 227 - SOFT_RESET
+ 0x0ff, // 0x0e4 = 228 - JUMP
+ 0x001, // 0x0e5 = 229 -
+ 0x0b7, // 0x0e6 = 230 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+ 0x0ee, // 0x0e7 = 231 -
+ 0x0b8, // 0x0e8 = 232 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+ 0x0ee, // 0x0e9 = 233 -
+ 0x0b9, // 0x0ea = 234 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+ 0x0ee, // 0x0eb = 235 -
+ 0x0ff, // 0x0ec = 236 - JUMP
+ 0x0d5, // 0x0ed = 237 -
+ 0x006, // 0x0ee = 238 - CLOSE_NORMAL
+ 0x0ff, // 0x0ef = 239 - JUMP
+ 0x0f9, // 0x0f0 = 240 -
+ 0x009, // 0x0f1 = 241 - CLOSE_BREAK
+ 0x035, // 0x0f2 = 242 - ADVANCE_DOC
+ 0x0ff, // 0x0f3 = 243 - JUMP
+ 0x0ff, // 0x0f4 = 244 -
+ 0x009, // 0x0f5 = 245 - CLOSE_BREAK
+ 0x035, // 0x0f6 = 246 - ADVANCE_DOC
+ 0x0ff, // 0x0f7 = 247 - JUMP
+ 0x0ff, // 0x0f8 = 248 -
+ 0x035, // 0x0f9 = 249 - ADVANCE_DOC
+ 0x0ff, // 0x0fa = 250 - JUMP
+ 0x12d, // 0x0fb = 251 -
+ 0x035, // 0x0fc = 252 - ADVANCE_DOC
+ 0x0ff, // 0x0fd = 253 - JUMP
+ 0x0ff, // 0x0fe = 254 -
+ 0x0a9, // 0x0ff = 255 - JUMP_IF_SFO_REQ
+ 0x10a, // 0x100 = 256 -
+ 0x0b0, // 0x101 = 257 - JUMP_IF_DOC_REQ
+ 0x118, // 0x102 = 258 -
+ 0x0a8, // 0x103 = 259 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x126, // 0x104 = 260 -
+ 0x0ca, // 0x105 = 261 - JUMP_IF_PHY_READY
+ 0x0ff, // 0x106 = 262 -
+ 0x033, // 0x107 = 263 - SOFT_RESET
+ 0x0ff, // 0x108 = 264 - JUMP
+ 0x001, // 0x109 = 265 -
+ 0x0ca, // 0x10a = 266 - JUMP_IF_PHY_READY
+ 0x110, // 0x10b = 267 -
+ 0x031, // 0x10c = 268 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x10d = 269 - SOFT_RESET
+ 0x0ff, // 0x10e = 270 - JUMP
+ 0x001, // 0x10f = 271 -
+ 0x0a8, // 0x110 = 272 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x114, // 0x111 = 273 -
+ 0x0ff, // 0x112 = 274 - JUMP
+ 0x02b, // 0x113 = 275 -
+ 0x0a3, // 0x114 = 276 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_SFO
+ 0x056, // 0x115 = 277 -
+ 0x0ff, // 0x116 = 278 - JUMP
+ 0x101, // 0x117 = 279 -
+ 0x0ca, // 0x118 = 280 - JUMP_IF_PHY_READY
+ 0x11e, // 0x119 = 281 -
+ 0x032, // 0x11a = 282 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x11b = 283 - SOFT_RESET
+ 0x0ff, // 0x11c = 284 - JUMP
+ 0x001, // 0x11d = 285 -
+ 0x0a8, // 0x11e = 286 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x122, // 0x11f = 287 -
+ 0x0ff, // 0x120 = 288 - JUMP
+ 0x091, // 0x121 = 289 -
+ 0x0a4, // 0x122 = 290 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_DOC
+ 0x0bc, // 0x123 = 291 -
+ 0x0ff, // 0x124 = 292 - JUMP
+ 0x103, // 0x125 = 293 -
+ 0x0a6, // 0x126 = 294 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+ 0x12a, // 0x127 = 295 -
+ 0x0ff, // 0x128 = 296 - JUMP
+ 0x143, // 0x129 = 297 -
+ 0x006, // 0x12a = 298 - CLOSE_NORMAL
+ 0x0ff, // 0x12b = 299 - JUMP
+ 0x12d, // 0x12c = 300 -
+ 0x000, // 0x12d = 301 - NO_OP
+ 0x000, // 0x12e = 302 - NO_OP
+ 0x000, // 0x12f = 303 - NO_OP
+ 0x000, // 0x130 = 304 - NO_OP
+ 0x000, // 0x131 = 305 - NO_OP
+ 0x09e, // 0x132 = 306 - JUMP_IF_CLOSE_STATUS_EQUAL_NORMAL
+ 0x0ff, // 0x133 = 307 -
+ 0x0c8, // 0x134 = 308 - JUMP_IF_BREAK_RECEIVED
+ 0x13b, // 0x135 = 309 -
+ 0x0ca, // 0x136 = 310 - JUMP_IF_PHY_READY
+ 0x12d, // 0x137 = 311 -
+ 0x033, // 0x138 = 312 - SOFT_RESET
+ 0x0ff, // 0x139 = 313 - JUMP
+ 0x001, // 0x13a = 314 -
+ 0x009, // 0x13b = 315 - CLOSE_BREAK
+ 0x0c8, // 0x13c = 316 - JUMP_IF_BREAK_RECEIVED
+ 0x0ff, // 0x13d = 317 -
+ 0x0ca, // 0x13e = 318 - JUMP_IF_PHY_READY
+ 0x13c, // 0x13f = 319 -
+ 0x033, // 0x140 = 320 - SOFT_RESET
+ 0x0ff, // 0x141 = 321 - JUMP
+ 0x001, // 0x142 = 322 -
+ 0x0c8, // 0x143 = 323 - JUMP_IF_BREAK_RECEIVED
+ 0x14c, // 0x144 = 324 -
+ 0x0c9, // 0x145 = 325 - JUMP_IF_DONE_NORMAL_RECEIVED
+ 0x154, // 0x146 = 326 -
+ 0x0ca, // 0x147 = 327 - JUMP_IF_PHY_READY
+ 0x0ff, // 0x148 = 328 -
+ 0x033, // 0x149 = 329 - SOFT_RESET
+ 0x0ff, // 0x14a = 330 - JUMP
+ 0x0ff, // 0x14b = 331 -
+ 0x009, // 0x14c = 332 - CLOSE_BREAK
+ 0x0c8, // 0x14d = 333 - JUMP_IF_BREAK_RECEIVED
+ 0x0ff, // 0x14e = 334 -
+ 0x0ca, // 0x14f = 335 - JUMP_IF_PHY_READY
+ 0x14d, // 0x150 = 336 -
+ 0x033, // 0x151 = 337 - SOFT_RESET
+ 0x0ff, // 0x152 = 338 - JUMP
+ 0x001, // 0x153 = 339 -
+ 0x006, // 0x154 = 340 - CLOSE_NORMAL
+ 0x000, // 0x155 = 341 - NO_OP
+ 0x000, // 0x156 = 342 - NO_OP
+ 0x000, // 0x157 = 343 - NO_OP
+ 0x000, // 0x158 = 344 - NO_OP
+ 0x000, // 0x159 = 345 - NO_OP
+ 0x09e, // 0x15a = 346 - JUMP_IF_CLOSE_STATUS_EQUAL_NORMAL
+ 0x0ff, // 0x15b = 347 -
+ 0x0ca, // 0x15c = 348 - JUMP_IF_PHY_READY
+ 0x15a, // 0x15d = 349 -
+ 0x033, // 0x15e = 350 - SOFT_RESET
+ 0x0ff, // 0x15f = 351 - JUMP
+ 0x001, // 0x160 = 352 -
+ 0x000, // 0x161 = 353 - NO_OP
+ 0x000, // 0x162 = 354 - NO_OP
+ 0x000, // 0x163 = 355 - NO_OP
+ 0x000, // 0x164 = 356 - NO_OP
+ 0x000, // 0x165 = 357 - NO_OP
+ 0x000, // 0x166 = 358 - NO_OP
+ 0x000, // 0x167 = 359 - NO_OP
+ 0x000, // 0x168 = 360 - NO_OP
+ 0x000, // 0x169 = 361 - NO_OP
+ 0x000, // 0x16a = 362 - NO_OP
+ 0x000, // 0x16b = 363 - NO_OP
+ 0x000, // 0x16c = 364 - NO_OP
+ 0x000, // 0x16d = 365 - NO_OP
+ 0x000, // 0x16e = 366 - NO_OP
+ 0x000, // 0x16f = 367 - NO_OP
+ 0x000, // 0x170 = 368 - NO_OP
+ 0x000, // 0x171 = 369 - NO_OP
+ 0x000, // 0x172 = 370 - NO_OP
+ 0x000, // 0x173 = 371 - NO_OP
+ 0x000, // 0x174 = 372 - NO_OP
+ 0x000, // 0x175 = 373 - NO_OP
+ 0x000, // 0x176 = 374 - NO_OP
+ 0x000, // 0x177 = 375 - NO_OP
+ 0x000, // 0x178 = 376 - NO_OP
+ 0x000, // 0x179 = 377 - NO_OP
+ 0x000, // 0x17a = 378 - NO_OP
+ 0x000, // 0x17b = 379 - NO_OP
+ 0x000, // 0x17c = 380 - NO_OP
+ 0x000, // 0x17d = 381 - NO_OP
+ 0x000, // 0x17e = 382 - NO_OP
+ 0x000, // 0x17f = 383 - NO_OP
+ 0x000, // 0x180 = 384 - NO_OP
+ 0x000, // 0x181 = 385 - NO_OP
+ 0x000, // 0x182 = 386 - NO_OP
+ 0x000, // 0x183 = 387 - NO_OP
+ 0x000, // 0x184 = 388 - NO_OP
+ 0x000, // 0x185 = 389 - NO_OP
+ 0x000, // 0x186 = 390 - NO_OP
+ 0x000, // 0x187 = 391 - NO_OP
+ 0x000, // 0x188 = 392 - NO_OP
+ 0x000, // 0x189 = 393 - NO_OP
+ 0x000, // 0x18a = 394 - NO_OP
+ 0x000, // 0x18b = 395 - NO_OP
+ 0x000, // 0x18c = 396 - NO_OP
+ 0x000, // 0x18d = 397 - NO_OP
+ 0x000, // 0x18e = 398 - NO_OP
+ 0x000, // 0x18f = 399 - NO_OP
+ 0x000, // 0x190 = 400 - NO_OP
+ 0x000, // 0x191 = 401 - NO_OP
+ 0x000, // 0x192 = 402 - NO_OP
+ 0x000, // 0x193 = 403 - NO_OP
+ 0x000, // 0x194 = 404 - NO_OP
+ 0x000, // 0x195 = 405 - NO_OP
+ 0x000, // 0x196 = 406 - NO_OP
+ 0x000, // 0x197 = 407 - NO_OP
+ 0x000, // 0x198 = 408 - NO_OP
+ 0x000, // 0x199 = 409 - NO_OP
+ 0x000, // 0x19a = 410 - NO_OP
+ 0x000, // 0x19b = 411 - NO_OP
+ 0x000, // 0x19c = 412 - NO_OP
+ 0x000, // 0x19d = 413 - NO_OP
+ 0x000, // 0x19e = 414 - NO_OP
+ 0x000, // 0x19f = 415 - NO_OP
+ 0x000, // 0x1a0 = 416 - NO_OP
+ 0x000, // 0x1a1 = 417 - NO_OP
+ 0x000, // 0x1a2 = 418 - NO_OP
+ 0x000, // 0x1a3 = 419 - NO_OP
+ 0x000, // 0x1a4 = 420 - NO_OP
+ 0x000, // 0x1a5 = 421 - NO_OP
+ 0x000, // 0x1a6 = 422 - NO_OP
+ 0x000, // 0x1a7 = 423 - NO_OP
+ 0x000, // 0x1a8 = 424 - NO_OP
+ 0x000, // 0x1a9 = 425 - NO_OP
+ 0x000, // 0x1aa = 426 - NO_OP
+ 0x000, // 0x1ab = 427 - NO_OP
+ 0x000, // 0x1ac = 428 - NO_OP
+ 0x000, // 0x1ad = 429 - NO_OP
+ 0x000, // 0x1ae = 430 - NO_OP
+ 0x000, // 0x1af = 431 - NO_OP
+ 0x000, // 0x1b0 = 432 - NO_OP
+ 0x000, // 0x1b1 = 433 - NO_OP
+ 0x000, // 0x1b2 = 434 - NO_OP
+ 0x000, // 0x1b3 = 435 - NO_OP
+ 0x000, // 0x1b4 = 436 - NO_OP
+ 0x000, // 0x1b5 = 437 - NO_OP
+ 0x000, // 0x1b6 = 438 - NO_OP
+ 0x000, // 0x1b7 = 439 - NO_OP
+ 0x000, // 0x1b8 = 440 - NO_OP
+ 0x000, // 0x1b9 = 441 - NO_OP
+ 0x000, // 0x1ba = 442 - NO_OP
+ 0x000, // 0x1bb = 443 - NO_OP
+ 0x000, // 0x1bc = 444 - NO_OP
+ 0x000, // 0x1bd = 445 - NO_OP
+ 0x000, // 0x1be = 446 - NO_OP
+ 0x000, // 0x1bf = 447 - NO_OP
+ 0x000, // 0x1c0 = 448 - NO_OP
+ 0x000, // 0x1c1 = 449 - NO_OP
+ 0x000, // 0x1c2 = 450 - NO_OP
+ 0x000, // 0x1c3 = 451 - NO_OP
+ 0x000, // 0x1c4 = 452 - NO_OP
+ 0x000, // 0x1c5 = 453 - NO_OP
+ 0x000, // 0x1c6 = 454 - NO_OP
+ 0x000, // 0x1c7 = 455 - NO_OP
+ 0x000, // 0x1c8 = 456 - NO_OP
+ 0x000, // 0x1c9 = 457 - NO_OP
+ 0x000, // 0x1ca = 458 - NO_OP
+ 0x000, // 0x1cb = 459 - NO_OP
+ 0x000, // 0x1cc = 460 - NO_OP
+ 0x000, // 0x1cd = 461 - NO_OP
+ 0x000, // 0x1ce = 462 - NO_OP
+ 0x000, // 0x1cf = 463 - NO_OP
+ 0x000, // 0x1d0 = 464 - NO_OP
+ 0x000, // 0x1d1 = 465 - NO_OP
+ 0x000, // 0x1d2 = 466 - NO_OP
+ 0x000, // 0x1d3 = 467 - NO_OP
+ 0x000, // 0x1d4 = 468 - NO_OP
+ 0x000, // 0x1d5 = 469 - NO_OP
+ 0x000, // 0x1d6 = 470 - NO_OP
+ 0x000, // 0x1d7 = 471 - NO_OP
+ 0x000, // 0x1d8 = 472 - NO_OP
+ 0x000, // 0x1d9 = 473 - NO_OP
+ 0x000, // 0x1da = 474 - NO_OP
+ 0x000, // 0x1db = 475 - NO_OP
+ 0x000, // 0x1dc = 476 - NO_OP
+ 0x000, // 0x1dd = 477 - NO_OP
+ 0x000, // 0x1de = 478 - NO_OP
+ 0x000, // 0x1df = 479 - NO_OP
+ 0x000, // 0x1e0 = 480 - NO_OP
+ 0x000, // 0x1e1 = 481 - NO_OP
+ 0x000, // 0x1e2 = 482 - NO_OP
+ 0x000, // 0x1e3 = 483 - NO_OP
+ 0x000, // 0x1e4 = 484 - NO_OP
+ 0x000, // 0x1e5 = 485 - NO_OP
+ 0x000, // 0x1e6 = 486 - NO_OP
+ 0x000, // 0x1e7 = 487 - NO_OP
+ 0x000, // 0x1e8 = 488 - NO_OP
+ 0x000, // 0x1e9 = 489 - NO_OP
+ 0x000, // 0x1ea = 490 - NO_OP
+ 0x000, // 0x1eb = 491 - NO_OP
+ 0x000, // 0x1ec = 492 - NO_OP
+ 0x000, // 0x1ed = 493 - NO_OP
+ 0x000, // 0x1ee = 494 - NO_OP
+ 0x000, // 0x1ef = 495 - NO_OP
+ 0x000, // 0x1f0 = 496 - NO_OP
+ 0x000, // 0x1f1 = 497 - NO_OP
+ 0x000, // 0x1f2 = 498 - NO_OP
+ 0x000, // 0x1f3 = 499 - NO_OP
+ 0x000, // 0x1f4 = 500 - NO_OP
+ 0x000, // 0x1f5 = 501 - NO_OP
+ 0x000, // 0x1f6 = 502 - NO_OP
+ 0x000, // 0x1f7 = 503 - NO_OP
+ 0x000, // 0x1f8 = 504 - NO_OP
+ 0x000, // 0x1f9 = 505 - NO_OP
+ 0x000, // 0x1fa = 506 - NO_OP
+ 0x000, // 0x1fb = 507 - NO_OP
+ 0x000, // 0x1fc = 508 - NO_OP
+ 0x000, // 0x1fd = 509 - NO_OP
+ 0x000, // 0x1fe = 510 - NO_OP
+ 0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* as of 6/27 */
+bit32 wcsImage0627[] =
+{
+ 0x011, // 00000 = 0 - PHY_RESET_START
+ 0x0ca, // 0x001 = 1 - JUMP_IF_PHY_READY
+ 0x009, // 0x002 = 2 -
+ 0x0ba, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x004 = 4 -
+ 0x0bb, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01e, // 0x006 = 6 -
+ 0x0ff, // 0x007 = 7 - JUMP
+ 0x001, // 0x008 = 8 -
+ 0x010, // 0x009 = 9 - SEND_ID_FRAME
+ 0x0ba, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x00b = 11 -
+ 0x0bb, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x00d = 13 -
+ 0x0ff, // 0x00e = 14 - JUMP
+ 0x00a, // 0x00f = 15 -
+ 0x033, // 0x010 = 16 - SOFT_RESET
+ 0x011, // 0x011 = 17 - PHY_RESET_START
+ 0x0ca, // 0x012 = 18 - JUMP_IF_PHY_READY
+ 0x016, // 0x013 = 19 -
+ 0x0bb, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01b, // 0x015 = 21 -
+ 0x010, // 0x016 = 22 - SEND_ID_FRAME
+ 0x0bb, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x018 = 24 -
+ 0x0ff, // 0x019 = 25 - JUMP
+ 0x017, // 0x01a = 26 -
+ 0x010, // 0x01b = 27 - SEND_ID_FRAME
+ 0x0ff, // 0x01c = 28 - JUMP
+ 0x023, // 0x01d = 29 -
+ 0x0ca, // 0x01e = 30 - JUMP_IF_PHY_READY
+ 0x022, // 0x01f = 31 -
+ 0x0ff, // 0x020 = 32 - JUMP
+ 0x01e, // 0x021 = 33 -
+ 0x010, // 0x022 = 34 - SEND_ID_FRAME
+ 0x000, // 0x023 = 35 - NO_OP
+ 0x000, // 0x024 = 36 - NO_OP
+ 0x000, // 0x025 = 37 - NO_OP
+ 0x000, // 0x026 = 38 - NO_OP
+ 0x000, // 0x027 = 39 - NO_OP
+ 0x000, // 0x028 = 40 - NO_OP
+ 0x0ff, // 0x029 = 41 - JUMP
+ 0x10d, // 0x02a = 42 -
+ 0x01b, // 0x02b = 43 - START_IT_NEXUS_LOSS_TIMER_SFO
+ 0x017, // 0x02c = 44 - PATHWAY_BLOCKED_CNT_SFO_RESET
+ 0x013, // 0x02d = 45 - START_ARB_WAIT_TIMER_SFO
+ 0x001, // 0x02e = 46 - OPEN_REQUEST_SFO
+ 0x000, // 0x02f = 47 - NO_OP
+ 0x000, // 0x030 = 48 - NO_OP
+ 0x000, // 0x031 = 49 - NO_OP
+ 0x000, // 0x032 = 50 - NO_OP
+ 0x000, // 0x033 = 51 - NO_OP
+ 0x091, // 0x034 = 52 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x056, // 0x035 = 53 -
+ 0x097, // 0x036 = 54 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x059, // 0x037 = 55 -
+ 0x09b, // 0x038 = 56 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x05c, // 0x039 = 57 -
+ 0x09d, // 0x03a = 58 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x05f, // 0x03b = 59 -
+ 0x096, // 0x03c = 60 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x062, // 0x03d = 61 -
+ 0x095, // 0x03e = 62 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x065, // 0x03f = 63 -
+ 0x0a1, // 0x040 = 64 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_SFO
+ 0x068, // 0x041 = 65 -
+ 0x09c, // 0x042 = 66 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x02b, // 0x043 = 67 -
+ 0x098, // 0x044 = 68 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x10d, // 0x045 = 69 -
+ 0x099, // 0x046 = 70 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x06b, // 0x047 = 71 -
+ 0x09a, // 0x048 = 72 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x02e, // 0x049 = 73 -
+ 0x094, // 0x04a = 74 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x02e, // 0x04b = 75 -
+ 0x0a7, // 0x04c = 76 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x122, // 0x04d = 77 -
+ 0x092, // 0x04e = 78 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x02e, // 0x04f = 79 -
+ 0x0ca, // 0x050 = 80 - JUMP_IF_PHY_READY
+ 0x034, // 0x051 = 81 -
+ 0x031, // 0x052 = 82 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x053 = 83 - SOFT_RESET
+ 0x0ff, // 0x054 = 84 - JUMP
+ 0x001, // 0x055 = 85 -
+ 0x021, // 0x056 = 86 - SET_OPEN_STATUS_NORMAL_SFO
+ 0x0ff, // 0x057 = 87 - JUMP
+ 0x06e, // 0x058 = 88 -
+ 0x025, // 0x059 = 89 - SET_OPEN_STATUS_BAD_RATE_SFO
+ 0x0ff, // 0x05a = 90 - JUMP
+ 0x10d, // 0x05b = 91 -
+ 0x026, // 0x05c = 92 - SET_OPEN_STATUS_BAD_PROTOCOL_SFO
+ 0x0ff, // 0x05d = 93 - JUMP
+ 0x10d, // 0x05e = 94 -
+ 0x028, // 0x05f = 95 - SET_OPEN_STATUS_WRONG_DEST_SFO
+ 0x0ff, // 0x060 = 96 - JUMP
+ 0x10d, // 0x061 = 97 -
+ 0x024, // 0x062 = 98 - SET_OPEN_STATUS_BREAK_SFO
+ 0x0ff, // 0x063 = 99 - JUMP
+ 0x10d, // 0x064 = 100 -
+ 0x023, // 0x065 = 101 - SET_OPEN_STATUS_BAD_DEST_SFO
+ 0x0ff, // 0x066 = 102 - JUMP
+ 0x10d, // 0x067 = 103 -
+ 0x022, // 0x068 = 104 - SET_OPEN_STATUS_IT_NEXUS_LOSS_SFO
+ 0x0ff, // 0x069 = 105 - JUMP
+ 0x10d, // 0x06a = 106 -
+ 0x019, // 0x06b = 107 - PATHWAY_BLOCKED_CNT_SFO_INC
+ 0x0ff, // 0x06c = 108 - JUMP
+ 0x02e, // 0x06d = 109 -
+ 0x000, // 0x06e = 110 - NO_OP
+ 0x0aa, // 0x06f = 111 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x082, // 0x070 = 112 -
+ 0x0ab, // 0x071 = 113 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x086, // 0x072 = 114 -
+ 0x0ac, // 0x073 = 115 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x089, // 0x074 = 116 -
+ 0x0ad, // 0x075 = 117 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x08f, // 0x076 = 118 -
+ 0x0af, // 0x077 = 119 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x08c, // 0x078 = 120 -
+ 0x0ae, // 0x079 = 121 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x086, // 0x07a = 122 -
+ 0x0d2, // 0x07b = 123 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+ 0x095, // 0x07c = 124 -
+ 0x0ca, // 0x07d = 125 - JUMP_IF_PHY_READY
+ 0x06f, // 0x07e = 126 -
+ 0x033, // 0x07f = 127 - SOFT_RESET
+ 0x0ff, // 0x080 = 128 - JUMP
+ 0x001, // 0x081 = 129 -
+ 0x0d0, // 0x082 = 130 - JUMP_IF_SMP_PROTOCOL
+ 0x086, // 0x083 = 131 -
+ 0x0ff, // 0x084 = 132 - JUMP
+ 0x092, // 0x085 = 133 -
+ 0x006, // 0x086 = 134 - CLOSE_NORMAL
+ 0x0ff, // 0x087 = 135 - JUMP
+ 0x08f, // 0x088 = 136 -
+ 0x007, // 0x089 = 137 - CLOSE_ACK_NAK_TIMEOUT
+ 0x0ff, // 0x08a = 138 - JUMP
+ 0x08f, // 0x08b = 139 -
+ 0x008, // 0x08c = 140 - CLOSE_CREDIT_TIMEOUT
+ 0x0ff, // 0x08d = 141 - JUMP
+ 0x08f, // 0x08e = 142 -
+ 0x034, // 0x08f = 143 - ADVANCE_SFO
+ 0x0ff, // 0x090 = 144 - JUMP
+ 0x141, // 0x091 = 145 -
+ 0x034, // 0x092 = 146 - ADVANCE_SFO
+ 0x0ff, // 0x093 = 147 - JUMP
+ 0x10d, // 0x094 = 148 -
+ 0x034, // 0x095 = 149 - ADVANCE_SFO
+ 0x0ff, // 0x096 = 150 - JUMP
+ 0x14f, // 0x097 = 151 -
+ 0x01c, // 0x098 = 152 - START_IT_NEXUS_LOSS_TIMER_DOC
+ 0x018, // 0x099 = 153 - PATHWAY_BLOCKED_CNT_DOC_RESET
+ 0x014, // 0x09a = 154 - START_ARB_WAIT_TIMER_DOC
+ 0x002, // 0x09b = 155 - OPEN_REQUEST_DOC
+ 0x000, // 0x09c = 156 - NO_OP
+ 0x000, // 0x09d = 157 - NO_OP
+ 0x000, // 0x09e = 158 - NO_OP
+ 0x000, // 0x09f = 159 - NO_OP
+ 0x000, // 0x0a0 = 160 - NO_OP
+ 0x091, // 0x0a1 = 161 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x0c3, // 0x0a2 = 162 -
+ 0x097, // 0x0a3 = 163 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x0c6, // 0x0a4 = 164 -
+ 0x09b, // 0x0a5 = 165 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x0c9, // 0x0a6 = 166 -
+ 0x09d, // 0x0a7 = 167 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x0cc, // 0x0a8 = 168 -
+ 0x096, // 0x0a9 = 169 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x0cf, // 0x0aa = 170 -
+ 0x095, // 0x0ab = 171 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x0d2, // 0x0ac = 172 -
+ 0x0a2, // 0x0ad = 173 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_DOC
+ 0x0d5, // 0x0ae = 174 -
+ 0x09c, // 0x0af = 175 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x098, // 0x0b0 = 176 -
+ 0x098, // 0x0b1 = 177 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x10d, // 0x0b2 = 178 -
+ 0x099, // 0x0b3 = 179 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x0d8, // 0x0b4 = 180 -
+ 0x09a, // 0x0b5 = 181 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x09b, // 0x0b6 = 182 -
+ 0x094, // 0x0b7 = 183 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x09b, // 0x0b8 = 184 -
+ 0x0a7, // 0x0b9 = 185 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x130, // 0x0ba = 186 -
+ 0x092, // 0x0bb = 187 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x09b, // 0x0bc = 188 -
+ 0x0ca, // 0x0bd = 189 - JUMP_IF_PHY_READY
+ 0x0a1, // 0x0be = 190 -
+ 0x032, // 0x0bf = 191 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x0c0 = 192 - SOFT_RESET
+ 0x0ff, // 0x0c1 = 193 - JUMP
+ 0x001, // 0x0c2 = 194 -
+ 0x029, // 0x0c3 = 195 - SET_OPEN_STATUS_NORMAL_DOC
+ 0x0ff, // 0x0c4 = 196 - JUMP
+ 0x0db, // 0x0c5 = 197 -
+ 0x02d, // 0x0c6 = 198 - SET_OPEN_STATUS_BAD_RATE_DOC
+ 0x0ff, // 0x0c7 = 199 - JUMP
+ 0x10d, // 0x0c8 = 200 -
+ 0x02e, // 0x0c9 = 201 - SET_OPEN_STATUS_BAD_PROTOCOL_DOC
+ 0x0ff, // 0x0ca = 202 - JUMP
+ 0x10d, // 0x0cb = 203 -
+ 0x030, // 0x0cc = 204 - SET_OPEN_STATUS_WRONG_DEST_DOC
+ 0x0ff, // 0x0cd = 205 - JUMP
+ 0x10d, // 0x0ce = 206 -
+ 0x02c, // 0x0cf = 207 - SET_OPEN_STATUS_BREAK_DOC
+ 0x0ff, // 0x0d0 = 208 - JUMP
+ 0x10d, // 0x0d1 = 209 -
+ 0x02b, // 0x0d2 = 210 - SET_OPEN_STATUS_BAD_DEST_DOC
+ 0x0ff, // 0x0d3 = 211 - JUMP
+ 0x10d, // 0x0d4 = 212 -
+ 0x02a, // 0x0d5 = 213 - SET_OPEN_STATUS_IT_NEXUS_LOSS_DOC
+ 0x0ff, // 0x0d6 = 214 - JUMP
+ 0x10d, // 0x0d7 = 215 -
+ 0x01a, // 0x0d8 = 216 - PATHWAY_BLOCKED_CNT_DOC_INC
+ 0x0ff, // 0x0d9 = 217 - JUMP
+ 0x09b, // 0x0da = 218 -
+ 0x000, // 0x0db = 219 - NO_OP
+ 0x0b1, // 0x0dc = 220 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x0ef, // 0x0dd = 221 -
+ 0x0b2, // 0x0de = 222 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x0fb, // 0x0df = 223 -
+ 0x0b3, // 0x0e0 = 224 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x0fe, // 0x0e1 = 225 -
+ 0x0b4, // 0x0e2 = 226 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x104, // 0x0e3 = 227 -
+ 0x0b6, // 0x0e4 = 228 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x101, // 0x0e5 = 229 -
+ 0x0b5, // 0x0e6 = 230 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x0fb, // 0x0e7 = 231 -
+ 0x0d3, // 0x0e8 = 232 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+ 0x10a, // 0x0e9 = 233 -
+ 0x0ca, // 0x0ea = 234 - JUMP_IF_PHY_READY
+ 0x0f3, // 0x0eb = 235 -
+ 0x033, // 0x0ec = 236 - SOFT_RESET
+ 0x0ff, // 0x0ed = 237 - JUMP
+ 0x001, // 0x0ee = 238 -
+ 0x0d0, // 0x0ef = 239 - JUMP_IF_SMP_PROTOCOL
+ 0x0fb, // 0x0f0 = 240 -
+ 0x0ff, // 0x0f1 = 241 - JUMP
+ 0x107, // 0x0f2 = 242 -
+ 0x0b7, // 0x0f3 = 243 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+ 0x0fb, // 0x0f4 = 244 -
+ 0x0b8, // 0x0f5 = 245 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+ 0x0fb, // 0x0f6 = 246 -
+ 0x0b9, // 0x0f7 = 247 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+ 0x0fb, // 0x0f8 = 248 -
+ 0x0ff, // 0x0f9 = 249 - JUMP
+ 0x0dc, // 0x0fa = 250 -
+ 0x006, // 0x0fb = 251 - CLOSE_NORMAL
+ 0x0ff, // 0x0fc = 252 - JUMP
+ 0x104, // 0x0fd = 253 -
+ 0x007, // 0x0fe = 254 - CLOSE_ACK_NAK_TIMEOUT
+ 0x0ff, // 0x0ff = 255 - JUMP
+ 0x104, // 0x100 = 256 -
+ 0x008, // 0x101 = 257 - CLOSE_CREDIT_TIMEOUT
+ 0x0ff, // 0x102 = 258 - JUMP
+ 0x104, // 0x103 = 259 -
+ 0x035, // 0x104 = 260 - ADVANCE_DOC
+ 0x0ff, // 0x105 = 261 - JUMP
+ 0x141, // 0x106 = 262 -
+ 0x035, // 0x107 = 263 - ADVANCE_DOC
+ 0x0ff, // 0x108 = 264 - JUMP
+ 0x10d, // 0x109 = 265 -
+ 0x035, // 0x10a = 266 - ADVANCE_DOC
+ 0x0ff, // 0x10b = 267 - JUMP
+ 0x14f, // 0x10c = 268 -
+ 0x0a9, // 0x10d = 269 - JUMP_IF_SFO_REQ
+ 0x118, // 0x10e = 270 -
+ 0x0b0, // 0x10f = 271 - JUMP_IF_DOC_REQ
+ 0x126, // 0x110 = 272 -
+ 0x0a8, // 0x111 = 273 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x134, // 0x112 = 274 -
+ 0x0ca, // 0x113 = 275 - JUMP_IF_PHY_READY
+ 0x10d, // 0x114 = 276 -
+ 0x033, // 0x115 = 277 - SOFT_RESET
+ 0x0ff, // 0x116 = 278 - JUMP
+ 0x001, // 0x117 = 279 -
+ 0x0ca, // 0x118 = 280 - JUMP_IF_PHY_READY
+ 0x11e, // 0x119 = 281 -
+ 0x031, // 0x11a = 282 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x11b = 283 - SOFT_RESET
+ 0x0ff, // 0x11c = 284 - JUMP
+ 0x001, // 0x11d = 285 -
+ 0x0a8, // 0x11e = 286 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x122, // 0x11f = 287 -
+ 0x0ff, // 0x120 = 288 - JUMP
+ 0x02b, // 0x121 = 289 -
+ 0x0a3, // 0x122 = 290 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_SFO
+ 0x056, // 0x123 = 291 -
+ 0x0ff, // 0x124 = 292 - JUMP
+ 0x10f, // 0x125 = 293 -
+ 0x0ca, // 0x126 = 294 - JUMP_IF_PHY_READY
+ 0x12c, // 0x127 = 295 -
+ 0x032, // 0x128 = 296 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x129 = 297 - SOFT_RESET
+ 0x0ff, // 0x12a = 298 - JUMP
+ 0x001, // 0x12b = 299 -
+ 0x0a8, // 0x12c = 300 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x130, // 0x12d = 301 -
+ 0x0ff, // 0x12e = 302 - JUMP
+ 0x098, // 0x12f = 303 -
+ 0x0a4, // 0x130 = 304 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_DOC
+ 0x0c3, // 0x131 = 305 -
+ 0x0ff, // 0x132 = 306 - JUMP
+ 0x111, // 0x133 = 307 -
+ 0x0d0, // 0x134 = 308 - JUMP_IF_SMP_PROTOCOL
+ 0x13d, // 0x135 = 309 -
+ 0x0a6, // 0x136 = 310 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+ 0x13a, // 0x137 = 311 -
+ 0x0ff, // 0x138 = 312 - JUMP
+ 0x157, // 0x139 = 313 -
+ 0x006, // 0x13a = 314 - CLOSE_NORMAL
+ 0x0ff, // 0x13b = 315 - JUMP
+ 0x141, // 0x13c = 316 -
+ 0x0d1, // 0x13d = 317 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+ 0x160, // 0x13e = 318 -
+ 0x0ff, // 0x13f = 319 - JUMP
+ 0x10d, // 0x140 = 320 -
+ 0x000, // 0x141 = 321 - NO_OP
+ 0x000, // 0x142 = 322 - NO_OP
+ 0x000, // 0x143 = 323 - NO_OP
+ 0x000, // 0x144 = 324 - NO_OP
+ 0x000, // 0x145 = 325 - NO_OP
+ 0x09e, // 0x146 = 326 - JUMP_IF_CLOSE_STATUS_EQUAL_NORMAL
+ 0x10d, // 0x147 = 327 -
+ 0x0c8, // 0x148 = 328 - JUMP_IF_BREAK_RECEIVED
+ 0x14f, // 0x149 = 329 -
+ 0x0ca, // 0x14a = 330 - JUMP_IF_PHY_READY
+ 0x141, // 0x14b = 331 -
+ 0x033, // 0x14c = 332 - SOFT_RESET
+ 0x0ff, // 0x14d = 333 - JUMP
+ 0x001, // 0x14e = 334 -
+ 0x009, // 0x14f = 335 - CLOSE_BREAK
+ 0x0c8, // 0x150 = 336 - JUMP_IF_BREAK_RECEIVED
+ 0x10d, // 0x151 = 337 -
+ 0x0ca, // 0x152 = 338 - JUMP_IF_PHY_READY
+ 0x150, // 0x153 = 339 -
+ 0x033, // 0x154 = 340 - SOFT_RESET
+ 0x0ff, // 0x155 = 341 - JUMP
+ 0x001, // 0x156 = 342 -
+ 0x0c8, // 0x157 = 343 - JUMP_IF_BREAK_RECEIVED
+ 0x160, // 0x158 = 344 -
+ 0x0c9, // 0x159 = 345 - JUMP_IF_DONE_NORMAL_RECEIVED
+ 0x168, // 0x15a = 346 -
+ 0x0ca, // 0x15b = 347 - JUMP_IF_PHY_READY
+ 0x10d, // 0x15c = 348 -
+ 0x033, // 0x15d = 349 - SOFT_RESET
+ 0x0ff, // 0x15e = 350 - JUMP
+ 0x10d, // 0x15f = 351 -
+ 0x009, // 0x160 = 352 - CLOSE_BREAK
+ 0x0c8, // 0x161 = 353 - JUMP_IF_BREAK_RECEIVED
+ 0x10d, // 0x162 = 354 -
+ 0x0ca, // 0x163 = 355 - JUMP_IF_PHY_READY
+ 0x161, // 0x164 = 356 -
+ 0x033, // 0x165 = 357 - SOFT_RESET
+ 0x0ff, // 0x166 = 358 - JUMP
+ 0x001, // 0x167 = 359 -
+ 0x006, // 0x168 = 360 - CLOSE_NORMAL
+ 0x000, // 0x169 = 361 - NO_OP
+ 0x000, // 0x16a = 362 - NO_OP
+ 0x000, // 0x16b = 363 - NO_OP
+ 0x000, // 0x16c = 364 - NO_OP
+ 0x000, // 0x16d = 365 - NO_OP
+ 0x09e, // 0x16e = 366 - JUMP_IF_CLOSE_STATUS_EQUAL_NORMAL
+ 0x10d, // 0x16f = 367 -
+ 0x0ca, // 0x170 = 368 - JUMP_IF_PHY_READY
+ 0x16e, // 0x171 = 369 -
+ 0x033, // 0x172 = 370 - SOFT_RESET
+ 0x0ff, // 0x173 = 371 - JUMP
+ 0x001, // 0x174 = 372 -
+ 0x000, // 0x175 = 373 - NO_OP
+ 0x000, // 0x176 = 374 - NO_OP
+ 0x000, // 0x177 = 375 - NO_OP
+ 0x000, // 0x178 = 376 - NO_OP
+ 0x000, // 0x179 = 377 - NO_OP
+ 0x000, // 0x17a = 378 - NO_OP
+ 0x000, // 0x17b = 379 - NO_OP
+ 0x000, // 0x17c = 380 - NO_OP
+ 0x000, // 0x17d = 381 - NO_OP
+ 0x000, // 0x17e = 382 - NO_OP
+ 0x000, // 0x17f = 383 - NO_OP
+ 0x000, // 0x180 = 384 - NO_OP
+ 0x000, // 0x181 = 385 - NO_OP
+ 0x000, // 0x182 = 386 - NO_OP
+ 0x000, // 0x183 = 387 - NO_OP
+ 0x000, // 0x184 = 388 - NO_OP
+ 0x000, // 0x185 = 389 - NO_OP
+ 0x000, // 0x186 = 390 - NO_OP
+ 0x000, // 0x187 = 391 - NO_OP
+ 0x000, // 0x188 = 392 - NO_OP
+ 0x000, // 0x189 = 393 - NO_OP
+ 0x000, // 0x18a = 394 - NO_OP
+ 0x000, // 0x18b = 395 - NO_OP
+ 0x000, // 0x18c = 396 - NO_OP
+ 0x000, // 0x18d = 397 - NO_OP
+ 0x000, // 0x18e = 398 - NO_OP
+ 0x000, // 0x18f = 399 - NO_OP
+ 0x000, // 0x190 = 400 - NO_OP
+ 0x000, // 0x191 = 401 - NO_OP
+ 0x000, // 0x192 = 402 - NO_OP
+ 0x000, // 0x193 = 403 - NO_OP
+ 0x000, // 0x194 = 404 - NO_OP
+ 0x000, // 0x195 = 405 - NO_OP
+ 0x000, // 0x196 = 406 - NO_OP
+ 0x000, // 0x197 = 407 - NO_OP
+ 0x000, // 0x198 = 408 - NO_OP
+ 0x000, // 0x199 = 409 - NO_OP
+ 0x000, // 0x19a = 410 - NO_OP
+ 0x000, // 0x19b = 411 - NO_OP
+ 0x000, // 0x19c = 412 - NO_OP
+ 0x000, // 0x19d = 413 - NO_OP
+ 0x000, // 0x19e = 414 - NO_OP
+ 0x000, // 0x19f = 415 - NO_OP
+ 0x000, // 0x1a0 = 416 - NO_OP
+ 0x000, // 0x1a1 = 417 - NO_OP
+ 0x000, // 0x1a2 = 418 - NO_OP
+ 0x000, // 0x1a3 = 419 - NO_OP
+ 0x000, // 0x1a4 = 420 - NO_OP
+ 0x000, // 0x1a5 = 421 - NO_OP
+ 0x000, // 0x1a6 = 422 - NO_OP
+ 0x000, // 0x1a7 = 423 - NO_OP
+ 0x000, // 0x1a8 = 424 - NO_OP
+ 0x000, // 0x1a9 = 425 - NO_OP
+ 0x000, // 0x1aa = 426 - NO_OP
+ 0x000, // 0x1ab = 427 - NO_OP
+ 0x000, // 0x1ac = 428 - NO_OP
+ 0x000, // 0x1ad = 429 - NO_OP
+ 0x000, // 0x1ae = 430 - NO_OP
+ 0x000, // 0x1af = 431 - NO_OP
+ 0x000, // 0x1b0 = 432 - NO_OP
+ 0x000, // 0x1b1 = 433 - NO_OP
+ 0x000, // 0x1b2 = 434 - NO_OP
+ 0x000, // 0x1b3 = 435 - NO_OP
+ 0x000, // 0x1b4 = 436 - NO_OP
+ 0x000, // 0x1b5 = 437 - NO_OP
+ 0x000, // 0x1b6 = 438 - NO_OP
+ 0x000, // 0x1b7 = 439 - NO_OP
+ 0x000, // 0x1b8 = 440 - NO_OP
+ 0x000, // 0x1b9 = 441 - NO_OP
+ 0x000, // 0x1ba = 442 - NO_OP
+ 0x000, // 0x1bb = 443 - NO_OP
+ 0x000, // 0x1bc = 444 - NO_OP
+ 0x000, // 0x1bd = 445 - NO_OP
+ 0x000, // 0x1be = 446 - NO_OP
+ 0x000, // 0x1bf = 447 - NO_OP
+ 0x000, // 0x1c0 = 448 - NO_OP
+ 0x000, // 0x1c1 = 449 - NO_OP
+ 0x000, // 0x1c2 = 450 - NO_OP
+ 0x000, // 0x1c3 = 451 - NO_OP
+ 0x000, // 0x1c4 = 452 - NO_OP
+ 0x000, // 0x1c5 = 453 - NO_OP
+ 0x000, // 0x1c6 = 454 - NO_OP
+ 0x000, // 0x1c7 = 455 - NO_OP
+ 0x000, // 0x1c8 = 456 - NO_OP
+ 0x000, // 0x1c9 = 457 - NO_OP
+ 0x000, // 0x1ca = 458 - NO_OP
+ 0x000, // 0x1cb = 459 - NO_OP
+ 0x000, // 0x1cc = 460 - NO_OP
+ 0x000, // 0x1cd = 461 - NO_OP
+ 0x000, // 0x1ce = 462 - NO_OP
+ 0x000, // 0x1cf = 463 - NO_OP
+ 0x000, // 0x1d0 = 464 - NO_OP
+ 0x000, // 0x1d1 = 465 - NO_OP
+ 0x000, // 0x1d2 = 466 - NO_OP
+ 0x000, // 0x1d3 = 467 - NO_OP
+ 0x000, // 0x1d4 = 468 - NO_OP
+ 0x000, // 0x1d5 = 469 - NO_OP
+ 0x000, // 0x1d6 = 470 - NO_OP
+ 0x000, // 0x1d7 = 471 - NO_OP
+ 0x000, // 0x1d8 = 472 - NO_OP
+ 0x000, // 0x1d9 = 473 - NO_OP
+ 0x000, // 0x1da = 474 - NO_OP
+ 0x000, // 0x1db = 475 - NO_OP
+ 0x000, // 0x1dc = 476 - NO_OP
+ 0x000, // 0x1dd = 477 - NO_OP
+ 0x000, // 0x1de = 478 - NO_OP
+ 0x000, // 0x1df = 479 - NO_OP
+ 0x000, // 0x1e0 = 480 - NO_OP
+ 0x000, // 0x1e1 = 481 - NO_OP
+ 0x000, // 0x1e2 = 482 - NO_OP
+ 0x000, // 0x1e3 = 483 - NO_OP
+ 0x000, // 0x1e4 = 484 - NO_OP
+ 0x000, // 0x1e5 = 485 - NO_OP
+ 0x000, // 0x1e6 = 486 - NO_OP
+ 0x000, // 0x1e7 = 487 - NO_OP
+ 0x000, // 0x1e8 = 488 - NO_OP
+ 0x000, // 0x1e9 = 489 - NO_OP
+ 0x000, // 0x1ea = 490 - NO_OP
+ 0x000, // 0x1eb = 491 - NO_OP
+ 0x000, // 0x1ec = 492 - NO_OP
+ 0x000, // 0x1ed = 493 - NO_OP
+ 0x000, // 0x1ee = 494 - NO_OP
+ 0x000, // 0x1ef = 495 - NO_OP
+ 0x000, // 0x1f0 = 496 - NO_OP
+ 0x000, // 0x1f1 = 497 - NO_OP
+ 0x000, // 0x1f2 = 498 - NO_OP
+ 0x000, // 0x1f3 = 499 - NO_OP
+ 0x000, // 0x1f4 = 500 - NO_OP
+ 0x000, // 0x1f5 = 501 - NO_OP
+ 0x000, // 0x1f6 = 502 - NO_OP
+ 0x000, // 0x1f7 = 503 - NO_OP
+ 0x000, // 0x1f8 = 504 - NO_OP
+ 0x000, // 0x1f9 = 505 - NO_OP
+ 0x000, // 0x1fa = 506 - NO_OP
+ 0x000, // 0x1fb = 507 - NO_OP
+ 0x000, // 0x1fc = 508 - NO_OP
+ 0x000, // 0x1fd = 509 - NO_OP
+ 0x000, // 0x1fe = 510 - NO_OP
+ 0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* as of 8/18/2005 */
+bit32 wcsImage0818[] =
+{
+ 0x011, // 00000 = 0 - PHY_RESET_START
+ 0x0ca, // 0x001 = 1 - JUMP_IF_PHY_READY
+ 0x009, // 0x002 = 2 -
+ 0x0ba, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x004 = 4 -
+ 0x0bb, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01e, // 0x006 = 6 -
+ 0x0ff, // 0x007 = 7 - JUMP
+ 0x001, // 0x008 = 8 -
+ 0x010, // 0x009 = 9 - SEND_ID_FRAME
+ 0x0ba, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x00b = 11 -
+ 0x0bb, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x00d = 13 -
+ 0x0ff, // 0x00e = 14 - JUMP
+ 0x00a, // 0x00f = 15 -
+ 0x033, // 0x010 = 16 - SOFT_RESET
+ 0x011, // 0x011 = 17 - PHY_RESET_START
+ 0x0ca, // 0x012 = 18 - JUMP_IF_PHY_READY
+ 0x016, // 0x013 = 19 -
+ 0x0bb, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01b, // 0x015 = 21 -
+ 0x010, // 0x016 = 22 - SEND_ID_FRAME
+ 0x0bb, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x018 = 24 -
+ 0x0ff, // 0x019 = 25 - JUMP
+ 0x017, // 0x01a = 26 -
+ 0x010, // 0x01b = 27 - SEND_ID_FRAME
+ 0x0ff, // 0x01c = 28 - JUMP
+ 0x023, // 0x01d = 29 -
+ 0x0ca, // 0x01e = 30 - JUMP_IF_PHY_READY
+ 0x022, // 0x01f = 31 -
+ 0x0ff, // 0x020 = 32 - JUMP
+ 0x01e, // 0x021 = 33 -
+ 0x010, // 0x022 = 34 - SEND_ID_FRAME
+ 0x000, // 0x023 = 35 - NO_OP
+ 0x000, // 0x024 = 36 - NO_OP
+ 0x000, // 0x025 = 37 - NO_OP
+ 0x000, // 0x026 = 38 - NO_OP
+ 0x000, // 0x027 = 39 - NO_OP
+ 0x000, // 0x028 = 40 - NO_OP
+ 0x0ff, // 0x029 = 41 - JUMP
+ 0x10d, // 0x02a = 42 -
+ 0x01b, // 0x02b = 43 - START_IT_NEXUS_LOSS_TIMER_SFO
+ 0x017, // 0x02c = 44 - PATHWAY_BLOCKED_CNT_SFO_RESET
+ 0x013, // 0x02d = 45 - START_ARB_WAIT_TIMER_SFO
+ 0x001, // 0x02e = 46 - OPEN_REQUEST_SFO
+ 0x000, // 0x02f = 47 - NO_OP
+ 0x000, // 0x030 = 48 - NO_OP
+ 0x000, // 0x031 = 49 - NO_OP
+ 0x000, // 0x032 = 50 - NO_OP
+ 0x000, // 0x033 = 51 - NO_OP
+ 0x091, // 0x034 = 52 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x056, // 0x035 = 53 -
+ 0x097, // 0x036 = 54 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x059, // 0x037 = 55 -
+ 0x09b, // 0x038 = 56 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x05c, // 0x039 = 57 -
+ 0x09d, // 0x03a = 58 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x05f, // 0x03b = 59 -
+ 0x096, // 0x03c = 60 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x062, // 0x03d = 61 -
+ 0x095, // 0x03e = 62 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x065, // 0x03f = 63 -
+ 0x0a1, // 0x040 = 64 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_SFO
+ 0x068, // 0x041 = 65 -
+ 0x09c, // 0x042 = 66 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x02b, // 0x043 = 67 -
+ 0x098, // 0x044 = 68 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x10d, // 0x045 = 69 -
+ 0x099, // 0x046 = 70 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x06b, // 0x047 = 71 -
+ 0x09a, // 0x048 = 72 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x02e, // 0x049 = 73 -
+ 0x094, // 0x04a = 74 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x02e, // 0x04b = 75 -
+ 0x0a7, // 0x04c = 76 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x122, // 0x04d = 77 -
+ 0x092, // 0x04e = 78 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x02e, // 0x04f = 79 -
+ 0x0ca, // 0x050 = 80 - JUMP_IF_PHY_READY
+ 0x034, // 0x051 = 81 -
+ 0x031, // 0x052 = 82 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x053 = 83 - SOFT_RESET
+ 0x0ff, // 0x054 = 84 - JUMP
+ 0x001, // 0x055 = 85 -
+ 0x021, // 0x056 = 86 - SET_OPEN_STATUS_NORMAL_SFO
+ 0x0ff, // 0x057 = 87 - JUMP
+ 0x06e, // 0x058 = 88 -
+ 0x025, // 0x059 = 89 - SET_OPEN_STATUS_BAD_RATE_SFO
+ 0x0ff, // 0x05a = 90 - JUMP
+ 0x10d, // 0x05b = 91 -
+ 0x026, // 0x05c = 92 - SET_OPEN_STATUS_BAD_PROTOCOL_SFO
+ 0x0ff, // 0x05d = 93 - JUMP
+ 0x10d, // 0x05e = 94 -
+ 0x028, // 0x05f = 95 - SET_OPEN_STATUS_WRONG_DEST_SFO
+ 0x0ff, // 0x060 = 96 - JUMP
+ 0x10d, // 0x061 = 97 -
+ 0x024, // 0x062 = 98 - SET_OPEN_STATUS_BREAK_SFO
+ 0x0ff, // 0x063 = 99 - JUMP
+ 0x10d, // 0x064 = 100 -
+ 0x023, // 0x065 = 101 - SET_OPEN_STATUS_BAD_DEST_SFO
+ 0x0ff, // 0x066 = 102 - JUMP
+ 0x10d, // 0x067 = 103 -
+ 0x022, // 0x068 = 104 - SET_OPEN_STATUS_IT_NEXUS_LOSS_SFO
+ 0x0ff, // 0x069 = 105 - JUMP
+ 0x10d, // 0x06a = 106 -
+ 0x019, // 0x06b = 107 - PATHWAY_BLOCKED_CNT_SFO_INC
+ 0x0ff, // 0x06c = 108 - JUMP
+ 0x02e, // 0x06d = 109 -
+ 0x000, // 0x06e = 110 - NO_OP
+ 0x0aa, // 0x06f = 111 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x082, // 0x070 = 112 -
+ 0x0ab, // 0x071 = 113 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x086, // 0x072 = 114 -
+ 0x0ac, // 0x073 = 115 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x089, // 0x074 = 116 -
+ 0x0ad, // 0x075 = 117 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x08f, // 0x076 = 118 -
+ 0x0af, // 0x077 = 119 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x08c, // 0x078 = 120 -
+ 0x0ae, // 0x079 = 121 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x086, // 0x07a = 122 -
+ 0x0d2, // 0x07b = 123 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+ 0x095, // 0x07c = 124 -
+ 0x0ca, // 0x07d = 125 - JUMP_IF_PHY_READY
+ 0x06f, // 0x07e = 126 -
+ 0x033, // 0x07f = 127 - SOFT_RESET
+ 0x0ff, // 0x080 = 128 - JUMP
+ 0x001, // 0x081 = 129 -
+ 0x0d0, // 0x082 = 130 - JUMP_IF_SMP_PROTOCOL
+ 0x086, // 0x083 = 131 -
+ 0x0ff, // 0x084 = 132 - JUMP
+ 0x092, // 0x085 = 133 -
+ 0x006, // 0x086 = 134 - CLOSE_NORMAL
+ 0x0ff, // 0x087 = 135 - JUMP
+ 0x08f, // 0x088 = 136 -
+ 0x007, // 0x089 = 137 - CLOSE_ACK_NAK_TIMEOUT
+ 0x0ff, // 0x08a = 138 - JUMP
+ 0x08f, // 0x08b = 139 -
+ 0x008, // 0x08c = 140 - CLOSE_CREDIT_TIMEOUT
+ 0x0ff, // 0x08d = 141 - JUMP
+ 0x08f, // 0x08e = 142 -
+ 0x034, // 0x08f = 143 - ADVANCE_SFO
+ 0x0ff, // 0x090 = 144 - JUMP
+ 0x14c, // 0x091 = 145 -
+ 0x034, // 0x092 = 146 - ADVANCE_SFO
+ 0x0ff, // 0x093 = 147 - JUMP
+ 0x10d, // 0x094 = 148 -
+ 0x034, // 0x095 = 149 - ADVANCE_SFO
+ 0x0ff, // 0x096 = 150 - JUMP
+ 0x15a, // 0x097 = 151 -
+ 0x01c, // 0x098 = 152 - START_IT_NEXUS_LOSS_TIMER_DOC
+ 0x018, // 0x099 = 153 - PATHWAY_BLOCKED_CNT_DOC_RESET
+ 0x014, // 0x09a = 154 - START_ARB_WAIT_TIMER_DOC
+ 0x002, // 0x09b = 155 - OPEN_REQUEST_DOC
+ 0x000, // 0x09c = 156 - NO_OP
+ 0x000, // 0x09d = 157 - NO_OP
+ 0x000, // 0x09e = 158 - NO_OP
+ 0x000, // 0x09f = 159 - NO_OP
+ 0x000, // 0x0a0 = 160 - NO_OP
+ 0x091, // 0x0a1 = 161 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x0c3, // 0x0a2 = 162 -
+ 0x097, // 0x0a3 = 163 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x0c6, // 0x0a4 = 164 -
+ 0x09b, // 0x0a5 = 165 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x0c9, // 0x0a6 = 166 -
+ 0x09d, // 0x0a7 = 167 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x0cc, // 0x0a8 = 168 -
+ 0x096, // 0x0a9 = 169 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x0cf, // 0x0aa = 170 -
+ 0x095, // 0x0ab = 171 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x0d2, // 0x0ac = 172 -
+ 0x0a2, // 0x0ad = 173 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_DOC
+ 0x0d5, // 0x0ae = 174 -
+ 0x09c, // 0x0af = 175 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x098, // 0x0b0 = 176 -
+ 0x098, // 0x0b1 = 177 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x10d, // 0x0b2 = 178 -
+ 0x099, // 0x0b3 = 179 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x0d8, // 0x0b4 = 180 -
+ 0x09a, // 0x0b5 = 181 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x09b, // 0x0b6 = 182 -
+ 0x094, // 0x0b7 = 183 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x09b, // 0x0b8 = 184 -
+ 0x0a7, // 0x0b9 = 185 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x134, // 0x0ba = 186 -
+ 0x092, // 0x0bb = 187 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+ 0x09b, // 0x0bc = 188 -
+ 0x0ca, // 0x0bd = 189 - JUMP_IF_PHY_READY
+ 0x0a1, // 0x0be = 190 -
+ 0x032, // 0x0bf = 191 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x0c0 = 192 - SOFT_RESET
+ 0x0ff, // 0x0c1 = 193 - JUMP
+ 0x001, // 0x0c2 = 194 -
+ 0x029, // 0x0c3 = 195 - SET_OPEN_STATUS_NORMAL_DOC
+ 0x0ff, // 0x0c4 = 196 - JUMP
+ 0x0db, // 0x0c5 = 197 -
+ 0x02d, // 0x0c6 = 198 - SET_OPEN_STATUS_BAD_RATE_DOC
+ 0x0ff, // 0x0c7 = 199 - JUMP
+ 0x10d, // 0x0c8 = 200 -
+ 0x02e, // 0x0c9 = 201 - SET_OPEN_STATUS_BAD_PROTOCOL_DOC
+ 0x0ff, // 0x0ca = 202 - JUMP
+ 0x10d, // 0x0cb = 203 -
+ 0x030, // 0x0cc = 204 - SET_OPEN_STATUS_WRONG_DEST_DOC
+ 0x0ff, // 0x0cd = 205 - JUMP
+ 0x10d, // 0x0ce = 206 -
+ 0x02c, // 0x0cf = 207 - SET_OPEN_STATUS_BREAK_DOC
+ 0x0ff, // 0x0d0 = 208 - JUMP
+ 0x10d, // 0x0d1 = 209 -
+ 0x02b, // 0x0d2 = 210 - SET_OPEN_STATUS_BAD_DEST_DOC
+ 0x0ff, // 0x0d3 = 211 - JUMP
+ 0x10d, // 0x0d4 = 212 -
+ 0x02a, // 0x0d5 = 213 - SET_OPEN_STATUS_IT_NEXUS_LOSS_DOC
+ 0x0ff, // 0x0d6 = 214 - JUMP
+ 0x10d, // 0x0d7 = 215 -
+ 0x01a, // 0x0d8 = 216 - PATHWAY_BLOCKED_CNT_DOC_INC
+ 0x0ff, // 0x0d9 = 217 - JUMP
+ 0x09b, // 0x0da = 218 -
+ 0x000, // 0x0db = 219 - NO_OP
+ 0x0b1, // 0x0dc = 220 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x0ef, // 0x0dd = 221 -
+ 0x0b2, // 0x0de = 222 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x0fb, // 0x0df = 223 -
+ 0x0b3, // 0x0e0 = 224 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x0fe, // 0x0e1 = 225 -
+ 0x0b4, // 0x0e2 = 226 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x104, // 0x0e3 = 227 -
+ 0x0b6, // 0x0e4 = 228 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x101, // 0x0e5 = 229 -
+ 0x0b5, // 0x0e6 = 230 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+ 0x0fb, // 0x0e7 = 231 -
+ 0x0d3, // 0x0e8 = 232 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+ 0x10a, // 0x0e9 = 233 -
+ 0x0ca, // 0x0ea = 234 - JUMP_IF_PHY_READY
+ 0x0f3, // 0x0eb = 235 -
+ 0x033, // 0x0ec = 236 - SOFT_RESET
+ 0x0ff, // 0x0ed = 237 - JUMP
+ 0x001, // 0x0ee = 238 -
+ 0x0d0, // 0x0ef = 239 - JUMP_IF_SMP_PROTOCOL
+ 0x0fb, // 0x0f0 = 240 -
+ 0x0ff, // 0x0f1 = 241 - JUMP
+ 0x107, // 0x0f2 = 242 -
+ 0x0b7, // 0x0f3 = 243 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+ 0x0fb, // 0x0f4 = 244 -
+ 0x0b8, // 0x0f5 = 245 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+ 0x0fb, // 0x0f6 = 246 -
+ 0x0b9, // 0x0f7 = 247 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+ 0x0fb, // 0x0f8 = 248 -
+ 0x0ff, // 0x0f9 = 249 - JUMP
+ 0x0dc, // 0x0fa = 250 -
+ 0x006, // 0x0fb = 251 - CLOSE_NORMAL
+ 0x0ff, // 0x0fc = 252 - JUMP
+ 0x104, // 0x0fd = 253 -
+ 0x007, // 0x0fe = 254 - CLOSE_ACK_NAK_TIMEOUT
+ 0x0ff, // 0x0ff = 255 - JUMP
+ 0x104, // 0x100 = 256 -
+ 0x008, // 0x101 = 257 - CLOSE_CREDIT_TIMEOUT
+ 0x0ff, // 0x102 = 258 - JUMP
+ 0x104, // 0x103 = 259 -
+ 0x035, // 0x104 = 260 - ADVANCE_DOC
+ 0x0ff, // 0x105 = 261 - JUMP
+ 0x14c, // 0x106 = 262 -
+ 0x035, // 0x107 = 263 - ADVANCE_DOC
+ 0x0ff, // 0x108 = 264 - JUMP
+ 0x10d, // 0x109 = 265 -
+ 0x035, // 0x10a = 266 - ADVANCE_DOC
+ 0x0ff, // 0x10b = 267 - JUMP
+ 0x15a, // 0x10c = 268 -
+ 0x0a9, // 0x10d = 269 - JUMP_IF_SFO_REQ
+ 0x118, // 0x10e = 270 -
+ 0x0b0, // 0x10f = 271 - JUMP_IF_DOC_REQ
+ 0x12a, // 0x110 = 272 -
+ 0x0a8, // 0x111 = 273 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x13c, // 0x112 = 274 -
+ 0x0ca, // 0x113 = 275 - JUMP_IF_PHY_READY
+ 0x10d, // 0x114 = 276 -
+ 0x033, // 0x115 = 277 - SOFT_RESET
+ 0x0ff, // 0x116 = 278 - JUMP
+ 0x001, // 0x117 = 279 -
+ 0x0ca, // 0x118 = 280 - JUMP_IF_PHY_READY
+ 0x11e, // 0x119 = 281 -
+ 0x031, // 0x11a = 282 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+ 0x033, // 0x11b = 283 - SOFT_RESET
+ 0x0ff, // 0x11c = 284 - JUMP
+ 0x001, // 0x11d = 285 -
+ 0x0a8, // 0x11e = 286 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x122, // 0x11f = 287 -
+ 0x0ff, // 0x120 = 288 - JUMP
+ 0x02b, // 0x121 = 289 -
+ 0x0a3, // 0x122 = 290 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_SFO
+ 0x126, // 0x123 = 291 -
+ 0x0ff, // 0x124 = 292 - JUMP
+ 0x10f, // 0x125 = 293 -
+ 0x0c8, // 0x126 = 294 - JUMP_IF_BREAK_RECEIVED
+ 0x15a, // 0x127 = 295 -
+ 0x0ff, // 0x128 = 296 - JUMP
+ 0x056, // 0x129 = 297 -
+ 0x0ca, // 0x12a = 298 - JUMP_IF_PHY_READY
+ 0x130, // 0x12b = 299 -
+ 0x032, // 0x12c = 300 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+ 0x033, // 0x12d = 301 - SOFT_RESET
+ 0x0ff, // 0x12e = 302 - JUMP
+ 0x001, // 0x12f = 303 -
+ 0x0a8, // 0x130 = 304 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x134, // 0x131 = 305 -
+ 0x0ff, // 0x132 = 306 - JUMP
+ 0x098, // 0x133 = 307 -
+ 0x0a4, // 0x134 = 308 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_DOC
+ 0x138, // 0x135 = 309 -
+ 0x0ff, // 0x136 = 310 - JUMP
+ 0x111, // 0x137 = 311 -
+ 0x0c8, // 0x138 = 312 - JUMP_IF_BREAK_RECEIVED
+ 0x15a, // 0x139 = 313 -
+ 0x0ff, // 0x13a = 314 - JUMP
+ 0x0c3, // 0x13b = 315 -
+ 0x0d0, // 0x13c = 316 - JUMP_IF_SMP_PROTOCOL
+ 0x145, // 0x13d = 317 -
+ 0x0a6, // 0x13e = 318 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+ 0x142, // 0x13f = 319 -
+ 0x0ff, // 0x140 = 320 - JUMP
+ 0x15f, // 0x141 = 321 -
+ 0x006, // 0x142 = 322 - CLOSE_NORMAL
+ 0x0ff, // 0x143 = 323 - JUMP
+ 0x14c, // 0x144 = 324 -
+ 0x0d1, // 0x145 = 325 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+ 0x168, // 0x146 = 326 -
+ 0x0ff, // 0x147 = 327 - JUMP
+ 0x10d, // 0x148 = 328 -
+ 0x0c8, // 0x149 = 329 - JUMP_IF_BREAK_RECEIVED
+ 0x15a, // 0x14a = 330 -
+ 0x006, // 0x14b = 331 - CLOSE_NORMAL
+ 0x000, // 0x14c = 332 - NO_OP
+ 0x000, // 0x14d = 333 - NO_OP
+ 0x000, // 0x14e = 334 - NO_OP
+ 0x000, // 0x14f = 335 - NO_OP
+ 0x000, // 0x150 = 336 - NO_OP
+ 0x0cd, // 0x151 = 337 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+ 0x10d, // 0x152 = 338 -
+ 0x0c8, // 0x153 = 339 - JUMP_IF_BREAK_RECEIVED
+ 0x15a, // 0x154 = 340 -
+ 0x0ca, // 0x155 = 341 - JUMP_IF_PHY_READY
+ 0x14c, // 0x156 = 342 -
+ 0x033, // 0x157 = 343 - SOFT_RESET
+ 0x0ff, // 0x158 = 344 - JUMP
+ 0x001, // 0x159 = 345 -
+ 0x009, // 0x15a = 346 - CLOSE_BREAK
+ 0x0a8, // 0x15b = 347 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x15b, // 0x15c = 348 -
+ 0x0ff, // 0x15d = 349 - JUMP
+ 0x10d, // 0x15e = 350 -
+ 0x0c8, // 0x15f = 351 - JUMP_IF_BREAK_RECEIVED
+ 0x168, // 0x160 = 352 -
+ 0x0ce, // 0x161 = 353 - JUMP_IF_ANY_DONE_RECEIVED
+ 0x16d, // 0x162 = 354 -
+ 0x0ca, // 0x163 = 355 - JUMP_IF_PHY_READY
+ 0x10d, // 0x164 = 356 -
+ 0x033, // 0x165 = 357 - SOFT_RESET
+ 0x0ff, // 0x166 = 358 - JUMP
+ 0x10d, // 0x167 = 359 -
+ 0x009, // 0x168 = 360 - CLOSE_BREAK
+ 0x0a8, // 0x169 = 361 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x169, // 0x16a = 362 -
+ 0x0ff, // 0x16b = 363 - JUMP
+ 0x10d, // 0x16c = 364 -
+ 0x006, // 0x16d = 365 - CLOSE_NORMAL
+ 0x000, // 0x16e = 366 - NO_OP
+ 0x000, // 0x16f = 367 - NO_OP
+ 0x000, // 0x170 = 368 - NO_OP
+ 0x000, // 0x171 = 369 - NO_OP
+ 0x000, // 0x172 = 370 - NO_OP
+ 0x0cd, // 0x173 = 371 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+ 0x10d, // 0x174 = 372 -
+ 0x0c8, // 0x175 = 373 - JUMP_IF_BREAK_RECEIVED
+ 0x168, // 0x176 = 374 -
+ 0x0ca, // 0x177 = 375 - JUMP_IF_PHY_READY
+ 0x173, // 0x178 = 376 -
+ 0x033, // 0x179 = 377 - SOFT_RESET
+ 0x0ff, // 0x17a = 378 - JUMP
+ 0x001, // 0x17b = 379 -
+ 0x000, // 0x17c = 380 - NO_OP
+ 0x000, // 0x17d = 381 - NO_OP
+ 0x000, // 0x17e = 382 - NO_OP
+ 0x000, // 0x17f = 383 - NO_OP
+ 0x000, // 0x180 = 384 - NO_OP
+ 0x000, // 0x181 = 385 - NO_OP
+ 0x000, // 0x182 = 386 - NO_OP
+ 0x000, // 0x183 = 387 - NO_OP
+ 0x000, // 0x184 = 388 - NO_OP
+ 0x000, // 0x185 = 389 - NO_OP
+ 0x000, // 0x186 = 390 - NO_OP
+ 0x000, // 0x187 = 391 - NO_OP
+ 0x000, // 0x188 = 392 - NO_OP
+ 0x000, // 0x189 = 393 - NO_OP
+ 0x000, // 0x18a = 394 - NO_OP
+ 0x000, // 0x18b = 395 - NO_OP
+ 0x000, // 0x18c = 396 - NO_OP
+ 0x000, // 0x18d = 397 - NO_OP
+ 0x000, // 0x18e = 398 - NO_OP
+ 0x000, // 0x18f = 399 - NO_OP
+ 0x000, // 0x190 = 400 - NO_OP
+ 0x000, // 0x191 = 401 - NO_OP
+ 0x000, // 0x192 = 402 - NO_OP
+ 0x000, // 0x193 = 403 - NO_OP
+ 0x000, // 0x194 = 404 - NO_OP
+ 0x000, // 0x195 = 405 - NO_OP
+ 0x000, // 0x196 = 406 - NO_OP
+ 0x000, // 0x197 = 407 - NO_OP
+ 0x000, // 0x198 = 408 - NO_OP
+ 0x000, // 0x199 = 409 - NO_OP
+ 0x000, // 0x19a = 410 - NO_OP
+ 0x000, // 0x19b = 411 - NO_OP
+ 0x000, // 0x19c = 412 - NO_OP
+ 0x000, // 0x19d = 413 - NO_OP
+ 0x000, // 0x19e = 414 - NO_OP
+ 0x000, // 0x19f = 415 - NO_OP
+ 0x000, // 0x1a0 = 416 - NO_OP
+ 0x000, // 0x1a1 = 417 - NO_OP
+ 0x000, // 0x1a2 = 418 - NO_OP
+ 0x000, // 0x1a3 = 419 - NO_OP
+ 0x000, // 0x1a4 = 420 - NO_OP
+ 0x000, // 0x1a5 = 421 - NO_OP
+ 0x000, // 0x1a6 = 422 - NO_OP
+ 0x000, // 0x1a7 = 423 - NO_OP
+ 0x000, // 0x1a8 = 424 - NO_OP
+ 0x000, // 0x1a9 = 425 - NO_OP
+ 0x000, // 0x1aa = 426 - NO_OP
+ 0x000, // 0x1ab = 427 - NO_OP
+ 0x000, // 0x1ac = 428 - NO_OP
+ 0x000, // 0x1ad = 429 - NO_OP
+ 0x000, // 0x1ae = 430 - NO_OP
+ 0x000, // 0x1af = 431 - NO_OP
+ 0x000, // 0x1b0 = 432 - NO_OP
+ 0x000, // 0x1b1 = 433 - NO_OP
+ 0x000, // 0x1b2 = 434 - NO_OP
+ 0x000, // 0x1b3 = 435 - NO_OP
+ 0x000, // 0x1b4 = 436 - NO_OP
+ 0x000, // 0x1b5 = 437 - NO_OP
+ 0x000, // 0x1b6 = 438 - NO_OP
+ 0x000, // 0x1b7 = 439 - NO_OP
+ 0x000, // 0x1b8 = 440 - NO_OP
+ 0x000, // 0x1b9 = 441 - NO_OP
+ 0x000, // 0x1ba = 442 - NO_OP
+ 0x000, // 0x1bb = 443 - NO_OP
+ 0x000, // 0x1bc = 444 - NO_OP
+ 0x000, // 0x1bd = 445 - NO_OP
+ 0x000, // 0x1be = 446 - NO_OP
+ 0x000, // 0x1bf = 447 - NO_OP
+ 0x000, // 0x1c0 = 448 - NO_OP
+ 0x000, // 0x1c1 = 449 - NO_OP
+ 0x000, // 0x1c2 = 450 - NO_OP
+ 0x000, // 0x1c3 = 451 - NO_OP
+ 0x000, // 0x1c4 = 452 - NO_OP
+ 0x000, // 0x1c5 = 453 - NO_OP
+ 0x000, // 0x1c6 = 454 - NO_OP
+ 0x000, // 0x1c7 = 455 - NO_OP
+ 0x000, // 0x1c8 = 456 - NO_OP
+ 0x000, // 0x1c9 = 457 - NO_OP
+ 0x000, // 0x1ca = 458 - NO_OP
+ 0x000, // 0x1cb = 459 - NO_OP
+ 0x000, // 0x1cc = 460 - NO_OP
+ 0x000, // 0x1cd = 461 - NO_OP
+ 0x000, // 0x1ce = 462 - NO_OP
+ 0x000, // 0x1cf = 463 - NO_OP
+ 0x000, // 0x1d0 = 464 - NO_OP
+ 0x000, // 0x1d1 = 465 - NO_OP
+ 0x000, // 0x1d2 = 466 - NO_OP
+ 0x000, // 0x1d3 = 467 - NO_OP
+ 0x000, // 0x1d4 = 468 - NO_OP
+ 0x000, // 0x1d5 = 469 - NO_OP
+ 0x000, // 0x1d6 = 470 - NO_OP
+ 0x000, // 0x1d7 = 471 - NO_OP
+ 0x000, // 0x1d8 = 472 - NO_OP
+ 0x000, // 0x1d9 = 473 - NO_OP
+ 0x000, // 0x1da = 474 - NO_OP
+ 0x000, // 0x1db = 475 - NO_OP
+ 0x000, // 0x1dc = 476 - NO_OP
+ 0x000, // 0x1dd = 477 - NO_OP
+ 0x000, // 0x1de = 478 - NO_OP
+ 0x000, // 0x1df = 479 - NO_OP
+ 0x000, // 0x1e0 = 480 - NO_OP
+ 0x000, // 0x1e1 = 481 - NO_OP
+ 0x000, // 0x1e2 = 482 - NO_OP
+ 0x000, // 0x1e3 = 483 - NO_OP
+ 0x000, // 0x1e4 = 484 - NO_OP
+ 0x000, // 0x1e5 = 485 - NO_OP
+ 0x000, // 0x1e6 = 486 - NO_OP
+ 0x000, // 0x1e7 = 487 - NO_OP
+ 0x000, // 0x1e8 = 488 - NO_OP
+ 0x000, // 0x1e9 = 489 - NO_OP
+ 0x000, // 0x1ea = 490 - NO_OP
+ 0x000, // 0x1eb = 491 - NO_OP
+ 0x000, // 0x1ec = 492 - NO_OP
+ 0x000, // 0x1ed = 493 - NO_OP
+ 0x000, // 0x1ee = 494 - NO_OP
+ 0x000, // 0x1ef = 495 - NO_OP
+ 0x000, // 0x1f0 = 496 - NO_OP
+ 0x000, // 0x1f1 = 497 - NO_OP
+ 0x000, // 0x1f2 = 498 - NO_OP
+ 0x000, // 0x1f3 = 499 - NO_OP
+ 0x000, // 0x1f4 = 500 - NO_OP
+ 0x000, // 0x1f5 = 501 - NO_OP
+ 0x000, // 0x1f6 = 502 - NO_OP
+ 0x000, // 0x1f7 = 503 - NO_OP
+ 0x000, // 0x1f8 = 504 - NO_OP
+ 0x000, // 0x1f9 = 505 - NO_OP
+ 0x000, // 0x1fa = 506 - NO_OP
+ 0x000, // 0x1fb = 507 - NO_OP
+ 0x000, // 0x1fc = 508 - NO_OP
+ 0x000, // 0x1fd = 509 - NO_OP
+ 0x000, // 0x1fe = 510 - NO_OP
+ 0x000, // 0x1ff = 511 - NO_OP
+};
+/* 8/24/05 not worked */
+bit32 wcsImage0824[] =
+{
+0x011, // 00000 = 0 - PHY_RESET_START
+0x0ca, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ba, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0bb, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x010, // 0x009 = 9 - SEND_ID_FRAME
+0x0ba, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0bb, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x033, // 0x010 = 16 - SOFT_RESET
+0x011, // 0x011 = 17 - PHY_RESET_START
+0x0ca, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0bb, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x010, // 0x016 = 22 - SEND_ID_FRAME
+0x0bb, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x010, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0ca, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x010, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x11b, // 0x02a = 42 -
+0x01b, // 0x02b = 43 - START_IT_NEXUS_LOSS_TIMER_SFO
+0x017, // 0x02c = 44 - PATHWAY_BLOCKED_CNT_SFO_RESET
+0x015, // 0x02d = 45 - NO_OP
+0x07f, // 0x02e = 46 - NO_OP
+0x001, // 0x02f = 47 - OPEN_REQUEST_SFO
+0x000, // 0x030 = 48 - NO_OP
+0x000, // 0x031 = 49 - NO_OP
+0x000, // 0x032 = 50 - NO_OP
+0x000, // 0x033 = 51 - NO_OP
+0x000, // 0x034 = 52 - NO_OP
+0x091, // 0x035 = 53 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x057, // 0x036 = 54 -
+0x097, // 0x037 = 55 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x05a, // 0x038 = 56 -
+0x09b, // 0x039 = 57 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x05d, // 0x03a = 58 -
+0x09d, // 0x03b = 59 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x060, // 0x03c = 60 -
+0x096, // 0x03d = 61 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x063, // 0x03e = 62 -
+0x095, // 0x03f = 63 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x066, // 0x040 = 64 -
+0x0a1, // 0x041 = 65 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_SFO
+0x069, // 0x042 = 66 -
+0x09c, // 0x043 = 67 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x02b, // 0x044 = 68 -
+0x098, // 0x045 = 69 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x11b, // 0x046 = 70 -
+0x099, // 0x047 = 71 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x06c, // 0x048 = 72 -
+0x09a, // 0x049 = 73 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x02f, // 0x04a = 74 -
+0x094, // 0x04b = 75 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x02f, // 0x04c = 76 -
+0x0a7, // 0x04d = 77 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x130, // 0x04e = 78 -
+0x092, // 0x04f = 79 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+0x02f, // 0x050 = 80 -
+0x0ca, // 0x051 = 81 - JUMP_IF_PHY_READY
+0x035, // 0x052 = 82 -
+0x031, // 0x053 = 83 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+0x033, // 0x054 = 84 - SOFT_RESET
+0x0ff, // 0x055 = 85 - JUMP
+0x001, // 0x056 = 86 -
+0x021, // 0x057 = 87 - SET_OPEN_STATUS_NORMAL_SFO
+0x0ff, // 0x058 = 88 - JUMP
+0x06f, // 0x059 = 89 -
+0x025, // 0x05a = 90 - SET_OPEN_STATUS_BAD_RATE_SFO
+0x0ff, // 0x05b = 91 - JUMP
+0x11b, // 0x05c = 92 -
+0x026, // 0x05d = 93 - SET_OPEN_STATUS_BAD_PROTOCOL_SFO
+0x0ff, // 0x05e = 94 - JUMP
+0x11b, // 0x05f = 95 -
+0x028, // 0x060 = 96 - SET_OPEN_STATUS_WRONG_DEST_SFO
+0x0ff, // 0x061 = 97 - JUMP
+0x11b, // 0x062 = 98 -
+0x024, // 0x063 = 99 - SET_OPEN_STATUS_BREAK_SFO
+0x0ff, // 0x064 = 100 - JUMP
+0x11b, // 0x065 = 101 -
+0x023, // 0x066 = 102 - SET_OPEN_STATUS_BAD_DEST_SFO
+0x0ff, // 0x067 = 103 - JUMP
+0x11b, // 0x068 = 104 -
+0x022, // 0x069 = 105 - SET_OPEN_STATUS_IT_NEXUS_LOSS_SFO
+0x0ff, // 0x06a = 106 - JUMP
+0x11b, // 0x06b = 107 -
+0x019, // 0x06c = 108 - PATHWAY_BLOCKED_CNT_SFO_INC
+0x0ff, // 0x06d = 109 - JUMP
+0x02f, // 0x06e = 110 -
+0x000, // 0x06f = 111 - NO_OP
+0x0d4, // 0x070 = 112 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x09b, // 0x071 = 113 -
+0x0aa, // 0x072 = 114 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_GOOD
+0x085, // 0x073 = 115 -
+0x0ab, // 0x074 = 116 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_NAK
+0x089, // 0x075 = 117 -
+0x0ac, // 0x076 = 118 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x08c, // 0x077 = 119 -
+0x0ad, // 0x078 = 120 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_BREAK
+0x092, // 0x079 = 121 -
+0x0af, // 0x07a = 122 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x08f, // 0x07b = 123 -
+0x0ae, // 0x07c = 124 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+0x089, // 0x07d = 125 -
+0x0d2, // 0x07e = 126 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x098, // 0x07f = 127 -
+0x0ca, // 0x080 = 128 - JUMP_IF_PHY_READY
+0x070, // 0x081 = 129 -
+0x033, // 0x082 = 130 - SOFT_RESET
+0x0ff, // 0x083 = 131 - JUMP
+0x001, // 0x084 = 132 -
+0x0d0, // 0x085 = 133 - JUMP_IF_SMP_PROTOCOL
+0x089, // 0x086 = 134 -
+0x0ff, // 0x087 = 135 - JUMP
+0x095, // 0x088 = 136 -
+0x006, // 0x089 = 137 - CLOSE_NORMAL
+0x0ff, // 0x08a = 138 - JUMP
+0x092, // 0x08b = 139 -
+0x007, // 0x08c = 140 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x08d = 141 - JUMP
+0x092, // 0x08e = 142 -
+0x008, // 0x08f = 143 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x090 = 144 - JUMP
+0x092, // 0x091 = 145 -
+0x034, // 0x092 = 146 - ADVANCE_SFO
+0x0ff, // 0x093 = 147 - JUMP
+0x15f, // 0x094 = 148 -
+0x034, // 0x095 = 149 - ADVANCE_SFO
+0x0ff, // 0x096 = 150 - JUMP
+0x11b, // 0x097 = 151 -
+0x034, // 0x098 = 152 - ADVANCE_SFO
+0x0ff, // 0x099 = 153 - JUMP
+0x16f, // 0x09a = 154 -
+0x037, // 0x09b = 155 - SEND_CREDIT_BLOCK
+0x0ff, // 0x09c = 156 - JUMP
+0x072, // 0x09d = 157 -
+0x01c, // 0x09e = 158 - START_IT_NEXUS_LOSS_TIMER_DOC
+0x018, // 0x09f = 159 - PATHWAY_BLOCKED_CNT_DOC_RESET
+0x016, // 0x0a0 = 160 - NO_OP
+0x07f, // 0x0a1 = 161 - NO_OP
+0x002, // 0x0a2 = 162 - OPEN_REQUEST_DOC
+0x000, // 0x0a3 = 163 - NO_OP
+0x000, // 0x0a4 = 164 - NO_OP
+0x000, // 0x0a5 = 165 - NO_OP
+0x000, // 0x0a6 = 166 - NO_OP
+0x000, // 0x0a7 = 167 - NO_OP
+0x091, // 0x0a8 = 168 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0ca, // 0x0a9 = 169 -
+0x097, // 0x0aa = 170 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x0cd, // 0x0ab = 171 -
+0x09b, // 0x0ac = 172 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x0d0, // 0x0ad = 173 -
+0x09d, // 0x0ae = 174 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x0d3, // 0x0af = 175 -
+0x096, // 0x0b0 = 176 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0d6, // 0x0b1 = 177 -
+0x095, // 0x0b2 = 178 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x0d9, // 0x0b3 = 179 -
+0x0a2, // 0x0b4 = 180 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_DOC
+0x0dc, // 0x0b5 = 181 -
+0x09c, // 0x0b6 = 182 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x09e, // 0x0b7 = 183 -
+0x098, // 0x0b8 = 184 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x11b, // 0x0b9 = 185 -
+0x099, // 0x0ba = 186 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x0df, // 0x0bb = 187 -
+0x09a, // 0x0bc = 188 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x0a2, // 0x0bd = 189 -
+0x094, // 0x0be = 190 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x0a2, // 0x0bf = 191 -
+0x0a7, // 0x0c0 = 192 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x142, // 0x0c1 = 193 -
+0x092, // 0x0c2 = 194 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+0x0a2, // 0x0c3 = 195 -
+0x0ca, // 0x0c4 = 196 - JUMP_IF_PHY_READY
+0x0a8, // 0x0c5 = 197 -
+0x032, // 0x0c6 = 198 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+0x033, // 0x0c7 = 199 - SOFT_RESET
+0x0ff, // 0x0c8 = 200 - JUMP
+0x001, // 0x0c9 = 201 -
+0x029, // 0x0ca = 202 - SET_OPEN_STATUS_NORMAL_DOC
+0x0ff, // 0x0cb = 203 - JUMP
+0x0e2, // 0x0cc = 204 -
+0x02d, // 0x0cd = 205 - SET_OPEN_STATUS_BAD_RATE_DOC
+0x0ff, // 0x0ce = 206 - JUMP
+0x11b, // 0x0cf = 207 -
+0x02e, // 0x0d0 = 208 - SET_OPEN_STATUS_BAD_PROTOCOL_DOC
+0x0ff, // 0x0d1 = 209 - JUMP
+0x11b, // 0x0d2 = 210 -
+0x030, // 0x0d3 = 211 - SET_OPEN_STATUS_WRONG_DEST_DOC
+0x0ff, // 0x0d4 = 212 - JUMP
+0x11b, // 0x0d5 = 213 -
+0x02c, // 0x0d6 = 214 - SET_OPEN_STATUS_BREAK_DOC
+0x0ff, // 0x0d7 = 215 - JUMP
+0x11b, // 0x0d8 = 216 -
+0x02b, // 0x0d9 = 217 - SET_OPEN_STATUS_BAD_DEST_DOC
+0x0ff, // 0x0da = 218 - JUMP
+0x11b, // 0x0db = 219 -
+0x02a, // 0x0dc = 220 - SET_OPEN_STATUS_IT_NEXUS_LOSS_DOC
+0x0ff, // 0x0dd = 221 - JUMP
+0x11b, // 0x0de = 222 -
+0x01a, // 0x0df = 223 - PATHWAY_BLOCKED_CNT_DOC_INC
+0x0ff, // 0x0e0 = 224 - JUMP
+0x0a2, // 0x0e1 = 225 -
+0x000, // 0x0e2 = 226 - NO_OP
+0x0d4, // 0x0e3 = 227 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x118, // 0x0e4 = 228 -
+0x0b1, // 0x0e5 = 229 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_GOOD
+0x0fa, // 0x0e6 = 230 -
+0x0b2, // 0x0e7 = 231 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_NAK
+0x106, // 0x0e8 = 232 -
+0x0b3, // 0x0e9 = 233 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x109, // 0x0ea = 234 -
+0x0b4, // 0x0eb = 235 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_BREAK
+0x10f, // 0x0ec = 236 -
+0x0b6, // 0x0ed = 237 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x10c, // 0x0ee = 238 -
+0x0b5, // 0x0ef = 239 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+0x106, // 0x0f0 = 240 -
+0x0d3, // 0x0f1 = 241 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x115, // 0x0f2 = 242 -
+0x0d5, // 0x0f3 = 243 - JUMP_IF_DOC_CLOSE_REQ
+0x15c, // 0x0f4 = 244 -
+0x0ca, // 0x0f5 = 245 - JUMP_IF_PHY_READY
+0x0fe, // 0x0f6 = 246 -
+0x033, // 0x0f7 = 247 - SOFT_RESET
+0x0ff, // 0x0f8 = 248 - JUMP
+0x001, // 0x0f9 = 249 -
+0x0d0, // 0x0fa = 250 - JUMP_IF_SMP_PROTOCOL
+0x106, // 0x0fb = 251 -
+0x0ff, // 0x0fc = 252 - JUMP
+0x112, // 0x0fd = 253 -
+0x0b7, // 0x0fe = 254 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+0x106, // 0x0ff = 255 -
+0x0b8, // 0x100 = 256 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x106, // 0x101 = 257 -
+0x0b9, // 0x102 = 258 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+0x106, // 0x103 = 259 -
+0x0ff, // 0x104 = 260 - JUMP
+0x0e3, // 0x105 = 261 -
+0x006, // 0x106 = 262 - CLOSE_NORMAL
+0x0ff, // 0x107 = 263 - JUMP
+0x10f, // 0x108 = 264 -
+0x007, // 0x109 = 265 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x10a = 266 - JUMP
+0x10f, // 0x10b = 267 -
+0x008, // 0x10c = 268 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x10d = 269 - JUMP
+0x10f, // 0x10e = 270 -
+0x035, // 0x10f = 271 - ADVANCE_DOC
+0x0ff, // 0x110 = 272 - JUMP
+0x15f, // 0x111 = 273 -
+0x035, // 0x112 = 274 - ADVANCE_DOC
+0x0ff, // 0x113 = 275 - JUMP
+0x11b, // 0x114 = 276 -
+0x035, // 0x115 = 277 - ADVANCE_DOC
+0x0ff, // 0x116 = 278 - JUMP
+0x16f, // 0x117 = 279 -
+0x037, // 0x118 = 280 - SEND_CREDIT_BLOCK
+0x0ff, // 0x119 = 281 - JUMP
+0x0e5, // 0x11a = 282 -
+0x0a9, // 0x11b = 283 - JUMP_IF_SFO_REQ
+0x126, // 0x11c = 284 -
+0x0b0, // 0x11d = 285 - JUMP_IF_DOC_REQ
+0x138, // 0x11e = 286 -
+0x0a8, // 0x11f = 287 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x14a, // 0x120 = 288 -
+0x0ca, // 0x121 = 289 - JUMP_IF_PHY_READY
+0x11b, // 0x122 = 290 -
+0x033, // 0x123 = 291 - SOFT_RESET
+0x0ff, // 0x124 = 292 - JUMP
+0x001, // 0x125 = 293 -
+0x0ca, // 0x126 = 294 - JUMP_IF_PHY_READY
+0x12c, // 0x127 = 295 -
+0x031, // 0x128 = 296 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+0x033, // 0x129 = 297 - SOFT_RESET
+0x0ff, // 0x12a = 298 - JUMP
+0x001, // 0x12b = 299 -
+0x0a8, // 0x12c = 300 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x130, // 0x12d = 301 -
+0x0ff, // 0x12e = 302 - JUMP
+0x02b, // 0x12f = 303 -
+0x0a3, // 0x130 = 304 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_SFO
+0x134, // 0x131 = 305 -
+0x0ff, // 0x132 = 306 - JUMP
+0x11d, // 0x133 = 307 -
+0x0c8, // 0x134 = 308 - JUMP_IF_BREAK_RECEIVED
+0x16f, // 0x135 = 309 -
+0x0ff, // 0x136 = 310 - JUMP
+0x057, // 0x137 = 311 -
+0x0ca, // 0x138 = 312 - JUMP_IF_PHY_READY
+0x13e, // 0x139 = 313 -
+0x032, // 0x13a = 314 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+0x033, // 0x13b = 315 - SOFT_RESET
+0x0ff, // 0x13c = 316 - JUMP
+0x001, // 0x13d = 317 -
+0x0a8, // 0x13e = 318 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x142, // 0x13f = 319 -
+0x0ff, // 0x140 = 320 - JUMP
+0x09e, // 0x141 = 321 -
+0x0a4, // 0x142 = 322 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_DOC
+0x146, // 0x143 = 323 -
+0x0ff, // 0x144 = 324 - JUMP
+0x11f, // 0x145 = 325 -
+0x0c8, // 0x146 = 326 - JUMP_IF_BREAK_RECEIVED
+0x16f, // 0x147 = 327 -
+0x0ff, // 0x148 = 328 - JUMP
+0x0ca, // 0x149 = 329 -
+0x0d0, // 0x14a = 330 - JUMP_IF_SMP_PROTOCOL
+0x155, // 0x14b = 331 -
+0x0d4, // 0x14c = 332 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x159, // 0x14d = 333 -
+0x0a6, // 0x14e = 334 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x152, // 0x14f = 335 -
+0x0ff, // 0x150 = 336 - JUMP
+0x177, // 0x151 = 337 -
+0x006, // 0x152 = 338 - CLOSE_NORMAL
+0x0ff, // 0x153 = 339 - JUMP
+0x15f, // 0x154 = 340 -
+0x0d1, // 0x155 = 341 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x180, // 0x156 = 342 -
+0x0ff, // 0x157 = 343 - JUMP
+0x11b, // 0x158 = 344 -
+0x037, // 0x159 = 345 - SEND_CREDIT_BLOCK
+0x0ff, // 0x15a = 346 - JUMP
+0x14e, // 0x15b = 347 -
+0x0c8, // 0x15c = 348 - JUMP_IF_BREAK_RECEIVED
+0x16f, // 0x15d = 349 -
+0x006, // 0x15e = 350 - CLOSE_NORMAL
+0x000, // 0x15f = 351 - NO_OP
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x000, // 0x162 = 354 - NO_OP
+0x000, // 0x163 = 355 - NO_OP
+0x0d4, // 0x164 = 356 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x174, // 0x165 = 357 -
+0x0cd, // 0x166 = 358 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x11b, // 0x167 = 359 -
+0x0c8, // 0x168 = 360 - JUMP_IF_BREAK_RECEIVED
+0x16f, // 0x169 = 361 -
+0x0ca, // 0x16a = 362 - JUMP_IF_PHY_READY
+0x15f, // 0x16b = 363 -
+0x033, // 0x16c = 364 - SOFT_RESET
+0x0ff, // 0x16d = 365 - JUMP
+0x001, // 0x16e = 366 -
+0x009, // 0x16f = 367 - CLOSE_BREAK
+0x0a8, // 0x170 = 368 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x170, // 0x171 = 369 -
+0x0ff, // 0x172 = 370 - JUMP
+0x11b, // 0x173 = 371 -
+0x037, // 0x174 = 372 - SEND_CREDIT_BLOCK
+0x0ff, // 0x175 = 373 - JUMP
+0x166, // 0x176 = 374 -
+0x0c8, // 0x177 = 375 - JUMP_IF_BREAK_RECEIVED
+0x180, // 0x178 = 376 -
+0x0ce, // 0x179 = 377 - JUMP_IF_ANY_DONE_RECEIVED
+0x185, // 0x17a = 378 -
+0x0ca, // 0x17b = 379 - JUMP_IF_PHY_READY
+0x11b, // 0x17c = 380 -
+0x033, // 0x17d = 381 - SOFT_RESET
+0x0ff, // 0x17e = 382 - JUMP
+0x11b, // 0x17f = 383 -
+0x009, // 0x180 = 384 - CLOSE_BREAK
+0x0a8, // 0x181 = 385 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x181, // 0x182 = 386 -
+0x0ff, // 0x183 = 387 - JUMP
+0x11b, // 0x184 = 388 -
+0x006, // 0x185 = 389 - CLOSE_NORMAL
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x0cd, // 0x18b = 395 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x11b, // 0x18c = 396 -
+0x0d4, // 0x18d = 397 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x196, // 0x18e = 398 -
+0x0c8, // 0x18f = 399 - JUMP_IF_BREAK_RECEIVED
+0x180, // 0x190 = 400 -
+0x0ca, // 0x191 = 401 - JUMP_IF_PHY_READY
+0x18b, // 0x192 = 402 -
+0x033, // 0x193 = 403 - SOFT_RESET
+0x0ff, // 0x194 = 404 - JUMP
+0x001, // 0x195 = 405 -
+0x037, // 0x196 = 406 - SEND_CREDIT_BLOCK
+0x0ff, // 0x197 = 407 - JUMP
+0x18f, // 0x198 = 408 -
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+
+/* as of 8/23/05 and worked, used for Houston demo, bitmap0822 */
+bit32 wcsImage0822[] =
+{
+0x011, // 00000 = 0 - PHY_RESET_START
+0x0ca, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ba, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0bb, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x010, // 0x009 = 9 - SEND_ID_FRAME
+0x0ba, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0bb, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x033, // 0x010 = 16 - SOFT_RESET
+0x011, // 0x011 = 17 - PHY_RESET_START
+0x0ca, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0bb, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x010, // 0x016 = 22 - SEND_ID_FRAME
+0x0bb, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x010, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0ca, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x010, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x112, // 0x02a = 42 -
+0x01b, // 0x02b = 43 - START_IT_NEXUS_LOSS_TIMER_SFO
+0x017, // 0x02c = 44 - PATHWAY_BLOCKED_CNT_SFO_RESET
+0x013, // 0x02d = 45 - START_ARB_WAIT_TIMER_SFO
+0x001, // 0x02e = 46 - OPEN_REQUEST_SFO
+0x000, // 0x02f = 47 - NO_OP
+0x000, // 0x030 = 48 - NO_OP
+0x000, // 0x031 = 49 - NO_OP
+0x000, // 0x032 = 50 - NO_OP
+0x000, // 0x033 = 51 - NO_OP
+0x091, // 0x034 = 52 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x056, // 0x035 = 53 -
+0x097, // 0x036 = 54 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x059, // 0x037 = 55 -
+0x09b, // 0x038 = 56 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x05c, // 0x039 = 57 -
+0x09d, // 0x03a = 58 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x05f, // 0x03b = 59 -
+0x096, // 0x03c = 60 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x062, // 0x03d = 61 -
+0x095, // 0x03e = 62 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x065, // 0x03f = 63 -
+0x0a1, // 0x040 = 64 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_SFO
+0x068, // 0x041 = 65 -
+0x09c, // 0x042 = 66 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x02b, // 0x043 = 67 -
+0x098, // 0x044 = 68 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x112, // 0x045 = 69 -
+0x099, // 0x046 = 70 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x06b, // 0x047 = 71 -
+0x09a, // 0x048 = 72 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x02e, // 0x049 = 73 -
+0x094, // 0x04a = 74 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x02e, // 0x04b = 75 -
+0x0a7, // 0x04c = 76 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x127, // 0x04d = 77 -
+0x092, // 0x04e = 78 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+0x02e, // 0x04f = 79 -
+0x0ca, // 0x050 = 80 - JUMP_IF_PHY_READY
+0x034, // 0x051 = 81 -
+0x031, // 0x052 = 82 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+0x033, // 0x053 = 83 - SOFT_RESET
+0x0ff, // 0x054 = 84 - JUMP
+0x001, // 0x055 = 85 -
+0x021, // 0x056 = 86 - SET_OPEN_STATUS_NORMAL_SFO
+0x0ff, // 0x057 = 87 - JUMP
+0x06e, // 0x058 = 88 -
+0x025, // 0x059 = 89 - SET_OPEN_STATUS_BAD_RATE_SFO
+0x0ff, // 0x05a = 90 - JUMP
+0x112, // 0x05b = 91 -
+0x026, // 0x05c = 92 - SET_OPEN_STATUS_BAD_PROTOCOL_SFO
+0x0ff, // 0x05d = 93 - JUMP
+0x112, // 0x05e = 94 -
+0x028, // 0x05f = 95 - SET_OPEN_STATUS_WRONG_DEST_SFO
+0x0ff, // 0x060 = 96 - JUMP
+0x112, // 0x061 = 97 -
+0x024, // 0x062 = 98 - SET_OPEN_STATUS_BREAK_SFO
+0x0ff, // 0x063 = 99 - JUMP
+0x112, // 0x064 = 100 -
+0x023, // 0x065 = 101 - SET_OPEN_STATUS_BAD_DEST_SFO
+0x0ff, // 0x066 = 102 - JUMP
+0x112, // 0x067 = 103 -
+0x022, // 0x068 = 104 - SET_OPEN_STATUS_IT_NEXUS_LOSS_SFO
+0x0ff, // 0x069 = 105 - JUMP
+0x112, // 0x06a = 106 -
+0x019, // 0x06b = 107 - PATHWAY_BLOCKED_CNT_SFO_INC
+0x0ff, // 0x06c = 108 - JUMP
+0x02e, // 0x06d = 109 -
+0x000, // 0x06e = 110 - NO_OP
+0x0d4, // 0x06f = 111 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x093, // 0x070 = 112 -
+0x0aa, // 0x071 = 113 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_GOOD
+0x084, // 0x072 = 114 -
+0x0ab, // 0x073 = 115 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_NAK
+0x084, // 0x074 = 116 -
+0x0ac, // 0x075 = 117 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x087, // 0x076 = 118 -
+0x0ad, // 0x077 = 119 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_BREAK
+0x08d, // 0x078 = 120 -
+0x0af, // 0x079 = 121 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x08a, // 0x07a = 122 -
+0x0ae, // 0x07b = 123 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+0x084, // 0x07c = 124 -
+0x0d2, // 0x07d = 125 - JUMP_IF_SFO_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x090, // 0x07e = 126 -
+0x0ca, // 0x07f = 127 - JUMP_IF_PHY_READY
+0x06f, // 0x080 = 128 -
+0x033, // 0x081 = 129 - SOFT_RESET
+0x0ff, // 0x082 = 130 - JUMP
+0x001, // 0x083 = 131 -
+0x006, // 0x084 = 132 - CLOSE_NORMAL
+0x0ff, // 0x085 = 133 - JUMP
+0x08d, // 0x086 = 134 -
+0x007, // 0x087 = 135 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x088 = 136 - JUMP
+0x08d, // 0x089 = 137 -
+0x008, // 0x08a = 138 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x08b = 139 - JUMP
+0x08d, // 0x08c = 140 -
+0x034, // 0x08d = 141 - ADVANCE_SFO
+0x0ff, // 0x08e = 142 - JUMP
+0x156, // 0x08f = 143 -
+0x034, // 0x090 = 144 - ADVANCE_SFO
+0x0ff, // 0x091 = 145 - JUMP
+0x166, // 0x092 = 146 -
+0x037, // 0x093 = 147 - SEND_CREDIT_BLOCK
+0x0ff, // 0x094 = 148 - JUMP
+0x071, // 0x095 = 149 -
+0x01c, // 0x096 = 150 - START_IT_NEXUS_LOSS_TIMER_DOC
+0x018, // 0x097 = 151 - PATHWAY_BLOCKED_CNT_DOC_RESET
+0x014, // 0x098 = 152 - START_ARB_WAIT_TIMER_DOC
+0x002, // 0x099 = 153 - OPEN_REQUEST_DOC
+0x000, // 0x09a = 154 - NO_OP
+0x000, // 0x09b = 155 - NO_OP
+0x000, // 0x09c = 156 - NO_OP
+0x000, // 0x09d = 157 - NO_OP
+0x000, // 0x09e = 158 - NO_OP
+0x091, // 0x09f = 159 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0c1, // 0x0a0 = 160 -
+0x097, // 0x0a1 = 161 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x0c4, // 0x0a2 = 162 -
+0x09b, // 0x0a3 = 163 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x0c7, // 0x0a4 = 164 -
+0x09d, // 0x0a5 = 165 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x0ca, // 0x0a6 = 166 -
+0x096, // 0x0a7 = 167 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0cd, // 0x0a8 = 168 -
+0x095, // 0x0a9 = 169 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x0d0, // 0x0aa = 170 -
+0x0a2, // 0x0ab = 171 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT_DOC
+0x0d3, // 0x0ac = 172 -
+0x09c, // 0x0ad = 173 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x096, // 0x0ae = 174 -
+0x098, // 0x0af = 175 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x112, // 0x0b0 = 176 -
+0x099, // 0x0b1 = 177 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x0d6, // 0x0b2 = 178 -
+0x09a, // 0x0b3 = 179 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x099, // 0x0b4 = 180 -
+0x094, // 0x0b5 = 181 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x099, // 0x0b6 = 182 -
+0x0a7, // 0x0b7 = 183 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x139, // 0x0b8 = 184 -
+0x092, // 0x0b9 = 185 - JUMP_IF_OPEN_STATUS_EQUAL_OCSM_BUSY
+0x099, // 0x0ba = 186 -
+0x0ca, // 0x0bb = 187 - JUMP_IF_PHY_READY
+0x09f, // 0x0bc = 188 -
+0x032, // 0x0bd = 189 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+0x033, // 0x0be = 190 - SOFT_RESET
+0x0ff, // 0x0bf = 191 - JUMP
+0x001, // 0x0c0 = 192 -
+0x029, // 0x0c1 = 193 - SET_OPEN_STATUS_NORMAL_DOC
+0x0ff, // 0x0c2 = 194 - JUMP
+0x0d9, // 0x0c3 = 195 -
+0x02d, // 0x0c4 = 196 - SET_OPEN_STATUS_BAD_RATE_DOC
+0x0ff, // 0x0c5 = 197 - JUMP
+0x112, // 0x0c6 = 198 -
+0x02e, // 0x0c7 = 199 - SET_OPEN_STATUS_BAD_PROTOCOL_DOC
+0x0ff, // 0x0c8 = 200 - JUMP
+0x112, // 0x0c9 = 201 -
+0x030, // 0x0ca = 202 - SET_OPEN_STATUS_WRONG_DEST_DOC
+0x0ff, // 0x0cb = 203 - JUMP
+0x112, // 0x0cc = 204 -
+0x02c, // 0x0cd = 205 - SET_OPEN_STATUS_BREAK_DOC
+0x0ff, // 0x0ce = 206 - JUMP
+0x112, // 0x0cf = 207 -
+0x02b, // 0x0d0 = 208 - SET_OPEN_STATUS_BAD_DEST_DOC
+0x0ff, // 0x0d1 = 209 - JUMP
+0x112, // 0x0d2 = 210 -
+0x02a, // 0x0d3 = 211 - SET_OPEN_STATUS_IT_NEXUS_LOSS_DOC
+0x0ff, // 0x0d4 = 212 - JUMP
+0x112, // 0x0d5 = 213 -
+0x01a, // 0x0d6 = 214 - PATHWAY_BLOCKED_CNT_DOC_INC
+0x0ff, // 0x0d7 = 215 - JUMP
+0x099, // 0x0d8 = 216 -
+0x000, // 0x0d9 = 217 - NO_OP
+0x0d4, // 0x0da = 218 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x10f, // 0x0db = 219 -
+0x0b1, // 0x0dc = 220 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_GOOD
+0x0f1, // 0x0dd = 221 -
+0x0b2, // 0x0de = 222 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_NAK
+0x0fd, // 0x0df = 223 -
+0x0b3, // 0x0e0 = 224 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x100, // 0x0e1 = 225 -
+0x0b4, // 0x0e2 = 226 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_BREAK
+0x106, // 0x0e3 = 227 -
+0x0b6, // 0x0e4 = 228 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x103, // 0x0e5 = 229 -
+0x0b5, // 0x0e6 = 230 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_UNEXPECTED_CLOSE
+0x0fd, // 0x0e7 = 231 -
+0x0d3, // 0x0e8 = 232 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x10c, // 0x0e9 = 233 -
+0x0d5, // 0x0ea = 234 - JUMP_IF_DOC_CLOSE_REQ
+0x153, // 0x0eb = 235 -
+0x0ca, // 0x0ec = 236 - JUMP_IF_PHY_READY
+0x0f5, // 0x0ed = 237 -
+0x033, // 0x0ee = 238 - SOFT_RESET
+0x0ff, // 0x0ef = 239 - JUMP
+0x001, // 0x0f0 = 240 -
+0x0d0, // 0x0f1 = 241 - JUMP_IF_SMP_PROTOCOL
+0x0fd, // 0x0f2 = 242 -
+0x0ff, // 0x0f3 = 243 - JUMP
+0x109, // 0x0f4 = 244 -
+0x0b7, // 0x0f5 = 245 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+0x0fd, // 0x0f6 = 246 -
+0x0b8, // 0x0f7 = 247 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x0fd, // 0x0f8 = 248 -
+0x0b9, // 0x0f9 = 249 - JUMP_IF_DOC_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+0x0fd, // 0x0fa = 250 -
+0x0ff, // 0x0fb = 251 - JUMP
+0x0da, // 0x0fc = 252 -
+0x006, // 0x0fd = 253 - CLOSE_NORMAL
+0x0ff, // 0x0fe = 254 - JUMP
+0x106, // 0x0ff = 255 -
+0x007, // 0x100 = 256 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x101 = 257 - JUMP
+0x106, // 0x102 = 258 -
+0x008, // 0x103 = 259 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x104 = 260 - JUMP
+0x106, // 0x105 = 261 -
+0x035, // 0x106 = 262 - ADVANCE_DOC
+0x0ff, // 0x107 = 263 - JUMP
+0x156, // 0x108 = 264 -
+0x035, // 0x109 = 265 - ADVANCE_DOC
+0x0ff, // 0x10a = 266 - JUMP
+0x112, // 0x10b = 267 -
+0x035, // 0x10c = 268 - ADVANCE_DOC
+0x0ff, // 0x10d = 269 - JUMP
+0x166, // 0x10e = 270 -
+0x037, // 0x10f = 271 - SEND_CREDIT_BLOCK
+0x0ff, // 0x110 = 272 - JUMP
+0x0dc, // 0x111 = 273 -
+0x0a9, // 0x112 = 274 - JUMP_IF_SFO_REQ
+0x11d, // 0x113 = 275 -
+0x0b0, // 0x114 = 276 - JUMP_IF_DOC_REQ
+0x12f, // 0x115 = 277 -
+0x0a8, // 0x116 = 278 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x141, // 0x117 = 279 -
+0x0ca, // 0x118 = 280 - JUMP_IF_PHY_READY
+0x112, // 0x119 = 281 -
+0x033, // 0x11a = 282 - SOFT_RESET
+0x0ff, // 0x11b = 283 - JUMP
+0x001, // 0x11c = 284 -
+0x0ca, // 0x11d = 285 - JUMP_IF_PHY_READY
+0x123, // 0x11e = 286 -
+0x031, // 0x11f = 287 - SET_OPEN_STATUS_PHY_NOT_RDY_SFO
+0x033, // 0x120 = 288 - SOFT_RESET
+0x0ff, // 0x121 = 289 - JUMP
+0x001, // 0x122 = 290 -
+0x0a8, // 0x123 = 291 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x127, // 0x124 = 292 -
+0x0ff, // 0x125 = 293 - JUMP
+0x02b, // 0x126 = 294 -
+0x0a3, // 0x127 = 295 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_SFO
+0x12b, // 0x128 = 296 -
+0x0ff, // 0x129 = 297 - JUMP
+0x114, // 0x12a = 298 -
+0x0c8, // 0x12b = 299 - JUMP_IF_BREAK_RECEIVED
+0x166, // 0x12c = 300 -
+0x0ff, // 0x12d = 301 - JUMP
+0x056, // 0x12e = 302 -
+0x0ca, // 0x12f = 303 - JUMP_IF_PHY_READY
+0x135, // 0x130 = 304 -
+0x032, // 0x131 = 305 - SET_OPEN_STATUS_PHY_NOT_RDY_DOC
+0x033, // 0x132 = 306 - SOFT_RESET
+0x0ff, // 0x133 = 307 - JUMP
+0x001, // 0x134 = 308 -
+0x0a8, // 0x135 = 309 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x139, // 0x136 = 310 -
+0x0ff, // 0x137 = 311 - JUMP
+0x096, // 0x138 = 312 -
+0x0a4, // 0x139 = 313 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL_DOC
+0x13d, // 0x13a = 314 -
+0x0ff, // 0x13b = 315 - JUMP
+0x116, // 0x13c = 316 -
+0x0c8, // 0x13d = 317 - JUMP_IF_BREAK_RECEIVED
+0x166, // 0x13e = 318 -
+0x0ff, // 0x13f = 319 - JUMP
+0x0c1, // 0x140 = 320 -
+0x0d0, // 0x141 = 321 - JUMP_IF_SMP_PROTOCOL
+0x14c, // 0x142 = 322 -
+0x0d4, // 0x143 = 323 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x150, // 0x144 = 324 -
+0x0a6, // 0x145 = 325 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x149, // 0x146 = 326 -
+0x0ff, // 0x147 = 327 - JUMP
+0x16e, // 0x148 = 328 -
+0x006, // 0x149 = 329 - CLOSE_NORMAL
+0x0ff, // 0x14a = 330 - JUMP
+0x156, // 0x14b = 331 -
+0x0d1, // 0x14c = 332 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x177, // 0x14d = 333 -
+0x0ff, // 0x14e = 334 - JUMP
+0x112, // 0x14f = 335 -
+0x037, // 0x150 = 336 - SEND_CREDIT_BLOCK
+0x0ff, // 0x151 = 337 - JUMP
+0x145, // 0x152 = 338 -
+0x0c8, // 0x153 = 339 - JUMP_IF_BREAK_RECEIVED
+0x166, // 0x154 = 340 -
+0x006, // 0x155 = 341 - CLOSE_NORMAL
+0x000, // 0x156 = 342 - NO_OP
+0x000, // 0x157 = 343 - NO_OP
+0x000, // 0x158 = 344 - NO_OP
+0x000, // 0x159 = 345 - NO_OP
+0x000, // 0x15a = 346 - NO_OP
+0x0d4, // 0x15b = 347 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x16b, // 0x15c = 348 -
+0x0cd, // 0x15d = 349 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x112, // 0x15e = 350 -
+0x0c8, // 0x15f = 351 - JUMP_IF_BREAK_RECEIVED
+0x166, // 0x160 = 352 -
+0x0ca, // 0x161 = 353 - JUMP_IF_PHY_READY
+0x156, // 0x162 = 354 -
+0x033, // 0x163 = 355 - SOFT_RESET
+0x0ff, // 0x164 = 356 - JUMP
+0x001, // 0x165 = 357 -
+0x009, // 0x166 = 358 - CLOSE_BREAK
+0x0a8, // 0x167 = 359 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x167, // 0x168 = 360 -
+0x0ff, // 0x169 = 361 - JUMP
+0x112, // 0x16a = 362 -
+0x037, // 0x16b = 363 - SEND_CREDIT_BLOCK
+0x0ff, // 0x16c = 364 - JUMP
+0x15d, // 0x16d = 365 -
+0x0c8, // 0x16e = 366 - JUMP_IF_BREAK_RECEIVED
+0x177, // 0x16f = 367 -
+0x0ce, // 0x170 = 368 - JUMP_IF_ANY_DONE_RECEIVED
+0x17c, // 0x171 = 369 -
+0x0ca, // 0x172 = 370 - JUMP_IF_PHY_READY
+0x112, // 0x173 = 371 -
+0x033, // 0x174 = 372 - SOFT_RESET
+0x0ff, // 0x175 = 373 - JUMP
+0x112, // 0x176 = 374 -
+0x009, // 0x177 = 375 - CLOSE_BREAK
+0x0a8, // 0x178 = 376 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x178, // 0x179 = 377 -
+0x0ff, // 0x17a = 378 - JUMP
+0x112, // 0x17b = 379 -
+0x006, // 0x17c = 380 - CLOSE_NORMAL
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x0cd, // 0x182 = 386 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x112, // 0x183 = 387 -
+0x0d4, // 0x184 = 388 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x18d, // 0x185 = 389 -
+0x0c8, // 0x186 = 390 - JUMP_IF_BREAK_RECEIVED
+0x177, // 0x187 = 391 -
+0x0ca, // 0x188 = 392 - JUMP_IF_PHY_READY
+0x182, // 0x189 = 393 -
+0x033, // 0x18a = 394 - SOFT_RESET
+0x0ff, // 0x18b = 395 - JUMP
+0x001, // 0x18c = 396 -
+0x037, // 0x18d = 397 - SEND_CREDIT_BLOCK
+0x0ff, // 0x18e = 398 - JUMP
+0x186, // 0x18f = 399 -
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* worked with the bitmap both pnr11020.bit(mainly this) and t091505d0.bit,
+ this has been golden */
+bit32 wcsImage11020[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x0be, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ae, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0af, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x00c, // 0x009 = 9 - SEND_ID_FRAME
+0x0ae, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0af, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x01c, // 0x010 = 16 - SOFT_RESET
+0x00d, // 0x011 = 17 - PHY_RESET_START
+0x0be, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0af, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x00c, // 0x016 = 22 - SEND_ID_FRAME
+0x0af, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0be, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x00c, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x061, // 0x02a = 42 -
+0x000, // 0x02b = 43 - NO_OP
+0x0c9, // 0x02c = 44 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x05e, // 0x02d = 45 -
+0x0a5, // 0x02e = 46 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x041, // 0x02f = 47 -
+0x0a6, // 0x030 = 48 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x052, // 0x031 = 49 -
+0x0a7, // 0x032 = 50 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x055, // 0x033 = 51 -
+0x0a8, // 0x034 = 52 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x052, // 0x035 = 53 -
+0x0aa, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x058, // 0x037 = 55 -
+0x0c5, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x05b, // 0x039 = 57 -
+0x0ca, // 0x03a = 58 - JUMP_IF_DOC_CLOSE_REQ
+0x0a5, // 0x03b = 59 -
+0x0be, // 0x03c = 60 - JUMP_IF_PHY_READY
+0x04a, // 0x03d = 61 -
+0x01c, // 0x03e = 62 - SOFT_RESET
+0x0ff, // 0x03f = 63 - JUMP
+0x001, // 0x040 = 64 -
+0x01d, // 0x041 = 65 - ADVANCE
+0x0c3, // 0x042 = 66 - JUMP_IF_SMP_PROTOCOL
+0x046, // 0x043 = 67 -
+0x0ff, // 0x044 = 68 - JUMP
+0x061, // 0x045 = 69 -
+0x0a2, // 0x046 = 70 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0a5, // 0x047 = 71 -
+0x0ff, // 0x048 = 72 - JUMP
+0x061, // 0x049 = 73 -
+0x0ab, // 0x04a = 74 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_BLOCKED
+0x052, // 0x04b = 75 -
+0x0ac, // 0x04c = 76 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x052, // 0x04d = 77 -
+0x0ad, // 0x04e = 78 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_CONNECTION_TIME
+0x052, // 0x04f = 79 -
+0x0ff, // 0x050 = 80 - JUMP
+0x02c, // 0x051 = 81 -
+0x01d, // 0x052 = 82 - ADVANCE
+0x0ff, // 0x053 = 83 - JUMP
+0x061, // 0x054 = 84 -
+0x01d, // 0x055 = 85 - ADVANCE
+0x0ff, // 0x056 = 86 - JUMP
+0x0c2, // 0x057 = 87 -
+0x01d, // 0x058 = 88 - ADVANCE
+0x0ff, // 0x059 = 89 - JUMP
+0x0c5, // 0x05a = 90 -
+0x01d, // 0x05b = 91 - ADVANCE
+0x0ff, // 0x05c = 92 - JUMP
+0x0b6, // 0x05d = 93 -
+0x022, // 0x05e = 94 - SEND_CREDIT_BLOCK
+0x0ff, // 0x05f = 95 - JUMP
+0x02e, // 0x060 = 96 -
+0x0c8, // 0x061 = 97 - JUMP_IF_HIP_REQ
+0x06d, // 0x062 = 98 -
+0x0c6, // 0x063 = 99 - JUMP_IF_SFO_REQ
+0x07d, // 0x064 = 100 -
+0x0c7, // 0x065 = 101 - JUMP_IF_DOC_REQ
+0x08d, // 0x066 = 102 -
+0x0a3, // 0x067 = 103 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x09d, // 0x068 = 104 -
+0x0a2, // 0x069 = 105 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0a5, // 0x06a = 106 -
+0x0ff, // 0x06b = 107 - JUMP
+0x061, // 0x06c = 108 -
+0x020, // 0x06d = 109 - SELECT_HIP
+0x000, // 0x06e = 110 - NO_OP
+0x000, // 0x06f = 111 - NO_OP
+0x0a4, // 0x070 = 112 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x074, // 0x071 = 113 -
+0x0ff, // 0x072 = 114 - JUMP
+0x0c8, // 0x073 = 115 -
+0x0a0, // 0x074 = 116 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x07a, // 0x075 = 117 -
+0x0a3, // 0x076 = 118 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x09d, // 0x077 = 119 -
+0x0ff, // 0x078 = 120 - JUMP
+0x0a5, // 0x079 = 121 -
+0x013, // 0x07a = 122 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x07b = 123 - JUMP
+0x02b, // 0x07c = 124 -
+0x01e, // 0x07d = 125 - SELECT_SFO
+0x000, // 0x07e = 126 - NO_OP
+0x000, // 0x07f = 127 - NO_OP
+0x0a4, // 0x080 = 128 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x084, // 0x081 = 129 -
+0x0ff, // 0x082 = 130 - JUMP
+0x0c8, // 0x083 = 131 -
+0x0a0, // 0x084 = 132 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x08a, // 0x085 = 133 -
+0x0a3, // 0x086 = 134 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x09d, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x0a5, // 0x089 = 137 -
+0x013, // 0x08a = 138 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x08b = 139 - JUMP
+0x02b, // 0x08c = 140 -
+0x01f, // 0x08d = 141 - SELECT_DOC
+0x000, // 0x08e = 142 - NO_OP
+0x000, // 0x08f = 143 - NO_OP
+0x0a4, // 0x090 = 144 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x094, // 0x091 = 145 -
+0x0ff, // 0x092 = 146 - JUMP
+0x0c8, // 0x093 = 147 -
+0x0a0, // 0x094 = 148 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x09a, // 0x095 = 149 -
+0x0a3, // 0x096 = 150 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x09d, // 0x097 = 151 -
+0x0ff, // 0x098 = 152 - JUMP
+0x0a5, // 0x099 = 153 -
+0x013, // 0x09a = 154 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x09b = 155 - JUMP
+0x02b, // 0x09c = 156 -
+0x0c3, // 0x09d = 157 - JUMP_IF_SMP_PROTOCOL
+0x0a1, // 0x09e = 158 -
+0x0ff, // 0x09f = 159 - JUMP
+0x0a5, // 0x0a0 = 160 -
+0x0c4, // 0x0a1 = 161 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x0b6, // 0x0a2 = 162 -
+0x0ff, // 0x0a3 = 163 - JUMP
+0x061, // 0x0a4 = 164 -
+0x004, // 0x0a5 = 165 - CLOSE_NORMAL
+0x000, // 0x0a6 = 166 - NO_OP
+0x000, // 0x0a7 = 167 - NO_OP
+0x000, // 0x0a8 = 168 - NO_OP
+0x000, // 0x0a9 = 169 - NO_OP
+0x0c9, // 0x0aa = 170 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x0b3, // 0x0ab = 171 -
+0x0c0, // 0x0ac = 172 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x061, // 0x0ad = 173 -
+0x0be, // 0x0ae = 174 - JUMP_IF_PHY_READY
+0x0a6, // 0x0af = 175 -
+0x01c, // 0x0b0 = 176 - SOFT_RESET
+0x0ff, // 0x0b1 = 177 - JUMP
+0x001, // 0x0b2 = 178 -
+0x022, // 0x0b3 = 179 - SEND_CREDIT_BLOCK
+0x0ff, // 0x0b4 = 180 - JUMP
+0x0a6, // 0x0b5 = 181 -
+0x007, // 0x0b6 = 182 - CLOSE_BREAK
+0x000, // 0x0b7 = 183 - NO_OP
+0x000, // 0x0b8 = 184 - NO_OP
+0x000, // 0x0b9 = 185 - NO_OP
+0x000, // 0x0ba = 186 - NO_OP
+0x0c0, // 0x0bb = 187 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x061, // 0x0bc = 188 -
+0x0be, // 0x0bd = 189 - JUMP_IF_PHY_READY
+0x0b7, // 0x0be = 190 -
+0x01c, // 0x0bf = 191 - SOFT_RESET
+0x0ff, // 0x0c0 = 192 - JUMP
+0x001, // 0x0c1 = 193 -
+0x005, // 0x0c2 = 194 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x0c3 = 195 - JUMP
+0x0a6, // 0x0c4 = 196 -
+0x006, // 0x0c5 = 197 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x0c6 = 198 - JUMP
+0x0a6, // 0x0c7 = 199 -
+0x0b0, // 0x0c8 = 200 - JUMP_IF_FLAG_0_SET
+0x0cd, // 0x0c9 = 201 -
+0x011, // 0x0ca = 202 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x0cb = 203 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x0cc = 204 - START_ARB_WAIT_TIMER
+0x001, // 0x0cd = 205 - OPEN_REQUEST
+0x000, // 0x0ce = 206 - NO_OP
+0x000, // 0x0cf = 207 - NO_OP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x090, // 0x0d2 = 210 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0f8, // 0x0d3 = 211 -
+0x095, // 0x0d4 = 212 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x0fd, // 0x0d5 = 213 -
+0x099, // 0x0d6 = 214 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x100, // 0x0d7 = 215 -
+0x09b, // 0x0d8 = 216 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x103, // 0x0d9 = 217 -
+0x094, // 0x0da = 218 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0cd, // 0x0db = 219 -
+0x093, // 0x0dc = 220 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x106, // 0x0dd = 221 -
+0x09f, // 0x0de = 222 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x109, // 0x0df = 223 -
+0x09a, // 0x0e0 = 224 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x0cd, // 0x0e1 = 225 -
+0x096, // 0x0e2 = 226 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x106, // 0x0e3 = 227 -
+0x097, // 0x0e4 = 228 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x10c, // 0x0e5 = 229 -
+0x098, // 0x0e6 = 230 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x0cd, // 0x0e7 = 231 -
+0x092, // 0x0e8 = 232 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x0cd, // 0x0e9 = 233 -
+0x0a4, // 0x0ea = 234 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0f2, // 0x0eb = 235 -
+0x0be, // 0x0ec = 236 - JUMP_IF_PHY_READY
+0x0d2, // 0x0ed = 237 -
+0x01b, // 0x0ee = 238 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x0ef = 239 - SOFT_RESET
+0x0ff, // 0x0f0 = 240 - JUMP
+0x001, // 0x0f1 = 241 -
+0x0a0, // 0x0f2 = 242 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0f8, // 0x0f3 = 243 -
+0x000, // 0x0f4 = 244 - NO_OP
+0x000, // 0x0f5 = 245 - NO_OP
+0x0ff, // 0x0f6 = 246 - JUMP
+0x09d, // 0x0f7 = 247 -
+0x013, // 0x0f8 = 248 - SET_OPEN_STATUS_NORMAL
+0x000, // 0x0f9 = 249 - NO_OP
+0x000, // 0x0fa = 250 - NO_OP
+0x0ff, // 0x0fb = 251 - JUMP
+0x02b, // 0x0fc = 252 -
+0x017, // 0x0fd = 253 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x0fe = 254 - JUMP
+0x061, // 0x0ff = 255 -
+0x018, // 0x100 = 256 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x101 = 257 - JUMP
+0x061, // 0x102 = 258 -
+0x01a, // 0x103 = 259 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x104 = 260 - JUMP
+0x061, // 0x105 = 261 -
+0x015, // 0x106 = 262 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x107 = 263 - JUMP
+0x061, // 0x108 = 264 -
+0x014, // 0x109 = 265 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x10a = 266 - JUMP
+0x061, // 0x10b = 267 -
+0x010, // 0x10c = 268 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x10d = 269 - JUMP
+0x0cd, // 0x10e = 270 -
+0x000, // 0x10f = 271 - NO_OP
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x000, // 0x112 = 274 - NO_OP
+0x000, // 0x113 = 275 - NO_OP
+0x000, // 0x114 = 276 - NO_OP
+0x000, // 0x115 = 277 - NO_OP
+0x000, // 0x116 = 278 - NO_OP
+0x000, // 0x117 = 279 - NO_OP
+0x000, // 0x118 = 280 - NO_OP
+0x000, // 0x119 = 281 - NO_OP
+0x000, // 0x11a = 282 - NO_OP
+0x000, // 0x11b = 283 - NO_OP
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x000, // 0x120 = 288 - NO_OP
+0x000, // 0x121 = 289 - NO_OP
+0x000, // 0x122 = 290 - NO_OP
+0x000, // 0x123 = 291 - NO_OP
+0x000, // 0x124 = 292 - NO_OP
+0x000, // 0x125 = 293 - NO_OP
+0x000, // 0x126 = 294 - NO_OP
+0x000, // 0x127 = 295 - NO_OP
+0x000, // 0x128 = 296 - NO_OP
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x000, // 0x12d = 301 - NO_OP
+0x000, // 0x12e = 302 - NO_OP
+0x000, // 0x12f = 303 - NO_OP
+0x000, // 0x130 = 304 - NO_OP
+0x000, // 0x131 = 305 - NO_OP
+0x000, // 0x132 = 306 - NO_OP
+0x000, // 0x133 = 307 - NO_OP
+0x000, // 0x134 = 308 - NO_OP
+0x000, // 0x135 = 309 - NO_OP
+0x000, // 0x136 = 310 - NO_OP
+0x000, // 0x137 = 311 - NO_OP
+0x000, // 0x138 = 312 - NO_OP
+0x000, // 0x139 = 313 - NO_OP
+0x000, // 0x13a = 314 - NO_OP
+0x000, // 0x13b = 315 - NO_OP
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x000, // 0x140 = 320 - NO_OP
+0x000, // 0x141 = 321 - NO_OP
+0x000, // 0x142 = 322 - NO_OP
+0x000, // 0x143 = 323 - NO_OP
+0x000, // 0x144 = 324 - NO_OP
+0x000, // 0x145 = 325 - NO_OP
+0x000, // 0x146 = 326 - NO_OP
+0x000, // 0x147 = 327 - NO_OP
+0x000, // 0x148 = 328 - NO_OP
+0x000, // 0x149 = 329 - NO_OP
+0x000, // 0x14a = 330 - NO_OP
+0x000, // 0x14b = 331 - NO_OP
+0x000, // 0x14c = 332 - NO_OP
+0x000, // 0x14d = 333 - NO_OP
+0x000, // 0x14e = 334 - NO_OP
+0x000, // 0x14f = 335 - NO_OP
+0x000, // 0x150 = 336 - NO_OP
+0x000, // 0x151 = 337 - NO_OP
+0x000, // 0x152 = 338 - NO_OP
+0x000, // 0x153 = 339 - NO_OP
+0x000, // 0x154 = 340 - NO_OP
+0x000, // 0x155 = 341 - NO_OP
+0x000, // 0x156 = 342 - NO_OP
+0x000, // 0x157 = 343 - NO_OP
+0x000, // 0x158 = 344 - NO_OP
+0x000, // 0x159 = 345 - NO_OP
+0x000, // 0x15a = 346 - NO_OP
+0x000, // 0x15b = 347 - NO_OP
+0x000, // 0x15c = 348 - NO_OP
+0x000, // 0x15d = 349 - NO_OP
+0x000, // 0x15e = 350 - NO_OP
+0x000, // 0x15f = 351 - NO_OP
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x000, // 0x162 = 354 - NO_OP
+0x000, // 0x163 = 355 - NO_OP
+0x000, // 0x164 = 356 - NO_OP
+0x000, // 0x165 = 357 - NO_OP
+0x000, // 0x166 = 358 - NO_OP
+0x000, // 0x167 = 359 - NO_OP
+0x000, // 0x168 = 360 - NO_OP
+0x000, // 0x169 = 361 - NO_OP
+0x000, // 0x16a = 362 - NO_OP
+0x000, // 0x16b = 363 - NO_OP
+0x000, // 0x16c = 364 - NO_OP
+0x000, // 0x16d = 365 - NO_OP
+0x000, // 0x16e = 366 - NO_OP
+0x000, // 0x16f = 367 - NO_OP
+0x000, // 0x170 = 368 - NO_OP
+0x000, // 0x171 = 369 - NO_OP
+0x000, // 0x172 = 370 - NO_OP
+0x000, // 0x173 = 371 - NO_OP
+0x000, // 0x174 = 372 - NO_OP
+0x000, // 0x175 = 373 - NO_OP
+0x000, // 0x176 = 374 - NO_OP
+0x000, // 0x177 = 375 - NO_OP
+0x000, // 0x178 = 376 - NO_OP
+0x000, // 0x179 = 377 - NO_OP
+0x000, // 0x17a = 378 - NO_OP
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* for pnr12220.bit */
+bit32 wcsImage12220[] =
+{
+ 0x00d, // 00000 = 0 - PHY_RESET_START
+ 0x0be, // 0x001 = 1 - JUMP_IF_PHY_READY
+ 0x009, // 0x002 = 2 -
+ 0x0ae, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x004 = 4 -
+ 0x0af, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01e, // 0x006 = 6 -
+ 0x0ff, // 0x007 = 7 - JUMP
+ 0x001, // 0x008 = 8 -
+ 0x00c, // 0x009 = 9 - SEND_ID_FRAME
+ 0x0ae, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+ 0x010, // 0x00b = 11 -
+ 0x0af, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x00d = 13 -
+ 0x0ff, // 0x00e = 14 - JUMP
+ 0x00a, // 0x00f = 15 -
+ 0x01c, // 0x010 = 16 - SOFT_RESET
+ 0x00d, // 0x011 = 17 - PHY_RESET_START
+ 0x0be, // 0x012 = 18 - JUMP_IF_PHY_READY
+ 0x016, // 0x013 = 19 -
+ 0x0af, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x01b, // 0x015 = 21 -
+ 0x00c, // 0x016 = 22 - SEND_ID_FRAME
+ 0x0af, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+ 0x023, // 0x018 = 24 -
+ 0x0ff, // 0x019 = 25 - JUMP
+ 0x017, // 0x01a = 26 -
+ 0x00c, // 0x01b = 27 - SEND_ID_FRAME
+ 0x0ff, // 0x01c = 28 - JUMP
+ 0x023, // 0x01d = 29 -
+ 0x0be, // 0x01e = 30 - JUMP_IF_PHY_READY
+ 0x022, // 0x01f = 31 -
+ 0x0ff, // 0x020 = 32 - JUMP
+ 0x01e, // 0x021 = 33 -
+ 0x00c, // 0x022 = 34 - SEND_ID_FRAME
+ 0x000, // 0x023 = 35 - NO_OP
+ 0x000, // 0x024 = 36 - NO_OP
+ 0x000, // 0x025 = 37 - NO_OP
+ 0x000, // 0x026 = 38 - NO_OP
+ 0x000, // 0x027 = 39 - NO_OP
+ 0x000, // 0x028 = 40 - NO_OP
+ 0x0ff, // 0x029 = 41 - JUMP
+ 0x059, // 0x02a = 42 -
+ 0x000, // 0x02b = 43 - NO_OP
+ 0x0c9, // 0x02c = 44 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+ 0x056, // 0x02d = 45 -
+ 0x0a5, // 0x02e = 46 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+ 0x041, // 0x02f = 47 -
+ 0x0a6, // 0x030 = 48 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+ 0x04a, // 0x031 = 49 -
+ 0x0a7, // 0x032 = 50 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+ 0x04d, // 0x033 = 51 -
+ 0x0a8, // 0x034 = 52 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+ 0x053, // 0x035 = 53 -
+ 0x0aa, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+ 0x050, // 0x037 = 55 -
+ 0x0c5, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+ 0x053, // 0x039 = 57 -
+ 0x0ca, // 0x03a = 58 - JUMP_IF_CLOSE_REQ
+ 0x08e, // 0x03b = 59 -
+ 0x0be, // 0x03c = 60 - JUMP_IF_PHY_READY
+ 0x02c, // 0x03d = 61 -
+ 0x01c, // 0x03e = 62 - SOFT_RESET
+ 0x0ff, // 0x03f = 63 - JUMP
+ 0x001, // 0x040 = 64 -
+ 0x01d, // 0x041 = 65 - ADVANCE
+ 0x0c3, // 0x042 = 66 - JUMP_IF_SMP_PROTOCOL
+ 0x046, // 0x043 = 67 -
+ 0x0ff, // 0x044 = 68 - JUMP
+ 0x059, // 0x045 = 69 -
+ 0x0a2, // 0x046 = 70 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+ 0x08e, // 0x047 = 71 -
+ 0x0ff, // 0x048 = 72 - JUMP
+ 0x059, // 0x049 = 73 -
+ 0x01d, // 0x04a = 74 - ADVANCE
+ 0x0ff, // 0x04b = 75 - JUMP
+ 0x059, // 0x04c = 76 -
+ 0x01d, // 0x04d = 77 - ADVANCE
+ 0x0ff, // 0x04e = 78 - JUMP
+ 0x0ad, // 0x04f = 79 -
+ 0x01d, // 0x050 = 80 - ADVANCE
+ 0x0ff, // 0x051 = 81 - JUMP
+ 0x0b0, // 0x052 = 82 -
+ 0x01d, // 0x053 = 83 - ADVANCE
+ 0x0ff, // 0x054 = 84 - JUMP
+ 0x0a1, // 0x055 = 85 -
+ 0x022, // 0x056 = 86 - SEND_CREDIT_BLOCK
+ 0x0ff, // 0x057 = 87 - JUMP
+ 0x02e, // 0x058 = 88 -
+ 0x0c8, // 0x059 = 89 - JUMP_IF_HIP_REQ
+ 0x065, // 0x05a = 90 -
+ 0x0c6, // 0x05b = 91 - JUMP_IF_SFO_REQ
+ 0x06a, // 0x05c = 92 -
+ 0x0c7, // 0x05d = 93 - JUMP_IF_DOC_REQ
+ 0x06f, // 0x05e = 94 -
+ 0x0a3, // 0x05f = 95 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x086, // 0x060 = 96 -
+ 0x0a2, // 0x061 = 97 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+ 0x08e, // 0x062 = 98 -
+ 0x0ff, // 0x063 = 99 - JUMP
+ 0x059, // 0x064 = 100 -
+ 0x020, // 0x065 = 101 - SELECT_HIP
+ 0x000, // 0x066 = 102 - NO_OP
+ 0x000, // 0x067 = 103 - NO_OP
+ 0x0ff, // 0x068 = 104 - JUMP
+ 0x072, // 0x069 = 105 -
+ 0x01e, // 0x06a = 106 - SELECT_SFO
+ 0x000, // 0x06b = 107 - NO_OP
+ 0x000, // 0x06c = 108 - NO_OP
+ 0x0ff, // 0x06d = 109 - JUMP
+ 0x072, // 0x06e = 110 -
+ 0x01f, // 0x06f = 111 - SELECT_DOC
+ 0x000, // 0x070 = 112 - NO_OP
+ 0x000, // 0x071 = 113 - NO_OP
+ 0x0a4, // 0x072 = 114 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x076, // 0x073 = 115 -
+ 0x0ff, // 0x074 = 116 - JUMP
+ 0x0b3, // 0x075 = 117 -
+ 0x0a0, // 0x076 = 118 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+ 0x07c, // 0x077 = 119 -
+ 0x0a3, // 0x078 = 120 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+ 0x086, // 0x079 = 121 -
+ 0x0ff, // 0x07a = 122 - JUMP
+ 0x08e, // 0x07b = 123 -
+ 0x0cb, // 0x07c = 124 - JUMP_IF_FREEZE_ACTIVE
+ 0x081, // 0x07d = 125 -
+ 0x013, // 0x07e = 126 - SET_OPEN_STATUS_NORMAL
+ 0x0ff, // 0x07f = 127 - JUMP
+ 0x02b, // 0x080 = 128 -
+ 0x024, // 0x081 = 129 - SET_OPEN_STATUS_FREEZE
+ 0x000, // 0x082 = 130 - NO_OP
+ 0x000, // 0x083 = 131 - NO_OP
+ 0x0ff, // 0x084 = 132 - JUMP
+ 0x059, // 0x085 = 133 -
+ 0x0c3, // 0x086 = 134 - JUMP_IF_SMP_PROTOCOL
+ 0x08a, // 0x087 = 135 -
+ 0x0ff, // 0x088 = 136 - JUMP
+ 0x08e, // 0x089 = 137 -
+ 0x0c4, // 0x08a = 138 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+ 0x0a1, // 0x08b = 139 -
+ 0x0ff, // 0x08c = 140 - JUMP
+ 0x059, // 0x08d = 141 -
+ 0x004, // 0x08e = 142 - CLOSE_NORMAL
+ 0x000, // 0x08f = 143 - NO_OP
+ 0x000, // 0x090 = 144 - NO_OP
+ 0x000, // 0x091 = 145 - NO_OP
+ 0x000, // 0x092 = 146 - NO_OP
+ 0x0c9, // 0x093 = 147 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+ 0x09e, // 0x094 = 148 -
+ 0x0c0, // 0x095 = 149 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+ 0x059, // 0x096 = 150 -
+ 0x0bc, // 0x097 = 151 - JUMP_IF_BREAK_RECEIVED
+ 0x0a1, // 0x098 = 152 -
+ 0x0be, // 0x099 = 153 - JUMP_IF_PHY_READY
+ 0x08f, // 0x09a = 154 -
+ 0x01c, // 0x09b = 155 - SOFT_RESET
+ 0x0ff, // 0x09c = 156 - JUMP
+ 0x001, // 0x09d = 157 -
+ 0x022, // 0x09e = 158 - SEND_CREDIT_BLOCK
+ 0x0ff, // 0x09f = 159 - JUMP
+ 0x08f, // 0x0a0 = 160 -
+ 0x007, // 0x0a1 = 161 - CLOSE_BREAK
+ 0x000, // 0x0a2 = 162 - NO_OP
+ 0x000, // 0x0a3 = 163 - NO_OP
+ 0x000, // 0x0a4 = 164 - NO_OP
+ 0x000, // 0x0a5 = 165 - NO_OP
+ 0x0c0, // 0x0a6 = 166 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+ 0x059, // 0x0a7 = 167 -
+ 0x0be, // 0x0a8 = 168 - JUMP_IF_PHY_READY
+ 0x0a2, // 0x0a9 = 169 -
+ 0x01c, // 0x0aa = 170 - SOFT_RESET
+ 0x0ff, // 0x0ab = 171 - JUMP
+ 0x001, // 0x0ac = 172 -
+ 0x005, // 0x0ad = 173 - CLOSE_ACK_NAK_TIMEOUT
+ 0x0ff, // 0x0ae = 174 - JUMP
+ 0x08f, // 0x0af = 175 -
+ 0x006, // 0x0b0 = 176 - CLOSE_CREDIT_TIMEOUT
+ 0x0ff, // 0x0b1 = 177 - JUMP
+ 0x08f, // 0x0b2 = 178 -
+ 0x0cc, // 0x0b3 = 179 - JUMP_IF_RX_BUFFER_FULL
+ 0x059, // 0x0b4 = 180 -
+ 0x0b0, // 0x0b5 = 181 - JUMP_IF_FLAG_0_SET
+ 0x0ba, // 0x0b6 = 182 -
+ 0x011, // 0x0b7 = 183 - START_IT_NEXUS_LOSS_TIMER
+ 0x00f, // 0x0b8 = 184 - PATHWAY_BLOCKED_CNT_RESET
+ 0x00e, // 0x0b9 = 185 - START_ARB_WAIT_TIMER
+ 0x0cb, // 0x0ba = 186 - JUMP_IF_FREEZE_ACTIVE
+ 0x0fb, // 0x0bb = 187 -
+ 0x001, // 0x0bc = 188 - OPEN_REQUEST
+ 0x000, // 0x0bd = 189 - NO_OP
+ 0x000, // 0x0be = 190 - NO_OP
+ 0x000, // 0x0bf = 191 - NO_OP
+ 0x000, // 0x0c0 = 192 - NO_OP
+ 0x090, // 0x0c1 = 193 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+ 0x0e7, // 0x0c2 = 194 -
+ 0x095, // 0x0c3 = 195 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+ 0x0ec, // 0x0c4 = 196 -
+ 0x099, // 0x0c5 = 197 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+ 0x0ef, // 0x0c6 = 198 -
+ 0x09b, // 0x0c7 = 199 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+ 0x0f2, // 0x0c8 = 200 -
+ 0x094, // 0x0c9 = 201 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+ 0x0ba, // 0x0ca = 202 -
+ 0x093, // 0x0cb = 203 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+ 0x0f5, // 0x0cc = 204 -
+ 0x09f, // 0x0cd = 205 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+ 0x0f8, // 0x0ce = 206 -
+ 0x09a, // 0x0cf = 207 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+ 0x0ba, // 0x0d0 = 208 -
+ 0x096, // 0x0d1 = 209 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+ 0x0f5, // 0x0d2 = 210 -
+ 0x097, // 0x0d3 = 211 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+ 0x100, // 0x0d4 = 212 -
+ 0x098, // 0x0d5 = 213 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+ 0x0ba, // 0x0d6 = 214 -
+ 0x092, // 0x0d7 = 215 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+ 0x0ba, // 0x0d8 = 216 -
+ 0x0a4, // 0x0d9 = 217 - JUMP_IF_CONNECTION_ACTIVE_SET
+ 0x0e1, // 0x0da = 218 -
+ 0x0be, // 0x0db = 219 - JUMP_IF_PHY_READY
+ 0x0c1, // 0x0dc = 220 -
+ 0x01b, // 0x0dd = 221 - SET_OPEN_STATUS_PHY_NOT_RDY
+ 0x01c, // 0x0de = 222 - SOFT_RESET
+ 0x0ff, // 0x0df = 223 - JUMP
+ 0x001, // 0x0e0 = 224 -
+ 0x0a0, // 0x0e1 = 225 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+ 0x0e7, // 0x0e2 = 226 -
+ 0x000, // 0x0e3 = 227 - NO_OP
+ 0x000, // 0x0e4 = 228 - NO_OP
+ 0x0ff, // 0x0e5 = 229 - JUMP
+ 0x086, // 0x0e6 = 230 -
+ 0x013, // 0x0e7 = 231 - SET_OPEN_STATUS_NORMAL
+ 0x000, // 0x0e8 = 232 - NO_OP
+ 0x000, // 0x0e9 = 233 - NO_OP
+ 0x0ff, // 0x0ea = 234 - JUMP
+ 0x02b, // 0x0eb = 235 -
+ 0x017, // 0x0ec = 236 - SET_OPEN_STATUS_BAD_RATE
+ 0x0ff, // 0x0ed = 237 - JUMP
+ 0x0fc, // 0x0ee = 238 -
+ 0x018, // 0x0ef = 239 - SET_OPEN_STATUS_BAD_PROTOCOL
+ 0x0ff, // 0x0f0 = 240 - JUMP
+ 0x0fc, // 0x0f1 = 241 -
+ 0x01a, // 0x0f2 = 242 - SET_OPEN_STATUS_WRONG_DEST
+ 0x0ff, // 0x0f3 = 243 - JUMP
+ 0x0fc, // 0x0f4 = 244 -
+ 0x015, // 0x0f5 = 245 - SET_OPEN_STATUS_BAD_DEST
+ 0x0ff, // 0x0f6 = 246 - JUMP
+ 0x0fc, // 0x0f7 = 247 -
+ 0x014, // 0x0f8 = 248 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+ 0x0ff, // 0x0f9 = 249 - JUMP
+ 0x0fc, // 0x0fa = 250 -
+ 0x024, // 0x0fb = 251 - SET_OPEN_STATUS_FREEZE
+ 0x000, // 0x0fc = 252 - NO_OP
+ 0x000, // 0x0fd = 253 - NO_OP
+ 0x0ff, // 0x0fe = 254 - JUMP
+ 0x059, // 0x0ff = 255 -
+ 0x010, // 0x100 = 256 - PATHWAY_BLOCKED_CNT_INC
+ 0x0ff, // 0x101 = 257 - JUMP
+ 0x0ba, // 0x102 = 258 -
+ 0x000, // 0x103 = 259 - NO_OP
+ 0x000, // 0x104 = 260 - NO_OP
+ 0x000, // 0x105 = 261 - NO_OP
+ 0x000, // 0x106 = 262 - NO_OP
+ 0x000, // 0x107 = 263 - NO_OP
+ 0x000, // 0x108 = 264 - NO_OP
+ 0x000, // 0x109 = 265 - NO_OP
+ 0x000, // 0x10a = 266 - NO_OP
+ 0x000, // 0x10b = 267 - NO_OP
+ 0x000, // 0x10c = 268 - NO_OP
+ 0x000, // 0x10d = 269 - NO_OP
+ 0x000, // 0x10e = 270 - NO_OP
+ 0x000, // 0x10f = 271 - NO_OP
+ 0x000, // 0x110 = 272 - NO_OP
+ 0x000, // 0x111 = 273 - NO_OP
+ 0x000, // 0x112 = 274 - NO_OP
+ 0x000, // 0x113 = 275 - NO_OP
+ 0x000, // 0x114 = 276 - NO_OP
+ 0x000, // 0x115 = 277 - NO_OP
+ 0x000, // 0x116 = 278 - NO_OP
+ 0x000, // 0x117 = 279 - NO_OP
+ 0x000, // 0x118 = 280 - NO_OP
+ 0x000, // 0x119 = 281 - NO_OP
+ 0x000, // 0x11a = 282 - NO_OP
+ 0x000, // 0x11b = 283 - NO_OP
+ 0x000, // 0x11c = 284 - NO_OP
+ 0x000, // 0x11d = 285 - NO_OP
+ 0x000, // 0x11e = 286 - NO_OP
+ 0x000, // 0x11f = 287 - NO_OP
+ 0x000, // 0x120 = 288 - NO_OP
+ 0x000, // 0x121 = 289 - NO_OP
+ 0x000, // 0x122 = 290 - NO_OP
+ 0x000, // 0x123 = 291 - NO_OP
+ 0x000, // 0x124 = 292 - NO_OP
+ 0x000, // 0x125 = 293 - NO_OP
+ 0x000, // 0x126 = 294 - NO_OP
+ 0x000, // 0x127 = 295 - NO_OP
+ 0x000, // 0x128 = 296 - NO_OP
+ 0x000, // 0x129 = 297 - NO_OP
+ 0x000, // 0x12a = 298 - NO_OP
+ 0x000, // 0x12b = 299 - NO_OP
+ 0x000, // 0x12c = 300 - NO_OP
+ 0x000, // 0x12d = 301 - NO_OP
+ 0x000, // 0x12e = 302 - NO_OP
+ 0x000, // 0x12f = 303 - NO_OP
+ 0x000, // 0x130 = 304 - NO_OP
+ 0x000, // 0x131 = 305 - NO_OP
+ 0x000, // 0x132 = 306 - NO_OP
+ 0x000, // 0x133 = 307 - NO_OP
+ 0x000, // 0x134 = 308 - NO_OP
+ 0x000, // 0x135 = 309 - NO_OP
+ 0x000, // 0x136 = 310 - NO_OP
+ 0x000, // 0x137 = 311 - NO_OP
+ 0x000, // 0x138 = 312 - NO_OP
+ 0x000, // 0x139 = 313 - NO_OP
+ 0x000, // 0x13a = 314 - NO_OP
+ 0x000, // 0x13b = 315 - NO_OP
+ 0x000, // 0x13c = 316 - NO_OP
+ 0x000, // 0x13d = 317 - NO_OP
+ 0x000, // 0x13e = 318 - NO_OP
+ 0x000, // 0x13f = 319 - NO_OP
+ 0x000, // 0x140 = 320 - NO_OP
+ 0x000, // 0x141 = 321 - NO_OP
+ 0x000, // 0x142 = 322 - NO_OP
+ 0x000, // 0x143 = 323 - NO_OP
+ 0x000, // 0x144 = 324 - NO_OP
+ 0x000, // 0x145 = 325 - NO_OP
+ 0x000, // 0x146 = 326 - NO_OP
+ 0x000, // 0x147 = 327 - NO_OP
+ 0x000, // 0x148 = 328 - NO_OP
+ 0x000, // 0x149 = 329 - NO_OP
+ 0x000, // 0x14a = 330 - NO_OP
+ 0x000, // 0x14b = 331 - NO_OP
+ 0x000, // 0x14c = 332 - NO_OP
+ 0x000, // 0x14d = 333 - NO_OP
+ 0x000, // 0x14e = 334 - NO_OP
+ 0x000, // 0x14f = 335 - NO_OP
+ 0x000, // 0x150 = 336 - NO_OP
+ 0x000, // 0x151 = 337 - NO_OP
+ 0x000, // 0x152 = 338 - NO_OP
+ 0x000, // 0x153 = 339 - NO_OP
+ 0x000, // 0x154 = 340 - NO_OP
+ 0x000, // 0x155 = 341 - NO_OP
+ 0x000, // 0x156 = 342 - NO_OP
+ 0x000, // 0x157 = 343 - NO_OP
+ 0x000, // 0x158 = 344 - NO_OP
+ 0x000, // 0x159 = 345 - NO_OP
+ 0x000, // 0x15a = 346 - NO_OP
+ 0x000, // 0x15b = 347 - NO_OP
+ 0x000, // 0x15c = 348 - NO_OP
+ 0x000, // 0x15d = 349 - NO_OP
+ 0x000, // 0x15e = 350 - NO_OP
+ 0x000, // 0x15f = 351 - NO_OP
+ 0x000, // 0x160 = 352 - NO_OP
+ 0x000, // 0x161 = 353 - NO_OP
+ 0x000, // 0x162 = 354 - NO_OP
+ 0x000, // 0x163 = 355 - NO_OP
+ 0x000, // 0x164 = 356 - NO_OP
+ 0x000, // 0x165 = 357 - NO_OP
+ 0x000, // 0x166 = 358 - NO_OP
+ 0x000, // 0x167 = 359 - NO_OP
+ 0x000, // 0x168 = 360 - NO_OP
+ 0x000, // 0x169 = 361 - NO_OP
+ 0x000, // 0x16a = 362 - NO_OP
+ 0x000, // 0x16b = 363 - NO_OP
+ 0x000, // 0x16c = 364 - NO_OP
+ 0x000, // 0x16d = 365 - NO_OP
+ 0x000, // 0x16e = 366 - NO_OP
+ 0x000, // 0x16f = 367 - NO_OP
+ 0x000, // 0x170 = 368 - NO_OP
+ 0x000, // 0x171 = 369 - NO_OP
+ 0x000, // 0x172 = 370 - NO_OP
+ 0x000, // 0x173 = 371 - NO_OP
+ 0x000, // 0x174 = 372 - NO_OP
+ 0x000, // 0x175 = 373 - NO_OP
+ 0x000, // 0x176 = 374 - NO_OP
+ 0x000, // 0x177 = 375 - NO_OP
+ 0x000, // 0x178 = 376 - NO_OP
+ 0x000, // 0x179 = 377 - NO_OP
+ 0x000, // 0x17a = 378 - NO_OP
+ 0x000, // 0x17b = 379 - NO_OP
+ 0x000, // 0x17c = 380 - NO_OP
+ 0x000, // 0x17d = 381 - NO_OP
+ 0x000, // 0x17e = 382 - NO_OP
+ 0x000, // 0x17f = 383 - NO_OP
+ 0x000, // 0x180 = 384 - NO_OP
+ 0x000, // 0x181 = 385 - NO_OP
+ 0x000, // 0x182 = 386 - NO_OP
+ 0x000, // 0x183 = 387 - NO_OP
+ 0x000, // 0x184 = 388 - NO_OP
+ 0x000, // 0x185 = 389 - NO_OP
+ 0x000, // 0x186 = 390 - NO_OP
+ 0x000, // 0x187 = 391 - NO_OP
+ 0x000, // 0x188 = 392 - NO_OP
+ 0x000, // 0x189 = 393 - NO_OP
+ 0x000, // 0x18a = 394 - NO_OP
+ 0x000, // 0x18b = 395 - NO_OP
+ 0x000, // 0x18c = 396 - NO_OP
+ 0x000, // 0x18d = 397 - NO_OP
+ 0x000, // 0x18e = 398 - NO_OP
+ 0x000, // 0x18f = 399 - NO_OP
+ 0x000, // 0x190 = 400 - NO_OP
+ 0x000, // 0x191 = 401 - NO_OP
+ 0x000, // 0x192 = 402 - NO_OP
+ 0x000, // 0x193 = 403 - NO_OP
+ 0x000, // 0x194 = 404 - NO_OP
+ 0x000, // 0x195 = 405 - NO_OP
+ 0x000, // 0x196 = 406 - NO_OP
+ 0x000, // 0x197 = 407 - NO_OP
+ 0x000, // 0x198 = 408 - NO_OP
+ 0x000, // 0x199 = 409 - NO_OP
+ 0x000, // 0x19a = 410 - NO_OP
+ 0x000, // 0x19b = 411 - NO_OP
+ 0x000, // 0x19c = 412 - NO_OP
+ 0x000, // 0x19d = 413 - NO_OP
+ 0x000, // 0x19e = 414 - NO_OP
+ 0x000, // 0x19f = 415 - NO_OP
+ 0x000, // 0x1a0 = 416 - NO_OP
+ 0x000, // 0x1a1 = 417 - NO_OP
+ 0x000, // 0x1a2 = 418 - NO_OP
+ 0x000, // 0x1a3 = 419 - NO_OP
+ 0x000, // 0x1a4 = 420 - NO_OP
+ 0x000, // 0x1a5 = 421 - NO_OP
+ 0x000, // 0x1a6 = 422 - NO_OP
+ 0x000, // 0x1a7 = 423 - NO_OP
+ 0x000, // 0x1a8 = 424 - NO_OP
+ 0x000, // 0x1a9 = 425 - NO_OP
+ 0x000, // 0x1aa = 426 - NO_OP
+ 0x000, // 0x1ab = 427 - NO_OP
+ 0x000, // 0x1ac = 428 - NO_OP
+ 0x000, // 0x1ad = 429 - NO_OP
+ 0x000, // 0x1ae = 430 - NO_OP
+ 0x000, // 0x1af = 431 - NO_OP
+ 0x000, // 0x1b0 = 432 - NO_OP
+ 0x000, // 0x1b1 = 433 - NO_OP
+ 0x000, // 0x1b2 = 434 - NO_OP
+ 0x000, // 0x1b3 = 435 - NO_OP
+ 0x000, // 0x1b4 = 436 - NO_OP
+ 0x000, // 0x1b5 = 437 - NO_OP
+ 0x000, // 0x1b6 = 438 - NO_OP
+ 0x000, // 0x1b7 = 439 - NO_OP
+ 0x000, // 0x1b8 = 440 - NO_OP
+ 0x000, // 0x1b9 = 441 - NO_OP
+ 0x000, // 0x1ba = 442 - NO_OP
+ 0x000, // 0x1bb = 443 - NO_OP
+ 0x000, // 0x1bc = 444 - NO_OP
+ 0x000, // 0x1bd = 445 - NO_OP
+ 0x000, // 0x1be = 446 - NO_OP
+ 0x000, // 0x1bf = 447 - NO_OP
+ 0x000, // 0x1c0 = 448 - NO_OP
+ 0x000, // 0x1c1 = 449 - NO_OP
+ 0x000, // 0x1c2 = 450 - NO_OP
+ 0x000, // 0x1c3 = 451 - NO_OP
+ 0x000, // 0x1c4 = 452 - NO_OP
+ 0x000, // 0x1c5 = 453 - NO_OP
+ 0x000, // 0x1c6 = 454 - NO_OP
+ 0x000, // 0x1c7 = 455 - NO_OP
+ 0x000, // 0x1c8 = 456 - NO_OP
+ 0x000, // 0x1c9 = 457 - NO_OP
+ 0x000, // 0x1ca = 458 - NO_OP
+ 0x000, // 0x1cb = 459 - NO_OP
+ 0x000, // 0x1cc = 460 - NO_OP
+ 0x000, // 0x1cd = 461 - NO_OP
+ 0x000, // 0x1ce = 462 - NO_OP
+ 0x000, // 0x1cf = 463 - NO_OP
+ 0x000, // 0x1d0 = 464 - NO_OP
+ 0x000, // 0x1d1 = 465 - NO_OP
+ 0x000, // 0x1d2 = 466 - NO_OP
+ 0x000, // 0x1d3 = 467 - NO_OP
+ 0x000, // 0x1d4 = 468 - NO_OP
+ 0x000, // 0x1d5 = 469 - NO_OP
+ 0x000, // 0x1d6 = 470 - NO_OP
+ 0x000, // 0x1d7 = 471 - NO_OP
+ 0x000, // 0x1d8 = 472 - NO_OP
+ 0x000, // 0x1d9 = 473 - NO_OP
+ 0x000, // 0x1da = 474 - NO_OP
+ 0x000, // 0x1db = 475 - NO_OP
+ 0x000, // 0x1dc = 476 - NO_OP
+ 0x000, // 0x1dd = 477 - NO_OP
+ 0x000, // 0x1de = 478 - NO_OP
+ 0x000, // 0x1df = 479 - NO_OP
+ 0x000, // 0x1e0 = 480 - NO_OP
+ 0x000, // 0x1e1 = 481 - NO_OP
+ 0x000, // 0x1e2 = 482 - NO_OP
+ 0x000, // 0x1e3 = 483 - NO_OP
+ 0x000, // 0x1e4 = 484 - NO_OP
+ 0x000, // 0x1e5 = 485 - NO_OP
+ 0x000, // 0x1e6 = 486 - NO_OP
+ 0x000, // 0x1e7 = 487 - NO_OP
+ 0x000, // 0x1e8 = 488 - NO_OP
+ 0x000, // 0x1e9 = 489 - NO_OP
+ 0x000, // 0x1ea = 490 - NO_OP
+ 0x000, // 0x1eb = 491 - NO_OP
+ 0x000, // 0x1ec = 492 - NO_OP
+ 0x000, // 0x1ed = 493 - NO_OP
+ 0x000, // 0x1ee = 494 - NO_OP
+ 0x000, // 0x1ef = 495 - NO_OP
+ 0x000, // 0x1f0 = 496 - NO_OP
+ 0x000, // 0x1f1 = 497 - NO_OP
+ 0x000, // 0x1f2 = 498 - NO_OP
+ 0x000, // 0x1f3 = 499 - NO_OP
+ 0x000, // 0x1f4 = 500 - NO_OP
+ 0x000, // 0x1f5 = 501 - NO_OP
+ 0x000, // 0x1f6 = 502 - NO_OP
+ 0x000, // 0x1f7 = 503 - NO_OP
+ 0x000, // 0x1f8 = 504 - NO_OP
+ 0x000, // 0x1f9 = 505 - NO_OP
+ 0x000, // 0x1fa = 506 - NO_OP
+ 0x000, // 0x1fb = 507 - NO_OP
+ 0x000, // 0x1fc = 508 - NO_OP
+ 0x000, // 0x1fd = 509 - NO_OP
+ 0x000, // 0x1fe = 510 - NO_OP
+ 0x000 // 0x1ff = 511 - NO_OP
+};
+
+/* WCS 022406 */
+bit32 wcsImage022406[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x0be, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ae, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0af, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x00c, // 0x009 = 9 - SEND_ID_FRAME
+0x0ae, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0af, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x01c, // 0x010 = 16 - SOFT_RESET
+0x00d, // 0x011 = 17 - PHY_RESET_START
+0x0be, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0af, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x00c, // 0x016 = 22 - SEND_ID_FRAME
+0x0af, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0be, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x00c, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x055, // 0x02a = 42 -
+0x000, // 0x02b = 43 - NO_OP
+0x0c9, // 0x02c = 44 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x052, // 0x02d = 45 -
+0x0a5, // 0x02e = 46 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x041, // 0x02f = 47 -
+0x0a6, // 0x030 = 48 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x046, // 0x031 = 49 -
+0x0a7, // 0x032 = 50 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x049, // 0x033 = 51 -
+0x0a8, // 0x034 = 52 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x04f, // 0x035 = 53 -
+0x0aa, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x04c, // 0x037 = 55 -
+0x0c5, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x04f, // 0x039 = 57 -
+0x0ca, // 0x03a = 58 - JUMP_IF_CLOSE_REQ
+0x08a, // 0x03b = 59 -
+0x0be, // 0x03c = 60 - JUMP_IF_PHY_READY
+0x02c, // 0x03d = 61 -
+0x01c, // 0x03e = 62 - SOFT_RESET
+0x0ff, // 0x03f = 63 - JUMP
+0x001, // 0x040 = 64 -
+0x01d, // 0x041 = 65 - ADVANCE
+0x0c3, // 0x042 = 66 - JUMP_IF_SMP_PROTOCOL
+0x08a, // 0x043 = 67 -
+0x0ff, // 0x044 = 68 - JUMP
+0x055, // 0x045 = 69 -
+0x01d, // 0x046 = 70 - ADVANCE
+0x0ff, // 0x047 = 71 - JUMP
+0x055, // 0x048 = 72 -
+0x01d, // 0x049 = 73 - ADVANCE
+0x0ff, // 0x04a = 74 - JUMP
+0x0a9, // 0x04b = 75 -
+0x01d, // 0x04c = 76 - ADVANCE
+0x0ff, // 0x04d = 77 - JUMP
+0x0ac, // 0x04e = 78 -
+0x01d, // 0x04f = 79 - ADVANCE
+0x0ff, // 0x050 = 80 - JUMP
+0x09d, // 0x051 = 81 -
+0x022, // 0x052 = 82 - SEND_CREDIT_BLOCK
+0x0ff, // 0x053 = 83 - JUMP
+0x02e, // 0x054 = 84 -
+0x0c8, // 0x055 = 85 - JUMP_IF_HIP_REQ
+0x061, // 0x056 = 86 -
+0x0c6, // 0x057 = 87 - JUMP_IF_SFO_REQ
+0x066, // 0x058 = 88 -
+0x0c7, // 0x059 = 89 - JUMP_IF_DOC_REQ
+0x06b, // 0x05a = 90 -
+0x0a3, // 0x05b = 91 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x082, // 0x05c = 92 -
+0x0a2, // 0x05d = 93 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x08a, // 0x05e = 94 -
+0x0ff, // 0x05f = 95 - JUMP
+0x055, // 0x060 = 96 -
+0x020, // 0x061 = 97 - SELECT_HIP
+0x000, // 0x062 = 98 - NO_OP
+0x000, // 0x063 = 99 - NO_OP
+0x0ff, // 0x064 = 100 - JUMP
+0x06e, // 0x065 = 101 -
+0x01e, // 0x066 = 102 - SELECT_SFO
+0x000, // 0x067 = 103 - NO_OP
+0x000, // 0x068 = 104 - NO_OP
+0x0ff, // 0x069 = 105 - JUMP
+0x06e, // 0x06a = 106 -
+0x01f, // 0x06b = 107 - SELECT_DOC
+0x000, // 0x06c = 108 - NO_OP
+0x000, // 0x06d = 109 - NO_OP
+0x0a4, // 0x06e = 110 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x072, // 0x06f = 111 -
+0x0ff, // 0x070 = 112 - JUMP
+0x0af, // 0x071 = 113 -
+0x0a0, // 0x072 = 114 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x078, // 0x073 = 115 -
+0x0a3, // 0x074 = 116 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x082, // 0x075 = 117 -
+0x0ff, // 0x076 = 118 - JUMP
+0x08a, // 0x077 = 119 -
+0x0cb, // 0x078 = 120 - JUMP_IF_FREEZE_ACTIVE
+0x07d, // 0x079 = 121 -
+0x013, // 0x07a = 122 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x07b = 123 - JUMP
+0x02b, // 0x07c = 124 -
+0x024, // 0x07d = 125 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x07e = 126 - NO_OP
+0x000, // 0x07f = 127 - NO_OP
+0x0ff, // 0x080 = 128 - JUMP
+0x055, // 0x081 = 129 -
+0x0c3, // 0x082 = 130 - JUMP_IF_SMP_PROTOCOL
+0x086, // 0x083 = 131 -
+0x0ff, // 0x084 = 132 - JUMP
+0x08a, // 0x085 = 133 -
+0x0c4, // 0x086 = 134 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x09d, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x055, // 0x089 = 137 -
+0x004, // 0x08a = 138 - CLOSE_NORMAL
+0x000, // 0x08b = 139 - NO_OP
+0x000, // 0x08c = 140 - NO_OP
+0x000, // 0x08d = 141 - NO_OP
+0x000, // 0x08e = 142 - NO_OP
+0x0c9, // 0x08f = 143 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x09a, // 0x090 = 144 -
+0x0c0, // 0x091 = 145 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x055, // 0x092 = 146 -
+0x0bc, // 0x093 = 147 - JUMP_IF_BREAK_RECEIVED
+0x09d, // 0x094 = 148 -
+0x0be, // 0x095 = 149 - JUMP_IF_PHY_READY
+0x08b, // 0x096 = 150 -
+0x01c, // 0x097 = 151 - SOFT_RESET
+0x0ff, // 0x098 = 152 - JUMP
+0x001, // 0x099 = 153 -
+0x022, // 0x09a = 154 - SEND_CREDIT_BLOCK
+0x0ff, // 0x09b = 155 - JUMP
+0x08b, // 0x09c = 156 -
+0x007, // 0x09d = 157 - CLOSE_BREAK
+0x000, // 0x09e = 158 - NO_OP
+0x000, // 0x09f = 159 - NO_OP
+0x000, // 0x0a0 = 160 - NO_OP
+0x000, // 0x0a1 = 161 - NO_OP
+0x0c0, // 0x0a2 = 162 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x055, // 0x0a3 = 163 -
+0x0be, // 0x0a4 = 164 - JUMP_IF_PHY_READY
+0x09e, // 0x0a5 = 165 -
+0x01c, // 0x0a6 = 166 - SOFT_RESET
+0x0ff, // 0x0a7 = 167 - JUMP
+0x001, // 0x0a8 = 168 -
+0x005, // 0x0a9 = 169 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x0aa = 170 - JUMP
+0x08b, // 0x0ab = 171 -
+0x006, // 0x0ac = 172 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x0ad = 173 - JUMP
+0x08b, // 0x0ae = 174 -
+0x0cc, // 0x0af = 175 - JUMP_IF_RX_BUFFER_FULL
+0x055, // 0x0b0 = 176 -
+0x0b7, // 0x0b1 = 177 - JUMP_IF_FLAG_7_SET
+0x0b6, // 0x0b2 = 178 -
+0x011, // 0x0b3 = 179 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x0b4 = 180 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x0b5 = 181 - START_ARB_WAIT_TIMER
+0x0cb, // 0x0b6 = 182 - JUMP_IF_FREEZE_ACTIVE
+0x0f9, // 0x0b7 = 183 -
+0x001, // 0x0b8 = 184 - OPEN_REQUEST
+0x080, // 0x0b9 = 185 - SET_FLAG
+0x080, // 0x0ba = 186 -
+0x000, // 0x0bb = 187 - NO_OP
+0x000, // 0x0bc = 188 - NO_OP
+0x000, // 0x0bd = 189 - NO_OP
+0x090, // 0x0be = 190 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0e4, // 0x0bf = 191 -
+0x095, // 0x0c0 = 192 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x0ea, // 0x0c1 = 193 -
+0x099, // 0x0c2 = 194 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x0ed, // 0x0c3 = 195 -
+0x09b, // 0x0c4 = 196 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x0f0, // 0x0c5 = 197 -
+0x094, // 0x0c6 = 198 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0b6, // 0x0c7 = 199 -
+0x093, // 0x0c8 = 200 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x0f3, // 0x0c9 = 201 -
+0x09f, // 0x0ca = 202 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x0f6, // 0x0cb = 203 -
+0x09a, // 0x0cc = 204 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x0b6, // 0x0cd = 205 -
+0x096, // 0x0ce = 206 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x0f3, // 0x0cf = 207 -
+0x097, // 0x0d0 = 208 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x0fe, // 0x0d1 = 209 -
+0x098, // 0x0d2 = 210 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x0b6, // 0x0d3 = 211 -
+0x092, // 0x0d4 = 212 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x0b6, // 0x0d5 = 213 -
+0x0a4, // 0x0d6 = 214 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0de, // 0x0d7 = 215 -
+0x0be, // 0x0d8 = 216 - JUMP_IF_PHY_READY
+0x0be, // 0x0d9 = 217 -
+0x01b, // 0x0da = 218 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x0db = 219 - SOFT_RESET
+0x0ff, // 0x0dc = 220 - JUMP
+0x001, // 0x0dd = 221 -
+0x0a0, // 0x0de = 222 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0e4, // 0x0df = 223 -
+0x000, // 0x0e0 = 224 - NO_OP
+0x000, // 0x0e1 = 225 - NO_OP
+0x0ff, // 0x0e2 = 226 - JUMP
+0x082, // 0x0e3 = 227 -
+0x013, // 0x0e4 = 228 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x0e5 = 229 - CLEAR_FLAG
+0x080, // 0x0e6 = 230 -
+0x000, // 0x0e7 = 231 - NO_OP
+0x0ff, // 0x0e8 = 232 - JUMP
+0x02b, // 0x0e9 = 233 -
+0x017, // 0x0ea = 234 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x0eb = 235 - JUMP
+0x0fa, // 0x0ec = 236 -
+0x018, // 0x0ed = 237 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x0ee = 238 - JUMP
+0x0fa, // 0x0ef = 239 -
+0x01a, // 0x0f0 = 240 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x0f1 = 241 - JUMP
+0x0fa, // 0x0f2 = 242 -
+0x015, // 0x0f3 = 243 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x0f4 = 244 - JUMP
+0x0fa, // 0x0f5 = 245 -
+0x014, // 0x0f6 = 246 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x0f7 = 247 - JUMP
+0x0fa, // 0x0f8 = 248 -
+0x024, // 0x0f9 = 249 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0fa = 250 - NO_OP
+0x000, // 0x0fb = 251 - NO_OP
+0x0ff, // 0x0fc = 252 - JUMP
+0x055, // 0x0fd = 253 -
+0x010, // 0x0fe = 254 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x0ff = 255 - JUMP
+0x0b6, // 0x100 = 256 -
+0x000, // 0x101 = 257 - NO_OP
+0x000, // 0x102 = 258 - NO_OP
+0x000, // 0x103 = 259 - NO_OP
+0x000, // 0x104 = 260 - NO_OP
+0x000, // 0x105 = 261 - NO_OP
+0x000, // 0x106 = 262 - NO_OP
+0x000, // 0x107 = 263 - NO_OP
+0x000, // 0x108 = 264 - NO_OP
+0x000, // 0x109 = 265 - NO_OP
+0x000, // 0x10a = 266 - NO_OP
+0x000, // 0x10b = 267 - NO_OP
+0x000, // 0x10c = 268 - NO_OP
+0x000, // 0x10d = 269 - NO_OP
+0x000, // 0x10e = 270 - NO_OP
+0x000, // 0x10f = 271 - NO_OP
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x000, // 0x112 = 274 - NO_OP
+0x000, // 0x113 = 275 - NO_OP
+0x000, // 0x114 = 276 - NO_OP
+0x000, // 0x115 = 277 - NO_OP
+0x000, // 0x116 = 278 - NO_OP
+0x000, // 0x117 = 279 - NO_OP
+0x000, // 0x118 = 280 - NO_OP
+0x000, // 0x119 = 281 - NO_OP
+0x000, // 0x11a = 282 - NO_OP
+0x000, // 0x11b = 283 - NO_OP
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x000, // 0x120 = 288 - NO_OP
+0x000, // 0x121 = 289 - NO_OP
+0x000, // 0x122 = 290 - NO_OP
+0x000, // 0x123 = 291 - NO_OP
+0x000, // 0x124 = 292 - NO_OP
+0x000, // 0x125 = 293 - NO_OP
+0x000, // 0x126 = 294 - NO_OP
+0x000, // 0x127 = 295 - NO_OP
+0x000, // 0x128 = 296 - NO_OP
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x000, // 0x12d = 301 - NO_OP
+0x000, // 0x12e = 302 - NO_OP
+0x000, // 0x12f = 303 - NO_OP
+0x000, // 0x130 = 304 - NO_OP
+0x000, // 0x131 = 305 - NO_OP
+0x000, // 0x132 = 306 - NO_OP
+0x000, // 0x133 = 307 - NO_OP
+0x000, // 0x134 = 308 - NO_OP
+0x000, // 0x135 = 309 - NO_OP
+0x000, // 0x136 = 310 - NO_OP
+0x000, // 0x137 = 311 - NO_OP
+0x000, // 0x138 = 312 - NO_OP
+0x000, // 0x139 = 313 - NO_OP
+0x000, // 0x13a = 314 - NO_OP
+0x000, // 0x13b = 315 - NO_OP
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x000, // 0x140 = 320 - NO_OP
+0x000, // 0x141 = 321 - NO_OP
+0x000, // 0x142 = 322 - NO_OP
+0x000, // 0x143 = 323 - NO_OP
+0x000, // 0x144 = 324 - NO_OP
+0x000, // 0x145 = 325 - NO_OP
+0x000, // 0x146 = 326 - NO_OP
+0x000, // 0x147 = 327 - NO_OP
+0x000, // 0x148 = 328 - NO_OP
+0x000, // 0x149 = 329 - NO_OP
+0x000, // 0x14a = 330 - NO_OP
+0x000, // 0x14b = 331 - NO_OP
+0x000, // 0x14c = 332 - NO_OP
+0x000, // 0x14d = 333 - NO_OP
+0x000, // 0x14e = 334 - NO_OP
+0x000, // 0x14f = 335 - NO_OP
+0x000, // 0x150 = 336 - NO_OP
+0x000, // 0x151 = 337 - NO_OP
+0x000, // 0x152 = 338 - NO_OP
+0x000, // 0x153 = 339 - NO_OP
+0x000, // 0x154 = 340 - NO_OP
+0x000, // 0x155 = 341 - NO_OP
+0x000, // 0x156 = 342 - NO_OP
+0x000, // 0x157 = 343 - NO_OP
+0x000, // 0x158 = 344 - NO_OP
+0x000, // 0x159 = 345 - NO_OP
+0x000, // 0x15a = 346 - NO_OP
+0x000, // 0x15b = 347 - NO_OP
+0x000, // 0x15c = 348 - NO_OP
+0x000, // 0x15d = 349 - NO_OP
+0x000, // 0x15e = 350 - NO_OP
+0x000, // 0x15f = 351 - NO_OP
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x000, // 0x162 = 354 - NO_OP
+0x000, // 0x163 = 355 - NO_OP
+0x000, // 0x164 = 356 - NO_OP
+0x000, // 0x165 = 357 - NO_OP
+0x000, // 0x166 = 358 - NO_OP
+0x000, // 0x167 = 359 - NO_OP
+0x000, // 0x168 = 360 - NO_OP
+0x000, // 0x169 = 361 - NO_OP
+0x000, // 0x16a = 362 - NO_OP
+0x000, // 0x16b = 363 - NO_OP
+0x000, // 0x16c = 364 - NO_OP
+0x000, // 0x16d = 365 - NO_OP
+0x000, // 0x16e = 366 - NO_OP
+0x000, // 0x16f = 367 - NO_OP
+0x000, // 0x170 = 368 - NO_OP
+0x000, // 0x171 = 369 - NO_OP
+0x000, // 0x172 = 370 - NO_OP
+0x000, // 0x173 = 371 - NO_OP
+0x000, // 0x174 = 372 - NO_OP
+0x000, // 0x175 = 373 - NO_OP
+0x000, // 0x176 = 374 - NO_OP
+0x000, // 0x177 = 375 - NO_OP
+0x000, // 0x178 = 376 - NO_OP
+0x000, // 0x179 = 377 - NO_OP
+0x000, // 0x17a = 378 - NO_OP
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* WCS 031606 */
+bit32 wcsImage031606[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x0be, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ae, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0af, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x00c, // 0x009 = 9 - SEND_ID_FRAME
+0x0ae, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0af, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x01c, // 0x010 = 16 - SOFT_RESET
+0x00d, // 0x011 = 17 - PHY_RESET_START
+0x0be, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0af, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x00c, // 0x016 = 22 - SEND_ID_FRAME
+0x0af, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0be, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x00c, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x05b, // 0x02a = 42 -
+0x000, // 0x02b = 43 - NO_OP
+0x0c9, // 0x02c = 44 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x058, // 0x02d = 45 -
+0x0a5, // 0x02e = 46 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x041, // 0x02f = 47 -
+0x0a6, // 0x030 = 48 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x048, // 0x031 = 49 -
+0x0a7, // 0x032 = 50 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x04b, // 0x033 = 51 -
+0x0a8, // 0x034 = 52 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x055, // 0x035 = 53 -
+0x0aa, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x050, // 0x037 = 55 -
+0x0c5, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x055, // 0x039 = 57 -
+0x0ca, // 0x03a = 58 - JUMP_IF_CLOSE_REQ
+0x09c, // 0x03b = 59 -
+0x0be, // 0x03c = 60 - JUMP_IF_PHY_READY
+0x02c, // 0x03d = 61 -
+0x01c, // 0x03e = 62 - SOFT_RESET
+0x0ff, // 0x03f = 63 - JUMP
+0x001, // 0x040 = 64 -
+0x01d, // 0x041 = 65 - ADVANCE
+0x0bc, // 0x042 = 66 - JUMP_IF_BREAK_RECEIVED
+0x0af, // 0x043 = 67 -
+0x0c3, // 0x044 = 68 - JUMP_IF_SMP_PROTOCOL
+0x09c, // 0x045 = 69 -
+0x0ff, // 0x046 = 70 - JUMP
+0x05b, // 0x047 = 71 -
+0x01d, // 0x048 = 72 - ADVANCE
+0x0ff, // 0x049 = 73 - JUMP
+0x05b, // 0x04a = 74 -
+0x01d, // 0x04b = 75 - ADVANCE
+0x0bc, // 0x04c = 76 - JUMP_IF_BREAK_RECEIVED
+0x0af, // 0x04d = 77 -
+0x0ff, // 0x04e = 78 - JUMP
+0x0bb, // 0x04f = 79 -
+0x01d, // 0x050 = 80 - ADVANCE
+0x0bc, // 0x051 = 81 - JUMP_IF_BREAK_RECEIVED
+0x0af, // 0x052 = 82 -
+0x0ff, // 0x053 = 83 - JUMP
+0x0be, // 0x054 = 84 -
+0x01d, // 0x055 = 85 - ADVANCE
+0x0ff, // 0x056 = 86 - JUMP
+0x0af, // 0x057 = 87 -
+0x022, // 0x058 = 88 - SEND_CREDIT_BLOCK
+0x0ff, // 0x059 = 89 - JUMP
+0x02e, // 0x05a = 90 -
+0x0bc, // 0x05b = 91 - JUMP_IF_BREAK_RECEIVED
+0x0af, // 0x05c = 92 -
+0x0c8, // 0x05d = 93 - JUMP_IF_HIP_REQ
+0x069, // 0x05e = 94 -
+0x0c6, // 0x05f = 95 - JUMP_IF_SFO_REQ
+0x06e, // 0x060 = 96 -
+0x0c7, // 0x061 = 97 - JUMP_IF_DOC_REQ
+0x073, // 0x062 = 98 -
+0x0a3, // 0x063 = 99 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x08a, // 0x064 = 100 -
+0x0a2, // 0x065 = 101 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x09c, // 0x066 = 102 -
+0x0ff, // 0x067 = 103 - JUMP
+0x05b, // 0x068 = 104 -
+0x020, // 0x069 = 105 - SELECT_HIP
+0x000, // 0x06a = 106 - NO_OP
+0x000, // 0x06b = 107 - NO_OP
+0x0ff, // 0x06c = 108 - JUMP
+0x076, // 0x06d = 109 -
+0x01e, // 0x06e = 110 - SELECT_SFO
+0x000, // 0x06f = 111 - NO_OP
+0x000, // 0x070 = 112 - NO_OP
+0x0ff, // 0x071 = 113 - JUMP
+0x076, // 0x072 = 114 -
+0x01f, // 0x073 = 115 - SELECT_DOC
+0x000, // 0x074 = 116 - NO_OP
+0x000, // 0x075 = 117 - NO_OP
+0x0a4, // 0x076 = 118 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x07a, // 0x077 = 119 -
+0x0ff, // 0x078 = 120 - JUMP
+0x0c1, // 0x079 = 121 -
+0x0a0, // 0x07a = 122 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x080, // 0x07b = 123 -
+0x0a3, // 0x07c = 124 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x08a, // 0x07d = 125 -
+0x0ff, // 0x07e = 126 - JUMP
+0x09c, // 0x07f = 127 -
+0x0cb, // 0x080 = 128 - JUMP_IF_FREEZE_ACTIVE
+0x085, // 0x081 = 129 -
+0x013, // 0x082 = 130 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x083 = 131 - JUMP
+0x02b, // 0x084 = 132 -
+0x024, // 0x085 = 133 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x086 = 134 - NO_OP
+0x000, // 0x087 = 135 - NO_OP
+0x0ff, // 0x088 = 136 - JUMP
+0x05b, // 0x089 = 137 -
+0x0c3, // 0x08a = 138 - JUMP_IF_SMP_PROTOCOL
+0x092, // 0x08b = 139 -
+0x0d2, // 0x08c = 140 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x096, // 0x08d = 141 -
+0x0d1, // 0x08e = 142 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x09a, // 0x08f = 143 -
+0x0ff, // 0x090 = 144 - JUMP
+0x05b, // 0x091 = 145 -
+0x0c4, // 0x092 = 146 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x0af, // 0x093 = 147 -
+0x0ff, // 0x094 = 148 - JUMP
+0x05b, // 0x095 = 149 -
+0x0d1, // 0x096 = 150 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x09a, // 0x097 = 151 -
+0x0ff, // 0x098 = 152 - JUMP
+0x05b, // 0x099 = 153 -
+0x0ff, // 0x09a = 154 - JUMP
+0x09c, // 0x09b = 155 -
+0x004, // 0x09c = 156 - CLOSE_NORMAL
+0x000, // 0x09d = 157 - NO_OP
+0x000, // 0x09e = 158 - NO_OP
+0x000, // 0x09f = 159 - NO_OP
+0x000, // 0x0a0 = 160 - NO_OP
+0x0c9, // 0x0a1 = 161 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x0ac, // 0x0a2 = 162 -
+0x0c0, // 0x0a3 = 163 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x05b, // 0x0a4 = 164 -
+0x0bc, // 0x0a5 = 165 - JUMP_IF_BREAK_RECEIVED
+0x0af, // 0x0a6 = 166 -
+0x0be, // 0x0a7 = 167 - JUMP_IF_PHY_READY
+0x09d, // 0x0a8 = 168 -
+0x01c, // 0x0a9 = 169 - SOFT_RESET
+0x0ff, // 0x0aa = 170 - JUMP
+0x001, // 0x0ab = 171 -
+0x022, // 0x0ac = 172 - SEND_CREDIT_BLOCK
+0x0ff, // 0x0ad = 173 - JUMP
+0x09d, // 0x0ae = 174 -
+0x007, // 0x0af = 175 - CLOSE_BREAK
+0x000, // 0x0b0 = 176 - NO_OP
+0x000, // 0x0b1 = 177 - NO_OP
+0x000, // 0x0b2 = 178 - NO_OP
+0x000, // 0x0b3 = 179 - NO_OP
+0x0c0, // 0x0b4 = 180 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x05b, // 0x0b5 = 181 -
+0x0be, // 0x0b6 = 182 - JUMP_IF_PHY_READY
+0x0b0, // 0x0b7 = 183 -
+0x01c, // 0x0b8 = 184 - SOFT_RESET
+0x0ff, // 0x0b9 = 185 - JUMP
+0x001, // 0x0ba = 186 -
+0x005, // 0x0bb = 187 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x0bc = 188 - JUMP
+0x09d, // 0x0bd = 189 -
+0x006, // 0x0be = 190 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x0bf = 191 - JUMP
+0x09d, // 0x0c0 = 192 -
+0x0cc, // 0x0c1 = 193 - JUMP_IF_RX_BUFFER_FULL
+0x05b, // 0x0c2 = 194 -
+0x0b7, // 0x0c3 = 195 - JUMP_IF_FLAG_7_SET
+0x0c8, // 0x0c4 = 196 -
+0x011, // 0x0c5 = 197 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x0c6 = 198 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x0c7 = 199 - START_ARB_WAIT_TIMER
+0x0cb, // 0x0c8 = 200 - JUMP_IF_FREEZE_ACTIVE
+0x107, // 0x0c9 = 201 -
+0x001, // 0x0ca = 202 - OPEN_REQUEST
+0x080, // 0x0cb = 203 - SET_FLAG
+0x080, // 0x0cc = 204 -
+0x090, // 0x0cd = 205 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0f3, // 0x0ce = 206 -
+0x095, // 0x0cf = 207 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x0f8, // 0x0d0 = 208 -
+0x099, // 0x0d1 = 209 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x0fb, // 0x0d2 = 210 -
+0x09b, // 0x0d3 = 211 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x0fe, // 0x0d4 = 212 -
+0x094, // 0x0d5 = 213 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0c8, // 0x0d6 = 214 -
+0x093, // 0x0d7 = 215 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x101, // 0x0d8 = 216 -
+0x09f, // 0x0d9 = 217 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x104, // 0x0da = 218 -
+0x09a, // 0x0db = 219 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x0c8, // 0x0dc = 220 -
+0x096, // 0x0dd = 221 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x101, // 0x0de = 222 -
+0x097, // 0x0df = 223 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x10c, // 0x0e0 = 224 -
+0x098, // 0x0e1 = 225 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x0c8, // 0x0e2 = 226 -
+0x092, // 0x0e3 = 227 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x0c8, // 0x0e4 = 228 -
+0x0a4, // 0x0e5 = 229 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0ed, // 0x0e6 = 230 -
+0x0be, // 0x0e7 = 231 - JUMP_IF_PHY_READY
+0x0cd, // 0x0e8 = 232 -
+0x01b, // 0x0e9 = 233 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x0ea = 234 - SOFT_RESET
+0x0ff, // 0x0eb = 235 - JUMP
+0x001, // 0x0ec = 236 -
+0x0a0, // 0x0ed = 237 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0f3, // 0x0ee = 238 -
+0x000, // 0x0ef = 239 - NO_OP
+0x000, // 0x0f0 = 240 - NO_OP
+0x0ff, // 0x0f1 = 241 - JUMP
+0x05b, // 0x0f2 = 242 -
+0x013, // 0x0f3 = 243 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x0f4 = 244 - CLEAR_FLAG
+0x080, // 0x0f5 = 245 -
+0x0ff, // 0x0f6 = 246 - JUMP
+0x02b, // 0x0f7 = 247 -
+0x017, // 0x0f8 = 248 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x0f9 = 249 - JUMP
+0x108, // 0x0fa = 250 -
+0x018, // 0x0fb = 251 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x0fc = 252 - JUMP
+0x108, // 0x0fd = 253 -
+0x01a, // 0x0fe = 254 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x0ff = 255 - JUMP
+0x108, // 0x100 = 256 -
+0x015, // 0x101 = 257 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x102 = 258 - JUMP
+0x108, // 0x103 = 259 -
+0x014, // 0x104 = 260 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x105 = 261 - JUMP
+0x108, // 0x106 = 262 -
+0x024, // 0x107 = 263 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x108 = 264 - NO_OP
+0x000, // 0x109 = 265 - NO_OP
+0x0ff, // 0x10a = 266 - JUMP
+0x05b, // 0x10b = 267 -
+0x010, // 0x10c = 268 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x10d = 269 - JUMP
+0x0c8, // 0x10e = 270 -
+0x000, // 0x10f = 271 - NO_OP
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x000, // 0x112 = 274 - NO_OP
+0x000, // 0x113 = 275 - NO_OP
+0x000, // 0x114 = 276 - NO_OP
+0x000, // 0x115 = 277 - NO_OP
+0x000, // 0x116 = 278 - NO_OP
+0x000, // 0x117 = 279 - NO_OP
+0x000, // 0x118 = 280 - NO_OP
+0x000, // 0x119 = 281 - NO_OP
+0x000, // 0x11a = 282 - NO_OP
+0x000, // 0x11b = 283 - NO_OP
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x000, // 0x120 = 288 - NO_OP
+0x000, // 0x121 = 289 - NO_OP
+0x000, // 0x122 = 290 - NO_OP
+0x000, // 0x123 = 291 - NO_OP
+0x000, // 0x124 = 292 - NO_OP
+0x000, // 0x125 = 293 - NO_OP
+0x000, // 0x126 = 294 - NO_OP
+0x000, // 0x127 = 295 - NO_OP
+0x000, // 0x128 = 296 - NO_OP
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x000, // 0x12d = 301 - NO_OP
+0x000, // 0x12e = 302 - NO_OP
+0x000, // 0x12f = 303 - NO_OP
+0x000, // 0x130 = 304 - NO_OP
+0x000, // 0x131 = 305 - NO_OP
+0x000, // 0x132 = 306 - NO_OP
+0x000, // 0x133 = 307 - NO_OP
+0x000, // 0x134 = 308 - NO_OP
+0x000, // 0x135 = 309 - NO_OP
+0x000, // 0x136 = 310 - NO_OP
+0x000, // 0x137 = 311 - NO_OP
+0x000, // 0x138 = 312 - NO_OP
+0x000, // 0x139 = 313 - NO_OP
+0x000, // 0x13a = 314 - NO_OP
+0x000, // 0x13b = 315 - NO_OP
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x000, // 0x140 = 320 - NO_OP
+0x000, // 0x141 = 321 - NO_OP
+0x000, // 0x142 = 322 - NO_OP
+0x000, // 0x143 = 323 - NO_OP
+0x000, // 0x144 = 324 - NO_OP
+0x000, // 0x145 = 325 - NO_OP
+0x000, // 0x146 = 326 - NO_OP
+0x000, // 0x147 = 327 - NO_OP
+0x000, // 0x148 = 328 - NO_OP
+0x000, // 0x149 = 329 - NO_OP
+0x000, // 0x14a = 330 - NO_OP
+0x000, // 0x14b = 331 - NO_OP
+0x000, // 0x14c = 332 - NO_OP
+0x000, // 0x14d = 333 - NO_OP
+0x000, // 0x14e = 334 - NO_OP
+0x000, // 0x14f = 335 - NO_OP
+0x000, // 0x150 = 336 - NO_OP
+0x000, // 0x151 = 337 - NO_OP
+0x000, // 0x152 = 338 - NO_OP
+0x000, // 0x153 = 339 - NO_OP
+0x000, // 0x154 = 340 - NO_OP
+0x000, // 0x155 = 341 - NO_OP
+0x000, // 0x156 = 342 - NO_OP
+0x000, // 0x157 = 343 - NO_OP
+0x000, // 0x158 = 344 - NO_OP
+0x000, // 0x159 = 345 - NO_OP
+0x000, // 0x15a = 346 - NO_OP
+0x000, // 0x15b = 347 - NO_OP
+0x000, // 0x15c = 348 - NO_OP
+0x000, // 0x15d = 349 - NO_OP
+0x000, // 0x15e = 350 - NO_OP
+0x000, // 0x15f = 351 - NO_OP
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x000, // 0x162 = 354 - NO_OP
+0x000, // 0x163 = 355 - NO_OP
+0x000, // 0x164 = 356 - NO_OP
+0x000, // 0x165 = 357 - NO_OP
+0x000, // 0x166 = 358 - NO_OP
+0x000, // 0x167 = 359 - NO_OP
+0x000, // 0x168 = 360 - NO_OP
+0x000, // 0x169 = 361 - NO_OP
+0x000, // 0x16a = 362 - NO_OP
+0x000, // 0x16b = 363 - NO_OP
+0x000, // 0x16c = 364 - NO_OP
+0x000, // 0x16d = 365 - NO_OP
+0x000, // 0x16e = 366 - NO_OP
+0x000, // 0x16f = 367 - NO_OP
+0x000, // 0x170 = 368 - NO_OP
+0x000, // 0x171 = 369 - NO_OP
+0x000, // 0x172 = 370 - NO_OP
+0x000, // 0x173 = 371 - NO_OP
+0x000, // 0x174 = 372 - NO_OP
+0x000, // 0x175 = 373 - NO_OP
+0x000, // 0x176 = 374 - NO_OP
+0x000, // 0x177 = 375 - NO_OP
+0x000, // 0x178 = 376 - NO_OP
+0x000, // 0x179 = 377 - NO_OP
+0x000, // 0x17a = 378 - NO_OP
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000 // 0x1ff = 511 - NO_OP
+};
+
+/* WCS 032006 */
+bit32 wcsImage032006[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x0be, // 0x001 = 1 - JUMP_IF_PHY_READY
+0x009, // 0x002 = 2 -
+0x0ae, // 0x003 = 3 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x004 = 4 -
+0x0af, // 0x005 = 5 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01e, // 0x006 = 6 -
+0x0ff, // 0x007 = 7 - JUMP
+0x001, // 0x008 = 8 -
+0x00c, // 0x009 = 9 - SEND_ID_FRAME
+0x0ae, // 0x00a = 10 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x010, // 0x00b = 11 -
+0x0af, // 0x00c = 12 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x00d = 13 -
+0x0ff, // 0x00e = 14 - JUMP
+0x00a, // 0x00f = 15 -
+0x01c, // 0x010 = 16 - SOFT_RESET
+0x00d, // 0x011 = 17 - PHY_RESET_START
+0x0be, // 0x012 = 18 - JUMP_IF_PHY_READY
+0x016, // 0x013 = 19 -
+0x0af, // 0x014 = 20 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01b, // 0x015 = 21 -
+0x00c, // 0x016 = 22 - SEND_ID_FRAME
+0x0af, // 0x017 = 23 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x0ff, // 0x01c = 28 - JUMP
+0x023, // 0x01d = 29 -
+0x0be, // 0x01e = 30 - JUMP_IF_PHY_READY
+0x022, // 0x01f = 31 -
+0x0ff, // 0x020 = 32 - JUMP
+0x01e, // 0x021 = 33 -
+0x00c, // 0x022 = 34 - SEND_ID_FRAME
+0x000, // 0x023 = 35 - NO_OP
+0x000, // 0x024 = 36 - NO_OP
+0x000, // 0x025 = 37 - NO_OP
+0x000, // 0x026 = 38 - NO_OP
+0x000, // 0x027 = 39 - NO_OP
+0x000, // 0x028 = 40 - NO_OP
+0x0ff, // 0x029 = 41 - JUMP
+0x063, // 0x02a = 42 -
+0x000, // 0x02b = 43 - NO_OP
+0x0c9, // 0x02c = 44 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x058, // 0x02d = 45 -
+0x0a5, // 0x02e = 46 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x041, // 0x02f = 47 -
+0x0a6, // 0x030 = 48 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x048, // 0x031 = 49 -
+0x0a7, // 0x032 = 50 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x04b, // 0x033 = 51 -
+0x0a8, // 0x034 = 52 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x055, // 0x035 = 53 -
+0x0aa, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x050, // 0x037 = 55 -
+0x0c5, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x055, // 0x039 = 57 -
+0x0ca, // 0x03a = 58 - JUMP_IF_CLOSE_REQ
+0x0a4, // 0x03b = 59 -
+0x0be, // 0x03c = 60 - JUMP_IF_PHY_READY
+0x02c, // 0x03d = 61 -
+0x01c, // 0x03e = 62 - SOFT_RESET
+0x0ff, // 0x03f = 63 - JUMP
+0x001, // 0x040 = 64 -
+0x01d, // 0x041 = 65 - ADVANCE
+0x0bc, // 0x042 = 66 - JUMP_IF_BREAK_RECEIVED
+0x0b7, // 0x043 = 67 -
+0x0c3, // 0x044 = 68 - JUMP_IF_SMP_PROTOCOL
+0x0a4, // 0x045 = 69 -
+0x0ff, // 0x046 = 70 - JUMP
+0x05b, // 0x047 = 71 -
+0x01d, // 0x048 = 72 - ADVANCE
+0x0ff, // 0x049 = 73 - JUMP
+0x05b, // 0x04a = 74 -
+0x01d, // 0x04b = 75 - ADVANCE
+0x0bc, // 0x04c = 76 - JUMP_IF_BREAK_RECEIVED
+0x0b7, // 0x04d = 77 -
+0x0ff, // 0x04e = 78 - JUMP
+0x0c3, // 0x04f = 79 -
+0x01d, // 0x050 = 80 - ADVANCE
+0x0bc, // 0x051 = 81 - JUMP_IF_BREAK_RECEIVED
+0x0b7, // 0x052 = 82 -
+0x0ff, // 0x053 = 83 - JUMP
+0x0c6, // 0x054 = 84 -
+0x01d, // 0x055 = 85 - ADVANCE
+0x0ff, // 0x056 = 86 - JUMP
+0x0b7, // 0x057 = 87 -
+0x022, // 0x058 = 88 - SEND_CREDIT_BLOCK
+0x0ff, // 0x059 = 89 - JUMP
+0x02e, // 0x05a = 90 -
+0x083, // 0x05b = 91 - TIMER_START
+0x002, // 0x05c = 92 -
+0x000, // 0x05d = 93 - NO_OP
+0x000, // 0x05e = 94 - NO_OP
+0x0b8, // 0x05f = 95 - JUMP_IF_TIMER_EXPIRED
+0x063, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x05d, // 0x062 = 98 -
+0x0bc, // 0x063 = 99 - JUMP_IF_BREAK_RECEIVED
+0x0b7, // 0x064 = 100 -
+0x0c8, // 0x065 = 101 - JUMP_IF_HIP_REQ
+0x071, // 0x066 = 102 -
+0x0c6, // 0x067 = 103 - JUMP_IF_SFO_REQ
+0x076, // 0x068 = 104 -
+0x0c7, // 0x069 = 105 - JUMP_IF_DOC_REQ
+0x07b, // 0x06a = 106 -
+0x0a3, // 0x06b = 107 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x092, // 0x06c = 108 -
+0x0a2, // 0x06d = 109 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0a4, // 0x06e = 110 -
+0x0ff, // 0x06f = 111 - JUMP
+0x063, // 0x070 = 112 -
+0x020, // 0x071 = 113 - SELECT_HIP
+0x000, // 0x072 = 114 - NO_OP
+0x000, // 0x073 = 115 - NO_OP
+0x0ff, // 0x074 = 116 - JUMP
+0x07e, // 0x075 = 117 -
+0x01e, // 0x076 = 118 - SELECT_SFO
+0x000, // 0x077 = 119 - NO_OP
+0x000, // 0x078 = 120 - NO_OP
+0x0ff, // 0x079 = 121 - JUMP
+0x07e, // 0x07a = 122 -
+0x01f, // 0x07b = 123 - SELECT_DOC
+0x000, // 0x07c = 124 - NO_OP
+0x000, // 0x07d = 125 - NO_OP
+0x0a4, // 0x07e = 126 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x082, // 0x07f = 127 -
+0x0ff, // 0x080 = 128 - JUMP
+0x0c9, // 0x081 = 129 -
+0x0a0, // 0x082 = 130 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x088, // 0x083 = 131 -
+0x0a3, // 0x084 = 132 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x092, // 0x085 = 133 -
+0x0ff, // 0x086 = 134 - JUMP
+0x0a4, // 0x087 = 135 -
+0x0cb, // 0x088 = 136 - JUMP_IF_FREEZE_ACTIVE
+0x08d, // 0x089 = 137 -
+0x013, // 0x08a = 138 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x08b = 139 - JUMP
+0x02b, // 0x08c = 140 -
+0x024, // 0x08d = 141 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x08e = 142 - NO_OP
+0x000, // 0x08f = 143 - NO_OP
+0x0ff, // 0x090 = 144 - JUMP
+0x063, // 0x091 = 145 -
+0x0c3, // 0x092 = 146 - JUMP_IF_SMP_PROTOCOL
+0x09a, // 0x093 = 147 -
+0x0d2, // 0x094 = 148 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x09e, // 0x095 = 149 -
+0x0d1, // 0x096 = 150 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x0a2, // 0x097 = 151 -
+0x0ff, // 0x098 = 152 - JUMP
+0x063, // 0x099 = 153 -
+0x0c4, // 0x09a = 154 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x0b7, // 0x09b = 155 -
+0x0ff, // 0x09c = 156 - JUMP
+0x063, // 0x09d = 157 -
+0x0d1, // 0x09e = 158 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x0a2, // 0x09f = 159 -
+0x0ff, // 0x0a0 = 160 - JUMP
+0x063, // 0x0a1 = 161 -
+0x0ff, // 0x0a2 = 162 - JUMP
+0x0a4, // 0x0a3 = 163 -
+0x004, // 0x0a4 = 164 - CLOSE_NORMAL
+0x000, // 0x0a5 = 165 - NO_OP
+0x000, // 0x0a6 = 166 - NO_OP
+0x000, // 0x0a7 = 167 - NO_OP
+0x000, // 0x0a8 = 168 - NO_OP
+0x0c9, // 0x0a9 = 169 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x0b4, // 0x0aa = 170 -
+0x0c0, // 0x0ab = 171 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x063, // 0x0ac = 172 -
+0x0bc, // 0x0ad = 173 - JUMP_IF_BREAK_RECEIVED
+0x0b7, // 0x0ae = 174 -
+0x0be, // 0x0af = 175 - JUMP_IF_PHY_READY
+0x0a5, // 0x0b0 = 176 -
+0x01c, // 0x0b1 = 177 - SOFT_RESET
+0x0ff, // 0x0b2 = 178 - JUMP
+0x001, // 0x0b3 = 179 -
+0x022, // 0x0b4 = 180 - SEND_CREDIT_BLOCK
+0x0ff, // 0x0b5 = 181 - JUMP
+0x0a5, // 0x0b6 = 182 -
+0x007, // 0x0b7 = 183 - CLOSE_BREAK
+0x000, // 0x0b8 = 184 - NO_OP
+0x000, // 0x0b9 = 185 - NO_OP
+0x000, // 0x0ba = 186 - NO_OP
+0x000, // 0x0bb = 187 - NO_OP
+0x0c0, // 0x0bc = 188 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x063, // 0x0bd = 189 -
+0x0be, // 0x0be = 190 - JUMP_IF_PHY_READY
+0x0b8, // 0x0bf = 191 -
+0x01c, // 0x0c0 = 192 - SOFT_RESET
+0x0ff, // 0x0c1 = 193 - JUMP
+0x001, // 0x0c2 = 194 -
+0x005, // 0x0c3 = 195 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x0c4 = 196 - JUMP
+0x0a5, // 0x0c5 = 197 -
+0x006, // 0x0c6 = 198 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x0c7 = 199 - JUMP
+0x0a5, // 0x0c8 = 200 -
+0x0cc, // 0x0c9 = 201 - JUMP_IF_RX_BUFFER_FULL
+0x063, // 0x0ca = 202 -
+0x0b7, // 0x0cb = 203 - JUMP_IF_FLAG_7_SET
+0x0d0, // 0x0cc = 204 -
+0x011, // 0x0cd = 205 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x0ce = 206 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x0cf = 207 - START_ARB_WAIT_TIMER
+0x0cb, // 0x0d0 = 208 - JUMP_IF_FREEZE_ACTIVE
+0x10f, // 0x0d1 = 209 -
+0x001, // 0x0d2 = 210 - OPEN_REQUEST
+0x080, // 0x0d3 = 211 - SET_FLAG
+0x080, // 0x0d4 = 212 -
+0x090, // 0x0d5 = 213 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x0fb, // 0x0d6 = 214 -
+0x095, // 0x0d7 = 215 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x100, // 0x0d8 = 216 -
+0x099, // 0x0d9 = 217 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x103, // 0x0da = 218 -
+0x09b, // 0x0db = 219 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x106, // 0x0dc = 220 -
+0x094, // 0x0dd = 221 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x0d0, // 0x0de = 222 -
+0x093, // 0x0df = 223 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x109, // 0x0e0 = 224 -
+0x09f, // 0x0e1 = 225 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x10c, // 0x0e2 = 226 -
+0x09a, // 0x0e3 = 227 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x0d0, // 0x0e4 = 228 -
+0x096, // 0x0e5 = 229 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x109, // 0x0e6 = 230 -
+0x097, // 0x0e7 = 231 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x114, // 0x0e8 = 232 -
+0x098, // 0x0e9 = 233 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x0d0, // 0x0ea = 234 -
+0x092, // 0x0eb = 235 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x0d0, // 0x0ec = 236 -
+0x0a4, // 0x0ed = 237 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0f5, // 0x0ee = 238 -
+0x0be, // 0x0ef = 239 - JUMP_IF_PHY_READY
+0x0d5, // 0x0f0 = 240 -
+0x01b, // 0x0f1 = 241 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x0f2 = 242 - SOFT_RESET
+0x0ff, // 0x0f3 = 243 - JUMP
+0x001, // 0x0f4 = 244 -
+0x0a0, // 0x0f5 = 245 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0fb, // 0x0f6 = 246 -
+0x000, // 0x0f7 = 247 - NO_OP
+0x000, // 0x0f8 = 248 - NO_OP
+0x0ff, // 0x0f9 = 249 - JUMP
+0x063, // 0x0fa = 250 -
+0x013, // 0x0fb = 251 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x0fc = 252 - CLEAR_FLAG
+0x080, // 0x0fd = 253 -
+0x0ff, // 0x0fe = 254 - JUMP
+0x02b, // 0x0ff = 255 -
+0x017, // 0x100 = 256 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x101 = 257 - JUMP
+0x110, // 0x102 = 258 -
+0x018, // 0x103 = 259 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x104 = 260 - JUMP
+0x110, // 0x105 = 261 -
+0x01a, // 0x106 = 262 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x107 = 263 - JUMP
+0x110, // 0x108 = 264 -
+0x015, // 0x109 = 265 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x10a = 266 - JUMP
+0x110, // 0x10b = 267 -
+0x014, // 0x10c = 268 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x10d = 269 - JUMP
+0x110, // 0x10e = 270 -
+0x024, // 0x10f = 271 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x0ff, // 0x112 = 274 - JUMP
+0x063, // 0x113 = 275 -
+0x010, // 0x114 = 276 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x115 = 277 - JUMP
+0x0d0, // 0x116 = 278 -
+0x000, // 0x117 = 279 - NO_OP
+0x000, // 0x118 = 280 - NO_OP
+0x000, // 0x119 = 281 - NO_OP
+0x000, // 0x11a = 282 - NO_OP
+0x000, // 0x11b = 283 - NO_OP
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x000, // 0x120 = 288 - NO_OP
+0x000, // 0x121 = 289 - NO_OP
+0x000, // 0x122 = 290 - NO_OP
+0x000, // 0x123 = 291 - NO_OP
+0x000, // 0x124 = 292 - NO_OP
+0x000, // 0x125 = 293 - NO_OP
+0x000, // 0x126 = 294 - NO_OP
+0x000, // 0x127 = 295 - NO_OP
+0x000, // 0x128 = 296 - NO_OP
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x000, // 0x12d = 301 - NO_OP
+0x000, // 0x12e = 302 - NO_OP
+0x000, // 0x12f = 303 - NO_OP
+0x000, // 0x130 = 304 - NO_OP
+0x000, // 0x131 = 305 - NO_OP
+0x000, // 0x132 = 306 - NO_OP
+0x000, // 0x133 = 307 - NO_OP
+0x000, // 0x134 = 308 - NO_OP
+0x000, // 0x135 = 309 - NO_OP
+0x000, // 0x136 = 310 - NO_OP
+0x000, // 0x137 = 311 - NO_OP
+0x000, // 0x138 = 312 - NO_OP
+0x000, // 0x139 = 313 - NO_OP
+0x000, // 0x13a = 314 - NO_OP
+0x000, // 0x13b = 315 - NO_OP
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x000, // 0x140 = 320 - NO_OP
+0x000, // 0x141 = 321 - NO_OP
+0x000, // 0x142 = 322 - NO_OP
+0x000, // 0x143 = 323 - NO_OP
+0x000, // 0x144 = 324 - NO_OP
+0x000, // 0x145 = 325 - NO_OP
+0x000, // 0x146 = 326 - NO_OP
+0x000, // 0x147 = 327 - NO_OP
+0x000, // 0x148 = 328 - NO_OP
+0x000, // 0x149 = 329 - NO_OP
+0x000, // 0x14a = 330 - NO_OP
+0x000, // 0x14b = 331 - NO_OP
+0x000, // 0x14c = 332 - NO_OP
+0x000, // 0x14d = 333 - NO_OP
+0x000, // 0x14e = 334 - NO_OP
+0x000, // 0x14f = 335 - NO_OP
+0x000, // 0x150 = 336 - NO_OP
+0x000, // 0x151 = 337 - NO_OP
+0x000, // 0x152 = 338 - NO_OP
+0x000, // 0x153 = 339 - NO_OP
+0x000, // 0x154 = 340 - NO_OP
+0x000, // 0x155 = 341 - NO_OP
+0x000, // 0x156 = 342 - NO_OP
+0x000, // 0x157 = 343 - NO_OP
+0x000, // 0x158 = 344 - NO_OP
+0x000, // 0x159 = 345 - NO_OP
+0x000, // 0x15a = 346 - NO_OP
+0x000, // 0x15b = 347 - NO_OP
+0x000, // 0x15c = 348 - NO_OP
+0x000, // 0x15d = 349 - NO_OP
+0x000, // 0x15e = 350 - NO_OP
+0x000, // 0x15f = 351 - NO_OP
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x000, // 0x162 = 354 - NO_OP
+0x000, // 0x163 = 355 - NO_OP
+0x000, // 0x164 = 356 - NO_OP
+0x000, // 0x165 = 357 - NO_OP
+0x000, // 0x166 = 358 - NO_OP
+0x000, // 0x167 = 359 - NO_OP
+0x000, // 0x168 = 360 - NO_OP
+0x000, // 0x169 = 361 - NO_OP
+0x000, // 0x16a = 362 - NO_OP
+0x000, // 0x16b = 363 - NO_OP
+0x000, // 0x16c = 364 - NO_OP
+0x000, // 0x16d = 365 - NO_OP
+0x000, // 0x16e = 366 - NO_OP
+0x000, // 0x16f = 367 - NO_OP
+0x000, // 0x170 = 368 - NO_OP
+0x000, // 0x171 = 369 - NO_OP
+0x000, // 0x172 = 370 - NO_OP
+0x000, // 0x173 = 371 - NO_OP
+0x000, // 0x174 = 372 - NO_OP
+0x000, // 0x175 = 373 - NO_OP
+0x000, // 0x176 = 374 - NO_OP
+0x000, // 0x177 = 375 - NO_OP
+0x000, // 0x178 = 376 - NO_OP
+0x000, // 0x179 = 377 - NO_OP
+0x000, // 0x17a = 378 - NO_OP
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000 // 0x1ff = 511 - NO_OP
+};
+
+
+
+/* WCS 20060825 */
+bit32 wcsImage_20060825[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x00c, // 0x003 = 3 -
+0x0ae, // 0x004 = 4 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x015, // 0x005 = 5 -
+0x0af, // 0x006 = 6 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x026, // 0x007 = 7 -
+0x0ce, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x009 = 9 -
+0x0ff, // 0x00a = 10 - JUMP
+0x002, // 0x00b = 11 -
+0x00c, // 0x00c = 12 - SEND_ID_FRAME
+0x0ae, // 0x00d = 13 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x015, // 0x00e = 14 -
+0x0af, // 0x00f = 15 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x02b, // 0x010 = 16 -
+0x0ce, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x012 = 18 -
+0x0ff, // 0x013 = 19 - JUMP
+0x00d, // 0x014 = 20 -
+0x01c, // 0x015 = 21 - SOFT_RESET
+0x00d, // 0x016 = 22 - PHY_RESET_START
+0x00d, // 0x017 = 23 - PHY_RESET_START
+0x0be, // 0x018 = 24 - JUMP_IF_PHY_READY
+0x01c, // 0x019 = 25 -
+0x0af, // 0x01a = 26 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x023, // 0x01b = 27 -
+0x00c, // 0x01c = 28 - SEND_ID_FRAME
+0x0af, // 0x01d = 29 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x02b, // 0x01e = 30 -
+0x0ce, // 0x01f = 31 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x020 = 32 -
+0x0ff, // 0x021 = 33 - JUMP
+0x01d, // 0x022 = 34 -
+0x00c, // 0x023 = 35 - SEND_ID_FRAME
+0x0ff, // 0x024 = 36 - JUMP
+0x02b, // 0x025 = 37 -
+0x0be, // 0x026 = 38 - JUMP_IF_PHY_READY
+0x02a, // 0x027 = 39 -
+0x0ff, // 0x028 = 40 - JUMP
+0x026, // 0x029 = 41 -
+0x00c, // 0x02a = 42 - SEND_ID_FRAME
+0x000, // 0x02b = 43 - NO_OP
+0x000, // 0x02c = 44 - NO_OP
+0x000, // 0x02d = 45 - NO_OP
+0x000, // 0x02e = 46 - NO_OP
+0x000, // 0x02f = 47 - NO_OP
+0x000, // 0x030 = 48 - NO_OP
+0x0ff, // 0x031 = 49 - JUMP
+0x06d, // 0x032 = 50 -
+0x000, // 0x033 = 51 - NO_OP
+0x0c9, // 0x034 = 52 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x062, // 0x035 = 53 -
+0x0a5, // 0x036 = 54 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x04b, // 0x037 = 55 -
+0x0a6, // 0x038 = 56 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x052, // 0x039 = 57 -
+0x0a7, // 0x03a = 58 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x055, // 0x03b = 59 -
+0x0a8, // 0x03c = 60 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x05f, // 0x03d = 61 -
+0x0aa, // 0x03e = 62 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x05a, // 0x03f = 63 -
+0x0c5, // 0x040 = 64 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x05f, // 0x041 = 65 -
+0x0ac, // 0x042 = 66 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x052, // 0x043 = 67 -
+0x0ca, // 0x044 = 68 - JUMP_IF_CLOSE_REQ
+0x0fc, // 0x045 = 69 -
+0x0be, // 0x046 = 70 - JUMP_IF_PHY_READY
+0x034, // 0x047 = 71 -
+0x01c, // 0x048 = 72 - SOFT_RESET
+0x0ff, // 0x049 = 73 - JUMP
+0x002, // 0x04a = 74 -
+0x01d, // 0x04b = 75 - ADVANCE
+0x0bc, // 0x04c = 76 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x04d = 77 -
+0x0c3, // 0x04e = 78 - JUMP_IF_SMP_PROTOCOL
+0x0fc, // 0x04f = 79 -
+0x0ff, // 0x050 = 80 - JUMP
+0x065, // 0x051 = 81 -
+0x01d, // 0x052 = 82 - ADVANCE
+0x0ff, // 0x053 = 83 - JUMP
+0x065, // 0x054 = 84 -
+0x01d, // 0x055 = 85 - ADVANCE
+0x0bc, // 0x056 = 86 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x057 = 87 -
+0x0ff, // 0x058 = 88 - JUMP
+0x11b, // 0x059 = 89 -
+0x01d, // 0x05a = 90 - ADVANCE
+0x0bc, // 0x05b = 91 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x05c = 92 -
+0x0ff, // 0x05d = 93 - JUMP
+0x11e, // 0x05e = 94 -
+0x01d, // 0x05f = 95 - ADVANCE
+0x0ff, // 0x060 = 96 - JUMP
+0x10f, // 0x061 = 97 -
+0x022, // 0x062 = 98 - SEND_CREDIT_BLOCK
+0x0ff, // 0x063 = 99 - JUMP
+0x036, // 0x064 = 100 -
+0x083, // 0x065 = 101 - TIMER_START
+0x004, // 0x066 = 102 -
+0x000, // 0x067 = 103 - NO_OP
+0x000, // 0x068 = 104 - NO_OP
+0x0b8, // 0x069 = 105 - JUMP_IF_TIMER_EXPIRED
+0x06d, // 0x06a = 106 -
+0x0ff, // 0x06b = 107 - JUMP
+0x067, // 0x06c = 108 -
+0x0bc, // 0x06d = 109 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x06e = 110 -
+0x0be, // 0x06f = 111 - JUMP_IF_PHY_READY
+0x074, // 0x070 = 112 -
+0x01c, // 0x071 = 113 - SOFT_RESET
+0x0ff, // 0x072 = 114 - JUMP
+0x002, // 0x073 = 115 -
+0x0c8, // 0x074 = 116 - JUMP_IF_HIP_REQ
+0x086, // 0x075 = 117 -
+0x0c6, // 0x076 = 118 - JUMP_IF_SFO_REQ
+0x08f, // 0x077 = 119 -
+0x0c7, // 0x078 = 120 - JUMP_IF_DOC_REQ
+0x09a, // 0x079 = 121 -
+0x0a3, // 0x07a = 122 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x0db, // 0x07b = 123 -
+0x0a2, // 0x07c = 124 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0c4, // 0x07d = 125 -
+0x0c8, // 0x07e = 126 - JUMP_IF_HIP_REQ
+0x0a3, // 0x07f = 127 -
+0x0c6, // 0x080 = 128 - JUMP_IF_SFO_REQ
+0x0a8, // 0x081 = 129 -
+0x0c7, // 0x082 = 130 - JUMP_IF_DOC_REQ
+0x0ad, // 0x083 = 131 -
+0x0ff, // 0x084 = 132 - JUMP
+0x06d, // 0x085 = 133 -
+0x028, // 0x086 = 134 - CHECK_HIP
+0x000, // 0x087 = 135 - NO_OP
+0x000, // 0x088 = 136 - NO_OP
+0x000, // 0x089 = 137 - NO_OP
+0x000, // 0x08a = 138 - NO_OP
+0x0d8, // 0x08b = 139 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0a3, // 0x08c = 140 -
+0x0ff, // 0x08d = 141 - JUMP
+0x07a, // 0x08e = 142 -
+0x029, // 0x08f = 143 - CHECK_SFO
+0x000, // 0x090 = 144 - NO_OP
+0x000, // 0x091 = 145 - NO_OP
+0x000, // 0x092 = 146 - NO_OP
+0x000, // 0x093 = 147 - NO_OP
+0x0d8, // 0x094 = 148 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0a8, // 0x095 = 149 -
+0x0c7, // 0x096 = 150 - JUMP_IF_DOC_REQ
+0x09a, // 0x097 = 151 -
+0x0ff, // 0x098 = 152 - JUMP
+0x07a, // 0x099 = 153 -
+0x02a, // 0x09a = 154 - CHECK_DOC
+0x000, // 0x09b = 155 - NO_OP
+0x000, // 0x09c = 156 - NO_OP
+0x000, // 0x09d = 157 - NO_OP
+0x000, // 0x09e = 158 - NO_OP
+0x0d8, // 0x09f = 159 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0ad, // 0x0a0 = 160 -
+0x0ff, // 0x0a1 = 161 - JUMP
+0x07a, // 0x0a2 = 162 -
+0x020, // 0x0a3 = 163 - SELECT_HIP
+0x000, // 0x0a4 = 164 - NO_OP
+0x000, // 0x0a5 = 165 - NO_OP
+0x0ff, // 0x0a6 = 166 - JUMP
+0x0b0, // 0x0a7 = 167 -
+0x01e, // 0x0a8 = 168 - SELECT_SFO
+0x000, // 0x0a9 = 169 - NO_OP
+0x000, // 0x0aa = 170 - NO_OP
+0x0ff, // 0x0ab = 171 - JUMP
+0x0b0, // 0x0ac = 172 -
+0x01f, // 0x0ad = 173 - SELECT_DOC
+0x000, // 0x0ae = 174 - NO_OP
+0x000, // 0x0af = 175 - NO_OP
+0x0a4, // 0x0b0 = 176 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0b4, // 0x0b1 = 177 -
+0x0ff, // 0x0b2 = 178 - JUMP
+0x121, // 0x0b3 = 179 -
+0x0a0, // 0x0b4 = 180 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0ba, // 0x0b5 = 181 -
+0x0a3, // 0x0b6 = 182 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x0db, // 0x0b7 = 183 -
+0x0ff, // 0x0b8 = 184 - JUMP
+0x0fc, // 0x0b9 = 185 -
+0x0cb, // 0x0ba = 186 - JUMP_IF_FREEZE_ACTIVE
+0x0bf, // 0x0bb = 187 -
+0x013, // 0x0bc = 188 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0bd = 189 - JUMP
+0x033, // 0x0be = 190 -
+0x024, // 0x0bf = 191 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0c0 = 192 - NO_OP
+0x000, // 0x0c1 = 193 - NO_OP
+0x0ff, // 0x0c2 = 194 - JUMP
+0x06d, // 0x0c3 = 195 -
+0x0d2, // 0x0c4 = 196 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0c8, // 0x0c5 = 197 -
+0x0ff, // 0x0c6 = 198 - JUMP
+0x0fc, // 0x0c7 = 199 -
+0x0d5, // 0x0c8 = 200 - JUMP_IF_CLOSE_RECEIVED
+0x0fc, // 0x0c9 = 201 -
+0x0d6, // 0x0ca = 202 - JUMP_IF_SYNC_RECEIVED
+0x0ce, // 0x0cb = 203 -
+0x0ff, // 0x0cc = 204 - JUMP
+0x06d, // 0x0cd = 205 -
+0x027, // 0x0ce = 206 - SEND_STP_CLOSE_REQ
+0x000, // 0x0cf = 207 - NO_OP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x000, // 0x0d2 = 210 - NO_OP
+0x0d5, // 0x0d3 = 211 - JUMP_IF_CLOSE_RECEIVED
+0x0fc, // 0x0d4 = 212 -
+0x0bc, // 0x0d5 = 213 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x0d6 = 214 -
+0x0d7, // 0x0d7 = 215 - JUMP_IF_STP_CLOSE_ACK
+0x0fc, // 0x0d8 = 216 -
+0x0ff, // 0x0d9 = 217 - JUMP
+0x0cf, // 0x0da = 218 -
+0x0c3, // 0x0db = 219 - JUMP_IF_SMP_PROTOCOL
+0x0e3, // 0x0dc = 220 -
+0x0d2, // 0x0dd = 221 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0e7, // 0x0de = 222 -
+0x0d1, // 0x0df = 223 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x0ed, // 0x0e0 = 224 -
+0x0ff, // 0x0e1 = 225 - JUMP
+0x06d, // 0x0e2 = 226 -
+0x0c4, // 0x0e3 = 227 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x10f, // 0x0e4 = 228 -
+0x0ff, // 0x0e5 = 229 - JUMP
+0x07e, // 0x0e6 = 230 -
+0x0d5, // 0x0e7 = 231 - JUMP_IF_CLOSE_RECEIVED
+0x0ed, // 0x0e8 = 232 -
+0x0d6, // 0x0e9 = 233 - JUMP_IF_SYNC_RECEIVED
+0x0ef, // 0x0ea = 234 -
+0x0ff, // 0x0eb = 235 - JUMP
+0x0e7, // 0x0ec = 236 -
+0x0ff, // 0x0ed = 237 - JUMP
+0x0fc, // 0x0ee = 238 -
+0x027, // 0x0ef = 239 - SEND_STP_CLOSE_REQ
+0x000, // 0x0f0 = 240 - NO_OP
+0x000, // 0x0f1 = 241 - NO_OP
+0x000, // 0x0f2 = 242 - NO_OP
+0x000, // 0x0f3 = 243 - NO_OP
+0x0d5, // 0x0f4 = 244 - JUMP_IF_CLOSE_RECEIVED
+0x0fc, // 0x0f5 = 245 -
+0x0bc, // 0x0f6 = 246 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x0f7 = 247 -
+0x0d7, // 0x0f8 = 248 - JUMP_IF_STP_CLOSE_ACK
+0x0fc, // 0x0f9 = 249 -
+0x0ff, // 0x0fa = 250 - JUMP
+0x0f0, // 0x0fb = 251 -
+0x004, // 0x0fc = 252 - CLOSE_NORMAL
+0x000, // 0x0fd = 253 - NO_OP
+0x000, // 0x0fe = 254 - NO_OP
+0x000, // 0x0ff = 255 - NO_OP
+0x000, // 0x100 = 256 - NO_OP
+0x0c9, // 0x101 = 257 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x10c, // 0x102 = 258 -
+0x0c0, // 0x103 = 259 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x06d, // 0x104 = 260 -
+0x0bc, // 0x105 = 261 - JUMP_IF_BREAK_RECEIVED
+0x10f, // 0x106 = 262 -
+0x0be, // 0x107 = 263 - JUMP_IF_PHY_READY
+0x0fd, // 0x108 = 264 -
+0x01c, // 0x109 = 265 - SOFT_RESET
+0x0ff, // 0x10a = 266 - JUMP
+0x002, // 0x10b = 267 -
+0x022, // 0x10c = 268 - SEND_CREDIT_BLOCK
+0x0ff, // 0x10d = 269 - JUMP
+0x0fd, // 0x10e = 270 -
+0x007, // 0x10f = 271 - CLOSE_BREAK
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x000, // 0x112 = 274 - NO_OP
+0x000, // 0x113 = 275 - NO_OP
+0x0c0, // 0x114 = 276 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x06d, // 0x115 = 277 -
+0x0be, // 0x116 = 278 - JUMP_IF_PHY_READY
+0x110, // 0x117 = 279 -
+0x01c, // 0x118 = 280 - SOFT_RESET
+0x0ff, // 0x119 = 281 - JUMP
+0x002, // 0x11a = 282 -
+0x005, // 0x11b = 283 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x11c = 284 - JUMP
+0x0fd, // 0x11d = 285 -
+0x006, // 0x11e = 286 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x11f = 287 - JUMP
+0x0fd, // 0x120 = 288 -
+0x0cc, // 0x121 = 289 - JUMP_IF_RX_BUFFER_FULL
+0x06d, // 0x122 = 290 -
+0x0b7, // 0x123 = 291 - JUMP_IF_FLAG_7_SET
+0x128, // 0x124 = 292 -
+0x011, // 0x125 = 293 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x126 = 294 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x127 = 295 - START_ARB_WAIT_TIMER
+0x0cb, // 0x128 = 296 - JUMP_IF_FREEZE_ACTIVE
+0x169, // 0x129 = 297 -
+0x001, // 0x12a = 298 - OPEN_REQUEST
+0x080, // 0x12b = 299 - SET_FLAG
+0x080, // 0x12c = 300 -
+0x090, // 0x12d = 301 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x153, // 0x12e = 302 -
+0x095, // 0x12f = 303 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x158, // 0x130 = 304 -
+0x099, // 0x131 = 305 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x15b, // 0x132 = 306 -
+0x09b, // 0x133 = 307 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x15e, // 0x134 = 308 -
+0x094, // 0x135 = 309 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x128, // 0x136 = 310 -
+0x093, // 0x137 = 311 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x161, // 0x138 = 312 -
+0x09f, // 0x139 = 313 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x164, // 0x13a = 314 -
+0x09a, // 0x13b = 315 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x128, // 0x13c = 316 -
+0x096, // 0x13d = 317 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x128, // 0x13e = 318 -
+0x097, // 0x13f = 319 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x16e, // 0x140 = 320 -
+0x098, // 0x141 = 321 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x128, // 0x142 = 322 -
+0x092, // 0x143 = 323 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x128, // 0x144 = 324 -
+0x0a4, // 0x145 = 325 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x14d, // 0x146 = 326 -
+0x0be, // 0x147 = 327 - JUMP_IF_PHY_READY
+0x12d, // 0x148 = 328 -
+0x01b, // 0x149 = 329 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x14a = 330 - SOFT_RESET
+0x0ff, // 0x14b = 331 - JUMP
+0x002, // 0x14c = 332 -
+0x0a0, // 0x14d = 333 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x153, // 0x14e = 334 -
+0x000, // 0x14f = 335 - NO_OP
+0x000, // 0x150 = 336 - NO_OP
+0x0ff, // 0x151 = 337 - JUMP
+0x06d, // 0x152 = 338 -
+0x013, // 0x153 = 339 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x154 = 340 - CLEAR_FLAG
+0x080, // 0x155 = 341 -
+0x0ff, // 0x156 = 342 - JUMP
+0x033, // 0x157 = 343 -
+0x017, // 0x158 = 344 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x159 = 345 - JUMP
+0x16a, // 0x15a = 346 -
+0x018, // 0x15b = 347 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x15c = 348 - JUMP
+0x16a, // 0x15d = 349 -
+0x01a, // 0x15e = 350 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x15f = 351 - JUMP
+0x16a, // 0x160 = 352 -
+0x015, // 0x161 = 353 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x162 = 354 - JUMP
+0x16a, // 0x163 = 355 -
+0x014, // 0x164 = 356 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x081, // 0x165 = 357 - CLEAR_FLAG
+0x080, // 0x166 = 358 -
+0x0ff, // 0x167 = 359 - JUMP
+0x16a, // 0x168 = 360 -
+0x024, // 0x169 = 361 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x16a = 362 - NO_OP
+0x000, // 0x16b = 363 - NO_OP
+0x0ff, // 0x16c = 364 - JUMP
+0x06d, // 0x16d = 365 -
+0x010, // 0x16e = 366 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x16f = 367 - JUMP
+0x128, // 0x170 = 368 -
+0x000, // 0x171 = 369 - NO_OP
+0x000, // 0x172 = 370 - NO_OP
+0x000, // 0x173 = 371 - NO_OP
+0x000, // 0x174 = 372 - NO_OP
+0x000, // 0x175 = 373 - NO_OP
+0x000, // 0x176 = 374 - NO_OP
+0x000, // 0x177 = 375 - NO_OP
+0x000, // 0x178 = 376 - NO_OP
+0x000, // 0x179 = 377 - NO_OP
+0x000, // 0x17a = 378 - NO_OP
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x000, // 0x17f = 383 - NO_OP
+0x000, // 0x180 = 384 - NO_OP
+0x000, // 0x181 = 385 - NO_OP
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* wcs with A1302_20 */
+bit32 wcsImage_A1302_20[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x002, // 0x003 = 3 -
+0x0be, // 0x004 = 4 - JUMP_IF_PHY_READY
+0x00e, // 0x005 = 5 -
+0x0ae, // 0x006 = 6 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x007 = 7 -
+0x0af, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x017, // 0x009 = 9 -
+0x0ce, // 0x00a = 10 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x00b = 11 -
+0x0ff, // 0x00c = 12 - JUMP
+0x004, // 0x00d = 13 -
+0x00c, // 0x00e = 14 - SEND_ID_FRAME
+0x0ae, // 0x00f = 15 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x010 = 16 -
+0x0af, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01c, // 0x012 = 18 -
+0x0ce, // 0x013 = 19 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x014 = 20 -
+0x0ff, // 0x015 = 21 - JUMP
+0x00f, // 0x016 = 22 -
+0x0be, // 0x017 = 23 - JUMP_IF_PHY_READY
+0x01b, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x000, // 0x01c = 28 - NO_OP
+0x000, // 0x01d = 29 - NO_OP
+0x000, // 0x01e = 30 - NO_OP
+0x000, // 0x01f = 31 - NO_OP
+0x000, // 0x020 = 32 - NO_OP
+0x000, // 0x021 = 33 - NO_OP
+0x0ff, // 0x022 = 34 - JUMP
+0x07e, // 0x023 = 35 -
+0x01c, // 0x024 = 36 - SOFT_RESET
+0x00d, // 0x025 = 37 - PHY_RESET_START
+0x00d, // 0x026 = 38 - PHY_RESET_START
+0x0be, // 0x027 = 39 - JUMP_IF_PHY_READY
+0x027, // 0x028 = 40 -
+0x0be, // 0x029 = 41 - JUMP_IF_PHY_READY
+0x02f, // 0x02a = 42 -
+0x0af, // 0x02b = 43 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x036, // 0x02c = 44 -
+0x0ff, // 0x02d = 45 - JUMP
+0x029, // 0x02e = 46 -
+0x00c, // 0x02f = 47 - SEND_ID_FRAME
+0x0af, // 0x030 = 48 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x039, // 0x031 = 49 -
+0x0ce, // 0x032 = 50 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x024, // 0x033 = 51 -
+0x0ff, // 0x034 = 52 - JUMP
+0x030, // 0x035 = 53 -
+0x00c, // 0x036 = 54 - SEND_ID_FRAME
+0x0ff, // 0x037 = 55 - JUMP
+0x039, // 0x038 = 56 -
+0x000, // 0x039 = 57 - NO_OP
+0x0cb, // 0x03a = 58 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03b = 59 -
+0x0ff, // 0x03c = 60 - JUMP
+0x03a, // 0x03d = 61 -
+0x0cb, // 0x03e = 62 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03f = 63 -
+0x0ff, // 0x040 = 64 - JUMP
+0x07e, // 0x041 = 65 -
+0x000, // 0x042 = 66 - NO_OP
+0x0c9, // 0x043 = 67 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x073, // 0x044 = 68 -
+0x0a5, // 0x045 = 69 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x05c, // 0x046 = 70 -
+0x0a6, // 0x047 = 71 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x063, // 0x048 = 72 -
+0x0a7, // 0x049 = 73 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x066, // 0x04a = 74 -
+0x0a8, // 0x04b = 75 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x070, // 0x04c = 76 -
+0x0aa, // 0x04d = 77 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x06b, // 0x04e = 78 -
+0x0c5, // 0x04f = 79 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x070, // 0x050 = 80 -
+0x0ac, // 0x051 = 81 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x063, // 0x052 = 82 -
+0x0d9, // 0x053 = 83 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_FREEZE_TIMEOUT
+0x070, // 0x054 = 84 -
+0x0ca, // 0x055 = 85 - JUMP_IF_CLOSE_REQ
+0x10d, // 0x056 = 86 -
+0x0be, // 0x057 = 87 - JUMP_IF_PHY_READY
+0x043, // 0x058 = 88 -
+0x01c, // 0x059 = 89 - SOFT_RESET
+0x0ff, // 0x05a = 90 - JUMP
+0x004, // 0x05b = 91 -
+0x01d, // 0x05c = 92 - ADVANCE
+0x0bc, // 0x05d = 93 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x05e = 94 -
+0x0c3, // 0x05f = 95 - JUMP_IF_SMP_PROTOCOL
+0x10d, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x076, // 0x062 = 98 -
+0x01d, // 0x063 = 99 - ADVANCE
+0x0ff, // 0x064 = 100 - JUMP
+0x076, // 0x065 = 101 -
+0x01d, // 0x066 = 102 - ADVANCE
+0x0bc, // 0x067 = 103 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x068 = 104 -
+0x0ff, // 0x069 = 105 - JUMP
+0x12c, // 0x06a = 106 -
+0x01d, // 0x06b = 107 - ADVANCE
+0x0bc, // 0x06c = 108 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x06d = 109 -
+0x0ff, // 0x06e = 110 - JUMP
+0x12f, // 0x06f = 111 -
+0x01d, // 0x070 = 112 - ADVANCE
+0x0ff, // 0x071 = 113 - JUMP
+0x120, // 0x072 = 114 -
+0x022, // 0x073 = 115 - SEND_CREDIT_BLOCK
+0x0ff, // 0x074 = 116 - JUMP
+0x045, // 0x075 = 117 -
+0x083, // 0x076 = 118 - TIMER_START
+0x004, // 0x077 = 119 -
+0x000, // 0x078 = 120 - NO_OP
+0x000, // 0x079 = 121 - NO_OP
+0x0b8, // 0x07a = 122 - JUMP_IF_TIMER_EXPIRED
+0x07e, // 0x07b = 123 -
+0x0ff, // 0x07c = 124 - JUMP
+0x078, // 0x07d = 125 -
+0x0bc, // 0x07e = 126 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x07f = 127 -
+0x0be, // 0x080 = 128 - JUMP_IF_PHY_READY
+0x085, // 0x081 = 129 -
+0x01c, // 0x082 = 130 - SOFT_RESET
+0x0ff, // 0x083 = 131 - JUMP
+0x004, // 0x084 = 132 -
+0x0c8, // 0x085 = 133 - JUMP_IF_HIP_REQ
+0x097, // 0x086 = 134 -
+0x0c6, // 0x087 = 135 - JUMP_IF_SFO_REQ
+0x0a0, // 0x088 = 136 -
+0x0c7, // 0x089 = 137 - JUMP_IF_DOC_REQ
+0x0ab, // 0x08a = 138 -
+0x0a3, // 0x08b = 139 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x0ec, // 0x08c = 140 -
+0x0a2, // 0x08d = 141 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0d5, // 0x08e = 142 -
+0x0c8, // 0x08f = 143 - JUMP_IF_HIP_REQ
+0x0b4, // 0x090 = 144 -
+0x0c6, // 0x091 = 145 - JUMP_IF_SFO_REQ
+0x0b9, // 0x092 = 146 -
+0x0c7, // 0x093 = 147 - JUMP_IF_DOC_REQ
+0x0be, // 0x094 = 148 -
+0x0ff, // 0x095 = 149 - JUMP
+0x07e, // 0x096 = 150 -
+0x028, // 0x097 = 151 - CHECK_HIP
+0x000, // 0x098 = 152 - NO_OP
+0x000, // 0x099 = 153 - NO_OP
+0x000, // 0x09a = 154 - NO_OP
+0x000, // 0x09b = 155 - NO_OP
+0x0d8, // 0x09c = 156 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0b4, // 0x09d = 157 -
+0x0ff, // 0x09e = 158 - JUMP
+0x08b, // 0x09f = 159 -
+0x029, // 0x0a0 = 160 - CHECK_SFO
+0x000, // 0x0a1 = 161 - NO_OP
+0x000, // 0x0a2 = 162 - NO_OP
+0x000, // 0x0a3 = 163 - NO_OP
+0x000, // 0x0a4 = 164 - NO_OP
+0x0d8, // 0x0a5 = 165 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0b9, // 0x0a6 = 166 -
+0x0c7, // 0x0a7 = 167 - JUMP_IF_DOC_REQ
+0x0ab, // 0x0a8 = 168 -
+0x0ff, // 0x0a9 = 169 - JUMP
+0x08b, // 0x0aa = 170 -
+0x02a, // 0x0ab = 171 - CHECK_DOC
+0x000, // 0x0ac = 172 - NO_OP
+0x000, // 0x0ad = 173 - NO_OP
+0x000, // 0x0ae = 174 - NO_OP
+0x000, // 0x0af = 175 - NO_OP
+0x0d8, // 0x0b0 = 176 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0be, // 0x0b1 = 177 -
+0x0ff, // 0x0b2 = 178 - JUMP
+0x08b, // 0x0b3 = 179 -
+0x020, // 0x0b4 = 180 - SELECT_HIP
+0x000, // 0x0b5 = 181 - NO_OP
+0x000, // 0x0b6 = 182 - NO_OP
+0x0ff, // 0x0b7 = 183 - JUMP
+0x0c1, // 0x0b8 = 184 -
+0x01e, // 0x0b9 = 185 - SELECT_SFO
+0x000, // 0x0ba = 186 - NO_OP
+0x000, // 0x0bb = 187 - NO_OP
+0x0ff, // 0x0bc = 188 - JUMP
+0x0c1, // 0x0bd = 189 -
+0x01f, // 0x0be = 190 - SELECT_DOC
+0x000, // 0x0bf = 191 - NO_OP
+0x000, // 0x0c0 = 192 - NO_OP
+0x0a4, // 0x0c1 = 193 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0c5, // 0x0c2 = 194 -
+0x0ff, // 0x0c3 = 195 - JUMP
+0x132, // 0x0c4 = 196 -
+0x0a0, // 0x0c5 = 197 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0cb, // 0x0c6 = 198 -
+0x0a3, // 0x0c7 = 199 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x0ec, // 0x0c8 = 200 -
+0x0ff, // 0x0c9 = 201 - JUMP
+0x10d, // 0x0ca = 202 -
+0x0cb, // 0x0cb = 203 - JUMP_IF_FREEZE_ACTIVE
+0x0d0, // 0x0cc = 204 -
+0x013, // 0x0cd = 205 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0ce = 206 - JUMP
+0x042, // 0x0cf = 207 -
+0x024, // 0x0d0 = 208 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0d1 = 209 - NO_OP
+0x000, // 0x0d2 = 210 - NO_OP
+0x0ff, // 0x0d3 = 211 - JUMP
+0x07e, // 0x0d4 = 212 -
+0x0d2, // 0x0d5 = 213 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0d9, // 0x0d6 = 214 -
+0x0ff, // 0x0d7 = 215 - JUMP
+0x10d, // 0x0d8 = 216 -
+0x0d5, // 0x0d9 = 217 - JUMP_IF_CLOSE_RECEIVED
+0x10d, // 0x0da = 218 -
+0x0d6, // 0x0db = 219 - JUMP_IF_SYNC_RECEIVED
+0x0df, // 0x0dc = 220 -
+0x0ff, // 0x0dd = 221 - JUMP
+0x07e, // 0x0de = 222 -
+0x027, // 0x0df = 223 - SEND_STP_CLOSE_REQ
+0x000, // 0x0e0 = 224 - NO_OP
+0x000, // 0x0e1 = 225 - NO_OP
+0x000, // 0x0e2 = 226 - NO_OP
+0x000, // 0x0e3 = 227 - NO_OP
+0x0d5, // 0x0e4 = 228 - JUMP_IF_CLOSE_RECEIVED
+0x10d, // 0x0e5 = 229 -
+0x0bc, // 0x0e6 = 230 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x0e7 = 231 -
+0x0d7, // 0x0e8 = 232 - JUMP_IF_STP_CLOSE_ACK
+0x10d, // 0x0e9 = 233 -
+0x0ff, // 0x0ea = 234 - JUMP
+0x0e0, // 0x0eb = 235 -
+0x0c3, // 0x0ec = 236 - JUMP_IF_SMP_PROTOCOL
+0x0f4, // 0x0ed = 237 -
+0x0d2, // 0x0ee = 238 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0f8, // 0x0ef = 239 -
+0x0d1, // 0x0f0 = 240 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x0fe, // 0x0f1 = 241 -
+0x0ff, // 0x0f2 = 242 - JUMP
+0x07e, // 0x0f3 = 243 -
+0x0c4, // 0x0f4 = 244 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x120, // 0x0f5 = 245 -
+0x0ff, // 0x0f6 = 246 - JUMP
+0x08f, // 0x0f7 = 247 -
+0x0d5, // 0x0f8 = 248 - JUMP_IF_CLOSE_RECEIVED
+0x0fe, // 0x0f9 = 249 -
+0x0d6, // 0x0fa = 250 - JUMP_IF_SYNC_RECEIVED
+0x100, // 0x0fb = 251 -
+0x0ff, // 0x0fc = 252 - JUMP
+0x0f8, // 0x0fd = 253 -
+0x0ff, // 0x0fe = 254 - JUMP
+0x10d, // 0x0ff = 255 -
+0x027, // 0x100 = 256 - SEND_STP_CLOSE_REQ
+0x000, // 0x101 = 257 - NO_OP
+0x000, // 0x102 = 258 - NO_OP
+0x000, // 0x103 = 259 - NO_OP
+0x000, // 0x104 = 260 - NO_OP
+0x0d5, // 0x105 = 261 - JUMP_IF_CLOSE_RECEIVED
+0x10d, // 0x106 = 262 -
+0x0bc, // 0x107 = 263 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x108 = 264 -
+0x0d7, // 0x109 = 265 - JUMP_IF_STP_CLOSE_ACK
+0x10d, // 0x10a = 266 -
+0x0ff, // 0x10b = 267 - JUMP
+0x101, // 0x10c = 268 -
+0x004, // 0x10d = 269 - CLOSE_NORMAL
+0x000, // 0x10e = 270 - NO_OP
+0x000, // 0x10f = 271 - NO_OP
+0x000, // 0x110 = 272 - NO_OP
+0x000, // 0x111 = 273 - NO_OP
+0x0c9, // 0x112 = 274 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x11d, // 0x113 = 275 -
+0x0c0, // 0x114 = 276 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x07e, // 0x115 = 277 -
+0x0bc, // 0x116 = 278 - JUMP_IF_BREAK_RECEIVED
+0x120, // 0x117 = 279 -
+0x0be, // 0x118 = 280 - JUMP_IF_PHY_READY
+0x10e, // 0x119 = 281 -
+0x01c, // 0x11a = 282 - SOFT_RESET
+0x0ff, // 0x11b = 283 - JUMP
+0x004, // 0x11c = 284 -
+0x022, // 0x11d = 285 - SEND_CREDIT_BLOCK
+0x0ff, // 0x11e = 286 - JUMP
+0x10e, // 0x11f = 287 -
+0x007, // 0x120 = 288 - CLOSE_BREAK
+0x000, // 0x121 = 289 - NO_OP
+0x000, // 0x122 = 290 - NO_OP
+0x000, // 0x123 = 291 - NO_OP
+0x000, // 0x124 = 292 - NO_OP
+0x0c0, // 0x125 = 293 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x07e, // 0x126 = 294 -
+0x0be, // 0x127 = 295 - JUMP_IF_PHY_READY
+0x121, // 0x128 = 296 -
+0x01c, // 0x129 = 297 - SOFT_RESET
+0x0ff, // 0x12a = 298 - JUMP
+0x004, // 0x12b = 299 -
+0x005, // 0x12c = 300 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x12d = 301 - JUMP
+0x10e, // 0x12e = 302 -
+0x006, // 0x12f = 303 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x130 = 304 - JUMP
+0x10e, // 0x131 = 305 -
+0x0cc, // 0x132 = 306 - JUMP_IF_RX_BUFFER_FULL
+0x07e, // 0x133 = 307 -
+0x0b7, // 0x134 = 308 - JUMP_IF_FLAG_7_SET
+0x139, // 0x135 = 309 -
+0x011, // 0x136 = 310 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x137 = 311 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x138 = 312 - START_ARB_WAIT_TIMER
+0x0cb, // 0x139 = 313 - JUMP_IF_FREEZE_ACTIVE
+0x17a, // 0x13a = 314 -
+0x001, // 0x13b = 315 - OPEN_REQUEST
+0x080, // 0x13c = 316 - SET_FLAG
+0x080, // 0x13d = 317 -
+0x090, // 0x13e = 318 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x164, // 0x13f = 319 -
+0x095, // 0x140 = 320 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x169, // 0x141 = 321 -
+0x099, // 0x142 = 322 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x16c, // 0x143 = 323 -
+0x09b, // 0x144 = 324 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x16f, // 0x145 = 325 -
+0x094, // 0x146 = 326 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x139, // 0x147 = 327 -
+0x093, // 0x148 = 328 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x172, // 0x149 = 329 -
+0x09f, // 0x14a = 330 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x175, // 0x14b = 331 -
+0x09a, // 0x14c = 332 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x139, // 0x14d = 333 -
+0x096, // 0x14e = 334 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x139, // 0x14f = 335 -
+0x097, // 0x150 = 336 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x17f, // 0x151 = 337 -
+0x098, // 0x152 = 338 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x139, // 0x153 = 339 -
+0x092, // 0x154 = 340 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x139, // 0x155 = 341 -
+0x0a4, // 0x156 = 342 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x15e, // 0x157 = 343 -
+0x0be, // 0x158 = 344 - JUMP_IF_PHY_READY
+0x13e, // 0x159 = 345 -
+0x01b, // 0x15a = 346 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x15b = 347 - SOFT_RESET
+0x0ff, // 0x15c = 348 - JUMP
+0x004, // 0x15d = 349 -
+0x0a0, // 0x15e = 350 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x164, // 0x15f = 351 -
+0x000, // 0x160 = 352 - NO_OP
+0x000, // 0x161 = 353 - NO_OP
+0x0ff, // 0x162 = 354 - JUMP
+0x07e, // 0x163 = 355 -
+0x013, // 0x164 = 356 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x165 = 357 - CLEAR_FLAG
+0x080, // 0x166 = 358 -
+0x0ff, // 0x167 = 359 - JUMP
+0x042, // 0x168 = 360 -
+0x017, // 0x169 = 361 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x16a = 362 - JUMP
+0x17b, // 0x16b = 363 -
+0x018, // 0x16c = 364 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x16d = 365 - JUMP
+0x17b, // 0x16e = 366 -
+0x01a, // 0x16f = 367 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x170 = 368 - JUMP
+0x17b, // 0x171 = 369 -
+0x015, // 0x172 = 370 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x173 = 371 - JUMP
+0x17b, // 0x174 = 372 -
+0x014, // 0x175 = 373 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x081, // 0x176 = 374 - CLEAR_FLAG
+0x080, // 0x177 = 375 -
+0x0ff, // 0x178 = 376 - JUMP
+0x17b, // 0x179 = 377 -
+0x024, // 0x17a = 378 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x0ff, // 0x17d = 381 - JUMP
+0x07e, // 0x17e = 382 -
+0x010, // 0x17f = 383 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x180 = 384 - JUMP
+0x139, // 0x181 = 385 -
+0x000, // 0x182 = 386 - NO_OP
+0x000, // 0x183 = 387 - NO_OP
+0x000, // 0x184 = 388 - NO_OP
+0x000, // 0x185 = 389 - NO_OP
+0x000, // 0x186 = 390 - NO_OP
+0x000, // 0x187 = 391 - NO_OP
+0x000, // 0x188 = 392 - NO_OP
+0x000, // 0x189 = 393 - NO_OP
+0x000, // 0x18a = 394 - NO_OP
+0x000, // 0x18b = 395 - NO_OP
+0x000, // 0x18c = 396 - NO_OP
+0x000, // 0x18d = 397 - NO_OP
+0x000, // 0x18e = 398 - NO_OP
+0x000, // 0x18f = 399 - NO_OP
+0x000, // 0x190 = 400 - NO_OP
+0x000, // 0x191 = 401 - NO_OP
+0x000, // 0x192 = 402 - NO_OP
+0x000, // 0x193 = 403 - NO_OP
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x000, // 0x198 = 408 - NO_OP
+0x000, // 0x199 = 409 - NO_OP
+0x000, // 0x19a = 410 - NO_OP
+0x000, // 0x19b = 411 - NO_OP
+0x000, // 0x19c = 412 - NO_OP
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+
+/* wcs with A1304_24 and A1305_28 */
+bit32 wcsImage1304_24[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x002, // 0x003 = 3 -
+0x0be, // 0x004 = 4 - JUMP_IF_PHY_READY
+0x00e, // 0x005 = 5 -
+0x0ae, // 0x006 = 6 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x007 = 7 -
+0x0af, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x017, // 0x009 = 9 -
+0x0ce, // 0x00a = 10 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x00b = 11 -
+0x0ff, // 0x00c = 12 - JUMP
+0x004, // 0x00d = 13 -
+0x00c, // 0x00e = 14 - SEND_ID_FRAME
+0x0ae, // 0x00f = 15 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x010 = 16 -
+0x0af, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01c, // 0x012 = 18 -
+0x0ce, // 0x013 = 19 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x014 = 20 -
+0x0ff, // 0x015 = 21 - JUMP
+0x00f, // 0x016 = 22 -
+0x0be, // 0x017 = 23 - JUMP_IF_PHY_READY
+0x01b, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x000, // 0x01c = 28 - NO_OP
+0x000, // 0x01d = 29 - NO_OP
+0x000, // 0x01e = 30 - NO_OP
+0x000, // 0x01f = 31 - NO_OP
+0x000, // 0x020 = 32 - NO_OP
+0x000, // 0x021 = 33 - NO_OP
+0x0ff, // 0x022 = 34 - JUMP
+0x09c, // 0x023 = 35 -
+0x01c, // 0x024 = 36 - SOFT_RESET
+0x00d, // 0x025 = 37 - PHY_RESET_START
+0x00d, // 0x026 = 38 - PHY_RESET_START
+0x0be, // 0x027 = 39 - JUMP_IF_PHY_READY
+0x027, // 0x028 = 40 -
+0x0be, // 0x029 = 41 - JUMP_IF_PHY_READY
+0x02f, // 0x02a = 42 -
+0x0af, // 0x02b = 43 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x036, // 0x02c = 44 -
+0x0ff, // 0x02d = 45 - JUMP
+0x029, // 0x02e = 46 -
+0x00c, // 0x02f = 47 - SEND_ID_FRAME
+0x0af, // 0x030 = 48 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x039, // 0x031 = 49 -
+0x0ce, // 0x032 = 50 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x024, // 0x033 = 51 -
+0x0ff, // 0x034 = 52 - JUMP
+0x030, // 0x035 = 53 -
+0x00c, // 0x036 = 54 - SEND_ID_FRAME
+0x0ff, // 0x037 = 55 - JUMP
+0x039, // 0x038 = 56 -
+0x000, // 0x039 = 57 - NO_OP
+0x0cb, // 0x03a = 58 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03b = 59 -
+0x0ff, // 0x03c = 60 - JUMP
+0x03a, // 0x03d = 61 -
+0x0cb, // 0x03e = 62 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03f = 63 -
+0x0ff, // 0x040 = 64 - JUMP
+0x09c, // 0x041 = 65 -
+0x000, // 0x042 = 66 - NO_OP
+0x0c9, // 0x043 = 67 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x073, // 0x044 = 68 -
+0x0a5, // 0x045 = 69 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x05c, // 0x046 = 70 -
+0x0a6, // 0x047 = 71 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x063, // 0x048 = 72 -
+0x0a7, // 0x049 = 73 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x066, // 0x04a = 74 -
+0x0a8, // 0x04b = 75 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x070, // 0x04c = 76 -
+0x0aa, // 0x04d = 77 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x06b, // 0x04e = 78 -
+0x0c5, // 0x04f = 79 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x070, // 0x050 = 80 -
+0x0ac, // 0x051 = 81 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x063, // 0x052 = 82 -
+0x0d9, // 0x053 = 83 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_FREEZE_TIMEOUT
+0x070, // 0x054 = 84 -
+0x0ca, // 0x055 = 85 - JUMP_IF_CLOSE_REQ
+0x0f0, // 0x056 = 86 -
+0x0be, // 0x057 = 87 - JUMP_IF_PHY_READY
+0x043, // 0x058 = 88 -
+0x01c, // 0x059 = 89 - SOFT_RESET
+0x0ff, // 0x05a = 90 - JUMP
+0x004, // 0x05b = 91 -
+0x01d, // 0x05c = 92 - ADVANCE
+0x0bc, // 0x05d = 93 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x05e = 94 -
+0x0c3, // 0x05f = 95 - JUMP_IF_SMP_PROTOCOL
+0x128, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x076, // 0x062 = 98 -
+0x01d, // 0x063 = 99 - ADVANCE
+0x0ff, // 0x064 = 100 - JUMP
+0x076, // 0x065 = 101 -
+0x01d, // 0x066 = 102 - ADVANCE
+0x0bc, // 0x067 = 103 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x068 = 104 -
+0x0ff, // 0x069 = 105 - JUMP
+0x147, // 0x06a = 106 -
+0x01d, // 0x06b = 107 - ADVANCE
+0x0bc, // 0x06c = 108 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x06d = 109 -
+0x0ff, // 0x06e = 110 - JUMP
+0x14a, // 0x06f = 111 -
+0x01d, // 0x070 = 112 - ADVANCE
+0x0ff, // 0x071 = 113 - JUMP
+0x13b, // 0x072 = 114 -
+0x022, // 0x073 = 115 - SEND_CREDIT_BLOCK
+0x0ff, // 0x074 = 116 - JUMP
+0x045, // 0x075 = 117 -
+0x083, // 0x076 = 118 - TIMER_START
+0x004, // 0x077 = 119 -
+0x0c8, // 0x078 = 120 - JUMP_IF_HIP_REQ
+0x082, // 0x079 = 121 -
+0x0c6, // 0x07a = 122 - JUMP_IF_SFO_REQ
+0x08a, // 0x07b = 123 -
+0x0c7, // 0x07c = 124 - JUMP_IF_DOC_REQ
+0x094, // 0x07d = 125 -
+0x0b8, // 0x07e = 126 - JUMP_IF_TIMER_EXPIRED
+0x09c, // 0x07f = 127 -
+0x0ff, // 0x080 = 128 - JUMP
+0x078, // 0x081 = 129 -
+0x028, // 0x082 = 130 - CHECK_HIP
+0x000, // 0x083 = 131 - NO_OP
+0x000, // 0x084 = 132 - NO_OP
+0x000, // 0x085 = 133 - NO_OP
+0x0d8, // 0x086 = 134 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x07e, // 0x089 = 137 -
+0x029, // 0x08a = 138 - CHECK_SFO
+0x000, // 0x08b = 139 - NO_OP
+0x000, // 0x08c = 140 - NO_OP
+0x000, // 0x08d = 141 - NO_OP
+0x0d8, // 0x08e = 142 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x08f = 143 -
+0x0c7, // 0x090 = 144 - JUMP_IF_DOC_REQ
+0x094, // 0x091 = 145 -
+0x0ff, // 0x092 = 146 - JUMP
+0x07e, // 0x093 = 147 -
+0x02a, // 0x094 = 148 - CHECK_DOC
+0x000, // 0x095 = 149 - NO_OP
+0x000, // 0x096 = 150 - NO_OP
+0x000, // 0x097 = 151 - NO_OP
+0x0d8, // 0x098 = 152 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x099 = 153 -
+0x0ff, // 0x09a = 154 - JUMP
+0x07e, // 0x09b = 155 -
+0x0bc, // 0x09c = 156 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x09d = 157 -
+0x0be, // 0x09e = 158 - JUMP_IF_PHY_READY
+0x0a3, // 0x09f = 159 -
+0x01c, // 0x0a0 = 160 - SOFT_RESET
+0x0ff, // 0x0a1 = 161 - JUMP
+0x004, // 0x0a2 = 162 -
+0x0c8, // 0x0a3 = 163 - JUMP_IF_HIP_REQ
+0x0b5, // 0x0a4 = 164 -
+0x0c6, // 0x0a5 = 165 - JUMP_IF_SFO_REQ
+0x0bd, // 0x0a6 = 166 -
+0x0c7, // 0x0a7 = 167 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0a8 = 168 -
+0x0a3, // 0x0a9 = 169 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0aa = 170 -
+0x0a2, // 0x0ab = 171 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0f0, // 0x0ac = 172 -
+0x0c8, // 0x0ad = 173 - JUMP_IF_HIP_REQ
+0x0cf, // 0x0ae = 174 -
+0x0c6, // 0x0af = 175 - JUMP_IF_SFO_REQ
+0x0d4, // 0x0b0 = 176 -
+0x0c7, // 0x0b1 = 177 - JUMP_IF_DOC_REQ
+0x0d9, // 0x0b2 = 178 -
+0x0ff, // 0x0b3 = 179 - JUMP
+0x09c, // 0x0b4 = 180 -
+0x028, // 0x0b5 = 181 - CHECK_HIP
+0x000, // 0x0b6 = 182 - NO_OP
+0x000, // 0x0b7 = 183 - NO_OP
+0x000, // 0x0b8 = 184 - NO_OP
+0x0d8, // 0x0b9 = 185 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x0ba = 186 -
+0x0ff, // 0x0bb = 187 - JUMP
+0x0a9, // 0x0bc = 188 -
+0x029, // 0x0bd = 189 - CHECK_SFO
+0x000, // 0x0be = 190 - NO_OP
+0x000, // 0x0bf = 191 - NO_OP
+0x000, // 0x0c0 = 192 - NO_OP
+0x0d8, // 0x0c1 = 193 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x0c2 = 194 -
+0x0c7, // 0x0c3 = 195 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0c4 = 196 -
+0x0ff, // 0x0c5 = 197 - JUMP
+0x0a9, // 0x0c6 = 198 -
+0x02a, // 0x0c7 = 199 - CHECK_DOC
+0x000, // 0x0c8 = 200 - NO_OP
+0x000, // 0x0c9 = 201 - NO_OP
+0x000, // 0x0ca = 202 - NO_OP
+0x0d8, // 0x0cb = 203 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x0cc = 204 -
+0x0ff, // 0x0cd = 205 - JUMP
+0x0a9, // 0x0ce = 206 -
+0x020, // 0x0cf = 207 - SELECT_HIP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x0ff, // 0x0d2 = 210 - JUMP
+0x0dc, // 0x0d3 = 211 -
+0x01e, // 0x0d4 = 212 - SELECT_SFO
+0x000, // 0x0d5 = 213 - NO_OP
+0x000, // 0x0d6 = 214 - NO_OP
+0x0ff, // 0x0d7 = 215 - JUMP
+0x0dc, // 0x0d8 = 216 -
+0x01f, // 0x0d9 = 217 - SELECT_DOC
+0x000, // 0x0da = 218 - NO_OP
+0x000, // 0x0db = 219 - NO_OP
+0x0a4, // 0x0dc = 220 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0e0, // 0x0dd = 221 -
+0x0ff, // 0x0de = 222 - JUMP
+0x14d, // 0x0df = 223 -
+0x0a0, // 0x0e0 = 224 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0e6, // 0x0e1 = 225 -
+0x0a3, // 0x0e2 = 226 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0e3 = 227 -
+0x0ff, // 0x0e4 = 228 - JUMP
+0x128, // 0x0e5 = 229 -
+0x0cb, // 0x0e6 = 230 - JUMP_IF_FREEZE_ACTIVE
+0x0eb, // 0x0e7 = 231 -
+0x013, // 0x0e8 = 232 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0e9 = 233 - JUMP
+0x042, // 0x0ea = 234 -
+0x024, // 0x0eb = 235 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0ec = 236 - NO_OP
+0x000, // 0x0ed = 237 - NO_OP
+0x0ff, // 0x0ee = 238 - JUMP
+0x09c, // 0x0ef = 239 -
+0x0d2, // 0x0f0 = 240 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0f4, // 0x0f1 = 241 -
+0x0ff, // 0x0f2 = 242 - JUMP
+0x128, // 0x0f3 = 243 -
+0x0d5, // 0x0f4 = 244 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x0f5 = 245 -
+0x0d6, // 0x0f6 = 246 - JUMP_IF_SYNC_RECEIVED
+0x0fa, // 0x0f7 = 247 -
+0x0ff, // 0x0f8 = 248 - JUMP
+0x09c, // 0x0f9 = 249 -
+0x027, // 0x0fa = 250 - SEND_STP_CLOSE_REQ
+0x000, // 0x0fb = 251 - NO_OP
+0x000, // 0x0fc = 252 - NO_OP
+0x000, // 0x0fd = 253 - NO_OP
+0x000, // 0x0fe = 254 - NO_OP
+0x0d5, // 0x0ff = 255 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x100 = 256 -
+0x0bc, // 0x101 = 257 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x102 = 258 -
+0x0d7, // 0x103 = 259 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x104 = 260 -
+0x0ff, // 0x105 = 261 - JUMP
+0x0fb, // 0x106 = 262 -
+0x0c3, // 0x107 = 263 - JUMP_IF_SMP_PROTOCOL
+0x10f, // 0x108 = 264 -
+0x0d2, // 0x109 = 265 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x113, // 0x10a = 266 -
+0x0d1, // 0x10b = 267 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x119, // 0x10c = 268 -
+0x0ff, // 0x10d = 269 - JUMP
+0x09c, // 0x10e = 270 -
+0x0c4, // 0x10f = 271 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x13b, // 0x110 = 272 -
+0x0ff, // 0x111 = 273 - JUMP
+0x0ad, // 0x112 = 274 -
+0x0d5, // 0x113 = 275 - JUMP_IF_CLOSE_RECEIVED
+0x119, // 0x114 = 276 -
+0x0d6, // 0x115 = 277 - JUMP_IF_SYNC_RECEIVED
+0x11b, // 0x116 = 278 -
+0x0ff, // 0x117 = 279 - JUMP
+0x113, // 0x118 = 280 -
+0x0ff, // 0x119 = 281 - JUMP
+0x128, // 0x11a = 282 -
+0x027, // 0x11b = 283 - SEND_STP_CLOSE_REQ
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x0d5, // 0x120 = 288 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x121 = 289 -
+0x0bc, // 0x122 = 290 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x123 = 291 -
+0x0d7, // 0x124 = 292 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x125 = 293 -
+0x0ff, // 0x126 = 294 - JUMP
+0x11c, // 0x127 = 295 -
+0x004, // 0x128 = 296 - CLOSE_NORMAL
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x0c9, // 0x12d = 301 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x138, // 0x12e = 302 -
+0x0c0, // 0x12f = 303 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x130 = 304 -
+0x0bc, // 0x131 = 305 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x132 = 306 -
+0x0be, // 0x133 = 307 - JUMP_IF_PHY_READY
+0x129, // 0x134 = 308 -
+0x01c, // 0x135 = 309 - SOFT_RESET
+0x0ff, // 0x136 = 310 - JUMP
+0x004, // 0x137 = 311 -
+0x022, // 0x138 = 312 - SEND_CREDIT_BLOCK
+0x0ff, // 0x139 = 313 - JUMP
+0x129, // 0x13a = 314 -
+0x007, // 0x13b = 315 - CLOSE_BREAK
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x0c0, // 0x140 = 320 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x141 = 321 -
+0x0be, // 0x142 = 322 - JUMP_IF_PHY_READY
+0x13c, // 0x143 = 323 -
+0x01c, // 0x144 = 324 - SOFT_RESET
+0x0ff, // 0x145 = 325 - JUMP
+0x004, // 0x146 = 326 -
+0x005, // 0x147 = 327 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x148 = 328 - JUMP
+0x129, // 0x149 = 329 -
+0x006, // 0x14a = 330 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x14b = 331 - JUMP
+0x129, // 0x14c = 332 -
+0x0cc, // 0x14d = 333 - JUMP_IF_RX_BUFFER_FULL
+0x09c, // 0x14e = 334 -
+0x0b7, // 0x14f = 335 - JUMP_IF_FLAG_7_SET
+0x154, // 0x150 = 336 -
+0x011, // 0x151 = 337 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x152 = 338 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x153 = 339 - START_ARB_WAIT_TIMER
+0x0cb, // 0x154 = 340 - JUMP_IF_FREEZE_ACTIVE
+0x195, // 0x155 = 341 -
+0x001, // 0x156 = 342 - OPEN_REQUEST
+0x080, // 0x157 = 343 - SET_FLAG
+0x080, // 0x158 = 344 -
+0x090, // 0x159 = 345 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x17f, // 0x15a = 346 -
+0x095, // 0x15b = 347 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x184, // 0x15c = 348 -
+0x099, // 0x15d = 349 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x187, // 0x15e = 350 -
+0x09b, // 0x15f = 351 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x18a, // 0x160 = 352 -
+0x094, // 0x161 = 353 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x154, // 0x162 = 354 -
+0x093, // 0x163 = 355 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x18d, // 0x164 = 356 -
+0x09f, // 0x165 = 357 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x190, // 0x166 = 358 -
+0x09a, // 0x167 = 359 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x153, // 0x168 = 360 -
+0x096, // 0x169 = 361 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x154, // 0x16a = 362 -
+0x097, // 0x16b = 363 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x19a, // 0x16c = 364 -
+0x098, // 0x16d = 365 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x153, // 0x16e = 366 -
+0x092, // 0x16f = 367 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x154, // 0x170 = 368 -
+0x0a4, // 0x171 = 369 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x179, // 0x172 = 370 -
+0x0be, // 0x173 = 371 - JUMP_IF_PHY_READY
+0x159, // 0x174 = 372 -
+0x01b, // 0x175 = 373 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x176 = 374 - SOFT_RESET
+0x0ff, // 0x177 = 375 - JUMP
+0x004, // 0x178 = 376 -
+0x0a0, // 0x179 = 377 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x17f, // 0x17a = 378 -
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x0ff, // 0x17d = 381 - JUMP
+0x09c, // 0x17e = 382 -
+0x013, // 0x17f = 383 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x180 = 384 - CLEAR_FLAG
+0x080, // 0x181 = 385 -
+0x0ff, // 0x182 = 386 - JUMP
+0x042, // 0x183 = 387 -
+0x017, // 0x184 = 388 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x185 = 389 - JUMP
+0x196, // 0x186 = 390 -
+0x018, // 0x187 = 391 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x188 = 392 - JUMP
+0x196, // 0x189 = 393 -
+0x01a, // 0x18a = 394 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x18b = 395 - JUMP
+0x196, // 0x18c = 396 -
+0x015, // 0x18d = 397 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x18e = 398 - JUMP
+0x196, // 0x18f = 399 -
+0x014, // 0x190 = 400 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x081, // 0x191 = 401 - CLEAR_FLAG
+0x080, // 0x192 = 402 -
+0x0ff, // 0x193 = 403 - JUMP
+0x196, // 0x194 = 404 -
+0x024, // 0x195 = 405 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x0ff, // 0x198 = 408 - JUMP
+0x09c, // 0x199 = 409 -
+0x010, // 0x19a = 410 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x19b = 411 - JUMP
+0x154, // 0x19c = 412 -
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* wcs with A1306_02 and A1307_06 */
+bit32 wcsImageA1306_02[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x002, // 0x003 = 3 -
+0x0be, // 0x004 = 4 - JUMP_IF_PHY_READY
+0x00e, // 0x005 = 5 -
+0x0ae, // 0x006 = 6 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x007 = 7 -
+0x0af, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x017, // 0x009 = 9 -
+0x0ce, // 0x00a = 10 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x00b = 11 -
+0x0ff, // 0x00c = 12 - JUMP
+0x004, // 0x00d = 13 -
+0x00c, // 0x00e = 14 - SEND_ID_FRAME
+0x0ae, // 0x00f = 15 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x010 = 16 -
+0x0af, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01c, // 0x012 = 18 -
+0x0ce, // 0x013 = 19 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x014 = 20 -
+0x0ff, // 0x015 = 21 - JUMP
+0x00f, // 0x016 = 22 -
+0x0be, // 0x017 = 23 - JUMP_IF_PHY_READY
+0x01b, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x000, // 0x01c = 28 - NO_OP
+0x000, // 0x01d = 29 - NO_OP
+0x000, // 0x01e = 30 - NO_OP
+0x000, // 0x01f = 31 - NO_OP
+0x000, // 0x020 = 32 - NO_OP
+0x000, // 0x021 = 33 - NO_OP
+0x0ff, // 0x022 = 34 - JUMP
+0x09c, // 0x023 = 35 -
+0x01c, // 0x024 = 36 - SOFT_RESET
+0x00d, // 0x025 = 37 - PHY_RESET_START
+0x00d, // 0x026 = 38 - PHY_RESET_START
+0x0be, // 0x027 = 39 - JUMP_IF_PHY_READY
+0x027, // 0x028 = 40 -
+0x0be, // 0x029 = 41 - JUMP_IF_PHY_READY
+0x02f, // 0x02a = 42 -
+0x0af, // 0x02b = 43 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x036, // 0x02c = 44 -
+0x0ff, // 0x02d = 45 - JUMP
+0x029, // 0x02e = 46 -
+0x00c, // 0x02f = 47 - SEND_ID_FRAME
+0x0af, // 0x030 = 48 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x039, // 0x031 = 49 -
+0x0ce, // 0x032 = 50 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x024, // 0x033 = 51 -
+0x0ff, // 0x034 = 52 - JUMP
+0x030, // 0x035 = 53 -
+0x00c, // 0x036 = 54 - SEND_ID_FRAME
+0x0ff, // 0x037 = 55 - JUMP
+0x039, // 0x038 = 56 -
+0x000, // 0x039 = 57 - NO_OP
+0x0cb, // 0x03a = 58 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03b = 59 -
+0x0ff, // 0x03c = 60 - JUMP
+0x03a, // 0x03d = 61 -
+0x0cb, // 0x03e = 62 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03f = 63 -
+0x0ff, // 0x040 = 64 - JUMP
+0x09c, // 0x041 = 65 -
+0x000, // 0x042 = 66 - NO_OP
+0x0c9, // 0x043 = 67 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x073, // 0x044 = 68 -
+0x0a5, // 0x045 = 69 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x05c, // 0x046 = 70 -
+0x0a6, // 0x047 = 71 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x063, // 0x048 = 72 -
+0x0a7, // 0x049 = 73 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x066, // 0x04a = 74 -
+0x0a8, // 0x04b = 75 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x070, // 0x04c = 76 -
+0x0aa, // 0x04d = 77 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x06b, // 0x04e = 78 -
+0x0c5, // 0x04f = 79 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x070, // 0x050 = 80 -
+0x0ac, // 0x051 = 81 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x063, // 0x052 = 82 -
+0x0d9, // 0x053 = 83 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_FREEZE_TIMEOUT
+0x070, // 0x054 = 84 -
+0x0ca, // 0x055 = 85 - JUMP_IF_CLOSE_REQ
+0x0f0, // 0x056 = 86 -
+0x0be, // 0x057 = 87 - JUMP_IF_PHY_READY
+0x043, // 0x058 = 88 -
+0x01c, // 0x059 = 89 - SOFT_RESET
+0x0ff, // 0x05a = 90 - JUMP
+0x004, // 0x05b = 91 -
+0x01d, // 0x05c = 92 - ADVANCE
+0x0bc, // 0x05d = 93 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x05e = 94 -
+0x0c3, // 0x05f = 95 - JUMP_IF_SMP_PROTOCOL
+0x128, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x076, // 0x062 = 98 -
+0x01d, // 0x063 = 99 - ADVANCE
+0x0ff, // 0x064 = 100 - JUMP
+0x076, // 0x065 = 101 -
+0x01d, // 0x066 = 102 - ADVANCE
+0x0bc, // 0x067 = 103 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x068 = 104 -
+0x0ff, // 0x069 = 105 - JUMP
+0x147, // 0x06a = 106 -
+0x01d, // 0x06b = 107 - ADVANCE
+0x0bc, // 0x06c = 108 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x06d = 109 -
+0x0ff, // 0x06e = 110 - JUMP
+0x14a, // 0x06f = 111 -
+0x01d, // 0x070 = 112 - ADVANCE
+0x0ff, // 0x071 = 113 - JUMP
+0x13b, // 0x072 = 114 -
+0x022, // 0x073 = 115 - SEND_CREDIT_BLOCK
+0x0ff, // 0x074 = 116 - JUMP
+0x045, // 0x075 = 117 -
+0x083, // 0x076 = 118 - TIMER_START
+0x004, // 0x077 = 119 -
+0x0c8, // 0x078 = 120 - JUMP_IF_HIP_REQ
+0x082, // 0x079 = 121 -
+0x0c6, // 0x07a = 122 - JUMP_IF_SFO_REQ
+0x08a, // 0x07b = 123 -
+0x0c7, // 0x07c = 124 - JUMP_IF_DOC_REQ
+0x094, // 0x07d = 125 -
+0x0b8, // 0x07e = 126 - JUMP_IF_TIMER_EXPIRED
+0x09c, // 0x07f = 127 -
+0x0ff, // 0x080 = 128 - JUMP
+0x078, // 0x081 = 129 -
+0x028, // 0x082 = 130 - CHECK_HIP
+0x000, // 0x083 = 131 - NO_OP
+0x000, // 0x084 = 132 - NO_OP
+0x000, // 0x085 = 133 - NO_OP
+0x0d8, // 0x086 = 134 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x07e, // 0x089 = 137 -
+0x029, // 0x08a = 138 - CHECK_SFO
+0x000, // 0x08b = 139 - NO_OP
+0x000, // 0x08c = 140 - NO_OP
+0x000, // 0x08d = 141 - NO_OP
+0x0d8, // 0x08e = 142 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x08f = 143 -
+0x0c7, // 0x090 = 144 - JUMP_IF_DOC_REQ
+0x094, // 0x091 = 145 -
+0x0ff, // 0x092 = 146 - JUMP
+0x07e, // 0x093 = 147 -
+0x02a, // 0x094 = 148 - CHECK_DOC
+0x000, // 0x095 = 149 - NO_OP
+0x000, // 0x096 = 150 - NO_OP
+0x000, // 0x097 = 151 - NO_OP
+0x0d8, // 0x098 = 152 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x099 = 153 -
+0x0ff, // 0x09a = 154 - JUMP
+0x07e, // 0x09b = 155 -
+0x0bc, // 0x09c = 156 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x09d = 157 -
+0x0be, // 0x09e = 158 - JUMP_IF_PHY_READY
+0x0a3, // 0x09f = 159 -
+0x01c, // 0x0a0 = 160 - SOFT_RESET
+0x0ff, // 0x0a1 = 161 - JUMP
+0x004, // 0x0a2 = 162 -
+0x0c8, // 0x0a3 = 163 - JUMP_IF_HIP_REQ
+0x0b5, // 0x0a4 = 164 -
+0x0c6, // 0x0a5 = 165 - JUMP_IF_SFO_REQ
+0x0bd, // 0x0a6 = 166 -
+0x0c7, // 0x0a7 = 167 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0a8 = 168 -
+0x0a3, // 0x0a9 = 169 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0aa = 170 -
+0x0a2, // 0x0ab = 171 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0f0, // 0x0ac = 172 -
+0x0c8, // 0x0ad = 173 - JUMP_IF_HIP_REQ
+0x0cf, // 0x0ae = 174 -
+0x0c6, // 0x0af = 175 - JUMP_IF_SFO_REQ
+0x0d4, // 0x0b0 = 176 -
+0x0c7, // 0x0b1 = 177 - JUMP_IF_DOC_REQ
+0x0d9, // 0x0b2 = 178 -
+0x0ff, // 0x0b3 = 179 - JUMP
+0x09c, // 0x0b4 = 180 -
+0x028, // 0x0b5 = 181 - CHECK_HIP
+0x000, // 0x0b6 = 182 - NO_OP
+0x000, // 0x0b7 = 183 - NO_OP
+0x000, // 0x0b8 = 184 - NO_OP
+0x0d8, // 0x0b9 = 185 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x0ba = 186 -
+0x0ff, // 0x0bb = 187 - JUMP
+0x0a9, // 0x0bc = 188 -
+0x029, // 0x0bd = 189 - CHECK_SFO
+0x000, // 0x0be = 190 - NO_OP
+0x000, // 0x0bf = 191 - NO_OP
+0x000, // 0x0c0 = 192 - NO_OP
+0x0d8, // 0x0c1 = 193 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x0c2 = 194 -
+0x0c7, // 0x0c3 = 195 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0c4 = 196 -
+0x0ff, // 0x0c5 = 197 - JUMP
+0x0a9, // 0x0c6 = 198 -
+0x02a, // 0x0c7 = 199 - CHECK_DOC
+0x000, // 0x0c8 = 200 - NO_OP
+0x000, // 0x0c9 = 201 - NO_OP
+0x000, // 0x0ca = 202 - NO_OP
+0x0d8, // 0x0cb = 203 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x0cc = 204 -
+0x0ff, // 0x0cd = 205 - JUMP
+0x0a9, // 0x0ce = 206 -
+0x020, // 0x0cf = 207 - SELECT_HIP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x0ff, // 0x0d2 = 210 - JUMP
+0x0dc, // 0x0d3 = 211 -
+0x01e, // 0x0d4 = 212 - SELECT_SFO
+0x000, // 0x0d5 = 213 - NO_OP
+0x000, // 0x0d6 = 214 - NO_OP
+0x0ff, // 0x0d7 = 215 - JUMP
+0x0dc, // 0x0d8 = 216 -
+0x01f, // 0x0d9 = 217 - SELECT_DOC
+0x000, // 0x0da = 218 - NO_OP
+0x000, // 0x0db = 219 - NO_OP
+0x0a4, // 0x0dc = 220 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0e0, // 0x0dd = 221 -
+0x0ff, // 0x0de = 222 - JUMP
+0x14d, // 0x0df = 223 -
+0x0a0, // 0x0e0 = 224 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0e6, // 0x0e1 = 225 -
+0x0a3, // 0x0e2 = 226 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0e3 = 227 -
+0x0ff, // 0x0e4 = 228 - JUMP
+0x128, // 0x0e5 = 229 -
+0x0cb, // 0x0e6 = 230 - JUMP_IF_FREEZE_ACTIVE
+0x0eb, // 0x0e7 = 231 -
+0x013, // 0x0e8 = 232 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0e9 = 233 - JUMP
+0x042, // 0x0ea = 234 -
+0x024, // 0x0eb = 235 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0ec = 236 - NO_OP
+0x000, // 0x0ed = 237 - NO_OP
+0x0ff, // 0x0ee = 238 - JUMP
+0x09c, // 0x0ef = 239 -
+0x0d2, // 0x0f0 = 240 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0f4, // 0x0f1 = 241 -
+0x0ff, // 0x0f2 = 242 - JUMP
+0x128, // 0x0f3 = 243 -
+0x0d5, // 0x0f4 = 244 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x0f5 = 245 -
+0x0d6, // 0x0f6 = 246 - JUMP_IF_SYNC_RECEIVED
+0x0fa, // 0x0f7 = 247 -
+0x0ff, // 0x0f8 = 248 - JUMP
+0x09c, // 0x0f9 = 249 -
+0x027, // 0x0fa = 250 - SEND_STP_CLOSE_REQ
+0x000, // 0x0fb = 251 - NO_OP
+0x000, // 0x0fc = 252 - NO_OP
+0x000, // 0x0fd = 253 - NO_OP
+0x000, // 0x0fe = 254 - NO_OP
+0x0d5, // 0x0ff = 255 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x100 = 256 -
+0x0bc, // 0x101 = 257 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x102 = 258 -
+0x0d7, // 0x103 = 259 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x104 = 260 -
+0x0ff, // 0x105 = 261 - JUMP
+0x0fb, // 0x106 = 262 -
+0x0c3, // 0x107 = 263 - JUMP_IF_SMP_PROTOCOL
+0x10f, // 0x108 = 264 -
+0x0d2, // 0x109 = 265 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x113, // 0x10a = 266 -
+0x0d1, // 0x10b = 267 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x119, // 0x10c = 268 -
+0x0ff, // 0x10d = 269 - JUMP
+0x09c, // 0x10e = 270 -
+0x0c4, // 0x10f = 271 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x13b, // 0x110 = 272 -
+0x0ff, // 0x111 = 273 - JUMP
+0x0ad, // 0x112 = 274 -
+0x0d5, // 0x113 = 275 - JUMP_IF_CLOSE_RECEIVED
+0x119, // 0x114 = 276 -
+0x0d6, // 0x115 = 277 - JUMP_IF_SYNC_RECEIVED
+0x11b, // 0x116 = 278 -
+0x0ff, // 0x117 = 279 - JUMP
+0x113, // 0x118 = 280 -
+0x0ff, // 0x119 = 281 - JUMP
+0x128, // 0x11a = 282 -
+0x027, // 0x11b = 283 - SEND_STP_CLOSE_REQ
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x0d5, // 0x120 = 288 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x121 = 289 -
+0x0bc, // 0x122 = 290 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x123 = 291 -
+0x0d7, // 0x124 = 292 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x125 = 293 -
+0x0ff, // 0x126 = 294 - JUMP
+0x11c, // 0x127 = 295 -
+0x004, // 0x128 = 296 - CLOSE_NORMAL
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x0c9, // 0x12d = 301 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x138, // 0x12e = 302 -
+0x0c0, // 0x12f = 303 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x130 = 304 -
+0x0bc, // 0x131 = 305 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x132 = 306 -
+0x0be, // 0x133 = 307 - JUMP_IF_PHY_READY
+0x129, // 0x134 = 308 -
+0x01c, // 0x135 = 309 - SOFT_RESET
+0x0ff, // 0x136 = 310 - JUMP
+0x004, // 0x137 = 311 -
+0x022, // 0x138 = 312 - SEND_CREDIT_BLOCK
+0x0ff, // 0x139 = 313 - JUMP
+0x129, // 0x13a = 314 -
+0x007, // 0x13b = 315 - CLOSE_BREAK
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x0c0, // 0x140 = 320 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x141 = 321 -
+0x0be, // 0x142 = 322 - JUMP_IF_PHY_READY
+0x13c, // 0x143 = 323 -
+0x01c, // 0x144 = 324 - SOFT_RESET
+0x0ff, // 0x145 = 325 - JUMP
+0x004, // 0x146 = 326 -
+0x005, // 0x147 = 327 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x148 = 328 - JUMP
+0x129, // 0x149 = 329 -
+0x006, // 0x14a = 330 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x14b = 331 - JUMP
+0x129, // 0x14c = 332 -
+0x0cc, // 0x14d = 333 - JUMP_IF_RX_BUFFER_FULL
+0x09c, // 0x14e = 334 -
+0x0b7, // 0x14f = 335 - JUMP_IF_FLAG_7_SET
+0x154, // 0x150 = 336 -
+0x011, // 0x151 = 337 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x152 = 338 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x153 = 339 - START_ARB_WAIT_TIMER
+0x0cb, // 0x154 = 340 - JUMP_IF_FREEZE_ACTIVE
+0x193, // 0x155 = 341 -
+0x001, // 0x156 = 342 - OPEN_REQUEST
+0x080, // 0x157 = 343 - SET_FLAG
+0x080, // 0x158 = 344 -
+0x090, // 0x159 = 345 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x17f, // 0x15a = 346 -
+0x095, // 0x15b = 347 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x184, // 0x15c = 348 -
+0x099, // 0x15d = 349 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x187, // 0x15e = 350 -
+0x09b, // 0x15f = 351 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x18a, // 0x160 = 352 -
+0x094, // 0x161 = 353 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x154, // 0x162 = 354 -
+0x093, // 0x163 = 355 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x18d, // 0x164 = 356 -
+0x09f, // 0x165 = 357 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x190, // 0x166 = 358 -
+0x09a, // 0x167 = 359 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x153, // 0x168 = 360 -
+0x096, // 0x169 = 361 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x154, // 0x16a = 362 -
+0x097, // 0x16b = 363 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x19a, // 0x16c = 364 -
+0x098, // 0x16d = 365 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x153, // 0x16e = 366 -
+0x092, // 0x16f = 367 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x154, // 0x170 = 368 -
+0x0a4, // 0x171 = 369 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x179, // 0x172 = 370 -
+0x0be, // 0x173 = 371 - JUMP_IF_PHY_READY
+0x159, // 0x174 = 372 -
+0x01b, // 0x175 = 373 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x176 = 374 - SOFT_RESET
+0x0ff, // 0x177 = 375 - JUMP
+0x004, // 0x178 = 376 -
+0x0a0, // 0x179 = 377 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x17f, // 0x17a = 378 -
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x0ff, // 0x17d = 381 - JUMP
+0x09c, // 0x17e = 382 -
+0x013, // 0x17f = 383 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x180 = 384 - CLEAR_FLAG
+0x080, // 0x181 = 385 -
+0x0ff, // 0x182 = 386 - JUMP
+0x042, // 0x183 = 387 -
+0x017, // 0x184 = 388 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x185 = 389 - JUMP
+0x194, // 0x186 = 390 -
+0x018, // 0x187 = 391 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x188 = 392 - JUMP
+0x194, // 0x189 = 393 -
+0x01a, // 0x18a = 394 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x18b = 395 - JUMP
+0x194, // 0x18c = 396 -
+0x015, // 0x18d = 397 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x18e = 398 - JUMP
+0x194, // 0x18f = 399 -
+0x014, // 0x190 = 400 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x191 = 401 - JUMP
+0x194, // 0x192 = 402 -
+0x024, // 0x193 = 403 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x081, // 0x196 = 406 - CLEAR_FLAG
+0x080, // 0x197 = 407 -
+0x0ff, // 0x198 = 408 - JUMP
+0x09c, // 0x199 = 409 -
+0x010, // 0x19a = 410 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x19b = 411 - JUMP
+0x154, // 0x19c = 412 -
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* for A1307_09 */
+bit32 wcsImageA1307_09[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x002, // 0x003 = 3 -
+0x0be, // 0x004 = 4 - JUMP_IF_PHY_READY
+0x00e, // 0x005 = 5 -
+0x0ae, // 0x006 = 6 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x007 = 7 -
+0x0af, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x017, // 0x009 = 9 -
+0x0ce, // 0x00a = 10 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x00b = 11 -
+0x0ff, // 0x00c = 12 - JUMP
+0x004, // 0x00d = 13 -
+0x00c, // 0x00e = 14 - SEND_ID_FRAME
+0x0ae, // 0x00f = 15 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x010 = 16 -
+0x0af, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01c, // 0x012 = 18 -
+0x0ce, // 0x013 = 19 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x014 = 20 -
+0x0ff, // 0x015 = 21 - JUMP
+0x00f, // 0x016 = 22 -
+0x0be, // 0x017 = 23 - JUMP_IF_PHY_READY
+0x01b, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x000, // 0x01c = 28 - NO_OP
+0x000, // 0x01d = 29 - NO_OP
+0x000, // 0x01e = 30 - NO_OP
+0x000, // 0x01f = 31 - NO_OP
+0x000, // 0x020 = 32 - NO_OP
+0x000, // 0x021 = 33 - NO_OP
+0x0ff, // 0x022 = 34 - JUMP
+0x09c, // 0x023 = 35 -
+0x01c, // 0x024 = 36 - SOFT_RESET
+0x00d, // 0x025 = 37 - PHY_RESET_START
+0x00d, // 0x026 = 38 - PHY_RESET_START
+0x0be, // 0x027 = 39 - JUMP_IF_PHY_READY
+0x027, // 0x028 = 40 -
+0x0be, // 0x029 = 41 - JUMP_IF_PHY_READY
+0x02f, // 0x02a = 42 -
+0x0af, // 0x02b = 43 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x036, // 0x02c = 44 -
+0x0ff, // 0x02d = 45 - JUMP
+0x029, // 0x02e = 46 -
+0x00c, // 0x02f = 47 - SEND_ID_FRAME
+0x0af, // 0x030 = 48 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x039, // 0x031 = 49 -
+0x0ce, // 0x032 = 50 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x024, // 0x033 = 51 -
+0x0ff, // 0x034 = 52 - JUMP
+0x030, // 0x035 = 53 -
+0x00c, // 0x036 = 54 - SEND_ID_FRAME
+0x0ff, // 0x037 = 55 - JUMP
+0x039, // 0x038 = 56 -
+0x000, // 0x039 = 57 - NO_OP
+0x0cb, // 0x03a = 58 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03b = 59 -
+0x0ff, // 0x03c = 60 - JUMP
+0x03a, // 0x03d = 61 -
+0x0cb, // 0x03e = 62 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03f = 63 -
+0x0ff, // 0x040 = 64 - JUMP
+0x09c, // 0x041 = 65 -
+0x000, // 0x042 = 66 - NO_OP
+0x0c9, // 0x043 = 67 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x073, // 0x044 = 68 -
+0x0a5, // 0x045 = 69 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x05c, // 0x046 = 70 -
+0x0a6, // 0x047 = 71 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x063, // 0x048 = 72 -
+0x0a7, // 0x049 = 73 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x066, // 0x04a = 74 -
+0x0a8, // 0x04b = 75 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x070, // 0x04c = 76 -
+0x0aa, // 0x04d = 77 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x06b, // 0x04e = 78 -
+0x0c5, // 0x04f = 79 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x070, // 0x050 = 80 -
+0x0ac, // 0x051 = 81 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x063, // 0x052 = 82 -
+0x0d9, // 0x053 = 83 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_FREEZE_TIMEOUT
+0x070, // 0x054 = 84 -
+0x0ca, // 0x055 = 85 - JUMP_IF_CLOSE_REQ
+0x0f0, // 0x056 = 86 -
+0x0be, // 0x057 = 87 - JUMP_IF_PHY_READY
+0x043, // 0x058 = 88 -
+0x01c, // 0x059 = 89 - SOFT_RESET
+0x0ff, // 0x05a = 90 - JUMP
+0x004, // 0x05b = 91 -
+0x01d, // 0x05c = 92 - ADVANCE
+0x0bc, // 0x05d = 93 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x05e = 94 -
+0x0c3, // 0x05f = 95 - JUMP_IF_SMP_PROTOCOL
+0x128, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x076, // 0x062 = 98 -
+0x01d, // 0x063 = 99 - ADVANCE
+0x0ff, // 0x064 = 100 - JUMP
+0x076, // 0x065 = 101 -
+0x01d, // 0x066 = 102 - ADVANCE
+0x0bc, // 0x067 = 103 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x068 = 104 -
+0x0ff, // 0x069 = 105 - JUMP
+0x147, // 0x06a = 106 -
+0x01d, // 0x06b = 107 - ADVANCE
+0x0bc, // 0x06c = 108 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x06d = 109 -
+0x0ff, // 0x06e = 110 - JUMP
+0x14a, // 0x06f = 111 -
+0x01d, // 0x070 = 112 - ADVANCE
+0x0ff, // 0x071 = 113 - JUMP
+0x13b, // 0x072 = 114 -
+0x022, // 0x073 = 115 - SEND_CREDIT_BLOCK
+0x0ff, // 0x074 = 116 - JUMP
+0x045, // 0x075 = 117 -
+0x083, // 0x076 = 118 - TIMER_START
+0x004, // 0x077 = 119 -
+0x0c8, // 0x078 = 120 - JUMP_IF_HIP_REQ
+0x082, // 0x079 = 121 -
+0x0c6, // 0x07a = 122 - JUMP_IF_SFO_REQ
+0x08a, // 0x07b = 123 -
+0x0c7, // 0x07c = 124 - JUMP_IF_DOC_REQ
+0x094, // 0x07d = 125 -
+0x0b8, // 0x07e = 126 - JUMP_IF_TIMER_EXPIRED
+0x09c, // 0x07f = 127 -
+0x0ff, // 0x080 = 128 - JUMP
+0x078, // 0x081 = 129 -
+0x028, // 0x082 = 130 - CHECK_HIP
+0x000, // 0x083 = 131 - NO_OP
+0x000, // 0x084 = 132 - NO_OP
+0x000, // 0x085 = 133 - NO_OP
+0x0d8, // 0x086 = 134 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x07e, // 0x089 = 137 -
+0x029, // 0x08a = 138 - CHECK_SFO
+0x000, // 0x08b = 139 - NO_OP
+0x000, // 0x08c = 140 - NO_OP
+0x000, // 0x08d = 141 - NO_OP
+0x0d8, // 0x08e = 142 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x08f = 143 -
+0x0c7, // 0x090 = 144 - JUMP_IF_DOC_REQ
+0x094, // 0x091 = 145 -
+0x0ff, // 0x092 = 146 - JUMP
+0x07e, // 0x093 = 147 -
+0x02a, // 0x094 = 148 - CHECK_DOC
+0x000, // 0x095 = 149 - NO_OP
+0x000, // 0x096 = 150 - NO_OP
+0x000, // 0x097 = 151 - NO_OP
+0x0d8, // 0x098 = 152 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x099 = 153 -
+0x0ff, // 0x09a = 154 - JUMP
+0x07e, // 0x09b = 155 -
+0x0bc, // 0x09c = 156 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x09d = 157 -
+0x0be, // 0x09e = 158 - JUMP_IF_PHY_READY
+0x0a3, // 0x09f = 159 -
+0x01c, // 0x0a0 = 160 - SOFT_RESET
+0x0ff, // 0x0a1 = 161 - JUMP
+0x004, // 0x0a2 = 162 -
+0x0c8, // 0x0a3 = 163 - JUMP_IF_HIP_REQ
+0x0b5, // 0x0a4 = 164 -
+0x0c6, // 0x0a5 = 165 - JUMP_IF_SFO_REQ
+0x0bd, // 0x0a6 = 166 -
+0x0c7, // 0x0a7 = 167 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0a8 = 168 -
+0x0a3, // 0x0a9 = 169 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0aa = 170 -
+0x0a2, // 0x0ab = 171 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0f0, // 0x0ac = 172 -
+0x0c8, // 0x0ad = 173 - JUMP_IF_HIP_REQ
+0x0cf, // 0x0ae = 174 -
+0x0c6, // 0x0af = 175 - JUMP_IF_SFO_REQ
+0x0d4, // 0x0b0 = 176 -
+0x0c7, // 0x0b1 = 177 - JUMP_IF_DOC_REQ
+0x0d9, // 0x0b2 = 178 -
+0x0ff, // 0x0b3 = 179 - JUMP
+0x09c, // 0x0b4 = 180 -
+0x028, // 0x0b5 = 181 - CHECK_HIP
+0x000, // 0x0b6 = 182 - NO_OP
+0x000, // 0x0b7 = 183 - NO_OP
+0x000, // 0x0b8 = 184 - NO_OP
+0x0d8, // 0x0b9 = 185 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x0ba = 186 -
+0x0ff, // 0x0bb = 187 - JUMP
+0x0a9, // 0x0bc = 188 -
+0x029, // 0x0bd = 189 - CHECK_SFO
+0x000, // 0x0be = 190 - NO_OP
+0x000, // 0x0bf = 191 - NO_OP
+0x000, // 0x0c0 = 192 - NO_OP
+0x0d8, // 0x0c1 = 193 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x0c2 = 194 -
+0x0c7, // 0x0c3 = 195 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0c4 = 196 -
+0x0ff, // 0x0c5 = 197 - JUMP
+0x0a9, // 0x0c6 = 198 -
+0x02a, // 0x0c7 = 199 - CHECK_DOC
+0x000, // 0x0c8 = 200 - NO_OP
+0x000, // 0x0c9 = 201 - NO_OP
+0x000, // 0x0ca = 202 - NO_OP
+0x0d8, // 0x0cb = 203 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x0cc = 204 -
+0x0ff, // 0x0cd = 205 - JUMP
+0x0a9, // 0x0ce = 206 -
+0x020, // 0x0cf = 207 - SELECT_HIP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x0ff, // 0x0d2 = 210 - JUMP
+0x0dc, // 0x0d3 = 211 -
+0x01e, // 0x0d4 = 212 - SELECT_SFO
+0x000, // 0x0d5 = 213 - NO_OP
+0x000, // 0x0d6 = 214 - NO_OP
+0x0ff, // 0x0d7 = 215 - JUMP
+0x0dc, // 0x0d8 = 216 -
+0x01f, // 0x0d9 = 217 - SELECT_DOC
+0x000, // 0x0da = 218 - NO_OP
+0x000, // 0x0db = 219 - NO_OP
+0x0a4, // 0x0dc = 220 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0e0, // 0x0dd = 221 -
+0x0ff, // 0x0de = 222 - JUMP
+0x14d, // 0x0df = 223 -
+0x0a0, // 0x0e0 = 224 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0e6, // 0x0e1 = 225 -
+0x0a3, // 0x0e2 = 226 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0e3 = 227 -
+0x0ff, // 0x0e4 = 228 - JUMP
+0x0f0, // 0x0e5 = 229 -
+0x0cb, // 0x0e6 = 230 - JUMP_IF_FREEZE_ACTIVE
+0x0eb, // 0x0e7 = 231 -
+0x013, // 0x0e8 = 232 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0e9 = 233 - JUMP
+0x042, // 0x0ea = 234 -
+0x024, // 0x0eb = 235 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0ec = 236 - NO_OP
+0x000, // 0x0ed = 237 - NO_OP
+0x0ff, // 0x0ee = 238 - JUMP
+0x09c, // 0x0ef = 239 -
+0x0d2, // 0x0f0 = 240 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0f4, // 0x0f1 = 241 -
+0x0ff, // 0x0f2 = 242 - JUMP
+0x128, // 0x0f3 = 243 -
+0x0d5, // 0x0f4 = 244 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x0f5 = 245 -
+0x0d6, // 0x0f6 = 246 - JUMP_IF_SYNC_RECEIVED
+0x0fa, // 0x0f7 = 247 -
+0x0ff, // 0x0f8 = 248 - JUMP
+0x09c, // 0x0f9 = 249 -
+0x027, // 0x0fa = 250 - SEND_STP_CLOSE_REQ
+0x000, // 0x0fb = 251 - NO_OP
+0x000, // 0x0fc = 252 - NO_OP
+0x000, // 0x0fd = 253 - NO_OP
+0x000, // 0x0fe = 254 - NO_OP
+0x0d5, // 0x0ff = 255 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x100 = 256 -
+0x0bc, // 0x101 = 257 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x102 = 258 -
+0x0d7, // 0x103 = 259 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x104 = 260 -
+0x0ff, // 0x105 = 261 - JUMP
+0x0fb, // 0x106 = 262 -
+0x0c3, // 0x107 = 263 - JUMP_IF_SMP_PROTOCOL
+0x10f, // 0x108 = 264 -
+0x0d2, // 0x109 = 265 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x113, // 0x10a = 266 -
+0x0d1, // 0x10b = 267 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x119, // 0x10c = 268 -
+0x0ff, // 0x10d = 269 - JUMP
+0x09c, // 0x10e = 270 -
+0x0c4, // 0x10f = 271 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x13b, // 0x110 = 272 -
+0x0ff, // 0x111 = 273 - JUMP
+0x0ad, // 0x112 = 274 -
+0x0d5, // 0x113 = 275 - JUMP_IF_CLOSE_RECEIVED
+0x119, // 0x114 = 276 -
+0x0d6, // 0x115 = 277 - JUMP_IF_SYNC_RECEIVED
+0x11b, // 0x116 = 278 -
+0x0ff, // 0x117 = 279 - JUMP
+0x113, // 0x118 = 280 -
+0x0ff, // 0x119 = 281 - JUMP
+0x128, // 0x11a = 282 -
+0x027, // 0x11b = 283 - SEND_STP_CLOSE_REQ
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x0d5, // 0x120 = 288 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x121 = 289 -
+0x0bc, // 0x122 = 290 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x123 = 291 -
+0x0d7, // 0x124 = 292 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x125 = 293 -
+0x0ff, // 0x126 = 294 - JUMP
+0x11c, // 0x127 = 295 -
+0x004, // 0x128 = 296 - CLOSE_NORMAL
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x0c9, // 0x12d = 301 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x138, // 0x12e = 302 -
+0x0c0, // 0x12f = 303 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x130 = 304 -
+0x0bc, // 0x131 = 305 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x132 = 306 -
+0x0be, // 0x133 = 307 - JUMP_IF_PHY_READY
+0x129, // 0x134 = 308 -
+0x01c, // 0x135 = 309 - SOFT_RESET
+0x0ff, // 0x136 = 310 - JUMP
+0x004, // 0x137 = 311 -
+0x022, // 0x138 = 312 - SEND_CREDIT_BLOCK
+0x0ff, // 0x139 = 313 - JUMP
+0x129, // 0x13a = 314 -
+0x007, // 0x13b = 315 - CLOSE_BREAK
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x0c0, // 0x140 = 320 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x141 = 321 -
+0x0be, // 0x142 = 322 - JUMP_IF_PHY_READY
+0x13c, // 0x143 = 323 -
+0x01c, // 0x144 = 324 - SOFT_RESET
+0x0ff, // 0x145 = 325 - JUMP
+0x004, // 0x146 = 326 -
+0x005, // 0x147 = 327 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x148 = 328 - JUMP
+0x129, // 0x149 = 329 -
+0x006, // 0x14a = 330 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x14b = 331 - JUMP
+0x129, // 0x14c = 332 -
+0x0cc, // 0x14d = 333 - JUMP_IF_RX_BUFFER_FULL
+0x09c, // 0x14e = 334 -
+0x0b7, // 0x14f = 335 - JUMP_IF_FLAG_7_SET
+0x154, // 0x150 = 336 -
+0x011, // 0x151 = 337 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x152 = 338 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x153 = 339 - START_ARB_WAIT_TIMER
+0x0cb, // 0x154 = 340 - JUMP_IF_FREEZE_ACTIVE
+0x193, // 0x155 = 341 -
+0x001, // 0x156 = 342 - OPEN_REQUEST
+0x080, // 0x157 = 343 - SET_FLAG
+0x080, // 0x158 = 344 -
+0x090, // 0x159 = 345 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x17f, // 0x15a = 346 -
+0x095, // 0x15b = 347 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x184, // 0x15c = 348 -
+0x099, // 0x15d = 349 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x187, // 0x15e = 350 -
+0x09b, // 0x15f = 351 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x18a, // 0x160 = 352 -
+0x094, // 0x161 = 353 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x154, // 0x162 = 354 -
+0x093, // 0x163 = 355 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x18d, // 0x164 = 356 -
+0x09f, // 0x165 = 357 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x190, // 0x166 = 358 -
+0x09a, // 0x167 = 359 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x153, // 0x168 = 360 -
+0x096, // 0x169 = 361 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x154, // 0x16a = 362 -
+0x097, // 0x16b = 363 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x19a, // 0x16c = 364 -
+0x098, // 0x16d = 365 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x153, // 0x16e = 366 -
+0x092, // 0x16f = 367 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x154, // 0x170 = 368 -
+0x0a4, // 0x171 = 369 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x179, // 0x172 = 370 -
+0x0be, // 0x173 = 371 - JUMP_IF_PHY_READY
+0x159, // 0x174 = 372 -
+0x01b, // 0x175 = 373 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x176 = 374 - SOFT_RESET
+0x0ff, // 0x177 = 375 - JUMP
+0x004, // 0x178 = 376 -
+0x0a0, // 0x179 = 377 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x17f, // 0x17a = 378 -
+0x000, // 0x17b = 379 - NO_OP
+0x000, // 0x17c = 380 - NO_OP
+0x0ff, // 0x17d = 381 - JUMP
+0x09c, // 0x17e = 382 -
+0x013, // 0x17f = 383 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x180 = 384 - CLEAR_FLAG
+0x080, // 0x181 = 385 -
+0x0ff, // 0x182 = 386 - JUMP
+0x042, // 0x183 = 387 -
+0x017, // 0x184 = 388 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x185 = 389 - JUMP
+0x194, // 0x186 = 390 -
+0x018, // 0x187 = 391 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x188 = 392 - JUMP
+0x194, // 0x189 = 393 -
+0x01a, // 0x18a = 394 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x18b = 395 - JUMP
+0x194, // 0x18c = 396 -
+0x015, // 0x18d = 397 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x18e = 398 - JUMP
+0x194, // 0x18f = 399 -
+0x014, // 0x190 = 400 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x191 = 401 - JUMP
+0x194, // 0x192 = 402 -
+0x024, // 0x193 = 403 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x194 = 404 - NO_OP
+0x000, // 0x195 = 405 - NO_OP
+0x081, // 0x196 = 406 - CLEAR_FLAG
+0x080, // 0x197 = 407 -
+0x0ff, // 0x198 = 408 - JUMP
+0x09c, // 0x199 = 409 -
+0x010, // 0x19a = 410 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x19b = 411 - JUMP
+0x154, // 0x19c = 412 -
+0x000, // 0x19d = 413 - NO_OP
+0x000, // 0x19e = 414 - NO_OP
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
+
+/* for A1407_10, A1410_15, A1412_19, A1415_19*/
+bit32 wcsImage[] =
+{
+0x00d, // 00000 = 0 - PHY_RESET_START
+0x00d, // 0x001 = 1 - PHY_RESET_START
+0x0be, // 0x002 = 2 - JUMP_IF_PHY_READY
+0x002, // 0x003 = 3 -
+0x0be, // 0x004 = 4 - JUMP_IF_PHY_READY
+0x00e, // 0x005 = 5 -
+0x0ae, // 0x006 = 6 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x007 = 7 -
+0x0af, // 0x008 = 8 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x017, // 0x009 = 9 -
+0x0ce, // 0x00a = 10 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x00b = 11 -
+0x0ff, // 0x00c = 12 - JUMP
+0x004, // 0x00d = 13 -
+0x00c, // 0x00e = 14 - SEND_ID_FRAME
+0x0ae, // 0x00f = 15 - JUMP_IF_HARD_RESET_PRIMITIVE
+0x024, // 0x010 = 16 -
+0x0af, // 0x011 = 17 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x01c, // 0x012 = 18 -
+0x0ce, // 0x013 = 19 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x000, // 0x014 = 20 -
+0x0ff, // 0x015 = 21 - JUMP
+0x00f, // 0x016 = 22 -
+0x0be, // 0x017 = 23 - JUMP_IF_PHY_READY
+0x01b, // 0x018 = 24 -
+0x0ff, // 0x019 = 25 - JUMP
+0x017, // 0x01a = 26 -
+0x00c, // 0x01b = 27 - SEND_ID_FRAME
+0x000, // 0x01c = 28 - NO_OP
+0x000, // 0x01d = 29 - NO_OP
+0x000, // 0x01e = 30 - NO_OP
+0x000, // 0x01f = 31 - NO_OP
+0x000, // 0x020 = 32 - NO_OP
+0x000, // 0x021 = 33 - NO_OP
+0x0ff, // 0x022 = 34 - JUMP
+0x09c, // 0x023 = 35 -
+0x01c, // 0x024 = 36 - SOFT_RESET
+0x00d, // 0x025 = 37 - PHY_RESET_START
+0x00d, // 0x026 = 38 - PHY_RESET_START
+0x0be, // 0x027 = 39 - JUMP_IF_PHY_READY
+0x027, // 0x028 = 40 -
+0x0be, // 0x029 = 41 - JUMP_IF_PHY_READY
+0x02f, // 0x02a = 42 -
+0x0af, // 0x02b = 43 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x036, // 0x02c = 44 -
+0x0ff, // 0x02d = 45 - JUMP
+0x029, // 0x02e = 46 -
+0x00c, // 0x02f = 47 - SEND_ID_FRAME
+0x0af, // 0x030 = 48 - JUMP_IF_IDENTIFY_FRAME_RECEIVED
+0x039, // 0x031 = 49 -
+0x0ce, // 0x032 = 50 - JUMP_IF_IDENTIFY_FRAME_TIMEOUT
+0x024, // 0x033 = 51 -
+0x0ff, // 0x034 = 52 - JUMP
+0x030, // 0x035 = 53 -
+0x00c, // 0x036 = 54 - SEND_ID_FRAME
+0x0ff, // 0x037 = 55 - JUMP
+0x039, // 0x038 = 56 -
+0x000, // 0x039 = 57 - NO_OP
+0x0cb, // 0x03a = 58 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03b = 59 -
+0x0ff, // 0x03c = 60 - JUMP
+0x03a, // 0x03d = 61 -
+0x0cb, // 0x03e = 62 - JUMP_IF_FREEZE_ACTIVE
+0x03e, // 0x03f = 63 -
+0x0ff, // 0x040 = 64 - JUMP
+0x09c, // 0x041 = 65 -
+0x000, // 0x042 = 66 - NO_OP
+0x0c9, // 0x043 = 67 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x073, // 0x044 = 68 -
+0x0a5, // 0x045 = 69 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_GOOD
+0x05c, // 0x046 = 70 -
+0x0a6, // 0x047 = 71 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_NAK
+0x063, // 0x048 = 72 -
+0x0a7, // 0x049 = 73 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_ACK_NAK_TIMEOUT
+0x066, // 0x04a = 74 -
+0x0a8, // 0x04b = 75 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_BREAK
+0x070, // 0x04c = 76 -
+0x0aa, // 0x04d = 77 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_CREDIT_TIMEOUT
+0x06b, // 0x04e = 78 -
+0x0c5, // 0x04f = 79 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_SMP_ERR
+0x070, // 0x050 = 80 -
+0x0ac, // 0x051 = 81 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_MAX_BURST_SIZE
+0x063, // 0x052 = 82 -
+0x0d9, // 0x053 = 83 - JUMP_IF_TRANSMISSION_STATUS_EQUAL_FREEZE_TIMEOUT
+0x070, // 0x054 = 84 -
+0x0ca, // 0x055 = 85 - JUMP_IF_CLOSE_REQ
+0x0f0, // 0x056 = 86 -
+0x0be, // 0x057 = 87 - JUMP_IF_PHY_READY
+0x043, // 0x058 = 88 -
+0x01c, // 0x059 = 89 - SOFT_RESET
+0x0ff, // 0x05a = 90 - JUMP
+0x004, // 0x05b = 91 -
+0x01d, // 0x05c = 92 - ADVANCE
+0x0bc, // 0x05d = 93 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x05e = 94 -
+0x0c3, // 0x05f = 95 - JUMP_IF_SMP_PROTOCOL
+0x128, // 0x060 = 96 -
+0x0ff, // 0x061 = 97 - JUMP
+0x076, // 0x062 = 98 -
+0x01d, // 0x063 = 99 - ADVANCE
+0x0ff, // 0x064 = 100 - JUMP
+0x076, // 0x065 = 101 -
+0x01d, // 0x066 = 102 - ADVANCE
+0x0bc, // 0x067 = 103 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x068 = 104 -
+0x0ff, // 0x069 = 105 - JUMP
+0x147, // 0x06a = 106 -
+0x01d, // 0x06b = 107 - ADVANCE
+0x0bc, // 0x06c = 108 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x06d = 109 -
+0x0ff, // 0x06e = 110 - JUMP
+0x14a, // 0x06f = 111 -
+0x01d, // 0x070 = 112 - ADVANCE
+0x0ff, // 0x071 = 113 - JUMP
+0x13b, // 0x072 = 114 -
+0x022, // 0x073 = 115 - SEND_CREDIT_BLOCK
+0x0ff, // 0x074 = 116 - JUMP
+0x045, // 0x075 = 117 -
+0x083, // 0x076 = 118 - TIMER_START
+0x004, // 0x077 = 119 -
+0x0c8, // 0x078 = 120 - JUMP_IF_HIP_REQ
+0x082, // 0x079 = 121 -
+0x0c6, // 0x07a = 122 - JUMP_IF_SFO_REQ
+0x08a, // 0x07b = 123 -
+0x0c7, // 0x07c = 124 - JUMP_IF_DOC_REQ
+0x094, // 0x07d = 125 -
+0x0b8, // 0x07e = 126 - JUMP_IF_TIMER_EXPIRED
+0x09c, // 0x07f = 127 -
+0x0ff, // 0x080 = 128 - JUMP
+0x078, // 0x081 = 129 -
+0x028, // 0x082 = 130 - CHECK_HIP
+0x000, // 0x083 = 131 - NO_OP
+0x000, // 0x084 = 132 - NO_OP
+0x000, // 0x085 = 133 - NO_OP
+0x0d8, // 0x086 = 134 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x087 = 135 -
+0x0ff, // 0x088 = 136 - JUMP
+0x07e, // 0x089 = 137 -
+0x029, // 0x08a = 138 - CHECK_SFO
+0x000, // 0x08b = 139 - NO_OP
+0x000, // 0x08c = 140 - NO_OP
+0x000, // 0x08d = 141 - NO_OP
+0x0d8, // 0x08e = 142 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x08f = 143 -
+0x0c7, // 0x090 = 144 - JUMP_IF_DOC_REQ
+0x094, // 0x091 = 145 -
+0x0ff, // 0x092 = 146 - JUMP
+0x07e, // 0x093 = 147 -
+0x02a, // 0x094 = 148 - CHECK_DOC
+0x000, // 0x095 = 149 - NO_OP
+0x000, // 0x096 = 150 - NO_OP
+0x000, // 0x097 = 151 - NO_OP
+0x0d8, // 0x098 = 152 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x099 = 153 -
+0x0ff, // 0x09a = 154 - JUMP
+0x07e, // 0x09b = 155 -
+0x0bc, // 0x09c = 156 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x09d = 157 -
+0x0be, // 0x09e = 158 - JUMP_IF_PHY_READY
+0x0a3, // 0x09f = 159 -
+0x01c, // 0x0a0 = 160 - SOFT_RESET
+0x0ff, // 0x0a1 = 161 - JUMP
+0x004, // 0x0a2 = 162 -
+0x0c8, // 0x0a3 = 163 - JUMP_IF_HIP_REQ
+0x0b5, // 0x0a4 = 164 -
+0x0c6, // 0x0a5 = 165 - JUMP_IF_SFO_REQ
+0x0bd, // 0x0a6 = 166 -
+0x0c7, // 0x0a7 = 167 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0a8 = 168 -
+0x0a3, // 0x0a9 = 169 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0aa = 170 -
+0x0a2, // 0x0ab = 171 - JUMP_IF_CONNECTION_OPEN_MASTER_FLAG_SET
+0x0f0, // 0x0ac = 172 -
+0x0c8, // 0x0ad = 173 - JUMP_IF_HIP_REQ
+0x0cf, // 0x0ae = 174 -
+0x0c6, // 0x0af = 175 - JUMP_IF_SFO_REQ
+0x0d4, // 0x0b0 = 176 -
+0x0c7, // 0x0b1 = 177 - JUMP_IF_DOC_REQ
+0x0d9, // 0x0b2 = 178 -
+0x0ff, // 0x0b3 = 179 - JUMP
+0x09c, // 0x0b4 = 180 -
+0x028, // 0x0b5 = 181 - CHECK_HIP
+0x000, // 0x0b6 = 182 - NO_OP
+0x000, // 0x0b7 = 183 - NO_OP
+0x000, // 0x0b8 = 184 - NO_OP
+0x0d8, // 0x0b9 = 185 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0cf, // 0x0ba = 186 -
+0x0ff, // 0x0bb = 187 - JUMP
+0x0a9, // 0x0bc = 188 -
+0x029, // 0x0bd = 189 - CHECK_SFO
+0x000, // 0x0be = 190 - NO_OP
+0x000, // 0x0bf = 191 - NO_OP
+0x000, // 0x0c0 = 192 - NO_OP
+0x0d8, // 0x0c1 = 193 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d4, // 0x0c2 = 194 -
+0x0c7, // 0x0c3 = 195 - JUMP_IF_DOC_REQ
+0x0c7, // 0x0c4 = 196 -
+0x0ff, // 0x0c5 = 197 - JUMP
+0x0a9, // 0x0c6 = 198 -
+0x02a, // 0x0c7 = 199 - CHECK_DOC
+0x000, // 0x0c8 = 200 - NO_OP
+0x000, // 0x0c9 = 201 - NO_OP
+0x000, // 0x0ca = 202 - NO_OP
+0x0d8, // 0x0cb = 203 - JUMP_IF_NXT_CONN_ACTIVE_PROF_EQ
+0x0d9, // 0x0cc = 204 -
+0x0ff, // 0x0cd = 205 - JUMP
+0x0a9, // 0x0ce = 206 -
+0x020, // 0x0cf = 207 - SELECT_HIP
+0x000, // 0x0d0 = 208 - NO_OP
+0x000, // 0x0d1 = 209 - NO_OP
+0x0ff, // 0x0d2 = 210 - JUMP
+0x0dc, // 0x0d3 = 211 -
+0x01e, // 0x0d4 = 212 - SELECT_SFO
+0x000, // 0x0d5 = 213 - NO_OP
+0x000, // 0x0d6 = 214 - NO_OP
+0x0ff, // 0x0d7 = 215 - JUMP
+0x0dc, // 0x0d8 = 216 -
+0x01f, // 0x0d9 = 217 - SELECT_DOC
+0x000, // 0x0da = 218 - NO_OP
+0x000, // 0x0db = 219 - NO_OP
+0x0a4, // 0x0dc = 220 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x0e0, // 0x0dd = 221 -
+0x0ff, // 0x0de = 222 - JUMP
+0x14d, // 0x0df = 223 -
+0x0a0, // 0x0e0 = 224 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x0e6, // 0x0e1 = 225 -
+0x0a3, // 0x0e2 = 226 - JUMP_IF_CONNECTION_OPEN_SLAVE_FLAG_SET
+0x107, // 0x0e3 = 227 -
+0x0ff, // 0x0e4 = 228 - JUMP
+0x0f0, // 0x0e5 = 229 -
+0x0cb, // 0x0e6 = 230 - JUMP_IF_FREEZE_ACTIVE
+0x0eb, // 0x0e7 = 231 -
+0x013, // 0x0e8 = 232 - SET_OPEN_STATUS_NORMAL
+0x0ff, // 0x0e9 = 233 - JUMP
+0x042, // 0x0ea = 234 -
+0x024, // 0x0eb = 235 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x0ec = 236 - NO_OP
+0x000, // 0x0ed = 237 - NO_OP
+0x0ff, // 0x0ee = 238 - JUMP
+0x09c, // 0x0ef = 239 -
+0x0d2, // 0x0f0 = 240 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x0f4, // 0x0f1 = 241 -
+0x0ff, // 0x0f2 = 242 - JUMP
+0x128, // 0x0f3 = 243 -
+0x0d5, // 0x0f4 = 244 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x0f5 = 245 -
+0x0d6, // 0x0f6 = 246 - JUMP_IF_SYNC_RECEIVED
+0x0fa, // 0x0f7 = 247 -
+0x0ff, // 0x0f8 = 248 - JUMP
+0x09c, // 0x0f9 = 249 -
+0x027, // 0x0fa = 250 - SEND_STP_CLOSE_REQ
+0x000, // 0x0fb = 251 - NO_OP
+0x000, // 0x0fc = 252 - NO_OP
+0x000, // 0x0fd = 253 - NO_OP
+0x000, // 0x0fe = 254 - NO_OP
+0x0d5, // 0x0ff = 255 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x100 = 256 -
+0x0bc, // 0x101 = 257 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x102 = 258 -
+0x0d7, // 0x103 = 259 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x104 = 260 -
+0x0ff, // 0x105 = 261 - JUMP
+0x0fb, // 0x106 = 262 -
+0x0c3, // 0x107 = 263 - JUMP_IF_SMP_PROTOCOL
+0x10f, // 0x108 = 264 -
+0x0d2, // 0x109 = 265 - JUMP_IF_STP_CONNECTION_ACTIVE
+0x113, // 0x10a = 266 -
+0x0d1, // 0x10b = 267 - JUMP_IF_IDLE_TIMER_TIMEOUT
+0x119, // 0x10c = 268 -
+0x0ff, // 0x10d = 269 - JUMP
+0x09c, // 0x10e = 270 -
+0x0c4, // 0x10f = 271 - JUMP_IF_SMP_FRAME_ERR_RECEIVED
+0x13b, // 0x110 = 272 -
+0x0ff, // 0x111 = 273 - JUMP
+0x0ad, // 0x112 = 274 -
+0x0d5, // 0x113 = 275 - JUMP_IF_CLOSE_RECEIVED
+0x119, // 0x114 = 276 -
+0x0d6, // 0x115 = 277 - JUMP_IF_SYNC_RECEIVED
+0x11b, // 0x116 = 278 -
+0x0ff, // 0x117 = 279 - JUMP
+0x113, // 0x118 = 280 -
+0x0ff, // 0x119 = 281 - JUMP
+0x128, // 0x11a = 282 -
+0x027, // 0x11b = 283 - SEND_STP_CLOSE_REQ
+0x000, // 0x11c = 284 - NO_OP
+0x000, // 0x11d = 285 - NO_OP
+0x000, // 0x11e = 286 - NO_OP
+0x000, // 0x11f = 287 - NO_OP
+0x0d5, // 0x120 = 288 - JUMP_IF_CLOSE_RECEIVED
+0x128, // 0x121 = 289 -
+0x0bc, // 0x122 = 290 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x123 = 291 -
+0x0d7, // 0x124 = 292 - JUMP_IF_STP_CLOSE_ACK
+0x128, // 0x125 = 293 -
+0x0ff, // 0x126 = 294 - JUMP
+0x11c, // 0x127 = 295 -
+0x004, // 0x128 = 296 - CLOSE_NORMAL
+0x000, // 0x129 = 297 - NO_OP
+0x000, // 0x12a = 298 - NO_OP
+0x000, // 0x12b = 299 - NO_OP
+0x000, // 0x12c = 300 - NO_OP
+0x0c9, // 0x12d = 301 - JUMP_IF_RX_BUFFER_FULL_TIMEOUT
+0x138, // 0x12e = 302 -
+0x0c0, // 0x12f = 303 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x130 = 304 -
+0x0bc, // 0x131 = 305 - JUMP_IF_BREAK_RECEIVED
+0x13b, // 0x132 = 306 -
+0x0be, // 0x133 = 307 - JUMP_IF_PHY_READY
+0x129, // 0x134 = 308 -
+0x01c, // 0x135 = 309 - SOFT_RESET
+0x0ff, // 0x136 = 310 - JUMP
+0x004, // 0x137 = 311 -
+0x022, // 0x138 = 312 - SEND_CREDIT_BLOCK
+0x0ff, // 0x139 = 313 - JUMP
+0x129, // 0x13a = 314 -
+0x007, // 0x13b = 315 - CLOSE_BREAK
+0x000, // 0x13c = 316 - NO_OP
+0x000, // 0x13d = 317 - NO_OP
+0x000, // 0x13e = 318 - NO_OP
+0x000, // 0x13f = 319 - NO_OP
+0x0c0, // 0x140 = 320 - JUMP_IF_CLOSE_STATUS_EQUAL_ANY
+0x09c, // 0x141 = 321 -
+0x0be, // 0x142 = 322 - JUMP_IF_PHY_READY
+0x13c, // 0x143 = 323 -
+0x01c, // 0x144 = 324 - SOFT_RESET
+0x0ff, // 0x145 = 325 - JUMP
+0x004, // 0x146 = 326 -
+0x005, // 0x147 = 327 - CLOSE_ACK_NAK_TIMEOUT
+0x0ff, // 0x148 = 328 - JUMP
+0x129, // 0x149 = 329 -
+0x006, // 0x14a = 330 - CLOSE_CREDIT_TIMEOUT
+0x0ff, // 0x14b = 331 - JUMP
+0x129, // 0x14c = 332 -
+0x0da, // 0x14d = 333 - JUMP_IF_SMP_TARGET
+0x189, // 0x14e = 334 -
+0x0cc, // 0x14f = 335 - JUMP_IF_RX_BUFFER_FULL
+0x09c, // 0x150 = 336 -
+0x0b7, // 0x151 = 337 - JUMP_IF_FLAG_7_SET
+0x156, // 0x152 = 338 -
+0x011, // 0x153 = 339 - START_IT_NEXUS_LOSS_TIMER
+0x00f, // 0x154 = 340 - PATHWAY_BLOCKED_CNT_RESET
+0x00e, // 0x155 = 341 - START_ARB_WAIT_TIMER
+0x0cb, // 0x156 = 342 - JUMP_IF_FREEZE_ACTIVE
+0x195, // 0x157 = 343 -
+0x001, // 0x158 = 344 - OPEN_REQUEST
+0x080, // 0x159 = 345 - SET_FLAG
+0x080, // 0x15a = 346 -
+0x090, // 0x15b = 347 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_ACCEPT
+0x181, // 0x15c = 348 -
+0x095, // 0x15d = 349 - JUMP_IF_OPEN_STATUS_EQUAL_RATE_NOT_SUPPORTED
+0x186, // 0x15e = 350 -
+0x099, // 0x15f = 351 - JUMP_IF_OPEN_STATUS_EQUAL_PROTOCOL_NOT_SUPPORTED
+0x189, // 0x160 = 352 -
+0x09b, // 0x161 = 353 - JUMP_IF_OPEN_STATUS_EQUAL_WRONG_DESTINATION
+0x18c, // 0x162 = 354 -
+0x094, // 0x163 = 355 - JUMP_IF_OPEN_STATUS_EQUAL_BREAK_RECEIVED
+0x156, // 0x164 = 356 -
+0x093, // 0x165 = 357 - JUMP_IF_OPEN_STATUS_EQUAL_BAD_DESTINATION
+0x18f, // 0x166 = 358 -
+0x09f, // 0x167 = 359 - JUMP_IF_IT_NEXUS_LOSS_TIMEOUT
+0x192, // 0x168 = 360 -
+0x09a, // 0x169 = 361 - JUMP_IF_OPEN_STATUS_EQUAL_STP_RESOURCE_BUSY
+0x155, // 0x16a = 362 -
+0x096, // 0x16b = 363 - JUMP_IF_OPEN_STATUS_EQUAL_NO_DESTINATION
+0x156, // 0x16c = 364 -
+0x097, // 0x16d = 365 - JUMP_IF_OPEN_STATUS_EQUAL_PATHWAY_BLOCKED
+0x19c, // 0x16e = 366 -
+0x098, // 0x16f = 367 - JUMP_IF_OPEN_STATUS_EQUAL_RETRY
+0x155, // 0x170 = 368 -
+0x092, // 0x171 = 369 - JUMP_IF_OPEN_STATUS_EQUAL_OPEN_TIMEOUT
+0x156, // 0x172 = 370 -
+0x0a4, // 0x173 = 371 - JUMP_IF_CONNECTION_ACTIVE_SET
+0x17b, // 0x174 = 372 -
+0x0be, // 0x175 = 373 - JUMP_IF_PHY_READY
+0x15b, // 0x176 = 374 -
+0x01b, // 0x177 = 375 - SET_OPEN_STATUS_PHY_NOT_RDY
+0x01c, // 0x178 = 376 - SOFT_RESET
+0x0ff, // 0x179 = 377 - JUMP
+0x004, // 0x17a = 378 -
+0x0a0, // 0x17b = 379 - JUMP_IF_CONNECTION_PROFILE_OPEN_EQUAL
+0x181, // 0x17c = 380 -
+0x000, // 0x17d = 381 - NO_OP
+0x000, // 0x17e = 382 - NO_OP
+0x0ff, // 0x17f = 383 - JUMP
+0x09c, // 0x180 = 384 -
+0x013, // 0x181 = 385 - SET_OPEN_STATUS_NORMAL
+0x081, // 0x182 = 386 - CLEAR_FLAG
+0x080, // 0x183 = 387 -
+0x0ff, // 0x184 = 388 - JUMP
+0x042, // 0x185 = 389 -
+0x017, // 0x186 = 390 - SET_OPEN_STATUS_BAD_RATE
+0x0ff, // 0x187 = 391 - JUMP
+0x196, // 0x188 = 392 -
+0x018, // 0x189 = 393 - SET_OPEN_STATUS_BAD_PROTOCOL
+0x0ff, // 0x18a = 394 - JUMP
+0x196, // 0x18b = 395 -
+0x01a, // 0x18c = 396 - SET_OPEN_STATUS_WRONG_DEST
+0x0ff, // 0x18d = 397 - JUMP
+0x196, // 0x18e = 398 -
+0x015, // 0x18f = 399 - SET_OPEN_STATUS_BAD_DEST
+0x0ff, // 0x190 = 400 - JUMP
+0x196, // 0x191 = 401 -
+0x014, // 0x192 = 402 - SET_OPEN_STATUS_IT_NEXUS_LOSS
+0x0ff, // 0x193 = 403 - JUMP
+0x196, // 0x194 = 404 -
+0x024, // 0x195 = 405 - SET_OPEN_STATUS_FREEZE
+0x000, // 0x196 = 406 - NO_OP
+0x000, // 0x197 = 407 - NO_OP
+0x081, // 0x198 = 408 - CLEAR_FLAG
+0x080, // 0x199 = 409 -
+0x0ff, // 0x19a = 410 - JUMP
+0x09c, // 0x19b = 411 -
+0x010, // 0x19c = 412 - PATHWAY_BLOCKED_CNT_INC
+0x0ff, // 0x19d = 413 - JUMP
+0x156, // 0x19e = 414 -
+0x000, // 0x19f = 415 - NO_OP
+0x000, // 0x1a0 = 416 - NO_OP
+0x000, // 0x1a1 = 417 - NO_OP
+0x000, // 0x1a2 = 418 - NO_OP
+0x000, // 0x1a3 = 419 - NO_OP
+0x000, // 0x1a4 = 420 - NO_OP
+0x000, // 0x1a5 = 421 - NO_OP
+0x000, // 0x1a6 = 422 - NO_OP
+0x000, // 0x1a7 = 423 - NO_OP
+0x000, // 0x1a8 = 424 - NO_OP
+0x000, // 0x1a9 = 425 - NO_OP
+0x000, // 0x1aa = 426 - NO_OP
+0x000, // 0x1ab = 427 - NO_OP
+0x000, // 0x1ac = 428 - NO_OP
+0x000, // 0x1ad = 429 - NO_OP
+0x000, // 0x1ae = 430 - NO_OP
+0x000, // 0x1af = 431 - NO_OP
+0x000, // 0x1b0 = 432 - NO_OP
+0x000, // 0x1b1 = 433 - NO_OP
+0x000, // 0x1b2 = 434 - NO_OP
+0x000, // 0x1b3 = 435 - NO_OP
+0x000, // 0x1b4 = 436 - NO_OP
+0x000, // 0x1b5 = 437 - NO_OP
+0x000, // 0x1b6 = 438 - NO_OP
+0x000, // 0x1b7 = 439 - NO_OP
+0x000, // 0x1b8 = 440 - NO_OP
+0x000, // 0x1b9 = 441 - NO_OP
+0x000, // 0x1ba = 442 - NO_OP
+0x000, // 0x1bb = 443 - NO_OP
+0x000, // 0x1bc = 444 - NO_OP
+0x000, // 0x1bd = 445 - NO_OP
+0x000, // 0x1be = 446 - NO_OP
+0x000, // 0x1bf = 447 - NO_OP
+0x000, // 0x1c0 = 448 - NO_OP
+0x000, // 0x1c1 = 449 - NO_OP
+0x000, // 0x1c2 = 450 - NO_OP
+0x000, // 0x1c3 = 451 - NO_OP
+0x000, // 0x1c4 = 452 - NO_OP
+0x000, // 0x1c5 = 453 - NO_OP
+0x000, // 0x1c6 = 454 - NO_OP
+0x000, // 0x1c7 = 455 - NO_OP
+0x000, // 0x1c8 = 456 - NO_OP
+0x000, // 0x1c9 = 457 - NO_OP
+0x000, // 0x1ca = 458 - NO_OP
+0x000, // 0x1cb = 459 - NO_OP
+0x000, // 0x1cc = 460 - NO_OP
+0x000, // 0x1cd = 461 - NO_OP
+0x000, // 0x1ce = 462 - NO_OP
+0x000, // 0x1cf = 463 - NO_OP
+0x000, // 0x1d0 = 464 - NO_OP
+0x000, // 0x1d1 = 465 - NO_OP
+0x000, // 0x1d2 = 466 - NO_OP
+0x000, // 0x1d3 = 467 - NO_OP
+0x000, // 0x1d4 = 468 - NO_OP
+0x000, // 0x1d5 = 469 - NO_OP
+0x000, // 0x1d6 = 470 - NO_OP
+0x000, // 0x1d7 = 471 - NO_OP
+0x000, // 0x1d8 = 472 - NO_OP
+0x000, // 0x1d9 = 473 - NO_OP
+0x000, // 0x1da = 474 - NO_OP
+0x000, // 0x1db = 475 - NO_OP
+0x000, // 0x1dc = 476 - NO_OP
+0x000, // 0x1dd = 477 - NO_OP
+0x000, // 0x1de = 478 - NO_OP
+0x000, // 0x1df = 479 - NO_OP
+0x000, // 0x1e0 = 480 - NO_OP
+0x000, // 0x1e1 = 481 - NO_OP
+0x000, // 0x1e2 = 482 - NO_OP
+0x000, // 0x1e3 = 483 - NO_OP
+0x000, // 0x1e4 = 484 - NO_OP
+0x000, // 0x1e5 = 485 - NO_OP
+0x000, // 0x1e6 = 486 - NO_OP
+0x000, // 0x1e7 = 487 - NO_OP
+0x000, // 0x1e8 = 488 - NO_OP
+0x000, // 0x1e9 = 489 - NO_OP
+0x000, // 0x1ea = 490 - NO_OP
+0x000, // 0x1eb = 491 - NO_OP
+0x000, // 0x1ec = 492 - NO_OP
+0x000, // 0x1ed = 493 - NO_OP
+0x000, // 0x1ee = 494 - NO_OP
+0x000, // 0x1ef = 495 - NO_OP
+0x000, // 0x1f0 = 496 - NO_OP
+0x000, // 0x1f1 = 497 - NO_OP
+0x000, // 0x1f2 = 498 - NO_OP
+0x000, // 0x1f3 = 499 - NO_OP
+0x000, // 0x1f4 = 500 - NO_OP
+0x000, // 0x1f5 = 501 - NO_OP
+0x000, // 0x1f6 = 502 - NO_OP
+0x000, // 0x1f7 = 503 - NO_OP
+0x000, // 0x1f8 = 504 - NO_OP
+0x000, // 0x1f9 = 505 - NO_OP
+0x000, // 0x1fa = 506 - NO_OP
+0x000, // 0x1fb = 507 - NO_OP
+0x000, // 0x1fc = 508 - NO_OP
+0x000, // 0x1fd = 509 - NO_OP
+0x000, // 0x1fe = 510 - NO_OP
+0x000, // 0x1ff = 511 - NO_OP
+};
OpenPOWER on IntegriCloud