1 /*******************************************************************************
2 *Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
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
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.
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
21 ********************************************************************************/
22 /*******************************************************************************/
24 * \brief The file implements the functions to Start, Stop a phy
28 /******************************************************************************/
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31 #include <dev/pms/config.h>
33 #include <dev/pms/RefTisa/sallsdk/spc/saglobal.h>
34 #ifdef SA_ENABLE_TRACE_FUNCTIONS
38 #define siTraceFileID 'K'
42 extern bit32 gFPGA_TEST;
43 /******************************************************************************/
44 /*! \brief Start a Phy
48 * \param agRoot handles for this instance of SAS/SATA hardware
50 * \param phyId the phy id of the link will be started
51 * \param agPhyConfig the phy configuration
52 * \param agSASIdentify the SAS identify frame will be sent by the phy
54 * \return If phy is started successfully
55 * - \e AGSA_RC_SUCCESS phy is started successfully
56 * - \e AGSA_RC_BUSY phy is already started or starting
57 * - \e AGSA_RC_FAILURE phy is not started successfully
59 /*******************************************************************************/
60 GLOBAL bit32 saPhyStart(
62 agsaContext_t *agContext,
65 agsaPhyConfig_t *agPhyConfig,
66 agsaSASIdentify_t *agSASIdentify
69 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
70 agsaIORequestDesc_t *pRequest;
71 bit32 ret = AGSA_RC_SUCCESS;
72 bit32 using_reserved = agFALSE;
74 smTraceFuncEnter(hpDBG_VERY_LOUD, "7a");
77 SA_ASSERT((agNULL != agRoot), "");
78 SA_ASSERT((agNULL != agSASIdentify), "");
80 SA_DBG3(("saPhyStart: phy%d started with ID %08X:%08X\n",
82 SA_IDFRM_GET_SAS_ADDRESSHI(agSASIdentify),
83 SA_IDFRM_GET_SAS_ADDRESSLO(agSASIdentify)));
85 /* If phyId is invalid, return failure */
86 if ( phyId >= saRoot->phyCount )
88 ret = AGSA_RC_FAILURE;
90 /* If phyId is valid */
93 /* Get request from free IORequests */
94 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
95 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests)); /* */
96 /* If no LL Control request entry available */
97 if ( agNULL == pRequest )
99 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests));
100 /* If no LL Control request entry available */
101 if(agNULL != pRequest)
103 using_reserved = agTRUE;
104 SA_DBG1(("saPhyStart, using saRoot->freeReservedRequests\n"));
108 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
109 SA_DBG1(("saPhyStart, No request from free list Not using saRoot->freeReservedRequests\n"));
110 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "7a");
114 SA_ASSERT((!pRequest->valid), "The pRequest is in use");
115 pRequest->valid = agTRUE;
116 /* If LL Control request entry avaliable */
119 saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
123 /* Remove the request from free list */
124 saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
126 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
128 saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
129 saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
130 saRoot->IOMap[pRequest->HTag].agContext = agContext;
131 pRequest->valid = agTRUE;
133 /* Build the Phy Start IOMB command and send to SPC */
135 smTrace(hpDBG_VERY_LOUD,"P2", phyId);
138 ret = mpiPhyStartCmd(agRoot, pRequest->HTag, phyId, agPhyConfig, agSASIdentify, queueNum);
139 if (AGSA_RC_SUCCESS != ret)
141 /* remove the request from IOMap */
142 saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
143 saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
144 saRoot->IOMap[pRequest->HTag].agContext = agNULL;
145 pRequest->valid = agFALSE;
147 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
148 /* return the request to free pool */
149 if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
151 SA_DBG1(("saPhyStart: saving pRequest (%p) for later use\n", pRequest));
152 saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
156 /* return the request to free pool */
157 saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
159 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
160 SA_DBG1(("saPhyStart, sending IOMB failed\n" ));
164 smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "7a");
169 /******************************************************************************/
170 /*! \brief Stop a Phy
174 * \param agRoot handles for this instance of SAS/SATA hardware
175 * \param agContext the context of this API
176 * \param phyId the phy id of the link will be stopped
178 * \return If phy is stopped successfully
179 * - \e AGSA_RC_SUCCESS phy is stopped successfully
180 * - \e AGSA_RC_FAILURE phy is not stopped successfully
182 /*******************************************************************************/
183 GLOBAL bit32 saPhyStop(
185 agsaContext_t *agContext,
190 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
191 agsaIORequestDesc_t *pRequest;
192 bit32 ret = AGSA_RC_SUCCESS;
193 bit32 using_reserved = agFALSE;
195 smTraceFuncEnter(hpDBG_VERY_LOUD,"7b");
198 SA_ASSERT((agNULL != agRoot), "");
200 SA_DBG2(("saPhyStop: phy%d stop\n", phyId));
204 mpiOCQueue_t *circularQ;
206 SA_DBG4(("saPhyStop:\n"));
207 for ( i = 0; i < saRoot->QueueConfig.numOutboundQueues; i++ )
209 circularQ = &saRoot->outboundQueue[i];
210 OSSA_READ_LE_32(circularQ->agRoot, &circularQ->producerIdx, circularQ->piPointer, 0);
211 if(circularQ->producerIdx != circularQ->consumerIdx)
213 SA_DBG1(("saPhyStop: PI 0x%03x CI 0x%03x\n",circularQ->producerIdx, circularQ->consumerIdx ));
222 /* If phyId is invalid, return failure */
223 if ( (phyId & 0xF) >= saRoot->phyCount )
225 ret = AGSA_RC_FAILURE;
226 SA_DBG1(("saPhyStop: phy%d - failure with phyId\n", phyId));
230 /* If phyId is valid */
231 /* Get request from free IORequests */
232 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
233 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests)); /**/
234 /* If no LL Control request entry available */
235 if ( agNULL == pRequest )
237 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests));
238 /* If no LL Control request entry available */
239 if(agNULL != pRequest)
241 using_reserved = agTRUE;
242 SA_DBG1(("saPhyStop: using saRoot->freeReservedRequests\n"));
246 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
247 SA_DBG1(("saPhyStop, No request from free list Not using saRoot->freeReservedRequests\n"));
248 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "7b");
252 /* Remove the request from free list */
255 saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
259 saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
261 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
262 SA_ASSERT((!pRequest->valid), "The pRequest is in use");
263 saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
264 saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
265 saRoot->IOMap[pRequest->HTag].agContext = agContext;
266 pRequest->valid = agTRUE;
268 /* build IOMB command and send to SPC */
269 ret = mpiPhyStopCmd(agRoot, pRequest->HTag, phyId, queueNum);
270 if (AGSA_RC_SUCCESS != ret)
272 /* remove the request from IOMap */
273 saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
274 saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
275 saRoot->IOMap[pRequest->HTag].agContext = agNULL;
277 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
278 /* return the request to free pool */
279 if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
281 SA_DBG2(("saPhyStop: saving pRequest (%p) for later use\n", pRequest));
282 saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
286 /* return the request to free pool */
287 saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
289 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
290 SA_DBG1(("saPhyStop, sending IOMB failed\n" ));
294 smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "7b");
299 /******************************************************************************/
300 /*! \brief CallBack Routine to stop a Phy
302 * CallBack for Stop a Phy
304 * \param agRoot handles for this instance of SAS/SATA hardware
305 * \param phyId the phy id of the link will be stopped
306 * \param status the status of the phy
307 * \param agContext the context of the saPhyStop
309 * \return If phy is stopped successfully
310 * - \e AGSA_RC_SUCCESS phy is stopped successfully
311 * - \e AGSA_RC_FAILURE phy is not stopped successfully
313 /*******************************************************************************/
314 GLOBAL bit32 siPhyStopCB(
318 agsaContext_t *agContext,
323 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
326 bit32 ret = AGSA_RC_SUCCESS;
327 bit32 iomb_status = status;
329 smTraceFuncEnter(hpDBG_VERY_LOUD,"7c");
332 SA_ASSERT((agNULL != agRoot), "");
334 /* If phyId is invalid, return failure */
335 if ( phyId >= saRoot->phyCount )
337 ret = AGSA_RC_FAILURE;
338 SA_DBG1(("siPhyStopCB: phy%d - failure with phyId\n", phyId));
340 status = (status << SHIFT8) | phyId;
341 status |= ((npipps & PORT_STATE_MASK) << SHIFT16);
342 ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_PHY_STOP_STATUS, status, agContext, agNULL);
344 /* If phyId is valid */
347 pPhy = &(saRoot->phys[phyId]);
349 /* get the port of the phy */
353 status = (status << SHIFT8) | phyId;
354 status |= ((npipps & PORT_STATE_MASK) << SHIFT16);
355 /* Callback to stop phy */
356 if ( agNULL != pPort )
358 if ( iomb_status == OSSA_SUCCESS && (OSSA_PORT_INVALID == (npipps & PORT_STATE_MASK) ))
360 SA_DBG1(("siPhyStopCB: phy%d invalidating port\n", phyId));
361 /* invalid port state, remove the port */
362 pPort->status |= PORT_INVALIDATING;
363 saRoot->PortMap[portId].PortStatus |= PORT_INVALIDATING;
364 /* invalid the port */
365 siPortInvalid(agRoot, pPort);
366 /* map out the portmap */
367 saRoot->PortMap[pPort->portId].PortContext = agNULL;
368 saRoot->PortMap[pPort->portId].PortID = PORT_MARK_OFF;
369 saRoot->PortMap[pPort->portId].PortStatus |= PORT_INVALIDATING;
371 ossaHwCB(agRoot, &(pPort->portContext), OSSA_HW_EVENT_PHY_STOP_STATUS, status, agContext, agNULL);
375 SA_DBG1(("siPhyStopCB: phy%d - Port is not established\n", phyId));
376 ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_PHY_STOP_STATUS, status, agContext, agNULL);
379 /* set PHY_STOPPED status */
380 PHY_STATUS_SET(pPhy, PHY_STOPPED);
382 /* Exclude the phy from a port */
383 if ( agNULL != pPort )
385 /* Acquire port list lock */
386 ossaSingleThreadedEnter(agRoot, LL_PORT_LOCK);
388 /* Delete the phy from the port */
389 pPort->phyMap[phyId] = agFALSE;
390 saRoot->phys[phyId].pPort = agNULL;
392 /* Release port list lock */
393 ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK);
397 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "7c");
403 /******************************************************************************/
404 /*! \brief Initiate a Local PHY control command
406 * This function is called to initiate a PHY control command to the local PHY.
407 * The completion of this function is reported in ossaLocalPhyControlCB()
410 * \param agRoot handles for this instance of SAS/SATA hardware
411 * \param agContext the context of this API
412 * \param phyId phy number
413 * \param phyOperation
414 * one of AGSA_PHY_LINK_RESET, AGSA_PHY_HARD_RESET, AGSA_PHY_ENABLE_SPINUP
419 /*******************************************************************************/
420 GLOBAL bit32 saLocalPhyControl(
422 agsaContext_t *agContext,
426 ossaLocalPhyControlCB_t agCB
429 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
430 agsaIORequestDesc_t *pRequest;
431 agsaPhyErrCounters_t errorParam;
432 bit32 ret = AGSA_RC_SUCCESS;
433 bit32 value, value1, value2, copyPhyId;
435 bit32 using_reserved = agFALSE;
439 SA_ASSERT((agNULL != saRoot), "");
442 SA_DBG1(("saLocalPhyControl: saRoot == agNULL\n"));
443 return(AGSA_RC_FAILURE);
445 smTraceFuncEnter(hpDBG_VERY_LOUD,"7d");
447 si_memset(&errorParam,0,sizeof(agsaPhyErrCounters_t));
448 SA_DBG2(("saLocalPhyControl: phy%d operation %08X\n", phyId, phyOperation));
452 case AGSA_PHY_LINK_RESET:
453 case AGSA_PHY_HARD_RESET:
454 case AGSA_PHY_NOTIFY_ENABLE_SPINUP:
455 case AGSA_PHY_BROADCAST_ASYNCH_EVENT:
456 case AGSA_PHY_COMINIT_OOB:
458 /* Get request from free IORequests */
459 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
460 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests)); /**/
462 /* If no LL Control request entry available */
463 if ( agNULL == pRequest )
465 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests));
466 /* If no LL Control request entry available */
467 if(agNULL != pRequest)
469 using_reserved = agTRUE;
470 SA_DBG1(("saLocalPhyControl, using saRoot->freeReservedRequests\n"));
474 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
475 SA_DBG1(("saLocalPhyControl, No request from free list Not using saRoot->freeReservedRequests\n"));
476 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "7d");
482 saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
486 saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
488 /* Remove the request from free list */
489 SA_ASSERT((!pRequest->valid), "The pRequest is in use");
490 pRequest->completionCB = (void*)agCB;
491 // pRequest->abortCompletionCB = agCB;
492 saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
493 saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
494 saRoot->IOMap[pRequest->HTag].agContext = agContext;
495 pRequest->valid = agTRUE;
496 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
498 /* Build the local phy control IOMB command and send to SPC */
499 ret = mpiLocalPhyControlCmd(agRoot, pRequest->HTag, phyId, phyOperation, queueNum);
500 if (AGSA_RC_SUCCESS != ret)
502 /* remove the request from IOMap */
503 saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
504 saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
505 saRoot->IOMap[pRequest->HTag].agContext = agNULL;
506 pRequest->valid = agFALSE;
508 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
509 /* return the request to free pool */
510 if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
512 SA_DBG1(("saLocalPhyControl: saving pRequest (%p) for later use\n", pRequest));
513 saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
517 /* return the request to free pool */
518 saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
520 SA_DBG1(("saLocalPhyControl, sending IOMB failed\n" ));
521 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
526 case AGSA_PHY_GET_ERROR_COUNTS:
528 if(smIS_SPCV(agRoot))
531 SA_ASSERT((smIS_SPC(agRoot)), "SPC only");
532 SA_DBG1(("saLocalPhyControl: V AGSA_PHY_GET_ERROR_COUNTS\n" ));
533 smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "7d");
534 return AGSA_RC_FAILURE;
536 /* If phyId is invalid, return failure */
537 if ( phyId >= saRoot->phyCount )
539 ret = AGSA_RC_FAILURE;
540 si_memset(&errorParam, 0, sizeof(agsaPhyErrCounters_t));
541 SA_DBG1(("saLocalPhyControl: phy%d - failure with phyId\n", phyId));
542 /* call back with the status */
546 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
550 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
552 smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "7d");
557 /* map 0x030000 or 0x040000 based on phyId to BAR4(0x20), BAT2(win) to access the register */
560 /* for phyId = 0, 1, 2, 3 */
565 /* for phyId = 4, 5, 6, 7 */
570 /* Need to make sure DEVICE_LCLK_GENERATION register bit 6 is 0 */
571 value1 = ossaHwRegReadExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK);
573 SA_DBG3(("saLocalPhyControl: TOP DEVICE LCLK Register value = %08X\n", value1));
574 /* If LCLK_CLEAR bit set then disable it */
575 if (value1 & DEVICE_LCLK_CLEAR)
577 ossaHwRegWriteExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK, (value1 & 0xFFFFFFBF) );
578 SA_DBG3(("saLocalPhyControl: TOP DEVICE LCLK value = %08X\n", (value1 & 0xFFFFFFBF)));
581 if (AGSA_RC_FAILURE == siBar4Shift(agRoot, value))
583 SA_DBG1(("saLocalPhyControl:Shift Bar4 to 0x%x failed\n", value));
585 /* call back with the status */
589 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
593 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
596 smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "7d");
597 return AGSA_RC_FAILURE;
600 /* set LCLK = 1 and LCLK_CLEAR = 0 */
601 SPC_WRITE_COUNTER_CNTL(phyId, LCLK);
603 /* LCLK bit should be low to be able to read error registers */
604 while((value = SPC_READ_COUNTER_CNTL(phyId)) & LCLK)
608 SA_DBG1(("saLocalPhyControl: Timeout,SPC_COUNTER_CNTL value = %08X\n", value));
609 ret = AGSA_RC_FAILURE;
614 value = SPC_READ_COUNTER_CNTL(phyId);
615 SA_DBG3(("saLocalPhyControl: SPC_COUNTER_CNTL value = %08X\n", value));
618 errorParam.invalidDword = SPC_READ_INV_DW_COUNT(phyId);
619 /* runningDisparityError */
620 errorParam.runningDisparityError = SPC_READ_DISP_ERR_COUNT(phyId);
621 /* lossOfDwordSynch */
622 errorParam.lossOfDwordSynch = SPC_READ_LOSS_DW_COUNT(phyId);
623 /* phyResetProblem */
624 errorParam.phyResetProblem = SPC_READ_PHY_RESET_COUNT(phyId);
626 errorParam.codeViolation = SPC_READ_CODE_VIO_COUNT(phyId);
627 /* never occurred in SPC8x6G */
628 errorParam.elasticityBufferOverflow = 0;
629 errorParam.receivedErrorPrimitive = 0;
630 errorParam.inboundCRCError = 0;
632 SA_DBG3(("saLocalPhyControl:INV_DW_COUNT 0x%x\n", SPC_READ_INV_DW_COUNT(phyId)));
633 SA_DBG3(("saLocalPhyControl:DISP_ERR_COUNT 0x%x\n", SPC_READ_DISP_ERR_COUNT(phyId)));
634 SA_DBG3(("saLocalPhyControl:LOSS_DW_COUNT 0x%x\n", SPC_READ_LOSS_DW_COUNT(phyId)));
635 SA_DBG3(("saLocalPhyControl:PHY_RESET_COUNT 0x%x\n", SPC_READ_PHY_RESET_COUNT(phyId)));
636 SA_DBG3(("saLocalPhyControl:CODE_VIOLATION_COUNT 0x%x\n", SPC_READ_CODE_VIO_COUNT(phyId)));
638 /* Shift back to BAR4 original address */
639 if (AGSA_RC_FAILURE == siBar4Shift(agRoot, 0x0))
641 SA_DBG1(("saLocalPhyControl:Shift Bar4 to 0x%x failed\n", 0x0));
642 ret = AGSA_RC_FAILURE;
645 /* restore back the Top Device LCLK generation register value */
646 ossaHwRegWriteExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK, value1);
650 /* call back with the status */
652 if (AGSA_RC_SUCCESS == ret)
656 ossaLocalPhyControlCB(agRoot, agContext, copyPhyId, phyOperation, OSSA_SUCCESS, (void *)&errorParam);
660 agCB(agRoot, agContext, copyPhyId, phyOperation, OSSA_SUCCESS, (void *)&errorParam);
667 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
671 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
676 case AGSA_PHY_CLEAR_ERROR_COUNTS:
678 if(smIS_SPCV(agRoot))
681 SA_ASSERT((smIS_SPC(agRoot)), "SPC only");
682 SA_DBG1(("saLocalPhyControl: V AGSA_PHY_CLEAR_ERROR_COUNTS\n" ));
683 smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "7d");
684 return AGSA_RC_FAILURE;
686 /* If phyId is invalid, return failure */
687 if ( phyId >= saRoot->phyCount )
689 si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t));
690 SA_DBG3(("saLocalPhyControl(CLEAR): phy%d - failure with phyId\n", phyId));
691 /* call back with the status */
694 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
698 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
700 smTraceFuncExit(hpDBG_VERY_LOUD, 'f', "7d");
701 return AGSA_RC_FAILURE;
705 /* map 0x030000 or 0x040000 based on phyId to BAR4(0x20), BAT2(win) to access the register */
708 /* for phyId = 0, 1, 2, 3 */
713 /* for phyId = 4, 5, 6, 7 */
717 /* Need to make sure DEVICE_LCLK_GENERATION register bit 6 is 1 */
718 value2 = ossaHwRegReadExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK);
720 SA_DBG3(("saLocalPhyControl: TOP DEVICE LCLK Register value = %08X\n", value2));
721 /* If LCLK_CLEAR bit not set then set it */
722 if ((value2 & DEVICE_LCLK_CLEAR) == 0)
724 ossaHwRegWriteExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK, (value2 | DEVICE_LCLK_CLEAR) );
725 SA_DBG3(("saLocalPhyControl: TOP DEVICE LCLK value = %08X\n", (value2 & 0xFFFFFFBF)));
728 if (AGSA_RC_FAILURE == siBar4Shift(agRoot, value))
730 SA_DBG1(("saLocalPhyControl(CLEAR):Shift Bar4 to 0x%x failed\n", value));
732 /* call back with the status */
735 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
739 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
741 smTraceFuncExit(hpDBG_VERY_LOUD, 'g', "7d");
742 return AGSA_RC_FAILURE;
745 /* read Counter Control register */
746 value1 = SPC_READ_COUNTER_CNTL(phyId);
747 SA_DBG3(("saLocalPhyControl(CLEAR): SPC_COUNTER_CNTL value = %08X\n", value1));
748 /* set LCLK and LCLK_CLEAR */
749 SPC_WRITE_COUNTER_CNTL(phyId, (LCLK_CLEAR | LCLK));
750 /* read back the value of register */
751 /* poll LCLK bit = 0 */
752 while((value = SPC_READ_COUNTER_CNTL(phyId)) & LCLK)
756 SA_DBG1(("saLocalPhyControl: Timeout,SPC_COUNTER_CNTL value = %08X\n", value));
757 ret = AGSA_RC_FAILURE;
762 value = SPC_READ_COUNTER_CNTL(phyId);
763 SA_DBG3(("saLocalPhyControl(CLEAR): SPC_COUNTER_CNTL value = %08X\n", value));
765 /* restore the value */
766 SPC_WRITE_COUNTER_CNTL(phyId, value1);
768 /* Shift back to BAR4 original address */
769 if (AGSA_RC_FAILURE == siBar4Shift(agRoot, 0x0))
771 SA_DBG1(("saLocalPhyControl:Shift Bar4 to 0x%x failed\n", 0x0));
772 ret = AGSA_RC_FAILURE;
775 /* restore back the Top Device LCLK generation register value */
776 ossaHwRegWriteExt(agRoot, PCIBAR2, SPC_REG_DEVICE_LCLK, value2);
780 /* call back with the status */
781 if (AGSA_RC_SUCCESS == ret)
785 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_SUCCESS, agNULL);
789 agCB(agRoot, agContext, phyId, phyOperation, OSSA_SUCCESS, agNULL);
796 ossaLocalPhyControlCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
800 agCB(agRoot, agContext, phyId, phyOperation, OSSA_FAILURE, (void *)&errorParam);
805 case AGSA_PHY_GET_BW_COUNTS:
807 SA_ASSERT((smIS_SPC(agRoot)), "SPCv only");
808 SA_DBG1(("saLocalPhyControl: AGSA_PHY_GET_BW_COUNTS\n" ));
813 ret = AGSA_RC_FAILURE;
814 SA_ASSERT(agFALSE, "(saLocalPhyControl) Unknown operation");
818 smTraceFuncExit(hpDBG_VERY_LOUD, 'h', "7d");
823 GLOBAL bit32 saGetPhyProfile(
825 agsaContext_t *agContext,
831 bit32 ret = AGSA_RC_SUCCESS;
833 agsaLLRoot_t *saRoot = agNULL;
834 agsaPhyErrCountersPage_t errorParam;
836 ossaLocalPhyControlCB_t agCB = ossaGetPhyProfileCB;
839 SA_ASSERT((agNULL != agRoot), "");
840 saRoot = (agsaLLRoot_t *) (agRoot->sdkData);
841 SA_ASSERT((agNULL != saRoot), "");
845 SA_DBG3(("saGetPhyProfile : saRoot is NULL"));
846 return AGSA_RC_FAILURE;
849 SA_DBG1(("saGetPhyProfile: ppc 0x%x phyID %d\n", ppc,phyId));
853 case AGSA_SAS_PHY_ERR_COUNTERS_PAGE:
855 if(smIS_SPCV(agRoot))
858 SA_DBG1(("saGetPhyProfile: V AGSA_SAS_PHY_ERR_COUNTERS_PAGE\n" ));
860 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
861 smTraceFuncExit(hpDBG_VERY_LOUD, 'i', "7d");
865 case AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE:
867 /* If phyId is invalid, return failure */
868 if ( phyId >= saRoot->phyCount )
870 si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t));
871 SA_DBG3(("saGetPhyProfile(CLEAR): phy%d - failure with phyId\n", phyId));
872 /* call back with the status */
873 ossaGetPhyProfileCB(agRoot, agContext, phyId, ppc, OSSA_FAILURE, (void *)&errorParam);
874 smTraceFuncExit(hpDBG_VERY_LOUD, 'j', "7d");
875 return AGSA_RC_FAILURE;
877 if(smIS_SPCV(agRoot))
879 SA_DBG1(("saGetPhyProfile: V AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE\n" ));
881 ret = mpiGetPhyProfileCmd( agRoot,agContext, ppc,phyId,agCB);
882 smTraceFuncExit(hpDBG_VERY_LOUD, 'k', "7d");
887 case AGSA_SAS_PHY_BW_COUNTERS_PAGE:
889 SA_DBG1(("saGetPhyProfile: AGSA_SAS_PHY_BW_COUNTERS_PAGE\n" ));
890 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
893 case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE:
895 SA_DBG1(("saGetPhyProfile: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE\n" ));
896 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
900 case AGSA_SAS_PHY_GENERAL_STATUS_PAGE:
902 SA_DBG1(("saGetPhyProfile: AGSA_SAS_PHY_GENERAL_STATUS_PAGE\n" ));
903 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
906 case AGSA_PHY_SNW3_PAGE:
908 SA_DBG1(("saGetPhyProfile: AGSA_PHY_SNW3_PAGE\n" ));
909 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
912 case AGSA_PHY_RATE_CONTROL_PAGE:
914 SA_DBG1(("saGetPhyProfile: AGSA_PHY_RATE_CONTROL_PAGE\n" ));
915 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
918 case AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE:
920 SA_DBG1(("saGetPhyProfile: AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE\n" ));
921 ret = mpiGetPhyProfileCmd( agRoot,agContext,ppc ,phyId,agCB);
926 SA_DBG1(("saGetPhyProfile: Unknown operation 0x%X\n",ppc ));
927 SA_ASSERT(agFALSE, "saGetPhyProfile Unknown operation " );
936 GLOBAL bit32 saSetPhyProfile (
938 agsaContext_t *agContext,
946 bit32 ret = AGSA_RC_SUCCESS;
948 SA_DBG1(("saSetPhyProfile: ppc 0x%x length 0x%x phyID %d\n", ppc,length,phyID));
952 case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE:
954 SA_DBG1(("saSetPhyProfile: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE\n" ));
955 ret = mpiSetPhyProfileCmd( agRoot,agContext,ppc ,phyID,length,buffer);
958 case AGSA_PHY_SNW3_PAGE:
960 SA_DBG1(("saSetPhyProfile: AGSA_PHY_SNW3_PAGE\n" ));
961 ret = mpiSetPhyProfileCmd( agRoot,agContext,ppc ,phyID,length,buffer);
964 case AGSA_PHY_RATE_CONTROL_PAGE:
966 SA_DBG1(("saSetPhyProfile: AGSA_PHY_RATE_CONTROL_PAGE\n" ));
967 ret = mpiSetPhyProfileCmd( agRoot,agContext,ppc ,phyID,length,buffer);
970 case AGSA_SAS_PHY_MISC_PAGE:
972 SA_DBG1(("saSetPhyProfile: AGSA_SAS_PHY_MISC_PAGE\n"));
973 ret = mpiSetPhyProfileCmd( agRoot,agContext,ppc ,phyID,length,buffer);
978 SA_DBG1(("saSetPhyProfile: Unknown operation 0x%X\n",ppc ));
979 SA_ASSERT(agFALSE, "saSetPhyProfile Unknown operation " );
980 ret = AGSA_RC_FAILURE;
987 /******************************************************************************/
988 /*! \brief Initiate a HW Event Ack command
990 * This function is called to initiate a HW Event Ack command to the SPC.
991 * The completion of this function is reported in ossaHwEventAckCB().
993 * \param agRoot handles for this instance of SAS/SATA hardware
994 * \param agContext the context of this API
995 * \param queueNum queue number
996 * \param eventSource point to the event source structure
1003 /*******************************************************************************/
1004 GLOBAL bit32 saHwEventAck(
1006 agsaContext_t *agContext,
1008 agsaEventSource_t *eventSource,
1013 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1014 agsaIORequestDesc_t *pRequest;
1015 agsaPortContext_t *agPortContext;
1016 agsaPort_t *pPort = agNULL;
1017 agsaSASHwEventAckCmd_t payload;
1019 bit32 ret = AGSA_RC_SUCCESS;
1020 bit32 using_reserved = agFALSE;
1022 smTraceFuncEnter(hpDBG_VERY_LOUD,"7e");
1025 SA_ASSERT((agNULL != saRoot), "");
1026 if(saRoot == agNULL)
1028 SA_DBG1(("saHwEventAck: saRoot == agNULL\n"));
1029 return(AGSA_RC_FAILURE);
1032 SA_DBG2(("saHwEventAck: agContext %p eventSource %p\n", agContext, eventSource));
1033 SA_DBG1(("saHwEventAck: event 0x%x param0 0x%x param1 0x%x\n", eventSource->event, param0, param1));
1035 agPortContext = eventSource->agPortContext;
1037 /* Get request from free IORequests */
1038 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1039 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests)); /**/
1041 /* If no LL Control request entry available */
1042 if ( agNULL == pRequest )
1044 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests)); /**/
1045 if(agNULL != pRequest)
1047 using_reserved = agTRUE;
1048 SA_DBG1(("saHwEventAck, using saRoot->freeReservedRequests\n"));
1052 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1053 /* If no LL Control request entry available */
1054 SA_DBG1(("saHwEventAck, No request from free list Not using saRoot->freeReservedRequests\n"));
1055 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "7e");
1056 return AGSA_RC_BUSY;
1059 if( using_reserved )
1061 saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1065 /* Remove the request from free list */
1066 saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
1068 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1069 SA_ASSERT((!pRequest->valid), "The pRequest is in use");
1071 SA_DBG2(("saHwEventAck: queueNum 0x%x HTag 0x%x\n",queueNum ,pRequest->HTag));
1073 saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
1074 saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
1075 saRoot->IOMap[pRequest->HTag].agContext = agContext;
1076 pRequest->valid = agTRUE;
1078 /* build IOMB command and send to SPC */
1079 /* set payload to zeros */
1080 si_memset(&payload, 0, sizeof(agsaSASHwEventAckCmd_t));
1085 pPort = (agsaPort_t *) (agPortContext->sdkData);
1088 if(eventSource->event == OSSA_HW_EVENT_PHY_DOWN)
1090 pPort->tobedeleted = agTRUE;
1092 SA_DBG3(("saHwEventAck,pPort->portId %X\n",pPort->portId));
1094 if(smIS_SPC(agRoot))
1096 /* fillup PORT_ID field */
1097 phyportid = pPort->portId & 0xF;
1101 /* fillup PORT_ID field */
1102 phyportid = pPort->portId & 0xFF;
1108 /* pPort is NULL - set PORT_ID to not intialized */
1109 if(smIS_SPC(agRoot))
1121 /* agPortContext is NULL - set PORT_ID to not intialized */
1122 if(smIS_SPC(agRoot))
1132 pRequest->pPort = pPort;
1134 SA_DBG3(("saHwEventAck,eventSource->param 0x%X\n",eventSource->param));
1135 SA_DBG3(("saHwEventAck,eventSource->event 0x%X\n",eventSource->event));
1137 if(smIS_SPC(agRoot))
1139 /* fillup up PHY_ID */
1140 phyportid |= ((eventSource->param & 0x0000000F) << 4);
1141 /* fillup SEA field */
1142 phyportid |= (eventSource->event & 0x0000FFFF) << 8;
1143 SA_DBG3(("saHwEventAck: portId 0x%x phyId 0x%x SEA 0x%x\n", phyportid & 0xF,
1144 eventSource->param & 0x0000000F, eventSource->event & 0x0000FFFF));
1148 /* fillup up PHY_ID */
1149 phyportid |= ((eventSource->param & 0x000000FF) << SHIFT24);
1150 /* fillup SEA field */
1151 phyportid |= (eventSource->event & 0x00FFFFFF) << SHIFT8;
1152 SA_DBG3(("saHwEventAck: portId 0x%x phyId 0x%x SEA 0x%x\n", phyportid & 0xFF,
1153 eventSource->param & 0x0000000F, eventSource->event & 0x0000FFFF));
1156 pRequest->HwAckType = (bit16)phyportid;
1158 SA_DBG1(("saHwEventAck,phyportid 0x%X HwAckType 0x%X\n",phyportid,pRequest->HwAckType));
1160 OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaSASHwEventAckCmd_t, tag), pRequest->HTag);
1161 OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaSASHwEventAckCmd_t, sEaPhyIdPortId), phyportid);
1162 OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaSASHwEventAckCmd_t, Param0), param0);
1163 OSSA_WRITE_LE_32(agRoot, &payload, OSSA_OFFSET_OF(agsaSASHwEventAckCmd_t, Param1), param1);
1165 /* build IOMB command and send to SPC */
1167 if(smIS_SPC(agRoot))
1169 ret = mpiBuildCmd(agRoot, (bit32 *)&payload, MPI_CATEGORY_SAS_SATA, OPC_INB_SPC_SAS_HW_EVENT_ACK, IOMB_SIZE64, queueNum);
1173 ret = mpiBuildCmd(agRoot, (bit32 *)&payload, MPI_CATEGORY_SAS_SATA, OPC_INB_SAS_HW_EVENT_ACK, IOMB_SIZE64, queueNum);
1176 if (AGSA_RC_SUCCESS != ret)
1178 /* remove the request from IOMap */
1179 saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
1180 saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
1181 saRoot->IOMap[pRequest->HTag].agContext = agNULL;
1182 pRequest->valid = agFALSE;
1184 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1185 /* return the request to free pool */
1186 if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1188 SA_DBG1(("saHwEventAck: saving pRequest (%p) for later use\n", pRequest));
1189 saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1193 /* return the request to free pool */
1194 saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1196 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1197 SA_DBG1(("saHwEventAck, sending IOMB failed\n" ));
1199 smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "7e");
1205 GLOBAL bit32 saVhistCapture(
1207 agsaContext_t *agContext,
1217 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1218 agsaIORequestDesc_t *pRequest;
1219 bit32 ret = AGSA_RC_SUCCESS;
1220 bit32 using_reserved = agFALSE;
1222 smTraceFuncEnter(hpDBG_VERY_LOUD,"3N");
1225 SA_ASSERT((agNULL != agRoot), "");
1227 SA_DBG1(("saVhistCapture:Channel 0x%08X 0x%08X%08X 0x%08X%08X count 0x%X\n",Channel, NumBitHi, NumBitLo ,PcieAddrHi,PcieAddrLo,ByteCount));
1230 /* Get request from free IORequests */
1231 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1232 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeIORequests)); /* */
1233 /* If no LL Control request entry available */
1234 if ( agNULL == pRequest )
1236 pRequest = (agsaIORequestDesc_t *)saLlistIOGetHead(&(saRoot->freeReservedRequests));
1237 /* If no LL Control request entry available */
1238 if(agNULL != pRequest)
1240 using_reserved = agTRUE;
1241 SA_DBG1((", using saRoot->freeReservedRequests\n"));
1245 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1246 SA_DBG1(("saVhistCapture: No request from free list Not using saRoot->freeReservedRequests\n"));
1247 smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3N");
1248 return AGSA_RC_BUSY;
1251 SA_ASSERT((!pRequest->valid), "The pRequest is in use");
1252 pRequest->valid = agTRUE;
1253 /* If LL Control request entry avaliable */
1254 if( using_reserved )
1256 saLlistIORemove(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1260 /* Remove the request from free list */
1261 saLlistIORemove(&(saRoot->freeIORequests), &(pRequest->linkNode));
1263 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1265 saRoot->IOMap[pRequest->HTag].Tag = pRequest->HTag;
1266 saRoot->IOMap[pRequest->HTag].IORequest = (void *)pRequest;
1267 saRoot->IOMap[pRequest->HTag].agContext = agContext;
1268 pRequest->valid = agTRUE;
1270 /* Build the VhisCapture IOMB command and send to SPCv */
1272 ret = mpiVHistCapCmd(agRoot,agContext, queueNum, Channel, NumBitLo, NumBitHi ,PcieAddrLo, PcieAddrHi, ByteCount);
1273 if (AGSA_RC_SUCCESS != ret)
1275 /* remove the request from IOMap */
1276 saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
1277 saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
1278 saRoot->IOMap[pRequest->HTag].agContext = agNULL;
1279 pRequest->valid = agFALSE;
1281 ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1282 /* return the request to free pool */
1283 if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1285 SA_DBG1(("saPhyStart: saving pRequest (%p) for later use\n", pRequest));
1286 saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1290 /* return the request to free pool */
1291 saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1293 ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1294 SA_DBG1(("saVhistCapture: sending IOMB failed\n" ));
1298 smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3N");