The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/pms/RefTisa/sallsdk/spc/mpidebug.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*******************************************************************************
    2 *Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved. 
    3 *
    4 *Redistribution and use in source and binary forms, with or without modification, are permitted provided 
    5 *that the following conditions are met: 
    6 *1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
    7 *following disclaimer. 
    8 *2. Redistributions in binary form must reproduce the above copyright notice, 
    9 *this list of conditions and the following disclaimer in the documentation and/or other materials provided
   10 *with the distribution. 
   11 *
   12 *THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED 
   13 *WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   14 *FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   15 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
   16 *NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
   17 *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
   18 *LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
   19 *SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
   20 
   21 ********************************************************************************/
   22 
   23 /*******************************************************************************/
   24 /*! \file mpidebug.c
   25  *  \brief The file is a MPI Libraries to implement the MPI debug and trace functions
   26  *
   27  * The file implements the MPI functions.
   28  *
   29  */
   30 /*******************************************************************************/
   31 #include <sys/cdefs.h>
   32 __FBSDID("$FreeBSD$");
   33 #include <dev/pms/config.h>
   34 
   35 #include <dev/pms/RefTisa/sallsdk/spc/saglobal.h>
   36 #ifdef MPI_DEBUG_TRACE_ENABLE /* enable with CCBUILD_MPI_TRACE*/
   37 
   38 /*******************************************************************************/
   39 
   40 #ifdef OSLAYER_USE_HI_RES_TIMER
   41 unsigned __int64
   42 GetHiResTimeStamp(void);
   43 #endif /* OSLAYER_USE_HI_RES_TIMER */
   44 /*******************************************************************************/
   45 /*******************************************************************************/
   46 /* FUNCTIONS                                                                   */
   47 /*******************************************************************************/
   48 mpiDebugObTrace_t obTraceData;
   49 mpiDebugIbTrace_t ibTraceData;
   50 
   51 void mpiTraceInit(void)
   52 {
   53 
   54   SA_DBG1(("mpiTraceInit:obTraceData @ %p\n",&obTraceData ));
   55   SA_DBG1(("mpiTraceInit:ibTraceData @ %p\n",&ibTraceData ));
   56   SA_DBG1(("mpiTraceInit: num enties %d Ib Iomb size %d Ob Iomb size %d\n",
   57                MPI_DEBUG_TRACE_BUFFER_MAX,
   58                MPI_DEBUG_TRACE_IB_IOMB_SIZE,
   59                MPI_DEBUG_TRACE_OB_IOMB_SIZE ));
   60 
   61   si_memset(&obTraceData, 0, sizeof(obTraceData));
   62   si_memset(&ibTraceData, 0, sizeof(ibTraceData));
   63 }
   64 
   65 void mpiTraceAdd( bit32 q,bit32 pici,bit32 ib, void *iomb, bit32 numBytes)
   66 {
   67   bit32                  curIdx;
   68   mpiDebugIbTraceEntry_t *curIbTrace;
   69   mpiDebugObTraceEntry_t *curObTrace;
   70 
   71   mpiDebugIbTrace_t * ibTrace = &ibTraceData;
   72   mpiDebugObTrace_t * obTrace = &obTraceData;
   73 
   74   if (ib)
   75   {
   76     if(ibTrace->Idx >= MPI_DEBUG_TRACE_BUFFER_MAX)
   77     {
   78       ibTrace->Idx = 0;
   79     }
   80     curIdx = ibTrace->Idx;
   81 
   82     curIbTrace = &ibTrace->Data[curIdx];
   83     curIbTrace->pEntry =  iomb;
   84     curIbTrace->QNum = q;
   85     curIbTrace->pici = pici;
   86 #ifdef OSLAYER_USE_HI_RES_TIMER
   87 #ifdef SA_64BIT_TIMESTAMP
   88   curIbTrace->Time = ossaTimeStamp64(agNULL);
   89 #else /* SA_64BIT_TIMESTAMP */
   90   curIbTrace->Time = ossaTimeStamp(agNULL);
   91 #endif /* SA_64BIT_TIMESTAMP */
   92 #else /* OSLAYER_USE_HI_RES_TIMER */
   93   curIbTrace->Time = 0;
   94 #endif
   95     si_memcpy(curIbTrace->Iomb, iomb, MIN(numBytes, MPI_DEBUG_TRACE_IB_IOMB_SIZE));
   96     ibTrace->Idx++;
   97   }
   98   else
   99   {
  100     if(obTrace->Idx >= MPI_DEBUG_TRACE_BUFFER_MAX )
  101     {
  102       obTrace->Idx = 0;
  103     }
  104     curIdx = obTrace->Idx;
  105     curObTrace = &obTrace->Data[curIdx];
  106     curObTrace->pEntry =  iomb;
  107     curObTrace->QNum = q;
  108     curObTrace->pici = pici;
  109 #ifdef OSLAYER_USE_HI_RES_TIMER
  110 #ifdef SA_64BIT_TIMESTAMP
  111     curObTrace->Time = ossaTimeStamp64(agNULL);
  112 #else /* SA_64BIT_TIMESTAMP */
  113     curObTrace->Time = ossaTimeStamp(agNULL);
  114 #endif /* SA_64BIT_TIMESTAMP */
  115 #else /* OSLAYER_USE_HI_RES_TIMER */
  116     curObTrace->Time = 0;
  117 #endif
  118     si_memcpy(curObTrace->Iomb, iomb, MIN(numBytes, MPI_DEBUG_TRACE_OB_IOMB_SIZE));
  119     obTrace->Idx++;
  120   }
  121 
  122 
  123   return;
  124 }
  125 
  126 #endif /* MPI_DEBUG_TRACE_ENABLE */
  127 
  128 
  129 
  130 #ifdef SA_ENABLE_TRACE_FUNCTIONS
  131 
  132 /**
  133  * fiEnableTracing
  134  *
  135  *    This fucntion is called to initialize tracing of FC layer.
  136  *
  137  */
  138 void siEnableTracing (agsaRoot_t  *agRoot)
  139 {
  140 
  141   agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  142   agsaSwConfig_t    *swC  = &saRoot->swConfig;
  143   bit32 count;
  144 
  145   OS_ASSERT(saRoot != NULL, "");
  146 
  147   if( saRoot->TraceBlockReInit != 0)
  148   {
  149     return;
  150   }
  151 
  152 
  153   /* Initialize tracing first */
  154 
  155   for (count = 0; count < 10; count++)
  156   {
  157       saRoot->traceBuffLookup[count] = (bit8)('' + count);
  158   }
  159   for (count = 0; count < 6; count++)
  160   {
  161       saRoot->traceBuffLookup[(bitptr)count + 10] = (bit8)('a' + count);
  162   }
  163 
  164 
  165   saRoot->TraceDestination = swC->TraceDestination;
  166   saRoot->TraceMask = swC->TraceMask;
  167   saRoot->CurrentTraceIndexWrapCount = 0;
  168   saRoot->CurrentTraceIndex = 0;
  169   saRoot->TraceBlockReInit = 1;
  170 
  171 
  172   SA_DBG1(("siEnableTracing: \n" ));
  173 
  174   SA_DBG1 (("      length       = %08x\n", saRoot->TraceBufferLength ));
  175   SA_DBG1 (("      virt         = %p\n",   saRoot->TraceBuffer ));
  176   SA_DBG1 (("    traceMask        = %08x @ %p\n", saRoot->TraceMask, &saRoot->TraceMask));
  177   SA_DBG1 (("    last trace entry @ %p\n", &saRoot->CurrentTraceIndex));
  178   SA_DBG1 (("    TraceWrapAround  = %x\n", saRoot->TraceMask & hpDBG_TraceBufferWrapAround ? 1 : 0));
  179   SA_DBG1 (("    da %p l %x\n",saRoot->TraceBuffer ,saRoot->TraceBufferLength));
  180 
  181 #ifdef SA_PRINTOUT_IN_WINDBG
  182 #ifndef DBG
  183   DbgPrint("siTraceEnable: \n" );
  184 
  185   DbgPrint("      length       = %08x\n", saRoot->TraceBufferLength );
  186   DbgPrint("      virt         = %p\n",   saRoot->TraceBuffer );
  187   DbgPrint("    last trace entry @ %p\n", &saRoot->CurrentTraceIndex);
  188   DbgPrint("    traceMask      = %08x @ %p\n", saRoot->TraceMask, &saRoot->TraceMask);
  189   DbgPrint("    da %p l %x\n",saRoot->TraceBuffer ,saRoot->TraceBufferLength);
  190 #endif /* DBG  */
  191 #endif /* SA_PRINTOUT_IN_WINDBG  */
  192   /*
  193   ** Init trace buffer with all spaces
  194   */
  195   for (count = 0; count < saRoot->TraceBufferLength; count++)
  196   {
  197       saRoot->TraceBuffer[count] = (bit8)' ';
  198   }
  199 
  200 }
  201 
  202 
  203 
  204 /**
  205  * IF_DO_TRACE
  206  *
  207  * PURPOSE:     convenience macro for the "to output or not to output" logic
  208  *
  209  * PARAMETERS:
  210  *
  211  * CALLS:
  212  *
  213  * SIDE EFFECTS & CAVEATS:
  214  *
  215  * ALGORITHM:
  216  *
  217  *
  218  *
  219  *     MODIFICATION HISTORY     ***********************
  220  *
  221  * ENGINEER NAME      DATE     DESCRIPTION
  222  * -------------    --------   -----------
  223  */
  224 
  225 #define IF_DO_TRACE                                     \
  226   if ( (saRoot != NULL) &&                              \
  227        (saRoot->TraceDestination & siTraceDestMask) &&  \
  228        (mask & saRoot->TraceMask) )                     \
  229 
  230 
  231 /* #define TRACE_ENTER_LOCK  ossaSingleThreadedEnter(agRoot, LL_TRACE_LOCK); */
  232 /* #define TRACE_LEAVE_LOCK  ossaSingleThreadedLeave(agRoot, LL_TRACE_LOCK); */
  233 #define TRACE_ENTER_LOCK
  234 #define TRACE_LEAVE_LOCK
  235 /**
  236  * BUFFER_WRAP_CHECK
  237  *
  238  * PURPOSE: Checks if the tracing buffer tracing index is too high.  If it is,
  239  *          the buffer index gets reset to 0 or tracing stops..
  240  */
  241 #define BUFFER_WRAP_CHECK                                           \
  242     if( (saRoot->CurrentTraceIndex + TMP_TRACE_BUFF_SIZE)               \
  243                            >= saRoot->TraceBufferLength )               \
  244     {                                                                   \
  245         /* Trace wrap-Around is enabled.  */                            \
  246         if( saRoot->TraceMask & hpDBG_TraceBufferWrapAround )           \
  247         {                                                               \
  248             /* Fill the end of the buffer with spaces */                \
  249             for( i = saRoot->CurrentTraceIndex;                         \
  250                      i < saRoot->TraceBufferLength; i++ )               \
  251             {                                                           \
  252                 saRoot->TraceBuffer[i] = (bit8)' ';                     \
  253             }                                                           \
  254             /* Wrap the current trace index back to 0.. */              \
  255             saRoot->CurrentTraceIndex = 0;                              \
  256             saRoot->CurrentTraceIndexWrapCount++;                       \
  257         }                                                               \
  258         else                                                            \
  259         {                                                               \
  260             /* Don't do anything -- trace buffer is filled up */        \
  261             return;                                                     \
  262         }                                                               \
  263     }
  264 
  265 /**
  266  * LOCAL_OS_LOG_DEBUG_STRING
  267  *
  268  * PURPOSE:     protects against a change in the api for this function
  269  *
  270  * PARAMETERS:
  271  *
  272  * CALLS:
  273  *
  274  * SIDE EFFECTS & CAVEATS:
  275  *
  276  * ALGORITHM:
  277  *
  278  *
  279  *
  280  *     MODIFICATION HISTORY     ***********************
  281  *
  282  * ENGINEER NAME      DATE     DESCRIPTION
  283  * -------------    --------   -----------
  284  * Laurent Chavey   03/09/00   - changed cast of 3rd parameter to (char *)
  285  */
  286     #define LOCAL_OS_LOG_DEBUG_STRING(H,S)  \
  287             osLogDebugString(H,hpDBG_ALWAYS,(char *)(S))
  288 
  289 /******************************************************************************
  290 *******************************************************************************
  291 **
  292 ** copyHex
  293 **
  294 ** PURPOSE:  Copies a hex version of a bit32 into a bit8 buffer
  295 **
  296 *******************************************************************************
  297 ******************************************************************************/
  298 #define copyHex(bit32Val, bitSize)                                     \
  299 {                                                                      \
  300   bit32 nibbleLen = bitSize / 4;                                       \
  301   bit32 scratch = 0;                                                   \
  302   for( i = 0; i < nibbleLen; i++ )                                     \
  303   {                                                                    \
  304     bPtr[pos++] =                                                      \
  305         saRoot->traceBuffLookup[0xf & (bit32Val >> ((bitSize - 4) - (i << 2)))];  \
  306     i++;                                                               \
  307     bPtr[pos++] =                                                      \
  308     saRoot->traceBuffLookup[0xf & (bit32Val >> ((bitSize - 4) - (i << 2)))]; \
  309     /* Skip leading 0-s to save memory buffer space */                 \
  310     if( !scratch                                                       \
  311           && (bPtr[pos-2] == '')                                      \
  312           && (bPtr[pos-1] == '') )                                    \
  313     {                                                                  \
  314       pos -= 2;                                                        \
  315       continue;                                                        \
  316     }                                                                  \
  317     else                                                               \
  318     {                                                                  \
  319       scratch = 1;                                                     \
  320     }                                                                  \
  321   }                                                                    \
  322   if( scratch == 0 )                                                   \
  323   {                                                                    \
  324     /* The value is 0 and nothing got put in the buffer.  Do       */  \
  325     /* print at least two zeros.                                   */  \
  326     bPtr[pos++] = '';                                                 \
  327     bPtr[pos++] = '';                                                 \
  328   }                                                                    \
  329 }
  330 
  331 
  332 /**
  333  * TRACE_OTHER_DEST
  334  *
  335  * PURPOSE:  Check if any other destinations are enabled.  If yes, use them
  336  *           for debug log.
  337  */
  338 #define TRACE_OTHER_DEST                                                \
  339     {                                                                   \
  340     bit32 bitptrscratch;                                                \
  341     if( saRoot->TraceDestination & smTraceDestDebugger )                \
  342     {                                                                   \
  343         bPtr[pos++] = (bit8)'\n';                                       \
  344         bPtr[pos++] = (bit8)0;                                          \
  345         LOCAL_OS_LOG_DEBUG_STRING(hpRoot, (char *)bPtr);                \
  346     }                                                                   \
  347     if( saRoot->TraceDestination & smTraceDestRegister )                \
  348     {                                                                   \
  349         while( (pos & 0x3) != 0x3 )                                     \
  350         {                                                               \
  351             bPtr[pos++] = (bit8)' ';                                    \
  352         }                                                               \
  353         bPtr[pos] = ' ';                                                \
  354         for( i = 0; i < pos; i = i + 4 )                                \
  355         {                                                               \
  356             bitptrscratch =  bPtr[i+0];                                 \
  357             bitptrscratch <<= 8;                                        \
  358             bitptrscratch |= bPtr[i+1];                                 \
  359             bitptrscratch <<= 8;                                        \
  360             bitptrscratch |= bPtr[i+2];                                 \
  361             bitptrscratch <<= 8;                                        \
  362             bitptrscratch |= bPtr[i+3];                                 \
  363             osChipRegWrite(hpRoot,                                      \
  364                  FC_rFMReceivedALPA, (bit32)bitptrscratch );            \
  365         }                                                               \
  366     }                                                                   \
  367     }
  368 
  369 
  370 
  371 /**
  372  * siGetCurrentTraceIndex()
  373  *
  374  * PURPOSE:     Returns the current tracing index ( if tracing buffer is
  375  *              used ).
  376  *
  377  * PARAMETERS:
  378  *
  379  * CALLS:
  380  *
  381  * SIDE EFFECTS & CAVEATS:
  382  *
  383  * ALGORITHM:
  384  *
  385  *
  386  *     MODIFICATION HISTORY     ***********************
  387  *
  388  * ENGINEER NAME      DATE     DESCRIPTION
  389  * -------------    --------   -----------
  390  * Tom Nalepa       02/27/03
  391  *
  392  * @param hpRoot
  393  *
  394  * @return
  395  */
  396 GLOBAL bit32 siGetCurrentTraceIndex(agsaRoot_t  *agRoot)
  397 {
  398     agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  399     return(saRoot->CurrentTraceIndex);
  400 }
  401 
  402 
  403 
  404 
  405 /**
  406  * siResetTraceBuffer
  407  *
  408  * PURPOSE:     Sets saRoot->CurrentTraceIndex to 0.
  409  *
  410  * @param hpRoot
  411  *
  412  * @return
  413  */
  414 GLOBAL void siResetTraceBuffer(agsaRoot_t  *agRoot)
  415 {
  416     bit32 count;
  417     agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  418     saRoot->CurrentTraceIndex = 0;
  419 
  420     for ( count = 0; count < saRoot->TraceBufferLength; count++ )
  421     {
  422         saRoot->TraceBuffer[count] = (bit8)' ';
  423     }
  424 }
  425 
  426 
  427 /**
  428  * siTraceFuncEnter
  429  *
  430  * PURPOSE:     Format a function entry trace and post it to the appropriate
  431  *              destination.
  432  *
  433  * PARAMETERS:
  434  *
  435  * CALLS:
  436  *
  437  * SIDE EFFECTS & CAVEATS:
  438  *
  439  * ALGORITHM:
  440  *
  441  * siTraceFuncEnter  :    _[Xxxxx_
  442  *                 fileid---^  ^------funcid
  443  *
  444  *
  445  *     MODIFICATION HISTORY     ***********************
  446  *
  447  * ENGINEER NAME      DATE     DESCRIPTION
  448  * -------------    --------   -----------
  449  *
  450  * @param hpRoot
  451  * @param mask
  452  * @param fileid
  453  * @param funcid
  454  *
  455  * @return
  456  */
  457 
  458 #define TMP_TRACE_BUFF_SIZE 32
  459 
  460 
  461 GLOBAL void siTraceFuncEnter( agsaRoot_t  *agRoot,
  462                              bit32        mask,
  463                              bit32        fileid,
  464                              char       * funcid)
  465 {
  466 agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  467     bitptr         i;
  468     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  469     bit8          *bPtr;
  470     bit8           pos = 0;
  471 
  472     IF_DO_TRACE
  473     {
  474       TRACE_ENTER_LOCK
  475       if ( saRoot->TraceDestination & smTraceDestBuffer )
  476       {
  477         BUFFER_WRAP_CHECK
  478         bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  479       }
  480       else
  481       {
  482         bPtr = tmpB;
  483       }
  484       bPtr[pos++] = (bit8)'[';
  485 
  486 #ifndef FC_DO_NOT_INCLUDE_FILE_NAME_TAGS_IN_ENTER_EXIT_TRACE
  487         bPtr[pos++] = (bit8)fileid;
  488 #endif
  489 
  490         for ( i=0; i<4; i++ )
  491         {
  492             if ( funcid[i] == 0 )
  493             {
  494                 break;
  495             }
  496             bPtr[pos++] = (bit8)funcid[i];
  497         }
  498         bPtr[pos++] = ' ';
  499         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  500         {
  501             bPtr[pos++] = '\r';
  502             bPtr[pos++] = '\n';
  503             saRoot->traceLineFeedCnt = 0;
  504         }
  505         saRoot->CurrentTraceIndex += pos;
  506 //        TRACE_OTHER_DEST
  507     TRACE_LEAVE_LOCK
  508 
  509     }
  510     return;
  511 }
  512 
  513 
  514 /**
  515  * siTraceFuncExit
  516  *
  517  * PURPOSE:     Format a function exit trace and post it to the appropriate
  518  *              destination.
  519  *
  520  * PARAMETERS:
  521  *
  522  * CALLS:
  523  *
  524  * SIDE EFFECTS & CAVEATS:
  525  *
  526  * ALGORITHM:
  527  *
  528  * siTraceFuncExit         _Xxxxx]_
  529  *                 fileid---^  ^------funcid
  530  *
  531  *
  532  *     MODIFICATION HISTORY     ***********************
  533  *
  534  * ENGINEER NAME      DATE     DESCRIPTION
  535  * -------------    --------   -----------
  536  *
  537  * @param hpRoot
  538  * @param mask
  539  * @param fileid
  540  * @param funcid
  541  * @param exitId
  542  *
  543  * @return
  544  */
  545 GLOBAL void siTraceFuncExit(   agsaRoot_t  *agRoot,  bit32   mask, char  fileid, char  * funcid, char  exitId )
  546 {
  547     bitptr         i;
  548     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  549     bit8          *bPtr;
  550     bit8           pos = 0;
  551 
  552     agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  553 
  554     IF_DO_TRACE
  555     {
  556       TRACE_ENTER_LOCK
  557       if ( saRoot->TraceDestination & smTraceDestBuffer )
  558       {
  559         BUFFER_WRAP_CHECK
  560         bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  561       }
  562       else
  563       {
  564         bPtr = tmpB;
  565       }
  566 
  567 #ifndef FC_DO_NOT_INCLUDE_FILE_NAME_TAGS_IN_ENTER_EXIT_TRACE
  568         bPtr[pos++] = (bit8)fileid;
  569 #endif
  570 
  571         for ( i=0; i<4; i++ )
  572         {
  573             if ( funcid[i] == 0 )
  574             {
  575                 break;
  576             }
  577             bPtr[pos++] = (bit8)funcid[i];
  578         }
  579         bPtr[pos++] = (bit8)exitId;
  580         bPtr[pos++] = (bit8)']';
  581         bPtr[pos++] = (bit8)' ';
  582         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  583         {
  584             bPtr[pos++] = '\r';
  585             bPtr[pos++] = '\n';
  586             saRoot->traceLineFeedCnt = 0;
  587         }
  588         saRoot->CurrentTraceIndex += pos;
  589 //        TRACE_OTHER_DEST
  590     TRACE_LEAVE_LOCK
  591     }
  592     return;
  593 }
  594 
  595 /**
  596  * siTraceListRemove
  597  *
  598  * PURPOSE:     Adds a trace tag for an exchange that is removed from a list
  599  *
  600  * PARAMETERS:
  601  *
  602  * CALLS:
  603  *
  604  * SIDE EFFECTS & CAVEATS:
  605  *
  606  * ALGORITHM:
  607  *
  608  *
  609  *     MODIFICATION HISTORY     ***********************
  610  *
  611  * ENGINEER NAME      DATE     DESCRIPTION
  612  * -------------    --------   -----------
  613  * Tom Nalepa       12/16/02   Initial Developmet
  614  *
  615  * @param hpRoot
  616  * @param mask
  617  * @param listId
  618  * @param exchangeId
  619  *
  620  * @return
  621  */
  622 GLOBAL void siTraceListRemove(agsaRoot_t  *agRoot,
  623                               bit32        mask,
  624                               char         listId,
  625                               bitptr       exchangeId)
  626 {
  627     agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
  628     bitptr         i;
  629     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  630     bit8          *bPtr;
  631     bit8           pos = 0;
  632 
  633     IF_DO_TRACE
  634     {
  635      TRACE_ENTER_LOCK
  636         if ( saRoot->TraceDestination & smTraceDestBuffer )
  637         {
  638             BUFFER_WRAP_CHECK
  639             bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  640         }
  641         else
  642         {
  643             bPtr = tmpB;
  644         }
  645         bPtr[pos++] = (bit8)'<';
  646         bPtr[pos++] = (bit8)listId;
  647         copyHex(exchangeId, 32);
  648         bPtr[pos++] = (bit8)' ';
  649         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  650         {
  651             bPtr[pos++] = '\r';
  652             bPtr[pos++] = '\n';
  653             saRoot->traceLineFeedCnt = 0;
  654         }
  655         saRoot->CurrentTraceIndex += pos;
  656 //        TRACE_OTHER_DEST
  657     TRACE_LEAVE_LOCK
  658     }
  659     return;
  660 }
  661 
  662 /**
  663  * siTraceListAdd
  664  *
  665  * PURPOSE:     Adds a trace tag for an exchange that is added to a list
  666  *
  667  * PARAMETERS:
  668  *
  669  * CALLS:
  670  *
  671  * SIDE EFFECTS & CAVEATS:
  672  *
  673  * ALGORITHM:
  674  *
  675  *
  676  *     MODIFICATION HISTORY     ***********************
  677  *
  678  * ENGINEER NAME      DATE     DESCRIPTION
  679  * -------------    --------   -----------
  680  * Tom Nalepa       12/16/02   Initial Developmet
  681  *
  682  * @param hpRoot
  683  * @param mask
  684  * @param listId
  685  * @param exchangeId
  686  *
  687  * @return
  688  */
  689 GLOBAL void siTraceListAdd(agsaRoot_t      *agRoot,
  690                            bit32        mask,
  691                            char         listId,
  692                            bitptr       exchangeId)
  693 {
  694 
  695   agsaLLRoot_t          *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
  696 
  697     bitptr         i;
  698     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  699     bit8          *bPtr;
  700     bit8           pos = 0;
  701 
  702     IF_DO_TRACE
  703     {
  704         if ( saRoot->TraceDestination & smTraceDestBuffer )
  705         {
  706             BUFFER_WRAP_CHECK
  707             bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  708         }
  709         else
  710         {
  711             bPtr = tmpB;
  712         }
  713         bPtr[pos++] = (bit8)'>';
  714         bPtr[pos++] = (bit8)listId;
  715         copyHex(exchangeId, 32);
  716         bPtr[pos++] = (bit8)' ';
  717         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  718         {
  719             bPtr[pos++] = '\r';
  720             bPtr[pos++] = '\n';
  721             saRoot->traceLineFeedCnt = 0;
  722         }
  723         saRoot->CurrentTraceIndex += pos;
  724 //        TRACE_OTHER_DEST
  725     }
  726     return;
  727 }
  728 
  729 /**
  730  * siTrace64
  731  *
  732  * PURPOSE:     Format a function parameter trace and post it to the appropriate
  733  *              destination.
  734  *
  735  * PARAMETERS:
  736  *
  737  * CALLS:
  738  *
  739  * SIDE EFFECTS & CAVEATS:
  740  *
  741  * ALGORITHM:
  742  *
  743  * siTrace : index is 0 for return value, 1 for first parm after "("
  744  *           produces:   _nn" XXXXXXXXXX
  745  *           index-----^    value--^
  746  *
  747  *
  748  *     MODIFICATION HISTORY     ***********************
  749  *
  750  * ENGINEER NAME      DATE     DESCRIPTION
  751  * -------------    --------   -----------
  752  *
  753  * @param hpRoot
  754  * @param mask
  755  * @param uId
  756  * @param value
  757  *
  758  * @return
  759  */
  760 GLOBAL void siTrace64(agsaRoot_t      *agRoot,
  761                       bit32        mask,
  762                       char       * uId,
  763                       bit64        value,
  764                       bit32        dataSizeInBits)
  765 {
  766 
  767     agsaLLRoot_t  *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
  768     bitptr         i;
  769     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  770     bit8          *bPtr;
  771     bit8           pos = 0;
  772 
  773     IF_DO_TRACE
  774     {
  775         if ( saRoot->TraceDestination & smTraceDestBuffer )
  776         {
  777             BUFFER_WRAP_CHECK
  778             bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  779         }
  780         else
  781         {
  782             bPtr = tmpB;
  783         }
  784         bPtr[pos++] = (bit8)'"';
  785         bPtr[pos++] = (bit8)uId[0];
  786         bPtr[pos++] = (bit8)uId[1];
  787         bPtr[pos++] = (bit8)':';
  788         copyHex(value, dataSizeInBits);
  789         bPtr[pos++] = (bit8)' ';
  790         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  791         {
  792             bPtr[pos++] = '\r';
  793             bPtr[pos++] = '\n';
  794             saRoot->traceLineFeedCnt = 0;
  795         }
  796         saRoot->CurrentTraceIndex += pos;
  797 //        TRACE_OTHER_DEST
  798     }
  799     return;
  800 }
  801 
  802 
  803 
  804 /**
  805  * siTrace
  806  *
  807  * PURPOSE:     Format a function parameter trace and post it to the appropriate
  808  *              destination.
  809  *
  810  * PARAMETERS:
  811  *
  812  * CALLS:
  813  *
  814  * SIDE EFFECTS & CAVEATS:
  815  *
  816  * ALGORITHM:
  817  *
  818  * fiTrace : index is 0 for return value, 1 for first parm after "("
  819  *           produces:   _nn" XXXXXXXXXX
  820  *           index-----^    value--^
  821  *
  822  *
  823  *     MODIFICATION HISTORY     ***********************
  824  *
  825  * ENGINEER NAME      DATE     DESCRIPTION
  826  * -------------    --------   -----------
  827  *
  828  * @param hpRoot
  829  * @param mask
  830  * @param uId
  831  * @param value
  832  *
  833  * @return
  834  */
  835 GLOBAL void siTrace( agsaRoot_t      *agRoot,
  836                     bit32        mask,
  837                     char       * uId,
  838                     bit32        value,
  839                     bit32        dataSizeInBits)
  840 {
  841 
  842    agsaLLRoot_t   *saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
  843 
  844     bitptr         i;
  845     bit8           tmpB[TMP_TRACE_BUFF_SIZE];
  846     bit8          *bPtr;
  847     bit8           pos = 0;
  848 
  849     IF_DO_TRACE
  850     {
  851         if ( saRoot->TraceDestination & smTraceDestBuffer )
  852         {
  853             BUFFER_WRAP_CHECK
  854             bPtr = &saRoot->TraceBuffer[saRoot->CurrentTraceIndex];
  855         }
  856         else
  857         {
  858             bPtr = tmpB;
  859         }
  860         bPtr[pos++] = (bit8)'"';
  861         bPtr[pos++] = (bit8)uId[0];
  862         bPtr[pos++] = (bit8)uId[1];
  863         bPtr[pos++] = (bit8)':';
  864         copyHex(value, dataSizeInBits);
  865         bPtr[pos++] = (bit8)' ';
  866         if ( saRoot->traceLineFeedCnt > FC_TRACE_LINE_SIZE )
  867         {
  868             bPtr[pos++] = '\r';
  869             bPtr[pos++] = '\n';
  870             saRoot->traceLineFeedCnt = 0;
  871         }
  872         saRoot->CurrentTraceIndex += pos;
  873 //        TRACE_OTHER_DEST
  874     }
  875     return;
  876 }
  877 
  878 
  879 /*Set Wrap 0 for Wrapping non zero stops when full  */
  880 
  881 
  882 GLOBAL void siTraceGetInfo(agsaRoot_t  *agRoot, hpTraceBufferParms_t * pBParms)
  883 {
  884     agsaLLRoot_t  *saRoot = (agsaLLRoot_t *)agRoot->sdkData;
  885 
  886     pBParms->TraceCompiled  =  TRUE;
  887 
  888     pBParms->TraceWrap                  = saRoot->TraceMask & 0x80000000;
  889     pBParms->CurrentTraceIndexWrapCount = saRoot->CurrentTraceIndexWrapCount;
  890     pBParms->BufferSize                 = saRoot->TraceBufferLength;
  891     pBParms->CurrentIndex               = saRoot->CurrentTraceIndex;
  892     pBParms->pTrace                     = saRoot->TraceBuffer;
  893     pBParms->pTraceIndexWrapCount       = &saRoot->CurrentTraceIndexWrapCount;
  894     pBParms->pTraceMask                 = &saRoot->TraceMask;
  895     pBParms->pCurrentTraceIndex         = &saRoot->CurrentTraceIndex;
  896 }
  897 /**/
  898 
  899 GLOBAL void siTraceSetMask(agsaRoot_t  *agRoot, bit32 TraceMask  )
  900 {
  901     agsaLLRoot_t  *saRoot = (agsaLLRoot_t *)agRoot->sdkData;
  902     saRoot->TraceMask = TraceMask;
  903 }
  904 
  905 
  906 
  907 #endif
  908 
  909 

Cache object: 3c98cfa1203ecbc00f8d63578ff53a0a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.