FreeBSD kernel pms device code
tdioctl.c
Go to the documentation of this file.
1/*******************************************************************************
2*Copyright (c) 2014 PMC-Sierra, Inc. All rights reserved.
3*
4*Redistribution and use in source and binary forms, with or without modification, are permitted provided
5*that the following conditions are met:
6*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
7*following disclaimer.
8*2. Redistributions in binary form must reproduce the above copyright notice,
9*this list of conditions and the following disclaimer in the documentation and/or other materials provided
10*with the distribution.
11*
12*THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED
13*WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14*FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
15*FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16*NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17*BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
18*LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19*SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
20
21********************************************************************************/
22/*******************************************************************************/
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD$");
31#include <dev/pms/config.h>
32
36
40
45
46#ifdef FDS_SM
50#endif
51
52#ifdef FDS_DM
56#endif
57
62
63#ifdef INITIATOR_DRIVER
67#endif
68
69#ifdef TARGET_DRIVER
71#include <dev/pms/RefTisa/tisa/sassata/sas/tgt/ttdxchg.h>
73#endif
74
78
84
85
86#define agFieldOffset(baseType,fieldName) \
87 /*lint -e545 */ \
88 ((bit32)((bitptr)(&(((baseType *)0)->fieldName)))) \
89
90#ifdef SA_LL_API_TEST
91osGLOBAL bit32 tdLlApiTestIoctl(tiRoot_t *tiRoot,
92 tiIOCTLPayload_t *agIOCTLPayload,
93 void *agParam1,
94 void *agParam2,
95 void *agParam3);
96#endif /* SA_LL_API_TEST */
97
98
99extern bit32 volatile sgpioResponseSet;
100
101#ifdef SPC_ENABLE_PROFILE
102/*****************************************************************************
103*
104* tdipFWProfileIoctl
105*
106* Purpose: This routine is called to process the FW Profile IOCTL function.
107* This function is used for both target and initiator.
108*
109* Parameters:
110* tiRoot: Pointer to driver instance
111* agIOCTLPayload: Pointer to the IOCTL payload.
112* agParam1: Pointer to pass context handle for IOCTL DMA operation
113* agParam2: Pointer to pass context handle for IOCTL DMA operation
114* agParam3: Pointer to pass context handle for IOCTL DMA operation
115*
116* Return:
117*
118* IOCTL_CALL_SUCCESS The requested operation completed successfully.
119* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
120* Detail error code is function specific and
121* defined by the specific IOCTL function.
122* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
123*
124*
125*****************************************************************************/
126osGLOBAL bit32 tdipFWProfileIoctl(
128 tiIOCTLPayload_t *agIOCTLPayload,
129 void *agParam1,
130 void *agParam2,
131 void *agParam3
132 )
133{
134
136 bit32 bufAddrUpper = 0;
137 bit32 bufAddrLower = 0;
138 tdFWProfile_t *fwProfile;
139
140 void *osMemHandle = agNULL;
141 void *buffer = agNULL;
142 agsaFwProfile_t fwProfileInfo = {0};
143
144 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
145 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
146 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
147
148 fwProfile = (tdFWProfile_t *)&agIOCTLPayload->FunctionSpecificArea[0];
149
150
151 fwProfileInfo.processor = fwProfile->processor;
152 fwProfileInfo.cmd = fwProfile->cmd;
153 fwProfileInfo.len = fwProfile->len;
154 fwProfileInfo.tcid = fwProfile->tcid;
155 if(fwProfile->cmd == START_CODE_PROFILE)
156 {
157 fwProfileInfo.codeStartAdd = fwProfile->codeStartAdd;
158 fwProfileInfo.codeEndAdd = fwProfile->codeEndAdd;
159 }
160 if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
161 {
162 if(fwProfile->len != 0)
163 {
165 &osMemHandle,
166 (void **)&buffer,
167 &bufAddrUpper,
168 &bufAddrLower,
169 8,
170 fwProfile->len,
171 agFALSE))
172 {
173 return IOCTL_CALL_FAIL;
174 }
175 osti_memset((void *)buffer, 0, fwProfile->len);
176 }
177 fwProfileInfo.agSgl.sgLower = bufAddrLower;
178 fwProfileInfo.agSgl.sgUpper = bufAddrUpper;
179 fwProfileInfo.agSgl.len = fwProfile->len;
180 fwProfileInfo.agSgl.extReserved = 0;
181 tdsaAllShared->tdFWProfileEx.buffer = osMemHandle;
182 tdsaAllShared->tdFWProfileEx.virtAddr = buffer;
183 tdsaAllShared->tdFWProfileEx.len = fwProfile->len;
184 }
185 tdsaAllShared->tdFWProfileEx.tdFWProfile = fwProfile;
186 tdsaAllShared->tdFWProfileEx.param1 = agParam1;
187 tdsaAllShared->tdFWProfileEx.param2 = agParam2;
188 tdsaAllShared->tdFWProfileEx.payload = agIOCTLPayload;
189 tdsaAllShared->tdFWProfileEx.inProgress = 1;
190 status = saFwProfile(agRoot,
191 agNULL,
192 0,
193 &fwProfileInfo
194 );
195 if(status)
196 {
197 if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
198 ostiFreeMemory(tiRoot, osMemHandle, fwProfile->len);
200 }
201 else
203 return status;
204}
205
206
207#endif
208
209/*****************************************************************************
210*
211* tdipFWControlIoctl
212*
213* Purpose: This routine is called to process the FW control IOCTL function.
214* This function is used for both target and initiator.
215*
216* Parameters:
217* tiRoot: Pointer to driver instance
218* agIOCTLPayload: Pointer to the IOCTL payload.
219* agParam1: Pointer to pass context handle for IOCTL DMA operation
220* agParam2: Pointer to pass context handle for IOCTL DMA operation
221* agParam3: Pointer to pass context handle for IOCTL DMA operation
222*
223* Return:
224*
225* IOCTL_CALL_SUCCESS The requested operation completed successfully.
226* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
227* Detail error code is function specific and
228* defined by the specific IOCTL function.
229* IOCTL_CALL_PENDING This request is asynchronous and completed
230* in some other context.
231* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
232*
233*
234*****************************************************************************/
237 tiIOCTLPayload_t *agIOCTLPayload,
238 void *agParam1,
239 void *agParam2,
240 void *agParam3
241 ) {
242
244 bit32 bufAddrUpper = 0;
245 bit32 bufAddrLower = 0;
246 tdFWControl_t *fwControl;
247 void *osMemHandle = agNULL;
248 void *buffer = agNULL;
249 agsaUpdateFwFlash_t flashUpdateInfo;
250 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
251 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
252 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
253
254 if( agIOCTLPayload->Length <
255 ( agFieldOffset(tiIOCTLPayload_t, FunctionSpecificArea) +
256 sizeof(tdFWControl_t) ) ) {
257 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
259 return status;
260 }
261 fwControl = (tdFWControl_t *)&agIOCTLPayload->FunctionSpecificArea[0];
262
263 if(fwControl->len != 0)
264 {
266 &osMemHandle,
267 (void **)&buffer,
268 &bufAddrUpper,
269 &bufAddrLower,
270 8,
271 fwControl->len,
272 agFALSE) )
273 return IOCTL_CALL_FAIL;
274 }
275 osti_memset( (void *)buffer, 0, fwControl->len );
276 osti_memcpy( (void *)buffer,
277 fwControl->buffer,
278 fwControl->len );
279 flashUpdateInfo.agSgl.sgLower = bufAddrLower;
280 flashUpdateInfo.agSgl.sgUpper = bufAddrUpper;
281 flashUpdateInfo.agSgl.len = fwControl->len;
282 flashUpdateInfo.agSgl.extReserved = 0;
283 flashUpdateInfo.currentImageOffset = fwControl->offset;
284 flashUpdateInfo.currentImageLen = fwControl->len;
285 flashUpdateInfo.totalImageLen = fwControl->size;
286 switch (agIOCTLPayload->MinorFunction)
287 {
289 {
290 TI_DBG6(("tdipFWControlIoctl: calling saFwFlashUpdate\n"));
291 tdsaAllShared->tdFWControlEx.tdFWControl = fwControl;
292 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
293 tdsaAllShared->tdFWControlEx.param1 = agParam1;
294 tdsaAllShared->tdFWControlEx.param2 = agParam2;
295 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
296 tdsaAllShared->tdFWControlEx.inProgress = 1;
297 status = saFwFlashUpdate( agRoot,
298 agNULL,
299 0,
300 &flashUpdateInfo );
301 if(status) {
303 fwControl->retcode = IOCTL_CALL_TIMEOUT;
304 }
305 else {
307 }
308 break;
309 }
310 default:
312 TI_DBG1( ("tdipFWControlIoctl: ERROR: Wrong IOCTL code %d\n",
313 agIOCTLPayload->MinorFunction) );
314 ostiFreeMemory(tiRoot, osMemHandle, fwControl->len);
315 return status;
316 } /* end IOCTL switch */
317 return status;
318} /* tdipFWControlIoctl */
319
320
321/*****************************************************************************
322*
323* tiCOMMgntIOCTL
324*
325* Purpose: This routine is a TISA API for processing the PMC specific
326* IOCTL function.
327*
328* Each IOCTL function is identified by the IOCTL header
329* specified in the data payload as the following:
330* Field Description
331* ----- -----------
332* Signature PMC IOCTL signature.
333* #define PMC_IOCTL_SIGNATURE 0x1234
334* MajorFunction Major function number.
335* MinorFunction Minor function number.
336* Length Length of this structure in bytes.
337* Status Return status for this IOCTL function.
338* FunctionSpecificArea Variable length function specific area.
339*
340* Parameters:
341* tiRoot: Pointer to driver instance
342* agIOCTLPayload: Pointer to the IOCTL payload.
343* agParam1: Pointer to pass context handle for IOCTL DMA operation
344* agParam2: Pointer to pass context handle for IOCTL DMA operation
345* agParam3: Pointer to pass context handle for IOCTL DMA operation
346*
347* Return:
348*
349* IOCTL_CALL_SUCCESS The requested operation completed successfully.
350* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
351* Detail error code is function specific and
352* defined by the specific IOCTL function.
353* IOCTL_CALL_PENDING This request is asynchronous and completed
354* in some other context.
355* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
356* IOCTL_CALL_INVALID_DEVICE Invalid target or destination device.
357*
358* Note:
359* Used ostiAllocMemory() OS layer callback function to allocate memory
360* for DMA operaion. Then use ostiFreeMemory() to deallocate the memory.
361*
362*****************************************************************************/
366 tiIOCTLPayload_t *agIOCTLPayload,
367 void *agParam1,
368 void *agParam2,
369 void *agParam3
370 )
371{
373 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
374 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
375 agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
376 bit32 EventLogLength = 0;
377 bit32 EventLogOption;
378 bit32 ReadLength = 0;
379 bit32 Offset = 0;
380 bit32 RequestLength = 0; /* user request on how much data to pass to application */
381 agsaContext_t *agContext = NULL;
382 bit8 *loc = NULL;
383
384 TI_DBG3(("tiCOMMgntIOCTL: start\n"));
385
386 TI_DBG3(("tiCOMMgntIOCTL: tiRoot %p agIOCTLPayload %p agParam1 %p agParam2 %p agParam3 %p\n",
387 tiRoot,agIOCTLPayload,agParam1,agParam2,agParam3 ));
388
389 TI_DBG3(("tiCOMMgntIOCTL: Signature %X\ntiCOMMgntIOCTL: MajorFunction 0x%X\ntiCOMMgntIOCTL: MinorFunction 0x%X\ntiCOMMgntIOCTL: Length 0x%X\ntiCOMMgntIOCTL: Status 0x%X\ntiCOMMgntIOCTL: Reserved 0x%X\ntiCOMMgntIOCTL: FunctionSpecificArea 0x%X\n",
390 agIOCTLPayload->Signature,
391 agIOCTLPayload->MajorFunction,
392 agIOCTLPayload->MinorFunction,
393 agIOCTLPayload->Length,
394 agIOCTLPayload->Status,
395 agIOCTLPayload->Reserved,
396 agIOCTLPayload->FunctionSpecificArea[0] ));
397
398 /* PMC IOCTL signatures matched ? */
399 if(agIOCTLPayload->Signature != PMC_IOCTL_SIGNATURE)
400 {
401 TI_DBG1(("tiCOMMgntIOCTL:agIOCTLPayload->Signature %x IOCTL_CALL_INVALID_CODE\n",agIOCTLPayload->Signature ));
403 return (status);
404 }
405
406 switch (agIOCTLPayload->MajorFunction)
407 {
408//TODO: make the card identification more robust. For now - just to keep going with FW download
409#ifdef IOCTL_INTERRUPT_TIME_CONFIG
411 {
412 switch( agIOCTLPayload->MinorFunction )
413 {
415 {
416 agsaInterruptConfigPage_t *pInterruptConfig = (agsaInterruptConfigPage_t *)&agIOCTLPayload->FunctionSpecificArea[0];
418 0,
420 pInterruptConfig->vectorMask0,
421 pInterruptConfig->vectorMask1,
422 agParam2);
423 if(status == AGSA_RC_SUCCESS) {
425 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
426 } else {
427 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
428 }
429 break;
430 }
433 if(status == AGSA_RC_SUCCESS) {
435 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
436 } else {
437 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
438 }
439 break;
440 }
441 break;
442 }
443#endif /* IOCTL_INTERRUPT_TIME_CONFIG */
445 {
447 break;
448 }
450 status = tdsaGetNumOfLUNIOCTL(tiRoot,agIOCTLPayload, agParam1, agParam2, agParam3);
452 {
454 }
455 break;
457 status = tdsaSendSMPIoctl(tiRoot, agIOCTLPayload,
458 agParam1,agParam2,agParam3);
459 break;
460
462 {
463 //ostiIOCTLClearSignal (tiRoot, &agParam1, &agParam2, &agParam3);
464 status = tdipFWControlIoctl( tiRoot, agIOCTLPayload,
465 agParam1, agParam2, agParam3);
466
467 break;
468 }
469//#ifdef EVENT_LOG_INFO_TESTING
470 /* Reserved field in tiIOCTLPayload_t is used as offset */
472 {
473 switch (agIOCTLPayload->MinorFunction)
474 {
476 {
478 saGetControllerEventLogInfo(agRoot, &EventLog);
479 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_EVENT_LOG1 Length %d\n", agIOCTLPayload->Length));
480 RequestLength = agIOCTLPayload->Length;
481 Offset = agIOCTLPayload->Reserved;
482 EventLogLength = EventLog.eventLog1.totalLength;
483 EventLogOption = EventLog.eventLog1Option;
484 if (EventLogLength <= Offset)
485 {
486 TI_DBG1(("tiCOMMgntIOCTL: 1 out of range Requestlength %d Offset %d event log length %d\n", RequestLength, Offset, EventLogLength));
487 // out of range
488 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
489 agIOCTLPayload->Length = 0;
490 if(EventLogOption == 0)
491 {
492 agIOCTLPayload->Status = IOCTL_ERR_FW_EVENTLOG_DISABLED;
493 }
495 return status;
496 }
497 ReadLength = MIN(EventLogLength - Offset, RequestLength);
498 loc = (bit8 *)EventLog.eventLog1.virtPtr + Offset;
499 osti_memcpy(&(agIOCTLPayload->FunctionSpecificArea), loc, ReadLength);
500 // tdhexdump("IOCTL_MJ_GET_EVENT_LOG1 first 32bytes", (bit8 *)&(agIOCTLPayload->FunctionSpecificArea), 32);
501 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
502 agIOCTLPayload->Length = (bit16)ReadLength;
504 break;
505 }
507 {
508 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MN_FW_GET_EVENT_FLASH_LOG1\n"));
509 status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
510 break;
511 }
512 }
513 break;
514 }
515
517 {
518 switch (agIOCTLPayload->MinorFunction)
519 {
521 {
523 saGetControllerEventLogInfo(agRoot, &EventLog);
524 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_EVENT_LOG2 Length %d\n", agIOCTLPayload->Length));
525 RequestLength = agIOCTLPayload->Length;
526 Offset = agIOCTLPayload->Reserved;
527 EventLogLength = EventLog.eventLog2.totalLength;
528 EventLogOption = EventLog.eventLog2Option;
529 if (EventLogLength <= Offset)
530 {
531 TI_DBG1(("tiCOMMgntIOCTL: 2 out of range Requestlength %d Offset %d event log length %d\n", RequestLength, Offset, EventLogLength));
532 /* out of range */
533 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
534 agIOCTLPayload->Length = 0;
535 if(EventLogOption == 0)
536 {
537 agIOCTLPayload->Status = IOCTL_ERR_FW_EVENTLOG_DISABLED;
538 }
540 return status;
541 }
542 ReadLength = MIN(EventLogLength - Offset, RequestLength);
543 loc = (bit8 *)EventLog.eventLog2.virtPtr + Offset;
544 osti_memcpy(&(agIOCTLPayload->FunctionSpecificArea), loc, ReadLength);
545 // tdhexdump("IOCTL_MJ_GET_EVENT_LOG2 first 32bytes", (bit8 *)&(agIOCTLPayload->FunctionSpecificArea), 32);
546 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
547 agIOCTLPayload->Length = (bit16)ReadLength;
549 break;
550 }
552 {
553 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MN_FW_GET_EVENT_FLASH_LOG2\n"));
554 status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
555 break;
556 }
557 }
558 break;
559 }
560
561
562 case IOCTL_MJ_FW_INFO:
563 {
564 agsaControllerInfo_t ControllerInfo;
565 saGetControllerInfo(agRoot, &ControllerInfo);
566 TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_FW_INFO Length %d\n", agIOCTLPayload->Length));
567 RequestLength = agIOCTLPayload->Length;
568 Offset = agIOCTLPayload->Reserved;
569 if (RequestLength == 0)
570 {
571 TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_FW_INFO: No more Data!\n"));
572 /* out of range */
573 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
574 agIOCTLPayload->Length = 0;
576 return status;
577 }
578
579 osti_memcpy((bit8*)&(agIOCTLPayload->FunctionSpecificArea), (bit8*)&ControllerInfo, sizeof(agsaControllerInfo_t));
580
581 TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo signature 0x%X\n",ControllerInfo.signature));
582 TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo PCILinkRate 0x%X\n",ControllerInfo.PCILinkRate));
583 TI_DBG1(("tiCOMMgntIOCTL:IOCTL_MJ_FW_INFO ControllerInfo PCIWidth 0x%X\n",ControllerInfo.PCIWidth));
584 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
586 break;
587
588 }
589
591 {
592 agsaControllerInfo_t ControllerInfo;
593 saGetControllerInfo(agRoot, &ControllerInfo);
594 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FW_REV Length %d\n", agIOCTLPayload->Length));
595 RequestLength = agIOCTLPayload->Length;
596 Offset = agIOCTLPayload->Reserved;
597 if (RequestLength == 0)
598 {
599 TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FW_REV: No more Data!\n"));
600 /* out of range */
601 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
602 agIOCTLPayload->Length = 0;
604 return status;
605 }
606
607 osti_memcpy((bit8*)&(agIOCTLPayload->FunctionSpecificArea), (bit8*)&ControllerInfo.fwRevision, sizeof(bit32));
608 loc = (bit8 *)&(agIOCTLPayload->FunctionSpecificArea)+ sizeof(bit32);
609 osti_memcpy(loc, (bit8*)&ControllerInfo.sdkRevision, sizeof(bit32));
610
611 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
613 break;
614
615 }
616
617#ifdef SPC_ENABLE_PROFILE
619 {
620 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_FW_PROFILE\n"));
621 status = tdipFWProfileIoctl( tiRoot, agIOCTLPayload,
622 agParam1, agParam2, agParam3);
623 break;
624 }
625#endif /* SPC_ENABLE_PROFILE */
626
628 {
629 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GET_CORE_DUMP\n"));
630 if (tiIS_SPC(agRoot))
631 {
632 status = tdsaRegDumpGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
633 }
634 else
635 {
636 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
638 }
639 break;
640 }
641//#endif
643 {
644 bit8 nvmDev;
645 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_NVMD_SET\n"));
646 nvmDev = (bit8) agIOCTLPayload->Status;
647 agIOCTLPayload->Status = 0;
648 status = tdsaNVMDSetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, &nvmDev);
649 break;
650 }
651#if 0
652case IOCTL_MJ_GPIO:
653 {
654 bit32 sVid =0;
655 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_GPIO\n"));
656
657 /* Get Subsystem vendor */
658 sVid = ostiChipConfigReadBit32(tiRoot,0x2C);
659 sVid = sVid & 0xFFFF;
660
661 /* GPIO is only intended for chip down design
662 * therefore it's only applies to 8H/SPCv product family
663 */
664 if(sVid == 0x9005)
666
667 status = tdsaGpioSetup(tiRoot, agContext, agIOCTLPayload, agParam1, agParam2);
669 status = IOCTL_CALL_PENDING; /* Wait for response from the Controller */
670 else
671 return status;
672
673 break;
674 }
675#endif
676
677 case IOCTL_MJ_SGPIO:
678 {
679 TI_DBG6(("tiCOMMgntIOCTL: IOCTL_MJ_SGPIO\n"));
680 status = tdsaSGpioIoctlSetup(tiRoot, agContext, agIOCTLPayload, agParam1, agParam2);
681 break;
682 }
683
685 {
686 bit8 nvmDev;
687 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_NVMD_GET\n"));
688 nvmDev = (bit8) agIOCTLPayload->Status;
689 agIOCTLPayload->Status = 0;
690 status = tdsaNVMDGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, &nvmDev);
691 break;
692 }
693
695 {
696 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_FORENSIC_DATA\n"));
697 status = tdsaForensicDataGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
698 break;
699 }
701 {
702 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_DEVICE_INFO\n"));
703 status = tdsaDeviceInfoGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
704 break;
705 }
706
708 {
709 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_IO_ERROR_STATISTIC\n"));
710 status = tdsaIoErrorStatisticGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
711 break;
712 }
713
715 {
716 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_GET_IO_EVENT_STATISTIC\n"));
717 status = tdsaIoEventStatisticGetIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
718 break;
719 }
720
722 {
723 TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_SEND_BIST\n"));
724 status = tdsaSendBISTIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
725 break;
726 }
727
728#if 0
730 {
731 TI_DBG3(("tiCOMMgntIOCTL: IOCTL_MJ_SET_OR_GET_REGISTER\n"));
732 status = tdsaRegisterIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
733 break;
734 }
735
736#endif
738 {
739 PhyDetails_t *PhyDetails = (PhyDetails_t*)&agIOCTLPayload->FunctionSpecificArea;
740 agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
741 agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
742 bit8 *sasAddressHi;
743 bit8 *sasAddressLo;
744 bit8 sas_dev_type;
745 int i = 0;
746
747 tiIniGetDirectSataSasAddr(tiRoot, i , &sasAddressHi, &sasAddressLo);
748 for( i = 0; i < saRoot->phyCount ; i++)
749 {
750 PhyDetails[i].attached_phy = saRoot->phys[i].sasIdentify.phyIdentifier;
751 /* deice types
752 * SAS
753 * 0x01 - Sas end device
754 * 0x02 - Expander device
755 * SATA
756 * 0x11 - Sata
757 * NO DEVICE 0x00
758 */
759 sas_dev_type = (saRoot->phys[i].sasIdentify.deviceType_addressFrameType & 0x70 ) >> 4 ;
760 if ((saRoot->phys[i].status == 1) && (sas_dev_type == 0)){ //status 1 - Phy Up
761 //Sata phy
762 PhyDetails[i].attached_dev_type = SAS_PHY_SATA_DEVICE;//0x11 for sata end device
763 osti_memcpy(&PhyDetails[i].attached_sasAddressHi, tdsaAllShared->Ports[i].SASID.sasAddressHi, sizeof(bit32));
764 osti_memcpy(&PhyDetails[i].attached_sasAddressLo, tdsaAllShared->Ports[i].SASID.sasAddressLo, sizeof(bit32));
765 PhyDetails[i].attached_sasAddressLo[3] += i + 16;
766 }
767 else {
768 PhyDetails[i].attached_dev_type = sas_dev_type;
769 osti_memcpy(&PhyDetails[i].attached_sasAddressHi, saRoot->phys[i].sasIdentify.sasAddressHi, sizeof(bit32));
770 osti_memcpy(&PhyDetails[i].attached_sasAddressLo, saRoot->phys[i].sasIdentify.sasAddressLo, sizeof(bit32));
771 }
772 osti_memcpy(&PhyDetails[i].sasAddressLo,&(tdsaAllShared->Ports[i].SASID.sasAddressLo), sizeof(bit32));
773 osti_memcpy(&PhyDetails[i].sasAddressHi,&(tdsaAllShared->Ports[i].SASID.sasAddressHi), sizeof(bit32));
774 }
775
776// osti_memcpy(&agIoctlPayload->FunctionSpecificArea,&PhyInfo, sizeof(agsaSGpioReqResponse_t));
777// printk("Ioctl success\n");
778 return IOCTL_CALL_SUCCESS;
779 }
780
782 {
785 PhyData = (agsaPhyGeneralState_t*) &agIOCTLPayload->FunctionSpecificArea[0];
786
787 PhyData->Reserved2 = 0;
788 /* Validate the length */
789 if (agIOCTLPayload->Length < sizeof(agsaPhyGeneralState_t))
790 {
792 break;
793 }
794
795 tdsaAllShared->tdFWControlEx.param1 = agParam1;
796 tdsaAllShared->tdFWControlEx.param2 = agParam2;
797 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
798 tdsaAllShared->tdFWControlEx.inProgress = 1;
799 //tdsaAllShared->tdFWControlEx.usrAddr = PhyData;
800
802 if(ret == AGSA_RC_FAILURE)
803 {
805 tdsaAllShared->tdFWControlEx.payload = NULL;
806 tdsaAllShared->tdFWControlEx.inProgress = 0;
807 break;
808 }
809 else if(ret == IOCTL_ERR_STATUS_NOT_SUPPORTED)
810 {
811
812 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
814 break;
815 }
816
817 //status = IOCTL_CALL_PENDING;
819 }
820
821 break;
822#if 1
824 {
825 TI_DBG1(("tiCOMMgntIOCTL: IOCTL_MJ_GET_PHY_PROFILE %p %p %p\n",agParam1,agParam2,agParam3));
826 status = tdsaPhyProfileIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, agParam3);
827 break;
828 }
829#endif
831 {
832 void * stu = &agIOCTLPayload->FunctionSpecificArea[0];
833 switch(agIOCTLPayload->MinorFunction)
834 {
835
837 {
838
839#ifdef SA_ENABLE_TRACE_FUNCTIONS
841 hpTraceBufferParms_t BufferParms;
842 TI_DBG5(("tdReturnIOCTL_Info: hpIOCTL_ResetTraceIndex\n"));
843
844 BufferParms.TraceCompiled = 0;
845 BufferParms.TraceWrap = 0;
846 BufferParms.CurrentTraceIndexWrapCount = 0;
847 BufferParms.BufferSize = 0;
848 BufferParms.CurrentIndex = 0;
849 BufferParms.pTrace = NULL;
850 BufferParms.pTraceIndexWrapCount = NULL;
851 BufferParms.pTraceMask = NULL;
852 BufferParms.pCurrentTraceIndex = NULL;
853
854 smTraceGetInfo(agRoot,&BufferParms);
855 TI_DBG5(("tdReturnIOCTL_Info: pTrace %p\n",BufferParms.pTrace));
856 TI_DBG5(("tdReturnIOCTL_Info: pCurrentTraceIndex %p %X\n",BufferParms.pCurrentTraceIndex,*BufferParms.pCurrentTraceIndex));
857 TI_DBG5(("tdReturnIOCTL_Info: pTraceIndexWrapCount %p %X\n",BufferParms.pTraceIndexWrapCount,*BufferParms.pTraceIndexWrapCount));
858 TI_DBG5(("tdReturnIOCTL_Info: pTraceMask %p %X\n",BufferParms.pTraceMask,*BufferParms.pTraceMask));
859
860 if( llist->Flag != 0)
861 {
862 if( llist->TraceMask != *BufferParms.pTraceMask)
863 {
864 smTraceSetMask(agRoot, llist->TraceMask );
865 }
866 }
867 if( llist->Reset)
868 {
869
870 *BufferParms.pCurrentTraceIndex = 0;
871 smResetTraceBuffer(agRoot);
872
873 *BufferParms.pCurrentTraceIndex = 0;
874 *BufferParms.pTraceIndexWrapCount =0;
875 llist->TraceMask = *BufferParms.pTraceMask;
876 }
877#endif /* SA_ENABLE_TRACE_FUNCTIONS */
878 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
880
881 }
882 break;
883
885 {
886 hpTraceBufferParms_t BufferParms;
888 TI_DBG5(("tdReturnIOCTL_Info: hpIOCTL_GetTraceBufferInfo\n"));
889
890
891 BufferParms.TraceCompiled = 0;
892 BufferParms.TraceWrap = 0;
893 BufferParms.CurrentTraceIndexWrapCount = 0;
894 BufferParms.BufferSize = 0;
895 BufferParms.CurrentIndex = 0;
896 BufferParms.pTrace = NULL;
897 BufferParms.pTraceMask = NULL;
898#ifdef SA_ENABLE_TRACE_FUNCTIONS
899 smTraceGetInfo(agRoot,&BufferParms);
900#endif /* SA_ENABLE_TRACE_FUNCTIONS not enabled */
901 llist->TraceCompiled = BufferParms.TraceCompiled;
902 llist->BufferSize = BufferParms.BufferSize;
903 llist->CurrentIndex = BufferParms.CurrentIndex ;
905 llist->TraceWrap = BufferParms.TraceWrap;
906 if(BufferParms.pTraceMask != NULL)
907 {
908 llist->TraceMask = *BufferParms.pTraceMask;
909 }
910 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
912 }
913 break;
914
916 {
917#ifdef SA_ENABLE_TRACE_FUNCTIONS
919
920 hpTraceBufferParms_t BufferParms;
921 bit32 c= 0;
922
923 BufferParms.TraceCompiled = 0;
924 BufferParms.TraceWrap = 0;
925 BufferParms.CurrentTraceIndexWrapCount = 0;
926 BufferParms.BufferSize = 0;
927 BufferParms.CurrentIndex = 0;
928 BufferParms.pTrace = NULL;
929 smTraceGetInfo(agRoot,&BufferParms);
930
931 TI_DBG6(("tdReturnIOCTL_Info: hpIOCTL_GetTraceBuffer\n"));
932
933 if(llist->LowFence != LowFence32Bits)
934 {
935 break;
936 }
937 if(llist->HighFence != HighFence32Bits)
938 {
939 break;
940 }
941
942 if(llist->BufferOffsetBegin + FetchBufferSIZE > BufferParms.BufferSize )
943 {
944 }
945
946 for ( c=0; c < FetchBufferSIZE;c++)
947 {
948 llist->Data[c] = *(BufferParms.pTrace+( c + llist->BufferOffsetBegin));
949 }
950#endif /* SA_ENABLE_TRACE_FUNCTIONS not enabled */
951 }
952 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
954 break;
955 }
956 break;
957 }
958
959#ifdef SA_LL_API_TEST
961 {
962 status = tdLlApiTestIoctl( tiRoot, agIOCTLPayload,
963 agParam1,agParam2,agParam3 );
964 break;
965 }
966
967#endif /* SA_LL_API_TEST */
968
970 {
971 /* The SPCv controller has some options accessed via mode pages */
973 bit32 pageLength = 0;
974 bit32 pageCode;
975 bit32 modeOperation;
976
977 pageCode = pModePage->pageCode & 0xFF;
978 modeOperation = *(bit32 *) agParam2;
979
980 switch(modeOperation)
981 {
982
983 case tiModePageSet:
984 switch (pageCode)
985 {
987 pageLength = sizeof(tiEncryptDekConfigPage_t);
988 break;
989
991 pageLength = sizeof(tiEncryptControlParamPage_t);
992 break;
993
995 /* Pages are currently unsupported */
996 pageLength = 0;
997 break;
998 }
999
1000 status = saSetControllerConfig(agRoot, 0, pageCode, pageLength, pModePage, (agsaContext_t *)agIOCTLPayload);
1001 break;
1002
1003 case tiModePageGet:
1004 status = saGetControllerConfig(agRoot, 0, pageCode, 0, 0, (agsaContext_t *)agIOCTLPayload);
1005 break;
1006
1007 default:
1008 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
1009 }
1010 }
1011 break;
1012#ifdef PHY_RESTART_TEST
1014 {
1015 bit32 portID, tiStatus;
1016 bit32 *data = (bit32*) &agIOCTLPayload->FunctionSpecificArea[0];
1017 portID = *data;
1018
1019 tiStatus = tiCOMPortStart(tiRoot, portID, tdsaAllShared->Ports[portID].tiPortalContext, 0);
1020
1021 if (tiStatus == tiSuccess)
1022 {
1023 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1024 }
1025 else
1026 {
1027 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1028 }
1030 break;
1031 }
1032
1033 case IOCTL_MJ_PORT_STOP:
1034 {
1035 bit32 portID, tiStatus;
1036 bit32 *data = (bit32*) &agIOCTLPayload->FunctionSpecificArea[0];
1037 portID = *data;
1038
1039 tiStatus = tiCOMPortStop(tiRoot, tdsaAllShared->Ports[portID].tiPortalContext);
1040 if (tiStatus == tiSuccess)
1041 {
1042 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1043 }
1044 else
1045 {
1046 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1047 }
1048
1050 break;
1051 }
1052#endif
1053 case IOCTL_MJ_SEND_TMF:
1054 switch(agIOCTLPayload->MinorFunction)
1055 {
1057 status = tdsaSendTMFIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, AG_TARGET_WARM_RESET);
1058 break;
1060 status = tdsaSendTMFIoctl(tiRoot, agIOCTLPayload, agParam1, agParam2, AG_LOGICAL_UNIT_RESET);
1061 break;
1062 }
1063 break;
1066 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1068 break;
1069 default:
1070 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_SUPPORTED;
1071 break;
1072 }
1073
1074 return status;
1075}
1076
1077#if 0
1078/*****************************************************************************
1079*
1080* tdsaGpioSetup
1081*
1082* Purpose: This routine is called to set Gpio parameters to the controller.
1083*
1084* Parameters:
1085* tiRoot: Pointer to driver instance
1086* agsaContext_t :
1087* tiIOCTLPayload_t : ioctl header with payload gpio info
1088* agParam1,agParam2 : Generic parameters
1089*
1090* Return: status
1091*
1092*
1093*****************************************************************************/
1097 agsaContext_t *agContext,
1098 tiIOCTLPayload_t *agIOCTLPayload,
1099 void *agParam1,
1100 void *agParam2
1101 )
1102{
1103
1104 tdsaTimerRequest_t *osIoctlTimer;
1105 agsaGpioEventSetupInfo_t *gpioEventSetupInfo;
1106 agsaGpioWriteSetupInfo_t *gpioWriteSetupInfo;
1107 agsaGpioPinSetupInfo_t *gpioPinSetupInfo;
1108 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1109 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1110 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
1112
1113 TI_DBG3(("tdsaGpioSetup: start\n"));
1114
1115 if(tiRoot == agNULL || agIOCTLPayload == agNULL )
1116 return IOCTL_CALL_FAIL;
1117
1118 osIoctlTimer = &tdsaAllShared->osIoctlTimer;
1119 tdsaInitTimerRequest(tiRoot, osIoctlTimer);
1120 tdIoctlStartTimer(tiRoot, osIoctlTimer); /* Start the timout handler for both ioctl and controller response */
1121 tdsaAllShared->tdFWControlEx.virtAddr = (bit8 *)osIoctlTimer;
1122
1123 tdsaAllShared->tdFWControlEx.usrAddr = (bit8 *)&agIOCTLPayload->FunctionSpecificArea[0];
1124 tdsaAllShared->tdFWControlEx.param1 = agParam1;
1125 tdsaAllShared->tdFWControlEx.param2 = agParam2;
1126 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
1127 tdsaAllShared->tdFWControlEx.inProgress = 1;
1128
1129 switch (agIOCTLPayload->MinorFunction)
1130 {
1131
1133 {
1134 TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_PINSETUP\n"));
1135 gpioPinSetupInfo =(agsaGpioPinSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
1136 status = saGpioPinSetup(agRoot, agContext, 0, gpioPinSetupInfo);
1137
1138 break;
1139 }
1141 {
1142 TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_EVENTSETUP\n"));
1143 gpioEventSetupInfo = (agsaGpioEventSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
1144 status = saGpioEventSetup(agRoot, agContext, 0, gpioEventSetupInfo);
1145
1146 break;
1147 }
1148
1149 case IOCTL_MN_GPIO_READ:
1150 {
1151 TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_READ\n"));
1152 status = saGpioRead(agRoot, agContext, 0);
1153
1154 break;
1155 }
1156
1158 {
1159 TI_DBG3(("tdsaGpioSetup: IOCTL_MN_GPIO_WRITE\n"));
1160 gpioWriteSetupInfo = (agsaGpioWriteSetupInfo_t *)&agIOCTLPayload->FunctionSpecificArea[0];
1161 status = saGpioWrite(agRoot, agContext, 0, gpioWriteSetupInfo->gpioWritemask, gpioWriteSetupInfo->gpioWriteVal);
1162
1163 break;
1164 }
1165
1166 default :
1167 return status;
1168 }
1169
1170 if(status != AGSA_RC_SUCCESS)
1171 {
1173 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1174
1176 if (osIoctlTimer->timerRunning == agTRUE)
1177 {
1179 tdsaKillTimer(tiRoot, osIoctlTimer);
1180
1181 }else{
1183 }
1184 }
1185
1186 TI_DBG3(("tdsaGpioPinSetup: End\n"));
1187 return status;
1188
1189}
1190#endif
1191
1192/*****************************************************************************
1193*
1194* ostiGetGpioIOCTLRsp
1195*
1196* Purpose: This routine is called for Get Gpio IOCTL reaponse has been received.
1197*
1198* Parameters:
1199* tiRoot: Pointer to driver instance
1200* payloadRsp: Pointer to the FW download IOMB's payload.
1201*
1202* Return: none
1203*
1204*
1205*****************************************************************************/
1206
1209 bit32 status,
1210 bit32 gpioReadValue,
1211 agsaGpioPinSetupInfo_t *gpioPinSetupInfo,
1212 agsaGpioEventSetupInfo_t *gpioEventSetupInfo
1213 )
1214{
1215 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1216 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1217 tiIOCTLPayload_t *agIoctlPayload ;
1218 agsaGpioReadInfo_t *gpioReadInfo;
1219
1220 tdsaTimerRequest_t *osIoctlTimer;
1221 osIoctlTimer = (tdsaTimerRequest_t *)tdsaAllShared->tdFWControlEx.virtAddr;
1222
1223 TI_DBG2(("ostiGetGpioIOCTLRsp: start, status = %d \n", status));
1224
1225 agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1226
1227 if(agIoctlPayload == agNULL){
1228 return;
1229 }
1230
1231 agIoctlPayload->Status =(bit16) status;
1232
1233 if( (status != IOCTL_CALL_TIMEOUT) && (osIoctlTimer != NULL))
1234 {
1236 if (osIoctlTimer->timerRunning == agTRUE)
1237 {
1239 tdsaKillTimer(tiRoot, osIoctlTimer);
1240
1241 }else{
1243 }
1244 }else {
1245 tdsaAllShared->tdFWControlEx.inProgress = 0;
1246 agIoctlPayload->Status = (bit16)status;
1247 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
1248 tdsaAllShared->tdFWControlEx.param2, NULL);
1249 return;
1250 }
1251
1252 if(status == SUCCESS)
1253 TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response from OUTBuf"));
1254 else {
1255 tdsaAllShared->tdFWControlEx.inProgress = 0;
1256 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
1257 tdsaAllShared->tdFWControlEx.param2, NULL);
1258 return;
1259 }
1260
1261 switch (agIoctlPayload->MinorFunction)
1262 {
1263
1265 {
1266 TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_PINSETUP"));
1267
1268 break;
1269 }
1271 {
1272 TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_EVENTSETUP"));
1273
1274 break;
1275 }
1276
1278 {
1279 TI_DBG3((" ostiGetGpioIOCTLRsp:Got GPIO response for IOCTL_MN_GPIO_WRITE"));
1280
1281 break;
1282 }
1283
1284 case IOCTL_MN_GPIO_READ:
1285 {
1286 gpioReadInfo = ( agsaGpioReadInfo_t *)tdsaAllShared->tdFWControlEx.usrAddr;
1287
1288 gpioReadInfo->gpioReadValue = gpioReadValue;
1289 gpioReadInfo->gpioInputEnabled = gpioPinSetupInfo->gpioInputEnabled ; /* GPIOIE */
1290 gpioReadInfo->gpioEventLevelChangePart1 = gpioPinSetupInfo->gpioTypePart1; /* GPIEVCHANGE (pins 11-0) */
1291 gpioReadInfo->gpioEventLevelChangePart2 = gpioPinSetupInfo->gpioTypePart2; /* GPIEVCHANGE (pins 23-20) */
1292 gpioReadInfo->gpioEventRisingEdgePart1 = 0xFFF & gpioEventSetupInfo->gpioEventRisingEdge; /* GPIEVRISE (pins 11-0) */
1293 gpioReadInfo->gpioEventRisingEdgePart2 = 0x00F00000 & (gpioEventSetupInfo->gpioEventRisingEdge); /* GPIEVRISE (pins 23-20) */
1294 gpioReadInfo->gpioEventFallingEdgePart1 = 0xFFF & gpioEventSetupInfo->gpioEventFallingEdge; /* GPIEVALL (pins 11-0) */
1295 gpioReadInfo->gpioEventFallingEdgePart2 = 0x00F00000 & gpioEventSetupInfo->gpioEventFallingEdge; /* GPIEVALL (pins 23-20 */
1296
1297 break;
1298 }
1299
1300 default :
1301 break;
1302 }
1303
1304 if(tdsaAllShared->tdFWControlEx.inProgress)
1305 {
1306 tdsaAllShared->tdFWControlEx.inProgress = 0;
1307 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
1308 tdsaAllShared->tdFWControlEx.param2, NULL);
1309 }
1310 TI_DBG2(("ostiGetGpioIOCTLRsp: end \n"));
1311
1312 return ;
1313}
1314
1315/*****************************************************************************
1316*
1317* tdsaSGpioIoctlSetup
1318*
1319* Purpose: This routine is called to send SGPIO request to the controller.
1320*
1321* Parameters:
1322* tiRoot: Pointer to driver instance
1323* agsaContext_t: Context for this request
1324* tiIOCTLPayload_t: ioctl header with payload sgpio info
1325* agParam1,agParam2: Generic parameters
1326*
1327* Return: status
1328*
1329*
1330*****************************************************************************/
1334 agsaContext_t *agContext,
1335 tiIOCTLPayload_t *agIOCTLPayload,
1336 void *agParam1,
1337 void *agParam2
1338 )
1339{
1340 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1341 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1342 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
1344 agsaSGpioReqResponse_t *pSGpioReq = (agsaSGpioReqResponse_t *)&agIOCTLPayload->FunctionSpecificArea[0];
1345
1346 TI_DBG3(("tdsaSGpioIoctlSetup: start\n"));
1347
1348 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1349
1350 do
1351 {
1352 if (tiRoot == agNULL || agIOCTLPayload == agNULL)
1353 {
1354 break;
1355 }
1356
1357 /* Validate the length */
1358 if (agIOCTLPayload->Length < sizeof(agsaSGpioReqResponse_t))
1359 {
1360 TI_DBG3(("Invalid length\n"));
1361 break;
1362 }
1363
1364 /* Validate the SMP Frame Type, Function and Register Type fields */
1365 if ((pSGpioReq->smpFrameType != SMP_REQUEST) || \
1366 ((pSGpioReq->function != SMP_READ_GPIO_REGISTER) && (pSGpioReq->function != SMP_WRITE_GPIO_REGISTER)) || \
1368 {
1369 TI_DBG4(("Invalid Parameter\n"));
1370 break;
1371 }
1372
1373 /* Specific validation for configuration register type */
1374 if (AGSA_SGPIO_CONFIG_REG == pSGpioReq->registerType)
1375 {
1376 if ((pSGpioReq->registerIndex > 0x01) || \
1377 ((0x00 == pSGpioReq->registerIndex) && (pSGpioReq->registerCount > 0x02)) || \
1378 ((0x01 == pSGpioReq->registerIndex) && (pSGpioReq->registerCount > 0x01)))
1379 {
1380 break;
1381 }
1382 }
1383
1384 /* Use FW control place in shared structure to keep the necessary information */
1385 tdsaAllShared->tdFWControlEx.param1 = agParam1;
1386 tdsaAllShared->tdFWControlEx.param2 = agParam2;
1387 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
1388 tdsaAllShared->tdFWControlEx.inProgress = 1;
1389
1390 status = saSgpio(agRoot, agContext, 0, pSGpioReq);
1391 if (status != AGSA_RC_SUCCESS)
1392 {
1393 break;
1394 }
1395
1397
1398 } while (0);
1399
1400 TI_DBG3(("tdsaGpioPinSetup: End\n"));
1401 return status;
1402}
1403
1404/*****************************************************************************
1405*
1406* ostiSgpioIoctlRsp
1407*
1408* Purpose: This routine is called when a SGPIO IOCTL response is received.
1409*
1410* Parameters:
1411* tiRoot: Pointer to driver instance
1412* pSgpioResponse: Pointer to the SGPIO response
1413*
1414* Return: none
1415*
1416*
1417*****************************************************************************/
1420 agsaSGpioReqResponse_t *pSgpioResponse
1421 )
1422{
1423 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1424 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1425 tiIOCTLPayload_t *agIoctlPayload = agNULL;
1426
1427 TI_DBG3(("ostiSgpioIoctlRsp: start\n"));
1428
1429 if (tdsaAllShared->tdFWControlEx.inProgress)
1430 {
1431 agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1432 if (agIoctlPayload)
1433 {
1434 tdsaAllShared->tdFWControlEx.payload = NULL;
1435 osti_memcpy(&agIoctlPayload->FunctionSpecificArea[0], pSgpioResponse, sizeof(agsaSGpioReqResponse_t));
1436 agIoctlPayload->Status = IOCTL_ERR_STATUS_OK;
1437 sgpioResponseSet = 1;
1438 }
1439 tdsaAllShared->sgpioResponseSet = 1; //Sunitha:Check if needed?
1440
1441 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
1442 tdsaAllShared->tdFWControlEx.param2, agNULL);
1443
1444 tdsaAllShared->tdFWControlEx.inProgress = 0;
1445 }
1446
1447 TI_DBG3(("ostiSgpioIoctlRsp: end\n"));
1448}
1449/*****************************************************************************
1450*
1451* ostiCOMMgntIOCTLRsp
1452*
1453* Purpose: This routine is called when FW control IOCTL reaponse has been received.
1454* This function is used for both target and initiator.
1455*
1456* Parameters:
1457* tiRoot: Pointer to driver instance
1458* payloadRsp: Pointer to the FW download IOMB's payload.
1459*
1460* Return: none
1461*
1462*
1463*
1464*****************************************************************************/
1465
1469 )
1470{
1471 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1472 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1473
1474 TI_DBG1(("ostiCOMMgntIOCTLRsp: status 0x%x\n",status));
1475 (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
1476
1478 tdsaAllShared->tdFWControlEx.buffer,
1479 tdsaAllShared->tdFWControlEx.tdFWControl->len);
1480
1482 tdsaAllShared->tdFWControlEx.param1,
1483 tdsaAllShared->tdFWControlEx.param2,
1484 NULL);
1485}
1486
1487
1488/*****************************************************************************
1489*
1490* ostiRegDumpIOCTLRsp
1491*
1492* Purpose: This routine is called when Register Dump from flash IOCTL reaponse has been received.
1493* This function is used for both target and initiator.
1494*
1495* Parameters:
1496* tiRoot: Pointer to driver instance
1497* payloadRsp: Pointer to the FW download IOMB's payload.
1498*
1499* Return: none
1500*
1501*
1502*
1503*****************************************************************************/
1504
1508 )
1509{
1510 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1511 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1512
1513 TI_DBG1(("ostiRegDumpIOCTLRsp: start\n"));
1514// (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
1515 osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
1516 (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
1517 tdsaAllShared->tdFWControlEx.len);
1518
1520 tdsaAllShared->tdFWControlEx.buffer,
1521 tdsaAllShared->tdFWControlEx.len);
1522
1524 tdsaAllShared->tdFWControlEx.param1,
1525 tdsaAllShared->tdFWControlEx.param2,
1526 NULL);
1527}
1528
1529/*****************************************************************************
1530*
1531* ostiSetNVMDIOCTLRsp
1532*
1533* Purpose: This routine is called for Set NVMD IOCTL reaponse has been received.
1534* This function is used for both target and initiator.
1535*
1536* Parameters:
1537* tiRoot: Pointer to driver instance
1538* payloadRsp: Pointer to the FW download IOMB's payload.
1539*
1540* Return: none
1541*
1542*
1543*
1544*****************************************************************************/
1545
1549 )
1550{
1551 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1552 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1553 tiIOCTLPayload_t *agIOCTLPayload;
1554
1555 if(status)
1556 {
1557 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1558 agIOCTLPayload->Status = (bit16)status;
1559 }
1560
1561 TI_DBG1(("ostiSetNVMDIOCTLRsp: start, status = %d\n", status));
1562// (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
1564 tdsaAllShared->tdFWControlEx.buffer,
1565 tdsaAllShared->tdFWControlEx.len);
1566
1568 tdsaAllShared->tdFWControlEx.param1,
1569 tdsaAllShared->tdFWControlEx.param2,
1570 NULL);
1571}
1572#ifdef SPC_ENABLE_PROFILE
1573/*****************************************************************************
1574*
1575* ostiFWProfileIOCTLRsp
1576*
1577* Purpose: This routine is called for Fw Profile IOCTL reaponse has been received.
1578* This function is used for both target and initiator.
1579*
1580* Parameters:
1581* tiRoot: Pointer to driver instance
1582* status:
1583*
1584* Return: none
1585*
1586*
1587*
1588*****************************************************************************/
1589
1590osGLOBAL void ostiFWProfileIOCTLRsp(
1592 bit32 status,
1593 bit32 len)
1594{
1595 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1596 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1597 tdFWProfile_t *fwProfile;
1598
1599 TI_DBG1(("ostiFWProfileIOCTLRsp: start\n"));
1600 fwProfile = (tdFWProfile_t *)tdsaAllShared->tdFWProfileEx.tdFWProfile;
1601 // (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
1602 if (status == AGSA_RC_SUCCESS)
1603 {
1604 if((fwProfile->cmd == STOP_TIMER_PROFILE) || (fwProfile->cmd == STOP_CODE_PROFILE))
1605 {
1606 osti_memcpy((void *)(fwProfile->buffer),
1607 (void *)(tdsaAllShared->tdFWProfileEx.virtAddr),
1608 len);
1609
1611 tdsaAllShared->tdFWProfileEx.buffer,
1612 tdsaAllShared->tdFWProfileEx.len);
1613 }
1614 }
1615 fwProfile->status = status;
1616 fwProfile->len = len;
1618 tdsaAllShared->tdFWProfileEx.param1,
1619 tdsaAllShared->tdFWProfileEx.param2,
1620 NULL);
1621}
1622#endif
1623/*****************************************************************************
1624*
1625* ostiGetNVMDIOCTLRsp
1626*
1627* Purpose: This routine is called for Get NVMD IOCTL reaponse has been received.
1628* This function is used for both target and initiator.
1629*
1630* Parameters:
1631* tiRoot: Pointer to driver instance
1632* payloadRsp: Pointer to the FW download IOMB's payload.
1633*
1634* Return: none
1635*
1636*
1637*
1638*****************************************************************************/
1639
1643 )
1644{
1645 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1646 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1647 tiIOCTLPayload_t *agIOCTLPayload;
1648
1649 if(status)
1650 {
1651 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1652 agIOCTLPayload->Status = (bit16)status;
1653 }
1654
1655 TI_DBG1(("ostiGetNVMDIOCTLRsp: start, status = %d\n", status));
1656 tdsaAllShared->NvmdResponseSet = 1;
1657
1658 if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
1659 {
1660 osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
1661 (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
1662 tdsaAllShared->tdFWControlEx.len);
1663
1665 tdsaAllShared->tdFWControlEx.buffer,
1666 tdsaAllShared->tdFWControlEx.len);
1667
1669 tdsaAllShared->tdFWControlEx.param1,
1670 tdsaAllShared->tdFWControlEx.param2,
1671 NULL);
1672 }
1673}
1674
1675
1676/*****************************************************************************
1677*
1678* ostiGetPhyProfileIOCTLRsp
1679*
1680* Purpose: This routine is called for phy response has been received.
1681* This function is used for both target and initiator.
1682*
1683* Parameters:
1684* tiRoot: Pointer to driver instance
1685* payloadRsp: Pointer to the IOMB's payload.
1686*
1687* Return: none
1688*
1689*
1690*
1691*****************************************************************************/
1692
1696 )
1697{
1698 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1699 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1700 tiIOCTLPayload_t *agIOCTLPayload;
1701 tdPhyCount_t *PhyBlob = agNULL;
1702 if(status)
1703 {
1704 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1705 agIOCTLPayload->Status = (bit16)status;
1706
1707 PhyBlob = (tdPhyCount_t*)&agIOCTLPayload->FunctionSpecificArea[0];
1708 if(PhyBlob)
1709 {
1710// PhyBlob->Phy |= 0x800;
1711 if(PhyBlob->phyResetProblem == 0 )
1712 {
1713 PhyBlob->phyResetProblem = -1;
1714 }
1715 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->Phy 0x%x\n",PhyBlob->Phy));
1716 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->BW_rx 0x%x\n",PhyBlob->BW_rx));
1717 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->BW_tx 0x%x\n",PhyBlob->BW_tx));
1718 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->InvalidDword 0x%x\n",PhyBlob->InvalidDword));
1719 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->runningDisparityError 0x%x\n",PhyBlob->runningDisparityError));
1720 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->codeViolation 0x%x\n",PhyBlob->codeViolation));
1721 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->phyResetProblem 0x%x\n",PhyBlob->phyResetProblem));
1722 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: PhyBlob->inboundCRCError 0x%x\n",PhyBlob->inboundCRCError));
1723
1724 }
1725
1726
1727 }
1728
1729 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: start, status = %d\n", status));
1730 TI_DBG1(("ostiGetPhyProfileIOCTLRsp: start, len = %d %p %p\n", tdsaAllShared->tdFWControlEx.len,tdsaAllShared->tdFWControlEx.usrAddr,tdsaAllShared->tdFWControlEx.virtAddr));
1731
1732// osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
1733// (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
1734// tdsaAllShared->tdFWControlEx.len);
1735
1737 tdsaAllShared->tdFWControlEx.buffer,
1738 tdsaAllShared->tdFWControlEx.len);
1739
1741 tdsaAllShared->tdFWControlEx.param1,
1742 tdsaAllShared->tdFWControlEx.param2,
1743 NULL);
1744}
1745
1746
1747/*****************************************************************************
1748*
1749* ostiGenEventIOCTLRsp
1750*
1751* Purpose: This routine is called when General Event happened while waiting for IOCTL response.
1752* This function is used for both target and initiator.
1753*
1754* Parameters:
1755* tiRoot: Pointer to driver instance
1756* payloadRsp: Pointer to the FW download IOMB's payload.
1757*
1758* Return: none
1759*
1760*
1761*
1762*****************************************************************************/
1763
1767 )
1768{
1769 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1770 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1771 tiIOCTLPayload_t *agIOCTLPayload;
1772
1773 TI_DBG1(("ostiGenEventIOCTLRsp: start\n"));
1774
1775 if(tdsaAllShared->tdFWControlEx.inProgress) /*Free only if our IOCTL is in progress*/
1776 {
1777 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1778 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1779 (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1780
1782 tdsaAllShared->tdFWControlEx.buffer,
1783 tdsaAllShared->tdFWControlEx.len);
1784
1786 tdsaAllShared->tdFWControlEx.param1,
1787 tdsaAllShared->tdFWControlEx.param2,
1788 NULL);
1789 tdsaAllShared->tdFWControlEx.inProgress = 0;
1790 }
1791#ifdef SPC_ENABLE_PROFILE
1792 if(tdsaAllShared->tdFWProfileEx.inProgress)
1793 {
1794 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWProfileEx.payload);
1795 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1796 if(tdsaAllShared->tdFWProfileEx.virtAddr != NULL) /*Free only if our IOCTL is in progress*/
1797 {
1799 tdsaAllShared->tdFWProfileEx.buffer,
1800 tdsaAllShared->tdFWProfileEx.len);
1801 tdsaAllShared->tdFWProfileEx.virtAddr = NULL;
1802 }
1804 tdsaAllShared->tdFWProfileEx.param1,
1805 tdsaAllShared->tdFWProfileEx.param2,
1806 NULL);
1807 tdsaAllShared->tdFWProfileEx.inProgress = 0;
1808
1809 }
1810#endif /*SPC_ENABLE_PROFILE*/
1811
1812}
1813
1814osGLOBAL void
1817 bit32 status,
1818 void *param
1819 )
1820{
1821 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1822 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1823 tiIOCTLPayload_t *agIOCTLPayload = agNULL;
1824 tdDeviceInfoPayload_t *pTDDeviceInfo = agNULL;
1825 agsaDeviceInfo_t *pSADeviceInfo = agNULL;
1826
1827 TI_DBG1(("ostiGetDeviceInfoIOCTLRsp: start\n"));
1828
1829 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1830 pSADeviceInfo = (agsaDeviceInfo_t*)param;
1831 pTDDeviceInfo = (tdDeviceInfoPayload_t*)agIOCTLPayload->FunctionSpecificArea;
1832
1833 if (pSADeviceInfo != agNULL)
1834 {
1835 /* fill the device information in IOCTL payload */
1836 osti_memcpy(&pTDDeviceInfo->devInfo.sasAddressHi, pSADeviceInfo->sasAddressHi, sizeof(bit32));
1837 osti_memcpy(&pTDDeviceInfo->devInfo.sasAddressLo, pSADeviceInfo->sasAddressLo, sizeof(bit32));
1838
1839 pTDDeviceInfo->devInfo.sasAddressHi = DMA_BEBIT32_TO_BIT32(pTDDeviceInfo->devInfo.sasAddressHi);
1840 pTDDeviceInfo->devInfo.sasAddressLo = DMA_BEBIT32_TO_BIT32(pTDDeviceInfo->devInfo.sasAddressLo);
1841
1842 pTDDeviceInfo->devInfo.deviceType = (pSADeviceInfo->devType_S_Rate & 0x30) >> 4;
1843 pTDDeviceInfo->devInfo.linkRate = pSADeviceInfo->devType_S_Rate & 0x0F;
1844
1845 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1846 }
1847 else
1848 {
1849 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
1850 }
1851
1852 if(tdsaAllShared->tdFWControlEx.inProgress) /*Free only if our IOCTL is in progress*/
1853 {
1855 tdsaAllShared->tdFWControlEx.param1,
1856 tdsaAllShared->tdFWControlEx.param2,
1857 NULL);
1858 tdsaAllShared->tdFWControlEx.inProgress = 0;
1859 }
1860}
1861
1862
1863#ifdef INITIATOR_DRIVER
1864osGLOBAL void
1867 bit32 status,
1868 void *param
1869 )
1870{
1871 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1872 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1873 itdsaIni_t *Initiator = (itdsaIni_t *)tdsaAllShared->itdsaIni;
1874 tiIOCTLPayload_t *agIOCTLPayload = agNULL;
1875 tdIoErrorStatisticPayload_t *pIoErrorPayload = agNULL;
1876 agsaIOErrorEventStats_t *pIoErrorCount = agNULL;
1877
1878 OS_ASSERT(sizeof(agsaIOErrorEventStats_t) == sizeof(tdIoErrorEventStatisticIOCTL_t), "agsaIOErrorEventStats_t tdIoErrorEventStatisticIOCTL_t\n");
1879 TI_DBG1(("ostiGetIoErrorStatsIOCTLRsp: start\n"));
1880
1881 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1882 pIoErrorPayload = (tdIoErrorStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
1883 pIoErrorCount = (agsaIOErrorEventStats_t*)param;
1884
1885 osti_memcpy(&pIoErrorPayload->IoError, pIoErrorCount, sizeof(agsaIOErrorEventStats_t));
1886 /*copy SCSI status and sense key count from OS layer to TD layer*/
1887 osti_memcpy(&pIoErrorPayload->ScsiStatusCounter, &Initiator->ScsiStatusCounts, sizeof(tdSCSIStatusCount_t));
1888 osti_memcpy(&pIoErrorPayload->SenseKeyCounter, &Initiator->SenseKeyCounter, sizeof(tdSenseKeyCount_t));
1889 if (pIoErrorPayload->flag)
1890 {
1891 osti_memset(&Initiator->ScsiStatusCounts, 0,sizeof(tdSCSIStatusCount_t) );
1892 osti_memset(&Initiator->SenseKeyCounter, 0,sizeof(tdSenseKeyCount_t) );
1893 }
1894
1895 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1896}
1897#endif /* INITIATOR_DRIVER */
1898
1899osGLOBAL void
1902 bit32 status,
1903 void *param
1904 )
1905{
1906 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1907 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1908 tiIOCTLPayload_t *agIOCTLPayload = agNULL;
1909 tdIoEventStatisticPayload_t *pIoEventPayload = agNULL;
1910 agsaIOErrorEventStats_t *pIoEventCount = agNULL;
1911
1912 TI_DBG1(("ostiGetIoEventStatsIOCTLRsp: start\n"));
1913
1914 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1915 pIoEventPayload = (tdIoEventStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
1916 pIoEventCount = (agsaIOErrorEventStats_t*)param;
1917
1918 osti_memcpy(&pIoEventPayload->IoEvent, pIoEventCount, sizeof(agsaIOErrorEventStats_t));
1919
1920 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1921}
1922
1923osGLOBAL void
1926 bit32 status,
1927 void *param
1928 )
1929{
1930 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
1931 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
1932 tiIOCTLPayload_t *agIOCTLPayload = agNULL;
1933 tdForensicDataPayload_t *pForensicDataPayload = agNULL;
1934 agsaForensicData_t *pForensicData = agNULL;
1935
1936 TI_DBG3(("ostiGetForensicDataIOCTLRsp: start, status = %d\n", status));
1937
1938 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
1939 pForensicDataPayload = (tdForensicDataPayload_t*)agIOCTLPayload->FunctionSpecificArea;
1940 pForensicData = (agsaForensicData_t*)param;
1941
1942 if (agNULL == agIOCTLPayload)
1943 {
1944 return;
1945 }
1946
1947 if (FORENSIC_DATA_TYPE_CHECK_FATAL == pForensicData->DataType)
1948 {
1949 agIOCTLPayload->Status = (bit16)status;
1950 return;
1951 }
1952
1953 if (status == AGSA_RC_SUCCESS)
1954 {
1955 switch (pForensicData->DataType)
1956 {
1959 pForensicDataPayload->dataBuffer.directOffset = pForensicData->BufferType.dataBuf.directOffset;
1960 pForensicDataPayload->dataBuffer.readLen = pForensicData->BufferType.dataBuf.readLen;
1961 break;
1963 pForensicDataPayload->gsmBuffer.directOffset = pForensicData->BufferType.gsmBuf.directOffset;
1964 pForensicDataPayload->gsmBuffer.readLen = pForensicData->BufferType.gsmBuf.readLen;
1965 break;
1966
1968 break;
1969
1970 default:
1971 TI_DBG1(("ostiGetForensicDataIOCTLRsp: forensic data type error %d\n", pForensicData->DataType));
1972 break;
1973 }
1974 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
1975 }
1977 {
1978 agIOCTLPayload->Status = (bit16)status;
1979 }
1980 else
1981 {
1982 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
1983 }
1984
1985 /*Free only if our IOCTL is in progress*/
1986 if(tdsaAllShared->tdFWControlEx.inProgress)
1987 {
1988 TI_DBG3(("ostiGetForensicDataIOCTLRsp: Waiting for the signal \n"));
1990 tdsaAllShared->tdFWControlEx.param1,
1991 tdsaAllShared->tdFWControlEx.param2,
1992 NULL);
1993 TI_DBG3(("ostiGetForensicDataIOCTLRsp: Signal wait completed \n"));
1994 tdsaAllShared->tdFWControlEx.inProgress = 0;
1995 }
1996}
1997
1998/*****************************************************************************
1999*
2000* tdsaRegDumpGetIoctl
2001*
2002* Purpose: This routine is called to get Register Dump information.
2003* This function is used for both target and initiator.
2004*
2005* Parameters:
2006* tiRoot: Pointer to driver instance
2007* agIOCTLPayload: Pointer to the IOCTL payload.
2008* agParam1: Pointer to pass context handle for IOCTL DMA operation
2009* agParam2: Pointer to pass context handle for IOCTL DMA operation
2010* agParam3: Pointer to pass context handle for IOCTL DMA operation
2011*
2012* Return:
2013*
2014* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2015* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2016* Detail error code is function specific and
2017* defined by the specific IOCTL function.
2018* IOCTL_CALL_PENDING This request is asynchronous and completed
2019* in some other context.
2020* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2021*
2022*
2023*****************************************************************************/
2027 tiIOCTLPayload_t *agIOCTLPayload,
2028 void *agParam1,
2029 void *agParam2,
2030 void *agParam3
2031 )
2032{
2033 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2034 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2035 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2036// agsaControllerStatus_t RegDump;
2037 bit32 Offset = 0;
2038 bit32 RequestLength = 0; /* user request on how much data to pass to application */
2039 agsaRegDumpInfo_t regDumpInfo;
2040 void *buffer = agNULL;
2041 void *osMemHandle = agNULL;
2043 bit32 CoreDumpLength = 16384; /* change it once data is available */
2044 bit32 EventLogOffset = 65536;
2045
2047 /* length of FSA as provided by application */
2048 RequestLength = agIOCTLPayload->Length;
2050 /* offset into core dump that was passed from application */
2051 Offset = agIOCTLPayload->Reserved;
2052
2053 if((CoreDumpLength <= Offset)&&
2054 (agIOCTLPayload->MinorFunction != IOCTL_MN_FW_GET_EVENT_FLASH_LOG1)&&
2056 {
2057 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
2058 agIOCTLPayload->Length = 0;
2060 return status;
2061 }
2062 regDumpInfo.regDumpOffset = Offset;
2063 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
2064 /* dump either aap1 or iop registers */
2065 switch(agIOCTLPayload->MinorFunction){
2066
2067 /*Coredump*/
2069 //CoreDumpBAROffset = RegDump.fatalErrorInfo.regDumpOffset0; /* get this from mpi config table */
2070 //CoreDumpLength = RegDump.fatalErrorInfo.regDumpLen0;
2071 /*changes for added Call back*/
2072 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2073 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2074 regDumpInfo.regDumpSrc = 0;
2075 regDumpInfo.regDumpNum = 0;
2076 regDumpInfo.directLen = RequestLength;
2077 regDumpInfo.directData = &agIOCTLPayload->FunctionSpecificArea[0];
2078 /*changes for added Call back*/
2079 //status = IOCTL_CALL_SUCCESS;
2080 tdsaAllShared->tdFWControlEx.inProgress = 1;
2082 break;
2084 //CoreDumpBAROffset = RegDump.fatalErrorInfo.regDumpOffset1; /* get this from mpi config table */
2085 //CoreDumpLength = RegDump.fatalErrorInfo.regDumpLen1;
2086 /*changes for added Call back*/
2087 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2088 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2089 regDumpInfo.regDumpSrc = 0;
2090 regDumpInfo.regDumpNum = 1;
2091 regDumpInfo.directLen = RequestLength;
2092 regDumpInfo.directData = &agIOCTLPayload->FunctionSpecificArea[0];
2093 /*changes for added Call back*/
2094 //status = IOCTL_CALL_SUCCESS;
2095 tdsaAllShared->tdFWControlEx.inProgress = 1;
2097 break;
2099 regDumpInfo.regDumpSrc = 1;
2100 regDumpInfo.regDumpNum = 0;
2101 if(RequestLength != 0)
2102 {
2104 &osMemHandle,
2105 (void **)&buffer,
2106 &(regDumpInfo.indirectAddrUpper32),
2107 &(regDumpInfo.indirectAddrLower32),
2108 8,
2109 RequestLength,
2110 agFALSE))
2111 return IOCTL_CALL_FAIL;
2112 }
2113 osti_memset((void *)buffer, 0, RequestLength);
2114 regDumpInfo.indirectLen = RequestLength;
2115
2116 // use FW control place in shared structure to keep the neccesary information
2117 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2118 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2119 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2120 tdsaAllShared->tdFWControlEx.len = RequestLength;
2121 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2122 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2123 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2124 tdsaAllShared->tdFWControlEx.inProgress = 1;
2126 break;
2128 regDumpInfo.regDumpSrc = 1;
2129 regDumpInfo.regDumpNum = 1;
2130 if(RequestLength != 0)
2131 {
2133 &osMemHandle,
2134 (void **)&buffer,
2135 &(regDumpInfo.indirectAddrUpper32),
2136 &(regDumpInfo.indirectAddrLower32),
2137 8,
2138 RequestLength,
2139 agFALSE))
2140 return IOCTL_CALL_FAIL;
2141 }
2142 osti_memset((void *)buffer, 0, RequestLength);
2143 regDumpInfo.indirectLen = RequestLength;
2144
2145 // use FW control place in shared structure to keep the neccesary information
2146 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2147 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2148 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2149 tdsaAllShared->tdFWControlEx.len = RequestLength;
2150 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2151 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2152 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2153 tdsaAllShared->tdFWControlEx.inProgress = 1;
2155 break;
2156 /*EventLog from Flash*/
2157 case IOCTL_MN_FW_GET_EVENT_FLASH_LOG1: //aap1 Eventlog
2158 if(CoreDumpLength + EventLogOffset <= Offset)
2159 {
2160 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
2161 agIOCTLPayload->Length = 0;
2163 return status;
2164 }
2165 regDumpInfo.regDumpSrc = 1;
2166 regDumpInfo.regDumpNum = 0;
2167 if(RequestLength != 0)
2168 {
2170 &osMemHandle,
2171 (void **)&buffer,
2172 &(regDumpInfo.indirectAddrUpper32),
2173 &(regDumpInfo.indirectAddrLower32),
2174 8,
2175 RequestLength,
2176 agFALSE))
2177 return IOCTL_CALL_FAIL;
2178 }
2179 osti_memset((void *)buffer, 0, RequestLength);
2180 regDumpInfo.indirectLen = RequestLength;
2181
2182 // use FW control place in shared structure to keep the neccesary information
2183 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2184 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2185 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2186 tdsaAllShared->tdFWControlEx.len = RequestLength;
2187 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2188 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2189 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2190 tdsaAllShared->tdFWControlEx.inProgress = 1;
2192 break;
2193 case IOCTL_MN_FW_GET_EVENT_FLASH_LOG2: //iop Eventlog
2194 if(CoreDumpLength + EventLogOffset <= Offset)
2195 {
2196 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
2197 agIOCTLPayload->Length = 0;
2199 return status;
2200 }
2201 regDumpInfo.regDumpSrc = 1;
2202 regDumpInfo.regDumpNum = 1;
2203 if(RequestLength != 0)
2204 {
2206 &osMemHandle,
2207 (void **)&buffer,
2208 &(regDumpInfo.indirectAddrUpper32),
2209 &(regDumpInfo.indirectAddrLower32),
2210 8,
2211 RequestLength,
2212 agFALSE))
2213 return IOCTL_CALL_FAIL;
2214 }
2215 osti_memset((void *)buffer, 0, RequestLength);
2216 regDumpInfo.indirectLen = RequestLength;
2217
2218 // use FW control place in shared structure to keep the neccesary information
2219 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2220 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2221 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2222 tdsaAllShared->tdFWControlEx.len = RequestLength;
2223 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2224 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2225 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2226 tdsaAllShared->tdFWControlEx.inProgress = 1;
2228 break;
2229 default:
2231 TI_DBG1(("tiCOMMgntIOCTL: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
2232 break;
2233 }
2234 if(saGetRegisterDump(agRoot, agNULL, 0, &regDumpInfo) != AGSA_RC_SUCCESS)
2235 {
2237 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
2238 }
2239
2240 return status;
2241}
2242
2243osGLOBAL void
2247 )
2248{
2249 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2250 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2251// agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2252
2253 TI_DBG1(("ostiCOMMgntVPDSetIOCTLRsp: start\n"));
2254 (tdsaAllShared->tdFWControlEx.tdFWControl)->retcode = status;
2255
2257 tdsaAllShared->tdFWControlEx.buffer,
2258 tdsaAllShared->tdFWControlEx.len);
2259
2260 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
2261 tdsaAllShared->tdFWControlEx.param2,
2262 NULL);
2263}
2264
2265/*****************************************************************************
2266*
2267* tdsaNVMDSetIoctl
2268*
2269* Purpose: This routine is called to set Config. SEEPROM information.
2270* This function is used for both target and initiator.
2271*
2272* Parameters:
2273* tiRoot: Pointer to driver instance
2274* agIOCTLPayload: Pointer to the IOCTL payload.
2275* agParam1: Pointer to pass context handle for IOCTL DMA operation
2276* agParam2: Pointer to pass context handle for IOCTL DMA operation
2277* agParam3: Pointer to pass context handle for IOCTL DMA operation
2278*
2279* Return:
2280*
2281* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2282* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2283* Detail error code is function specific and
2284* defined by the specific IOCTL function.
2285* IOCTL_CALL_PENDING This request is asynchronous and completed
2286* in some other context.
2287* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2288*
2289*
2290*****************************************************************************/
2294 tiIOCTLPayload_t *agIOCTLPayload,
2295 void *agParam1,
2296 void *agParam2,
2297 void *agParam3
2298 )
2299{
2300 bit32 RequestLength = 0;
2301 bit32 bufAddrUpper = 0;
2302 bit32 bufAddrLower = 0;
2303 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2304 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2305 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2306 void *buffer = agNULL;
2307 void *osMemHandle = agNULL;
2309 agsaNVMDData_t nvmdInfo;
2310
2311
2312 TI_DBG2(("tdsaNVMDSetIoctl: start\n"));
2313
2314 RequestLength = agIOCTLPayload->Length;
2315
2316 osti_memset(&nvmdInfo, 0, sizeof(agsaNVMDData_t));
2317
2318 switch(agIOCTLPayload->MinorFunction)
2319 {
2321
2322 //nvmdInfo.NVMDevice = 1;
2323 nvmdInfo.NVMDevice = *((bit8*)agParam3);
2324 nvmdInfo.signature = 0xFEDCBA98;
2325 nvmdInfo.dataOffsetAddress = agIOCTLPayload->Reserved;
2326 nvmdInfo.indirectPayload = 1;
2327 nvmdInfo.indirectLen = RequestLength;
2328
2329 if (nvmdInfo.NVMDevice == 0) {
2330 nvmdInfo.TWIDeviceAddress = 0xa0;
2331 nvmdInfo.TWIBusNumber = 0;
2332 nvmdInfo.TWIDevicePageSize = 0;
2333 nvmdInfo.TWIDeviceAddressSize = 1;
2334 }
2335
2336 if(RequestLength != 0)
2337 {
2339 &osMemHandle,
2340 (void **)&buffer,
2341 &bufAddrUpper,
2342 &bufAddrLower,
2343 8,
2344 RequestLength,
2345 agFALSE))
2346 return IOCTL_CALL_FAIL;
2347 }
2348 else
2349 {
2350 return IOCTL_CALL_FAIL;
2351 }
2352
2353 osti_memset((void *)buffer, 0, RequestLength);
2354
2355 osti_memcpy((void *)buffer,
2356 agIOCTLPayload->FunctionSpecificArea,
2357 RequestLength);
2358
2359 nvmdInfo.indirectAddrLower32 = bufAddrLower;
2360 nvmdInfo.indirectAddrUpper32 = bufAddrUpper;
2361 // use FW control place in shared structure to keep the neccesary information
2362 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2363 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2364 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2365 tdsaAllShared->tdFWControlEx.len = RequestLength;
2366 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2367 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2368 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2369 tdsaAllShared->tdFWControlEx.inProgress = 1;
2371 break;
2372 default:
2374 TI_DBG1(("tdsaNVMDSetIoctl: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
2375 break;
2376 }
2377
2378 if(saSetNVMDCommand(agRoot, agNULL, 0, &nvmdInfo) != AGSA_RC_SUCCESS)
2379 {
2381 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
2382 }
2383
2384 return status;
2385
2386}
2387
2388/*****************************************************************************
2389*
2390* tdsaNVMDGetIoctl
2391*
2392* Purpose: This routine is called to get Config. SEEPROM information.
2393* This function is used for both target and initiator.
2394*
2395* Parameters:
2396* tiRoot: Pointer to driver instance
2397* agIOCTLPayload: Pointer to the IOCTL payload.
2398* agParam1: Pointer to pass context handle for IOCTL DMA operation
2399* agParam2: Pointer to pass context handle for IOCTL DMA operation
2400* agParam3: Pointer to pass context handle for IOCTL DMA operation
2401*
2402* Return:
2403*
2404* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2405* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2406* Detail error code is function specific and
2407* defined by the specific IOCTL function.
2408* IOCTL_CALL_PENDING This request is asynchronous and completed
2409* in some other context.
2410* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2411*
2412*
2413*****************************************************************************/
2417 tiIOCTLPayload_t *agIOCTLPayload,
2418 void *agParam1,
2419 void *agParam2,
2420 void *agParam3
2421 )
2422{
2423 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2424 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2425 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2426 void *buffer = agNULL;
2427 void *osMemHandle = agNULL;
2429 agsaNVMDData_t nvmdInfo;
2430 bit32 Offset = 0;
2431 bit32 RequestLength = 0;
2432 bit32 ostiMemoryStatus = 0;
2433 bit32 i,j;
2434 bit8* seepromBuffer;
2435 bit8* phySettingsBuffer;
2436
2437
2438 TI_DBG2(("tdsaNVMDGetIoctl: start\n"));
2439
2440 RequestLength = agIOCTLPayload->Length;
2441 Offset = agIOCTLPayload->Reserved;
2442
2443 osti_memset(&nvmdInfo, 0, sizeof(agsaNVMDData_t));
2444 /* This condition is not valid for direct read so commenting */
2445 /*if(!tiIS_SPC(agRoot)) {
2446 if( RequestLength <= Offset ) //4096-max seeprom size
2447 {
2448 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NO_MORE_DATA;
2449 agIOCTLPayload->Length = 0;
2450 status=IOCTL_CALL_SUCCESS;
2451 return status;
2452 }
2453 }*/
2454
2455 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
2456
2457 switch(agIOCTLPayload->MinorFunction)
2458 {
2460
2461 // nvmdInfo.NVMDevice = 1;
2462 nvmdInfo.NVMDevice = *((bit8*)agParam3);
2463 nvmdInfo.signature = 0xFEDCBA98;
2464 nvmdInfo.dataOffsetAddress = Offset;
2465 nvmdInfo.indirectPayload = 1;
2466 nvmdInfo.indirectLen = RequestLength;
2467
2468 if (nvmdInfo.NVMDevice == 0) {
2469 nvmdInfo.TWIDeviceAddress = 0xa0;
2470 nvmdInfo.TWIBusNumber = 0;
2471 nvmdInfo.TWIDevicePageSize = 0;
2472 nvmdInfo.TWIDeviceAddressSize = 1;
2473 }
2474
2475 if(RequestLength != 0)
2476 {
2477 ostiMemoryStatus = ostiAllocMemory( tiRoot,
2478 &osMemHandle,
2479 (void **)&buffer,
2480 &(nvmdInfo.indirectAddrUpper32),
2481 &(nvmdInfo.indirectAddrLower32),
2482 8,
2483 RequestLength,
2484 agFALSE);
2485 if((ostiMemoryStatus != tiSuccess) && (buffer == agNULL))
2486 return IOCTL_CALL_FAIL;
2487 }
2488 else
2489 {
2490 return IOCTL_CALL_FAIL;
2491 }
2492 osti_memset((void *)buffer, 0, RequestLength);
2493
2494 // use FW control place in shared structure to keep the neccesary information
2495 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2496 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2497 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2498 tdsaAllShared->tdFWControlEx.len = RequestLength;
2499 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2500 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2501 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2502 tdsaAllShared->tdFWControlEx.inProgress = 1;
2504 break;
2505 default:
2507 TI_DBG1(("tiCOMMgntIOCTL: ERROR: Wrong IOCTL code %d\n", agIOCTLPayload->MinorFunction));
2508 break;
2509 }
2510 tdsaAllShared->NvmdResponseSet = 0;
2511
2512 if(saGetNVMDCommand(agRoot, agNULL, 0, &nvmdInfo) != AGSA_RC_SUCCESS)
2513 {
2515 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
2516 return status;
2517 }
2518 /* Copy the SAS address */
2519 if(agParam1 == agNULL)
2520
2521 {
2522 while(!tdsaAllShared->NvmdResponseSet)
2523 {
2524 // tiCOMDelayedInterruptHandler(tiRoot, 0, 1, tiNonInterruptContext);
2525 }
2526 if(nvmdInfo.NVMDevice == 4 || nvmdInfo.NVMDevice == 1)
2527 {
2528 seepromBuffer = buffer;
2529 /*Get Initiator SAS address*/
2530
2531 if(tiIS_SPC(agRoot))
2532 {
2534 agIOCTLPayload->FunctionSpecificArea[j] = seepromBuffer[i];
2535 }
2536 else
2537 {
2538 for(j=0,i=ADAPTER_WWN_START_OFFSET; i<= ADAPTER_WWN_END_OFFSET; i++,j++)
2539 agIOCTLPayload->FunctionSpecificArea[j] = seepromBuffer[i];
2540 }
2541 }
2542 /* Copy the Phy settings */
2543 else if(nvmdInfo.NVMDevice == 6)
2544 {
2545 phySettingsBuffer = buffer;
2546 for(i=0; i<PHY_SETTINGS_LEN; i++)
2547 agIOCTLPayload->FunctionSpecificArea[i] = phySettingsBuffer[i];
2548 }
2549 tdsaAllShared->NvmdResponseSet = 0;
2550 ostiFreeMemory(tiRoot, tdsaAllShared->tdFWControlEx.buffer, tdsaAllShared->tdFWControlEx.len);
2551
2552 }
2553 return status;
2554
2555}
2556
2557/*****************************************************************************
2558*
2559* tdsaDeviceInfoGetIoctl
2560*
2561* Purpose: This routine is called to get the specified device information.
2562*
2563* Parameters:
2564* tiRoot: Pointer to driver instance
2565* agIOCTLPayload: Pointer to the IOCTL payload.
2566* agParam1: Pointer to pass context handle for IOCTL DMA operation
2567* agParam2: Pointer to pass context handle for IOCTL DMA operation
2568* agParam3: Pointer to pass context handle for IOCTL DMA operation
2569*
2570* Return:
2571*
2572* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2573* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2574* Detail error code is function specific and
2575* defined by the specific IOCTL function.
2576* IOCTL_CALL_PENDING This request is asynchronous and completed
2577* in some other context.
2578* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2579*
2580*
2581*****************************************************************************/
2585 tiIOCTLPayload_t *agIOCTLPayload,
2586 void *agParam1,
2587 void *agParam2,
2588 void *agParam3
2589 )
2590{
2591 tdsaDeviceData_t *oneDeviceData = agNULL;
2593 tdDeviceInfoPayload_t *pDeviceInfo = agNULL;
2594 /*agsaDevHandle_t *agDevHandle = agNULL;*/
2596
2597 pDeviceInfo = (tdDeviceInfoPayload_t*)agIOCTLPayload->FunctionSpecificArea;
2598
2599 TI_DBG3(("tdsaDeviceInfoGetIoctl: %d:%3d:%d %p %p %p\n",
2600 (bit8)pDeviceInfo->PathId,
2601 (bit8)pDeviceInfo->TargetId,
2602 (bit8)pDeviceInfo->Lun,
2603 agParam1,
2604 agParam2,
2605 agParam3));
2606
2608 (bit8)pDeviceInfo->PathId,
2609 (bit8)pDeviceInfo->TargetId,
2610 (bit8)pDeviceInfo->Lun
2611 );
2612
2613 if (tiDeviceHandle == agNULL)
2614 {
2615 TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle is NULL !!!! SCSI address = %d:%3d:%d\n",
2616 pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
2617 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
2619 return status;
2620 }
2621
2622 oneDeviceData = (tdsaDeviceData_t *)tiDeviceHandle->tdData;
2623 if(oneDeviceData == agNULL)
2624 {
2625 TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle=%p DeviceData is NULL!!! SCSI address = %d:%3d:%d\n",
2626 tiDeviceHandle, pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
2627 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
2629 return status;
2630 }
2631
2632 /* for hotplug */
2633 if (oneDeviceData->valid != agTRUE || oneDeviceData->registered != agTRUE ||
2634 oneDeviceData->tdPortContext == agNULL )
2635 {
2636 TI_DBG1(("tdsaDeviceInfoGetIoctl: tiDeviceHandle=%p did %d DeviceData was removed!!! SCSI address = %d:%3d:%d\n",
2637 tiDeviceHandle, oneDeviceData->id, pDeviceInfo->PathId, pDeviceInfo->TargetId, pDeviceInfo->Lun));
2638 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INVALID_DEVICE;
2640 return status;
2641 }
2642
2643 /* fill the device information in IOCTL payload */
2644 pDeviceInfo->devInfo.phyId = oneDeviceData->phyID;
2645 osti_memcpy(&pDeviceInfo->devInfo.sasAddressHi, oneDeviceData->agDeviceInfo.sasAddressHi, sizeof(bit32));
2646 osti_memcpy(&pDeviceInfo->devInfo.sasAddressLo, oneDeviceData->agDeviceInfo.sasAddressLo, sizeof(bit32));
2647
2648 pDeviceInfo->devInfo.sasAddressHi = DMA_BEBIT32_TO_BIT32(pDeviceInfo->devInfo.sasAddressHi);
2649 pDeviceInfo->devInfo.sasAddressLo = DMA_BEBIT32_TO_BIT32(pDeviceInfo->devInfo.sasAddressLo);
2650
2651 pDeviceInfo->devInfo.deviceType = (oneDeviceData->agDeviceInfo.devType_S_Rate & 0x30) >> 4;
2652 pDeviceInfo->devInfo.linkRate = oneDeviceData->agDeviceInfo.devType_S_Rate & 0x0F;
2653
2654 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
2655
2656 TI_DBG3(("tdsaDeviceInfoGetIoctl:IOCTL_CALL_SUCCESS\n"));
2657
2658 /*saGetDeviceInfo(agRoot, agNULL, 0, 0, agDevHandle);*/
2659
2661
2662 return status;
2663}
2664/*****************************************************************************
2665*
2666* tdsaIoErrorStatisticGetIoctl
2667*
2668* Purpose: This routine is called to get the IO error statistic.
2669*
2670* Parameters:
2671* tiRoot: Pointer to driver instance
2672* agIOCTLPayload: Pointer to the IOCTL payload.
2673* agParam1: Pointer to pass context handle for IOCTL DMA operation
2674* agParam2: Pointer to pass context handle for IOCTL DMA operation
2675* agParam3: Pointer to pass context handle for IOCTL DMA operation
2676*
2677* Return:
2678*
2679* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2680* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2681* Detail error code is function specific and
2682* defined by the specific IOCTL function.
2683* IOCTL_CALL_PENDING This request is asynchronous and completed
2684* in some other context.
2685* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2686*
2687*
2688*****************************************************************************/
2692 tiIOCTLPayload_t *agIOCTLPayload,
2693 void *agParam1,
2694 void *agParam2,
2695 void *agParam3
2696 )
2697{
2698 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2699 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2700 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2701 tdIoErrorStatisticPayload_t *pIoErrorPayload = agNULL;
2703
2704 pIoErrorPayload = (tdIoErrorStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
2705
2706 tdsaAllShared->tdFWControlEx.buffer = agNULL;
2707 tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
2708 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2709 tdsaAllShared->tdFWControlEx.len = 0;
2710 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2711 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2712 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2713 tdsaAllShared->tdFWControlEx.inProgress = 0;
2714
2715 saGetIOErrorStats(agRoot, agNULL, pIoErrorPayload->flag);
2716
2717 return status;
2718}
2719
2720/*****************************************************************************
2721*
2722* tdsaIoEventStatisticGetIoctl
2723*
2724* Purpose: This routine is called to get the IO event statistic.
2725*
2726* Parameters:
2727* tiRoot: Pointer to driver instance
2728* agIOCTLPayload: Pointer to the IOCTL payload.
2729* agParam1: Pointer to pass context handle for IOCTL DMA operation
2730* agParam2: Pointer to pass context handle for IOCTL DMA operation
2731* agParam3: Pointer to pass context handle for IOCTL DMA operation
2732*
2733* Return:
2734*
2735* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2736* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2737* Detail error code is function specific and
2738* defined by the specific IOCTL function.
2739* IOCTL_CALL_PENDING This request is asynchronous and completed
2740* in some other context.
2741* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2742*
2743*
2744*****************************************************************************/
2748 tiIOCTLPayload_t *agIOCTLPayload,
2749 void *agParam1,
2750 void *agParam2,
2751 void *agParam3
2752 )
2753{
2754 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2755 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2756 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2757 tdIoEventStatisticPayload_t *pIoEventPayload = agNULL;
2759
2760 pIoEventPayload = (tdIoEventStatisticPayload_t*)agIOCTLPayload->FunctionSpecificArea;
2761
2762 tdsaAllShared->tdFWControlEx.buffer = agNULL;
2763 tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
2764 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2765 tdsaAllShared->tdFWControlEx.len = 0;
2766 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2767 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2768 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2769 tdsaAllShared->tdFWControlEx.inProgress = 0;
2770
2771 saGetIOEventStats(agRoot, agNULL, pIoEventPayload->flag);
2772
2773 return status;
2774}
2775
2776/*****************************************************************************
2777*
2778* tdsaRegisterIoctl
2779*
2780* Purpose: This routine is called to get Forensic Data.
2781*
2782* Parameters:
2783* tiRoot: Pointer to driver instance
2784* agIOCTLPayload: Pointer to the IOCTL payload.
2785* agParam1: Pointer to pass context handle for IOCTL DMA operation
2786* agParam2: Pointer to pass context handle for IOCTL DMA operation
2787* agParam3: Pointer to pass context handle for IOCTL DMA operation
2788*
2789* Return:
2790*
2791* IOCTL_CALL_SUCCESS The requested operation completed successfully.
2792* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
2793* Detail error code is function specific and
2794* defined by the specific IOCTL function.
2795* IOCTL_CALL_PENDING This request is asynchronous and completed
2796* in some other context.
2797* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
2798*
2799*
2800*****************************************************************************/
2804 tiIOCTLPayload_t *agIOCTLPayload,
2805 void *agParam1,
2806 void *agParam2,
2807 void *agParam3
2808 )
2809{
2810 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2811 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2812// agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2813 tdRegisterPayload_t *pRegisterPayload = agNULL;
2815
2816 pRegisterPayload = (tdRegisterPayload_t*)agIOCTLPayload->FunctionSpecificArea;
2817
2818 tdsaAllShared->tdFWControlEx.buffer = agNULL;
2819 tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
2820 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2821 tdsaAllShared->tdFWControlEx.len = 0;
2822 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2823 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2824 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2825 tdsaAllShared->tdFWControlEx.inProgress = 0;
2826
2827 TI_DBG1(("tdsaRegisterIoctl: Flag %d RegAddr 0x%x RegValue 0x%x\n",
2828 pRegisterPayload->flag, pRegisterPayload->RegAddr, pRegisterPayload->RegValue));
2829
2830 if (pRegisterPayload->flag)
2831 {
2832 /* set register */
2833 ostiChipWriteBit32Ext(tiRoot, 0, pRegisterPayload->RegAddr, pRegisterPayload->RegValue);
2834 }
2835 else
2836 {
2837 /* get register */
2838 pRegisterPayload->RegValue = ostiChipReadBit32Ext(tiRoot, 0, pRegisterPayload->RegAddr);
2839 }
2840 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
2841 return status;
2842}
2843
2847 agsaPhyGeneralState_t *PhyData
2848 )
2849{
2850 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2851 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2852 agsaRoot_t *agRoot = &(tdsaAllShared->agRootNonInt);
2853// agsaLLRoot_t *saRoot = (agsaLLRoot_t *)(agRoot->sdkData);
2854// bit8 totalValidPhys;
2856 bit32 i = 0;
2857 agsaControllerInfo_t ControllerInfo;
2858 saGetControllerInfo(agRoot,&ControllerInfo);
2859
2860 TI_DBG3(("tdsaGetPhyGeneralStatusIoctl: start\n"));
2861 do
2862 {
2863 if(tIsSPC(agRoot)||tIsSPCHIL(agRoot))
2864 {
2866 break;
2867 }
2868
2869 PhyData->Reserved1 = ControllerInfo.phyCount;
2870 for(i=0;i<PhyData->Reserved1;i++)
2871 {
2873 if(status == AGSA_RC_FAILURE)
2874 {
2875 break;
2876 }
2877 }
2878 }while(0);
2879 TI_DBG3(("tdsaGetPhyGeneralStatusIoctl: End\n"));
2880 return status;
2881}
2882/*****************************************************************************
2883*
2884* ostiGetPhyGeneralStatusRsp
2885*
2886* Purpose: This routine is called when a PhyStatus IOCTL response is received.
2887*
2888* Parameters:
2889* tiRoot: Pointer to driver instance
2890* agsaSASPhyGeneralStatusPage_t: Status of the phy.
2891* bit32: phyID
2892*
2893* Return: none
2894*
2895*
2896*****************************************************************************/
2900 bit32 phyID
2901 )
2902{
2903
2904 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2905 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2906 tiIOCTLPayload_t *agIoctlPayload = agNULL;
2907 agsaPhyGeneralState_t *pSetPhyStatusRes = agNULL;
2908
2909
2910 TI_DBG1(("ostiGetPhyGeneralStatusRsp: start\n"));
2911
2912 if (tdsaAllShared->tdFWControlEx.inProgress)
2913 {
2914 agIoctlPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
2915 if ((agIoctlPayload) && (PMC_IOCTL_SIGNATURE == agIoctlPayload->Signature)&&
2916 (IOCTL_MJ_PHY_GENERAL_STATUS == agIoctlPayload->MajorFunction))
2917 {
2918 pSetPhyStatusRes = (agsaPhyGeneralState_t*) &agIoctlPayload->FunctionSpecificArea[0];
2919 osti_memcpy(&pSetPhyStatusRes->PhyGenData[phyID], GenStatus, sizeof(agsaSASPhyGeneralStatusPage_t));
2920 pSetPhyStatusRes->Reserved2++;
2921 if(pSetPhyStatusRes->Reserved1 == pSetPhyStatusRes->Reserved2)
2922 {
2923 tdsaAllShared->tdFWControlEx.payload = NULL;
2924 ostiIOCTLSetSignal(tiRoot, tdsaAllShared->tdFWControlEx.param1,
2925 tdsaAllShared->tdFWControlEx.param2, agNULL);
2926 tdsaAllShared->tdFWControlEx.inProgress = 0;
2927 agIoctlPayload->Status = IOCTL_ERR_STATUS_OK;
2928
2929 }
2930 }
2931 }
2932
2933 TI_DBG1(("ostiGetPhyGeneralStatusRsp: end\n"));
2934}
2935
2936
2940 tiIOCTLPayload_t *agIOCTLPayload,
2941 void *agParam1,
2942 void *agParam2,
2943 void *agParam3
2944 )
2945{
2946 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2947 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
2948 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
2949 void *buffer = agNULL;
2950 void *osMemHandle = agNULL;
2952 bit32 retcode = AGSA_RC_FAILURE;
2953 bit32 RequestLength= agIOCTLPayload->Length;
2954 bit32 bufAddrUpper = 0;
2955 bit32 bufAddrLower = 0;
2956
2957 tdPhyCount_t *PhyBlob = (tdPhyCount_t*)&agIOCTLPayload->FunctionSpecificArea[0];
2958
2959
2961 &osMemHandle,
2962 (void **)&buffer,
2963 &bufAddrUpper,
2964 &bufAddrLower,
2965 RequestLength,
2966 RequestLength,
2967 agTRUE))
2968 return IOCTL_CALL_FAIL;
2969
2970
2971 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
2972 tdsaAllShared->tdFWControlEx.virtAddr = buffer;
2973 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
2974 tdsaAllShared->tdFWControlEx.len = 32;
2975 tdsaAllShared->tdFWControlEx.param1 = agParam1;
2976 tdsaAllShared->tdFWControlEx.param2 = agParam2;
2977 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
2978 tdsaAllShared->tdFWControlEx.inProgress = 1;
2979
2980 TI_DBG1(("tdsaPhyProfileIoctl: MinorFunction %d\n",agIOCTLPayload->MinorFunction));
2981// PhyBlob->Phy |= 0x100;
2982
2983 if( tiIS_SPC(agRoot) )
2984 {
2985 TI_DBG1(("tdsaPhyProfileIoctl: SPC operation 0x%x PHY %d\n",agIOCTLPayload->MinorFunction,PhyBlob->Phy));
2986 retcode = saLocalPhyControl(agRoot,agNULL,0 ,PhyBlob->Phy ,agIOCTLPayload->MinorFunction , agNULL);
2987 if(retcode == AGSA_RC_SUCCESS)
2988 {
2990 }
2991 }
2992 else
2993 {
2994 TI_DBG1(("tdsaPhyProfileIoctl: SPCv operation 0x%x PHY %d\n",agIOCTLPayload->MinorFunction,PhyBlob->Phy));
2995 retcode = saGetPhyProfile( agRoot,agNULL,0,agIOCTLPayload->MinorFunction , PhyBlob->Phy);
2996
2997 if(retcode == AGSA_RC_SUCCESS)
2998 {
3000 }
3001
3002 }
3003
3004 TI_DBG2(("tdsaPhyProfileIoctl: after\n"));
3005
3006
3007 return status;
3008}
3009
3010/*****************************************************************************
3011*
3012* tdsaForensicDataGetIoctl
3013*
3014* Purpose: This routine is called to get Forensic Data.
3015*
3016* Parameters:
3017* tiRoot: Pointer to driver instance
3018* agIOCTLPayload: Pointer to the IOCTL payload.
3019* agParam1: Pointer to pass context handle for IOCTL DMA operation
3020* agParam2: Pointer to pass context handle for IOCTL DMA operation
3021* agParam3: Pointer to pass context handle for IOCTL DMA operation
3022*
3023* Return:
3024*
3025* IOCTL_CALL_SUCCESS The requested operation completed successfully.
3026* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
3027* Detail error code is function specific and
3028* defined by the specific IOCTL function.
3029* IOCTL_CALL_PENDING This request is asynchronous and completed
3030* in some other context.
3031* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
3032*
3033*
3034*****************************************************************************/
3038 tiIOCTLPayload_t *agIOCTLPayload,
3039 void *agParam1,
3040 void *agParam2,
3041 void *agParam3
3042 )
3043{
3044 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3045 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3046 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3047 tdForensicDataPayload_t *pForensicDataPayload = agNULL;
3048 agsaForensicData_t ForensicData;
3050
3051 pForensicDataPayload = (tdForensicDataPayload_t*)agIOCTLPayload->FunctionSpecificArea;
3052
3053 tdsaAllShared->tdFWControlEx.buffer = agNULL;
3054 tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
3055 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
3056 tdsaAllShared->tdFWControlEx.len = 0;
3057 tdsaAllShared->tdFWControlEx.param1 = agParam1;
3058 tdsaAllShared->tdFWControlEx.param2 = agParam2;
3059 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
3060 tdsaAllShared->tdFWControlEx.inProgress = 0;
3061
3062 osti_memset(&ForensicData, 0, sizeof(agsaForensicData_t));
3063
3064 ForensicData.DataType = pForensicDataPayload->DataType;
3065
3066 switch (ForensicData.DataType)
3067 {
3070 ForensicData.BufferType.dataBuf.directLen = pForensicDataPayload->dataBuffer.directLen;
3071 ForensicData.BufferType.dataBuf.directOffset = pForensicDataPayload->dataBuffer.directOffset;
3072 ForensicData.BufferType.dataBuf.readLen = pForensicDataPayload->dataBuffer.readLen;
3073 ForensicData.BufferType.dataBuf.directData = (void*)pForensicDataPayload->dataBuffer.directData;
3074 break;
3076 ForensicData.BufferType.gsmBuf.directLen = pForensicDataPayload->gsmBuffer.directLen;
3077 ForensicData.BufferType.gsmBuf.directOffset = pForensicDataPayload->gsmBuffer.directOffset;
3078 ForensicData.BufferType.dataBuf.readLen = pForensicDataPayload->gsmBuffer.readLen;
3079 ForensicData.BufferType.gsmBuf.directData = (void*)pForensicDataPayload->gsmBuffer.directData;
3080 break;
3081
3083 ForensicData.BufferType.queueBuf.directLen = pForensicDataPayload->queueBuffer.directLen;
3084 //ForensicData.BufferType.queueBuf.queueType = pForensicDataPayload->queueBuffer.queueType;
3086 ForensicData.BufferType.queueBuf.queueIndex = pForensicDataPayload->queueBuffer.queueIndex;
3087 ForensicData.BufferType.queueBuf.directData = (void*)pForensicDataPayload->queueBuffer.directData;
3088 break;
3090 ForensicData.BufferType.queueBuf.directLen = pForensicDataPayload->queueBuffer.directLen;
3092 ForensicData.BufferType.queueBuf.queueIndex = pForensicDataPayload->queueBuffer.queueIndex;
3093 ForensicData.BufferType.queueBuf.directData = (void*)pForensicDataPayload->queueBuffer.directData;
3094 break;
3095
3096 default:
3097 TI_DBG1(("tdsaGetForensicDataIoctl: forensic data type error %d\n", pForensicDataPayload->DataType));
3099 return status;
3100 }
3101
3102 if ( saGetForensicData(agRoot, agNULL, &ForensicData) != AGSA_RC_SUCCESS )
3103 {
3105 }
3106
3107 return status;
3108}
3109
3113 tiIOCTLPayload_t *agIOCTLPayload,
3114 void *agParam1,
3115 void *agParam2,
3116 void *agParam3
3117 )
3118{
3119 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3120 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3121 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3122 void *reqBuffer = agNULL;
3123 void *respBuffer = agNULL;
3124 void *osMemHandle = agNULL;
3126// bit32 Offset = 0;
3127// bit32 RequestLength = 0;
3128 bit32 ostiMemoryStatus = 0;
3130
3131 tiDeviceHandle_t *devHandle;
3132 agsaSMPFrame_t agSMPFrame;
3133 tdsaDeviceData_t *oneDeviceData = agNULL;
3134 bit32 i;
3135
3136 TI_DBG2(("tdsaSendSMPIoctl: start\n"));
3137
3139
3140 for(i=0;i<8;i++)
3141 TI_DBG2(("SAS Address[%d]:%x",i,smp_pass_through_req->exp_sas_addr[i]));
3142 TI_DBG2(("SAS Request Length:%d",smp_pass_through_req->smp_req_len));
3143 TI_DBG2(("SAS Response Length:%d",smp_pass_through_req->smp_resp_len));
3144 for(i=0;i<smp_pass_through_req->smp_req_len;i++)
3145 TI_DBG2(("SAS request + %d:%x",i,smp_pass_through_req->smp_req_resp[i]));
3146
3148 if(devHandle == NULL)
3149 {
3151 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
3152 return status;
3153 }
3154
3155
3156
3157 //agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
3158 agIOCTLPayload->Status = IOCTL_ERR_STATUS_NOT_RESPONDING;
3159
3160
3161
3162 if((ostiMemoryStatus != tiSuccess) && (reqBuffer == agNULL ))
3163 return IOCTL_CALL_FAIL;
3164
3165
3166 tdsaAllShared->tdFWControlEx.param3 = osMemHandle;
3167
3168
3172
3173 if(!(smp_pass_through_req->smp_req_len - 8) && !tiIS_SPC(agRoot))
3174 {
3175 agSMPFrame.flag = 1; // Direct request Indirect response
3176 agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 4; //Exclude header
3177 }
3178 else
3179 {
3180
3181 agSMPFrame.flag = 3; //Indirect request and Indirect response
3182 ostiMemoryStatus = ostiAllocMemory( tiRoot,
3183 &osMemHandle,
3184 (void **)&reqBuffer,
3185 &(agSMPFrame.outFrameAddrUpper32),
3186 &(agSMPFrame.outFrameAddrLower32),
3187 8,
3189 agFALSE);
3190 tdsaAllShared->tdFWControlEx.param3 = osMemHandle;
3191 if(tiIS_SPC(agRoot))
3192 {
3193 agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 4; //Exclude crc
3195 }
3196 else
3197 {
3198 agSMPFrame.outFrameLen = smp_pass_through_req->smp_req_len - 8; //Exclude header and crc
3199 osti_memcpy((void *)reqBuffer, (void *)(smp_pass_through_req->smp_req_resp + 4), smp_pass_through_req->smp_req_len - 4);
3200 }
3201 }
3202
3203 ostiMemoryStatus = ostiAllocMemory( tiRoot,
3204 &osMemHandle,
3205 (void **)&respBuffer,
3206 &(agSMPFrame.inFrameAddrUpper32),
3207 &(agSMPFrame.inFrameAddrLower32),
3208 8,
3210 agFALSE);
3211 if((ostiMemoryStatus != tiSuccess) && (respBuffer == agNULL ))
3212 return IOCTL_CALL_FAIL;
3213
3214
3215 osti_memset((void *)respBuffer, 0, smp_pass_through_req->smp_resp_len);
3216
3217 // use FW control place in shared structure to keep the neccesary information
3218 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
3219 tdsaAllShared->tdFWControlEx.virtAddr = respBuffer;
3220 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)smp_pass_through_req->smp_req_resp + smp_pass_through_req->smp_req_len;
3221 tdsaAllShared->tdFWControlEx.len = smp_pass_through_req->smp_resp_len;
3222 tdsaAllShared->tdFWControlEx.param1 = agParam1;
3223 tdsaAllShared->tdFWControlEx.param2 = agParam2;
3224 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
3225 tdsaAllShared->tdFWControlEx.inProgress = 1;
3227
3228 oneDeviceData = (tdsaDeviceData_t *)devHandle->tdData;
3229 if(saSendSMPIoctl(agRoot, oneDeviceData->agDevHandle, 0, &agSMPFrame, &ossaSMPIoctlCompleted) != AGSA_RC_SUCCESS)
3230 {
3232 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
3233 }
3234 return status;
3235}
3236
3240 )
3241{
3242 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3243 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3244 tiIOCTLPayload_t *agIOCTLPayload;
3245
3246 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
3247 agIOCTLPayload->Status = (bit16)status;
3248
3249 TI_DBG1(("ostiSendSMPIOCTLRsp: start, status = %d\n", status));
3250
3251// if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
3252// {
3253 osti_memcpy((void *)(tdsaAllShared->tdFWControlEx.usrAddr),
3254 (void *)(tdsaAllShared->tdFWControlEx.virtAddr),
3255 tdsaAllShared->tdFWControlEx.len);
3256// }
3258 tdsaAllShared->tdFWControlEx.buffer,
3259 tdsaAllShared->tdFWControlEx.len);
3261 tdsaAllShared->tdFWControlEx.param3,
3262 tdsaAllShared->tdFWControlEx.len);
3263 //if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
3264// {
3266 tdsaAllShared->tdFWControlEx.param1,
3267 tdsaAllShared->tdFWControlEx.param2,
3268 NULL);
3269// }
3270}
3271
3272
3273
3274
3275/*****************************************************************************
3276*
3277* tdsaSendBISTIoctl
3278*
3279* Purpose: This routine is called to get Forensic Data.
3280*
3281* Parameters:
3282* tiRoot: Pointer to driver instance
3283* agIOCTLPayload: Pointer to the IOCTL payload.
3284* agParam1: Pointer to pass context handle for IOCTL DMA operation
3285* agParam2: Pointer to pass context handle for IOCTL DMA operation
3286* agParam3: Pointer to pass context handle for IOCTL DMA operation
3287*
3288* Return:
3289*
3290* IOCTL_CALL_SUCCESS The requested operation completed successfully.
3291* IOCTL_CALL_FAIL Fail to complete the IOCTL request.
3292* Detail error code is function specific and
3293* defined by the specific IOCTL function.
3294* IOCTL_CALL_PENDING This request is asynchronous and completed
3295* in some other context.
3296* IOCTL_CALL_INVALID_CODE This IOCTL function is not recognized.
3297*
3298*
3299*****************************************************************************/
3303 tiIOCTLPayload_t *agIOCTLPayload,
3304 void *agParam1,
3305 void *agParam2,
3306 void *agParam3
3307 )
3308{
3309 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3310 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3311 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3312 tdBistPayload_t *pBistPayload;
3313// bit32 length = 0;
3314// bit32 status = IOCTL_CALL_SUCCESS;
3316
3317 pBistPayload = (tdBistPayload_t*)agIOCTLPayload->FunctionSpecificArea;
3318
3319 tdsaAllShared->tdFWControlEx.buffer = agNULL;
3320 tdsaAllShared->tdFWControlEx.virtAddr = agNULL;
3321 tdsaAllShared->tdFWControlEx.usrAddr = (bit8*)&agIOCTLPayload->FunctionSpecificArea[0];
3322 tdsaAllShared->tdFWControlEx.len = 0;
3323 tdsaAllShared->tdFWControlEx.param1 = agParam1;
3324 tdsaAllShared->tdFWControlEx.param2 = agParam2;
3325 tdsaAllShared->tdFWControlEx.payload = agIOCTLPayload;
3326 tdsaAllShared->tdFWControlEx.inProgress = 0;
3327
3328 TI_DBG1(("tdsaSendBISTIoctl: Type %d Length %d Data %p\n",
3329 pBistPayload->testType,
3330 pBistPayload->testLength,
3331 pBistPayload->testData ));
3332
3333
3334 // pBistPayload->testtype = AGSA_BIST_TEST;
3335
3336 if( pBistPayload->testType == AGSA_BIST_TEST)
3337 {
3338 if( pBistPayload->testLength != sizeof(agsaEncryptSelfTestBitMap_t))
3339 {
3340 return status;
3341 }
3342 }
3343 else if( pBistPayload->testType == AGSA_SHA_TEST)
3344 {
3345 if( pBistPayload->testLength != sizeof(agsaEncryptSHATestDescriptor_t) )
3346 {
3347 return status;
3348 }
3349 }
3350 else if( pBistPayload->testType == AGSA_HMAC_TEST )
3351 {
3352 if( pBistPayload->testLength != sizeof(agsaEncryptHMACTestDescriptor_t))
3353 {
3354 return status;
3355 }
3356 }
3357
3358/*
3359GLOBAL bit32 saEncryptSelftestExecute(
3360 agsaRoot_t *agRoot,
3361 agsaContext_t *agContext,
3362 bit32 queueNum,
3363 bit32 type,
3364 bit32 length,
3365 void *TestDescriptor);
3366
3367*/
3368 if ( saEncryptSelftestExecute(agRoot,
3369 agNULL,
3370 0,
3371 pBistPayload->testType,
3372 pBistPayload->testLength,
3373 pBistPayload->testData ) != AGSA_RC_SUCCESS )
3374 {
3376 }
3377
3378 return status;
3379}
3380
3381
3384 tiIOCTLPayload_t *agIOCTLPayload,
3385 void *agParam1,
3386 void *agParam2,
3387 unsigned long resetType
3388 )
3389{
3390 bit32 status;
3392#if !(defined(__FreeBSD__))
3393 status = ostiSendResetDeviceIoctl(tiRoot, agParam2, tmf_req->pathId, tmf_req->targetId, tmf_req->lun, resetType);
3394#endif
3395 TI_DBG3(("Status returned from ostiSendResetDeviceIoctl is %d\n",status));
3397 {
3398 agIOCTLPayload->Status = status;
3399 return status;
3400 }
3402 return status;
3403}
3404
3405
3406#ifdef VPD_TESTING
3407/* temporary to test saSetVPDCommand() and saGetVPDCommand */
3409tdsaVPDSet(
3411 )
3412{
3413 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3414 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3415 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3417 agsaVPD_t VPDInfo;
3418 bit32 ret = AGSA_RC_SUCCESS;
3419
3420 bit32 bufAddrUpper = 0;
3421 bit32 bufAddrLower = 0;
3422 tdVPDControl_t *VPDControl;
3423
3424 void *osMemHandle = agNULL;
3425 void *buffer;
3426 bit32 timeCount=0;
3427 bit8 ioctlErr=0;
3428 bit8 VPDPayload[32];
3429 bit8 i;
3430 TI_DBG2(("tdsaVPDSet: start\n"));
3431
3432 for(i=0;i<sizeof(VPDPayload);i++)
3433 {
3434 VPDPayload[i] = i;
3435 }
3437 &osMemHandle,
3438 (void **)&buffer,
3439 &bufAddrUpper,
3440 &bufAddrLower,
3441 8,
3442 sizeof(VPDPayload),
3443 agFALSE))
3444 {
3445 return tiError;
3446 }
3447 osti_memcpy((void *)buffer,
3448 VPDPayload,
3449 sizeof(VPDPayload));
3450
3451
3452 osti_memset(&VPDInfo, 0, sizeof(agsaVPD_t));
3453#ifdef NOT_YET /* direct mode worked */
3454 /* For now, only direct mode */
3455 VPDInfo.indirectMode = 0; /* direct mode */
3456 VPDInfo.VPDDevice = 1; /* SEEPROM-1 */
3457 VPDInfo.directLen = (bit8)sizeof(VPDPayload);
3458 VPDInfo.VPDOffset = 0;
3459 VPDInfo.directData = buffer;
3460 VPDInfo.indirectAddrUpper32 = bufAddrUpper;
3461 VPDInfo.indirectAddrLower32 = bufAddrLower;
3462 VPDInfo.indirectLen = sizeof(VPDPayload);
3463#endif
3464
3465 /* indirect mode */
3466 VPDInfo.indirectMode = 1; /* indirect mode */
3467 VPDInfo.VPDDevice = 1; /* SEEPROM-1 */
3468 VPDInfo.directLen = 0;
3469 VPDInfo.VPDOffset = 0;
3470 VPDInfo.directData = agNULL;
3471 VPDInfo.indirectAddrUpper32 = bufAddrUpper;
3472 VPDInfo.indirectAddrLower32 = bufAddrLower;
3473 VPDInfo.indirectLen = sizeof(VPDPayload);
3474
3475 tdsaAllShared->tdFWControlEx.buffer = osMemHandle;
3476 tdsaAllShared->tdFWControlEx.param1 = agParam1;
3477 tdsaAllShared->tdFWControlEx.param2 = agParam2;
3478
3479 /* for testing only */
3480 tdsaAllShared->addrUpper = bufAddrUpper;
3481 tdsaAllShared->addrLower = bufAddrLower;
3482
3483 ret = saSetVPDCommand(agRoot, agNULL, 0, &VPDInfo);
3484
3485 if (ret == AGSA_RC_SUCCESS)
3486 {
3487 status = tiSuccess;
3488 }
3489 else
3490 {
3491 status = tiError;
3492 }
3493
3494 ostiFreeMemory(tiRoot, osMemHandle, sizeof(VPDPayload));
3495 return status;
3496}
3497
3498/* temporary to test saSetVPDCommand() and saGetVPDCommand */
3500tdsaVPDGet(tiRoot_t *tiRoot)
3501{
3502 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3503 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3504 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3506 agsaVPD_t VPDInfo;
3507 bit32 ret = AGSA_RC_SUCCESS;
3508
3509
3510 TI_DBG2(("tdsaVPDGet: start\n"));
3511
3512 osti_memset(&VPDInfo, 0, sizeof(agsaVPD_t));
3513
3514 /* direct mode worked */
3515 VPDInfo.indirectMode = 0; /* direct mode */
3516 VPDInfo.VPDDevice = 1; /* SEEPROM-1*/
3517 VPDInfo.directLen = 32;
3518 VPDInfo.VPDOffset = 0;
3519 VPDInfo.directData = agNULL;
3520 VPDInfo.indirectAddrUpper32 = 0;
3521 VPDInfo.indirectAddrLower32 = 0;
3522 VPDInfo.indirectLen = 0;
3523
3524
3525#ifdef NOT_YET /* worked; can't read VPD in ossaGetVPDResponseCB() because of indirect */
3526 VPDInfo.indirectMode = 1; /* direct mode */
3527 VPDInfo.VPDDevice = 1; /* SEEPROM-1*/
3528 VPDInfo.directLen = 0;
3529 VPDInfo.VPDOffset = 0;
3530 VPDInfo.directData = agNULL;
3531 VPDInfo.indirectAddrUpper32 = tdsaAllShared->addrUpper;
3532 VPDInfo.indirectAddrLower32 = tdsaAllShared->addrLower;
3533 VPDInfo.indirectLen = 32;
3534#endif
3535 ret = saGetVPDCommand(agRoot, agNULL, 0, &VPDInfo);
3536
3537 if (ret == AGSA_RC_SUCCESS)
3538 {
3539 status = tiSuccess;
3540 }
3541 else
3542 {
3543 status = tiError;
3544 }
3545 return status;
3546}
3547#endif
3548/*****************************************************************************
3549*
3550* tdsaGetNumOfLUNIOCTL
3551*
3552* Purpose: This routine is called to send Report LUN SSP command request.
3553*
3554* Parameters:
3555* tiRoot: Pointer to driver instance
3556* tiIOCTLPayload_t: Status of the Controller Reset.
3557* agParam1: Void pointer to device extension
3558* agParam2: Void pointer to SRB
3559* agParam3: NULL
3560*
3561* Return: status
3562*
3563*
3564*****************************************************************************/
3568 tiIOCTLPayload_t *agIOCTLPayload,
3569 void *agParam1,
3570 void *agParam2,
3571 void *agParam3
3572 )
3573{
3574 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3575 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3576 agsaRoot_t *agRoot = &(tdsaAllShared->agRootInt);
3577 tdDeviceLUNInfoIOCTL_t *pDeviceLUNInfo = agNULL;
3578 tiDeviceHandle_t *devHandle = agNULL;
3579 void *tiRequestBody = agNULL;
3582
3583 TI_DBG2(("tdsaGetNumOfLUNIOCTL: Start\n"));
3584 do
3585 {
3586 pDeviceLUNInfo = (tdDeviceLUNInfoIOCTL_t*)agIOCTLPayload->FunctionSpecificArea;
3587
3588 if (agIOCTLPayload->Length < sizeof(tdDeviceLUNInfoIOCTL_t))
3589 {
3591 break;
3592 }
3593 if(!pDeviceLUNInfo->tiDeviceHandle)
3594 {
3596 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
3597 break;
3598 }
3599 devHandle = (tiDeviceHandle_t*)pDeviceLUNInfo->tiDeviceHandle;
3600 agIOCTLPayload->Status = IOCTL_ERR_STATUS_OK;
3601
3602 status = ostiNumOfLUNIOCTLreq(tiRoot,agParam1,agParam2,&tiRequestBody,&tiIORequest);
3603
3604
3605 if(status != AGSA_RC_SUCCESS)
3606 {
3607 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
3608 break;
3609 }
3610 status = tiNumOfLunIOCTLreq(tiRoot,tiIORequest,devHandle,tiRequestBody,agIOCTLPayload,agParam1,agParam2);
3611
3612 if(status != AGSA_RC_SUCCESS)
3613 {
3614 agIOCTLPayload->Status = IOCTL_ERR_STATUS_INTERNAL_ERROR;
3615 break;
3616 }
3617// ostiIOCTLWaitForSignal (tiRoot, agParam1, agParam2, agParam3);
3618
3619 }while(0);
3620 TI_DBG2(("tdsaGetNumOfLUNIOCTL: End\n"));
3621 return status;
3622}
3623
3624
3625/*****************************************************************************
3626*
3627* ostiNumOfLUNIOCTLRsp
3628*
3629* Purpose: This routine is called when a Report LUN SSP command response id recieved.
3630*
3631* Parameters:
3632* tiRoot: Pointer to driver instance
3633* bit32 status
3634*
3635* Return: none
3636*
3637*
3638*****************************************************************************/
3642 )
3643{
3644 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3645 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
3646 tiIOCTLPayload_t *agIOCTLPayload;
3647 tdDeviceLUNInfoIOCTL_t *pDeviceLUNInfo = NULL;
3648 bit32 count = 0;
3649 bit32 numOfLUN =0;
3650
3651 TI_DBG1(("ostiNumOfLUNIOCTLRsp: start, status = %d\n", status));
3652
3653 if(tdsaAllShared->tdFWControlEx.inProgress == 1)
3654 {
3655 agIOCTLPayload = (tiIOCTLPayload_t *)(tdsaAllShared->tdFWControlEx.payload);
3656 if ((agIOCTLPayload) && (PMC_IOCTL_SIGNATURE == agIOCTLPayload->Signature)&&
3657 (IOCTL_MJ_GET_DEVICE_LUN == agIOCTLPayload->MajorFunction))
3658 {
3659 agIOCTLPayload->Status = (bit16)status;
3660 pDeviceLUNInfo = (tdDeviceLUNInfoIOCTL_t*)agIOCTLPayload->FunctionSpecificArea;
3661 numOfLUN = ((tdsaAllShared->tdFWControlEx.virtAddr[0] << 24)|(tdsaAllShared->tdFWControlEx.virtAddr[1] << 16)|\
3662 (tdsaAllShared->tdFWControlEx.virtAddr[2] << 8)|(tdsaAllShared->tdFWControlEx.virtAddr[3]));
3663 numOfLUN = numOfLUN/8;
3664 pDeviceLUNInfo->numOfLun = numOfLUN;
3665// ostiFreeMemory(tiRoot,
3666// tdsaAllShared->tdFWControlEx.virtAddr,
3667// tdsaAllShared->tdFWControlEx.len);
3668 // if(tdsaAllShared->tdFWControlEx.param1 != agNULL)
3669 // {
3671 tdsaAllShared->tdFWControlEx.param1,
3672 tdsaAllShared->tdFWControlEx.param2,
3673 NULL);
3674 tdsaAllShared->tdFWControlEx.payload = NULL;
3675 // }
3676
3677 tdsaAllShared->tdFWControlEx.inProgress = 0;
3678 }
3679 }
3680 TI_DBG1(("ostiNumOfLUNIOCTLRsp: End\n"));
3681}
3682
#define SMP_WRITE_GPIO_REGISTER
Definition: dmdefs.h:158
#define MIN(a, b)
MIN macro.
Definition: dmdefs.h:88
#define SMP_READ_GPIO_REGISTER
Definition: dmdefs.h:153
#define SMP_REQUEST
Definition: dmdefs.h:1064
bit32 status
Definition: encrypt_ioctl.h:12
U32 ostiChipConfigReadBit32(tiRoot_t *ptiRoot, U32 chipConfigOffset)
Definition: lxosapi.c:155
osGLOBAL U32 ostiFreeMemory(tiRoot_t *ptiRoot, void *osMemHandle, U32 allocLength)
Definition: lxosapi.c:320
osGLOBAL U32 ostiAllocMemory(tiRoot_t *ptiRoot, void **osMemHandle, void **agVirtAddr, U32 *agPhysUpper32, U32 *agPhysLower32, U32 alignment, U32 allocLength, agBOOLEAN isCacheable)
Definition: lxosapi.c:51
void ostiChipWriteBit32Ext(tiRoot_t *ptiRoot, U32 busBaseNumber, U32 chipOffset, U32 aData)
Definition: lxosapi.c:255
osGLOBAL void ostiIOCTLSetSignal(tiRoot_t *ptiRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:541
U32 ostiChipReadBit32Ext(tiRoot_t *ptiRoot, U32 busBaseNumber, U32 chipOffset)
Definition: lxosapi.c:232
osGLOBAL void ostiIOCTLComplete(tiRoot_t *ptiRoot, void *agParam1, void *agParam2, void *agParam3)
Definition: lxosapi.c:556
The file defines the MPI constants and structures.
The file defines the debug constants and structures.
#define smTraceGetInfo(R, P)
Definition: mpidebug.h:268
#define smResetTraceBuffer(agRoot)
Definition: mpidebug.h:237
#define smTraceSetMask(R, P)
Definition: mpidebug.h:279
osGLOBAL bit32 ostiNumOfLUNIOCTLreq(tiRoot_t *root, void *param1, void *param2, void **tiRequestBody, tiIORequest_t **tiIORequest)
Definition: osapi.c:810
osGLOBAL tiDeviceHandle_t * ostiMapToDevHandle(tiRoot_t *root, bit8 pathId, bit8 targetId, bit8 LUN)
Definition: osapi.c:542
osGLOBAL tiDeviceHandle_t * ostiGetDevHandleFromSasAddr(tiRoot_t *root, unsigned char *sas_addr)
Definition: osapi.c:364
#define OS_ASSERT(expr, message)
Definition: osdebug.h:56
#define osti_memset(s, c, n)
Definition: osstring.h:65
#define osti_memcpy(des, src, n)
Definition: osstring.h:64
osGLOBAL bit32 ostiSendResetDeviceIoctl(tiRoot_t *root, void *pccb, bit8 pathId, bit8 targetId, bit8 lun, unsigned long resetType)
unsigned short bit16
Definition: ostypes.h:98
#define NULL
Definition: ostypes.h:142
#define osGLOBAL
Definition: ostypes.h:147
#define agNULL
Definition: ostypes.h:151
#define osti_sprintf
Definition: ostypes.h:168
unsigned int bit32
Definition: ostypes.h:99
#define agFALSE
Definition: ostypes.h:150
#define SUCCESS
Definition: ostypes.h:138
#define agTRUE
Definition: ostypes.h:149
#define AGTIAPI_DRIVER_VERSION
Definition: ostypes.h:157
unsigned char bit8
Definition: ostypes.h:97
The file defines the constants, data structure, and functions defined by LL API.
#define AGSA_SGPIO_CONFIG_REG
Definition: sa.h:1593
#define AGSA_SHA_TEST
Definition: sa.h:3269
#define AGSA_SGPIO_GENERAL_PURPOSE_TRANSMIT_REG
Definition: sa.h:1597
#define AGSA_BIST_TEST
Definition: sa.h:3267
#define AGSA_SAS_PHY_GENERAL_STATUS_PAGE
Definition: sa.h:847
#define AGSA_INTERRUPT_CONFIGURATION_PAGE
Definition: sa.h:3153
#define AGSA_RC_FAILURE
Definition: sa.h:781
#define AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE
Definition: sa.h:3152
#define AGSA_HMAC_TEST
Definition: sa.h:3268
#define AGSA_RC_SUCCESS
Definition: sa.h:780
The file defines the declaration of tSDK APIs.
bit32 saGetIOErrorStats(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 flag)
Definition: saioctlcmd.c:3016
bit32 saGetIOEventStats(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 flag)
Definition: saioctlcmd.c:3036
GLOBAL bit32 saGpioPinSetup(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaGpioPinSetupInfo_t *gpioPinSetupInfo)
SPC Set GPIO Pin Setup Command.
Definition: saioctlcmd.c:1477
GLOBAL bit32 saLocalPhyControl(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 phyId, bit32 phyOperation, ossaLocalPhyControlCB_t agCB)
Initiate a Local PHY control command.
Definition: saphy.c:420
GLOBAL bit32 saGetNVMDCommand(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaNVMDData_t *NVMDInfo)
SPC Get NVMD Command.
Definition: saioctlcmd.c:3292
GLOBAL bit32 saGetControllerInfo(agsaRoot_t *agRoot, agsaControllerInfo_t *controllerInfo)
SPC Get Controller Information Command.
Definition: saioctlcmd.c:714
GLOBAL bit32 saGetControllerEventLogInfo(agsaRoot_t *agRoot, agsaControllerEventLog_t *eventLogInfo)
SPC Get Controller Event Log Information Command.
Definition: saioctlcmd.c:1345
GLOBAL bit32 saGetPhyProfile(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 ppc, bit32 phyID)
Definition: saphy.c:823
GLOBAL bit32 saGpioRead(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum)
SPC GPIO Read Command.
Definition: saioctlcmd.c:1567
GLOBAL bit32 saSetNVMDCommand(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaNVMDData_t *NVMDInfo)
SPC Set NVMD Command.
Definition: saioctlcmd.c:3327
GLOBAL bit32 saGpioEventSetup(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaGpioEventSetupInfo_t *gpioEventSetupInfo)
SPC Set GPIO Event Setup Command.
Definition: saioctlcmd.c:1384
GLOBAL bit32 saGetRegisterDump(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaRegDumpInfo_t *regDumpInfo)
Initiate a GET REGISTER DUMP command.
Definition: saioctlcmd.c:3071
GLOBAL bit32 saGpioWrite(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 gpioWriteMask, bit32 gpioWriteValue)
SPC GPIO Write Command.
Definition: saioctlcmd.c:1657
GLOBAL bit32 saEncryptSelftestExecute(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 type, bit32 length, void *TestDescriptor)
Definition: saport.c:1271
GLOBAL bit32 saGetControllerConfig(agsaRoot_t *agRoot, bit32 queueNum, bit32 modePage, bit32 flag0, bit32 flag1, agsaContext_t *agContext)
Definition: saport.c:1234
GLOBAL bit32 saSendSMPIoctl(agsaRoot_t *agRoot, agsaDevHandle_t *agDevHandle, bit32 queueNum, agsaSMPFrame_t *pSMPFrame, ossaSMPCompletedCB_t agCB)
Definition: saioctlcmd.c:3346
GLOBAL bit32 saFwFlashUpdate(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaUpdateFwFlash_t *flashUpdateInfo)
SPC FW Flash Update Command.
Definition: saioctlcmd.c:223
GLOBAL bit32 saSgpio(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaSGpioReqResponse_t *pSGpioReq)
Initiate a serial GPIO command.
Definition: saioctlcmd.c:2203
GLOBAL bit32 saSetControllerConfig(agsaRoot_t *agRoot, bit32 queueNum, bit32 modePage, bit32 length, void *buffer, agsaContext_t *agContext)
Definition: saport.c:1151
GLOBAL bit32 saGetForensicData(agsaRoot_t *agRoot, agsaContext_t *agContext, agsaForensicData_t *forensicData)
Definition: saioctlcmd.c:3004
The file defines the constants used by LL layer.
The file contains link list manipulation helper routines.
The file defines the declaration of OS APIs.
osGLOBAL void ossaSMPIoctlCompleted(agsaRoot_t *agRoot, agsaIORequest_t *agIORequest, bit32 agIOStatus, bit32 agIOInfoLen, agsaFrameHandle_t agFrameHandle)
Definition: ossacmnapi.c:3912
The file defines the internal data structure types used by LL layer.
The file defines the MPI Application Programming Interface (API)
#define IOCTL_ERROR_NO_FATAL_ERROR
Definition: spcdefs.h:377
bit8 sasAddressHi[4]
Definition: tdioctl.h:672
bit8 attached_sasAddressLo[4]
Definition: tdioctl.h:673
bit8 attached_phy
Definition: tdioctl.h:675
bit8 attached_dev_type
Definition: tdioctl.h:676
bit8 sasAddressLo[4]
Definition: tdioctl.h:671
bit8 Data[FetchBufferSIZE]
Definition: tdioctl.h:625
data structure stores OS specific and LL specific context
Definition: sa.h:1658
void * sdkData
Definition: sa.h:1660
specify the controller Event Log for the SAS/SATA LL Layer
Definition: sa.h:2484
agsaMem_t eventLog1
Definition: sa.h:2485
agsaMem_t eventLog2
Definition: sa.h:2486
describe a information for a Controller in the SAS/SATA hardware
Definition: sa.h:2045
bit8 PCILinkRate
Definition: sa.h:2065
bit32 sdkRevision
Definition: sa.h:2069
bit32 fwRevision
Definition: sa.h:2049
bit32 signature
Definition: sa.h:2046
data structure provides some information about a SATA device
Definition: sa.h:2561
bit8 sasAddressHi[4]
Definition: sa.h:2580
bit8 devType_S_Rate
Definition: sa.h:2567
bit8 sasAddressLo[4]
Definition: sa.h:2581
bit32 readLen
Definition: sa.h:1908
bit16 queueType
Definition: sa.h:1914
bit32 DataType
Definition: sa.h:1901
bit32 directLen
Definition: sa.h:1906
bit32 directOffset
Definition: sa.h:1907
bit16 queueIndex
Definition: sa.h:1915
struct agsaForensicData_t::@1::@3 queueBuf
struct agsaForensicData_t::@1::@4 dataBuf
void * directData
Definition: sa.h:1909
struct agsaForensicData_t::@1::@2 gsmBuf
union agsaForensicData_t::@1 BufferType
describe a GPIO Event Setup Infomation in the SAS/SATA hardware
Definition: sa.h:2102
bit32 gpioEventRisingEdge
Definition: sa.h:2105
bit32 gpioEventFallingEdge
Definition: sa.h:2106
describe a GPIO Pin Setup Infomation in the SAS/SATA hardware
Definition: sa.h:2115
bit32 gpioTypePart1
Definition: sa.h:2118
bit32 gpioTypePart2
Definition: sa.h:2119
bit32 gpioInputEnabled
Definition: sa.h:2117
describe a GPIO Read Infomation in the SAS/SATA hardware
Definition: sa.h:2139
bit32 gpioEventRisingEdgePart2
Definition: sa.h:2145
bit32 gpioEventLevelChangePart2
Definition: sa.h:2143
bit32 gpioEventLevelChangePart1
Definition: sa.h:2142
bit32 gpioEventFallingEdgePart1
Definition: sa.h:2146
bit32 gpioInputEnabled
Definition: sa.h:2141
bit32 gpioEventRisingEdgePart1
Definition: sa.h:2144
bit32 gpioReadValue
Definition: sa.h:2140
bit32 gpioEventFallingEdgePart2
Definition: sa.h:2147
describe a serial GPIO operation in the SAS/SATA hardware
Definition: sa.h:2128
the LLRoot
Definition: satypes.h:209
agsaPhy_t phys[AGSA_MAX_VALID_PHYS]
Definition: satypes.h:221
bit8 phyCount
Definition: satypes.h:227
void * virtPtr
Definition: sa.h:2465
bit32 totalLength
Definition: sa.h:2469
describe a NVMData for a Controller in the SAS/SATA hardware
Definition: sa.h:1936
bit32 indirectLen
Definition: sa.h:1949
bit32 indirectPayload
Definition: sa.h:1937
bit32 indirectAddrLower32
Definition: sa.h:1948
bit32 dataOffsetAddress
Definition: sa.h:1945
bit32 TWIBusNumber
Definition: sa.h:1940
bit32 TWIDevicePageSize
Definition: sa.h:1941
bit32 signature
Definition: sa.h:1950
bit32 TWIDeviceAddress
Definition: sa.h:1939
bit32 TWIDeviceAddressSize
Definition: sa.h:1942
bit32 NVMDevice
Definition: sa.h:1943
bit32 indirectAddrUpper32
Definition: sa.h:1947
GetPhyGenState_t PhyGenData[16]
Definition: tdioctl.h:664
agsaSASIdentify_t sasIdentify
Definition: satypes.h:84
bit32 status
Definition: satypes.h:86
describe a Register Dump information for a Controller in the SAS/SATA hardware
Definition: sa.h:1846
bit32 directLen
Definition: sa.h:1851
bit32 regDumpOffset
Definition: sa.h:1850
bit32 indirectAddrLower32
Definition: sa.h:1854
bit8 regDumpNum
Definition: sa.h:1848
bit32 indirectAddrUpper32
Definition: sa.h:1853
void * directData
Definition: sa.h:1852
bit32 indirectLen
Definition: sa.h:1855
bit8 regDumpSrc
Definition: sa.h:1847
bit8 sasAddressLo[4]
Definition: sa_spec.h:471
bit8 phyIdentifier
Definition: sa_spec.h:473
bit8 deviceType_addressFrameType
Definition: sa_spec.h:449
bit8 sasAddressHi[4]
Definition: sa_spec.h:470
for the SAS/SATA LL Layer
Definition: sa.h:2522
describe a serial GPIO request and response in the SAS/SATA hardware
Definition: sa.h:2156
data structure describes a SMP request or response frame to be sent on the SAS port
Definition: sa.h:3057
bit32 inFrameAddrLower32
Definition: sa.h:3070
bit32 inFrameLen
Definition: sa.h:3072
bit32 flag
Definition: sa.h:3075
void * outFrameBuf
Definition: sa.h:3058
bit32 inFrameAddrUpper32
Definition: sa.h:3068
bit32 outFrameAddrLower32
Definition: sa.h:3064
bit32 expectedRespLen
Definition: sa.h:3074
bit32 outFrameLen
Definition: sa.h:3066
bit32 outFrameAddrUpper32
Definition: sa.h:3062
bit32 len
Definition: sa.h:2758
bit32 sgLower
Definition: sa.h:2756
bit32 sgUpper
Definition: sa.h:2757
bit32 extReserved
Definition: sa.h:2759
data structure for firmware flash update saFwFlashUpdate().
Definition: sa.h:3391
bit32 currentImageLen
Definition: sa.h:3393
bit32 currentImageOffset
Definition: sa.h:3392
agsaSgl_t agSgl
Definition: sa.h:3395
bit32 totalImageLen
Definition: sa.h:3394
bit32 * pTraceIndexWrapCount
Definition: mpidebug.h:256
bit32 CurrentTraceIndexWrapCount
Definition: mpidebug.h:251
bit32 * pCurrentTraceIndex
Definition: mpidebug.h:255
bit32 testLength
Definition: tdioctl.h:584
bit32 testData[29]
Definition: tdioctl.h:585
bit32 testType
Definition: tdioctl.h:583
tdDeviceInfoIOCTL_t devInfo
Definition: tdioctl.h:353
unsigned long tiDeviceHandle
Definition: tdtypes.h:492
bit32 offset
Definition: tdioctl.h:241
bit32 size
Definition: tdioctl.h:243
bit8 buffer[1]
Definition: tdioctl.h:245
bit32 retcode
Definition: tdioctl.h:237
bit32 len
Definition: tdioctl.h:242
struct tdForensicDataPayload_s::@10::@14 dataBuffer
struct tdForensicDataPayload_s::@10::@13 queueBuffer
struct tdForensicDataPayload_s::@10::@12 gsmBuffer
tdIoErrorEventStatisticIOCTL_t IoEvent
Definition: tdioctl.h:524
bit32 BW_rx
Definition: tdioctl.h:646
bit32 phyResetProblem
Definition: tdioctl.h:651
bit32 BW_tx
Definition: tdioctl.h:645
bit32 Phy
Definition: tdioctl.h:644
bit32 runningDisparityError
Definition: tdioctl.h:648
bit32 inboundCRCError
Definition: tdioctl.h:652
bit32 InvalidDword
Definition: tdioctl.h:647
bit32 codeViolation
Definition: tdioctl.h:649
data structure for SAS/SATA context at TD layer
Definition: tdsatypes.h:199
struct itdsaIni_s * itdsaIni
Definition: tdsatypes.h:240
data structure for SAS device list This structure maintains the device as a list and information abou...
Definition: tdtypes.h:322
agsaDevHandle_t * agDevHandle
Definition: tdtypes.h:336
struct tdsaPortContext_s * tdPortContext
Definition: tdtypes.h:349
agsaDeviceInfo_t agDeviceInfo
Definition: tdtypes.h:357
the root data structure for TD layer
Definition: tdsatypes.h:362
tdsaContext_t tdsaAllShared
Definition: tdsatypes.h:364
data structure for timer request Timer requests are enqueued and dequeued using tdList_t and have a c...
Definition: tdtypes.h:122
bit32 timerRunning
Definition: tdtypes.h:130
void * tdData
Definition: titypes.h:57
bit16 MajorFunction
Definition: titypes.h:138
bit8 FunctionSpecificArea[1]
Definition: titypes.h:143
bit16 MinorFunction
Definition: titypes.h:139
bit16 Status
Definition: titypes.h:141
bit32 Reserved
Definition: titypes.h:142
bit16 Length
Definition: titypes.h:140
bit32 Signature
Definition: titypes.h:137
Definition: titypes.h:61
void * tdData
Definition: titypes.h:63
#define tIsSPC(agr)
Definition: tddefs.h:1246
#define PMC_IOCTL_SIGNATURE
Definition: tddefs.h:1044
#define tIsSPCHIL(agr)
Definition: tddefs.h:1247
@ TD_TIMER_LOCK
Definition: tddefs.h:1159
#define tiIS_SPC(agr)
Definition: tddefs.h:1265
osGLOBAL void ostiSendSMPIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:3237
osGLOBAL void ostiGetNVMDIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1640
osGLOBAL bit32 tdipFWControlIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:235
osGLOBAL bit32 tdsaPhyProfileIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2938
bit32 volatile sgpioResponseSet
Definition: tdport.c:97
osGLOBAL bit32 tdsaDeviceInfoGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2583
osGLOBAL void ostiCOMMgntIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1466
osGLOBAL bit32 tdsaRegisterIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2802
osGLOBAL bit32 tdsaIoErrorStatisticGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2690
osGLOBAL void ostiGetDeviceInfoIOCTLRsp(tiRoot_t *tiRoot, bit32 status, void *param)
Definition: tdioctl.c:1815
osGLOBAL bit32 tdsaIoEventStatisticGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2746
osGLOBAL void ostiNumOfLUNIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:3639
osGLOBAL bit32 tdsaNVMDSetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2292
osGLOBAL bit32 tdsaSendBISTIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:3301
osGLOBAL bit32 tdsaSendSMPIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:3111
osGLOBAL bit32 tdsaRegDumpGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2025
osGLOBAL bit32 tdsaGetPhyGeneralStatusIoctl(tiRoot_t *tiRoot, agsaPhyGeneralState_t *PhyData)
Definition: tdioctl.c:2845
osGLOBAL void ostiGetPhyGeneralStatusRsp(tiRoot_t *tiRoot, agsaSASPhyGeneralStatusPage_t *GenStatus, bit32 phyID)
Definition: tdioctl.c:2897
osGLOBAL void ostiGetPhyProfileIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1693
__FBSDID("$FreeBSD$")
osGLOBAL bit32 tdsaSendTMFIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, unsigned long resetType)
Definition: tdioctl.c:3383
osGLOBAL void ostiGenEventIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1764
#define agFieldOffset(baseType, fieldName)
Definition: tdioctl.c:86
osGLOBAL void ostiGetForensicDataIOCTLRsp(tiRoot_t *tiRoot, bit32 status, void *param)
Definition: tdioctl.c:1924
osGLOBAL void ostiGetIoEventStatsIOCTLRsp(tiRoot_t *tiRoot, bit32 status, void *param)
Definition: tdioctl.c:1900
osGLOBAL bit32 tdsaGetNumOfLUNIOCTL(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:3566
osGLOBAL void ostiSgpioIoctlRsp(tiRoot_t *tiRoot, agsaSGpioReqResponse_t *pSgpioResponse)
Definition: tdioctl.c:1418
osGLOBAL void ostiGetGpioIOCTLRsp(tiRoot_t *tiRoot, bit32 status, bit32 gpioReadValue, agsaGpioPinSetupInfo_t *gpioPinSetupInfo, agsaGpioEventSetupInfo_t *gpioEventSetupInfo)
Definition: tdioctl.c:1207
osGLOBAL bit32 tiCOMMgntIOCTL(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:364
osGLOBAL void ostiCOMMgntVPDSetIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:2244
osGLOBAL bit32 tdsaSGpioIoctlSetup(tiRoot_t *tiRoot, agsaContext_t *agContext, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2)
Definition: tdioctl.c:1332
osGLOBAL bit32 tdsaNVMDGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:2415
osGLOBAL void ostiRegDumpIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1505
osGLOBAL bit32 tdsaForensicDataGetIoctl(tiRoot_t *tiRoot, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2, void *agParam3)
Definition: tdioctl.c:3036
osGLOBAL void ostiSetNVMDIOCTLRsp(tiRoot_t *tiRoot, bit32 status)
Definition: tdioctl.c:1546
#define IOCTL_MN_TMF_DEVICE_RESET
Definition: tdioctl.h:233
#define FORENSIC_DATA_TYPE_QUEUE
Definition: tdioctl.h:539
#define IOCTL_MN_FW_GET_TRACE_BUFFER
Definition: tdioctl.h:180
#define IOCTL_MN_GPIO_EVENTSETUP
Definition: tdioctl.h:229
#define IOCTL_MJ_SET_OR_GET_REGISTER
Definition: tdioctl.h:117
#define IOCTL_MN_NVMD_SET_CONFIG
Definition: tdioctl.h:183
#define HighFence32Bits
Definition: tdioctl.h:618
#define IOCTL_MJ_GET_FORENSIC_DATA
Definition: tdioctl.h:80
#define IOCTL_MJ_SEND_TMF
Definition: tdioctl.h:91
#define IOCTL_MJ_LL_TRACING
Definition: tdioctl.h:67
#define PHY_SETTINGS_LEN
Definition: tdioctl.h:685
#define FORENSIC_DATA_TYPE_FATAL
Definition: tdioctl.h:540
#define IOCTL_MJ_FW_INFO
Definition: tdioctl.h:72
#define IOCTL_MN_GPIO_WRITE
Definition: tdioctl.h:231
#define IOCTL_MJ_FW_PROFILE
Definition: tdioctl.h:68
#define FORENSIC_DATA_TYPE_OB_QUEUE
Definition: tdioctl.h:543
#define IOCTL_MN_LL_RESET_TRACE_INDEX
Definition: tdioctl.h:190
#define IOCTL_MJ_NVMD_SET
Definition: tdioctl.h:63
#define IOCTL_MN_GPIO_READ
Definition: tdioctl.h:230
#define IOCTL_MJ_SMP_REQUEST
Definition: tdioctl.h:82
#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_AAP1
Definition: tdioctl.h:187
#define FORENSIC_DATA_TYPE_NON_FATAL
Definition: tdioctl.h:541
#define IOCTL_MJ_MODE_CTL_PAGE
Definition: tdioctl.h:115
#define IOCTL_MN_FW_DOWNLOAD_DATA
Definition: tdioctl.h:145
#define IOCTL_MJ_GET_IO_EVENT_STATISTIC
Definition: tdioctl.h:79
#define IOCTL_MN_FW_GET_CORE_DUMP_AAP1
Definition: tdioctl.h:185
@ SAS_PHY_SATA_DEVICE
Definition: tdioctl.h:683
#define IOCTL_MJ_LL_API_TEST
Definition: tdioctl.h:74
#define IOCTL_MJ_GET_IO_ERROR_STATISTIC
Definition: tdioctl.h:78
#define IOCTL_MJ_PHY_DETAILS
Definition: tdioctl.h:85
#define IOCTL_MJ_GET_DEVICE_INFO
Definition: tdioctl.h:77
#define IOCTL_MJ_GET_EVENT_LOG1
Definition: tdioctl.h:64
#define IOCTL_MJ_CARD_PARAMETER
Definition: tdioctl.h:60
#define IOCTL_MJ_PORT_START
Definition: tdioctl.h:112
#define LowFence32Bits
Definition: tdioctl.h:617
#define IOCTL_MJ_GPIO
Definition: tdioctl.h:89
#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG2
Definition: tdioctl.h:224
#define IOCTL_MN_LL_GET_TRACE_BUFFER
Definition: tdioctl.h:192
#define IOCTL_MJ_SEND_BIST
Definition: tdioctl.h:86
#define IOCTL_MJ_SGPIO
Definition: tdioctl.h:90
#define IOCTL_MJ_GET_EVENT_LOG2
Definition: tdioctl.h:65
#define IOCTL_MN_NVMD_GET_CONFIG
Definition: tdioctl.h:182
#define IOCTL_MJ_INI_DRIVER_IDENTIFY
Definition: tdioctl.h:108
#define IOCTL_MN_GPIO_PINSETUP
Definition: tdioctl.h:228
#define IOCTL_MN_LL_GET_TRACE_BUFFER_INFO
Definition: tdioctl.h:191
#define IOCTL_MN_FW_GET_CORE_DUMP_FLASH_IOP
Definition: tdioctl.h:188
#define IOCTL_MJ_GET_DRIVER_VERSION
Definition: tdioctl.h:122
#define IOCTL_MJ_PORT_STOP
Definition: tdioctl.h:111
#define IOCTL_MJ_GET_DEVICE_LUN
Definition: tdioctl.h:83
#define IOCTL_MN_FW_GET_CORE_DUMP_IOP
Definition: tdioctl.h:186
struct tdIoErrorEventStatisticIOCTL_s tdIoErrorEventStatisticIOCTL_t
#define IOCTL_MJ_GET_FW_REV
Definition: tdioctl.h:76
#define FORENSIC_DATA_TYPE_CHECK_FATAL
Definition: tdioctl.h:544
#define IOCTL_MJ_GET_CORE_DUMP
Definition: tdioctl.h:66
#define IOCTL_MN_CARD_GET_INTERRUPT_CONFIG
Definition: tdioctl.h:134
#define IOCTL_MJ_FW_CONTROL
Definition: tdioctl.h:61
#define IOCTL_MN_TMF_LUN_RESET
Definition: tdioctl.h:234
#define IOCTL_MJ_PHY_GENERAL_STATUS
Definition: tdioctl.h:84
#define FORENSIC_DATA_TYPE_GSM_SPACE
Definition: tdioctl.h:538
#define FORENSIC_DATA_TYPE_IB_QUEUE
Definition: tdioctl.h:542
#define IOCTL_MN_FW_GET_EVENT_FLASH_LOG1
Definition: tdioctl.h:223
#define IOCTL_MJ_GET_PHY_PROFILE
Definition: tdioctl.h:119
#define IOCTL_MJ_NVMD_GET
Definition: tdioctl.h:62
#define FetchBufferSIZE
Definition: tdioctl.h:616
#define IOCTL_MN_CARD_GET_TIMER_CONFIG
Definition: tdioctl.h:136
void tdsaSingleThreadedEnter(tiRoot_t *ptiRoot, bit32 queueId)
Definition: tdmisc.c:2862
void tdsaSingleThreadedLeave(tiRoot_t *ptiRoot, bit32 queueId)
Definition: tdmisc.c:2875
FORCEINLINE bit32 tdsaRotateQnumber(tiRoot_t *tiRoot, tdsaDeviceData_t *oneDeviceData)
Definition: tdport.c:7956
osGLOBAL void tdsaInitTimerRequest(tiRoot_t *tiRoot, tdsaTimerRequest_t *timerRequest)
Definition: tdtimers.c:138
osGLOBAL bit32 tdsaGpioSetup(tiRoot_t *tiRoot, agsaContext_t *agContext, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2)
osGLOBAL void tdsaKillTimer(tiRoot_t *tiRoot, tdsaTimerRequest_t *timerRequest)
Definition: tdtimers.c:228
osGLOBAL void ostiGetIoErrorStatsIOCTLRsp(tiRoot_t *tiRoot, bit32 status, void *param)
osGLOBAL bit32 tiCOMPortStart(tiRoot_t *tiRoot, bit32 portID, tiPortalContext_t *portalContext, bit32 option)
Definition: tdport.c:4765
osGLOBAL bit32 tiNumOfLunIOCTLreq(tiRoot_t *tiRoot, tiIORequest_t *tiIORequest, tiDeviceHandle_t *tiDeviceHandle, void *tiRequestBody, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2)
Definition: itdio.c:1790
osGLOBAL void tiIniGetDirectSataSasAddr(tiRoot_t *tiRoot, bit32 phyId, bit8 **sasAddressHi, bit8 **sasAddressLo)
Definition: itddisc.c:1066
osGLOBAL bit32 tiCOMPortStop(tiRoot_t *tiRoot, tiPortalContext_t *portalContext)
Definition: tdport.c:5009
#define tiModePageGet
Definition: tidefs.h:325
#define IOCTL_ERR_FW_EVENTLOG_DISABLED
Definition: tidefs.h:229
#define ADAPTER_WWN_START_OFFSET
Definition: tidefs.h:235
#define AG_LOGICAL_UNIT_RESET
Definition: tidefs.h:445
@ tiSuccess
Definition: tidefs.h:67
@ tiError
Definition: tidefs.h:68
#define IOCTL_CALL_PENDING
Definition: tidefs.h:245
#define IOCTL_ERR_STATUS_NOT_RESPONDING
Definition: tidefs.h:226
#define IOCTL_CALL_INVALID_DEVICE
Definition: tidefs.h:247
#define IOCTL_ERR_STATUS_NOT_SUPPORTED
Definition: tidefs.h:228
#define IOCTL_CALL_INVALID_CODE
Definition: tidefs.h:246
#define TI_ENCRYPTION_CONTROL_PARM_PAGE
Definition: tidefs.h:333
#define tiModePageSet
Definition: tidefs.h:326
#define ADAPTER_WWN_SPC_END_OFFSET
Definition: tidefs.h:238
#define IOCTL_ERR_STATUS_NO_MORE_DATA
Definition: tidefs.h:223
#define IOCTL_CALL_TIMEOUT
Definition: tidefs.h:248
#define TI_ENCRYPTION_DEK_CONFIG_PAGE
Definition: tidefs.h:332
#define ADAPTER_WWN_SPC_START_OFFSET
Definition: tidefs.h:237
#define TI_ENCRYPTION_GENERAL_CONFIG_PAGE
Definition: tidefs.h:331
#define IOCTL_ERR_STATUS_OK
Definition: tidefs.h:221
#define ADAPTER_WWN_END_OFFSET
Definition: tidefs.h:236
#define IOCTL_ERR_STATUS_INTERNAL_ERROR
Definition: tidefs.h:227
#define IOCTL_CALL_FAIL
Definition: tidefs.h:244
#define IOCTL_CALL_SUCCESS
Definition: tidefs.h:243
#define IOCTL_ERR_STATUS_INVALID_DEVICE
Definition: tidefs.h:225
#define AG_TARGET_WARM_RESET
Definition: tidefs.h:446
#define TI_DBG3(a)
Definition: tiglobal.h:50
#define TI_DBG4(a)
Definition: tiglobal.h:51
#define TI_DBG6(a)
Definition: tiglobal.h:53
#define TI_DBG1(a)
Definition: tiglobal.h:48
#define TI_DBG5(a)
Definition: tiglobal.h:52
#define TI_DBG2(a)
Definition: tiglobal.h:49
struct tiEncryptControlParamPage_s tiEncryptControlParamPage_t
struct tiEncryptDekConfigPage tiEncryptDekConfigPage_t