FreeBSD kernel pms device code
tdport.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
41
46
47#ifdef FDS_SM
51#endif
52
53#ifdef FDS_DM
57#endif
58
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
77
78#ifndef TURN_OFF_HDA
79#include <dev/pms/RefTisa/sallsdk/hda/64k/aap1img.h> /* SPC HDA */
83
84#include <dev/pms/RefTisa/sallsdk/hda/64k/aap18008.h> /* SPCv HDA */
86
87#include <dev/pms/RefTisa/sallsdk/hda/64k/ila8008.h> /* Ila common to SPCv SPCvp versions */
88
89#include <dev/pms/RefTisa/sallsdk/hda/64k/raae8070.h> /* SPCv 12g HDA */
91#include <dev/pms/RefTisa/sallsdk/hda/64k/ila8070.h> /* Ila 12g SPCv SPCvp versions */
92
93#endif /* TURN_OFF_HDA */
94
95
98
99#ifdef ECHO_TESTING
100/* temporary to test saEchoCommand() */
101bit8 gEcho;
102#endif
105 bit8 enableSgpio
106 );
107
108
109/*****************************************************************************
110*! \brief tdsaGetSwConfigParams
111*
112* Purpose: This function reads software configuration parameters from the
113* configuration file
114*
115* \param tiRoot: Pointer to driver/port instance.
116*
117* \return: None
118*
119* \note -
120*
121*****************************************************************************/
122osGLOBAL void
125 )
126{
127 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
128 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
129 agsaSwConfig_t *SwConfig;
130 agsaQueueConfig_t *QueueConfig;
131 char *buffer;
132 bit32 buffLen;
133 bit32 lenRecv = 0;
134 char *pLastUsedChar = agNULL;
135 char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
136 char globalStr[] = "Global";
137 char iniParmsStr[] = "InitiatorParms";
138 char SwParmsStr[] = "SWParms";
139 char OBQueueProps[] = "OBQueueProps";
140 char IBQueueProps[] = "IBQueueProps";
141 char IBQueueSize[40];
142 char OBQueueSize[40];
143 char IBQueueEleSize[40];
144 char OBQueueEleSize[40];
145 char OBQueueInterruptCount[40];
146 char OBQueueInterruptDelay[40];
147 char OBQueueInterruptEnable[40];
148 char IBQueuePriority[40];
149 char *cardNum = tdsaAllShared->CardIDString;
150 bit32 i;
151 bit32 enableDIF;
152 bit32 enableEncryption;
153#ifdef SA_CONFIG_MDFD_REGISTRY
154 bit32 disableMDF;
155#endif
156
157#ifdef FDS_DM
158 dmSwConfig_t *dmSwConfig;
159#endif
160#ifdef FDS_SM
161 smSwConfig_t *smSwConfig;
162#endif
163
164 TI_DBG6(("tdsaGetSwConfigParams: start\n"));
165 TI_DBG6(("tdsaGetSwConfigParams: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
166
167 buffer = tmpBuffer;
168 buffLen = sizeof(tmpBuffer);
169
170 osti_memset(buffer, 0, buffLen);
171
172 /* the followings are the default values */
173 SwConfig = (agsaSwConfig_t *)&(tdsaAllShared->SwConfig);
174 QueueConfig = (agsaQueueConfig_t *)&(tdsaAllShared->QueueConfig);
175
176#ifdef FDS_DM
177 dmSwConfig = (dmSwConfig_t *)&(tdsaAllShared->dmSwConfig);
178#endif
179#ifdef FDS_SM
180 smSwConfig = (smSwConfig_t *)&(tdsaAllShared->smSwConfig);
181#endif
182
183 /*
184 just default values
185 and are overwritten later by the configuration file contents
186 */
187 SwConfig->numDevHandles = DEFAULT_MAX_DEV;
188
190 SwConfig->smpReqTimeout = DEFAULT_SMP_TIMEOUT; /* DEFAULT_VALUE; */
196 SwConfig->fatalErrorInterruptEnable = 1;
197 SwConfig->fatalErrorInterruptVector = 0; /* Was 1 */
198 SwConfig->hostDirectAccessSupport = 0;
199 SwConfig->hostDirectAccessMode = 0;
200 SwConfig->FWConfig = 0;
201 SwConfig->enableDIF = agFALSE;
202 SwConfig->enableEncryption = agFALSE;
203
204#ifdef SA_CONFIG_MDFD_REGISTRY
205 SwConfig->disableMDF = agFALSE;
206#endif
207
208 SwConfig->param1 = tdsaAllShared->tdDeviceIdVendId;
209 SwConfig->param2 = tdsaAllShared->tdSubVendorId;
210
211
212#if defined(SALLSDK_DEBUG)
213 SwConfig->sallDebugLevel = 1; /* DEFAULT_VALUE; */
214#endif
215#if defined(DM_DEBUG)
216 dmSwConfig->DMDebugLevel = 1; /* DEFAULT_VALUE; */
217#endif
218#if defined(SM_DEBUG)
219 smSwConfig->SMDebugLevel = 1; /* DEFAULT_VALUE; */
220#endif
221
222 tdsaAllShared->portTMO = PORT_RECOVERY_TIMEOUT; /* default 5 sec */
223 tdsaAllShared->stp_idle_time = STP_IDLE_TIME; /* default 5 us */
224 tdsaAllShared->itNexusTimeout = IT_NEXUS_TIMEOUT; /* default 2000 ms */
225
226 osti_memset(buffer, 0, buffLen);
227 lenRecv = 0;
228
230 tiRoot,
231 globalStr,
232 iniParmsStr,
233 agNULL,
234 agNULL,
235 agNULL,
236 agNULL,
237 "MaxTargets",
238 buffer,
239 buffLen,
240 &lenRecv
241 ) == tiSuccess) && (lenRecv != 0))
242 {
243 if (osti_strncmp(buffer, "0x", 2) == 0)
244 {
245 SwConfig->numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 0);
246 }
247 else
248 {
249 SwConfig->numDevHandles = osti_strtoul (buffer, &pLastUsedChar, 10);
250 }
251 TI_DBG2(("tdsaGetSwConfigParams: MaxTargets %d\n",SwConfig->numDevHandles ));
252 }
253
254 /*
255 * read the NumInboundQueue parameter
256 */
257 osti_memset(buffer, 0, buffLen);
258 lenRecv = 0;
259
260 QueueConfig->numInboundQueues = DEFAULT_NUM_INBOUND_QUEUE; /* default 1 Inbound queue */
261
263 tiRoot,
264 globalStr, /* key */
265 SwParmsStr, /* subkey1 */
266 agNULL, /* subkey2 */
267 agNULL,
268 agNULL,
269 agNULL, /* subkey5 */
270 "NumInboundQueues", /* valueName */
271 buffer,
272 buffLen,
273 &lenRecv
274 ) == tiSuccess) && (lenRecv != 0))
275 {
276 if (osti_strncmp(buffer, "0x", 2) == 0)
277 {
278 QueueConfig->numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
279 }
280 else
281 {
282 QueueConfig->numInboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
283 }
284
285 if (QueueConfig->numInboundQueues > AGSA_MAX_INBOUND_Q)
286 {
288 }
289 }
290
291 /*
292 * read the NumOutboundQueue parameter
293 */
294 osti_memset(buffer, 0, buffLen);
295 lenRecv = 0;
296
297 QueueConfig->numOutboundQueues = DEFAULT_NUM_OUTBOUND_QUEUE; /* default 1 Outbound queue */
298
300 tiRoot,
301 globalStr, /* key */
302 SwParmsStr, /* subkey1 */
303 agNULL, /* subkey2 */
304 agNULL,
305 agNULL,
306 agNULL, /* subkey5 */
307 "NumOutboundQueues", /* valueName */
308 buffer,
309 buffLen,
310 &lenRecv
311 ) == tiSuccess) && (lenRecv != 0))
312 {
313 if (osti_strncmp(buffer, "0x", 2) == 0)
314 {
315 QueueConfig->numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
316 }
317 else
318 {
319 QueueConfig->numOutboundQueues = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
320 }
321
322 if (QueueConfig->numOutboundQueues > AGSA_MAX_OUTBOUND_Q)
323 {
325 }
326 }
327
328 /*
329 * read the outbound queue option
330 */
331
332 osti_memset(buffer, 0, buffLen);
333 lenRecv = 0;
334
335 tdsaAllShared->QueueOption = DEFAULT_QUEUE_OPTION; /* default 0 Outbound queue element */
336
338 tiRoot,
339 globalStr, /* key */
340 SwParmsStr, /* subkey1 */
341 agNULL, /* subkey2 */
342 agNULL,
343 agNULL,
344 agNULL, /* subkey5 */
345 "QueueOption", /* valueName */
346 buffer,
347 buffLen,
348 &lenRecv
349 ) == tiSuccess) && (lenRecv != 0))
350 {
351 if (osti_strncmp(buffer, "0x", 2) == 0)
352 {
353 tdsaAllShared->QueueOption = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
354 }
355 else
356 {
357 tdsaAllShared->QueueOption = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
358 }
359 }
360
361 /*
362 * read the MaxActiveIO parameter
363 */
364
365 osti_memset(buffer, 0, buffLen);
366 lenRecv = 0;
367
369 tiRoot,
370 globalStr, /* key */
371 SwParmsStr, /* subkey1 */
372 agNULL, /* subkey2 */
373 agNULL,
374 agNULL,
375 agNULL, /* subkey5 */
376 "MaxActiveIO", /* valueName */
377 buffer,
378 buffLen,
379 &lenRecv
380 ) == tiSuccess) && (lenRecv != 0))
381 {
382 if (osti_strncmp(buffer, "0x", 2) == 0)
383 {
384 SwConfig->maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 0);
385 TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 1 !!!\n"));
386 }
387 else
388 {
389 SwConfig->maxActiveIOs = osti_strtoul (buffer, &pLastUsedChar, 10);
390 TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 2 !!!\n"));
391 }
392 TI_DBG6(("tdsaGetSwConfigParams: maxactiveio 3 !!!\n"));
393 }
394
395
396
397 /*
398 * read the SMPTO parameter (SMP Timeout)
399 */
400 osti_memset(buffer, 0, buffLen);
401 lenRecv = 0;
402
404 tiRoot,
405 globalStr, /* key */
406 SwParmsStr, /* subkey1 */
407 agNULL, /* subkey2 */
408 agNULL,
409 agNULL,
410 agNULL, /* subkey5 */
411 "SMPTO", /* valueName */
412 buffer,
413 buffLen,
414 &lenRecv
415 ) == tiSuccess) && (lenRecv != 0))
416 {
417 if (osti_strncmp(buffer, "0x", 2) == 0)
418 {
419 SwConfig->smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 0);
420 }
421 else
422 {
423 SwConfig->smpReqTimeout = osti_strtoul (buffer, &pLastUsedChar, 10);
424 }
425 }
426
427
428 /*
429 * read the NumRegClients parameter (SMP Timeout)
430 */
431 osti_memset(buffer, 0, buffLen);
432 lenRecv = 0;
433
435 tiRoot,
436 globalStr, /* key */
437 SwParmsStr, /* subkey1 */
438 agNULL, /* subkey2 */
439 agNULL,
440 agNULL,
441 agNULL, /* subkey5 */
442 "NumRegClients", /* valueName */
443 buffer,
444 buffLen,
445 &lenRecv
446 ) == tiSuccess) && (lenRecv != 0))
447 {
448 if (osti_strncmp(buffer, "0x", 2) == 0)
449 {
450 SwConfig->numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 0);
451 }
452 else
453 {
454 SwConfig->numberOfEventRegClients = osti_strtoul (buffer, &pLastUsedChar, 10);
455 }
456 }
457
458#if defined(SALLSDK_DEBUG)
459 osti_memset(buffer, 0, buffLen);
460 lenRecv = 0;
461
463 tiRoot,
464 globalStr, /* key */
465 SwParmsStr, /* subkey1 */
466 agNULL, /* subkey2 */
467 agNULL,
468 agNULL,
469 agNULL, /* subkey5 */
470 "LLDebugLevel", /* valueName */
471 buffer,
472 buffLen,
473 &lenRecv
474 ) == tiSuccess) && (lenRecv != 0))
475 {
476 if (osti_strncmp(buffer, "0x", 2) == 0)
477 {
478 SwConfig->sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
479 }
480 else
481 {
482 SwConfig->sallDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
483 }
484 }
485#endif
486
487#if defined(DM_DEBUG)
488 osti_memset(buffer, 0, buffLen);
489 lenRecv = 0;
490
492 tiRoot,
493 globalStr, /* key */
494 SwParmsStr, /* subkey1 */
495 agNULL, /* subkey2 */
496 agNULL,
497 agNULL,
498 agNULL, /* subkey5 */
499 "DMDebugLevel", /* valueName */
500 buffer,
501 buffLen,
502 &lenRecv
503 ) == tiSuccess) && (lenRecv != 0))
504 {
505 if (osti_strncmp(buffer, "0x", 2) == 0)
506 {
507 dmSwConfig->DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
508 }
509 else
510 {
511 dmSwConfig->DMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
512 }
513 }
514#endif
515
516#if defined(SM_DEBUG)
517 osti_memset(buffer, 0, buffLen);
518 lenRecv = 0;
519
521 tiRoot,
522 globalStr, /* key */
523 SwParmsStr, /* subkey1 */
524 agNULL, /* subkey2 */
525 agNULL,
526 agNULL,
527 agNULL, /* subkey5 */
528 "SMDebugLevel", /* valueName */
529 buffer,
530 buffLen,
531 &lenRecv
532 ) == tiSuccess) && (lenRecv != 0))
533 {
534 if (osti_strncmp(buffer, "0x", 2) == 0)
535 {
536 smSwConfig->SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 0);
537 }
538 else
539 {
540 smSwConfig->SMDebugLevel = osti_strtoul (buffer, &pLastUsedChar, 10);
541 }
542 }
543#endif
544
545 osti_memset(buffer, 0, buffLen);
546 lenRecv = 0;
547
548 for (i=0;i<QueueConfig->numInboundQueues;i++)
549 {
550 osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
551 osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
552 osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
553
554 /*
555 * read the IBQueueSize
556 */
557
558 osti_memset(buffer, 0, buffLen);
559 lenRecv = 0;
560
561 tdsaAllShared->InboundQueueSize[i] = DEFAULT_INBOUND_QUEUE_SIZE; /* default 256 Inbound queue size */
562
564 tiRoot,
565 globalStr, /* key */
566 SwParmsStr, /* subkey1 */
567 IBQueueProps,/* subkey2 */
568 agNULL,
569 agNULL,
570 agNULL, /* subkey5 */
571 IBQueueSize, /* valueName */
572 buffer,
573 buffLen,
574 &lenRecv
575 ) == tiSuccess) && (lenRecv != 0))
576 {
577 if (osti_strncmp(buffer, "0x", 2) == 0)
578 {
579 tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
580 }
581 else
582 {
583 tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
584 TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue size %d\n", i, tdsaAllShared->InboundQueueSize[i]));
585 }
586 }
587
588
589 /*
590 * read the IBQueueEleSize
591 */
592
593 osti_memset(buffer, 0, buffLen);
594 lenRecv = 0;
595
596 tdsaAllShared->InboundQueueEleSize[i] = DEFAULT_INBOUND_QUEUE_ELE_SIZE; /* default 128 Inbound queue element */
597
599 tiRoot,
600 globalStr, /* key */
601 SwParmsStr, /* subkey1 */
602 IBQueueProps,/* subkey2 */
603 agNULL,
604 agNULL,
605 agNULL, /* subkey5 */
606 IBQueueEleSize, /* valueName */
607 buffer,
608 buffLen,
609 &lenRecv
610 ) == tiSuccess) && (lenRecv != 0))
611 {
612 if (osti_strncmp(buffer, "0x", 2) == 0)
613 {
614 tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
615 }
616 else
617 {
618 tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
619 TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue ele size %d\n", i, tdsaAllShared->InboundQueueEleSize[i]));
620 }
621 }
622
623 /*
624 * read the IBQueuePriority
625 */
626
627 osti_memset(buffer, 0, buffLen);
628 lenRecv = 0;
629
630 tdsaAllShared->InboundQueuePriority[i] = DEFAULT_INBOUND_QUEUE_PRIORITY; /* default 0 Inbound queue priority */
631
633 tiRoot,
634 globalStr, /* key */
635 SwParmsStr, /* subkey1 */
636 IBQueueProps,/* subkey2 */
637 agNULL,
638 agNULL,
639 agNULL, /* subkey5 */
640 IBQueuePriority, /* valueName */
641 buffer,
642 buffLen,
643 &lenRecv
644 ) == tiSuccess) && (lenRecv != 0))
645 {
646 if (osti_strncmp(buffer, "0x", 2) == 0)
647 {
648 tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
649 }
650 else
651 {
652 tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
653 TI_DBG6(("tdsaGetSwConfigParams: queue number %d priority %d\n", i, tdsaAllShared->InboundQueuePriority[i]));
654 }
655 }
656
657 /**********************************************/
658 osti_memset(buffer, 0, buffLen);
659 lenRecv = 0;
660 }/* end of loop */
661
662
663
664 osti_memset(buffer, 0, buffLen);
665 lenRecv = 0;
666
667 for (i=0;i<QueueConfig->numOutboundQueues;i++)
668 {
669 osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
670 osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
671 osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
672 osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
673 osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
674
675 /*
676 * read the OBQueueSize
677 */
678 osti_memset(buffer, 0, buffLen);
679 lenRecv = 0;
680
681
682 tdsaAllShared->OutboundQueueSize[i] = DEFAULT_OUTBOUND_QUEUE_SIZE; /* default 256 Outbound queue size */
683
685 tiRoot,
686 globalStr, /* key */
687 SwParmsStr, /* subkey1 */
688 OBQueueProps, /* subkey2 */
689 agNULL,
690 agNULL,
691 agNULL, /* subkey5 */
692 OBQueueSize, /* valueName */
693 buffer,
694 buffLen,
695 &lenRecv
696 ) == tiSuccess) && (lenRecv != 0))
697 {
698 if (osti_strncmp(buffer, "0x", 2) == 0)
699 {
700 tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
701 }
702 else
703 {
704 tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
705 TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue size %d\n", i, tdsaAllShared->OutboundQueueSize[i]));
706
707 }
708 }
709
710
711 /*
712 * read the OBQueueEleSize
713 */
714 osti_memset(buffer, 0, buffLen);
715 lenRecv = 0;
716
717
718 tdsaAllShared->OutboundQueueEleSize[i] = DEFAULT_OUTBOUND_QUEUE_ELE_SIZE; /* default 128 Outbound queue element */
719
721 tiRoot,
722 globalStr, /* key */
723 SwParmsStr, /* subkey1 */
724 OBQueueProps, /* subkey2 */
725 agNULL,
726 agNULL,
727 agNULL, /* subkey5 */
728 OBQueueEleSize, /* valueName */
729 buffer,
730 buffLen,
731 &lenRecv
732 ) == tiSuccess) && (lenRecv != 0))
733 {
734 if (osti_strncmp(buffer, "0x", 2) == 0)
735 {
736 tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
737 }
738 else
739 {
740 tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
741 TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue ele size %d\n", i, tdsaAllShared->OutboundQueueEleSize[i]));
742
743 }
744 }
745
746
747 /*
748 * read the OBQueueInterruptDelay
749 */
750 osti_memset(buffer, 0, buffLen);
751 lenRecv = 0;
752
753
754 tdsaAllShared->OutboundQueueInterruptDelay[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY; /* default 1 Outbound interrupt delay */
755
757 tiRoot,
758 globalStr, /* key */
759 SwParmsStr, /* subkey1 */
760 OBQueueProps, /* subkey2 */
761 agNULL,
762 agNULL,
763 agNULL, /* subkey5 */
764 OBQueueInterruptDelay, /* valueName */
765 buffer,
766 buffLen,
767 &lenRecv
768 ) == tiSuccess) && (lenRecv != 0))
769 {
770 if (osti_strncmp(buffer, "0x", 2) == 0)
771 {
772 tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
773 }
774 else
775 {
776 tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
777 TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt delay %d\n", i, tdsaAllShared->OutboundQueueInterruptDelay[i]));
778
779 }
780 }
781
782 /*
783 * read the OBQueueInterruptCount
784 */
785
786 osti_memset(buffer, 0, buffLen);
787 lenRecv = 0;
788
789 tdsaAllShared->OutboundQueueInterruptCount[i] = DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT; /* default 1 Outbound interrupt count */
790
792 tiRoot,
793 globalStr, /* key */
794 SwParmsStr, /* subkey1 */
795 OBQueueProps, /* subkey2 */
796 agNULL,
797 agNULL,
798 agNULL, /* subkey5 */
799 OBQueueInterruptCount, /* valueName */
800 buffer,
801 buffLen,
802 &lenRecv
803 ) == tiSuccess) && (lenRecv != 0))
804 {
805 if (osti_strncmp(buffer, "0x", 2) == 0)
806 {
807 tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
808 }
809 else
810 {
811 tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
812 TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt count %d\n", i, tdsaAllShared->OutboundQueueInterruptCount[i]));
813 }
814 }
815
816
817 /*
818 * read the OBQueueInterruptEnable
819 */
820
821 osti_memset(buffer, 0, buffLen);
822 lenRecv = 0;
823
824 tdsaAllShared->OutboundQueueInterruptEnable[i] = DEFAULT_OUTBOUND_INTERRUPT_ENABLE; /* default 1 Outbound interrupt is enabled */
825
827 tiRoot,
828 globalStr, /* key */
829 SwParmsStr, /* subkey1 */
830 OBQueueProps, /* subkey2 */
831 agNULL,
832 agNULL,
833 agNULL, /* subkey5 */
834 OBQueueInterruptEnable, /* valueName */
835 buffer,
836 buffLen,
837 &lenRecv
838 ) == tiSuccess) && (lenRecv != 0))
839 {
840 if (osti_strncmp(buffer, "0x", 2) == 0)
841 {
842 tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
843 }
844 else
845 {
846 tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
847 TI_DBG6(("tdsaGetSwConfigParams: queue number %d interrupt enable %d\n", i, tdsaAllShared->OutboundQueueInterruptEnable[i]));
848 }
849 }
850
851 /**********************************************/
852 osti_memset(buffer, 0, buffLen);
853 lenRecv = 0;
854
855 }/* end of loop */
856
857
858
859 /********************READ CARD SPECIFIC *******************************************************/
860
861 osti_memset(buffer, 0, buffLen);
862 lenRecv = 0;
863
864 for (i=0;i<QueueConfig->numInboundQueues;i++)
865 {
866 osti_sprintf(IBQueueSize,"IBQueueNumElements%d", i);
867 osti_sprintf(IBQueueEleSize,"IBQueueElementSize%d", i);
868 osti_sprintf(IBQueuePriority,"IBQueuePriority%d", i);
869
870 /*
871 * read the IBQueueSize
872 */
873
874 osti_memset(buffer, 0, buffLen);
875 lenRecv = 0;
876
878 tiRoot,
879 cardNum, /* key */
880 SwParmsStr, /* subkey1 */
881 IBQueueProps,/* subkey2 */
882 agNULL,
883 agNULL,
884 agNULL, /* subkey5 */
885 IBQueueSize, /* valueName */
886 buffer,
887 buffLen,
888 &lenRecv
889 ) == tiSuccess) && (lenRecv != 0))
890 {
891 if (osti_strncmp(buffer, "0x", 2) == 0)
892 {
893 tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
894 }
895 else
896 {
897 tdsaAllShared->InboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
898 TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue size %d\n", i, tdsaAllShared->InboundQueueSize[i]));
899 }
900 }
901
902 /*
903 * read the IBQueueEleSize
904 */
905
906 osti_memset(buffer, 0, buffLen);
907 lenRecv = 0;
908
910 tiRoot,
911 cardNum, /* key */
912 SwParmsStr, /* subkey1 */
913 IBQueueProps,/* subkey2 */
914 agNULL,
915 agNULL,
916 agNULL, /* subkey5 */
917 IBQueueEleSize, /* valueName */
918 buffer,
919 buffLen,
920 &lenRecv
921 ) == tiSuccess) && (lenRecv != 0))
922 {
923 if (osti_strncmp(buffer, "0x", 2) == 0)
924 {
925 tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
926 }
927 else
928 {
929 tdsaAllShared->InboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
930 TI_DBG6(("tdsaGetSwConfigParams: queue number %d IB queue ele size %d\n", i, tdsaAllShared->InboundQueueEleSize[i]));
931 }
932 }
933
934 /*
935 * read the IBQueuePriority
936 */
937
938 osti_memset(buffer, 0, buffLen);
939 lenRecv = 0;
940
942 tiRoot,
943 cardNum, /* key */
944 SwParmsStr, /* subkey1 */
945 IBQueueProps,/* subkey2 */
946 agNULL,
947 agNULL,
948 agNULL, /* subkey5 */
949 IBQueuePriority, /* valueName */
950 buffer,
951 buffLen,
952 &lenRecv
953 ) == tiSuccess) && (lenRecv != 0))
954 {
955 if (osti_strncmp(buffer, "0x", 2) == 0)
956 {
957 tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
958 }
959 else
960 {
961 tdsaAllShared->InboundQueuePriority[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
962 TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d priority %d\n", cardNum, i, tdsaAllShared->InboundQueuePriority[i]));
963 }
964 }
965
966 /**********************************************/
967 osti_memset(buffer, 0, buffLen);
968 lenRecv = 0;
969 }/* end of loop */
970
971
972
973 osti_memset(buffer, 0, buffLen);
974 lenRecv = 0;
975
976 for (i=0;i<QueueConfig->numOutboundQueues;i++)
977 {
978 osti_sprintf(OBQueueSize,"OBQueueNumElements%d", i);
979 osti_sprintf(OBQueueEleSize,"OBQueueElementSize%d", i);
980 osti_sprintf(OBQueueInterruptDelay,"OBQueueInterruptDelay%d", i);
981 osti_sprintf(OBQueueInterruptCount,"OBQueueInterruptCount%d", i);
982 osti_sprintf(OBQueueInterruptEnable,"OBQueueInterruptEnable%d", i);
983
984 /*
985 * read the OBQueueSize
986 */
987 osti_memset(buffer, 0, buffLen);
988 lenRecv = 0;
989
991 tiRoot,
992 cardNum, /* key */
993 SwParmsStr, /* subkey1 */
994 OBQueueProps, /* subkey2 */
995 agNULL,
996 agNULL,
997 agNULL, /* subkey5 */
998 OBQueueSize, /* valueName */
999 buffer,
1000 buffLen,
1001 &lenRecv
1002 ) == tiSuccess) && (lenRecv != 0))
1003 {
1004 if (osti_strncmp(buffer, "0x", 2) == 0)
1005 {
1006 tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
1007 }
1008 else
1009 {
1010 tdsaAllShared->OutboundQueueSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
1011 TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue size %d\n", i, tdsaAllShared->OutboundQueueSize[i]));
1012
1013 }
1014 }
1015
1016 /*
1017 * read the OBQueueEleSize
1018 */
1019 osti_memset(buffer, 0, buffLen);
1020 lenRecv = 0;
1021
1022
1024 tiRoot,
1025 cardNum, /* key */
1026 SwParmsStr, /* subkey1 */
1027 OBQueueProps, /* subkey2 */
1028 agNULL,
1029 agNULL,
1030 agNULL, /* subkey5 */
1031 OBQueueEleSize, /* valueName */
1032 buffer,
1033 buffLen,
1034 &lenRecv
1035 ) == tiSuccess) && (lenRecv != 0))
1036 {
1037 if (osti_strncmp(buffer, "0x", 2) == 0)
1038 {
1039 tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
1040 }
1041 else
1042 {
1043 tdsaAllShared->OutboundQueueEleSize[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
1044 TI_DBG6(("tdsaGetSwConfigParams: queue number %d OB queue ele size %d\n", i, tdsaAllShared->OutboundQueueEleSize[i]));
1045
1046 }
1047 }
1048
1049 /*
1050 * read the OBQueueInterruptDelay
1051 */
1052 osti_memset(buffer, 0, buffLen);
1053 lenRecv = 0;
1054
1055
1057 tiRoot,
1058 cardNum, /* key */
1059 SwParmsStr, /* subkey1 */
1060 OBQueueProps, /* subkey2 */
1061 agNULL,
1062 agNULL,
1063 agNULL, /* subkey5 */
1064 OBQueueInterruptDelay, /* valueName */
1065 buffer,
1066 buffLen,
1067 &lenRecv
1068 ) == tiSuccess) && (lenRecv != 0))
1069 {
1070 if (osti_strncmp(buffer, "0x", 2) == 0)
1071 {
1072 tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
1073 }
1074 else
1075 {
1076 tdsaAllShared->OutboundQueueInterruptDelay[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
1077 TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt delay %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptDelay[i]));
1078
1079 }
1080 }
1081
1082 /*
1083 * read the OBQueueInterruptCount
1084 */
1085
1086 osti_memset(buffer, 0, buffLen);
1087 lenRecv = 0;
1088
1090 tiRoot,
1091 cardNum, /* key */
1092 SwParmsStr, /* subkey1 */
1093 OBQueueProps, /* subkey2 */
1094 agNULL,
1095 agNULL,
1096 agNULL, /* subkey5 */
1097 OBQueueInterruptCount, /* valueName */
1098 buffer,
1099 buffLen,
1100 &lenRecv
1101 ) == tiSuccess) && (lenRecv != 0))
1102 {
1103 if (osti_strncmp(buffer, "0x", 2) == 0)
1104 {
1105 tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
1106 }
1107 else
1108 {
1109 tdsaAllShared->OutboundQueueInterruptCount[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
1110 TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt count %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptCount[i]));
1111 }
1112 }
1113
1114
1115 /*
1116 * read the OBQueueInterruptEnable
1117 */
1118
1119 osti_memset(buffer, 0, buffLen);
1120 lenRecv = 0;
1121
1123 tiRoot,
1124 cardNum, /* key */
1125 SwParmsStr, /* subkey1 */
1126 OBQueueProps, /* subkey2 */
1127 agNULL,
1128 agNULL,
1129 agNULL, /* subkey5 */
1130 OBQueueInterruptEnable, /* valueName */
1131 buffer,
1132 buffLen,
1133 &lenRecv
1134 ) == tiSuccess) && (lenRecv != 0))
1135 {
1136 if (osti_strncmp(buffer, "0x", 2) == 0)
1137 {
1138 tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 0);
1139 }
1140 else
1141 {
1142 tdsaAllShared->OutboundQueueInterruptEnable[i] = (bit16) osti_strtoul (buffer, &pLastUsedChar, 10);
1143 TI_DBG6(("tdsaGetSwConfigParams: card number %s queue number %d interrupt enable %d\n", cardNum, i, tdsaAllShared->OutboundQueueInterruptEnable[i]));
1144 }
1145 }
1146
1147
1148 /**********************************************/
1149 osti_memset(buffer, 0, buffLen);
1150 lenRecv = 0;
1151
1152 }/* end of loop */
1153
1154 /* process event log related parameters */
1155 osti_memset(buffer, 0, buffLen);
1156 lenRecv = 0;
1157
1159 tiRoot,
1160 globalStr, /* key */
1161 SwParmsStr, /* subkey1 */
1162 agNULL, /* subkey2 */
1163 agNULL,
1164 agNULL,
1165 agNULL, /* subkey5 */
1166 "EventLogSize1", /* valueName */
1167 buffer,
1168 buffLen,
1169 &lenRecv
1170 ) == tiSuccess) && (lenRecv != 0))
1171 {
1172 if (osti_strncmp(buffer, "0x", 2) == 0)
1173 {
1174 SwConfig->sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 0);
1175 }
1176 else
1177 {
1178 SwConfig->sizefEventLog1 = osti_strtoul (buffer, &pLastUsedChar, 10);
1179 }
1180 }
1181
1182 osti_memset(buffer, 0, buffLen);
1183 lenRecv = 0;
1184
1186 tiRoot,
1187 globalStr, /* key */
1188 SwParmsStr, /* subkey1 */
1189 agNULL, /* subkey2 */
1190 agNULL,
1191 agNULL,
1192 agNULL, /* subkey5 */
1193 "EventLogOption1", /* valueName */
1194 buffer,
1195 buffLen,
1196 &lenRecv
1197 ) == tiSuccess) && (lenRecv != 0))
1198 {
1199 if (osti_strncmp(buffer, "0x", 2) == 0)
1200 {
1201 SwConfig->eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 0);
1202 }
1203 else
1204 {
1205 SwConfig->eventLog1Option = osti_strtoul (buffer, &pLastUsedChar, 10);
1206 }
1207 }
1208
1209 osti_memset(buffer, 0, buffLen);
1210 lenRecv = 0;
1211
1213 tiRoot,
1214 globalStr, /* key */
1215 SwParmsStr, /* subkey1 */
1216 agNULL, /* subkey2 */
1217 agNULL,
1218 agNULL,
1219 agNULL, /* subkey5 */
1220 "EventLogSize2", /* valueName *//* IOP size in K dWords */
1221 buffer,
1222 buffLen,
1223 &lenRecv
1224 ) == tiSuccess) && (lenRecv != 0))
1225 {
1226 if (osti_strncmp(buffer, "0x", 2) == 0)
1227 {
1228 SwConfig->sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 0);
1229 }
1230 else
1231 {
1232 SwConfig->sizefEventLog2 = osti_strtoul (buffer, &pLastUsedChar, 10);
1233 }
1234 }
1235
1236 osti_memset(buffer, 0, buffLen);
1237 lenRecv = 0;
1238
1240 tiRoot,
1241 globalStr, /* key */
1242 SwParmsStr, /* subkey1 */
1243 agNULL, /* subkey2 */
1244 agNULL,
1245 agNULL,
1246 agNULL, /* subkey5 */
1247 "EventLogOption2", /* valueName */
1248 buffer,
1249 buffLen,
1250 &lenRecv
1251 ) == tiSuccess) && (lenRecv != 0))
1252 {
1253 if (osti_strncmp(buffer, "0x", 2) == 0)
1254 {
1255 SwConfig->eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 0);
1256 }
1257 else
1258 {
1259 SwConfig->eventLog2Option = osti_strtoul (buffer, &pLastUsedChar, 10);
1260 }
1261 }
1262 /* end of event log related parameters */
1263
1264 /*
1265 HDA parameters
1266 */
1267 osti_memset(buffer, 0, buffLen);
1268 lenRecv = 0;
1269
1271 tiRoot,
1272 globalStr, /* key */
1273 SwParmsStr, /* subkey1 */
1274 agNULL, /* subkey2 */
1275 agNULL,
1276 agNULL,
1277 agNULL, /* subkey5 */
1278 "HDASupport", /* valueName */
1279 buffer,
1280 buffLen,
1281 &lenRecv
1282 ) == tiSuccess) && (lenRecv != 0))
1283 {
1284 if (osti_strncmp(buffer, "0x", 2) == 0)
1285 {
1286 SwConfig->hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 0);
1287 }
1288 else
1289 {
1290 SwConfig->hostDirectAccessSupport = osti_strtoul (buffer, &pLastUsedChar, 10);
1291 }
1292 }
1293
1294 osti_memset(buffer, 0, buffLen);
1295 lenRecv = 0;
1296
1298 tiRoot,
1299 globalStr, /* key */
1300 SwParmsStr, /* subkey1 */
1301 agNULL, /* subkey2 */
1302 agNULL,
1303 agNULL,
1304 agNULL, /* subkey5 */
1305 "HDAMode", /* valueName */
1306 buffer,
1307 buffLen,
1308 &lenRecv
1309 ) == tiSuccess) && (lenRecv != 0))
1310 {
1311 if (osti_strncmp(buffer, "0x", 2) == 0)
1312 {
1313 SwConfig->hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 0);
1314 }
1315 else
1316 {
1317 SwConfig->hostDirectAccessMode = osti_strtoul (buffer, &pLastUsedChar, 10);
1318 }
1319 }
1320 /* the end of HDA parameters */
1321
1322 /* FW configuration */
1323 osti_memset(buffer, 0, buffLen);
1324 lenRecv = 0;
1325
1327 tiRoot,
1328 globalStr, /* key */
1329 SwParmsStr, /* subkey1 */
1330 agNULL, /* subkey2 */
1331 agNULL,
1332 agNULL,
1333 agNULL, /* subkey5 */
1334 "FWConfig", /* valueName */
1335 buffer,
1336 buffLen,
1337 &lenRecv
1338 ) == tiSuccess) && (lenRecv != 0))
1339 {
1340 if (osti_strncmp(buffer, "0x", 2) == 0)
1341 {
1342 SwConfig->FWConfig = osti_strtoul (buffer, &pLastUsedChar, 0);
1343 }
1344 else
1345 {
1346 SwConfig->FWConfig = osti_strtoul (buffer, &pLastUsedChar, 10);
1347 }
1348 }
1349 /* The end of FW configuration */
1350
1351 /* IQ Normal priority and High priority */
1352 osti_memset(buffer, 0, buffLen);
1353 lenRecv = 0;
1354
1356 tiRoot,
1357 globalStr, /* key */
1358 SwParmsStr, /* subkey1 */
1359 IBQueueProps,/* subkey2 */
1360 agNULL,
1361 agNULL,
1362 agNULL, /* subkey5 */
1363 "IQNQDepth", /* valueName */
1364 buffer,
1365 buffLen,
1366 &lenRecv
1367 ) == tiSuccess) && (lenRecv != 0))
1368 {
1369 if (osti_strncmp(buffer, "0x", 2) == 0)
1370 {
1371 QueueConfig->iqNormalPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 0);
1372 }
1373 else
1374 {
1375 QueueConfig->iqNormalPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 10);
1376 }
1377 }
1378
1379 osti_memset(buffer, 0, buffLen);
1380 lenRecv = 0;
1381
1383 tiRoot,
1384 globalStr, /* key */
1385 SwParmsStr, /* subkey1 */
1386 IBQueueProps,/* subkey2 */
1387 agNULL,
1388 agNULL,
1389 agNULL, /* subkey5 */
1390 "IQHQDepth", /* valueName */
1391 buffer,
1392 buffLen,
1393 &lenRecv
1394 ) == tiSuccess) && (lenRecv != 0))
1395 {
1396 if (osti_strncmp(buffer, "0x", 2) == 0)
1397 {
1398 QueueConfig->iqHighPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 0);
1399 }
1400 else
1401 {
1402 QueueConfig->iqHighPriorityProcessingDepth = (bit8) osti_strtoul (buffer, &pLastUsedChar, 10);
1403 }
1404 }
1405 /* End IQ Normal priority and High priority */
1406
1407 /* Start port timeout value */
1408 osti_memset(buffer, 0, buffLen);
1409 lenRecv = 0;
1410
1412 tiRoot,
1413 globalStr, /* key */
1414 SwParmsStr, /* subkey1 */
1415 agNULL,/* subkey2 */
1416 agNULL,
1417 agNULL,
1418 agNULL, /* subkey5 */
1419 "PortTMO", /* valueName */
1420 buffer,
1421 buffLen,
1422 &lenRecv
1423 ) == tiSuccess) && (lenRecv != 0))
1424 {
1425 if (osti_strncmp(buffer, "0x", 2) == 0)
1426 {
1427 tdsaAllShared->portTMO = osti_strtoul (buffer, &pLastUsedChar, 0);
1428 }
1429 else
1430 {
1431 tdsaAllShared->portTMO = osti_strtoul (buffer, &pLastUsedChar, 10);
1432 }
1433 }
1434 /* End port timeout value */
1435
1436#ifdef SA_ENABLE_TRACE_FUNCTIONS
1437 osti_memset(buffer, 0, buffLen);
1438 lenRecv = 0;
1440 tiRoot,
1441 globalStr, /* key */
1442 SwParmsStr, /* subkey1 */
1443 agNULL, /* subkey2 */
1444 agNULL,
1445 agNULL,
1446 agNULL, /* subkey5 */
1447 "TraceDestination", /* valueName */
1448 buffer,
1449 buffLen,
1450 &lenRecv
1451 ) == tiSuccess) && (lenRecv != 0))
1452 {
1453 if (osti_strncmp(buffer, "0x", 2) == 0)
1454 {
1455 SwConfig->TraceDestination = osti_strtoul (buffer, &pLastUsedChar, 0);
1456 }
1457 else
1458 {
1459 SwConfig->TraceDestination = osti_strtoul (buffer, &pLastUsedChar, 10);
1460 }
1461 TI_DBG2(("tdsaGetSwConfigParams: SwConfig->TraceDestination %d\n",SwConfig->TraceDestination));
1462 }
1463
1464 osti_memset(buffer, 0, buffLen);
1465 lenRecv = 0;
1467 tiRoot,
1468 globalStr, /* key */
1469 SwParmsStr, /* subkey1 */
1470 agNULL, /* subkey2 */
1471 agNULL,
1472 agNULL,
1473 agNULL, /* subkey5 */
1474 "TraceMask", /* valueName */
1475 buffer,
1476 buffLen,
1477 &lenRecv
1478 ) == tiSuccess) && (lenRecv != 0))
1479 {
1480 if (osti_strncmp(buffer, "0x", 2) == 0)
1481 {
1482 SwConfig->TraceMask = osti_strtoul (buffer, &pLastUsedChar, 0);
1483 }
1484 else
1485 {
1486 SwConfig->TraceMask = osti_strtoul (buffer, &pLastUsedChar, 10);
1487 }
1488 TI_DBG2(("tdsaGetSwConfigParams: SwConfig->TraceMask %d %X\n",SwConfig->TraceMask,SwConfig->TraceMask));
1489 }
1490#endif /*# SA_ENABLE_TRACE_FUNCTIONS */
1491
1492#ifdef AGTIAPI_CTL
1493 /*
1494 * read the SAS Connection Time Limit parameter
1495 */
1496 osti_memset(buffer, 0, buffLen);
1497 lenRecv = 0;
1498 tdsaAllShared->SASConnectTimeLimit = 0;
1499
1501 tiRoot,
1502 globalStr, /* key */
1503 SwParmsStr, /* subkey1 */
1504 agNULL, /* subkey2 */
1505 agNULL,
1506 agNULL,
1507 agNULL, /* subkey5 */
1508 "SASCTL", /* valueName */
1509 buffer,
1510 buffLen,
1511 &lenRecv
1512 ) == tiSuccess) && (lenRecv != 0))
1513 {
1514 if (osti_strncmp(buffer, "0x", 2) == 0)
1515 tdsaAllShared->SASConnectTimeLimit = osti_strtoul (buffer, &pLastUsedChar, 0);
1516 else
1517 tdsaAllShared->SASConnectTimeLimit = osti_strtoul (buffer, &pLastUsedChar, 10);
1518 }
1519#endif
1520
1521 /* Start FCA value */
1522 osti_memset(buffer, 0, buffLen);
1523 lenRecv = 0;
1524
1525 tdsaAllShared->FCA = 1; /* No FCA by default */
1526
1528 tiRoot,
1529 globalStr, /* key */
1530 "InitiatorParms", /* subkey1 */
1531 agNULL,/* subkey2 */
1532 agNULL,
1533 agNULL,
1534 agNULL, /* subkey5 */
1535 "FCA", /* valueName */
1536 buffer,
1537 buffLen,
1538 &lenRecv
1539 ) == tiSuccess) && (lenRecv != 0))
1540 {
1541 if (osti_strncmp(buffer, "0x", 2) == 0)
1542 {
1543 tdsaAllShared->FCA = osti_strtoul (buffer, &pLastUsedChar, 0);
1544 }
1545 else
1546 {
1547 tdsaAllShared->FCA = osti_strtoul (buffer, &pLastUsedChar, 10);
1548 }
1549 }
1550 /* End FCA value */
1551
1552 /* Start ResetInDiscovery value */
1553 osti_memset(buffer, 0, buffLen);
1554 lenRecv = 0;
1555
1556 tdsaAllShared->ResetInDiscovery = 0; /* No ResetInDiscovery by default */
1557
1559 tiRoot,
1560 globalStr, /* key */
1561 "InitiatorParms", /* subkey1 */
1562 agNULL,/* subkey2 */
1563 agNULL,
1564 agNULL,
1565 agNULL, /* subkey5 */
1566 "ResetInDiscovery", /* valueName */
1567 buffer,
1568 buffLen,
1569 &lenRecv
1570 ) == tiSuccess) && (lenRecv != 0))
1571 {
1572 if (osti_strncmp(buffer, "0x", 2) == 0)
1573 {
1574 tdsaAllShared->ResetInDiscovery = osti_strtoul (buffer, &pLastUsedChar, 0);
1575 }
1576 else
1577 {
1578 tdsaAllShared->ResetInDiscovery = osti_strtoul (buffer, &pLastUsedChar, 10);
1579 }
1580 }
1581 /* End ResetInDiscovery value */
1582
1583 /* Start MCN value */
1584 osti_memset(buffer, 0, buffLen);
1585 lenRecv = 0;
1586
1587 tdsaAllShared->MCN = 1; /* default MCN */
1588
1590 tiRoot,
1591 globalStr, /* key */
1592 SwParmsStr, /* subkey1 */
1593 agNULL,/* subkey2 */
1594 agNULL,
1595 agNULL,
1596 agNULL, /* subkey5 */
1597 "MCN", /* valueName */
1598 buffer,
1599 buffLen,
1600 &lenRecv
1601 ) == tiSuccess) && (lenRecv != 0))
1602 {
1603 if (osti_strncmp(buffer, "0x", 2) == 0)
1604 {
1605 tdsaAllShared->MCN = osti_strtoul (buffer, &pLastUsedChar, 0);
1606 }
1607 else
1608 {
1609 tdsaAllShared->MCN = osti_strtoul (buffer, &pLastUsedChar, 10);
1610 }
1611 TI_DBG6(("tdsaGetSwConfigParams: MCN %d\n", tdsaAllShared->MCN));
1612 }
1613 /* End MCN value */
1614
1615 /* Start sflag value */
1616 osti_memset(buffer, 0, buffLen);
1617 lenRecv = 0;
1618
1619 tdsaAllShared->sflag = 0; /* default sflag */
1620
1622 tiRoot,
1623 globalStr, /* key */
1624 SwParmsStr, /* subkey1 */
1625 agNULL, /* subkey2 */
1626 agNULL,
1627 agNULL,
1628 agNULL, /* subkey5 */
1629 "Sflag", /* valueName */
1630 buffer,
1631 buffLen,
1632 &lenRecv
1633 ) == tiSuccess) && (lenRecv != 0))
1634 {
1635 if (osti_strncmp(buffer, "0x", 2) == 0)
1636 {
1637 tdsaAllShared->sflag = osti_strtoul (buffer, &pLastUsedChar, 0);
1638 }
1639 else
1640 {
1641 tdsaAllShared->sflag = osti_strtoul (buffer, &pLastUsedChar, 10);
1642 }
1643 TI_DBG1(("tdsaGetSwConfigParams: sflag %d\n", tdsaAllShared->sflag));
1644 }
1645 /* End sflag value */
1646
1647 /* Start enable DIF */
1648 osti_memset(buffer, 0, buffLen);
1649 lenRecv = 0;
1650
1652 tiRoot,
1653 globalStr, /* key */
1654 SwParmsStr, /* subkey1 */
1655 agNULL,/* subkey2 */
1656 agNULL,
1657 agNULL,
1658 agNULL, /* subkey5 */
1659 "enableDIF", /* valueName */
1660 buffer,
1661 buffLen,
1662 &lenRecv
1663 ) == tiSuccess) && (lenRecv != 0))
1664 {
1665 if (osti_strncmp(buffer, "0x", 2) == 0)
1666 {
1667 enableDIF = osti_strtoul (buffer, &pLastUsedChar, 0);
1668 }
1669 else
1670 {
1671 enableDIF = osti_strtoul (buffer, &pLastUsedChar, 10);
1672 }
1673 TI_DBG6(("tdsaGetSwConfigParams: enableDIF %d\n", enableDIF));
1674 if (enableDIF)
1675 {
1676 SwConfig->enableDIF = agTRUE;
1677 }
1678 else
1679 {
1680 SwConfig->enableDIF = agFALSE;
1681 }
1682 TI_DBG6(("tdsaGetSwConfigParams: SwConfig->enableDIF %d\n", SwConfig->enableDIF));
1683 }
1684 /* End enable DIF */
1685
1686
1687 /* Start enable Encryption */
1688 osti_memset(buffer, 0, buffLen);
1689 lenRecv = 0;
1690
1692 tiRoot,
1693 globalStr, /* key */
1694 SwParmsStr, /* subkey1 */
1695 agNULL,/* subkey2 */
1696 agNULL,
1697 agNULL,
1698 agNULL, /* subkey5 */
1699 "enableEncryption", /* valueName */
1700 buffer,
1701 buffLen,
1702 &lenRecv
1703 ) == tiSuccess) && (lenRecv != 0))
1704 {
1705 if (osti_strncmp(buffer, "0x", 2) == 0)
1706 {
1707 enableEncryption = osti_strtoul (buffer, &pLastUsedChar, 0);
1708 }
1709 else
1710 {
1711 enableEncryption = osti_strtoul (buffer, &pLastUsedChar, 10);
1712 }
1713 TI_DBG6(("tdsaGetSwConfigParams: enableEncryption %d\n", enableEncryption));
1714 if (enableEncryption)
1715 {
1716 SwConfig->enableEncryption = agTRUE;
1717 }
1718 else
1719 {
1720 SwConfig->enableEncryption = agFALSE;
1721 }
1722 TI_DBG6(("tdsaGetSwConfigParams: SwConfig->enableEncryption %d\n", SwConfig->enableEncryption));
1723 }
1724 /* End enable Encryption */
1725
1726 /* Start allow connection rate change */
1727 osti_memset(buffer, 0, buffLen);
1728 lenRecv = 0;
1729 tdsaAllShared->RateAdjust = 0; /* No rate adjust by default */
1731 tiRoot,
1732 globalStr, /* key */
1733 SwParmsStr, /* subkey1 */
1734 agNULL,/* subkey2 */
1735 agNULL,
1736 agNULL,
1737 agNULL, /* subkey5 */
1738 "RateAdjust", /* valueName */
1739 buffer,
1740 buffLen,
1741 &lenRecv
1742 ) == tiSuccess) && (lenRecv != 0))
1743 {
1744 if (osti_strncmp(buffer, "0x", 2) == 0)
1745 {
1746 tdsaAllShared->RateAdjust = osti_strtoul (buffer, &pLastUsedChar, 0);
1747 }
1748 else
1749 {
1750 tdsaAllShared->RateAdjust = osti_strtoul (buffer, &pLastUsedChar, 10);
1751 }
1752 TI_DBG6(("tdsaGetSwConfigParams: tdsaAllShared->RateAdjust %d\n", tdsaAllShared->RateAdjust));
1753 }
1754 /* End allow connection rate change */
1755
1756
1757#ifdef SA_CONFIG_MDFD_REGISTRY
1758 /* Start disable MDF */
1759 osti_memset(buffer, 0, buffLen);
1760 lenRecv = 0;
1761
1763 tiRoot,
1764 globalStr, /* key */
1765 SwParmsStr, /* subkey1 */
1766 agNULL,/* subkey2 */
1767 agNULL,
1768 agNULL,
1769 agNULL, /* subkey5 */
1770 "disableMDF", /* valueName */
1771 buffer,
1772 buffLen,
1773 &lenRecv
1774 ) == tiSuccess) && (lenRecv != 0))
1775 {
1776 if (osti_strncmp(buffer, "0x", 2) == 0)
1777 {
1778 disableMDF = osti_strtoul (buffer, &pLastUsedChar, 0);
1779 }
1780 else
1781 {
1782 disableMDF = osti_strtoul (buffer, &pLastUsedChar, 10);
1783 }
1784 TI_DBG6(("tdsaGetSwConfigParams: disableMDF %d\n", disableMDF));
1785 if (disableMDF)
1786 {
1787 SwConfig->disableMDF = agTRUE;
1788 }
1789 else
1790 {
1791 SwConfig->disableMDF = agFALSE;
1792 }
1793 TI_DBG6(("tdsaGetSwConfigParams: SwConfig->disableMDF %d\n", SwConfig->disableMDF));
1794 }
1795 /* End disable MDF */
1796#endif /*SA_CONFIG_MDFD_REGISTRY*/
1797
1798 /* Start IT_NEXUS_TIMEOUT */
1799 osti_memset(buffer, 0, buffLen);
1800 lenRecv = 0;
1801
1803 tiRoot,
1804 globalStr, /* key */
1805 SwParmsStr, /* subkey1 */
1806 agNULL,/* subkey2 */
1807 agNULL,
1808 agNULL,
1809 agNULL, /* subkey5 */
1810 "IT_NEXUS_TIMEOUT", /* valueName */
1811 buffer,
1812 buffLen,
1813 &lenRecv
1814 ) == tiSuccess) && (lenRecv != 0))
1815 {
1816 if (osti_strncmp(buffer, "0x", 2) == 0)
1817 {
1818 tdsaAllShared->itNexusTimeout = osti_strtoul (buffer, &pLastUsedChar, 0);
1819 }
1820 else
1821 {
1822 tdsaAllShared->itNexusTimeout = osti_strtoul (buffer, &pLastUsedChar, 10);
1823 }
1824 TI_DBG1(("tdsaGetSwConfigParams: tdsaAllShared->itNexusTimeout %d\n", tdsaAllShared->itNexusTimeout));
1825 }
1826 /* End IT_NEXUS_TIMEOUT */
1827
1828 /* Start stp idle time */
1829 osti_memset(buffer, 0, buffLen);
1830 lenRecv = 0;
1831
1833 tiRoot,
1834 globalStr, /* key */
1835 SwParmsStr, /* subkey1 */
1836 agNULL,/* subkey2 */
1837 agNULL,
1838 agNULL,
1839 agNULL, /* subkey5 */
1840 "STPIdleTime", /* valueName */
1841 buffer,
1842 buffLen,
1843 &lenRecv
1844 ) == tiSuccess) && (lenRecv != 0))
1845 {
1846 if (osti_strncmp(buffer, "0x", 2) == 0)
1847 {
1848 tdsaAllShared->stp_idle_time = osti_strtoul (buffer, &pLastUsedChar, 0);
1849 }
1850 else
1851 {
1852 tdsaAllShared->stp_idle_time = osti_strtoul (buffer, &pLastUsedChar, 10);
1853 }
1854 TI_DBG2(("tdsaGetSwConfigParams: STPIdleTime %d\n", tdsaAllShared->stp_idle_time));
1855 }
1856 /* End stp idle time */
1857
1858 /* Start STP_MCT_TMO */
1859 osti_memset(buffer, 0, buffLen);
1860 lenRecv = 0;
1861
1862 tdsaAllShared->STP_MCT_TMO = 32;
1864 tiRoot,
1865 globalStr, /* key */
1866 SwParmsStr, /* subkey1 */
1867 agNULL,/* subkey2 */
1868 agNULL,
1869 agNULL,
1870 agNULL, /* subkey5 */
1871 "SAS_STP_MCT_TMO", /* valueName */
1872 buffer,
1873 buffLen,
1874 &lenRecv
1875 ) == tiSuccess) && (lenRecv != 0))
1876 {
1877 if (osti_strncmp(buffer, "0x", 2) == 0)
1878 {
1879 tdsaAllShared->STP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
1880 }
1881 else
1882 {
1883 tdsaAllShared->STP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
1884 }
1885 TI_DBG2(("tdsaGetSwConfigParams: STP_MCT_TMO %d\n", tdsaAllShared->STP_MCT_TMO));
1886 }
1887 /* End STP_MCT_TMO */
1888
1889 /* Start SSP_MCT_TMO */
1890 osti_memset(buffer, 0, buffLen);
1891 lenRecv = 0;
1892 tdsaAllShared->SSP_MCT_TMO = 32;
1894 tiRoot,
1895 globalStr, /* key */
1896 SwParmsStr, /* subkey1 */
1897 agNULL,/* subkey2 */
1898 agNULL,
1899 agNULL,
1900 agNULL, /* subkey5 */
1901 "SAS_SSP_MCT_TMO", /* valueName */
1902 buffer,
1903 buffLen,
1904 &lenRecv
1905 ) == tiSuccess) && (lenRecv != 0))
1906 {
1907 if (osti_strncmp(buffer, "0x", 2) == 0)
1908 {
1909 tdsaAllShared->SSP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
1910 }
1911 else
1912 {
1913 tdsaAllShared->SSP_MCT_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
1914 }
1915 TI_DBG2(("tdsaGetSwConfigParams: SSP_MCT_TMO %d\n", tdsaAllShared->SSP_MCT_TMO));
1916 }
1917 /* End SSP_MCT_TMO */
1918
1919
1920 /* Start MAX_OPEN_TIME */
1921 osti_memset(buffer, 0, buffLen);
1922 lenRecv = 0;
1923 tdsaAllShared->MAX_OPEN_TIME = 5;
1925 tiRoot,
1926 globalStr, /* key */
1927 SwParmsStr, /* subkey1 */
1928 agNULL,/* subkey2 */
1929 agNULL,
1930 agNULL,
1931 agNULL, /* subkey5 */
1932 "SAS_MAX_OPEN_TIME", /* valueName */
1933 buffer,
1934 buffLen,
1935 &lenRecv
1936 ) == tiSuccess) && (lenRecv != 0))
1937 {
1938 if (osti_strncmp(buffer, "0x", 2) == 0)
1939 {
1940 tdsaAllShared->MAX_OPEN_TIME = osti_strtoul (buffer, &pLastUsedChar, 0);
1941 }
1942 else
1943 {
1944 tdsaAllShared->MAX_OPEN_TIME = osti_strtoul (buffer, &pLastUsedChar, 10);
1945 }
1946 TI_DBG2(("tdsaGetSwConfigParams: MAX_OPEN_TIME %d\n", tdsaAllShared->MAX_OPEN_TIME));
1947 }
1948 /* End MAX_OPEN_TIME */
1949
1950
1951 /* Start SMP_MAX_CONN_TIMER */
1952 osti_memset(buffer, 0, buffLen);
1953 lenRecv = 0;
1954 tdsaAllShared->SMP_MAX_CONN_TIMER = 0xFF;
1956 tiRoot,
1957 globalStr, /* key */
1958 SwParmsStr, /* subkey1 */
1959 agNULL,/* subkey2 */
1960 agNULL,
1961 agNULL,
1962 agNULL, /* subkey5 */
1963 "SAS_SMP_MAX_CONN_TIMER", /* valueName */
1964 buffer,
1965 buffLen,
1966 &lenRecv
1967 ) == tiSuccess) && (lenRecv != 0))
1968 {
1969 if (osti_strncmp(buffer, "0x", 2) == 0)
1970 {
1971 tdsaAllShared->SMP_MAX_CONN_TIMER = osti_strtoul (buffer, &pLastUsedChar, 0);
1972 }
1973 else
1974 {
1975 tdsaAllShared->SMP_MAX_CONN_TIMER = osti_strtoul (buffer, &pLastUsedChar, 10);
1976 }
1977 TI_DBG2(("tdsaGetSwConfigParams: SMP_MAX_CONN_TIMER %d\n", tdsaAllShared->SMP_MAX_CONN_TIMER));
1978 }
1979 /* End SMP_MAX_CONN_TIMER */
1980
1981 /* Start STP_FRM_TMO */
1982 osti_memset(buffer, 0, buffLen);
1983 lenRecv = 0;
1984 tdsaAllShared->STP_FRM_TMO = 0;
1986 tiRoot,
1987 globalStr, /* key */
1988 SwParmsStr, /* subkey1 */
1989 agNULL,/* subkey2 */
1990 agNULL,
1991 agNULL,
1992 agNULL, /* subkey5 */
1993 "SAS_STP_FRM_TMO", /* valueName */
1994 buffer,
1995 buffLen,
1996 &lenRecv
1997 ) == tiSuccess) && (lenRecv != 0))
1998 {
1999 if (osti_strncmp(buffer, "0x", 2) == 0)
2000 {
2001 tdsaAllShared->STP_FRM_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
2002 }
2003 else
2004 {
2005 tdsaAllShared->STP_FRM_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
2006 }
2007 TI_DBG2(("tdsaGetSwConfigParams: STP_FRM_TMO %d\n", tdsaAllShared->STP_FRM_TMO));
2008 }
2009 /* End STP_FRM_TMO */
2010
2011 /* Start MFD_OPNRJT_RTRY_INTVL */
2012 osti_memset(buffer, 0, buffLen);
2013 lenRecv = 0;
2014 tdsaAllShared->MFD = 1; /* disabled by default */
2016 tiRoot,
2017 globalStr, /* key */
2018 SwParmsStr, /* subkey1 */
2019 agNULL,/* subkey2 */
2020 agNULL,
2021 agNULL,
2022 agNULL, /* subkey5 */
2023 "SAS_MFD", /* valueName */
2024 buffer,
2025 buffLen,
2026 &lenRecv
2027 ) == tiSuccess) && (lenRecv != 0))
2028 {
2029 if (osti_strncmp(buffer, "0x", 2) == 0)
2030 {
2031 tdsaAllShared->MFD = osti_strtoul (buffer, &pLastUsedChar, 0);
2032 }
2033 else
2034 {
2035 tdsaAllShared->MFD = osti_strtoul (buffer, &pLastUsedChar, 10);
2036 }
2037 TI_DBG2(("tdsaGetSwConfigParams: MFD %d\n", tdsaAllShared->MFD));
2038 }
2039 /* End MFD_OPNRJT_RTRY_INTVL */
2040
2041 /* Start MFD_OPNRJT_RTRY_INTVL */
2042 osti_memset(buffer, 0, buffLen);
2043 lenRecv = 0;
2044 tdsaAllShared->OPNRJT_RTRY_INTVL = 2;
2046 tiRoot,
2047 globalStr, /* key */
2048 SwParmsStr, /* subkey1 */
2049 agNULL,/* subkey2 */
2050 agNULL,
2051 agNULL,
2052 agNULL, /* subkey5 */
2053 "SAS_OPNRJT_RTRY_INTVL", /* valueName */
2054 buffer,
2055 buffLen,
2056 &lenRecv
2057 ) == tiSuccess) && (lenRecv != 0))
2058 {
2059 if (osti_strncmp(buffer, "0x", 2) == 0)
2060 {
2061 tdsaAllShared->OPNRJT_RTRY_INTVL = osti_strtoul (buffer, &pLastUsedChar, 0);
2062 }
2063 else
2064 {
2065 tdsaAllShared->OPNRJT_RTRY_INTVL = osti_strtoul (buffer, &pLastUsedChar, 10);
2066 }
2067 TI_DBG2(("tdsaGetSwConfigParams: OPNRJT_RTRY_INTVL %d\n", tdsaAllShared->OPNRJT_RTRY_INTVL));
2068 }
2069 /* End MFD_OPNRJT_RTRY_INTVL */
2070
2071 /* Start DOPNRJT_RTRY_TMO */
2072 osti_memset(buffer, 0, buffLen);
2073 lenRecv = 0;
2074 tdsaAllShared->DOPNRJT_RTRY_TMO = 128;
2076 tiRoot,
2077 globalStr, /* key */
2078 SwParmsStr, /* subkey1 */
2079 agNULL,/* subkey2 */
2080 agNULL,
2081 agNULL,
2082 agNULL, /* subkey5 */
2083 "SAS_DOPNRJT_RTRY_TMO", /* valueName */
2084 buffer,
2085 buffLen,
2086 &lenRecv
2087 ) == tiSuccess) && (lenRecv != 0))
2088 {
2089 if (osti_strncmp(buffer, "0x", 2) == 0)
2090 {
2091 tdsaAllShared->DOPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
2092 }
2093 else
2094 {
2095 tdsaAllShared->DOPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
2096 }
2097 TI_DBG2(("tdsaGetSwConfigParams: DOPNRJT_RTRY_TMO %d\n", tdsaAllShared->DOPNRJT_RTRY_TMO));
2098 }
2099 /* End DOPNRJT_RTRY_TMO */
2100
2101 /* Start COPNRJT_RTRY_TMO */
2102 osti_memset(buffer, 0, buffLen);
2103 lenRecv = 0;
2104// tdsaAllShared->COPNRJT_RTRY_TMO = 32;
2105 tdsaAllShared->COPNRJT_RTRY_TMO = 128;
2107 tiRoot,
2108 globalStr, /* key */
2109 SwParmsStr, /* subkey1 */
2110 agNULL,/* subkey2 */
2111 agNULL,
2112 agNULL,
2113 agNULL, /* subkey5 */
2114 "SAS_COPNRJT_RTRY_TMO", /* valueName */
2115 buffer,
2116 buffLen,
2117 &lenRecv
2118 ) == tiSuccess) && (lenRecv != 0))
2119 {
2120 if (osti_strncmp(buffer, "0x", 2) == 0)
2121 {
2122 tdsaAllShared->COPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 0);
2123 }
2124 else
2125 {
2126 tdsaAllShared->COPNRJT_RTRY_TMO = osti_strtoul (buffer, &pLastUsedChar, 10);
2127 }
2128 TI_DBG2(("tdsaGetSwConfigParams: COPNRJT_RTRY_TMO %d\n", tdsaAllShared->COPNRJT_RTRY_TMO));
2129 }
2130 /* End COPNRJT_RTRY_TMO */
2131
2132 /* Start DOPNRJT_RTRY_THR */
2133 osti_memset(buffer, 0, buffLen);
2134 lenRecv = 0;
2135// tdsaAllShared->DOPNRJT_RTRY_THR = 16; /* FW default */
2136 /*
2137 Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
2138 Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 is tdsaAllShared->DOPNRJT_RTRY_TMO
2139 */
2140 tdsaAllShared->DOPNRJT_RTRY_THR = 23438;
2142 tiRoot,
2143 globalStr, /* key */
2144 SwParmsStr, /* subkey1 */
2145 agNULL,/* subkey2 */
2146 agNULL,
2147 agNULL,
2148 agNULL, /* subkey5 */
2149 "SAS_DOPNRJT_RTRY_THR", /* valueName */
2150 buffer,
2151 buffLen,
2152 &lenRecv
2153 ) == tiSuccess) && (lenRecv != 0))
2154 {
2155 if (osti_strncmp(buffer, "0x", 2) == 0)
2156 {
2157 tdsaAllShared->DOPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 0);
2158 }
2159 else
2160 {
2161 tdsaAllShared->DOPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 10);
2162 }
2163 TI_DBG2(("tdsaGetSwConfigParams: DOPNRJT_RTRY_THR %d\n", tdsaAllShared->DOPNRJT_RTRY_THR));
2164 }
2165 /* End DOPNRJT_RTRY_THR */
2166
2167 /* Start COPNRJT_RTRY_THR */
2168 osti_memset(buffer, 0, buffLen);
2169 lenRecv = 0;
2170// tdsaAllShared->COPNRJT_RTRY_THR = 1024; /* FW default */
2171 /*
2172 Making ORR bigger than IT NEXUS LOSS which is 2000000us = 2 second.
2173 Assuming a bigger value 3 second, 3000000/128 = 23437.5 where 128 is tdsaAllShared->COPNRJT_RTRY_TMO
2174 */
2175 tdsaAllShared->COPNRJT_RTRY_THR = 23438;
2177 tiRoot,
2178 globalStr, /* key */
2179 SwParmsStr, /* subkey1 */
2180 agNULL,/* subkey2 */
2181 agNULL,
2182 agNULL,
2183 agNULL, /* subkey5 */
2184 "SAS_COPNRJT_RTRY_THR", /* valueName */
2185 buffer,
2186 buffLen,
2187 &lenRecv
2188 ) == tiSuccess) && (lenRecv != 0))
2189 {
2190 if (osti_strncmp(buffer, "0x", 2) == 0)
2191 {
2192 tdsaAllShared->COPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 0);
2193 }
2194 else
2195 {
2196 tdsaAllShared->COPNRJT_RTRY_THR = osti_strtoul (buffer, &pLastUsedChar, 10);
2197 }
2198 TI_DBG2(("tdsaGetSwConfigParams: COPNRJT_RTRY_THR %d\n", tdsaAllShared->COPNRJT_RTRY_THR));
2199 }
2200 /* End COPNRJT_RTRY_THR */
2201
2202 /* Start MAX_AIP */
2203 osti_memset(buffer, 0, buffLen);
2204 lenRecv = 0;
2205 tdsaAllShared->MAX_AIP = 0x200000;
2207 tiRoot,
2208 globalStr, /* key */
2209 SwParmsStr, /* subkey1 */
2210 agNULL,/* subkey2 */
2211 agNULL,
2212 agNULL,
2213 agNULL, /* subkey5 */
2214 "SAS_MAX_AIP", /* valueName */
2215 buffer,
2216 buffLen,
2217 &lenRecv
2218 ) == tiSuccess) && (lenRecv != 0))
2219 {
2220 if (osti_strncmp(buffer, "0x", 2) == 0)
2221 {
2222 tdsaAllShared->MAX_AIP = osti_strtoul (buffer, &pLastUsedChar, 0);
2223 }
2224 else
2225 {
2226 tdsaAllShared->MAX_AIP = osti_strtoul (buffer, &pLastUsedChar, 10);
2227 }
2228 TI_DBG2(("tdsaGetSwConfigParams: MAX_AIP %d\n", tdsaAllShared->MAX_AIP));
2229 }
2230 /* End MAX_AIP */
2231
2232 /***********************************************************************/
2233 osti_memset(buffer, 0, buffLen);
2234 lenRecv = 0;
2235
2236
2237 /*
2238 typedef struct agsaMPIContext_s
2239 {
2240 bit32 MPITableType;
2241 bit32 offset;
2242 bit32 value;
2243 } agsaMPIContext_t;
2244 */
2245
2246 {
2247 bit32 MpiContextvalue = 0;
2248 SwConfig->mpiContextTable = agNULL;
2249 SwConfig->mpiContextTablelen = 0;
2250
2252 tiRoot,
2253 globalStr, /* key */
2254 SwParmsStr, /* subkey1 */
2255 agNULL, /* subkey2 */
2256 agNULL,
2257 agNULL,
2258 agNULL, /* subkey5 */
2259 "MpiContext", /* valueName */
2260 buffer,
2261 buffLen,
2262 &lenRecv
2263 ) == tiSuccess) && (lenRecv != 0))
2264 {
2265
2266 if (osti_strncmp(buffer, "0x", 2) == 0)
2267 {
2268 MpiContextvalue = osti_strtoul (buffer, &pLastUsedChar, 0);
2269 }
2270 else
2271 {
2272 MpiContextvalue = osti_strtoul (buffer, &pLastUsedChar, 10);
2273 }
2274
2275
2276 if (MpiContextvalue == 0)
2277 {
2278 SwConfig->mpiContextTable = agNULL;
2279 SwConfig->mpiContextTablelen = 0;
2280 }
2281 else
2282 {
2283 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
2284 if(agNULL != tdsaRoot)
2285 {
2286 tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = 0xFF;
2287 tdsaRoot->tdsaAllShared.MpiOverride.offset = 0;
2288 tdsaRoot->tdsaAllShared.MpiOverride.value = 0;
2289
2290 SwConfig->mpiContextTable = &(tdsaRoot->tdsaAllShared.MpiOverride);
2291 SwConfig->mpiContextTablelen = sizeof(agsaMPIContext_t);
2292 }
2293
2294 TI_DBG1(("tdsaGetSwConfigParams: MpiContext %p Len %d\n", SwConfig->mpiContextTable, SwConfig->mpiContextTablelen));
2295
2296 }
2297 }
2298
2299 if(SwConfig->mpiContextTable != agNULL )
2300 {
2301 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *)tiRoot->tdData;
2302 if(agNULL != tdsaRoot)
2303 {
2305 tiRoot,
2306 globalStr, /* key */
2307 SwParmsStr, /* subkey1 */
2308 agNULL, /* subkey2 */
2309 agNULL,
2310 agNULL,
2311 agNULL, /* subkey5 */
2312 "MpiTableType", /* valueName */
2313 buffer,
2314 buffLen,
2315 &lenRecv
2316 ) == tiSuccess) && (lenRecv != 0))
2317 {
2318 if (osti_strncmp(buffer, "0x", 2) == 0)
2319 {
2320 tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = osti_strtoul (buffer, &pLastUsedChar, 0);
2321 }
2322 else
2323 {
2324 tdsaRoot->tdsaAllShared.MpiOverride.MPITableType = osti_strtoul (buffer, &pLastUsedChar, 10);
2325 }
2326 TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.MPITableType 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.MPITableType ));
2327 }
2328
2330 tiRoot,
2331 globalStr, /* key */
2332 SwParmsStr, /* subkey1 */
2333 agNULL, /* subkey2 */
2334 agNULL,
2335 agNULL,
2336 agNULL, /* subkey5 */
2337 "MpiTableOffset", /* valueName */
2338 buffer,
2339 buffLen,
2340 &lenRecv
2341 ) == tiSuccess) && (lenRecv != 0))
2342 {
2343 if (osti_strncmp(buffer, "0x", 2) == 0)
2344 {
2345 tdsaRoot->tdsaAllShared.MpiOverride.offset = osti_strtoul (buffer, &pLastUsedChar, 0);
2346 }
2347 else
2348 {
2349 tdsaRoot->tdsaAllShared.MpiOverride.offset = osti_strtoul (buffer, &pLastUsedChar, 10);
2350 }
2351
2352 TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.offset 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.offset ));
2353 }
2354
2356 tiRoot,
2357 globalStr, /* key */
2358 SwParmsStr, /* subkey1 */
2359 agNULL, /* subkey2 */
2360 agNULL,
2361 agNULL,
2362 agNULL, /* subkey5 */
2363 "MpiTableValue", /* valueName */
2364 buffer,
2365 buffLen,
2366 &lenRecv
2367 ) == tiSuccess) && (lenRecv != 0))
2368 {
2369 if (osti_strncmp(buffer, "0x", 2) == 0)
2370 {
2371 tdsaRoot->tdsaAllShared.MpiOverride.value = osti_strtoul (buffer, &pLastUsedChar, 0);
2372 }
2373 else
2374 {
2375 tdsaRoot->tdsaAllShared.MpiOverride.value = osti_strtoul (buffer, &pLastUsedChar, 10);
2376 }
2377 TI_DBG1(("tdsaGetSwConfigParams: MpiOverride.value 0x%X\n",tdsaRoot->tdsaAllShared.MpiOverride.value ));
2378 }
2379 }
2380 }
2381 }
2382 /***********************************************************************/
2383
2384#ifdef SA_ENABLE_PCI_TRIGGER
2385
2386 osti_memset(buffer, 0, buffLen);
2387 lenRecv = 0;
2388
2390 tiRoot,
2391 globalStr, /* key */
2392 SwParmsStr, /* subkey1 */
2393 agNULL, /* subkey2 */
2394 agNULL,
2395 agNULL,
2396 agNULL, /* subkey5 */
2397 "PciTrigger", /* valueName */
2398 buffer,
2399 buffLen,
2400 &lenRecv
2401 ) == tiSuccess) && (lenRecv != 0))
2402 {
2403
2404 if (osti_strncmp(buffer, "0x", 2) == 0)
2405 {
2406 SwConfig->PCI_trigger = osti_strtoul (buffer, &pLastUsedChar, 0);
2407 }
2408 else
2409 {
2410 SwConfig->PCI_trigger = osti_strtoul (buffer, &pLastUsedChar, 10);
2411 }
2412 TI_DBG1(("tdsaGetSwConfigParams: PciTrigger %d\n",SwConfig->PCI_trigger));
2413 }
2414#endif /* SA_ENABLE_PCI_TRIGGER */
2415
2416
2417 TI_DBG6(("tdsaGetSwConfigParams: $$$$$$$$$$$$$$$$$ merge $$$$$$$$$$$$$\n"));
2418#if defined(SALLSDK_DEBUG)
2419 TI_DBG2(("tdsaGetSwConfigParams: SwConfig->sallDebugLevel %d\n", SwConfig->sallDebugLevel));
2420#endif
2421
2422#ifdef SA_ENABLE_PCI_TRIGGER
2423 TI_DBG1(("tdsaGetSwConfigParams: SwConfig->PCI_trigger 0x%x 0x%x\n",SwConfig->PCI_trigger, tdsaRoot->itdsaIni->tdsaAllShared->SwConfig.PCI_trigger));
2424#endif /* SA_ENABLE_PCI_TRIGGER */
2425
2426
2427#ifdef AGTIAPI_CTL
2428 TI_DBG6(("tdsaLoLevelGetResource: SASConnectTimeLimit 0x%x\n",
2429 tdsaAllShared->SASConnectTimeLimit));
2430#endif
2431
2432 return;
2433}
2434
2435/*****************************************************************************
2436*! \brief tdsaParseLinkRateMode
2437*
2438* Purpose: This function parses link rate and mode.
2439*
2440* \param LinkRate: Link rate specified by user.
2441* \param Mode: Link rate specified by user.
2442*
2443* \return:
2444* Value combined with Linkrate and Mode
2445*
2446* \note:
2447*
2448*****************************************************************************/
2449osGLOBAL void
2452 bit32 index,
2453 bit32 LinkRateRead,
2454 bit32 ModeRead,
2455 bit32 OpticalModeRead,
2456 bit32 LinkRate,
2457 bit32 Mode,
2458 bit32 OpticalMode
2459 )
2460{
2461 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2462 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
2463
2464 TI_DBG3(("tdsaParseLinkRateMode: index 0x%X\n",index));
2465 TI_DBG3(("tdsaParseLinkRateMode: LinkRateRead 0x%X LinkRate 0x%X\n",LinkRateRead,LinkRate));
2466 TI_DBG3(("tdsaParseLinkRateMode: ModeRead 0x%X Mode 0x%X\n",ModeRead,Mode));
2467 TI_DBG3(("tdsaParseLinkRateMode: OpticalModeRead 0x%X OpticalMode 0x%X\n",OpticalModeRead,OpticalMode));
2468
2469
2470 if (LinkRateRead == agTRUE)
2471 {
2472 /* link rate */
2473 if (LinkRate & 0x1)
2474 {
2475 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x1;
2476 }
2477 if (LinkRate & 0x2)
2478 {
2479 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x2;
2480 }
2481 if (LinkRate & 0x4)
2482 {
2483 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x4;
2484 }
2485 if (LinkRate & 0x8)
2486 {
2487 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x8;
2488 }
2489 if (LinkRate == 0 || LinkRate > 0xF )
2490 {
2491 /* not allowed, set the rate to default 1.5 G */
2492 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = 0;
2493 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x1;
2494 TI_DBG1(("tdsaParseLinkRateMode: LinkRate == 0 || LinkRate >= 0x%x\n",tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2495 }
2496 TI_DBG2(("tdsaParseLinkRateMode:A index 0x%x LinkRate 0x%x Mode 0x%x\n",index,LinkRate,Mode));
2497
2498 }
2499
2500 if ( ModeRead == agTRUE)
2501 {
2502 /* mode */
2503 if (Mode & 0x1)
2504 {
2505 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x10;
2506 }
2507 if (Mode & 0x2)
2508 {
2509 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x20;
2510 }
2511 if (Mode == 0 || Mode >= 4 )
2512 {
2513 /* not allowed, set the mode to default SAS/SATA */
2514 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties & 0xf;
2515 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | 0x30;
2516 }
2517 TI_DBG2(("tdsaParseLinkRateMode:1 index 0x%x Mode 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2518 }
2519
2520 if ( OpticalModeRead == agTRUE)
2521 {
2522 /* setting bit20 */
2523 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
2524
2525 if (OpticalMode == 0)
2526 {
2527 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 0 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2528 }
2529 else if(OpticalMode == 1)
2530 {
2531 if(tIsSPCV12or6G(agRoot))
2532 {
2533 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 1 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2534 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 22);
2535 }
2536 else
2537 {
2538 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 22);
2539 tdsaAllShared->Ports[index].agPhyConfig.phyProperties &= 0xFFFFFFF0;
2540 tdsaAllShared->Ports[index].agPhyConfig.phyProperties |= 0x4;
2541 }
2542 }
2543 else if(OpticalMode == 2 )
2544 {
2545 if(tIsSPCV12or6G(agRoot))
2546 {
2547 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode 2 phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2548 tdsaAllShared->Ports[index].agPhyConfig.phyProperties = tdsaAllShared->Ports[index].agPhyConfig.phyProperties | (1 << 20);
2549 }
2550 else
2551 {
2552 TD_ASSERT(0, "SPC optical mode 2");
2553 }
2554
2555 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode %d phy %d phyProperties 0x%x\n",OpticalMode,index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2556 }
2557 else
2558 {
2559 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode unknown %d phy %d phyProperties 0x%x\n",OpticalMode,index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2560 }
2561 }
2562 else
2563 {
2564 TI_DBG1(("tdsaParseLinkRateMode: OpticalMode off phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2565 }
2566
2567 TI_DBG1(("tdsaParseLinkRateMode: phy %d phyProperties 0x%x\n",index,tdsaAllShared->Ports[index].agPhyConfig.phyProperties));
2568
2569
2570 return;
2571}
2572
2573
2574/*****************************************************************************
2575*! \brief tdsaGetHwConfigParams
2576*
2577* Purpose: This function reads hardware configuration parameters from the
2578* configuration file
2579*
2580* \param tiRoot: Pointer to driver/port instance.
2581*
2582* \return: None
2583*
2584* \note -
2585*
2586*****************************************************************************/
2587osGLOBAL void
2590 )
2591{
2592 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
2593 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
2594 agsaHwConfig_t *HwConfig;
2595 char *buffer;
2596 bit32 buffLen;
2597 bit32 lenRecv = 0;
2598 char *pLastUsedChar = agNULL;
2599 char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
2600 char globalStr[] = "Global";
2601 char HwParmsStr[] = "HWParms";
2602 char phyReg[10];
2603 int i,j;
2604 agsaPhyAnalogSetupTable_t *phyRegTable;
2605
2606 TI_DBG6(("tdsaGetHwConfigParams: start\n"));
2607 TI_DBG6(("tdsaGetHwConfigParams: tdsaRoot %p tdsaAllShared %p \n",tdsaRoot, tdsaAllShared));
2608
2609 buffer = tmpBuffer;
2610 buffLen = sizeof(tmpBuffer);
2611
2612 osti_memset(buffer, 0, buffLen);
2613
2614 HwConfig = (agsaHwConfig_t *)&(tdsaAllShared->HwConfig);
2615 phyRegTable = (agsaPhyAnalogSetupTable_t *)&(HwConfig->phyAnalogConfig);
2616
2617 osti_memset(HwConfig, 0, sizeof(agsaHwConfig_t));
2618
2619 /*
2620 just default values
2621 and are overwritten later by the configuration file contents
2622 turning off hw control interrupt coalescing
2623 */
2624 tdsaAllShared->FWMaxPorts = DEFAULT_FW_MAX_PORTS; /* 8, applicable only to SPC not to SPCv */
2625 HwConfig->phyCount = TD_MAX_NUM_PHYS;
2626 HwConfig->hwInterruptCoalescingTimer = 1;
2627 HwConfig->hwInterruptCoalescingControl = 0;
2628 tdsaAllShared->phyCalibration = 0;
2629 HwConfig->hwOption = 0; /* default: PI/CI addresses are 32-bit */
2630
2631 osti_memset(buffer, 0, buffLen);
2632 lenRecv = 0;
2633
2635 tiRoot,
2636 globalStr, /* key */
2637 HwParmsStr, /* subkey1 */
2638 agNULL, /* subkey2 */
2639 agNULL,
2640 agNULL,
2641 agNULL, /* subkey5 */
2642 "HwIntCoalTimer", /* valueName */
2643 buffer,
2644 buffLen,
2645 &lenRecv
2646 ) == tiSuccess) && (lenRecv != 0))
2647 {
2648 if (osti_strncmp(buffer, "0x", 2) == 0)
2649 {
2650 HwConfig->hwInterruptCoalescingTimer = osti_strtoul (buffer, &pLastUsedChar, 0);
2651 }
2652 else
2653 {
2654 HwConfig->hwInterruptCoalescingTimer = osti_strtoul (buffer, &pLastUsedChar, 10);
2655 }
2656 }
2657
2658 osti_memset(buffer, 0, buffLen);
2659 lenRecv = 0;
2660
2662 tiRoot,
2663 globalStr, /* key */
2664 HwParmsStr, /* subkey1 */
2665 agNULL, /* subkey2 */
2666 agNULL,
2667 agNULL,
2668 agNULL, /* subkey5 */
2669 "HwIntCoalControl", /* valueName */
2670 buffer,
2671 buffLen,
2672 &lenRecv
2673 ) == tiSuccess) && (lenRecv != 0))
2674 {
2675 if (osti_strncmp(buffer, "0x", 2) == 0)
2676 {
2677 HwConfig->hwInterruptCoalescingControl = osti_strtoul (buffer, &pLastUsedChar, 0);
2678 }
2679 else
2680 {
2681 HwConfig->hwInterruptCoalescingControl = osti_strtoul (buffer, &pLastUsedChar, 10);
2682 }
2683 }
2684
2685 /* For hwInterruptCoalescingTimer, 0 disables interrrupt, not allowed */
2686 if (HwConfig->hwInterruptCoalescingControl == 1 && HwConfig->hwInterruptCoalescingTimer == 0)
2687 {
2688 HwConfig->hwInterruptCoalescingTimer = 1;
2689 }
2690
2691 osti_memset(buffer, 0, buffLen);
2692 lenRecv = 0;
2693
2694 /* interrupt reassetion field*/
2696 tiRoot,
2697 globalStr, /* key */
2698 HwParmsStr, /* subkey1 */
2699 agNULL, /* subkey2 */
2700 agNULL,
2701 agNULL,
2702 agNULL, /* subkey5 */
2703 "IntReassertionOpt", /* valueName */
2704 buffer,
2705 buffLen,
2706 &lenRecv
2707 ) == tiSuccess) && (lenRecv != 0))
2708 {
2709 if (osti_strncmp(buffer, "0x", 2) == 0)
2710 {
2711 HwConfig->intReassertionOption = osti_strtoul (buffer, &pLastUsedChar, 0);
2712 }
2713 else
2714 {
2715 HwConfig->intReassertionOption = osti_strtoul (buffer, &pLastUsedChar, 10);
2716 }
2717 }
2718
2719 osti_memset(buffer, 0, buffLen);
2720 lenRecv = 0;
2721
2722 /* interrupt reassetion field*/
2724 tiRoot,
2725 globalStr, /* key */
2726 HwParmsStr, /* subkey1 */
2727 agNULL, /* subkey2 */
2728 agNULL,
2729 agNULL,
2730 agNULL, /* subkey5 */
2731 "HwOption", /* valueName */
2732 buffer,
2733 buffLen,
2734 &lenRecv
2735 ) == tiSuccess) && (lenRecv != 0))
2736 {
2737 if (osti_strncmp(buffer, "0x", 2) == 0)
2738 {
2739 HwConfig->hwOption = osti_strtoul (buffer, &pLastUsedChar, 0);
2740 }
2741 else
2742 {
2743 HwConfig->hwOption = osti_strtoul (buffer, &pLastUsedChar, 10);
2744 }
2745 }
2746
2747 osti_memset(buffer, 0, buffLen);
2748 lenRecv = 0;
2749
2750 /* interrupt reassetion field*/
2752 tiRoot,
2753 globalStr, /* key */
2754 HwParmsStr, /* subkey1 */
2755 agNULL, /* subkey2 */
2756 agNULL,
2757 agNULL,
2758 agNULL, /* subkey5 */
2759 "MaxFWPorts", /* valueName */
2760 buffer,
2761 buffLen,
2762 &lenRecv
2763 ) == tiSuccess) && (lenRecv != 0))
2764 {
2765 if (osti_strncmp(buffer, "0x", 2) == 0)
2766 {
2767 tdsaAllShared->FWMaxPorts = osti_strtoul (buffer, &pLastUsedChar, 0);
2768 }
2769 else
2770 {
2771 tdsaAllShared->FWMaxPorts = osti_strtoul (buffer, &pLastUsedChar, 10);
2772 }
2773 }
2774
2775 osti_memset(buffer, 0, buffLen);
2776 lenRecv = 0;
2777
2779 tiRoot,
2780 globalStr, /* key */
2781 HwParmsStr, /* subkey1 */
2782 agNULL, /* subkey2 */
2783 agNULL,
2784 agNULL,
2785 agNULL, /* subkey5 */
2786 "phyCalibration", /* valueName */
2787 buffer,
2788 buffLen,
2789 &lenRecv
2790 ) == tiSuccess) && (lenRecv != 0))
2791 {
2792 if (osti_strncmp(buffer, "0x", 2) == 0)
2793 {
2794 tdsaAllShared->phyCalibration = osti_strtoul (buffer, &pLastUsedChar, 0);
2795 }
2796 else
2797 {
2798 tdsaAllShared->phyCalibration = osti_strtoul (buffer, &pLastUsedChar, 10);
2799 }
2800 }
2801
2802 osti_memset(buffer, 0, buffLen);
2803 lenRecv = 0;
2804
2805
2806 /* phy calibration */
2807 for (i=0;i<MAX_INDEX;i++)
2808 {
2809 for(j=0;j<10;j++)
2810 {
2811 osti_sprintf(phyReg,"spaReg%d%d",i,j);
2812 TI_DBG6(("tdsaGetHwConfigParams: phyReg %s\n", phyReg));
2813
2814 if (j == 0)
2815 {
2817 tiRoot,
2818 globalStr, /* key */
2819 HwParmsStr, /* subkey1 */
2820 agNULL, /* subkey2 */
2821 agNULL,
2822 agNULL,
2823 agNULL, /* subkey5 */
2824 phyReg, /* valueName */
2825 buffer,
2826 buffLen,
2827 &lenRecv
2828 ) == tiSuccess) && (lenRecv != 0))
2829 {
2830 if (osti_strncmp(buffer, "0x", 2) == 0)
2831 {
2832 phyRegTable->phyAnalogSetupRegisters[i].spaRegister0 = osti_strtoul (buffer, &pLastUsedChar, 0);
2833 }
2834 else
2835 {
2836 phyRegTable->phyAnalogSetupRegisters[i].spaRegister0 = osti_strtoul (buffer, &pLastUsedChar, 10);
2837 }
2838 }
2839
2840 osti_memset(buffer, 0, buffLen);
2841 lenRecv = 0;
2842 }
2843 else if (j == 1)
2844 {
2846 tiRoot,
2847 globalStr, /* key */
2848 HwParmsStr, /* subkey1 */
2849 agNULL, /* subkey2 */
2850 agNULL,
2851 agNULL,
2852 agNULL, /* subkey5 */
2853 phyReg, /* valueName */
2854 buffer,
2855 buffLen,
2856 &lenRecv
2857 ) == tiSuccess) && (lenRecv != 0))
2858 {
2859 if (osti_strncmp(buffer, "0x", 2) == 0)
2860 {
2861 phyRegTable->phyAnalogSetupRegisters[i].spaRegister1 = osti_strtoul (buffer, &pLastUsedChar, 0);
2862 }
2863 else
2864 {
2865 phyRegTable->phyAnalogSetupRegisters[i].spaRegister1 = osti_strtoul (buffer, &pLastUsedChar, 10);
2866 }
2867 }
2868
2869 osti_memset(buffer, 0, buffLen);
2870 lenRecv = 0;
2871 }
2872 else if (j == 2)
2873 {
2875 tiRoot,
2876 globalStr, /* key */
2877 HwParmsStr, /* subkey1 */
2878 agNULL, /* subkey2 */
2879 agNULL,
2880 agNULL,
2881 agNULL, /* subkey5 */
2882 phyReg, /* valueName */
2883 buffer,
2884 buffLen,
2885 &lenRecv
2886 ) == tiSuccess) && (lenRecv != 0))
2887 {
2888 if (osti_strncmp(buffer, "0x", 2) == 0)
2889 {
2890 phyRegTable->phyAnalogSetupRegisters[i].spaRegister2 = osti_strtoul (buffer, &pLastUsedChar, 0);
2891 }
2892 else
2893 {
2894 phyRegTable->phyAnalogSetupRegisters[i].spaRegister2 = osti_strtoul (buffer, &pLastUsedChar, 10);
2895 }
2896 }
2897
2898 osti_memset(buffer, 0, buffLen);
2899 lenRecv = 0;
2900 }
2901 else if (j == 3)
2902 {
2904 tiRoot,
2905 globalStr, /* key */
2906 HwParmsStr, /* subkey1 */
2907 agNULL, /* subkey2 */
2908 agNULL,
2909 agNULL,
2910 agNULL, /* subkey5 */
2911 phyReg, /* valueName */
2912 buffer,
2913 buffLen,
2914 &lenRecv
2915 ) == tiSuccess) && (lenRecv != 0))
2916 {
2917 if (osti_strncmp(buffer, "0x", 2) == 0)
2918 {
2919 phyRegTable->phyAnalogSetupRegisters[i].spaRegister3 = osti_strtoul (buffer, &pLastUsedChar, 0);
2920 }
2921 else
2922 {
2923 phyRegTable->phyAnalogSetupRegisters[i].spaRegister3 = osti_strtoul (buffer, &pLastUsedChar, 10);
2924 }
2925 }
2926
2927 osti_memset(buffer, 0, buffLen);
2928 lenRecv = 0;
2929 }
2930 else if (j == 4)
2931 {
2933 tiRoot,
2934 globalStr, /* key */
2935 HwParmsStr, /* subkey1 */
2936 agNULL, /* subkey2 */
2937 agNULL,
2938 agNULL,
2939 agNULL, /* subkey5 */
2940 phyReg, /* valueName */
2941 buffer,
2942 buffLen,
2943 &lenRecv
2944 ) == tiSuccess) && (lenRecv != 0))
2945 {
2946 if (osti_strncmp(buffer, "0x", 2) == 0)
2947 {
2948 phyRegTable->phyAnalogSetupRegisters[i].spaRegister4 = osti_strtoul (buffer, &pLastUsedChar, 0);
2949 }
2950 else
2951 {
2952 phyRegTable->phyAnalogSetupRegisters[i].spaRegister4 = osti_strtoul (buffer, &pLastUsedChar, 10);
2953 }
2954 }
2955
2956 osti_memset(buffer, 0, buffLen);
2957 lenRecv = 0;
2958 }
2959 else if (j == 5)
2960 {
2962 tiRoot,
2963 globalStr, /* key */
2964 HwParmsStr, /* subkey1 */
2965 agNULL, /* subkey2 */
2966 agNULL,
2967 agNULL,
2968 agNULL, /* subkey5 */
2969 phyReg, /* valueName */
2970 buffer,
2971 buffLen,
2972 &lenRecv
2973 ) == tiSuccess) && (lenRecv != 0))
2974 {
2975 if (osti_strncmp(buffer, "0x", 2) == 0)
2976 {
2977 phyRegTable->phyAnalogSetupRegisters[i].spaRegister5 = osti_strtoul (buffer, &pLastUsedChar, 0);
2978 }
2979 else
2980 {
2981 phyRegTable->phyAnalogSetupRegisters[i].spaRegister5 = osti_strtoul (buffer, &pLastUsedChar, 10);
2982 }
2983 }
2984
2985 osti_memset(buffer, 0, buffLen);
2986 lenRecv = 0;
2987 }
2988 else if (j == 6)
2989 {
2991 tiRoot,
2992 globalStr, /* key */
2993 HwParmsStr, /* subkey1 */
2994 agNULL, /* subkey2 */
2995 agNULL,
2996 agNULL,
2997 agNULL, /* subkey5 */
2998 phyReg, /* valueName */
2999 buffer,
3000 buffLen,
3001 &lenRecv
3002 ) == tiSuccess) && (lenRecv != 0))
3003 {
3004 if (osti_strncmp(buffer, "0x", 2) == 0)
3005 {
3006 phyRegTable->phyAnalogSetupRegisters[i].spaRegister6 = osti_strtoul (buffer, &pLastUsedChar, 0);
3007 }
3008 else
3009 {
3010 phyRegTable->phyAnalogSetupRegisters[i].spaRegister6 = osti_strtoul (buffer, &pLastUsedChar, 10);
3011 }
3012 }
3013
3014 osti_memset(buffer, 0, buffLen);
3015 lenRecv = 0;
3016 }
3017 else if (j == 7)
3018 {
3020 tiRoot,
3021 globalStr, /* key */
3022 HwParmsStr, /* subkey1 */
3023 agNULL, /* subkey2 */
3024 agNULL,
3025 agNULL,
3026 agNULL, /* subkey5 */
3027 phyReg, /* valueName */
3028 buffer,
3029 buffLen,
3030 &lenRecv
3031 ) == tiSuccess) && (lenRecv != 0))
3032 {
3033 if (osti_strncmp(buffer, "0x", 2) == 0)
3034 {
3035 phyRegTable->phyAnalogSetupRegisters[i].spaRegister7 = osti_strtoul (buffer, &pLastUsedChar, 0);
3036 }
3037 else
3038 {
3039 phyRegTable->phyAnalogSetupRegisters[i].spaRegister7 = osti_strtoul (buffer, &pLastUsedChar, 10);
3040 }
3041 }
3042
3043 osti_memset(buffer, 0, buffLen);
3044 lenRecv = 0;
3045 }
3046 else if (j == 8)
3047 {
3049 tiRoot,
3050 globalStr, /* key */
3051 HwParmsStr, /* subkey1 */
3052 agNULL, /* subkey2 */
3053 agNULL,
3054 agNULL,
3055 agNULL, /* subkey5 */
3056 phyReg, /* valueName */
3057 buffer,
3058 buffLen,
3059 &lenRecv
3060 ) == tiSuccess) && (lenRecv != 0))
3061 {
3062 if (osti_strncmp(buffer, "0x", 2) == 0)
3063 {
3064 phyRegTable->phyAnalogSetupRegisters[i].spaRegister8 = osti_strtoul (buffer, &pLastUsedChar, 0);
3065 }
3066 else
3067 {
3068 phyRegTable->phyAnalogSetupRegisters[i].spaRegister8 = osti_strtoul (buffer, &pLastUsedChar, 10);
3069 }
3070 }
3071
3072 osti_memset(buffer, 0, buffLen);
3073 lenRecv = 0;
3074 }
3075 else if (j == 9)
3076 {
3078 tiRoot,
3079 globalStr, /* key */
3080 HwParmsStr, /* subkey1 */
3081 agNULL, /* subkey2 */
3082 agNULL,
3083 agNULL,
3084 agNULL, /* subkey5 */
3085 phyReg, /* valueName */
3086 buffer,
3087 buffLen,
3088 &lenRecv
3089 ) == tiSuccess) && (lenRecv != 0))
3090 {
3091 if (osti_strncmp(buffer, "0x", 2) == 0)
3092 {
3093 phyRegTable->phyAnalogSetupRegisters[i].spaRegister9 = osti_strtoul (buffer, &pLastUsedChar, 0);
3094 }
3095 else
3096 {
3097 phyRegTable->phyAnalogSetupRegisters[i].spaRegister9 = osti_strtoul (buffer, &pLastUsedChar, 10);
3098 }
3099 }
3100
3101 osti_memset(buffer, 0, buffLen);
3102 lenRecv = 0;
3103 }
3104
3105 } /* inner loop */
3106 } /* outer loop */
3107 return;
3108}
3109/*****************************************************************************
3110*! \brief tdsaGetCardPhyParams
3111*
3112* Purpose: This function reads phy-related configuration parameters from the
3113* configuration file
3114*
3115* \param tiRoot: Pointer to driver/port instance.
3116*
3117* \return: None
3118*
3119* \note - just a place holder for now
3120*
3121*****************************************************************************/
3122osGLOBAL void
3125 )
3126{
3127 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3128 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
3129 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
3130 char *buffer;
3131 bit32 buffLen;
3132 bit32 lenRecv = 0;
3133 char *pLastUsedChar = agNULL;
3134 char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
3135 char *globalStr = tdsaAllShared->CardIDString;
3136 char phyParmsStr[12];
3137 int i;
3138 bit32 LinkRate = 15, Mode = 3, OpticalMode = 0; //VG
3139 bit32 LinkRateRead = agTRUE, ModeRead = agFALSE, OpticalModeRead = agFALSE;
3140 bit32 flag = agFALSE; /* true only for PM8008 or PM8009 (SPCv and SPCve) controller */
3141
3142 TI_DBG6(("tdsaGetCardPhyParams: start \n"));
3143 TI_DBG6(("tdsaGetCardPhyParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
3144
3145 if (tiIS_8PHY(agRoot))
3146 {
3147 TI_DBG6(("tdsaGetCardPhyParams: SPCv or SPCve \n"));
3148 flag = agTRUE;
3149 }
3150 TI_DBG6(("tdsaGetCardPhyParams: flag %d\n", flag));
3151
3152#ifdef REMOVED
3153#ifdef FPGA_CARD
3154 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3155 {
3156 /* setting default phy properties */
3157 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3158 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
3159 /* 1.5G only, SAS/SATA, no spin-up control */
3160 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 */
3161 }
3162#else
3163#ifdef INITIATOR_DRIVER
3164 /* ASIC */
3165 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3166 {
3167 /* setting default phy properties */
3168 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3169 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
3170 /* 1.5G/3G , SAS/SATA, no spin-up control */
3171 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x37; /* 55 */
3172 TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3173 }
3174#endif
3175
3176#ifdef TARGET_DRIVER
3177 /* ASIC */
3178 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3179 {
3180 /* setting default phy properties */
3181 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3182 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
3183 /* 1.5G/3G , SAS/SATA, no spin-up control */
3184 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x37; /* 55 */
3185 TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3186 }
3187#endif
3188
3189#endif
3190#endif /* REMOVED */
3191
3192
3193 buffer = tmpBuffer;
3194 buffLen = sizeof(tmpBuffer);
3195
3196 osti_memset(buffer, 0, buffLen);
3197 lenRecv = 0;
3198
3199 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3200 {
3201 if (flag == agFALSE)
3202 {
3203 osti_sprintf(phyParmsStr,"PhyParms%d", i);
3204 }
3205 else
3206 {
3207 if (i >= 4)
3208 {
3209 osti_sprintf(phyParmsStr,"PhyParms%d", i+4);
3210 }
3211 else
3212 {
3213 osti_sprintf(phyParmsStr,"PhyParms%d", i);
3214 }
3215 }
3216
3217 TI_DBG6(("tdsaGetCardPhyParams: i %d PhyParms %s\n", i, phyParmsStr));
3218
3219 TI_DBG2(("tdsaGetCardPhyParams: phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
3220
3221
3223 tiRoot,
3224 globalStr,
3225 phyParmsStr,
3226 agNULL,
3227 agNULL,
3228 agNULL,
3229 agNULL,
3230 "AddrHi",
3231 buffer,
3232 buffLen,
3233 &lenRecv
3234 ) == tiSuccess) && (lenRecv != 0))
3235 {
3236 if (osti_strncmp(buffer, "0x", 2) == 0)
3237 {
3238 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
3239 TI_DBG6(("tdsaGetCardPhyParams: phy %d hi 0x%x \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
3240 }
3241 else
3242 {
3243 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
3244 TI_DBG6(("tdsaGetCardPhyParams: phy %d hi %d \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
3245 }
3246 }
3247
3248
3249 osti_memset(buffer, 0, buffLen);
3250 lenRecv = 0;
3251
3253 tiRoot,
3254 globalStr,
3255 phyParmsStr,
3256 agNULL,
3257 agNULL,
3258 agNULL,
3259 agNULL,
3260 "AddrLow",
3261 buffer,
3262 buffLen,
3263 &lenRecv
3264 ) == tiSuccess) && (lenRecv != 0))
3265 {
3266 if (osti_strncmp(buffer, "0x", 2) == 0)
3267 {
3268 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
3269 TI_DBG6(("tdsaGetCardPhyParams: phy %d lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3270 }
3271 else
3272 {
3273 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
3274 TI_DBG6(("tdsaGetCardPhyParams: phy %d lo %d\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3275 }
3276 }
3277 TI_DBG6(("tdsaGetCardPhyParams: loop phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3278
3279 /* phy properties */
3280 osti_memset(buffer, 0, buffLen);
3281 lenRecv = 0;
3282/*
3283 if ((ostiGetTransportParam (
3284 tiRoot,
3285 globalStr,
3286 phyParmsStr,
3287 agNULL,
3288 agNULL,
3289 agNULL,
3290 agNULL,
3291 "LinkRate",
3292 buffer,
3293 buffLen,
3294 &lenRecv
3295 ) == tiSuccess) && (lenRecv != 0))
3296 {
3297 LinkRateRead = agTRUE;
3298 if (osti_strncmp(buffer, "0x", 2) == 0)
3299 {
3300 LinkRate = osti_strtoul(buffer, &pLastUsedChar, 0);
3301 TI_DBG6(("tdsaGetCardPhyParams: phy %d linkrate 0x%x \n", i, LinkRate));
3302 }
3303 else
3304 {
3305 LinkRate = osti_strtoul(buffer, &pLastUsedChar, 10);
3306 TI_DBG6(("tdsaGetCardPhyParams: phy %d linkrate %d \n", i, LinkRate));
3307 }
3308 }
3309
3310 TI_DBG2(("tdsaGetCardPhyParams: phy %d linkrate %d \n", i, LinkRate));
3311*/
3312
3313 osti_memset(buffer, 0, buffLen);
3314 lenRecv = 0;
3315
3317 tiRoot,
3318 globalStr,
3319 phyParmsStr,
3320 agNULL,
3321 agNULL,
3322 agNULL,
3323 agNULL,
3324 "Mode",
3325 buffer,
3326 buffLen,
3327 &lenRecv
3328 ) == tiSuccess) && (lenRecv != 0))
3329 {
3330 ModeRead = agTRUE;
3331 if (osti_strncmp(buffer, "0x", 2) == 0)
3332 {
3333 Mode = osti_strtoul(buffer, &pLastUsedChar, 0);
3334 TI_DBG6(("tdsaGetCardPhyParams: phy %d Mode 0x%x \n", i, Mode));
3335 }
3336 else
3337 {
3338 Mode = osti_strtoul(buffer, &pLastUsedChar, 10);
3339 TI_DBG6(("tdsaGetCardPhyParams: phy %d Mode %d \n", i, Mode));
3340 }
3341 }
3342
3343 osti_memset(buffer, 0, buffLen);
3344 lenRecv = 0;
3345
3347 tiRoot,
3348 globalStr,
3349 phyParmsStr,
3350 agNULL,
3351 agNULL,
3352 agNULL,
3353 agNULL,
3354 "OpticalMode",
3355 buffer,
3356 buffLen,
3357 &lenRecv
3358 ) == tiSuccess) && (lenRecv != 0))
3359 {
3360 OpticalModeRead = agTRUE;
3361 if (osti_strncmp(buffer, "0x", 2) == 0)
3362 {
3363 OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 0);
3364 TI_DBG6(("tdsaGetCardPhyParams: phy %d OpticalMode 0x%x \n", i, OpticalMode));
3365 }
3366 else
3367 {
3368 OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 10);
3369 TI_DBG6(("tdsaGetCardPhyParams: phy %d OpticalMode %d \n", i, OpticalMode));
3370 }
3371 }
3372
3373 tdsaParseLinkRateMode(tiRoot, i, LinkRateRead, ModeRead, OpticalModeRead, LinkRate, Mode, OpticalMode);
3374
3375 TI_DBG2(("tdsaGetCardPhyParams: phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
3376
3377
3378 /**********************************************/
3379 osti_memset(buffer, 0, buffLen);
3380 lenRecv = 0;
3381 LinkRateRead = agTRUE;//VG
3382 ModeRead = agFALSE;
3383 OpticalModeRead = agFALSE;
3384
3385 } /* end for */
3386 return;
3387}
3388
3389
3390
3391
3392
3393/*****************************************************************************
3394*! \brief tdsaGetGlobalPhyParams
3395*
3396* Purpose: This function reads phy-related configuration parameters from the
3397* configuration file
3398*
3399* \param tiRoot: Pointer to driver/port instance.
3400*
3401* \return: None
3402*
3403* \note - just a place holder for now
3404*
3405*****************************************************************************/
3406osGLOBAL void
3409 )
3410{
3411 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3412 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
3413 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
3414 char *buffer;
3415 bit32 buffLen;
3416 bit32 lenRecv = 0;
3417 char *pLastUsedChar = agNULL;
3418 char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
3419 char globalStr[] = "Global";
3420 char phyParmsStr[12];
3421 int i;
3422 bit32 LinkRate = 15/*7*/, Mode = 3, OpticalMode = 0;
3423 bit32 LinkRateRead = agFALSE, ModeRead = agFALSE, OpticalModeRead = agFALSE;
3424 bit32 flag = agFALSE; /* true only for PM8008 or PM8009 (SPCv and SPCve) controller */
3425
3426 TI_DBG6(("tdsaGetGlobalPhyParams: start \n"));
3427 TI_DBG6(("tdsaGetGlobalPhyParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
3428
3429 if (tiIS_8PHY(agRoot) )
3430 {
3431 TI_DBG6(("tdsaGetGlobalPhyParams: SPCv or SPCve \n"));
3432 flag = agTRUE;
3433 }
3434
3435 TI_DBG6(("tdsaGetGlobalPhyParams: flag %d\n", flag));
3436
3437#ifdef FPGA_CARD
3438 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3439 {
3440 /* setting default phy properties */
3441 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3442 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
3443 /* 1.5G only, SAS/SATA, no spin-up control */
3444 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 */
3445 }
3446#else
3447 /* ASIC */
3448#ifdef INITIATOR_DRIVER
3449 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3450 {
3451 /* setting default phy properties */
3452 if (flag == agFALSE) /* SPC or SPCv+ */
3453 {
3454 if (0 <= i && i <= 7)
3455 {
3456 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3457 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
3458 }
3459 else
3460 {
3461 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01010101);
3462 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x02020202);
3463 }
3464 }
3465 else /* SPCv or SPCve */
3466 {
3467 if (0 <= i && i <= 3)
3468 {
3469 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3470 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05060708);
3471 }
3472 else if (4 <= i && i <= 7)
3473 {
3474 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3475 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x02020202);
3476 }
3477 else /* don't care */
3478 {
3479 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01010101);
3480 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x0f0f0f0f);
3481 }
3482
3483 }
3484 /* 1.5G/3G , SAS/SATA, no spin-up control */
3485 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 55 */
3486 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3487
3488 }
3489#endif
3490#ifdef TARGET_DRIVER
3491 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3492 {
3493 /* setting default phy properties */
3494 /* SPC; narrow ports; 8 ports
3495 SPCv, SPCve wide port; 8 ports
3496 SPCv+ wide port; 16 ports
3497 */
3498 if (tiIS_SPC(agRoot))
3499 {
3500 if (0 <= i && i <= 7)
3501 {
3502 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3503 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
3504 }
3505 else
3506 {
3507 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3508 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
3509 }
3510 }
3511 else if (tiIS_16PHY(agRoot))
3512 {
3513 if (0 <= i && i <= 7)
3514 {
3515 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3516 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
3517 }
3518 else
3519 {
3520 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3521 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
3522 }
3523 }
3524 else
3525 {
3526 if (0 <= i && i <= 3)
3527 {
3528 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3529 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x05050500+i);
3530 }
3531 else if (4 <= i && i <= 7)
3532 {
3533 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3534 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x06060600+i);
3535 }
3536 else /* don't care */
3537 {
3538 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, 0x01020304);
3539 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, 0x0f0f0f0f+i);
3540 }
3541 }
3542 /* 1.5G/3G , SAS/SATA, no spin-up control */
3543 tdsaAllShared->Ports[i].agPhyConfig.phyProperties = 0x31; /* 49 The default is 1.5G and will be changed based on the registry value */
3544 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3545
3546 }
3547#endif
3548#endif
3549
3550
3551 buffer = tmpBuffer;
3552 buffLen = sizeof(tmpBuffer);
3553
3554 osti_memset(buffer, 0, buffLen);
3555 lenRecv = 0;
3556
3557 /* needs to read Phy's id frame */
3558 for (i=0;i<TD_MAX_NUM_PHYS;i++)
3559 {
3560 if (flag == agFALSE)
3561 {
3562 osti_sprintf(phyParmsStr,"PhyParms%d", i);
3563 }
3564 else
3565 {
3566 if (i >= 4)
3567 {
3568 osti_sprintf(phyParmsStr,"PhyParms%d", i+4);
3569 }
3570 else
3571 {
3572 osti_sprintf(phyParmsStr,"PhyParms%d", i);
3573 }
3574 }
3575
3576 TI_DBG6(("tdsaGetGlobalPhyParams: i %d PhyParms %s\n", i, phyParmsStr));
3577
3578
3580 tiRoot,
3581 globalStr,
3582 phyParmsStr,
3583 agNULL,
3584 agNULL,
3585 agNULL,
3586 agNULL,
3587 "AddrHi",
3588 buffer,
3589 buffLen,
3590 &lenRecv
3591 ) == tiSuccess) && (lenRecv != 0))
3592 {
3593 if (osti_strncmp(buffer, "0x", 2) == 0)
3594 {
3595 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
3596 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi 0x%x \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
3597 }
3598 else
3599 {
3600 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressHi, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
3601 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d hi %d \n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID))));
3602
3603 }
3604 }
3605
3606
3607 osti_memset(buffer, 0, buffLen);
3608 lenRecv = 0;
3609
3611 tiRoot,
3612 globalStr,
3613 phyParmsStr,
3614 agNULL,
3615 agNULL,
3616 agNULL,
3617 agNULL,
3618 "AddrLow",
3619 buffer,
3620 buffLen,
3621 &lenRecv
3622 ) == tiSuccess) && (lenRecv != 0))
3623 {
3624 if (osti_strncmp(buffer, "0x", 2) == 0)
3625 {
3626 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 0));
3627 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3628 }
3629 else
3630 {
3631 OSSA_WRITE_BE_32(agRoot, tdsaAllShared->Ports[i].SASID.sasAddressLo, 0, osti_strtoul(buffer, &pLastUsedChar, 10));
3632 TI_DBG6(("tdsaGetGlobalPhyParams: phy %d lo %d\n", i, SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3633
3634 }
3635 }
3636 TI_DBG6(("tdsaGetGlobalPhyParams: loop phy %d hi 0x%x lo 0x%x\n", i, SA_IDFRM_GET_SAS_ADDRESSHI(&(tdsaAllShared->Ports[i].SASID)), SA_IDFRM_GET_SAS_ADDRESSLO(&(tdsaAllShared->Ports[i].SASID))));
3637
3638 /* phy properties */
3639 osti_memset(buffer, 0, buffLen);
3640 lenRecv = 0;
3641/*
3642 if ((ostiGetTransportParam (
3643 tiRoot,
3644 globalStr,
3645 phyParmsStr,
3646 agNULL,
3647 agNULL,
3648 agNULL,
3649 agNULL,
3650 "LinkRate",
3651 buffer,
3652 buffLen,
3653 &lenRecv
3654 ) == tiSuccess) && (lenRecv != 0))
3655 {
3656 LinkRateRead = agTRUE;
3657 if (osti_strncmp(buffer, "0x", 2) == 0)
3658 {
3659 LinkRate = osti_strtoul(buffer, &pLastUsedChar, 0);
3660 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d linkrate 0x%x \n", i, LinkRate));
3661 }
3662 else
3663 {
3664 LinkRate = osti_strtoul(buffer, &pLastUsedChar, 10);
3665 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d linkrate %d \n", i, LinkRate));
3666 }
3667 }
3668*/
3669
3670 osti_memset(buffer, 0, buffLen);
3671 lenRecv = 0;
3672
3674 tiRoot,
3675 globalStr,
3676 phyParmsStr,
3677 agNULL,
3678 agNULL,
3679 agNULL,
3680 agNULL,
3681 "Mode",
3682 buffer,
3683 buffLen,
3684 &lenRecv
3685 ) == tiSuccess) && (lenRecv != 0))
3686 {
3687 ModeRead = agTRUE;
3688 if (osti_strncmp(buffer, "0x", 2) == 0)
3689 {
3690 Mode = osti_strtoul(buffer, &pLastUsedChar, 0);
3691 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d Mode 0x%x \n", i, Mode));
3692 }
3693 else
3694 {
3695 Mode = osti_strtoul(buffer, &pLastUsedChar, 10);
3696 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d Mode %d \n", i, Mode));
3697 }
3698 }
3699
3700 osti_memset(buffer, 0, buffLen);
3701 lenRecv = 0;
3702
3704 tiRoot,
3705 globalStr,
3706 phyParmsStr,
3707 agNULL,
3708 agNULL,
3709 agNULL,
3710 agNULL,
3711 "OpticalMode",
3712 buffer,
3713 buffLen,
3714 &lenRecv
3715 ) == tiSuccess) && (lenRecv != 0))
3716 {
3717 OpticalModeRead = agTRUE;
3718 if (osti_strncmp(buffer, "0x", 2) == 0)
3719 {
3720 OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 0);
3721 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d OpticalMode 0x%x \n", i, OpticalMode));
3722 }
3723 else
3724 {
3725 OpticalMode = osti_strtoul(buffer, &pLastUsedChar, 10);
3726 TI_DBG2(("tdsaGetGlobalPhyParams: phy %d OpticalMode %d \n", i, OpticalMode));
3727 }
3728 }
3729
3730 TI_DBG2(("tdsaGetGlobalPhyParams:A phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
3731 tdsaParseLinkRateMode(tiRoot, i, LinkRateRead, ModeRead, OpticalModeRead, LinkRate, Mode, OpticalMode);
3732
3733 TI_DBG2(("tdsaGetGlobalPhyParams:B phy %d phyProperties %d\n", i, tdsaAllShared->Ports[i].agPhyConfig.phyProperties));
3734
3735
3736
3737 /**********************************************/
3738 osti_memset(buffer, 0, buffLen);
3739 lenRecv = 0;
3740 /* restore default */
3741 LinkRate = 15;
3742 Mode = 3;
3743 OpticalMode = 0;
3744 LinkRateRead = agTRUE;//VG
3745 ModeRead = agFALSE;
3746 OpticalModeRead = agFALSE;
3747
3748
3749 } /* end for */
3750
3751 return;
3752}
3753
3754/*****************************************************************************
3755*! \brief tdsaGetPortParams
3756*
3757* Purpose: This function reads port-related configuration parameters from the
3758* configuration file
3759*
3760* \param tiRoot: Pointer to driver/port instance.
3761*
3762* \return: None
3763*
3764* \note - just a place holder for now
3765*
3766*****************************************************************************/
3767osGLOBAL void
3770 )
3771{
3772 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3773 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
3774
3775
3776 char *buffer;
3777 bit32 buffLen;
3778 bit32 lenRecv = 0;
3779 char *pLastUsedChar = agNULL;
3780 char tmpBuffer[DEFAULT_KEY_BUFFER_SIZE];
3781 char globalStr[] = "Global";
3782 char portParmsStr[] = "PortParms";
3783
3784 TI_DBG6(("tdsaGetPortParams: start \n"));
3785 TI_DBG6(("tdsaGetPortParams: tdsaRoot %p tdsaAllShared %p \n", tdsaRoot,tdsaAllShared));
3786
3787 buffer = tmpBuffer;
3788 buffLen = sizeof(tmpBuffer);
3789 osti_memset(buffer, 0, buffLen);
3790
3792 tiRoot,
3793 globalStr,
3794 portParmsStr,
3795 agNULL,
3796 agNULL,
3797 agNULL,
3798 agNULL,
3799 "InterruptDelay",
3800 buffer,
3801 buffLen,
3802 &lenRecv
3803 ) == tiSuccess) && (lenRecv != 0))
3804 {
3805 if (osti_strncmp(buffer, "0x", 2) == 0)
3806 {
3807 tdsaAllShared->currentInterruptDelay = osti_strtoul (buffer, &pLastUsedChar, 0);
3808 }
3809 else
3810 {
3811 tdsaAllShared->currentInterruptDelay = osti_strtoul (buffer, &pLastUsedChar, 10);
3812 }
3813 TI_DBG6(("tdsaGetPortParams: in \n"));
3814 }
3815 osti_memset(buffer, 0, buffLen);
3816 lenRecv = 0;
3817
3818 TI_DBG6(("tdsaGetPortParams: out \n"));
3819
3820 /* and more .... */
3821
3822
3823 return;
3824}
3825
3826#ifdef FW_EVT_LOG_TST
3827void saLogDump(agsaRoot_t *agRoot,
3828 U32 *eventLogSize,
3829 U32 **eventLogAddress);
3830
3831void tiLogDump(tiRoot_t *tiRoot, U32 *size, U32 **addr)
3832{
3833 tdsaRoot_t *tdsaRoot;
3834 tdsaContext_t *tdsaAllShared;
3835
3836 tdsaRoot = (tdsaRoot_t*)tiRoot->tdData;
3837 tdsaAllShared = (tdsaContext_t*)&(tdsaRoot->tdsaAllShared);
3838 saLogDump(&tdsaAllShared->agRootNonInt, size, addr);
3839}
3840#endif
3841
3842
3843
3844/*****************************************************************************
3845*! \brief tiCOMPortInit
3846*
3847* Purpose: This function is called to initialize the port hardware.
3848* This call could only be called until after the successful
3849* completion tiCOMInit().
3850*
3851* \param tiRoot: Pointer to root data structure.
3852* \param sysIntsActive: system interrupt flag
3853*
3854* \return:
3855* tiSuccess: Successful.
3856* Others: Fail.
3857*
3858* \note -
3859*
3860*****************************************************************************/
3864 bit32 sysIntsActive
3865 )
3866{
3867 tdsaRoot_t *tdsaRoot;
3868 tdsaContext_t *tdsaAllShared;
3869 agsaRoot_t *agRoot;
3870 tiLoLevelResource_t *loResource;
3872 bit32 i;
3873
3874 agsaQueueConfig_t *QueueConfig;
3875
3876#ifdef CONTROLLER_STATUS_TESTING
3877 static agsaControllerStatus_t agcontrollerStatus;
3878#endif /* CONTROLLER_STATUS_TESTING */
3879
3880#ifdef CONTROLLER_INFO_TESTING
3881 static agsaControllerInfo_t agcontrollerInfo;
3882#endif /* CONTROLLER_INFO_TESTING */
3883
3884#ifdef CONTROLLER_ENCRYPT_TESTING
3885 static agsaEncryptInfo_t agsaEncryptInfo;
3886#endif /* CONTROLLER_INFO_TESTING */
3887
3888 static agsaMemoryRequirement_t agMemoryRequirement;
3889#ifdef ECHO_TESTING
3890 /* temp */
3891 static bit8 payload[56];
3892#endif
3893
3894#if defined(FDS_DM) || defined(FDS_SM)
3895 static agsaMemoryRequirement_t memRequirement;
3896 bit32 maxQueueSets = 0;
3897 bit32 LLMemCount = 0;
3898 bit32 usecsPerTick = 0;
3899 static agsaSwConfig_t tmpLLSwConfig;
3900#endif
3901
3902#ifdef FDS_DM
3903 static dmRoot_t *dmRoot = agNULL;
3904#ifdef FDS_SM
3905 static dmSwConfig_t dmSwConfig;
3906#endif
3907 static dmMemoryRequirement_t dmMemRequirement;
3908 bit32 DMMemCount = 0;
3909#endif
3910
3911#if defined(FDS_DM) && defined(FDS_SM)
3912 bit32 dmUsecsPerTick = 0;
3913 bit32 dmMaxNumLocks = 0;
3914#endif
3915
3916#ifdef FDS_SM
3917 smRoot_t *smRoot = agNULL;
3918// smSwConfig_t smSwConfig;
3919 static smMemoryRequirement_t smMemRequirement;
3920 bit32 SMMemCount = 0;
3921#endif
3922
3923#ifndef TURN_OFF_HDA
3924 static agsaFwImg_t HDAImg;
3925#endif /* TURN_OFF_HDA */
3926
3927 TI_DBG3(("tiCOMPortInit: start\n"));
3928 TI_DBG6(("tiCOMPortInit: sizeof agsaMemoryRequirement_t %d\n", (int)sizeof(agsaMemoryRequirement_t)));
3929
3930 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
3931 tdsaAllShared = (tdsaContext_t *)&(tdsaRoot->tdsaAllShared);
3932
3933 osti_memset(&agMemoryRequirement, 0, sizeof(agsaMemoryRequirement_t));
3934 /*
3935 * don't do anything if reset is in progress
3936 */
3937 if (tdsaAllShared->flags.resetInProgress == agTRUE)
3938 {
3939 TI_DBG1(("tiCOMPortInit: resetinProgress error\n"));
3940 return tiError;
3941 }
3942
3943 loResource = &(tdsaAllShared->loResource);
3944
3945 agRoot = &(tdsaAllShared->agRootNonInt);
3946 tdsaAllShared->flags.sysIntsActive = sysIntsActive;
3947
3948 /*
3949 gets port-related parameters; not in use for now
3950 tdsaGetPortParams(tiRoot);
3951 */
3952
3953 /* call these before agroot is created for testing */
3954
3955
3956#ifdef CONTROLLER_STATUS_TESTING
3957 TI_DBG1(("tiCOMPortInit: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
3958#endif /* CONTROLLER_INFO_TESTING */
3959
3960#ifdef CONTROLLER_INFO_TESTING
3961 TI_DBG1(("tiCOMPortInit: saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
3962#endif /* CONTROLLER_INFO_TESTING */
3963
3964#ifdef CONTROLLER_ENCRYPT_TESTING
3965 TI_DBG1(("tiCOMPortInit: saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo ) ));
3966#endif /* CONTROLLER_INFO_TESTING */
3967
3968
3970 tdsaPrintSwConfig(&(tdsaAllShared->SwConfig));
3971
3972 /* setting interrupt requirements */
3975 tdsaAllShared->SwConfig.legacyInt_X = loResource->loLevelOption.flag;
3976 TI_DBG2(("tiCOMPortInit: got max_MSIX_InterruptVectors %d \n", tdsaAllShared->SwConfig.max_MSIX_InterruptVectors));
3977 TI_DBG2(("tiCOMPortInit: got max_MSI_InterruptVectors %d \n", tdsaAllShared->SwConfig.max_MSI_InterruptVectors));
3978 TI_DBG2(("tiCOMPortInit: got flag - legacyInt_X %d \n", tdsaAllShared->SwConfig.legacyInt_X));
3979
3980 /* error checking for interrupt types */
3981 if (
3982 ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
3983 (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
3984 (tdsaAllShared->SwConfig.legacyInt_X == 0))
3985 ||
3986 ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors != 0) &&
3987 (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
3988 (tdsaAllShared->SwConfig.legacyInt_X == 0))
3989 ||
3990 ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
3991 (tdsaAllShared->SwConfig.max_MSI_InterruptVectors != 0) &&
3992 (tdsaAllShared->SwConfig.legacyInt_X == 0))
3993 ||
3994 ((tdsaAllShared->SwConfig.max_MSIX_InterruptVectors == 0) &&
3995 (tdsaAllShared->SwConfig.max_MSI_InterruptVectors == 0) &&
3996 (tdsaAllShared->SwConfig.legacyInt_X != 0))
3997 )
3998 {
3999 /* do nothing */
4000 }
4001 else
4002 {
4003 TI_DBG1(("tiCOMPortInit: incorrect interrupt\n"));
4004 return tiError;
4005 }
4006
4007 QueueConfig = &tdsaAllShared->QueueConfig;
4008
4009 for(i=0;i<QueueConfig->numInboundQueues;i++)
4010 {
4011 QueueConfig->inboundQueues[i].elementCount = tdsaAllShared->InboundQueueSize[i];
4012 QueueConfig->inboundQueues[i].elementSize = tdsaAllShared->InboundQueueEleSize[i];
4013 QueueConfig->inboundQueues[i].priority = tdsaAllShared->InboundQueuePriority[i];
4014 QueueConfig->inboundQueues[i].reserved = 0;
4015 TI_DBG6(("tiCOMPortInit: InboundQueuePriroity %d \n", tdsaAllShared->InboundQueuePriority[i]));
4016 }
4017 for(i=0;i<QueueConfig->numOutboundQueues;i++)
4018 {
4019 QueueConfig->outboundQueues[i].elementCount = tdsaAllShared->OutboundQueueSize[i];
4020 QueueConfig->outboundQueues[i].elementSize = tdsaAllShared->OutboundQueueEleSize[i];
4021 QueueConfig->outboundQueues[i].interruptDelay = tdsaAllShared->OutboundQueueInterruptDelay[i]; /* default 0; no interrupt delay */
4022 QueueConfig->outboundQueues[i].interruptCount = tdsaAllShared->OutboundQueueInterruptCount[i]; /* default 1 */
4023 QueueConfig->outboundQueues[i].interruptEnable = tdsaAllShared->OutboundQueueInterruptEnable[i]; /* default 1 */
4024 QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
4025 if (tdsaAllShared->SwConfig.max_MSIX_InterruptVectors != 0)
4026 {
4027 QueueConfig->outboundQueues[i].interruptVectorIndex = i % tdsaAllShared->SwConfig.max_MSIX_InterruptVectors;
4028 }
4029 else if (tdsaAllShared->SwConfig.max_MSI_InterruptVectors != 0)
4030 {
4031 QueueConfig->outboundQueues[i].interruptVectorIndex = i % tdsaAllShared->SwConfig.max_MSI_InterruptVectors;
4032 }
4033 else
4034 {
4035 QueueConfig->outboundQueues[i].interruptVectorIndex = 0;
4036 }
4037 TI_DBG6(("tiCOMPortInit: OutboundQueueInterruptDelay %d OutboundQueueInterruptCount %d OutboundQueueInterruptEnable %d\n", tdsaAllShared->OutboundQueueInterruptDelay[i], tdsaAllShared->OutboundQueueInterruptCount[i], tdsaAllShared->OutboundQueueInterruptEnable[i]));
4038
4039 }
4040 /* queue option */
4041 QueueConfig->queueOption = tdsaAllShared->QueueOption;
4042
4043 tdsaAllShared->SwConfig.param3 = (void *)QueueConfig;
4044 tdsaAllShared->SwConfig.stallUsec = 10;
4045
4046 /* finds a first high priority queue for SMP */
4047 tdsaAllShared->SMPQNum = 0; /* default */
4048 for(i=0;i<QueueConfig->numInboundQueues;i++)
4049 {
4050 if (QueueConfig->inboundQueues[i].priority != DEFAULT_INBOUND_QUEUE_PRIORITY) /* 0 */
4051 {
4052 tdsaAllShared->SMPQNum = i;
4053 break;
4054 }
4055 }
4056
4058
4059 tdsaPrintHwConfig(&(tdsaAllShared->HwConfig));
4060
4061#ifdef TARGET_DRIVER
4062 /* target, not yet */
4063 if (tdsaAllShared->currentOperation & TD_OPERATION_TARGET)
4064 {
4066 }
4067#endif
4068
4069#if defined(FDS_DM) && defined(FDS_SM)
4070 /*
4071 needs to call saGetRequirements() to find out agMemoryRequirement.count requested by LL
4072 */
4073 osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
4074
4075 saGetRequirements(agRoot,
4076 &tmpLLSwConfig,
4077 &memRequirement,
4078 &usecsPerTick,
4079 &maxQueueSets
4080 );
4081 TI_DBG1(("tiCOMPortInit: usecsPerTick %d\n", usecsPerTick));
4082
4083 TI_DBG1(("tiCOMPortInit: LL memRequirement.count %d\n", memRequirement.count));
4084 TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
4085 LLMemCount = memRequirement.count;
4086
4087 /*
4088 needs to call dmGetRequirements() to find out dmMemoryRequirement.count requested by DM
4089 */
4090
4091 dmGetRequirements(dmRoot,
4092 &dmSwConfig,
4093 &dmMemRequirement,
4094 &dmUsecsPerTick,
4095 &dmMaxNumLocks
4096 );
4097
4098 TI_DBG1(("tiCOMPortInit: DM dmmemRequirement.count %d\n", dmMemRequirement.count));
4099 TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
4100
4101 DMMemCount = dmMemRequirement.count;
4102 SMMemCount = loResource->loLevelMem.count - LLMemCount - DMMemCount;
4103 agMemoryRequirement.count = LLMemCount;
4104
4105 TI_DBG1(("tiCOMPortInit: SMMemCount %d\n", SMMemCount));
4106
4107
4108#elif defined(FDS_DM)
4109 /*
4110 needs to call saGetRequirements() to find out agMemoryRequirement.count requested by LL
4111 */
4112 osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
4113
4114 saGetRequirements(agRoot,
4115 &tmpLLSwConfig,
4116 &memRequirement,
4117 &usecsPerTick,
4118 &maxQueueSets
4119 );
4120
4121 TI_DBG1(("tiCOMPortInit: memRequirement.count %d\n", memRequirement.count));
4122 TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
4123
4124 LLMemCount = memRequirement.count;
4125 DMMemCount = loResource->loLevelMem.count - LLMemCount;
4126
4127 agMemoryRequirement.count = LLMemCount;
4128
4129#elif defined(FDS_SM)
4130 osti_memcpy(&tmpLLSwConfig, &(tdsaAllShared->SwConfig), sizeof(agsaSwConfig_t));
4131
4132 saGetRequirements(agRoot,
4133 &tmpLLSwConfig,
4134 &memRequirement,
4135 &usecsPerTick,
4136 &maxQueueSets
4137 );
4138
4139 TI_DBG1(("tiCOMPortInit: memRequirement.count %d\n", memRequirement.count));
4140 TI_DBG1(("tiCOMPortInit: loResource->loLevelMem.count %d\n", loResource->loLevelMem.count));
4141
4142 LLMemCount = memRequirement.count;
4143 SMMemCount = loResource->loLevelMem.count - LLMemCount;
4144
4145 agMemoryRequirement.count = LLMemCount;
4146
4147#else
4148
4149 agMemoryRequirement.count = loResource->loLevelMem.count;
4150
4151#endif
4152
4153#if defined(FDS_DM) && defined(FDS_SM)
4154 /* for debugging */
4155 for(i=0;i<(int)(LLMemCount + DMMemCount + SMMemCount);i++)
4156 {
4157 TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
4158 TI_DBG2(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
4159 }
4160#endif
4161
4162 /* initialize */
4163 TI_DBG6(("tiCOMPortInit: AGSA_NUM_MEM_CHUNKS %d\n", AGSA_NUM_MEM_CHUNKS));
4164 for(i=0;i<AGSA_NUM_MEM_CHUNKS;i++)
4165 {
4166 agMemoryRequirement.agMemory[i].virtPtr = agNULL;
4167 agMemoryRequirement.agMemory[i].osHandle = agNULL;
4168 agMemoryRequirement.agMemory[i].phyAddrUpper = 0;
4169 agMemoryRequirement.agMemory[i].phyAddrLower = 0;
4170 agMemoryRequirement.agMemory[i].totalLength = 0;
4171 agMemoryRequirement.agMemory[i].numElements = 0;
4172 agMemoryRequirement.agMemory[i].singleElementLength = 0;
4173 agMemoryRequirement.agMemory[i].alignment = 0;
4174 agMemoryRequirement.agMemory[i].type = 0;
4175 agMemoryRequirement.agMemory[i].reserved = 0;
4176 }
4177
4178 for(i=0;i<(int)agMemoryRequirement.count;i++)
4179 {
4180 TI_DBG2(("tiCOMPortInit: LL copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
4181 agMemoryRequirement.agMemory[i].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
4182 agMemoryRequirement.agMemory[i].osHandle = loResource->loLevelMem.mem[i].osHandle;
4183 agMemoryRequirement.agMemory[i].phyAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
4184 agMemoryRequirement.agMemory[i].phyAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
4185 agMemoryRequirement.agMemory[i].totalLength = loResource->loLevelMem.mem[i].totalLength;
4186 agMemoryRequirement.agMemory[i].numElements = loResource->loLevelMem.mem[i].numElements;
4187 agMemoryRequirement.agMemory[i].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
4188 agMemoryRequirement.agMemory[i].alignment = loResource->loLevelMem.mem[i].alignment;
4189 if (loResource->loLevelMem.mem[i].type == TI_DMA_MEM)
4190 {
4191 agMemoryRequirement.agMemory[i].type = AGSA_DMA_MEM;
4192 }
4193 else if (loResource->loLevelMem.mem[i].type == TI_CACHED_MEM)
4194 {
4195 agMemoryRequirement.agMemory[i].type = AGSA_CACHED_MEM;
4196
4197 }
4198 else if (loResource->loLevelMem.mem[i].type == TI_CACHED_DMA_MEM)
4199 {
4200 agMemoryRequirement.agMemory[i].type = AGSA_CACHED_DMA_MEM;
4201 }
4202
4203 agMemoryRequirement.agMemory[i].reserved = loResource->loLevelMem.mem[i].reserved;
4204 TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
4205 TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
4206 loResource->loLevelMem.mem[i].physAddrUpper,
4207 loResource->loLevelMem.mem[i].physAddrLower,
4208 loResource->loLevelMem.mem[i].totalLength,
4209 loResource->loLevelMem.mem[i].numElements));
4210 TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
4211 loResource->loLevelMem.mem[i].singleElementLength,
4212 loResource->loLevelMem.mem[i].alignment,
4213 loResource->loLevelMem.mem[i].type,
4214 loResource->loLevelMem.mem[i].reserved));
4215
4216 }
4217 osti_memset(&(tdsaAllShared->tdFWControlEx), 0, sizeof(tdFWControlEx_t));
4218
4219 /*
4220 * Note: Be sure to call this only once since sallsdk does initialization only once
4221 * saInitialize(IN, IN, IN, IN, IN);
4222 */
4223
4224 TI_DBG1(("tiCOMPortInit: tdsaAllShared->tdDeviceIdVendId %x\n",tdsaAllShared->tdDeviceIdVendId));
4225 TI_DBG1(("tiCOMPortInit: tdsaAllShared->tdSubVendorId= SUB_VEN_ID %x\n",tdsaAllShared->tdSubVendorId));
4226
4227 TI_DBG1(("tiCOMPortInit: swConfig->param1 hwDEVICE_ID_VENDID %x\n", tdsaAllShared->SwConfig.param1 ));
4228 TI_DBG1(("tiCOMPortInit: swConfig->param2 hwSVID %x\n", tdsaAllShared->SwConfig.param2));
4229
4230 /*
4231 1. Read hostDirectAccessSupport
4232 2. If set, read HDA images based on chip ID
4233 */
4234
4235 t_MacroCheck(agRoot);
4236
4237#ifndef TURN_OFF_HDA
4238 if (tdsaAllShared->SwConfig.hostDirectAccessSupport != 0)
4239 {
4240 osti_memset(&HDAImg, 0, sizeof(HDAImg));
4241 if (tiIS_SPC(agRoot))
4242 {
4243 TI_DBG1(("tiCOMPortInit: SPC HDA\n"));
4244 HDAImg.aap1Img = (bit8*)(&aap1array);
4245 HDAImg.aap1Len = sizeof( aap1array);
4246 HDAImg.iopImg = (bit8*)(&ioparray);
4247 HDAImg.iopLen = sizeof( ioparray);
4248 HDAImg.istrImg = (bit8*)(&istrarray);
4249 HDAImg.istrLen = sizeof( istrarray);
4250
4251 HDAImg.ilaImg = (bit8*)(&ilaarray);
4252 HDAImg.ilaLen = sizeof(ilaarray);
4253 }
4254 else if (tiIS_SPC6V(agRoot))
4255 {
4256 TI_DBG1(("tiCOMPortInit: SPCv HDA\n"));
4257 HDAImg.aap1Img = (bit8*)(&spcv_aap1array);
4258 HDAImg.aap1Len = sizeof( spcv_aap1array);
4259 HDAImg.iopImg = (bit8*)(&spcv_ioparray);
4260 HDAImg.iopLen = sizeof( spcv_ioparray);
4261
4262 HDAImg.ilaImg = (bit8*)(&spcv_ilaarray);
4263 HDAImg.ilaLen = sizeof(spcv_ilaarray);
4264 }
4265 else if (tIsSPCV12G(agRoot))
4266 {
4267 TI_DBG1(("tiCOMPortInit: SPCv12G HDA\n"));
4268 HDAImg.aap1Img = (bit8*)(&spcv12g_raaearray);
4269 HDAImg.aap1Len = sizeof( spcv12g_raaearray);
4270 HDAImg.iopImg = (bit8*)(&spcv12g_ioparray);
4271 HDAImg.iopLen = sizeof( spcv12g_ioparray);
4272
4273 HDAImg.ilaImg = (bit8*)(&spcv12g_ilaarray);
4274 HDAImg.ilaLen = sizeof(spcv12g_ilaarray);
4275 }
4276 else
4277 {
4278 TI_DBG1(("tiCOMPortInit: HDA Mode Unknown chip type 0x%08x\n",ossaHwRegReadConfig32(agRoot,0 )));
4279 return tiError;
4280 }
4281 TI_DBG1(("tiCOMPortInit: HDA aap1Len 0x%08x iopLen 0x%08x ilaLen 0x%08x\n",HDAImg.aap1Len,HDAImg.iopLen,HDAImg.ilaLen ));
4282 tdsaAllShared->SwConfig.param4 = &(HDAImg);
4283 }
4284 else
4285 {
4286 TI_DBG1(("tiCOMPortInit: HDA off\n"));
4287 tdsaAllShared->SwConfig.param4 = agNULL;
4288 }
4289#endif /* TURN_OFF_HDA */
4290
4291 if (tiIS_SPC(agRoot))
4292 {
4293 /* FW config is only for SPC */
4294 tdsaAllShared->SwConfig.FWConfig = 0;
4295 /* default port recovery timer 0x32 = 50 = 5000ms and port reset timer 3 (300 ms)*/
4296 tdsaAllShared->SwConfig.PortRecoveryResetTimer = 0x30032;
4297 TI_DBG1(("tiCOMPortInit:only for SPC FWConfig set\n"));
4298 }
4299
4300 tdsaAllShared->SwConfig.fatalErrorInterruptVector = loResource->loLevelOption.maxInterruptVectors > 31 ? 31 : loResource->loLevelOption.maxInterruptVectors -1;
4301
4302 TI_DBG1(("tiCOMPortInit: SwConfig->FWConfig 0x%x\n", tdsaAllShared->SwConfig.FWConfig));
4303 TI_DBG1(("tiCOMPortInit: SwConfig->fatalErrorInterruptVector 0x%x\n", tdsaAllShared->SwConfig.fatalErrorInterruptVector));
4304 TI_DBG1(("tiCOMPortInit: loResource->loLevelOption.usecsPerTick %d\n", loResource->loLevelOption.usecsPerTick));
4305
4306 status = saInitialize(agRoot,
4307 &agMemoryRequirement,
4308 &(tdsaAllShared->HwConfig),
4309 /* &temp_HwConfig, */
4310 &(tdsaAllShared->SwConfig),
4311 loResource->loLevelOption.usecsPerTick);
4312
4313 TI_DBG6(("tiCOMPortInit: loResource->loLevelOption.usecsPerTick %d 0x%x\n", loResource->loLevelOption.usecsPerTick, loResource->loLevelOption.usecsPerTick));
4314
4315 /*TI_DBG6(("tiCOMPortInit: tdsaAllShared->SwConfig.enableDIF %d\n", tdsaAllShared->SwConfig.enableDIF)); */
4316 /*TI_DBG6(("tiCOMPortInit: tdsaAllShared->SwConfig.enableEncryption %d\n", tdsaAllShared->SwConfig.enableEncryption)); */
4317
4318 if(status == AGSA_RC_FAILURE )
4319 {
4320 TI_DBG1(("tiCOMPortInit: saInitialize AGSA_RC_FAILURE, status 0x%x\n", status));
4321 return tiError;
4322 }
4323
4325 {
4326 TI_DBG1(("tiCOMPortInit: saInitialize AGSA_RC_VERSION_INCOMPATIBLE, status 0x%x\n", status));
4327 return tiError;
4328 }
4329
4330 /* let's make sdkData same for Int and Non-int agRoots */
4331 tdsaAllShared->agRootInt.sdkData = tdsaAllShared->agRootNonInt.sdkData;
4332
4333
4334 /* mark the port as initialized */
4335 for(i=0;i<TD_MAX_NUM_PHYS;i++)
4336 {
4337 tdsaAllShared->Ports[i].flags.portInitialized = agTRUE;
4338 }
4339
4340#ifdef INITIATOR_DRIVER //ini. only in stsdkll spec (TP)
4341 /* register device registration callback function */
4342 TI_DBG6(("tiCOMPortInit: calling saRegisterEventCallback for device registration\n"));
4344 if (status == AGSA_RC_FAILURE)
4345 {
4346 TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Register failed\n"));
4347 }
4348 else
4349 {
4350 TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Register succeeded\n"));
4351 }
4352#endif
4353
4354 /* register device deregistration callback function */
4355 TI_DBG6(("tiCOMPortInit: calling saRegisterEventCallback for device de-registration\n"));
4357 if (status == AGSA_RC_FAILURE)
4358 {
4359 TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Deregister failed\n"));
4360 }
4361 else
4362 {
4363 TI_DBG6(("tiCOMPortInit: saRegisterEventCallback Device Deregister succeeded\n"));
4364 }
4365
4366#ifdef ECHO_TESTING
4367 /* temporary to test saEchoCommand() */
4368 /*
4369 send echo
4370 */
4371 payload[0] = gEcho;
4372 payload[55] = gEcho;
4373 TI_DBG2(("tiCOMPortInit: calling saEchoCommand gEcho %d\n", gEcho));
4374 saEchoCommand(agRoot, agNULL, tdsaRotateQnumber(tiRoot, agNULL), (void *)&payload);
4375 gEcho++;
4376#endif
4377
4378#ifdef CONTROLLER_STATUS_TESTING
4379 TI_DBG1(("tiCOMPortInit: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
4380#endif /* CONTROLLER_INFO_TESTING */
4381
4382#ifdef CONTROLLER_INFO_TESTING
4383 TI_DBG1(("tiCOMPortInit: saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
4384#endif /* CONTROLLER_INFO_TESTING */
4385
4386#ifdef CONTROLLER_ENCRYPT_TESTING
4387 TI_DBG1(("tiCOMPortInit: saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL,&agsaEncryptInfo ) ));
4388#endif /* CONTROLLER_INFO_TESTING */
4389
4390
4391#ifdef VPD_TESTING
4392 /* temporary to test saSetVPDCommand() and saGetVPDCommand */
4393 tdsaVPDSet(tiRoot);
4394#endif /* VPD_TESTING */
4395
4396#if defined(FDS_DM) && defined(FDS_SM)
4397 /* initialize DM then SM */
4398 /* DM */
4399 dmRoot = &(tdsaAllShared->dmRoot);
4400 osti_memset(&dmMemRequirement, 0, sizeof(dmMemoryRequirement_t));
4401
4402 dmMemRequirement.count = DMMemCount;
4403
4404 for(i=LLMemCount;i<(int)(LLMemCount + DMMemCount);i++)
4405 {
4406 TI_DBG2(("tiCOMPortInit: DM copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
4407 dmMemRequirement.dmMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
4408 dmMemRequirement.dmMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
4409 dmMemRequirement.dmMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
4410 dmMemRequirement.dmMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
4411 dmMemRequirement.dmMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
4412 dmMemRequirement.dmMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
4413 dmMemRequirement.dmMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
4414 dmMemRequirement.dmMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
4415 dmMemRequirement.dmMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
4416 dmMemRequirement.dmMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
4417 TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
4418 TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
4419 loResource->loLevelMem.mem[i].physAddrUpper,
4420 loResource->loLevelMem.mem[i].physAddrLower,
4421 loResource->loLevelMem.mem[i].totalLength,
4422 loResource->loLevelMem.mem[i].numElements));
4423 TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
4424 loResource->loLevelMem.mem[i].singleElementLength,
4425 loResource->loLevelMem.mem[i].alignment,
4426 loResource->loLevelMem.mem[i].type,
4427 loResource->loLevelMem.mem[i].reserved));
4428
4429 }
4430
4431 status = dmInitialize(dmRoot,
4432 agRoot,
4433 &dmMemRequirement,
4434 &(tdsaAllShared->dmSwConfig), //&dmSwConfig, /* start here */
4435 loResource->loLevelOption.usecsPerTick);
4436
4438 {
4439 TI_DBG1(("tiCOMPortInit: dmInitialize FAILED, status 0x%x\n", status));
4440 return tiError;
4441 }
4442
4443 /* SM */
4444 smRoot = &(tdsaAllShared->smRoot);
4445 osti_memset(&smMemRequirement, 0, sizeof(smMemoryRequirement_t));
4446
4447 smMemRequirement.count = SMMemCount;
4448
4449 for(i=(LLMemCount + DMMemCount);i<(int)(LLMemCount + DMMemCount + SMMemCount);i++)
4450 {
4451 TI_DBG1(("tiCOMPortInit: SM copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
4452 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
4453 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
4454 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
4455 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
4456 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
4457 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
4458 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
4459 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
4460 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].type = loResource->loLevelMem.mem[i].type;
4461 smMemRequirement.smMemory[i-LLMemCount-DMMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
4462 TI_DBG2(("tiCOMPortInit: index %d virtPtr %p osHandle %p\n",i, loResource->loLevelMem.mem[i].virtPtr, loResource->loLevelMem.mem[i].osHandle));
4463 TI_DBG2(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d numElements %d\n", i,
4464 loResource->loLevelMem.mem[i].physAddrUpper,
4465 loResource->loLevelMem.mem[i].physAddrLower,
4466 loResource->loLevelMem.mem[i].totalLength,
4467 loResource->loLevelMem.mem[i].numElements));
4468 TI_DBG2(("tiCOMPortInit: index %d singleElementLength 0x%x alignment 0x%x type %d reserved %d\n", i,
4469 loResource->loLevelMem.mem[i].singleElementLength,
4470 loResource->loLevelMem.mem[i].alignment,
4471 loResource->loLevelMem.mem[i].type,
4472 loResource->loLevelMem.mem[i].reserved));
4473
4474 }
4475
4476 status = smInitialize(smRoot,
4477 agRoot,
4478 &smMemRequirement,
4479 &(tdsaAllShared->smSwConfig), //&smSwConfig, /* start here */
4480 loResource->loLevelOption.usecsPerTick);
4481
4483 {
4484 TI_DBG1(("tiCOMPortInit: smInitialize FAILED, status 0x%x\n", status));
4485 return tiError;
4486 }
4487
4488#elif defined(FDS_DM)
4489 dmRoot = &(tdsaAllShared->dmRoot);
4490 osti_memset(&dmMemRequirement, 0, sizeof(dmMemoryRequirement_t));
4491
4492 dmMemRequirement.count = DMMemCount;
4493
4494 for(i=LLMemCount;i<(int)(LLMemCount + DMMemCount);i++)
4495 {
4496 TI_DBG6(("tiCOMPortInit: copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
4497 dmMemRequirement.dmMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
4498 dmMemRequirement.dmMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
4499 dmMemRequirement.dmMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
4500 dmMemRequirement.dmMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
4501 dmMemRequirement.dmMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
4502 dmMemRequirement.dmMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
4503 dmMemRequirement.dmMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
4504 dmMemRequirement.dmMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
4505 dmMemRequirement.dmMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
4506 dmMemRequirement.dmMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
4507 TI_DBG6(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
4508 TI_DBG6(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
4509
4510 }
4511
4512 status = dmInitialize(dmRoot,
4513 agRoot,
4514 &dmMemRequirement,
4515 &(tdsaAllShared->dmSwConfig), //&dmSwConfig, /* start here */
4516 loResource->loLevelOption.usecsPerTick);
4517
4519 {
4520 TI_DBG1(("tiCOMPortInit: dmInitialize FAILED, status 0x%x\n", status));
4521 return tiError;
4522 }
4523
4524#elif defined(FDS_SM)
4525 smRoot = &(tdsaAllShared->smRoot);
4526 osti_memset(&smMemRequirement, 0, sizeof(smMemoryRequirement_t));
4527
4528 smMemRequirement.count = SMMemCount;
4529
4530 for(i=LLMemCount;i<(int)(LLMemCount + SMMemCount);i++)
4531 {
4532 TI_DBG6(("tiCOMPortInit: copying loResource.loLevelMem to agsaMemoryRequirement_t index %d\n", i));
4533 smMemRequirement.smMemory[i-LLMemCount].virtPtr = loResource->loLevelMem.mem[i].virtPtr;
4534 smMemRequirement.smMemory[i-LLMemCount].osHandle = loResource->loLevelMem.mem[i].osHandle;
4535 smMemRequirement.smMemory[i-LLMemCount].physAddrUpper = loResource->loLevelMem.mem[i].physAddrUpper;
4536 smMemRequirement.smMemory[i-LLMemCount].physAddrLower = loResource->loLevelMem.mem[i].physAddrLower;
4537 smMemRequirement.smMemory[i-LLMemCount].totalLength = loResource->loLevelMem.mem[i].totalLength;
4538 smMemRequirement.smMemory[i-LLMemCount].numElements = loResource->loLevelMem.mem[i].numElements;
4539 smMemRequirement.smMemory[i-LLMemCount].singleElementLength = loResource->loLevelMem.mem[i].singleElementLength;
4540 smMemRequirement.smMemory[i-LLMemCount].alignment = loResource->loLevelMem.mem[i].alignment;
4541 smMemRequirement.smMemory[i-LLMemCount].type = loResource->loLevelMem.mem[i].type;
4542 smMemRequirement.smMemory[i-LLMemCount].reserved = loResource->loLevelMem.mem[i].reserved;
4543 TI_DBG6(("tiCOMPortInit: index %d phyAddrUpper 0x%x phyAddrLower 0x%x totalLength %d alignment %d\n", i, loResource->loLevelMem.mem[i].physAddrUpper, loResource->loLevelMem.mem[i].physAddrLower, loResource->loLevelMem.mem[i].totalLength, loResource->loLevelMem.mem[i].alignment));
4544 TI_DBG6(("tiCOMPortInit: index %d virtPtr %p\n",i, loResource->loLevelMem.mem[i].virtPtr));
4545
4546 }
4547
4548 status = smInitialize(smRoot,
4549 agRoot,
4550 &smMemRequirement,
4551 &(tdsaAllShared->smSwConfig), //&smSwConfig, /* start here */
4552 loResource->loLevelOption.usecsPerTick);
4553
4555 {
4556 TI_DBG1(("tiCOMPortInit: smInitialize FAILED, status 0x%x\n", status));
4557 return tiError;
4558 }
4559#else
4560 /* nothing */
4561#endif /* FDS_DM && FDS_SM */
4562
4563 /* call these again after agroot is created for testing */
4564#ifdef CONTROLLER_STATUS_TESTING
4565 TI_DBG1(("tiCOMPortInit:again saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
4566#endif /* CONTROLLER_INFO_TESTING */
4567
4568#ifdef CONTROLLER_INFO_TESTING
4569 TI_DBG1(("tiCOMPortInit:again saGetControllerInfo returns 0x%X\n",saGetControllerInfo(agRoot,&agcontrollerInfo ) ));
4570#endif /* CONTROLLER_INFO_TESTING */
4571
4572#ifdef CONTROLLER_ENCRYPT_TESTING
4573 TI_DBG1(("tiCOMPortInit:again saEncryptGetMode returns 0x%X\n",saEncryptGetMode(agRoot,agNULL,&agsaEncryptInfo ) ));
4574#endif /* CONTROLLER_INFO_TESTING */
4575
4576/* Enable SGPIO */
4578 {
4579 TI_DBG2(("tiCOMPortInit: Successfully sent request to enable SGPIO\n"));
4580 }
4581 else
4582 {
4583 TI_DBG1(("tiCOMPortInit: Failed to enable SGPIO\n"));
4584 }
4585
4586 return tiSuccess;
4587}
4588
4589/*****************************************************************************
4590*! \brief SendSgpioRequest
4591*
4592* Purpose: This function is used to send SGPIO request during initialization
4593*
4594* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
4595* instance.
4596* \param regType: Register Type
4597* \param regIndex: Register Index
4598* \param regCount: Register Count
4599* \param writeData: Part of the request
4600*
4601* \return:
4602* tiSuccess on success
4603* Other status on failure
4604*
4605*****************************************************************************/
4608 bit8 regType,
4609 bit8 regIndex,
4610 bit8 regCount,
4611 bit32 *writeData
4612 )
4613{
4614 static bit32 buffer[128] = {0};
4616 bit32 retVal = IOCTL_CALL_FAIL;
4617 tiIOCTLPayload_t *agIOCTLPayload = (tiIOCTLPayload_t *) buffer;
4618 agsaSGpioReqResponse_t *pSGpioReq = (agsaSGpioReqResponse_t *) &agIOCTLPayload->FunctionSpecificArea[0];
4619 agsaSGpioReqResponse_t *pSgpioResponse = (agsaSGpioReqResponse_t *) &agIOCTLPayload->FunctionSpecificArea[0];
4620
4621 do{
4622
4623 /* Frame the Ioctl payload */
4624 agIOCTLPayload->MajorFunction = IOCTL_MJ_SGPIO;
4625 agIOCTLPayload->Length = sizeof(agsaSGpioReqResponse_t);
4626
4627 /* Frame the SGPIO request */
4628 pSGpioReq->smpFrameType = SMP_REQUEST;
4630 pSGpioReq->registerType = regType;
4631 pSGpioReq->registerIndex = regIndex;
4632 pSGpioReq->registerCount = regCount;
4633 memcpy(pSGpioReq->readWriteData, writeData, regCount * 4);
4634
4635 /* Send the SGPIO request */
4636 sgpioResponseSet = 0;
4637 retVal = tdsaSGpioIoctlSetup(tiRoot, agNULL, agIOCTLPayload, agNULL, agNULL);
4638 if (retVal != IOCTL_CALL_PENDING)
4639 {
4640 break;
4641 }
4642 /* Waiting for SGPIO Response */
4643 while(!sgpioResponseSet)
4644 {
4646 }
4647 sgpioResponseSet = 0;
4648 /* Check the ioctl result */
4649 if(agIOCTLPayload->Status != IOCTL_ERR_STATUS_OK)
4650 {
4651 break;
4652 }
4653 /* Check the sgpio function result */
4654 if(pSgpioResponse->functionResult != 0x00)
4655 {
4656 break;
4657 }
4658
4659 status = tiSuccess;
4660
4661 }while(0);
4662
4663 return status;
4664}
4665
4666/*****************************************************************************
4667*! \brief tiCOMConfigureSgpio
4668*
4669* Purpose: This function is used to configure SGPIO during initialization
4670*
4671* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
4672* instance.
4673* \param enableSgpio: Enable / Disable SGPIO
4674*
4675* \return:
4676* tiSuccess on success
4677* Other status on failure
4678*
4679*****************************************************************************/
4682 bit8 enableSgpio
4683 )
4684{
4686 bit32 i;
4687 bit8 regCount;
4688 bit32 writeData[OSSA_SGPIO_MAX_READ_DATA_COUNT] = {0};
4689 agsaSGpioCfg0_t *pCfg0 = (agsaSGpioCfg0_t *) &writeData[0];
4690 agsaSGpioCfg1_t *pCfg1 = (agsaSGpioCfg1_t *) &writeData[1];
4691 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
4692 tdsaContext_t *tdsaAllShared = (tdsaContext_t *) &tdsaRoot->tdsaAllShared;
4693 bit32 phyCount = tdsaAllShared->phyCount;
4694
4695 if (enableSgpio)
4696 {
4697 /* Configure both CFG[0] and CFG[1] */
4698 regCount = 2;
4699
4700 /* Enable SGPIO */
4701 pCfg0->gpioEnable = 1;
4702
4703 /* The following are the default values for CFG[1] suggested by SFF-8485 spec */
4704 /* Maximum Activity ON: 2 */
4705 /* Forced Activity OFF: 1 */
4706 pCfg1->maxActOn = 2;
4707 pCfg1->forceActOff = 1;
4708 }
4709 else
4710 {
4711 /* Configure CFG[0] only */
4712 regCount = 1;
4713
4714 /* Disable SGPIO */
4715 pCfg0->gpioEnable = 0;
4716 }
4717
4718 status = SendSgpioRequest(tiRoot, AGSA_SGPIO_CONFIG_REG, 0, regCount, writeData);
4719 if((tiSuccess == status) && (enableSgpio))
4720 {
4721 /* Write default values to transmit registers */
4722 /* RegisterCount = Number of phys present in HBA / 4 */
4723 regCount = phyCount / 4;
4724 for(i = 0; i < regCount; i++)
4725 {
4726 /* Following are the default values specified in SFF-8485 spec */
4727 /* Activity: 5 */
4728 /* Locate: 0 */
4729 /* Error: 0 */
4730 writeData[i] = 0xA0A0A0A0;
4731 }
4733 }
4734
4735 return status;
4736}
4737
4738
4739/*****************************************************************************
4740*! \brief tiCOMPortStart
4741*
4742* Purpose: This function is called to bring the port hardware online. This
4743* call could only be called until after the successful completion
4744* tiCOMPortInit().
4745*
4746* \param tiRoot: Pointer to root data structure.
4747* \param portID: A ID for this portal to be used by the TD Layer
4748* to get the portal configuration information.
4749* \param portalContext: Pointer to the context for this portal.
4750* \param option: An option for starting a port
4751*
4752* \return:
4753* tiSuccess: Successful.
4754* Others: Fail.
4755*
4756* \note -
4757* If sas or sata initiator, this will be called 8 (the number of phys) times.
4758* If both sas and sata initiator, this will be called 16 times
4759*
4760*****************************************************************************/
4761/* portID is used as PhyID
4762 Should return always tiSuccess. PortStarted is returned in ossaHwCB()
4763*/
4766 tiRoot_t * tiRoot,
4767 bit32 portID,
4768 tiPortalContext_t * portalContext,
4769 bit32 option
4770 )
4771{
4772 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
4773 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
4774 agsaRoot_t *agRoot = &tdsaAllShared->agRootInt;
4777 static bit32 IsSendSASConfigPage = agFALSE;
4778
4779
4780 TI_DBG3(("tiCOMPortStart: start portID %d\n", portID));
4781
4782 /*
4783 * return error if reset is in progress
4784 */
4785 if (tdsaAllShared->flags.resetInProgress == agTRUE)
4786 {
4787 TI_DBG1(("tiCOMPortStart: reset error\n"));
4788 return tiError;
4789 }
4790
4791 /*
4792 *
4793 * port is not initialized, return error
4794 */
4795 if (tdsaAllShared->Ports[portID].flags.portInitialized == agFALSE)
4796 {
4797 TI_DBG1(("tiCOMPortStart: not intialized error\n"));
4798 return tiError;
4799 }
4800
4801 /* portal has been started. */
4802 if (portalContext->tdData != NULL)
4803 {
4804 if (tdsaAllShared->Ports[portID].flags.portStarted == agTRUE)
4805 {
4806 TI_DBG3 (("tiCOMPortStart : Cannot start port again: Port has already been started\n"));
4808 tiRoot,
4810 tiSuccess,
4811 (void *) tdsaAllShared->Ports[portID].tiPortalContext
4812 );
4813 return tiSuccess;
4814 }
4815 }
4816
4817 portalContext->tdData = &(tdsaAllShared->Ports[portID]);
4818 TI_DBG4 (("tiCOMPortStart : saving portalconext portID %d tdsaAllShared %p\n", portID, tdsaAllShared));
4819 /* saving tiportalContext_t */
4820 tdsaAllShared->Ports[portID].tiPortalContext = portalContext;
4821 TI_DBG4(("tiCOMPortStart : portID/phyID %d tiPortalContext %p\n", portID, tdsaAllShared->Ports[portID].tiPortalContext));
4822
4823 /*
4824 where is "tdsaAllShared->Ports[0].portContext" set?
4825 in ossaHWCB
4826 */
4827 if (tdsaAllShared->Ports[portID].flags.portStarted == agTRUE)
4828 {
4829 TI_DBG1(("tiCOMPortStart: port already has been started \n"));
4830 return tiSuccess;
4831 }
4832
4833
4834 /*
4835 hardcode sasID frame. It should be read by ostigettransportparams later from configuration file
4836 */
4837#ifdef INITIATOR_DRIVER
4838
4839 tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = 0;
4840 tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp
4842 tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
4843
4844 tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
4845
4846#endif
4847
4848#ifdef TARGET_DRIVER
4849
4850 tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = SA_IDFRM_SSP_BIT;
4851 tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp = 0;
4852 tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
4853 tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
4854
4855#endif
4856
4857#if defined (INITIATOR_DRIVER) && defined (TARGET_DRIVER)
4858
4859 /* for combo testing */
4860 tdsaAllShared->Ports[portID].SASID.target_ssp_stp_smp = SA_IDFRM_SSP_BIT;
4861 tdsaAllShared->Ports[portID].SASID.initiator_ssp_stp_smp
4863 tdsaAllShared->Ports[portID].SASID.deviceType_addressFrameType = AGSA_DEV_TYPE_END_DEVICE;
4864
4865 tdsaAllShared->Ports[portID].SASID.phyIdentifier = (bit8)portID;
4866
4867#endif
4868
4869
4870 TI_DBG6(("tiCOMPortStart: before pid %d\n", portID));
4871 tdssPrintSASIdentify(&(tdsaAllShared->Ports[portID].SASID));
4872
4873 TI_DBG6(("tiCOMPortStart: sysIntsActive %s\n",
4874 (tdsaAllShared->flags.sysIntsActive == agTRUE) ? "agTRUE" : "agFALSE"));
4875
4876 /* Read global configuration first then card-specific configuration */
4877
4878 /* the following must be processed only once */
4879 if ( tdsaAllShared->first_process == agFALSE)
4880 {
4883 tdsaAllShared->first_process = agTRUE;
4884 }
4885
4886 TI_DBG6(("tiCOMPortStart: after pid %d\n", portID));
4887 tdssPrintSASIdentify(&(tdsaAllShared->Ports[portID].SASID));
4888
4889 /*
4890 Phy Calibration
4891 */
4892 if (tdsaAllShared->phyCalibration)
4893 {
4894 /* Change default phy calibration */
4895 tdsaAllShared->Ports[portID].agPhyConfig.phyProperties =
4896 (tdsaAllShared->Ports[portID].agPhyConfig.phyProperties) | 0x80;
4897 /* Setting index of phy calibration table index
4898 portID is used as phy calibration table index
4899 */
4900 tdsaAllShared->Ports[portID].agPhyConfig.phyProperties =
4901 (tdsaAllShared->Ports[portID].agPhyConfig.phyProperties) | (portID << 8);
4902 }
4903 TI_DBG2(("tiCOMPortStart: tdsaAllShared->Ports[0x%x].agPhyConfig.phyProperties 0x%x\n",
4904 portID, tdsaAllShared->Ports[portID].agPhyConfig.phyProperties));
4905
4906
4907 if(gSSC_Disable)
4908 {
4909 tdsaAllShared->Ports[portID].agPhyConfig.phyProperties = tdsaAllShared->Ports[portID].agPhyConfig.phyProperties | 0x40000;
4910 TI_DBG1(("tiCOMPortStart:gSSC_Disable tdsaAllShared->Ports[portID].agPhyConfig.phyProperties 0x%x\n", tdsaAllShared->Ports[portID].agPhyConfig.phyProperties));
4911
4912 }
4913
4914 if(tIsSPCV12or6G(agRoot) && !IsSendSASConfigPage) /* Not SPC */
4915 {
4916 /* call saSetControllerConfig() to set STP_IDLE_TIME; All others are the defaults */
4917 osti_memset(&SASConfigPage, 0, sizeof(agsaSASProtocolTimerConfigurationPage_t));
4919 SASConfigPage.MST_MSI = 3 << 15; /* enables both MCT for SSP target and initiator */
4920 SASConfigPage.STP_SSP_MCT_TMO = (tdsaAllShared->STP_MCT_TMO << 16) | tdsaAllShared->SSP_MCT_TMO; /* default of 3200 us for STP and SSP maximum connection time */
4921 SASConfigPage.STP_FRM_TMO = (tdsaAllShared->MAX_OPEN_TIME << 24) | (tdsaAllShared->SMP_MAX_CONN_TIMER << 16) | tdsaAllShared->STP_FRM_TMO; /* MAX_OPEN_TIME, SMP_MAX_CONN_TIMER, STP frame timeout */
4922 SASConfigPage.STP_IDLE_TMO = tdsaAllShared->stp_idle_time;
4923 if (SASConfigPage.STP_IDLE_TMO > 0x3FFFFFF)
4924 {
4925 SASConfigPage.STP_IDLE_TMO = 0x3FFFFFF;
4926 }
4927 SASConfigPage.OPNRJT_RTRY_INTVL = (tdsaAllShared->MFD << 16) | tdsaAllShared->OPNRJT_RTRY_INTVL; /* Multi Data Fetach enabled and 2 us for Open Reject Retry interval */
4928 SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (tdsaAllShared->DOPNRJT_RTRY_TMO << 16) | tdsaAllShared->COPNRJT_RTRY_TMO; /* 128 us for ORR Timeout for DATA phase and 32 us for ORR Timeout for command phase */
4929 SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (tdsaAllShared->DOPNRJT_RTRY_THR << 16) | tdsaAllShared->COPNRJT_RTRY_THR; /* 16 for ORR backoff threshold for DATA phase and 1024 for ORR backoff threshold for command phase */
4930 SASConfigPage.MAX_AIP = tdsaAllShared->MAX_AIP; /* MAX AIP. Default is 0x200000 */
4931
4932 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.pageCode 0x%08x\n",SASConfigPage.pageCode));
4933 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.MST_MSI 0x%08x\n",SASConfigPage.MST_MSI));
4934 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n",SASConfigPage.STP_SSP_MCT_TMO));
4935 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_FRM_TMO 0x%08x\n",SASConfigPage.STP_FRM_TMO));
4936 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.STP_IDLE_TMO 0x%08x\n",SASConfigPage.STP_IDLE_TMO));
4937 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n",SASConfigPage.OPNRJT_RTRY_INTVL));
4938 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n",SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO));
4939 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n",SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR));
4940 TI_DBG1(("tiCOMPortStart: saSetControllerConfig SASConfigPage.MAX_AIP 0x%08x\n",SASConfigPage.MAX_AIP));
4941
4943 0,
4946 &SASConfigPage,
4947 agNULL);
4948 if (status != AGSA_RC_SUCCESS)
4949 {
4950 TI_DBG1(("tiCOMPortStart: calling saSetControllerConfig() failed\n"));
4951 }
4952 else
4953 {
4954 TI_DBG2(("tiCOMPortStart: calling saSetControllerConfig() is OK\n"));
4955 }
4956 IsSendSASConfigPage = agTRUE;
4957 }
4958 else
4959 {
4960 TI_DBG1(("tiCOMPortStart: saSetControllerConfig not called tIsSPCV12or6G %d IsSendSASConfigPage %d\n",tIsSPCV12or6G(agRoot),IsSendSASConfigPage));
4961 }
4962
4963 /* maps portID to phyID */
4964 status = saPhyStart(agRoot,
4965 agNULL,
4966 0,
4967 portID,
4968 &(tdsaAllShared->Ports[portID].agPhyConfig),
4969 &(tdsaAllShared->Ports[portID].SASID)
4970 );
4971
4972 TI_DBG6(("tiCOMPortStart: saPhyStart status %d\n", status));
4973
4974 if (status == AGSA_RC_SUCCESS)
4975 {
4976 TI_DBG3(("tiCOMPortStart : calling portstarted\n"));
4978 tiRoot,
4980 tiSuccess,
4981 (void *) tdsaAllShared->Ports[portID].tiPortalContext
4982 );
4983 return tiSuccess;
4984 }
4985 else
4986 {
4987 TI_DBG3(("tiCOMPortStart : cant' start port\n"));
4988 return tiError;
4989 }
4990
4991}
4992
4993/*****************************************************************************
4994*! \brief tiCOMPortStop
4995*
4996* Purpose: This function is called to bring the port hardware down.
4997*
4998* \param tiRoot: Pointer to root data structure.
4999* \param portalContext: Pointer to the context for this portal.
5000*
5001* \return:
5002* tiSuccess: Successful.
5003* Others: Fail.
5004*
5005* \note -
5006*
5007*****************************************************************************/
5011 tiPortalContext_t *portalContext
5012 )
5013{
5014 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5015 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5016 tdList_t *PortContextList;
5017 tdsaPortContext_t *onePortContext = agNULL;
5018 agsaRoot_t *agRoot = agNULL;
5019 bit32 i;
5020 bit32 found = agFALSE;
5021
5022#ifdef CONTROLLER_STATUS_TESTING
5023 agsaControllerStatus_t agcontrollerStatus;
5024#endif /* CONTROLLER_STATUS_TESTING */
5025
5026
5027 TI_DBG3(("tiCOMPortStop: start\n"));
5028 /*
5029 find the portcontext
5030 find phys belonging to that portcotext
5031 call saPhyStop for all those phys
5032 call saPhyStop()
5033 remove the portcontext from the portcontext list
5034 */
5035
5036 agRoot = &(tdsaAllShared->agRootNonInt);
5037
5038#ifdef CONTROLLER_STATUS_TESTING
5039 TI_DBG1(("tiCOMPortStop: saGetControllerStatus returns 0x%X\n",saGetControllerStatus(agRoot,&agcontrollerStatus ) ));
5040#endif /* CONTROLLER_INFO_TESTING */
5041
5042 if (TDLIST_EMPTY(&(tdsaAllShared->MainPortContextList)))
5043 {
5044 TI_DBG1(("tiCOMPortStop: empty tdsaPortContext\n"));
5045 return tiError;
5046 }
5047
5048 /* find a right portcontext */
5049 PortContextList = tdsaAllShared->MainPortContextList.flink;
5050 while (PortContextList != &(tdsaAllShared->MainPortContextList))
5051 {
5052 onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
5053 if (onePortContext == agNULL)
5054 {
5055 TI_DBG1(("tiCOMPortStop: onePortContext is NULL!!!\n"));
5056 return tiError;
5057 }
5058 if (onePortContext->tiPortalContext == portalContext)
5059 {
5060 TI_DBG6(("tiCOMPortStop: found; oneportContext ID %d\n", onePortContext->id));
5061 found = agTRUE;
5062 break;
5063 }
5064 PortContextList = PortContextList->flink;
5065 }
5066
5067 if (found == agFALSE)
5068 {
5069 TI_DBG1(("tiCOMPortStop: No corressponding tdsaPortContext\n"));
5070 return tiError;
5071 }
5072
5073#ifdef INITIATOR_DRIVER
5074 /* reset the fields of portcontext */
5075 onePortContext->DiscoveryState = ITD_DSTATE_NOT_STARTED;
5077#endif /* INITIATOR_DRIVER */
5078
5079 onePortContext->Count = 0;
5080 onePortContext->agContext.osData = onePortContext;
5081 for(i=0;i<TD_MAX_NUM_PHYS;i++)
5082 {
5083 if (onePortContext->PhyIDList[i] == agTRUE)
5084 {
5085 tdsaAllShared->Ports[i].portContext = agNULL;
5086#ifdef CCFLAGS_PHYCONTROL_COUNTS
5087 if( tiIS_SPC(agRoot) )
5088 {
5089
5090 saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_GET_ERROR_COUNTS, agNULL);
5091 saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_CLEAR_ERROR_COUNTS, agNULL);
5092 saLocalPhyControl(agRoot,&onePortContext->agContext,0 , i, AGSA_PHY_GET_BW_COUNTS, agNULL);
5093 }
5094 else
5095 {
5096 TI_DBG1(("\ntiCOMPortStop: CCFLAGS_PHYCONTROL_COUNTS PHY %d\n",i));
5097 saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ERR_COUNTERS_PAGE, i);
5098 saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_BW_COUNTERS_PAGE,i);
5099 saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE,i);
5100 saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_GENERAL_STATUS_PAGE,i);
5101 saGetPhyProfile( agRoot,&onePortContext->agContext,0, AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE,i);
5102
5103 TI_DBG1(("tiCOMPortStop: CCFLAGS_PHYCONTROL_COUNTS PHY %d\n",i));
5104
5105 }
5106
5107#endif /* CCFLAGS_PHYCONTROL_COUNTS */
5108 saPhyStop(agRoot, &onePortContext->agContext, 0, i);
5109 }
5110 }
5111
5112 return tiSuccess;
5113}
5114
5115
5116/*****************************************************************************
5117*! \brief tiCOMGetPortInfo
5118*
5119* Purpose: This function is called to return information about the specific
5120* port instant
5121*
5122*
5123* \param tiRoot: Pointer to driver/port instance.
5124* \param portalContext Pointer to the context for this portal.
5125* \param tiPortInfo: Pointer to port information structure.
5126*
5127* \Return: tiSuccess
5128*
5129*****************************************************************************/
5130/*
5131 can't find tdsaportcontext in this function
5132 since discovery has not been called by OS layer yet
5133 Therefore, hardcoded value are being returned for now
5134*/
5137 tiPortalContext_t *portalContext,
5139 )
5140
5141{
5142 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5143 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5144 tdList_t *PortContextList;
5145 tdsaPortContext_t *onePortContext = agNULL;
5146 bit32 found = agFALSE;
5147 static bit8 localname[68], remotename[68];
5148
5149 TI_DBG6(("tiCOMGetPortInfo: start\n"));
5150
5151
5153 if (TDLIST_EMPTY(&(tdsaAllShared->MainPortContextList)))
5154 {
5156 TI_DBG1(("tiCOMGetPortInfo: No tdsaPortContext\n"));
5157 return tiError;
5158 }
5159 else
5160 {
5162 }
5163
5164 /* find a corresponding portcontext */
5165 PortContextList = tdsaAllShared->MainPortContextList.flink;
5166 while (PortContextList != &(tdsaAllShared->MainPortContextList))
5167 {
5168 onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
5169 TI_DBG3(("tiCOMGetPortInfo: oneportContext pid %d\n", onePortContext->id));
5170 if (onePortContext->tiPortalContext == portalContext && onePortContext->valid == agTRUE)
5171 {
5172 TI_DBG3(("tiCOMGetPortInfo: found; oneportContext pid %d\n", onePortContext->id));
5173 found = agTRUE;
5174 break;
5175 }
5176 PortContextList = PortContextList->flink;
5177 }
5178
5179 if (found == agFALSE)
5180 {
5181 TI_DBG1(("tiCOMGetPortInfo: First, No corresponding tdsaPortContext\n"));
5182 return tiError;
5183 }
5184
5185 if (onePortContext == agNULL)
5186 {
5187 TI_DBG1(("tiCOMGetPortInfo: Second, No corressponding tdsaPortContext\n"));
5188 return tiError;
5189 }
5190
5191 osti_memset(localname, 0, sizeof(localname));
5192 osti_memset(remotename, 0, sizeof(remotename));
5193
5194 /*
5195 Parse the type of port then fill in the information
5196 */
5197 if ( onePortContext->sasRemoteAddressHi == 0xFFFFFFFF && onePortContext->sasRemoteAddressLo == 0xFFFFFFFF)
5198 {
5199 /* directly attached SATA port */
5200 osti_memcpy(localname, &(onePortContext->sasLocalAddressHi), 4);
5201 osti_memcpy(&(localname[4]), &(onePortContext->sasLocalAddressLo), 4);
5203 /* information is from SATA ID device data. remoteName is serial number, firmware version, model number */
5204 osti_memcpy(remotename, onePortContext->remoteName, 68);
5206 }
5207 else
5208 {
5209 /* copy hi address and low address */
5210 osti_memcpy(localname, &(onePortContext->sasLocalAddressHi), 4);
5211 osti_memcpy(&(localname[4]), &(onePortContext->sasLocalAddressLo), 4);
5213 osti_memcpy(remotename, &(onePortContext->sasRemoteAddressHi), 4);
5214 osti_memcpy(&(remotename[4]), &(onePortContext->sasRemoteAddressLo), 4);
5216 }
5217
5218 tiPortInfo->localName = (char *)&localname;
5219 tiPortInfo->remoteName = (char *)&remotename;
5220
5221
5222 return tiSuccess;
5223
5224}
5225
5226/*****************************************************************************
5227*
5228* tiCOMSetControllerConfig
5229*
5230* Purpose: This function is called to set the controller's advanced configuration.
5231* The status is reported via ostiPortEvent().
5232*
5233* Parameters:
5234*
5235* tiRoot: Pointer to driver/port instance.
5236*
5237* Return:
5238* tiSuccess: The setting controller configuration was started.
5239* tiError: The setting controller configuration was not started.
5240*
5241*****************************************************************************/
5244 bit32 modePage,
5245 bit32 length,
5246 void *buffer,
5247 void *context)
5248{
5249 agsaRoot_t *agRoot;
5250 bit32 returnCode = AGSA_RC_BUSY;
5251 bit32 tiStatus = tiSuccess;
5252 tdsaRoot_t *tdsaRoot ;
5253 tdsaContext_t *tdsaAllShared ;
5254
5255 TD_ASSERT(tiRoot, "tiRoot");
5256 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5257 TD_ASSERT(tdsaRoot, "tdsaRoot");
5258
5259 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5260 TD_ASSERT(tdsaAllShared, "tdsaAllShared");
5261 agRoot = &(tdsaAllShared->agRootNonInt);
5262 TD_ASSERT(agRoot, "agRoot");
5263
5264 agRoot = &(tdsaAllShared->agRootNonInt);
5265
5266 TI_DBG1(("tiCOMSetControllerConfig:\n" ));
5267
5268 /*do some sanity checking */
5269 if ( ((modePage == TI_INTERRUPT_CONFIGURATION_PAGE) && (length != sizeof(tiInterruptConfigPage_t ))) ||
5270 ((modePage == TI_ENCRYPTION_GENERAL_CONFIG_PAGE) && (length != sizeof(tiEncryptGeneralPage_t ))) ||
5271 ((modePage == TI_ENCRYPTION_DEK_CONFIG_PAGE) && (length != sizeof(tiEncryptDekConfigPage_t))) ||
5272 ((modePage == TI_ENCRYPTION_CONTROL_PARM_PAGE) && (length != sizeof(tiEncryptControlParamPage_t ))) ||
5273 ((modePage == TI_ENCRYPTION_HMAC_CONFIG_PAGE) && (length != sizeof(tiEncryptHMACConfigPage_t ))) ||
5274 ((modePage == TI_SAS_PROTOCOL_TIMER_CONFIG_PAGE) && (length != sizeof(tiSASProtocolTimerConfigurationPage_t ))) )
5275 {
5276 tiStatus = tiError;
5277 }
5278 else
5279 {
5280 returnCode = saSetControllerConfig(agRoot, 0, modePage, length, buffer, context);
5281
5282 if (returnCode == AGSA_RC_SUCCESS)
5283 {
5284 tiStatus = tiSuccess;
5285 }
5286 else if (returnCode == AGSA_RC_BUSY)
5287 {
5288 tiStatus = tiBusy;
5289 }
5290 else
5291 {
5292 tiStatus = tiError;
5293 }
5294 }
5295 return(tiStatus);
5296}
5297
5298/*****************************************************************************
5299*
5300* tiCOMGetControllerConfig
5301*
5302* Purpose: This function is called to get the controller's advanced configuration.
5303* The status is reported via ostiPortEvent().
5304*
5305* Parameters:
5306*
5307* tiRoot: Pointer to driver/port instance.
5308* flag: Interrupt Vector Mask
5309* This parameter is valid only when modePage is set to TI_INTERRUPT_CONFIGURATION_PAGE.
5310* When the modePage field is set to TI_INTERRUPT_CONFIGURATION_PAGE,
5311* this field contains a bitmap of interrupt vectors for which interrupt coalescing parameters are retrieved.
5312* Return:
5313* tiSuccess: The controller configuration retrival was started.
5314* tiError: The controller configuration retrival was not started.
5315*
5316*****************************************************************************/
5319 bit32 modePage,
5320 bit32 flag,
5321 void *context)
5322
5323{
5324 agsaRoot_t *agRoot;
5325 bit32 returnCode = AGSA_RC_BUSY;
5326 bit32 tiStatus = tiSuccess;
5327 tdsaRoot_t *tdsaRoot ;
5328 tdsaContext_t *tdsaAllShared ;
5329
5330 TD_ASSERT(tiRoot, "tiRoot");
5331 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5332 TD_ASSERT(tdsaRoot, "tdsaRoot");
5333
5334 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5335 TD_ASSERT(tdsaAllShared, "tdsaAllShared");
5336 agRoot = &(tdsaAllShared->agRootNonInt);
5337 TD_ASSERT(agRoot, "agRoot");
5338
5339 agRoot = &(tdsaAllShared->agRootNonInt);
5340
5341 TI_DBG1(("tiCOMGetControllerConfig: modePage 0x%x context %p\n",modePage,context ));
5342
5343 returnCode = saGetControllerConfig(agRoot, 0, modePage, flag, 0, context);
5344
5345 if (returnCode == AGSA_RC_SUCCESS)
5346 {
5347 tiStatus = tiSuccess;
5348 TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiSuccess\n",modePage ));
5349 }
5350 else if (returnCode == AGSA_RC_BUSY)
5351 {
5352 tiStatus = tiBusy;
5353 TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiBusy\n",modePage ));
5354 }
5355 else
5356 {
5357 tiStatus = tiError;
5358 TI_DBG1(("tiCOMGetControllerConfig:modePage 0x%x tiError\n",modePage ));
5359 }
5360
5361 return(tiStatus);
5362}
5363
5364/*****************************************************************************
5365*
5366* tiCOMEncryptGetInfo
5367*
5368* Purpose: This function is called to return information about the encryption
5369* engine for the specified port.
5370*
5371* Parameters:
5372*
5373* tiRoot: Pointer to driver/port instance.
5374*
5375* Return:
5376* tiSuccess The request is being processed
5377* tiNotSupported Encryption is not supported
5378*
5379*****************************************************************************/
5381{
5383 agsaEncryptInfo_t agsaEncryptInfo;
5384 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5385 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5386 agsaRoot_t *agRoot;
5388 bit32 returnCode;
5389 bit32 tiStatus;
5390
5391 agRoot = &(tdsaAllShared->agRootNonInt);
5392
5393 returnCode = saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo);
5394 TI_DBG1(("tiCOMEncryptGetInfo: returnCode 0x%x\n", returnCode));
5395
5396 if (returnCode == AGSA_RC_SUCCESS)
5397 {
5398 tiStatus = tiSuccess;
5399
5400 /*
5401 * The data encoded in the agsaEncryptInfo must be converted
5402 * to match the fields of the tiEncryptInfo structure.
5403 *
5404 * No sector information is currently available.
5405 */
5407
5408 /* cipher mode */
5409 if (agsaEncryptInfo.encryptionCipherMode == agsaEncryptCipherModeXTS)
5410 {
5412 }
5413 /* security mode */
5414 if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMF)
5415 {
5417 }
5418 else if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMA)
5419 {
5421 }
5422 else if (agsaEncryptInfo.encryptionSecurityMode == agsaEncryptSMB)
5423 {
5425 }
5426
5427 tiEncryptInfo.status = agsaEncryptInfo.status;
5428
5430
5431 /* The low level returns synchronously, so fake a port event now.*/
5434
5436 }
5437 else
5438 {
5439 if (returnCode == AGSA_RC_NOT_SUPPORTED)
5440 {
5441 tiStatus = tiNotSupported;
5442 TI_DBG1(("tiCOMEncryptGetInfo: tiNotSupported\n"));
5443 }
5444 else
5445 {
5446 TI_DBG1(("tiCOMEncryptGetInfo: tiError returnCode 0x%x\n",returnCode));
5447 tiStatus = tiError;
5448 }
5449
5451 }
5452
5453 return(tiStatus);
5454}
5455
5456/*****************************************************************************
5457*
5458* tiCOMEncryptSetMode
5459*
5460* Purpose: This function is called to set the encryption security and cipher modes
5461* for the encryption engine.
5462*
5463* Parameters:
5464*
5465* tiRoot: Pointer to driver/port instance.
5466*
5467* Return:
5468* tiSuccess The request is being processed
5469* tiError The encryption engine is not in factory init mode or multiple
5470* security modes were specified.
5471*
5472*****************************************************************************/
5473
5476{
5477 bit32 returnCode;
5478 bit32 tiStatus;
5479 agsaEncryptInfo_t mode;
5480 agsaEncryptInfo_t *pmode = &mode;
5481
5482 tdsaRoot_t *tdsaRoot ;
5483 tdsaContext_t *tdsaAllShared;
5484 agsaRoot_t *agRoot;
5485
5486 TD_ASSERT(tiRoot, "tiRoot");
5487 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5488 TD_ASSERT(tdsaRoot, "tdsaRoot");
5489
5490 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5491 TD_ASSERT(tdsaAllShared, "tdsaAllShared");
5492 agRoot = &(tdsaAllShared->agRootNonInt);
5493 TD_ASSERT(agRoot, "agRoot");
5494
5495 pmode->encryptionSecurityMode = 0;
5496 pmode->encryptionCipherMode = 0;
5497 pmode->status = 0;
5498
5499 TI_DBG1(("tiCOMEncryptSetMode:\n"));
5500
5501
5503 {
5505 }
5506
5508 {
5510 }
5511
5513 {
5515 }
5516
5517 /* ECB is not supported in SPCv */
5519 {
5520 return tiError;
5521 }
5522
5523 returnCode = saEncryptSetMode(agRoot,agNULL, 0, pmode );
5524
5525 if (returnCode == AGSA_RC_SUCCESS)
5526 {
5527 tiStatus = tiSuccess;
5528 }
5529 else if (returnCode == AGSA_RC_BUSY)
5530 {
5531 TI_DBG1(("tiCOMEncryptSetMode:tiBusy\n"));
5532 tiStatus = tiBusy;
5533 }
5534 else
5535 {
5536 TI_DBG1(("tiCOMEncryptSetMode:tiError\n"));
5537 tiStatus = tiError;
5538 }
5539
5540 return(tiStatus);
5541}
5542
5543/*****************************************************************************
5544*
5545* tiCOMEncryptDekAdd
5546*
5547* Purpose: This function is called to add a DEK to the controller cache.
5548*
5549* Parameters:
5550*
5551* tiRoot: Pointer to driver/port instance.
5552* kekIndext: Index of the KEK table
5553* dekTableSelect: Number of the DEK table receiving a new entry
5554* dekAddrHi: Upper 32-bits of the DEK table physical address
5555* dekAddrLo: Lower 32-bits of the DEK table physical address
5556* dekIndex: Number of the first entry in the DEK table that will inserted in the cache
5557* dekNumberOfEntries: Number of entries to be inserted in the cache
5558* dekBlobFormat: Specifies the DEK blob format
5559* dekTableKeyEntrySize: Encoded value for DEK Entry Size in the DEK Table
5560*
5561* Return:
5562* tiSuccess The request is being processed
5563* tiError An invalid parameter was specified
5564*
5565*****************************************************************************/
5568 bit32 dekTableSelect,
5569 bit32 dekAddrHi,
5570 bit32 dekAddrLo,
5572 bit32 dekNumberOfEntries,
5575
5576 )
5577{
5578 agsaRoot_t *agRoot;
5579 bit32 returnCode;
5580 bit32 tiStatus;
5581 tdsaRoot_t *tdsaRoot ;
5582 tdsaContext_t *tdsaAllShared ;
5583
5584 TD_ASSERT(tiRoot, "tiRoot");
5585 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5586 TD_ASSERT(tdsaRoot, "tdsaRoot");
5587
5588 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5589 TD_ASSERT(tdsaAllShared, "tdsaAllShared");
5590 agRoot = &(tdsaAllShared->agRootNonInt);
5591 TD_ASSERT(agRoot, "agRoot");
5592
5593
5594 agRoot = &(tdsaAllShared->agRootNonInt);
5595
5596
5597 TI_DBG1(("tiCOMEncryptDekAdd:\n" ));
5598
5599 returnCode = saEncryptDekCacheUpdate(agRoot,
5600 agNULL,
5601 0,
5602 kekIndex,
5603 dekTableSelect,
5604 dekAddrHi,
5605 dekAddrLo,
5606 dekIndex,
5607 dekNumberOfEntries,
5610 );
5611
5612 if (returnCode == AGSA_RC_SUCCESS)
5613 {
5614 tiStatus = tiSuccess;
5615 }
5616 else if (returnCode == AGSA_RC_BUSY)
5617 {
5618 tiStatus = tiBusy;
5619 }
5620 else
5621 {
5622 tiStatus = tiError;
5623 }
5624
5625 return(tiStatus);
5626}
5627
5628/*****************************************************************************
5629*
5630* tiCOMEncryptDekInvalidate
5631*
5632* Purpose: This function is called to remove a DEK entry from the hardware cache.
5633*
5634* Parameters:
5635*
5636* tiRoot: Pointer to driver/port instance.
5637* dekTable DEK table that will be affected
5638* dekIndex: DEK table entry that will be affected. The value 0xfffffff clears the cache.
5639*
5640* Return:
5641* tiSuccess The request is being processed
5642* tiError An invalid parameter was specified
5643* tiBusy An operation is already in progress
5644*
5645*****************************************************************************/
5646
5650{
5651
5652 tdsaRoot_t *tdsaRoot;
5653 tdsaContext_t *tdsaAllShared;
5654
5655 agsaRoot_t *agRoot;
5658 bit32 returnCode;
5659 bit32 tiStatus;
5660
5661 TD_ASSERT(tiRoot, "tiRoot");
5662 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5663 TD_ASSERT(tdsaRoot, "tdsaRoot");
5664
5665 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5666 TD_ASSERT(tdsaAllShared, "tdsaAllShared");
5667 agRoot = &(tdsaAllShared->agRootNonInt);
5668 TD_ASSERT(agRoot, "agRoot");
5669
5670 TI_DBG1(("tiCOMEncryptDekInvalidate:dekTable 0x%x dekIndex 0x%x\n", dekTable, dekIndex));
5671
5672 returnCode = saEncryptDekCacheInvalidate(agRoot, agNULL, 0, dekTable, dekIndex);
5673
5674 if (returnCode == AGSA_RC_SUCCESS)
5675 {
5676 tiStatus = tiSuccess;
5677 }
5678 else
5679 {
5680 if (returnCode == AGSA_RC_NOT_SUPPORTED)
5681 {
5682 tiStatus = tiNotSupported;
5683 }
5684 else if (returnCode == AGSA_RC_BUSY)
5685 {
5686 tiStatus = tiBusy;
5687 }
5688 else
5689 {
5690 tiStatus = tiError;
5691 }
5692
5695
5698 tiEncryptPort.pData = (void *) &tiEncryptDek;
5699
5701 }
5702
5703 return(tiStatus);
5704}
5705
5706/*****************************************************************************
5707*
5708* tiCOMEncryptKekAdd
5709*
5710* Purpose: This function is called to add a KEK in the register specified by
5711* the index parameter.
5712*
5713* Parameters:
5714*
5715* tiRoot: Pointer to driver/port instance.
5716* kekIndex: KEK table entry that will be affected
5717* wrapperKekIndex KEK table entry that encrypt the KEK blob
5718* encryptKekBlob KEK blob that will be added
5719*
5720* Return:
5721* tiSuccess The request is being processed
5722* tiError An invalid parameter was specified
5723* tiBusy A KEK operation is already in progress
5724*
5725*****************************************************************************/
5726
5731 tiEncryptKekBlob_t *encryptKekBlob)
5732{
5733 tdsaRoot_t *tdsaRoot;
5734 tdsaContext_t *tdsaAllShared;
5735 agsaRoot_t *agRoot;
5736
5737 bit32 returnCode= AGSA_RC_BUSY;
5738 bit32 tiStatus= tiError;
5739
5740 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5741 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5742
5743 agRoot = &(tdsaAllShared->agRootNonInt);
5744
5745 TI_DBG1(("tiCOMEncryptDekInvalidate: kekIndex 0x%x wrapperKekIndex 0x%x\n", kekIndex , wrapperKekIndex));
5746
5747 returnCode = saEncryptKekUpdate(agRoot,
5748 agNULL,
5749 0,
5751 kekIndex,
5753 blobFormat,
5754 (agsaEncryptKekBlob_t *) encryptKekBlob);
5755
5756 if (returnCode == AGSA_RC_SUCCESS)
5757 {
5758 tiStatus = tiSuccess;
5759 }
5760 else if (returnCode == AGSA_RC_BUSY)
5761 {
5762 tiStatus = tiBusy;
5763 }
5764 else
5765 {
5766 tiStatus = tiError;
5767 }
5768
5769 return(tiStatus);
5770}
5771#ifdef HIALEAH_ENCRYPTION
5772
5773osGLOBAL bit32 tiCOMEncryptHilSet(tiRoot_t *tiRoot )
5774{
5775 tdsaRoot_t *tdsaRoot;
5776 tdsaContext_t *tdsaAllShared;
5777 agsaRoot_t *agRoot;
5778 agsaEncryptInfo_t agsaEncryptInfo;
5779
5780 bit32 returnCode= tiBusy;
5781 bit32 tiStatus= tiError;
5782
5783 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5784 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5785
5786 agRoot = &(tdsaAllShared->agRootNonInt);
5787
5788
5789 returnCode = saEncryptGetMode(agRoot,agNULL, &agsaEncryptInfo);
5790 TI_DBG1(("tiCOMEncryptHilSet: saEncryptGetMode returnCode 0x%x agsaEncryptInfo status 0x%x Smode 0x%x CMode 0x%x\n",
5791 returnCode,
5792 agsaEncryptInfo.status,
5793 agsaEncryptInfo.encryptionSecurityMode,
5794 agsaEncryptInfo.encryptionCipherMode ));
5795
5796 if (returnCode == AGSA_RC_FAILURE)
5797 {
5798 TI_DBG1(("tiCOMEncryptHilSet:agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
5799 if(agsaEncryptInfo.status == 0x81)
5800 {
5801 TI_DBG1(("tiCOMEncryptHilSet: status 0x80 KEY CARD MISMATCH agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
5802 returnCode = saEncryptHilUpdate(agRoot,
5803 agNULL,
5804 0 );
5805 if (returnCode == AGSA_RC_SUCCESS)
5806 {
5807 TI_DBG1(("tiCOMEncryptHilSet:AGSA_RC_SUCCESS\n"));
5808 }
5809 }
5810 else if(agsaEncryptInfo.status == 0x80)
5811 {
5813 TI_DBG1(("tiCOMEncryptHilSet: status 0x80 KEY CARD MISSING agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
5814 returnCode = AGSA_RC_SUCCESS;
5815 }
5816 else
5817 {
5818 TI_DBG1(("tiCOMEncryptHilSet: not status 0x81 agsaEncryptInfo.status 0x%x\n",agsaEncryptInfo.status ));
5819 returnCode = AGSA_RC_FAILURE;
5820 }
5821 }
5822
5823 if (returnCode == AGSA_RC_SUCCESS)
5824 {
5825 tiStatus = tiSuccess;
5826 }
5827 else if (returnCode == AGSA_RC_BUSY)
5828 {
5829 TI_DBG1(("tiCOMEncryptHilSet:AGSA_RC_BUSY\n"));
5830 tiStatus = tiBusy;
5831 }
5832 else
5833 {
5834 TI_DBG1(("tiCOMEncryptHilSet:tiError\n"));
5835 tiStatus = tiError;
5836 }
5837
5838 return(tiStatus);
5839}
5840#endif /* HIALEAH_ENCRYPTION */
5841
5842/*****************************************************************************
5843*
5844* tiCOMEncryptKekStore
5845*
5846* Purpose: This function is called to store a KEK in NVRAM. If -1 is specified
5847* as the KEK index, then all KEKs will be stored.
5848*
5849* Parameters:
5850*
5851* tiRoot: Pointer to driver/port instance.
5852* kekIndex: The KEK to be stored in NVRAM
5853*
5854* Return:
5855* tiSuccess The request is being processed
5856* tiError An invalid parameter was specified
5857* tiBusy A KEK operation is already in progress
5858*
5859*****************************************************************************/
5860
5863{
5864#ifdef NOT_YET
5865 tdsaRoot_t *tdsaRoot;
5866 tdsaContext_t *tdsaAllShared;
5867 agsaRoot_t *agRoot;
5868#endif
5869/*
5870 bit32 returnCode= AGSA_RC_BUSY;
5871*/
5872 bit32 tiStatus = tiError;
5873
5874#ifdef NOT_YET
5875 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5876 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5877
5878 agRoot = &(tdsaAllShared->agRootNonInt);
5879#endif
5880
5881 TI_DBG1(("tiCOMEncryptKekStore: Needs code !!!! kekIndex 0x%x\n", kekIndex ));
5882/*
5883 returnCode = fcEncryptKekStore(agRoot, kekIndex);
5884
5885 if (returnCode == AGSA_RC_SUCCESS)
5886 {
5887 tiStatus = tiSuccess;
5888 }
5889 else if (returnCode == AGSA_RC_BUSY)
5890 {
5891 tiStatus = tiBusy;
5892 }
5893 else
5894 {
5895 tiStatus;
5896 }
5897*/
5898 return(tiStatus);
5899}
5900
5901/*****************************************************************************
5902*
5903* tiCOMEncryptKekLoad
5904*
5905* Purpose: This function is called to load a KEK from NVRAM. If -1 is specified
5906* as the KEK index, then all KEKs will be loaded.
5907*
5908* Parameters:
5909*
5910* tiRoot: Pointer to driver/port instance.
5911* kekIndex: The KEK to be loaded in NVRAM
5912*
5913* Return:
5914* tiSuccess The request is being processed
5915* tiError An invalid parameter was specified
5916* tiBusy A KEK operation is already in progress
5917*
5918*****************************************************************************/
5919
5922{
5923#ifdef NOT_YET
5924 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5925 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5926 agsaRoot_t *agRoot;
5927 //bit32 returnCode;
5928#endif
5929 bit32 tiStatus = tiError;
5930
5931#ifdef NOT_YET
5932 agRoot = &(tdsaAllShared->agRootNonInt);
5933#endif
5934/*
5935 returnCode = fcEncryptKekLoad(agRoot, kekIndex);
5936
5937 if (returnCode == AGSA_RC_SUCCESS)
5938 {
5939 tiStatus = tiSuccess;
5940 }
5941 else if (returnCode == AGSA_RC_BUSY)
5942 {
5943 tiStatus = tiBusy;
5944 }
5945 else
5946 {
5947 tiStatus = tiError;
5948 }
5949*/
5950 return(tiStatus);
5951}
5952
5953/*****************************************************************************
5954*
5955* tiCOMEncryptSelfTest
5956*
5957* Purpose: This function starts the encryption self test. For the encryption self test, IOs must be quiesced.
5958* The completion of this function is via ostiPortEvent().
5959*
5960* Parameters:
5961*
5962* tiRoot: Pointer to driver/port instance.
5963* type: Types of test
5964 0x1: tiBISTTest
5965 0x2: tiHMACTest
5966 Others are reserved.
5967* length:
5968 Size of the test descriptor in bytes, e.g.,
5969 Sizeof(tiEncryptSelfTestDescriptor_t)
5970 Sizeof(tiEncryptHMACTestDescriptor_t)
5971* TestDescriptor address of the test descriptor structure.
5972*
5973* Return:
5974* tiSuccess The request is being processed
5975* tiError An invalid parameter was specified
5976* tiBusy A encrytion operation is already in progress
5977*
5978*****************************************************************************/
5981 bit32 type,
5982 bit32 length,
5983 void *TestDescriptor
5984 )
5985{
5986 tdsaRoot_t *tdsaRoot = agNULL;
5987 tdsaContext_t *tdsaAllShared = agNULL;
5988 agsaRoot_t *agRoot = agNULL;
5989
5990 bit32 returnCode = AGSA_RC_BUSY;
5991 bit32 tiStatus = tiError;
5992
5993 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
5994 TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
5995
5996 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
5997 TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
5998
5999 agRoot = &(tdsaAllShared->agRootNonInt);
6000 TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
6001
6002 TI_DBG1(("tiCOMEncryptSelfTest: type = 0x%x length = 0x%x\n", type, length));
6003
6004 /*do some sanity checking */
6005 if ( ((type == TI_ENCRYPTION_TEST_TYPE_BIST) && (length != sizeof(tiEncryptSelfTestDescriptor_t ))) ||
6006 ((type == TI_ENCRYPTION_TEST_TYPE_HMAC) && (length != sizeof(tiEncryptHMACTestDescriptor_t))) )
6007 {
6008 TI_DBG1(("tiCOMEncryptSelfTest: type or length error, type 0x%x length 0x%x\n", type, length));
6009 tiStatus = tiError;
6010 }
6011 else
6012 {
6013 returnCode = saEncryptSelftestExecute(agRoot,
6014 agNULL,
6015 0,
6016 type,
6017 length,
6018 TestDescriptor
6019 );
6020
6021 if (returnCode == AGSA_RC_SUCCESS)
6022 {
6023 tiStatus = tiSuccess;
6024 }
6025 else if (returnCode == AGSA_RC_BUSY)
6026 {
6027 tiStatus = tiBusy;
6028 }
6029 else
6030 {
6031 tiStatus = tiError;
6032 }
6033 }
6034
6035 return(tiStatus);
6036}
6037
6038/*****************************************************************************
6039*
6040* tiCOMSetOperator
6041*
6042* Purpose: This function is called to login to or logout out from the controller by an operator.
6043 The status is reported via ostiPortEvent().
6044*
6045* Parameters:
6046*
6047* tiRoot: Pointer to driver/port instance.
6048* flag: operator flag.
6049 Bits 0-3: Access type (ACS)
6050 0x1: Login
6051 0x2: Logout
6052 All others are reserved.
6053 Bit 4: KEYopr pinned in the KEK table (PIN)
6054 0: Not pinned. Operator ID table will be searched during authentication.
6055 1: Pinned. OPRIDX is referenced to unwrap the certificate.
6056 Bits 5-7: Reserved
6057 Bits 8-15: KEKopr Index in the KEK Table (OPRIDX). If KEKopr is pinned in the KEK table, OPRIDX is to reference the KEK for authentication
6058 Bits 16-31: Reserved.
6059
6060 cert: The pointer to the operator's certificate. The size of the certificate is 40 bytes.
6061*
6062* Return:
6063* tiSuccess Log in or log out was started.
6064* tiError Log in or log out was not started.
6065* tiBusy A operator management operation is already in progress
6066*
6067*****************************************************************************/
6070 bit32 flag,
6071 void *cert
6072 )
6073{
6074 tdsaRoot_t *tdsaRoot = agNULL;
6075 tdsaContext_t *tdsaAllShared = agNULL;
6076 agsaRoot_t *agRoot = agNULL;
6077
6078 bit32 returnCode = AGSA_RC_FAILURE;
6079 bit32 tiStatus = tiError;
6080
6081 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6082 TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
6083
6084 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6085 TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
6086
6087 agRoot = &(tdsaAllShared->agRootNonInt);
6088 TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
6089
6090 TI_DBG1(("tiCOMSetOperator: flag = 0x%x \n", flag));
6091
6092 returnCode = saSetOperator(agRoot,
6093 agNULL,
6094 0,
6095 flag,
6096 cert);
6097
6098 if (returnCode == AGSA_RC_SUCCESS)
6099 {
6100 tiStatus = tiSuccess;
6101 }
6102 else if (returnCode == AGSA_RC_BUSY)
6103 {
6104 tiStatus = tiBusy;
6105 }
6106 else
6107 {
6108 tiStatus = tiError;
6109 }
6110
6111 return(tiStatus);
6112}
6113
6114/*****************************************************************************
6115*
6116* tiCOMGetOperator
6117*
6118* Purpose: This function is used to retrieve the role and ID of the current operator or all operators.
6119 The status is reported via ostiPortEvent().
6120*
6121* Parameters:
6122*
6123* tiRoot: Pointer to driver/port instance.
6124* option: Types of get operations
6125 0x1: Current operator only
6126 0x2: All operators
6127 All others are reserved.
6128 AddrHi Upper 32-bit host physical address to store operator certificates.
6129 This field is used only when option is 0x2
6130 AddrLo Lower 32-bit host physical address to store operator certificates.
6131 This field is used only when option is 0x2
6132*
6133* Return:
6134* tiSuccess The operation was started..
6135* tiError The operation was not started.
6136* tiBusy A operator management operation is already in progress
6137*
6138*****************************************************************************/
6141 bit32 option,
6142 bit32 AddrHi,
6143 bit32 AddrLo
6144 )
6145{
6146 tdsaRoot_t *tdsaRoot = agNULL;
6147 tdsaContext_t *tdsaAllShared = agNULL;
6148 agsaRoot_t *agRoot = agNULL;
6149
6150 bit32 returnCode = AGSA_RC_FAILURE;
6151 bit32 tiStatus = tiError;
6152
6153 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6154 TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
6155
6156 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6157 TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
6158
6159 agRoot = &(tdsaAllShared->agRootNonInt);
6160 TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
6161
6162 TI_DBG1(("tiCOMGetOperator: option = 0x%x \n", option));
6163
6164 returnCode = saGetOperator(agRoot,
6165 agNULL,
6166 0,
6167 option,
6168 AddrHi,
6169 AddrLo);
6170
6171 if (returnCode == AGSA_RC_SUCCESS)
6172 {
6173 tiStatus = tiSuccess;
6174 }
6175 else if (returnCode == AGSA_RC_BUSY)
6176 {
6177 tiStatus = tiBusy;
6178 }
6179 else
6180 {
6181 tiStatus = tiError;
6182 }
6183
6184 return(tiStatus);
6185}
6186
6187/*****************************************************************************
6188*
6189* tiCOMOperationManagement
6190*
6191* Purpose: this function is used to manage operators, e.g. adding or deleting an operator..
6192*
6193* Parameters:
6194*
6195* tiRoot: Pointer to driver/port instance.
6196* flag: operation flag.
6197 Bits 0-7: Operator Management Operation(OMO)
6198 0: Add an operator.
6199 1: Delete an operator.
6200 2: Delete all operators.
6201 Others are reserved.
6202 Bit 8: Pinned to KEK RAM (PKR)
6203 0: Operator's KEK is stored in the operator ID table(OID_TLB) only.
6204 1: Operator's KEK is pinned to the internal KEK RAM (1 of the 16 entries) and is also stored in OID_TLB.
6205 Bits 9-10: KEKopr blob format (KBF)
6206 00b: Reserved.
6207 01b: AGSA_ENCRYPTED_KEK_PMCA.
6208 10b: AGSA_ENCRYPTED_KEK_PMCB.
6209 11b: Reserved.
6210 Bits 11-15: Reserved
6211 Bits 16-23: KEKauth Index in the KEK Table (AUTIDX)
6212 Bits 24-31: KEKopr Index in the KEK Table (OPRIDX). This field is valid only when PKR is 1.
6213
6214 role Role
6215 01b: Crypto officer role.
6216 10b: User role.
6217 All others are reserved.
6218
6219* idString: Pointer to the tiID_t structure describing the ID string
6220* kekBlob Pointer to the tiEncryptKekBlob_t structure describing KBLOB.
6221*
6222* Return:
6223* tiSuccess The request is being processed
6224* tiError An invalid parameter was specified
6225* tiBusy A operator management operation is already in progress
6226*
6227*****************************************************************************/
6230 bit32 flag,
6231 bit8 role,
6232 tiID_t *idString,
6233 tiEncryptKekBlob_t *kekBlob
6234 )
6235{
6236 tdsaRoot_t *tdsaRoot = agNULL;
6237 tdsaContext_t *tdsaAllShared = agNULL;
6238 agsaRoot_t *agRoot = agNULL;
6239
6240 bit32 returnCode = AGSA_RC_BUSY;
6241 bit32 tiStatus = tiError;
6242
6243 tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6244 TD_ASSERT(tdsaRoot != agNULL, "tdsaRoot is NULL !!!");
6245
6246 tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6247 TD_ASSERT(tdsaAllShared != agNULL, "tdsaAllShared is NULL !!!");
6248
6249 agRoot = &(tdsaAllShared->agRootNonInt);
6250 TD_ASSERT(agRoot != agNULL, "agRoot is NULL !!!");
6251
6252 TI_DBG1(("tiCOMOperatorManagement: flag = 0x%x role = 0x%x\n", flag, role));
6253
6254 returnCode = saOperatorManagement(agRoot,
6255 agNULL,
6256 0,
6257 flag,
6258 role,
6259 (agsaID_t*)idString,
6260 (agsaEncryptKekBlob_t *)kekBlob
6261 );
6262
6263 if (returnCode == AGSA_RC_SUCCESS)
6264 {
6265 tiStatus = tiSuccess;
6266 }
6267 else if (returnCode == AGSA_RC_BUSY)
6268 {
6269 tiStatus = tiBusy;
6270 }
6271 else
6272 {
6273 tiStatus = tiError;
6274 }
6275
6276 return(tiStatus);
6277}
6278
6279/*****************************************************************************
6280*! \brief tdssRemoveSASSATAFromSharedcontext
6281*
6282* Purpose: This function removes all discovered devices belonging to
6283* a given portcontext from device list
6284*
6285*
6286* \param agRoot Pointer to the root data structure of
6287* TD and Lower layer
6288* \param tsddPortContext_Instance Pointer to the target port context
6289*
6290* \Return: none
6291*
6292*****************************************************************************/
6293#ifdef INITIATOR_DRIVER /*TBD: added to compile tgt_drv. (TP)*/
6294osGLOBAL void
6296 agsaRoot_t *agRoot,
6297 tdsaPortContext_t *PortContext_Instance
6298 )
6299{
6300 tdsaDeviceData_t *oneDeviceData = agNULL;
6301 tdList_t *DeviceListList;
6302 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6303 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6304 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6305 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6306
6307 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: start\n"));
6308 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: pid %d\n", PortContext_Instance->id));
6309
6310 /* find oneDeviceData belonging to the portcontext */
6311 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6312 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6313 {
6314 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6315 if (oneDeviceData == agNULL)
6316 {
6317 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: oneDeviceData is NULL!!!\n"));
6318 return;
6319 }
6320 if (oneDeviceData->tdPortContext == PortContext_Instance)
6321 {
6322 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: pid %d did %d\n", PortContext_Instance->id, oneDeviceData->id));
6323 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
6324 TI_DBG1(("tdssRemoveSASSATAFromSharedcontext: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
6325
6326 /* reset valid bit */
6327 oneDeviceData->valid = agFALSE;
6328 oneDeviceData->valid2 = agFALSE;
6329 oneDeviceData->registered = agFALSE;
6330 /* notify only reported devices to OS layer*/
6331 if ( DEVICE_IS_SSP_TARGET(oneDeviceData) ||
6332 DEVICE_IS_STP_TARGET(oneDeviceData) ||
6333 DEVICE_IS_SATA_DEVICE(oneDeviceData)
6334 )
6335 {
6337 tiRoot,
6338 PortContext_Instance->tiPortalContext,
6339 &(oneDeviceData->tiDeviceHandle),
6342 agNULL
6343 );
6344 }
6345 DeviceListList = DeviceListList->flink;
6346 /* to-do: deregister */
6347#ifdef REMOVED /* don't remove device from the device list. May screw up ordering */
6348 TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
6349 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
6350#endif
6351 }
6352 else
6353 {
6354 TI_DBG6(("tdssRemoveSASSATAFromSharedcontext: move to the next\n"));
6355 DeviceListList = DeviceListList->flink;
6356 }
6357 } /* while */
6358
6359 return;
6360}
6361
6362/*****************************************************************************
6363*! \brief tdssRemoveSASSATAFromSharedcontextByReset
6364*
6365* Purpose: This function removes all ports and discovered devices
6366*
6367*
6368* \param agRoot Pointer to the root data structure of
6369* TD and Lower layer
6370*
6371* \Return: none
6372*
6373*****************************************************************************/
6374osGLOBAL void
6376 agsaRoot_t *agRoot
6377 )
6378{
6379 tdsaPortContext_t *onePortContext = agNULL;
6380 tdsaDeviceData_t *oneDeviceData = agNULL;
6381 tdList_t *PortContextList;
6382 tdList_t *DeviceListList;
6383 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6384 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6385 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6386 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6387#ifdef FDS_DM
6388 dmRoot_t *dmRoot = agNULL;
6389 dmPortContext_t *dmPortContext = agNULL;
6390 dmPortInfo_t dmPortInfo;
6391#endif
6392#ifdef FDS_SM
6393 smRoot_t *smRoot = &(tdsaAllShared->smRoot);
6394 smDeviceHandle_t *smDeviceHandle = agNULL;
6395 agsaDevHandle_t *agDevHandle = agNULL;
6396#endif
6397
6398 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: start\n"));
6399
6400#ifdef FDS_DM
6401 dmRoot = &(tdsaAllShared->dmRoot);
6402#endif
6403 /* looping throuhg all portcontext */
6404 PortContextList = tdsaAllShared->MainPortContextList.flink;
6405 while (PortContextList != &(tdsaAllShared->MainPortContextList))
6406 {
6407 onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
6408 if (onePortContext == agNULL)
6409 {
6410 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: onePortContext is NULL!!!\n"));
6411 return;
6412 }
6413 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: oneportContext pid %d\n", onePortContext->id));
6414 TI_DBG3(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressHi 0x%08x\n", onePortContext->sasLocalAddressHi));
6415 TI_DBG3(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressLo 0x%08x\n", onePortContext->sasLocalAddressLo));
6416#ifdef FDS_DM
6417 if (onePortContext->UseDM == agTRUE)
6418 {
6419 dmPortContext = &(onePortContext->dmPortContext);
6420 dmDestroyPort(dmRoot, dmPortContext, &dmPortInfo);
6421 }
6422#endif
6423
6424 tdsaPortContextReInit(tiRoot, onePortContext);
6425
6426 PortContextList = PortContextList->flink;
6428 TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
6429 TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
6431 }
6432
6433 /* reinitialize the device data belonging to this portcontext */
6434 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6435 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6436 {
6437 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6438 if (oneDeviceData == agNULL)
6439 {
6440 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: oneDeviceData is NULL!!!\n"));
6441 return;
6442 }
6443
6444 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: did %d\n", oneDeviceData->id));
6445 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
6446 TI_DBG1(("tdssRemoveSASSATAFromSharedcontextByReset: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
6447
6448#ifdef FDS_SM
6449 agDevHandle = oneDeviceData->agDevHandle;
6450 smDeviceHandle = (smDeviceHandle_t *)&(oneDeviceData->smDeviceHandle);
6451 smDeregisterDevice(smRoot, agDevHandle, smDeviceHandle);
6452#endif
6453
6454 tdsaDeviceDataReInit(tiRoot, oneDeviceData);
6455
6456 DeviceListList = DeviceListList->flink;
6458 osti_memset(&(oneDeviceData->satDevData.satIdentifyData), 0xFF, sizeof(agsaSATAIdentifyData_t));
6459 TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
6460 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceList));
6462 /* no dequeue from Mainlink for consistant ordering of devices */
6463 }
6464
6465
6466 return;
6467}
6468
6469#endif
6470
6471
6472/*****************************************************************************
6473*! \brief tdssAddSASToSharedcontext
6474*
6475* Purpose: This function adds a discovered device to a device list of
6476* a shared context
6477*
6478* \param tsddPortContext_Instance Pointer to the target port context
6479* \param agRoot Pointer to the root data structure of
6480* TD and Lower layer
6481* \param agDevHandle Pointer to a device handle
6482*
6483* \Return: none
6484*
6485*****************************************************************************/
6486osGLOBAL void
6488 tdsaPortContext_t *tdsaPortContext_Instance,
6489 agsaRoot_t *agRoot,
6490 agsaDevHandle_t *agDevHandle, /* this is NULL */
6491 tdsaSASSubID_t *agSASSubID,
6492 bit32 registered, /* no longer in use */
6493 bit8 phyID,
6494 bit32 flag
6495 )
6496{
6497
6498 tdsaPortContext_t *onePortContext = agNULL;
6499 tdList_t *PortContextList;
6500 tdsaDeviceData_t *oneDeviceData = agNULL;
6501 tdList_t *DeviceListList;
6502 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6503 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6504 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6505 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6506 bit32 new_device = agTRUE;
6507 bit32 Indenom = tdsaAllShared->QueueConfig.numInboundQueues;
6508 bit32 Outdenom = tdsaAllShared->QueueConfig.numOutboundQueues;
6509 bit8 dev_s_rate = 0;
6510 bit8 sasorsata = 1;
6511 bit8 connectionRate;
6512 bit32 found = agFALSE;
6513
6514 TI_DBG3(("tdssAddSASToSharedcontext: start\n"));
6515 /*
6516 find a right portcontext
6517 then, get devicedata from FreeLink in DeviceList
6518 then, do pointer operations
6519 then, add the devicedata to the portcontext
6520 */
6521
6522 /* find a right portcontext */
6523 PortContextList = tdsaAllShared->MainPortContextList.flink;
6524 while (PortContextList != &(tdsaAllShared->MainPortContextList))
6525 {
6526 onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
6527 if (onePortContext == tdsaPortContext_Instance)
6528 {
6529 TI_DBG3(("tdssAddSASToSharedContext: found; oneportContext ID %d\n", onePortContext->id));
6530 found = agTRUE;
6531 break;
6532 }
6533 PortContextList = PortContextList->flink;
6534 }
6535
6536 if (found == agTRUE)
6537 {
6538 TI_DBG3(("tdssAddSASToSharedcontext: found pid %d\n", onePortContext->id));
6539 }
6540 else
6541 {
6542 TI_DBG1(("tdssAddSASToSharedcontext: Error!!! no portcontext found!!!\n"));
6543 return;
6544 }
6545
6546 /* find a device's existence */
6547 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6548 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6549 {
6550 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6551 if (oneDeviceData == agNULL)
6552 {
6553 TI_DBG1(("tdssAddSASToSharedcontext: oneDeviceData is NULL!!!\n"));
6554 return;
6555 }
6556 if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
6557 (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
6558 (oneDeviceData->tdPortContext == onePortContext)
6559 )
6560 {
6561 TI_DBG1(("tdssAddSASToSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
6562 new_device = agFALSE;
6563 break;
6564 }
6565 DeviceListList = DeviceListList->flink;
6566 }
6567
6568 /* new device */
6569 if (new_device == agTRUE)
6570 {
6571 TI_DBG3(("tdssAddSASToSharedcontext: new device\n"));
6572
6574 if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
6575 {
6577 TI_DBG1(("tdssAddSASToSharedContext: empty DeviceData FreeLink\n"));
6578 return;
6579 }
6580
6581 TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
6583 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
6584
6585 TI_DBG3(("tdssAddSASToSharedcontext: oneDeviceData %p\n", oneDeviceData));
6586
6587 onePortContext->Count++;
6588 oneDeviceData->DeviceType = TD_SAS_DEVICE;
6589 oneDeviceData->agRoot = agRoot;
6590
6591 if (flag == TD_OPERATION_TARGET)
6592 {
6593 oneDeviceData->agDevHandle = agDevHandle;
6594 agDevHandle->osData = oneDeviceData; /* TD layer */
6595 }
6596
6597 /* saving sas address */
6598 oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
6599 oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
6600 oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
6601 oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
6602
6603 oneDeviceData->tdPortContext = onePortContext;
6604 oneDeviceData->valid = agTRUE;
6605
6606 /* new */
6607 oneDeviceData->directlyAttached = agTRUE;
6608 /* parse sasIDframe to fill in agDeviceInfo */
6610 DEVINFO_PUT_ITNEXUSTO(&oneDeviceData->agDeviceInfo, (bit16)tdsaAllShared->itNexusTimeout);
6611 DEVINFO_PUT_FBS(&oneDeviceData->agDeviceInfo, 0);
6612 /* enable TLR */
6613 DEVINFO_PUT_FLAG(&oneDeviceData->agDeviceInfo, 1);
6614
6615 sasorsata = SAS_DEVICE_TYPE; /* SAS target (SAS disk or expander) */
6616 connectionRate = onePortContext->LinkRate;
6617 dev_s_rate = (bit8)(dev_s_rate | (sasorsata << 4));
6618 dev_s_rate = (bit8)(dev_s_rate | connectionRate);
6619 DEVINFO_PUT_DEV_S_RATE(&oneDeviceData->agDeviceInfo, dev_s_rate);
6620
6621
6623 &oneDeviceData->agDeviceInfo,
6624 agSASSubID->sasAddressLo
6625 );
6627 &oneDeviceData->agDeviceInfo,
6628 agSASSubID->sasAddressHi
6629 );
6630
6631 oneDeviceData->agContext.osData = oneDeviceData;
6632 oneDeviceData->agContext.sdkData = agNULL;
6633
6634 if (flag == TD_OPERATION_INITIATOR)
6635 {
6636 if (oneDeviceData->registered == agFALSE )
6637 {
6638 if( tdsaAllShared->sflag )
6639 {
6640 if( ! DEVICE_IS_SMP_TARGET(oneDeviceData))
6641 {
6642 TI_DBG1(("tdssAddSASToSharedcontext: First, saRegisterNewDevice sflag %d\n", tdsaAllShared->sflag));
6643 oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | TD_XFER_RDY_PRIORTY_DEVICE_FLAG;
6644 }
6645 }
6646
6647 saRegisterNewDevice( /* tdssAddSASToSharedcontext */
6648 agRoot,
6649 &oneDeviceData->agContext,
6650 0,
6651 &oneDeviceData->agDeviceInfo,
6652 onePortContext->agPortContext,
6653 0
6654 );
6655 }
6656 }
6657 oneDeviceData->phyID = phyID;
6658 oneDeviceData->InQID = oneDeviceData->id % Indenom;
6659
6660#ifdef TARGET_DRIVER
6661 {
6662 bit32 localId = oneDeviceData->id;
6663 localId += 1;
6664 oneDeviceData->OutQID = localId % Outdenom;
6665 TI_DBG1(("tdssAddSASToSharedcontext: OutQID %d\n", oneDeviceData->OutQID)); /* tdsaRotateQnumber for tgt*/
6666
6667 }
6668#endif /* TARGET_DRIVER */
6669
6670 TI_DBG4(("tdssAddSASToSharedcontext: SSP target %d STP target %d SATA device %d\n", DEVICE_IS_SSP_TARGET(oneDeviceData), DEVICE_IS_STP_TARGET(oneDeviceData), DEVICE_IS_SATA_DEVICE(oneDeviceData)));
6671 /* add the devicedata to the portcontext */
6673 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
6675 TI_DBG4(("tdssAddSASToSharedContext: one case pid %d did %d \n", onePortContext->id, oneDeviceData->id));
6676 TI_DBG4(("tdssAddSASToSharedContext: new case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
6677
6678 }
6679 else /* old device */
6680 {
6681 TI_DBG3(("tdssAddSASToSharedcontext: old device\n"));
6682 TI_DBG3(("tdssAddSASToSharedcontext: oneDeviceData %p\n", oneDeviceData));
6683
6684 oneDeviceData->DeviceType = TD_SAS_DEVICE;
6685 oneDeviceData->agRoot = agRoot;
6686
6687 if (flag == TD_OPERATION_TARGET)
6688 {
6689 oneDeviceData->agDevHandle = agDevHandle;
6690 agDevHandle->osData = oneDeviceData; /* TD layer */
6691 }
6692
6693 /* saving sas address */
6694 oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
6695 oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
6696 oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
6697 oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
6698
6699
6700 oneDeviceData->tdPortContext = onePortContext;
6701 oneDeviceData->valid = agTRUE;
6702
6703 oneDeviceData->directlyAttached = agTRUE;
6704 /* new */
6705 if (oneDeviceData->registered == agFALSE)
6706 {
6707 TI_DBG1(("tdssAddSASToSharedcontext: registering\n"));
6708 /* parse sasIDframe to fill in agDeviceInfo */
6710 DEVINFO_PUT_ITNEXUSTO(&oneDeviceData->agDeviceInfo, (bit16)tdsaAllShared->itNexusTimeout);
6711 DEVINFO_PUT_FBS(&oneDeviceData->agDeviceInfo, 0);
6712 DEVINFO_PUT_FLAG(&oneDeviceData->agDeviceInfo, 1);
6713
6714 sasorsata = SAS_DEVICE_TYPE; /* SAS target (SAS disk or expander) */
6715 connectionRate = onePortContext->LinkRate;
6716 dev_s_rate = (bit8)(dev_s_rate | (sasorsata << 4));
6717 dev_s_rate = (bit8)(dev_s_rate | connectionRate);
6718 DEVINFO_PUT_DEV_S_RATE(&oneDeviceData->agDeviceInfo, dev_s_rate);
6719
6720
6722 &oneDeviceData->agDeviceInfo,
6723 agSASSubID->sasAddressLo
6724 );
6726 &oneDeviceData->agDeviceInfo,
6727 agSASSubID->sasAddressHi
6728 );
6729
6730 oneDeviceData->agContext.osData = oneDeviceData;
6731 oneDeviceData->agContext.sdkData = agNULL;
6732
6733 if (flag == TD_OPERATION_INITIATOR)
6734 {
6735 if( tdsaAllShared->sflag )
6736 {
6737 if( ! DEVICE_IS_SMP_TARGET(oneDeviceData))
6738 {
6739 TI_DBG1(("tdssAddSASToSharedcontext: Second, saRegisterNewDevice sflag %d\n", tdsaAllShared->sflag));
6740 oneDeviceData->agDeviceInfo.flag = oneDeviceData->agDeviceInfo.flag | TD_XFER_RDY_PRIORTY_DEVICE_FLAG;
6741 }
6742 }
6743 saRegisterNewDevice( /* tdssAddSASToSharedcontext */
6744 agRoot,
6745 &oneDeviceData->agContext,
6746 0,
6747 &oneDeviceData->agDeviceInfo,
6748 onePortContext->agPortContext,
6749 0
6750 );
6751 }
6752 }
6753
6754
6755
6756
6757
6758
6759 oneDeviceData->phyID = phyID;
6760 oneDeviceData->InQID = oneDeviceData->id % Indenom;
6761 oneDeviceData->OutQID = oneDeviceData->id % Outdenom;
6762
6763 TI_DBG1(("tdssAddSASToSharedcontext: A OutQID %d\n", oneDeviceData->OutQID));
6764 TI_DBG4(("tdssAddSASToSharedcontext: SSP target %d STP target %d SATA device %d\n", DEVICE_IS_SSP_TARGET(oneDeviceData), DEVICE_IS_STP_TARGET(oneDeviceData), DEVICE_IS_SATA_DEVICE(oneDeviceData)));
6765 TI_DBG4(("tdssAddSASToSharedContext: old case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
6766 }
6767
6768 return;
6769}
6770
6771
6772
6773
6774/*****************************************************************************
6775*! \brief tdssRemoveDevicedataFromSharedcontext
6776*
6777* Purpose: This function removes a discovered device from a device list of
6778* a port context
6779*
6780* \param tsddPortContext_Ins Pointer to the target port context
6781* \param tdsaDeviceData_Ins Pointer to the target device
6782* \param agRoot Pointer to the root data structure of
6783* TD and Lower layer
6784
6785*
6786* \Return: none
6787*
6788*****************************************************************************/
6789osGLOBAL void
6791 tdsaPortContext_t *tdsaPortContext_Ins,
6792 tdsaDeviceData_t *tdsaDeviceData_Ins,
6793 agsaRoot_t *agRoot
6794 )
6795{
6796 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6797 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6798 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6799 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6800 tdsaPortContext_t *onePortContext = agNULL;
6801 tdList_t *PortContextList;
6802 tdsaDeviceData_t *oneDeviceData = agNULL;
6803 tdList_t *DeviceListList;
6804 bit32 found = agTRUE;
6805
6806 TI_DBG3(("tdssRemoveSASFromSharedcontext: start\n"));
6807 /* find a right portcontext */
6808 PortContextList = tdsaAllShared->MainPortContextList.flink;
6809 while (PortContextList != &(tdsaAllShared->MainPortContextList))
6810 {
6811 onePortContext = TDLIST_OBJECT_BASE(tdsaPortContext_t, MainLink, PortContextList);
6812 if (onePortContext == agNULL)
6813 {
6814 TI_DBG1(("tdssRemoveDevicedataFromSharedcontext: onePortContext is NULL!!!\n"));
6815 return;
6816 }
6817 if (onePortContext == tdsaPortContext_Ins)
6818 {
6819 TI_DBG4(("tdssRemoveDevicedataFromSharedcontext: found; oneportContext ID %d\n", onePortContext->id));
6820 break;
6821 }
6822 PortContextList = PortContextList->flink;
6823 }
6824
6825 /* find a device's existence */
6826 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6827 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6828 {
6829 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6830 if (oneDeviceData == agNULL)
6831 {
6832 TI_DBG1(("tdssRemoveDevicedataFromSharedcontext: oneDeviceData is NULL!!!\n"));
6833 return;
6834 }
6835 if ((oneDeviceData->SASAddressID.sasAddressHi
6836 == SA_DEVINFO_GET_SAS_ADDRESSHI(&tdsaDeviceData_Ins->agDeviceInfo))
6837 &&
6838 (oneDeviceData->SASAddressID.sasAddressLo ==
6839 SA_DEVINFO_GET_SAS_ADDRESSLO(&tdsaDeviceData_Ins->agDeviceInfo)))
6840 {
6841 TI_DBG4(("tdssRemoveDevicedataFromSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
6842 found = agFALSE;
6843 break;
6844 }
6845 DeviceListList = DeviceListList->flink;
6846 }
6847
6848 if (found == agFALSE)
6849 {
6850 TI_DBG6(("tdssRemoveDevicedataFromSharedcontext: can't find the right devicedata in MainLink\n"));
6851 return;
6852 }
6853
6854 /* remove it and put it back to FreeLink of Devicedata */
6855 TI_DBG6(("tdssRemoveDevicedataFromSharedcontext: removing ... pid %d did %d\n", onePortContext->id, oneDeviceData->id));
6856
6857 /* invalidate the device but keep it on the list for persistency */
6858 oneDeviceData->valid = agFALSE;
6859
6860 return;
6861}
6862
6863/*****************************************************************************
6864*! \brief tdssRemoveAllDevicedataFromPortcontext
6865*
6866* Purpose: This function removes all discovered devices from a device list of
6867* a port context
6868*
6869* \param tdsaDeviceData Pointer to a device header
6870*
6871* \Return: none
6872*
6873*****************************************************************************/
6874osGLOBAL void
6876 tdsaPortContext_t *PortContext_Ins,
6877 agsaRoot_t *agRoot
6878 )
6879{
6880
6881 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6882 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6883 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6884 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6885 tdsaDeviceData_t *oneDeviceData = agNULL;
6886 tdList_t *DeviceListList;
6887
6888 TI_DBG6(("tdssRemoveAllDevicedataFromPortcontext: start\n"));
6889
6890 /*
6891 loop through device list and find the matching portcontext. Then invalidate the
6892 matching devices
6893 */
6894 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6895 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6896 {
6897 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6898 if (oneDeviceData == agNULL)
6899 {
6900 TI_DBG1(("tdssRemoveAllDevicelistFromPortcontext: oneDeviceData is NULL!!!\n"));
6901 return;
6902 }
6903 if (oneDeviceData->tdPortContext == PortContext_Ins)
6904 {
6905 TI_DBG4(("tdssRemoveAllDevicelistFromPortcontext: pid %d did %d\n", PortContext_Ins->id, oneDeviceData->id));
6906 PortContext_Ins->Count--;
6907 oneDeviceData->valid = agFALSE;
6908 }
6909 DeviceListList = DeviceListList->flink;
6910 }
6911
6912 return;
6913}
6914
6915
6916#ifdef INITIATOR_DRIVER
6917#ifdef TD_DISCOVER
6918/*****************************************************************************
6919*! \brief tdssNewAddSASToSharedcontext
6920*
6921* Purpose: This function adds a discovered SAS device to a device list of
6922* a shared context. Used only in discovery.
6923*
6924* \param agRoot Pointer to chip/driver Instance.
6925* \param onePortContext Pointer to the target port context
6926* \param agSASSubID Pointer to the SAS identification.
6927*
6928* \Return:
6929* Pointer to the device data
6930*
6931*****************************************************************************/
6933tdssNewAddSASToSharedcontext(
6934 agsaRoot_t *agRoot,
6935 tdsaPortContext_t *onePortContext,
6936 tdsaSASSubID_t *agSASSubID,
6937 tdsaDeviceData_t *oneExpDeviceData,
6938 bit8 phyID
6939 )
6940{
6941 tdsaDeviceData_t *oneDeviceData = agNULL;
6942 tdList_t *DeviceListList;
6943 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
6944 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
6945 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
6946 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
6947 bit32 new_device = agTRUE;
6948
6949 TI_DBG3(("tdssNewAddSASToSharedcontext: start\n"));
6950 /*
6951 find a right portcontext
6952 then, get devicedata from FreeLink in DeviceList
6953 then, do pointer operations
6954 then, add the devicedata to the portcontext
6955 */
6956
6957
6958 TI_DBG3(("tdssNewAddSASToSharedcontext: oneportContext ID %d\n", onePortContext->id));
6959 /* find a device's existence */
6960 DeviceListList = tdsaAllShared->MainDeviceList.flink;
6961 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
6962 {
6963 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
6964 if (oneDeviceData == agNULL)
6965 {
6966 TI_DBG1(("tdssNewAddSASToSharedcontext: oneDeviceData is NULL!!!\n"));
6967 return agNULL;
6968 }
6969 if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
6970 (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
6971 (oneDeviceData->tdPortContext == onePortContext)
6972 )
6973 {
6974 TI_DBG3(("tdssNewAddSASToSharedcontext: pid %d did %d\n", onePortContext->id, oneDeviceData->id));
6975 new_device = agFALSE;
6976 break;
6977 }
6978 DeviceListList = DeviceListList->flink;
6979 }
6980
6981 /* new device */
6982 if (new_device == agTRUE)
6983 {
6984 TI_DBG3(("tdssNewAddSASToSharedcontext: new device\n"));
6986 if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
6987 {
6989 TI_DBG1(("tdssNewAddSASToSharedcontext: empty DeviceData FreeLink\n"));
6990 return agNULL;
6991 }
6992
6993 TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
6995 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
6996
6997 TI_DBG3(("tdssNewAddSASToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
6998
6999 onePortContext->Count++;
7000 oneDeviceData->agRoot = agRoot;
7001 /* saving sas address */
7002 oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
7003 oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
7004 oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
7005 oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
7006 oneDeviceData->tdPortContext = onePortContext;
7007 /* handles both SAS target and STP-target, SATA-device */
7008 if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
7009 {
7010 oneDeviceData->DeviceType = TD_SAS_DEVICE;
7011 }
7012 else
7013 {
7014 oneDeviceData->DeviceType = TD_SATA_DEVICE;
7015 }
7016
7017 oneDeviceData->ExpDevice = oneExpDeviceData;
7018 /* set phyID only when it has initial value of 0xFF */
7019 if (oneDeviceData->phyID == 0xFF)
7020 {
7021 oneDeviceData->phyID = phyID;
7022 }
7023#ifdef FDS_DM
7024 oneDeviceData->valid = agTRUE;
7025#else
7026
7027 /* incremental discovery */
7028 /* add device to incremental-related link. Report using this link
7029 when incremental discovery is done */
7030 if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_INCREMENTAL_START)
7031 {
7032 TI_DBG3(("tdssNewAddSASToSharedcontext: incremental discovery\n"));
7033 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
7034 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
7035 oneDeviceData->valid2 = agTRUE;
7036 }
7037 else
7038 {
7039 TI_DBG3(("tdssNewAddSASToSharedcontext: full discovery\n"));
7040 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
7041 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
7042 oneDeviceData->valid = agTRUE;
7043 }
7044#endif
7045 /* add the devicedata to the portcontext */
7047 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
7049 TI_DBG4(("tdssNewAddSASToSharedcontext: one case pid %d did %d \n", onePortContext->id, oneDeviceData->id));
7050 TI_DBG4(("tdssNewAddSASToSharedcontext: new case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
7051 }
7052 else /* old device */
7053 {
7054 TI_DBG3(("tdssNewAddSASToSharedcontext: old device\n"));
7055 TI_DBG3(("tdssNewAddSASToSharedcontext: oneDeviceData %p did %d\n", oneDeviceData, oneDeviceData->id));
7056
7057 oneDeviceData->agRoot = agRoot;
7058 /* saving sas address */
7059 oneDeviceData->SASAddressID.sasAddressLo = agSASSubID->sasAddressLo;
7060 oneDeviceData->SASAddressID.sasAddressHi = agSASSubID->sasAddressHi;
7061 oneDeviceData->initiator_ssp_stp_smp = agSASSubID->initiator_ssp_stp_smp;
7062 oneDeviceData->target_ssp_stp_smp = agSASSubID->target_ssp_stp_smp;
7063 oneDeviceData->tdPortContext = onePortContext;
7064 /* handles both SAS target and STP-target, SATA-device */
7065 if (!DEVICE_IS_SATA_DEVICE(oneDeviceData) && !DEVICE_IS_STP_TARGET(oneDeviceData))
7066 {
7067 oneDeviceData->DeviceType = TD_SAS_DEVICE;
7068 }
7069 else
7070 {
7071 oneDeviceData->DeviceType = TD_SATA_DEVICE;
7072 }
7073
7074 oneDeviceData->ExpDevice = oneExpDeviceData;
7075 /* set phyID only when it has initial value of 0xFF */
7076 if (oneDeviceData->phyID == 0xFF)
7077 {
7078 oneDeviceData->phyID = phyID;
7079 }
7080
7081#ifdef FDS_DM
7082 oneDeviceData->valid = agTRUE;
7083#else
7084 if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_INCREMENTAL_START)
7085 {
7086 TI_DBG3(("tdssNewAddSASToSharedcontext: incremental discovery\n"));
7087 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
7088 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
7089 oneDeviceData->valid2 = agTRUE;
7090 }
7091 else
7092 {
7093 TI_DBG3(("tdssNewAddSASToSharedcontext: full discovery\n"));
7094 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrHi 0x%08x \n", oneDeviceData->SASAddressID.sasAddressHi));
7095 TI_DBG3(("tdssNewAddSASToSharedcontext: sasAddrLo 0x%08x \n", oneDeviceData->SASAddressID.sasAddressLo));
7096 oneDeviceData->valid = agTRUE;
7097 }
7098#endif
7099 TI_DBG4(("tdssNewAddSASToSharedcontext: old case pid %d did %d phyID %d\n", onePortContext->id, oneDeviceData->id, oneDeviceData->phyID));
7100
7101 }
7102 return oneDeviceData;
7103}
7104
7105/*****************************************************************************
7106*! \brief tdsaFindRegNValid
7107*
7108* Purpose: This function finds a device which is registered and valid in
7109* the device list. Used only in incremental discovery.
7110*
7111* \param agRoot Pointer to chip/driver Instance.
7112* \param onePortContext Pointer to the target port context
7113* \param tdsaDeviceData Pointer to a device list header
7114* \param agSASSubID Pointer to the SAS identification.
7115*
7116* \Return:
7117* Pointer to the device data
7118*
7119*****************************************************************************/
7121tdsaFindRegNValid(
7122 agsaRoot_t *agRoot,
7123 tdsaPortContext_t *onePortContext,
7124 tdsaSASSubID_t *agSASSubID
7125 )
7126{
7127 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
7128 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
7129 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7130 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7131 tdsaDeviceData_t *oneDeviceData = agNULL;
7132 tdList_t *DeviceListList;
7133 bit32 found = agFALSE;
7134
7135 TI_DBG3(("tdsaFindRegNValid: start\n"));
7136
7137 /* find a device's existence */
7138 DeviceListList = tdsaAllShared->MainDeviceList.flink;
7139 if (onePortContext->discovery.type == TDSA_DISCOVERY_OPTION_FULL_START)
7140 {
7141 TI_DBG3(("tdsaFindRegNValid: Full discovery\n"));
7142 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
7143 {
7144 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
7145 if (oneDeviceData == agNULL)
7146 {
7147 TI_DBG1(("tdsaFindRegNValid: oneDeviceData is NULL!!!\n"));
7148 return agNULL;
7149 }
7150 if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
7151 (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
7152 (oneDeviceData->registered == agTRUE) &&
7153 (oneDeviceData->valid == agTRUE) &&
7154 (oneDeviceData->tdPortContext == onePortContext)
7155 )
7156 {
7157 TI_DBG3(("tdsaFindRegNValid: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
7158 TI_DBG3(("tdsaFindRegNValid: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
7159 TI_DBG3(("tdsaFindRegNValid: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
7160 found = agTRUE;
7161 break;
7162 }
7163 DeviceListList = DeviceListList->flink;
7164 }
7165 }
7166 else
7167 {
7168 /* incremental discovery */
7169 TI_DBG3(("tdsaFindRegNValid: Incremental discovery\n"));
7170 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
7171 {
7172 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
7173 if (oneDeviceData == agNULL)
7174 {
7175 TI_DBG1(("tdsaFindRegNValid: oneDeviceData is NULL!!!\n"));
7176 return agNULL;
7177 }
7178 if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
7179 (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
7180 (oneDeviceData->registered == agTRUE) &&
7181 (oneDeviceData->valid2 == agTRUE) &&
7182 (oneDeviceData->tdPortContext == onePortContext)
7183 )
7184 {
7185 TI_DBG3(("tdsaFindRegNValid: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
7186 TI_DBG3(("tdsaFindRegNValid: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
7187 TI_DBG3(("tdsaFindRegNValid: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
7188 found = agTRUE;
7189 break;
7190 }
7191 DeviceListList = DeviceListList->flink;
7192 }
7193 }
7194
7195
7196
7197 if (found == agFALSE)
7198 {
7199 TI_DBG3(("tdsaFindRegNValid: end returning NULL\n"));
7200 return agNULL;
7201 }
7202 else
7203 {
7204 TI_DBG3(("tdsaFindRegNValid: end returning NOT NULL\n"));
7205 return oneDeviceData;
7206 }
7207
7208}
7209
7210//registered to LL or not
7211/*****************************************************************************
7212*! \brief tdssNewSASorNot
7213*
7214* Purpose: This function finds whether a device is registered or not
7215*
7216* \param agRoot Pointer to chip/driver Instance.
7217* \param onePortContext Pointer to the target port context
7218* \param agSASSubID Pointer to the SAS identification.
7219*
7220* \Return:
7221* agTRUE Device is not registered (New device).
7222* agFALSE Device is registered (Old device).
7223*
7224*****************************************************************************/
7225bit32
7226tdssNewSASorNot(
7227 agsaRoot_t *agRoot,
7228 tdsaPortContext_t *onePortContext,
7229 tdsaSASSubID_t *agSASSubID
7230 )
7231{
7232 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
7233 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
7234 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7235 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7236 tdsaDeviceData_t *oneDeviceData = agNULL;
7237 tdList_t *DeviceListList;
7238 bit32 ret = agTRUE;
7239
7240 TI_DBG3(("tdssNewSASorNot: start\n"));
7241
7242 /* find a device's existence */
7243 DeviceListList = tdsaAllShared->MainDeviceList.flink;
7244 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
7245 {
7246 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
7247 if ((oneDeviceData->SASAddressID.sasAddressHi == agSASSubID->sasAddressHi) &&
7248 (oneDeviceData->SASAddressID.sasAddressLo == agSASSubID->sasAddressLo) &&
7249 (oneDeviceData->registered == agTRUE) &&
7250 (oneDeviceData->tdPortContext == onePortContext)
7251 )
7252 {
7253 TI_DBG3(("tdssNewSASorNot: Found pid %d did %d\n", onePortContext->id, oneDeviceData->id));
7254 ret = agFALSE;
7255 break;
7256 }
7257 DeviceListList = DeviceListList->flink;
7258 }
7259
7260
7261
7262 TI_DBG3(("tdssNewSASorNot: end\n"));
7263
7264 return ret;
7265}
7266
7267
7268
7269/*****************************************************************************
7270*! \brief tdssSASDiscoveringExpanderAlloc
7271*
7272* Purpose: This function allocates an expander from the pre-allocated memory
7273* pool.
7274*
7275* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
7276* instance.
7277* \param onePortContext: Pointer to the portal context instance.
7278* \param oneDeviceData: Pointer to the device data.
7279*
7280* \return:
7281* Pointer to expander on success
7282* agNULL on failure
7283*
7284* \note:
7285*
7286*****************************************************************************/
7288tdssSASDiscoveringExpanderAlloc(
7290 tdsaPortContext_t *onePortContext,
7291 tdsaDeviceData_t *oneDeviceData
7292 )
7293{
7294 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7295 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7296 tdsaExpander_t *oneExpander = agNULL;
7297 tdList_t *ExpanderList;
7298
7299 /*
7300 move the expander from freeExpanderList
7301 and ground the expander by TDLIST_DEQUEUE_THIS
7302 */
7303
7304
7305 TI_DBG3(("tdssSASDiscoveringExpanderAlloc: start\n"));
7306 TI_DBG3(("tdssSASDiscoveringExpanderAlloc: did %d\n", oneDeviceData->id));
7307 TI_DBG3(("tdssSASDiscoveringExpanderAlloc: sasAddressHi 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi));
7308 TI_DBG3(("tdssSASDiscoveringExpanderAlloc: sasAddressLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressLo));
7309
7310 if (onePortContext->valid == agFALSE)
7311 {
7312 TI_DBG1(("tdssSASDiscoveringExpanderAlloc: aborting discovery\n"));
7313 tdsaSASDiscoverAbort(tiRoot, onePortContext);
7314 return agNULL;
7315 }
7316
7317 tdsaDumpAllFreeExp(tiRoot);
7318
7319 if (TDLIST_EMPTY(&(tdsaAllShared->freeExpanderList)))
7320 {
7321 TI_DBG1(("tdssSASDiscoveringExpanderAlloc: no free expanders\n"));
7322 return agNULL;
7323 }
7324
7326 TDLIST_DEQUEUE_FROM_HEAD(&ExpanderList, &(tdsaAllShared->freeExpanderList));
7328 // oneExpander = TDLIST_OBJECT_BASE(tdsaContext_t, freeExpanderList, ExpanderList);
7329 oneExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
7330
7331 if (oneExpander != agNULL)
7332 {
7333 TI_DBG3(("tdssSASDiscoveringExpanderAlloc: expander id %d\n", oneExpander->id));
7334
7336 TDLIST_DEQUEUE_THIS(&(oneExpander->linkNode));
7338
7339 oneExpander->tdDevice = oneDeviceData;
7340 oneExpander->tdUpStreamExpander = agNULL;
7341 oneExpander->tdCurrentDownStreamExpander = agNULL;
7342 oneExpander->tdReturnginExpander = agNULL;
7343 oneExpander->hasUpStreamDevice = agFALSE;
7344 oneExpander->numOfUpStreamPhys = 0;
7345 oneExpander->currentUpStreamPhyIndex = 0;
7346 oneExpander->discoveringPhyId = 0;
7347 oneExpander->underDiscovering = agFALSE;
7348 osti_memset( &(oneExpander->currentIndex), 0, sizeof(oneExpander->currentIndex));
7349
7350 oneDeviceData->tdExpander = oneExpander;
7351 }
7352
7353 return oneExpander;
7354}
7355
7356/*****************************************************************************
7357*! \brief tdssSASDiscoveringExpanderAdd
7358*
7359* Purpose: This function adds an expander to the expander list.
7360*
7361* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
7362* instance.
7363* \param onePortContext: Pointer to the portal context instance.
7364* \param oneExpander: Pointer to the expander data.
7365*
7366* \return:
7367* None
7368*
7369* \note:
7370*
7371*****************************************************************************/
7372osGLOBAL void
7373tdssSASDiscoveringExpanderAdd(
7375 tdsaPortContext_t *onePortContext,
7376 tdsaExpander_t *oneExpander
7377 )
7378{
7379#ifdef TD_INTERNAL_DEBUG
7380 tdList_t *ExpanderList;
7381 tdsaExpander_t *tempExpander;
7382#endif
7383
7384 /* move the expander to discoveringExpanderList */
7385
7386 TI_DBG3(("tdssSASDiscoveringExpanderAdd: start\n"));
7387 TI_DBG3(("tdssSASDiscoveringExpanderAdd: expander id %d\n", oneExpander->id));
7388 TI_DBG3(("tdssSASDiscoveringExpanderAdd: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
7389 TI_DBG3(("tdssSASDiscoveringExpanderAdd: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
7390
7391 if (onePortContext->valid == agFALSE)
7392 {
7393 TI_DBG1(("tdssSASDiscoveringExpanderAdd: aborting discovery\n"));
7394 tdsaSASDiscoverAbort(tiRoot, onePortContext);
7395 return;
7396 }
7397
7398
7399 if (onePortContext->discovery.status == DISCOVERY_UP_STREAM)
7400 {
7401 TI_DBG3(("tdssSASDiscoveringExpanderAdd: UPSTREAM\n"));
7402 }
7403 else if (onePortContext->discovery.status == DISCOVERY_DOWN_STREAM)
7404 {
7405 TI_DBG3(("tdssSASDiscoveringExpanderAdd: DOWNSTREAM\n"));
7406 }
7407 else
7408 {
7409 TI_DBG3(("tdssSASDiscoveringExpanderAdd: status %d\n", onePortContext->discovery.status));
7410 }
7411
7412 TI_DBG3(("tdssSASDiscoveringExpanderAdd: BEFORE\n"));
7413 tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
7414
7415
7416 if ( oneExpander->underDiscovering == agFALSE)
7417 {
7418 TI_DBG3(("tdssSASDiscoveringExpanderAdd: ADDED \n"));
7419
7420 oneExpander->underDiscovering = agTRUE;
7422 TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->linkNode), &(onePortContext->discovery.discoveringExpanderList));
7424 }
7425
7426 TI_DBG3(("tdssSASDiscoveringExpanderAdd: AFTER\n"));
7427 tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
7428
7429#ifdef TD_INTERNAL_DEBUG
7430 /* debugging */
7431 if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
7432 {
7433 TI_DBG3(("tdssSASDiscoveringExpanderAdd: empty discoveringExpanderList\n"));
7434 return;
7435 }
7436 ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
7437 while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
7438 {
7439 tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
7440 TI_DBG3(("tdssSASDiscoveringExpanderAdd: expander id %d\n", tempExpander->id));
7441 ExpanderList = ExpanderList->flink;
7442 }
7443#endif
7444
7445 return;
7446}
7447
7448/* temp */
7452 tdsaPortContext_t *onePortContext,
7453 tdsaExpander_t *oneExpander
7454 )
7455{
7456 tdList_t *ExpanderList;
7457 tdsaExpander_t *tempExpander;
7458 tdsaPortContext_t *tmpOnePortContext = onePortContext;
7459 bit32 ret = agFALSE;
7460
7461 TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
7462 TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
7463
7464 if (TDLIST_EMPTY(&(tmpOnePortContext->discovery.discoveringExpanderList)))
7465 {
7466 TI_DBG1(("tdssSASFindDiscoveringExpander: empty discoveringExpanderList\n"));
7467 return ret;
7468 }
7469 ExpanderList = tmpOnePortContext->discovery.discoveringExpanderList.flink;
7470 while (ExpanderList != &(tmpOnePortContext->discovery.discoveringExpanderList))
7471 {
7472 tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
7473 if (tempExpander == oneExpander)
7474 {
7475 TI_DBG3(("tdssSASFindDiscoveringExpander: match!!! expander id %d\n", tempExpander->id));
7476 TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrHi 0x%08x\n", tempExpander->tdDevice->SASAddressID.sasAddressHi));
7477 TI_DBG3(("tdssSASFindDiscoveringExpander: exp addrLo 0x%08x\n", tempExpander->tdDevice->SASAddressID.sasAddressLo));
7478 ret = agTRUE;
7479 break;
7480 }
7481
7482 ExpanderList = ExpanderList->flink;
7483 }
7484
7485
7486 return ret;
7487
7488}
7489/* to be tested */
7490/* move the expander to freeExpanderList */
7491/*****************************************************************************
7492*! \brief tdssSASDiscoveringExpanderRemove
7493*
7494* Purpose: This function removes an expander from the expander list.
7495*
7496* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
7497* instance.
7498* \param onePortContext: Pointer to the portal context instance.
7499* \param oneExpander: Pointer to the expander data.
7500*
7501* \return:
7502* None
7503*
7504* \note:
7505*
7506*****************************************************************************/
7507osGLOBAL void
7508tdssSASDiscoveringExpanderRemove(
7510 tdsaPortContext_t *onePortContext,
7511 tdsaExpander_t *oneExpander
7512 )
7513{
7514 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7515 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7516#ifdef TD_INTERNAL_DEBUG
7517 tdList_t *ExpanderList;
7518 tdsaExpander_t *tempExpander;
7519#endif
7520
7521 TI_DBG3(("tdssSASDiscoveringExpanderRemove: start\n"));
7522 TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", oneExpander->id));
7523 TI_DBG3(("tdssSASDiscoveringExpanderRemove: exp addrHi 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressHi));
7524 TI_DBG3(("tdssSASDiscoveringExpanderRemove: exp addrLo 0x%08x\n", oneExpander->tdDevice->SASAddressID.sasAddressLo));
7525
7526
7527 TI_DBG3(("tdssSASDiscoveringExpanderRemove: BEFORE\n"));
7528 tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
7529 tdsaDumpAllUpExp(tiRoot, onePortContext, oneExpander);
7530 tdsaDumpAllFreeExp(tiRoot);
7531
7532#ifdef TD_INTERNAL_DEBUG
7533 /* debugging */
7534 TI_DBG3(("tdssSASDiscoveringExpanderRemove: BEFORE\n"));
7535 if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
7536 {
7537 TI_DBG3(("tdssSASDiscoveringExpanderRemove: empty discoveringExpanderList\n"));
7538 }
7539 ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
7540 while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
7541 {
7542 tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
7543 TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", tempExpander->id));
7544 ExpanderList = ExpanderList->flink;
7545 }
7546#endif
7547
7548 // if is temporary till smp problem is fixed
7549 if (tdssSASFindDiscoveringExpander(tiRoot, onePortContext, oneExpander) == agTRUE)
7550 {
7551 oneExpander->underDiscovering = agFALSE;
7552 oneExpander->discoveringPhyId = 0;
7554 TDLIST_DEQUEUE_THIS(&(oneExpander->linkNode));
7555
7556 if (onePortContext->discovery.status == DISCOVERY_UP_STREAM)
7557 {
7558 TI_DBG3(("tdssSASDiscoveringExpanderRemove: DISCOVERY_UP_STREAM\n"));
7559 TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->upNode), &(onePortContext->discovery.UpdiscoveringExpanderList));
7560 onePortContext->discovery.NumOfUpExp++;
7561 }
7562 else
7563 {
7564 TI_DBG3(("tdssSASDiscoveringExpanderRemove: Status %d\n", onePortContext->discovery.status));
7565 TDLIST_ENQUEUE_AT_TAIL(&(oneExpander->linkNode), &(tdsaAllShared->freeExpanderList));
7566 }
7567
7569 } //end temp if
7570 else
7571 {
7572 TI_DBG1(("tdssSASDiscoveringExpanderRemove: !!! problem !!!\n"));
7573 }
7574
7575 TI_DBG3(("tdssSASDiscoveringExpanderRemove: AFTER\n"));
7576 tdsaDumpAllExp(tiRoot, onePortContext, oneExpander);
7577 tdsaDumpAllUpExp(tiRoot, onePortContext, oneExpander);
7578
7579 tdsaDumpAllFreeExp(tiRoot);
7580
7581#ifdef TD_INTERNAL_DEBUG
7582 /* debugging */
7583 TI_DBG3(("tdssSASDiscoveringExpanderRemove: AFTER\n"));
7584 if (TDLIST_EMPTY(&(onePortContext->discovery.discoveringExpanderList)))
7585 {
7586 TI_DBG3(("tdssSASDiscoveringExpanderRemove: empty discoveringExpanderList\n"));
7587 }
7588 ExpanderList = onePortContext->discovery.discoveringExpanderList.flink;
7589 while (ExpanderList != &(onePortContext->discovery.discoveringExpanderList))
7590 {
7591 tempExpander = TDLIST_OBJECT_BASE(tdsaExpander_t, linkNode, ExpanderList);
7592 TI_DBG3(("tdssSASDiscoveringExpanderRemove: expander id %d\n", tempExpander->id));
7593 ExpanderList = ExpanderList->flink;
7594 }
7595#endif
7596
7597 return;
7598}
7599
7600#ifdef SATA_ENABLE
7601
7602/*****************************************************************************
7603*! \brief tdssNewAddSATAToSharedcontext
7604*
7605* Purpose: This function adds a discovered SATA device to a device list of
7606* a shared context. Used only in discovery.
7607*
7608* \param tiRoot Pointer to the OS Specific module allocated tiRoot_t
7609* instance.
7610* \param agRoot Pointer to chip/driver Instance.
7611* \param onePortContext Pointer to the target port context
7612* \param tdsaDeviceData Pointer to a device list header
7613* \param agSATADeviceInfo Pointer to the SATA device information.
7614* \param Signature Pointer to SATA signature
7615* \param pm Port multiplier
7616* \param pmField Port multiplier field
7617* \param connectionRate Connection rate
7618*
7619* \Return:
7620* Pointer to the device data
7621*
7622*****************************************************************************/
7624tdssNewAddSATAToSharedcontext(tiRoot_t *tiRoot,
7625 agsaRoot_t *agRoot,
7626 tdsaPortContext_t *onePortContext,
7627 agsaSATADeviceInfo_t *agSATADeviceInfo,
7628 bit8 *Signature,
7629 bit8 pm,
7630 bit8 pmField,
7631 bit32 connectionRate,
7632 tdsaDeviceData_t *oneExpDeviceData,
7633 bit8 phyID
7634 )
7635{
7636 tdsaDeviceData_t *oneDeviceData = agNULL;
7637 tdList_t *DeviceListList;
7638 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7639 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7640 int new_device = agTRUE;
7641
7642 TI_DBG5(("tdssNewAddSATAToSharedcontext: start\n"));
7643
7644
7645
7646 TI_DBG5(("tdssNewAddSATAToSharedcontext: oneportContext ID %d\n", onePortContext->id));
7647
7648
7649#ifdef RPM_SOC
7650 /* Find a device's existence */
7651 DeviceListList = tdsaAllShared->MainDeviceList.flink;
7652 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
7653 {
7654 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
7655
7656 if ((osti_memcmp (((char *)&oneDeviceData->satDevData.satIdentifyData),
7657 ((char *)&agSATADeviceInfo->sataIdentifyData),
7658 sizeof(agsaSATAIdentifyData_t)) == 0))
7659 {
7660 TI_DBG5(("tdssNewAddSATAToSharedcontext: pid %d did %d\n",
7661 onePortContext->id, oneDeviceData->id));
7662 new_device = agFALSE;
7663 break;
7664 }
7665 DeviceListList = DeviceListList->flink;
7666 }
7667#else
7668
7669
7670#endif
7671
7672 /* New device */
7673 if (new_device == agTRUE)
7674 {
7675 TI_DBG5(("tdssNewAddSATAToSharedcontext: new device\n"));
7676
7678 if (!TDLIST_NOT_EMPTY(&(tdsaAllShared->FreeDeviceList)))
7679 {
7681 TI_DBG1(("tdssNewAddSATAToSharedcontext: ERROR empty DeviceData FreeLink\n"));
7682 return oneDeviceData;
7683 }
7684
7685 TDLIST_DEQUEUE_FROM_HEAD(&DeviceListList, &(tdsaAllShared->FreeDeviceList));
7687 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, FreeLink, DeviceListList);
7688
7689 onePortContext->Count++;
7690 oneDeviceData->DeviceType = TD_SATA_DEVICE;
7691 oneDeviceData->agRoot = agRoot;
7692 TI_DBG5(("tdssNewAddSATAToSharedcontext: oneDeviceData %p\n", oneDeviceData));
7693 TI_DBG5(("tdssNewAddSATAToSharedcontext: pSatDevData=%p\n", &oneDeviceData->satDevData));
7694
7695
7696 /* saving PortMultiplier(PM) field */
7697 oneDeviceData->satDevData.satPMField = pmField;
7698
7699 /* saving signature */
7700 osti_memcpy(&(oneDeviceData->satDevData.satSignature), Signature, 8);
7701
7702 /*
7703 saving device type
7704 ATA device type; here should be either ATA_ATA_DEVICE or ATA_ATAPI_DEVICE
7705 */
7706 oneDeviceData->satDevData.satDeviceType = tdssSATADeviceTypeDecode(agSATADeviceInfo->signature);
7707 TI_DBG3(("tdssNewAddSATAToSharedcontext: device type %d\n", oneDeviceData->satDevData.satDeviceType));
7708
7709#ifdef RPM_SOC_REMOVED
7710 /* print device signature - Word8 */
7711 TI_DBG3(("tdssNewAddSATAToSharedcontext: Word8 %x signature: %x %x %x %x %x %x %x %x\n",
7712 agSATADeviceInfo->sataIdentifyData.word1_9[7],
7713 agSATADeviceInfo->signature[0], agSATADeviceInfo->signature[1],
7714 agSATADeviceInfo->signature[2], agSATADeviceInfo->signature[3],
7715 agSATADeviceInfo->signature[4], agSATADeviceInfo->signature[5],
7716 agSATADeviceInfo->signature[6], agSATADeviceInfo->signature[7] ));
7717#endif
7718
7719
7720
7721 oneDeviceData->tdPortContext = onePortContext;
7722 oneDeviceData->valid = agTRUE;
7723
7724 oneDeviceData->ExpDevice = oneExpDeviceData;
7725 oneDeviceData->phyID = phyID;
7726
7727 /* Add the devicedata to the portcontext */
7729 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->MainLink), &(tdsaAllShared->MainDeviceList));
7731 TI_DBG5(("tdssNewAddSATAToSharedcontext: one case pid %d did %d \n",
7732 onePortContext->id, oneDeviceData->id));
7733 }
7734 else /* old device */
7735 {
7736 TI_DBG5(("tdssNewAddSATAToSharedcontext: old device\n"));
7737
7738 onePortContext->Count++;
7739
7740 oneDeviceData->DeviceType = TD_SATA_DEVICE;
7741 oneDeviceData->agRoot = agRoot;
7742
7743 oneDeviceData->tdPortContext = onePortContext;
7744 oneDeviceData->valid = agTRUE;
7745
7746 oneDeviceData->ExpDevice = oneExpDeviceData;
7747 oneDeviceData->phyID = phyID;
7748
7749 }
7750
7751 return oneDeviceData;
7752
7753}
7754#endif /* SATA_ENABLE */
7755#endif /* TD_DISCOVER */
7756#endif /* INITIATOR_DRIVER */
7757
7758#ifdef TARGET_DRIVER
7759/*****************************************************************************
7760*! \brief tdssReportRemovals
7761*
7762* Purpose: This function goes through device list and removes all devices
7763* belong to the portcontext. This function also deregiters those
7764* devices. This function is called in case of incremental discovery
7765* failure.
7766*
7767* \param agRoot : Pointer to chip/driver Instance.
7768* \param onePortContext: Pointer to the portal context instance.
7769* \param oneDeviceData: Pointer to the device data.
7770*
7771* \return:
7772* None
7773*
7774* \note:
7775*
7776*****************************************************************************/
7777osGLOBAL void
7778ttdssReportRemovals(
7779 agsaRoot_t *agRoot,
7780 tdsaPortContext_t *onePortContext,
7781 bit32 flag
7782 )
7783{
7784 tdsaDeviceData_t *oneDeviceData = agNULL;
7785 tdList_t *DeviceListList;
7786 tdsaRootOsData_t *osData = (tdsaRootOsData_t *)agRoot->osData;
7787 tiRoot_t *tiRoot = (tiRoot_t *)osData->tiRoot;
7788 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7789 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7790 bit32 removed = agFALSE;
7791 agsaEventSource_t *eventSource;
7792 bit32 PhyID;
7793 bit32 HwAckSatus;
7794 tdsaDeviceData_t *tmpDeviceData = agNULL;
7795
7796 TI_DBG1(("ttdssReportRemovals: start\n"));
7797 /* in case nothing was registered */
7798 PhyID = onePortContext->eventPhyID;
7799 if (tdsaAllShared->eventSource[PhyID].EventValid == agTRUE &&
7800 onePortContext->RegisteredDevNums == 0 &&
7801 PhyID != 0xFF
7802 )
7803 {
7804 TI_DBG1(("ttdssReportRemovals: calling saHwEventAck\n"));
7805 eventSource = &(tdsaAllShared->eventSource[PhyID].Source);
7806 HwAckSatus = saHwEventAck(
7807 agRoot,
7808 agNULL, /* agContext */
7809 0,
7810 eventSource, /* agsaEventSource_t */
7811 0,
7812 0
7813 );
7814 if ( HwAckSatus != AGSA_RC_SUCCESS)
7815 {
7816 TI_DBG1(("ttdssReportRemovals: failing in saHwEventAck; status %d\n", HwAckSatus));
7817 }
7818
7819 /* toggle */
7820 tdsaAllShared->eventSource[PhyID].EventValid = agFALSE;
7821 if (onePortContext->valid == agFALSE)
7822 {
7823 tdsaPortContextReInit(tiRoot, onePortContext);
7824 /*
7825 put all devices belonging to the onePortContext
7826 back to the free link
7827 */
7829 TDLIST_DEQUEUE_THIS(&(onePortContext->MainLink));
7830 TDLIST_ENQUEUE_AT_TAIL(&(onePortContext->FreeLink), &(tdsaAllShared->FreePortContextList));
7832 }
7833 }
7834 else
7835 {
7836 if (TDLIST_EMPTY(&(tdsaAllShared->MainDeviceList)))
7837 {
7838 TI_DBG1(("ttdssReportRemovals: empty device list\n"));
7839 return;
7840 }
7841
7842 DeviceListList = tdsaAllShared->MainDeviceList.flink;
7843 while (DeviceListList != &(tdsaAllShared->MainDeviceList))
7844 {
7845 oneDeviceData = TDLIST_OBJECT_BASE(tdsaDeviceData_t, MainLink, DeviceListList);
7846 if( oneDeviceData == agNULL )
7847 {
7848 break;
7849 }
7850 TI_DBG1(("ttdssReportRemovals: loop did %d\n", oneDeviceData->id));
7851 TI_DBG1(("ttdssReportRemovals: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
7852 TI_DBG1(("ttdssReportRemovals: valid %d valid2 %d\n", oneDeviceData->valid, oneDeviceData->valid2));
7853 TI_DBG1(("ttdssReportRemovals: directlyAttached %d registered %d\n", oneDeviceData->directlyAttached, oneDeviceData->registered));
7854 if ( oneDeviceData->tdPortContext == onePortContext)
7855 {
7856 TI_DBG1(("ttdssReportRemovals: right portcontext pid %d\n", onePortContext->id));
7857 if (oneDeviceData->valid == agTRUE && oneDeviceData->registered == agTRUE)
7858 {
7859 TI_DBG1(("ttdssReportRemovals: removing\n"));
7860
7861 /* notify only reported devices to OS layer*/
7862 removed = agTRUE;
7863
7864 /* all targets except expanders */
7865 TI_DBG1(("ttdssReportRemovals: calling tdsaAbortAll\n"));
7866 TI_DBG1(("ttdssReportRemovals: did %d\n", oneDeviceData->id));
7867 TI_DBG1(("ttdssReportRemovals: sasAddrHi 0x%08x sasAddrLo 0x%08x\n", oneDeviceData->SASAddressID.sasAddressHi, oneDeviceData->SASAddressID.sasAddressLo));
7868 tmpDeviceData = oneDeviceData;
7869 ttdsaAbortAll(tiRoot, agRoot, oneDeviceData);
7870
7871
7872 /* reset valid bit */
7873 oneDeviceData->valid = agFALSE;
7874 oneDeviceData->valid2 = agFALSE;
7875 oneDeviceData->registered = agFALSE;
7876 }
7877 /* called by port invalid case */
7878 if (flag == agTRUE)
7879 {
7880 oneDeviceData->tdPortContext = agNULL;
7881 }
7882#ifdef REMOVED /* removed */
7883 /* directly attached SATA -> always remove it */
7884 if (oneDeviceData->DeviceType == TD_SATA_DEVICE &&
7885 oneDeviceData->directlyAttached == agTRUE)
7886 {
7887 TI_DBG1(("ttdssReportRemovals: device did %d\n", oneDeviceData->id));
7889 TDLIST_DEQUEUE_THIS(&(oneDeviceData->MainLink));
7890 TDLIST_ENQUEUE_AT_TAIL(&(oneDeviceData->FreeLink), &(tdsaAllShared->FreeDeviceLis));
7891 DeviceListList = tdsaAllShared->MainDeviceList.flink;
7892 if (TDLIST_EMPTY(&(tdsaAllShared->MainDeviceList)))
7893 {
7895 break;
7896 }
7897 else
7898 {
7900 }
7901 }
7902 else
7903 {
7904 DeviceListList = DeviceListList->flink;
7905 }
7906#endif /* REMOVED */
7907 DeviceListList = DeviceListList->flink;
7908 }
7909 else
7910 {
7911 if (oneDeviceData->tdPortContext != agNULL)
7912 {
7913 TI_DBG1(("ttdssReportRemovals: different portcontext; oneDeviceData->tdPortContext pid %d oneportcontext pid %d\n", oneDeviceData->tdPortContext->id, onePortContext->id));
7914 }
7915 else
7916 {
7917 TI_DBG1(("ttdssReportRemovals: different portcontext; oneDeviceData->tdPortContext pid NULL oneportcontext pid %d\n", onePortContext->id));
7918 }
7919 DeviceListList = DeviceListList->flink;
7920 }
7921 }
7922
7923 if (removed == agTRUE)
7924 {
7925 TI_DBG1(("ttdssReportRemovals: removed at the end\n"));
7927 tiRoot,
7928 onePortContext->tiPortalContext,
7929 &(tmpDeviceData->tiDeviceHandle),
7932 agNULL
7933 );
7934 }
7935 } /* big else */
7936 return;
7937}
7938#endif /* TARGET_DRIVER */
7939
7940
7941/*****************************************************************************
7942*! \brief tdsaRotateQnumber
7943*
7944* Purpose: This function generates inbound queue number.
7945*
7946* \param tiRoot: Pointer to the OS Specific module allocated tiRoot_t
7947* instance.
7948*
7949* \return:
7950* Queue number
7951*
7952* \note:
7953*
7954*****************************************************************************/
7957 tdsaDeviceData_t *oneDeviceData )
7958{
7959 bit32 ret = 0;
7960
7961 TI_DBG6(("tdsaRotateQnumber: start\n"));
7962 if (oneDeviceData == agNULL)
7963 {
7964 return 0;
7965 }
7966 ret = (oneDeviceData->OutQID << 16) | oneDeviceData->InQID;
7967 return ret;
7968}
7969
7972 tdsaDeviceData_t *oneDeviceData )
7973{
7974 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7975 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7976// static int Last_Q;
7977// bit32 denom = tdsaAllShared->QueueConfig.numOutboundQueues;
7978 bit32 ret = 0;
7979 if (oneDeviceData == agNULL)
7980 {
7981// Last_Q= 0;
7982 return 0;
7983 }
7984
7985/* alway use highest Q number */
7986 ret = ((tdsaAllShared->QueueConfig.numOutboundQueues-1) << 16) | (tdsaAllShared->QueueConfig.numInboundQueues-1);
7987
7988 return(ret);
7989}
7990
7991#ifdef REMOVED
7994 tdsaDeviceData_t *oneDeviceData )
7995{
7996 tdsaRoot_t *tdsaRoot = (tdsaRoot_t *) tiRoot->tdData;
7997 tdsaContext_t *tdsaAllShared = (tdsaContext_t *)&tdsaRoot->tdsaAllShared;
7998 bit32 denom = tdsaAllShared->QueueConfig.numInboundQueues;
7999 bit32 ret = 0;
8000
8001 /* inbound queue number */
8002 tdsaAllShared->IBQnumber++;
8003 if (tdsaAllShared->IBQnumber % denom == 0) /* % Qnumber*/
8004 {
8005 tdsaAllShared->IBQnumber = 0;
8006 }
8007 TI_DBG6(("tdsaRotateQnumber: IBQnumber %d\n", tdsaAllShared->IBQnumber));
8008
8009
8010 /* outbound queue number */
8011 tdsaAllShared->OBQnumber++;
8012 denom = tdsaAllShared->QueueConfig.numOutboundQueues;
8013 if (tdsaAllShared->OBQnumber % denom == 0) /* % Qnumber*/
8014 {
8015 tdsaAllShared->OBQnumber = 0;
8016 }
8017 TI_DBG6(("tdsaRotateQnumber: OBQnumber %d\n", tdsaAllShared->OBQnumber));
8018
8019 ret = (tdsaAllShared->OBQnumber << 16) | tdsaAllShared->IBQnumber;
8020 return ret;
8021}
8022#endif
8023
8024
8026{
8027 TI_DBG1(("t_MacroCheck:tIsSPC %d\n",tIsSPC(agRoot)));
8028 TI_DBG1(("t_MacroCheck:tIsSPCHIL %d\n",tIsSPCHIL(agRoot)));
8029 TI_DBG1(("t_MacroCheck:tIsSPCv %d\n",tIsSPCv(agRoot)));
8030 TI_DBG1(("t_MacroCheck:tIsSPCve %d\n",tIsSPCve(agRoot)));
8031 TI_DBG1(("t_MacroCheck:tIsSPCvplus %d\n",tIsSPCvplus(agRoot)));
8032 TI_DBG1(("t_MacroCheck:tIsSPCveplus %d\n",tIsSPCveplus(agRoot)));
8033 TI_DBG1(("t_MacroCheck:tIsSPCADAPvplus %d\n",tIsSPCADAPvplus(agRoot)));
8034 TI_DBG1(("t_MacroCheck:tIsSPCADAPveplus %d\n",tIsSPCADAPveplus(agRoot)));
8035 TI_DBG1(("t_MacroCheck:tIsSPC12Gv %d\n",tIsSPC12Gv(agRoot)));
8036 TI_DBG1(("t_MacroCheck:tIsSPC12Gve %d\n",tIsSPC12Gve(agRoot)));
8037 TI_DBG1(("t_MacroCheck:tIsSPC12Gvplus %d\n",tIsSPC12Gvplus(agRoot)));
8038 TI_DBG1(("t_MacroCheck:tIsSPC12Gveplus %d\n",tIsSPC12Gveplus(agRoot)));
8039 TI_DBG1(("t_MacroCheck:tiIS_SPC %d\n",tiIS_SPC(agRoot) ));
8040 TI_DBG1(("t_MacroCheck:tiIS_HIL %d\n",tiIS_HIL(agRoot) ));
8041 TI_DBG1(("t_MacroCheck:tiIS_SPC6V %d\n",tiIS_SPC6V(agRoot) ));
8042 TI_DBG1(("t_MacroCheck:tiIS_SPC_ENC %d\n",tiIS_SPC_ENC(agRoot) ));
8043 TI_DBG1(("t_MacroCheck:tIsSPCV12G %d\n",tIsSPCV12G(agRoot) ));
8044}
const unsigned char spcv_aap1array[]
Definition: aap18008.h:42
const unsigned char aap1array[]
Definition: aap1img.h:42
#define DM_RC_FAILURE
Definition: dm.h:49
#define DM_RC_VERSION_INCOMPATIBLE
Definition: dm.h:51
osGLOBAL bit32 dmInitialize(dmRoot_t *dmRoot, agsaRoot_t *agRoot, dmMemoryRequirement_t *memoryAllocated, dmSwConfig_t *swConfig, bit32 usecsPerTick)
osGLOBAL void dmGetRequirements(dmRoot_t *dmRoot, dmSwConfig_t *swConfig, dmMemoryRequirement_t *memoryRequirement, bit32 *usecsPerTick, bit32 *maxNumLocks)
osGLOBAL bit32 dmDestroyPort(dmRoot_t *dmRoot, dmPortContext_t *dmPortContext, dmPortInfo_t *dmPortInfo)
#define DEVICE_IS_SATA_DEVICE(DeviceData)
Definition: dmdefs.h:1172
#define DISCOVERY_UP_STREAM
Definition: dmdefs.h:144
#define DEVINFO_PUT_FLAG(devInfo, tlr)
Definition: dmdefs.h:1209
#define DEVICE_IS_STP_TARGET(DeviceData)
Definition: dmdefs.h:1166
#define DEVINFO_PUT_SAS_ADDRESSLO(devInfo, src32)
Definition: dmdefs.h:1216
#define DEVINFO_PUT_SMPTO(devInfo, smpto)
Definition: dmdefs.h:1200
#define DEVINFO_PUT_FBS(devInfo, fbs)
Definition: dmdefs.h:1206
#define DEVICE_IS_SMP_TARGET(DeviceData)
Definition: dmdefs.h:1169
#define DEVINFO_PUT_ITNEXUSTO(devInfo, itnexusto)
Definition: dmdefs.h:1203
#define DISCOVERY_DOWN_STREAM
Definition: dmdefs.h:145
#define DEFAULT_SMP_TIMEOUT
Definition: dmdefs.h:72
#define DEVINFO_PUT_DEV_S_RATE(devInfo, dev_s_rate)
Definition: dmdefs.h:1212
#define IT_NEXUS_TIMEOUT
Definition: dmdefs.h:1125
#define DEVINFO_PUT_SAS_ADDRESSHI(devInfo, src32)
Definition: dmdefs.h:1219
#define DEFAULT_KEY_BUFFER_SIZE
Definition: dmdefs.h:60
#define SMP_REQUEST
Definition: dmdefs.h:1064
#define DEVICE_IS_SSP_TARGET(DeviceData)
Definition: dmdefs.h:1163
#define SAS_DEVICE_TYPE
Definition: dmdefs.h:1095
bit32 index
Definition: encrypt_ioctl.h:0
bit32 Signature
Definition: encrypt_ioctl.h:0
bit32 dekBlobFormat
Definition: encrypt_ioctl.h:3
bit32 dekTableKeyEntrySize
Definition: encrypt_ioctl.h:4
bit32 wrapperKekIndex
Definition: encrypt_ioctl.h:1
bit32 dekTable
Definition: encrypt_ioctl.h:1
bit32 kekIndex
Definition: encrypt_ioctl.h:0
bit32 dekIndex
Definition: encrypt_ioctl.h:2
bit32 blobFormat
Definition: encrypt_ioctl.h:2
bit32 securityCipherMode
Definition: encrypt_ioctl.h:0
bit32 status
Definition: encrypt_ioctl.h:12
const unsigned char spcv_ilaarray[]
Definition: ila8008.h:44
const unsigned char spcv12g_ilaarray[]
Definition: ila8070.h:36
const unsigned char ilaarray[]
Definition: ilaimg.h:45
const unsigned char spcv_ioparray[]
Definition: iop8008.h:45
const unsigned char spcv12g_ioparray[]
Definition: iop8070.h:36
const unsigned char ioparray[]
Definition: iopimg.h:44
const unsigned char istrarray[]
Definition: istrimg.h:44
#define ITD_DSTATE_NOT_STARTED
Definition: itddefs.h:37
U32 ostiGetTransportParam(tiRoot_t *ptiRoot, S08 *key, S08 *subkey1, S08 *subkey2, S08 *subkey3, S08 *subkey4, S08 *subkey5, S08 *valueName, S08 *buffer, U32 bufferLen, U32 *lenReceived)
Definition: lxosapi.c:464
void ostiPortEvent(tiRoot_t *ptiRoot, tiPortEvent_t eventType, U32 status, void *pParm)
Definition: lxosapi.c:591
void ostiInitiatorEvent(tiRoot_t *ptiRoot, tiPortalContext_t *ptiPortalContext, tiDeviceHandle_t *ptiDevHandle, tiIntrEventType_t eventType, U32 eventStatus, void *parm)
Definition: osapi.c:49
osGLOBAL void ossaDeregisterDeviceHandleCB(agsaRoot_t *agRoot, agsaContext_t *agContext, agsaDevHandle_t *agDevHandle, bit32 status)
ossaDeregisterDeviceHandleCB
Definition: ossacmnapi.c:6448
osGLOBAL void ossaDeviceRegistrationCB(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 status, agsaDevHandle_t *agDevHandle, bit32 deviceID)
ossaDeviceRegistrationCB
Definition: ossacmnapi.c:6021
#define osti_strncmp(s1, s2, n)
Definition: osstring.h:71
#define osti_strtoul(nptr, endptr, base)
Definition: osstring.h:75
#define osti_memset(s, c, n)
Definition: osstring.h:65
#define osti_memcpy(des, src, n)
Definition: osstring.h:64
#define osti_memcmp(s1, s2, n)
Definition: osstring.h:63
osGLOBAL FORCEINLINE void ostidisableEncryption(tiRoot_t *root)
osGLOBAL bit32 ostiTargetEvent(tiRoot_t *tiRoot, tiPortalContext_t *portalContext, tiDeviceHandle_t *tiDeviceHandle, tiTgtEventType_t eventType, bit32 eventStatus, void *parm)
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 FORCEINLINE
Definition: ostypes.h:86
#define agTRUE
Definition: ostypes.h:149
unsigned int U32
Definition: ostypes.h:124
unsigned char bit8
Definition: ostypes.h:97
const unsigned char spcv12g_raaearray[]
Definition: raae8070.h:36
The file defines the constants, data structure, and functions defined by LL API.
#define AGSA_SGPIO_CONFIG_REG
Definition: sa.h:1593
#define AGSA_RC_VERSION_INCOMPATIBLE
Definition: sa.h:787
#define AGSA_RC_BUSY
Definition: sa.h:782
#define AGSA_CACHED_DMA_MEM
Definition: sa.h:797
#define AGSA_SAS_PHY_BW_COUNTERS_PAGE
Definition: sa.h:845
#define OSSA_EVENT_SOURCE_DEVICE_HANDLE_ADDED
Definition: sa.h:1399
#define AGSA_CACHED_MEM
Definition: sa.h:795
#define AGSA_WRITE_SGPIO_REGISTER
Definition: sa.h:1591
#define AGSA_MAX_OUTBOUND_Q
Definition: sa.h:828
#define AGSA_PHY_CLEAR_ERROR_COUNTS
Definition: sa.h:837
#define AGSA_SAS_PHY_ANALOG_SETTINGS_PAGE
Definition: sa.h:846
#define AGSA_SAS_PHY_GENERAL_STATUS_PAGE
Definition: sa.h:847
struct agsaMPIContext_s agsaMPIContext_t
data structure for set fields in MPI table. The agsaMPIContext_t data structure is used to set fields...
#define AGSA_MAX_INBOUND_Q
Definition: sa.h:827
#define AGSA_ENCRYPT_STORE_NVRAM
Definition: sa.h:1579
#define OSSA_EVENT_SOURCE_DEVICE_HANDLE_REMOVED
Definition: sa.h:1400
#define AGSA_DMA_MEM
Definition: sa.h:796
#define agsaEncryptSMB
Definition: sa.h:1526
#define agsaEncryptCipherModeXTS
Definition: sa.h:1542
#define agsaEncryptSMF
Definition: sa.h:1524
#define AG_SA_DISCOVERY_OPTION_FULL_START
Definition: sa.h:868
#define OSSA_SGPIO_MAX_READ_DATA_COUNT
Definition: sa.h:1617
#define agsaEncryptSMA
Definition: sa.h:1525
#define AGSA_PHY_GET_BW_COUNTS
Definition: sa.h:838
#define AGSA_SAS_PHY_ERR_COUNTERS_PAGE
Definition: sa.h:843
#define AGSA_SGPIO_DRIVE_BY_DRIVE_TRANSMIT_REG
Definition: sa.h:1596
#define SA_DEVINFO_GET_SAS_ADDRESSLO(devInfo)
Definition: sa.h:2627
#define AGSA_RC_NOT_SUPPORTED
Definition: sa.h:789
#define AGSA_RC_FAILURE
Definition: sa.h:781
#define SA_DEVINFO_GET_SAS_ADDRESSHI(devInfo)
Definition: sa.h:2630
struct agsaSGpioReqResponse_s agsaSGpioReqResponse_t
describe a serial GPIO request and response in the SAS/SATA hardware
#define MAX_INDEX
Definition: sa.h:1763
#define AGSA_SAS_PHY_ERR_COUNTERS_CLR_PAGE
Definition: sa.h:844
#define AGSA_SAS_PROTOCOL_TIMER_CONFIG_PAGE
Definition: sa.h:3152
#define AGSA_PHY_GET_ERROR_COUNTS
Definition: sa.h:836
#define AGSA_NUM_MEM_CHUNKS
Definition: sa.h:809
#define AGSA_RC_SUCCESS
Definition: sa.h:780
#define AGSA_DEV_TYPE_END_DEVICE
Definition: sa_spec.h:63
#define SA_IDFRM_SSP_BIT
Definition: sa_spec.h:497
#define SA_IDFRM_GET_SAS_ADDRESSLO(identFrame)
Definition: sa_spec.h:482
#define SA_IDFRM_STP_BIT
Definition: sa_spec.h:498
#define SA_IDFRM_GET_SAS_ADDRESSHI(identFrame)
Definition: sa_spec.h:485
#define SA_IDFRM_SMP_BIT
Definition: sa_spec.h:499
The file defines the declaration of tSDK APIs.
GLOBAL bit32 saPhyStop(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 phyId)
Stop a Phy.
Definition: saphy.c:183
GLOBAL bit32 saRegisterEventCallback(agsaRoot_t *agRoot, bit32 eventSourceType, ossaGenericCB_t callbackPtr)
Register a callback for a specific event.
Definition: sadisc.c:566
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 saEncryptGetMode(agsaRoot_t *agRoot, agsaContext_t *agContext, agsaEncryptInfo_t *encryptInfo)
Definition: saport.c:563
GLOBAL bit32 saGetControllerInfo(agsaRoot_t *agRoot, agsaControllerInfo_t *controllerInfo)
SPC Get Controller Information Command.
Definition: saioctlcmd.c:714
GLOBAL bit32 saEncryptDekCacheInvalidate(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 dekTable, bit32 dekIndex)
Definition: saport.c:1057
GLOBAL bit32 saOperatorManagement(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 flag, bit8 role, agsaID_t *id, agsaEncryptKekBlob_t *kblob)
Definition: saport.c:1297
GLOBAL bit32 saGetPhyProfile(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 ppc, bit32 phyID)
Definition: saphy.c:823
GLOBAL bit32 saGetControllerStatus(agsaRoot_t *agRoot, agsaControllerStatus_t *controllerStatus)
SPC Get Controller Status Command.
Definition: saioctlcmd.c:974
GLOBAL void saGetRequirements(agsaRoot_t *agRoot, agsaSwConfig_t *swConfig, agsaMemoryRequirement_t *memoryRequirement, bit32 *usecsPerTick, bit32 *maxNumLocks)
Get the memory and lock requirement from LL layer.
Definition: sainit.c:74
GLOBAL bit32 saEchoCommand(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, void *echoPayload)
SAS/SATA LL API ECHO Command.
Definition: sampicmd.c:57
GLOBAL bit32 saHwEventAck(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaEventSource_t *eventSource, bit32 param0, bit32 param1)
Initiate a HW Event Ack command.
Definition: saphy.c:1004
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 saEncryptDekCacheUpdate(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 kekIndex, bit32 dekTableSelect, bit32 dekAddrHi, bit32 dekAddrLo, bit32 dekIndex, bit32 dekNumberOfEntries, bit32 dekBlobFormat, bit32 dekTableKeyEntrySize)
Definition: saport.c:973
GLOBAL bit32 saInitialize(agsaRoot_t *agRoot, agsaMemoryRequirement_t *memoryAllocated, agsaHwConfig_t *hwConfig, agsaSwConfig_t *swConfig, bit32 usecsPerTick)
Initialize the Hardware.
Definition: sainit.c:303
GLOBAL bit32 saSetControllerConfig(agsaRoot_t *agRoot, bit32 queueNum, bit32 modePage, bit32 length, void *buffer, agsaContext_t *agContext)
Definition: saport.c:1151
GLOBAL bit32 saRegisterNewDevice(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaDeviceInfo_t *agDeviceInfo, agsaPortContext_t *agPortContext, bit16 hostAssignedDeviceId)
Register New Device from a specific local port.
Definition: sadisc.c:302
GLOBAL bit32 saGetOperator(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 option, bit32 AddrHi, bit32 AddrLo)
Definition: saport.c:1395
GLOBAL bit32 saPhyStart(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 phyId, agsaPhyConfig_t *agPhyConfig, agsaSASIdentify_t *agSASIdentify)
Start a Phy.
Definition: saphy.c:60
GLOBAL bit32 saSetOperator(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 flag, void *cert)
Definition: saport.c:1356
GLOBAL bit32 saEncryptKekUpdate(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, bit32 flags, bit32 newKekIndex, bit32 wrapperKekIndex, bit32 blobFormat, agsaEncryptKekBlob_t *encryptKekBlob)
Definition: saport.c:808
GLOBAL bit32 saEncryptSetMode(agsaRoot_t *agRoot, agsaContext_t *agContext, bit32 queueNum, agsaEncryptInfo_t *mode)
Definition: saport.c:710
The file defines the constants used by LL layer.
The file defines the declaration of OS APIs.
osGLOBAL bit32 ossaHwRegReadConfig32(agsaRoot_t *agRoot, bit32 regOffset)
Definition: ossacmnapi.c:3690
@ SM_RC_FAILURE
Definition: sm.h:49
@ SM_RC_VERSION_INCOMPATIBLE
Definition: sm.h:52
osGLOBAL bit32 smDeregisterDevice(smRoot_t *smRoot, agsaDevHandle_t *agDevHandle, smDeviceHandle_t *smDeviceHandle)
Definition: smsat.c:85
osGLOBAL bit32 smInitialize(smRoot_t *smRoot, agsaRoot_t *agRoot, smMemoryRequirement_t *memoryAllocated, smSwConfig_t *swConfig, bit32 usecsPerTick)
Definition: sminit.c:160
bit32 sasAddressHi
Definition: tdtypes.h:229
bit32 sasAddressLo
Definition: tdtypes.h:228
data structure stores OS specific and LL specific context
Definition: sa.h:1658
void * osData
Definition: sa.h:1659
void * sdkData
Definition: sa.h:1660
describe a information for a Controller in the SAS/SATA hardware
Definition: sa.h:2045
describe a status for a Controller in the SAS/SATA hardware
Definition: sa.h:2078
bit32 flag
Definition: sa.h:2582
bit32 status
Definition: sa.h:3210
bit32 encryptionSecurityMode
Definition: sa.h:3209
bit32 encryptionCipherMode
Definition: sa.h:3208
describe a information for a Event in the SAS/SATA hardware
Definition: sa.h:2033
bit8 * iopImg
Definition: sa.h:2452
bit32 iopLen
Definition: sa.h:2453
bit8 * istrImg
Definition: sa.h:2454
bit32 istrLen
Definition: sa.h:2455
bit32 ilaLen
Definition: sa.h:2451
bit8 * ilaImg
Definition: sa.h:2450
bit8 * aap1Img
Definition: sa.h:2448
bit32 aap1Len
Definition: sa.h:2449
structure describe hardware configuration
Definition: sa.h:2301
bit32 hwInterruptCoalescingControl
Definition: sa.h:2305
agsaPhyAnalogSetupTable_t phyAnalogConfig
Definition: sa.h:2309
bit32 phyCount
Definition: sa.h:2302
bit32 hwOption
Definition: sa.h:2307
bit32 intReassertionOption
Definition: sa.h:2306
bit32 hwInterruptCoalescingTimer
Definition: sa.h:2304
Definition: sa.h:3292
bit32 value
Definition: sa.h:3436
bit32 MPITableType
Definition: sa.h:3434
bit32 offset
Definition: sa.h:3435
bit32 phyAddrUpper
Definition: sa.h:2467
bit32 reserved
Definition: sa.h:2475
bit32 singleElementLength
Definition: sa.h:2471
void * virtPtr
Definition: sa.h:2465
void * osHandle
Definition: sa.h:2466
bit32 alignment
Definition: sa.h:2472
bit32 numElements
Definition: sa.h:2470
bit32 phyAddrLower
Definition: sa.h:2468
bit32 type
Definition: sa.h:2474
bit32 totalLength
Definition: sa.h:2469
specify the memory allocation requirement for the SAS/SATA LL Layer
Definition: sa.h:2534
agsaMem_t agMemory[AGSA_NUM_MEM_CHUNKS]
Definition: sa.h:2537
agsaPhyAnalogSetupRegisters_t phyAnalogSetupRegisters[MAX_INDEX]
Definition: sa.h:1770
agsaQueueOutbound_t outboundQueues[AGSA_MAX_OUTBOUND_Q]
Definition: sa.h:2441
agsaQueueInbound_t inboundQueues[AGSA_MAX_INBOUND_Q]
Definition: sa.h:2440
bit8 iqNormalPriorityProcessingDepth
Definition: sa.h:2435
bit8 iqHighPriorityProcessingDepth
Definition: sa.h:2436
bit16 numInboundQueues
Definition: sa.h:2428
bit32 queueOption
Definition: sa.h:2439
bit16 numOutboundQueues
Definition: sa.h:2429
bit32 elementCount
Definition: sa.h:2377
bit32 elementSize
Definition: sa.h:2379
bit32 reserved
Definition: sa.h:2385
bit32 priority
Definition: sa.h:2380
bit32 elementCount
Definition: sa.h:2390
bit32 elementSize
Definition: sa.h:2393
bit32 interruptCount
Definition: sa.h:2399
bit32 interruptEnable
Definition: sa.h:2407
bit32 interruptVectorIndex
Definition: sa.h:2401
bit32 interruptDelay
Definition: sa.h:2394
data structure for SAS protocol timer configuration page.
Definition: sa.h:3373
data structure provides some information about a SATA device
Definition: sa.h:2649
bit8 signature[8]
Definition: sa.h:2668
data structure provides the identify data of the SATA device
Definition: sa_spec.h:530
describe a serial GPIO operation response in the SAS/SATA hardware
Definition: sa.h:2173
bit8 gpioEnable
Definition: sa.h:2179
SGPIO configuration register 1.
Definition: sa.h:2188
bit8 forceActOff
Definition: sa.h:2193
bit8 maxActOn
Definition: sa.h:2192
describe a serial GPIO request and response in the SAS/SATA hardware
Definition: sa.h:2156
bit32 readWriteData[OSSA_SGPIO_MAX_READ_DATA_COUNT]
Definition: sa.h:2163
structure describe software configuration
Definition: sa.h:2319
bit32 eventLog1Option
Definition: sa.h:2328
bit32 smpReqTimeout
Definition: sa.h:2323
bit32 max_MSI_InterruptVectors
Definition: sa.h:2334
bit32 enableDIF
Definition: sa.h:2339
bit32 fatalErrorInterruptEnable
Definition: sa.h:2331
bit32 disableMDF
Definition: sa.h:2342
bit32 legacyInt_X
Definition: sa.h:2336
void * mpiContextTable
Definition: sa.h:2351
bit32 eventLog2Option
Definition: sa.h:2329
bit32 maxActiveIOs
Definition: sa.h:2320
bit32 param2
Definition: sa.h:2345
void * param4
Definition: sa.h:2347
bit32 sizefEventLog2
Definition: sa.h:2327
bit32 enableEncryption
Definition: sa.h:2340
bit32 numDevHandles
Definition: sa.h:2321
bit32 stallUsec
Definition: sa.h:2348
bit32 sizefEventLog1
Definition: sa.h:2326
bit32 PortRecoveryResetTimer
Definition: sa.h:2350
bit32 mpiContextTablelen
Definition: sa.h:2357
bit32 param1
Definition: sa.h:2344
void * param3
Definition: sa.h:2346
bit32 hostDirectAccessMode
Definition: sa.h:2338
bit32 max_MSIX_InterruptVectors
Definition: sa.h:2335
bit32 hostDirectAccessSupport
Definition: sa.h:2337
bit32 fatalErrorInterruptVector
Definition: sa.h:2333
bit32 FWConfig
Definition: sa.h:2349
bit32 numberOfEventRegClients
Definition: sa.h:2324
Definition: dm.h:91
bit32 numElements
Definition: dm.h:126
bit32 physAddrLower
Definition: dm.h:124
void * osHandle
Definition: dm.h:122
bit32 type
Definition: dm.h:129
bit32 singleElementLength
Definition: dm.h:127
bit32 physAddrUpper
Definition: dm.h:123
bit32 totalLength
Definition: dm.h:125
void * virtPtr
Definition: dm.h:121
bit32 alignment
Definition: dm.h:128
bit32 reserved
Definition: dm.h:130
dmMem_t dmMemory[DM_NUM_MEM_CHUNKS]
Definition: dm.h:137
bit8 satSignature[8]
Definition: tdtypes.h:301
bit32 satPMField
Definition: tdtypes.h:300
agsaSATAIdentifyData_t satIdentifyData
Definition: tdtypes.h:273
bit32 satDeviceType
Definition: tdtypes.h:302
bit32 physAddrUpper
Definition: sm.h:167
bit32 reserved
Definition: sm.h:174
bit32 numElements
Definition: sm.h:170
bit32 totalLength
Definition: sm.h:169
void * virtPtr
Definition: sm.h:165
bit32 physAddrLower
Definition: sm.h:168
bit32 alignment
Definition: sm.h:172
void * osHandle
Definition: sm.h:166
bit32 type
Definition: sm.h:173
bit32 singleElementLength
Definition: sm.h:171
smMem_t smMemory[SM_NUM_MEM_CHUNKS]
Definition: sm.h:181
tdList_t * flink
Definition: tdlist.h:38
agBOOLEAN resetInProgress
Definition: tdtypes.h:193
agBOOLEAN sysIntsActive
Definition: tdtypes.h:190
data structure for SAS/SATA context at TD layer
Definition: tdsatypes.h:199
agsaRoot_t agRootNonInt
Definition: tdsatypes.h:207
agsaHwConfig_t HwConfig
Definition: tdsatypes.h:220
agsaQueueConfig_t QueueConfig
Definition: tdsatypes.h:217
bit32 InboundQueuePriority[AGSA_MAX_INBOUND_Q]
Definition: tdsatypes.h:283
bit32 QueueOption
Definition: tdsatypes.h:284
tdList_t MainPortContextList
Definition: tdsatypes.h:248
bit32 InboundQueueEleSize[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:277
agsaRoot_t agRootInt
Definition: tdsatypes.h:206
bit32 InboundQueueSize[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:276
bit32 tdSubVendorId
Definition: tdsatypes.h:286
tdList_t FreePortContextList
Definition: tdsatypes.h:247
bit32 OutboundQueueInterruptCount[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:281
tiLoLevelResource_t loResource
Definition: tdsatypes.h:224
bit32 itNexusTimeout
Definition: tdsatypes.h:339
bit32 OutboundQueueInterruptEnable[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:282
bit32 tdDeviceIdVendId
Definition: tdsatypes.h:285
tdFWControlEx_t tdFWControlEx
Definition: tdsatypes.h:258
bit32 SMPQNum
Definition: tdsatypes.h:301
tdsaHwEventSource_t eventSource[TD_MAX_NUM_PHYS]
Definition: tdsatypes.h:297
tdList_t MainDeviceList
Definition: tdsatypes.h:250
tdList_t FreeDeviceList
Definition: tdsatypes.h:249
bit32 IBQnumber
Definition: tdsatypes.h:274
agsaSwConfig_t SwConfig
Definition: tdsatypes.h:214
tdsaPortStartInfo_t Ports[TD_MAX_NUM_PHYS]
Definition: tdsatypes.h:255
bit32 OutboundQueueInterruptDelay[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:280
struct tdsaComMemFlags_s flags
Definition: tdsatypes.h:210
agsaMPIContext_t MpiOverride
Definition: tdsatypes.h:341
bit32 currentOperation
Definition: tdsatypes.h:200
bit32 OutboundQueueSize[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:278
bit32 OutboundQueueEleSize[AGSA_MAX_OUTBOUND_Q]
Definition: tdsatypes.h:279
bit32 phyCount
Definition: tdsatypes.h:273
tdList_t freeExpanderList
Definition: tdsatypes.h:272
bit32 OBQnumber
Definition: tdsatypes.h:275
data structure for SAS device list This structure maintains the device as a list and information abou...
Definition: tdtypes.h:322
tiDeviceHandle_t tiDeviceHandle
Definition: tdtypes.h:325
agsaRoot_t * agRoot
Definition: tdtypes.h:335
bit8 target_ssp_stp_smp
Definition: tdtypes.h:343
tdList_t MainLink
Definition: tdtypes.h:328
agsaDevHandle_t * agDevHandle
Definition: tdtypes.h:336
bit8 initiator_ssp_stp_smp
Definition: tdtypes.h:342
struct tdsaExpander_s * tdExpander
Definition: tdtypes.h:360
bit8 directlyAttached
Definition: tdtypes.h:367
struct tdsaPortContext_s * tdPortContext
Definition: tdtypes.h:349
tdList_t FreeLink
Definition: tdtypes.h:327
TDSASAddressID_t SASAddressID
Definition: tdtypes.h:341
satDeviceData_t satDevData
Definition: tdtypes.h:346
agsaDeviceInfo_t agDeviceInfo
Definition: tdtypes.h:357
struct tdsaDeviceData_s * ExpDevice
Definition: tdtypes.h:361
agsaContext_t agContext
Definition: tdtypes.h:358
bit32 NumOfUpExp
Definition: tdtypes.h:246
tdList_t discoveringExpanderList
Definition: tdtypes.h:239
bit32 status
Definition: tdtypes.h:242
tdList_t UpdiscoveringExpanderList
Definition: tdtypes.h:240
bit16 numOfUpStreamPhys
Definition: tdtypes.h:511
bit8 hasUpStreamDevice
Definition: tdtypes.h:502
bit16 currentUpStreamPhyIndex
Definition: tdtypes.h:512
tdList_t linkNode
Definition: tdtypes.h:498
tdList_t upNode
Definition: tdtypes.h:499
bit16 currentIndex[TD_MAX_EXPANDER_PHYS]
Definition: tdtypes.h:505
struct tdsaExpander_s * tdReturnginExpander
Definition: tdtypes.h:520
struct tdsaExpander_s * tdCurrentDownStreamExpander
Definition: tdtypes.h:509
tdsaDeviceData_t * tdDevice
Definition: tdtypes.h:500
struct tdsaExpander_s * tdUpStreamExpander
Definition: tdtypes.h:501
bit32 underDiscovering
Definition: tdtypes.h:515
bit8 discoveringPhyId
Definition: tdtypes.h:503
agsaEventSource_t Source
Definition: tdsatypes.h:189
data structure for TD port context This structure maintains information about the port such as ID add...
Definition: tdtypes.h:412
bit32 discoveryOptions
Definition: tdtypes.h:418
tdsaDiscovery_t discovery
Definition: tdtypes.h:453
bit32 sasRemoteAddressLo
Definition: tdtypes.h:433
bit32 sasLocalAddressHi
Definition: tdtypes.h:438
bit32 eventPhyID
Definition: tdtypes.h:457
bit32 DiscoveryState
Definition: tdtypes.h:416
tdList_t FreeLink
Definition: tdtypes.h:429
bit32 sasRemoteAddressHi
Definition: tdtypes.h:432
bit8 PhyIDList[TD_MAX_NUM_PHYS]
Definition: tdtypes.h:442
bit32 RegisteredDevNums
Definition: tdtypes.h:456
agsaContext_t agContext
Definition: tdtypes.h:459
agsaPortContext_t * agPortContext
Definition: tdtypes.h:446
bit32 sasLocalAddressLo
Definition: tdtypes.h:439
tiPortalContext_t * tiPortalContext
Definition: tdtypes.h:443
tdList_t MainLink
Definition: tdtypes.h:430
bit8 remoteName[68]
Definition: tdtypes.h:462
tdssPortFlags_t flags
Definition: tdtypes.h:481
data structure OS root from the view of lower layer. TD Layer interrupt/non-interrupt context support...
Definition: tdtypes.h:151
tiRoot_t * tiRoot
Definition: tdtypes.h:152
the root data structure for TD layer
Definition: tdsatypes.h:362
tdsaContext_t tdsaAllShared
Definition: tdsatypes.h:364
bit8 initiator_ssp_stp_smp
Definition: tdtypes.h:396
bit32 sasAddressLo
Definition: tdtypes.h:395
bit8 target_ssp_stp_smp
Definition: tdtypes.h:397
bit32 sasAddressHi
Definition: tdtypes.h:394
agBOOLEAN portInitialized
Definition: tdtypes.h:170
bit32 dekTable
Definition: titypes.h:314
bit32 dekIndex
Definition: titypes.h:315
bit32 securityCipherMode
Definition: titypes.h:300
bit32 status
Definition: titypes.h:301
bit32 subEvent
Definition: titypes.h:308
void * pData
Definition: titypes.h:309
bit32 encryptEvent
Definition: titypes.h:307
bit16 MajorFunction
Definition: titypes.h:138
bit8 FunctionSpecificArea[1]
Definition: titypes.h:143
bit16 Status
Definition: titypes.h:141
bit16 Length
Definition: titypes.h:140
bit32 count
Definition: titypes.h:82
tiMem_t mem[MAX_LL_LAYER_MEM_DESCRIPTORS]
Definition: titypes.h:83
bit32 maxInterruptVectors
Definition: titypes.h:95
bit32 usecsPerTick
Definition: titypes.h:88
bit32 flag
Definition: titypes.h:96
bit32 max_MSI_InterruptVectors
Definition: titypes.h:97
tiLoLevelOption_t loLevelOption
Definition: titypes.h:106
tiLoLevelMem_t loLevelMem
Definition: titypes.h:107
bit32 totalLength
Definition: titypes.h:72
bit32 reserved
Definition: titypes.h:77
void * virtPtr
Definition: titypes.h:68
bit32 physAddrLower
Definition: titypes.h:71
bit32 numElements
Definition: titypes.h:73
bit32 singleElementLength
Definition: titypes.h:74
bit32 physAddrUpper
Definition: titypes.h:70
void * osHandle
Definition: titypes.h:69
bit32 type
Definition: titypes.h:76
bit32 alignment
Definition: titypes.h:75
char * localName
Definition: titypes.h:162
bit32 localNameLen
Definition: titypes.h:164
bit32 remoteNameLen
Definition: titypes.h:165
char * remoteName
Definition: titypes.h:163
void * tdData
Definition: titypes.h:51
Definition: titypes.h:61
void * tdData
Definition: titypes.h:63
#define tiIS_SPC6V(agr)
Definition: tddefs.h:1272
#define DEFAULT_QUEUE_OPTION
Definition: tddefs.h:145
#define tIsSPCADAPvplus(agr)
Definition: tddefs.h:1252
#define DEFAULT_INBOUND_QUEUE_PRIORITY
Definition: tddefs.h:144
#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_DELAY
Definition: tddefs.h:141
#define DEFAULT_OUTBOUND_INTERRUPT_ENABLE
Definition: tddefs.h:143
#define tIsSPC12Gve(agr)
Definition: tddefs.h:1256
#define tIsSPC(agr)
Definition: tddefs.h:1246
#define tiIS_SPC_ENC(agr)
Definition: tddefs.h:1302
#define PORT_RECOVERY_TIMEOUT
Definition: tddefs.h:376
#define DEFAULT_NUM_REG_CLIENTS
Definition: tddefs.h:134
#define DEFAULT_MAX_ACTIVE_IOS
Definition: tddefs.h:133
#define tIsSPCveplus(agr)
Definition: tddefs.h:1251
#define DEFAULT_OUTBOUND_QUEUE_SIZE
Definition: tddefs.h:139
#define DEFAULT_EVENT_LOG_OPTION
Definition: tddefs.h:1089
#define tIsSPC12Gv(agr)
Definition: tddefs.h:1255
#define TD_OPERATION_TARGET
Definition: tddefs.h:89
#define tIsSPC12Gvplus(agr)
Definition: tddefs.h:1257
#define tIsSPC12Gveplus(agr)
Definition: tddefs.h:1258
#define DEFAULT_OUTBOUND_QUEUE_ELE_SIZE
Definition: tddefs.h:140
#define tIsSPCv(agr)
Definition: tddefs.h:1248
#define tiIS_16PHY(agr)
Definition: tddefs.h:1295
#define DEFAULT_MAX_DEV
Definition: tddefs.h:122
#define tIsSPCHIL(agr)
Definition: tddefs.h:1247
#define tIsSPCV12G(agr)
Definition: tddefs.h:1279
#define TD_ASSERT
Definition: tddefs.h:1055
#define DEFAULT_OUTBOUND_QUEUE_INTERRUPT_COUNT
Definition: tddefs.h:142
#define HOST_EVENT_LOG_SIZE
Definition: tddefs.h:1088
#define tIsSPCADAPveplus(agr)
Definition: tddefs.h:1253
#define tIsSPCvplus(agr)
Definition: tddefs.h:1250
#define DEFAULT_NUM_INBOUND_QUEUE
Definition: tddefs.h:135
#define TD_MAX_NUM_PHYS
Definition: tddefs.h:108
#define tIsSPCV12or6G(agr)
Definition: tddefs.h:1306
#define tIsSPCve(agr)
Definition: tddefs.h:1249
#define tiIS_HIL(agr)
Definition: tddefs.h:1268
#define DEFAULT_NUM_OUTBOUND_QUEUE
Definition: tddefs.h:136
#define STP_IDLE_TIME
Definition: tddefs.h:378
#define DEFAULT_INBOUND_QUEUE_SIZE
Definition: tddefs.h:137
#define TD_OPERATION_INITIATOR
Definition: tddefs.h:88
#define DEFAULT_INBOUND_QUEUE_ELE_SIZE
Definition: tddefs.h:138
@ TD_DISC_LOCK
Definition: tddefs.h:1153
@ TD_DEVICE_LOCK
Definition: tddefs.h:1146
@ TD_PORT_LOCK
Definition: tddefs.h:1149
#define tiIS_SPC(agr)
Definition: tddefs.h:1265
#define TD_XFER_RDY_PRIORTY_DEVICE_FLAG
Definition: tddefs.h:1196
#define tiIS_8PHY(agr)
Definition: tddefs.h:1289
#define DEFAULT_FW_MAX_PORTS
Definition: tddefs.h:146
osGLOBAL void tdsaPortContextReInit(tiRoot_t *tiRoot, tdsaPortContext_t *onePortContext)
Definition: tdinit.c:2811
osGLOBAL void tdsaDeviceDataReInit(tiRoot_t *tiRoot, tdsaDeviceData_t *oneDeviceData)
Definition: tdinit.c:3071
osGLOBAL bit32 tdsaSGpioIoctlSetup(tiRoot_t *tiRoot, agsaContext_t *agContext, tiIOCTLPayload_t *agIOCTLPayload, void *agParam1, void *agParam2)
Definition: tdioctl.c:1332
#define IOCTL_MJ_SGPIO
Definition: tdioctl.h:90
#define TDLIST_OBJECT_BASE(baseType, fieldName, fieldPtr)
Definition: tdlist.h:161
#define TDLIST_NOT_EMPTY(listHdr)
Definition: tdlist.h:76
#define TDLIST_ENQUEUE_AT_TAIL(toAddHdr, listHdr)
Definition: tdlist.h:65
#define TDLIST_EMPTY(listHdr)
Definition: tdlist.h:73
#define TDLIST_DEQUEUE_THIS(hdr)
Definition: tdlist.h:79
#define TDLIST_DEQUEUE_FROM_HEAD(atHeadHdr, listHdr)
Definition: tdlist.h:93
osGLOBAL void tdssPrintSASIdentify(agsaSASIdentify_t *id)
Definition: tdmisc.c:2689
void tdsaSingleThreadedEnter(tiRoot_t *ptiRoot, bit32 queueId)
Definition: tdmisc.c:2862
void tdsaSingleThreadedLeave(tiRoot_t *ptiRoot, bit32 queueId)
Definition: tdmisc.c:2875
osGLOBAL void tdsaPrintHwConfig(agsaHwConfig_t *HwConfig)
Definition: tdmisc.c:2672
osGLOBAL void tdsaPrintSwConfig(agsaSwConfig_t *SwConfig)
Definition: tdmisc.c:2652
osGLOBAL bit32 tdsaRotateQnumber1(tiRoot_t *tiRoot, tdsaDeviceData_t *oneDeviceData)
Definition: tdport.c:7971
osGLOBAL bit32 tiCOMEncryptGetInfo(tiRoot_t *tiRoot)
Definition: tdport.c:5380
void t_MacroCheck(agsaRoot_t *agRoot)
Definition: tdport.c:8025
bit32 volatile sgpioResponseSet
Definition: tdport.c:97
osGLOBAL bit32 tiCOMEncryptSetMode(tiRoot_t *tiRoot, bit32 securityCipherMode)
Definition: tdport.c:5474
osGLOBAL bit32 tiCOMGetOperator(tiRoot_t *tiRoot, bit32 option, bit32 AddrHi, bit32 AddrLo)
Definition: tdport.c:6139
osGLOBAL void tdsaGetPortParams(tiRoot_t *tiRoot)
Definition: tdport.c:3768
osGLOBAL bit32 tiCOMEncryptKekAdd(tiRoot_t *tiRoot, bit32 kekIndex, bit32 wrapperKekIndex, bit32 blobFormat, tiEncryptKekBlob_t *encryptKekBlob)
Definition: tdport.c:5727
osGLOBAL void tdsaGetGlobalPhyParams(tiRoot_t *tiRoot)
Definition: tdport.c:3407
osGLOBAL bit32 tiCOMEncryptKekLoad(tiRoot_t *tiRoot, bit32 kekIndex)
Definition: tdport.c:5920
osGLOBAL void tdssRemoveAllDevicelistFromPortcontext(tdsaPortContext_t *PortContext_Ins, agsaRoot_t *agRoot)
Definition: tdport.c:6875
osGLOBAL bit32 tiCOMPortInit(tiRoot_t *tiRoot, bit32 sysIntsActive)
Definition: tdport.c:3862
osGLOBAL void tdssRemoveSASFromSharedcontext(tdsaPortContext_t *tdsaPortContext_Ins, tdsaDeviceData_t *tdsaDeviceData_Ins, agsaRoot_t *agRoot)
Definition: tdport.c:6790
osGLOBAL bit32 tiCOMEncryptDekAdd(tiRoot_t *tiRoot, bit32 kekIndex, bit32 dekTableSelect, bit32 dekAddrHi, bit32 dekAddrLo, bit32 dekIndex, bit32 dekNumberOfEntries, bit32 dekBlobFormat, bit32 dekTableKeyEntrySize)
Definition: tdport.c:5566
osGLOBAL void tdsaGetCardPhyParams(tiRoot_t *tiRoot)
Definition: tdport.c:3123
osGLOBAL void tdsaGetSwConfigParams(tiRoot_t *tiRoot)
Definition: tdport.c:123
osGLOBAL bit32 tiCOMEncryptKekStore(tiRoot_t *tiRoot, bit32 kekIndex)
Definition: tdport.c:5861
FORCEINLINE bit32 tdsaRotateQnumber(tiRoot_t *tiRoot, tdsaDeviceData_t *oneDeviceData)
Definition: tdport.c:7956
__FBSDID("$FreeBSD$")
osGLOBAL bit32 tiCOMGetControllerConfig(tiRoot_t *tiRoot, bit32 modePage, bit32 flag, void *context)
Definition: tdport.c:5317
osGLOBAL bit32 tiCOMSetControllerConfig(tiRoot_t *tiRoot, bit32 modePage, bit32 length, void *buffer, void *context)
Definition: tdport.c:5242
bit32 tiCOMConfigureSgpio(tiRoot_t *tiRoot, bit8 enableSgpio)
Definition: tdport.c:4680
osGLOBAL bit32 tiCOMPortStart(tiRoot_t *tiRoot, bit32 portID, tiPortalContext_t *portalContext, bit32 option)
Definition: tdport.c:4765
osGLOBAL bit32 tiCOMSetOperator(tiRoot_t *tiRoot, bit32 flag, void *cert)
Definition: tdport.c:6068
osGLOBAL bit32 tiCOMEncryptDekInvalidate(tiRoot_t *tiRoot, bit32 dekTable, bit32 dekIndex)
Definition: tdport.c:5647
bit32 gSSC_Disable
Definition: tdport.c:96
osGLOBAL bit32 tiCOMEncryptSelfTest(tiRoot_t *tiRoot, bit32 type, bit32 length, void *TestDescriptor)
Definition: tdport.c:5979
osGLOBAL void tdsaGetHwConfigParams(tiRoot_t *tiRoot)
Definition: tdport.c:2588
static bit32 SendSgpioRequest(tiRoot_t *tiRoot, bit8 regType, bit8 regIndex, bit8 regCount, bit32 *writeData)
Definition: tdport.c:4606
osGLOBAL void tdsaParseLinkRateMode(tiRoot_t *tiRoot, bit32 index, bit32 LinkRateRead, bit32 ModeRead, bit32 OpticalModeRead, bit32 LinkRate, bit32 Mode, bit32 OpticalMode)
Definition: tdport.c:2450
osGLOBAL void tdssAddSASToSharedcontext(tdsaPortContext_t *tdsaPortContext_Instance, agsaRoot_t *agRoot, agsaDevHandle_t *agDevHandle, tdsaSASSubID_t *agSASSubID, bit32 registered, bit8 phyID, bit32 flag)
Definition: tdport.c:6487
osGLOBAL bit32 tiCOMGetPortInfo(tiRoot_t *tiRoot, tiPortalContext_t *portalContext, tiPortInfo_t *tiPortInfo)
Definition: tdport.c:5135
osGLOBAL bit32 tiCOMOperatorManagement(tiRoot_t *tiRoot, bit32 flag, bit8 role, tiID_t *idString, tiEncryptKekBlob_t *kekBlob)
Definition: tdport.c:6228
osGLOBAL bit32 tiCOMPortStop(tiRoot_t *tiRoot, tiPortalContext_t *portalContext)
Definition: tdport.c:5009
osGLOBAL void tdssRemoveSASSATAFromSharedcontextByReset(agsaRoot_t *agRoot)
osGLOBAL void tdssRemoveSASSATAFromSharedcontext(agsaRoot_t *agRoot, tdsaPortContext_t *PortContext_Instance)
osGLOBAL bit32 tdssSASFindDiscoveringExpander(tiRoot_t *tiRoot, tdsaPortContext_t *onePortContext, tdsaExpander_t *oneExpander)
#define TD_SATA_DEVICE
Definition: tdsatypes.h:42
#define TD_SAS_DEVICE
Definition: tdsatypes.h:41
osGLOBAL FORCEINLINE bit32 tiCOMDelayedInterruptHandler(tiRoot_t *tiRoot, bit32 channelNum, bit32 count, bit32 context)
Definition: tdint.c:144
#define TI_INTERRUPT_CONFIGURATION_PAGE
Definition: tidefs.h:330
@ tiNonInterruptContext
Definition: tidefs.h:121
@ tiEncryptOperation
Definition: tidefs.h:139
@ tiPortStarted
Definition: tidefs.h:134
#define TI_ENCRYPT_SEC_MODE_B
Definition: tidefs.h:273
#define TI_ENCRYPT_SEC_MODE_A
Definition: tidefs.h:272
@ tiNotSupported
Definition: tidefs.h:74
@ tiSuccess
Definition: tidefs.h:67
@ tiBusy
Definition: tidefs.h:69
@ tiError
Definition: tidefs.h:68
#define IOCTL_CALL_PENDING
Definition: tidefs.h:245
#define TI_ENCRYPT_ATTRIB_CIPHER_XTS
Definition: tidefs.h:276
@ tiTgtEventTypeDeviceChange
Definition: tidefs.h:601
#define TI_ENCRYPT_ATTRIB_CIPHER_ECB
Definition: tidefs.h:277
#define TI_SAS_PROTOCOL_TIMER_CONFIG_PAGE
Definition: tidefs.h:329
#define TI_ENCRYPTION_CONTROL_PARM_PAGE
Definition: tidefs.h:333
@ tiEncryptDekInvalidate
Definition: tidefs.h:151
@ tiEncryptGetInfo
Definition: tidefs.h:148
@ tiDeviceRemoval
Definition: tidefs.h:504
#define TI_DMA_MEM
Definition: tidefs.h:86
#define TI_ENCRYPTION_TEST_TYPE_HMAC
Definition: tidefs.h:339
#define TI_ENCRYPTION_DEK_CONFIG_PAGE
Definition: tidefs.h:332
#define TI_CACHED_MEM
Definition: tidefs.h:87
#define TI_ENCRYPTION_GENERAL_CONFIG_PAGE
Definition: tidefs.h:331
#define IOCTL_ERR_STATUS_OK
Definition: tidefs.h:221
#define TI_ENCRYPTION_TEST_TYPE_BIST
Definition: tidefs.h:338
@ tiIntrEventTypeDeviceChange
Definition: tidefs.h:461
#define TI_ENCRYPTION_HMAC_CONFIG_PAGE
Definition: tidefs.h:334
#define IOCTL_CALL_FAIL
Definition: tidefs.h:244
#define TI_ENCRYPT_SEC_MODE_FACT_INIT
Definition: tidefs.h:271
#define TI_CACHED_DMA_MEM
Definition: tidefs.h:88
#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
osGLOBAL void ttdssGetTargetParams(tiRoot_t *tiRoot)
Definition: ttdinit.c:459