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 ********************************************************************************/ 23 /*******************************************************************************/ 24 /*! \file saapi.h 25 * \brief The file defines the declaration of tSDK APIs 26 * 27 * 28 * 29 * 30 */ 31 /******************************************************************************/ 32 33 #ifndef __SSDKAPI_H__ 34 #define __SSDKAPI_H__ 35 36 /******************************************************************************** 37 * SA LL Function Declaration * 38 ********************************************************************************/ 39 40 /*************************************************************************** 41 * Definition of interrupt related functions start * 42 ***************************************************************************/ 43 44 45 GLOBAL bit32 FORCEINLINE saDelayedInterruptHandler( 46 agsaRoot_t *agRoot, 47 bit32 interruptVectorIndex, 48 bit32 count 49 ); 50 51 GLOBAL bit32 FORCEINLINE saInterruptHandler( 52 agsaRoot_t *agRoot, 53 bit32 interruptVectorIndex 54 ); 55 56 GLOBAL void saSystemInterruptsActive( 57 agsaRoot_t *agRoot, 58 agBOOLEAN sysIntsActive 59 ); 60 61 GLOBAL FORCEINLINE void saSystemInterruptsEnable( 62 agsaRoot_t *agRoot, 63 bit32 interruptVectorIndex 64 ); 65 /*************************************************************************** 66 * Definition of interrupt related functions end * 67 ***************************************************************************/ 68 69 70 /*************************************************************************** 71 * Definition of timer related functions start * 72 ***************************************************************************/ 73 GLOBAL void saTimerTick(agsaRoot_t *agRoot); 74 /*************************************************************************** 75 * Definition of timer related functions end * 76 ***************************************************************************/ 77 78 /*************************************************************************** 79 * Definition of initialization related functions start * 80 ***************************************************************************/ 81 GLOBAL void saGetRequirements( 82 agsaRoot_t *agRoot, 83 agsaSwConfig_t *swConfig, 84 agsaMemoryRequirement_t *memoryRequirement, 85 bit32 *usecsPerTick, 86 bit32 *maxNumLocks 87 ); 88 89 GLOBAL bit32 saInitialize( 90 agsaRoot_t *agRoot, 91 agsaMemoryRequirement_t *memoryAllocated, 92 agsaHwConfig_t *hwConfig, 93 agsaSwConfig_t *swConfig, 94 bit32 usecsPerTick 95 ); 96 /*************************************************************************** 97 * Definition of initialization related functions end * 98 ***************************************************************************/ 99 100 /*************************************************************************** 101 * Definition of hardware related functions start * 102 ***************************************************************************/ 103 GLOBAL void saHwReset( 104 agsaRoot_t *agRoot, 105 bit32 resetType, 106 bit32 resetParm 107 ); 108 109 GLOBAL void saHwShutdown(agsaRoot_t *agRoot); 110 111 /*************************************************************************** 112 * Definition of hardware related functions end * 113 ***************************************************************************/ 114 115 /*************************************************************************** 116 * Definition of phy related functions start * 117 ***************************************************************************/ 118 GLOBAL bit32 saPhyStart( 119 agsaRoot_t *agRoot, 120 agsaContext_t *agContext, 121 bit32 queueNum, 122 bit32 phyId, 123 agsaPhyConfig_t *agPhyConfig, 124 agsaSASIdentify_t *agSASIdentify 125 ); 126 127 GLOBAL bit32 saPhyStop( 128 agsaRoot_t *agRoot, 129 agsaContext_t *agContext, 130 bit32 queueNum, 131 bit32 phyId 132 ); 133 134 135 GLOBAL bit32 saLocalPhyControl( 136 agsaRoot_t *agRoot, 137 agsaContext_t *agContext, 138 bit32 queueNum, 139 bit32 phyId, 140 bit32 phyOperation, 141 ossaLocalPhyControlCB_t agCB 142 ); 143 144 GLOBAL bit32 saGetPhyProfile( 145 agsaRoot_t *agRoot, 146 agsaContext_t *agContext, 147 bit32 queueNum, 148 bit32 ppc, 149 bit32 phyID 150 ); 151 152 GLOBAL bit32 saSetPhyProfile ( 153 agsaRoot_t *agRoot, 154 agsaContext_t *agContext, 155 bit32 queueNum, 156 bit32 ppc, 157 bit32 length, 158 void *buffer, 159 bit32 phyID 160 ); 161 162 GLOBAL bit32 saHwEventAck( 163 agsaRoot_t *agRoot, 164 agsaContext_t *agContext, 165 bit32 queueNum, 166 agsaEventSource_t *eventSource, 167 bit32 param0, 168 bit32 param1 169 ); 170 171 172 /*************************************************************************** 173 * Definition of phy related functions end * 174 ***************************************************************************/ 175 176 /*************************************************************************** 177 * Definition of discovery related functions start * 178 ***************************************************************************/ 179 GLOBAL bit32 saDiscover( 180 agsaRoot_t *agRoot, 181 agsaPortContext_t *agPortContext, 182 bit32 type, 183 bit32 option 184 ); 185 /*************************************************************************** 186 * Definition of discovery related functions end * 187 ***************************************************************************/ 188 189 /*************************************************************************** 190 * Definition of frame related functions start * 191 ***************************************************************************/ 192 GLOBAL bit32 saFrameReadBit32( 193 agsaRoot_t *agRoot, 194 agsaFrameHandle_t agFrame, 195 bit32 frameOffset 196 ); 197 198 GLOBAL void saFrameReadBlock( 199 agsaRoot_t *agRoot, 200 agsaFrameHandle_t agFrame, 201 bit32 frameOffset, 202 void *frameBuffer, 203 bit32 frameBufLen 204 ); 205 /*************************************************************************** 206 * Definition of frame related functions end * 207 ***************************************************************************/ 208 209 /*************************************************************************** 210 * Definition of SATA related functions start * 211 ***************************************************************************/ 212 GLOBAL bit32 saSATAStart( 213 agsaRoot_t *agRoot, 214 agsaIORequest_t *agIORequest, 215 bit32 queueNum, 216 agsaDevHandle_t *agDevHandle, 217 bit32 agRequestType, 218 agsaSATAInitiatorRequest_t *agSATAReq, 219 bit8 agTag, 220 ossaSATACompletedCB_t agCB 221 ); 222 223 GLOBAL bit32 saSATAAbort( 224 agsaRoot_t *agRoot, 225 agsaIORequest_t *agIORequest, 226 bit32 queueNum, 227 agsaDevHandle_t *agDevHandle, 228 bit32 flag, 229 void *abortParam, 230 ossaGenericAbortCB_t agCB 231 ); 232 233 /*************************************************************************** 234 * Definition of SATA related functions end * 235 ***************************************************************************/ 236 237 /*************************************************************************** 238 * Definition of SAS related functions start * 239 ***************************************************************************/ 240 241 GLOBAL bit32 saSendSMPIoctl( 242 agsaRoot_t *agRoot, 243 agsaDevHandle_t *agDevHandle, 244 bit32 queueNum, 245 agsaSMPFrame_t *pSMPFrame, 246 ossaSMPCompletedCB_t agCB 247 ); 248 249 GLOBAL bit32 saSMPStart( 250 agsaRoot_t *agRoot, 251 agsaIORequest_t *agIORequest, 252 bit32 queueNum, 253 agsaDevHandle_t *agDevHandle, 254 bit32 agRequestType, 255 agsaSASRequestBody_t *agRequestBody, 256 ossaSMPCompletedCB_t agCB 257 ); 258 259 GLOBAL bit32 saSMPAbort( 260 agsaRoot_t *agRoot, 261 agsaIORequest_t *agIORequest, 262 bit32 queueNum, 263 agsaDevHandle_t *agDevHandle, 264 bit32 flag, 265 void *abortParam, 266 ossaGenericAbortCB_t agCB 267 ); 268 269 GLOBAL bit32 saSSPStart( 270 agsaRoot_t *agRoot, 271 agsaIORequest_t *agIORequest, 272 bit32 queueNum, 273 agsaDevHandle_t *agDevHandle, 274 bit32 agRequestType, 275 agsaSASRequestBody_t *agRequestBody, 276 agsaIORequest_t *agTMRequest, 277 ossaSSPCompletedCB_t agCB 278 ); 279 280 #ifdef FAST_IO_TEST 281 GLOBAL void *saFastSSPPrepare( 282 void *ioHandle, 283 agsaFastCommand_t *fc, 284 ossaSSPCompletedCB_t cb, 285 void *cbArg); 286 287 GLOBAL bit32 saFastSSPSend(void *ioHandle); 288 GLOBAL bit32 saFastSSPCancel(void *ioHandle); 289 #endif 290 291 GLOBAL bit32 saSSPAbort( 292 agsaRoot_t *agRoot, 293 agsaIORequest_t *agIORequest, 294 bit32 queueNum, 295 agsaDevHandle_t *agDevHandle, 296 bit32 flag, 297 void *abortParam, 298 ossaGenericAbortCB_t agCB 299 ); 300 301 GLOBAL void saGetDifErrorDetails( 302 agsaRoot_t *agRoot, 303 agsaIORequest_t *agIORequest, 304 agsaDifDetails_t *difDetails 305 ); 306 307 GLOBAL bit32 saRegisterEventCallback( 308 agsaRoot_t *agRoot, 309 bit32 eventSourceType, 310 ossaGenericCB_t callbackPtr 311 ); 312 313 /*************************************************************************** 314 * Definition of SAS related functions end * 315 ***************************************************************************/ 316 317 /*************************************************************************** 318 * Definition of Device related functions start * 319 ***************************************************************************/ 320 GLOBAL bit32 saRegisterNewDevice( 321 agsaRoot_t *agRoot, 322 agsaContext_t *agContext, 323 bit32 queueNum, 324 agsaDeviceInfo_t *agDeviceInfo, 325 agsaPortContext_t *agPortContext, 326 bit16 hostAssignedDeviceId 327 ); 328 329 GLOBAL bit32 saDeregisterDeviceHandle( 330 agsaRoot_t *agRoot, 331 agsaContext_t *agContext, 332 agsaDevHandle_t *agDevHandle, 333 bit32 queueNum 334 ); 335 336 GLOBAL bit32 saGetDeviceHandles( 337 agsaRoot_t *agRoot, 338 agsaContext_t *agContext, 339 bit32 queueNum, 340 agsaPortContext_t *agPortContext, 341 bit32 flags, 342 agsaDevHandle_t *agDev[], 343 bit32 skipCount, 344 bit32 maxDevs 345 ); 346 347 GLOBAL bit32 saGetDeviceInfo( 348 agsaRoot_t *agRoot, 349 agsaContext_t *agContext, 350 bit32 option, 351 bit32 queueNum, 352 agsaDevHandle_t *agDevHandle 353 ); 354 355 GLOBAL bit32 saGetDeviceState( 356 agsaRoot_t *agRoot, 357 agsaContext_t *agContext, 358 bit32 queueNum, 359 agsaDevHandle_t *agDevHandle 360 ); 361 362 GLOBAL bit32 saSetDeviceInfo( 363 agsaRoot_t *agRoot, 364 agsaContext_t *agContext, 365 bit32 queueNum , 366 agsaDevHandle_t *agDevHandle, 367 bit32 option, 368 bit32 param, 369 ossaSetDeviceInfoCB_t agCB 370 ); 371 372 GLOBAL bit32 saSetDeviceState( 373 agsaRoot_t *agRoot, 374 agsaContext_t *agContext, 375 bit32 queueNum, 376 agsaDevHandle_t *agDevHandle, 377 bit32 newDeviceState 378 ); 379 380 /*************************************************************************** 381 * Definition of Device related functions end * 382 ***************************************************************************/ 383 384 /*************************************************************************** 385 * Definition of Misc related functions start * 386 ***************************************************************************/ 387 GLOBAL bit32 saFwFlashUpdate( 388 agsaRoot_t *agRoot, 389 agsaContext_t *agContext, 390 bit32 queueNum, 391 agsaUpdateFwFlash_t *flashUpdateInfo 392 ); 393 394 GLOBAL bit32 saFlashExtExecute ( 395 agsaRoot_t *agRoot, 396 agsaContext_t *agContext, 397 bit32 queueNum, 398 agsaFlashExtExecute_t *agFlashExtExe 399 ); 400 401 #ifdef SPC_ENABLE_PROFILE 402 GLOBAL bit32 saFwProfile( 403 agsaRoot_t *agRoot, 404 agsaContext_t *agContext, 405 bit32 queueNum, 406 agsaFwProfile_t *fwProfileInfo 407 ); 408 #endif 409 410 GLOBAL bit32 saEchoCommand( 411 agsaRoot_t *agRoot, 412 agsaContext_t *agContext, 413 bit32 queueNum, 414 void *echoPayload 415 ); 416 417 GLOBAL bit32 saGetControllerInfo( 418 agsaRoot_t *agRoot, 419 agsaControllerInfo_t *controllerInfo 420 ); 421 422 GLOBAL bit32 saGetControllerStatus( 423 agsaRoot_t *agRoot, 424 agsaControllerStatus_t *controllerStatus 425 ); 426 427 GLOBAL bit32 saGetControllerEventLogInfo( 428 agsaRoot_t *agRoot, 429 agsaControllerEventLog_t *eventLogInfo 430 ); 431 432 GLOBAL bit32 saGpioEventSetup( 433 agsaRoot_t *agRoot, 434 agsaContext_t *agContext, 435 bit32 queueNum, 436 agsaGpioEventSetupInfo_t *gpioEventSetupInfo 437 ); 438 439 GLOBAL bit32 saGpioPinSetup( 440 agsaRoot_t *agRoot, 441 agsaContext_t *agContext, 442 bit32 queueNum, 443 agsaGpioPinSetupInfo_t *gpioPinSetupInfo 444 ); 445 446 GLOBAL bit32 saGpioRead( 447 agsaRoot_t *agRoot, 448 agsaContext_t *agContext, 449 bit32 queueNum 450 ); 451 452 GLOBAL bit32 saGpioWrite( 453 agsaRoot_t *agRoot, 454 agsaContext_t *agContext, 455 bit32 queueNum, 456 bit32 gpioWriteMask, 457 bit32 gpioWriteValue 458 ); 459 460 GLOBAL bit32 saSASDiagExecute( 461 agsaRoot_t *agRoot, 462 agsaContext_t *agContext, 463 bit32 queueNum, 464 agsaSASDiagExecute_t *diag 465 ); 466 467 GLOBAL bit32 saSASDiagStartEnd( 468 agsaRoot_t *agRoot, 469 agsaContext_t *agContext, 470 bit32 queueNum, 471 bit32 phyId, 472 bit32 operation 473 ); 474 475 GLOBAL bit32 saGetTimeStamp( 476 agsaRoot_t *agRoot, 477 agsaContext_t *agContext, 478 bit32 queueNum 479 ); 480 481 GLOBAL bit32 saPortControl( 482 agsaRoot_t *agRoot, 483 agsaContext_t *agContext, 484 bit32 queueNum, 485 agsaPortContext_t *agPortContext, 486 bit32 portOperation, 487 bit32 param0, 488 bit32 param1 489 ); 490 491 GLOBAL bit32 saGetRegisterDump( 492 agsaRoot_t *agRoot, 493 agsaContext_t *agContext, 494 bit32 queueNum, 495 agsaRegDumpInfo_t *regDumpInfo 496 ); 497 498 GLOBAL bit32 saGetForensicData( 499 agsaRoot_t *agRoot, 500 agsaContext_t *agContext, 501 agsaForensicData_t *forensicData 502 ); 503 504 bit32 saGetIOErrorStats( 505 agsaRoot_t *agRoot, 506 agsaContext_t *agContext, 507 bit32 flag 508 ); 509 510 bit32 saGetIOEventStats( 511 agsaRoot_t *agRoot, 512 agsaContext_t *agContext, 513 bit32 flag 514 ); 515 516 GLOBAL bit32 saGetNVMDCommand( 517 agsaRoot_t *agRoot, 518 agsaContext_t *agContext, 519 bit32 queueNum, 520 agsaNVMDData_t *NVMDInfo 521 ); 522 523 GLOBAL bit32 saSetNVMDCommand( 524 agsaRoot_t *agRoot, 525 agsaContext_t *agContext, 526 bit32 queueNum, 527 agsaNVMDData_t *NVMDInfo 528 ); 529 530 GLOBAL bit32 saReconfigSASParams( 531 agsaRoot_t *agRoot, 532 agsaContext_t *agContext, 533 bit32 queueNum , 534 agsaSASReconfig_t *agSASConfig 535 ); 536 537 GLOBAL bit32 saSgpio( 538 agsaRoot_t *agRoot, 539 agsaContext_t *agContext, 540 bit32 queueNum, 541 agsaSGpioReqResponse_t *pSGpioReq 542 ); 543 544 GLOBAL bit32 saPCIeDiagExecute( 545 agsaRoot_t *agRoot, 546 agsaContext_t *agContext, 547 bit32 queueNum, 548 agsaPCIeDiagExecute_t *diag); 549 550 551 GLOBAL bit32 saEncryptSelftestExecute( 552 agsaRoot_t *agRoot, 553 agsaContext_t *agContext, 554 bit32 queueNum, 555 bit32 type, 556 bit32 length, 557 void *TestDescriptor); 558 559 GLOBAL bit32 saSetOperator( 560 agsaRoot_t *agRoot, 561 agsaContext_t *agContext, 562 bit32 queueNum, 563 bit32 flag, 564 void *cert); 565 566 GLOBAL bit32 saGetOperator( 567 agsaRoot_t *agRoot, 568 agsaContext_t *agContext, 569 bit32 queueNum, 570 bit32 option, 571 bit32 AddrHi, 572 bit32 AddrLo); 573 574 GLOBAL bit32 saOperatorManagement( 575 agsaRoot_t *agRoot, 576 agsaContext_t *agContext, 577 bit32 queueNum, 578 bit32 flag, 579 bit8 role, 580 agsaID_t *id, 581 agsaEncryptKekBlob_t *kblob); 582 583 584 /*************************************************************************** 585 * Definition of Misc. related functions end * 586 ***************************************************************************/ 587 588 GLOBAL bit32 saSetControllerConfig( 589 agsaRoot_t *agRoot, 590 bit32 queueNum, 591 bit32 modePage, 592 bit32 length, 593 void *buffer, 594 agsaContext_t *agContext 595 ); 596 597 598 GLOBAL bit32 saGetControllerConfig( 599 agsaRoot_t *agRoot, 600 bit32 queueNum, 601 bit32 modePage, 602 bit32 flag0, 603 bit32 flag1, 604 agsaContext_t *agContext 605 ); 606 607 GLOBAL bit32 saEncryptDekCacheUpdate( 608 agsaRoot_t *agRoot, 609 agsaContext_t *agContext, 610 bit32 queueNum, 611 bit32 kekIndex, 612 bit32 dekTableSelect, 613 bit32 dekAddrHi, 614 bit32 dekAddrLo, 615 bit32 dekIndex, 616 bit32 dekNumberOfEntries, 617 bit32 dekBlobFormat, 618 bit32 dekTableKeyEntrySize 619 ); 620 621 GLOBAL bit32 saEncryptDekCacheInvalidate( 622 agsaRoot_t *agRoot, 623 agsaContext_t *agContext, 624 bit32 queueNum, 625 bit32 dekTable, 626 bit32 dekIndex 627 ); 628 629 GLOBAL bit32 saEncryptGetMode( 630 agsaRoot_t *agRoot, 631 agsaContext_t *agContext, 632 agsaEncryptInfo_t *encryptInfo 633 ); 634 635 GLOBAL bit32 saEncryptSetMode ( 636 agsaRoot_t *agRoot, 637 agsaContext_t *agContext, 638 bit32 queueNum, 639 agsaEncryptInfo_t *mode 640 ); 641 642 GLOBAL bit32 saEncryptKekInvalidate( 643 agsaRoot_t *agRoot, 644 agsaContext_t *agContext, 645 bit32 queueNum, 646 bit32 kekIndex 647 ); 648 649 GLOBAL bit32 saEncryptKekUpdate( 650 agsaRoot_t *agRoot, 651 agsaContext_t *agContext, 652 bit32 queueNum, 653 bit32 flags, 654 bit32 newKekIndex, 655 bit32 wrapperKekIndex, 656 bit32 blobFormat, 657 agsaEncryptKekBlob_t *encryptKekBlob 658 ); 659 660 #ifdef HIALEAH_ENCRYPTION 661 GLOBAL bit32 saEncryptHilUpdate( 662 agsaRoot_t *agRoot, 663 agsaContext_t *agContext, 664 bit32 queueNum 665 ); 666 #endif /* HIALEAH_ENCRYPTION */ 667 668 GLOBAL bit32 saGetDFEData( 669 agsaRoot_t *agRoot, 670 agsaContext_t *agContext, 671 bit32 queueNum, 672 bit32 interface, 673 bit32 laneNumber, 674 bit32 interations, 675 agsaSgl_t *agSgl); 676 677 678 GLOBAL bit32 saFatalInterruptHandler( 679 agsaRoot_t *agRoot, 680 bit32 interruptVectorIndex 681 ); 682 683 684 GLOBAL bit32 saDIFEncryptionOffloadStart( 685 agsaRoot_t *agRoot, 686 agsaContext_t *agContext, 687 bit32 queueNum, 688 bit32 op, 689 agsaDifEncPayload_t *agsaDifEncPayload, 690 ossaDIFEncryptionOffloadStartCB_t agCB); 691 692 693 GLOBAL bit32 saVhistCapture( 694 agsaRoot_t *agRoot, 695 agsaContext_t *agContext, 696 bit32 queueNum, 697 bit32 Channel, 698 bit32 NumBitLo, 699 bit32 NumBitHi, 700 bit32 PcieAddrLo, 701 bit32 PcieAddrHi, 702 bit32 ByteCount ); 703 704 705 GLOBAL void saCountActiveIORequests( agsaRoot_t *agRoot); 706 707 #ifdef SA_64BIT_TIMESTAMP 708 osGLOBAL bit64 osTimeStamp64(void); 709 #endif /* SA_64BIT_TIMESTAMP */ 710 711 #ifdef SALL_API_TEST 712 /*************************************************************************** 713 * Definition of LL Test related API functions start * 714 ***************************************************************************/ 715 GLOBAL bit32 saGetLLCounters( 716 agsaRoot_t *agRoot, 717 bit32 counters, 718 agsaLLCountInfo_t *LLCountInfo 719 ); 720 721 GLOBAL bit32 saResetLLCounters( 722 agsaRoot_t *agRoot, 723 bit32 counters 724 ); 725 #endif 726 727 #endif /*__SSDKAPI_H__ */ 728