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 sampirsp.c 24285809Sscottl * \brief The file implements the functions of MPI Outbound Response Message 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#ifdef SA_ENABLE_TRACE_FUNCTIONS 34285809Sscottl#ifdef siTraceFileID 35285809Sscottl#undef siTraceFileID 36285809Sscottl#endif 37285809Sscottl#define siTraceFileID 'J' 38285809Sscottl#endif 39285809Sscottl 40285809Sscottl/******************************************************************************/ 41285809Sscottl/* Protoytpes */ 42285809Sscottlvoid saReturnRequestToFreePool( 43285809Sscottl agsaRoot_t *agRoot, 44285809Sscottl agsaIORequestDesc_t *pRequest 45285809Sscottl ); 46285809Sscottl 47285809Sscottl/******************************************************************************/ 48285809Sscottl/*! \brief Process Outbound IOMB Message 49285809Sscottl * 50285809Sscottl * Process Outbound IOMB from SPC 51285809Sscottl * 52285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LL Layer 53285809Sscottl * \param pMsg1 Pointer of Response IOMB message 1 54285809Sscottl * \param category category of outbpond IOMB header 55285809Sscottl * \param opcode Opcode of Outbound IOMB header 56285809Sscottl * \param bc buffer count of IOMB header 57285809Sscottl * 58285809Sscottl * \return success or fail 59285809Sscottl * 60285809Sscottl */ 61285809Sscottl/*******************************************************************************/ 62285809Sscottl#if 0 63285809SscottlFORCEINLINE bit32 64285809SscottlmpiParseOBIomb( 65285809Sscottl agsaRoot_t *agRoot, 66285809Sscottl bit32 *pMsg1, 67285809Sscottl mpiMsgCategory_t category, 68285809Sscottl bit16 opcode 69285809Sscottl ) 70285809Sscottl{ 71285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 72285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 73285809Sscottl bit32 parserStatus = AGSA_RC_SUCCESS; 74285809Sscottl 75285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD, "2f"); 76285809Sscottl 77285809Sscottl switch (opcode) 78285809Sscottl { 79285809Sscottl case OPC_OUB_COMBINED_SSP_COMP: 80285809Sscottl { 81285809Sscottl agsaSSPCoalescedCompletionRsp_t *pIomb = (agsaSSPCoalescedCompletionRsp_t *)pMsg1; 82285809Sscottl agsaIORequestDesc_t *pRequest = agNULL; 83285809Sscottl bit32 tag = 0; 84285809Sscottl bit32 sspTag = 0; 85285809Sscottl bit32 count = 0; 86285809Sscottl 87285809Sscottl#ifdef SALL_API_TEST 88285809Sscottl saRoot->LLCounters.IOCounter.numSSPCompleted++; 89285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p %d\n", 90285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted)); 91285809Sscottl#else 92285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SSP_COMP Response received IOMB=%p\n", pMsg1)); 93285809Sscottl#endif 94285809Sscottl /* get Tag */ 95285809Sscottl for (count = 0; count < pIomb->coalescedCount; count++) 96285809Sscottl { 97285809Sscottl tag = pIomb->sspComplCxt[count].tag; 98285809Sscottl sspTag = pIomb->sspComplCxt[count].SSPTag; 99285809Sscottl pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest; 100285809Sscottl SA_ASSERT((pRequest), "pRequest"); 101285809Sscottl 102285809Sscottl if(pRequest == agNULL) 103285809Sscottl { 104285809Sscottl 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)); 105285809Sscottl return(AGSA_RC_FAILURE); 106285809Sscottl } 107285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 108285809Sscottl 109285809Sscottl 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)); 110285809Sscottl 111285809Sscottl /* Completion of SSP without Response Data */ 112285809Sscottl siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, sspTag); 113285809Sscottl } 114285809Sscottl } 115285809Sscottl break; 116285809Sscottl 117285809Sscottl case OPC_OUB_SSP_COMP: 118285809Sscottl { 119285809Sscottl#ifdef SALL_API_TEST 120285809Sscottl saRoot->LLCounters.IOCounter.numSSPCompleted++; 121285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p %d\n", 122285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted)); 123285809Sscottl#else 124285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_COMP Response received IOMB=%p\n", pMsg1)); 125285809Sscottl#endif 126285809Sscottl /* process the SSP IO Completed response message */ 127285809Sscottl mpiSSPCompletion(agRoot, pMsg1); 128285809Sscottl break; 129285809Sscottl } 130285809Sscottl case OPC_OUB_COMBINED_SATA_COMP: 131285809Sscottl { 132285809Sscottl agsaSATACoalescedCompletionRsp_t *pIomb; 133285809Sscottl agsaIORequestDesc_t *pRequest; 134285809Sscottl bit32 tag; 135285809Sscottl bit32 count; 136285809Sscottl 137285809Sscottl #ifdef SALL_API_TEST 138285809Sscottl saRoot->LLCounters.IOCounter.numSSPCompleted++; 139285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP Response received IOMB=%p %d\n", 140285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSSPCompleted)); 141285809Sscottl #else 142285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP Response received IOMB=%p\n", pMsg1)); 143285809Sscottl #endif 144285809Sscottl 145285809Sscottl pIomb = (agsaSATACoalescedCompletionRsp_t *)pMsg1; 146285809Sscottl /* get Tag */ 147285809Sscottl for (count = 0; count < pIomb->coalescedCount; count++) 148285809Sscottl { 149285809Sscottl tag = pIomb->stpComplCxt[count].tag; 150285809Sscottl pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest; 151285809Sscottl SA_ASSERT((pRequest), "pRequest"); 152285809Sscottl 153285809Sscottl if(pRequest == agNULL) 154285809Sscottl { 155285809Sscottl 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)); 156285809Sscottl return(AGSA_RC_FAILURE); 157285809Sscottl } 158285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 159285809Sscottl 160285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_COMBINED_SATA_COMP IOMB tag=0x%x, status=0x%x, param=0x%x\n", tag, OSSA_IO_SUCCESS, 0)); 161285809Sscottl 162285809Sscottl /* Completion of SATA without Response Data */ 163285809Sscottl siIODone( agRoot, pRequest, OSSA_IO_SUCCESS, 0); 164285809Sscottl } 165285809Sscottl break; 166285809Sscottl } 167285809Sscottl case OPC_OUB_SATA_COMP: 168285809Sscottl { 169285809Sscottl#ifdef SALL_API_TEST 170285809Sscottl saRoot->LLCounters.IOCounter.numSataCompleted++; 171285809Sscottl SA_DBG3(("mpiParseOBIomb, SATA_COMP Response received IOMB=%p %d\n", 172285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSataCompleted)); 173285809Sscottl#else 174285809Sscottl SA_DBG3(("mpiParseOBIomb, SATA_COMP Response received IOMB=%p\n", pMsg1)); 175285809Sscottl#endif 176285809Sscottl /* process the response message */ 177285809Sscottl mpiSATACompletion(agRoot, pMsg1); 178285809Sscottl break; 179285809Sscottl } 180285809Sscottl case OPC_OUB_SSP_ABORT_RSP: 181285809Sscottl { 182285809Sscottl#ifdef SALL_API_TEST 183285809Sscottl saRoot->LLCounters.IOCounter.numSSPAbortedCB++; 184285809Sscottl#else 185285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_ABORT Response received IOMB=%p\n", pMsg1)); 186285809Sscottl#endif 187285809Sscottl /* process the response message */ 188285809Sscottl parserStatus = mpiSSPAbortRsp(agRoot, (agsaSSPAbortRsp_t *)pMsg1); 189285809Sscottl if(parserStatus != AGSA_RC_SUCCESS) 190285809Sscottl { 191285809Sscottl SA_DBG3(("mpiParseOBIomb, mpiSSPAbortRsp FAIL IOMB=%p\n", pMsg1)); 192285809Sscottl } 193285809Sscottl 194285809Sscottl break; 195285809Sscottl } 196285809Sscottl case OPC_OUB_SATA_ABORT_RSP: 197285809Sscottl { 198285809Sscottl#ifdef SALL_API_TEST 199285809Sscottl saRoot->LLCounters.IOCounter.numSataAbortedCB++; 200285809Sscottl#else 201285809Sscottl SA_DBG3(("mpiParseOBIomb, SATA_ABORT Response received IOMB=%p\n", pMsg1)); 202285809Sscottl#endif 203285809Sscottl /* process the response message */ 204285809Sscottl mpiSATAAbortRsp(agRoot, (agsaSATAAbortRsp_t *)pMsg1); 205285809Sscottl break; 206285809Sscottl } 207285809Sscottl case OPC_OUB_SATA_EVENT: 208285809Sscottl { 209285809Sscottl SA_DBG3(("mpiParseOBIomb, SATA_EVENT Response received IOMB=%p\n", pMsg1)); 210285809Sscottl /* process the response message */ 211285809Sscottl mpiSATAEvent(agRoot, (agsaSATAEventRsp_t *)pMsg1); 212285809Sscottl break; 213285809Sscottl } 214285809Sscottl case OPC_OUB_SSP_EVENT: 215285809Sscottl { 216285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_EVENT Response received IOMB=%p\n", pMsg1)); 217285809Sscottl /* process the response message */ 218285809Sscottl mpiSSPEvent(agRoot, (agsaSSPEventRsp_t *)pMsg1); 219285809Sscottl break; 220285809Sscottl } 221285809Sscottl case OPC_OUB_SMP_COMP: 222285809Sscottl { 223285809Sscottl#ifdef SALL_API_TEST 224285809Sscottl saRoot->LLCounters.IOCounter.numSMPCompleted++; 225285809Sscottl SA_DBG3(("mpiParseOBIomb, SMP_COMP Response received IOMB=%p, %d\n", 226285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSMPCompleted)); 227285809Sscottl#else 228285809Sscottl SA_DBG3(("mpiParseOBIomb, SMP_COMP Response received IOMB=%p\n", pMsg1)); 229285809Sscottl#endif 230285809Sscottl /* process the response message */ 231285809Sscottl mpiSMPCompletion(agRoot, (agsaSMPCompletionRsp_t *)pMsg1); 232285809Sscottl break; 233285809Sscottl } 234285809Sscottl#ifndef BIOS 235285809Sscottl case OPC_OUB_ECHO: 236285809Sscottl { 237285809Sscottl#ifdef SALL_API_TEST 238285809Sscottl saRoot->LLCounters.IOCounter.numEchoCB++; 239285809Sscottl SA_DBG3(("mpiParseOBIomb, ECHO Response received %d\n", saRoot->LLCounters.IOCounter.numEchoCB)); 240285809Sscottl#else 241285809Sscottl SA_DBG3(("mpiParseOBIomb, ECHO Response received\n")); 242285809Sscottl#endif 243285809Sscottl /* process the response message */ 244285809Sscottl mpiEchoRsp(agRoot, (agsaEchoRsp_t *)pMsg1); 245285809Sscottl break; 246285809Sscottl } 247285809Sscottl#endif 248285809Sscottl case OPC_OUB_GET_NVMD_DATA: 249285809Sscottl { 250285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_NVMD_DATA received IOMB=%p\n", pMsg1)); 251285809Sscottl /* process the response message */ 252285809Sscottl mpiGetNVMDataRsp(agRoot, (agsaGetNVMDataRsp_t *)pMsg1); 253285809Sscottl break; 254285809Sscottl } 255285809Sscottl case OPC_OUB_SPC_HW_EVENT: 256285809Sscottl { 257285809Sscottl SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC"); 258285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SPC_HW_EVENT Response received IOMB=%p\n", pMsg1)); 259285809Sscottl /* process the response message */ 260285809Sscottl mpiHWevent(agRoot, (agsaHWEvent_SPC_OUB_t *)pMsg1); 261285809Sscottl break; 262285809Sscottl } 263285809Sscottl case OPC_OUB_HW_EVENT: 264285809Sscottl { 265285809Sscottl SA_DBG3(("mpiParseOBIomb, HW_EVENT Response received IOMB=%p\n", pMsg1)); 266285809Sscottl /* process the response message */ 267285809Sscottl mpiHWevent(agRoot, (agsaHWEvent_SPC_OUB_t *)pMsg1); 268285809Sscottl break; 269285809Sscottl } 270285809Sscottl case OPC_OUB_PHY_START_RESPONSE: 271285809Sscottl { 272285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_PHY_START_RESPONSE Response received IOMB=%p\n", pMsg1)); 273285809Sscottl /* process the response message */ 274285809Sscottl mpiPhyStartEvent( agRoot, (agsaHWEvent_Phy_OUB_t *)pMsg1 ); 275285809Sscottl 276285809Sscottl break; 277285809Sscottl } 278285809Sscottl case OPC_OUB_PHY_STOP_RESPONSE: 279285809Sscottl { 280285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_PHY_STOP_RESPONSE Response received IOMB=%p\n", pMsg1)); 281285809Sscottl /* process the response message */ 282285809Sscottl mpiPhyStopEvent( agRoot, (agsaHWEvent_Phy_OUB_t *)pMsg1 ); 283285809Sscottl break; 284285809Sscottl } 285285809Sscottl 286285809Sscottl case OPC_OUB_LOCAL_PHY_CNTRL: 287285809Sscottl { 288285809Sscottl SA_DBG3(("mpiParseOBIomb, PHY CONTROL Response received IOMB=%p\n", pMsg1)); 289285809Sscottl /* process the response message */ 290285809Sscottl mpiPhyCntrlRsp(agRoot, (agsaLocalPhyCntrlRsp_t *)pMsg1); 291285809Sscottl break; 292285809Sscottl } 293285809Sscottl case OPC_OUB_SPC_DEV_REGIST: 294285809Sscottl { 295285809Sscottl SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC"); 296285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SPC_DEV_REGIST Response received IOMB=%p\n", pMsg1)); 297285809Sscottl /* process the response message */ 298285809Sscottl mpiDeviceRegRsp(agRoot, (agsaDeviceRegistrationRsp_t *)pMsg1); 299285809Sscottl break; 300285809Sscottl } 301285809Sscottl case OPC_OUB_DEV_REGIST: 302285809Sscottl { 303285809Sscottl SA_DBG2(("mpiParseOBIomb, DEV_REGISTRATION Response received IOMB=%p\n", pMsg1)); 304285809Sscottl /* process the response message */ 305285809Sscottl mpiDeviceRegRsp(agRoot, (agsaDeviceRegistrationRsp_t *)pMsg1); 306285809Sscottl break; 307285809Sscottl } 308285809Sscottl case OPC_OUB_DEREG_DEV: 309285809Sscottl { 310285809Sscottl SA_DBG3(("mpiParseOBIomb, DEREGISTRATION DEVICE Response received IOMB=%p\n", pMsg1)); 311285809Sscottl /* process the response message */ 312285809Sscottl mpiDeregDevHandleRsp(agRoot, (agsaDeregDevHandleRsp_t *)pMsg1); 313285809Sscottl break; 314285809Sscottl } 315285809Sscottl#ifndef BIOS 316285809Sscottl case OPC_OUB_GET_DEV_HANDLE: 317285809Sscottl { 318285809Sscottl SA_DBG3(("mpiParseOBIomb, GET_DEV_HANDLE Response received IOMB=%p\n", pMsg1)); 319285809Sscottl /* process the response message */ 320285809Sscottl mpiGetDevHandleRsp(agRoot, (agsaGetDevHandleRsp_t *)pMsg1); 321285809Sscottl break; 322285809Sscottl } 323285809Sscottl#endif 324285809Sscottl case OPC_OUB_SPC_DEV_HANDLE_ARRIV: 325285809Sscottl { 326285809Sscottl SA_DBG3(("mpiParseOBIomb, SPC_DEV_HANDLE_ARRIV Response received IOMB=%p\n", pMsg1)); 327285809Sscottl /* process the response message */ 328285809Sscottl mpiDeviceHandleArrived(agRoot, (agsaDeviceHandleArrivedNotify_t *)pMsg1); 329285809Sscottl break; 330285809Sscottl } 331285809Sscottl case OPC_OUB_DEV_HANDLE_ARRIV: 332285809Sscottl { 333285809Sscottl SA_DBG3(("mpiParseOBIomb, DEV_HANDLE_ARRIV Response received IOMB=%p\n", pMsg1)); 334285809Sscottl /* process the response message */ 335285809Sscottl mpiDeviceHandleArrived(agRoot, (agsaDeviceHandleArrivedNotify_t *)pMsg1); 336285809Sscottl break; 337285809Sscottl } 338285809Sscottl#if 0 //Sunitha 339285809Sscottl case OPC_OUB_THERM_HW_EVENT: 340285809Sscottl { 341285809Sscottl SA_DBG3(("mpiParseOBIomb, THERM_HW_EVENT Response received IOMB=%p\n", pMsg1)); 342285809Sscottl ossaLogThermalEvent(agRoot, (agsaThermal_Hw_Event_Notify_t *)pMsg1); 343285809Sscottl break; 344285809Sscottl } 345285809Sscottl#endif //Sunitha 346285809Sscottl case OPC_OUB_SSP_RECV_EVENT: 347285809Sscottl { 348285809Sscottl SA_DBG3(("mpiParseOBIomb, SSP_RECV_EVENT Response received IOMB=%p\n", pMsg1)); 349285809Sscottl /* process the response message */ 350285809Sscottl mpiSSPReqReceivedNotify(agRoot, (agsaSSPReqReceivedNotify_t *)pMsg1); 351285809Sscottl break; 352285809Sscottl } 353285809Sscottl case OPC_OUB_DEV_INFO: 354285809Sscottl { 355285809Sscottl SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV"); 356285809Sscottl SA_DBG3(("mpiParseOBIomb, DEV_INFO Response received IOMB=%p\n", pMsg1)); 357285809Sscottl /* process the response message */ 358285809Sscottl mpiGetDevInfoRsp(agRoot, (agsaGetDevInfoRspV_t *)pMsg1); 359285809Sscottl break; 360285809Sscottl } 361285809Sscottl#ifndef BIOS 362285809Sscottl case OPC_OUB_GET_PHY_PROFILE_RSP: 363285809Sscottl { 364285809Sscottl SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV"); 365285809Sscottl SA_DBG2(("mpiParseOBIomb, OPC_OUB_GET_PHY_PROFILE_RSP Response received IOMB=%p\n", pMsg1)); 366285809Sscottl /* process the response message */ 367285809Sscottl mpiGetPhyProfileRsp(agRoot, (agsaGetPhyProfileRspV_t *)pMsg1); 368285809Sscottl break; 369285809Sscottl } 370285809Sscottl case OPC_OUB_SET_PHY_PROFILE_RSP: 371285809Sscottl { 372285809Sscottl SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV"); 373285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_PHY_PROFILE_RSP Response received IOMB=%p\n", pMsg1)); 374285809Sscottl /* process the response message */ 375285809Sscottl mpiSetPhyProfileRsp(agRoot, (agsaSetPhyProfileRspV_t *)pMsg1); 376285809Sscottl break; 377285809Sscottl } 378285809Sscottl#endif /* BIOS */ 379285809Sscottl case OPC_OUB_SPC_DEV_INFO: 380285809Sscottl { 381285809Sscottl SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC"); 382285809Sscottl SA_DBG3(("mpiParseOBIomb, DEV_INFO Response received IOMB=%p\n", pMsg1)); 383285809Sscottl /* process the response message */ 384285809Sscottl mpiGetDevInfoRspSpc(agRoot, (agsaGetDevInfoRsp_t *)pMsg1); 385285809Sscottl break; 386285809Sscottl } 387285809Sscottl case OPC_OUB_FW_FLASH_UPDATE: 388285809Sscottl { 389285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_FW_FLASH_UPDATE Response received IOMB=%p\n", pMsg1)); 390285809Sscottl /* process the response message */ 391285809Sscottl mpiFwFlashUpdateRsp(agRoot, (agsaFwFlashUpdateRsp_t *)pMsg1); 392285809Sscottl break; 393285809Sscottl } 394285809Sscottl case OPC_OUB_FLASH_OP_EXT_RSP: 395285809Sscottl { 396285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_FW_FLASH_UPDATE Response received IOMB=%p\n", pMsg1)); 397285809Sscottl /* process the response message */ 398285809Sscottl mpiFwExtFlashUpdateRsp(agRoot, (agsaFwFlashOpExtRsp_t *)pMsg1); 399285809Sscottl break; 400285809Sscottl } 401285809Sscottl#ifndef BIOS 402285809Sscottl#ifdef SPC_ENABLE_PROFILE 403285809Sscottl case OPC_OUB_FW_PROFILE: 404285809Sscottl { 405285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_FW_PROFILE Response received IOMB=%p\n", pMsg1)); 406285809Sscottl /* process the response message */ 407285809Sscottl mpiFwProfileRsp(agRoot, (agsaFwProfileRsp_t *)pMsg1); 408285809Sscottl break; 409285809Sscottl } 410285809Sscottl#endif 411285809Sscottl case OPC_OUB_SET_NVMD_DATA: 412285809Sscottl { 413285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_NVMD_DATA received IOMB=%p\n", pMsg1)); 414285809Sscottl /* process the response message */ 415285809Sscottl mpiSetNVMDataRsp(agRoot, (agsaSetNVMDataRsp_t *)pMsg1); 416285809Sscottl break; 417285809Sscottl } 418285809Sscottl 419285809Sscottl case OPC_OUB_GPIO_RESPONSE: 420285809Sscottl { 421285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GPIO_RESPONSE Response received IOMB=%p\n", pMsg1)); 422285809Sscottl /* process the response message */ 423285809Sscottl mpiGPIORsp(agRoot, (agsaGPIORsp_t *)pMsg1); 424285809Sscottl break; 425285809Sscottl } 426285809Sscottl case OPC_OUB_GPIO_EVENT: 427285809Sscottl { 428285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GPIO_RESPONSE Response received IOMB=%p\n", pMsg1)); 429285809Sscottl /* process the response message */ 430285809Sscottl mpiGPIOEventRsp(agRoot, (agsaGPIOEvent_t *)pMsg1); 431285809Sscottl break; 432285809Sscottl } 433285809Sscottl#endif /* BIOS */ 434285809Sscottl case OPC_OUB_GENERAL_EVENT: 435285809Sscottl { 436285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_GENERAL_EVENT Response received IOMB=%p\n", pMsg1)); 437285809Sscottl /* process the response message */ 438285809Sscottl mpiGeneralEventRsp(agRoot, (agsaGeneralEventRsp_t *)pMsg1); 439285809Sscottl break; 440285809Sscottl } 441285809Sscottl#ifndef BIOS 442285809Sscottl case OPC_OUB_SAS_DIAG_MODE_START_END: 443285809Sscottl { 444285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_DIAG_MODE_START_END Response received IOMB=%p\n", pMsg1)); 445285809Sscottl /* process the response message */ 446285809Sscottl mpiSASDiagStartEndRsp(agRoot, (agsaSASDiagStartEndRsp_t *)pMsg1); 447285809Sscottl break; 448285809Sscottl } 449285809Sscottl case OPC_OUB_SAS_DIAG_EXECUTE: 450285809Sscottl { 451285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_DIAG_EXECUTE_RSP Response received IOMB=%p\n", pMsg1)); 452285809Sscottl /* process the response message */ 453285809Sscottl mpiSASDiagExecuteRsp(agRoot, (agsaSASDiagExecuteRsp_t *)pMsg1); 454285809Sscottl break; 455285809Sscottl } 456285809Sscottl#endif /* BIOS */ 457285809Sscottl case OPC_OUB_GET_TIME_STAMP: 458285809Sscottl { 459285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_TIME_STAMP Response received IOMB=%p\n", pMsg1)); 460285809Sscottl /* process the response message */ 461285809Sscottl mpiGetTimeStampRsp(agRoot, (agsaGetTimeStampRsp_t *)pMsg1); 462285809Sscottl break; 463285809Sscottl } 464285809Sscottl 465285809Sscottl case OPC_OUB_SPC_SAS_HW_EVENT_ACK: 466285809Sscottl { 467285809Sscottl SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC"); 468285809Sscottl SA_DBG3(("mpiParseOBIomb,OPC_OUB_SPC_SAS_HW_EVENT_ACK Response received IOMB=%p\n", pMsg1)); 469285809Sscottl /* process the response message */ 470285809Sscottl mpiSASHwEventAckRsp(agRoot, (agsaSASHwEventAckRsp_t *)pMsg1); 471285809Sscottl break; 472285809Sscottl } 473285809Sscottl 474285809Sscottl case OPC_OUB_SAS_HW_EVENT_ACK: 475285809Sscottl { 476285809Sscottl SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV"); 477285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_HW_EVENT_ACK Response received IOMB=%p\n", pMsg1)); 478285809Sscottl /* process the response message */ 479285809Sscottl mpiSASHwEventAckRsp(agRoot, (agsaSASHwEventAckRsp_t *)pMsg1); 480285809Sscottl break; 481285809Sscottl } 482285809Sscottl case OPC_OUB_PORT_CONTROL: 483285809Sscottl { 484285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_PORT_CONTROL Response received IOMB=%p\n", pMsg1)); 485285809Sscottl /* process the response message */ 486285809Sscottl mpiPortControlRsp(agRoot, (agsaPortControlRsp_t *)pMsg1); 487285809Sscottl break; 488285809Sscottl } 489285809Sscottl case OPC_OUB_SMP_ABORT_RSP: 490285809Sscottl { 491285809Sscottl#ifdef SALL_API_TEST 492285809Sscottl saRoot->LLCounters.IOCounter.numSMPAbortedCB++; 493285809Sscottl SA_DBG3(("mpiParseOBIomb, SMP_ABORT Response received IOMB=%p, %d\n", 494285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numSMPAbortedCB)); 495285809Sscottl#else 496285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SMP_ABORT_RSP Response received IOMB=%p\n", pMsg1)); 497285809Sscottl#endif 498285809Sscottl /* process the response message */ 499285809Sscottl mpiSMPAbortRsp(agRoot, (agsaSMPAbortRsp_t *)pMsg1); 500285809Sscottl break; 501285809Sscottl } 502285809Sscottl case OPC_OUB_DEVICE_HANDLE_REMOVAL: 503285809Sscottl { 504285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_DEVICE_HANDLE_REMOVAL received IOMB=%p\n", pMsg1)); 505285809Sscottl /* process the response message */ 506285809Sscottl mpiDeviceHandleRemoval(agRoot, (agsaDeviceHandleRemoval_t *)pMsg1); 507285809Sscottl break; 508285809Sscottl } 509285809Sscottl case OPC_OUB_SET_DEVICE_STATE: 510285809Sscottl { 511285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_DEVICE_STATE received IOMB=%p\n", pMsg1)); 512285809Sscottl /* process the response message */ 513285809Sscottl mpiSetDeviceStateRsp(agRoot, (agsaSetDeviceStateRsp_t *)pMsg1); 514285809Sscottl break; 515285809Sscottl } 516285809Sscottl 517285809Sscottl#ifndef BIOS 518285809Sscottl case OPC_OUB_GET_DEVICE_STATE: 519285809Sscottl { 520285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_DEVICE_STATE received IOMB=%p\n", pMsg1)); 521285809Sscottl /* process the response message */ 522285809Sscottl mpiGetDeviceStateRsp(agRoot, (agsaGetDeviceStateRsp_t *)pMsg1); 523285809Sscottl break; 524285809Sscottl } 525285809Sscottl#endif /* BIOS */ 526285809Sscottl 527285809Sscottl case OPC_OUB_SET_DEV_INFO: 528285809Sscottl { 529285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_DEV_INFO received IOMB=%p\n", pMsg1)); 530285809Sscottl /* process the response message */ 531285809Sscottl mpiSetDevInfoRsp(agRoot, (agsaSetDeviceInfoRsp_t *)pMsg1); 532285809Sscottl break; 533285809Sscottl } 534285809Sscottl 535285809Sscottl#ifndef BIOS_DEBUG 536285809Sscottl case OPC_OUB_SAS_RE_INITIALIZE: 537285809Sscottl { 538285809Sscottl SA_ASSERT((smIS_SPC(agRoot)), "smIS_SPC"); 539285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SAS_RE_INITIALIZE received IOMB=%p\n", pMsg1)); 540285809Sscottl /* process the response message */ 541285809Sscottl mpiSasReInitializeRsp(agRoot, (agsaSasReInitializeRsp_t *)pMsg1); 542285809Sscottl break; 543285809Sscottl } 544285809Sscottl#endif /* BIOS */ 545285809Sscottl 546285809Sscottl case OPC_OUB_SGPIO_RESPONSE: 547285809Sscottl { 548285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SGPIO_RESPONSE Response received IOMB=%p\n", pMsg1)); 549285809Sscottl /* process the response message */ 550285809Sscottl mpiSGpioRsp(agRoot, (agsaSGpioRsp_t *)pMsg1); 551285809Sscottl break; 552285809Sscottl } 553285809Sscottl 554285809Sscottl#ifndef BIOS 555285809Sscottl case OPC_OUB_PCIE_DIAG_EXECUTE: 556285809Sscottl { 557285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_PCIE_DIAG_EXECUTE Response received IOMB=%p\n", pMsg1)); 558285809Sscottl /* process the response message */ 559285809Sscottl mpiPCIeDiagExecuteRsp(agRoot, (agsaPCIeDiagExecuteRsp_t *)pMsg1); 560285809Sscottl break; 561285809Sscottl } 562285809Sscottl case 2104: //delray start 563285809Sscottl { 564285809Sscottl if(smIS_SPC6V(agRoot)) 565285809Sscottl { 566285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_DFE_DATA_RSP Response received IOMB=%p\n", pMsg1)); 567285809Sscottl /* process the response message */ 568285809Sscottl mpiGetDFEDataRsp(agRoot, (agsaGetDDEFDataRsp_t *)pMsg1); 569285809Sscottl } 570285809Sscottl if(smIS_SPC12V(agRoot)) 571285809Sscottl { 572285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_INB_GET_VIST_CAP Response received IOMB=%p\n", pMsg1)); 573285809Sscottl mpiGetVisRsp(agRoot, (agsaGetVisCapRsp_t *)pMsg1); 574285809Sscottl } 575285809Sscottl else 576285809Sscottl { 577285809Sscottl SA_DBG1(("mpiParseOBIomb, 2104 Response received IOMB=%p\n", pMsg1)); 578285809Sscottl } 579285809Sscottl break; 580285809Sscottl } 581285809Sscottl#endif /* BIOS */ 582285809Sscottl case OPC_OUB_SET_CONTROLLER_CONFIG: 583285809Sscottl { 584285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_SET_CONTROLLER_CONFIG Response received IOMB=%p\n", pMsg1)); 585285809Sscottl mpiSetControllerConfigRsp(agRoot, (agsaSetControllerConfigRsp_t *)pMsg1); 586285809Sscottl break; 587285809Sscottl } 588285809Sscottl#ifndef BIOS 589285809Sscottl case OPC_OUB_GET_CONTROLLER_CONFIG: 590285809Sscottl { 591285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_GET_CONTROLLER_CONFIG Response received IOMB=%p\n", pMsg1)); 592285809Sscottl mpiGetControllerConfigRsp(agRoot, (agsaGetControllerConfigRsp_t *)pMsg1); 593285809Sscottl break; 594285809Sscottl } 595285809Sscottl case OPC_OUB_KEK_MANAGEMENT: 596285809Sscottl { 597285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_KEK_MANAGEMENT Response received IOMB=%p\n", pMsg1)); 598285809Sscottl mpiKekManagementRsp(agRoot, (agsaKekManagementRsp_t *)pMsg1); 599285809Sscottl break; 600285809Sscottl } 601285809Sscottl#endif /* BIOS */ 602285809Sscottl#ifdef UN_USED_FUNC 603285809Sscottl case OPC_OUB_DEK_MANAGEMENT: 604285809Sscottl { 605285809Sscottl SA_DBG3(("mpiParseOBIomb, OPC_OUB_DEK_MANAGEMENT Response received IOMB=%p\n", pMsg1)); 606285809Sscottl mpiDekManagementRsp(agRoot, (agsaDekManagementRsp_t *)pMsg1); 607285809Sscottl break; 608285809Sscottl } 609285809Sscottl#endif 610285809Sscottl#ifndef BIOS 611285809Sscottl case OPC_OUB_OPR_MGMT: 612285809Sscottl { 613285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_OPR_MGMT Response received IOMB=%p\n", pMsg1)); 614285809Sscottl mpiOperatorManagementRsp(agRoot, (agsaOperatorMangmenRsp_t *)pMsg1); 615285809Sscottl break; 616285809Sscottl } 617285809Sscottl case OPC_OUB_ENC_TEST_EXECUTE: 618285809Sscottl { 619285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_ENC_TEST_EXECUTE Response received IOMB=%p\n", pMsg1)); 620285809Sscottl mpiBistRsp(agRoot, (agsaEncryptBistRsp_t *)pMsg1); 621285809Sscottl break; 622285809Sscottl } 623285809Sscottl#endif /* BIOS */ 624285809Sscottl case OPC_OUB_SET_OPERATOR: 625285809Sscottl { 626285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_SET_OPERATOR Response received IOMB=%p\n", pMsg1)); 627285809Sscottl mpiSetOperatorRsp(agRoot, (agsaSetOperatorRsp_t *)pMsg1); 628285809Sscottl break; 629285809Sscottl } 630285809Sscottl case OPC_OUB_GET_OPERATOR: 631285809Sscottl { 632285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_GET_OPERATOR Response received IOMB=%p\n", pMsg1)); 633285809Sscottl mpiGetOperatorRsp(agRoot, (agsaGetOperatorRsp_t *)pMsg1); 634285809Sscottl break; 635285809Sscottl } 636285809Sscottl case OPC_OUB_DIF_ENC_OFFLOAD_RSP://delray start 637285809Sscottl { 638285809Sscottl SA_ASSERT((smIS_SPCV(agRoot)), "smIS_SPCV"); 639285809Sscottl SA_DBG1(("mpiParseOBIomb, OPC_OUB_DIF_ENC_OFFLOAD_RSP Response received IOMB=%p\n", pMsg1)); 640285809Sscottl mpiDifEncOffloadRsp(agRoot, (agsaDifEncOffloadRspV_t *)pMsg1); 641285809Sscottl break; 642285809Sscottl } //delray end 643285809Sscottl default: 644285809Sscottl { 645285809Sscottl#ifdef SALL_API_TEST 646285809Sscottl saRoot->LLCounters.IOCounter.numUNKNWRespIOMB++; 647285809Sscottl SA_DBG1(("mpiParseOBIomb, UnKnown Response received IOMB=%p, %d\n", 648285809Sscottl pMsg1, saRoot->LLCounters.IOCounter.numUNKNWRespIOMB)); 649285809Sscottl#else 650285809Sscottl SA_DBG1(("mpiParseOBIomb, Unknown IOMB Response received opcode 0x%X IOMB=%p\n",opcode, pMsg1)); 651285809Sscottl#endif 652285809Sscottl break; 653285809Sscottl } 654285809Sscottl } /* switch */ 655285809Sscottl 656285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2f"); 657285809Sscottl 658285809Sscottl return ret; 659285809Sscottl 660285809Sscottl} 661285809Sscottl#endif 662285809Sscottl 663285809Sscottl#ifndef BIOS 664285809Sscottl#endif 665285809Sscottl 666285809Sscottl/******************************************************************************/ 667285809Sscottl/*! \brief ECHO Response 668285809Sscottl * 669285809Sscottl * This routine handles the response of ECHO Command 670285809Sscottl * 671285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 672285809Sscottl * \param pIomb Pointer of IOMB Mesage 673285809Sscottl * 674285809Sscottl * \return sucess or fail 675285809Sscottl * 676285809Sscottl */ 677285809Sscottl/*******************************************************************************/ 678285809SscottlGLOBAL bit32 mpiEchoRsp( 679285809Sscottl agsaRoot_t *agRoot, 680285809Sscottl agsaEchoRsp_t *pIomb 681285809Sscottl ) 682285809Sscottl{ 683285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 684285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 685285809Sscottl agsaIORequestDesc_t *pRequest; 686285809Sscottl agsaContext_t *agContext; 687285809Sscottl bit32 tag; 688285809Sscottl 689285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD, "2g"); 690285809Sscottl 691285809Sscottl SA_DBG3(("mpiEchoRsp: HTAG=0x%x\n", pIomb->tag)); 692285809Sscottl 693285809Sscottl /* get request from IOMap */ 694285809Sscottl OSSA_READ_LE_32(agRoot, &tag, pIomb, OSSA_OFFSET_OF(agsaEchoRsp_t, tag)); 695285809Sscottl 696285809Sscottl pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest; 697285809Sscottl if (agNULL == pRequest) 698285809Sscottl { 699285809Sscottl SA_DBG1(("mpiEchoRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x\n", tag)); 700285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2g"); 701285809Sscottl return AGSA_RC_FAILURE; 702285809Sscottl } 703285809Sscottl 704285809Sscottl agContext = saRoot->IOMap[tag].agContext; 705285809Sscottl 706285809Sscottl ossaEchoCB(agRoot, agContext, (void *)&pIomb->payload[0]); 707285809Sscottl 708285809Sscottl /* remove the request from IOMap */ 709285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 710285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 711285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 712285809Sscottl 713285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 714285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 715285809Sscottl pRequest->valid = agFALSE; 716285809Sscottl /* return the request to free pool */ 717285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 718285809Sscottl { 719285809Sscottl SA_DBG1(("mpiEchoRsp: saving pRequest (%p) for later use\n", pRequest)); 720285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 721285809Sscottl } 722285809Sscottl else 723285809Sscottl { 724285809Sscottl /* return the request to free pool */ 725285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 726285809Sscottl } 727285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 728285809Sscottl 729285809Sscottl /* return value */ 730285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2g"); 731285809Sscottl return ret; 732285809Sscottl} 733285809Sscottl 734285809Sscottl/******************************************************************************/ 735285809Sscottl/*! \brief Get NVM Data Response 736285809Sscottl * 737285809Sscottl * This routine handles the response of GET NVM Data Response 738285809Sscottl * 739285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 740285809Sscottl * \param pIomb Pointer of IOMB Mesage 741285809Sscottl * 742285809Sscottl * \return sucess or fail 743285809Sscottl * 744285809Sscottl */ 745285809Sscottl/*******************************************************************************/ 746285809SscottlGLOBAL bit32 mpiGetNVMDataRsp( 747285809Sscottl agsaRoot_t *agRoot, 748285809Sscottl agsaGetNVMDataRsp_t *pIomb 749285809Sscottl ) 750285809Sscottl{ 751285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 752285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 753285809Sscottl agsaIORequestDesc_t *pRequest; 754285809Sscottl agsaContext_t *agContext; 755285809Sscottl bit32 i, dataLen; 756285809Sscottl bit32 DlenStatus, tag, iRTdaBnDpsAsNvm; 757285809Sscottl 758285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD, "2h"); 759285809Sscottl 760285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetNVMDataRsp_t, tag)); 761285809Sscottl OSSA_READ_LE_32(AGROOT, &DlenStatus, pIomb, OSSA_OFFSET_OF(agsaGetNVMDataRsp_t, DlenStatus)); 762285809Sscottl OSSA_READ_LE_32(AGROOT, &iRTdaBnDpsAsNvm, pIomb, OSSA_OFFSET_OF(agsaGetNVMDataRsp_t, iRTdaBnDpsAsNvm)); 763285809Sscottl OSSA_READ_LE_32(AGROOT, &dataLen, pIomb, OSSA_OFFSET_OF(agsaGetNVMDataRsp_t, NVMData[10])) ; 764285809Sscottl 765285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: HTAG=0x%x\n", tag)); 766285809Sscottl 767285809Sscottl /* get request from IOMap */ 768285809Sscottl pRequest = (agsaIORequestDesc_t *)saRoot->IOMap[tag].IORequest; 769285809Sscottl if (agNULL == pRequest) 770285809Sscottl { 771285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: Bad Response IOMB!!! pRequest is NULL.\n")); 772285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2h"); 773285809Sscottl return AGSA_RC_FAILURE; 774285809Sscottl } 775285809Sscottl 776285809Sscottl agContext = saRoot->IOMap[tag].agContext; 777285809Sscottl 778285809Sscottl if (iRTdaBnDpsAsNvm & IRMode) 779285809Sscottl { 780285809Sscottl /* indirect mode - IR bit set */ 781285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: OSSA_SUCCESS, IR=1, DataLen=%d\n", dataLen)); 782285809Sscottl if (((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_CONFIG_SEEPROM) || 783285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_VPD_FLASH) || 784285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_TWI_DEVICES) || 785285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_EXPANSION_ROM) || 786285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_IOP_REG_FLASH)) 787285809Sscottl { 788285809Sscottl /* CB for NVMD */ 789285809Sscottl//#ifdef UN_USED_FUNC 790285809Sscottl ossaGetNVMDResponseCB(agRoot, agContext, (DlenStatus & NVMD_STAT), INDIRECT_MODE, dataLen, agNULL); 791285809Sscottl//#endif 792285809Sscottl } 793285809Sscottl else if (((iRTdaBnDpsAsNvm & NVMD_TYPE) == AAP1_RDUMP) || 794285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == IOP_RDUMP)) 795285809Sscottl { 796285809Sscottl#ifdef UN_USED_FUNC 797285809Sscottl if ((DlenStatus & NVMD_STAT) == 0) 798285809Sscottl { 799285809Sscottl /* CB for Register Dump */ 800285809Sscottl 801285809Sscottl ossaGetRegisterDumpCB(agRoot, agContext, OSSA_SUCCESS); 802285809Sscottl } 803285809Sscottl else 804285809Sscottl { 805285809Sscottl /* CB for Register Dump */ 806285809Sscottl ossaGetRegisterDumpCB(agRoot, agContext, OSSA_FAILURE); 807285809Sscottl } 808285809Sscottl#endif 809285809Sscottl } 810285809Sscottl else 811285809Sscottl { 812285809Sscottl /* Should not be happened */ 813285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: (IR=1)Wrong Device type 0x%x\n", iRTdaBnDpsAsNvm)); 814285809Sscottl } 815285809Sscottl } 816285809Sscottl else /* direct mode */ 817285809Sscottl { 818285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: OSSA_SUCCESS, IR=0, DataLen=%d\n", ((DlenStatus & NVMD_LEN) >> SHIFT24))); 819285809Sscottl for (i = 0; i < (((DlenStatus & NVMD_LEN) >> SHIFT24)/4); i++) 820285809Sscottl { 821285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: OSSA_SUCCESS, NVMDATA=0x%x\n", pIomb->NVMData[i])); 822285809Sscottl } 823285809Sscottl if (((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_CONFIG_SEEPROM) || 824285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_VPD_FLASH) || 825285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_TWI_DEVICES)) 826285809Sscottl { 827285809Sscottl /* CB for NVMD */ 828285809Sscottl // char * safe_type_pun = (char *)(&pIomb->NVMData[0]); 829285809Sscottl#ifdef UN_USED_FUNC 830285809Sscottl ossaGetNVMDResponseCB(agRoot, agContext, (DlenStatus & NVMD_STAT), DIRECT_MODE, 831285809Sscottl ((DlenStatus & NVMD_LEN) >> SHIFT24), (agsaFrameHandle_t *)safe_type_pun); 832285809Sscottl#endif 833285809Sscottl } 834285809Sscottl else if (((iRTdaBnDpsAsNvm & NVMD_TYPE) == AAP1_RDUMP) || 835285809Sscottl ((iRTdaBnDpsAsNvm & NVMD_TYPE) == IOP_RDUMP)) 836285809Sscottl { 837285809Sscottl#ifdef UN_USED_FUNC 838285809Sscottl 839285809Sscottl if ((DlenStatus & NVMD_STAT) == 0) 840285809Sscottl { 841285809Sscottl /* CB for Register Dump */ 842285809Sscottl ossaGetRegisterDumpCB(agRoot, agContext, OSSA_SUCCESS); 843285809Sscottl } 844285809Sscottl else 845285809Sscottl { 846285809Sscottl /* CB for Register Dump */ 847285809Sscottl ossaGetRegisterDumpCB(agRoot, agContext, OSSA_FAILURE); 848285809Sscottl } 849285809Sscottl#endif 850285809Sscottl } 851285809Sscottl else 852285809Sscottl { 853285809Sscottl /* Should not be happened */ 854285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: (IR=0)Wrong Device type 0x%x\n", iRTdaBnDpsAsNvm)); 855285809Sscottl } 856285809Sscottl } 857285809Sscottl 858285809Sscottl /* remove the request from IOMap */ 859285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 860285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 861285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 862285809Sscottl 863285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 864285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 865285809Sscottl pRequest->valid = agFALSE; 866285809Sscottl /* return the request to free pool */ 867285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 868285809Sscottl { 869285809Sscottl SA_DBG1(("mpiGetNVMDataRsp: saving pRequest (%p) for later use\n", pRequest)); 870285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 871285809Sscottl } 872285809Sscottl else 873285809Sscottl { 874285809Sscottl /* return the request to free pool */ 875285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 876285809Sscottl } 877285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 878285809Sscottl 879285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2h"); 880285809Sscottl 881285809Sscottl /* return value */ 882285809Sscottl return ret; 883285809Sscottl} 884285809Sscottl 885285809Sscottl/******************************************************************************/ 886285809Sscottl/*! \brief Phy Event Response from SPCv 887285809Sscottl * 888285809Sscottl * Process Phy Event from SPC 889285809Sscottl * 890285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LL Layer 891285809Sscottl * \param pIomb pointer of IOMB 892285809Sscottl * 893285809Sscottl * \return success or fail 894285809Sscottl * 895285809Sscottl */ 896285809Sscottl/*******************************************************************************/ 897285809Sscottl 898285809SscottlGLOBAL bit32 mpiPhyStartEvent( 899285809Sscottl agsaRoot_t *agRoot, 900285809Sscottl agsaHWEvent_Phy_OUB_t *pIomb 901285809Sscottl ) 902285809Sscottl{ 903285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 904285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 905285809Sscottl 906285809Sscottl bit32 phyId; 907285809Sscottl bit32 IOMBStatus; 908285809Sscottl bit32 tag; 909285809Sscottl 910285809Sscottl agsaIORequestDesc_t *pRequest; 911285809Sscottl agsaContext_t *agContext; 912285809Sscottl bit32 HwCBStatus; 913285809Sscottl 914285809Sscottl if(saRoot == agNULL) 915285809Sscottl { 916285809Sscottl SA_DBG1(("mpiPhyStartEvent: saRoot == agNULL\n")); 917285809Sscottl return(AGSA_RC_FAILURE); 918285809Sscottl } 919285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD, "2H"); 920285809Sscottl 921285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t, tag)) ; 922285809Sscottl 923285809Sscottl /* get request from IOMap */ 924285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 925285809Sscottl agContext = saRoot->IOMap[tag].agContext; 926285809Sscottl /* remove the request from IOMap */ 927285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 928285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 929285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 930285809Sscottl if (agNULL == pRequest) 931285809Sscottl { 932285809Sscottl SA_DBG1(("mpiPhyStartEvent: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x \n", tag)); 933285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2H"); 934285809Sscottl return AGSA_RC_FAILURE; 935285809Sscottl } 936285809Sscottl 937285809Sscottl SA_DBG1(("mpiPhyStartEvent: Status 0x%X PhyId 0x%X\n",pIomb->Status,pIomb->ReservedPhyId)); 938285809Sscottl 939285809Sscottl OSSA_READ_LE_32(AGROOT, &IOMBStatus, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t,Status )); 940285809Sscottl OSSA_READ_LE_32(AGROOT, &phyId, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t,ReservedPhyId )); 941285809Sscottl 942285809Sscottl switch (IOMBStatus) 943285809Sscottl { 944285809Sscottl case OSSA_MPI_IO_SUCCESS: /* PhyStart operation completed successfully */ 945285809Sscottl HwCBStatus = 0; 946285809Sscottl saRoot->phys[phyId].linkstatus = 1; 947285809Sscottl SA_DBG1(("mpiPhyStartEvent:MPI_IO_SUCCESS IOMBStatus 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 948285809Sscottl /* Callback with PHY_UP */ 949285809Sscottl break; 950285809Sscottl case OSSA_MPI_ERR_INVALID_PHY_ID: /* identifier specified in the PHY_START command is invalid i.e out of supported range for this product. */ 951285809Sscottl HwCBStatus = 1; 952285809Sscottl saRoot->phys[phyId].linkstatus = 0; 953285809Sscottl SA_DBG1(("mpiPhyStartEvent: MPI_ERR_INVALID_PHY_ID IOMBStatus 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 954285809Sscottl ret = AGSA_RC_FAILURE; 955285809Sscottl break; 956285809Sscottl case OSSA_MPI_ERR_PHY_ALREADY_STARTED: 957285809Sscottl HwCBStatus = 2; 958285809Sscottl saRoot->phys[phyId].linkstatus = 1; 959285809Sscottl SA_DBG1(("mpiPhyStartEvent: MPI_ERR_PHY_ALREADY_STARTED IOMBStatus 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 960285809Sscottl ret = AGSA_RC_FAILURE; 961285809Sscottl break; 962285809Sscottl case OSSA_MPI_ERR_INVALID_ANALOG_TBL_IDX: 963285809Sscottl HwCBStatus = 4; 964285809Sscottl saRoot->phys[phyId].linkstatus = 0; 965285809Sscottl SA_DBG1(("mpiPhyStartEvent: MPI_ERR_INVALID_ANALOG_TBL_IDX IOMBStatus 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 966285809Sscottl ret = AGSA_RC_FAILURE; 967285809Sscottl break; 968285809Sscottl default: 969285809Sscottl HwCBStatus = 3; 970285809Sscottl saRoot->phys[phyId].linkstatus = 0; 971285809Sscottl SA_DBG1(("mpiPhyStartEvent: Unknown IOMBStatus 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 972285809Sscottl ret = AGSA_RC_FAILURE; 973285809Sscottl break; 974285809Sscottl } 975285809Sscottl 976285809Sscottl ossaHwCB(agRoot,agNULL, OSSA_HW_EVENT_PHY_START_STATUS ,((HwCBStatus << SHIFT8) | phyId) ,agContext, agNULL); 977285809Sscottl 978285809Sscottl /* return the request to free pool */ 979285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 980285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 981285809Sscottl pRequest->valid = agFALSE; 982285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 983285809Sscottl { 984285809Sscottl SA_DBG1(("mpiPhyStartEvent: saving pRequest (%p) for later use\n", pRequest)); 985285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 986285809Sscottl } 987285809Sscottl else 988285809Sscottl { 989285809Sscottl /* return the request to free pool */ 990285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 991285809Sscottl } 992285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 993285809Sscottl 994285809Sscottl return(ret); 995285809Sscottl} 996285809Sscottl 997285809Sscottl 998285809SscottlGLOBAL bit32 mpiPhyStopEvent( 999285809Sscottl agsaRoot_t *agRoot, 1000285809Sscottl agsaHWEvent_Phy_OUB_t *pIomb 1001285809Sscottl ) 1002285809Sscottl{ 1003285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 1004285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 1005285809Sscottl bit32 phyId; 1006285809Sscottl 1007285809Sscottl bit32 IOMBStatus; 1008285809Sscottl bit32 HwCBStatus; 1009285809Sscottl 1010285809Sscottl bit32 tag; 1011285809Sscottl 1012285809Sscottl agsaIORequestDesc_t *pRequest; 1013285809Sscottl agsaContext_t *agContext; 1014285809Sscottl 1015285809Sscottl agsaPhy_t *pPhy; 1016285809Sscottl agsaPort_t *pPort; 1017285809Sscottl 1018285809Sscottl 1019285809Sscottl if(saRoot == agNULL) 1020285809Sscottl { 1021285809Sscottl SA_DBG1(("mpiPhyStopEvent: saRoot == agNULL\n")); 1022285809Sscottl return(AGSA_RC_FAILURE); 1023285809Sscottl } 1024285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t, tag)) ; 1025285809Sscottl 1026285809Sscottl /* get request from IOMap */ 1027285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 1028285809Sscottl agContext = saRoot->IOMap[tag].agContext; 1029285809Sscottl /* remove the request from IOMap */ 1030285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 1031285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 1032285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 1033285809Sscottl if (agNULL == pRequest) 1034285809Sscottl { 1035285809Sscottl SA_DBG1(("mpiPhyStopEvent: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x \n", tag)); 1036285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2H"); 1037285809Sscottl return AGSA_RC_FAILURE; 1038285809Sscottl } 1039285809Sscottl 1040285809Sscottl OSSA_READ_LE_32(AGROOT, &IOMBStatus, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t,Status )); 1041285809Sscottl OSSA_READ_LE_32(AGROOT, &phyId, pIomb, OSSA_OFFSET_OF(agsaHWEvent_Phy_OUB_t,ReservedPhyId )); 1042285809Sscottl SA_DBG1(("mpiPhyStopEvent: Status %08X PhyId %08X\n",IOMBStatus,phyId)); 1043285809Sscottl 1044285809Sscottl if(smIS_SPCV(agRoot)) 1045285809Sscottl { 1046285809Sscottl phyId &= 0xff; // SPCv PHY_ID is one byte wide 1047285809Sscottl } 1048285809Sscottl 1049285809Sscottl saRoot->phys[phyId].linkstatus = 0; 1050285809Sscottl 1051285809Sscottl switch (IOMBStatus) 1052285809Sscottl { 1053285809Sscottl case OSSA_MPI_IO_SUCCESS: /* PhyStart operation completed successfully */ 1054285809Sscottl SA_DBG1(("mpiPhyStopEvent:MPI_IO_SUCCESS 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 1055285809Sscottl HwCBStatus = 0; 1056285809Sscottl /* Callback with PHY_DOWN */ 1057285809Sscottl break; 1058285809Sscottl case OSSA_MPI_ERR_INVALID_PHY_ID: /* identifier specified in the PHY_START command is invalid i.e out of supported range for this product. */ 1059285809Sscottl SA_DBG1(("mpiPhyStopEvent: MPI_ERR_INVALID_PHY_ID 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 1060285809Sscottl HwCBStatus = 1; 1061285809Sscottl break; 1062285809Sscottl case OSSA_MPI_ERR_PHY_NOT_STARTED: /* An attempt to stop a phy which is not started */ 1063285809Sscottl HwCBStatus = 4; 1064285809Sscottl SA_DBG1(("mpiPhyStopEvent: 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 1065285809Sscottl break; 1066285809Sscottl 1067285809Sscottl case OSSA_MPI_ERR_DEVICES_ATTACHED: /* All the devices in a port need to be deregistered if the PHY_STOP is for the last phy */ 1068285809Sscottl HwCBStatus = 2; 1069285809Sscottl SA_DBG1(("mpiPhyStopEvent: 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 1070285809Sscottl break; 1071285809Sscottl 1072285809Sscottl default: 1073285809Sscottl HwCBStatus = 3; 1074285809Sscottl SA_DBG1(("mpiPhyStopEvent: Unknown Status 0x%x for phyId 0x%x\n",IOMBStatus,phyId)); 1075285809Sscottl break; 1076285809Sscottl } 1077285809Sscottl 1078285809Sscottl 1079285809Sscottl if(HwCBStatus == 0) 1080285809Sscottl { 1081285809Sscottl pPhy = &(saRoot->phys[phyId]); 1082285809Sscottl /* get the port of the phy */ 1083285809Sscottl pPort = pPhy->pPort; 1084285809Sscottl if ( agNULL != pPort ) 1085285809Sscottl { 1086285809Sscottl SA_DBG1(("siPhyStopCB: phy%d invalidating port\n", phyId)); 1087285809Sscottl /* invalid port state, remove the port */ 1088285809Sscottl pPort->status |= PORT_INVALIDATING; 1089285809Sscottl saRoot->PortMap[pPort->portId].PortStatus |= PORT_INVALIDATING; 1090285809Sscottl /* invalid the port */ 1091285809Sscottl siPortInvalid(agRoot, pPort); 1092285809Sscottl /* map out the portmap */ 1093285809Sscottl saRoot->PortMap[pPort->portId].PortContext = agNULL; 1094285809Sscottl saRoot->PortMap[pPort->portId].PortID = PORT_MARK_OFF; 1095285809Sscottl saRoot->PortMap[pPort->portId].PortStatus |= PORT_INVALIDATING; 1096285809Sscottl ossaHwCB(agRoot,&(pPort->portContext) , OSSA_HW_EVENT_PHY_STOP_STATUS, ((HwCBStatus << SHIFT8) | phyId ),agContext, agNULL); 1097285809Sscottl } 1098285809Sscottl else 1099285809Sscottl { 1100285809Sscottl SA_DBG1(("siPhyStopCB: phy%d - Port is not established\n", phyId)); 1101285809Sscottl ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_PHY_STOP_STATUS, ((HwCBStatus << SHIFT8) | phyId ) , agContext, agNULL); 1102285809Sscottl } 1103285809Sscottl 1104285809Sscottl /* set PHY_STOPPED status */ 1105285809Sscottl PHY_STATUS_SET(pPhy, PHY_STOPPED); 1106285809Sscottl 1107285809Sscottl /* Exclude the phy from a port */ 1108285809Sscottl if ( agNULL != pPort ) 1109285809Sscottl { 1110285809Sscottl /* Acquire port list lock */ 1111285809Sscottl ossaSingleThreadedEnter(agRoot, LL_PORT_LOCK); 1112285809Sscottl 1113285809Sscottl /* Delete the phy from the port */ 1114285809Sscottl pPort->phyMap[phyId] = agFALSE; 1115285809Sscottl saRoot->phys[phyId].pPort = agNULL; 1116285809Sscottl 1117285809Sscottl /* Release port list lock */ 1118285809Sscottl ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK); 1119285809Sscottl } 1120285809Sscottl 1121285809Sscottl } 1122285809Sscottl else 1123285809Sscottl { 1124285809Sscottl SA_DBG1(("siPhyStopCB: Error phy%d - Port is not established\n", phyId)); 1125285809Sscottl ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_PHY_STOP_STATUS, ((HwCBStatus << SHIFT8) | phyId ) , agContext, agNULL); 1126285809Sscottl } 1127285809Sscottl 1128285809Sscottl /* return the request to free pool */ 1129285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1130285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 1131285809Sscottl pRequest->valid = agFALSE; 1132285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 1133285809Sscottl { 1134285809Sscottl SA_DBG1(("mpiPhyStartEvent: saving pRequest (%p) for later use\n", pRequest)); 1135285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 1136285809Sscottl } 1137285809Sscottl else 1138285809Sscottl { 1139285809Sscottl /* return the request to free pool */ 1140285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 1141285809Sscottl } 1142285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1143285809Sscottl 1144285809Sscottl return(ret); 1145285809Sscottl} 1146285809Sscottl 1147285809Sscottl 1148285809Sscottl/******************************************************************************/ 1149285809Sscottl/*! \brief Hardware Event Response from SPC 1150285809Sscottl * 1151285809Sscottl * Process HW Event from SPC 1152285809Sscottl * 1153285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LL Layer 1154285809Sscottl * \param pIomb pointer of IOMB 1155285809Sscottl * 1156285809Sscottl * \return success or fail 1157285809Sscottl * 1158285809Sscottl */ 1159285809Sscottl/*******************************************************************************/ 1160285809SscottlGLOBAL bit32 mpiHWevent( 1161285809Sscottl agsaRoot_t *agRoot, 1162285809Sscottl agsaHWEvent_SPC_OUB_t *pIomb 1163285809Sscottl ) 1164285809Sscottl{ 1165285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 1166285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 1167285809Sscottl agsaIORequestDesc_t *pRequest; 1168285809Sscottl agsaPortContext_t *agPortContext; 1169285809Sscottl agsaSASIdentify_t *IDframe; 1170285809Sscottl agsaFisRegDeviceToHost_t *sataFis; 1171285809Sscottl agsaContext_t *agContext; 1172285809Sscottl agsaPort_t *pPort = agNULL; 1173285809Sscottl bit32 phyId; 1174285809Sscottl bit32 portId; 1175285809Sscottl bit32 Event; 1176285809Sscottl bit32 tag, status; 1177285809Sscottl bit8 linkRate; 1178285809Sscottl bit32 LREventPhyIdPortId; 1179285809Sscottl bit32 npipps, eventParam,npip,port_state; 1180285809Sscottl 1181285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2j"); 1182285809Sscottl 1183285809Sscottl SA_ASSERT((agNULL !=saRoot ), ""); 1184285809Sscottl if(saRoot == agNULL) 1185285809Sscottl { 1186285809Sscottl SA_DBG1(("mpiHWevent: saRoot == agNULL\n")); 1187285809Sscottl return(AGSA_RC_FAILURE); 1188285809Sscottl } 1189285809Sscottl if(smIS_SPC(agRoot)) 1190285809Sscottl { 1191285809Sscottl OSSA_READ_LE_32(AGROOT, &LREventPhyIdPortId, pIomb, OSSA_OFFSET_OF(agsaHWEvent_SPC_OUB_t, LRStatusEventPhyIdPortId)); 1192285809Sscottl OSSA_READ_LE_32(AGROOT, &npipps, pIomb, OSSA_OFFSET_OF(agsaHWEvent_SPC_OUB_t, NpipPortState)); 1193285809Sscottl OSSA_READ_LE_32(AGROOT, &eventParam, pIomb, OSSA_OFFSET_OF(agsaHWEvent_SPC_OUB_t, EVParam)); 1194285809Sscottl SA_DBG2(("mpiHWEvent: S, LREventPhyIdPortId 0x%08x npipps 0x%08x eventParam 0x%08x\n", LREventPhyIdPortId ,npipps ,eventParam )); 1195285809Sscottl 1196285809Sscottl /* get port context */ 1197285809Sscottl portId = LREventPhyIdPortId & PORTID_MASK; 1198285809Sscottl smTrace(hpDBG_VERY_LOUD,"QK",portId); 1199285809Sscottl /* TP:QK portId */ 1200285809Sscottl 1201285809Sscottl /* get phyId */ 1202285809Sscottl phyId = (LREventPhyIdPortId & PHY_ID_BITS) >> SHIFT4; 1203285809Sscottl 1204285809Sscottl smTrace(hpDBG_VERY_LOUD,"QK",npipps); 1205285809Sscottl /* TP:QK npipps */ 1206285809Sscottl smTrace(hpDBG_VERY_LOUD,"QL",portId); 1207285809Sscottl /* TP:QL portId */ 1208285809Sscottl smTrace(hpDBG_VERY_LOUD,"QM",phyId); 1209285809Sscottl /* TP:QM phyId */ 1210285809Sscottl 1211285809Sscottl SA_DBG1(("mpiHWEvent:SPC, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1212285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, (npipps & PORT_STATE_MASK))); 1213285809Sscottl } 1214285809Sscottl else 1215285809Sscottl { 1216285809Sscottl OSSA_READ_LE_32(AGROOT, &LREventPhyIdPortId, pIomb, OSSA_OFFSET_OF(agsaHWEvent_V_OUB_t, LRStatEventPortId)); 1217285809Sscottl OSSA_READ_LE_32(AGROOT, &npipps, pIomb, OSSA_OFFSET_OF(agsaHWEvent_V_OUB_t, RsvPhyIdNpipRsvPortState)); 1218285809Sscottl OSSA_READ_LE_32(AGROOT, &eventParam, pIomb, OSSA_OFFSET_OF(agsaHWEvent_V_OUB_t, EVParam)); 1219285809Sscottl SA_DBG2(("mpiHWEvent: V, LREventPhyIdPortId 0x%08x npipps 0x%08x eventParam 0x%08x\n", LREventPhyIdPortId ,npipps ,eventParam )); 1220285809Sscottl 1221285809Sscottl smTrace(hpDBG_VERY_LOUD,"QN",npipps); 1222285809Sscottl /* TP:QN npipps */ 1223285809Sscottl 1224285809Sscottl /* get port context */ 1225285809Sscottl portId = LREventPhyIdPortId & PORTID_MASK; 1226285809Sscottl 1227285809Sscottl smTrace(hpDBG_VERY_LOUD,"QO",portId); 1228285809Sscottl /* TP:QO portId */ 1229285809Sscottl 1230285809Sscottl /* get phyId */ 1231285809Sscottl phyId = (npipps & PHY_ID_V_BITS) >> SHIFT16; 1232285809Sscottl smTrace(hpDBG_VERY_LOUD,"QP",phyId); 1233285809Sscottl /* TP:QP phyId */ 1234285809Sscottl 1235285809Sscottl /* get npipps */ 1236285809Sscottl npip =(npipps & 0xFF00 ) >> SHIFT4; 1237285809Sscottl port_state =(npipps & 0xF ); 1238285809Sscottl npipps = npip | port_state; // Make it look like SPCs nipps 1239285809Sscottl 1240285809Sscottl 1241285809Sscottl SA_DBG1(("mpiHWEvent: V, PhyID 0x%x PortID 0x%x NPIP 0x%x PS 0x%x npipps 0x%x\n", 1242285809Sscottl phyId, portId,npip,port_state,npipps)); 1243285809Sscottl } 1244285809Sscottl 1245285809Sscottl Event = (LREventPhyIdPortId & HW_EVENT_BITS) >> SHIFT8; 1246285809Sscottl 1247285809Sscottl /* get Link Rate */ 1248285809Sscottl linkRate = (bit8)((LREventPhyIdPortId & LINK_RATE_MASK) >> SHIFT28); 1249285809Sscottl /* get status byte */ 1250285809Sscottl status = (LREventPhyIdPortId & STATUS_BITS) >> SHIFT24; 1251285809Sscottl 1252285809Sscottl smTrace(hpDBG_VERY_LOUD,"HA",portId); 1253285809Sscottl /* TP:HA portId */ 1254285809Sscottl smTrace(hpDBG_VERY_LOUD,"HB",linkRate); 1255285809Sscottl /* TP:HB linkRate */ 1256285809Sscottl smTrace(hpDBG_VERY_LOUD,"HC",phyId); 1257285809Sscottl /* TP:HC phyId */ 1258285809Sscottl smTrace(hpDBG_VERY_LOUD,"HD",npipps); 1259285809Sscottl /* TP:HD npipps */ 1260285809Sscottl smTrace(hpDBG_VERY_LOUD,"HE",status); 1261285809Sscottl /* TP:HE status */ 1262285809Sscottl 1263285809Sscottl if (portId > saRoot->phyCount) 1264285809Sscottl { 1265285809Sscottl if (OSSA_PORT_NOT_ESTABLISHED == (npipps & PORT_STATE_MASK)) 1266285809Sscottl { 1267285809Sscottl /* out of range checking for portId */ 1268285809Sscottl SA_DBG1(("mpiHWEvent: PORT_ID is out of range, PhyID %d PortID %d\n", 1269285809Sscottl phyId, portId)); 1270285809Sscottl /* port is not estiblished */ 1271285809Sscottl agPortContext = agNULL; 1272285809Sscottl } 1273285809Sscottl else 1274285809Sscottl { 1275285809Sscottl /* portId is bad and state is correct - should not happen */ 1276285809Sscottl SA_DBG1(("mpiHWEvent: PORT_ID is bad with correct Port State, PhyID %d PortID %d\n", 1277285809Sscottl phyId, portId)); 1278285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2j"); 1279285809Sscottl return AGSA_RC_FAILURE; 1280285809Sscottl } 1281285809Sscottl } 1282285809Sscottl else 1283285809Sscottl { 1284285809Sscottl SA_DBG2(("mpiHWEvent: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)); 1285285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext; 1286285809Sscottl } 1287285809Sscottl 1288285809Sscottl if(agPortContext == agNULL) 1289285809Sscottl { 1290285809Sscottl SA_DBG1(("mpiHWEvent: agPortContext is NULL, PhyID %d PortID %d\n", 1291285809Sscottl phyId, portId)); 1292285809Sscottl } 1293285809Sscottl 1294285809Sscottl smTrace(hpDBG_VERY_LOUD,"HF",Event); 1295285809Sscottl /* TP:HF OSSA_HW_EVENT */ 1296285809Sscottl 1297285809Sscottl switch (Event) 1298285809Sscottl { 1299285809Sscottl case OSSA_HW_EVENT_SAS_PHY_UP: 1300285809Sscottl { 1301285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_SAS_PHY_UP, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1302285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, (npipps & PORT_STATE_MASK))); 1303285809Sscottl 1304285809Sscottl /* get SAS Identify info */ 1305285809Sscottl IDframe = (agsaSASIdentify_t *)&pIomb->sasIdentify; 1306285809Sscottl /* Callback about SAS link up */ 1307285809Sscottl saRoot->phys[phyId].linkstatus |= 2; 1308285809Sscottl saRoot->phys[phyId].sasIdentify.phyIdentifier = IDframe->phyIdentifier; 1309285809Sscottl saRoot->phys[phyId].sasIdentify.deviceType_addressFrameType = IDframe->deviceType_addressFrameType; 1310285809Sscottl 1311285809Sscottl si_memcpy(&(saRoot->phys[phyId].sasIdentify.sasAddressHi),&(IDframe->sasAddressHi),4); 1312285809Sscottl si_memcpy(&(saRoot->phys[phyId].sasIdentify.sasAddressLo),&(IDframe->sasAddressLo),4); 1313285809Sscottl siEventPhyUpRcvd(agRoot, phyId, IDframe, portId, npipps, linkRate); 1314285809Sscottl break; 1315285809Sscottl } 1316285809Sscottl case OSSA_HW_EVENT_SATA_PHY_UP: 1317285809Sscottl { 1318285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_SATA_PHY_UP, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1319285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, (npipps & PORT_STATE_MASK))); 1320285809Sscottl 1321285809Sscottl /* get SATA FIS info */ 1322285809Sscottl saRoot->phys[phyId].linkstatus |= 2; 1323285809Sscottl sataFis = (agsaFisRegDeviceToHost_t *)&pIomb->sataFis; 1324285809Sscottl /* Callback about SATA Link Up */ 1325285809Sscottl siEventSATASignatureRcvd(agRoot, phyId, (void *)sataFis, portId, npipps, linkRate); 1326285809Sscottl break; 1327285809Sscottl } 1328285809Sscottl case OSSA_HW_EVENT_SATA_SPINUP_HOLD: 1329285809Sscottl { 1330285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_SATA_SPINUP_HOLD, PhyID %d\n", phyId)); 1331285809Sscottl ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_SATA_SPINUP_HOLD, phyId, agNULL, agNULL); 1332285809Sscottl break; 1333285809Sscottl } 1334285809Sscottl case OSSA_HW_EVENT_PHY_DOWN: 1335285809Sscottl { 1336285809Sscottl agsaPhy_t *pPhy = &(saRoot->phys[phyId]); 1337285809Sscottl 1338285809Sscottl if(pPhy) { 1339285809Sscottl osti_memset(&pPhy->sasIdentify,0,sizeof(agsaSASIdentify_t)); 1340285809Sscottl } 1341285809Sscottl saRoot->phys[phyId].linkstatus &= 1; 1342285809Sscottl if (agNULL != agPortContext) 1343285809Sscottl { 1344285809Sscottl pPort = (agsaPort_t *) (agPortContext->sdkData); 1345285809Sscottl } 1346285809Sscottl 1347285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1348285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1349285809Sscottl 1350285809Sscottl /* callback */ 1351285809Sscottl if ( agNULL != pPort ) 1352285809Sscottl { 1353285809Sscottl if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK)) 1354285809Sscottl { 1355285809Sscottl pPort->status &= ~PORT_INVALIDATING; 1356285809Sscottl saRoot->PortMap[portId].PortStatus &= ~PORT_INVALIDATING; 1357285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN, PhyID %d ~PORT_INVALIDATING \n", phyId)); 1358285809Sscottl } 1359285809Sscottl else 1360285809Sscottl { 1361285809Sscottl if (OSSA_PORT_INVALID == (npipps & PORT_STATE_MASK)) 1362285809Sscottl { 1363285809Sscottl /* set port invalid flag */ 1364285809Sscottl pPort->status |= PORT_INVALIDATING; 1365285809Sscottl saRoot->PortMap[portId].PortStatus |= PORT_INVALIDATING; 1366285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN PortInvalid portID %d PortContext %p NPIP 0x%x\n", portId, agPortContext,npipps)); 1367285809Sscottl } 1368285809Sscottl else 1369285809Sscottl { 1370285809Sscottl if (OSSA_PORT_IN_RESET == (npipps & PORT_STATE_MASK)) 1371285809Sscottl { 1372285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN PortInReset portID %d PortContext %p\n", portId, agPortContext)); 1373285809Sscottl } 1374285809Sscottl else 1375285809Sscottl { 1376285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN Not PortInReset portID %d PortContext %p\n", portId, agPortContext)); 1377285809Sscottl } 1378285809Sscottl } 1379285809Sscottl } 1380285809Sscottl 1381285809Sscottl /* report PhyId, NPIP, PortState */ 1382285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1383285809Sscottl /* Callback with PHY_DOWN */ 1384285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_DOWN, phyId, agNULL, agNULL); 1385285809Sscottl } 1386285809Sscottl else 1387285809Sscottl { 1388285809Sscottl /* no portcontext.- error */ 1389285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_DOWN PhyDown pPort is NULL.\n")); 1390285809Sscottl } 1391285809Sscottl 1392285809Sscottl /* set PHY_DOWN status */ 1393285809Sscottl PHY_STATUS_SET(pPhy, PHY_DOWN); 1394285809Sscottl break; 1395285809Sscottl } 1396285809Sscottl case OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC: 1397285809Sscottl { 1398285809Sscottl agsaPhyErrCountersPage_t errorParam; 1399285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1400285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1401285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1402285809Sscottl errorParam.inboundCRCError = eventParam; 1403285809Sscottl /* report PhyId, NPIP, PortState */ 1404285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1405285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_INBOUND_CRC, phyId, (void *)&errorParam, agNULL); 1406285809Sscottl break; 1407285809Sscottl } 1408285809Sscottl case OSSA_HW_EVENT_HARD_RESET_RECEIVED: 1409285809Sscottl { 1410285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_HARD_RESET_RECEIVED, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1411285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1412285809Sscottl /* report PhyId, NPIP, PortState */ 1413285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1414285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_HARD_RESET_RECEIVED, phyId, agNULL, agNULL); 1415285809Sscottl break; 1416285809Sscottl } 1417285809Sscottl case OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD: 1418285809Sscottl { 1419285809Sscottl agsaPhyErrCountersPage_t errorParam; 1420285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_LINK_ERR_INVALID_DWORD, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1421285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1422285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1423285809Sscottl errorParam.invalidDword = eventParam; 1424285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1425285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_INVALID_DWORD, phyId, (void *)&errorParam, agNULL); 1426285809Sscottl break; 1427285809Sscottl } 1428285809Sscottl case OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR: 1429285809Sscottl { 1430285809Sscottl agsaPhyErrCountersPage_t errorParam; 1431285809Sscottl SA_DBG3(("mpiHWEvent: OSSA_HW_EVENT_LINK_ERR_DISPARITY_ERROR, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1432285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1433285809Sscottl /* report PhyId, NPIP, PortState */ 1434285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1435285809Sscottl errorParam.runningDisparityError = eventParam; 1436285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1437285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_DISPARITY_ERROR, phyId, (void *)&errorParam, agNULL); 1438285809Sscottl break; 1439285809Sscottl } 1440285809Sscottl case OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION: 1441285809Sscottl { 1442285809Sscottl agsaPhyErrCountersPage_t errorParam; 1443285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_LINK_ERR_CODE_VIOLATION, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1444285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1445285809Sscottl /* report PhyId, NPIP, PortState */ 1446285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1447285809Sscottl errorParam.codeViolation = eventParam; 1448285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1449285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_CODE_VIOLATION, phyId, (void *)&errorParam, agNULL); 1450285809Sscottl break; 1451285809Sscottl } 1452285809Sscottl case OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH: 1453285809Sscottl { 1454285809Sscottl agsaPhyErrCountersPage_t errorParam; 1455285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_LINK_ERR_LOSS_OF_DWORD_SYNCH, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1456285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1457285809Sscottl /* report PhyId, NPIP, PortState */ 1458285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1459285809Sscottl errorParam.lossOfDwordSynch = eventParam; 1460285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1461285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_LOSS_OF_DWORD_SYNCH, phyId, (void *)&errorParam, agNULL); 1462285809Sscottl break; 1463285809Sscottl } 1464285809Sscottl case OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO: 1465285809Sscottl { 1466285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1467285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1468285809Sscottl 1469285809Sscottl if (agNULL != agPortContext) 1470285809Sscottl { 1471285809Sscottl pPort = (agsaPort_t *) (agPortContext->sdkData); 1472285809Sscottl } 1473285809Sscottl else 1474285809Sscottl { 1475285809Sscottl SA_ASSERT((agPortContext), "agPortContext agNULL was there a PHY UP?"); 1476285809Sscottl return(AGSA_RC_FAILURE); 1477285809Sscottl } 1478285809Sscottl 1479285809Sscottl /* report PhyId, NPIP, PortState */ 1480285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1481285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO, phyId, agNULL, agNULL); 1482285809Sscottl 1483285809Sscottl if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK)) 1484285809Sscottl { 1485285809Sscottl pPort->status &= ~PORT_INVALIDATING; 1486285809Sscottl saRoot->PortMap[portId].PortStatus &= ~PORT_INVALIDATING; 1487285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO NOT PORT_INVALIDATING portID %d PortContext %p\n", portId, agPortContext)); 1488285809Sscottl } 1489285809Sscottl else 1490285809Sscottl { 1491285809Sscottl if (OSSA_PORT_INVALID == (npipps & PORT_STATE_MASK)) 1492285809Sscottl { 1493285809Sscottl /* set port invalid flag */ 1494285809Sscottl pPort->status |= PORT_INVALIDATING; 1495285809Sscottl saRoot->PortMap[portId].PortStatus |= PORT_INVALIDATING; 1496285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RECOVERY_TIMER_TMO PORT_INVALIDATING portID %d PortContext %p\n", portId, agPortContext)); 1497285809Sscottl } 1498285809Sscottl else 1499285809Sscottl { 1500285809Sscottl if (OSSA_PORT_IN_RESET == (npipps & PORT_STATE_MASK)) 1501285809Sscottl { 1502285809Sscottl SA_DBG1(("mpiHWEvent: PortInReset portID %d PortContext %p\n", portId, agPortContext)); 1503285809Sscottl } 1504285809Sscottl } 1505285809Sscottl } 1506285809Sscottl break; 1507285809Sscottl } 1508285809Sscottl case OSSA_HW_EVENT_PORT_RECOVER: 1509285809Sscottl { 1510285809Sscottl if (agNULL != agPortContext) 1511285809Sscottl { 1512285809Sscottl pPort = (agsaPort_t *) (agPortContext->sdkData); 1513285809Sscottl } 1514285809Sscottl 1515285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RECOVER, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1516285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1517285809Sscottl 1518285809Sscottl if (OSSA_PORT_VALID == (npipps & PORT_STATE_MASK)) 1519285809Sscottl { 1520285809Sscottl if (agNULL != pPort) 1521285809Sscottl { 1522285809Sscottl /* reset port invalid flag */ 1523285809Sscottl pPort->status &= ~PORT_INVALIDATING; 1524285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RECOVER NOT PORT_INVALIDATING portID %d PortContext %p\n", portId, agPortContext)); 1525285809Sscottl } 1526285809Sscottl saRoot->PortMap[portId].PortStatus &= ~PORT_INVALIDATING; 1527285809Sscottl } 1528285809Sscottl /* get SAS Identify info */ 1529285809Sscottl IDframe = (agsaSASIdentify_t *)&pIomb->sasIdentify; 1530285809Sscottl /* report PhyId, NPIP, PortState and LinkRate */ 1531285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16) | (linkRate << SHIFT8); 1532285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PORT_RECOVER, phyId, agNULL, (void *)IDframe); 1533285809Sscottl break; 1534285809Sscottl } 1535285809Sscottl case OSSA_HW_EVENT_PHY_STOP_STATUS: 1536285809Sscottl { 1537285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS PhyId=0x%x, status=0x%x eventParam=0x%x\n", phyId, status,eventParam)); 1538285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaHWEvent_SPC_OUB_t, EVParam)); 1539285809Sscottl 1540285809Sscottl switch(eventParam) 1541285809Sscottl { 1542285809Sscottl case 0: 1543285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS Stopped 0\n" )); 1544285809Sscottl break; 1545285809Sscottl case 1: 1546285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS INVALID_PHY 1\n" )); 1547285809Sscottl break; 1548285809Sscottl case 2: 1549285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS DEVICES_ATTACHED 2\n" )); 1550285809Sscottl break; 1551285809Sscottl case 3: 1552285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS OTHER_FAILURE 3\n" )); 1553285809Sscottl break; 1554285809Sscottl case 4: 1555285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS PHY_NOT_ENABLED 4\n" )); 1556285809Sscottl break; 1557285809Sscottl default: 1558285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS Unknown code 0x%x\n", eventParam)); 1559285809Sscottl break; 1560285809Sscottl } 1561285809Sscottl 1562285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_STOP_STATUS phyId 0x%x status 0x%x eventParam 0x%x\n", phyId, status,eventParam)); 1563285809Sscottl /* get request from IOMap */ 1564285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 1565285809Sscottl SA_ASSERT((pRequest), "pRequest NULL"); 1566285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 1567285809Sscottl 1568285809Sscottl agContext = saRoot->IOMap[tag].agContext; 1569285809Sscottl 1570285809Sscottl siPhyStopCB(agRoot, phyId, status, agContext, portId, npipps); 1571285809Sscottl 1572285809Sscottl /* remove the request from IOMap */ 1573285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 1574285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 1575285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 1576285809Sscottl 1577285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1578285809Sscottl pRequest->valid = agFALSE; 1579285809Sscottl /* return the request to free pool */ 1580285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 1581285809Sscottl { 1582285809Sscottl SA_DBG1(("mpiHWevent: saving pRequest (%p) for later use\n", pRequest)); 1583285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 1584285809Sscottl } 1585285809Sscottl else 1586285809Sscottl { 1587285809Sscottl /* return the request to free pool */ 1588285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 1589285809Sscottl } 1590285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1591285809Sscottl break; 1592285809Sscottl } 1593285809Sscottl case OSSA_HW_EVENT_BROADCAST_CHANGE: 1594285809Sscottl { 1595285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_BROADCAST_CHANGE, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1596285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1597285809Sscottl /* report PhyId, NPIP, PortState */ 1598285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1599285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_BROADCAST_CHANGE, phyId, agNULL, agNULL); 1600285809Sscottl break; 1601285809Sscottl } 1602285809Sscottl case OSSA_HW_EVENT_BROADCAST_SES: 1603285809Sscottl { 1604285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_BROADCAST_CHANGE_SES, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1605285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1606285809Sscottl /* report PhyId, NPIP, PortState */ 1607285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1608285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_BROADCAST_SES, phyId, agNULL, agNULL); 1609285809Sscottl break; 1610285809Sscottl } 1611285809Sscottl case OSSA_HW_EVENT_BROADCAST_EXP: 1612285809Sscottl { 1613285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_BROADCAST_EXP, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1614285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1615285809Sscottl /* report PhyId, NPIP, PortState */ 1616285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1617285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_BROADCAST_EXP, phyId, agNULL, agNULL); 1618285809Sscottl break; 1619285809Sscottl } 1620285809Sscottl case OSSA_HW_EVENT_ID_FRAME_TIMEOUT: 1621285809Sscottl { 1622285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_ID_FRAME_TIMEOUT, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1623285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1624285809Sscottl /* report PhyId, NPIP, PortState */ 1625285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1626285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_ID_FRAME_TIMEOUT, phyId, agNULL, agNULL); 1627285809Sscottl break; 1628285809Sscottl } 1629285809Sscottl case OSSA_HW_EVENT_PHY_START_STATUS: 1630285809Sscottl { 1631285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaHWEvent_SPC_OUB_t, EVParam)) ; 1632285809Sscottl /* get request from IOMap */ 1633285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 1634285809Sscottl 1635285809Sscottl SA_ASSERT((pRequest), "pRequest"); 1636285809Sscottl if( pRequest == agNULL) 1637285809Sscottl { 1638285809Sscottl SA_DBG1(("mpiHWevent: pRequest (%p) NULL\n", pRequest)); 1639285809Sscottl ret = AGSA_RC_FAILURE; 1640285809Sscottl break; 1641285809Sscottl } 1642285809Sscottl 1643285809Sscottl agContext = saRoot->IOMap[tag].agContext; 1644285809Sscottl 1645285809Sscottl /* makeup for CB */ 1646285809Sscottl status = (status << 8) | phyId; 1647285809Sscottl ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_PHY_START_STATUS, status, agContext, agNULL); 1648285809Sscottl 1649285809Sscottl /* remove the request from IOMap */ 1650285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 1651285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 1652285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 1653285809Sscottl 1654285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1655285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 1656285809Sscottl pRequest->valid = agFALSE; 1657285809Sscottl /* return the request to free pool */ 1658285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 1659285809Sscottl { 1660285809Sscottl SA_DBG1(("mpiHWevent: saving pRequest (%p) for later use\n", pRequest)); 1661285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 1662285809Sscottl } 1663285809Sscottl else 1664285809Sscottl { 1665285809Sscottl /* return the request to free pool */ 1666285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 1667285809Sscottl } 1668285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 1669285809Sscottl 1670285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_START_STATUS, PhyID %d\n", phyId)); 1671285809Sscottl 1672285809Sscottl break; 1673285809Sscottl } 1674285809Sscottl case OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED: 1675285809Sscottl { 1676285809Sscottl agsaPhyErrCountersPage_t errorParam; 1677285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED, PhyID %d PortID %d NPIP 0x%x PS 0x%x\n", 1678285809Sscottl phyId, portId, (npipps & PHY_IN_PORT_MASK) >> SHIFT4, npipps & PORT_STATE_MASK)); 1679285809Sscottl /* report PhyId, NPIP, PortState */ 1680285809Sscottl si_memset(&errorParam, 0, sizeof(agsaPhyErrCountersPage_t)); 1681285809Sscottl errorParam.phyResetProblem = eventParam; 1682285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1683285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PHY_ERR_PHY_RESET_FAILED, phyId, (void *)&errorParam, agNULL); 1684285809Sscottl break; 1685285809Sscottl } 1686285809Sscottl case OSSA_HW_EVENT_PORT_RESET_TIMER_TMO: 1687285809Sscottl { 1688285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RESET_TIMER_TMO, PhyID %d PortID %d\n", phyId, portId)); 1689285809Sscottl /* report PhyId, NPIP, PortState */ 1690285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1691285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PORT_RESET_TIMER_TMO, phyId, agNULL, agNULL); 1692285809Sscottl break; 1693285809Sscottl } 1694285809Sscottl case OSSA_HW_EVENT_PORT_RESET_COMPLETE: 1695285809Sscottl { 1696285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_PORT_RESET_COMPLETE, PhyID %d PortID %d\n", phyId, portId)); 1697285809Sscottl /* get SAS Identify info */ 1698285809Sscottl IDframe = (agsaSASIdentify_t *)&pIomb->sasIdentify; 1699285809Sscottl /* report PhyId, NPIP, PortState and LinkRate */ 1700285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16) | (linkRate << SHIFT8); 1701285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_PORT_RESET_COMPLETE, phyId, agNULL, (void *)IDframe); 1702285809Sscottl break; 1703285809Sscottl } 1704285809Sscottl case OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT: 1705285809Sscottl { 1706285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT, PhyID %d PortID %d\n", phyId, portId)); 1707285809Sscottl /* report PhyId, NPIP, PortState */ 1708285809Sscottl phyId |= (npipps & PHY_IN_PORT_MASK) | ((npipps & PORT_STATE_MASK) << SHIFT16); 1709285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_BROADCAST_ASYNCH_EVENT, phyId, agNULL, agNULL); 1710285809Sscottl break; 1711285809Sscottl } 1712285809Sscottl case OSSA_HW_EVENT_IT_NEXUS_LOSS: 1713285809Sscottl { 1714285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_IT_NEXUS_LOSS, PhyID %d PortID %d status 0x%X\n", phyId, portId,status)); 1715285809Sscottl break; 1716285809Sscottl } 1717285809Sscottl case OSSA_HW_EVENT_OPEN_RETRY_BACKOFF_THR_ADJUSTED: 1718285809Sscottl { 1719285809Sscottl SA_DBG1(("mpiHWEvent: OSSA_HW_EVENT_OPEN_RETRY_BACKOFF_THR_ADJUSTED, PhyID %d PortID %d status 0x%X\n", phyId, portId,status)); 1720285809Sscottl ossaHwCB(agRoot, agPortContext, OSSA_HW_EVENT_OPEN_RETRY_BACKOFF_THR_ADJUSTED, phyId, agNULL, agNULL); 1721285809Sscottl break; 1722285809Sscottl } 1723285809Sscottl 1724285809Sscottl default: 1725285809Sscottl { 1726285809Sscottl SA_DBG1(("mpiHWEvent: Unknown HW Event 0x%x status 0x%X\n", Event ,status)); 1727285809Sscottl break; 1728285809Sscottl } 1729285809Sscottl } 1730285809Sscottl 1731285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2j"); 1732285809Sscottl return ret; 1733285809Sscottl} 1734285809Sscottl 1735285809Sscottl/******************************************************************************/ 1736285809Sscottl/*! \brief SPC MPI SMP Completion 1737285809Sscottl * 1738285809Sscottl * This function handles the SMP completion. 1739285809Sscottl * 1740285809Sscottl * \param agRoot Handles for this instance of SAS/SATA hardware 1741285809Sscottl * \param pIomb pointer of Message1 1742285809Sscottl * \param bc buffer count 1743285809Sscottl * 1744285809Sscottl * \return The read value 1745285809Sscottl * 1746285809Sscottl */ 1747285809Sscottl/*******************************************************************************/ 1748285809SscottlGLOBAL bit32 mpiSMPCompletion( 1749285809Sscottl agsaRoot_t *agRoot, 1750285809Sscottl agsaSMPCompletionRsp_t *pIomb 1751285809Sscottl ) 1752285809Sscottl{ 1753285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 1754285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 1755285809Sscottl bit32 status; 1756285809Sscottl bit32 tag; 1757285809Sscottl bit32 param; 1758285809Sscottl agsaIORequestDesc_t *pRequest; 1759285809Sscottl 1760285809Sscottl SA_DBG3(("mpiSMPCompletion: start, HTAG=0x%x\n", pIomb->tag)); 1761285809Sscottl 1762285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2k"); 1763285809Sscottl 1764285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSMPCompletionRsp_t, tag)) ; 1765285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSMPCompletionRsp_t, status)) ; 1766285809Sscottl OSSA_READ_LE_32(AGROOT, ¶m, pIomb, OSSA_OFFSET_OF(agsaSMPCompletionRsp_t, param)) ; 1767285809Sscottl /* get SMP request from IOMap */ 1768285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 1769285809Sscottl if (agNULL == pRequest) 1770285809Sscottl { 1771285809Sscottl SA_DBG1(("mpiSMPCompletion: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x PARAM=0x%x\n", tag, status, param)); 1772285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2k"); 1773285809Sscottl return AGSA_RC_FAILURE; 1774285809Sscottl } 1775285809Sscottl 1776285809Sscottl switch (status) 1777285809Sscottl { 1778285809Sscottl case OSSA_IO_SUCCESS: 1779285809Sscottl SA_DBG3(("mpiSMPCompletion: OSSA_IO_SUCCESS HTAG = 0x%x\n", tag)); 1780285809Sscottl /* process message */ 1781285809Sscottl siSMPRespRcvd(agRoot, pIomb, param, tag); 1782285809Sscottl break; 1783285809Sscottl 1784285809Sscottl case OSSA_IO_OVERFLOW: 1785285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OVERFLOW HTAG = 0x%x\n", tag)); 1786285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OVERFLOW++; 1787285809Sscottl /* SMP failed */ 1788285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1789285809Sscottl break; 1790285809Sscottl 1791285809Sscottl case OSSA_IO_ABORTED: 1792285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_ABORTED HTAG = 0x%x\n", tag)); 1793285809Sscottl 1794285809Sscottl saRoot->IoErrorCount.agOSSA_IO_ABORTED++; 1795285809Sscottl#ifdef SA_PRINTOUT_IN_WINDBG 1796285809Sscottl#ifndef DBG 1797285809Sscottl DbgPrint("agOSSA_IO_ABORTED %d\n", saRoot->IoErrorCount.agOSSA_IO_ABORTED); 1798285809Sscottl#endif /* DBG */ 1799285809Sscottl#endif /* SA_PRINTOUT_IN_WINDBG */ 1800285809Sscottl /* SMP failed */ 1801285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1802285809Sscottl break; 1803285809Sscottl 1804285809Sscottl case OSSA_IO_NO_DEVICE: 1805285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_NO_DEVICE HTAG = 0x%x\n", tag)); 1806285809Sscottl saRoot->IoErrorCount.agOSSA_IO_NO_DEVICE++; 1807285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1808285809Sscottl break; 1809285809Sscottl 1810285809Sscottl case OSSA_IO_ERROR_HW_TIMEOUT: 1811285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_ERROR_HW_TIMEOUT HTAG = 0x%x\n", tag)); 1812285809Sscottl saRoot->IoErrorCount.agOSSA_IO_ERROR_HW_TIMEOUT++; 1813285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1814285809Sscottl break; 1815285809Sscottl 1816285809Sscottl case OSSA_IO_XFER_ERROR_BREAK: 1817285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_XFER_ERROR_BREAK HTAG = 0x%x\n", tag)); 1818285809Sscottl saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_BREAK++; 1819285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1820285809Sscottl break; 1821285809Sscottl 1822285809Sscottl case OSSA_IO_XFER_ERROR_PHY_NOT_READY: 1823285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_XFER_ERROR_PHY_NOT_READY HTAG = 0x%x\n", tag)); 1824285809Sscottl saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_PHY_NOT_READY++; 1825285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1826285809Sscottl break; 1827285809Sscottl 1828285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED: 1829285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED HTAG = 0x%x\n", tag)); 1830285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED++; 1831285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1832285809Sscottl break; 1833285809Sscottl 1834285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION: 1835285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION HTAG = 0x%x\n", tag)); 1836285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION++; 1837285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1838285809Sscottl break; 1839285809Sscottl 1840285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BREAK: 1841285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_BREAK HTAG = 0x%x\n", tag)); 1842285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BREAK++; 1843285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1844285809Sscottl break; 1845285809Sscottl 1846285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: 1847285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS HTAG = 0x%x\n", tag)); 1848285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS++; 1849285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1850285809Sscottl break; 1851285809Sscottl 1852285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION: 1853285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION HTAG = 0x%x\n", tag)); 1854285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION++; 1855285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1856285809Sscottl break; 1857285809Sscottl 1858285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED: 1859285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED HTAG = 0x%x\n", tag)); 1860285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED++; 1861285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1862285809Sscottl break; 1863285809Sscottl 1864285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION: 1865285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION HTAG = 0x%x\n", tag)); 1866285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION++; 1867285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1868285809Sscottl break; 1869285809Sscottl 1870285809Sscottl case OSSA_IO_XFER_ERROR_RX_FRAME: 1871285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_XFER_ERROR_RX_FRAME HTAG = 0x%x\n", tag)); 1872285809Sscottl saRoot->IoErrorCount.agOSSA_IO_XFER_ERROR_RX_FRAME++; 1873285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1874285809Sscottl break; 1875285809Sscottl 1876285809Sscottl case OSSA_IO_XFER_OPEN_RETRY_TIMEOUT: 1877285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_XFER_OPEN_RETRY_TIMEOUT HTAG = 0x%x\n", tag)); 1878285809Sscottl saRoot->IoErrorCount.agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT++; 1879285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1880285809Sscottl break; 1881285809Sscottl 1882285809Sscottl case OSSA_IO_ERROR_INTERNAL_SMP_RESOURCE: 1883285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_ERROR_INTERNAL_SMP_RESOURCE HTAG = 0x%x\n", tag)); 1884285809Sscottl saRoot->IoErrorCount.agOSSA_IO_ERROR_INTERNAL_SMP_RESOURCE++; 1885285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1886285809Sscottl break; 1887285809Sscottl 1888285809Sscottl case OSSA_IO_PORT_IN_RESET: 1889285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_PORT_IN_RESET HTAG = 0x%x\n", tag)); 1890285809Sscottl saRoot->IoErrorCount.agOSSA_IO_PORT_IN_RESET++; 1891285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1892285809Sscottl break; 1893285809Sscottl 1894285809Sscottl case OSSA_IO_DS_NON_OPERATIONAL: 1895285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_DS_NON_OPERATIONAL HTAG = 0x%x\n", tag)); 1896285809Sscottl saRoot->IoErrorCount.agOSSA_IO_DS_NON_OPERATIONAL++; 1897285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1898285809Sscottl break; 1899285809Sscottl 1900285809Sscottl case OSSA_IO_DS_IN_RECOVERY: 1901285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_DS_IN_RECOVERY HTAG = 0x%x\n", tag)); 1902285809Sscottl saRoot->IoErrorCount.agOSSA_IO_DS_IN_RECOVERY++; 1903285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1904285809Sscottl break; 1905285809Sscottl 1906285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY: 1907285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY HTAG = 0x%x\n", tag)); 1908285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY++; 1909285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1910285809Sscottl break; 1911285809Sscottl 1912285809Sscottl case OSSA_IO_ABORT_IN_PROGRESS: 1913285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_ABORT_IN_PROGRESS HTAG = 0x%x\n", tag)); 1914285809Sscottl saRoot->IoErrorCount.agOSSA_IO_ABORT_IN_PROGRESS++; 1915285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1916285809Sscottl break; 1917285809Sscottl 1918285809Sscottl case OSSA_IO_ABORT_DELAYED: 1919285809Sscottl SA_DBG1(("mpiSMPCompletion:OSSA_IO_ABORT_DELAYED HTAG = 0x%x\n", tag)); 1920285809Sscottl saRoot->IoErrorCount.agOSSA_IO_ABORT_DELAYED++; 1921285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1922285809Sscottl break; 1923285809Sscottl 1924285809Sscottl case OSSA_IO_INVALID_LENGTH: 1925285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_INVALID_LENGTH HTAG = 0x%x\n", tag)); 1926285809Sscottl saRoot->IoErrorCount.agOSSA_IO_INVALID_LENGTH++; 1927285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1928285809Sscottl break; 1929285809Sscottl 1930285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED: 1931285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED HTAG = 0x%x\n", tag)); 1932285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED++; 1933285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1934285809Sscottl break; 1935285809Sscottl 1936285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO: 1937285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO HTAG = 0x%x\n", tag)); 1938285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO++; 1939285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1940285809Sscottl break; 1941285809Sscottl 1942285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST: 1943285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST HTAG = 0x%x\n", tag)); 1944285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++; 1945285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1946285809Sscottl break; 1947285809Sscottl 1948285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE: 1949285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE HTAG = 0x%x\n", tag)); 1950285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++; 1951285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1952285809Sscottl break; 1953285809Sscottl 1954285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED: 1955285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED HTAG = 0x%x\n", tag)); 1956285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED++; 1957285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1958285809Sscottl break; 1959285809Sscottl 1960285809Sscottl case OSSA_IO_DS_INVALID: 1961285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_DS_INVALID HTAG = 0x%x\n", tag)); 1962285809Sscottl saRoot->IoErrorCount.agOSSA_IO_DS_INVALID++; 1963285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1964285809Sscottl break; 1965285809Sscottl 1966285809Sscottl case OSSA_IO_XFER_READ_COMPL_ERR: 1967285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_XFER_READ_COMPL_ERR HTAG = 0x%x\n", tag)); 1968285809Sscottl saRoot->IoErrorCount.agOSSA_IO_XFER_READ_COMPL_ERR++; 1969285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1970285809Sscottl break; 1971285809Sscottl 1972285809Sscottl case OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE: 1973285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE HTAG = 0x%x\n", tag)); 1974285809Sscottl saRoot->IoErrorCount.agOSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE++; 1975285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1976285809Sscottl break; 1977285809Sscottl 1978285809Sscottl case OSSA_MPI_ERR_OFFLOAD_DIF_OR_ENC_NOT_ENABLED: 1979285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_MPI_ERR_IO_RESOURCE_UNAVAILABLE HTAG = 0x%x\n", tag)); 1980285809Sscottl saRoot->IoErrorCount.agOSSA_MPI_ERR_OFFLOAD_DIF_OR_ENC_NOT_ENABLED++; 1981285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1982285809Sscottl break; 1983285809Sscottl 1984285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED: 1985285809Sscottl SA_DBG1(("mpiSMPCompletion: OSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED HTAG = 0x%x\n", tag)); 1986285809Sscottl saRoot->IoErrorCount.agOSSA_IO_OPEN_CNX_ERROR_OPEN_PREEMPTED++; 1987285809Sscottl siAbnormal(agRoot, pRequest, status, 0, 0); 1988285809Sscottl break; 1989285809Sscottl 1990285809Sscottl default: 1991285809Sscottl SA_DBG1(("mpiSMPCompletion: Unknown Status = 0x%x Tag 0x%x\n", status, tag)); 1992285809Sscottl saRoot->IoErrorCount.agOSSA_IO_UNKNOWN_ERROR++; 1993285809Sscottl /* not allowed case. Therefore, assert */ 1994285809Sscottl SA_ASSERT((agFALSE), "mpiSMPCompletion: Unknown Status"); 1995285809Sscottl break; 1996285809Sscottl } 1997285809Sscottl 1998285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2k"); 1999285809Sscottl return ret; 2000285809Sscottl} 2001285809Sscottl 2002285809Sscottl/******************************************************************************/ 2003285809Sscottl/*! \brief SPC MPI Get Device Handle Command Response 2004285809Sscottl * 2005285809Sscottl * This function handles the response of Get Device Handle Command. 2006285809Sscottl * 2007285809Sscottl * \param agRoot Handles for this instance of SAS/SATA hardware 2008285809Sscottl * \param pIomb pointer of Message 2009285809Sscottl * \param bc buffer count 2010285809Sscottl * 2011285809Sscottl * \return The read value 2012285809Sscottl * 2013285809Sscottl */ 2014285809Sscottl/*******************************************************************************/ 2015285809SscottlGLOBAL bit32 mpiGetDevHandleRsp( 2016285809Sscottl agsaRoot_t *agRoot, 2017285809Sscottl agsaGetDevHandleRsp_t *pIomb 2018285809Sscottl ) 2019285809Sscottl{ 2020285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2021285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 2022285809Sscottl agsaIORequestDesc_t *pRequest; 2023285809Sscottl agsaPortContext_t *agPortContext; 2024285809Sscottl agsaContext_t *agContext; 2025285809Sscottl agsaDeviceDesc_t *pDevice; 2026285809Sscottl bit8 portId; 2027285809Sscottl bit32 deviceid=0, deviceIdc, i; 2028285809Sscottl bit32 DeviceIdcPortId, tag; 2029285809Sscottl 2030285809Sscottl SA_DBG3(("mpiGetDevHandleRsp: start, HTAG=0x%x\n", pIomb->tag)); 2031285809Sscottl 2032285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2m"); 2033285809Sscottl 2034285809Sscottl OSSA_READ_LE_32(AGROOT, &DeviceIdcPortId, pIomb, OSSA_OFFSET_OF(agsaGetDevHandleRsp_t, DeviceIdcPortId)) ; 2035285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetDevHandleRsp_t, tag)) ; 2036285809Sscottl /* get request from IOMap */ 2037285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2038285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2039285809Sscottl /* remove the request from IOMap */ 2040285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2041285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2042285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2043285809Sscottl if (agNULL == pRequest) 2044285809Sscottl { 2045285809Sscottl SA_DBG1(("mpiGetDevHandleRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x DeviceIdcPortId=0x%x\n", tag, DeviceIdcPortId)); 2046285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2m"); 2047285809Sscottl return AGSA_RC_FAILURE; 2048285809Sscottl } 2049285809Sscottl 2050285809Sscottl /* get port context */ 2051285809Sscottl portId = (bit8)(DeviceIdcPortId & PORTID_MASK); 2052285809Sscottl SA_DBG2(("mpiGetDevHandleRsp: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)); 2053285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext; 2054285809Sscottl 2055285809Sscottl /* get Device ID count */ 2056285809Sscottl deviceIdc = (bit8)((DeviceIdcPortId & DEVICE_IDC_BITS) >> SHIFT8); 2057285809Sscottl 2058285809Sscottl /* based on the deviceIDC to get all device handles */ 2059285809Sscottl for (i = 0; i < deviceIdc; i++) 2060285809Sscottl { 2061285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pIomb, OSSA_OFFSET_OF(agsaGetDevHandleRsp_t, deviceId[i])) ; 2062285809Sscottl /* find device handle from device index */ 2063285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 2064285809Sscottl if (pDevice->targetDevHandle.sdkData) 2065285809Sscottl saRoot->DeviceHandle[i] = &(pDevice->targetDevHandle); 2066285809Sscottl else 2067285809Sscottl saRoot->DeviceHandle[i] = &(pDevice->initiatorDevHandle); 2068285809Sscottl } 2069285809Sscottl 2070285809Sscottl SA_DBG1(("mpiGetDevHandleRsp:deviceid 0x%x 0x%x\n",deviceid, (deviceid & DEVICE_ID_BITS))); 2071285809Sscottl /* call back oslayer */ 2072285809Sscottl ossaGetDeviceHandlesCB(agRoot, agContext, agPortContext, saRoot->DeviceHandle, deviceIdc); 2073285809Sscottl 2074285809Sscottl /* return the request to free pool */ 2075285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2076285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 2077285809Sscottl pRequest->valid = agFALSE; 2078285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2079285809Sscottl { 2080285809Sscottl SA_DBG1(("mpiGetDevHandleRsp: saving pRequest (%p) for later use\n", pRequest)); 2081285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2082285809Sscottl } 2083285809Sscottl else 2084285809Sscottl { 2085285809Sscottl /* return the request to free pool */ 2086285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2087285809Sscottl } 2088285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2089285809Sscottl 2090285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2m"); 2091285809Sscottl 2092285809Sscottl return ret; 2093285809Sscottl} 2094285809Sscottl 2095285809Sscottl/******************************************************************************/ 2096285809Sscottl/*! \brief SPC MPI Phy Control Command Response 2097285809Sscottl * 2098285809Sscottl * This function handles the response of PHY Control Command. 2099285809Sscottl * 2100285809Sscottl * \param agRoot Handles for this instance of SAS/SATA hardware 2101285809Sscottl * \param pIomb pointer of Message 2102285809Sscottl * 2103285809Sscottl * \return The read value 2104285809Sscottl * 2105285809Sscottl */ 2106285809Sscottl/*******************************************************************************/ 2107285809SscottlGLOBAL bit32 mpiPhyCntrlRsp( 2108285809Sscottl agsaRoot_t *agRoot, 2109285809Sscottl agsaLocalPhyCntrlRsp_t *pIomb 2110285809Sscottl ) 2111285809Sscottl{ 2112285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2113285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 2114285809Sscottl agsaIORequestDesc_t *pRequest; 2115285809Sscottl agsaContext_t *agContext = agNULL; 2116285809Sscottl bit32 phyId, operation, status, tag, phyOpId; 2117285809Sscottl 2118285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2n"); 2119285809Sscottl 2120285809Sscottl SA_DBG3(("mpiPhyCntrlRsp: start, HTAG=0x%x,\n", pIomb->tag)); 2121285809Sscottl 2122285809Sscottl /* get tag */ 2123285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaLocalPhyCntrlRsp_t, tag)) ; 2124285809Sscottl OSSA_READ_LE_32(AGROOT, &phyOpId, pIomb, OSSA_OFFSET_OF(agsaLocalPhyCntrlRsp_t, phyOpId)) ; 2125285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaLocalPhyCntrlRsp_t, status)) ; 2126285809Sscottl /* get request from IOMap */ 2127285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2128285809Sscottl if (agNULL == pRequest) 2129285809Sscottl { 2130285809Sscottl SA_DBG1(("mpiPhyCntrlRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x PhyOpId=0x%x\n", tag, status, phyOpId)); 2131285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2n"); 2132285809Sscottl return AGSA_RC_FAILURE; 2133285809Sscottl } 2134285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2135285809Sscottl /* remove the request from IOMap */ 2136285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2137285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2138285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2139285809Sscottl 2140285809Sscottl phyId = phyOpId & LOCAL_PHY_PHYID; 2141285809Sscottl operation = (phyOpId & LOCAL_PHY_OP_BITS) >> SHIFT8; 2142285809Sscottl 2143285809Sscottl 2144285809Sscottl SA_DBG3(("mpiPhyCntrlRsp: phyId=0x%x Operation=0x%x Status=0x%x\n", phyId, operation, status)); 2145285809Sscottl 2146285809Sscottl if( pRequest->completionCB == agNULL ) 2147285809Sscottl { 2148285809Sscottl /* call back with the status */ 2149285809Sscottl ossaLocalPhyControlCB(agRoot, agContext, phyId, operation, status, agNULL); 2150285809Sscottl } 2151285809Sscottl else 2152285809Sscottl { 2153285809Sscottl (*(ossaLocalPhyControlCB_t)(pRequest->completionCB))(agRoot, agContext, phyId, operation, status, agNULL ); 2154285809Sscottl } 2155285809Sscottl 2156285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2157285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 2158285809Sscottl pRequest->valid = agFALSE; 2159285809Sscottl /* return the request to free pool */ 2160285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2161285809Sscottl { 2162285809Sscottl SA_DBG1(("mpiPhyCntrlRsp: saving pRequest (%p) for later use\n", pRequest)); 2163285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2164285809Sscottl } 2165285809Sscottl else 2166285809Sscottl { 2167285809Sscottl /* return the request to free pool */ 2168285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2169285809Sscottl } 2170285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2171285809Sscottl 2172285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2n"); 2173285809Sscottl return ret; 2174285809Sscottl} 2175285809Sscottl 2176285809Sscottl/******************************************************************************/ 2177285809Sscottl/*! \brief SPC MPI Device Register Command Response 2178285809Sscottl * 2179285809Sscottl * This function handles the response of Device Register Command. 2180285809Sscottl * 2181285809Sscottl * \param agRoot Handles for this instance of SAS/SATA hardware 2182285809Sscottl * \param pIomb pointer of Message 2183285809Sscottl * 2184285809Sscottl * \return The read value 2185285809Sscottl * 2186285809Sscottl */ 2187285809Sscottl/*******************************************************************************/ 2188285809SscottlGLOBAL bit32 mpiDeviceRegRsp( 2189285809Sscottl agsaRoot_t *agRoot, 2190285809Sscottl agsaDeviceRegistrationRsp_t *pIomb 2191285809Sscottl ) 2192285809Sscottl{ 2193285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2194285809Sscottl agsaLLRoot_t *saRoot = agNULL; 2195285809Sscottl agsaIORequestDesc_t *pRequest; 2196285809Sscottl agsaContext_t *agContext; 2197285809Sscottl bit32 deviceId; 2198285809Sscottl agsaDeviceDesc_t *pDevice = agNULL; 2199285809Sscottl agsaDeviceDesc_t *pDeviceRemove = agNULL; 2200285809Sscottl bit32 deviceIdx,status, tag; 2201285809Sscottl 2202285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2p"); 2203285809Sscottl 2204285809Sscottl /* sanity check */ 2205285809Sscottl SA_ASSERT((agNULL != agRoot), ""); 2206285809Sscottl saRoot = (agsaLLRoot_t *) (agRoot->sdkData); 2207285809Sscottl SA_ASSERT((agNULL != saRoot), ""); 2208285809Sscottl 2209285809Sscottl SA_DBG3(("mpiDeviceRegRsp: start, HTAG=0x%x\n", pIomb->tag)); 2210285809Sscottl 2211285809Sscottl SA_ASSERT((NULL != saRoot->DeviceRegistrationCB), "DeviceRegistrationCB can not be NULL"); 2212285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceId, pIomb, OSSA_OFFSET_OF(agsaDeviceRegistrationRsp_t, deviceId)) ; 2213285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaDeviceRegistrationRsp_t, tag)) ; 2214285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaDeviceRegistrationRsp_t, status)) ; 2215285809Sscottl 2216285809Sscottl SA_DBG1(("mpiDeviceRegRsp: deviceID 0x%x \n", deviceId)); 2217285809Sscottl 2218285809Sscottl /* get request from IOMap */ 2219285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2220285809Sscottl if (agNULL == pRequest) 2221285809Sscottl { 2222285809Sscottl SA_DBG1(("mpiDeviceRegRsp: Bad IOMB!!! pRequest is NULL. TAG=0x%x, STATUS=0x%x DEVICEID=0x%x\n", tag, status, deviceId)); 2223285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2p"); 2224285809Sscottl return AGSA_RC_FAILURE; 2225285809Sscottl } 2226285809Sscottl 2227285809Sscottl pDevice = pRequest->pDevice; 2228285809Sscottl 2229285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2230285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 2231285809Sscottl /* remove the request from IOMap */ 2232285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2233285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2234285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2235285809Sscottl 2236285809Sscottl /* get Device Id or status */ 2237285809Sscottl SA_DBG3(("mpiDeviceRegRsp: hosttag 0x%x\n", tag)); 2238285809Sscottl SA_DBG3(("mpiDeviceRegRsp: deviceID 0x%x Device Context %p\n", deviceId, pDevice)); 2239285809Sscottl 2240285809Sscottl if (agNULL == pDevice) 2241285809Sscottl { 2242285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2243285809Sscottl pRequest->valid = agFALSE; 2244285809Sscottl /* return the request to free pool */ 2245285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2246285809Sscottl { 2247285809Sscottl SA_DBG1(("mpiDeviceRegRsp: saving pRequest (%p) for later use\n", pRequest)); 2248285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2249285809Sscottl } 2250285809Sscottl else 2251285809Sscottl { 2252285809Sscottl /* return the request to free pool */ 2253285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2254285809Sscottl } 2255285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2256285809Sscottl 2257285809Sscottl SA_DBG1(("mpiDeviceRegRsp: warning!!! no device is found\n")); 2258285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2p"); 2259285809Sscottl return AGSA_RC_FAILURE; 2260285809Sscottl } 2261285809Sscottl 2262285809Sscottl if (agNULL == saRoot->DeviceRegistrationCB) 2263285809Sscottl { 2264285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2265285809Sscottl pRequest->valid = agFALSE; 2266285809Sscottl /* return the request to free pool */ 2267285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2268285809Sscottl { 2269285809Sscottl SA_DBG1(("mpiDeviceRegRsp: saving pRequest (%p) for later use\n", pRequest)); 2270285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2271285809Sscottl } 2272285809Sscottl else 2273285809Sscottl { 2274285809Sscottl /* return the request to free pool */ 2275285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2276285809Sscottl } 2277285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2278285809Sscottl 2279285809Sscottl SA_DBG1(("mpiDeviceRegRsp: warning!!! no DeviceRegistrationCB is found\n")); 2280285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2p"); 2281285809Sscottl return AGSA_RC_FAILURE; 2282285809Sscottl } 2283285809Sscottl 2284285809Sscottl 2285285809Sscottl if(smIS_SPCV(agRoot)) 2286285809Sscottl { 2287285809Sscottl switch( status) 2288285809Sscottl { 2289285809Sscottl case 0: 2290285809Sscottl status = OSSA_SUCCESS; 2291285809Sscottl break; 2292285809Sscottl case MPI_ERR_DEVICE_HANDLE_UNAVAILABLE: 2293285809Sscottl status = OSSA_FAILURE_OUT_OF_RESOURCE; 2294285809Sscottl break; 2295285809Sscottl case MPI_ERR_DEVICE_ALREADY_REGISTERED: 2296285809Sscottl status = OSSA_FAILURE_DEVICE_ALREADY_REGISTERED; 2297285809Sscottl break; 2298285809Sscottl case MPI_ERR_PHY_ID_INVALID: 2299285809Sscottl status = OSSA_FAILURE_INVALID_PHY_ID; 2300285809Sscottl break; 2301285809Sscottl case MPI_ERR_PHY_ID_ALREADY_REGISTERED: 2302285809Sscottl status = OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED; 2303285809Sscottl break; 2304285809Sscottl case MPI_ERR_PORT_INVALID_PORT_ID: 2305285809Sscottl status = OSSA_FAILURE_PORT_ID_OUT_OF_RANGE; 2306285809Sscottl break; 2307285809Sscottl case MPI_ERR_PORT_STATE_NOT_VALID: 2308285809Sscottl status = OSSA_FAILURE_PORT_NOT_VALID_STATE; 2309285809Sscottl break; 2310285809Sscottl case MPI_ERR_DEVICE_TYPE_NOT_VALID: 2311285809Sscottl status = OSSA_FAILURE_DEVICE_TYPE_NOT_VALID; 2312285809Sscottl break; 2313285809Sscottl default: 2314285809Sscottl SA_ASSERT((0), "DeviceRegistration Unknown status"); 2315285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2316285809Sscottl pRequest->valid = agFALSE; 2317285809Sscottl /* return the request to free pool */ 2318285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2319285809Sscottl { 2320285809Sscottl SA_DBG1(("mpiDeviceRegRsp: saving pRequest (%p) for later use\n", pRequest)); 2321285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2322285809Sscottl } 2323285809Sscottl else 2324285809Sscottl { 2325285809Sscottl /* return the request to free pool */ 2326285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2327285809Sscottl } 2328285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2329285809Sscottl 2330285809Sscottl return AGSA_RC_FAILURE; 2331285809Sscottl } 2332285809Sscottl } 2333285809Sscottl 2334285809Sscottl switch (status) 2335285809Sscottl { 2336285809Sscottl case OSSA_SUCCESS: 2337285809Sscottl /* mapping the device handle and device id */ 2338285809Sscottl deviceIdx = deviceId & DEVICE_ID_BITS; 2339285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 2340285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceIdFromFW = deviceId; 2341285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceHandle = (void *)pDevice; 2342285809Sscottl pDevice->DeviceMapIndex = deviceId; 2343285809Sscottl 2344285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2345285809Sscottl agContext, 2346285809Sscottl OSSA_SUCCESS, 2347285809Sscottl &pDevice->targetDevHandle, 2348285809Sscottl deviceId 2349285809Sscottl ); 2350285809Sscottl 2351285809Sscottl break; 2352285809Sscottl case OSSA_FAILURE_OUT_OF_RESOURCE: 2353285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_OUT_OF_RESOURCE\n")); 2354285809Sscottl /* remove device from LL device list */ 2355285809Sscottl siPortDeviceRemove(agRoot, pDevice->pPort, pDevice, agFALSE); 2356285809Sscottl 2357285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2358285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2359285809Sscottl agContext, 2360285809Sscottl OSSA_FAILURE_OUT_OF_RESOURCE, 2361285809Sscottl &pDevice->targetDevHandle, 2362285809Sscottl deviceId 2363285809Sscottl ); 2364285809Sscottl 2365285809Sscottl 2366285809Sscottl break; 2367285809Sscottl case OSSA_FAILURE_DEVICE_ALREADY_REGISTERED: 2368285809Sscottl /* get original device handle and device id */ 2369285809Sscottl pDeviceRemove = pDevice; 2370285809Sscottl deviceIdx = deviceId & DEVICE_ID_BITS; 2371285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 2372285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceIdx].DeviceHandle; 2373285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_DEVICE_ALREADY_REGISTERED, existing deviceContext %p\n", pDevice)); 2374285809Sscottl /* no auto registration */ 2375285809Sscottl if (pDevice != agNULL) 2376285809Sscottl { 2377285809Sscottl /* remove device from LL device list */ 2378285809Sscottl siPortDeviceListRemove(agRoot, pDevice->pPort, pDeviceRemove); 2379285809Sscottl 2380285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2381285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2382285809Sscottl agContext, 2383285809Sscottl OSSA_FAILURE_DEVICE_ALREADY_REGISTERED, 2384285809Sscottl &pDevice->targetDevHandle, 2385285809Sscottl deviceId 2386285809Sscottl ); 2387285809Sscottl } 2388285809Sscottl else 2389285809Sscottl { 2390285809Sscottl SA_DBG1(("mpiDeviceRegRsp: pDevice is NULL. TAG=0x%x, STATUS=0x%x DEVICEID=0x%x\n", tag, status, deviceId)); 2391285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2p"); 2392285809Sscottl return AGSA_RC_FAILURE; 2393285809Sscottl } 2394285809Sscottl 2395285809Sscottl break; 2396285809Sscottl case OSSA_FAILURE_INVALID_PHY_ID: 2397285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_INVALID_PHY_ID\n")); 2398285809Sscottl /* remove device from LL device list */ 2399285809Sscottl siPortDeviceRemove(agRoot, pDevice->pPort, pDevice, agFALSE); 2400285809Sscottl 2401285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2402285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2403285809Sscottl agContext, 2404285809Sscottl OSSA_FAILURE_INVALID_PHY_ID, 2405285809Sscottl &pDevice->targetDevHandle, 2406285809Sscottl deviceId 2407285809Sscottl ); 2408285809Sscottl break; 2409285809Sscottl case OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED: 2410285809Sscottl /* get original device handle and device id */ 2411285809Sscottl pDeviceRemove = pDevice; 2412285809Sscottl deviceIdx = deviceId & DEVICE_ID_BITS; 2413285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 2414285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceIdx].DeviceHandle; 2415285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED, existing deviceContext %p\n", pDevice)); 2416285809Sscottl /* no auto registration */ 2417285809Sscottl if (pDevice != agNULL) 2418285809Sscottl { 2419285809Sscottl /* remove device from LL device list */ 2420285809Sscottl siPortDeviceListRemove(agRoot, pDevice->pPort, pDeviceRemove); 2421285809Sscottl 2422285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2423285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2424285809Sscottl agContext, 2425285809Sscottl OSSA_FAILURE_PHY_ID_ALREADY_REGISTERED, 2426285809Sscottl &pDevice->targetDevHandle, 2427285809Sscottl deviceId 2428285809Sscottl ); 2429285809Sscottl } 2430285809Sscottl else 2431285809Sscottl { 2432285809Sscottl SA_DBG1(("mpiDeviceRegRsp: pDevice is NULL. TAG=0x%x, STATUS=0x%x DEVICEID=0x%x\n", tag, status, deviceId)); 2433285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "2p"); 2434285809Sscottl return AGSA_RC_FAILURE; 2435285809Sscottl } 2436285809Sscottl 2437285809Sscottl break; 2438285809Sscottl case OSSA_FAILURE_PORT_ID_OUT_OF_RANGE: 2439285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_OUT_OF_RESOURCE\n")); 2440285809Sscottl /* remove device from LL device list */ 2441285809Sscottl siPortDeviceRemove(agRoot, pDevice->pPort, pDevice, agFALSE); 2442285809Sscottl 2443285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2444285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2445285809Sscottl agContext, 2446285809Sscottl OSSA_FAILURE_PORT_ID_OUT_OF_RANGE, 2447285809Sscottl &pDevice->targetDevHandle, 2448285809Sscottl deviceId 2449285809Sscottl ); 2450285809Sscottl break; 2451285809Sscottl case OSSA_FAILURE_PORT_NOT_VALID_STATE: 2452285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_PORT_NOT_VALID_STATE\n")); 2453285809Sscottl /* remove device from LL device list */ 2454285809Sscottl siPortDeviceRemove(agRoot, pDevice->pPort, pDevice, agFALSE); 2455285809Sscottl 2456285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2457285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2458285809Sscottl agContext, 2459285809Sscottl OSSA_FAILURE_PORT_NOT_VALID_STATE, 2460285809Sscottl &pDevice->targetDevHandle, 2461285809Sscottl deviceId 2462285809Sscottl ); 2463285809Sscottl break; 2464285809Sscottl case OSSA_FAILURE_DEVICE_TYPE_NOT_VALID: 2465285809Sscottl SA_DBG1(("mpiDeviceRegRsp: OSSA_FAILURE_DEVICE_TYPE_NOT_VALID\n")); 2466285809Sscottl /* remove device from LL device list */ 2467285809Sscottl siPortDeviceRemove(agRoot, pDevice->pPort, pDevice, agFALSE); 2468285809Sscottl /* call ossaDeviceRegistrationCB_t */ 2469285809Sscottl (*(ossaDeviceRegistrationCB_t)(saRoot->DeviceRegistrationCB))(agRoot, 2470285809Sscottl agContext, 2471285809Sscottl OSSA_FAILURE_DEVICE_TYPE_NOT_VALID, 2472285809Sscottl &pDevice->targetDevHandle, 2473285809Sscottl deviceId 2474285809Sscottl ); 2475285809Sscottl break; 2476285809Sscottl default: 2477285809Sscottl SA_DBG3(("mpiDeviceRegRsp, unknown status in response %d\n", status)); 2478285809Sscottl break; 2479285809Sscottl } 2480285809Sscottl 2481285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2482285809Sscottl pRequest->valid = agFALSE; 2483285809Sscottl /* return the request to free pool */ 2484285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2485285809Sscottl { 2486285809Sscottl SA_DBG1(("mpiDeviceRegRsp: saving pRequest (%p) for later use\n", pRequest)); 2487285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2488285809Sscottl } 2489285809Sscottl else 2490285809Sscottl { 2491285809Sscottl /* return the request to free pool */ 2492285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2493285809Sscottl } 2494285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2495285809Sscottl 2496285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'f', "2p"); 2497285809Sscottl return ret; 2498285809Sscottl} 2499285809Sscottl 2500285809Sscottl/******************************************************************************/ 2501285809Sscottl/*! \brief SPC MPI Deregister Device Command Response 2502285809Sscottl * 2503285809Sscottl * This function handles the response of Deregister Command. 2504285809Sscottl * 2505285809Sscottl * \param agRoot Handles for this instance of SAS/SATA hardware 2506285809Sscottl * \param pIomb pointer of Message 2507285809Sscottl * 2508285809Sscottl * \return The read value 2509285809Sscottl * 2510285809Sscottl */ 2511285809Sscottl/*******************************************************************************/ 2512285809SscottlGLOBAL bit32 mpiDeregDevHandleRsp( 2513285809Sscottl agsaRoot_t *agRoot, 2514285809Sscottl agsaDeregDevHandleRsp_t *pIomb 2515285809Sscottl ) 2516285809Sscottl{ 2517285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2518285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 2519285809Sscottl agsaIORequestDesc_t *pRequest; 2520285809Sscottl agsaDevHandle_t *agDevHandle; 2521285809Sscottl agsaContext_t *agContext; 2522285809Sscottl agsaDeviceDesc_t *pDevice; 2523285809Sscottl bit32 deviceIdx, status, tag; 2524285809Sscottl 2525285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2r"); 2526285809Sscottl SA_ASSERT((NULL != saRoot->DeviceDeregistrationCB), "DeviceDeregistrationCB can not be NULL"); 2527285809Sscottl 2528285809Sscottl SA_DBG3(("mpiDeregDevHandleRsp: start, HTAG=0x%x\n", pIomb->tag)); 2529285809Sscottl 2530285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaDeregDevHandleRsp_t, tag)) ; 2531285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaDeregDevHandleRsp_t, status)) ; 2532285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceIdx, pIomb, OSSA_OFFSET_OF(agsaDeregDevHandleRsp_t, deviceId)) ; 2533285809Sscottl /* get request from IOMap */ 2534285809Sscottl 2535285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2536285809Sscottl if (agNULL == pRequest) 2537285809Sscottl { 2538285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x deviceIdx 0x%x\n", tag, status,deviceIdx)); 2539285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2r"); 2540285809Sscottl return AGSA_RC_FAILURE; 2541285809Sscottl } 2542285809Sscottl 2543285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2544285809Sscottl /* remove the request from IOMap */ 2545285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2546285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2547285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2548285809Sscottl 2549285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 2550285809Sscottl 2551285809Sscottl pDevice = pRequest->pDevice; 2552285809Sscottl if (pDevice != agNULL) 2553285809Sscottl { 2554285809Sscottl if (pDevice->targetDevHandle.sdkData) 2555285809Sscottl { 2556285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 2557285809Sscottl } 2558285809Sscottl else 2559285809Sscottl { 2560285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 2561285809Sscottl } 2562285809Sscottl } 2563285809Sscottl else 2564285809Sscottl { 2565285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: pDevice is NULL")); 2566285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2r"); 2567285809Sscottl return AGSA_RC_FAILURE; 2568285809Sscottl } 2569285809Sscottl 2570285809Sscottl if (agNULL == agDevHandle) 2571285809Sscottl { 2572285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: warning!!! no deviceHandle is found")); 2573285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2r"); 2574285809Sscottl 2575285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2576285809Sscottl pRequest->valid = agFALSE; 2577285809Sscottl /* return the request to free pool */ 2578285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2579285809Sscottl { 2580285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: saving pRequest (%p) for later use\n", pRequest)); 2581285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2582285809Sscottl } 2583285809Sscottl else 2584285809Sscottl { 2585285809Sscottl /* return the request to free pool */ 2586285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2587285809Sscottl } 2588285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2589285809Sscottl 2590285809Sscottl return AGSA_RC_FAILURE; 2591285809Sscottl } 2592285809Sscottl 2593285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: deviceID 0x%x Device Context %p\n", pDevice->DeviceMapIndex, pDevice)); 2594285809Sscottl 2595285809Sscottl if (agNULL == saRoot->DeviceDeregistrationCB) 2596285809Sscottl { 2597285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: warning!!! no DeviceDeregistrationCB is found")); 2598285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2r"); 2599285809Sscottl 2600285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2601285809Sscottl pRequest->valid = agFALSE; 2602285809Sscottl /* return the request to free pool */ 2603285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2604285809Sscottl { 2605285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: saving pRequest (%p) for later use\n", pRequest)); 2606285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2607285809Sscottl } 2608285809Sscottl else 2609285809Sscottl { 2610285809Sscottl /* return the request to free pool */ 2611285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2612285809Sscottl } 2613285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2614285809Sscottl 2615285809Sscottl return AGSA_RC_FAILURE; 2616285809Sscottl } 2617285809Sscottl 2618285809Sscottl switch (status) 2619285809Sscottl { 2620285809Sscottl case OSSA_SUCCESS: 2621285809Sscottl (*(ossaDeregisterDeviceHandleCB_t)(saRoot->DeviceDeregistrationCB))(agRoot, 2622285809Sscottl agContext, 2623285809Sscottl agDevHandle, 2624285809Sscottl OSSA_SUCCESS 2625285809Sscottl ); 2626285809Sscottl siRemoveDevHandle(agRoot, agDevHandle); 2627285809Sscottl break; 2628285809Sscottl case OSSA_ERR_DEVICE_HANDLE_INVALID: 2629285809Sscottl case OSSA_INVALID_HANDLE: 2630285809Sscottl (*(ossaDeregisterDeviceHandleCB_t)(saRoot->DeviceDeregistrationCB))(agRoot, 2631285809Sscottl agContext, 2632285809Sscottl agDevHandle, 2633285809Sscottl status 2634285809Sscottl ); 2635285809Sscottl// already removed and no device to remove 2636285809Sscottl// siRemoveDevHandle(agRoot, agDevHandle); 2637285809Sscottl SA_DBG1(("mpiDeregDevRegRsp, OSSA_INVALID_HANDLE status in response %d\n", status)); 2638285809Sscottl break; 2639285809Sscottl case OSSA_ERR_DEVICE_BUSY: 2640285809Sscottl (*(ossaDeregisterDeviceHandleCB_t)(saRoot->DeviceDeregistrationCB))(agRoot, 2641285809Sscottl agContext, 2642285809Sscottl agDevHandle, 2643285809Sscottl status 2644285809Sscottl ); 2645285809Sscottl SA_DBG1(("mpiDeregDevRegRsp, OSSA_ERR_DEVICE_BUSY status in response %d\n", status)); 2646285809Sscottl ret = AGSA_RC_BUSY; 2647285809Sscottl break; 2648285809Sscottl default: 2649285809Sscottl SA_DBG1(("mpiDeregDevRegRsp, unknown status in response 0x%X\n", status)); 2650285809Sscottl break; 2651285809Sscottl } 2652285809Sscottl 2653285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2654285809Sscottl pRequest->valid = agFALSE; 2655285809Sscottl /* return the request to free pool */ 2656285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2657285809Sscottl { 2658285809Sscottl SA_DBG1(("mpiDeregDevHandleRsp: saving pRequest (%p) for later use\n", pRequest)); 2659285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2660285809Sscottl } 2661285809Sscottl else 2662285809Sscottl { 2663285809Sscottl /* return the request to free pool */ 2664285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2665285809Sscottl } 2666285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2667285809Sscottl 2668285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "2r"); 2669285809Sscottl return ret; 2670285809Sscottl} 2671285809Sscottl 2672285809Sscottl 2673285809Sscottl/******************************************************************************/ 2674285809Sscottl/*! \brief Get Phy Profile Response SPCv 2675285809Sscottl * 2676285809Sscottl * This routine handles the response of Get Phy Profile Command Response 2677285809Sscottl * 2678285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 2679285809Sscottl * \param pIomb Pointer of IOMB Message 2680285809Sscottl * 2681285809Sscottl * \return sucess or fail 2682285809Sscottl * SPC only 2683285809Sscottl */ 2684285809Sscottl/*******************************************************************************/ 2685285809Sscottl 2686285809SscottlGLOBAL bit32 mpiGetPhyProfileRsp( 2687285809Sscottl agsaRoot_t *agRoot, 2688285809Sscottl agsaGetPhyProfileRspV_t *pIomb 2689285809Sscottl ) 2690285809Sscottl{ 2691285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2692285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 2693285809Sscottl agsaIORequestDesc_t *pRequest; 2694285809Sscottl agsaContext_t *agContext; 2695285809Sscottl bit32 status, tag; 2696285809Sscottl 2697285809Sscottl bit32 Reserved_SOP_PHYID; 2698285809Sscottl bit32 PhyId; 2699285809Sscottl bit32 SOP; 2700285809Sscottl 2701285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2J"); 2702285809Sscottl OSSA_READ_LE_32(agRoot, &status, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t, status)); 2703285809Sscottl OSSA_READ_LE_32(agRoot, &tag, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t, tag)); 2704285809Sscottl /* get TAG */ 2705285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: HTag=0x%x\n", tag)); 2706285809Sscottl 2707285809Sscottl /* get request from IOMap */ 2708285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2709285809Sscottl if (agNULL == pRequest) 2710285809Sscottl { 2711285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 2712285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2J"); 2713285809Sscottl return AGSA_RC_FAILURE; 2714285809Sscottl } 2715285809Sscottl 2716285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2717285809Sscottl 2718285809Sscottl OSSA_READ_LE_32(agRoot, &Reserved_SOP_PHYID, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,Reserved_Ppc_SOP_PHYID )); 2719285809Sscottl 2720285809Sscottl /* remove the request from IOMap */ 2721285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2722285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2723285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2724285809Sscottl 2725285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 2726285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: %p\n",pIomb)); 2727285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: completionCB %p\n",pRequest->completionCB )); 2728285809Sscottl 2729285809Sscottl SOP = (Reserved_SOP_PHYID & 0xFF00) >> SHIFT8; 2730285809Sscottl PhyId = Reserved_SOP_PHYID & 0xFF; 2731285809Sscottl 2732285809Sscottl /* check status success or failure */ 2733285809Sscottl if (status) 2734285809Sscottl { 2735285809Sscottl /* status is FAILED */ 2736285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp:AGSA_RC_FAILURE 0x%08X\n", status)); 2737285809Sscottl switch(SOP) 2738285809Sscottl { 2739285809Sscottl case AGSA_SAS_PHY_ERR_COUNTERS_PAGE: 2740285809Sscottl { 2741285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_ERR_COUNTERS_PAGE SOP 0x%x\n", SOP)); 2742285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2743285809Sscottl break; 2744285809Sscottl } 2745285809Sscottl case AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE: 2746285809Sscottl { 2747285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE SOP 0x%x\n", SOP)); 2748285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2749285809Sscottl break; 2750285809Sscottl } 2751285809Sscottl case AGSA_SAS_PHY_BW_COUNTERS_PAGE: 2752285809Sscottl { 2753285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: GET_SAS_PHY_BW_COUNTERS SOP 0x%x\n", SOP)); 2754285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2755285809Sscottl break; 2756285809Sscottl } 2757285809Sscottl case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE: 2758285809Sscottl { 2759285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE SOP 0x%x\n", SOP)); 2760285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2761285809Sscottl break; 2762285809Sscottl } 2763285809Sscottl case AGSA_SAS_PHY_GENERAL_STATUS_PAGE: 2764285809Sscottl { 2765285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_GENERAL_STATUS_PAGE SOP 0x%x\n", SOP)); 2766285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2767285809Sscottl break; 2768285809Sscottl } 2769285809Sscottl case AGSA_PHY_SNW3_PAGE: 2770285809Sscottl { 2771285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_PHY_SNW3_PAGE SOP 0x%x\n", SOP)); 2772285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2773285809Sscottl break; 2774285809Sscottl } 2775285809Sscottl case AGSA_PHY_RATE_CONTROL_PAGE: 2776285809Sscottl { 2777285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_PHY_RATE_CONTROL_PAGE SOP 0x%x\n", SOP)); 2778285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2779285809Sscottl break; 2780285809Sscottl } 2781285809Sscottl case AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE: 2782285809Sscottl { 2783285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE SOP 0x%x\n", SOP)); 2784285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL ); 2785285809Sscottl break; 2786285809Sscottl } 2787285809Sscottl default: 2788285809Sscottl { 2789285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: undefined SOP 0x%x\n", SOP)); 2790285809Sscottl break; 2791285809Sscottl } 2792285809Sscottl } 2793285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2J"); 2794285809Sscottl return AGSA_RC_FAILURE; 2795285809Sscottl } 2796285809Sscottl else 2797285809Sscottl { 2798285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: SUCCESS type 0x%X\n",SOP )); 2799285809Sscottl switch(SOP) 2800285809Sscottl { 2801285809Sscottl case AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE: 2802285809Sscottl /* call back with the status */ 2803285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE PhyId %d\n",PhyId)); 2804285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , agNULL); 2805285809Sscottl break; 2806285809Sscottl case AGSA_SAS_PHY_ERR_COUNTERS_PAGE: 2807285809Sscottl { 2808285809Sscottl 2809285809Sscottl agsaPhyErrCountersPage_t Errors; 2810285809Sscottl 2811285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.invalidDword, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2812285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.runningDisparityError, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2813285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.codeViolation, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[2] )); 2814285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.lossOfDwordSynch, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[3] )); 2815285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.phyResetProblem, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[4] )); 2816285809Sscottl OSSA_READ_LE_32(agRoot, &Errors.inboundCRCError, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[5] )); 2817285809Sscottl 2818285809Sscottl /* call back with the status */ 2819285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , &Errors); 2820285809Sscottl /* status is SUCCESS */ 2821285809Sscottl 2822285809Sscottl SA_DBG3(("mpiGetPhyProfileRsp: pIomb %p\n",pIomb)); 2823285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: Reserved_SOP_PHYID 0x%08X\n",Reserved_SOP_PHYID)); 2824285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: invalidDword 0x%08X\n",Errors.invalidDword )); 2825285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: runningDisparityError 0x%08X\n",Errors.runningDisparityError )); 2826285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: codeViolation 0x%08X\n",Errors.codeViolation )); 2827285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: lossOfDwordSynch 0x%08X\n",Errors.lossOfDwordSynch )); 2828285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: phyResetProblem 0x%08X\n",Errors.phyResetProblem )); 2829285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: inboundCRCError 0x%08X\n",Errors.inboundCRCError )); 2830285809Sscottl break; 2831285809Sscottl 2832285809Sscottl } 2833285809Sscottl case AGSA_SAS_PHY_BW_COUNTERS_PAGE: 2834285809Sscottl { 2835285809Sscottl 2836285809Sscottl agsaPhyBWCountersPage_t bw_counts; 2837285809Sscottl OSSA_READ_LE_32(agRoot, &bw_counts.TXBWCounter, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2838285809Sscottl OSSA_READ_LE_32(agRoot, &bw_counts.RXBWCounter, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2839285809Sscottl 2840285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: GET_SAS_PHY_BW_COUNTERS TX 0x%08X RX 0x%08X\n",bw_counts.TXBWCounter,bw_counts.RXBWCounter)); 2841285809Sscottl /* call back with the status */ 2842285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, &bw_counts); 2843285809Sscottl break; 2844285809Sscottl } 2845285809Sscottl case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE: 2846285809Sscottl { 2847285809Sscottl agsaPhyAnalogSettingsPage_t analog; 2848285809Sscottl 2849285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE 0x%X\n",SOP)); 2850285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword0, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2851285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword1, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2852285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword2, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[2] )); 2853285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword3, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[3] )); 2854285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword4, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[4] )); 2855285809Sscottl /* call back with the status */ 2856285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, &analog); 2857285809Sscottl break; 2858285809Sscottl } 2859285809Sscottl 2860285809Sscottl case AGSA_SAS_PHY_GENERAL_STATUS_PAGE: 2861285809Sscottl { 2862285809Sscottl agsaSASPhyGeneralStatusPage_t GenStatus; 2863285809Sscottl OSSA_READ_LE_32(agRoot, &GenStatus.Dword0, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2864285809Sscottl OSSA_READ_LE_32(agRoot, &GenStatus.Dword1, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2865285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_GENERAL_STATUS_PAGE SOP 0x%x 0x%x 0x%x\n", SOP,GenStatus.Dword0,GenStatus.Dword1)); 2866285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , &GenStatus ); 2867285809Sscottl break; 2868285809Sscottl } 2869285809Sscottl case AGSA_PHY_SNW3_PAGE: 2870285809Sscottl { 2871285809Sscottl agsaPhySNW3Page_t Snw3; 2872285809Sscottl OSSA_READ_LE_32(agRoot, &Snw3.LSNW3, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2873285809Sscottl OSSA_READ_LE_32(agRoot, &Snw3.RSNW3, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2874285809Sscottl 2875285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_PHY_SNW3_PAGE SOP 0x%x\n", SOP)); 2876285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , &Snw3 ); 2877285809Sscottl break; 2878285809Sscottl } 2879285809Sscottl case AGSA_PHY_RATE_CONTROL_PAGE: 2880285809Sscottl { 2881285809Sscottl agsaPhyRateControlPage_t RateControl; 2882285809Sscottl OSSA_READ_LE_32(agRoot, &RateControl.Dword0, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2883285809Sscottl OSSA_READ_LE_32(agRoot, &RateControl.Dword1, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2884285809Sscottl OSSA_READ_LE_32(agRoot, &RateControl.Dword2, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[2] )); 2885285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_PHY_RATE_CONTROL_PAGE SOP 0x%x\n", SOP)); 2886285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , &RateControl ); 2887285809Sscottl break; 2888285809Sscottl } 2889285809Sscottl case AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE: 2890285809Sscottl { 2891285809Sscottl agsaSASPhyOpenRejectRetryBackOffThresholdPage_t Backoff; 2892285809Sscottl OSSA_READ_LE_32(agRoot, &Backoff.Dword0, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[0] )); 2893285809Sscottl OSSA_READ_LE_32(agRoot, &Backoff.Dword1, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[1] )); 2894285809Sscottl OSSA_READ_LE_32(agRoot, &Backoff.Dword2, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[2] )); 2895285809Sscottl OSSA_READ_LE_32(agRoot, &Backoff.Dword3, pIomb, OSSA_OFFSET_OF(agsaGetPhyProfileRspV_t,PageSpecificArea[3] )); 2896285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: AGSA_SAS_PHY_OPEN_REJECT_RETRY_BACKOFF_THRESHOLD_PAGE SOP 0x%x\n", SOP)); 2897285809Sscottl ossaGetPhyProfileCB(agRoot, agContext, status, SOP, PhyId , &Backoff ); 2898285809Sscottl break; 2899285809Sscottl } 2900285809Sscottl default: 2901285809Sscottl { 2902285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: undefined successful SOP 0x%x\n", SOP)); 2903285809Sscottl break; 2904285809Sscottl } 2905285809Sscottl 2906285809Sscottl } 2907285809Sscottl } 2908285809Sscottl 2909285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2910285809Sscottl pRequest->valid = agFALSE; 2911285809Sscottl /* return the request to free pool */ 2912285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 2913285809Sscottl { 2914285809Sscottl SA_DBG1(("mpiGetPhyProfileRsp: saving pRequest (%p) for later use\n", pRequest)); 2915285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 2916285809Sscottl } 2917285809Sscottl else 2918285809Sscottl { 2919285809Sscottl /* return the request to free pool */ 2920285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 2921285809Sscottl } 2922285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 2923285809Sscottl 2924285809Sscottl /* return value */ 2925285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2J"); 2926285809Sscottl return ret; 2927285809Sscottl} 2928285809Sscottl 2929285809Sscottl 2930285809SscottlGLOBAL bit32 mpiSetPhyProfileRsp( 2931285809Sscottl agsaRoot_t *agRoot, 2932285809Sscottl agsaSetPhyProfileRspV_t *pIomb 2933285809Sscottl ) 2934285809Sscottl{ 2935285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 2936285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 2937285809Sscottl agsaIORequestDesc_t *pRequest; 2938285809Sscottl agsaContext_t *agContext; 2939285809Sscottl bit32 status, tag; 2940285809Sscottl 2941285809Sscottl bit32 Reserved_Ppc_PHYID; 2942285809Sscottl bit32 PhyId; 2943285809Sscottl bit16 SOP; 2944285809Sscottl 2945285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2Q"); 2946285809Sscottl OSSA_READ_LE_32(agRoot, &status, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t, status)); 2947285809Sscottl OSSA_READ_LE_32(agRoot, &tag, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t, tag)); 2948285809Sscottl OSSA_READ_LE_32(agRoot, &Reserved_Ppc_PHYID, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t, Reserved_Ppc_PHYID)); 2949285809Sscottl /* get TAG */ 2950285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: HTag=0x%x\n", tag)); 2951285809Sscottl 2952285809Sscottl /* get request from IOMap */ 2953285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 2954285809Sscottl if (agNULL == pRequest) 2955285809Sscottl { 2956285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 2957285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2Q"); 2958285809Sscottl return AGSA_RC_FAILURE; 2959285809Sscottl } 2960285809Sscottl 2961285809Sscottl agContext = saRoot->IOMap[tag].agContext; 2962285809Sscottl 2963285809Sscottl /* remove the request from IOMap */ 2964285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 2965285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 2966285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 2967285809Sscottl 2968285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: %p\n",pIomb)); 2969285809Sscottl 2970285809Sscottl SOP = pRequest->SOP; 2971285809Sscottl PhyId = Reserved_Ppc_PHYID & 0xFF; 2972285809Sscottl 2973285809Sscottl /* check status success or failure */ 2974285809Sscottl if (status) 2975285809Sscottl { 2976285809Sscottl /* status is FAILED */ 2977285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp:AGSA_RC_FAILURE 0x%08X\n", status)); 2978285809Sscottl switch(SOP) 2979285809Sscottl { 2980285809Sscottl case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE: 2981285809Sscottl { 2982285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE SOP 0x%x\n", SOP)); 2983285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, agNULL ); 2984285809Sscottl break; 2985285809Sscottl } 2986285809Sscottl case AGSA_PHY_SNW3_PAGE: 2987285809Sscottl { 2988285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: AGSA_PHY_SNW3_PAGE SOP 0x%x\n", SOP)); 2989285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, agNULL ); 2990285809Sscottl break; 2991285809Sscottl } 2992285809Sscottl 2993285809Sscottl case AGSA_PHY_RATE_CONTROL_PAGE: 2994285809Sscottl { 2995285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: AGSA_PHY_RATE_CONTROL_PAGE SOP 0x%x\n", SOP)); 2996285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, agNULL ); 2997285809Sscottl break; 2998285809Sscottl } 2999285809Sscottl case AGSA_SAS_PHY_MISC_PAGE: 3000285809Sscottl { 3001285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: AGSA_SAS_PHY_MISC_PAGE SOP 0x%x\n", SOP)); 3002285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, agNULL ); 3003285809Sscottl break; 3004285809Sscottl } 3005285809Sscottl 3006285809Sscottl default: 3007285809Sscottl { 3008285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: undefined SOP 0x%x\n", SOP)); 3009285809Sscottl break; 3010285809Sscottl } 3011285809Sscottl } 3012285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2Q"); 3013285809Sscottl return AGSA_RC_FAILURE; 3014285809Sscottl } 3015285809Sscottl else 3016285809Sscottl { 3017285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: SUCCESS type 0x%X\n",SOP )); 3018285809Sscottl switch(SOP) 3019285809Sscottl { 3020285809Sscottl case AGSA_PHY_SNW3_PAGE: 3021285809Sscottl case AGSA_PHY_RATE_CONTROL_PAGE: 3022285809Sscottl { 3023285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: Status 0x%x SOP 0x%x PhyId %d\n",status, SOP, PhyId)); 3024285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, agNULL ); 3025285809Sscottl break; 3026285809Sscottl 3027285809Sscottl } 3028285809Sscottl case AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE: 3029285809Sscottl { 3030285809Sscottl agsaPhyAnalogSettingsPage_t analog; 3031285809Sscottl 3032285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE 0x%X\n",SOP)); 3033285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword0, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t,PageSpecificArea[0] )); 3034285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword1, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t,PageSpecificArea[1] )); 3035285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword2, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t,PageSpecificArea[2] )); 3036285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword3, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t,PageSpecificArea[3] )); 3037285809Sscottl OSSA_READ_LE_32(agRoot, &analog.Dword4, pIomb, OSSA_OFFSET_OF(agsaSetPhyProfileRspV_t,PageSpecificArea[4] )); 3038285809Sscottl /* call back with the status */ 3039285809Sscottl ossaSetPhyProfileCB(agRoot, agContext, status, SOP, PhyId, &analog ); 3040285809Sscottl break; 3041285809Sscottl } 3042285809Sscottl default: 3043285809Sscottl { 3044285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: undefined successful SOP 0x%x\n", SOP)); 3045285809Sscottl break; 3046285809Sscottl } 3047285809Sscottl 3048285809Sscottl } 3049285809Sscottl } 3050285809Sscottl 3051285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3052285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 3053285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: completionCB %p\n",pRequest->completionCB )); 3054285809Sscottl 3055285809Sscottl pRequest->valid = agFALSE; 3056285809Sscottl /* return the request to free pool */ 3057285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3058285809Sscottl { 3059285809Sscottl SA_DBG1(("mpiSetPhyProfileRsp: saving pRequest (%p) for later use\n", pRequest)); 3060285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3061285809Sscottl } 3062285809Sscottl else 3063285809Sscottl { 3064285809Sscottl /* return the request to free pool */ 3065285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3066285809Sscottl } 3067285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3068285809Sscottl 3069285809Sscottl /* return value */ 3070285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2Q"); 3071285809Sscottl return ret; 3072285809Sscottl} 3073285809Sscottl 3074285809Sscottl 3075285809Sscottl 3076285809Sscottl/******************************************************************************/ 3077285809Sscottl/*! \brief Get Device Information Response 3078285809Sscottl * 3079285809Sscottl * This routine handles the response of Get Device Info Command Response 3080285809Sscottl * 3081285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 3082285809Sscottl * \param pIomb Pointer of IOMB Message 3083285809Sscottl * 3084285809Sscottl * \return sucess or fail 3085285809Sscottl * 3086285809Sscottl */ 3087285809Sscottl/*******************************************************************************/ 3088285809SscottlGLOBAL bit32 mpiGetDevInfoRsp( 3089285809Sscottl agsaRoot_t *agRoot, 3090285809Sscottl agsaGetDevInfoRspV_t *pIomb 3091285809Sscottl ) 3092285809Sscottl{ 3093285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 3094285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 3095285809Sscottl agsaIORequestDesc_t *pRequest; 3096285809Sscottl agsaDevHandle_t *agDevHandle; 3097285809Sscottl agsaDeviceDesc_t *pDevice; 3098285809Sscottl agsaContext_t *agContext; 3099285809Sscottl agsaDeviceInfo_t commonDevInfo; 3100285809Sscottl bit32 ARSrateSMPTimeOutPortID, IRMcnITNexusTimeOut, status, tag; 3101285809Sscottl bit32 deviceid; 3102285809Sscottl bit32 sasAddrHi; 3103285809Sscottl bit32 sasAddrLow; 3104285809Sscottl#if defined(SALLSDK_DEBUG) 3105285809Sscottl bit32 option; 3106285809Sscottl#endif /* SALLSDK_DEBUG */ 3107285809Sscottl 3108285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2M"); 3109285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t, status)); 3110285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t, tag)); 3111285809Sscottl /* get TAG */ 3112285809Sscottl SA_DBG3(("mpiGetDevInfoRsp: HTag=0x%x\n", tag)); 3113285809Sscottl 3114285809Sscottl /* get request from IOMap */ 3115285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 3116285809Sscottl if (agNULL == pRequest) 3117285809Sscottl { 3118285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 3119285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2M"); 3120285809Sscottl return AGSA_RC_FAILURE; 3121285809Sscottl } 3122285809Sscottl 3123285809Sscottl agContext = saRoot->IOMap[tag].agContext; 3124285809Sscottl 3125285809Sscottl /* remove the request from IOMap */ 3126285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 3127285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 3128285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 3129285809Sscottl 3130285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 3131285809Sscottl 3132285809Sscottl /* check status success or failure */ 3133285809Sscottl if (status) 3134285809Sscottl { 3135285809Sscottl /* status is FAILED */ 3136285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agNULL, OSSA_DEV_INFO_INVALID_HANDLE, agNULL); 3137285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2M"); 3138285809Sscottl 3139285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3140285809Sscottl pRequest->valid = agFALSE; 3141285809Sscottl#if defined(SALLSDK_DEBUG) 3142285809Sscottl option = (bit32)pRequest->DeviceInfoCmdOption; 3143285809Sscottl#endif /* SALLSDK_DEBUG */ 3144285809Sscottl /* return the request to free pool */ 3145285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3146285809Sscottl { 3147285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: saving pRequest (%p) for later use\n", pRequest)); 3148285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3149285809Sscottl } 3150285809Sscottl else 3151285809Sscottl { 3152285809Sscottl /* return the request to free pool */ 3153285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3154285809Sscottl } 3155285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3156285809Sscottl 3157285809Sscottl return AGSA_RC_FAILURE; 3158285809Sscottl } 3159285809Sscottl 3160285809Sscottl /* status is SUCCESS */ 3161285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t, deviceId)); 3162285809Sscottl OSSA_READ_LE_32(AGROOT, &ARSrateSMPTimeOutPortID, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t, ARSrateSMPTimeOutPortID)); 3163285809Sscottl OSSA_READ_LE_32(AGROOT, &IRMcnITNexusTimeOut, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t, IRMcnITNexusTimeOut)); 3164285809Sscottl OSSA_READ_LE_32(AGROOT, &sasAddrHi, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t,sasAddrHi[0] )); 3165285809Sscottl OSSA_READ_LE_32(AGROOT, &sasAddrLow, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRspV_t,sasAddrLow[0] )); 3166285809Sscottl 3167285809Sscottl /* find device handle from device index */ 3168285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 3169285809Sscottl if (pDevice != agNULL) 3170285809Sscottl { 3171285809Sscottl if (pDevice->targetDevHandle.sdkData) 3172285809Sscottl { 3173285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 3174285809Sscottl } 3175285809Sscottl else 3176285809Sscottl { 3177285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 3178285809Sscottl } 3179285809Sscottl } 3180285809Sscottl else 3181285809Sscottl { 3182285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: pDevice is NULL")); 3183285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2M"); 3184285809Sscottl return AGSA_RC_FAILURE; 3185285809Sscottl } 3186285809Sscottl 3187285809Sscottl if (agDevHandle == agNULL) 3188285809Sscottl { 3189285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: warning!!! no deviceHandle is found")); 3190285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agNULL, OSSA_DEV_INFO_INVALID_HANDLE, agNULL); 3191285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2M"); 3192285809Sscottl 3193285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3194285809Sscottl pRequest->valid = agFALSE; 3195285809Sscottl#if defined(SALLSDK_DEBUG) 3196285809Sscottl option = (bit32)pRequest->DeviceInfoCmdOption; 3197285809Sscottl#endif /* SALLSDK_DEBUG */ 3198285809Sscottl /* return the request to free pool */ 3199285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3200285809Sscottl { 3201285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: saving pRequest (%p) for later use\n", pRequest)); 3202285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3203285809Sscottl } 3204285809Sscottl else 3205285809Sscottl { 3206285809Sscottl /* return the request to free pool */ 3207285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3208285809Sscottl } 3209285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3210285809Sscottl 3211285809Sscottl return AGSA_RC_FAILURE; 3212285809Sscottl } 3213285809Sscottl 3214285809Sscottl /* setup common device information */ 3215285809Sscottl si_memset(&commonDevInfo, 0, sizeof(agsaDeviceInfo_t)); 3216285809Sscottl commonDevInfo.smpTimeout = (bit16)((ARSrateSMPTimeOutPortID >> SHIFT8 ) & SMPTO_VBITS); 3217285809Sscottl commonDevInfo.it_NexusTimeout = (bit16)(IRMcnITNexusTimeOut & NEXUSTO_VBITS); 3218285809Sscottl commonDevInfo.firstBurstSize = (bit16)((IRMcnITNexusTimeOut >> SHIFT16) & FIRST_BURST_MCN); 3219285809Sscottl commonDevInfo.devType_S_Rate = (bit8)((ARSrateSMPTimeOutPortID >> SHIFT24) & 0x3f); 3220285809Sscottl commonDevInfo.flag = (bit32)((ARSrateSMPTimeOutPortID >> SHIFT30 ) & FLAG_VBITS); 3221285809Sscottl commonDevInfo.flag |= IRMcnITNexusTimeOut & 0xf0000; 3222285809Sscottl if (IRMcnITNexusTimeOut & 0x1000000) 3223285809Sscottl { 3224285809Sscottl commonDevInfo.flag |= 0x100000; 3225285809Sscottl } 3226285809Sscottl 3227285809Sscottl /* check SAS device then copy SAS Address */ 3228285809Sscottl if ( ((ARSrateSMPTimeOutPortID & DEV_TYPE_BITS) >> SHIFT28 == 0x00) || 3229285809Sscottl ((ARSrateSMPTimeOutPortID & DEV_TYPE_BITS) >> SHIFT28 == 0x01)) 3230285809Sscottl { 3231285809Sscottl /* copy the sasAddressHi byte-by-byte : no endianness */ 3232285809Sscottl commonDevInfo.sasAddressHi[0] = pIomb->sasAddrHi[0]; 3233285809Sscottl commonDevInfo.sasAddressHi[1] = pIomb->sasAddrHi[1]; 3234285809Sscottl commonDevInfo.sasAddressHi[2] = pIomb->sasAddrHi[2]; 3235285809Sscottl commonDevInfo.sasAddressHi[3] = pIomb->sasAddrHi[3]; 3236285809Sscottl 3237285809Sscottl /* copy the sasAddressLow byte-by-byte : no endianness */ 3238285809Sscottl commonDevInfo.sasAddressLo[0] = pIomb->sasAddrLow[0]; 3239285809Sscottl commonDevInfo.sasAddressLo[1] = pIomb->sasAddrLow[1]; 3240285809Sscottl commonDevInfo.sasAddressLo[2] = pIomb->sasAddrLow[2]; 3241285809Sscottl commonDevInfo.sasAddressLo[3] = pIomb->sasAddrLow[3]; 3242285809Sscottl } 3243285809Sscottl 3244285809Sscottl /* copy common device information to SAS and SATA device common header*/ 3245285809Sscottl si_memcpy(&pDevice->devInfo.sasDeviceInfo.commonDevInfo, &commonDevInfo, sizeof(agsaDeviceInfo_t)); 3246285809Sscottl si_memcpy(&pDevice->devInfo.sataDeviceInfo.commonDevInfo, &commonDevInfo, sizeof(agsaDeviceInfo_t)); 3247285809Sscottl 3248285809Sscottl /* setup device firstBurstSize infomation */ 3249285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.firstBurstSize = 3250285809Sscottl (bit16)((IRMcnITNexusTimeOut >> SHIFT16) & FIRST_BURST); 3251285809Sscottl 3252285809Sscottl /* Display Device Information */ 3253285809Sscottl SA_DBG3(("mpiGetDevInfoRsp: smpTimeout=0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.smpTimeout)); 3254285809Sscottl SA_DBG3(("mpiGetDevInfoRsp: it_NexusTimeout=0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.it_NexusTimeout)); 3255285809Sscottl SA_DBG3(("mpiGetDevInfoRsp: firstBurstSize=0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.firstBurstSize)); 3256285809Sscottl SA_DBG3(("mpiGetDevInfoRsp: devType_S_Rate=0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate)); 3257285809Sscottl 3258285809Sscottl /* 3259285809Sscottl D518 P2I[15-12]: Disk HP DG0146FAMWL , HPDE, WWID=5000c500:17459a31, 6.0G 3260285809Sscottl */ 3261285809Sscottl 3262285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: Device 0x%08X flag 0x%08X %s WWID= %02x%02x%02x%02x:%02x%02x%02x%02x, %s\n", 3263285809Sscottl deviceid, 3264285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.flag, 3265285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x20 ? "SATA DA" : 3266285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x10 ? "SSP/SMP" : 3267285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x0 ? " STP " : "Unknown", 3268285809Sscottl 3269285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[3], 3270285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[2], 3271285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[1], 3272285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[0], 3273285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[3], 3274285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[2], 3275285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[1], 3276285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[0], 3277285809Sscottl 3278285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 8 ? " 1.5G" : 3279285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 9 ? " 3.0G" : 3280285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 10 ? " 6.0G" : 3281285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 11 ? "12.0G" : "????" )); 3282285809Sscottl 3283285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agDevHandle, OSSA_DEV_INFO_NO_EXTENDED_INFO, &commonDevInfo); 3284285809Sscottl 3285285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3286285809Sscottl pRequest->valid = agFALSE; 3287285809Sscottl#if defined(SALLSDK_DEBUG) 3288285809Sscottl option = (bit32)pRequest->DeviceInfoCmdOption; 3289285809Sscottl#endif /* SALLSDK_DEBUG */ 3290285809Sscottl /* return the request to free pool */ 3291285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3292285809Sscottl { 3293285809Sscottl SA_DBG1(("mpiGetDevInfoRsp: saving pRequest (%p) for later use\n", pRequest)); 3294285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3295285809Sscottl } 3296285809Sscottl else 3297285809Sscottl { 3298285809Sscottl /* return the request to free pool */ 3299285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3300285809Sscottl } 3301285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3302285809Sscottl 3303285809Sscottl /* return value */ 3304285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "2M"); 3305285809Sscottl return ret; 3306285809Sscottl} 3307285809Sscottl 3308285809Sscottl/******************************************************************************/ 3309285809Sscottl/*! \brief Get Device Information Response 3310285809Sscottl * 3311285809Sscottl * This routine handles the response of Get Device Info Command Response 3312285809Sscottl * 3313285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 3314285809Sscottl * \param pIomb Pointer of IOMB Message 3315285809Sscottl * 3316285809Sscottl * \return sucess or fail 3317285809Sscottl * 3318285809Sscottl */ 3319285809Sscottl/*******************************************************************************/ 3320285809SscottlGLOBAL bit32 mpiGetDevInfoRspSpc( 3321285809Sscottl agsaRoot_t *agRoot, 3322285809Sscottl agsaGetDevInfoRsp_t *pIomb 3323285809Sscottl ) 3324285809Sscottl{ 3325285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 3326285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 3327285809Sscottl agsaIORequestDesc_t *pRequest; 3328285809Sscottl agsaDevHandle_t *agDevHandle; 3329285809Sscottl agsaDeviceDesc_t *pDevice; 3330285809Sscottl agsaContext_t *agContext; 3331285809Sscottl bit32 dTypeSrateSMPTOPortID, FirstBurstSizeITNexusTimeOut, status, tag; 3332285809Sscottl bit32 deviceid; 3333285809Sscottl bit32 sasAddrHi; 3334285809Sscottl bit32 sasAddrLow; 3335285809Sscottl bit32 Info_avail = 0; 3336285809Sscottl 3337285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2t"); 3338285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, status)); 3339285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, tag)); 3340285809Sscottl /* get TAG */ 3341285809Sscottl SA_DBG3(("mpiGetDevInfoRspSpc: HTag=0x%x\n", tag)); 3342285809Sscottl 3343285809Sscottl /* get request from IOMap */ 3344285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 3345285809Sscottl if (agNULL == pRequest) 3346285809Sscottl { 3347285809Sscottl SA_DBG1(("mpiGetDevInfoRspSpc: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 3348285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2t"); 3349285809Sscottl return AGSA_RC_FAILURE; 3350285809Sscottl } 3351285809Sscottl 3352285809Sscottl agContext = saRoot->IOMap[tag].agContext; 3353285809Sscottl 3354285809Sscottl /* remove the request from IOMap */ 3355285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 3356285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 3357285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 3358285809Sscottl 3359285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 3360285809Sscottl 3361285809Sscottl /* check status success or failure */ 3362285809Sscottl if (status) 3363285809Sscottl { 3364285809Sscottl /* status is FAILED */ 3365285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agNULL, OSSA_DEV_INFO_INVALID_HANDLE, agNULL); 3366285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2t"); 3367285809Sscottl return AGSA_RC_FAILURE; 3368285809Sscottl } 3369285809Sscottl 3370285809Sscottl /* status is SUCCESS */ 3371285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, deviceId)); 3372285809Sscottl OSSA_READ_LE_32(AGROOT, &dTypeSrateSMPTOPortID, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, dTypeSrateSMPTOArPortID)); 3373285809Sscottl OSSA_READ_LE_32(AGROOT, &FirstBurstSizeITNexusTimeOut, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, FirstBurstSizeITNexusTimeOut)); 3374285809Sscottl OSSA_READ_LE_32(AGROOT, &sasAddrHi, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, sasAddrHi[0])); 3375285809Sscottl OSSA_READ_LE_32(AGROOT, &sasAddrLow, pIomb, OSSA_OFFSET_OF(agsaGetDevInfoRsp_t, sasAddrLow[0])); 3376285809Sscottl 3377285809Sscottl 3378285809Sscottl SA_DBG2(("mpiGetDevInfoRspSpc:deviceid 0x%08X\n",deviceid)); 3379285809Sscottl SA_DBG2(("mpiGetDevInfoRspSpc:dTypeSrateSMPTOPortID 0x%08X\n",dTypeSrateSMPTOPortID)); 3380285809Sscottl SA_DBG2(("mpiGetDevInfoRspSpc:FirstBurstSizeITNexusTimeOut 0x%08X\n",FirstBurstSizeITNexusTimeOut)); 3381285809Sscottl SA_DBG2(("mpiGetDevInfoRspSpc:sasAddrHi 0x%08X\n",sasAddrHi)); 3382285809Sscottl SA_DBG2(("mpiGetDevInfoRspSpc:sasAddrLow 0x%08X\n",sasAddrLow)); 3383285809Sscottl 3384285809Sscottl 3385285809Sscottl /* find device handle from device index */ 3386285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 3387285809Sscottl if (pDevice != agNULL) 3388285809Sscottl { 3389285809Sscottl if (pDevice->targetDevHandle.sdkData) 3390285809Sscottl { 3391285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 3392285809Sscottl } 3393285809Sscottl else 3394285809Sscottl { 3395285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 3396285809Sscottl } 3397285809Sscottl } 3398285809Sscottl else 3399285809Sscottl { 3400285809Sscottl SA_DBG1(("mpiGetDevInfoRspSpc: pDevice is NULL")); 3401285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2t"); 3402285809Sscottl return AGSA_RC_FAILURE; 3403285809Sscottl } 3404285809Sscottl 3405285809Sscottl if (agDevHandle == agNULL) 3406285809Sscottl { 3407285809Sscottl SA_DBG1(("mpiGetDevInfoRspSpc: warning!!! no deviceHandle is found")); 3408285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agNULL, OSSA_DEV_INFO_INVALID_HANDLE, agNULL); 3409285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2t"); 3410285809Sscottl 3411285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3412285809Sscottl pRequest->valid = agFALSE; 3413285809Sscottl /* return the request to free pool */ 3414285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3415285809Sscottl { 3416285809Sscottl SA_DBG1(("mpiGetDevInfoRspSpc: saving pRequest (%p) for later use\n", pRequest)); 3417285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3418285809Sscottl } 3419285809Sscottl else 3420285809Sscottl { 3421285809Sscottl /* return the request to free pool */ 3422285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3423285809Sscottl } 3424285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3425285809Sscottl 3426285809Sscottl return AGSA_RC_FAILURE; 3427285809Sscottl } 3428285809Sscottl 3429285809Sscottl Info_avail = OSSA_DEV_INFO_NO_EXTENDED_INFO; 3430285809Sscottl 3431285809Sscottl /* setup device common infomation */ 3432285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.smpTimeout = 3433285809Sscottl (bit16)((dTypeSrateSMPTOPortID >> SHIFT8 ) & SMPTO_BITS); 3434285809Sscottl 3435285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.smpTimeout = 3436285809Sscottl (bit16)((dTypeSrateSMPTOPortID >> SHIFT8 ) & SMPTO_BITS); 3437285809Sscottl 3438285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.it_NexusTimeout = 3439285809Sscottl (bit16)(FirstBurstSizeITNexusTimeOut & NEXUSTO_BITS); 3440285809Sscottl 3441285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.it_NexusTimeout = 3442285809Sscottl (bit16)(FirstBurstSizeITNexusTimeOut & NEXUSTO_BITS); 3443285809Sscottl 3444285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.firstBurstSize = 3445285809Sscottl (bit16)((FirstBurstSizeITNexusTimeOut >> SHIFT16) & FIRST_BURST); 3446285809Sscottl 3447285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.firstBurstSize = 3448285809Sscottl (bit16)((FirstBurstSizeITNexusTimeOut >> SHIFT16) & FIRST_BURST); 3449285809Sscottl 3450285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.flag = (bit32)((dTypeSrateSMPTOPortID >> SHIFT4 ) & FLAG_BITS); 3451285809Sscottl 3452285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.flag = (bit32)((dTypeSrateSMPTOPortID >> SHIFT4 ) & FLAG_BITS); 3453285809Sscottl 3454285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate = 3455285809Sscottl (bit8)((dTypeSrateSMPTOPortID >> SHIFT24) & LINK_RATE_BITS); 3456285809Sscottl 3457285809Sscottl pDevice->devInfo.sataDeviceInfo.commonDevInfo.devType_S_Rate = 3458285809Sscottl (bit8)((dTypeSrateSMPTOPortID >> SHIFT24) & LINK_RATE_BITS); 3459285809Sscottl 3460285809Sscottl /* check SAS device then copy SAS Address */ 3461285809Sscottl if ( ((dTypeSrateSMPTOPortID & DEV_TYPE_BITS) >> SHIFT28 == 0x00) || 3462285809Sscottl ((dTypeSrateSMPTOPortID & DEV_TYPE_BITS) >> SHIFT28 == 0x01)) 3463285809Sscottl { 3464285809Sscottl /* copy the sasAddressHi byte-by-byte : no endianness */ 3465285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[0] = pIomb->sasAddrHi[0]; 3466285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[1] = pIomb->sasAddrHi[1]; 3467285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[2] = pIomb->sasAddrHi[2]; 3468285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[3] = pIomb->sasAddrHi[3]; 3469285809Sscottl 3470285809Sscottl /* copy the sasAddressLow byte-by-byte : no endianness */ 3471285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[0] = pIomb->sasAddrLow[0]; 3472285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[1] = pIomb->sasAddrLow[1]; 3473285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[2] = pIomb->sasAddrLow[2]; 3474285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[3] = pIomb->sasAddrLow[3]; 3475285809Sscottl } 3476285809Sscottl 3477285809Sscottl /* Display Device Information */ 3478285809Sscottl SA_DBG3(("mpiGetDevInfoRspSpc: smpTimeout= 0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.smpTimeout)); 3479285809Sscottl SA_DBG3(("mpiGetDevInfoRspSpc: it_NexusTimeout=0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.it_NexusTimeout)); 3480285809Sscottl SA_DBG3(("mpiGetDevInfoRspSpc: firstBurstSize= 0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.firstBurstSize)); 3481285809Sscottl SA_DBG3(("mpiGetDevInfoRspSpc: devType_S_Rate= 0x%x\n", pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate)); 3482285809Sscottl 3483285809Sscottl 3484285809Sscottl SA_DBG1(("Device SPC deviceid 0x%08X flag 0x%08X %s WWID= %02x%02x%02x%02x:%02x%02x%02x%02x, %s\n", 3485285809Sscottl deviceid, 3486285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.flag, 3487285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x20 ? "SATA DA" : 3488285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x10 ? "SSP/SMP" : 3489285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x0 ? " STP " : "Unknown", 3490285809Sscottl 3491285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[3], 3492285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[2], 3493285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[1], 3494285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[0], 3495285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[3], 3496285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[2], 3497285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[1], 3498285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[0], 3499285809Sscottl 3500285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 8 ? " 1.5G" : 3501285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 9 ? " 3.0G" : 3502285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 10 ? " 6.0G" : 3503285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 11 ? "12.0G" : "????" )); 3504285809Sscottl 3505285809Sscottl ossaGetDeviceInfoCB(agRoot, agContext, agDevHandle, Info_avail, &pDevice->devInfo.sasDeviceInfo.commonDevInfo); 3506285809Sscottl 3507285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3508285809Sscottl pRequest->valid = agFALSE; 3509285809Sscottl /* return the request to free pool */ 3510285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 3511285809Sscottl { 3512285809Sscottl SA_DBG1(("mpiGetDevInfoRspSpc: saving pRequest (%p) for later use\n", pRequest)); 3513285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 3514285809Sscottl } 3515285809Sscottl else 3516285809Sscottl { 3517285809Sscottl /* return the request to free pool */ 3518285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3519285809Sscottl } 3520285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3521285809Sscottl 3522285809Sscottl /* return value */ 3523285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "2t"); 3524285809Sscottl return ret; 3525285809Sscottl} 3526285809Sscottl 3527285809Sscottl/******************************************************************************/ 3528285809Sscottl/*! \brief Set Device Information Response 3529285809Sscottl * 3530285809Sscottl * This routine handles the response of Set Device Info Command Response 3531285809Sscottl * 3532285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 3533285809Sscottl * \param pIomb Pointer of IOMB Message 3534285809Sscottl * 3535285809Sscottl * \return sucess or fail 3536285809Sscottl * 3537285809Sscottl */ 3538285809Sscottl/*******************************************************************************/ 3539285809SscottlGLOBAL bit32 mpiSetDevInfoRsp( 3540285809Sscottl agsaRoot_t *agRoot, 3541285809Sscottl agsaSetDeviceInfoRsp_t *pIomb 3542285809Sscottl ) 3543285809Sscottl{ 3544285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 3545285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 3546285809Sscottl agsaIORequestDesc_t *pRequest; 3547285809Sscottl agsaDevHandle_t *agDevHandle; 3548285809Sscottl agsaDeviceDesc_t *pDevice; 3549285809Sscottl agsaContext_t *agContext; 3550285809Sscottl bit32 tag, status, deviceid, option, param; 3551285809Sscottl 3552285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2v"); 3553285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSetDeviceInfoRsp_t, status)); 3554285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSetDeviceInfoRsp_t, tag)); 3555285809Sscottl /* get TAG */ 3556285809Sscottl SA_DBG3(("mpiSetDevInfoRsp: HTag=0x%x\n", tag)); 3557285809Sscottl 3558285809Sscottl /* get request from IOMap */ 3559285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 3560285809Sscottl if (agNULL == pRequest) 3561285809Sscottl { 3562285809Sscottl SA_DBG1(("mpiSetDevInfoRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 3563285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2v"); 3564285809Sscottl return AGSA_RC_FAILURE; 3565285809Sscottl } 3566285809Sscottl 3567285809Sscottl agContext = saRoot->IOMap[tag].agContext; 3568285809Sscottl 3569285809Sscottl /* remove the request from IOMap */ 3570285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 3571285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 3572285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 3573285809Sscottl 3574285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 3575285809Sscottl /* check status success or failure */ 3576285809Sscottl if (status) 3577285809Sscottl { 3578285809Sscottl /* status is FAILED */ 3579285809Sscottl if (pRequest->completionCB == agNULL) 3580285809Sscottl { 3581285809Sscottl SA_DBG1(("mpiSetDevInfoRsp: status is FAILED pRequest->completionCB == agNULL\n" )); 3582285809Sscottl ossaSetDeviceInfoCB(agRoot, agContext, agNULL, status, 0, 0); 3583285809Sscottl } 3584285809Sscottl else 3585285809Sscottl { 3586285809Sscottl SA_DBG1(("mpiSetDevInfoRsp: status is FAILED use CB\n" )); 3587285809Sscottl (*(ossaSetDeviceInfoCB_t)(pRequest->completionCB))(agRoot, agContext, agNULL, status, 0, 0); 3588285809Sscottl } 3589285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2v"); 3590285809Sscottl 3591285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3592285809Sscottl pRequest->valid = agFALSE; 3593285809Sscottl /* return the request to free pool */ 3594285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3595285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3596285809Sscottl 3597285809Sscottl return AGSA_RC_FAILURE; 3598285809Sscottl } 3599285809Sscottl 3600285809Sscottl /* status is SUCCESS */ 3601285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pIomb, OSSA_OFFSET_OF(agsaSetDeviceInfoRsp_t, deviceId)); 3602285809Sscottl OSSA_READ_LE_32(AGROOT, &option, pIomb, OSSA_OFFSET_OF(agsaSetDeviceInfoRsp_t, SA_SR_SI)); 3603285809Sscottl OSSA_READ_LE_32(AGROOT, ¶m, pIomb, OSSA_OFFSET_OF(agsaSetDeviceInfoRsp_t, A_R_ITNT)); 3604285809Sscottl 3605285809Sscottl /* find device handle from device index */ 3606285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 3607285809Sscottl if (pDevice != agNULL) 3608285809Sscottl { 3609285809Sscottl if (pDevice->targetDevHandle.sdkData) 3610285809Sscottl { 3611285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 3612285809Sscottl } 3613285809Sscottl else 3614285809Sscottl { 3615285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 3616285809Sscottl } 3617285809Sscottl } 3618285809Sscottl else 3619285809Sscottl { 3620285809Sscottl SA_DBG1(("mpiSetDevInfoRsp: pDevice is NULL")); 3621285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3622285809Sscottl pRequest->valid = agFALSE; 3623285809Sscottl /* return the request to free pool */ 3624285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3625285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3626285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "2v"); 3627285809Sscottl return AGSA_RC_FAILURE; 3628285809Sscottl } 3629285809Sscottl 3630285809Sscottl if (agDevHandle == agNULL) 3631285809Sscottl { 3632285809Sscottl SA_DBG1(("mpiSetDevInfoRsp: warning!!! no deviceHandle is found")); 3633285809Sscottl if (pRequest->completionCB == agNULL) 3634285809Sscottl { 3635285809Sscottl ossaSetDeviceInfoCB(agRoot, agContext, agNULL, OSSA_IO_NO_DEVICE, 0, 0); 3636285809Sscottl } 3637285809Sscottl else 3638285809Sscottl { 3639285809Sscottl (*(ossaSetDeviceInfoCB_t)(pRequest->completionCB))(agRoot, agContext, agNULL, OSSA_IO_NO_DEVICE, 0, 0); 3640285809Sscottl } 3641285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "2v"); 3642285809Sscottl 3643285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3644285809Sscottl pRequest->valid = agFALSE; 3645285809Sscottl /* return the request to free pool */ 3646285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3647285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3648285809Sscottl 3649285809Sscottl return AGSA_RC_FAILURE; 3650285809Sscottl } 3651285809Sscottl 3652285809Sscottl SA_DBG2(("mpiSetDevInfoRsp:, option 0x%X param 0x%X\n", option, param)); 3653285809Sscottl 3654285809Sscottl if(smIS_SPCV(agRoot)) 3655285809Sscottl { 3656285809Sscottl SA_DBG2(("mpiSetDevInfoRsp:was option 0x%X param 0x%X\n", option, param)); 3657285809Sscottl SA_DBG2(("mpiSetDevInfoRsp:pDevice->option 0x%X pDevice->param 0x%X\n", pDevice->option, pDevice->param)); 3658285809Sscottl option |= pDevice->option; 3659285809Sscottl param |= pDevice->param; 3660285809Sscottl SA_DBG2(("mpiSetDevInfoRsp:now option 0x%X param 0x%X\n", option, param)); 3661285809Sscottl if (pRequest->completionCB == agNULL) 3662285809Sscottl { 3663285809Sscottl ossaSetDeviceInfoCB(agRoot, agContext, agDevHandle, OSSA_SUCCESS, option, param); 3664285809Sscottl } 3665285809Sscottl else 3666285809Sscottl { 3667285809Sscottl (*(ossaSetDeviceInfoCB_t)(pRequest->completionCB))(agRoot, agContext, agDevHandle, OSSA_SUCCESS, option, param); 3668285809Sscottl } 3669285809Sscottl } 3670285809Sscottl else 3671285809Sscottl { 3672285809Sscottl SA_DBG2(("mpiSetDevInfoRsp:, option 0x%X param 0x%X\n", option, param)); 3673285809Sscottl if (pRequest->completionCB == agNULL) 3674285809Sscottl { 3675285809Sscottl ossaSetDeviceInfoCB(agRoot, agContext, agDevHandle, OSSA_SUCCESS, option, param); 3676285809Sscottl } 3677285809Sscottl else 3678285809Sscottl { 3679285809Sscottl (*(ossaSetDeviceInfoCB_t)(pRequest->completionCB))(agRoot, agContext, agDevHandle, OSSA_SUCCESS, option, param); 3680285809Sscottl } 3681285809Sscottl } 3682285809Sscottl 3683285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3684285809Sscottl pRequest->valid = agFALSE; 3685285809Sscottl /* return the request to free pool */ 3686285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 3687285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 3688285809Sscottl 3689285809Sscottl /* return value */ 3690285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "2v"); 3691285809Sscottl return ret; 3692285809Sscottl} 3693285809Sscottl 3694285809Sscottl/******************************************************************************/ 3695285809Sscottl/*! \brief SPC MPI SSP Event 3696285809Sscottl * 3697285809Sscottl * This function handles the SAS Event. 3698285809Sscottl * 3699285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 3700285809Sscottl * \param pIomb pointer of Message 3701285809Sscottl * 3702285809Sscottl * \return The read value 3703285809Sscottl * 3704285809Sscottl */ 3705285809Sscottl/*******************************************************************************/ 3706285809SscottlGLOBAL bit32 mpiSSPEvent( 3707285809Sscottl agsaRoot_t *agRoot, 3708285809Sscottl agsaSSPEventRsp_t *pIomb 3709285809Sscottl ) 3710285809Sscottl{ 3711285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 3712285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 3713285809Sscottl agsaIORequestDesc_t *pRequest; 3714285809Sscottl agsaPortContext_t *agPortContext; 3715285809Sscottl agsaDevHandle_t *agDevHandle; 3716285809Sscottl agsaDeviceDesc_t *pDevice; 3717285809Sscottl bit32 event,deviceId; 3718285809Sscottl bit32 deviceIdx, tag, portId_tmp; 3719285809Sscottl bit32 SSPTag; 3720285809Sscottl bit16 sspTag; 3721285809Sscottl bit8 portId; 3722285809Sscottl 3723285809Sscottl agsaDifDetails_t Dif_details; 3724285809Sscottl 3725285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2u"); 3726285809Sscottl 3727285809Sscottl OSSA_READ_LE_32(AGROOT, &event, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, event)); 3728285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceId, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, deviceId)); 3729285809Sscottl OSSA_READ_LE_32(AGROOT, &portId_tmp, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, portId)); 3730285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, tag)); 3731285809Sscottl OSSA_READ_LE_32(AGROOT, &SSPTag, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, SSPTag)); 3732285809Sscottl 3733285809Sscottl 3734285809Sscottl sspTag = (bit16)(SSPTag & SSPTAG_BITS); 3735285809Sscottl 3736285809Sscottl /* get IORequest from IOMap */ 3737285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 3738285809Sscottl 3739285809Sscottl SA_ASSERT((pRequest), "pRequest"); 3740285809Sscottl 3741285809Sscottl if(agNULL == pRequest) 3742285809Sscottl { 3743285809Sscottl SA_DBG1(("mpiSSPEvent: agNULL == pRequest event 0x%X\n", event)); 3744285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2u"); 3745285809Sscottl return AGSA_RC_FAILURE; 3746285809Sscottl } 3747285809Sscottl 3748285809Sscottl /* get port context */ 3749285809Sscottl portId = (bit8)(portId_tmp & PORTID_MASK); 3750285809Sscottl SA_DBG2(("mpiSSPEvent: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)); 3751285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext; 3752285809Sscottl /* get device Id */ 3753285809Sscottl deviceIdx = deviceId & DEVICE_ID_BITS; 3754285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 3755285809Sscottl /* find device handle from device index */ 3756285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceIdx].DeviceHandle; 3757285809Sscottl 3758285809Sscottl if( agNULL == pDevice ) 3759285809Sscottl { 3760285809Sscottl OS_ASSERT(pDevice, "pDevice"); 3761285809Sscottl agDevHandle = agNULL; 3762285809Sscottl } 3763285809Sscottl else 3764285809Sscottl { 3765285809Sscottl if (pDevice->targetDevHandle.sdkData) 3766285809Sscottl { 3767285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 3768285809Sscottl } 3769285809Sscottl else 3770285809Sscottl { 3771285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 3772285809Sscottl } 3773285809Sscottl } 3774285809Sscottl 3775285809Sscottl switch (event) 3776285809Sscottl { 3777285809Sscottl case OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH: 3778285809Sscottl case OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH: 3779285809Sscottl case OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH: 3780285809Sscottl case OSSA_IO_XFR_ERROR_DIF_MISMATCH: 3781285809Sscottl { 3782285809Sscottl 3783285809Sscottl SA_DBG1(("mpiSSPEvent: DIF Event 0x%x HTAG = 0x%x\n", event, tag)); 3784285809Sscottl 3785285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.UpperLBA, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, EVT_PARAM0_or_LBAH)); 3786285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.LowerLBA, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, EVT_PARAM1_or_LBAL)); 3787285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.sasAddressHi, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, SAS_ADDRH)); 3788285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.sasAddressLo, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, SAS_ADDRL)); 3789285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.ExpectedCRCUDT01, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, UDT1_E_UDT0_E_CRC_E)); 3790285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.ExpectedUDT2345, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, UDT5_E_UDT4_E_UDT3_E_UDT2_E)); 3791285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.ActualCRCUDT01, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, UDT1_A_UDT0_A_CRC_A)); 3792285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.ActualUDT2345, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, UDT5_A_UDT4_A_UDT3_A_UDT2_A)); 3793285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.DIFErrDevID, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, HW_DEVID_Reserved_DIF_ERR)); 3794285809Sscottl OSSA_READ_LE_32(AGROOT, &Dif_details.ErrBoffsetEDataLen, pIomb, OSSA_OFFSET_OF(agsaSSPEventRsp_t, EDATA_LEN_ERR_BOFF)); 3795285809Sscottl 3796285809Sscottl SA_DBG2(("mpiSSPEvent: UpperLBA. 0x%08X LowerLBA. 0x%08X\n",Dif_details.UpperLBA, Dif_details.LowerLBA)); 3797285809Sscottl SA_DBG2(("mpiSSPEvent: sasAddressHi. 0x%02X%02X%02X%02X sasAddressLo. 0x%02X%02X%02X%02X\n", 3798285809Sscottl Dif_details.sasAddressHi[0],Dif_details.sasAddressHi[1],Dif_details.sasAddressHi[2],Dif_details.sasAddressHi[3], 3799285809Sscottl Dif_details.sasAddressLo[0],Dif_details.sasAddressLo[1],Dif_details.sasAddressLo[2],Dif_details.sasAddressLo[3])); 3800285809Sscottl SA_DBG2(("mpiSSPEvent: ExpectedCRCUDT01. 0x%08X ExpectedUDT2345. 0x%08X\n",Dif_details.ExpectedCRCUDT01, Dif_details.ExpectedUDT2345)); 3801285809Sscottl SA_DBG2(("mpiSSPEvent: ActualCRCUDT01. 0x%08X ActualUDT2345. 0x%08X\n",Dif_details.ActualCRCUDT01, Dif_details.ActualUDT2345)); 3802285809Sscottl SA_DBG2(("mpiSSPEvent: DIFErrDevID. 0x%08X ErrBoffsetEDataLen. 0x%08X\n",Dif_details.DIFErrDevID, Dif_details.ErrBoffsetEDataLen)); 3803285809Sscottl } 3804285809Sscottl 3805285809Sscottl default: 3806285809Sscottl { 3807285809Sscottl SA_DBG3(("mpiSSPEvent: Non DIF event")); 3808285809Sscottl break; 3809285809Sscottl } 3810285809Sscottl } 3811285809Sscottl 3812285809Sscottl 3813285809Sscottl /* get event */ 3814285809Sscottl switch (event) 3815285809Sscottl { 3816285809Sscottl case OSSA_IO_OVERFLOW: 3817285809Sscottl { 3818285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OVERFLOW tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3819285809Sscottl saRoot->IoEventCount.agOSSA_IO_OVERFLOW++; 3820285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3821285809Sscottl break; 3822285809Sscottl } 3823285809Sscottl case OSSA_IO_XFER_ERROR_BREAK: 3824285809Sscottl { 3825285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_BREAK tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3826285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_BREAK++; 3827285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3828285809Sscottl break; 3829285809Sscottl } 3830285809Sscottl case OSSA_IO_XFER_ERROR_PHY_NOT_READY: 3831285809Sscottl { 3832285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_PHY_NOT_READY tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3833285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_PHY_NOT_READY++; 3834285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3835285809Sscottl break; 3836285809Sscottl } 3837285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED: 3838285809Sscottl { 3839285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3840285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED++; 3841285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3842285809Sscottl break; 3843285809Sscottl } 3844285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION: 3845285809Sscottl { 3846285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3847285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION++; 3848285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3849285809Sscottl break; 3850285809Sscottl } 3851285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BREAK: 3852285809Sscottl { 3853285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_BREAK tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3854285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_BREAK++; 3855285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3856285809Sscottl break; 3857285809Sscottl } 3858285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: 3859285809Sscottl { 3860285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3861285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS++; 3862285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3863285809Sscottl break; 3864285809Sscottl } 3865285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION: 3866285809Sscottl { 3867285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3868285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION++; 3869285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3870285809Sscottl break; 3871285809Sscottl } 3872285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED: 3873285809Sscottl { 3874285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3875285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED++; 3876285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3877285809Sscottl break; 3878285809Sscottl } 3879285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION: 3880285809Sscottl { 3881285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3882285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION++; 3883285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3884285809Sscottl break; 3885285809Sscottl } 3886285809Sscottl case OSSA_IO_XFER_ERROR_NAK_RECEIVED: 3887285809Sscottl { 3888285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_NAK_RECEIVED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3889285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_NAK_RECEIVED++; 3890285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3891285809Sscottl break; 3892285809Sscottl } 3893285809Sscottl case OSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT: 3894285809Sscottl { 3895285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3896285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_ACK_NAK_TIMEOUT++; 3897285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3898285809Sscottl break; 3899285809Sscottl } 3900285809Sscottl case OSSA_IO_XFER_ERROR_OFFSET_MISMATCH: 3901285809Sscottl { 3902285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_OFFSET_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3903285809Sscottl#ifdef SA_ENABLE_PCI_TRIGGER 3904285809Sscottl if( saRoot->swConfig.PCI_trigger & PCI_TRIGGER_OFFSET_MISMATCH ) 3905285809Sscottl { 3906285809Sscottl siPCITriger(agRoot); 3907285809Sscottl } 3908285809Sscottl#endif /* SA_ENABLE_PCI_TRIGGER */ 3909285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_OFFSET_MISMATCH++; 3910285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3911285809Sscottl break; 3912285809Sscottl } 3913285809Sscottl case OSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN: 3914285809Sscottl { 3915285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3916285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN++; 3917285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3918285809Sscottl break; 3919285809Sscottl } 3920285809Sscottl case OSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT: 3921285809Sscottl { 3922285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3923285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_CMD_ISSUE_ACK_NAK_TIMEOUT++; 3924285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3925285809Sscottl break; 3926285809Sscottl } 3927285809Sscottl case OSSA_IO_XFER_OPEN_RETRY_TIMEOUT: 3928285809Sscottl { 3929285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_OPEN_RETRY_TIMEOUT tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3930285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT++; 3931285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3932285809Sscottl break; 3933285809Sscottl } 3934285809Sscottl case OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN: 3935285809Sscottl { 3936285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3937285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN++; 3938285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3939285809Sscottl break; 3940285809Sscottl } 3941285809Sscottl case OSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED: 3942285809Sscottl { 3943285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3944285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED++; 3945285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3946285809Sscottl break; 3947285809Sscottl } 3948285809Sscottl case OSSA_IO_XFER_CMD_FRAME_ISSUED: 3949285809Sscottl { 3950285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_CMD_FRAME_ISSUED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3951285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_CMD_FRAME_ISSUED++; 3952285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3953285809Sscottl break; 3954285809Sscottl } 3955285809Sscottl case OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE: 3956285809Sscottl { 3957285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3958285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_UNEXPECTED_PHASE++; 3959285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3960285809Sscottl break; 3961285809Sscottl } 3962285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED: 3963285809Sscottl { 3964285809Sscottl SA_DBG1(("mpiSSPEvent:OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED HTAG = 0x%x sspTag = 0x%x\n", tag, sspTag)); 3965285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED++; 3966285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3967285809Sscottl break; 3968285809Sscottl } 3969285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO: 3970285809Sscottl { 3971285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3972285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_TMO++; 3973285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3974285809Sscottl break; 3975285809Sscottl } 3976285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST: 3977285809Sscottl { 3978285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3979285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++; 3980285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3981285809Sscottl break; 3982285809Sscottl } 3983285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE: 3984285809Sscottl { 3985285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3986285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE++; 3987285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3988285809Sscottl break; 3989285809Sscottl } 3990285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED: 3991285809Sscottl { 3992285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED tag 0x%x ssptag 0x%x\n", tag, sspTag)); 3993285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED++; 3994285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 3995285809Sscottl break; 3996285809Sscottl } 3997285809Sscottl case OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS: 3998285809Sscottl { 3999285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4000285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DEK_KEY_CACHE_MISS++; 4001285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 4002285809Sscottl break; 4003285809Sscottl } 4004285809Sscottl case OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH: 4005285809Sscottl { 4006285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4007285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DEK_KEY_TAG_MISMATCH++; 4008285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 4009285809Sscottl break; 4010285809Sscottl } 4011285809Sscottl case OSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR: 4012285809Sscottl { 4013285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR HTAG = 0x%x\n", tag)); 4014285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR++; 4015285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 4016285809Sscottl break; 4017285809Sscottl } 4018285809Sscottl case OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH: 4019285809Sscottl { 4020285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4021285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH++; 4022285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag,sizeof(agsaDifDetails_t),&Dif_details); 4023285809Sscottl break; 4024285809Sscottl } 4025285809Sscottl case OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH: 4026285809Sscottl { 4027285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4028285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH++; 4029285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag,sizeof(agsaDifDetails_t),&Dif_details); 4030285809Sscottl break; 4031285809Sscottl } 4032285809Sscottl case OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH: 4033285809Sscottl { 4034285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4035285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH++; 4036285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag,sizeof(agsaDifDetails_t),&Dif_details); 4037285809Sscottl break; 4038285809Sscottl } 4039285809Sscottl case OSSA_IO_XFR_ERROR_DIF_MISMATCH: 4040285809Sscottl { 4041285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFR_ERROR_DIF_MISMATCH tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4042285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DIF_MISMATCH++; 4043285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag,sizeof(agsaDifDetails_t),&Dif_details); 4044285809Sscottl break; 4045285809Sscottl } 4046285809Sscottl case OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN: 4047285809Sscottl { 4048285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4049285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN++; 4050285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0, agNULL); 4051285809Sscottl break; 4052285809Sscottl } 4053285809Sscottl case OSSA_IO_XFER_READ_COMPL_ERR: 4054285809Sscottl { 4055285809Sscottl SA_DBG1(("mpiSSPEvent: OSSA_IO_XFER_READ_COMPL_ERR tag 0x%x ssptag 0x%x\n", tag, sspTag)); 4056285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_READ_COMPL_ERR++; 4057285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0, agNULL); 4058285809Sscottl break; 4059285809Sscottl } 4060285809Sscottl default: 4061285809Sscottl { 4062285809Sscottl SA_DBG1(("mpiSSPEvent: Unknown Event 0x%x tag 0x%x ssptag 0x%x\n", event, tag, sspTag)); 4063285809Sscottl saRoot->IoEventCount.agOSSA_IO_UNKNOWN_ERROR++; 4064285809Sscottl ossaSSPEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, sspTag, 0,agNULL); 4065285809Sscottl break; 4066285809Sscottl } 4067285809Sscottl } 4068285809Sscottl 4069285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2u"); 4070285809Sscottl /* return value */ 4071285809Sscottl return ret; 4072285809Sscottl} 4073285809Sscottl 4074285809Sscottl/******************************************************************************/ 4075285809Sscottl/*! \brief SPC MPI SATA Event 4076285809Sscottl * 4077285809Sscottl * This function handles the SATA Event. 4078285809Sscottl * 4079285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4080285809Sscottl * \param pIomb pointer of Message 4081285809Sscottl * 4082285809Sscottl * \return The read value 4083285809Sscottl * 4084285809Sscottl */ 4085285809Sscottl/*******************************************************************************/ 4086285809SscottlGLOBAL bit32 mpiSATAEvent( 4087285809Sscottl agsaRoot_t *agRoot, 4088285809Sscottl agsaSATAEventRsp_t *pIomb 4089285809Sscottl ) 4090285809Sscottl{ 4091285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4092285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4093285809Sscottl agsaIORequestDesc_t *pRequest = agNULL; 4094285809Sscottl agsaPortContext_t *agPortContext; 4095285809Sscottl agsaDevHandle_t *agDevHandle; 4096285809Sscottl agsaDeviceDesc_t *pDevice; 4097285809Sscottl bit32 deviceIdx, portId_tmp, event, tag, deviceId; 4098285809Sscottl bit8 portId; 4099285809Sscottl 4100285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2w"); 4101285809Sscottl 4102285809Sscottl /* get port context */ 4103285809Sscottl OSSA_READ_LE_32(AGROOT, &portId_tmp, pIomb, OSSA_OFFSET_OF(agsaSATAEventRsp_t, portId)); 4104285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceId, pIomb, OSSA_OFFSET_OF(agsaSATAEventRsp_t, deviceId)); 4105285809Sscottl OSSA_READ_LE_32(AGROOT, &event, pIomb, OSSA_OFFSET_OF(agsaSATAEventRsp_t, event)); 4106285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSATAEventRsp_t, tag)); 4107285809Sscottl 4108285809Sscottl if (OSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE != event) 4109285809Sscottl { 4110285809Sscottl /* get IORequest from IOMap */ 4111285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4112285809Sscottl } 4113285809Sscottl /* get port context - only for OSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE */ 4114285809Sscottl portId = (bit8)(portId_tmp & PORTID_MASK); 4115285809Sscottl SA_DBG2(("mpiSATAEvent: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)); 4116285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId].PortContext; 4117285809Sscottl /* get device Id - only for OSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE*/ 4118285809Sscottl deviceIdx = deviceId & DEVICE_ID_BITS; 4119285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 4120285809Sscottl /* find device handle from device index */ 4121285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceIdx].DeviceHandle; 4122285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 4123285809Sscottl 4124285809Sscottl /* get event */ 4125285809Sscottl switch (event) 4126285809Sscottl { 4127285809Sscottl case OSSA_IO_OVERFLOW: 4128285809Sscottl { 4129285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OVERFLOW HTAG = 0x%x\n", tag)); 4130285809Sscottl saRoot->IoEventCount.agOSSA_IO_OVERFLOW++; 4131285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4132285809Sscottl break; 4133285809Sscottl } 4134285809Sscottl case OSSA_IO_XFER_ERROR_BREAK: 4135285809Sscottl { 4136285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_BREAK HTAG = 0x%x\n", tag)); 4137285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_BREAK++; 4138285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4139285809Sscottl break; 4140285809Sscottl } 4141285809Sscottl case OSSA_IO_XFER_ERROR_PHY_NOT_READY: 4142285809Sscottl { 4143285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_PHY_NOT_READY HTAG = 0x%x\n", tag)); 4144285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_PHY_NOT_READY++; 4145285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4146285809Sscottl break; 4147285809Sscottl } 4148285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED: 4149285809Sscottl { 4150285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED HTAG = 0x%x\n", tag)); 4151285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_PROTOCOL_NOT_SUPPORTED++; 4152285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4153285809Sscottl break; 4154285809Sscottl } 4155285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION: 4156285809Sscottl { 4157285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION HTAG = 0x%x\n", tag)); 4158285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_ZONE_VIOLATION++; 4159285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4160285809Sscottl break; 4161285809Sscottl } 4162285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BREAK: 4163285809Sscottl { 4164285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_BREAK HTAG = 0x%x\n", tag)); 4165285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_BREAK++; 4166285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4167285809Sscottl break; 4168285809Sscottl } 4169285809Sscottl 4170285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST: 4171285809Sscottl { 4172285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST HTAG = 0x%x\n", tag)); 4173285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_NO_DEST++; 4174285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4175285809Sscottl break; 4176285809Sscottl } 4177285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE: 4178285809Sscottl { 4179285809Sscottl SA_DBG1(("mpiSATAEvent: HTAG = 0x%x\n", tag)); 4180285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_COLLIDE++; 4181285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4182285809Sscottl break; 4183285809Sscottl } 4184285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED: 4185285809Sscottl { 4186285809Sscottl SA_DBG1(("mpiSATAEvent:OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED HTAG = 0x%x\n", tag)); 4187285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_PATHWAY_BLOCKED++; 4188285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4189285809Sscottl break; 4190285809Sscottl } 4191285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS: 4192285809Sscottl { 4193285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS HTAG = 0x%x\n", tag)); 4194285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS++; 4195285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4196285809Sscottl break; 4197285809Sscottl } 4198285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION: 4199285809Sscottl { 4200285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION HTAG = 0x%x\n", tag)); 4201285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_BAD_DESTINATION++; 4202285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4203285809Sscottl break; 4204285809Sscottl } 4205285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED: 4206285809Sscottl { 4207285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED HTAG = 0x%x\n", tag)); 4208285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_CONNECTION_RATE_NOT_SUPPORTED++; 4209285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4210285809Sscottl break; 4211285809Sscottl } 4212285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION: 4213285809Sscottl { 4214285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION HTAG = 0x%x\n", tag)); 4215285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_WRONG_DESTINATION++; 4216285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4217285809Sscottl break; 4218285809Sscottl } 4219285809Sscottl case OSSA_IO_XFER_ERROR_NAK_RECEIVED: 4220285809Sscottl { 4221285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_NAK_RECEIVED HTAG = 0x%x\n", tag)); 4222285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_NAK_RECEIVED++; 4223285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4224285809Sscottl break; 4225285809Sscottl } 4226285809Sscottl case OSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE: 4227285809Sscottl { 4228285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE HTAG = 0x%x\n", tag)); 4229285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_ABORTED_NCQ_MODE++; 4230285809Sscottl ossaSATAEvent(agRoot, agNULL, agPortContext, agDevHandle, event, 0, agNULL); 4231285809Sscottl break; 4232285809Sscottl } 4233285809Sscottl case OSSA_IO_XFER_ERROR_OFFSET_MISMATCH: 4234285809Sscottl { 4235285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_OFFSET_MISMATCH HTAG = 0x%x\n", tag)); 4236285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_OFFSET_MISMATCH++; 4237285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4238285809Sscottl break; 4239285809Sscottl } 4240285809Sscottl case OSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN: 4241285809Sscottl { 4242285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN HTAG = 0x%x\n", tag)); 4243285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_ZERO_DATA_LEN++; 4244285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4245285809Sscottl break; 4246285809Sscottl } 4247285809Sscottl case OSSA_IO_XFER_OPEN_RETRY_TIMEOUT: 4248285809Sscottl { 4249285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_OPEN_RETRY_TIMEOUT HTAG = 0x%x\n", tag)); 4250285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_OPEN_RETRY_TIMEOUT++; 4251285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4252285809Sscottl break; 4253285809Sscottl } 4254285809Sscottl case OSSA_IO_XFER_ERROR_PEER_ABORTED: 4255285809Sscottl { 4256285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_PEER_ABORTED HTAG = 0x%x\n", tag)); 4257285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_PEER_ABORTED++; 4258285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4259285809Sscottl break; 4260285809Sscottl } 4261285809Sscottl case OSSA_IO_XFER_CMD_FRAME_ISSUED: 4262285809Sscottl { 4263285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_CMD_FRAME_ISSUED HTAG = 0x%x\n", tag)); 4264285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_CMD_FRAME_ISSUED++; 4265285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4266285809Sscottl break; 4267285809Sscottl } 4268285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY: 4269285809Sscottl { 4270285809Sscottl SA_DBG1(("mpiSATAEvent, OSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY HTAG = 0x%x\n", tag)); 4271285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY++; 4272285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4273285809Sscottl break; 4274285809Sscottl } 4275285809Sscottl case OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE: 4276285809Sscottl { 4277285809Sscottl SA_DBG1(("mpiSATAEvent, OSSA_IO_XFER_ERROR_UNEXPECTED_PHASE HTAG = 0x%x\n", tag)); 4278285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_UNEXPECTED_PHASE++; 4279285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4280285809Sscottl break; 4281285809Sscottl } 4282285809Sscottl case OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN: 4283285809Sscottl { 4284285809Sscottl SA_DBG1(("mpiSATAEvent, OSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN HTAG = 0x%x\n", tag)); 4285285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_RDY_OVERRUN++; 4286285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4287285809Sscottl break; 4288285809Sscottl } 4289285809Sscottl case OSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED: 4290285809Sscottl { 4291285809Sscottl SA_DBG1(("mpiSATAEvent, OSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED HTAG = 0x%x\n", tag)); 4292285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_XFER_RDY_NOT_EXPECTED++; 4293285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4294285809Sscottl break; 4295285809Sscottl } 4296285809Sscottl case OSSA_IO_XFER_PIO_SETUP_ERROR: 4297285809Sscottl { 4298285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_PIO_SETUP_ERROR HTAG = 0x%x\n", tag)); 4299285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_PIO_SETUP_ERROR++; 4300285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4301285809Sscottl break; 4302285809Sscottl } 4303285809Sscottl case OSSA_IO_XFR_ERROR_DIF_MISMATCH: 4304285809Sscottl { 4305285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFR_ERROR_DIF_MISMATCH HTAG = 0x%x\n", tag)); 4306285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_DIF_MISMATCH++; 4307285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4308285809Sscottl break; 4309285809Sscottl } 4310285809Sscottl case OSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR: 4311285809Sscottl { 4312285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR HTAG = 0x%x\n", tag)); 4313285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFR_ERROR_INTERNAL_CRC_ERROR++; 4314285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4315285809Sscottl break; 4316285809Sscottl } 4317285809Sscottl case OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED: 4318285809Sscottl { 4319285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED HTAG = 0x%x\n", tag)); 4320285809Sscottl saRoot->IoEventCount.agOSSA_IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS_OPEN_RETRY_BACKOFF_THRESHOLD_REACHED++; 4321285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4322285809Sscottl break; 4323285809Sscottl } 4324285809Sscottl case OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN: 4325285809Sscottl { 4326285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERR_EOB_DATA_OVERRUN HTAG = 0x%x\n", tag)); 4327285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERR_EOB_DATA_OVERRUN++; 4328285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4329285809Sscottl break; 4330285809Sscottl } 4331285809Sscottl case OSSA_IO_XFER_ERROR_DMA_ACTIVATE_TIMEOUT: 4332285809Sscottl { 4333285809Sscottl SA_DBG1(("mpiSATAEvent: OSSA_IO_XFER_ERROR_DMA_ACTIVATE_TIMEOUT HTAG = 0x%x\n", tag)); 4334285809Sscottl saRoot->IoEventCount.agOSSA_IO_XFER_ERROR_DMA_ACTIVATE_TIMEOUT++; 4335285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4336285809Sscottl break; 4337285809Sscottl } 4338285809Sscottl default: 4339285809Sscottl { 4340285809Sscottl SA_DBG1(("mpiSATAEvent: Unknown Event 0x%x HTAG = 0x%x\n", event, tag)); 4341285809Sscottl saRoot->IoEventCount.agOSSA_IO_UNKNOWN_ERROR++; 4342285809Sscottl ossaSATAEvent(agRoot, pRequest->pIORequestContext, agPortContext, agDevHandle, event, 0, agNULL); 4343285809Sscottl break; 4344285809Sscottl } 4345285809Sscottl } 4346285809Sscottl 4347285809Sscottl /* return value */ 4348285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2w"); 4349285809Sscottl return ret; 4350285809Sscottl} 4351285809Sscottl 4352285809Sscottl/******************************************************************************/ 4353285809Sscottl/*! \brief Set NVM Data Response 4354285809Sscottl * 4355285809Sscottl * This routine handles the response of SET NVM Data Response 4356285809Sscottl * 4357285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4358285809Sscottl * \param pIomb Pointer of IOMB Mesage 4359285809Sscottl * 4360285809Sscottl * \return sucess or fail 4361285809Sscottl * 4362285809Sscottl */ 4363285809Sscottl/*******************************************************************************/ 4364285809SscottlGLOBAL bit32 mpiSetNVMDataRsp( 4365285809Sscottl agsaRoot_t *agRoot, 4366285809Sscottl agsaSetNVMDataRsp_t *pIomb 4367285809Sscottl ) 4368285809Sscottl{ 4369285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4370285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4371285809Sscottl agsaIORequestDesc_t *pRequest; 4372285809Sscottl agsaContext_t *agContext; 4373285809Sscottl bit32 tag, status, iPTdaBnDpsAsNvm; 4374285809Sscottl 4375285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2x"); 4376285809Sscottl 4377285809Sscottl SA_DBG1(("mpiSetNVMDataRsp: HTag=0x%x\n", pIomb->tag)); 4378285809Sscottl 4379285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSetNVMDataRsp_t, tag)); 4380285809Sscottl OSSA_READ_LE_32(AGROOT, &iPTdaBnDpsAsNvm, pIomb, OSSA_OFFSET_OF(agsaSetNVMDataRsp_t, iPTdaBnDpsAsNvm)); 4381285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSetNVMDataRsp_t, status)); 4382285809Sscottl 4383285809Sscottl /* get request from IOMap */ 4384285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4385285809Sscottl if (agNULL == pRequest) 4386285809Sscottl { 4387285809Sscottl SA_DBG1(("mpiSetNVMDataRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 4388285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2x"); 4389285809Sscottl return AGSA_RC_FAILURE; 4390285809Sscottl } 4391285809Sscottl 4392285809Sscottl agContext = saRoot->IOMap[tag].agContext; 4393285809Sscottl /* remove the request from IOMap */ 4394285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4395285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4396285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 4397285809Sscottl 4398285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 4399285809Sscottl 4400285809Sscottl if (((iPTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_CONFIG_SEEPROM) || 4401285809Sscottl ((iPTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_VPD_FLASH) || 4402285809Sscottl ((iPTdaBnDpsAsNvm & NVMD_TYPE) == AGSA_NVMD_TWI_DEVICES)) 4403285809Sscottl { 4404285809Sscottl /* CB for VPD for SEEPROM-0, VPD_FLASH and TWI */ 4405285809Sscottl ossaSetNVMDResponseCB(agRoot, agContext, (status & NVMD_STAT)); 4406285809Sscottl } 4407285809Sscottl else 4408285809Sscottl { 4409285809Sscottl /* should not happend */ 4410285809Sscottl SA_DBG1(("mpiSetNVMDataRsp: NVMD is wrong. TAG=0x%x STATUS=0x%x\n", tag, (iPTdaBnDpsAsNvm & NVMD_TYPE))); 4411285809Sscottl ret = AGSA_RC_FAILURE; 4412285809Sscottl } 4413285809Sscottl 4414285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4415285809Sscottl pRequest->valid = agFALSE; 4416285809Sscottl /* return the request to free pool */ 4417285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4418285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4419285809Sscottl 4420285809Sscottl /* return value */ 4421285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2x"); 4422285809Sscottl return ret; 4423285809Sscottl} 4424285809Sscottl 4425285809Sscottl/******************************************************************************/ 4426285809Sscottl/*! \brief SPC MPI SSP ABORT Response 4427285809Sscottl * 4428285809Sscottl * This function handles the SSP Abort Response. 4429285809Sscottl * 4430285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4431285809Sscottl * \param pIomb pointer of Message 4432285809Sscottl * 4433285809Sscottl * \return The read value 4434285809Sscottl * 4435285809Sscottl */ 4436285809Sscottl/*******************************************************************************/ 4437285809SscottlGLOBAL bit32 mpiSSPAbortRsp( 4438285809Sscottl agsaRoot_t *agRoot, 4439285809Sscottl agsaSSPAbortRsp_t *pIomb 4440285809Sscottl ) 4441285809Sscottl{ 4442285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4443285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4444285809Sscottl agsaIORequestDesc_t *pRequest; 4445285809Sscottl agsaDeviceDesc_t *pDevice; 4446285809Sscottl bit32 tag, status, scope; 4447285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2y"); 4448285809Sscottl 4449285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSSPAbortRsp_t, tag)); 4450285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSSPAbortRsp_t, status)); 4451285809Sscottl OSSA_READ_LE_32(AGROOT, &scope, pIomb, OSSA_OFFSET_OF(agsaSSPAbortRsp_t, scp)); 4452285809Sscottl scope &= 3; 4453285809Sscottl /* get IORequest from IOMap */ 4454285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4455285809Sscottl 4456285809Sscottl if (agNULL == pRequest) 4457285809Sscottl { 4458285809Sscottl /* remove the SSP_ABORT or SATA_ABORT request from IOMap */ 4459285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4460285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4461285809Sscottl SA_ASSERT((pRequest), "pRequest"); 4462285809Sscottl SA_DBG1(("mpiSSPAbortRsp: the request is NULL. Tag=%x\n", tag)); 4463285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2y"); 4464285809Sscottl return AGSA_RC_FAILURE; 4465285809Sscottl } 4466285809Sscottl 4467285809Sscottl 4468285809Sscottl if ( agTRUE == pRequest->valid ) 4469285809Sscottl { 4470285809Sscottl pDevice = pRequest->pDevice; 4471285809Sscottl SA_ASSERT((pRequest->pDevice), "pRequest->pDevice"); 4472285809Sscottl 4473285809Sscottl SA_DBG3(("mpiSSPAbortRsp: request abort is valid Htag 0x%x\n", tag)); 4474285809Sscottl /* remove the SSP_ABORT or SATA_ABORT request from IOMap */ 4475285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4476285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4477285809Sscottl 4478285809Sscottl if( pRequest->completionCB == agNULL ) 4479285809Sscottl { 4480285809Sscottl ossaSSPAbortCB(agRoot, pRequest->pIORequestContext, scope, status); 4481285809Sscottl } 4482285809Sscottl else 4483285809Sscottl { 4484285809Sscottl (*(ossaGenericAbortCB_t)(pRequest->completionCB))(agRoot, pRequest->pIORequestContext, scope, status); 4485285809Sscottl } 4486285809Sscottl 4487285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4488285809Sscottl pRequest->valid = agFALSE; 4489285809Sscottl /* Delete the request from the pendingIORequests */ 4490285809Sscottl saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode)); 4491285809Sscottl 4492285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 4493285809Sscottl { 4494285809Sscottl SA_DBG1(("mpiSSPAbortRsp: saving pRequest (%p) for later use\n", pRequest)); 4495285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 4496285809Sscottl } 4497285809Sscottl else 4498285809Sscottl { 4499285809Sscottl /* return the request to free pool */ 4500285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4501285809Sscottl } 4502285809Sscottl 4503285809Sscottl if(scope) 4504285809Sscottl { 4505285809Sscottl siCountActiveIORequestsOnDevice( agRoot, pDevice->DeviceMapIndex ); 4506285809Sscottl } 4507285809Sscottl 4508285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4509285809Sscottl 4510285809Sscottl } 4511285809Sscottl else 4512285809Sscottl { 4513285809Sscottl ret = AGSA_RC_FAILURE; 4514285809Sscottl SA_DBG1(("mpiSSPAbortRsp: the request is not valid any more. Tag=%x\n", pRequest->HTag)); 4515285809Sscottl } 4516285809Sscottl 4517285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2y"); 4518285809Sscottl return ret; 4519285809Sscottl} 4520285809Sscottl 4521285809Sscottl/******************************************************************************/ 4522285809Sscottl/*! \brief SPC MPI SATA ABORT Response 4523285809Sscottl * 4524285809Sscottl * This function handles the SATA Event. 4525285809Sscottl * 4526285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4527285809Sscottl * \param pIomb pointer of Message 4528285809Sscottl * 4529285809Sscottl * \return The read value 4530285809Sscottl * 4531285809Sscottl */ 4532285809Sscottl/*******************************************************************************/ 4533285809SscottlGLOBAL bit32 mpiSATAAbortRsp( 4534285809Sscottl agsaRoot_t *agRoot, 4535285809Sscottl agsaSATAAbortRsp_t *pIomb 4536285809Sscottl ) 4537285809Sscottl{ 4538285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4539285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4540285809Sscottl agsaIORequestDesc_t *pRequest; 4541285809Sscottl agsaDeviceDesc_t *pDevice; 4542285809Sscottl bit32 tag, status, scope; 4543285809Sscottl 4544285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3B"); 4545285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSATAAbortRsp_t, tag)); 4546285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSATAAbortRsp_t, status)); 4547285809Sscottl OSSA_READ_LE_32(AGROOT, &scope, pIomb, OSSA_OFFSET_OF(agsaSATAAbortRsp_t, scp)); 4548285809Sscottl 4549285809Sscottl /* get IORequest from IOMap */ 4550285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4551285809Sscottl 4552285809Sscottl if (agNULL == pRequest) 4553285809Sscottl { 4554285809Sscottl /* remove the SSP_ABORT or SATA_ABORT request from IOMap */ 4555285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4556285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4557285809Sscottl SA_DBG1(("mpiSATAAbortRsp: the request is NULL. Tag=%x\n", tag)); 4558285809Sscottl SA_ASSERT((pRequest), "pRequest"); 4559285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3B"); 4560285809Sscottl return AGSA_RC_FAILURE; 4561285809Sscottl } 4562285809Sscottl 4563285809Sscottl if ( agTRUE == pRequest->valid ) 4564285809Sscottl { 4565285809Sscottl pDevice = pRequest->pDevice; 4566285809Sscottl SA_ASSERT((pRequest->pDevice), "pRequest->pDevice"); 4567285809Sscottl 4568285809Sscottl SA_DBG3(("mpiSATAAbortRsp: request abort is valid Htag 0x%x\n", tag)); 4569285809Sscottl 4570285809Sscottl if( pRequest->completionCB == agNULL ) 4571285809Sscottl { 4572285809Sscottl ossaSATAAbortCB(agRoot, pRequest->pIORequestContext, scope, status); 4573285809Sscottl } 4574285809Sscottl else 4575285809Sscottl { 4576285809Sscottl (*(ossaGenericAbortCB_t)(pRequest->completionCB))(agRoot, pRequest->pIORequestContext, scope, status); 4577285809Sscottl } 4578285809Sscottl /* remove the SATA_ABORT request from IOMap */ 4579285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4580285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4581285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 4582285809Sscottl 4583285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4584285809Sscottl pRequest->valid = agFALSE; 4585285809Sscottl /* Delete the request from the pendingIORequests */ 4586285809Sscottl saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode)); 4587285809Sscottl /* return the request to free pool */ 4588285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4589285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4590285809Sscottl 4591285809Sscottl } 4592285809Sscottl else 4593285809Sscottl { 4594285809Sscottl ret = AGSA_RC_FAILURE; 4595285809Sscottl SA_DBG1(("mpiSATAAbortRsp: the request is not valid any more. Tag=%x\n", pRequest->HTag)); 4596285809Sscottl } 4597285809Sscottl 4598285809Sscottl 4599285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3B"); 4600285809Sscottl return ret; 4601285809Sscottl} 4602285809Sscottl 4603285809Sscottl/******************************************************************************/ 4604285809Sscottl/*! \brief Set GPIO Response 4605285809Sscottl * 4606285809Sscottl * This routine handles the response of GPIO Command 4607285809Sscottl * 4608285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4609285809Sscottl * \param pIomb Pointer of IOMB Mesage 4610285809Sscottl * 4611285809Sscottl * \return sucess or fail 4612285809Sscottl * 4613285809Sscottl */ 4614285809Sscottl/*******************************************************************************/ 4615285809SscottlGLOBAL bit32 mpiGPIORsp( 4616285809Sscottl agsaRoot_t *agRoot, 4617285809Sscottl agsaGPIORsp_t *pIomb 4618285809Sscottl ) 4619285809Sscottl{ 4620285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4621285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4622285809Sscottl agsaContext_t *agContext; 4623285809Sscottl agsaIORequestDesc_t *pRequest; 4624285809Sscottl agsaGpioPinSetupInfo_t pinSetupInfo; 4625285809Sscottl agsaGpioEventSetupInfo_t eventSetupInfo; 4626285809Sscottl bit32 GpioIe, OT11_0, OT19_12, GPIEVChange, GPIEVFall, GPIEVRise, GpioRdVal, tag; 4627285809Sscottl 4628285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"5C"); 4629285809Sscottl 4630285809Sscottl SA_DBG3(("mpiGPIORsp: HTag=0x%x\n", pIomb->tag)); 4631285809Sscottl 4632285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, tag)); 4633285809Sscottl 4634285809Sscottl /* get request from IOMap */ 4635285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4636285809Sscottl if (agNULL == pRequest) 4637285809Sscottl { 4638285809Sscottl SA_DBG1(("mpiGPIORsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x\n", tag)); 4639285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "5C"); 4640285809Sscottl return AGSA_RC_FAILURE; 4641285809Sscottl } 4642285809Sscottl 4643285809Sscottl agContext = saRoot->IOMap[tag].agContext; 4644285809Sscottl /* remove the request from IOMap */ 4645285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4646285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4647285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 4648285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 4649285809Sscottl 4650285809Sscottl /* set payload to zeros */ 4651285809Sscottl si_memset(&pinSetupInfo, 0, sizeof(agsaGpioPinSetupInfo_t)); 4652285809Sscottl si_memset(&eventSetupInfo, 0, sizeof(agsaGpioEventSetupInfo_t)); 4653285809Sscottl 4654285809Sscottl OSSA_READ_LE_32(AGROOT, &GpioIe, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, GpioIe)); 4655285809Sscottl OSSA_READ_LE_32(AGROOT, &OT11_0, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, OT11_0)); 4656285809Sscottl OSSA_READ_LE_32(AGROOT, &OT19_12, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, OT19_12)); 4657285809Sscottl OSSA_READ_LE_32(AGROOT, &GPIEVChange, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, GPIEVChange)); 4658285809Sscottl OSSA_READ_LE_32(AGROOT, &GPIEVFall, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, GPIEVFall)); 4659285809Sscottl OSSA_READ_LE_32(AGROOT, &GPIEVRise, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, GPIEVRise)); 4660285809Sscottl OSSA_READ_LE_32(AGROOT, &GpioRdVal, pIomb, OSSA_OFFSET_OF(agsaGPIORsp_t, GpioRdVal)); 4661285809Sscottl pinSetupInfo.gpioInputEnabled = GpioIe; 4662285809Sscottl pinSetupInfo.gpioTypePart1 = OT11_0; 4663285809Sscottl pinSetupInfo.gpioTypePart2 = OT19_12; 4664285809Sscottl eventSetupInfo.gpioEventLevel = GPIEVChange; 4665285809Sscottl eventSetupInfo.gpioEventFallingEdge = GPIEVFall; 4666285809Sscottl eventSetupInfo.gpioEventRisingEdge = GPIEVRise; 4667285809Sscottl 4668285809Sscottl ossaGpioResponseCB(agRoot, agContext, OSSA_IO_SUCCESS, GpioRdVal, 4669285809Sscottl &pinSetupInfo, 4670285809Sscottl &eventSetupInfo); 4671285809Sscottl 4672285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4673285809Sscottl pRequest->valid = agFALSE; 4674285809Sscottl /* return the request to free pool */ 4675285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 4676285809Sscottl { 4677285809Sscottl SA_DBG1(("mpiGPIORsp: saving pRequest (%p) for later use\n", pRequest)); 4678285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 4679285809Sscottl } 4680285809Sscottl else 4681285809Sscottl { 4682285809Sscottl /* return the request to free pool */ 4683285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4684285809Sscottl } 4685285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4686285809Sscottl 4687285809Sscottl /* return value */ 4688285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "5C"); 4689285809Sscottl return ret; 4690285809Sscottl} 4691285809Sscottl 4692285809Sscottl/******************************************************************************/ 4693285809Sscottl/*! \brief Set GPIO Event Response 4694285809Sscottl * 4695285809Sscottl * This routine handles the response of GPIO Event 4696285809Sscottl * 4697285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4698285809Sscottl * \param pIomb Pointer of IOMB Mesage 4699285809Sscottl * 4700285809Sscottl * \return sucess or fail 4701285809Sscottl * 4702285809Sscottl */ 4703285809Sscottl/*******************************************************************************/ 4704285809SscottlGLOBAL bit32 mpiGPIOEventRsp( 4705285809Sscottl agsaRoot_t *agRoot, 4706285809Sscottl agsaGPIOEvent_t *pIomb 4707285809Sscottl ) 4708285809Sscottl{ 4709285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4710285809Sscottl bit32 GpioEvent; 4711285809Sscottl 4712285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3D"); 4713285809Sscottl 4714285809Sscottl OSSA_READ_LE_32(AGROOT, &GpioEvent, pIomb, OSSA_OFFSET_OF(agsaGPIOEvent_t, GpioEvent)); 4715285809Sscottl 4716285809Sscottl ossaGpioEvent(agRoot, GpioEvent); 4717285809Sscottl 4718285809Sscottl /* return value */ 4719285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3D"); 4720285809Sscottl return ret; 4721285809Sscottl} 4722285809Sscottl 4723285809Sscottl/******************************************************************************/ 4724285809Sscottl/*! \brief SAS Diagnostic Start/End Response 4725285809Sscottl * 4726285809Sscottl * This routine handles the response of SAS Diagnostic Start/End Command 4727285809Sscottl * 4728285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4729285809Sscottl * \param pIomb Pointer of IOMB Mesage 4730285809Sscottl * 4731285809Sscottl * \return sucess or fail 4732285809Sscottl * 4733285809Sscottl */ 4734285809Sscottl/*******************************************************************************/ 4735285809SscottlGLOBAL bit32 mpiSASDiagStartEndRsp( 4736285809Sscottl agsaRoot_t *agRoot, 4737285809Sscottl agsaSASDiagStartEndRsp_t *pIomb 4738285809Sscottl ) 4739285809Sscottl{ 4740285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4741285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4742285809Sscottl agsaIORequestDesc_t *pRequest; 4743285809Sscottl agsaContext_t *agContext; 4744285809Sscottl bit32 tag, Status; 4745285809Sscottl 4746285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2F"); 4747285809Sscottl 4748285809Sscottl SA_DBG3(("mpiSASDiagStartEndRsp: HTAG=0x%x\n", pIomb->tag)); 4749285809Sscottl 4750285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSASDiagStartEndRsp_t, tag)); 4751285809Sscottl OSSA_READ_LE_32(AGROOT, &Status, pIomb, OSSA_OFFSET_OF(agsaSASDiagStartEndRsp_t, Status)); 4752285809Sscottl 4753285809Sscottl /* get request from IOMap */ 4754285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4755285809Sscottl if (agNULL == pRequest) 4756285809Sscottl { 4757285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, Status)); 4758285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2F"); 4759285809Sscottl return AGSA_RC_FAILURE; 4760285809Sscottl } 4761285809Sscottl 4762285809Sscottl agContext = saRoot->IOMap[tag].agContext; 4763285809Sscottl /* remove the request from IOMap */ 4764285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4765285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4766285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 4767285809Sscottl 4768285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 4769285809Sscottl 4770285809Sscottl switch(Status) 4771285809Sscottl { 4772285809Sscottl 4773285809Sscottl case OSSA_DIAG_SE_SUCCESS: 4774285809Sscottl SA_DBG3(("mpiSASDiagStartEndRsp: Status OSSA_DIAG_SE_SUCCESS 0x%X \n", Status)); 4775285809Sscottl break; 4776285809Sscottl case OSSA_DIAG_SE_INVALID_PHY_ID: 4777285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: Status OSSA_DIAG_SE_INVALID_PHY_ID 0x%X \n", Status)); 4778285809Sscottl break; 4779285809Sscottl case OSSA_DIAG_PHY_NOT_DISABLED: 4780285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: Status OSSA_DIAG_PHY_NOT_DISABLED Status 0x%X \n", Status)); 4781285809Sscottl break; 4782285809Sscottl case OSSA_DIAG_OTHER_FAILURE: 4783285809Sscottl if(smIS_SPCV(agRoot)) 4784285809Sscottl { 4785285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: Status OSSA_DIAG_OTHER_FAILURE Status 0x%X \n", Status)); 4786285809Sscottl } 4787285809Sscottl else 4788285809Sscottl { 4789285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: Status OSSA_DIAG_OPCODE_INVALID Status 0x%X \n", Status)); 4790285809Sscottl } 4791285809Sscottl break; 4792285809Sscottl default: 4793285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp:Status UNKNOWN 0x%X \n", Status)); 4794285809Sscottl break; 4795285809Sscottl } 4796285809Sscottl 4797285809Sscottl ossaSASDiagStartEndCB(agRoot, agContext, Status); 4798285809Sscottl 4799285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4800285809Sscottl pRequest->valid = agFALSE; 4801285809Sscottl /* return the request to free pool */ 4802285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 4803285809Sscottl { 4804285809Sscottl SA_DBG1(("mpiSASDiagStartEndRsp: saving pRequest (%p) for later use\n", pRequest)); 4805285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 4806285809Sscottl } 4807285809Sscottl else 4808285809Sscottl { 4809285809Sscottl /* return the request to free pool */ 4810285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4811285809Sscottl } 4812285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4813285809Sscottl 4814285809Sscottl /* return value */ 4815285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2F"); 4816285809Sscottl return ret; 4817285809Sscottl} 4818285809Sscottl 4819285809Sscottl/******************************************************************************/ 4820285809Sscottl/*! \brief SAS Diagnostic Execute Response 4821285809Sscottl * 4822285809Sscottl * This routine handles the response of SAS Diagnostic Execute Command 4823285809Sscottl * 4824285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4825285809Sscottl * \param pIomb Pointer of IOMB Mesage 4826285809Sscottl * 4827285809Sscottl * \return sucess or fail 4828285809Sscottl * 4829285809Sscottl */ 4830285809Sscottl/*******************************************************************************/ 4831285809SscottlGLOBAL bit32 mpiSASDiagExecuteRsp( 4832285809Sscottl agsaRoot_t *agRoot, 4833285809Sscottl agsaSASDiagExecuteRsp_t *pIomb 4834285809Sscottl ) 4835285809Sscottl{ 4836285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4837285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4838285809Sscottl agsaIORequestDesc_t *pRequest; 4839285809Sscottl agsaContext_t *agContext; 4840285809Sscottl bit32 tag, Status, CmdTypeDescPhyId, ReportData; 4841285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3G"); 4842285809Sscottl 4843285809Sscottl SA_DBG3(("mpiSASDiagExecuteRsp: HTAG=0x%x\n", pIomb->tag)); 4844285809Sscottl 4845285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSASDiagExecuteRsp_t, tag)); 4846285809Sscottl OSSA_READ_LE_32(AGROOT, &Status, pIomb, OSSA_OFFSET_OF(agsaSASDiagExecuteRsp_t, Status)); 4847285809Sscottl OSSA_READ_LE_32(AGROOT, &CmdTypeDescPhyId, pIomb, OSSA_OFFSET_OF(agsaSASDiagExecuteRsp_t, CmdTypeDescPhyId)); 4848285809Sscottl OSSA_READ_LE_32(AGROOT, &ReportData, pIomb, OSSA_OFFSET_OF(agsaSASDiagExecuteRsp_t, ReportData)); 4849285809Sscottl /* get request from IOMap */ 4850285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 4851285809Sscottl if (agNULL == pRequest) 4852285809Sscottl { 4853285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x STATUS=0x%x\n", tag, Status)); 4854285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3G"); 4855285809Sscottl return AGSA_RC_FAILURE; 4856285809Sscottl } 4857285809Sscottl 4858285809Sscottl switch(Status) 4859285809Sscottl { 4860285809Sscottl 4861285809Sscottl case OSSA_DIAG_SUCCESS: 4862285809Sscottl SA_DBG3(("mpiSASDiagExecuteRsp: Status OSSA_DIAG_SUCCESS 0x%X \n", Status)); 4863285809Sscottl break; 4864285809Sscottl case OSSA_DIAG_INVALID_COMMAND: 4865285809Sscottl if(smIS_SPCV(agRoot)) 4866285809Sscottl { 4867285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status OSSA_DIAG_INVALID_COMMAND Status 0x%X \n", Status)); 4868285809Sscottl } 4869285809Sscottl else 4870285809Sscottl { 4871285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status OSSA_DIAG_FAIL Status 0x%X \n", Status)); 4872285809Sscottl } 4873285809Sscottl break; 4874285809Sscottl case OSSA_REGISTER_ACCESS_TIMEOUT: 4875285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status OSSA_REGISTER_ACCESS_TIMEOUT Status 0x%X \n", Status)); 4876285809Sscottl break; 4877285809Sscottl case OSSA_DIAG_NOT_IN_DIAGNOSTIC_MODE: 4878285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status OSSA_DIAG_NOT_IN_DIAGNOSTIC_MODE Status 0x%X \n", Status)); 4879285809Sscottl break; 4880285809Sscottl case OSSA_DIAG_INVALID_PHY: 4881285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status OSSA_DIAG_INVALID_PHY Status 0x%X \n", Status)); 4882285809Sscottl break; 4883285809Sscottl case OSSA_MEMORY_ALLOC_FAILURE: 4884285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: Status Status 0x%X \n", Status)); 4885285809Sscottl break; 4886285809Sscottl 4887285809Sscottl default: 4888285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp:Status UNKNOWN 0x%X \n", Status)); 4889285809Sscottl break; 4890285809Sscottl } 4891285809Sscottl 4892285809Sscottl 4893285809Sscottl agContext = saRoot->IOMap[tag].agContext; 4894285809Sscottl /* remove the request from IOMap */ 4895285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 4896285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 4897285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 4898285809Sscottl 4899285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 4900285809Sscottl 4901285809Sscottl ossaSASDiagExecuteCB(agRoot, agContext, Status, CmdTypeDescPhyId, ReportData); 4902285809Sscottl 4903285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4904285809Sscottl pRequest->valid = agFALSE; 4905285809Sscottl /* return the request to free pool */ 4906285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 4907285809Sscottl { 4908285809Sscottl SA_DBG1(("mpiSASDiagExecuteRsp: saving pRequest (%p) for later use\n", pRequest)); 4909285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 4910285809Sscottl } 4911285809Sscottl else 4912285809Sscottl { 4913285809Sscottl /* return the request to free pool */ 4914285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 4915285809Sscottl } 4916285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 4917285809Sscottl 4918285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3G"); 4919285809Sscottl 4920285809Sscottl /* return value */ 4921285809Sscottl return ret; 4922285809Sscottl} 4923285809Sscottl 4924285809Sscottl/******************************************************************************/ 4925285809Sscottl/*! \brief SAS General Event Notification Response 4926285809Sscottl * 4927285809Sscottl * This routine handles the response of Inbound IOMB Command with error case 4928285809Sscottl * 4929285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 4930285809Sscottl * \param pIomb Pointer of IOMB Mesage 4931285809Sscottl * 4932285809Sscottl * \return sucess or fail 4933285809Sscottl * 4934285809Sscottl */ 4935285809Sscottl/*******************************************************************************/ 4936285809SscottlGLOBAL bit32 mpiGeneralEventRsp( 4937285809Sscottl agsaRoot_t *agRoot, 4938285809Sscottl agsaGeneralEventRsp_t *pIomb 4939285809Sscottl ) 4940285809Sscottl{ 4941285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 4942285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 4943285809Sscottl bit32 i; 4944285809Sscottl bit32 status; 4945285809Sscottl bit32 tag; 4946285809Sscottl agsaIORequestDesc_t *pRequest; 4947285809Sscottl agsaDeviceDesc_t *pDevice; 4948285809Sscottl agsaContext_t *agContext = NULL; 4949285809Sscottl agsaGeneralEventRsp_t GenEventData; 4950285809Sscottl agsaHWEventEncrypt_t agEvent; 4951285809Sscottl bit16 OpCode = 0; 4952285809Sscottl 4953285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3H"); 4954285809Sscottl 4955285809Sscottl si_memset(&GenEventData,0,sizeof(agsaGeneralEventRsp_t)); 4956285809Sscottl 4957285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGeneralEventRsp_t, status)); 4958285809Sscottl 4959285809Sscottl SA_DBG3(("mpiGeneralEventRsp: %p\n", pIomb)); 4960285809Sscottl 4961285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OpCode 0x%X status 0x%x\n",pIomb->inbIOMBpayload[0] & OPCODE_BITS, status)); 4962285809Sscottl 4963285809Sscottl for (i = 0; i < GENERAL_EVENT_PAYLOAD; i++) 4964285809Sscottl { 4965285809Sscottl OSSA_READ_LE_32(AGROOT, &GenEventData.inbIOMBpayload[i], pIomb, OSSA_OFFSET_OF(agsaGeneralEventRsp_t,inbIOMBpayload[i] )); 4966285809Sscottl } 4967285809Sscottl SA_DBG1(("mpiGeneralEventRsp: inbIOMBpayload 0x%08x 0x%08x 0x%08x 0x%08x\n", 4968285809Sscottl GenEventData.inbIOMBpayload[0],GenEventData.inbIOMBpayload[1], 4969285809Sscottl GenEventData.inbIOMBpayload[2],GenEventData.inbIOMBpayload[3] )); 4970285809Sscottl SA_DBG1(("mpiGeneralEventRsp: inbIOMBpayload 0x%08x 0x%08x 0x%08x 0x%08x\n", 4971285809Sscottl GenEventData.inbIOMBpayload[4],GenEventData.inbIOMBpayload[8], 4972285809Sscottl GenEventData.inbIOMBpayload[6],GenEventData.inbIOMBpayload[7] )); 4973285809Sscottl 4974285809Sscottl switch (status) /*status */ 4975285809Sscottl { 4976285809Sscottl 4977285809Sscottl case GEN_EVENT_IOMB_V_BIT_NOT_SET: 4978285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_IOMB_V_BIT_NOT_SET\n" )); 4979285809Sscottl break; 4980285809Sscottl case GEN_EVENT_INBOUND_IOMB_OPC_NOT_SUPPORTED: 4981285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_INBOUND_IOMB_OPC_NOT_SUPPORTED\n" )); 4982285809Sscottl break; 4983285809Sscottl case GEN_EVENT_IOMB_INVALID_OBID: 4984285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_IOMB_INVALID_OBID\n" )); 4985285809Sscottl break; 4986285809Sscottl case GEN_EVENT_DS_IN_NON_OPERATIONAL: 4987285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_DS_IN_NON_OPERATIONAL\n" )); 4988285809Sscottl break; 4989285809Sscottl case GEN_EVENT_DS_IN_RECOVERY: 4990285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_DS_IN_RECOVERY\n" )); 4991285809Sscottl break; 4992285809Sscottl case GEN_EVENT_DS_INVALID: 4993285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_DS_INVALID\n" )); 4994285809Sscottl break; 4995285809Sscottl case GEN_EVENT_IO_XFER_READ_COMPL_ERR: 4996285809Sscottl SA_DBG1(("mpiGeneralEventRsp: GEN_EVENT_IO_XFER_READ_COMPL_ERR 0x%x 0x%x 0x%x\n", 4997285809Sscottl GenEventData.inbIOMBpayload[0], 4998285809Sscottl GenEventData.inbIOMBpayload[1], 4999285809Sscottl GenEventData.inbIOMBpayload[1] )); 5000285809Sscottl ossaGeneralEvent(agRoot, status, agContext, GenEventData.inbIOMBpayload); 5001285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3H"); 5002285809Sscottl return(ret); 5003285809Sscottl default: 5004285809Sscottl SA_DBG1(("mpiGeneralEventRsp: Unknown General Event status!!! 0x%x\n", status)); 5005285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3H"); 5006285809Sscottl return AGSA_RC_FAILURE; 5007285809Sscottl } 5008285809Sscottl 5009285809Sscottl OpCode = (bit16)(GenEventData.inbIOMBpayload[0] & OPCODE_BITS); 5010285809Sscottl tag = GenEventData.inbIOMBpayload[1]; 5011285809Sscottl SA_DBG1(("mpiGeneralEventRsp:OpCode 0x%X [0] 0x%08x\n" ,OpCode,(bit16)(GenEventData.inbIOMBpayload[0] & OPCODE_BITS))); 5012285809Sscottl 5013285809Sscottl switch (OpCode) /* OpCode */ 5014285809Sscottl { 5015285809Sscottl case OPC_INB_DEV_HANDLE_ACCEPT: 5016285809Sscottl case OPC_INB_ECHO: 5017285809Sscottl case OPC_INB_FW_FLASH_UPDATE: 5018285809Sscottl case OPC_INB_GET_NVMD_DATA: 5019285809Sscottl case OPC_INB_SET_NVMD_DATA: 5020285809Sscottl case OPC_INB_DEREG_DEV_HANDLE: 5021285809Sscottl case OPC_INB_SPC_GET_DEV_INFO: 5022285809Sscottl case OPC_INB_GET_DEV_HANDLE: 5023285809Sscottl case OPC_INB_SPC_REG_DEV: 5024285809Sscottl case OPC_INB_SAS_DIAG_EXECUTE: 5025285809Sscottl case OPC_INB_SAS_DIAG_MODE_START_END: 5026285809Sscottl case OPC_INB_PHYSTART: 5027285809Sscottl case OPC_INB_PHYSTOP: 5028285809Sscottl case OPC_INB_LOCAL_PHY_CONTROL: 5029285809Sscottl case OPC_INB_GPIO: 5030285809Sscottl case OPC_INB_GET_TIME_STAMP: 5031285809Sscottl case OPC_INB_PORT_CONTROL: 5032285809Sscottl case OPC_INB_SET_DEVICE_STATE: 5033285809Sscottl case OPC_INB_GET_DEVICE_STATE: 5034285809Sscottl case OPC_INB_SET_DEV_INFO: 5035285809Sscottl// case OPC_INB_PCIE_DIAG_EXECUTE: 5036285809Sscottl case OPC_INB_SAS_HW_EVENT_ACK: 5037285809Sscottl case OPC_INB_SAS_RE_INITIALIZE: 5038285809Sscottl case OPC_INB_KEK_MANAGEMENT: 5039285809Sscottl case OPC_INB_SET_OPERATOR: 5040285809Sscottl case OPC_INB_GET_OPERATOR: 5041285809Sscottl// case OPC_INB_SGPIO: 5042285809Sscottl 5043285809Sscottl#ifdef SPC_ENABLE_PROFILE 5044285809Sscottl case OPC_INB_FW_PROFILE: 5045285809Sscottl#endif 5046285809Sscottl /* Uses the tag table, so we have to free it up */ 5047285809Sscottl 5048285809Sscottl SA_ASSERT((tag < AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs), 5049285809Sscottl "OPC_OUB_GENERAL_EVENT tag out of range"); 5050285809Sscottl SA_ASSERT((saRoot->IOMap[ tag < (AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) ? tag : 0 ].Tag != MARK_OFF), 5051285809Sscottl "OPC_OUB_GENERAL_EVENT tag not in use 1"); 5052285809Sscottl 5053285809Sscottl#if defined(SALLSDK_DEBUG) 5054285809Sscottl if (tag > AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) 5055285809Sscottl { 5056285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "3H"); 5057285809Sscottl return AGSA_RC_FAILURE; 5058285809Sscottl } 5059285809Sscottl#endif /* SALLSDK_DEBUG */ 5060285809Sscottl 5061285809Sscottl SA_DBG1(("mpiGeneralEventRsp:OpCode found 0x%x htag 0x%x\n",OpCode, tag)); 5062285809Sscottl /* get agContext */ 5063285809Sscottl agContext = saRoot->IOMap[tag].agContext; 5064285809Sscottl /* get request from IOMap */ 5065285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5066285809Sscottl if(pRequest) 5067285809Sscottl { 5068285809Sscottl /* remove the request from IOMap */ 5069285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5070285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5071285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5072285809Sscottl 5073285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5074285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5075285809Sscottl pRequest->valid = agFALSE; 5076285809Sscottl /* return the request to free pool */ 5077285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5078285809Sscottl { 5079285809Sscottl SA_DBG1(("mpiGeneralEventRsp: saving pRequest (%p) for later use\n", pRequest)); 5080285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5081285809Sscottl } 5082285809Sscottl else 5083285809Sscottl { 5084285809Sscottl /* return the request to free pool */ 5085285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5086285809Sscottl } 5087285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5088285809Sscottl } 5089285809Sscottl else 5090285809Sscottl { 5091285809Sscottl SA_DBG1(("mpiGeneralEventRsp:pRequest (%p) NULL\n", pRequest)); 5092285809Sscottl ret = AGSA_RC_FAILURE; 5093285809Sscottl } 5094285809Sscottl break; 5095285809Sscottl /* ???? */ 5096285809Sscottl case OPC_INB_SATA_HOST_OPSTART: 5097285809Sscottl case OPC_INB_SATA_ABORT: 5098285809Sscottl case OPC_INB_SSPINIIOSTART: 5099285809Sscottl case OPC_INB_SSPINITMSTART: 5100285809Sscottl case OPC_INB_SSPINIEXTIOSTART: 5101285809Sscottl case OPC_INB_SSPTGTIOSTART: 5102285809Sscottl case OPC_INB_SSPTGTRSPSTART: 5103285809Sscottl case OPC_INB_SSP_DIF_ENC_OPSTART: 5104285809Sscottl case OPC_INB_SATA_DIF_ENC_OPSTART: 5105285809Sscottl 5106285809Sscottl case OPC_INB_SSP_ABORT: 5107285809Sscottl case OPC_INB_SMP_REQUEST: 5108285809Sscottl case OPC_INB_SMP_ABORT: 5109285809Sscottl { 5110285809Sscottl /* Uses the tag table, so we have to free it up */ 5111285809Sscottl SA_DBG1(("mpiGeneralEventRsp:OpCode found 0x%x htag 0x%x\n",OpCode, tag)); 5112285809Sscottl 5113285809Sscottl tag = GenEventData.inbIOMBpayload[1]; 5114285809Sscottl 5115285809Sscottl SA_ASSERT((tag < AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs), 5116285809Sscottl "OPC_OUB_GENERAL_EVENT tag out of range"); 5117285809Sscottl SA_ASSERT((saRoot->IOMap[ tag < (AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) ? tag : 0 ].Tag != MARK_OFF), 5118285809Sscottl "OPC_OUB_GENERAL_EVENT tag not in use 2"); 5119285809Sscottl#if defined(SALLSDK_DEBUG) 5120285809Sscottl if (tag > AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) 5121285809Sscottl { 5122285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "3H"); 5123285809Sscottl return AGSA_RC_FAILURE; 5124285809Sscottl } 5125285809Sscottl#endif 5126285809Sscottl /* get request from IOMap */ 5127285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5128285809Sscottl if(pRequest) 5129285809Sscottl { 5130285809Sscottl pDevice = pRequest->pDevice; 5131285809Sscottl /* return the request to free pool */ 5132285809Sscottl /* get IORequestContext */ 5133285809Sscottl agContext = (agsaContext_t *)pRequest->pIORequestContext; 5134285809Sscottl /* remove the request from IOMap */ 5135285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5136285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5137285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5138285809Sscottl 5139285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5140285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5141285809Sscottl pRequest->valid = agFALSE; 5142285809Sscottl saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode)); 5143285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5144285809Sscottl { 5145285809Sscottl SA_DBG1(("mpiGeneralEventRsp: saving pRequest (%p) for later use\n", pRequest)); 5146285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5147285809Sscottl } 5148285809Sscottl else 5149285809Sscottl { 5150285809Sscottl /* return the request to free pool */ 5151285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5152285809Sscottl } 5153285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5154285809Sscottl break; 5155285809Sscottl } 5156285809Sscottl else 5157285809Sscottl { 5158285809Sscottl SA_DBG1(("mpiGeneralEventRsp:pRequest (%p) NULL\n", pRequest)); 5159285809Sscottl ret = AGSA_RC_FAILURE; 5160285809Sscottl } 5161285809Sscottl } 5162285809Sscottl default: 5163285809Sscottl { 5164285809Sscottl SA_DBG1(("mpiGeneralEventRsp:OpCode Not found 0x%x htag 0x%x\n",OpCode, tag)); 5165285809Sscottl ret = AGSA_RC_FAILURE; 5166285809Sscottl 5167285809Sscottl /* Uses the tag table, so we have to free it up */ 5168285809Sscottl tag = GenEventData.inbIOMBpayload[1]; 5169285809Sscottl 5170285809Sscottl SA_ASSERT((tag < AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs), 5171285809Sscottl "OPC_OUB_GENERAL_EVENT tag out of range"); 5172285809Sscottl SA_ASSERT((saRoot->IOMap[ tag < (AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) ? tag : 0 ].Tag != MARK_OFF), 5173285809Sscottl "OPC_OUB_GENERAL_EVENT tag not in use 3"); 5174285809Sscottl 5175285809Sscottl#if defined(SALLSDK_DEBUG) 5176285809Sscottl if (tag > AGSA_MAX_VALID_PORTS * saRoot->swConfig.maxActiveIOs) 5177285809Sscottl { 5178285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'e', "3H"); 5179285809Sscottl return AGSA_RC_FAILURE; 5180285809Sscottl } 5181285809Sscottl#endif 5182285809Sscottl /* get agContext */ 5183285809Sscottl agContext = saRoot->IOMap[tag].agContext; 5184285809Sscottl /* get request from IOMap */ 5185285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5186285809Sscottl if (pRequest == agNULL) 5187285809Sscottl { 5188285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'f', "3H"); 5189285809Sscottl return AGSA_RC_FAILURE; 5190285809Sscottl } 5191285809Sscottl 5192285809Sscottl /* remove the request from IOMap */ 5193285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5194285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5195285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5196285809Sscottl 5197285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5198285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5199285809Sscottl pRequest->valid = agFALSE; 5200285809Sscottl /* return the request to free pool */ 5201285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5202285809Sscottl { 5203285809Sscottl SA_DBG1(("mpiGeneralEventRsp: saving pRequest (%p) for later use\n", pRequest)); 5204285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5205285809Sscottl } 5206285809Sscottl else 5207285809Sscottl { 5208285809Sscottl /* return the request to free pool */ 5209285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5210285809Sscottl } 5211285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5212285809Sscottl break; 5213285809Sscottl } 5214285809Sscottl ret = AGSA_RC_FAILURE; 5215285809Sscottl 5216285809Sscottl } 5217285809Sscottl 5218285809Sscottl switch (OpCode) /* OpCode */ 5219285809Sscottl { 5220285809Sscottl 5221285809Sscottl case OPC_INB_KEK_MANAGEMENT: 5222285809Sscottl { 5223285809Sscottl bit32 flags = GenEventData.inbIOMBpayload[2]; 5224285809Sscottl 5225285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OPC_INB_KEK_MANAGEMENT 0x%x htag 0x%x flags 0x%x\n",OpCode, tag, flags)); 5226285809Sscottl if (flags & 0xFF00) /* update and store*/ 5227285809Sscottl { 5228285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE; 5229285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE\n")); 5230285809Sscottl } 5231285809Sscottl else /* update */ 5232285809Sscottl { 5233285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE; 5234285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_KEK_UPDATE\n")); 5235285809Sscottl } 5236285809Sscottl agEvent.status = OSSA_INVALID_ENCRYPTION_SECURITY_MODE; 5237285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 5238285809Sscottl agEvent.status = status; 5239285809Sscottl 5240285809Sscottl SA_DBG1(("mpiGeneralEventRsp: ossaHwCB OSSA_HW_EVENT_ENCRYPTION\n" )); 5241285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_ENCRYPTION, 0, (void*)&agEvent, agContext); 5242285809Sscottl break; 5243285809Sscottl } 5244285809Sscottl case OPC_INB_OPR_MGMT: 5245285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 5246285809Sscottl agEvent.status = status; 5247285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_OPERATOR_MANAGEMENT; 5248285809Sscottl 5249285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_OPERATOR_MANAGEMENT\n" )); 5250285809Sscottl ossaOperatorManagementCB(agRoot, agContext, status, 0); 5251285809Sscottl break; 5252285809Sscottl case OPC_INB_SET_OPERATOR: 5253285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_SET_OPERATOR\n" )); 5254285809Sscottl ossaSetOperatorCB(agRoot,agContext,0xFF,0xFF ); 5255285809Sscottl break; 5256285809Sscottl case OPC_INB_GET_OPERATOR: 5257285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_GET_OPERATOR\n" )); 5258285809Sscottl ossaGetOperatorCB(agRoot,agContext,0xFF,0xFF,0xFF,0xFF,agNULL ); 5259285809Sscottl break; 5260285809Sscottl case OPC_INB_ENC_TEST_EXECUTE: 5261285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 5262285809Sscottl agEvent.status = status; 5263285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_TEST_EXECUTE; 5264285809Sscottl 5265285809Sscottl SA_DBG1(("mpiGeneralEventRsp: OSSA_HW_ENCRYPT_TEST_EXECUTE\n" )); 5266285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_ENCRYPTION, 0, (void*)&agEvent, agContext); 5267285809Sscottl break; 5268285809Sscottl default: 5269285809Sscottl SA_DBG1(("mpiGeneralEventRsp: MGMNT OpCode Not found 0x%x\n",OpCode )); 5270285809Sscottl ossaGeneralEvent(agRoot, status, agContext, GenEventData.inbIOMBpayload); 5271285809Sscottl break; 5272285809Sscottl } 5273285809Sscottl 5274285809Sscottl /* return value */ 5275285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'g', "3H"); 5276285809Sscottl return ret; 5277285809Sscottl} 5278285809Sscottl 5279285809Sscottl/******************************************************************************/ 5280285809Sscottl/*! \brief SPC MPI SSP Request Received Event (target mode) 5281285809Sscottl * 5282285809Sscottl * This function handles the SSP Request Received Event. 5283285809Sscottl * 5284285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5285285809Sscottl * \param pMsg1 pointer of Message 5286285809Sscottl * 5287285809Sscottl * \return The read value 5288285809Sscottl * 5289285809Sscottl */ 5290285809Sscottl/*******************************************************************************/ 5291285809SscottlGLOBAL bit32 mpiSSPReqReceivedNotify( 5292285809Sscottl agsaRoot_t *agRoot, 5293285809Sscottl agsaSSPReqReceivedNotify_t *pMsg1) 5294285809Sscottl{ 5295285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5296285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5297285809Sscottl agsaDeviceDesc_t *pDevice; 5298285809Sscottl bit32 deviceid, iniTagSSPIul, frameTypeHssa, TlrHdsa; 5299285809Sscottl 5300285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3J"); 5301285809Sscottl /* convert endiness if necassary */ 5302285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pMsg1, OSSA_OFFSET_OF(agsaSSPReqReceivedNotify_t, deviceId)); 5303285809Sscottl OSSA_READ_LE_32(AGROOT, &iniTagSSPIul, pMsg1, OSSA_OFFSET_OF(agsaSSPReqReceivedNotify_t, iniTagSSPIul)); 5304285809Sscottl OSSA_READ_LE_32(AGROOT, &frameTypeHssa, pMsg1, OSSA_OFFSET_OF(agsaSSPReqReceivedNotify_t, frameTypeHssa)); 5305285809Sscottl OSSA_READ_LE_32(AGROOT, &TlrHdsa, pMsg1, OSSA_OFFSET_OF(agsaSSPReqReceivedNotify_t, TlrHdsa)); 5306285809Sscottl /* deviceId -> agDeviceHandle */ 5307285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 5308285809Sscottl 5309285809Sscottl if (agNULL == pDevice) 5310285809Sscottl { 5311285809Sscottl SA_DBG1(("mpiSSPReqReceivedNotify: warning!!! no deviceHandle is found")); 5312285809Sscottl } 5313285809Sscottl else 5314285809Sscottl { 5315285809Sscottl /* type punning only safe through char *. See gcc -fstrict_aliasing. */ 5316285809Sscottl char * safe_type_pun = (char *)&(pMsg1->SSPIu[0]); 5317285809Sscottl if( pDevice->initiatorDevHandle.sdkData != agNULL) 5318285809Sscottl { 5319285809Sscottl ossaSSPReqReceived(agRoot, &(pDevice->initiatorDevHandle), 5320285809Sscottl (agsaFrameHandle_t *)safe_type_pun, 5321285809Sscottl (bit16)((iniTagSSPIul >> SHIFT16) & INITTAG_BITS), 5322285809Sscottl ((frameTypeHssa >> SHIFT24) & FRAME_TYPE) | 5323285809Sscottl ((TlrHdsa >> SHIFT16) & TLR_BITS), 5324285809Sscottl (iniTagSSPIul & SSPIUL_BITS)); 5325285809Sscottl }else if( pDevice->targetDevHandle.sdkData != agNULL) 5326285809Sscottl { 5327285809Sscottl ossaSSPReqReceived(agRoot, &(pDevice->targetDevHandle), 5328285809Sscottl (agsaFrameHandle_t *)safe_type_pun, 5329285809Sscottl (bit16)((iniTagSSPIul >> SHIFT16) & INITTAG_BITS), 5330285809Sscottl ((frameTypeHssa >> SHIFT24) & FRAME_TYPE) | 5331285809Sscottl ((TlrHdsa >> SHIFT16) & TLR_BITS), 5332285809Sscottl (iniTagSSPIul & SSPIUL_BITS)); 5333285809Sscottl }else 5334285809Sscottl { 5335285809Sscottl SA_ASSERT(0, "Device handle sdkData not set"); 5336285809Sscottl } 5337285809Sscottl } 5338285809Sscottl 5339285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3J"); 5340285809Sscottl return ret; 5341285809Sscottl} 5342285809Sscottl 5343285809Sscottl/******************************************************************************/ 5344285809Sscottl/*! \brief SPC MPI Device Handle Arrived Event (target mode) 5345285809Sscottl * 5346285809Sscottl * This function handles the Device Handle Arrived Event. 5347285809Sscottl * 5348285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5349285809Sscottl * \param pMsg1 pointer of Message 5350285809Sscottl * 5351285809Sscottl * \return The read value 5352285809Sscottl * 5353285809Sscottl */ 5354285809Sscottl/*******************************************************************************/ 5355285809SscottlGLOBAL bit32 mpiDeviceHandleArrived( 5356285809Sscottl agsaRoot_t *agRoot, 5357285809Sscottl agsaDeviceHandleArrivedNotify_t *pMsg1) 5358285809Sscottl{ 5359285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5360285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5361285809Sscottl agsaDeviceDesc_t *pDevice; 5362285809Sscottl agsaPort_t *pPort; 5363285809Sscottl agsaSASDeviceInfo_t pDeviceInfo; 5364285809Sscottl agsaPortContext_t *agPortContext; 5365285809Sscottl agsaSASIdentify_t remoteIdentify; 5366285809Sscottl bit32 CTag; 5367285809Sscottl bit32 FwdDeviceId; 5368285809Sscottl bit32 ProtConrPortId; 5369285809Sscottl bit32 portId; 5370285809Sscottl bit32 conRate; 5371285809Sscottl bit8 i, protocol, dTypeSRate; 5372285809Sscottl bit32 HostAssignedId; 5373285809Sscottl 5374285809Sscottl if(saRoot == agNULL) 5375285809Sscottl { 5376285809Sscottl SA_ASSERT((saRoot != agNULL), "saRoot"); 5377285809Sscottl return AGSA_RC_FAILURE; 5378285809Sscottl } 5379285809Sscottl 5380285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3L"); 5381285809Sscottl /* convert endiness if necassary */ 5382285809Sscottl OSSA_READ_LE_32(AGROOT, &CTag, pMsg1, OSSA_OFFSET_OF(agsaDeviceHandleArrivedNotify_t, CTag)); 5383285809Sscottl OSSA_READ_LE_32(AGROOT, &FwdDeviceId, pMsg1, OSSA_OFFSET_OF(agsaDeviceHandleArrivedNotify_t, HostAssignedIdFwdDeviceId)); 5384285809Sscottl OSSA_READ_LE_32(AGROOT, &ProtConrPortId, pMsg1, OSSA_OFFSET_OF(agsaDeviceHandleArrivedNotify_t, ProtConrPortId)); 5385285809Sscottl 5386285809Sscottl 5387285809Sscottl if(smIS_SPCV(agRoot)) 5388285809Sscottl { 5389285809Sscottl portId = ProtConrPortId & PortId_V_MASK; 5390285809Sscottl conRate = (ProtConrPortId & Conrate_V_MASK ) >> Conrate_V_SHIFT; 5391285809Sscottl 5392285809Sscottl HostAssignedId = (FwdDeviceId & 0xFFFF0000) >> SHIFT16; 5393285809Sscottl if(HostAssignedId) 5394285809Sscottl { 5395285809Sscottl SA_DBG1(("mpiDeviceHandleArrived: HostAssignedId 0x%X\n",HostAssignedId)); 5396285809Sscottl } 5397285809Sscottl } 5398285809Sscottl else 5399285809Sscottl { 5400285809Sscottl portId = ProtConrPortId & PortId_SPC_MASK; 5401285809Sscottl conRate = (ProtConrPortId & Conrate_SPC_MASK ) >> Conrate_SPC_SHIFT; 5402285809Sscottl } 5403285809Sscottl protocol =(bit8)((ProtConrPortId & PROTOCOL_BITS ) >> PROTOCOL_SHIFT); 5404285809Sscottl 5405285809Sscottl SA_DBG1(("mpiDeviceHandleArrived: New Port portID %d deviceid 0x%X conRate 0x%X protocol 0x%X\n",portId, FwdDeviceId,conRate,protocol)); 5406285809Sscottl 5407285809Sscottl /* Port Map */ 5408285809Sscottl agPortContext = saRoot->PortMap[portId].PortContext; 5409285809Sscottl if (agNULL == agPortContext) 5410285809Sscottl { 5411285809Sscottl ossaSingleThreadedEnter(agRoot, LL_PORT_LOCK); 5412285809Sscottl /* new port */ 5413285809Sscottl /* Acquire port list lock */ 5414285809Sscottl /* Allocate a free port */ 5415285809Sscottl pPort = (agsaPort_t *) saLlistGetHead(&(saRoot->freePorts)); 5416285809Sscottl if (agNULL != pPort) 5417285809Sscottl { 5418285809Sscottl saLlistRemove(&(saRoot->freePorts), &(pPort->linkNode)); 5419285809Sscottl 5420285809Sscottl /* setup the port data structure */ 5421285809Sscottl pPort->portContext.osData = agNULL; 5422285809Sscottl pPort->portContext.sdkData = pPort; 5423285809Sscottl pPort->tobedeleted = agFALSE; 5424285809Sscottl /* Add to valid port list */ 5425285809Sscottl saLlistAdd(&(saRoot->validPorts), &(pPort->linkNode)); 5426285809Sscottl /* Release port list lock */ 5427285809Sscottl ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK); 5428285809Sscottl 5429285809Sscottl /* Setup portMap based on portId */ 5430285809Sscottl saRoot->PortMap[portId].PortID = portId; 5431285809Sscottl saRoot->PortMap[portId].PortContext = &(pPort->portContext); 5432285809Sscottl saRoot->PortMap[portId].PortStatus &= ~PORT_INVALIDATING; 5433285809Sscottl pPort->portId = portId; 5434285809Sscottl 5435285809Sscottl pPort->status &= ~PORT_INVALIDATING; 5436285809Sscottl SA_DBG3(("mpiDeviceHandleArrived: ~PORT_INVALIDATING New Port portID %d PortContext %p\n",saRoot->PortMap[pPort->portId].PortID , &pPort->portContext)); 5437285809Sscottl } 5438285809Sscottl else 5439285809Sscottl { 5440285809Sscottl ossaSingleThreadedLeave(agRoot, LL_PORT_LOCK); 5441285809Sscottl SA_DBG2(("mpiDeviceHandleArrived:Port NULL\n")); 5442285809Sscottl /* pPort is agNULL*/ 5443285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3L"); 5444285809Sscottl return AGSA_RC_FAILURE; 5445285809Sscottl } 5446285809Sscottl } 5447285809Sscottl else 5448285809Sscottl { 5449285809Sscottl /* exist port */ 5450285809Sscottl pPort = (agsaPort_t *) (agPortContext->sdkData); 5451285809Sscottl pPort->status &= ~PORT_INVALIDATING; 5452285809Sscottl pPort->portId =portId; 5453285809Sscottl saRoot->PortMap[pPort->portId].PortStatus &= ~PORT_INVALIDATING; 5454285809Sscottl 5455285809Sscottl SA_DBG1(("mpiDeviceHandleArrived: ~PORT_INVALIDATING Old port portID %d PortContext %p\n", portId, &pPort->portContext)); 5456285809Sscottl 5457285809Sscottl } 5458285809Sscottl /* build Device Information structure */ 5459285809Sscottl si_memset(&pDeviceInfo, 0, sizeof(agsaSASDeviceInfo_t)); 5460285809Sscottl if (ProtConrPortId & PROTOCOL_BITS) 5461285809Sscottl { 5462285809Sscottl protocol = SA_IDFRM_SSP_BIT; /* SSP */ 5463285809Sscottl pDeviceInfo.commonDevInfo.devType_S_Rate = (bit8)(conRate | 0x10); 5464285809Sscottl 5465285809Sscottl } 5466285809Sscottl else 5467285809Sscottl { 5468285809Sscottl protocol = SA_IDFRM_SMP_BIT; /* SMP */ 5469285809Sscottl pDeviceInfo.commonDevInfo.devType_S_Rate = (bit8)conRate; 5470285809Sscottl } 5471285809Sscottl pDeviceInfo.initiator_ssp_stp_smp = protocol; 5472285809Sscottl pDeviceInfo.numOfPhys = 1; 5473285809Sscottl pDeviceInfo.commonDevInfo.sasAddressHi[0] = pMsg1->sasAddrHi[0]; 5474285809Sscottl pDeviceInfo.commonDevInfo.sasAddressHi[1] = pMsg1->sasAddrHi[1]; 5475285809Sscottl pDeviceInfo.commonDevInfo.sasAddressHi[2] = pMsg1->sasAddrHi[2]; 5476285809Sscottl pDeviceInfo.commonDevInfo.sasAddressHi[3] = pMsg1->sasAddrHi[3]; 5477285809Sscottl pDeviceInfo.commonDevInfo.sasAddressLo[0] = pMsg1->sasAddrLow[0]; 5478285809Sscottl pDeviceInfo.commonDevInfo.sasAddressLo[1] = pMsg1->sasAddrLow[1]; 5479285809Sscottl pDeviceInfo.commonDevInfo.sasAddressLo[2] = pMsg1->sasAddrLow[2]; 5480285809Sscottl pDeviceInfo.commonDevInfo.sasAddressLo[3] = pMsg1->sasAddrLow[3]; 5481285809Sscottl pDeviceInfo.commonDevInfo.flag = 0; 5482285809Sscottl pDeviceInfo.commonDevInfo.it_NexusTimeout = ITL_TO_DEFAULT; 5483285809Sscottl 5484285809Sscottl /* deviceId -> agDeviceHandle */ 5485285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[FwdDeviceId & DEVICE_ID_BITS].DeviceHandle; 5486285809Sscottl 5487285809Sscottl if (agNULL == pDevice) 5488285809Sscottl { 5489285809Sscottl /* new device */ 5490285809Sscottl si_memset(&remoteIdentify, 0, sizeof(agsaSASIdentify_t)); 5491285809Sscottl for (i=0;i<4;i++) 5492285809Sscottl { 5493285809Sscottl remoteIdentify.sasAddressHi[i] = pMsg1->sasAddrHi[i]; 5494285809Sscottl remoteIdentify.sasAddressLo[i] = pMsg1->sasAddrLow[i]; 5495285809Sscottl } 5496285809Sscottl remoteIdentify.deviceType_addressFrameType = (bit8)(pDeviceInfo.commonDevInfo.devType_S_Rate & 0xC0); 5497285809Sscottl dTypeSRate = pDeviceInfo.commonDevInfo.devType_S_Rate; 5498285809Sscottl /* get Device from free Device List */ 5499285809Sscottl pDevice = siPortSASDeviceAdd(agRoot, pPort, remoteIdentify, agTRUE, SMP_TO_DEFAULT, ITL_TO_DEFAULT, 0, dTypeSRate, 0); 5500285809Sscottl if (agNULL == pDevice) 5501285809Sscottl { 5502285809Sscottl SA_DBG1(("mpiDeviceHandleArrived: Device Handle is NULL, Out of Resources Error.\n")); 5503285809Sscottl } 5504285809Sscottl else 5505285809Sscottl { 5506285809Sscottl bit32 AccStatus = 0; 5507285809Sscottl bit32 SaveId = FwdDeviceId & 0xFFFF; 5508285809Sscottl /* mapping the device handle and device id */ 5509285809Sscottl saRoot->DeviceMap[FwdDeviceId & DEVICE_ID_BITS].DeviceIdFromFW = FwdDeviceId; 5510285809Sscottl saRoot->DeviceMap[FwdDeviceId & DEVICE_ID_BITS].DeviceHandle = (void *)pDevice; 5511285809Sscottl pDevice->DeviceMapIndex = FwdDeviceId; 5512285809Sscottl SA_DBG2(("mpiDeviceHandleArrived: New deviceID 0x%x Device Context %p DeviceTypeSRate 0x%x\n", FwdDeviceId, pDevice, dTypeSRate)); 5513285809Sscottl 5514285809Sscottl /* Call Back */ 5515285809Sscottl AccStatus = ossaDeviceHandleAccept(agRoot, &(pDevice->initiatorDevHandle), &pDeviceInfo, agPortContext,&FwdDeviceId ); 5516285809Sscottl 5517285809Sscottl HostAssignedId = (FwdDeviceId & 0xFFFF0000) >> SHIFT16; 5518285809Sscottl if(HostAssignedId) 5519285809Sscottl { 5520285809Sscottl if( SaveId == (FwdDeviceId & 0xFFFF) ) 5521285809Sscottl { 5522285809Sscottl 5523285809Sscottl saRoot->DeviceMap[FwdDeviceId & DEVICE_ID_BITS].DeviceIdFromFW = FwdDeviceId; 5524285809Sscottl pDevice->DeviceMapIndex = FwdDeviceId; 5525285809Sscottl 5526285809Sscottl SA_DBG1(("mpiDeviceHandleArrived:FwdDeviceId 0x%x HostAssignedId 0x%x\n",FwdDeviceId,HostAssignedId)); 5527285809Sscottl } 5528285809Sscottl else 5529285809Sscottl { 5530285809Sscottl SA_DBG1(("mpiDeviceHandleArrived:Id mangled expect 0x%x Got 0x%x\n",SaveId, (FwdDeviceId & 0xFFFF))); 5531285809Sscottl ret = AGSA_RC_FAILURE; 5532285809Sscottl } 5533285809Sscottl } 5534285809Sscottl 5535285809Sscottl /* get AWT flag and ITLN_TMO value */ 5536285809Sscottl 5537285809Sscottl if(AccStatus == OSSA_RC_ACCEPT ) 5538285809Sscottl { 5539285809Sscottl /* build DEVICE_HANDLE_ACCEPT IOMB and send to SPC with action=accept */ 5540285809Sscottl mpiDevHandleAcceptCmd(agRoot, agNULL, CTag, FwdDeviceId, 0, pDeviceInfo.commonDevInfo.flag, pDeviceInfo.commonDevInfo.it_NexusTimeout, 0); 5541285809Sscottl } 5542285809Sscottl else 5543285809Sscottl { 5544285809Sscottl mpiDevHandleAcceptCmd(agRoot, agNULL, CTag, FwdDeviceId, 1, pDeviceInfo.commonDevInfo.flag, pDeviceInfo.commonDevInfo.it_NexusTimeout, 0); 5545285809Sscottl } 5546285809Sscottl } 5547285809Sscottl } 5548285809Sscottl 5549285809Sscottl SA_DBG1(("mpiDeviceHandleArrived Device 0x%08X flag 0x%08X %s WWID= %02x%02x%02x%02x:%02x%02x%02x%02x, %s\n", 5550285809Sscottl FwdDeviceId, 5551285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.flag, 5552285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x20 ? "SATA DA" : 5553285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x10 ? "SSP/SMP" : 5554285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF0) == 0x0 ? " STP " : "Unknown", 5555285809Sscottl 5556285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[3], 5557285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[2], 5558285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[1], 5559285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressHi[0], 5560285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[3], 5561285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[2], 5562285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[1], 5563285809Sscottl pDevice->devInfo.sasDeviceInfo.commonDevInfo.sasAddressLo[0], 5564285809Sscottl 5565285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 8 ? " 1.5G" : 5566285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 9 ? " 3.0G" : 5567285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 10 ? " 6.0G" : 5568285809Sscottl (pDevice->devInfo.sasDeviceInfo.commonDevInfo.devType_S_Rate & 0xF) == 11 ? "12.0G" : "????" )); 5569285809Sscottl 5570285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3L"); 5571285809Sscottl return ret; 5572285809Sscottl} 5573285809Sscottl 5574285809Sscottl/******************************************************************************/ 5575285809Sscottl/*! \brief Get Time Stamp Response 5576285809Sscottl * 5577285809Sscottl * This routine handles the response of Get Time Stamp Command 5578285809Sscottl * 5579285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5580285809Sscottl * \param pIomb Pointer of IOMB Mesage 5581285809Sscottl * 5582285809Sscottl * \return sucess or fail 5583285809Sscottl * 5584285809Sscottl */ 5585285809Sscottl/*******************************************************************************/ 5586285809SscottlGLOBAL bit32 mpiGetTimeStampRsp( 5587285809Sscottl agsaRoot_t *agRoot, 5588285809Sscottl agsaGetTimeStampRsp_t *pIomb 5589285809Sscottl ) 5590285809Sscottl{ 5591285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5592285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5593285809Sscottl agsaIORequestDesc_t *pRequest; 5594285809Sscottl agsaContext_t *agContext; 5595285809Sscottl bit32 tag, timeStampLower, timeStampUpper; 5596285809Sscottl 5597285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3M"); 5598285809Sscottl 5599285809Sscottl SA_DBG3(("mpiGetTimeStampRsp: HTAG=0x%x\n", pIomb->tag)); 5600285809Sscottl 5601285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetTimeStampRsp_t, tag)); 5602285809Sscottl OSSA_READ_LE_32(AGROOT, &timeStampLower, pIomb, OSSA_OFFSET_OF(agsaGetTimeStampRsp_t, timeStampLower)); 5603285809Sscottl OSSA_READ_LE_32(AGROOT, &timeStampUpper, pIomb, OSSA_OFFSET_OF(agsaGetTimeStampRsp_t, timeStampUpper)); 5604285809Sscottl /* get request from IOMap */ 5605285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5606285809Sscottl if (agNULL == pRequest) 5607285809Sscottl { 5608285809Sscottl SA_DBG1(("mpiGetTimeStampRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x\n", tag)); 5609285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3M"); 5610285809Sscottl return AGSA_RC_FAILURE; 5611285809Sscottl } 5612285809Sscottl 5613285809Sscottl agContext = saRoot->IOMap[tag].agContext; 5614285809Sscottl /* remove the request from IOMap */ 5615285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5616285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5617285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5618285809Sscottl 5619285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5620285809Sscottl 5621285809Sscottl SA_DBG3(("mpiGetTimeStampRsp: timeStampLower 0x%x timeStampUpper 0x%x\n", timeStampLower, timeStampUpper)); 5622285809Sscottl 5623285809Sscottl ossaGetTimeStampCB(agRoot, agContext, timeStampLower, timeStampUpper); 5624285809Sscottl 5625285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5626285809Sscottl pRequest->valid = agFALSE; 5627285809Sscottl /* return the request to free pool */ 5628285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5629285809Sscottl { 5630285809Sscottl SA_DBG1(("mpiGetTimeStampRsp: saving pRequest (%p) for later use\n", pRequest)); 5631285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5632285809Sscottl } 5633285809Sscottl else 5634285809Sscottl { 5635285809Sscottl /* return the request to free pool */ 5636285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5637285809Sscottl } 5638285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5639285809Sscottl 5640285809Sscottl /* return value */ 5641285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3M"); 5642285809Sscottl return ret; 5643285809Sscottl} 5644285809Sscottl 5645285809Sscottl/******************************************************************************/ 5646285809Sscottl/*! \brief SAS HW Event Ack Response 5647285809Sscottl * 5648285809Sscottl * This routine handles the response of SAS HW Event Ack Command 5649285809Sscottl * 5650285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5651285809Sscottl * \param pIomb Pointer of IOMB Mesage 5652285809Sscottl * 5653285809Sscottl * \return sucess or fail 5654285809Sscottl * 5655285809Sscottl */ 5656285809Sscottl/*******************************************************************************/ 5657285809SscottlGLOBAL bit32 mpiSASHwEventAckRsp( 5658285809Sscottl agsaRoot_t *agRoot, 5659285809Sscottl agsaSASHwEventAckRsp_t *pIomb 5660285809Sscottl ) 5661285809Sscottl{ 5662285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5663285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5664285809Sscottl agsaIORequestDesc_t *pRequest; 5665285809Sscottl agsaContext_t *agContext; 5666285809Sscottl agsaPort_t *pPort; 5667285809Sscottl bit32 tag, status; 5668285809Sscottl 5669285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2N"); 5670285809Sscottl 5671285809Sscottl SA_DBG2(("mpiSASHwEventAckRsp: Htag=0x%x %p\n", pIomb->tag,pIomb)); 5672285809Sscottl 5673285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSASHwEventAckRsp_t, tag)); 5674285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSASHwEventAckRsp_t, status)); 5675285809Sscottl /* get request from IOMap */ 5676285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5677285809Sscottl if (agNULL == pRequest) 5678285809Sscottl { 5679285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x Status=0x%x\n", tag, status)); 5680285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2N"); 5681285809Sscottl return AGSA_RC_FAILURE; 5682285809Sscottl } 5683285809Sscottl 5684285809Sscottl agContext = saRoot->IOMap[tag].agContext; 5685285809Sscottl /* remove the request from IOMap */ 5686285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5687285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5688285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5689285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5690285809Sscottl 5691285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: status 0x%x Htag=0x%x HwAckType=0x%x\n",status,pIomb->tag,pRequest->HwAckType )); 5692285809Sscottl 5693285809Sscottl ossaHwEventAckCB(agRoot, agContext, status); 5694285809Sscottl 5695285809Sscottl pPort = pRequest->pPort; 5696285809Sscottl if (agNULL != pPort) 5697285809Sscottl { 5698285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: pPort %p tobedeleted %d\n", pPort, pPort->tobedeleted)); 5699285809Sscottl if (pPort->status & PORT_INVALIDATING && pPort->tobedeleted ) 5700285809Sscottl { 5701285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: PORT_INVALIDATING portInvalid portID %d pPort %p, nulling out PortContext\n", pPort->portId, pPort)); 5702285809Sscottl /* invalid the port */ 5703285809Sscottl siPortInvalid(agRoot, pPort); 5704285809Sscottl /* map out the portmap */ 5705285809Sscottl saRoot->PortMap[pPort->portId].PortContext = agNULL; 5706285809Sscottl saRoot->PortMap[pPort->portId].PortID = PORT_MARK_OFF; 5707285809Sscottl saRoot->PortMap[pPort->portId].PortStatus |= PORT_INVALIDATING; 5708285809Sscottl } 5709285809Sscottl else 5710285809Sscottl { 5711285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp:pPort->status 0x%x Htag=0x%x %p\n",pPort->status, pIomb->tag,pIomb)); 5712285809Sscottl } 5713285809Sscottl } 5714285809Sscottl else 5715285809Sscottl { 5716285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: pPort is NULL, no portId, HTag=0x%x\n", tag)); 5717285809Sscottl } 5718285809Sscottl 5719285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5720285809Sscottl pRequest->valid = agFALSE; 5721285809Sscottl /* return the request to free pool */ 5722285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5723285809Sscottl { 5724285809Sscottl SA_DBG1(("mpiSASHwEventAckRsp: saving pRequest (%p) for later use\n", pRequest)); 5725285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5726285809Sscottl } 5727285809Sscottl else 5728285809Sscottl { 5729285809Sscottl /* return the request to free pool */ 5730285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5731285809Sscottl } 5732285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5733285809Sscottl 5734285809Sscottl /* return value */ 5735285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2N"); 5736285809Sscottl return ret; 5737285809Sscottl} 5738285809Sscottl 5739285809Sscottl/******************************************************************************/ 5740285809Sscottl/*! \brief Port Control Response 5741285809Sscottl * 5742285809Sscottl * This routine handles the response of SAS HW Event Ack Command 5743285809Sscottl * 5744285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5745285809Sscottl * \param pIomb Pointer of IOMB Mesage 5746285809Sscottl * 5747285809Sscottl * \return sucess or fail 5748285809Sscottl * 5749285809Sscottl */ 5750285809Sscottl/*******************************************************************************/ 5751285809SscottlGLOBAL bit32 mpiPortControlRsp( 5752285809Sscottl agsaRoot_t *agRoot, 5753285809Sscottl agsaPortControlRsp_t *pIomb 5754285809Sscottl ) 5755285809Sscottl{ 5756285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5757285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5758285809Sscottl agsaIORequestDesc_t *pRequest = agNULL; 5759285809Sscottl agsaContext_t *agContext = agNULL; 5760285809Sscottl agsaPortContext_t *agPortContext = agNULL; 5761285809Sscottl bit32 tag; 5762285809Sscottl bit32 port =0; 5763285809Sscottl bit32 operation =0; 5764285809Sscottl bit32 status =0; 5765285809Sscottl bit32 portState =0; 5766285809Sscottl bit32 portOperation =0; 5767285809Sscottl 5768285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3O"); 5769285809Sscottl 5770285809Sscottl SA_DBG2(("mpiPortControlRsp: HTag=0x%x\n", pIomb->tag)); 5771285809Sscottl 5772285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaPortControlRsp_t, tag)); 5773285809Sscottl OSSA_READ_LE_32(AGROOT, &operation, pIomb, OSSA_OFFSET_OF(agsaPortControlRsp_t, portOPPortId)); 5774285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaPortControlRsp_t, status)); 5775285809Sscottl OSSA_READ_LE_32(AGROOT, &portState, pIomb, OSSA_OFFSET_OF(agsaPortControlRsp_t,rsvdPortState )); 5776285809Sscottl 5777285809Sscottl /* get request from IOMap */ 5778285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5779285809Sscottl if (agNULL == pRequest) 5780285809Sscottl { 5781285809Sscottl SA_DBG1(("mpiPortControlRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x Status=0x%x\n", tag, status)); 5782285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3O"); 5783285809Sscottl return AGSA_RC_FAILURE; 5784285809Sscottl } 5785285809Sscottl 5786285809Sscottl agContext = saRoot->IOMap[tag].agContext; 5787285809Sscottl /* remove the request from IOMap */ 5788285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5789285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5790285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5791285809Sscottl 5792285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 5793285809Sscottl 5794285809Sscottl if(!pRequest->valid) 5795285809Sscottl { 5796285809Sscottl SA_DBG1(("mpiPortControlRsp: pRequest->valid %d not set\n", pRequest->valid)); 5797285809Sscottl } 5798285809Sscottl 5799285809Sscottl SA_DBG2(("mpiPortControlRsp: pRequest->completionCB %p\n", pRequest->completionCB)); 5800285809Sscottl 5801285809Sscottl port = operation & PORTID_MASK; 5802285809Sscottl 5803285809Sscottl if(port < AGSA_MAX_VALID_PORTS ) 5804285809Sscottl { 5805285809Sscottl SA_DBG2(("mpiPortControlRsp: PortID 0x%x PortStatus 0x%x PortContext %p\n", 5806285809Sscottl saRoot->PortMap[port].PortID, 5807285809Sscottl saRoot->PortMap[port].PortStatus, 5808285809Sscottl saRoot->PortMap[port].PortContext)); 5809285809Sscottl 5810285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[port].PortContext; 5811285809Sscottl } 5812285809Sscottl SA_DBG2(("mpiPortControlRsp: PortID 0x%x PortStatus 0x%x PortContext %p\n",saRoot->PortMap[operation & PORTID_MASK].PortID,saRoot->PortMap[operation & PORTID_MASK].PortStatus,saRoot->PortMap[operation & PORTID_MASK].PortContext)); 5813285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[operation & PORTID_MASK].PortContext; 5814285809Sscottl SA_DBG1(("mpiPortControlRsp: agPortContext %p\n",agPortContext )); 5815285809Sscottl 5816285809Sscottl 5817285809Sscottl SA_DBG2(("mpiPortControlRsp: portID 0x%x status 0x%x\n", (operation & PORTID_MASK), status)); 5818285809Sscottl 5819285809Sscottl SA_DBG1(("mpiPortControlRsp: portID 0x%x status 0x%x agPortContext %p\n",port, status,agPortContext)); 5820285809Sscottl 5821285809Sscottl portOperation = (((operation & LOCAL_PHY_OP_BITS) >> SHIFT8) | (portState << SHIFT28) ); 5822285809Sscottl 5823285809Sscottl SA_DBG1(("mpiPortControlRsp: portState 0x%x operation 0x%x portOperation 0x%x\n",portState, operation,portOperation )); 5824285809Sscottl 5825285809Sscottl switch(portOperation) 5826285809Sscottl { 5827285809Sscottl case AGSA_PORT_SET_SMP_PHY_WIDTH: 5828285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_SET_SMP_PHY_WIDTH operation 0x%x\n",operation )); 5829285809Sscottl break; 5830285809Sscottl case AGSA_PORT_SET_PORT_RECOVERY_TIME: 5831285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_SET_PORT_RECOVERY_TIME operation 0x%x\n",operation )); 5832285809Sscottl break; 5833285809Sscottl case AGSA_PORT_IO_ABORT: 5834285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_IO_ABORT operation 0x%x\n",operation )); 5835285809Sscottl break; 5836285809Sscottl case AGSA_PORT_SET_PORT_RESET_TIME: 5837285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_SET_PORT_RESET_TIME operation 0x%x\n",operation )); 5838285809Sscottl break; 5839285809Sscottl case AGSA_PORT_HARD_RESET: 5840285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_HARD_RESET operation 0x%x\n",operation )); 5841285809Sscottl break; 5842285809Sscottl case AGSA_PORT_CLEAN_UP: 5843285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_PORT_CLEAN_UP operation 0x%x\n",operation )); 5844285809Sscottl break; 5845285809Sscottl case AGSA_STOP_PORT_RECOVERY_TIMER: 5846285809Sscottl SA_DBG1(("mpiPortControlRsp: AGSA_STOP_PORT_RECOVERY_TIMER operation 0x%x\n",operation )); 5847285809Sscottl break; 5848285809Sscottl default: 5849285809Sscottl { 5850285809Sscottl SA_DBG1(("mpiPortControlRsp: Unknown operation 0x%x\n",operation )); 5851285809Sscottl } 5852285809Sscottl } 5853285809Sscottl 5854285809Sscottl ossaPortControlCB(agRoot, agContext, agPortContext, portOperation, status); 5855285809Sscottl 5856285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5857285809Sscottl pRequest->valid = agFALSE; 5858285809Sscottl /* return the request to free pool */ 5859285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5860285809Sscottl { 5861285809Sscottl SA_DBG1(("mpiPortControlRsp: saving pRequest (%p) for later use\n", pRequest)); 5862285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5863285809Sscottl } 5864285809Sscottl else 5865285809Sscottl { 5866285809Sscottl /* return the request to free pool */ 5867285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5868285809Sscottl } 5869285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5870285809Sscottl 5871285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3O"); 5872285809Sscottl /* return value */ 5873285809Sscottl return ret; 5874285809Sscottl} 5875285809Sscottl 5876285809Sscottl/******************************************************************************/ 5877285809Sscottl/*! \brief SPC MPI SMP ABORT Response 5878285809Sscottl * 5879285809Sscottl * This function handles the SMP Abort Response. 5880285809Sscottl * 5881285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5882285809Sscottl * \param pIomb pointer of Message 5883285809Sscottl * 5884285809Sscottl * \return The read value 5885285809Sscottl * 5886285809Sscottl */ 5887285809Sscottl/*******************************************************************************/ 5888285809SscottlGLOBAL bit32 mpiSMPAbortRsp( 5889285809Sscottl agsaRoot_t *agRoot, 5890285809Sscottl agsaSMPAbortRsp_t *pIomb 5891285809Sscottl ) 5892285809Sscottl{ 5893285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5894285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5895285809Sscottl agsaIORequestDesc_t *pRequest; 5896285809Sscottl agsaDeviceDesc_t *pDevice; 5897285809Sscottl bit32 tag, scp, status; 5898285809Sscottl 5899285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3P"); 5900285809Sscottl 5901285809Sscottl SA_DBG3(("mpiSMPAbortRsp: HTag=0x%x Status=0x%x\n", pIomb->tag, pIomb->status)); 5902285809Sscottl 5903285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSMPAbortRsp_t, tag)); 5904285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSMPAbortRsp_t, status)); 5905285809Sscottl OSSA_READ_LE_32(AGROOT, &scp, pIomb, OSSA_OFFSET_OF(agsaSMPAbortRsp_t, scp)); 5906285809Sscottl 5907285809Sscottl /* get IORequest from IOMap */ 5908285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 5909285809Sscottl 5910285809Sscottl if (agNULL == pRequest) 5911285809Sscottl { 5912285809Sscottl SA_DBG1(("mpiSMPAbortRsp: pRequest is NULL, HTag=0x%x Status=0x%x\n", pIomb->tag, pIomb->status)); 5913285809Sscottl SA_ASSERT((pRequest), "pRequest"); 5914285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3P"); 5915285809Sscottl return AGSA_RC_FAILURE; 5916285809Sscottl } 5917285809Sscottl 5918285809Sscottl if ( agTRUE == pRequest->valid ) 5919285809Sscottl { 5920285809Sscottl pDevice = pRequest->pDevice; 5921285809Sscottl SA_ASSERT((pRequest->pDevice), "pRequest->pDevice"); 5922285809Sscottl 5923285809Sscottl SA_DBG3(("mpiSMPAbortRsp: request abort is valid Htag 0x%x\n", tag)); 5924285809Sscottl 5925285809Sscottl /* remove the SSP_ABORT or SATA_ABORT request from IOMap */ 5926285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 5927285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 5928285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 5929285809Sscottl 5930285809Sscottl if( pRequest->completionCB == agNULL ) 5931285809Sscottl { 5932285809Sscottl SA_DBG1(("mpiSMPAbortRsp: ************************************************* Valid for Expander only tag 0x%x\n", tag)); 5933285809Sscottl ossaSMPAbortCB(agRoot, pRequest->pIORequestContext, scp, status); 5934285809Sscottl } 5935285809Sscottl else 5936285809Sscottl { 5937285809Sscottl (*(ossaGenericAbortCB_t)(pRequest->completionCB))(agRoot, pRequest->pIORequestContext, scp, status); 5938285809Sscottl } 5939285809Sscottl 5940285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5941285809Sscottl 5942285809Sscottl /* Delete the request from the pendingIORequests */ 5943285809Sscottl saLlistIORemove(&(pDevice->pendingIORequests), &(pRequest->linkNode)); 5944285809Sscottl pRequest->valid = agFALSE; 5945285809Sscottl /* return the request to free pool */ 5946285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 5947285809Sscottl { 5948285809Sscottl SA_DBG1(("mpiSMPAbortRsp: saving pRequest (%p) for later use\n", pRequest)); 5949285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 5950285809Sscottl } 5951285809Sscottl else 5952285809Sscottl { 5953285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 5954285809Sscottl } 5955285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 5956285809Sscottl 5957285809Sscottl } 5958285809Sscottl else 5959285809Sscottl { 5960285809Sscottl ret = AGSA_RC_FAILURE; 5961285809Sscottl SA_DBG1(("mpiSMPAbortRsp: the request is not valid any more. Tag=%x\n", pRequest->HTag)); 5962285809Sscottl } 5963285809Sscottl 5964285809Sscottl 5965285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3P"); 5966285809Sscottl 5967285809Sscottl return ret; 5968285809Sscottl} 5969285809Sscottl 5970285809Sscottl/******************************************************************************/ 5971285809Sscottl/*! \brief SPC MPI Device Handle Arrived Event (target mode) 5972285809Sscottl * 5973285809Sscottl * This function handles the Device Handle Arrived Event. 5974285809Sscottl * 5975285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 5976285809Sscottl * \param pMsg1 pointer of Message 5977285809Sscottl * 5978285809Sscottl * \return The read value 5979285809Sscottl * 5980285809Sscottl */ 5981285809Sscottl/*******************************************************************************/ 5982285809SscottlGLOBAL bit32 mpiDeviceHandleRemoval( 5983285809Sscottl agsaRoot_t *agRoot, 5984285809Sscottl agsaDeviceHandleRemoval_t *pMsg1) 5985285809Sscottl{ 5986285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 5987285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 5988285809Sscottl agsaDeviceDesc_t *pDevice; 5989285809Sscottl agsaPortContext_t *agPortContext; 5990285809Sscottl bit32 portId; 5991285809Sscottl bit32 deviceid, deviceIdx; 5992285809Sscottl 5993285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3R"); 5994285809Sscottl 5995285809Sscottl /* convert endiness if necassary */ 5996285809Sscottl OSSA_READ_LE_32(AGROOT, &portId, pMsg1, OSSA_OFFSET_OF(agsaDeviceHandleRemoval_t, portId)); 5997285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceid, pMsg1, OSSA_OFFSET_OF(agsaDeviceHandleRemoval_t, deviceId)); 5998285809Sscottl 5999285809Sscottl SA_DBG3(("mpiDeviceHandleRemoval: portId=0x%x deviceId=0x%x\n", portId, deviceid)); 6000285809Sscottl 6001285809Sscottl pDevice = saRoot->DeviceMap[deviceid & DEVICE_ID_BITS].DeviceHandle; 6002285809Sscottl SA_DBG2(("mpiDeviceHandleRemoval:PortID 0x%x PortStatus 0x%x PortContext %p\n", 6003285809Sscottl saRoot->PortMap[portId & PORTID_MASK].PortID, 6004285809Sscottl saRoot->PortMap[portId & PORTID_MASK].PortStatus, 6005285809Sscottl saRoot->PortMap[portId & PORTID_MASK].PortContext)); 6006285809Sscottl agPortContext = (agsaPortContext_t *)saRoot->PortMap[portId & PORTID_MASK].PortContext; 6007285809Sscottl 6008285809Sscottl /* Call Back */ 6009285809Sscottl SA_DBG1(("mpiDeviceHandleRemoval: portId=0x%x deviceId=0x%x autoDeregDeviceflag=0x%x\n", portId, deviceid,saRoot->autoDeregDeviceflag[portId & PORTID_MASK])); 6010285809Sscottl if (pDevice->targetDevHandle.sdkData) 6011285809Sscottl { 6012285809Sscottl ossaDeviceHandleRemovedEvent(agRoot, &(pDevice->targetDevHandle), agPortContext); 6013285809Sscottl 6014285809Sscottl if (saRoot->autoDeregDeviceflag[portId & PORTID_MASK]) 6015285809Sscottl { 6016285809Sscottl /* remove the DeviceMap and MapIndex */ 6017285809Sscottl deviceIdx = pDevice->DeviceMapIndex & DEVICE_ID_BITS; 6018285809Sscottl SA_DBG1(("mpiDeviceHandleRemoval: A Freed portId=0x%x deviceId=0x%x\n", portId, deviceid)); 6019285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 6020285809Sscottl 6021285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceIdFromFW = 0; 6022285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceHandle = agNULL; 6023285809Sscottl pDevice->DeviceMapIndex = 0; 6024285809Sscottl 6025285809Sscottl /* Reset the device data structure */ 6026285809Sscottl pDevice->pPort = agNULL; 6027285809Sscottl pDevice->targetDevHandle.sdkData = agNULL; 6028285809Sscottl pDevice->targetDevHandle.osData = agNULL; 6029285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6030285809Sscottl saLlistAdd(&(saRoot->freeDevicesList), &(pDevice->linkNode)); 6031285809Sscottl SA_DBG1(("mpiDeviceHandleRemoval: portId=0x%x deviceId=0x%x\n", portId, deviceid)); 6032285809Sscottl 6033285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6034285809Sscottl } 6035285809Sscottl } 6036285809Sscottl else 6037285809Sscottl { 6038285809Sscottl if (pDevice->initiatorDevHandle.sdkData) 6039285809Sscottl { 6040285809Sscottl ossaDeviceHandleRemovedEvent(agRoot, &(pDevice->initiatorDevHandle), agPortContext); 6041285809Sscottl 6042285809Sscottl if (saRoot->autoDeregDeviceflag[portId & PORTID_MASK]) 6043285809Sscottl { 6044285809Sscottl /* remove the DeviceMap and MapIndex */ 6045285809Sscottl deviceIdx = pDevice->DeviceMapIndex & DEVICE_ID_BITS; 6046285809Sscottl SA_DBG1(("mpiDeviceHandleRemoval: A Freed portId=0x%x deviceId=0x%x\n", portId, deviceid)); 6047285809Sscottl OS_ASSERT(deviceIdx < MAX_IO_DEVICE_ENTRIES, "deviceIdx MAX_IO_DEVICE_ENTRIES"); 6048285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceIdFromFW = 0; 6049285809Sscottl saRoot->DeviceMap[deviceIdx].DeviceHandle = agNULL; 6050285809Sscottl pDevice->DeviceMapIndex = 0; 6051285809Sscottl 6052285809Sscottl /* Reset the device data structure */ 6053285809Sscottl pDevice->pPort = agNULL; 6054285809Sscottl pDevice->initiatorDevHandle.sdkData = agNULL; 6055285809Sscottl pDevice->initiatorDevHandle.osData = agNULL; 6056285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6057285809Sscottl saLlistAdd(&(saRoot->freeDevicesList), &(pDevice->linkNode)); 6058285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6059285809Sscottl } 6060285809Sscottl } 6061285809Sscottl else 6062285809Sscottl { 6063285809Sscottl /* no callback because bad device_id */ 6064285809Sscottl SA_DBG1(("mpiDeviceHandleRemoval: Bad Device Handle, deviceId=0x%x\n", deviceid)); 6065285809Sscottl } 6066285809Sscottl } 6067285809Sscottl 6068285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3R"); 6069285809Sscottl return ret; 6070285809Sscottl} 6071285809Sscottl 6072285809Sscottl/******************************************************************************/ 6073285809Sscottl/*! \brief Set Device State Response 6074285809Sscottl * 6075285809Sscottl * This routine handles the response of SET Device State Response 6076285809Sscottl * 6077285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6078285809Sscottl * \param pIomb Pointer of IOMB Mesage 6079285809Sscottl * 6080285809Sscottl * \return sucess or fail 6081285809Sscottl * 6082285809Sscottl */ 6083285809Sscottl/*******************************************************************************/ 6084285809SscottlGLOBAL bit32 mpiSetDeviceStateRsp( 6085285809Sscottl agsaRoot_t *agRoot, 6086285809Sscottl agsaSetDeviceStateRsp_t *pIomb 6087285809Sscottl ) 6088285809Sscottl{ 6089285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6090285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6091285809Sscottl agsaIORequestDesc_t *pRequest; 6092285809Sscottl agsaDevHandle_t *agDevHandle; 6093285809Sscottl agsaDeviceDesc_t *pDevice; 6094285809Sscottl agsaContext_t *agContext; 6095285809Sscottl bit32 tag, status, deviceState, deviceId; 6096285809Sscottl 6097285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3Q"); 6098285809Sscottl 6099285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: HTag=0x%x, deviceId=0x%x\n", pIomb->tag, pIomb->deviceId)); 6100285809Sscottl 6101285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSetDeviceStateRsp_t, tag)); 6102285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceId, pIomb, OSSA_OFFSET_OF(agsaSetDeviceStateRsp_t, deviceId)); 6103285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSetDeviceStateRsp_t, status)); 6104285809Sscottl 6105285809Sscottl /* get request from IOMap */ 6106285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6107285809Sscottl if (agNULL == pRequest) 6108285809Sscottl { 6109285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 6110285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3Q"); 6111285809Sscottl return AGSA_RC_FAILURE; 6112285809Sscottl } 6113285809Sscottl 6114285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6115285809Sscottl /* remove the request from IOMap */ 6116285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6117285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6118285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6119285809Sscottl 6120285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6121285809Sscottl 6122285809Sscottl /* status is SUCCESS */ 6123285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceState, pIomb, OSSA_OFFSET_OF(agsaSetDeviceStateRsp_t, pds_nds)); 6124285809Sscottl 6125285809Sscottl /* find device handle from device index */ 6126285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceId & DEVICE_ID_BITS].DeviceHandle; 6127285809Sscottl if (agNULL == pDevice) 6128285809Sscottl { 6129285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: DeviceHandle is NULL!!! deviceId=0x%x TAG=0x%x STATUS=0x%x \n", deviceId, tag, status)); 6130285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3Q"); 6131285809Sscottl return AGSA_RC_FAILURE; 6132285809Sscottl } 6133285809Sscottl 6134285809Sscottl if (pDevice->targetDevHandle.sdkData) 6135285809Sscottl { 6136285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 6137285809Sscottl } 6138285809Sscottl else 6139285809Sscottl { 6140285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 6141285809Sscottl } 6142285809Sscottl 6143285809Sscottl if (agDevHandle == agNULL) 6144285809Sscottl { 6145285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: warning!!! no deviceHandle is found")); 6146285809Sscottl ossaSetDeviceStateCB(agRoot, agContext, agNULL, OSSA_IO_NO_DEVICE, 0, 0); 6147285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "3Q"); 6148285809Sscottl 6149285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6150285809Sscottl pRequest->valid = agFALSE; 6151285809Sscottl /* return the request to free pool */ 6152285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6153285809Sscottl { 6154285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: saving pRequest (%p) for later use\n", pRequest)); 6155285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6156285809Sscottl } 6157285809Sscottl else 6158285809Sscottl { 6159285809Sscottl /* return the request to free pool */ 6160285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6161285809Sscottl } 6162285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6163285809Sscottl 6164285809Sscottl return AGSA_RC_FAILURE; 6165285809Sscottl } 6166285809Sscottl 6167285809Sscottl ossaSetDeviceStateCB(agRoot, agContext, agDevHandle, status, (deviceState & NDS_BITS), 6168285809Sscottl (deviceState & PDS_BITS) >> SHIFT4); 6169285809Sscottl 6170285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6171285809Sscottl pRequest->valid = agFALSE; 6172285809Sscottl /* return the request to free pool */ 6173285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6174285809Sscottl { 6175285809Sscottl SA_DBG1(("mpiSetDeviceStateRsp: saving pRequest (%p) for later use\n", pRequest)); 6176285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6177285809Sscottl } 6178285809Sscottl else 6179285809Sscottl { 6180285809Sscottl /* return the request to free pool */ 6181285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6182285809Sscottl } 6183285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6184285809Sscottl 6185285809Sscottl /* return value */ 6186285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "3Q"); 6187285809Sscottl return ret; 6188285809Sscottl} 6189285809Sscottl 6190285809Sscottl/******************************************************************************/ 6191285809Sscottl/*! \brief Get Device State Response 6192285809Sscottl * 6193285809Sscottl * This routine handles the response of GET Device State Response 6194285809Sscottl * 6195285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6196285809Sscottl * \param pIomb Pointer of IOMB Mesage 6197285809Sscottl * 6198285809Sscottl * \return sucess or fail 6199285809Sscottl * 6200285809Sscottl */ 6201285809Sscottl/*******************************************************************************/ 6202285809SscottlGLOBAL bit32 mpiGetDeviceStateRsp( 6203285809Sscottl agsaRoot_t *agRoot, 6204285809Sscottl agsaGetDeviceStateRsp_t *pIomb 6205285809Sscottl ) 6206285809Sscottl{ 6207285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6208285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6209285809Sscottl agsaIORequestDesc_t *pRequest; 6210285809Sscottl agsaDevHandle_t *agDevHandle; 6211285809Sscottl agsaDeviceDesc_t *pDevice; 6212285809Sscottl agsaContext_t *agContext; 6213285809Sscottl bit32 tag, status, deviceId, deviceState; 6214285809Sscottl 6215285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3W"); 6216285809Sscottl 6217285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: HTag=0x%x, deviceId=0x%x\n", pIomb->tag, pIomb->deviceId)); 6218285809Sscottl 6219285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetDeviceStateRsp_t, tag)); 6220285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceId, pIomb, OSSA_OFFSET_OF(agsaGetDeviceStateRsp_t, deviceId)); 6221285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetDeviceStateRsp_t, status)); 6222285809Sscottl 6223285809Sscottl /* get request from IOMap */ 6224285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6225285809Sscottl if (agNULL == pRequest) 6226285809Sscottl { 6227285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 6228285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3W"); 6229285809Sscottl return AGSA_RC_FAILURE; 6230285809Sscottl } 6231285809Sscottl 6232285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6233285809Sscottl /* remove the request from IOMap */ 6234285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6235285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6236285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6237285809Sscottl 6238285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6239285809Sscottl 6240285809Sscottl /* status is SUCCESS */ 6241285809Sscottl OSSA_READ_LE_32(AGROOT, &deviceState, pIomb, OSSA_OFFSET_OF(agsaGetDeviceStateRsp_t, ds)); 6242285809Sscottl 6243285809Sscottl /* find device handle from device index */ 6244285809Sscottl pDevice = (agsaDeviceDesc_t *)saRoot->DeviceMap[deviceId & DEVICE_ID_BITS].DeviceHandle; 6245285809Sscottl if (pDevice != agNULL) 6246285809Sscottl { 6247285809Sscottl if (pDevice->targetDevHandle.sdkData) 6248285809Sscottl { 6249285809Sscottl agDevHandle = &(pDevice->targetDevHandle); 6250285809Sscottl } 6251285809Sscottl else 6252285809Sscottl { 6253285809Sscottl agDevHandle = &(pDevice->initiatorDevHandle); 6254285809Sscottl } 6255285809Sscottl } 6256285809Sscottl else 6257285809Sscottl { 6258285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: pDevice is NULL")); 6259285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3W"); 6260285809Sscottl return AGSA_RC_FAILURE; 6261285809Sscottl } 6262285809Sscottl 6263285809Sscottl if (agDevHandle == agNULL) 6264285809Sscottl { 6265285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: warning!!! no deviceHandle is found")); 6266285809Sscottl ossaGetDeviceStateCB(agRoot, agContext, agNULL, OSSA_IO_NO_DEVICE, 0); 6267285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "3W"); 6268285809Sscottl 6269285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6270285809Sscottl pRequest->valid = agFALSE; 6271285809Sscottl /* return the request to free pool */ 6272285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6273285809Sscottl { 6274285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: saving pRequest (%p) for later use\n", pRequest)); 6275285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6276285809Sscottl } 6277285809Sscottl else 6278285809Sscottl { 6279285809Sscottl /* return the request to free pool */ 6280285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6281285809Sscottl } 6282285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6283285809Sscottl 6284285809Sscottl return AGSA_RC_FAILURE; 6285285809Sscottl } 6286285809Sscottl 6287285809Sscottl ossaGetDeviceStateCB(agRoot, agContext, agDevHandle, status, deviceState); 6288285809Sscottl 6289285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6290285809Sscottl pRequest->valid = agFALSE; 6291285809Sscottl /* return the request to free pool */ 6292285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6293285809Sscottl { 6294285809Sscottl SA_DBG1(("mpiGetDeviceStateRsp: saving pRequest (%p) for later use\n", pRequest)); 6295285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6296285809Sscottl } 6297285809Sscottl else 6298285809Sscottl { 6299285809Sscottl /* return the request to free pool */ 6300285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6301285809Sscottl } 6302285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6303285809Sscottl 6304285809Sscottl /* return value */ 6305285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "3W"); 6306285809Sscottl return ret; 6307285809Sscottl} 6308285809Sscottl 6309285809Sscottl/******************************************************************************/ 6310285809Sscottl/*! \brief SAS ReInitialize Response 6311285809Sscottl * 6312285809Sscottl * This routine handles the response of SAS Reinitialize Response 6313285809Sscottl * 6314285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6315285809Sscottl * \param pIomb Pointer of IOMB Mesage 6316285809Sscottl * 6317285809Sscottl * \return sucess or fail 6318285809Sscottl * 6319285809Sscottl */ 6320285809Sscottl/*******************************************************************************/ 6321285809SscottlGLOBAL bit32 mpiSasReInitializeRsp( 6322285809Sscottl agsaRoot_t *agRoot, 6323285809Sscottl agsaSasReInitializeRsp_t *pIomb 6324285809Sscottl ) 6325285809Sscottl{ 6326285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6327285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6328285809Sscottl agsaIORequestDesc_t *pRequest; 6329285809Sscottl agsaContext_t *agContext; 6330285809Sscottl agsaSASReconfig_t SASReconfig; 6331285809Sscottl bit32 tag, status, setFlags, MaxPorts; 6332285809Sscottl bit32 openRejReCmdData, sataHOLTMO; 6333285809Sscottl 6334285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3X"); 6335285809Sscottl 6336285809Sscottl SA_DBG1(("mpiSasReInitializeRsp: HTag=0x%x, status=0x%x\n", pIomb->tag, pIomb->status)); 6337285809Sscottl 6338285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, tag)); 6339285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, status)); 6340285809Sscottl OSSA_READ_LE_32(AGROOT, &setFlags, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, setFlags)); 6341285809Sscottl OSSA_READ_LE_32(AGROOT, &MaxPorts, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, MaxPorts)); 6342285809Sscottl OSSA_READ_LE_32(AGROOT, &openRejReCmdData, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, openRejReCmdData)); 6343285809Sscottl OSSA_READ_LE_32(AGROOT, &sataHOLTMO, pIomb, OSSA_OFFSET_OF(agsaSasReInitializeRsp_t, sataHOLTMO)); 6344285809Sscottl 6345285809Sscottl /* get request from IOMap */ 6346285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6347285809Sscottl if (agNULL == pRequest) 6348285809Sscottl { 6349285809Sscottl SA_DBG1(("mpiSasReInitializeRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 6350285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3X"); 6351285809Sscottl return AGSA_RC_FAILURE; 6352285809Sscottl } 6353285809Sscottl 6354285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6355285809Sscottl /* remove the request from IOMap */ 6356285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6357285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6358285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6359285809Sscottl 6360285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6361285809Sscottl 6362285809Sscottl SASReconfig.flags = setFlags; 6363285809Sscottl SASReconfig.maxPorts = (bit8)(MaxPorts & 0xFF); 6364285809Sscottl SASReconfig.openRejectRetriesCmd = (bit16)((openRejReCmdData & 0xFFFF0000) >> SHIFT16); 6365285809Sscottl SASReconfig.openRejectRetriesData = (bit16)(openRejReCmdData & 0x0000FFFF); 6366285809Sscottl SASReconfig.sataHolTmo = (bit16)(sataHOLTMO & 0xFFFF); 6367285809Sscottl ossaReconfigSASParamsCB(agRoot, agContext, status, &SASReconfig); 6368285809Sscottl 6369285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6370285809Sscottl pRequest->valid = agFALSE; 6371285809Sscottl /* return the request to free pool */ 6372285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6373285809Sscottl { 6374285809Sscottl SA_DBG1(("mpiSasReInitializeRsp: saving pRequest (%p) for later use\n", pRequest)); 6375285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6376285809Sscottl } 6377285809Sscottl else 6378285809Sscottl { 6379285809Sscottl /* return the request to free pool */ 6380285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6381285809Sscottl } 6382285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6383285809Sscottl 6384285809Sscottl /* return value */ 6385285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3X"); 6386285809Sscottl 6387285809Sscottl return ret; 6388285809Sscottl} 6389285809Sscottl 6390285809Sscottl/******************************************************************************/ 6391285809Sscottl/*! \brief serial GPIO Response 6392285809Sscottl * 6393285809Sscottl * This routine handles the response of serial GPIO Response 6394285809Sscottl * 6395285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6396285809Sscottl * \param pIomb Pointer of IOMB Mesage 6397285809Sscottl * 6398285809Sscottl * \return sucess or fail 6399285809Sscottl * 6400285809Sscottl */ 6401285809Sscottl/*******************************************************************************/ 6402285809SscottlGLOBAL bit32 mpiSGpioRsp( 6403285809Sscottl agsaRoot_t *agRoot, 6404285809Sscottl agsaSGpioRsp_t *pInIomb 6405285809Sscottl ) 6406285809Sscottl{ 6407285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6408285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6409285809Sscottl agsaIORequestDesc_t *pRequest = NULL; 6410285809Sscottl agsaContext_t *agContext = NULL; 6411285809Sscottl bit32 i, tag, resultFunctionFrameType; 6412285809Sscottl agsaSGpioReqResponse_t SgpioResponse = {0}; 6413285809Sscottl 6414285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3Y"); 6415285809Sscottl 6416285809Sscottl SA_DBG3(("mpiSGpioRsp: HTAG=0x%x\n", pInIomb->tag)); 6417285809Sscottl 6418285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pInIomb, OSSA_OFFSET_OF(agsaSGpioRsp_t, tag)); 6419285809Sscottl OSSA_READ_LE_32(AGROOT, &resultFunctionFrameType, pInIomb, OSSA_OFFSET_OF(agsaSGpioRsp_t, resultFunctionFrameType)); 6420285809Sscottl 6421285809Sscottl SgpioResponse.smpFrameType = resultFunctionFrameType & 0xFF; 6422285809Sscottl SgpioResponse.function = (resultFunctionFrameType & 0xFF00) >> 8; 6423285809Sscottl SgpioResponse.functionResult = (resultFunctionFrameType & 0xFF0000) >> 16; 6424285809Sscottl 6425285809Sscottl if (SA_SAS_SMP_READ_GPIO_REGISTER == SgpioResponse.function) 6426285809Sscottl { 6427285809Sscottl for (i = 0; i < OSSA_SGPIO_MAX_READ_DATA_COUNT; i++) 6428285809Sscottl { 6429285809Sscottl OSSA_READ_LE_32(AGROOT, &SgpioResponse.readWriteData[i], pInIomb, OSSA_OFFSET_OF(agsaSGpioRsp_t, readData) + (i * 4)); 6430285809Sscottl } 6431285809Sscottl } 6432285809Sscottl 6433285809Sscottl /* Get the request from IOMap */ 6434285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6435285809Sscottl if (agNULL == pRequest) 6436285809Sscottl { 6437285809Sscottl SA_DBG1(("mpiSGpioRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x STATUS=0x%x\n", tag, SgpioResponse.functionResult)); 6438285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3Y"); 6439285809Sscottl ret = AGSA_RC_FAILURE; 6440285809Sscottl } 6441285809Sscottl else 6442285809Sscottl { 6443285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6444285809Sscottl ossaSGpioCB(agRoot, agContext, &SgpioResponse); 6445285809Sscottl 6446285809Sscottl /* Return the request to free pool */ 6447285809Sscottl saReturnRequestToFreePool(agRoot, pRequest); 6448285809Sscottl 6449285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3Y"); 6450285809Sscottl } 6451285809Sscottl 6452285809Sscottl return ret; 6453285809Sscottl} 6454285809Sscottl 6455285809Sscottl/******************************************************************************/ 6456285809Sscottl/*! \brief PCIE Diagnostics Response 6457285809Sscottl * 6458285809Sscottl * This routine handles the response of PCIE Diagnostics Response 6459285809Sscottl * 6460285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6461285809Sscottl * \param pIomb Pointer of IOMB Mesage 6462285809Sscottl * 6463285809Sscottl * \return sucess or fail 6464285809Sscottl * 6465285809Sscottl */ 6466285809Sscottl/*******************************************************************************/ 6467285809SscottlGLOBAL bit32 mpiPCIeDiagExecuteRsp( 6468285809Sscottl agsaRoot_t *agRoot, 6469285809Sscottl void *pInIomb 6470285809Sscottl ) 6471285809Sscottl{ 6472285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6473285809Sscottl agsaLLRoot_t *saRoot = agNULL; 6474285809Sscottl agsaIORequestDesc_t *pRequest; 6475285809Sscottl agsaContext_t *agContext; 6476285809Sscottl bit32 tag, Status, Command; 6477285809Sscottl agsaPCIeDiagResponse_t pciediadrsp; 6478285809Sscottl bit32 *pIomb = (bit32 *)pInIomb; 6479285809Sscottl 6480285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3Z"); 6481285809Sscottl 6482285809Sscottl /* sanity check */ 6483285809Sscottl SA_ASSERT((agNULL != agRoot), ""); 6484285809Sscottl saRoot = (agsaLLRoot_t *) (agRoot->sdkData); 6485285809Sscottl SA_ASSERT((agNULL != saRoot), ""); 6486285809Sscottl 6487285809Sscottl si_memset(&pciediadrsp, 0, sizeof(agsaPCIeDiagResponse_t)); 6488285809Sscottl 6489285809Sscottl if(smIS_SPCV(agRoot)) 6490285809Sscottl { 6491285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,tag)); 6492285809Sscottl OSSA_READ_LE_32(AGROOT, &Command, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,CmdTypeDesc)); 6493285809Sscottl OSSA_READ_LE_32(AGROOT, &Status, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,Status)); 6494285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.ERR_BLKH, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,ERR_BLKH )); 6495285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.ERR_BLKL, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,ERR_BLKL )); 6496285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.DWord8, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,DWord8 )); 6497285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.DWord9, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,DWord9 )); 6498285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.DWord10, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,DWord10 )); 6499285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.DWord11, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,DWord11 )); 6500285809Sscottl OSSA_READ_LE_32(AGROOT, &pciediadrsp.DIF_ERR, pIomb, OSSA_OFFSET_OF(agsaPCIeDiagExecuteRsp_t,DIF_ERR )); 6501285809Sscottl SA_DBG3(("mpiPCIeDiagExecuteRsp: HTAG=0x%x\n",tag)); 6502285809Sscottl } 6503285809Sscottl else 6504285809Sscottl { 6505285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsa_SPC_PCIeDiagExecuteRsp_t,tag)); 6506285809Sscottl OSSA_READ_LE_32(AGROOT, &Command, pIomb, OSSA_OFFSET_OF(agsa_SPC_PCIeDiagExecuteRsp_t,CmdTypeDesc)); 6507285809Sscottl OSSA_READ_LE_32(AGROOT, &Status, pIomb, OSSA_OFFSET_OF(agsa_SPC_PCIeDiagExecuteRsp_t,Status)); 6508285809Sscottl SA_DBG3(("mpiPCIeDiagExecuteRsp: SPC HTAG=0x%x\n",tag)); 6509285809Sscottl } 6510285809Sscottl 6511285809Sscottl switch(Status) 6512285809Sscottl { 6513285809Sscottl case OSSA_PCIE_DIAG_SUCCESS: 6514285809Sscottl SA_DBG3(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_SUCCESS TAG=0x%x STATUS=0x%x\n", tag, Status)); 6515285809Sscottl break; 6516285809Sscottl case OSSA_IO_INVALID_LENGTH: 6517285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_IO_INVALID_LENGTH TAG=0x%x STATUS=0x%x\n", tag, Status)); 6518285809Sscottl break; 6519285809Sscottl case OSSA_PCIE_DIAG_INVALID_COMMAND: 6520285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INVALID_COMMAND TAG=0x%x STATUS=0x%x\n", tag, Status)); 6521285809Sscottl break; 6522285809Sscottl case OSSA_PCIE_DIAG_INTERNAL_FAILURE: 6523285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INTERNAL_FAILURE TAG=0x%x STATUS=0x%x\n", tag, Status)); 6524285809Sscottl break; 6525285809Sscottl case OSSA_PCIE_DIAG_INVALID_CMD_TYPE: 6526285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INVALID_CMD_TYPE TAG=0x%x STATUS=0x%x\n", tag, Status)); 6527285809Sscottl break; 6528285809Sscottl case OSSA_PCIE_DIAG_INVALID_CMD_DESC: 6529285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INVALID_CMD_DESC TAG=0x%x STATUS=0x%x\n", tag, Status)); 6530285809Sscottl break; 6531285809Sscottl case OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH: 6532285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH TAG=0x%x STATUS=0x%x\n", tag, Status)); 6533285809Sscottl break; 6534285809Sscottl case OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_CRC_MISMATCH: 6535285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_CRC_MISMATCH TAG=0x%x STATUS=0x%x\n", tag, Status)); 6536285809Sscottl break; 6537285809Sscottl case OSSA_PCIE_DIAG_INVALID_PCIE_ADDR: 6538285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INVALID_PCIE_ADDR TAG=0x%x STATUS=0x%x\n", tag, Status)); 6539285809Sscottl break; 6540285809Sscottl case OSSA_PCIE_DIAG_INVALID_BLOCK_SIZE: 6541285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_INVALID_BLOCK_SIZE TAG=0x%x STATUS=0x%x\n", tag, Status)); 6542285809Sscottl break; 6543285809Sscottl case OSSA_PCIE_DIAG_LENGTH_NOT_BLOCK_SIZE_ALIGNED: 6544285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_LENGTH_NOT_BLOCK_SIZE_ALIGNED TAG=0x%x STATUS=0x%x\n", tag, Status)); 6545285809Sscottl break; 6546285809Sscottl case OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_MISMATCH: 6547285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_MISMATCH TAG=0x%x STATUS=0x%x\n", tag, Status)); 6548285809Sscottl break; 6549285809Sscottl case OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH: 6550285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: OSSA_PCIE_DIAG_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH TAG=0x%x STATUS=0x%x\n", tag, Status)); 6551285809Sscottl break; 6552285809Sscottl default: 6553285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: UNKNOWN status TAG=0x%x STATUS=0x%x\n", tag, Status)); 6554285809Sscottl break; 6555285809Sscottl } 6556285809Sscottl /* get request from IOMap */ 6557285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6558285809Sscottl if (agNULL == pRequest) 6559285809Sscottl { 6560285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x STATUS=0x%x\n", tag, Status)); 6561285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3Z"); 6562285809Sscottl return AGSA_RC_FAILURE; 6563285809Sscottl } 6564285809Sscottl 6565285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6566285809Sscottl /* remove the request from IOMap */ 6567285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6568285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6569285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6570285809Sscottl 6571285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6572285809Sscottl 6573285809Sscottl ossaPCIeDiagExecuteCB(agRoot, agContext, Status, Command,&pciediadrsp); 6574285809Sscottl 6575285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6576285809Sscottl pRequest->valid = agFALSE; 6577285809Sscottl /* return the request to free pool */ 6578285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6579285809Sscottl { 6580285809Sscottl SA_DBG1(("mpiPCIeDiagExecuteRsp: saving pRequest (%p) for later use\n", pRequest)); 6581285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6582285809Sscottl } 6583285809Sscottl else 6584285809Sscottl { 6585285809Sscottl /* return the request to free pool */ 6586285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6587285809Sscottl } 6588285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6589285809Sscottl 6590285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3Z"); 6591285809Sscottl 6592285809Sscottl /* return value */ 6593285809Sscottl return ret; 6594285809Sscottl} 6595285809Sscottl/******************************************************************************/ 6596285809Sscottl/*! \brief Get DFE Data command Response 6597285809Sscottl * 6598285809Sscottl * This routine handles the response of Get DFE Data command Response 6599285809Sscottl * 6600285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6601285809Sscottl * \param pIomb Pointer of IOMB Mesage 6602285809Sscottl * 6603285809Sscottl * \return sucess or fail 6604285809Sscottl * 6605285809Sscottl */ 6606285809Sscottl/*******************************************************************************/ 6607285809SscottlGLOBAL bit32 mpiGetDFEDataRsp( 6608285809Sscottl agsaRoot_t *agRoot, 6609285809Sscottl void *pIomb 6610285809Sscottl ) 6611285809Sscottl{ 6612285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 6613285809Sscottl agsaLLRoot_t *saRoot = agNULL; 6614285809Sscottl agsaIORequestDesc_t *pRequest; 6615285809Sscottl agsaContext_t *agContext; 6616285809Sscottl bit32 tag = 0, status = 0, In_Ln = 0, MCNT = 0, NBT = 0; 6617285809Sscottl 6618285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2Y"); 6619285809Sscottl 6620285809Sscottl /* sanity check */ 6621285809Sscottl SA_ASSERT((agNULL != agRoot), ""); 6622285809Sscottl saRoot = (agsaLLRoot_t *) (agRoot->sdkData); 6623285809Sscottl SA_ASSERT((agNULL != saRoot), ""); 6624285809Sscottl 6625285809Sscottl if(smIS_SPCV(agRoot)) 6626285809Sscottl { 6627285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetDDEFDataRsp_t,tag)); 6628285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetDDEFDataRsp_t,status)); 6629285809Sscottl OSSA_READ_LE_32(AGROOT, &In_Ln, pIomb, OSSA_OFFSET_OF(agsaGetDDEFDataRsp_t,reserved_In_Ln)); 6630285809Sscottl OSSA_READ_LE_32(AGROOT, &MCNT, pIomb, OSSA_OFFSET_OF(agsaGetDDEFDataRsp_t,MCNT)); 6631285809Sscottl OSSA_READ_LE_32(AGROOT, &NBT, pIomb, OSSA_OFFSET_OF(agsaGetDDEFDataRsp_t,NBT)); 6632285809Sscottl } 6633285809Sscottl else 6634285809Sscottl { 6635285809Sscottl /* SPC does not support this command */ 6636285809Sscottl } 6637285809Sscottl 6638285809Sscottl switch(status) 6639285809Sscottl { 6640285809Sscottl case OSSA_DFE_MPI_IO_SUCCESS: 6641285809Sscottl SA_DBG3(("mpiGetDFEDataRsp: OSSA_DFE_MPI_IO_SUCCESS TAG=0x%x STATUS=0x%x\n", tag, status)); 6642285809Sscottl break; 6643285809Sscottl case OSSA_DFE_DATA_OVERFLOW: 6644285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_DATA_OVERFLOW TAG=0x%x STATUS=0x%x\n", tag, status)); 6645285809Sscottl break; 6646285809Sscottl case OSSA_DFE_MPI_ERR_RESOURCE_UNAVAILABLE: 6647285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_MPI_ERR_RESOURCE_UNAVAILABLE TAG=0x%x STATUS=0x%x\n", tag, status)); 6648285809Sscottl break; 6649285809Sscottl case OSSA_DFE_CHANNEL_DOWN: 6650285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_CHANNEL_DOWN TAG=0x%x STATUS=0x%x\n", tag, status)); 6651285809Sscottl break; 6652285809Sscottl case OSSA_DFE_MEASUREMENT_IN_PROGRESS: 6653285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_MEASUREMENT_IN_PROGRESS TAG=0x%x STATUS=0x%x\n", tag, status)); 6654285809Sscottl break; 6655285809Sscottl case OSSA_DFE_CHANNEL_INVALID: 6656285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_CHANNEL_INVALID TAG=0x%x STATUS=0x%x\n", tag, status)); 6657285809Sscottl break; 6658285809Sscottl case OSSA_DFE_DMA_FAILURE: 6659285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: OSSA_DFE_DMA_FAILURE TAG=0x%x STATUS=0x%x\n", tag, status)); 6660285809Sscottl break; 6661285809Sscottl default: 6662285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: UNKNOWN status TAG=0x%x STATUS=0x%x\n", tag, status)); 6663285809Sscottl break; 6664285809Sscottl } 6665285809Sscottl 6666285809Sscottl /* get request from IOMap */ 6667285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6668285809Sscottl if (agNULL == pRequest) 6669285809Sscottl { 6670285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: Bad Response IOMB!!! pRequest is NULL.TAG=0x%x STATUS=0x%x\n", tag, status)); 6671285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2Y"); 6672285809Sscottl return AGSA_RC_FAILURE; 6673285809Sscottl } 6674285809Sscottl 6675285809Sscottl agContext = saRoot->IOMap[tag].agContext; 6676285809Sscottl /* remove the request from IOMap */ 6677285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6678285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6679285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6680285809Sscottl 6681285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6682285809Sscottl 6683285809Sscottl ossaGetDFEDataCB(agRoot, agContext, status, NBT); 6684285809Sscottl 6685285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6686285809Sscottl pRequest->valid = agFALSE; 6687285809Sscottl /* return the request to free pool */ 6688285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6689285809Sscottl { 6690285809Sscottl SA_DBG1(("mpiGetDFEDataRsp: saving pRequest (%p) for later use\n", pRequest)); 6691285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6692285809Sscottl } 6693285809Sscottl else 6694285809Sscottl { 6695285809Sscottl /* return the request to free pool */ 6696285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6697285809Sscottl } 6698285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6699285809Sscottl 6700285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2Y"); 6701285809Sscottl 6702285809Sscottl return ret; 6703285809Sscottl} 6704285809Sscottl 6705285809Sscottl 6706285809Sscottl/******************************************************************************/ 6707285809Sscottl/*! \brief SAS Set Controller Config Response 6708285809Sscottl * 6709285809Sscottl * This routine handles the response of Set Controller Config Command 6710285809Sscottl * 6711285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6712285809Sscottl * \param pIomb Pointer of IOMB Mesage 6713285809Sscottl * 6714285809Sscottl * \return sucess or fail 6715285809Sscottl * 6716285809Sscottl */ 6717285809Sscottl/*******************************************************************************/ 6718285809SscottlGLOBAL bit32 mpiSetControllerConfigRsp( 6719285809Sscottl agsaRoot_t *agRoot, 6720285809Sscottl agsaSetControllerConfigRsp_t *pIomb 6721285809Sscottl ) 6722285809Sscottl{ 6723285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6724285809Sscottl agsaIORequestDesc_t *pRequest; 6725285809Sscottl agsaHWEventMode_t agMode; 6726285809Sscottl bit32 status, errorQualifierPage, tag; 6727285809Sscottl bit32 errorQualifier; 6728285809Sscottl bit32 pagetype; 6729285809Sscottl 6730285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3a"); 6731285809Sscottl 6732285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: HTag=0x%x\n", pIomb->tag)); 6733285809Sscottl 6734285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSetControllerConfigRsp_t, tag)); 6735285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSetControllerConfigRsp_t, status)); 6736285809Sscottl OSSA_READ_LE_32(AGROOT, &errorQualifierPage, pIomb, OSSA_OFFSET_OF(agsaSetControllerConfigRsp_t, errorQualifierPage)); 6737285809Sscottl 6738285809Sscottl /* get request from IOMap */ 6739285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6740285809Sscottl if (agNULL == pRequest) 6741285809Sscottl { 6742285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 6743285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3a"); 6744285809Sscottl return AGSA_RC_FAILURE; 6745285809Sscottl } 6746285809Sscottl 6747285809Sscottl si_memset(&agMode, 0, sizeof(agsaHWEventMode_t)); 6748285809Sscottl agMode.modePageOperation = agsaModePageSet; 6749285809Sscottl agMode.status = status; 6750285809Sscottl agMode.context = saRoot->IOMap[tag].agContext; 6751285809Sscottl errorQualifier = (errorQualifierPage & 0xFFFF0000) >> SHIFT16; 6752285809Sscottl pagetype = (errorQualifierPage & 0xFF); 6753285809Sscottl 6754285809Sscottl if(status ) 6755285809Sscottl { 6756285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: Error detected tag 0x%x pagetype 0x%x status 0x%x errorQualifier 0x%x\n", 6757285809Sscottl tag, pagetype,status, errorQualifier)); 6758285809Sscottl } 6759285809Sscottl else 6760285809Sscottl { 6761285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: tag 0x%x pagetype 0x%x status 0x%x\n", tag, pagetype,status )); 6762285809Sscottl } 6763285809Sscottl 6764285809Sscottl 6765285809Sscottl switch( pagetype) 6766285809Sscottl { 6767285809Sscottl case AGSA_ENCRYPTION_DEK_CONFIG_PAGE: 6768285809Sscottl case AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE: 6769285809Sscottl case AGSA_INTERRUPT_CONFIGURATION_PAGE: 6770285809Sscottl case AGSA_ENCRYPTION_HMAC_CONFIG_PAGE: 6771285809Sscottl case AGSA_IO_GENERAL_CONFIG_PAGE: 6772285809Sscottl /*case AGSA_ENCRYPTION_CONTROL_PARM_PAGE:*/ 6773285809Sscottl /* Report the event before freeing the IOMB */ 6774285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp:OSSA_HW_EVENT_MODE\n")); 6775285809Sscottl ossaHwCB(agRoot,agMode.context, OSSA_HW_EVENT_MODE, errorQualifierPage, (void *) &agMode, 0); 6776285809Sscottl 6777285809Sscottl 6778285809Sscottl break; 6779285809Sscottl 6780285809Sscottl case AGSA_ENCRYPTION_GENERAL_CONFIG_PAGE: 6781285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp:warning!!!! GENERAL_CONFIG_PAGE is read only, cannot be set\n")); 6782285809Sscottl break; 6783285809Sscottl 6784285809Sscottl /* why we need to read the scrach pad register when handling ENCRYPTION_SECURITY_PARM_PAGE??? */ 6785285809Sscottl case AGSA_ENCRYPTION_CONTROL_PARM_PAGE: 6786285809Sscottl { 6787285809Sscottl bit32 ScratchPad1 = 0; 6788285809Sscottl bit32 ScratchPad3 = 0; 6789285809Sscottl agsaEncryptInfo_t encrypt; 6790285809Sscottl agsaEncryptInfo_t *encryptInfo = &encrypt; 6791285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: AGSA_ENCRYPTION_CONTROL_PARM_PAGE\n" )); 6792285809Sscottl 6793285809Sscottl if( pRequest->modePageContext) 6794285809Sscottl { 6795285809Sscottl pRequest->modePageContext = agFALSE; 6796285809Sscottl } 6797285809Sscottl 6798285809Sscottl si_memset(&encrypt, 0, sizeof(agsaEncryptInfo_t)); 6799285809Sscottl encryptInfo->status = 0; 6800285809Sscottl encryptInfo->encryptionCipherMode = 0; 6801285809Sscottl encryptInfo->encryptionSecurityMode = 0; 6802285809Sscottl 6803285809Sscottl ScratchPad1 = ossaHwRegRead(agRoot,V_Scratchpad_1_Register); 6804285809Sscottl ScratchPad3 = ossaHwRegRead(agRoot,V_Scratchpad_3_Register); 6805285809Sscottl if( ScratchPad3 & SCRATCH_PAD3_V_XTS_ENABLED) 6806285809Sscottl { 6807285809Sscottl encryptInfo->encryptionCipherMode = agsaEncryptCipherModeXTS; 6808285809Sscottl } 6809285809Sscottl if( (ScratchPad3 & SCRATCH_PAD3_V_SM_MASK ) == SCRATCH_PAD3_V_SMF_ENABLED ) 6810285809Sscottl { 6811285809Sscottl encryptInfo->encryptionSecurityMode = agsaEncryptSMF; 6812285809Sscottl } 6813285809Sscottl if( (ScratchPad3 & SCRATCH_PAD3_V_SM_MASK ) == SCRATCH_PAD3_V_SMA_ENABLED) 6814285809Sscottl { 6815285809Sscottl encryptInfo->encryptionSecurityMode = agsaEncryptSMA; 6816285809Sscottl } 6817285809Sscottl if( (ScratchPad3 & SCRATCH_PAD3_V_SM_MASK ) == SCRATCH_PAD3_V_SMB_ENABLED ) 6818285809Sscottl { 6819285809Sscottl encryptInfo->encryptionSecurityMode = agsaEncryptSMB; 6820285809Sscottl } 6821285809Sscottl if((ScratchPad1 & SCRATCH_PAD1_V_RAAE_MASK) == SCRATCH_PAD1_V_RAAE_MASK) 6822285809Sscottl { 6823285809Sscottl if((ScratchPad3 & SCRATCH_PAD3_V_ENC_MASK) == SCRATCH_PAD3_V_ENC_READY ) /* 3 */ 6824285809Sscottl { 6825285809Sscottl encryptInfo->status = AGSA_RC_SUCCESS; 6826285809Sscottl } 6827285809Sscottl else if((ScratchPad3 & SCRATCH_PAD3_V_ENC_READY) == SCRATCH_PAD3_V_ENC_DISABLED) /* 0 */ 6828285809Sscottl { 6829285809Sscottl encryptInfo->status = 0xFFFF; 6830285809Sscottl encryptInfo->encryptionCipherMode = 0; 6831285809Sscottl encryptInfo->encryptionSecurityMode = 0; 6832285809Sscottl } 6833285809Sscottl else if((ScratchPad3 & SCRATCH_PAD3_V_ENC_MASK ) == SCRATCH_PAD3_V_ENC_DIS_ERR) /* 1 */ 6834285809Sscottl { 6835285809Sscottl encryptInfo->status = (ScratchPad3 & SCRATCH_PAD3_V_ERR_CODE ) >> SHIFT16; 6836285809Sscottl } 6837285809Sscottl else if((ScratchPad3 & SCRATCH_PAD3_V_ENC_MASK ) == SCRATCH_PAD3_V_ENC_ENA_ERR) /* 2 */ 6838285809Sscottl { 6839285809Sscottl encryptInfo->status = (ScratchPad3 & SCRATCH_PAD3_V_ERR_CODE ) >> SHIFT16; 6840285809Sscottl } 6841285809Sscottl } 6842285809Sscottl else if((ScratchPad1 & SCRATCH_PAD1_V_RAAE_MASK) == SCRATCH_PAD1_V_RAAE_ERR) 6843285809Sscottl { 6844285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp, RAAE not ready SPC AGSA_RC_FAILURE\n")); 6845285809Sscottl encryptInfo->status = 0xFFFF; 6846285809Sscottl encryptInfo->encryptionCipherMode = 0; 6847285809Sscottl encryptInfo->encryptionSecurityMode = 0; 6848285809Sscottl } 6849285809Sscottl else if((ScratchPad1 & SCRATCH_PAD1_V_RAAE_MASK) == 0x0 ) 6850285809Sscottl { 6851285809Sscottl SA_DBG2(("mpiSetControllerConfigRsp, RAAE not ready AGSA_RC_BUSY\n")); 6852285809Sscottl } 6853285809Sscottl 6854285809Sscottl SA_DBG2(("mpiSetControllerConfigRsp, encryptionCipherMode 0x%x encryptionSecurityMode 0x%x status 0x%x\n", 6855285809Sscottl encryptInfo->encryptionCipherMode, 6856285809Sscottl encryptInfo->encryptionSecurityMode, 6857285809Sscottl encryptInfo->status)); 6858285809Sscottl SA_DBG2(("mpiSetControllerConfigRsp, ScratchPad3 0x%x\n",ScratchPad3)); 6859285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp:AGSA_ENCRYPTION_CONTROL_PARM_PAGE 0x%X\n", agMode.modePageOperation)); 6860285809Sscottl ossaHwCB(agRoot, agNULL, OSSA_HW_EVENT_SECURITY_MODE, errorQualifier, (void *)encryptInfo, agMode.context); 6861285809Sscottl break; 6862285809Sscottl } 6863285809Sscottl 6864285809Sscottl default: 6865285809Sscottl SA_DBG1(("mpiSetControllerConfigRsp: Unknown page code 0x%X\n", pagetype)); 6866285809Sscottl break; 6867285809Sscottl } 6868285809Sscottl 6869285809Sscottl /* remove the request from IOMap */ 6870285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 6871285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 6872285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 6873285809Sscottl 6874285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6875285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 6876285809Sscottl pRequest->valid = agFALSE; 6877285809Sscottl /* return the request to free pool */ 6878285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 6879285809Sscottl { 6880285809Sscottl SA_DBG1(("mpiSetControllerRsp: saving pRequest (%p) for later use\n", pRequest)); 6881285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 6882285809Sscottl } 6883285809Sscottl else 6884285809Sscottl { 6885285809Sscottl /* return the request to free pool */ 6886285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 6887285809Sscottl } 6888285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 6889285809Sscottl 6890285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3a"); 6891285809Sscottl return AGSA_RC_SUCCESS; 6892285809Sscottl 6893285809Sscottl} 6894285809Sscottl 6895285809Sscottl/******************************************************************************/ 6896285809Sscottl/*! \brief SAS Get Controller Config Response 6897285809Sscottl * 6898285809Sscottl * This routine handles the response of Get Controller Config Command 6899285809Sscottl * 6900285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 6901285809Sscottl * \param pIomb Pointer of IOMB Mesage 6902285809Sscottl * 6903285809Sscottl * \return sucess or fail 6904285809Sscottl * 6905285809Sscottl */ 6906285809Sscottl/*******************************************************************************/ 6907285809SscottlGLOBAL bit32 mpiGetControllerConfigRsp( 6908285809Sscottl agsaRoot_t *agRoot, 6909285809Sscottl agsaGetControllerConfigRsp_t *pIomb 6910285809Sscottl ) 6911285809Sscottl{ 6912285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 6913285809Sscottl agsaIORequestDesc_t *pRequest; 6914285809Sscottl agsaHWEventMode_t agMode; 6915285809Sscottl bit32 status, errorQualifier, tag; 6916285809Sscottl bit32 configPage[12]; 6917285809Sscottl 6918285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3b"); 6919285809Sscottl 6920285809Sscottl si_memset(&agMode, 0, sizeof(agsaHWEventMode_t)); 6921285809Sscottl si_memset(configPage, 0, sizeof(configPage)); 6922285809Sscottl 6923285809Sscottl 6924285809Sscottl SA_DBG2(("mpiGetControllerConfigRsp: HTag=0x%x\n", pIomb->tag)); 6925285809Sscottl 6926285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t, tag)); 6927285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t, status)); 6928285809Sscottl OSSA_READ_LE_32(AGROOT, &errorQualifier, pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t, errorQualifier)); 6929285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[0], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[0] )); 6930285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[1], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[1] )); 6931285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[2], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[2] )); 6932285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[3], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[3] )); 6933285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[4], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[4] )); 6934285809Sscottl OSSA_READ_LE_32(AGROOT, &configPage[5], pIomb, OSSA_OFFSET_OF(agsaGetControllerConfigRsp_t,configPage[5] )); 6935285809Sscottl 6936285809Sscottl /* get request from IOMap */ 6937285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 6938285809Sscottl if (agNULL == pRequest) 6939285809Sscottl { 6940285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 6941285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3b"); 6942285809Sscottl return AGSA_RC_FAILURE; 6943285809Sscottl } 6944285809Sscottl 6945285809Sscottl si_memset(&agMode, 0, sizeof(agsaHWEventMode_t)); 6946285809Sscottl agMode.modePageOperation = agsaModePageGet; 6947285809Sscottl agMode.status = status; 6948285809Sscottl 6949285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: page 0x%x status 0x%x errorQualifier 0x%x \n", (pIomb->configPage[0] & 0xFF),status, errorQualifier)); 6950285809Sscottl 6951285809Sscottl switch (pIomb->configPage[0] & 0xFF) 6952285809Sscottl { 6953285809Sscottl case AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE: 6954285809Sscottl agMode.modePageLen = sizeof(agsaSASProtocolTimerConfigurationPage_t); 6955285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE page len 0x%x \n",agMode.modePageLen)); 6956285809Sscottl break; 6957285809Sscottl case AGSA_INTERRUPT_CONFIGURATION_PAGE: 6958285809Sscottl agMode.modePageLen = sizeof(agsaInterruptConfigPage_t); 6959285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_INTERRUPT_CONFIGURATION_PAGE page len 0x%x \n",agMode.modePageLen)); 6960285809Sscottl break; 6961285809Sscottl case AGSA_IO_GENERAL_CONFIG_PAGE: 6962285809Sscottl agMode.modePageLen = sizeof(agsaIoGeneralPage_t); 6963285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_IO_GENERAL_CONFIG_PAGE page len 0x%x \n",agMode.modePageLen)); 6964285809Sscottl break; 6965285809Sscottl case AGSA_ENCRYPTION_GENERAL_CONFIG_PAGE: 6966285809Sscottl agMode.modePageLen = sizeof(agsaEncryptGeneralPage_t); 6967285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_ENCRYPTION_GENERAL_CONFIG_PAGE page len 0x%x \n",agMode.modePageLen)); 6968285809Sscottl#ifdef HIALEAH_ENCRYPTION 6969285809Sscottl saRoot->EncGenPage.numberOfKeksPageCode = configPage[0]; 6970285809Sscottl saRoot->EncGenPage.KeyCardIdKekIndex = configPage[1]; 6971285809Sscottl saRoot->EncGenPage.KeyCardId3_0 = configPage[2]; 6972285809Sscottl saRoot->EncGenPage.KeyCardId7_4 = configPage[3]; 6973285809Sscottl saRoot->EncGenPage.KeyCardId11_8 = configPage[4]; 6974285809Sscottl 6975285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: numberOfKeksPageCode 0x%x\n",saRoot->EncGenPage.numberOfKeksPageCode)); 6976285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: KeyCardIdKekIndex 0x%x\n",saRoot->EncGenPage.KeyCardIdKekIndex)); 6977285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: KeyCardId3_0 0x%x\n",saRoot->EncGenPage.KeyCardId3_0)); 6978285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: KeyCardId7_4 0x%x\n",saRoot->EncGenPage.KeyCardId7_4)); 6979285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: KeyCardId11_8 0x%x\n",saRoot->EncGenPage.KeyCardId11_8)); 6980285809Sscottl#endif /* HIALEAH_ENCRYPTION */ 6981285809Sscottl 6982285809Sscottl break; 6983285809Sscottl case AGSA_ENCRYPTION_DEK_CONFIG_PAGE: 6984285809Sscottl agMode.modePageLen = sizeof(agsaEncryptDekConfigPage_t); 6985285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_ENCRYPTION_DEK_CONFIG_PAGE page len 0x%x \n",agMode.modePageLen)); 6986285809Sscottl break; 6987285809Sscottl case AGSA_ENCRYPTION_CONTROL_PARM_PAGE: 6988285809Sscottl agMode.modePageLen = sizeof(agsaEncryptControlParamPage_t); 6989285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_ENCRYPTION_CONTROL_PARM_PAGE page len 0x%x \n",agMode.modePageLen)); 6990285809Sscottl break; 6991285809Sscottl case AGSA_ENCRYPTION_HMAC_CONFIG_PAGE: 6992285809Sscottl agMode.modePageLen = sizeof(agsaEncryptHMACConfigPage_t); 6993285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: AGSA_ENCRYPTION_HMAC_CONFIG_PAGE page len 0x%x \n",agMode.modePageLen)); 6994285809Sscottl break; 6995285809Sscottl default: 6996285809Sscottl agMode.modePageLen = 0; 6997285809Sscottl SA_DBG1(("mpiGetControllerConfigRsp: Unknown !!! page len 0x%x \n",agMode.modePageLen)); 6998285809Sscottl break; 6999285809Sscottl } 7000285809Sscottl 7001285809Sscottl agMode.modePage = (void *) &pIomb->configPage[0]; 7002285809Sscottl agMode.context = saRoot->IOMap[tag].agContext; 7003285809Sscottl 7004285809Sscottl /* Report the event before freeing the IOMB */ 7005285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_MODE, errorQualifier, (void *) &agMode, 0); 7006285809Sscottl 7007285809Sscottl /* remove the request from IOMap */ 7008285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7009285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7010285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7011285809Sscottl 7012285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7013285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7014285809Sscottl pRequest->valid = agFALSE; 7015285809Sscottl /* return the request to free pool */ 7016285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7017285809Sscottl { 7018285809Sscottl SA_DBG1(("mpiGetControllerRsp: saving pRequest (%p) for later use\n", pRequest)); 7019285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7020285809Sscottl } 7021285809Sscottl else 7022285809Sscottl { 7023285809Sscottl /* return the request to free pool */ 7024285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7025285809Sscottl } 7026285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7027285809Sscottl 7028285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3b"); 7029285809Sscottl return AGSA_RC_SUCCESS; 7030285809Sscottl} 7031285809Sscottl 7032285809Sscottl/******************************************************************************/ 7033285809Sscottl/*! \brief KEK Management Response 7034285809Sscottl * 7035285809Sscottl * This routine handles the response of the KEK management message 7036285809Sscottl * 7037285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7038285809Sscottl * \param pIomb Pointer of IOMB Mesage 7039285809Sscottl * 7040285809Sscottl * \return sucess or fail 7041285809Sscottl * 7042285809Sscottl */ 7043285809Sscottl/*******************************************************************************/ 7044285809SscottlGLOBAL bit32 mpiKekManagementRsp( 7045285809Sscottl agsaRoot_t *agRoot, 7046285809Sscottl agsaKekManagementRsp_t *pIomb 7047285809Sscottl ) 7048285809Sscottl{ 7049285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7050285809Sscottl agsaIORequestDesc_t *pRequest; 7051285809Sscottl agsaContext_t *agContext; 7052285809Sscottl agsaHWEventEncrypt_t agEvent; 7053285809Sscottl bit32 status, errorQualifier, tag, flags; 7054285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2A"); 7055285809Sscottl 7056285809Sscottl SA_DBG1(("mpiKekManagementRsp: HTag=0x%x\n", pIomb->tag)); 7057285809Sscottl 7058285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaKekManagementRsp_t, tag)); 7059285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaKekManagementRsp_t, status)); 7060285809Sscottl OSSA_READ_LE_32(AGROOT, &flags, pIomb, OSSA_OFFSET_OF(agsaKekManagementRsp_t, flags)); 7061285809Sscottl OSSA_READ_LE_32(AGROOT, &errorQualifier, pIomb, OSSA_OFFSET_OF(agsaKekManagementRsp_t, errorQualifier)); 7062285809Sscottl 7063285809Sscottl 7064285809Sscottl SA_DBG1(("mpiKekManagementRsp:status 0x%x flags 0x%x errorQualifier 0x%x\n", status, flags, errorQualifier)); 7065285809Sscottl 7066285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 7067285809Sscottl if ((flags & 0xFF) == KEK_MGMT_SUBOP_UPDATE) 7068285809Sscottl { 7069285809Sscottl SA_DBG1(("mpiKekManagementRsp:KEK_MGMT_SUBOP_UPDATE 0x%x \n", status)); 7070285809Sscottl if (flags & 0xFF00) /* update and store*/ 7071285809Sscottl { 7072285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE; 7073285809Sscottl } 7074285809Sscottl else /* update */ 7075285809Sscottl { 7076285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE; 7077285809Sscottl } 7078285809Sscottl agEvent.status = status; 7079285809Sscottl if (status == OSSA_MPI_ENC_ERR_ILLEGAL_KEK_PARAM) 7080285809Sscottl { 7081285809Sscottl agEvent.eq = errorQualifier; 7082285809Sscottl } 7083285809Sscottl agEvent.info = 0; 7084285809Sscottl /* Store the new KEK index in agEvent.handle */ 7085285809Sscottl agEvent.handle = (void *) ((bitptr) (flags >> 24)); 7086285809Sscottl /* Store the current KEK index in agEvent.param */ 7087285809Sscottl agEvent.param = (void *) ((bitptr) (flags >> 16) & 0xFF); 7088285809Sscottl 7089285809Sscottl } 7090285809Sscottl 7091285809Sscottl else if ((flags & 0xFF) == KEK_MGMT_SUBOP_INVALIDATE) 7092285809Sscottl { 7093285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_INVALIDTE; 7094285809Sscottl agEvent.status = status; 7095285809Sscottl if (status == OSSA_MPI_ENC_ERR_ILLEGAL_KEK_PARAM) 7096285809Sscottl { 7097285809Sscottl agEvent.eq = errorQualifier; 7098285809Sscottl } 7099285809Sscottl agEvent.info = 0; 7100285809Sscottl /* Store the new KEK index in agEvent.handle */ 7101285809Sscottl agEvent.handle = (void *) ((bitptr) (flags >> 24)); 7102285809Sscottl /* Store the current KEK index in agEvent.param */ 7103285809Sscottl agEvent.param = (void *) ((bitptr) (flags >> 16) & 0xFF); 7104285809Sscottl } 7105285809Sscottl 7106285809Sscottl else if ((flags & 0xFF) == KEK_MGMT_SUBOP_KEYCARDINVALIDATE) 7107285809Sscottl { 7108285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE_AND_STORE; 7109285809Sscottl agEvent.status = status; 7110285809Sscottl if (status == OSSA_MPI_ENC_ERR_ILLEGAL_KEK_PARAM) 7111285809Sscottl { 7112285809Sscottl agEvent.eq = errorQualifier; 7113285809Sscottl } 7114285809Sscottl agEvent.info = 0; 7115285809Sscottl /* Store the new KEK index in agEvent.handle */ 7116285809Sscottl agEvent.handle = (void *) ((bitptr) (flags >> 24)); 7117285809Sscottl /* Store the current KEK index in agEvent.param */ 7118285809Sscottl agEvent.param = (void *) ((bitptr) (flags >> 16) & 0xFF); 7119285809Sscottl 7120285809Sscottl } 7121285809Sscottl 7122285809Sscottl else if ((flags & 0xFF) == KEK_MGMT_SUBOP_KEYCARDUPDATE) 7123285809Sscottl { 7124285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_KEK_UPDATE; 7125285809Sscottl agEvent.status = status; 7126285809Sscottl if (status == OSSA_MPI_ENC_ERR_ILLEGAL_KEK_PARAM) 7127285809Sscottl { 7128285809Sscottl agEvent.eq = errorQualifier; 7129285809Sscottl } 7130285809Sscottl agEvent.info = 0; 7131285809Sscottl /* Store the new KEK index in agEvent.handle */ 7132285809Sscottl agEvent.handle = (void *) ((bitptr) (flags >> 24)); 7133285809Sscottl /* Store the current KEK index in agEvent.param */ 7134285809Sscottl agEvent.param = (void *) ((bitptr) (flags >> 16) & 0xFF); 7135285809Sscottl 7136285809Sscottl } 7137285809Sscottl /* get request from IOMap */ 7138285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7139285809Sscottl if (agNULL == pRequest) 7140285809Sscottl { 7141285809Sscottl SA_DBG1(("mpiKekManagementRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7142285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2A"); 7143285809Sscottl return AGSA_RC_FAILURE; 7144285809Sscottl } 7145285809Sscottl 7146285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7147285809Sscottl /* remove the request from IOMap */ 7148285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7149285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7150285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7151285809Sscottl 7152285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_ENCRYPTION, 0, (void *) &agEvent, agContext); 7153285809Sscottl 7154285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7155285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7156285809Sscottl pRequest->valid = agFALSE; 7157285809Sscottl /* return the request to free pool */ 7158285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7159285809Sscottl { 7160285809Sscottl SA_DBG1(("mpiKekManagementRsp: saving pRequest (%p) for later use\n", pRequest)); 7161285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7162285809Sscottl } 7163285809Sscottl else 7164285809Sscottl { 7165285809Sscottl /* return the request to free pool */ 7166285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7167285809Sscottl } 7168285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7169285809Sscottl 7170285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2A"); 7171285809Sscottl 7172285809Sscottl return AGSA_RC_SUCCESS; 7173285809Sscottl} 7174285809Sscottl 7175285809Sscottl/******************************************************************************/ 7176285809Sscottl/*! \brief DEK Management Response 7177285809Sscottl * 7178285809Sscottl * This routine handles the response of the DEK management message 7179285809Sscottl * 7180285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7181285809Sscottl * \param pIomb Pointer of IOMB Mesage 7182285809Sscottl * 7183285809Sscottl * \return sucess or fail 7184285809Sscottl * 7185285809Sscottl */ 7186285809Sscottl/*******************************************************************************/ 7187285809SscottlGLOBAL bit32 mpiDekManagementRsp( 7188285809Sscottl agsaRoot_t *agRoot, 7189285809Sscottl agsaDekManagementRsp_t *pIomb 7190285809Sscottl ) 7191285809Sscottl{ 7192285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7193285809Sscottl agsaIORequestDesc_t *pRequest; 7194285809Sscottl agsaContext_t *agContext; 7195285809Sscottl agsaHWEventEncrypt_t agEvent; 7196285809Sscottl bit32 flags, status, errorQualifier, tag, dekIndex; 7197285809Sscottl 7198285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"2B"); 7199285809Sscottl 7200285809Sscottl SA_DBG1(("mpiDekManagementRsp: HTag=0x%x\n", pIomb->tag)); 7201285809Sscottl 7202285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaDekManagementRsp_t, tag)); 7203285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaDekManagementRsp_t, status)); 7204285809Sscottl OSSA_READ_LE_32(AGROOT, &flags, pIomb, OSSA_OFFSET_OF(agsaDekManagementRsp_t, flags)); 7205285809Sscottl OSSA_READ_LE_32(AGROOT, &errorQualifier, pIomb, OSSA_OFFSET_OF(agsaDekManagementRsp_t, errorQualifier)); 7206285809Sscottl OSSA_READ_LE_32(AGROOT, &dekIndex, pIomb, OSSA_OFFSET_OF(agsaDekManagementRsp_t, dekIndex)); 7207285809Sscottl 7208285809Sscottl SA_DBG2(("mpiDekManagementRsp:tag =0x%x\n",tag )); 7209285809Sscottl SA_DBG2(("mpiDekManagementRsp:status =0x%x\n", status)); 7210285809Sscottl SA_DBG2(("mpiDekManagementRsp:flags =0x%x\n",flags )); 7211285809Sscottl SA_DBG2(("mpiDekManagementRsp:errorQualifier =0x%x\n", errorQualifier)); 7212285809Sscottl SA_DBG2(("mpiDekManagementRsp:dekIndex =0x%x\n",dekIndex )); 7213285809Sscottl 7214285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 7215285809Sscottl if ((flags & 0xFF) == DEK_MGMT_SUBOP_UPDATE) 7216285809Sscottl { 7217285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_DEK_UPDATE; 7218285809Sscottl } 7219285809Sscottl else 7220285809Sscottl { 7221285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_DEK_INVALIDTE; 7222285809Sscottl } 7223285809Sscottl agEvent.status = status; 7224285809Sscottl if (status == OSSA_MPI_ENC_ERR_ILLEGAL_DEK_PARAM || OSSA_MPI_ERR_DEK_MANAGEMENT_DEK_UNWRAP_FAIL) 7225285809Sscottl { 7226285809Sscottl agEvent.eq = errorQualifier; 7227285809Sscottl } 7228285809Sscottl /* Store the DEK in agEvent.info */ 7229285809Sscottl agEvent.info = (flags >> 8) & 0xF; 7230285809Sscottl /* Store the KEK index in agEvent.handle */ 7231285809Sscottl agEvent.handle = (void *) ((bitptr) (flags >> 24)); 7232285809Sscottl /* Store the DEK index in agEvent.param */ 7233285809Sscottl agEvent.param = (void *) (bitptr) dekIndex; 7234285809Sscottl 7235285809Sscottl /* get request from IOMap */ 7236285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7237285809Sscottl if (agNULL == pRequest) 7238285809Sscottl { 7239285809Sscottl SA_DBG1(("mpiDekManagementRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7240285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "2B"); 7241285809Sscottl return AGSA_RC_FAILURE; 7242285809Sscottl } 7243285809Sscottl 7244285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7245285809Sscottl /* remove the request from IOMap */ 7246285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7247285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7248285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7249285809Sscottl 7250285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_ENCRYPTION, 0, (void *) &agEvent,agContext ); 7251285809Sscottl 7252285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7253285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7254285809Sscottl pRequest->valid = agFALSE; 7255285809Sscottl /* return the request to free pool */ 7256285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7257285809Sscottl { 7258285809Sscottl SA_DBG1(("mpiDekManagementRsp: saving pRequest (%p) for later use\n", pRequest)); 7259285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7260285809Sscottl } 7261285809Sscottl else 7262285809Sscottl { 7263285809Sscottl /* return the request to free pool */ 7264285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7265285809Sscottl } 7266285809Sscottl 7267285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7268285809Sscottl 7269285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "2B"); 7270285809Sscottl 7271285809Sscottl return AGSA_RC_SUCCESS; 7272285809Sscottl} 7273285809Sscottl 7274285809Sscottl/******************************************************************************/ 7275285809Sscottl/*! \brief Operator Management Response 7276285809Sscottl * 7277285809Sscottl * This routine handles the response of the Operator management message 7278285809Sscottl * 7279285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7280285809Sscottl * \param pIomb Pointer of IOMB Mesage 7281285809Sscottl * 7282285809Sscottl * \return sucess or fail 7283285809Sscottl * 7284285809Sscottl */ 7285285809Sscottl/*******************************************************************************/ 7286285809SscottlGLOBAL bit32 mpiOperatorManagementRsp( 7287285809Sscottl agsaRoot_t *agRoot, 7288285809Sscottl agsaOperatorMangmenRsp_t *pIomb 7289285809Sscottl ) 7290285809Sscottl{ 7291285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7292285809Sscottl agsaIORequestDesc_t *pRequest; 7293285809Sscottl agsaContext_t *agContext; 7294285809Sscottl agsaHWEventEncrypt_t agEvent; 7295285809Sscottl bit32 OPRIDX_AUTIDX_R_OMO,status, errorQualifier, tag; 7296285809Sscottl 7297285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"36"); 7298285809Sscottl 7299285809Sscottl SA_DBG1(("mpiOperatorManagementRsp: HTag=0x%x\n", pIomb->tag)); 7300285809Sscottl 7301285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaOperatorMangmenRsp_t, tag)); 7302285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaOperatorMangmenRsp_t, status)); 7303285809Sscottl OSSA_READ_LE_32(AGROOT, &OPRIDX_AUTIDX_R_OMO, pIomb, OSSA_OFFSET_OF(agsaOperatorMangmenRsp_t, OPRIDX_AUTIDX_R_OMO)); 7304285809Sscottl OSSA_READ_LE_32(AGROOT, &errorQualifier, pIomb, OSSA_OFFSET_OF(agsaOperatorMangmenRsp_t, errorQualifier)); 7305285809Sscottl 7306285809Sscottl SA_DBG2(("mpiOperatorManagementRsp:tag =0x%x\n",tag )); 7307285809Sscottl SA_DBG2(("mpiOperatorManagementRsp:status =0x%x\n", status)); 7308285809Sscottl SA_DBG2(("mpiOperatorManagementRsp:OPRIDX_AUTIDX_R_OMO =0x%x\n",OPRIDX_AUTIDX_R_OMO )); 7309285809Sscottl SA_DBG2(("mpiOperatorManagementRsp:errorQualifier =0x%x\n", errorQualifier)); 7310285809Sscottl 7311285809Sscottl /* get request from IOMap */ 7312285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7313285809Sscottl if (agNULL == pRequest) 7314285809Sscottl { 7315285809Sscottl SA_DBG1(("mpiOperatorManagementRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7316285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "36"); 7317285809Sscottl return AGSA_RC_FAILURE; 7318285809Sscottl } 7319285809Sscottl 7320285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7321285809Sscottl /* remove the request from IOMap */ 7322285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7323285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7324285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7325285809Sscottl 7326285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 7327285809Sscottl agEvent.status = status; 7328285809Sscottl agEvent.info = OPRIDX_AUTIDX_R_OMO; 7329285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_OPERATOR_MANAGEMENT; 7330285809Sscottl if (status == OPR_MGMT_MPI_ENC_ERR_OPR_PARAM_ILLEGAL) 7331285809Sscottl { 7332285809Sscottl agEvent.eq = errorQualifier; 7333285809Sscottl } 7334285809Sscottl 7335285809Sscottl ossaOperatorManagementCB(agRoot, agContext, status, errorQualifier); 7336285809Sscottl 7337285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7338285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7339285809Sscottl pRequest->valid = agFALSE; 7340285809Sscottl /* return the request to free pool */ 7341285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7342285809Sscottl { 7343285809Sscottl SA_DBG1(("mpiOperatorManagementRsp: saving pRequest (%p) for later use\n", pRequest)); 7344285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7345285809Sscottl } 7346285809Sscottl else 7347285809Sscottl { 7348285809Sscottl /* return the request to free pool */ 7349285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7350285809Sscottl } 7351285809Sscottl 7352285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7353285809Sscottl 7354285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "36"); 7355285809Sscottl 7356285809Sscottl return AGSA_RC_SUCCESS; 7357285809Sscottl} 7358285809Sscottl 7359285809SscottlGLOBAL bit32 mpiBistRsp( 7360285809Sscottl agsaRoot_t *agRoot, 7361285809Sscottl agsaEncryptBistRsp_t *pIomb 7362285809Sscottl ) 7363285809Sscottl{ 7364285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7365285809Sscottl agsaIORequestDesc_t *pRequest; 7366285809Sscottl agsaContext_t *agContext; 7367285809Sscottl agsaHWEventEncrypt_t agEvent; 7368285809Sscottl bit32 status; 7369285809Sscottl bit32 results[11]; 7370285809Sscottl bit32 length; 7371285809Sscottl bit32 subop; 7372285809Sscottl bit32 tag; 7373285809Sscottl 7374285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"37"); 7375285809Sscottl 7376285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, tag)); 7377285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, status)); 7378285809Sscottl OSSA_READ_LE_32(AGROOT, &subop, pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, subop)); 7379285809Sscottl OSSA_READ_LE_32(AGROOT, &results[0], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[0])); 7380285809Sscottl OSSA_READ_LE_32(AGROOT, &results[1], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[1])); 7381285809Sscottl OSSA_READ_LE_32(AGROOT, &results[2], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[2])); 7382285809Sscottl OSSA_READ_LE_32(AGROOT, &results[3], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[3])); 7383285809Sscottl OSSA_READ_LE_32(AGROOT, &results[4], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[4])); 7384285809Sscottl OSSA_READ_LE_32(AGROOT, &results[5], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[5])); 7385285809Sscottl OSSA_READ_LE_32(AGROOT, &results[6], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[6])); 7386285809Sscottl OSSA_READ_LE_32(AGROOT, &results[7], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[7])); 7387285809Sscottl OSSA_READ_LE_32(AGROOT, &results[8], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[8])); 7388285809Sscottl OSSA_READ_LE_32(AGROOT, &results[9], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[9])); 7389285809Sscottl OSSA_READ_LE_32(AGROOT, &results[10], pIomb, OSSA_OFFSET_OF(agsaEncryptBistRsp_t, testResults[10])); 7390285809Sscottl 7391285809Sscottl subop &= 0xFF; 7392285809Sscottl SA_DBG1(("mpiBistRsp: HTag=0x%x subops =0x%x status =0x%x\n",pIomb->tag, subop, status)); 7393285809Sscottl 7394285809Sscottl switch(subop) 7395285809Sscottl { 7396285809Sscottl case AGSA_BIST_TEST: 7397285809Sscottl length = sizeof(agsaEncryptSelfTestStatusBitMap_t); 7398285809Sscottl break; 7399285809Sscottl case AGSA_SHA_TEST: 7400285809Sscottl length = sizeof(agsaEncryptSHATestResult_t); 7401285809Sscottl break; 7402285809Sscottl case AGSA_HMAC_TEST: 7403285809Sscottl length = sizeof(agsaEncryptHMACTestResult_t); 7404285809Sscottl break; 7405285809Sscottl default: 7406285809Sscottl length = 0; 7407285809Sscottl break; 7408285809Sscottl } 7409285809Sscottl 7410285809Sscottl si_memset(&agEvent, 0, sizeof(agsaHWEventEncrypt_t)); 7411285809Sscottl agEvent.status = status; 7412285809Sscottl agEvent.encryptOperation = OSSA_HW_ENCRYPT_TEST_EXECUTE; 7413285809Sscottl agEvent.info = length; 7414285809Sscottl agEvent.eq = subop; 7415285809Sscottl agEvent.handle = agNULL; 7416285809Sscottl agEvent.param = &results; 7417285809Sscottl 7418285809Sscottl /* get request from IOMap */ 7419285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7420285809Sscottl if (agNULL == pRequest) 7421285809Sscottl { 7422285809Sscottl SA_DBG1(("mpiBistRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7423285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "37"); 7424285809Sscottl return AGSA_RC_FAILURE; 7425285809Sscottl } 7426285809Sscottl 7427285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7428285809Sscottl 7429285809Sscottl ossaHwCB(agRoot, NULL, OSSA_HW_EVENT_ENCRYPTION, 0, (void*)&agEvent, agContext); 7430285809Sscottl 7431285809Sscottl /* remove the request from IOMap */ 7432285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7433285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7434285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7435285809Sscottl 7436285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7437285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7438285809Sscottl pRequest->valid = agFALSE; 7439285809Sscottl /* return the request to free pool */ 7440285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7441285809Sscottl { 7442285809Sscottl SA_DBG1(("mpiBistRsp: saving pRequest (%p) for later use\n", pRequest)); 7443285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7444285809Sscottl } 7445285809Sscottl else 7446285809Sscottl { 7447285809Sscottl /* return the request to free pool */ 7448285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7449285809Sscottl } 7450285809Sscottl 7451285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7452285809Sscottl 7453285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "37"); 7454285809Sscottl 7455285809Sscottl return AGSA_RC_SUCCESS; 7456285809Sscottl} 7457285809Sscottl 7458285809Sscottl/******************************************************************************/ 7459285809Sscottl/*! \brief Set Operator Response 7460285809Sscottl * 7461285809Sscottl * This routine handles the response of the Operator management message 7462285809Sscottl * 7463285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7464285809Sscottl * \param pIomb Pointer of IOMB Mesage 7465285809Sscottl * 7466285809Sscottl * \return sucess or fail 7467285809Sscottl * 7468285809Sscottl */ 7469285809Sscottl/*******************************************************************************/ 7470285809SscottlGLOBAL bit32 mpiSetOperatorRsp( 7471285809Sscottl agsaRoot_t *agRoot, 7472285809Sscottl agsaSetOperatorRsp_t *pIomb 7473285809Sscottl ) 7474285809Sscottl{ 7475285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7476285809Sscottl agsaIORequestDesc_t *pRequest = agNULL; 7477285809Sscottl agsaContext_t *agContext = agNULL; 7478285809Sscottl bit32 ERR_QLFR_OPRIDX_PIN_ACS, OPRIDX_PIN_ACS, status, errorQualifier, tag = 0; 7479285809Sscottl 7480285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"38"); 7481285809Sscottl 7482285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaSetOperatorRsp_t, tag)); 7483285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaSetOperatorRsp_t, status)); 7484285809Sscottl OSSA_READ_LE_32(AGROOT, &ERR_QLFR_OPRIDX_PIN_ACS, pIomb, OSSA_OFFSET_OF(agsaSetOperatorRsp_t, ERR_QLFR_OPRIDX_PIN_ACS)); 7485285809Sscottl 7486285809Sscottl errorQualifier = ERR_QLFR_OPRIDX_PIN_ACS >> 16; 7487285809Sscottl OPRIDX_PIN_ACS = ERR_QLFR_OPRIDX_PIN_ACS & 0xFFFF; 7488285809Sscottl 7489285809Sscottl SA_DBG1(("mpiSetOperatorRsp: HTag=0x%x ERR_QLFR=0x%x OPRIDX_PIN_ACS=0x%x \n",tag, errorQualifier, OPRIDX_PIN_ACS)); 7490285809Sscottl 7491285809Sscottl /* get request from IOMap */ 7492285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7493285809Sscottl if (agNULL == pRequest) 7494285809Sscottl { 7495285809Sscottl SA_DBG1(("mpiSetOperatorRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7496285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "38"); 7497285809Sscottl return AGSA_RC_FAILURE; 7498285809Sscottl } 7499285809Sscottl 7500285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7501285809Sscottl /* remove the request from IOMap */ 7502285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7503285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7504285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7505285809Sscottl 7506285809Sscottl 7507285809Sscottl ossaSetOperatorCB(agRoot,agContext,status,errorQualifier ); 7508285809Sscottl 7509285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7510285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7511285809Sscottl pRequest->valid = agFALSE; 7512285809Sscottl /* return the request to free pool */ 7513285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7514285809Sscottl { 7515285809Sscottl SA_DBG1(("mpiSetOperatorRsp: saving pRequest (%p) for later use\n", pRequest)); 7516285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7517285809Sscottl } 7518285809Sscottl else 7519285809Sscottl { 7520285809Sscottl /* return the request to free pool */ 7521285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7522285809Sscottl } 7523285809Sscottl 7524285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7525285809Sscottl 7526285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "38"); 7527285809Sscottl 7528285809Sscottl return AGSA_RC_SUCCESS; 7529285809Sscottl} 7530285809Sscottl 7531285809Sscottl/******************************************************************************/ 7532285809Sscottl/*! \brief Get Operator Response 7533285809Sscottl * 7534285809Sscottl * This routine handles the response of the Operator management message 7535285809Sscottl * 7536285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7537285809Sscottl * \param pIomb Pointer of IOMB Mesage 7538285809Sscottl * 7539285809Sscottl * \return sucess or fail 7540285809Sscottl * 7541285809Sscottl */ 7542285809Sscottl/*******************************************************************************/ 7543285809SscottlGLOBAL bit32 mpiGetOperatorRsp( 7544285809Sscottl agsaRoot_t *agRoot, 7545285809Sscottl agsaGetOperatorRsp_t *pIomb 7546285809Sscottl ) 7547285809Sscottl{ 7548285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7549285809Sscottl agsaIORequestDesc_t *pRequest; 7550285809Sscottl agsaContext_t *agContext; 7551285809Sscottl bit32 Num_Option, NumOperators ,status, tag; 7552285809Sscottl bit8 option, Role = 0; 7553285809Sscottl bit32 IDstr[8]; 7554285809Sscottl bit8 *tmpIDstr = agNULL; 7555285809Sscottl agsaID_t *IDString = agNULL; 7556285809Sscottl 7557285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3f"); 7558285809Sscottl 7559285809Sscottl si_memset(&IDstr, 0, sizeof(IDstr)); 7560285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, tag)); 7561285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, status)); 7562285809Sscottl OSSA_READ_LE_32(AGROOT, &Num_Option, pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, Num_Option)); 7563285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[0], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[0])); 7564285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[1], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[1])); 7565285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[2], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[2])); 7566285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[3], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[3])); 7567285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[4], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[4])); 7568285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[5], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[5])); 7569285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[6], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[6])); 7570285809Sscottl OSSA_READ_LE_32(AGROOT, &IDstr[7], pIomb, OSSA_OFFSET_OF(agsaGetOperatorRsp_t, IDString[7])); 7571285809Sscottl 7572285809Sscottl SA_DBG1(("mpiGetOperatorRsp:tag=0x%x status=0x%x Num_Option=0x%x IDString_Role=0x%x\n", 7573285809Sscottl tag, status, Num_Option, IDstr[0])); 7574285809Sscottl 7575285809Sscottl /* get request from IOMap */ 7576285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7577285809Sscottl if (agNULL == pRequest) 7578285809Sscottl { 7579285809Sscottl SA_DBG1(("mpiGetOperatorRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7580285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3f"); 7581285809Sscottl return AGSA_RC_FAILURE; 7582285809Sscottl } 7583285809Sscottl 7584285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7585285809Sscottl /* remove the request from IOMap */ 7586285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7587285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7588285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7589285809Sscottl option = Num_Option & 0xFF; 7590285809Sscottl NumOperators = (Num_Option >> SHIFT8) & 0xFF; 7591285809Sscottl /* current operator's Role/ID, valid only if option == 1 */ 7592285809Sscottl if ( option == 1) 7593285809Sscottl { 7594285809Sscottl /* extra the role value as parameter */ 7595285809Sscottl Role = IDstr[0] & 0xFF; 7596285809Sscottl tmpIDstr = (bit8*)&IDstr[0]; 7597285809Sscottl tmpIDstr++; /* skip role byte */ 7598285809Sscottl IDString = (agsaID_t *)tmpIDstr; 7599285809Sscottl SA_DBG1(("mpiGetOperatorRsp: OSSA_IO_SUCCESS\n")); 7600285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[0], IDString->ID[1], IDString->ID[2], IDString->ID[3])); 7601285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[4], IDString->ID[5], IDString->ID[6], IDString->ID[7])); 7602285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[8], IDString->ID[9], IDString->ID[10],IDString->ID[11])); 7603285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[12],IDString->ID[13],IDString->ID[14],IDString->ID[15])); 7604285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[16],IDString->ID[17],IDString->ID[18],IDString->ID[19])); 7605285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[20],IDString->ID[21],IDString->ID[22],IDString->ID[23])); 7606285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x 0x%02x\n",IDString->ID[24],IDString->ID[25],IDString->ID[26],IDString->ID[27])); 7607285809Sscottl SA_DBG2(("mpiGetOperatorRsp: 0x%02x 0x%02x 0x%02x\n", IDString->ID[28],IDString->ID[29],IDString->ID[30])); 7608285809Sscottl } 7609285809Sscottl 7610285809Sscottl SA_DBG1(("mpiGetOperatorRsp:status 0x%x option 0x%x Role 0x%x\n",status,option,Role )); 7611285809Sscottl 7612285809Sscottl ossaGetOperatorCB(agRoot,agContext,status,option,NumOperators ,Role,IDString ); 7613285809Sscottl 7614285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7615285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7616285809Sscottl pRequest->valid = agFALSE; 7617285809Sscottl /* return the request to free pool */ 7618285809Sscottl if(saLlistIOGetCount(&(saRoot->freeReservedRequests)) < SA_RESERVED_REQUEST_COUNT) 7619285809Sscottl { 7620285809Sscottl SA_DBG1(("mpiGetOperatorRsp: saving pRequest (%p) for later use\n", pRequest)); 7621285809Sscottl saLlistIOAdd(&(saRoot->freeReservedRequests), &(pRequest->linkNode)); 7622285809Sscottl } 7623285809Sscottl else 7624285809Sscottl { 7625285809Sscottl /* return the request to free pool */ 7626285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7627285809Sscottl } 7628285809Sscottl 7629285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7630285809Sscottl 7631285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3f"); 7632285809Sscottl 7633285809Sscottl return AGSA_RC_SUCCESS; 7634285809Sscottl} 7635285809Sscottl 7636285809Sscottl 7637285809SscottlGLOBAL bit32 mpiGetVHistRsp( 7638285809Sscottl agsaRoot_t *agRoot, 7639285809Sscottl agsaGetVHistCapRsp_t *pIomb 7640285809Sscottl ) 7641285809Sscottl{ 7642285809Sscottl 7643285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 7644285809Sscottl agsaLLRoot_t *saRoot = agNULL; 7645285809Sscottl agsaIORequestDesc_t *pRequest; 7646285809Sscottl agsaContext_t *agContext; 7647285809Sscottl 7648285809Sscottl bit32 tag = 0; /* 1 */ 7649285809Sscottl bit32 status = 0; /* 2 */ 7650285809Sscottl bit32 channel; /* 3 */ 7651285809Sscottl bit32 BistLo; /* 4 */ 7652285809Sscottl bit32 BistHi; /* 5 */ 7653285809Sscottl bit32 BytesXfered = 0; /* 6 */ 7654285809Sscottl bit32 PciLo; /* 7 */ 7655285809Sscottl bit32 PciHi; /* 8 */ 7656285809Sscottl bit32 PciBytecount = 0; /* 9 */ 7657285809Sscottl 7658285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3K"); 7659285809Sscottl 7660285809Sscottl /* sanity check */ 7661285809Sscottl SA_ASSERT((agNULL != agRoot), ""); 7662285809Sscottl saRoot = (agsaLLRoot_t *) (agRoot->sdkData); 7663285809Sscottl SA_ASSERT((agNULL != saRoot), ""); 7664285809Sscottl 7665285809Sscottl if(smIS_SPC12V(agRoot)) 7666285809Sscottl { 7667285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,tag)); 7668285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,status)); 7669285809Sscottl OSSA_READ_LE_32(AGROOT, &channel, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,channel)); 7670285809Sscottl OSSA_READ_LE_32(AGROOT, &BistLo, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,BistLo)); 7671285809Sscottl OSSA_READ_LE_32(AGROOT, &BistHi, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,BistHi)); 7672285809Sscottl OSSA_READ_LE_32(AGROOT, &BytesXfered, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,BytesXfered)); 7673285809Sscottl OSSA_READ_LE_32(AGROOT, &PciLo, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,PciLo)); 7674285809Sscottl OSSA_READ_LE_32(AGROOT, &PciHi, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,PciHi)); 7675285809Sscottl OSSA_READ_LE_32(AGROOT, &PciBytecount, pIomb, OSSA_OFFSET_OF(agsaGetVHistCapRsp_t,PciBytecount)); 7676285809Sscottl } 7677285809Sscottl else 7678285809Sscottl { 7679285809Sscottl /* SPC does not support this command */ 7680285809Sscottl SA_DBG1(("mpiGetVHistRsp: smIS_SPC12V only\n")); 7681285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3K"); 7682285809Sscottl return AGSA_RC_FAILURE; 7683285809Sscottl } 7684285809Sscottl 7685285809Sscottl SA_DBG3(("mpiGetVHistRsp: HTag=0x%x\n", tag)); 7686285809Sscottl 7687285809Sscottl /* get request from IOMap */ 7688285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7689285809Sscottl if (agNULL == pRequest) 7690285809Sscottl { 7691285809Sscottl SA_DBG1(("mpiGetVHistRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7692285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3K"); 7693285809Sscottl return AGSA_RC_FAILURE; 7694285809Sscottl } 7695285809Sscottl 7696285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7697285809Sscottl 7698285809Sscottl /* remove the request from IOMap */ 7699285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7700285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7701285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7702285809Sscottl 7703285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7704285809Sscottl 7705285809Sscottl /* check status success or failure */ 7706285809Sscottl if (status) 7707285809Sscottl { 7708285809Sscottl SA_DBG1(("mpiGetVHistRsp: status is FAILED, status = %x\n", status )); 7709285809Sscottl 7710285809Sscottl if (pRequest->completionCB == agNULL) 7711285809Sscottl { 7712285809Sscottl ossaVhistCaptureCB(agRoot, agContext, status, BytesXfered); 7713285809Sscottl } 7714285809Sscottl else 7715285809Sscottl { 7716285809Sscottl (*(ossaVhistCaptureCB_t)(pRequest->completionCB))(agRoot, agContext, status, BytesXfered); 7717285809Sscottl } 7718285809Sscottl 7719285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7720285809Sscottl pRequest->valid = agFALSE; 7721285809Sscottl /* return the request to free pool */ 7722285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7723285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7724285809Sscottl 7725285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "3K"); 7726285809Sscottl return AGSA_RC_FAILURE; 7727285809Sscottl } 7728285809Sscottl 7729285809Sscottl /* status is SUCCESS */ 7730285809Sscottl SA_DBG1(("mpiGetVHistRsp: status is SUCCESS\n" )); 7731285809Sscottl 7732285809Sscottl if (pRequest->completionCB == agNULL) 7733285809Sscottl { 7734285809Sscottl ossaVhistCaptureCB(agRoot, agContext, status, BytesXfered); 7735285809Sscottl } 7736285809Sscottl else 7737285809Sscottl { 7738285809Sscottl (*(ossaVhistCaptureCB_t)(pRequest->completionCB))(agRoot, agContext, status, BytesXfered); 7739285809Sscottl } 7740285809Sscottl 7741285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7742285809Sscottl pRequest->valid = agFALSE; 7743285809Sscottl /* return the request to free pool */ 7744285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7745285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7746285809Sscottl 7747285809Sscottl /* return value */ 7748285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'd', "3K"); 7749285809Sscottl 7750285809Sscottl return ret; 7751285809Sscottl} 7752285809Sscottl 7753285809Sscottl 7754285809Sscottl 7755285809Sscottl/******************************************************************************/ 7756285809Sscottl/*! \brief DifEncOffload Response 7757285809Sscottl * 7758285809Sscottl * This routine handles the response of the DifEncOffload Response 7759285809Sscottl * 7760285809Sscottl * \param agRoot Handles for this instance of SAS/SATA LLL 7761285809Sscottl * \param pIomb Pointer of IOMB Mesage 7762285809Sscottl * 7763285809Sscottl * \return sucess or fail 7764285809Sscottl * 7765285809Sscottl */ 7766285809Sscottl/*******************************************************************************/ 7767285809SscottlGLOBAL bit32 mpiDifEncOffloadRsp( 7768285809Sscottl agsaRoot_t *agRoot, 7769285809Sscottl agsaDifEncOffloadRspV_t *pIomb 7770285809Sscottl ) 7771285809Sscottl{ 7772285809Sscottl 7773285809Sscottl bit32 ret = AGSA_RC_SUCCESS; 7774285809Sscottl agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData); 7775285809Sscottl agsaIORequestDesc_t *pRequest; 7776285809Sscottl agsaContext_t *agContext; 7777285809Sscottl bit32 tag, status; 7778285809Sscottl agsaOffloadDifDetails_t details; 7779285809Sscottl 7780285809Sscottl smTraceFuncEnter(hpDBG_VERY_LOUD,"3F"); 7781285809Sscottl 7782285809Sscottl OSSA_READ_LE_32(AGROOT, &tag, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, tag)); 7783285809Sscottl OSSA_READ_LE_32(AGROOT, &status, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, status)); 7784285809Sscottl /* get TAG */ 7785285809Sscottl SA_DBG3(("mpiDifEncOffloadRsp: HTag=0x%x\n", tag)); 7786285809Sscottl 7787285809Sscottl /* get request from IOMap */ 7788285809Sscottl pRequest = (agsaIORequestDesc_t*)saRoot->IOMap[tag].IORequest; 7789285809Sscottl if (agNULL == pRequest) 7790285809Sscottl { 7791285809Sscottl SA_DBG1(("mpiDifEncOffloadRsp: Bad Response IOMB!!! pRequest is NULL. TAG=0x%x STATUS=0x%x\n", tag, status)); 7792285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'a', "3F"); 7793285809Sscottl return AGSA_RC_FAILURE; 7794285809Sscottl } 7795285809Sscottl 7796285809Sscottl agContext = saRoot->IOMap[tag].agContext; 7797285809Sscottl 7798285809Sscottl /* remove the request from IOMap */ 7799285809Sscottl saRoot->IOMap[tag].Tag = MARK_OFF; 7800285809Sscottl saRoot->IOMap[tag].IORequest = agNULL; 7801285809Sscottl saRoot->IOMap[tag].agContext = agNULL; 7802285809Sscottl 7803285809Sscottl SA_ASSERT((pRequest->valid), "pRequest->valid"); 7804285809Sscottl 7805285809Sscottl /* check status success or failure */ 7806285809Sscottl if (status) 7807285809Sscottl { 7808285809Sscottl SA_DBG1(("mpiDifEncOffloadRsp: status is FAILED, status = %x\n", status )); 7809285809Sscottl 7810285809Sscottl if (status == OSSA_IO_XFR_ERROR_DIF_MISMATCH || status == OSSA_IO_XFR_ERROR_DIF_APPLICATION_TAG_MISMATCH || 7811285809Sscottl status == OSSA_IO_XFR_ERROR_DIF_REFERENCE_TAG_MISMATCH || status == OSSA_IO_XFR_ERROR_DIF_CRC_MISMATCH) 7812285809Sscottl { 7813285809Sscottl si_memset(&details, 0, sizeof(agsaOffloadDifDetails_t)); 7814285809Sscottl OSSA_READ_LE_32(AGROOT, &details.ExpectedCRCUDT01, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, ExpectedCRCUDT01)); 7815285809Sscottl OSSA_READ_LE_32(AGROOT, &details.ExpectedUDT2345, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, ExpectedUDT2345)); 7816285809Sscottl OSSA_READ_LE_32(AGROOT, &details.ActualCRCUDT01, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, ActualCRCUDT01)); 7817285809Sscottl OSSA_READ_LE_32(AGROOT, &details.ActualUDT2345, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, ActualUDT2345)); 7818285809Sscottl OSSA_READ_LE_32(AGROOT, &details.DIFErr, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, DIFErr)); 7819285809Sscottl OSSA_READ_LE_32(AGROOT, &details.ErrBoffset, pIomb, OSSA_OFFSET_OF(agsaDifEncOffloadRspV_t, ErrBoffset)); 7820285809Sscottl 7821285809Sscottl if (pRequest->completionCB == agNULL) 7822285809Sscottl { 7823285809Sscottl ossaDIFEncryptionOffloadStartCB(agRoot, agContext, status, &details); 7824285809Sscottl } 7825285809Sscottl else 7826285809Sscottl { 7827285809Sscottl (*(ossaDIFEncryptionOffloadStartCB_t)(pRequest->completionCB))(agRoot, agContext, status, &details); 7828285809Sscottl } 7829285809Sscottl } 7830285809Sscottl else 7831285809Sscottl { 7832285809Sscottl if (pRequest->completionCB == agNULL) 7833285809Sscottl { 7834285809Sscottl ossaDIFEncryptionOffloadStartCB(agRoot, agContext, status, agNULL); 7835285809Sscottl } 7836285809Sscottl else 7837285809Sscottl { 7838285809Sscottl (*(ossaDIFEncryptionOffloadStartCB_t)(pRequest->completionCB))(agRoot, agContext, status, agNULL); 7839285809Sscottl } 7840285809Sscottl } 7841285809Sscottl 7842285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'b', "3F"); 7843285809Sscottl 7844285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7845285809Sscottl pRequest->valid = agFALSE; 7846285809Sscottl /* return the request to free pool */ 7847285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7848285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7849285809Sscottl 7850285809Sscottl return AGSA_RC_FAILURE; 7851285809Sscottl } 7852285809Sscottl 7853285809Sscottl /* status is SUCCESS */ 7854285809Sscottl SA_DBG1(("mpiDifEncOffloadRsp: status is SUCCESS\n" )); 7855285809Sscottl 7856285809Sscottl if (pRequest->completionCB == agNULL) 7857285809Sscottl { 7858285809Sscottl ossaDIFEncryptionOffloadStartCB(agRoot, agContext, status, agNULL); 7859285809Sscottl } 7860285809Sscottl else 7861285809Sscottl { 7862285809Sscottl (*(ossaDIFEncryptionOffloadStartCB_t)(pRequest->completionCB))(agRoot, agContext, status, agNULL); 7863285809Sscottl } 7864285809Sscottl 7865285809Sscottl ossaSingleThreadedEnter(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7866285809Sscottl pRequest->valid = agFALSE; 7867285809Sscottl /* return the request to free pool */ 7868285809Sscottl saLlistIOAdd(&(saRoot->freeIORequests), &(pRequest->linkNode)); 7869285809Sscottl ossaSingleThreadedLeave(agRoot, LL_IOREQ_LOCKEQ_LOCK); 7870285809Sscottl 7871285809Sscottl /* return value */ 7872285809Sscottl smTraceFuncExit(hpDBG_VERY_LOUD, 'c', "3F"); 7873285809Sscottl 7874285809Sscottl return ret; 7875285809Sscottl} 7876285809Sscottl 7877