1285809Sscottl/*******************************************************************************
2285809Sscottl*Copyright (c) 2014 PMC-Sierra, Inc.  All rights reserved.
3285809Sscottl*
4285809Sscottl*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5285809Sscottl*that the following conditions are met:
6285809Sscottl*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7285809Sscottl*following disclaimer.
8285809Sscottl*2. Redistributions in binary form must reproduce the above copyright notice,
9285809Sscottl*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10285809Sscottl*with the distribution.
11285809Sscottl*
12285809Sscottl*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13285809Sscottl*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14285809Sscottl*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15285809Sscottl*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16285809Sscottl*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17285809Sscottl*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18285809Sscottl*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19285809Sscottl*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20285809Sscottl
21285809Sscottl********************************************************************************/
22285809Sscottl/*******************************************************************************/
23285809Sscottl/*! \file saint.c
24285809Sscottl *  \brief The file implements the functions to handle/enable/disable interrupt
25285809Sscottl *
26285809Sscottl */
27285809Sscottl/*******************************************************************************/
28285809Sscottl#include <sys/cdefs.h>
29285809Sscottl__FBSDID("$FreeBSD$");
30285809Sscottl#include <dev/pms/config.h>
31285809Sscottl
32285809Sscottl#include <dev/pms/RefTisa/sallsdk/spc/saglobal.h>
33285809Sscottl#define SA_CLEAR_ODCR_IN_INTERRUPT
34285809Sscottl
35285809Sscottl//#define SA_TEST_FW_SPURIOUS_INT
36285809Sscottl
37285809Sscottl#ifdef SA_TEST_FW_SPURIOUS_INT
38285809Sscottlbit32 gOurIntCount = 0;
39285809Sscottlbit32 gSpuriousIntCount = 0;
40285809Sscottlbit32 gSpuriousInt[64]=
41285809Sscottl{
42285809Sscottl0,0,0,0,0,0,0,0,
43285809Sscottl0,0,0,0,0,0,0,0,
44285809Sscottl0,0,0,0,0,0,0,0,
45285809Sscottl0,0,0,0,0,0,0,0,
46285809Sscottl0,0,0,0,0,0,0,0,
47285809Sscottl0,0,0,0,0,0,0,0,
48285809Sscottl0,0,0,0,0,0,0,0,
49285809Sscottl0,0,0,0,0,0,0,0
50285809Sscottl};
51285809Sscottlbit32 gSpuriousInt1[64]=
52285809Sscottl{
53285809Sscottl0,0,0,0,0,0,0,0,
54285809Sscottl0,0,0,0,0,0,0,0,
55285809Sscottl0,0,0,0,0,0,0,0,
56285809Sscottl0,0,0,0,0,0,0,0,
57285809Sscottl0,0,0,0,0,0,0,0,
58285809Sscottl0,0,0,0,0,0,0,0,
59285809Sscottl0,0,0,0,0,0,0,0,
60285809Sscottl0,0,0,0,0,0,0,0
61285809Sscottl};
62285809Sscottl#endif /* SA_TEST_FW_SPURIOUS_INT */
63285809Sscottl
64285809Sscottl#ifdef SA_ENABLE_TRACE_FUNCTIONS
65285809Sscottl#ifdef siTraceFileID
66285809Sscottl#undef siTraceFileID
67285809Sscottl#endif /* siTraceFileID */
68285809Sscottl#define siTraceFileID 'G'
69285809Sscottl#endif /* SA_ENABLE_TRACE_FUNCTIONS */
70285809Sscottl
71285809SscottlLOCAL FORCEINLINE bit32 siProcessOBMsg(
72285809Sscottl                           agsaRoot_t  *agRoot,
73285809Sscottl                           bit32        count,
74285809Sscottl                           bit32        queueNum
75285809Sscottl                           );
76285809Sscottl
77285809SscottlLOCAL bit32 siFatalInterruptHandler(
78285809Sscottl  agsaRoot_t  *agRoot,
79285809Sscottl  bit32       interruptVectorIndex
80285809Sscottl  )
81285809Sscottl{
82285809Sscottl  agsaLLRoot_t         *saRoot = agNULL;
83285809Sscottl  agsaFatalErrorInfo_t fatal_error;
84285809Sscottl  bit32                value;
85285809Sscottl  bit32                ret = AGSA_RC_FAILURE;
86285809Sscottl  bit32                Sendfatal = agTRUE;
87285809Sscottl
88285809Sscottl  SA_ASSERT((agNULL != agRoot), "");
89285809Sscottl  if (agRoot == agNULL)
90285809Sscottl  {
91285809Sscottl    SA_DBG1(("siFatalInterruptHandler: agRoot == agNULL\n"));
92285809Sscottl    return AGSA_RC_FAILURE;
93285809Sscottl  }
94285809Sscottl  saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
95285809Sscottl  SA_ASSERT((agNULL != saRoot), "");
96285809Sscottl  if (saRoot == agNULL)
97285809Sscottl  {
98285809Sscottl    SA_DBG1(("siFatalInterruptHandler: saRoot == agNULL\n"));
99285809Sscottl    return AGSA_RC_FAILURE;
100285809Sscottl  }
101285809Sscottl
102285809Sscottl  value  = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_1, MSGU_SCRATCH_PAD_1);
103285809Sscottl  if (saRoot->ResetFailed)
104285809Sscottl  {
105285809Sscottl    SA_DBG1(("siFatalInterruptHandler: ResetFailed\n"));
106285809Sscottl    ossaDisableInterrupts(agRoot, interruptVectorIndex);
107285809Sscottl    return AGSA_RC_FAILURE;
108285809Sscottl  }
109285809Sscottl
110285809Sscottl  if(SCRATCH_PAD1_V_ERROR_STATE( value ) )
111285809Sscottl  {
112285809Sscottl    si_memset(&fatal_error, 0, sizeof(agsaFatalErrorInfo_t));
113285809Sscottl    /* read detail fatal errors */
114285809Sscottl    value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_0, MSGU_SCRATCH_PAD_0);
115285809Sscottl    fatal_error.errorInfo0 = value;
116285809Sscottl    SA_DBG1(("siFatalInterruptHandler: ScratchPad0 AAP error 0x%x code 0x%x\n",SCRATCH_PAD1_V_ERROR_STATE( value ), value));
117285809Sscottl
118285809Sscottl    value  = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_1, MSGU_SCRATCH_PAD_1);
119285809Sscottl    fatal_error.errorInfo1 = value;
120285809Sscottl    /* AAP error state */
121285809Sscottl    SA_DBG1(("siFatalInterruptHandler: AAP error state and error code 0x%x\n", value));
122285809Sscottl    value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_2, MSGU_SCRATCH_PAD_2);
123285809Sscottl    fatal_error.errorInfo2 = value;
124285809Sscottl    SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2 0x%08x\n", fatal_error.errorInfo2 ));
125285809Sscottl
126285809Sscottl#if defined(SALLSDK_DEBUG)
127285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_ILA_ERR)
128285809Sscottl    {
129285809Sscottl      SA_DBG1(("siFatalInterruptHandler:SCRATCH_PAD1_V_ERROR_STATE SCRATCH_PAD2_FW_ILA_ERR 0x%08x\n", SCRATCH_PAD2_FW_ILA_ERR));
130285809Sscottl    }
131285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_FLM_ERR)
132285809Sscottl    {
133285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_FLM_ERR 0x%08x\n", SCRATCH_PAD2_FW_FLM_ERR));
134285809Sscottl    }
135285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_FW_ASRT_ERR)
136285809Sscottl    {
137285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_FW_ASRT_ERR 0x%08x\n", SCRATCH_PAD2_FW_FW_ASRT_ERR));
138285809Sscottl    }
139285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_WDG_ERR)
140285809Sscottl    {
141285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_HW_WDG_ERR 0x%08x\n", SCRATCH_PAD2_FW_HW_WDG_ERR));
142285809Sscottl    }
143285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_GEN_EXCEPTION_ERR)
144285809Sscottl    {
145285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_GEN_EXCEPTION_ERR 0x%08x\n", SCRATCH_PAD2_FW_GEN_EXCEPTION_ERR));
146285809Sscottl    }
147285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_UNDTMN_ERR)
148285809Sscottl    {
149285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_UNDTMN_ERR 0x%08x\n",SCRATCH_PAD2_FW_UNDTMN_ERR ));
150285809Sscottl    }
151285809Sscottl    if(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_FATAL_ERR)
152285809Sscottl    {
153285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_HW_FATAL_ERR 0x%08x\n", SCRATCH_PAD2_FW_HW_FATAL_ERR));
154285809Sscottl    }
155285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_PCS_ERR )
156285809Sscottl    {
157285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_PCS_ERR 0x%08x\n", value));
158285809Sscottl    }
159285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_GSM_ERR )
160285809Sscottl    {
161285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_GSM_ERR 0x%08x\n", value));
162285809Sscottl    }
163285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP0_ERR )
164285809Sscottl    {
165285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP0_ERR 0x%08x\n", value));
166285809Sscottl    }
167285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) ==SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP1_ERR  )
168285809Sscottl    {
169285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP1_ERR 0x%08x\n", value));
170285809Sscottl    }
171285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP2_ERR )
172285809Sscottl    {
173285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP2_ERR 0x%08x\n", value));
174285809Sscottl    }
175285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_ERAAE_ERR )
176285809Sscottl    {
177285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_ERAAE_ERR 0x%08x\n", value));
178285809Sscottl    }
179285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_SDS_ERR )
180285809Sscottl    {
181285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_SDS_ERR 0x%08x\n", value));
182285809Sscottl    }
183285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_CORE_ERR )
184285809Sscottl    {
185285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_CORE_ERR 0x%08x\n", value));
186285809Sscottl    }
187285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_AL_ERR )
188285809Sscottl    {
189285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_AL_ERR 0x%08x\n", value));
190285809Sscottl    }
191285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_MSGU_ERR )
192285809Sscottl    {
193285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_MSGU_ERR 0x%08x\n", value));
194285809Sscottl    }
195285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_SPBC_ERR )
196285809Sscottl    {
197285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_SPBC_ERR 0x%08x\n", value));
198285809Sscottl    }
199285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_BDMA_ERR )
200285809Sscottl    {
201285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_BDMA_ERR 0x%08x\n", value));
202285809Sscottl    }
203285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) ==  SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSL2B_ERR)
204285809Sscottl    {
205285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSL2B_ERR 0x%08x\n", value));
206285809Sscottl    }
207285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSDC_ERR )
208285809Sscottl    {
209285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSDC_ERR 0x%08x\n", value));
210285809Sscottl    }
211285809Sscottl    if((fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_MASK) == SCRATCH_PAD2_HW_ERROR_INT_INDX_UNDETERMINED_ERROR_OCCURRED )
212285809Sscottl    {
213285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_HW_ERROR_INT_INDX_UNDETERMINED_ERROR_OCCURRED 0x%08x\n", value));
214285809Sscottl    }
215285809Sscottl#endif /* SALLSDK_DEBUG */
216285809Sscottl
217285809Sscottl    if( fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_NON_FATAL_ERR   &&
218285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_ILA_ERR)           &&
219285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_FLM_ERR)           &&
220285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_FW_ASRT_ERR)       &&
221285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_WDG_ERR)        &&
222285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_GEN_EXCEPTION_ERR) &&
223285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_UNDTMN_ERR)        &&
224285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_PCS_ERR)       &&
225285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_GSM_ERR)       &&
226285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP0_ERR)     &&
227285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_OSSP2_ERR)     &&
228285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_ERAAE_ERR)     &&
229285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_SDS_ERR)       &&
230285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_CORE_ERR) &&
231285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_PCIE_AL_ERR)   &&
232285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_MSGU_ERR)      &&
233285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_SPBC_ERR)      &&
234285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_BDMA_ERR)      &&
235285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSL2B_ERR)   &&
236285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_MCPSDC_ERR)    &&
237285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_HW_ERROR_INT_INDX_UNDETERMINED_ERROR_OCCURRED) &&
238285809Sscottl      !(fatal_error.errorInfo2 & SCRATCH_PAD2_FW_HW_FATAL_ERR) )
239285809Sscottl    {
240285809Sscottl      SA_DBG1(("siFatalInterruptHandler: SCRATCH_PAD2_FW_HW_NON_FATAL_ERR 0x%08x\n", value));
241285809Sscottl      Sendfatal = agFALSE;
242285809Sscottl    }
243285809Sscottl
244285809Sscottl    value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_3, MSGU_SCRATCH_PAD_3);
245285809Sscottl    SA_DBG1(("siFatalInterruptHandler: ScratchPad3 IOP error code 0x%08x\n", value));
246285809Sscottl    fatal_error.errorInfo3 = value;
247285809Sscottl
248285809Sscottl    if (agNULL != saRoot)
249285809Sscottl    {
250285809Sscottl      fatal_error.regDumpBusBaseNum0 = saRoot->mainConfigTable.regDumpPCIBAR;
251285809Sscottl      fatal_error.regDumpOffset0 = saRoot->mainConfigTable.FatalErrorDumpOffset0;
252285809Sscottl      fatal_error.regDumpLen0 = saRoot->mainConfigTable.FatalErrorDumpLength0;
253285809Sscottl      fatal_error.regDumpBusBaseNum1 = saRoot->mainConfigTable.regDumpPCIBAR;
254285809Sscottl      fatal_error.regDumpOffset1 = saRoot->mainConfigTable.FatalErrorDumpOffset1;
255285809Sscottl      fatal_error.regDumpLen1 = saRoot->mainConfigTable.FatalErrorDumpLength1;
256285809Sscottl    }
257285809Sscottl    else
258285809Sscottl    {
259285809Sscottl      fatal_error.regDumpBusBaseNum0 = 0;
260285809Sscottl      fatal_error.regDumpOffset0 = 0;
261285809Sscottl      fatal_error.regDumpLen0 = 0;
262285809Sscottl      fatal_error.regDumpBusBaseNum1 = 0;
263285809Sscottl      fatal_error.regDumpOffset1 = 0;
264285809Sscottl      fatal_error.regDumpLen1 = 0;
265285809Sscottl    }
266285809Sscottl    /* Call Back with error */
267285809Sscottl    SA_DBG1(("siFatalInterruptHandler: Sendfatal %x HostR0 0x%x\n",Sendfatal ,ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_Rsvd_0_Register ) ));
268285809Sscottl    SA_DBG1(("siFatalInterruptHandler:  ScratchPad2 0x%x ScratchPad3 0x%x\n",
269285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Host_Scratchpad_2_Register),
270285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Host_Scratchpad_3_Register) ));
271285809Sscottl
272285809Sscottl    ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_MALFUNCTION, Sendfatal, (void *)&fatal_error, agNULL);
273285809Sscottl    ret = AGSA_RC_SUCCESS;
274285809Sscottl  }
275285809Sscottl  else
276285809Sscottl  {
277285809Sscottl    bit32 host_reg0;
278285809Sscottl    host_reg0 = ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_Rsvd_0_Register );
279285809Sscottl    if( host_reg0 == 0x2)
280285809Sscottl    {
281285809Sscottl      Sendfatal = agFALSE;
282285809Sscottl
283285809Sscottl      SA_DBG1(("siFatalInterruptHandler: Non fatal ScratchPad1 0x%x HostR0 0x%x\n", value,host_reg0));
284285809Sscottl      SA_DBG1(("siFatalInterruptHandler:  ScratchPad0 0x%x ScratchPad1 0x%x\n",
285285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_0_Register),
286285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_1_Register) ));
287285809Sscottl      SA_DBG1(("siFatalInterruptHandler:  ScratchPad2 0x%x ScratchPad3 0x%x\n",
288285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_2_Register),
289285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_3_Register) ));
290285809Sscottl
291285809Sscottl      ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_MALFUNCTION, Sendfatal, (void *)&fatal_error, agNULL);
292285809Sscottl      ret = AGSA_RC_SUCCESS;
293285809Sscottl    }
294285809Sscottl    else if( host_reg0 == HDA_AES_DIF_FUNC)
295285809Sscottl    {
296285809Sscottl      SA_DBG1(("siFatalInterruptHandler: HDA_AES_DIF_FUNC 0x%x\n",
297285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_Rsvd_0_Register)));
298285809Sscottl      Sendfatal = agFALSE;
299285809Sscottl      ret = AGSA_RC_SUCCESS;
300285809Sscottl    }
301285809Sscottl    else
302285809Sscottl    {
303285809Sscottl      SA_DBG1(("siFatalInterruptHandler: No error detected ScratchPad1 0x%x HostR0 0x%x\n", value,host_reg0));
304285809Sscottl      SA_DBG1(("siFatalInterruptHandler:  ScratchPad0 0x%x ScratchPad1 0x%x\n",
305285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_0_Register),
306285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_1_Register) ));
307285809Sscottl      SA_DBG1(("siFatalInterruptHandler:  ScratchPad2 0x%x ScratchPad3 0x%x\n",
308285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_2_Register),
309285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_3_Register) ));
310285809Sscottl
311285809Sscottl      SA_DBG1(("siFatalInterruptHandler: Doorbell_Set  %08X U %08X\n",
312285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_Register),
313285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_RegisterU)));
314285809Sscottl      SA_DBG1(("siFatalInterruptHandler: Doorbell_Mask %08X U %08X\n",
315285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register ),
316285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU )));
317285809Sscottl
318285809Sscottl      ret = AGSA_RC_FAILURE;
319285809Sscottl    }
320285809Sscottl  }
321285809Sscottl  return ret;
322285809Sscottl
323285809Sscottl}
324285809Sscottl
325285809SscottlGLOBAL bit32 saFatalInterruptHandler(
326285809Sscottl  agsaRoot_t  *agRoot,
327285809Sscottl  bit32       interruptVectorIndex
328285809Sscottl  )
329285809Sscottl{
330285809Sscottl  agsaLLRoot_t         *saRoot = agNULL;
331285809Sscottl  bit32                ret = AGSA_RC_FAILURE;
332285809Sscottl
333285809Sscottl  /* sanity check */
334285809Sscottl  SA_ASSERT((agNULL != agRoot), "");
335285809Sscottl  saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
336285809Sscottl  SA_ASSERT((agNULL != saRoot), "");
337285809Sscottl
338285809Sscottl  if (saRoot->ResetFailed)
339285809Sscottl  {
340285809Sscottl    SA_DBG1(("saFatalInterruptHandler: ResetFailed\n"));
341285809Sscottl    ossaDisableInterrupts(agRoot, interruptVectorIndex);
342285809Sscottl    return AGSA_RC_FAILURE;
343285809Sscottl  }
344285809Sscottl  if (saRoot->swConfig.fatalErrorInterruptEnable != 1)
345285809Sscottl  {
346285809Sscottl    SA_DBG1(("saFatalInterruptHandler: fatalErrorInterrtupt is NOT enabled\n"));
347285809Sscottl    ossaDisableInterrupts(agRoot, interruptVectorIndex);
348285809Sscottl    return AGSA_RC_FAILURE;
349285809Sscottl  }
350285809Sscottl
351285809Sscottl  if (saRoot->swConfig.fatalErrorInterruptVector != interruptVectorIndex)
352285809Sscottl  {
353285809Sscottl    SA_DBG1(("saFatalInterruptHandler: interruptVectorIndex does not match 0x%x 0x%x\n",
354285809Sscottl             saRoot->swConfig.fatalErrorInterruptVector, interruptVectorIndex));
355285809Sscottl    SA_DBG1(("saFatalInterruptHandler:  ScratchPad0 0x%x ScratchPad1 0x%x\n",
356285809Sscottl                              ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_0_Register),
357285809Sscottl                              ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_1_Register) ));
358285809Sscottl    SA_DBG1(("saFatalInterruptHandler:  ScratchPad2 0x%x ScratchPad3 0x%x\n",
359285809Sscottl                              ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_2_Register),
360285809Sscottl                              ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_3_Register) ));
361285809Sscottl    ossaDisableInterrupts(agRoot, interruptVectorIndex);
362285809Sscottl    return AGSA_RC_FAILURE;
363285809Sscottl  }
364285809Sscottl
365285809Sscottl  ret = siFatalInterruptHandler(agRoot,interruptVectorIndex);
366285809Sscottl
367285809Sscottl
368285809Sscottl  ossaDisableInterrupts(agRoot, interruptVectorIndex);
369285809Sscottl
370285809Sscottl  return ret;
371285809Sscottl}
372285809Sscottl/******************************************************************************/
373285809Sscottl/*! \brief Function to process the interrupts
374285809Sscottl *
375285809Sscottl *  The saInterruptHandler() function is called after an interrupts has
376285809Sscottl *  been received
377285809Sscottl *  This function disables interrupts
378285809Sscottl *
379285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
380285809Sscottl *                instance of SAS/SATA hardware
381285809Sscottl *  \param interruptVectorIndex message that caused MSI message
382285809Sscottl *
383285809Sscottl *  \return TRUE if we caused interrupt
384285809Sscottl *
385285809Sscottl */
386285809Sscottl/*******************************************************************************/
387285809SscottlFORCEINLINE bit32
388285809SscottlsaInterruptHandler(
389285809Sscottl  agsaRoot_t  *agRoot,
390285809Sscottl  bit32       interruptVectorIndex
391285809Sscottl  )
392285809Sscottl{
393285809Sscottl  agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
394285809Sscottl  bit32 ToBeProcessedCount = 0;
395285809Sscottl  bit32 our_int = 0;
396285809Sscottl#ifdef SA_TEST_FW_SPURIOUS_INT
397285809Sscottl  bit8         i;
398285809Sscottl#endif/* SA_TEST_FW_SPURIOUS_INT */
399285809Sscottl
400285809Sscottl  if( agNULL == saRoot )
401285809Sscottl  {
402285809Sscottl    /* Can be called before initialize is completed in a shared
403285809Sscottl       interrupt environment like windows 2003
404285809Sscottl    */
405285809Sscottl    return(ToBeProcessedCount);
406285809Sscottl  }
407285809Sscottl
408285809Sscottl  if( (our_int = saRoot->OurInterrupt(agRoot,interruptVectorIndex)) == FALSE )
409285809Sscottl  {
410285809Sscottl#ifdef SA_TEST_FW_SPURIOUS_INT
411285809Sscottl    gSpuriousIntCount++;
412285809Sscottl    smTrace(hpDBG_REGISTERS,"S1",gSpuriousIntCount);
413285809Sscottl    /* TP:S1 gSpuriousIntCount */
414285809Sscottl#endif /* SA_TEST_FW_SPURIOUS_INT */
415285809Sscottl    return(ToBeProcessedCount);
416285809Sscottl  }
417285809Sscottl
418285809Sscottl  smTraceFuncEnter(hpDBG_TICK_INT, "5q");
419285809Sscottl
420285809Sscottl  smTrace(hpDBG_TICK_INT,"VI",interruptVectorIndex);
421285809Sscottl  /* TP:Vi interrupt VectorIndex */
422285809Sscottl
423285809Sscottl  if ( agFALSE == saRoot->sysIntsActive )
424285809Sscottl  {
425285809Sscottl    // SA_ASSERT(0, "saInterruptHandler sysIntsActive not set");
426285809Sscottl
427285809Sscottl#ifdef SA_PRINTOUT_IN_WINDBG
428285809Sscottl#ifndef DBG
429285809Sscottl        DbgPrint("saInterruptHandler: sysIntsActive not set Doorbell_Mask_Set  %08X U %08X\n",
430285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register),
431285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU) );
432285809Sscottl#endif /* DBG  */
433285809Sscottl#endif /* SA_PRINTOUT_IN_WINDBG  */
434285809Sscottl
435285809Sscottl
436285809Sscottl    SA_DBG1(("saInterruptHandler: Doorbell_Mask_Set  %08X U %08X\n",
437285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register),
438285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU)));
439285809Sscottl    ossaDisableInterrupts(agRoot, interruptVectorIndex);
440285809Sscottl    return(ToBeProcessedCount);
441285809Sscottl
442285809Sscottl  }
443285809Sscottl
444285809Sscottl  /* Allow replacement of disable interrupt */
445285809Sscottl  ossaDisableInterrupts(agRoot, interruptVectorIndex);
446285809Sscottl
447285809Sscottl
448285809Sscottl#ifdef SA_TEST_FW_SPURIOUS_INT
449285809Sscottl
450285809Sscottl  /* count for my interrupt */
451285809Sscottl  gOurIntCount++;
452285809Sscottl
453285809Sscottl  smTrace(hpDBG_REGISTERS,"S4",gOurIntCount);
454285809Sscottl  /* TP:S4 gOurIntCount */
455285809Sscottl#endif /* SA_TEST_FW_SPURIOUS_INT */
456285809Sscottl
457285809Sscottl  smTraceFuncExit(hpDBG_TICK_INT, 'a', "5q");
458285809Sscottl  return(TRUE);
459285809Sscottl
460285809Sscottl}
461285809Sscottl
462285809Sscottl/******************************************************************************/
463285809Sscottl/*! \brief Function to disable MSIX interrupts
464285809Sscottl *
465285809Sscottl *  siDisableMSIXInterrupts disables interrupts
466285809Sscottl *  called thru macro ossaDisableInterrupts
467285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
468285809Sscottl *                instance of SAS/SATA hardware
469285809Sscottl *  \param interruptVectorIndex - vector index for message
470285809Sscottl *
471285809Sscottl */
472285809Sscottl/*******************************************************************************/
473285809SscottlGLOBAL void siDisableMSIXInterrupts(
474285809Sscottl  agsaRoot_t *agRoot,
475285809Sscottl  bit32 interruptVectorIndex
476285809Sscottl  )
477285809Sscottl{
478285809Sscottl  bit32 msi_index;
479285809Sscottl#ifndef SA_CLEAR_ODCR_IN_INTERRUPT
480285809Sscottl  bit32 value;
481285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
482285809Sscottl  msi_index = interruptVectorIndex * MSIX_TABLE_ELEMENT_SIZE;
483285809Sscottl  msi_index += MSIX_TABLE_BASE;
484285809Sscottl  ossaHwRegWrite(agRoot,msi_index , MSIX_INTERRUPT_DISABLE);
485285809Sscottl  ossaHwRegRead(agRoot, msi_index); /* Dummy read */
486285809Sscottl#ifndef SA_CLEAR_ODCR_IN_INTERRUPT
487285809Sscottl  value  = (1 << interruptVectorIndex);
488285809Sscottl  ossaHwRegWrite(agRoot, MSGU_ODCR, value);
489285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
490285809Sscottl}
491285809Sscottl
492285809Sscottl/******************************************************************************/
493285809Sscottl/*! \brief Function to disable MSIX V interrupts
494285809Sscottl *
495285809Sscottl *  siDisableMSIXInterrupts disables interrupts
496285809Sscottl *  called thru macro ossaDisableInterrupts
497285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
498285809Sscottl *                instance of SAS/SATA hardware
499285809Sscottl *  \param interruptVectorIndex - vector index for message
500285809Sscottl *
501285809Sscottl */
502285809Sscottl/*******************************************************************************/
503285809Sscottlvoid siDisableMSIX_V_Interrupts(
504285809Sscottl  agsaRoot_t *agRoot,
505285809Sscottl  bit32 interruptVectorIndex
506285809Sscottl  )
507285809Sscottl{
508285809Sscottl  bit64 mask;
509285809Sscottl  agsabit32bit64 u64;
510285809Sscottl  mask =( (bit64)1 << interruptVectorIndex);
511285809Sscottl  u64.B64 = mask;
512285809Sscottl  if(smIS64bInt(agRoot))
513285809Sscottl  {
514285809Sscottl    SA_DBG4(("siDisableMSIX_V_Interrupts: VI %d U 0x%08X L 0x%08X\n",interruptVectorIndex,u64.S32[1],u64.S32[0]));
515285809Sscottl    ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_RegisterU,u64.S32[1]);
516285809Sscottl  }
517285809Sscottl  ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_Register, u64.S32[0]);
518285809Sscottl
519285809Sscottl}
520285809Sscottl/******************************************************************************/
521285809Sscottl/*! \brief Function to disable MSI interrupts
522285809Sscottl *
523285809Sscottl *  siDisableMSIInterrupts disables interrupts
524285809Sscottl *  called thru macro ossaDisableInterrupts
525285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
526285809Sscottl *                instance of SAS/SATA hardware
527285809Sscottl *  \param interruptVectorIndex - vector index for message
528285809Sscottl *
529285809Sscottl */
530285809Sscottl/*******************************************************************************/
531285809SscottlGLOBAL void siDisableMSIInterrupts(
532285809Sscottl  agsaRoot_t *agRoot,
533285809Sscottl  bit32 interruptVectorIndex
534285809Sscottl  )
535285809Sscottl{
536285809Sscottl  bit32 ODMRValue;
537285809Sscottl  bit32 mask;
538285809Sscottl  mask = 1 << interruptVectorIndex;
539285809Sscottl
540285809Sscottl  /*Must be protected for interuption */
541285809Sscottl  ODMRValue = ossaHwRegRead(agRoot, MSGU_ODMR);
542285809Sscottl  ODMRValue |= mask;
543285809Sscottl
544285809Sscottl  ossaHwRegWrite(agRoot, MSGU_ODMR, ODMRValue);
545285809Sscottl  ossaHwRegWrite(agRoot, MSGU_ODCR, mask);
546285809Sscottl}
547285809Sscottl
548285809Sscottl/******************************************************************************/
549285809Sscottl/*! \brief Function to disable MSI V interrupts
550285809Sscottl *
551285809Sscottl *  siDisableMSIInterrupts disables interrupts
552285809Sscottl *  called thru macro ossaDisableInterrupts
553285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
554285809Sscottl *                instance of SAS/SATA hardware
555285809Sscottl *  \param interruptVectorIndex - vector index for message
556285809Sscottl *
557285809Sscottl */
558285809Sscottl/*******************************************************************************/
559285809SscottlGLOBAL void siDisableMSI_V_Interrupts(
560285809Sscottl  agsaRoot_t *agRoot,
561285809Sscottl  bit32 interruptVectorIndex
562285809Sscottl  )
563285809Sscottl{
564285809Sscottl  SA_ASSERT(0, "Should not be called");
565285809Sscottl  SA_DBG4(("siDisableMSI_V_Interrupts:\n"));
566285809Sscottl}
567285809Sscottl
568285809Sscottl/******************************************************************************/
569285809Sscottl/*! \brief Function to process Legacy interrupts
570285809Sscottl *
571285809Sscottl *  siDisableLegacyInterrupts disables interrupts
572285809Sscottl *  called thru macro ossaDisableInterrupts
573285809Sscottl *
574285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
575285809Sscottl *                instance of SAS/SATA hardware
576285809Sscottl *  \param interruptVectorIndex not used in legacy case
577285809Sscottl *
578285809Sscottl */
579285809Sscottl/*******************************************************************************/
580285809SscottlGLOBAL void siDisableLegacyInterrupts(
581285809Sscottl  agsaRoot_t *agRoot,
582285809Sscottl  bit32 interruptVectorIndex
583285809Sscottl  )
584285809Sscottl{
585285809Sscottl  ossaHwRegWrite(agRoot, MSGU_ODMR, ODMR_MASK_ALL);
586285809Sscottl#ifndef SA_CLEAR_ODCR_IN_INTERRUPT
587285809Sscottl  ossaHwRegWrite(agRoot, MSGU_ODCR, ODCR_CLEAR_ALL);
588285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
589285809Sscottl}
590285809Sscottl
591285809Sscottl/******************************************************************************/
592285809Sscottl/*! \brief Function to process Legacy V interrupts
593285809Sscottl *
594285809Sscottl *  siDisableLegacyInterrupts disables interrupts
595285809Sscottl *  called thru macro ossaDisableInterrupts
596285809Sscottl *
597285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
598285809Sscottl *                instance of SAS/SATA hardware
599285809Sscottl *  \param interruptVectorIndex not used in legacy case
600285809Sscottl *
601285809Sscottl */
602285809Sscottl/*******************************************************************************/
603285809SscottlGLOBAL void siDisableLegacy_V_Interrupts(
604285809Sscottl  agsaRoot_t *agRoot,
605285809Sscottl  bit32 interruptVectorIndex
606285809Sscottl  )
607285809Sscottl{
608285809Sscottl
609285809Sscottl  bit64 mask;
610285809Sscottl  agsabit32bit64 u64;
611285809Sscottl  mask =( (bit64)1 << interruptVectorIndex);
612285809Sscottl  u64.B64 = mask;
613285809Sscottl
614285809Sscottl  SA_DBG4(("siDisableLegacy_V_Interrupts:IN MSGU_READ_ODR  %08X\n",siHalRegReadExt(agRoot, GEN_MSGU_ODR,  V_Outbound_Doorbell_Set_Register)));
615285809Sscottl  SA_DBG4(("siDisableLegacy_V_Interrupts:IN MSGU_READ_ODMR %08X\n",siHalRegReadExt(agRoot, GEN_MSGU_ODMR, V_Outbound_Doorbell_Mask_Set_Register )));
616285809Sscottl  if(smIS64bInt(agRoot))
617285809Sscottl  {
618285809Sscottl    SA_DBG4(("siDisableLegacy_V_Interrupts: VI %d U 0x%08X L 0x%08X\n",interruptVectorIndex,u64.S32[1],u64.S32[0]));
619285809Sscottl    ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_Register,u64.S32[1] );
620285809Sscottl  }
621285809Sscottl  ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_RegisterU,u64.S32[0]);
622285809Sscottl
623285809Sscottl}
624285809Sscottl/******************************************************************************/
625285809Sscottl/*! \brief Function to process MSIX interrupts
626285809Sscottl *
627285809Sscottl *  siOurMSIXInterrupt checks if we generated interrupt
628285809Sscottl *  called thru function pointer saRoot->OurInterrupt
629285809Sscottl *
630285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
631285809Sscottl *                instance of SAS/SATA hardware
632285809Sscottl *  \return always true
633285809Sscottl */
634285809Sscottl/*******************************************************************************/
635285809SscottlGLOBAL bit32 siOurMSIXInterrupt(
636285809Sscottl  agsaRoot_t *agRoot,
637285809Sscottl  bit32 interruptVectorIndex
638285809Sscottl  )
639285809Sscottl{
640285809Sscottl  return(TRUE);
641285809Sscottl}
642285809Sscottl
643285809Sscottl/******************************************************************************/
644285809Sscottl/*! \brief Function to process MSIX V interrupts
645285809Sscottl *
646285809Sscottl *  siOurMSIXInterrupt checks if we generated interrupt
647285809Sscottl *  called thru function pointer saRoot->OurInterrupt
648285809Sscottl *
649285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
650285809Sscottl *                instance of SAS/SATA hardware
651285809Sscottl *  \return always true
652285809Sscottl */
653285809Sscottl/*******************************************************************************/
654285809SscottlGLOBAL bit32 siOurMSIX_V_Interrupt(
655285809Sscottl  agsaRoot_t *agRoot,
656285809Sscottl  bit32 interruptVectorIndex
657285809Sscottl  )
658285809Sscottl{
659285809Sscottl  return(TRUE);
660285809Sscottl}
661285809Sscottl/******************************************************************************/
662285809Sscottl/*! \brief Function to process MSI interrupts
663285809Sscottl *
664285809Sscottl *  siOurMSIInterrupt checks if we generated interrupt
665285809Sscottl *  called thru function pointer saRoot->OurInterrupt
666285809Sscottl *
667285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
668285809Sscottl *                instance of SAS/SATA hardware
669285809Sscottl *  \return always true
670285809Sscottl */
671285809Sscottl/*******************************************************************************/
672285809Sscottlbit32 siOurMSIInterrupt(
673285809Sscottl  agsaRoot_t *agRoot,
674285809Sscottl  bit32 interruptVectorIndex
675285809Sscottl  )
676285809Sscottl{
677285809Sscottl  return(TRUE);
678285809Sscottl}
679285809Sscottl
680285809Sscottl/******************************************************************************/
681285809Sscottl/*! \brief Function to process MSI V interrupts
682285809Sscottl *
683285809Sscottl *  siOurMSIInterrupt checks if we generated interrupt
684285809Sscottl *  called thru function pointer saRoot->OurInterrupt
685285809Sscottl *
686285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
687285809Sscottl *                instance of SAS/SATA hardware
688285809Sscottl *  \return always true
689285809Sscottl */
690285809Sscottl/*******************************************************************************/
691285809Sscottlbit32 siOurMSI_V_Interrupt(
692285809Sscottl  agsaRoot_t *agRoot,
693285809Sscottl  bit32 interruptVectorIndex
694285809Sscottl  )
695285809Sscottl{
696285809Sscottl  SA_DBG4((":siOurMSI_V_Interrupt\n"));
697285809Sscottl  return(TRUE);
698285809Sscottl}
699285809Sscottl
700285809Sscottl/******************************************************************************/
701285809Sscottl/*! \brief Function to process Legacy interrupts
702285809Sscottl *
703285809Sscottl *  siOurLegacyInterrupt checks if we generated interrupt
704285809Sscottl *  called thru function pointer saRoot->OurInterrupt
705285809Sscottl *
706285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
707285809Sscottl *                instance of SAS/SATA hardware
708285809Sscottl *  \return true if we claim interrupt
709285809Sscottl */
710285809Sscottl/*******************************************************************************/
711285809Sscottlbit32 siOurLegacyInterrupt(
712285809Sscottl  agsaRoot_t *agRoot,
713285809Sscottl  bit32 interruptVectorIndex
714285809Sscottl  )
715285809Sscottl{
716285809Sscottl  bit32 Int_masked;
717285809Sscottl  bit32 Int_active;
718285809Sscottl  Int_masked = MSGU_READ_ODMR;
719285809Sscottl  Int_active = MSGU_READ_ODR;
720285809Sscottl
721285809Sscottl  if(Int_masked & 1 )
722285809Sscottl  {
723285809Sscottl    return(FALSE);
724285809Sscottl  }
725285809Sscottl  if(Int_active & 1 )
726285809Sscottl  {
727285809Sscottl
728285809Sscottl    return(TRUE);
729285809Sscottl  }
730285809Sscottl  return(FALSE);
731285809Sscottl}
732285809Sscottl
733285809Sscottl/******************************************************************************/
734285809Sscottl/*! \brief Function to process Legacy V interrupts
735285809Sscottl *
736285809Sscottl *  siOurLegacyInterrupt checks if we generated interrupt
737285809Sscottl *  called thru function pointer saRoot->OurInterrupt
738285809Sscottl *
739285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
740285809Sscottl *                instance of SAS/SATA hardware
741285809Sscottl *  \return true if we claim interrupt
742285809Sscottl */
743285809Sscottl/*******************************************************************************/
744285809Sscottlbit32 siOurLegacy_V_Interrupt(
745285809Sscottl  agsaRoot_t *agRoot,
746285809Sscottl  bit32 interruptVectorIndex
747285809Sscottl  )
748285809Sscottl{
749285809Sscottl  bit32 Int_active;
750285809Sscottl  Int_active = siHalRegReadExt(agRoot, GEN_MSGU_ODR, V_Outbound_Doorbell_Set_Register  );
751285809Sscottl
752285809Sscottl  return(Int_active ? TRUE : FALSE);
753285809Sscottl}
754285809Sscottl
755285809Sscottl
756285809Sscottl/******************************************************************************/
757285809Sscottl/*! \brief Function to process the cause of interrupt
758285809Sscottl *
759285809Sscottl *  The saDelayedInterruptHandler() function is called after an interrupt messages has
760285809Sscottl *  been received it may be called by a deferred procedure call
761285809Sscottl *
762285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
763285809Sscottl *                instance of SAS/SATA hardware
764285809Sscottl *  \param interruptVectorIndex  - vector index for message
765285809Sscottl *  \param count Number of completion queue entries to consume
766285809Sscottl *
767285809Sscottl *  \return number of messages processed
768285809Sscottl *
769285809Sscottl */
770285809Sscottl/*******************************************************************************/
771285809SscottlFORCEINLINE bit32
772285809SscottlsaDelayedInterruptHandler(
773285809Sscottl  agsaRoot_t  *agRoot,
774285809Sscottl  bit32       interruptVectorIndex,
775285809Sscottl  bit32       count
776285809Sscottl  )
777285809Sscottl{
778285809Sscottl  agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
779285809Sscottl  bit32         processedMsgCount = 0;
780285809Sscottl  bit32         pad1 = 0;
781285809Sscottl  bit32         host_reg0 = 0;
782285809Sscottl#if defined(SALLSDK_DEBUG)
783285809Sscottl  bit32 host_reg1 = 0;
784285809Sscottl#endif
785285809Sscottl  bit8         i = 0;
786285809Sscottl
787285809Sscottl  OSSA_OUT_ENTER(agRoot);
788285809Sscottl
789285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5p");
790285809Sscottl
791285809Sscottl  smTrace(hpDBG_VERY_LOUD,"Vd",interruptVectorIndex);
792285809Sscottl  /* TP:Vd delayed VectorIndex */
793285809Sscottl  smTrace(hpDBG_VERY_LOUD,"Vc",count);
794285809Sscottl  /* TP:Vc IOMB count*/
795285809Sscottl
796285809Sscottl  if( saRoot->swConfig.fatalErrorInterruptEnable &&
797285809Sscottl      saRoot->swConfig.fatalErrorInterruptVector == interruptVectorIndex )
798285809Sscottl  {
799285809Sscottl    pad1 = siHalRegReadExt(agRoot,GEN_MSGU_SCRATCH_PAD_1,  MSGU_SCRATCH_PAD_1);
800285809Sscottl    host_reg0 = ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_Rsvd_0_Register );
801285809Sscottl
802285809Sscottl
803285809Sscottl    if(saRoot->swConfig.hostDirectAccessMode & 2 )
804285809Sscottl    {
805285809Sscottl      if( host_reg0 == HDA_AES_DIF_FUNC)
806285809Sscottl      {
807285809Sscottl        host_reg0 = 0;
808285809Sscottl      }
809285809Sscottl    }
810285809Sscottl
811285809Sscottl
812285809Sscottl#if defined(SALLSDK_DEBUG)
813285809Sscottl    host_reg1 = ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_Rsvd_1_Register );
814285809Sscottl#endif
815285809Sscottl    if( (SCRATCH_PAD1_V_ERROR_STATE( pad1 ) != 0 ) && host_reg0 )
816285809Sscottl    {
817285809Sscottl
818285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: vi %d  Error %08X\n",interruptVectorIndex,  SCRATCH_PAD1_V_ERROR_STATE( pad1 )));
819285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: Sp 1 %08X Hr0 %08X Hr1 %08X\n",pad1,host_reg0,host_reg1 ));
820285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: SCRATCH_PAD1_V_ERROR_STATE      %08X\n", SCRATCH_PAD1_V_ERROR_STATE( pad1 )));
821285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: SCRATCH_PAD1_V_ILA_ERROR_STATE  %08X\n", SCRATCH_PAD1_V_ILA_ERROR_STATE( pad1 )));
822285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: SCRATCH_PAD1_V_RAAE_ERROR_STATE %08X\n", SCRATCH_PAD1_V_RAAE_ERROR_STATE( pad1 )));
823285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: SCRATCH_PAD1_V_IOP0_ERROR_STATE %08X\n", SCRATCH_PAD1_V_IOP0_ERROR_STATE( pad1 )));
824285809Sscottl      SA_DBG1(("saDelayedInterruptHandler: SCRATCH_PAD1_V_IOP1_ERROR_STATE %08X\n", SCRATCH_PAD1_V_IOP1_ERROR_STATE( pad1 )));
825285809Sscottl
826285809Sscottl      siFatalInterruptHandler( agRoot, interruptVectorIndex  );
827285809Sscottl      ossaDisableInterrupts(agRoot, interruptVectorIndex);
828285809Sscottl
829285809Sscottl    }
830285809Sscottl    else
831285809Sscottl    {
832285809Sscottl      SA_DBG2(("saDelayedInterruptHandler: Fatal Check VI %d SCRATCH_PAD1 %08X host_reg0 %08X host_reg1 %08X\n",interruptVectorIndex, pad1,host_reg0,host_reg1));
833285809Sscottl      SA_DBG2(("saDelayedInterruptHandler:  ScratchPad0 0x%x ScratchPad1 0x%x\n",
834285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_0_Register),
835285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_1_Register) ));
836285809Sscottl      SA_DBG2(("saDelayedInterruptHandler:  ScratchPad2 0x%x ScratchPad3 0x%x\n",
837285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_2_Register),
838285809Sscottl                                ossaHwRegReadExt(agRoot, PCIBAR0,V_Scratchpad_3_Register) ));
839285809Sscottl
840285809Sscottl      SA_DBG2(("saDelayedInterruptHandler: Doorbell_Set  %08X U %08X\n",
841285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_Register),
842285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_RegisterU)));
843285809Sscottl      SA_DBG2(("saDelayedInterruptHandler: Doorbell_Mask %08X U %08X\n",
844285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register ),
845285809Sscottl                               ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU )));
846285809Sscottl    }
847285809Sscottl
848285809Sscottl  }
849285809Sscottl
850285809Sscottl
851285809Sscottl#ifdef SA_LNX_PERF_MODE
852285809Sscottl  return siProcessOBMsg(agRoot, count, interruptVectorIndex);
853285809Sscottl#endif
854285809Sscottl
855285809Sscottl  /* check all the configuration outbound queues within a vector bitmap */
856285809Sscottl  SA_ASSERT((saRoot->QueueConfig.numOutboundQueues < 65), "numOutboundQueue");
857285809Sscottl
858285809Sscottl  for ( i = 0; i < saRoot->QueueConfig.numOutboundQueues; i++ )
859285809Sscottl  {
860285809Sscottl    /* process IOMB in the outbound queue 0 to 31 if bit set in the vector bitmap */
861285809Sscottl    if (i < OQ_NUM_32)
862285809Sscottl    {
863285809Sscottl      if (saRoot->interruptVecIndexBitMap[interruptVectorIndex] & (1 << i))
864285809Sscottl      {
865285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
866285809Sscottl      }
867285809Sscottl      else if (saRoot->QueueConfig.outboundQueues[i].interruptEnable == 0)
868285809Sscottl      {
869285809Sscottl        /* polling mode - interruptVectorIndex = 0 only and no bit set */
870285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
871285809Sscottl      }
872285809Sscottl#ifdef SA_FW_TEST_INTERRUPT_REASSERT
873285809Sscottl      else if (saRoot->CheckAll)
874285809Sscottl      {
875285809Sscottl        /* polling mode - interruptVectorIndex = 0 only and no bit set */
876285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
877285809Sscottl      }
878285809Sscottl#endif /* SA_FW_TEST_INTERRUPT_REASSERT */
879285809Sscottl
880285809Sscottl    }
881285809Sscottl    else
882285809Sscottl    {
883285809Sscottl      /* process IOMB in the outbound queue 32 to 63 if bit set in the vector bitmap */
884285809Sscottl      if (saRoot->interruptVecIndexBitMap1[interruptVectorIndex] & (1 << (i - OQ_NUM_32)))
885285809Sscottl      {
886285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
887285809Sscottl      }
888285809Sscottl      /* check interruptEnable bit for polling mode of OQ */
889285809Sscottl      /* the following code can be removed, we do not care about the bit */
890285809Sscottl      else if (saRoot->QueueConfig.outboundQueues[i].interruptEnable == 0)
891285809Sscottl      {
892285809Sscottl        /* polling mode - interruptVectorIndex = 0 only and no bit set */
893285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
894285809Sscottl      }
895285809Sscottl#ifdef SA_FW_TEST_INTERRUPT_REASSERT
896285809Sscottl      else if (saRoot->CheckAll)
897285809Sscottl      {
898285809Sscottl        /* polling mode - interruptVectorIndex = 0 only and no bit set */
899285809Sscottl        processedMsgCount += siProcessOBMsg(agRoot, count, i);
900285809Sscottl      }
901285809Sscottl#endif /* SA_FW_TEST_INTERRUPT_REASSERT */
902285809Sscottl    }
903285809Sscottl  }
904285809Sscottl
905285809Sscottl#ifdef SA_FW_TEST_INTERRUPT_REASSERT
906285809Sscottl  saRoot->CheckAll = 0;
907285809Sscottl#endif /* SA_FW_TEST_INTERRUPT_REASSERT */
908285809Sscottl
909285809Sscottl#ifndef SA_RENABLE_IN_OSLAYER
910285809Sscottl  if ( agTRUE == saRoot->sysIntsActive )
911285809Sscottl  {
912285809Sscottl    /* Allow replacement of enable interrupt */
913285809Sscottl    ossaReenableInterrupts(agRoot, interruptVectorIndex);
914285809Sscottl  }
915285809Sscottl#endif /* SA_RENABLE_IN_OSLAYER */
916285809Sscottl
917285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5p");
918285809Sscottl
919285809Sscottl  OSSA_OUT_LEAVE(agRoot);
920285809Sscottl  return processedMsgCount;
921285809Sscottl}
922285809Sscottl
923285809Sscottl/******************************************************************************/
924285809Sscottl/*! \brief Function to reenable MSIX interrupts
925285809Sscottl *
926285809Sscottl *  siReenableMSIXInterrupts  reenableinterrupts
927285809Sscottl *  called thru macro ossaReenableInterrupts
928285809Sscottl *
929285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
930285809Sscottl *                instance of SAS/SATA hardware
931285809Sscottl *  \param interruptVectorIndex  - vector index for message
932285809Sscottl *
933285809Sscottl */
934285809Sscottl/*******************************************************************************/
935285809Sscottlvoid siReenableMSIXInterrupts(
936285809Sscottl   agsaRoot_t *agRoot,
937285809Sscottl   bit32 interruptVectorIndex
938285809Sscottl  )
939285809Sscottl{
940285809Sscottl  bit32 msi_index;
941285809Sscottl#ifdef SA_CLEAR_ODCR_IN_INTERRUPT
942285809Sscottl  bit32 value;
943285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
944285809Sscottl  msi_index = interruptVectorIndex * MSIX_TABLE_ELEMENT_SIZE;
945285809Sscottl  msi_index += MSIX_TABLE_BASE;
946285809Sscottl  ossaHwRegWriteExt(agRoot, PCIBAR0,msi_index, MSIX_INTERRUPT_ENABLE);
947285809Sscottl
948285809Sscottl  SA_DBG4(("siReenableMSIXInterrupts:interruptVectorIndex %d\n",interruptVectorIndex));
949285809Sscottl
950285809Sscottl#ifdef SA_CLEAR_ODCR_IN_INTERRUPT
951285809Sscottl  value  = (1 << interruptVectorIndex);
952285809Sscottl  siHalRegWriteExt(agRoot, GEN_MSGU_ODCR, MSGU_ODCR, value);
953285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
954285809Sscottl}
955285809Sscottl/******************************************************************************/
956285809Sscottl/*! \brief Function to reenable MSIX interrupts
957285809Sscottl *
958285809Sscottl *  siReenableMSIXInterrupts  reenableinterrupts
959285809Sscottl *  called thru macro ossaReenableInterrupts
960285809Sscottl *
961285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
962285809Sscottl *                instance of SAS/SATA hardware
963285809Sscottl *  \param interruptVectorIndex  - vector index for message
964285809Sscottl *
965285809Sscottl */
966285809Sscottl/*******************************************************************************/
967285809Sscottlvoid siReenableMSIX_V_Interrupts(
968285809Sscottl    agsaRoot_t *agRoot,
969285809Sscottl    bit32 interruptVectorIndex
970285809Sscottl    )
971285809Sscottl{
972285809Sscottl  agsaLLRoot_t         *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
973285809Sscottl  bit64 mask;
974285809Sscottl  agsabit32bit64 u64;
975285809Sscottl  mask =( (bit64)1 << interruptVectorIndex);
976285809Sscottl  u64.B64 = mask;
977285809Sscottl
978285809Sscottl  SA_DBG4(("siReenableMSIX_V_Interrupts:\n"));
979285809Sscottl
980285809Sscottl  if(saRoot->sysIntsActive)
981285809Sscottl  {
982285809Sscottl    if(smIS64bInt(agRoot))
983285809Sscottl    {
984285809Sscottl      SA_DBG4(("siReenableMSIX_V_Interrupts: VI %d U 0x%08X L 0x%08X\n",interruptVectorIndex,u64.S32[1],u64.S32[0]));
985285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Clear_RegisterU,u64.S32[1] );
986285809Sscottl    }
987285809Sscottl    ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Clear_Register,u64.S32[0]);
988285809Sscottl  }
989285809Sscottl  else
990285809Sscottl  {
991285809Sscottl      SA_DBG1(("siReenableMSIX_V_Interrupts: VI %d sysIntsActive off\n",interruptVectorIndex));
992285809Sscottl  }
993285809Sscottl
994285809Sscottl}
995285809Sscottl
996285809Sscottl/******************************************************************************/
997285809Sscottl/*! \brief Function to reenable MSI interrupts
998285809Sscottl *
999285809Sscottl *  siReenableMSIXInterrupts  reenableinterrupts
1000285809Sscottl *  called thru macro ossaReenableInterrupts
1001285809Sscottl *
1002285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1003285809Sscottl *                instance of SAS/SATA hardware
1004285809Sscottl *  \param interruptVectorIndex  - vector index for message
1005285809Sscottl *
1006285809Sscottl */
1007285809Sscottl/*******************************************************************************/
1008285809SscottlGLOBAL void siReenableMSIInterrupts(
1009285809Sscottl  agsaRoot_t *agRoot,
1010285809Sscottl  bit32 interruptVectorIndex
1011285809Sscottl  )
1012285809Sscottl{
1013285809Sscottl  bit32 ODMRValue;
1014285809Sscottl
1015285809Sscottl  ODMRValue = siHalRegReadExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR);
1016285809Sscottl  ODMRValue &= ~(1 << interruptVectorIndex);
1017285809Sscottl
1018285809Sscottl  siHalRegWriteExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR, ODMRValue);
1019285809Sscottl}
1020285809Sscottl
1021285809Sscottl/******************************************************************************/
1022285809Sscottl/*! \brief Function to reenable MSI V interrupts
1023285809Sscottl *
1024285809Sscottl *  siReenableMSIXInterrupts  reenableinterrupts
1025285809Sscottl *  called thru macro ossaReenableInterrupts
1026285809Sscottl *
1027285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1028285809Sscottl *                instance of SAS/SATA hardware
1029285809Sscottl *  \param interruptVectorIndex  - vector index for message
1030285809Sscottl *
1031285809Sscottl */
1032285809Sscottl/*******************************************************************************/
1033285809SscottlGLOBAL void siReenableMSI_V_Interrupts(
1034285809Sscottl   agsaRoot_t *agRoot,
1035285809Sscottl   bit32 interruptVectorIndex
1036285809Sscottl   )
1037285809Sscottl{
1038285809Sscottl  SA_ASSERT(0, "Should not be called");
1039285809Sscottl
1040285809Sscottl  SA_DBG4(("siReenableMSI_V_Interrupts:\n"));
1041285809Sscottl
1042285809Sscottl}
1043285809Sscottl/******************************************************************************/
1044285809Sscottl/*! \brief Function to reenable Legacy interrupts
1045285809Sscottl *
1046285809Sscottl *  siReenableLegacyInterrupts reenableinterrupts
1047285809Sscottl *  called thru macro ossaReenableInterrupts
1048285809Sscottl *
1049285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1050285809Sscottl *                instance of SAS/SATA hardware
1051285809Sscottl *  \param interruptVectorIndex always zero
1052285809Sscottl *
1053285809Sscottl */
1054285809Sscottl/*******************************************************************************/
1055285809SscottlGLOBAL void siReenableLegacyInterrupts(
1056285809Sscottl  agsaRoot_t *agRoot,
1057285809Sscottl  bit32 interruptVectorIndex
1058285809Sscottl  )
1059285809Sscottl{
1060285809Sscottl  siHalRegWriteExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR, ODMR_CLEAR_ALL);
1061285809Sscottl
1062285809Sscottl#ifdef SA_CLEAR_ODCR_IN_INTERRUPT
1063285809Sscottl  siHalRegWriteExt(agRoot, GEN_MSGU_ODCR, MSGU_ODCR, ODCR_CLEAR_ALL);
1064285809Sscottl#endif /* SA_CLEAR_ODCR_IN_INTERRUPT */
1065285809Sscottl}
1066285809Sscottl
1067285809Sscottl/******************************************************************************/
1068285809Sscottl/*! \brief Function to reenable Legacy V interrupts
1069285809Sscottl *
1070285809Sscottl *  siReenableLegacyInterrupts reenableinterrupts
1071285809Sscottl *  called thru macro ossaReenableInterrupts
1072285809Sscottl *
1073285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1074285809Sscottl *                instance of SAS/SATA hardware
1075285809Sscottl *  \param interruptVectorIndex always zero
1076285809Sscottl *
1077285809Sscottl */
1078285809Sscottl/*******************************************************************************/
1079285809SscottlGLOBAL void siReenableLegacy_V_Interrupts(
1080285809Sscottl  agsaRoot_t *agRoot,
1081285809Sscottl  bit32 interruptVectorIndex
1082285809Sscottl  )
1083285809Sscottl{
1084285809Sscottl
1085285809Sscottl  bit32 mask;
1086285809Sscottl  mask = 1 << interruptVectorIndex;
1087285809Sscottl
1088285809Sscottl  SA_DBG5(("siReenableLegacy_V_Interrupts:IN MSGU_READ_ODR  %08X\n",siHalRegReadExt(agRoot, GEN_MSGU_ODR, V_Outbound_Doorbell_Set_Register)));
1089285809Sscottl  SA_DBG5(("siReenableLegacy_V_Interrupts:IN MSGU_READ_ODMR %08X\n",siHalRegReadExt(agRoot, GEN_MSGU_ODMR, V_Outbound_Doorbell_Mask_Set_Register )));
1090285809Sscottl
1091285809Sscottl  ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Clear_Register, mask);
1092285809Sscottl  ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Clear_Register, mask );
1093285809Sscottl
1094285809Sscottl
1095285809Sscottl  SA_DBG5(("siReenableLegacy_V_Interrupts:OUT MSGU_READ_ODMR %08X\n",siHalRegReadExt(agRoot, GEN_MSGU_ODMR, V_Outbound_Doorbell_Mask_Set_Register )));
1096285809Sscottl
1097285809Sscottl}
1098285809Sscottl
1099285809Sscottl/******************************************************************************/
1100285809Sscottl/*! \brief Function to enable a single interrupt vector
1101285809Sscottl *
1102285809Sscottl *
1103285809Sscottl *
1104285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1105285809Sscottl *                instance of SAS/SATA hardware
1106285809Sscottl *  \param interruptVectorIndex Interrupt vector to enable
1107285809Sscottl *
1108285809Sscottl */
1109285809Sscottl/*******************************************************************************/
1110285809Sscottl/******************************************************************************/
1111285809Sscottl/*! \brief  saSystemInterruptsEnable
1112285809Sscottl *   Function to enable a single interrupt vector
1113285809Sscottl *
1114285809Sscottl *  \param agRoot OS Layer-specific and LL Layer-specific context handles for this
1115285809Sscottl *                instance of SAS/SATA hardware
1116285809Sscottl *  \param interruptVectorIndex Interrupt vector to enable
1117285809Sscottl *
1118285809Sscottl */
1119285809Sscottl/*******************************************************************************/
1120285809SscottlGLOBAL FORCEINLINE
1121285809Sscottlvoid saSystemInterruptsEnable(
1122285809Sscottl                              agsaRoot_t  *agRoot,
1123285809Sscottl                              bit32       interruptVectorIndex
1124285809Sscottl                              )
1125285809Sscottl{
1126285809Sscottl  ossaReenableInterrupts(agRoot, interruptVectorIndex);
1127285809Sscottl}
1128285809Sscottl/******************************************************************************/
1129285809Sscottl/*! \brief Routine to handle Outbound Message
1130285809Sscottl *
1131285809Sscottl *  The handle for outbound message
1132285809Sscottl *
1133285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
1134285809Sscottl *  \param count    interrupt message count
1135285809Sscottl *  \param queueNum outbound queue
1136285809Sscottl *
1137285809Sscottl *  \return
1138285809Sscottl */
1139285809Sscottl/*******************************************************************************/
1140285809SscottlLOCAL FORCEINLINE bit32
1141285809SscottlsiProcessOBMsg(
1142285809Sscottl  agsaRoot_t  *agRoot,
1143285809Sscottl  bit32       count,
1144285809Sscottl  bit32       queueNum
1145285809Sscottl  )
1146285809Sscottl{
1147285809Sscottl  agsaLLRoot_t         *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1148285809Sscottl  mpiOCQueue_t         *circularQ = agNULL;
1149285809Sscottl  void                 *pMsg1     = agNULL;
1150285809Sscottl  bit32                ret, processedMsgCount = 0;
1151285809Sscottl  bit32                ParseOBIombStatus = 0;
1152285809Sscottl#ifdef SA_ENABLE_TRACE_FUNCTIONS
1153285809Sscottl  bit32                i = 0;
1154285809Sscottl#endif
1155285809Sscottl  bit16                opcode  = 0;
1156285809Sscottl  mpiMsgCategory_t     category;
1157285809Sscottl  bit8                 bc      = 0;
1158285809Sscottl
1159285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5r");
1160285809Sscottl
1161285809Sscottl
1162285809Sscottl  SA_DBG3(("siProcessOBMsg: queueNum 0x%x\n", queueNum));
1163285809Sscottl
1164285809Sscottl  ossaSingleThreadedEnter(agRoot, LL_IOREQ_OBQ_LOCK + queueNum);
1165285809Sscottl
1166285809Sscottl  circularQ = &saRoot->outboundQueue[queueNum];
1167285809Sscottl  OSSA_READ_LE_32(circularQ->agRoot, &circularQ->producerIdx, circularQ->piPointer, 0);
1168285809Sscottl
1169285809Sscottl  if (circularQ->producerIdx == circularQ->consumerIdx)
1170285809Sscottl  {
1171285809Sscottl    ossaSingleThreadedLeave(agRoot, LL_IOREQ_OBQ_LOCK + queueNum);
1172285809Sscottl    smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5r");
1173285809Sscottl    return processedMsgCount;
1174285809Sscottl  }
1175285809Sscottl
1176285809Sscottl  ossaSingleThreadedLeave(agRoot, LL_IOREQ_OBQ_LOCK + queueNum);
1177285809Sscottl
1178285809Sscottl  do
1179285809Sscottl  {
1180285809Sscottl    /* ossaSingleThreadedEnter(agRoot, LL_IOREQ_OBQ_LOCK + queueNum); */
1181285809Sscottl    ret = mpiMsgConsume(circularQ, &pMsg1, &category, &opcode, &bc);
1182285809Sscottl    /* ossaSingleThreadedLeave(agRoot, LL_IOREQ_OBQ_LOCK + queueNum); */
1183285809Sscottl
1184285809Sscottl    if (AGSA_RC_SUCCESS == ret)
1185285809Sscottl    {
1186285809Sscottl      smTrace(hpDBG_IOMB,"M0",queueNum);
1187285809Sscottl      /* TP:M0 queueNum */
1188285809Sscottl      smTrace(hpDBG_VERY_LOUD,"MA",opcode);
1189285809Sscottl      /* TP:MA opcode */
1190285809Sscottl      smTrace(hpDBG_IOMB,"MB",category);
1191285809Sscottl      /* TP:MB category */
1192285809Sscottl
1193285809Sscottl#ifdef SA_ENABLE_TRACE_FUNCTIONS
1194285809Sscottl      for (i=0; i<((bit32)bc*(circularQ->elementSize/4)); i++)
1195285809Sscottl      {
1196285809Sscottl          /* The -sizeof(mpiMsgHeader_t) is to account for mpiMsgConsume incrementing the pointer past the header*/
1197285809Sscottl          smTrace(hpDBG_IOMB,"MC",*( ((bit32*)((bit8 *)pMsg1 - sizeof(mpiMsgHeader_t))) + i));
1198285809Sscottl          /* TP:MC Outbound IOMB Dword */
1199285809Sscottl      }
1200285809Sscottl#endif
1201285809Sscottl
1202285809Sscottl      MPI_DEBUG_TRACE( circularQ->qNumber,((circularQ->producerIdx << 16 ) | circularQ->consumerIdx),MPI_DEBUG_TRACE_OBQ, (void *)(((bit8*)pMsg1) - sizeof(mpiMsgHeader_t)), circularQ->elementSize);
1203285809Sscottl
1204285809Sscottl      ossaLogIomb(circularQ->agRoot,
1205285809Sscottl                  circularQ->qNumber,
1206285809Sscottl                  FALSE,
1207285809Sscottl                  (void *)(((bit8*)pMsg1) - sizeof(mpiMsgHeader_t)),
1208285809Sscottl                  bc*circularQ->elementSize);
1209285809Sscottl
1210285809Sscottl      ossaQueueProcessed(agRoot, queueNum, circularQ->producerIdx, circularQ->consumerIdx);
1211285809Sscottl      /* process the outbound message */
1212285809Sscottl      ParseOBIombStatus = mpiParseOBIomb(agRoot, (bit32 *)pMsg1, category, opcode);
1213285809Sscottl      if (ParseOBIombStatus == AGSA_RC_FAILURE)
1214285809Sscottl      {
1215285809Sscottl        SA_DBG1(("siProcessOBMsg, Failed Q %2d PI 0x%03x CI 0x%03x\n", queueNum, circularQ->producerIdx, circularQ->consumerIdx));
1216285809Sscottl#if defined(SALLSDK_DEBUG)
1217285809Sscottl        /* free the message for debug: this is a hang! */
1218285809Sscottl
1219285809Sscottl        mpiMsgFreeSet(circularQ, pMsg1, bc);
1220285809Sscottl        processedMsgCount ++;
1221285809Sscottl#endif /**/
1222285809Sscottl        break;
1223285809Sscottl      }
1224285809Sscottl
1225285809Sscottl      /* free the message from the outbound circular buffer */
1226285809Sscottl      mpiMsgFreeSet(circularQ, pMsg1, bc);
1227285809Sscottl      processedMsgCount ++;
1228285809Sscottl    }
1229285809Sscottl    else
1230285809Sscottl    //if (AGSA_RC_BUSY == ret) // always (circularQ->producerIdx == circularQ->consumerIdx)
1231285809Sscottl    // || (AGSA_RC_FAILURE == ret)
1232285809Sscottl    {
1233285809Sscottl        break;
1234285809Sscottl    }
1235285809Sscottl  }
1236285809Sscottl  /* end of message processing if hit the count */
1237285809Sscottl  while(count > processedMsgCount);
1238285809Sscottl
1239285809Sscottl/* #define SALLSDK_FATAL_ERROR_DETECT 1 */
1240285809Sscottl/*
1241285809Sscottl   this comments are to be removed
1242285809Sscottl   fill in 0x1D 0x1e 0x1f 0x20 in MPI table for
1243285809Sscottl  bit32   regDumpBusBaseNum0;
1244285809Sscottl  bit32   regDumpOffset0;
1245285809Sscottl  bit32   regDumpLen0;
1246285809Sscottl  bit32   regDumpBusBaseNum1;
1247285809Sscottl  bit32   regDumpOffset1;
1248285809Sscottl  bit32   regDumpLen1;
1249285809Sscottl  in agsaFatalErrorInfo_t
1250285809Sscottl
1251285809Sscottl  ??? regDumpBusBaseNum0 and regDumpBusBaseNum1
1252285809Sscottl    saRoot->mainConfigTable.regDumpPCIBAR = pcibar;
1253285809Sscottl    saRoot->mainConfigTable.FatalErrorDumpOffset0 = config->FatalErrorDumpOffset0;
1254285809Sscottl    saRoot->mainConfigTable.FatalErrorDumpLength0 = config->FatalErrorDumpLength0;
1255285809Sscottl    saRoot->mainConfigTable.FatalErrorDumpOffset1 = config->FatalErrorDumpOffset1;
1256285809Sscottl    saRoot->mainConfigTable.FatalErrorDumpLength1 = config->FatalErrorDumpLength1;
1257285809Sscottl
1258285809Sscottl
1259285809Sscottl
1260285809Sscottl*/
1261285809Sscottl#if defined(SALLSDK_FATAL_ERROR_DETECT)
1262285809Sscottl
1263285809Sscottl  if( smIS_SPC(agRoot) ) /* SPC only */
1264285809Sscottl  {
1265285809Sscottl
1266285809Sscottl  /* any fatal error happened */
1267285809Sscottl  /* executing this code impacts performance by 1% when no error is detected */
1268285809Sscottl  {
1269285809Sscottl    agsaFatalErrorInfo_t fatal_error;
1270285809Sscottl    bit32                value;
1271285809Sscottl    bit32                value1;
1272285809Sscottl
1273285809Sscottl    value  = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_1, MSGU_SCRATCH_PAD_1);
1274285809Sscottl    value1 = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_2, MSGU_SCRATCH_PAD_2);
1275285809Sscottl
1276285809Sscottl    if( (value & SA_FATAL_ERROR_SP1_AAP1_ERR_MASK) == SA_FATAL_ERROR_FATAL_ERROR ||
1277285809Sscottl        (value1 & SA_FATAL_ERROR_SP2_IOP_ERR_MASK) == SA_FATAL_ERROR_FATAL_ERROR    )
1278285809Sscottl    {
1279285809Sscottl      si_memset(&fatal_error, 0, sizeof(agsaFatalErrorInfo_t));
1280285809Sscottl      /* read detail fatal errors */
1281285809Sscottl      value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_0, MSGU_SCRATCH_PAD_0);
1282285809Sscottl      fatal_error.errorInfo0 = value;
1283285809Sscottl      SA_DBG1(("siProcessOBMsg: ScratchPad0 AAP error code 0x%x\n", value));
1284285809Sscottl
1285285809Sscottl      value  = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_1, MSGU_SCRATCH_PAD_1);
1286285809Sscottl      fatal_error.errorInfo1 = value;
1287285809Sscottl      /* AAP error state */
1288285809Sscottl      SA_DBG1(("siProcessOBMsg: AAP error state and error code 0x%x\n", value));
1289285809Sscottl      value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_2, MSGU_SCRATCH_PAD_2);
1290285809Sscottl      fatal_error.errorInfo2 = value;
1291285809Sscottl      /* IOP error state */
1292285809Sscottl      SA_DBG1(("siProcessOBMsg: IOP error state and error code 0x%x\n", value));
1293285809Sscottl      value = siHalRegReadExt(agRoot, GEN_MSGU_SCRATCH_PAD_3, MSGU_SCRATCH_PAD_3);
1294285809Sscottl      SA_DBG1(("siProcessOBMsg: ScratchPad3 IOP error code 0x%x\n", value));
1295285809Sscottl      fatal_error.errorInfo3 = value;
1296285809Sscottl
1297285809Sscottl      if (agNULL != saRoot)
1298285809Sscottl      {
1299285809Sscottl        fatal_error.regDumpBusBaseNum0 = saRoot->mainConfigTable.regDumpPCIBAR;
1300285809Sscottl        fatal_error.regDumpOffset0 = saRoot->mainConfigTable.FatalErrorDumpOffset0;
1301285809Sscottl        fatal_error.regDumpLen0 = saRoot->mainConfigTable.FatalErrorDumpLength0;
1302285809Sscottl        fatal_error.regDumpBusBaseNum1 = saRoot->mainConfigTable.regDumpPCIBAR;
1303285809Sscottl        fatal_error.regDumpOffset1 = saRoot->mainConfigTable.FatalErrorDumpOffset1;
1304285809Sscottl        fatal_error.regDumpLen1 = saRoot->mainConfigTable.FatalErrorDumpLength1;
1305285809Sscottl      }
1306285809Sscottl      else
1307285809Sscottl      {
1308285809Sscottl        fatal_error.regDumpBusBaseNum0 = 0;
1309285809Sscottl        fatal_error.regDumpOffset0 = 0;
1310285809Sscottl        fatal_error.regDumpLen0 = 0;
1311285809Sscottl        fatal_error.regDumpBusBaseNum1 = 0;
1312285809Sscottl        fatal_error.regDumpOffset1 = 0;
1313285809Sscottl        fatal_error.regDumpLen1 = 0;
1314285809Sscottl      }
1315285809Sscottl      /* Call Back with error */
1316285809Sscottl      SA_DBG1(("siProcessOBMsg: SALLSDK_FATAL_ERROR_DETECT \n"));
1317285809Sscottl      ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_MALFUNCTION, 0, (void *)&fatal_error, agNULL);
1318285809Sscottl    }
1319285809Sscottl  }
1320285809Sscottl  }
1321285809Sscottl#endif /* SALLSDK_FATAL_ERROR_DETECT */
1322285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5r");
1323285809Sscottl  return processedMsgCount;
1324285809Sscottl}
1325285809Sscottl
1326285809Sscottl/******************************************************************************/
1327285809Sscottl/*! \brief Function to enable/disable interrupts
1328285809Sscottl *
1329285809Sscottl *  The saSystemInterruptsActive() function is called to indicate to the LL Layer
1330285809Sscottl *  whether interrupts are available. The parameter sysIntsActive indicates whether
1331285809Sscottl *  interrupts are available at this time.
1332285809Sscottl *
1333285809Sscottl *  \param agRoot handles for this instance of SAS/SATA hardware
1334285809Sscottl *  \param sysIntsActive flag for enable/disable interrupt
1335285809Sscottl *
1336285809Sscottl *  \return -void-
1337285809Sscottl *
1338285809Sscottl */
1339285809Sscottl/*******************************************************************************/
1340285809SscottlGLOBAL void saSystemInterruptsActive(
1341285809Sscottl  agsaRoot_t  *agRoot,
1342285809Sscottl  agBOOLEAN   sysIntsActive
1343285809Sscottl  )
1344285809Sscottl{
1345285809Sscottl  bit32 x;
1346285809Sscottl  agsaLLRoot_t  *saRoot;
1347285809Sscottl
1348285809Sscottl  SA_ASSERT((agNULL != agRoot), "");
1349285809Sscottl  if (agRoot == agNULL)
1350285809Sscottl  {
1351285809Sscottl    SA_DBG1(("saSystemInterruptsActive: agRoot == agNULL\n"));
1352285809Sscottl    return;
1353285809Sscottl  }
1354285809Sscottl  saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1355285809Sscottl  SA_ASSERT((agNULL != saRoot), "");
1356285809Sscottl  if (saRoot == agNULL)
1357285809Sscottl  {
1358285809Sscottl    SA_DBG1(("saSystemInterruptsActive: saRoot == agNULL\n"));
1359285809Sscottl    return;
1360285809Sscottl  }
1361285809Sscottl
1362285809Sscottl  smTraceFuncEnter(hpDBG_TICK_INT,"5s");
1363285809Sscottl  SA_DBG1(("saSystemInterruptsActive: now 0x%X new 0x%x\n",saRoot->sysIntsActive,sysIntsActive));
1364285809Sscottl  SA_DBG3(("saSystemInterruptsActive: Doorbell_Set  %08X U %08X\n",
1365285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_Register),
1366285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_RegisterU)));
1367285809Sscottl  SA_DBG3(("saSystemInterruptsActive: Doorbell_Mask %08X U %08X\n",
1368285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register ),
1369285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU )));
1370285809Sscottl
1371285809Sscottl  if( saRoot->sysIntsActive && sysIntsActive )
1372285809Sscottl  {
1373285809Sscottl    SA_DBG1(("saSystemInterruptsActive: Already active 0x%X new 0x%x\n",saRoot->sysIntsActive,sysIntsActive));
1374285809Sscottl    smTraceFuncExit(hpDBG_TICK_INT, 'a', "5s");
1375285809Sscottl    return;
1376285809Sscottl  }
1377285809Sscottl
1378285809Sscottl  if( !saRoot->sysIntsActive && !sysIntsActive )
1379285809Sscottl  {
1380285809Sscottl    if(smIS_SPC(agRoot))
1381285809Sscottl    {
1382285809Sscottl      siHalRegWriteExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR,AGSA_INTERRUPT_HANDLE_ALL_CHANNELS );
1383285809Sscottl    }
1384285809Sscottl    else
1385285809Sscottl    {
1386285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_Register, AGSA_INTERRUPT_HANDLE_ALL_CHANNELS);
1387285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_RegisterU, AGSA_INTERRUPT_HANDLE_ALL_CHANNELS);
1388285809Sscottl    }
1389285809Sscottl    SA_DBG1(("saSystemInterruptsActive: Already disabled 0x%X new 0x%x\n",saRoot->sysIntsActive,sysIntsActive));
1390285809Sscottl    smTraceFuncExit(hpDBG_TICK_INT, 'b', "5s");
1391285809Sscottl    return;
1392285809Sscottl  }
1393285809Sscottl
1394285809Sscottl  /* Set the flag is sdkData */
1395285809Sscottl  saRoot->sysIntsActive = (bit8)sysIntsActive;
1396285809Sscottl
1397285809Sscottl
1398285809Sscottl  smTrace(hpDBG_TICK_INT,"Vq",sysIntsActive);
1399285809Sscottl  /* TP:Vq sysIntsActive */
1400285809Sscottl  /* If sysIntsActive is true */
1401285809Sscottl  if ( agTRUE == sysIntsActive )
1402285809Sscottl  {
1403285809Sscottl
1404285809Sscottl    SA_DBG1(("saSystemInterruptsActive: Doorbell_Set  %08X U %08X\n",
1405285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_Register),
1406285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_RegisterU)));
1407285809Sscottl    SA_DBG1(("saSystemInterruptsActive: Doorbell_Mask_Set  %08X U %08X\n",
1408285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register),
1409285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU)));
1410285809Sscottl    if(smIS_SPCV(agRoot))
1411285809Sscottl    {
1412285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Clear_Register, 0xFFFFFFFF);
1413285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Clear_RegisterU, 0xFFFFFFFF);
1414285809Sscottl    }
1415285809Sscottl    /* enable interrupt */
1416285809Sscottl    for(x=0; x < saRoot->numInterruptVectors; x++)
1417285809Sscottl    {
1418285809Sscottl      ossaReenableInterrupts(agRoot,x );
1419285809Sscottl    }
1420285809Sscottl
1421285809Sscottl    if(saRoot->swConfig.fatalErrorInterruptEnable)
1422285809Sscottl    {
1423285809Sscottl      ossaReenableInterrupts(agRoot,saRoot->swConfig.fatalErrorInterruptVector );
1424285809Sscottl    }
1425285809Sscottl
1426285809Sscottl    siHalRegWriteExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR, 0);
1427285809Sscottl  }
1428285809Sscottl  /* If sysIntsActive is false */
1429285809Sscottl  else
1430285809Sscottl  {
1431285809Sscottl    /* disable interrupt */
1432285809Sscottl    if(smIS_SPC(agRoot))
1433285809Sscottl    {
1434285809Sscottl      siHalRegWriteExt(agRoot, GEN_MSGU_ODMR, MSGU_ODMR,AGSA_INTERRUPT_HANDLE_ALL_CHANNELS );
1435285809Sscottl    }
1436285809Sscottl    else
1437285809Sscottl    {
1438285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_Register, AGSA_INTERRUPT_HANDLE_ALL_CHANNELS);
1439285809Sscottl      ossaHwRegWriteExt(agRoot, PCIBAR0,V_Outbound_Doorbell_Mask_Set_RegisterU, AGSA_INTERRUPT_HANDLE_ALL_CHANNELS);
1440285809Sscottl    }
1441285809Sscottl  }
1442285809Sscottl
1443285809Sscottl  SA_DBG3(("saSystemInterruptsActive: Doorbell_Set  %08X U %08X\n",
1444285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_Register),
1445285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Set_RegisterU)));
1446285809Sscottl  SA_DBG3(("saSystemInterruptsActive: Doorbell_Mask %08X U %08X\n",
1447285809Sscottl                           ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_Register ),
1448285809Sscottl                             ossaHwRegReadExt(agRoot, PCIBAR0, V_Outbound_Doorbell_Mask_Set_RegisterU )));
1449285809Sscottl
1450285809Sscottl
1451285809Sscottl  smTraceFuncExit(hpDBG_TICK_INT, 'c', "5s");
1452285809Sscottl}
1453285809Sscottl
1454285809Sscottl/******************************************************************************/
1455285809Sscottl/*! \brief Routine to handle for received SAS with data payload event
1456285809Sscottl *
1457285809Sscottl *  The handle for received SAS with data payload event
1458285809Sscottl *
1459285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
1460285809Sscottl *  \param pRequest handles for the IOrequest
1461285809Sscottl *  \param pRespIU  the pointer to the Response IU
1462285809Sscottl *  \param param    Payload Length
1463285809Sscottl *
1464285809Sscottl *  \return -void-
1465285809Sscottl */
1466285809Sscottl/*******************************************************************************/
1467285809SscottlGLOBAL void siEventSSPResponseWtDataRcvd(
1468285809Sscottl  agsaRoot_t                *agRoot,
1469285809Sscottl  agsaIORequestDesc_t       *pRequest,
1470285809Sscottl  agsaSSPResponseInfoUnit_t *pRespIU,
1471285809Sscottl  bit32                     param,
1472285809Sscottl  bit32                     sspTag
1473285809Sscottl  )
1474285809Sscottl{
1475285809Sscottl  agsaLLRoot_t  *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1476285809Sscottl  agsaDeviceDesc_t        *pDevice;
1477285809Sscottl  bit32                   count = 0;
1478285809Sscottl  bit32                   padCount;
1479285809Sscottl
1480285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5g");
1481285809Sscottl
1482285809Sscottl  /* get frame handle */
1483285809Sscottl
1484285809Sscottl  /* If the request is still valid */
1485285809Sscottl  if ( agTRUE == pRequest->valid )
1486285809Sscottl  {
1487285809Sscottl    /* get device */
1488285809Sscottl    pDevice = pRequest->pDevice;
1489285809Sscottl
1490285809Sscottl    /* Delete the request from the pendingIORequests */
1491285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1492285809Sscottl    saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1493285809Sscottl    ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1494285809Sscottl
1495285809Sscottl    if (sspTag & SSP_RESCV_BIT)
1496285809Sscottl    {
1497285809Sscottl        /* get the pad count, bit 17 and 18 of sspTag */
1498285809Sscottl      padCount = (sspTag >> SSP_RESCV_PAD_SHIFT) & 0x3;
1499285809Sscottl      /* get Residual Count */
1500285809Sscottl      count = *(bit32 *)((bit8 *)pRespIU + param + padCount);
1501285809Sscottl    }
1502285809Sscottl
1503285809Sscottl    (*(ossaSSPCompletedCB_t)(pRequest->completionCB))(agRoot,
1504285809Sscottl                             pRequest->pIORequestContext,
1505285809Sscottl                             OSSA_IO_SUCCESS,
1506285809Sscottl                             param,
1507285809Sscottl                             (void *)pRespIU,
1508285809Sscottl                             (bit16)(sspTag & SSPTAG_BITS),
1509285809Sscottl                             count);
1510285809Sscottl
1511285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1512285809Sscottl    pRequest->valid = agFALSE;
1513285809Sscottl    /* return the request to free pool */
1514285809Sscottl    if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1515285809Sscottl    {
1516285809Sscottl      SA_DBG1(("siEventSSPResponseWtDataRcvd: saving pRequest (%p) for later use\n", pRequest));
1517285809Sscottl      saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1518285809Sscottl    }
1519285809Sscottl    else
1520285809Sscottl    {
1521285809Sscottl      /* return the request to free pool */
1522285809Sscottl      saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1523285809Sscottl    }
1524285809Sscottl    ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1525285809Sscottl
1526285809Sscottl  }
1527285809Sscottl  else
1528285809Sscottl  {
1529285809Sscottl    SA_DBG1(("siEventSSPResponseWtDataRcvd: pRequest->Valid not TRUE\n"));
1530285809Sscottl  }
1531285809Sscottl
1532285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5g");
1533285809Sscottl
1534285809Sscottl  return;
1535285809Sscottl}
1536285809Sscottl
1537285809Sscottl/******************************************************************************/
1538285809Sscottl/*! \brief Routine to handle successfully completed IO event
1539285809Sscottl *
1540285809Sscottl *  Handle successfully completed IO
1541285809Sscottl *
1542285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
1543285809Sscottl *  \param pRequest Pointer of IO request of the IO
1544285809Sscottl *  \param status   status of the IO
1545285809Sscottl *
1546285809Sscottl *  \return -void-
1547285809Sscottl */
1548285809Sscottl/*******************************************************************************/
1549285809SscottlGLOBAL FORCEINLINE void siIODone(
1550285809Sscottl  agsaRoot_t                *agRoot,
1551285809Sscottl  agsaIORequestDesc_t       *pRequest,
1552285809Sscottl  bit32                     status,
1553285809Sscottl  bit32                     sspTag
1554285809Sscottl  )
1555285809Sscottl{
1556285809Sscottl  agsaLLRoot_t     *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1557285809Sscottl  agsaDeviceDesc_t *pDevice = agNULL;
1558285809Sscottl
1559285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5h");
1560285809Sscottl
1561285809Sscottl  SA_ASSERT(NULL != pRequest, "pRequest cannot be null");
1562285809Sscottl
1563285809Sscottl  /* If the request is still valid */
1564285809Sscottl  if ( agTRUE == pRequest->valid )
1565285809Sscottl  {
1566285809Sscottl    /* get device */
1567285809Sscottl    pDevice = pRequest->pDevice;
1568285809Sscottl
1569285809Sscottl    /* process different request type */
1570285809Sscottl    switch (pRequest->requestType & AGSA_REQTYPE_MASK)
1571285809Sscottl    {
1572285809Sscottl      case AGSA_SSP_REQTYPE:
1573285809Sscottl      {
1574285809Sscottl        SA_ASSERT(pRequest->valid, "pRequest not valid");
1575285809Sscottl        pRequest->completionCB(agRoot,
1576285809Sscottl                               pRequest->pIORequestContext,
1577285809Sscottl                               OSSA_IO_SUCCESS,
1578285809Sscottl                               0,
1579285809Sscottl                               agNULL,
1580285809Sscottl                               (bit16)(sspTag & SSPTAG_BITS),
1581285809Sscottl                               0);
1582285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1583285809Sscottl        /* Delete the request from the pendingIORequests */
1584285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1585285809Sscottl        /* return the request to free pool */
1586285809Sscottl        pRequest->valid = agFALSE;
1587285809Sscottl        saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1588285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1589285809Sscottl
1590285809Sscottl
1591285809Sscottl        break;
1592285809Sscottl      }
1593285809Sscottl      case AGSA_SATA_REQTYPE:
1594285809Sscottl      {
1595285809Sscottl        SA_DBG5(("siIODone: SATA complete\n"));
1596285809Sscottl
1597285809Sscottl        if ( agNULL != pRequest->pIORequestContext )
1598285809Sscottl        {
1599285809Sscottl          SA_DBG5(("siIODone: Complete Request\n"));
1600285809Sscottl
1601285809Sscottl          (*(ossaSATACompletedCB_t)(pRequest->completionCB))(agRoot,
1602285809Sscottl                                                             pRequest->pIORequestContext,
1603285809Sscottl                                                             OSSA_IO_SUCCESS,
1604285809Sscottl                                                             agNULL,
1605285809Sscottl                                                             0,
1606285809Sscottl                                                             agNULL);
1607285809Sscottl        }
1608285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1609285809Sscottl        /* Delete the request from the pendingIORequests */
1610285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1611285809Sscottl        /* return the request to free pool */
1612285809Sscottl        saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1613285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1614285809Sscottl
1615285809Sscottl        pRequest->valid = agFALSE;
1616285809Sscottl
1617285809Sscottl        break;
1618285809Sscottl      }
1619285809Sscottl      case AGSA_SMP_REQTYPE:
1620285809Sscottl      {
1621285809Sscottl        if ( agNULL != pRequest->pIORequestContext )
1622285809Sscottl        {
1623285809Sscottl          (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot,
1624285809Sscottl                                                            pRequest->pIORequestContext,
1625285809Sscottl                                                            OSSA_IO_SUCCESS,
1626285809Sscottl                                                            0,
1627285809Sscottl                                                            agNULL);
1628285809Sscottl        }
1629285809Sscottl
1630285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1631285809Sscottl        /* Delete the request from the pendingSMPRequests */
1632285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1633285809Sscottl        /* return the request to free pool */
1634285809Sscottl        if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1635285809Sscottl        {
1636285809Sscottl          SA_DBG1(("siIODone: saving pRequest (%p) for later use\n", pRequest));
1637285809Sscottl          saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1638285809Sscottl        }
1639285809Sscottl        else
1640285809Sscottl        {
1641285809Sscottl          saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1642285809Sscottl        }
1643285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1644285809Sscottl
1645285809Sscottl        pRequest->valid = agFALSE;
1646285809Sscottl
1647285809Sscottl        break;
1648285809Sscottl      }
1649285809Sscottl      default:
1650285809Sscottl      {
1651285809Sscottl        SA_DBG1(("siIODone: unknown request type (%x) is completed. HTag=0x%x\n", pRequest->requestType, pRequest->HTag));
1652285809Sscottl        break;
1653285809Sscottl      }
1654285809Sscottl    }
1655285809Sscottl  }
1656285809Sscottl  else
1657285809Sscottl  {
1658285809Sscottl    SA_DBG1(("siIODone: The request is not valid any more. HTag=0x%x requestType=0x%x\n", pRequest->HTag, pRequest->requestType));
1659285809Sscottl  }
1660285809Sscottl
1661285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5h");
1662285809Sscottl
1663285809Sscottl}
1664285809Sscottl
1665285809Sscottl/******************************************************************************/
1666285809Sscottl/*! \brief Routine to handle abnormal completed IO/SMP event
1667285809Sscottl *
1668285809Sscottl *  Handle abnormal completed IO/SMP
1669285809Sscottl *
1670285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
1671285809Sscottl *  \param pRequest Pointer of IO request of the IO
1672285809Sscottl *  \param status   status of the IO
1673285809Sscottl *  \param param    Length
1674285809Sscottl *
1675285809Sscottl *  \return -void-
1676285809Sscottl */
1677285809Sscottl/*******************************************************************************/
1678285809SscottlGLOBAL void siAbnormal(
1679285809Sscottl  agsaRoot_t                *agRoot,
1680285809Sscottl  agsaIORequestDesc_t       *pRequest,
1681285809Sscottl  bit32                     status,
1682285809Sscottl  bit32                     param,
1683285809Sscottl  bit32                     sspTag
1684285809Sscottl  )
1685285809Sscottl{
1686285809Sscottl  agsaLLRoot_t     *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1687285809Sscottl  agsaDeviceDesc_t *pDevice;
1688285809Sscottl
1689285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5i");
1690285809Sscottl
1691285809Sscottl  if (agNULL == pRequest)
1692285809Sscottl  {
1693285809Sscottl    SA_DBG1(("siAbnormal: pRequest is NULL.\n"));
1694285809Sscottl    smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5i");
1695285809Sscottl    return;
1696285809Sscottl  }
1697285809Sscottl
1698285809Sscottl  /* If the request is still valid */
1699285809Sscottl  if ( agTRUE == pRequest->valid )
1700285809Sscottl  {
1701285809Sscottl    /* get device */
1702285809Sscottl
1703285809Sscottl    SA_ASSERT((pRequest->pIORequestContext->osData != pRequest->pIORequestContext->sdkData), "pIORequestContext");
1704285809Sscottl
1705285809Sscottl    pDevice = pRequest->pDevice;
1706285809Sscottl
1707285809Sscottl    /* remove the IO request from IOMap */
1708285809Sscottl    saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
1709285809Sscottl    saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
1710285809Sscottl    saRoot->IOMap[pRequest->HTag].agContext = agNULL;
1711285809Sscottl
1712285809Sscottl    smTrace(hpDBG_VERY_LOUD,"P6",status );
1713285809Sscottl     /* TP:P6 siAbnormal status */
1714285809Sscottl    smTrace(hpDBG_VERY_LOUD,"P7",param );
1715285809Sscottl     /* TP:P7 siAbnormal param */
1716285809Sscottl    /* process different request type */
1717285809Sscottl    switch (pRequest->requestType & AGSA_REQTYPE_MASK)
1718285809Sscottl    {
1719285809Sscottl      case AGSA_SSP_REQTYPE:
1720285809Sscottl      {
1721285809Sscottl        (*(ossaSSPCompletedCB_t)(pRequest->completionCB))(agRoot,
1722285809Sscottl                                                          pRequest->pIORequestContext,
1723285809Sscottl                                                          status,
1724285809Sscottl                                                          param,
1725285809Sscottl                                                          agNULL,
1726285809Sscottl                                                          (bit16)(sspTag & SSPTAG_BITS),
1727285809Sscottl                                                          ((sspTag & SSP_AGR_S_BIT)? (1 << 0) : 0));
1728285809Sscottl
1729285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1730285809Sscottl        /* Delete the request from the pendingIORequests */
1731285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1732285809Sscottl        pRequest->valid = agFALSE;
1733285809Sscottl        /* return the request to free pool */
1734285809Sscottl        if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1735285809Sscottl        {
1736285809Sscottl          SA_DBG1(("siAbnormal: saving pRequest (%p) for later use\n", pRequest));
1737285809Sscottl          saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1738285809Sscottl        }
1739285809Sscottl        else
1740285809Sscottl        {
1741285809Sscottl          /* return the request to free pool */
1742285809Sscottl          saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1743285809Sscottl        }
1744285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1745285809Sscottl
1746285809Sscottl        break;
1747285809Sscottl      }
1748285809Sscottl      case AGSA_SATA_REQTYPE:
1749285809Sscottl      {
1750285809Sscottl        SA_DBG5(("siAbnormal: SATA \n"));
1751285809Sscottl
1752285809Sscottl        if ( agNULL != pRequest->pIORequestContext )
1753285809Sscottl        {
1754285809Sscottl          SA_DBG5(("siAbnormal: Calling SATACompletedCB\n"));
1755285809Sscottl
1756285809Sscottl          (*(ossaSATACompletedCB_t)(pRequest->completionCB))(agRoot,
1757285809Sscottl                                                             pRequest->pIORequestContext,
1758285809Sscottl                                                             status,
1759285809Sscottl                                                             agNULL,
1760285809Sscottl                                                             param,
1761285809Sscottl                                                             agNULL);
1762285809Sscottl        }
1763285809Sscottl
1764285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1765285809Sscottl        /* Delete the request from the pendingIORequests */
1766285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1767285809Sscottl        /* return the request to free pool */
1768285809Sscottl        pRequest->valid = agFALSE;
1769285809Sscottl        if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1770285809Sscottl        {
1771285809Sscottl          SA_DBG1(("siAbnormal: saving pRequest (%p) for later use\n", pRequest));
1772285809Sscottl          saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1773285809Sscottl        }
1774285809Sscottl        else
1775285809Sscottl        {
1776285809Sscottl          /* return the request to free pool */
1777285809Sscottl          saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1778285809Sscottl        }
1779285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1780285809Sscottl
1781285809Sscottl        break;
1782285809Sscottl      }
1783285809Sscottl      case AGSA_SMP_REQTYPE:
1784285809Sscottl      {
1785285809Sscottl        if ( agNULL != pRequest->pIORequestContext )
1786285809Sscottl        {
1787285809Sscottl          (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot,
1788285809Sscottl                                                            pRequest->pIORequestContext,
1789285809Sscottl                                                            status,
1790285809Sscottl                                                            param,
1791285809Sscottl                                                            agNULL);
1792285809Sscottl        }
1793285809Sscottl
1794285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1795285809Sscottl        /* Delete the request from the pendingSMPRequests */
1796285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1797285809Sscottl        /* return the request to free pool */
1798285809Sscottl        pRequest->valid = agFALSE;
1799285809Sscottl        if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1800285809Sscottl        {
1801285809Sscottl          SA_DBG1(("siAbnormal: saving pRequest (%p) for later use\n", pRequest));
1802285809Sscottl          saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1803285809Sscottl        }
1804285809Sscottl        else
1805285809Sscottl        {
1806285809Sscottl          /* return the request to free pool */
1807285809Sscottl          saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1808285809Sscottl        }
1809285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1810285809Sscottl
1811285809Sscottl        break;
1812285809Sscottl      }
1813285809Sscottl      default:
1814285809Sscottl      {
1815285809Sscottl        SA_DBG1(("siAbnormal: unknown request type (%x) is completed. Tag=0x%x\n", pRequest->requestType, pRequest->HTag));
1816285809Sscottl        break;
1817285809Sscottl      }
1818285809Sscottl    }
1819285809Sscottl
1820285809Sscottl  }
1821285809Sscottl  else
1822285809Sscottl  {
1823285809Sscottl    SA_DBG1(("siAbnormal: The request is not valid any more. Tag=0x%x\n", pRequest->HTag));
1824285809Sscottl  }
1825285809Sscottl
1826285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5i");
1827285809Sscottl
1828285809Sscottl  return;
1829285809Sscottl}
1830285809Sscottl
1831285809Sscottl
1832285809Sscottl/******************************************************************************/
1833285809Sscottl/*! \brief Routine to handle abnormal DIF completed IO/SMP event
1834285809Sscottl *
1835285809Sscottl *  Handle abnormal completed IO/SMP
1836285809Sscottl *
1837285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
1838285809Sscottl *  \param pRequest Pointer of IO request of the IO
1839285809Sscottl *  \param status   status of the IO
1840285809Sscottl *  \param param    Length
1841285809Sscottl *
1842285809Sscottl *  \return -void-
1843285809Sscottl */
1844285809Sscottl/*******************************************************************************/
1845285809SscottlGLOBAL void siDifAbnormal(
1846285809Sscottl  agsaRoot_t          *agRoot,
1847285809Sscottl  agsaIORequestDesc_t *pRequest,
1848285809Sscottl  bit32               status,
1849285809Sscottl  bit32               param,
1850285809Sscottl  bit32               sspTag,
1851285809Sscottl  bit32               *pMsg1
1852285809Sscottl  )
1853285809Sscottl{
1854285809Sscottl  agsaLLRoot_t     *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1855285809Sscottl  agsaDeviceDesc_t *pDevice;
1856285809Sscottl
1857285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"2S");
1858285809Sscottl
1859285809Sscottl  if (agNULL == pRequest)
1860285809Sscottl  {
1861285809Sscottl    SA_DBG1(("siDifAbnormal: pRequest is NULL.\n"));
1862285809Sscottl    smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2S");
1863285809Sscottl    return;
1864285809Sscottl  }
1865285809Sscottl
1866285809Sscottl  /* If the request is still valid */
1867285809Sscottl  if ( agTRUE == pRequest->valid )
1868285809Sscottl  {
1869285809Sscottl    /* get device */
1870285809Sscottl    pDevice = pRequest->pDevice;
1871285809Sscottl
1872285809Sscottl    /* remove the IO request from IOMap */
1873285809Sscottl    saRoot->IOMap[pRequest->HTag].Tag = MARK_OFF;
1874285809Sscottl    saRoot->IOMap[pRequest->HTag].IORequest = agNULL;
1875285809Sscottl    saRoot->IOMap[pRequest->HTag].agContext = agNULL;
1876285809Sscottl
1877285809Sscottl    smTrace(hpDBG_VERY_LOUD,"P6",status );
1878285809Sscottl     /* TP:P6 siDifAbnormal status */
1879285809Sscottl    /* process different request type */
1880285809Sscottl    switch (pRequest->requestType & AGSA_REQTYPE_MASK)
1881285809Sscottl    {
1882285809Sscottl      case AGSA_SSP_REQTYPE:
1883285809Sscottl      {
1884285809Sscottl        agsaDifDetails_t          agDifDetails;
1885285809Sscottl        agsaSSPCompletionDifRsp_t    *pIomb;
1886285809Sscottl        pIomb = (agsaSSPCompletionDifRsp_t *)pMsg1;
1887285809Sscottl        si_memset(&agDifDetails, 0, sizeof(agDifDetails));
1888285809Sscottl
1889285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.UpperLBA,           pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,UpperLBA ));
1890285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.LowerLBA,           pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,LowerLBA ));
1891285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.sasAddressHi,       pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,sasAddressHi ));
1892285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.sasAddressLo,       pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,sasAddressLo));
1893285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.ExpectedCRCUDT01,   pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,ExpectedCRCUDT01 ));
1894285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.ExpectedUDT2345,    pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,ExpectedUDT2345));
1895285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.ActualCRCUDT01,     pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,ActualCRCUDT01 ));
1896285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.ActualUDT2345,      pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,ActualUDT2345));
1897285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.DIFErrDevID,        pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,DIFErrDevID ));
1898285809Sscottl        OSSA_READ_LE_32(agRoot, &agDifDetails.ErrBoffsetEDataLen, pIomb, OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t,ErrBoffsetEDataLen ));
1899285809Sscottl        agDifDetails.frame = (void *)(bit8*)(pIomb+ OSSA_OFFSET_OF(agsaSSPCompletionDifRsp_t, EDATA_FRM));
1900285809Sscottl
1901285809Sscottl        (*(ossaSSPCompletedCB_t)(pRequest->completionCB))(agRoot,
1902285809Sscottl                                                          pRequest->pIORequestContext,
1903285809Sscottl                                                          status,
1904285809Sscottl                                                          param,
1905285809Sscottl                                                          &agDifDetails,
1906285809Sscottl                                                          (bit16)(sspTag & SSPTAG_BITS),
1907285809Sscottl                    ((sspTag & SSP_AGR_S_BIT)? (1 << 0) : 0));
1908285809Sscottl
1909285809Sscottl        ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1910285809Sscottl        pRequest->valid = agFALSE;
1911285809Sscottl        /* Delete the request from the pendingIORequests */
1912285809Sscottl        saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
1913285809Sscottl
1914285809Sscottl        /* return the request to free pool */
1915285809Sscottl        if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
1916285809Sscottl        {
1917285809Sscottl          SA_DBG1(("siDifAbnormal: saving pRequest (%p) for later use\n", pRequest));
1918285809Sscottl          saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
1919285809Sscottl        }
1920285809Sscottl        else
1921285809Sscottl        {
1922285809Sscottl          /* return the request to free pool */
1923285809Sscottl          saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
1924285809Sscottl        }
1925285809Sscottl        ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
1926285809Sscottl
1927285809Sscottl        break;
1928285809Sscottl      }
1929285809Sscottl      default:
1930285809Sscottl      {
1931285809Sscottl        SA_DBG1(("siDifAbnormal: unknown request type (%x) is completed. Tag=0x%x\n", pRequest->requestType, pRequest->HTag));
1932285809Sscottl        break;
1933285809Sscottl      }
1934285809Sscottl    }
1935285809Sscottl
1936285809Sscottl  }
1937285809Sscottl  else
1938285809Sscottl  {
1939285809Sscottl    SA_DBG1(("siDifAbnormal: The request is not valid any more. Tag=0x%x\n", pRequest->HTag));
1940285809Sscottl  }
1941285809Sscottl
1942285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2S");
1943285809Sscottl
1944285809Sscottl  return;
1945285809Sscottl}
1946285809Sscottl
1947285809Sscottl
1948285809Sscottl/******************************************************************************/
1949285809Sscottl/*! \brief Routine to handle for received SMP response event
1950285809Sscottl *
1951285809Sscottl *  The handle for received SMP response event
1952285809Sscottl *
1953285809Sscottl *  \param agRoot      handles for this instance of SAS/SATA hardware
1954285809Sscottl *  \param pIomb       Pointer of payload of IOMB
1955285809Sscottl *  \param payloadSize size of the payload
1956285809Sscottl *  \param tag         the tag of the request SMP
1957285809Sscottl *
1958285809Sscottl *  \return -void-
1959285809Sscottl */
1960285809Sscottl/*******************************************************************************/
1961285809SscottlGLOBAL void siSMPRespRcvd(
1962285809Sscottl  agsaRoot_t              *agRoot,
1963285809Sscottl  agsaSMPCompletionRsp_t  *pIomb,
1964285809Sscottl  bit32                   payloadSize,
1965285809Sscottl  bit32                   tag
1966285809Sscottl  )
1967285809Sscottl{
1968285809Sscottl  agsaLLRoot_t            *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
1969285809Sscottl  agsaFrameHandle_t       frameHandle;
1970285809Sscottl  agsaIORequestDesc_t     *pRequest;
1971285809Sscottl  agsaDeviceDesc_t        *pDevice;
1972285809Sscottl  agsaPort_t              *pPort;
1973285809Sscottl
1974285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5j");
1975285809Sscottl
1976285809Sscottl  /* get the request */
1977285809Sscottl  pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest;
1978285809Sscottl  SA_ASSERT(pRequest, "pRequest");
1979285809Sscottl
1980285809Sscottl  /* get the port */
1981285809Sscottl  pPort = pRequest->pPort;
1982285809Sscottl  SA_ASSERT(pPort, "pPort");
1983285809Sscottl
1984285809Sscottl  if (pRequest->IRmode == 0)
1985285809Sscottl  {
1986285809Sscottl    /* get frame handle - direct response mode */
1987285809Sscottl    frameHandle = (agsaFrameHandle_t)(&(pIomb->SMPrsp[0]));
1988285809Sscottl#if defined(SALLSDK_DEBUG)
1989285809Sscottl    SA_DBG3(("saSMPRespRcvd(direct): smpRspPtr=0x%p - len=0x%x\n",
1990285809Sscottl        frameHandle,
1991285809Sscottl        payloadSize
1992285809Sscottl        ));
1993285809Sscottl#endif /* SALLSDK_DEBUG */
1994285809Sscottl  }
1995285809Sscottl  else
1996285809Sscottl  {
1997285809Sscottl    /* indirect response mode */
1998285809Sscottl    frameHandle = agNULL;
1999285809Sscottl  }
2000285809Sscottl
2001285809Sscottl  /* If the request is still valid */
2002285809Sscottl  if ( agTRUE == pRequest->valid )
2003285809Sscottl  {
2004285809Sscottl    /* get device */
2005285809Sscottl    pDevice = pRequest->pDevice;
2006285809Sscottl    SA_ASSERT(pDevice, "pDevice");
2007285809Sscottl
2008285809Sscottl    /* Delete the request from the pendingSMPRequests */
2009285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
2010285809Sscottl    saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode));
2011285809Sscottl    ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
2012285809Sscottl
2013285809Sscottl    /* If the request is from OS layer */
2014285809Sscottl    if ( agNULL != pRequest->pIORequestContext )
2015285809Sscottl    {
2016285809Sscottl      if (agNULL == frameHandle)
2017285809Sscottl      {
2018285809Sscottl        /* indirect mode */
2019285809Sscottl        /* call back with success */
2020285809Sscottl        (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot, pRequest->pIORequestContext, OSSA_IO_SUCCESS, payloadSize, frameHandle);
2021285809Sscottl      }
2022285809Sscottl      else
2023285809Sscottl      {
2024285809Sscottl        /* direct mode */
2025285809Sscottl        /* call back with success */
2026285809Sscottl        (*(ossaSMPCompletedCB_t)(pRequest->completionCB))(agRoot, pRequest->pIORequestContext, OSSA_IO_SUCCESS, payloadSize, frameHandle);
2027285809Sscottl      }
2028285809Sscottl    }
2029285809Sscottl
2030285809Sscottl    /* remove the IO request from IOMap */
2031285809Sscottl    saRoot->IOMap[tag].Tag = MARK_OFF;
2032285809Sscottl    saRoot->IOMap[tag].IORequest = agNULL;
2033285809Sscottl    saRoot->IOMap[tag].agContext = agNULL;
2034285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK);
2035285809Sscottl    pRequest->valid = agFALSE;
2036285809Sscottl    if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT)
2037285809Sscottl    {
2038285809Sscottl      SA_DBG1(("siSMPRespRcvd: saving pRequest (%p) for later use\n", pRequest));
2039285809Sscottl      saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode));
2040285809Sscottl    }
2041285809Sscottl    else
2042285809Sscottl    {
2043285809Sscottl      /* return the request to free pool */
2044285809Sscottl      saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode));
2045285809Sscottl    }
2046285809Sscottl    ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK);
2047285809Sscottl  }
2048285809Sscottl
2049285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5j");
2050285809Sscottl
2051285809Sscottl  return;
2052285809Sscottl}
2053285809Sscottl
2054285809Sscottl/******************************************************************************/
2055285809Sscottl/*! \brief Routine to handle for received Phy Up event
2056285809Sscottl *
2057285809Sscottl *  The handle for received Phy Up event
2058285809Sscottl *
2059285809Sscottl *  \param agRoot handles for this instance of SAS/SATA hardware
2060285809Sscottl *  \param phyId for the Phy Up event happened
2061285809Sscottl *  \param agSASIdentify is the remote phy Identify
2062285809Sscottl *  \param portId is the port context index of the phy up event
2063285809Sscottl *  \param deviceId is the device context index
2064285809Sscottl *  \param linkRate link up rate from SPC
2065285809Sscottl *
2066285809Sscottl *  \return -void-
2067285809Sscottl */
2068285809Sscottl/*******************************************************************************/
2069285809SscottlGLOBAL void siEventPhyUpRcvd(
2070285809Sscottl  agsaRoot_t        *agRoot,
2071285809Sscottl  bit32             phyId,
2072285809Sscottl  agsaSASIdentify_t *agSASIdentify,
2073285809Sscottl  bit32             portId,
2074285809Sscottl  bit32             npipps,
2075285809Sscottl  bit8              linkRate
2076285809Sscottl  )
2077285809Sscottl{
2078285809Sscottl  agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
2079285809Sscottl  agsaPhy_t         *pPhy = &(saRoot->phys[phyId]);
2080285809Sscottl  agsaPort_t        *pPort;
2081285809Sscottl  agsaSASIdentify_t remoteIdentify;
2082285809Sscottl  agsaPortContext_t *agPortContext;
2083285809Sscottl
2084285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5k");
2085285809Sscottl
2086285809Sscottl  /* Read remote SAS Identify from response message and save it */
2087285809Sscottl  remoteIdentify = *agSASIdentify;
2088285809Sscottl
2089285809Sscottl  /* get port context from portMap */
2090285809Sscottl  SA_DBG2(("siEventPhyUpRcvd:PortID 0x%x PortStatus 0x%x PortContext %p\n",saRoot->PortMap[portId & PORTID_MASK].PortID,saRoot->PortMap[portId & PORTID_MASK].PortStatus,saRoot->PortMap[portId & PORTID_MASK].PortContext));
2091285809Sscottl  agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext;
2092285809Sscottl
2093285809Sscottl  SA_DBG2(("siEventPhyUpRcvd: portID %d PortContext %p linkRate 0x%X\n", portId, agPortContext,linkRate));
2094285809Sscottl  if (smIS_SPCV8006(agRoot))
2095285809Sscottl  {
2096285809Sscottl    SA_DBG1(("siEventPhyUpRcvd: SAS_PHY_UP received for SATA Controller\n"));
2097285809Sscottl    return;
2098285809Sscottl  }
2099285809Sscottl
2100285809Sscottl  if (agNULL != agPortContext)
2101285809Sscottl  {
2102285809Sscottl    /* existing port */
2103285809Sscottl    pPort = (agsaPort_t *) (agPortContext->sdkData);
2104285809Sscottl    pPort->portId = portId;
2105285809Sscottl
2106285809Sscottl    /* include the phy to the port */
2107285809Sscottl    pPort->phyMap[phyId] = agTRUE;
2108285809Sscottl    /* Set the port for the phy */
2109285809Sscottl    saRoot->phys[phyId].pPort = pPort;
2110285809Sscottl
2111285809Sscottl    /* Update port state */
2112285809Sscottl    if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK))
2113285809Sscottl    {
2114285809Sscottl      pPort->status &= ~PORT_INVALIDATING;
2115285809Sscottl      saRoot->PortMap[portId].PortStatus  &= ~PORT_INVALIDATING;
2116285809Sscottl      SA_DBG1(("siEventPhyUpRcvd: portID %d PortContext %p, hitting workaround\n", portId, agPortContext));
2117285809Sscottl    }
2118285809Sscottl  }
2119285809Sscottl  else
2120285809Sscottl  {
2121285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_PORT_LOCK);
2122285809Sscottl    /* new port */
2123285809Sscottl    /* Allocate a free port */
2124285809Sscottl    pPort = (agsaPort_t *) saLlistGetHead(&(saRoot->freePorts));
2125285809Sscottl    if (agNULL != pPort)
2126285809Sscottl    {
2127285809Sscottl      /* Acquire port list lock */
2128285809Sscottl      saLlistRemove(&(saRoot->freePorts), &(pPort->linkNode));
2129285809Sscottl
2130285809Sscottl      /* setup the port data structure */
2131285809Sscottl      pPort->portContext.osData = agNULL;
2132285809Sscottl      pPort->portContext.sdkData = pPort;
2133285809Sscottl
2134285809Sscottl      /* Add to valid port list */
2135285809Sscottl      saLlistAdd(&(saRoot->validPorts), &(pPort->linkNode));
2136285809Sscottl      /* Release port list lock */
2137285809Sscottl      ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK);
2138285809Sscottl
2139285809Sscottl      /* include the phy to the port */
2140285809Sscottl      pPort->phyMap[phyId] = agTRUE;
2141285809Sscottl      /* Set the port for the phy */
2142285809Sscottl      saRoot->phys[phyId].pPort = pPort;
2143285809Sscottl
2144285809Sscottl      /* Setup portMap based on portId */
2145285809Sscottl      saRoot->PortMap[portId].PortID = portId;
2146285809Sscottl      saRoot->PortMap[portId].PortContext = &(pPort->portContext);
2147285809Sscottl      pPort->portId = portId;
2148285809Sscottl
2149285809Sscottl      SA_DBG3(("siEventPhyUpRcvd: NewPort portID %d PortContext %p\n", portId, saRoot->PortMap[portId].PortContext));
2150285809Sscottl    }
2151285809Sscottl    else
2152285809Sscottl    {
2153285809Sscottl      ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK);
2154285809Sscottl      /* pPort is agNULL*/
2155285809Sscottl      smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5k");
2156285809Sscottl      return;
2157285809Sscottl    }
2158285809Sscottl
2159285809Sscottl    if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK))
2160285809Sscottl    {
2161285809Sscottl      pPort->status &= ~PORT_INVALIDATING;
2162285809Sscottl      saRoot->PortMap[portId].PortStatus  &= ~PORT_INVALIDATING;
2163285809Sscottl    }
2164285809Sscottl    else
2165285809Sscottl    {
2166285809Sscottl      SA_DBG1(("siEventPhyUpRcvd: PortInvalid portID %d PortContext %p\n", portId, saRoot->PortMap[portId].PortContext));
2167285809Sscottl    }
2168285809Sscottl  }
2169285809Sscottl
2170285809Sscottl  /* adjust the bit fields before callback */
2171285809Sscottl  phyId = (linkRate << SHIFT8) | phyId;
2172285809Sscottl  /* report PhyId, NPIP, PortState */
2173285809Sscottl  phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16);
2174285809Sscottl  ossaHwCB(agRoot, &(pPort->portContext), OSSA_HW_EVENT_SAS_PHY_UP, phyId, agNULL, &remoteIdentify);
2175285809Sscottl
2176285809Sscottl  /* set PHY_UP status */
2177285809Sscottl  PHY_STATUS_SET(pPhy, PHY_UP);
2178285809Sscottl
2179285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5k");
2180285809Sscottl
2181285809Sscottl  /* return */
2182285809Sscottl  return;
2183285809Sscottl}
2184285809Sscottl
2185285809Sscottl/******************************************************************************/
2186285809Sscottl/*! \brief Routine to handle for received SATA signature event
2187285809Sscottl *
2188285809Sscottl *  The handle for received SATA signature event
2189285809Sscottl *
2190285809Sscottl *  \param agRoot   handles for this instance of SAS/SATA hardware
2191285809Sscottl *  \param phyId    the phy id of the phy received the frame
2192285809Sscottl *  \param pMsg     the pointer to the message payload
2193285809Sscottl *  \param portId   the port context index of the phy up event
2194285809Sscottl *  \param deviceId the device context index
2195285809Sscottl *  \param linkRate link up rate from SPC
2196285809Sscottl *
2197285809Sscottl *  \return -void-
2198285809Sscottl */
2199285809Sscottl/*******************************************************************************/
2200285809SscottlGLOBAL void siEventSATASignatureRcvd(
2201285809Sscottl  agsaRoot_t    *agRoot,
2202285809Sscottl  bit32         phyId,
2203285809Sscottl  void          *pMsg,
2204285809Sscottl  bit32         portId,
2205285809Sscottl  bit32         npipps,
2206285809Sscottl  bit8          linkRate
2207285809Sscottl  )
2208285809Sscottl{
2209285809Sscottl  agsaLLRoot_t                *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
2210285809Sscottl  agsaPhy_t                   *pPhy = &(saRoot->phys[phyId]);
2211285809Sscottl  agsaPort_t                  *pPort = agNULL;
2212285809Sscottl  agsaPortContext_t           *agPortContext;
2213285809Sscottl#if defined(SALLSDK_DEBUG)
2214285809Sscottl  agsaFisRegDeviceToHost_t    *fisD2H;
2215285809Sscottl  /* Read the D2H FIS */
2216285809Sscottl  fisD2H = (agsaFisRegDeviceToHost_t *)pMsg;
2217285809Sscottl#endif  /* SALLSDK_DEBUG */
2218285809Sscottl
2219285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"5m");
2220285809Sscottl
2221285809Sscottl  SA_DBG5(("siEventSATASignatureRcvd: About to read the signatureFIS data\n"));
2222285809Sscottl
2223285809Sscottl
2224285809Sscottl  SA_DBG5(("agsaFisRegDeviceToHost_t:\n"));
2225285809Sscottl  SA_DBG5(("  fisType         = %x\n", fisD2H->h.fisType));
2226285809Sscottl  SA_DBG5(("  i_pmPort        = %x\n", fisD2H->h.i_pmPort));
2227285809Sscottl  SA_DBG5(("  status          = %x\n", fisD2H->h.status));
2228285809Sscottl  SA_DBG5(("  error           = %x\n", fisD2H->h.error));
2229285809Sscottl
2230285809Sscottl  SA_DBG5(("  lbaLow          = %x\n", fisD2H->d.lbaLow));
2231285809Sscottl  SA_DBG5(("  lbaMid          = %x\n", fisD2H->d.lbaMid));
2232285809Sscottl  SA_DBG5(("  lbaHigh         = %x\n", fisD2H->d.lbaHigh));
2233285809Sscottl  SA_DBG5(("  device          = %x\n", fisD2H->d.device));
2234285809Sscottl
2235285809Sscottl  SA_DBG5(("  lbaLowExp       = %x\n", fisD2H->d.lbaLowExp));
2236285809Sscottl  SA_DBG5(("  lbaMidExp       = %x\n", fisD2H->d.lbaMidExp));
2237285809Sscottl  SA_DBG5(("  lbaHighExp      = %x\n", fisD2H->d.lbaHighExp));
2238285809Sscottl  SA_DBG5(("  reserved4       = %x\n", fisD2H->d.reserved4));
2239285809Sscottl
2240285809Sscottl  SA_DBG5(("  sectorCount     = %x\n", fisD2H->d.sectorCount));
2241285809Sscottl  SA_DBG5(("  sectorCountExp  = %x\n", fisD2H->d.sectorCountExp));
2242285809Sscottl  SA_DBG5(("  reserved5       = %x\n", fisD2H->d.reserved5));
2243285809Sscottl  SA_DBG5(("  reserved6       = %x\n", fisD2H->d.reserved6));
2244285809Sscottl
2245285809Sscottl  SA_DBG5(("  reserved7 (32)  = %08X\n", fisD2H->d.reserved7));
2246285809Sscottl
2247285809Sscottl  SA_DBG5(("siEventSATASignatureRcvd: GOOD signatureFIS data\n"));
2248285809Sscottl
2249285809Sscottl#if defined(SALLSDK_DEBUG)
2250285809Sscottl  /* read signature */
2251285809Sscottl  pPhy->remoteSignature[0] = (bit8) fisD2H->d.sectorCount;
2252285809Sscottl  pPhy->remoteSignature[1] = (bit8) fisD2H->d.lbaLow;
2253285809Sscottl  pPhy->remoteSignature[2] = (bit8) fisD2H->d.lbaMid;
2254285809Sscottl  pPhy->remoteSignature[3] = (bit8) fisD2H->d.lbaHigh;
2255285809Sscottl  pPhy->remoteSignature[4] = (bit8) fisD2H->d.device;
2256285809Sscottl#endif
2257285809Sscottl
2258285809Sscottl  /* get port context from portMap */
2259285809Sscottl  SA_DBG2(("siEventSATASignatureRcvd:PortID 0x%x PortStatus 0x%x PortContext %p\n",saRoot->PortMap[portId & PORTID_MASK].PortID,saRoot->PortMap[portId & PORTID_MASK].PortStatus,saRoot->PortMap[portId & PORTID_MASK].PortContext));
2260285809Sscottl  agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext;
2261285809Sscottl
2262285809Sscottl  SA_DBG2(("siEventSATASignatureRcvd: portID %d PortContext %p\n", portId, agPortContext));
2263285809Sscottl
2264285809Sscottl  if (agNULL != agPortContext)
2265285809Sscottl  {
2266285809Sscottl    /* exist port */
2267285809Sscottl    pPort = (agsaPort_t *) (agPortContext->sdkData);
2268285809Sscottl    pPort->portId = portId;
2269285809Sscottl
2270285809Sscottl    /* include the phy to the port */
2271285809Sscottl    pPort->phyMap[phyId] = agTRUE;
2272285809Sscottl    /* Set the port for the phy */
2273285809Sscottl    saRoot->phys[phyId].pPort = pPort;
2274285809Sscottl  }
2275285809Sscottl  else
2276285809Sscottl  {
2277285809Sscottl    ossaSingleThreadedEnter(agRoot, LL_PORT_LOCK);
2278285809Sscottl    /* new port */
2279285809Sscottl    /* Allocate a free port */
2280285809Sscottl    pPort = (agsaPort_t *) saLlistGetHead(&(saRoot->freePorts));
2281285809Sscottl    if (agNULL != pPort)
2282285809Sscottl    {
2283285809Sscottl      /* Acquire port list lock */
2284285809Sscottl      saLlistRemove(&(saRoot->freePorts), &(pPort->linkNode));
2285285809Sscottl
2286285809Sscottl      /* setup the port data structure */
2287285809Sscottl      pPort->portContext.osData = agNULL;
2288285809Sscottl      pPort->portContext.sdkData = pPort;
2289285809Sscottl
2290285809Sscottl      /* Add to valid port list */
2291285809Sscottl      saLlistAdd(&(saRoot->validPorts), &(pPort->linkNode));
2292285809Sscottl      /* Release port list lock */
2293285809Sscottl      ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK);
2294285809Sscottl
2295285809Sscottl      /* include the phy to the port */
2296285809Sscottl      pPort->phyMap[phyId] = agTRUE;
2297285809Sscottl      /* Set the port for the phy */
2298285809Sscottl      saRoot->phys[phyId].pPort = pPort;
2299285809Sscottl
2300285809Sscottl      /* Setup portMap based on portId */
2301285809Sscottl      saRoot->PortMap[portId].PortID = portId;
2302285809Sscottl      saRoot->PortMap[portId].PortContext = &(pPort->portContext);
2303285809Sscottl      pPort->portId = portId;
2304285809Sscottl      SA_DBG3(("siEventSATASignatureRcvd: NewPort portID %d portContect %p\n", portId, saRoot->PortMap[portId].PortContext));
2305285809Sscottl    }
2306285809Sscottl    else
2307285809Sscottl    {
2308285809Sscottl      ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK);
2309285809Sscottl      /* pPort is agNULL*/
2310285809Sscottl      smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5m");
2311285809Sscottl      return;
2312285809Sscottl    }
2313285809Sscottl
2314285809Sscottl    if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK))
2315285809Sscottl    {
2316285809Sscottl      pPort->status &= ~PORT_INVALIDATING;
2317285809Sscottl      saRoot->PortMap[portId].PortStatus  &= ~PORT_INVALIDATING;
2318285809Sscottl    }
2319285809Sscottl    else
2320285809Sscottl    {
2321285809Sscottl      SA_DBG1(("siEventSATASignatureRcvd: PortInvalid portID %d PortContext %p\n", portId, saRoot->PortMap[portId].PortContext));
2322285809Sscottl    }
2323285809Sscottl  }
2324285809Sscottl
2325285809Sscottl  /* adjust the bit fields before callback */
2326285809Sscottl  phyId = (linkRate << SHIFT8) | phyId;
2327285809Sscottl  /* report PhyId, NPIP, PortState */
2328285809Sscottl  phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16);
2329285809Sscottl  ossaHwCB(agRoot, &(pPort->portContext), OSSA_HW_EVENT_SATA_PHY_UP, phyId, agNULL, pMsg);
2330285809Sscottl
2331285809Sscottl  /* set PHY_UP status */
2332285809Sscottl  PHY_STATUS_SET(pPhy, PHY_UP);
2333285809Sscottl
2334285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5m");
2335285809Sscottl
2336285809Sscottl  /* return */
2337285809Sscottl  return;
2338285809Sscottl}
2339285809Sscottl
2340285809Sscottl
2341285809Sscottl/******************************************************************************/
2342285809Sscottl/*! \brief Process Outbound IOMB Message
2343285809Sscottl *
2344285809Sscottl *  Process Outbound IOMB from SPC
2345285809Sscottl *
2346285809Sscottl *  \param agRoot       Handles for this instance of SAS/SATA LL Layer
2347285809Sscottl *  \param pMsg1        Pointer of Response IOMB message 1
2348285809Sscottl *  \param category     category of outbpond IOMB header
2349285809Sscottl *  \param opcode       Opcode of Outbound IOMB header
2350285809Sscottl *  \param bc           buffer count of IOMB header
2351285809Sscottl *
2352285809Sscottl *  \return success or fail
2353285809Sscottl *
2354285809Sscottl */
2355285809Sscottl/*******************************************************************************/
2356285809SscottlGLOBAL bit32 mpiParseOBIomb(
2357285809Sscottl  agsaRoot_t        *agRoot,
2358285809Sscottl  bit32             *pMsg1,
2359285809Sscottl  mpiMsgCategory_t  category,
2360285809Sscottl  bit16             opcode
2361285809Sscottl  )
2362285809Sscottl{
2363285809Sscottl  agsaLLRoot_t      *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
2364285809Sscottl  bit32              ret = AGSA_RC_SUCCESS;
2365285809Sscottl  bit32              parserStatus = AGSA_RC_SUCCESS;
2366285809Sscottl
2367285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD, "2f");
2368285809Sscottl
2369285809Sscottl  switch (opcode)
2370285809Sscottl  {
2371285809Sscottl    case OPC_OUB_COMBINED_SSP_COMP:
2372285809Sscottl    {
2373285809Sscottl      agsaSSPCoalescedCompletionRsp_t  *pIomb = (agsaSSPCoalescedCompletionRsp_t *)pMsg1;
2374285809Sscottl      agsaIORequestDesc_t              *pRequest = agNULL;
2375285809Sscottl      bit32  tag     = 0;
2376285809Sscottl      bit32  sspTag  = 0;
2377285809Sscottl      bit32  count   = 0;
2378285809Sscottl
2379285809Sscottl#ifdef SALL_API_TEST
2380285809Sscottl      saRoot->LLCounters.IOCounter.numSSPCompleted++;
2381285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p %d\n",
2382285809Sscottl         pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted));
2383285809Sscottl#else
2384285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SSP_COMP Response received IOMB=%p\n", pMsg1));
2385285809Sscottl#endif
2386285809Sscottl      /* get Tag */
2387285809Sscottl      for (count = 0; count < pIomb->coalescedCount; count++)
2388285809Sscottl      {
2389285809Sscottl        tag = pIomb->sspComplCxt[count].tag;
2390285809Sscottl        sspTag = pIomb->sspComplCxt[count].SSPTag;
2391285809Sscottl        pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest;
2392285809Sscottl        SA_ASSERT((pRequest), "pRequest");
2393285809Sscottl
2394285809Sscottl        if(pRequest == agNULL)
2395285809Sscottl        {
2396285809Sscottl          SA_DBG1(("mpiParseOBIomb,OPC_OUB_COMBINED_SSP_COMP Resp IOMB tag=0x%x, status=0x%x, param=0x%x, SSPTag=0x%x\n", tag, OSSA_IO_SUCCESS, 0, sspTag));
2397285809Sscottl#ifdef SA_ENABLE_PCI_TRIGGER
2398285809Sscottl          if( saRoot->swConfig.PCI_trigger & PCI_TRIGGER_COAL_IOMB_ERROR )
2399285809Sscottl          {
2400285809Sscottl            siPCITriger(agRoot);
2401285809Sscottl          }
2402285809Sscottl#endif /* SA_ENABLE_PCI_TRIGGER */
2403285809Sscottl          return(AGSA_RC_FAILURE);
2404285809Sscottl        }
2405285809Sscottl        SA_ASSERT((pRequest->valid), "pRequest->valid");
2406285809Sscottl
2407285809Sscottl#ifdef SA_ENABLE_PCI_TRIGGER
2408285809Sscottl        if(!pRequest->valid)
2409285809Sscottl        {
2410285809Sscottl          if( saRoot->swConfig.PCI_trigger & PCI_TRIGGER_COAL_INVALID )
2411285809Sscottl          {
2412285809Sscottl            siPCITriger(agRoot);
2413285809Sscottl          }
2414285809Sscottl        }
2415285809Sscottl#endif /* SA_ENABLE_PCI_TRIGGER */
2416285809Sscottl
2417285809Sscottl
2418285809Sscottl        SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SSP_COMP IOMB tag=0x%x, status=0x%x, param=0x%x, SSPTag=0x%x\n", tag, OSSA_IO_SUCCESS, 0, sspTag));
2419285809Sscottl
2420285809Sscottl        /* Completion of SSP without Response Data */
2421285809Sscottl        siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, sspTag);
2422285809Sscottl      }
2423285809Sscottl    }
2424285809Sscottl    break;
2425285809Sscottl
2426285809Sscottl    case OPC_OUB_SSP_COMP:
2427285809Sscottl    {
2428285809Sscottl#ifdef SALL_API_TEST
2429285809Sscottl      saRoot->LLCounters.IOCounter.numSSPCompleted++;
2430285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p %d\n",
2431285809Sscottl         pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted));
2432285809Sscottl#else
2433285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p\n", pMsg1));
2434285809Sscottl#endif
2435285809Sscottl      /* process the SSP IO Completed response message */
2436285809Sscottl      mpiSSPCompletion(agRoot, pMsg1);
2437285809Sscottl      break;
2438285809Sscottl    }
2439285809Sscottl    case OPC_OUB_COMBINED_SATA_COMP:
2440285809Sscottl    {
2441285809Sscottl      agsaSATACoalescedCompletionRsp_t    *pIomb;
2442285809Sscottl      agsaIORequestDesc_t       *pRequest;
2443285809Sscottl      bit32                     tag;
2444285809Sscottl      bit32                     count;
2445285809Sscottl
2446285809Sscottl    #ifdef SALL_API_TEST
2447285809Sscottl      saRoot->LLCounters.IOCounter.numSSPCompleted++;
2448285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP Response received IOMB=%p %d\n",
2449285809Sscottl         pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted));
2450285809Sscottl    #else
2451285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP Response received IOMB=%p\n", pMsg1));
2452285809Sscottl    #endif
2453285809Sscottl
2454285809Sscottl      pIomb = (agsaSATACoalescedCompletionRsp_t *)pMsg1;
2455285809Sscottl      /* get Tag */
2456285809Sscottl      for (count = 0; count < pIomb->coalescedCount; count++)
2457285809Sscottl      {
2458285809Sscottl        tag = pIomb->stpComplCxt[count].tag;
2459285809Sscottl        pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest;
2460285809Sscottl        SA_ASSERT((pRequest), "pRequest");
2461285809Sscottl
2462285809Sscottl        if(pRequest == agNULL)
2463285809Sscottl        {
2464285809Sscottl          SA_DBG1(("mpiParseOBIomb,OPC_OUB_COMBINED_SATA_COMP Resp IOMB tag=0x%x, status=0x%x, param=0x%x\n", tag, OSSA_IO_SUCCESS, 0));
2465285809Sscottl          return(AGSA_RC_FAILURE);
2466285809Sscottl        }
2467285809Sscottl        SA_ASSERT((pRequest->valid), "pRequest->valid");
2468285809Sscottl
2469285809Sscottl        SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP IOMB tag=0x%x, status=0x%x, param=0x%x\n", tag, OSSA_IO_SUCCESS, 0));
2470285809Sscottl
2471285809Sscottl        /* Completion of SATA without Response Data */
2472285809Sscottl        siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, 0);
2473285809Sscottl      }
2474285809Sscottl      break;
2475285809Sscottl    }
2476285809Sscottl    case OPC_OUB_SATA_COMP:
2477285809Sscottl    {
2478285809Sscottl#ifdef SALL_API_TEST
2479285809Sscottl      saRoot->LLCounters.IOCounter.numSataCompleted++;
2480285809Sscottl      SA_DBG3(("mpiParseOBIomb, SATA_COMP Response received IOMB=%p %d\n",
2481285809Sscottl             pMsg1, saRoot->LLCounters.IOCounter.numSataCompleted));
2482285809Sscottl#else
2483285809Sscottl      SA_DBG3(("mpiParseOBIomb, SATA_COMP Response received IOMB=%p\n", pMsg1));
2484285809Sscottl#endif
2485285809Sscottl      /* process the response message */
2486285809Sscottl      mpiSATACompletion(agRoot, pMsg1);
2487285809Sscottl      break;
2488285809Sscottl    }
2489285809Sscottl    case OPC_OUB_SSP_ABORT_RSP:
2490285809Sscottl    {
2491285809Sscottl#ifdef SALL_API_TEST
2492285809Sscottl      saRoot->LLCounters.IOCounter.numSSPAbortedCB++;
2493285809Sscottl#else
2494285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_ABORT Response received IOMB=%p\n", pMsg1));
2495285809Sscottl#endif
2496285809Sscottl      /* process the response message */
2497285809Sscottl      parserStatus = mpiSSPAbortRsp(agRoot, (agsaSSPAbortRsp_t *)pMsg1);
2498285809Sscottl      if(parserStatus !=  AGSA_RC_SUCCESS)
2499285809Sscottl      {
2500285809Sscottl         SA_DBG3(("mpiParseOBIomb, mpiSSPAbortRsp FAIL IOMB=%p\n", pMsg1));
2501285809Sscottl      }
2502285809Sscottl
2503285809Sscottl      break;
2504285809Sscottl    }
2505285809Sscottl    case OPC_OUB_SATA_ABORT_RSP:
2506285809Sscottl    {
2507285809Sscottl#ifdef SALL_API_TEST
2508285809Sscottl      saRoot->LLCounters.IOCounter.numSataAbortedCB++;
2509285809Sscottl#else
2510285809Sscottl      SA_DBG3(("mpiParseOBIomb, SATA_ABORT Response received IOMB=%p\n", pMsg1));
2511285809Sscottl#endif
2512285809Sscottl      /* process the response message */
2513285809Sscottl      mpiSATAAbortRsp(agRoot, (agsaSATAAbortRsp_t *)pMsg1);
2514285809Sscottl      break;
2515285809Sscottl    }
2516285809Sscottl    case OPC_OUB_SATA_EVENT:
2517285809Sscottl    {
2518285809Sscottl      SA_DBG3(("mpiParseOBIomb, SATA_EVENT Response received IOMB=%p\n", pMsg1));
2519285809Sscottl      /* process the response message */
2520285809Sscottl      mpiSATAEvent(agRoot, (agsaSATAEventRsp_t *)pMsg1);
2521285809Sscottl      break;
2522285809Sscottl    }
2523285809Sscottl    case OPC_OUB_SSP_EVENT:
2524285809Sscottl    {
2525285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_EVENT Response received IOMB=%p\n", pMsg1));
2526285809Sscottl      /* process the response message */
2527285809Sscottl      mpiSSPEvent(agRoot, (agsaSSPEventRsp_t *)pMsg1);
2528285809Sscottl      break;
2529285809Sscottl    }
2530285809Sscottl    case OPC_OUB_SMP_COMP:
2531285809Sscottl    {
2532285809Sscottl#ifdef SALL_API_TEST
2533285809Sscottl      saRoot->LLCounters.IOCounter.numSMPCompleted++;
2534285809Sscottl      SA_DBG3(("mpiParseOBIomb, SMP_COMP Response received IOMB=%p, %d\n",
2535285809Sscottl             pMsg1, saRoot->LLCounters.IOCounter.numSMPCompleted));
2536285809Sscottl#else
2537285809Sscottl      SA_DBG3(("mpiParseOBIomb, SMP_COMP Response received IOMB=%p\n", pMsg1));
2538285809Sscottl#endif
2539285809Sscottl      /* process the response message */
2540285809Sscottl      mpiSMPCompletion(agRoot, (agsaSMPCompletionRsp_t *)pMsg1);
2541285809Sscottl      break;
2542285809Sscottl    }
2543285809Sscottl    case OPC_OUB_ECHO:
2544285809Sscottl    {
2545285809Sscottl#ifdef SALL_API_TEST
2546285809Sscottl      saRoot->LLCounters.IOCounter.numEchoCB++;
2547285809Sscottl      SA_DBG3(("mpiParseOBIomb, ECHO Response received %d\n", saRoot->LLCounters.IOCounter.numEchoCB));
2548285809Sscottl#else
2549285809Sscottl      SA_DBG3(("mpiParseOBIomb, ECHO Response received\n"));
2550285809Sscottl#endif
2551285809Sscottl      /* process the response message */
2552285809Sscottl      mpiEchoRsp(agRoot, (agsaEchoRsp_t *)pMsg1);
2553285809Sscottl      break;
2554285809Sscottl    }
2555285809Sscottl    case OPC_OUB_GET_NVMD_DATA:
2556285809Sscottl    {
2557285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_NVMD_DATA received IOMB=%p\n", pMsg1));
2558285809Sscottl      /* process the response message */
2559285809Sscottl      mpiGetNVMDataRsp(agRoot, (agsaGetNVMDataRsp_t *)pMsg1);
2560285809Sscottl      break;
2561285809Sscottl    }
2562285809Sscottl    case OPC_OUB_SPC_HW_EVENT:
2563285809Sscottl    {
2564285809Sscottl      SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC");
2565285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SPC_HW_EVENT Response received IOMB=%p\n", pMsg1));
2566285809Sscottl      /* process the response message */
2567285809Sscottl      mpiHWevent(agRoot, (agsaHWEvent_SPC_OUB_t *)pMsg1);
2568285809Sscottl      break;
2569285809Sscottl    }
2570285809Sscottl    case OPC_OUB_HW_EVENT:
2571285809Sscottl    {
2572285809Sscottl      SA_DBG3(("mpiParseOBIomb, HW_EVENT Response received IOMB=%p\n", pMsg1));
2573285809Sscottl      /* process the response message */
2574285809Sscottl      mpiHWevent(agRoot, (agsaHWEvent_SPC_OUB_t *)pMsg1);
2575285809Sscottl      break;
2576285809Sscottl    }
2577285809Sscottl    case OPC_OUB_PHY_START_RESPONSE:
2578285809Sscottl    {
2579285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_PHY_START_RESPONSE Response received IOMB=%p\n", pMsg1));
2580285809Sscottl      /* process the response message */
2581285809Sscottl      mpiPhyStartEvent( agRoot, (agsaHWEvent_Phy_OUB_t  *)pMsg1  );
2582285809Sscottl
2583285809Sscottl      break;
2584285809Sscottl    }
2585285809Sscottl    case OPC_OUB_PHY_STOP_RESPONSE:
2586285809Sscottl    {
2587285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_PHY_STOP_RESPONSE Response received IOMB=%p\n", pMsg1));
2588285809Sscottl      /* process the response message */
2589285809Sscottl      mpiPhyStopEvent( agRoot, (agsaHWEvent_Phy_OUB_t  *)pMsg1  );
2590285809Sscottl      break;
2591285809Sscottl    }
2592285809Sscottl
2593285809Sscottl    case OPC_OUB_LOCAL_PHY_CNTRL:
2594285809Sscottl    {
2595285809Sscottl      SA_DBG3(("mpiParseOBIomb, PHY CONTROL Response received IOMB=%p\n", pMsg1));
2596285809Sscottl      /* process the response message */
2597285809Sscottl      mpiPhyCntrlRsp(agRoot, (agsaLocalPhyCntrlRsp_t *)pMsg1);
2598285809Sscottl      break;
2599285809Sscottl    }
2600285809Sscottl    case OPC_OUB_SPC_DEV_REGIST:
2601285809Sscottl    {
2602285809Sscottl      SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC");
2603285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SPC_DEV_REGIST Response received IOMB=%p\n", pMsg1));
2604285809Sscottl      /* process the response message */
2605285809Sscottl      mpiDeviceRegRsp(agRoot, (agsaDeviceRegistrationRsp_t *)pMsg1);
2606285809Sscottl      break;
2607285809Sscottl    }
2608285809Sscottl    case OPC_OUB_DEV_REGIST:
2609285809Sscottl    {
2610285809Sscottl      SA_DBG2(("mpiParseOBIomb, DEV_REGISTRATION Response received IOMB=%p\n", pMsg1));
2611285809Sscottl      /* process the response message */
2612285809Sscottl      mpiDeviceRegRsp(agRoot, (agsaDeviceRegistrationRsp_t *)pMsg1);
2613285809Sscottl      break;
2614285809Sscottl    }
2615285809Sscottl    case OPC_OUB_DEREG_DEV:
2616285809Sscottl    {
2617285809Sscottl      SA_DBG3(("mpiParseOBIomb, DEREGISTRATION DEVICE Response received IOMB=%p\n", pMsg1));
2618285809Sscottl      /* process the response message */
2619285809Sscottl      mpiDeregDevHandleRsp(agRoot, (agsaDeregDevHandleRsp_t *)pMsg1);
2620285809Sscottl      break;
2621285809Sscottl    }
2622285809Sscottl    case OPC_OUB_GET_DEV_HANDLE:
2623285809Sscottl    {
2624285809Sscottl      SA_DBG3(("mpiParseOBIomb, GET_DEV_HANDLE Response received IOMB=%p\n", pMsg1));
2625285809Sscottl      /* process the response message */
2626285809Sscottl      mpiGetDevHandleRsp(agRoot, (agsaGetDevHandleRsp_t *)pMsg1);
2627285809Sscottl      break;
2628285809Sscottl    }
2629285809Sscottl    case OPC_OUB_SPC_DEV_HANDLE_ARRIV:
2630285809Sscottl    {
2631285809Sscottl      SA_DBG3(("mpiParseOBIomb, SPC_DEV_HANDLE_ARRIV Response received IOMB=%p\n", pMsg1));
2632285809Sscottl      /* process the response message */
2633285809Sscottl      mpiDeviceHandleArrived(agRoot, (agsaDeviceHandleArrivedNotify_t *)pMsg1);
2634285809Sscottl      break;
2635285809Sscottl    }
2636285809Sscottl    case OPC_OUB_DEV_HANDLE_ARRIV:
2637285809Sscottl    {
2638285809Sscottl      SA_DBG3(("mpiParseOBIomb, DEV_HANDLE_ARRIV Response received IOMB=%p\n", pMsg1));
2639285809Sscottl      /* process the response message */
2640285809Sscottl      mpiDeviceHandleArrived(agRoot, (agsaDeviceHandleArrivedNotify_t *)pMsg1);
2641285809Sscottl      break;
2642285809Sscottl    }
2643285809Sscottl    case OPC_OUB_SSP_RECV_EVENT:
2644285809Sscottl    {
2645285809Sscottl      SA_DBG3(("mpiParseOBIomb, SSP_RECV_EVENT Response received IOMB=%p\n", pMsg1));
2646285809Sscottl      /* process the response message */
2647285809Sscottl      mpiSSPReqReceivedNotify(agRoot, (agsaSSPReqReceivedNotify_t *)pMsg1);
2648285809Sscottl      break;
2649285809Sscottl    }
2650285809Sscottl    case OPC_OUB_DEV_INFO:
2651285809Sscottl    {
2652285809Sscottl      SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV");
2653285809Sscottl      SA_DBG3(("mpiParseOBIomb, DEV_INFO Response received IOMB=%p\n", pMsg1));
2654285809Sscottl      /* process the response message */
2655285809Sscottl      mpiGetDevInfoRsp(agRoot, (agsaGetDevInfoRspV_t *)pMsg1);
2656285809Sscottl      break;
2657285809Sscottl    }
2658285809Sscottl    case OPC_OUB_GET_PHY_PROFILE_RSP:
2659285809Sscottl    {
2660285809Sscottl      SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV");
2661285809Sscottl      SA_DBG2(("mpiParseOBIomb, OPC_OUB_GET_PHY_PROFILE_RSP Response received IOMB=%p\n", pMsg1));
2662285809Sscottl      /* process the response message */
2663285809Sscottl      mpiGetPhyProfileRsp(agRoot, (agsaGetPhyProfileRspV_t *)pMsg1);
2664285809Sscottl      break;
2665285809Sscottl    }
2666285809Sscottl    case OPC_OUB_SET_PHY_PROFILE_RSP:
2667285809Sscottl    {
2668285809Sscottl      SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV");
2669285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_PHY_PROFILE_RSP Response received IOMB=%p\n", pMsg1));
2670285809Sscottl      /* process the response message */
2671285809Sscottl      mpiSetPhyProfileRsp(agRoot, (agsaSetPhyProfileRspV_t *)pMsg1);
2672285809Sscottl      break;
2673285809Sscottl    }
2674285809Sscottl    case OPC_OUB_SPC_DEV_INFO:
2675285809Sscottl    {
2676285809Sscottl      SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC");
2677285809Sscottl      SA_DBG3(("mpiParseOBIomb, DEV_INFO Response received IOMB=%p\n", pMsg1));
2678285809Sscottl      /* process the response message */
2679285809Sscottl      mpiGetDevInfoRspSpc(agRoot, (agsaGetDevInfoRsp_t *)pMsg1);
2680285809Sscottl      break;
2681285809Sscottl    }
2682285809Sscottl    case OPC_OUB_FW_FLASH_UPDATE:
2683285809Sscottl    {
2684285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_FW_FLASH_UPDATE Response received IOMB=%p\n", pMsg1));
2685285809Sscottl      /* process the response message */
2686285809Sscottl      mpiFwFlashUpdateRsp(agRoot, (agsaFwFlashUpdateRsp_t *)pMsg1);
2687285809Sscottl      break;
2688285809Sscottl    }
2689285809Sscottl    case OPC_OUB_FLASH_OP_EXT_RSP:
2690285809Sscottl    {
2691285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_FLASH_OP_EXT_RSP Response received IOMB=%p\n", pMsg1));
2692285809Sscottl      /* process the response message */
2693285809Sscottl      mpiFwExtFlashUpdateRsp(agRoot, (agsaFwFlashOpExtRsp_t *)pMsg1);
2694285809Sscottl      break;
2695285809Sscottl    }
2696285809Sscottl#ifdef SPC_ENABLE_PROFILE
2697285809Sscottl    case OPC_OUB_FW_PROFILE:
2698285809Sscottl    {
2699285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_FW_PROFILE Response received IOMB=%p\n", pMsg1));
2700285809Sscottl      /* process the response message */
2701285809Sscottl      mpiFwProfileRsp(agRoot, (agsaFwProfileRsp_t *)pMsg1);
2702285809Sscottl      break;
2703285809Sscottl    }
2704285809Sscottl#endif
2705285809Sscottl    case OPC_OUB_SET_NVMD_DATA:
2706285809Sscottl    {
2707285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_NVMD_DATA received IOMB=%p\n", pMsg1));
2708285809Sscottl      /* process the response message */
2709285809Sscottl      mpiSetNVMDataRsp(agRoot, (agsaSetNVMDataRsp_t *)pMsg1);
2710285809Sscottl      break;
2711285809Sscottl    }
2712285809Sscottl    case OPC_OUB_GPIO_RESPONSE:
2713285809Sscottl    {
2714285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GPIO_RESPONSE Response received IOMB=%p\n", pMsg1));
2715285809Sscottl      /* process the response message */
2716285809Sscottl      mpiGPIORsp(agRoot, (agsaGPIORsp_t *)pMsg1);
2717285809Sscottl      break;
2718285809Sscottl    }
2719285809Sscottl    case OPC_OUB_GPIO_EVENT:
2720285809Sscottl    {
2721285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GPIO_RESPONSE Response received IOMB=%p\n", pMsg1));
2722285809Sscottl      /* process the response message */
2723285809Sscottl      mpiGPIOEventRsp(agRoot, (agsaGPIOEvent_t *)pMsg1);
2724285809Sscottl      break;
2725285809Sscottl    }
2726285809Sscottl    case OPC_OUB_GENERAL_EVENT:
2727285809Sscottl    {
2728285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GENERAL_EVENT Response received IOMB=%p\n", pMsg1));
2729285809Sscottl      /* process the response message */
2730285809Sscottl      mpiGeneralEventRsp(agRoot, (agsaGeneralEventRsp_t *)pMsg1);
2731285809Sscottl      break;
2732285809Sscottl    }
2733285809Sscottl    case OPC_OUB_SAS_DIAG_MODE_START_END:
2734285809Sscottl    {
2735285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_DIAG_MODE_START_END Response received IOMB=%p\n", pMsg1));
2736285809Sscottl      /* process the response message */
2737285809Sscottl      mpiSASDiagStartEndRsp(agRoot, (agsaSASDiagStartEndRsp_t *)pMsg1);
2738285809Sscottl      break;
2739285809Sscottl    }
2740285809Sscottl    case OPC_OUB_SAS_DIAG_EXECUTE:
2741285809Sscottl    {
2742285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_DIAG_EXECUTE_RSP Response received IOMB=%p\n", pMsg1));
2743285809Sscottl      /* process the response message */
2744285809Sscottl      mpiSASDiagExecuteRsp(agRoot, (agsaSASDiagExecuteRsp_t *)pMsg1);
2745285809Sscottl      break;
2746285809Sscottl    }
2747285809Sscottl    case OPC_OUB_GET_TIME_STAMP:
2748285809Sscottl    {
2749285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_TIME_STAMP Response received IOMB=%p\n", pMsg1));
2750285809Sscottl      /* process the response message */
2751285809Sscottl      mpiGetTimeStampRsp(agRoot, (agsaGetTimeStampRsp_t *)pMsg1);
2752285809Sscottl      break;
2753285809Sscottl    }
2754285809Sscottl
2755285809Sscottl    case OPC_OUB_SPC_SAS_HW_EVENT_ACK:
2756285809Sscottl    {
2757285809Sscottl      SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC");
2758285809Sscottl      SA_DBG3(("mpiParseOBIomb,OPC_OUB_SPC_SAS_HW_EVENT_ACK  Response received IOMB=%p\n", pMsg1));
2759285809Sscottl      /* process the response message */
2760285809Sscottl      mpiSASHwEventAckRsp(agRoot, (agsaSASHwEventAckRsp_t *)pMsg1);
2761285809Sscottl      break;
2762285809Sscottl    }
2763285809Sscottl
2764285809Sscottl    case OPC_OUB_SAS_HW_EVENT_ACK:
2765285809Sscottl    {
2766285809Sscottl      SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV");
2767285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_SAS_HW_EVENT_ACK Response received IOMB=%p\n", pMsg1));
2768285809Sscottl      /* process the response message */
2769285809Sscottl      mpiSASHwEventAckRsp(agRoot, (agsaSASHwEventAckRsp_t *)pMsg1);
2770285809Sscottl      break;
2771285809Sscottl    }
2772285809Sscottl    case OPC_OUB_PORT_CONTROL:
2773285809Sscottl    {
2774285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_PORT_CONTROL Response received IOMB=%p\n", pMsg1));
2775285809Sscottl      /* process the response message */
2776285809Sscottl      mpiPortControlRsp(agRoot, (agsaPortControlRsp_t *)pMsg1);
2777285809Sscottl      break;
2778285809Sscottl    }
2779285809Sscottl    case OPC_OUB_SMP_ABORT_RSP:
2780285809Sscottl    {
2781285809Sscottl#ifdef SALL_API_TEST
2782285809Sscottl      saRoot->LLCounters.IOCounter.numSMPAbortedCB++;
2783285809Sscottl      SA_DBG3(("mpiParseOBIomb, SMP_ABORT Response received IOMB=%p, %d\n",
2784285809Sscottl             pMsg1, saRoot->LLCounters.IOCounter.numSMPAbortedCB));
2785285809Sscottl#else
2786285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SMP_ABORT_RSP Response received IOMB=%p\n", pMsg1));
2787285809Sscottl#endif
2788285809Sscottl      /* process the response message */
2789285809Sscottl      mpiSMPAbortRsp(agRoot, (agsaSMPAbortRsp_t *)pMsg1);
2790285809Sscottl      break;
2791285809Sscottl    }
2792285809Sscottl    case OPC_OUB_DEVICE_HANDLE_REMOVAL:
2793285809Sscottl    {
2794285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_DEVICE_HANDLE_REMOVAL received IOMB=%p\n", pMsg1));
2795285809Sscottl      /* process the response message */
2796285809Sscottl      mpiDeviceHandleRemoval(agRoot, (agsaDeviceHandleRemoval_t *)pMsg1);
2797285809Sscottl      break;
2798285809Sscottl    }
2799285809Sscottl    case OPC_OUB_SET_DEVICE_STATE:
2800285809Sscottl    {
2801285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_DEVICE_STATE received IOMB=%p\n", pMsg1));
2802285809Sscottl      /* process the response message */
2803285809Sscottl      mpiSetDeviceStateRsp(agRoot, (agsaSetDeviceStateRsp_t *)pMsg1);
2804285809Sscottl      break;
2805285809Sscottl    }
2806285809Sscottl    case OPC_OUB_GET_DEVICE_STATE:
2807285809Sscottl    {
2808285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_DEVICE_STATE received IOMB=%p\n", pMsg1));
2809285809Sscottl      /* process the response message */
2810285809Sscottl      mpiGetDeviceStateRsp(agRoot, (agsaGetDeviceStateRsp_t *)pMsg1);
2811285809Sscottl      break;
2812285809Sscottl    }
2813285809Sscottl    case OPC_OUB_SET_DEV_INFO:
2814285809Sscottl    {
2815285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_DEV_INFO received IOMB=%p\n", pMsg1));
2816285809Sscottl      /* process the response message */
2817285809Sscottl      mpiSetDevInfoRsp(agRoot, (agsaSetDeviceInfoRsp_t *)pMsg1);
2818285809Sscottl      break;
2819285809Sscottl    }
2820285809Sscottl    case OPC_OUB_SAS_RE_INITIALIZE:
2821285809Sscottl    {
2822285809Sscottl      SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC");
2823285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_RE_INITIALIZE received IOMB=%p\n", pMsg1));
2824285809Sscottl      /* process the response message */
2825285809Sscottl      mpiSasReInitializeRsp(agRoot, (agsaSasReInitializeRsp_t *)pMsg1);
2826285809Sscottl      break;
2827285809Sscottl    }
2828285809Sscottl
2829285809Sscottl    case OPC_OUB_SGPIO_RESPONSE:
2830285809Sscottl    {
2831285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SGPIO_RESPONSE Response received IOMB=%p\n", pMsg1));
2832285809Sscottl      /* process the response message */
2833285809Sscottl      mpiSGpioRsp(agRoot, (agsaSGpioRsp_t *)pMsg1);
2834285809Sscottl      break;
2835285809Sscottl    }
2836285809Sscottl
2837285809Sscottl    case OPC_OUB_PCIE_DIAG_EXECUTE:
2838285809Sscottl    {
2839285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_PCIE_DIAG_EXECUTE Response received IOMB=%p\n", pMsg1));
2840285809Sscottl      /* process the response message */
2841285809Sscottl      mpiPCIeDiagExecuteRsp(agRoot, (agsaPCIeDiagExecuteRsp_t *)pMsg1);
2842285809Sscottl      break;
2843285809Sscottl    }
2844285809Sscottl
2845285809Sscottl    case OPC_OUB_GET_VIST_CAP_RSP:
2846285809Sscottl    {
2847285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_INB_GET_VIST_CAP Response received IOMB=%p\n", pMsg1));
2848285809Sscottl      /* process the response message */
2849285809Sscottl      mpiGetVHistRsp(agRoot, (agsaGetVHistCapRsp_t *)pMsg1);
2850285809Sscottl      break;
2851285809Sscottl    }
2852285809Sscottl    case 2104:
2853285809Sscottl    {
2854285809Sscottl      if(smIS_SPC6V(agRoot))
2855285809Sscottl      {
2856285809Sscottl        SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_DFE_DATA_RSP Response received IOMB=%p\n", pMsg1));
2857285809Sscottl        /* process the response message */
2858285809Sscottl        mpiGetDFEDataRsp(agRoot, (agsaGetDDEFDataRsp_t *)pMsg1);
2859285809Sscottl      }
2860285809Sscottl      if(smIS_SPC12V(agRoot))
2861285809Sscottl      {
2862285809Sscottl        SA_DBG3(("mpiParseOBIomb, OPC_INB_GET_VIST_CAP Response received IOMB=%p\n", pMsg1));
2863285809Sscottl        /* process the response message */
2864285809Sscottl        mpiGetVHistRsp(agRoot, (agsaGetVHistCapRsp_t *)pMsg1);
2865285809Sscottl      }
2866285809Sscottl      else
2867285809Sscottl      {
2868285809Sscottl        SA_DBG1(("mpiParseOBIomb, 2104  Response received IOMB=%p\n", pMsg1));
2869285809Sscottl        /* process the response message */
2870285809Sscottl      }
2871285809Sscottl      break;
2872285809Sscottl    }
2873285809Sscottl    case OPC_OUB_SET_CONTROLLER_CONFIG:
2874285809Sscottl    {
2875285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_CONTROLLER_CONFIG Response received IOMB=%p\n", pMsg1));
2876285809Sscottl      mpiSetControllerConfigRsp(agRoot, (agsaSetControllerConfigRsp_t *)pMsg1);
2877285809Sscottl      break;
2878285809Sscottl    }
2879285809Sscottl    case OPC_OUB_GET_CONTROLLER_CONFIG:
2880285809Sscottl    {
2881285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_CONTROLLER_CONFIG Response received IOMB=%p\n", pMsg1));
2882285809Sscottl      mpiGetControllerConfigRsp(agRoot, (agsaGetControllerConfigRsp_t *)pMsg1);
2883285809Sscottl      break;
2884285809Sscottl    }
2885285809Sscottl    case OPC_OUB_KEK_MANAGEMENT:
2886285809Sscottl    {
2887285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_KEK_MANAGEMENT Response received IOMB=%p\n", pMsg1));
2888285809Sscottl      mpiKekManagementRsp(agRoot, (agsaKekManagementRsp_t *)pMsg1);
2889285809Sscottl      break;
2890285809Sscottl    }
2891285809Sscottl    case OPC_OUB_DEK_MANAGEMENT:
2892285809Sscottl    {
2893285809Sscottl      SA_DBG3(("mpiParseOBIomb, OPC_OUB_DEK_MANAGEMENT Response received IOMB=%p\n", pMsg1));
2894285809Sscottl      mpiDekManagementRsp(agRoot, (agsaDekManagementRsp_t *)pMsg1);
2895285809Sscottl      break;
2896285809Sscottl    }
2897285809Sscottl    case OPC_OUB_OPR_MGMT:
2898285809Sscottl    {
2899285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_OPR_MGMT Response received IOMB=%p\n", pMsg1));
2900285809Sscottl      mpiOperatorManagementRsp(agRoot, (agsaOperatorMangmenRsp_t *)pMsg1);
2901285809Sscottl      break;
2902285809Sscottl    }
2903285809Sscottl    case OPC_OUB_ENC_TEST_EXECUTE:
2904285809Sscottl    {
2905285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_ENC_TEST_EXECUTE Response received IOMB=%p\n", pMsg1));
2906285809Sscottl      mpiBistRsp(agRoot, (agsaEncryptBistRsp_t *)pMsg1);
2907285809Sscottl      break;
2908285809Sscottl    }
2909285809Sscottl    case OPC_OUB_SET_OPERATOR:
2910285809Sscottl    {
2911285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_SET_OPERATOR Response received IOMB=%p\n", pMsg1));
2912285809Sscottl      mpiSetOperatorRsp(agRoot, (agsaSetOperatorRsp_t *)pMsg1);
2913285809Sscottl      break;
2914285809Sscottl    }
2915285809Sscottl    case OPC_OUB_GET_OPERATOR:
2916285809Sscottl    {
2917285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_GET_OPERATOR Response received IOMB=%p\n", pMsg1));
2918285809Sscottl      mpiGetOperatorRsp(agRoot, (agsaGetOperatorRsp_t *)pMsg1);
2919285809Sscottl      break;
2920285809Sscottl    }
2921285809Sscottl    case OPC_OUB_DIF_ENC_OFFLOAD_RSP:
2922285809Sscottl    {
2923285809Sscottl      SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV");
2924285809Sscottl      SA_DBG1(("mpiParseOBIomb, OPC_OUB_DIF_ENC_OFFLOAD_RSP Response received IOMB=%p\n", pMsg1));
2925285809Sscottl      /* process the response message */
2926285809Sscottl      mpiDifEncOffloadRsp(agRoot, (agsaDifEncOffloadRspV_t *)pMsg1);
2927285809Sscottl      break;
2928285809Sscottl    }
2929285809Sscottl    default:
2930285809Sscottl    {
2931285809Sscottl#ifdef SALL_API_TEST
2932285809Sscottl      saRoot->LLCounters.IOCounter.numUNKNWRespIOMB++;
2933285809Sscottl      SA_DBG1(("mpiParseOBIomb, UnKnown Response received IOMB=%p, %d\n",
2934285809Sscottl             pMsg1, saRoot->LLCounters.IOCounter.numUNKNWRespIOMB));
2935285809Sscottl#else
2936285809Sscottl      SA_DBG1(("mpiParseOBIomb, Unknown IOMB Response received opcode 0x%X IOMB=%p\n",opcode, pMsg1));
2937285809Sscottl#endif
2938285809Sscottl      break;
2939285809Sscottl    }
2940285809Sscottl  } /* switch */
2941285809Sscottl
2942285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2f");
2943285809Sscottl
2944285809Sscottl  return ret;
2945285809Sscottl
2946285809Sscottl}
2947285809Sscottl
2948285809Sscottl
2949285809Sscottl/******************************************************************************/
2950285809Sscottl/*! \brief SPC MPI SATA Completion
2951285809Sscottl *
2952285809Sscottl *  This function handles the SATA completion.
2953285809Sscottl *
2954285809Sscottl *  \param agRoot       Handles for this instance of SAS/SATA LLL
2955285809Sscottl *  \param pIomb1       Pointer of Message1
2956285809Sscottl *  \param bc           buffer count
2957285809Sscottl *
2958285809Sscottl *  \return The read value
2959285809Sscottl *
2960285809Sscottl */
2961285809Sscottl/*******************************************************************************/
2962285809SscottlGLOBAL FORCEINLINE
2963285809Sscottlbit32 mpiSATACompletion(
2964285809Sscottl  agsaRoot_t    *agRoot,
2965285809Sscottl  bit32         *pIomb1
2966285809Sscottl  )
2967285809Sscottl{
2968285809Sscottl  bit32                     ret = AGSA_RC_SUCCESS;
2969285809Sscottl  agsaLLRoot_t              *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
2970285809Sscottl  bit32                     status;
2971285809Sscottl  bit32                     tag;
2972285809Sscottl  bit32                     param;
2973285809Sscottl  agsaIORequestDesc_t       *pRequest;
2974285809Sscottl  bit32                     *agFirstDword;
2975285809Sscottl  bit32                     *pResp;
2976285809Sscottl
2977285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD,"2s");
2978285809Sscottl
2979285809Sscottl  OSSA_READ_LE_32(AGROOT, &tag, pIomb1, OSSA_OFFSET_OF(agsaSATACompletionRsp_t, tag)) ;
2980285809Sscottl  OSSA_READ_LE_32(AGROOT, &status, pIomb1, OSSA_OFFSET_OF(agsaSATACompletionRsp_t, status)) ;
2981285809Sscottl  OSSA_READ_LE_32(AGROOT, &param, pIomb1, OSSA_OFFSET_OF(agsaSATACompletionRsp_t, param)) ;
2982285809Sscottl
2983285809Sscottl  SA_DBG3(("mpiSATACompletion: start, HTAG=0x%x\n", tag));
2984285809Sscottl
2985285809Sscottl  /* get IOrequest from IOMap */
2986285809Sscottl  pRequest  = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest;
2987285809Sscottl  SA_ASSERT((pRequest), "pRequest");
2988285809Sscottl
2989285809Sscottl  if(agNULL == pRequest)
2990285809Sscottl  {
2991285809Sscottl    SA_DBG1(("mpiSATACompletion: agNULL == pRequest tag 0x%X status 0x%X\n",tag, status ));
2992285809Sscottl    smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2s");
2993285809Sscottl    return AGSA_RC_FAILURE;
2994285809Sscottl  }
2995285809Sscottl
2996285809Sscottl  SA_ASSERT((pRequest->valid), "pRequest->valid");
2997285809Sscottl  if(!pRequest->valid)
2998285809Sscottl  {
2999285809Sscottl    SA_DBG1(("mpiSATACompletion: not valid IOMB tag=0x%x status=0x%x param=0x%x Device =0x%x\n", tag, status, param,
3000285809Sscottl    pRequest->pDevice ? pRequest->pDevice->DeviceMapIndex : -1));
3001285809Sscottl  }
3002285809Sscottl
3003285809Sscottl  switch (status)
3004285809Sscottl  {
3005285809Sscottl    case OSSA_IO_SUCCESS:
3006285809Sscottl    {
3007285809Sscottl      SA_DBG3(("mpiSATACompletion: OSSA_IO_SUCCESS, param=0x%x\n", param));
3008285809Sscottl      if (!param)
3009285809Sscottl      {
3010285809Sscottl        /* SATA request completion */
3011285809Sscottl        siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, 0);
3012285809Sscottl      }
3013285809Sscottl      else
3014285809Sscottl      {
3015285809Sscottl        /* param number bytes of SATA Rsp */
3016285809Sscottl        agFirstDword  = &pIomb1[3];
3017285809Sscottl        pResp         = &pIomb1[4];
3018285809Sscottl
3019285809Sscottl        /* CB function to the up layer */
3020285809Sscottl        /* Response Length not include firstDW */
3021285809Sscottl        saRoot->IoErrorCount.agOSSA_IO_COMPLETED_ERROR_SCSI_STATUS++;
3022285809Sscottl        SA_DBG2(("mpiSATACompletion: param 0x%x agFirstDwordResp 0x%x Resp 0x%x tag 0x%x\n",param,*agFirstDword,*pResp ,tag));
3023285809Sscottl        siEventSATAResponseWtDataRcvd(agRoot, pRequest, agFirstDword, pResp, (param - 4));
3024285809Sscottl      }
3025285809Sscottl
3026285809Sscottl      break;
3027285809Sscottl    }
3028285809Sscottl    case OSSA_IO_ABORTED:
3029285809Sscottl    {
3030285809Sscottl      SA_DBG2(("mpiSATACompletion: OSSA_IO_ABORTED tag 0x%X\n", tag));
3031285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_ABORTED++;
3032285809Sscottl      siAbnormal(agRoot, pRequest, status, param, 0);
3033285809Sscottl      break;
3034285809Sscottl    }
3035285809Sscottl    case OSSA_IO_UNDERFLOW:
3036285809Sscottl    {
3037285809Sscottl      /* SATA Completion with error */
3038285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_UNDERFLOW tag 0x%X\n", tag));
3039285809Sscottl      /*underflow means underrun, treat it as success*/
3040285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_UNDERFLOW++;
3041285809Sscottl      siAbnormal(agRoot, pRequest, status, param, 0);
3042285809Sscottl      break;
3043285809Sscottl    }
3044285809Sscottl    case OSSA_IO_NO_DEVICE:
3045285809Sscottl    {
3046285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_NO_DEVICE tag 0x%X\n", tag));
3047285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_NO_DEVICE++;
3048285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3049285809Sscottl      break;
3050285809Sscottl    }
3051285809Sscottl    case OSSA_IO_XFER_ERROR_BREAK:
3052285809Sscottl    {
3053285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_BREAK SPC tag 0x%X\n", tag));
3054285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_BREAK++;
3055285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3056285809Sscottl      break;
3057285809Sscottl    }
3058285809Sscottl    case OSSA_IO_XFER_ERROR_PHY_NOT_READY:
3059285809Sscottl    {
3060285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_PHY_NOT_READY tag 0x%X\n", tag));
3061285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_PHY_NOT_READY++;
3062285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3063285809Sscottl      break;
3064285809Sscottl    }
3065285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
3066285809Sscottl    {
3067285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED tag 0x%X\n", tag));
3068285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED++;
3069285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3070285809Sscottl      break;
3071285809Sscottl    }
3072285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION:
3073285809Sscottl    {
3074285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION tag 0x%X\n", tag));
3075285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION++;
3076285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3077285809Sscottl      break;
3078285809Sscottl    }
3079285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_BREAK:
3080285809Sscottl    {
3081285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_BREAK SPC tag 0x%X\n", tag));
3082285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BREAK++;
3083285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3084285809Sscottl      break;
3085285809Sscottl    }
3086285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS:
3087285809Sscottl    {
3088285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS tag 0x%X\n", tag));
3089285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS++;
3090285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3091285809Sscottl      break;
3092285809Sscottl    }
3093285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION:
3094285809Sscottl    {
3095285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION tag 0x%X\n", tag));
3096285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION++;
3097285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3098285809Sscottl      break;
3099285809Sscottl    }
3100285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED:
3101285809Sscottl    {
3102285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED tag 0x%X\n", tag));
3103285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED++;
3104285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3105285809Sscottl      break;
3106285809Sscottl    }
3107285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY:
3108285809Sscottl    {
3109285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY tag 0x%X\n", tag));
3110285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY++;
3111285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3112285809Sscottl      break;
3113285809Sscottl    }
3114285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION:
3115285809Sscottl    {
3116285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION tag 0x%X\n", tag));
3117285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION++;
3118285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3119285809Sscottl      break;
3120285809Sscottl    }
3121285809Sscottl    case OSSA_IO_XFER_ERROR_NAK_RECEIVED:
3122285809Sscottl    {
3123285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_NAK_RECEIVED tag 0x%X\n", tag));
3124285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_NAK_RECEIVED++;
3125285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3126285809Sscottl      break;
3127285809Sscottl    }
3128285809Sscottl    case OSSA_IO_XFER_ERROR_DMA:
3129285809Sscottl    {
3130285809Sscottl       SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_DMA tag 0x%X\n", tag));
3131285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_DMA++;
3132285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, 0);
3133285809Sscottl       break;
3134285809Sscottl    }
3135285809Sscottl    case OSSA_IO_XFER_ERROR_SATA_LINK_TIMEOUT:
3136285809Sscottl    {
3137285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_SATA_LINK_TIMEOUT tag 0x%X\n", tag));
3138285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_SATA_LINK_TIMEOUT++;
3139285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3140285809Sscottl      break;
3141285809Sscottl    }
3142285809Sscottl    case OSSA_IO_XFER_ERROR_REJECTED_NCQ_MODE:
3143285809Sscottl    {
3144285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_ERROR_REJECTED_NCQ_MODE tag 0x%X\n", tag));
3145285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_REJECTED_NCQ_MODE++;
3146285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3147285809Sscottl      break;
3148285809Sscottl    }
3149285809Sscottl    case OSSA_IO_XFER_OPEN_RETRY_TIMEOUT:
3150285809Sscottl    {
3151285809Sscottl       SA_DBG1(("mpiSATACompletion, OSSA_IO_XFER_OPEN_RETRY_TIMEOUT tag 0x%X\n", tag));
3152285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT++;
3153285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, 0);
3154285809Sscottl       break;
3155285809Sscottl    }
3156285809Sscottl    case OSSA_IO_PORT_IN_RESET:
3157285809Sscottl    {
3158285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_PORT_IN_RESET tag 0x%X\n", tag));
3159285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_PORT_IN_RESET++;
3160285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3161285809Sscottl      break;
3162285809Sscottl    }
3163285809Sscottl    case OSSA_IO_DS_NON_OPERATIONAL:
3164285809Sscottl    {
3165285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_DS_NON_OPERATIONAL tag 0x%X\n", tag));
3166285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_DS_NON_OPERATIONAL++;
3167285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3168285809Sscottl      break;
3169285809Sscottl    }
3170285809Sscottl    case OSSA_IO_DS_IN_RECOVERY:
3171285809Sscottl    {
3172285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_DS_IN_RECOVERY tag 0x%X\n", tag));
3173285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_DS_IN_RECOVERY++;
3174285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3175285809Sscottl      break;
3176285809Sscottl    }
3177285809Sscottl    case OSSA_IO_DS_IN_ERROR:
3178285809Sscottl    {
3179285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_DS_IN_ERROR tag 0x%X\n", tag));
3180285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_DS_IN_ERROR++;
3181285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3182285809Sscottl      break;
3183285809Sscottl    }
3184285809Sscottl
3185285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY:
3186285809Sscottl    {
3187285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY tag 0x%X\n", tag));
3188285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY++;
3189285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3190285809Sscottl      break;
3191285809Sscottl    }
3192285809Sscottl    case OSSA_IO_ABORT_IN_PROGRESS:
3193285809Sscottl    {
3194285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_ABORT_IN_PROGRESS tag 0x%X\n", tag));
3195285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_ABORT_IN_PROGRESS++;
3196285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3197285809Sscottl      break;
3198285809Sscottl    }
3199285809Sscottl    case OSSA_IO_ABORT_DELAYED:
3200285809Sscottl    {
3201285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_ABORT_DELAYED tag 0x%X\n", tag));
3202285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_ABORT_DELAYED++;
3203285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3204285809Sscottl      break;
3205285809Sscottl    }
3206285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT:
3207285809Sscottl    {
3208285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT tag 0x%X\n", tag));
3209285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT++;
3210285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3211285809Sscottl      break;
3212285809Sscottl    }
3213285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED:
3214285809Sscottl    {
3215285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED HTAG = 0x%x\n", tag));
3216285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED++;
3217285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3218285809Sscottl      break;
3219285809Sscottl    }
3220285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO:
3221285809Sscottl    {
3222285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO tag 0x%x\n", tag));
3223285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO++;
3224285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0 );
3225285809Sscottl      break;
3226285809Sscottl    }
3227285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST:
3228285809Sscottl    {
3229285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST tag 0x%x\n", tag));
3230285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++;
3231285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0 );
3232285809Sscottl      break;
3233285809Sscottl    }
3234285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE:
3235285809Sscottl    {
3236285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE tag 0x%x\n", tag));
3237285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE++;
3238285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0 );
3239285809Sscottl      break;
3240285809Sscottl    }
3241285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED:
3242285809Sscottl    {
3243285809Sscottl      SA_DBG1(("mpiSATACompletion, OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED tag 0x%x\n", tag));
3244285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED++;
3245285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0 );
3246285809Sscottl      break;
3247285809Sscottl    }
3248285809Sscottl    case OSSA_IO_DS_INVALID:
3249285809Sscottl    {
3250285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_DS_INVALID tag 0x%X\n", tag));
3251285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_DS_INVALID++;
3252285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3253285809Sscottl      break;
3254285809Sscottl    }
3255285809Sscottl    case OSSA_IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR:
3256285809Sscottl    {
3257285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR tag 0x%X\n", tag));
3258285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERR_LAST_PIO_DATAIN_CRC_ERR++;
3259285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3260285809Sscottl      break;
3261285809Sscottl    }
3262285809Sscottl    case OSSA_MPI_IO_RQE_BUSY_FULL:
3263285809Sscottl    {
3264285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_MPI_IO_RQE_BUSY_FULL tag 0x%X\n", tag));
3265285809Sscottl      saRoot->IoErrorCount.agOSSA_MPI_IO_RQE_BUSY_FULL++;
3266285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3267285809Sscottl      break;
3268285809Sscottl    }
3269285809Sscottl#ifdef REMOVED
3270285809Sscottl    case OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN:
3271285809Sscottl    {
3272285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN tag 0x%x\n", tag));
3273285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN++;
3274285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3275285809Sscottl      break;
3276285809Sscottl    }
3277285809Sscottl#endif
3278285809Sscottl    case OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE:
3279285809Sscottl    {
3280285809Sscottl      SA_DBG1(("mpiSATACompletion: OPC_OUB_SATA_COMP:OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE \n"));
3281285809Sscottl      saRoot->IoErrorCount.agOSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE++;
3282285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3283285809Sscottl      break;
3284285809Sscottl    }
3285285809Sscottl    case OSSA_MPI_ERR_ATAPI_DEVICE_BUSY:
3286285809Sscottl    {
3287285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_MPI_ERR_ATAPI_DEVICE_BUSY tag 0x%X\n", tag));
3288285809Sscottl      saRoot->IoErrorCount.agOSSA_MPI_ERR_ATAPI_DEVICE_BUSY++;
3289285809Sscottl      siAbnormal(agRoot, pRequest, status, param, 0 );
3290285809Sscottl      break;
3291285809Sscottl    }
3292285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS:
3293285809Sscottl    {
3294285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS tag 0x%X\n", tag));
3295285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS++;
3296285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3297285809Sscottl      break;
3298285809Sscottl    }
3299285809Sscottl    case OSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID:
3300285809Sscottl    {
3301285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID tag 0x%X\n", tag));
3302285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS++;
3303285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3304285809Sscottl      break;
3305285809Sscottl    }
3306285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_IV_MISMATCH:
3307285809Sscottl    {
3308285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_IV_MISMATCH tag 0x%X\n", tag));
3309285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_IV_MISMATCH++;
3310285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3311285809Sscottl      break;
3312285809Sscottl    }
3313285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR:
3314285809Sscottl    {
3315285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR tag 0x%X\n", tag));
3316285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR++;
3317285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3318285809Sscottl      break;
3319285809Sscottl    }
3320285809Sscottl    case OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED:
3321285809Sscottl    {
3322285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED tag 0x%X\n", tag));
3323285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED++;
3324285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3325285809Sscottl      break;
3326285809Sscottl    }
3327285809Sscottl
3328285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH:
3329285809Sscottl    {
3330285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH tag 0x%X\n", tag));
3331285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH++;
3332285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3333285809Sscottl      break;
3334285809Sscottl    }
3335285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS:
3336285809Sscottl    {
3337285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS tag 0x%X\n", tag));
3338285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS++;
3339285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3340285809Sscottl      break;
3341285809Sscottl    }
3342285809Sscottl    case OSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE:
3343285809Sscottl    {
3344285809Sscottl      SA_DBG1(("mpiSATACompletion: OSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE tag 0x%X\n", tag));
3345285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS++;
3346285809Sscottl      siAbnormal(agRoot, pRequest, status, 0, 0);
3347285809Sscottl      break;
3348285809Sscottl    }
3349285809Sscottl
3350285809Sscottl    default:
3351285809Sscottl    {
3352285809Sscottl      SA_DBG1(("mpiSATACompletion: Unknown status  0x%x tag 0x%x\n", status, tag));
3353285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_UNKNOWN_ERROR++;
3354285809Sscottl      siAbnormal(agRoot, pRequest, status, param, 0);
3355285809Sscottl      break;
3356285809Sscottl    }
3357285809Sscottl  }
3358285809Sscottl
3359285809Sscottl  /* The HTag should equal to the IOMB tag */
3360285809Sscottl  if (pRequest->HTag != tag)
3361285809Sscottl  {
3362285809Sscottl    SA_DBG1(("mpiSATACompletion: Error Htag %d not equal IOMBtag %d\n", pRequest->HTag, tag));
3363285809Sscottl  }
3364285809Sscottl
3365285809Sscottl  smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2s");
3366285809Sscottl  return ret;
3367285809Sscottl}
3368285809Sscottl
3369285809Sscottl/******************************************************************************/
3370285809Sscottl/*! \brief SPC MPI SSP Completion
3371285809Sscottl *
3372285809Sscottl *  This function handles the SSP completion.
3373285809Sscottl *
3374285809Sscottl *  \param agRoot       Handles for this instance of SAS/SATA LLL
3375285809Sscottl *  \param pIomb1       Pointer of Message1
3376285809Sscottl *  \param bc           buffer count
3377285809Sscottl *
3378285809Sscottl *  \return The read value
3379285809Sscottl *
3380285809Sscottl */
3381285809Sscottl/*******************************************************************************/
3382285809SscottlGLOBAL FORCEINLINE
3383285809Sscottlbit32 mpiSSPCompletion(
3384285809Sscottl  agsaRoot_t    *agRoot,
3385285809Sscottl  bit32         *pIomb1
3386285809Sscottl  )
3387285809Sscottl{
3388285809Sscottl  agsaLLRoot_t              *saRoot   = (agsaLLRoot_t *)(agRoot->sdkData);
3389285809Sscottl  agsaSSPCompletionRsp_t    *pIomb    = (agsaSSPCompletionRsp_t *)pIomb1;
3390285809Sscottl  agsaIORequestDesc_t       *pRequest = agNULL;
3391285809Sscottl  agsaSSPResponseInfoUnit_t *pRespIU  = agNULL;
3392285809Sscottl  bit32                      tag      = 0;
3393285809Sscottl  bit32                      sspTag   = 0;
3394285809Sscottl  bit32                      status, param = 0;
3395285809Sscottl  bit32                      ret = AGSA_RC_SUCCESS;
3396285809Sscottl
3397285809Sscottl  smTraceFuncEnter(hpDBG_VERY_LOUD, "5A");
3398285809Sscottl
3399285809Sscottl  /* get Tag */
3400285809Sscottl  OSSA_READ_LE_32(agRoot, &tag, pIomb, OSSA_OFFSET_OF(agsaSSPCompletionRsp_t, tag));
3401285809Sscottl  OSSA_READ_LE_32(agRoot, &status, pIomb, OSSA_OFFSET_OF(agsaSSPCompletionRsp_t, status));
3402285809Sscottl  OSSA_READ_LE_32(agRoot, &param, pIomb, OSSA_OFFSET_OF(agsaSSPCompletionRsp_t, param));
3403285809Sscottl  OSSA_READ_LE_32(agRoot, &sspTag, pIomb, OSSA_OFFSET_OF(agsaSSPCompletionRsp_t, SSPTag));
3404285809Sscottl  /* get SSP_START IOrequest from IOMap */
3405285809Sscottl  pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest;
3406285809Sscottl  SA_ASSERT((pRequest), "pRequest");
3407285809Sscottl
3408285809Sscottl  if(pRequest == agNULL)
3409285809Sscottl  {
3410285809Sscottl    SA_DBG1(("mpiSSPCompletion,AGSA_RC_FAILURE SSP Resp IOMB tag=0x%x, status=0x%x, param=0x%x, SSPTag=0x%x\n", tag, status, param, sspTag));
3411285809Sscottl    smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5A");
3412285809Sscottl    return(AGSA_RC_FAILURE);
3413285809Sscottl  }
3414285809Sscottl  SA_ASSERT((pRequest->valid), "pRequest->valid");
3415285809Sscottl
3416285809Sscottl  if(!pRequest->valid)
3417285809Sscottl  {
3418285809Sscottl    SA_DBG1(("mpiSSPCompletion, SSP Resp IOMB tag=0x%x, status=0x%x, param=0x%x, SSPTag=0x%x Device =0x%x\n", tag, status, param, sspTag,
3419285809Sscottl    pRequest->pDevice ? pRequest->pDevice->DeviceMapIndex : -1));
3420285809Sscottl  }
3421285809Sscottl
3422285809Sscottl  switch (status)
3423285809Sscottl  {
3424285809Sscottl    case OSSA_IO_SUCCESS:
3425285809Sscottl    {
3426285809Sscottl      if (!param)
3427285809Sscottl      {
3428285809Sscottl        /* Completion of SSP without Response Data */
3429285809Sscottl        siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, sspTag);
3430285809Sscottl      }
3431285809Sscottl      else
3432285809Sscottl      {
3433285809Sscottl        /* Get SSP Response with Response Data */
3434285809Sscottl        pRespIU = (agsaSSPResponseInfoUnit_t *)&(pIomb->SSPrsp);
3435285809Sscottl        if (pRespIU->status == 0x02 || pRespIU->status == 0x18 ||
3436285809Sscottl            pRespIU->status == 0x30 || pRespIU->status == 0x40 )
3437285809Sscottl        {
3438285809Sscottl          /* SCSI status is CHECK_CONDITION, RESV_CONFLICT, ACA_ACTIVE, TASK_ABORTED */
3439285809Sscottl          saRoot->IoErrorCount.agOSSA_IO_COMPLETED_ERROR_SCSI_STATUS++;
3440285809Sscottl          SA_DBG2(("mpiSSPCompletion: pRespIU->status 0x%x tag 0x%x\n", pRespIU->status,tag));
3441285809Sscottl        }
3442285809Sscottl        siEventSSPResponseWtDataRcvd(agRoot, pRequest, pRespIU, param, sspTag);
3443285809Sscottl      }
3444285809Sscottl
3445285809Sscottl      break;
3446285809Sscottl    }
3447285809Sscottl
3448285809Sscottl    case OSSA_IO_XFR_ERROR_INVALID_SSP_RSP_FRAME:
3449285809Sscottl    {
3450285809Sscottl      SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_INVALID_SSP_RSP_FRAME tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3451285809Sscottl      saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_INVALID_SSP_RSP_FRAME++;
3452285809Sscottl      /* Get SSP Response with Response Data */
3453285809Sscottl      pRespIU = (agsaSSPResponseInfoUnit_t *)&(pIomb->SSPrsp);
3454285809Sscottl      if (pRespIU->status == 0x02 || pRespIU->status == 0x18 ||
3455285809Sscottl          pRespIU->status == 0x30 || pRespIU->status == 0x40 )
3456285809Sscottl      {
3457285809Sscottl        /* SCSI status is CHECK_CONDITION, RESV_CONFLICT, ACA_ACTIVE, TASK_ABORTED */
3458285809Sscottl        saRoot->IoErrorCount.agOSSA_IO_COMPLETED_ERROR_SCSI_STATUS++;
3459285809Sscottl        SA_DBG2(("mpiSSPCompletion: pRespIU->status 0x%x tag 0x%x\n", pRespIU->status,tag));
3460285809Sscottl      }
3461285809Sscottl      siEventSSPResponseWtDataRcvd(agRoot, pRequest, pRespIU, param, sspTag);
3462285809Sscottl
3463285809Sscottl      break;
3464285809Sscottl     }
3465285809Sscottl
3466285809Sscottl     case OSSA_IO_ABORTED:
3467285809Sscottl     {
3468285809Sscottl#ifdef SALL_API_TEST
3469285809Sscottl       saRoot->LLCounters.IOCounter.numSSPAborted++;
3470285809Sscottl       SA_DBG3(("mpiSSPCompletion, OSSA_IO_ABORTED Response received IOMB=%p %d\n",
3471285809Sscottl              pIomb1, saRoot->LLCounters.IOCounter.numSSPAborted));
3472285809Sscottl#endif
3473285809Sscottl       SA_DBG2(("mpiSSPCompletion, OSSA_IO_ABORTED IOMB tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3474285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_ABORTED++;
3475285809Sscottl       /* SSP Abort CB */
3476285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3477285809Sscottl       break;
3478285809Sscottl     }
3479285809Sscottl     case OSSA_IO_UNDERFLOW:
3480285809Sscottl     {
3481285809Sscottl       /* SSP Completion with error */
3482285809Sscottl       SA_DBG2(("mpiSSPCompletion, OSSA_IO_UNDERFLOW tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3483285809Sscottl       /*saRoot->IoErrorCount.agOSSA_IO_UNDERFLOW++;*/
3484285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3485285809Sscottl       break;
3486285809Sscottl     }
3487285809Sscottl     case OSSA_IO_NO_DEVICE:
3488285809Sscottl     {
3489285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_NO_DEVICE tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3490285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_NO_DEVICE++;
3491285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3492285809Sscottl       break;
3493285809Sscottl     }
3494285809Sscottl     case OSSA_IO_XFER_ERROR_BREAK:
3495285809Sscottl     {
3496285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_BREAK tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3497285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_BREAK++;
3498285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3499285809Sscottl       break;
3500285809Sscottl     }
3501285809Sscottl     case OSSA_IO_XFER_ERROR_PHY_NOT_READY:
3502285809Sscottl     {
3503285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_PHY_NOT_READY tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3504285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_PHY_NOT_READY++;
3505285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3506285809Sscottl       break;
3507285809Sscottl     }
3508285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED:
3509285809Sscottl     {
3510285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3511285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED++;
3512285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3513285809Sscottl       break;
3514285809Sscottl     }
3515285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION:
3516285809Sscottl     {
3517285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION++;
3518285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3519285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3520285809Sscottl       break;
3521285809Sscottl     }
3522285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_BREAK:
3523285809Sscottl     {
3524285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_BREAK tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3525285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BREAK++;
3526285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3527285809Sscottl       break;
3528285809Sscottl     }
3529285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS:
3530285809Sscottl     {
3531285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3532285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS++;
3533285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3534285809Sscottl       break;
3535285809Sscottl     }
3536285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION:
3537285809Sscottl     {
3538285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3539285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION++;
3540285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3541285809Sscottl       break;
3542285809Sscottl     }
3543285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED:
3544285809Sscottl     {
3545285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3546285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED++;
3547285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3548285809Sscottl       break;
3549285809Sscottl     }
3550285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION:
3551285809Sscottl     {
3552285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3553285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION++;
3554285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3555285809Sscottl       break;
3556285809Sscottl     }
3557285809Sscottl     case OSSA_IO_XFER_ERROR_NAK_RECEIVED:
3558285809Sscottl     {
3559285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_NAK_RECEIVED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3560285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_NAK_RECEIVED++;
3561285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3562285809Sscottl       break;
3563285809Sscottl     }
3564285809Sscottl     case OSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT:
3565285809Sscottl     {
3566285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3567285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT++;
3568285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3569285809Sscottl       break;
3570285809Sscottl     }
3571285809Sscottl     case OSSA_IO_XFER_ERROR_DMA:
3572285809Sscottl     {
3573285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_DMA tag 0x%x ssptag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3574285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_DMA++;
3575285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3576285809Sscottl       break;
3577285809Sscottl     }
3578285809Sscottl     case OSSA_IO_XFER_OPEN_RETRY_TIMEOUT:
3579285809Sscottl     {
3580285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_OPEN_RETRY_TIMEOUT tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3581285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT++;
3582285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3583285809Sscottl       break;
3584285809Sscottl     }
3585285809Sscottl     case OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE:
3586285809Sscottl     {
3587285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3588285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_UNEXPECTED_PHASE++;
3589285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3590285809Sscottl       break;
3591285809Sscottl     }
3592285809Sscottl     case OSSA_IO_XFER_ERROR_OFFSET_MISMATCH:
3593285809Sscottl     {
3594285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_OFFSET_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3595285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_OFFSET_MISMATCH++;
3596285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3597285809Sscottl       break;
3598285809Sscottl     }
3599285809Sscottl     case OSSA_IO_PORT_IN_RESET:
3600285809Sscottl     {
3601285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_PORT_IN_RESET tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3602285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_PORT_IN_RESET++;
3603285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3604285809Sscottl       break;
3605285809Sscottl     }
3606285809Sscottl     case OSSA_IO_DS_NON_OPERATIONAL:
3607285809Sscottl     {
3608285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_DS_NON_OPERATIONAL tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3609285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_DS_NON_OPERATIONAL++;
3610285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3611285809Sscottl       break;
3612285809Sscottl     }
3613285809Sscottl     case OSSA_IO_DS_IN_RECOVERY:
3614285809Sscottl     {
3615285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_DS_IN_RECOVERY tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3616285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_DS_IN_RECOVERY++;
3617285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3618285809Sscottl       break;
3619285809Sscottl     }
3620285809Sscottl     case OSSA_IO_TM_TAG_NOT_FOUND:
3621285809Sscottl     {
3622285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_TM_TAG_NOT_FOUND tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3623285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_TM_TAG_NOT_FOUND++;
3624285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3625285809Sscottl       break;
3626285809Sscottl     }
3627285809Sscottl     case OSSA_IO_XFER_PIO_SETUP_ERROR:
3628285809Sscottl     {
3629285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_PIO_SETUP_ERROR tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3630285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_PIO_SETUP_ERROR++;
3631285809Sscottl       /* not allowed case. Therefore, return failed status */
3632285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3633285809Sscottl       break;
3634285809Sscottl     }
3635285809Sscottl     case OSSA_IO_SSP_EXT_IU_ZERO_LEN_ERROR:
3636285809Sscottl     {
3637285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_SSP_IU_ZERO_LEN_ERROR tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3638285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_SSP_EXT_IU_ZERO_LEN_ERROR++;
3639285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3640285809Sscottl       break;
3641285809Sscottl     }
3642285809Sscottl     case OSSA_IO_DS_IN_ERROR:
3643285809Sscottl     {
3644285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_DS_IN_ERROR tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3645285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_DS_IN_ERROR++;
3646285809Sscottl       /* not allowed case. Therefore, return failed status */
3647285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3648285809Sscottl       break;
3649285809Sscottl     }
3650285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY:
3651285809Sscottl     {
3652285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3653285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY++;
3654285809Sscottl       /* not allowed case. Therefore, return failed status */
3655285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3656285809Sscottl       break;
3657285809Sscottl     }
3658285809Sscottl     case OSSA_IO_ABORT_IN_PROGRESS:
3659285809Sscottl     {
3660285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_ABORT_IN_PROGRESS tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3661285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_ABORT_IN_PROGRESS++;
3662285809Sscottl       /* not allowed case. Therefore, return failed status */
3663285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3664285809Sscottl       break;
3665285809Sscottl     }
3666285809Sscottl     case OSSA_IO_ABORT_DELAYED:
3667285809Sscottl     {
3668285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_ABORT_DELAYED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3669285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_ABORT_DELAYED++;
3670285809Sscottl       /* not allowed case. Therefore, return failed status */
3671285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3672285809Sscottl       break;
3673285809Sscottl     }
3674285809Sscottl     case OSSA_IO_INVALID_LENGTH:
3675285809Sscottl     {
3676285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_INVALID_LENGTH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3677285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_INVALID_LENGTH++;
3678285809Sscottl       /* not allowed case. Therefore, return failed status */
3679285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3680285809Sscottl       break;
3681285809Sscottl     }
3682285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT:
3683285809Sscottl     {
3684285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3685285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY_ALT++;
3686285809Sscottl       /* not allowed case. Therefore, return failed status */
3687285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3688285809Sscottl       break;
3689285809Sscottl     }
3690285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED:
3691285809Sscottl     {
3692285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED HTAG = 0x%x ssptag = 0x%x\n", tag, sspTag));
3693285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED++;
3694285809Sscottl       siAbnormal(agRoot, pRequest, status, 0, sspTag);
3695285809Sscottl       break;
3696285809Sscottl     }
3697285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO:
3698285809Sscottl     {
3699285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3700285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO++;
3701285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3702285809Sscottl       break;
3703285809Sscottl     }
3704285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST:
3705285809Sscottl     {
3706285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3707285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++;
3708285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3709285809Sscottl       break;
3710285809Sscottl     }
3711285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE:
3712285809Sscottl     {
3713285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3714285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE++;
3715285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3716285809Sscottl       break;
3717285809Sscottl     }
3718285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED:
3719285809Sscottl     {
3720285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3721285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED++;
3722285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3723285809Sscottl       break;
3724285809Sscottl     }
3725285809Sscottl     case OSSA_IO_DS_INVALID:
3726285809Sscottl     {
3727285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_DS_INVALID tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3728285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_DS_INVALID++;
3729285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3730285809Sscottl       break;
3731285809Sscottl     }
3732285809Sscottl     case OSSA_MPI_IO_RQE_BUSY_FULL:
3733285809Sscottl     {
3734285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_MPI_IO_RQE_BUSY_FULL tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3735285809Sscottl       saRoot->IoErrorCount.agOSSA_MPI_IO_RQE_BUSY_FULL++;
3736285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3737285809Sscottl       break;
3738285809Sscottl     }
3739285809Sscottl     case OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE:
3740285809Sscottl     {
3741285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3742285809Sscottl       saRoot->IoErrorCount.agOSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE++;
3743285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3744285809Sscottl       break;
3745285809Sscottl     }
3746285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS:
3747285809Sscottl     {
3748285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3749285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS++;
3750285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3751285809Sscottl       break;
3752285809Sscottl     }
3753285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH:
3754285809Sscottl     {
3755285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3756285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH++;
3757285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3758285809Sscottl       break;
3759285809Sscottl     }
3760285809Sscottl     case OSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID:
3761285809Sscottl     {
3762285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3763285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_CIPHER_MODE_INVALID++;
3764285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3765285809Sscottl       break;
3766285809Sscottl     }
3767285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_IV_MISMATCH:
3768285809Sscottl     {
3769285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_IV_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3770285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_IV_MISMATCH++;
3771285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3772285809Sscottl       break;
3773285809Sscottl     }
3774285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR:
3775285809Sscottl     {
3776285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3777285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_RAM_INTERFACE_ERROR++;
3778285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3779285809Sscottl       break;
3780285809Sscottl     }
3781285809Sscottl     case OSSA_IO_XFR_ERROR_INTERNAL_RAM:
3782285809Sscottl     {
3783285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_INTERNAL_RAM tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3784285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_INTERNAL_RAM++;
3785285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3786285809Sscottl       break;
3787285809Sscottl     }
3788285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS:
3789285809Sscottl     {
3790285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3791285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_INDEX_OUT_OF_BOUNDS++;
3792285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3793285809Sscottl       break;
3794285809Sscottl     }
3795285809Sscottl     case OSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE:
3796285809Sscottl     {
3797285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3798285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DEK_ILLEGAL_TABLE++;
3799285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3800285809Sscottl       break;
3801285809Sscottl     }
3802285809Sscottl#ifdef SA_TESTBASE_EXTRA
3803285809Sscottl     /* TestBase */
3804285809Sscottl     case OSSA_IO_HOST_BST_INVALID:
3805285809Sscottl     {
3806285809Sscottl        SA_DBG1(("mpiParseOBIomb, OPC_OUB_SSP_COMP: OSSA_IO_HOST_BST_INVALID 0x%x\n", status));
3807285809Sscottl        siAbnormal(agRoot, pRequest, status, param, sspTag);
3808285809Sscottl        break;
3809285809Sscottl     }
3810285809Sscottl#endif /*  SA_TESTBASE_EXTRA */
3811285809Sscottl     case OSSA_IO_XFR_ERROR_DIF_MISMATCH:
3812285809Sscottl     {
3813285809Sscottl        SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DIF_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3814285809Sscottl        saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DIF_MISMATCH++;
3815285809Sscottl        siDifAbnormal(agRoot, pRequest, status, param, sspTag, pIomb1);
3816285809Sscottl        break;
3817285809Sscottl     }
3818285809Sscottl     case OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH:
3819285809Sscottl     {
3820285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3821285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH++;
3822285809Sscottl       siDifAbnormal(agRoot, pRequest, status, param, sspTag, pIomb1);
3823285809Sscottl       break;
3824285809Sscottl     }
3825285809Sscottl     case OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH:
3826285809Sscottl     {
3827285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3828285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH++;
3829285809Sscottl       siDifAbnormal(agRoot, pRequest, status, param, sspTag, pIomb1);
3830285809Sscottl       break;
3831285809Sscottl     }
3832285809Sscottl     case OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH:
3833285809Sscottl     {
3834285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3835285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH++;
3836285809Sscottl       siDifAbnormal(agRoot, pRequest, status, param, sspTag, pIomb1);
3837285809Sscottl       break;
3838285809Sscottl     }
3839285809Sscottl     case OSSA_IO_XFER_ERROR_DIF_INTERNAL_ERROR:
3840285809Sscottl     {
3841285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERROR_DIF_INTERNAL_ERROR tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3842285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_DIF_INTERNAL_ERROR++;
3843285809Sscottl       siDifAbnormal(agRoot, pRequest, status, param, sspTag, pIomb1);
3844285809Sscottl       break;
3845285809Sscottl     }
3846285809Sscottl     case OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN:
3847285809Sscottl     {
3848285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3849285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN++;
3850285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3851285809Sscottl       break;
3852285809Sscottl     }
3853285809Sscottl     case OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED:
3854285809Sscottl     {
3855285809Sscottl       SA_DBG1(("mpiSSPCompletion: OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3856285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED++;
3857285809Sscottl       siAbnormal(agRoot, pRequest, status, param, sspTag);
3858285809Sscottl       break;
3859285809Sscottl     }
3860285809Sscottl     default:
3861285809Sscottl     {
3862285809Sscottl       SA_DBG1(("mpiSSPCompletion: Unknown tag 0x%x sspTag 0x%x status 0x%x param 0x%x\n", tag,sspTag,status,param));
3863285809Sscottl       /* not allowed case. Therefore, return failed status */
3864285809Sscottl       saRoot->IoErrorCount.agOSSA_IO_UNKNOWN_ERROR++;
3865285809Sscottl       siAbnormal(agRoot, pRequest, OSSA_IO_FAILED, param, sspTag);
3866285809Sscottl       break;
3867285809Sscottl     }
3868285809Sscottl   }
3869285809Sscottl
3870285809Sscottl   smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5A");
3871285809Sscottl   return ret;
3872285809Sscottl}
3873