Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
/*-
 * This file is provided under a dual BSD/GPLv2 license.  When using or
 * redistributing this file, you may do so under either license.
 *
 * GPL LICENSE SUMMARY
 *
 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
 * The full GNU General Public License is included in this distribution
 * in the file called LICENSE.GPL.
 *
 * BSD LICENSE
 *
 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   * Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   * Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in
 *     the documentation and/or other materials provided with the
 *     distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * $FreeBSD$
 */
#ifndef _SCU_BIOS_DEFINITIONS_H_
#define _SCU_BIOS_DEFINITIONS_H_

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

/**
 *  IMPORTANT NOTE:
 *  This file can be used by an SCI Library based driver or
 *  stand-alone where the library is excluded.  By excluding
 *  the SCI Library, inclusion of OS specific header files can
 *  be avoided.  For example, a BIOS utility probably does not
 *  want to be bothered with inclusion of nested OS DDK include
 *  files that are not necessary for its function.
 *
 *  To exclude the SCI Library, either uncomment the EXCLUDE_SCI_LIBRARY
 *  #define statement in environment.h or define the statement as an input
 *  to your compiler.
 */

#include <dev/isci/environment.h>

#ifndef EXCLUDE_SCI_LIBRARY
#include <dev/isci/scil/sci_types.h>
#include <dev/isci/scil/intel_sas.h>
#include <dev/isci/scil/sci_controller_constants.h>
#endif /* EXCLUDE_SCI_LIBRARY */



// For Intel Storage Controller Unit OEM Block
#define SCI_OEM_PARAM_SIGNATURE     "ISCUOEMB"

#define SCI_PREBOOT_SOURCE_INIT     (0x00)
#define SCI_PREBOOT_SOURCE_OROM     (0x80)
#define SCI_PREBOOT_SOURCE_EFI      (0x81)

#define SCI_OEM_PARAM_VER_1_0       (0x10)
#define SCI_OEM_PARAM_VER_1_1       (0x11)
#define SCI_OEM_PARAM_VER_1_2       (0x12)
#define SCI_OEM_PARAM_VER_1_3       (0x13)

// current version
#define SCI_OEM_PARAM_VER_CUR       SCI_OEM_PARAM_VER_1_3

// port configuration mode
#define SCI_BIOS_MODE_MPC   (0x00)
#define SCI_BIOS_MODE_APC   (0x01)


#ifndef SCI_MAX_PHYS
#define SCI_MAX_PHYS (4)
#endif

#ifndef SCI_MAX_PORTS
#define SCI_MAX_PORTS (4)
#endif


/**
 * @struct SCI_BIOS_OEM_PARAM_BLOCK_HDR
 *
 * @brief This structure defines the OEM Parameter block header.
 */
typedef struct SCI_BIOS_OEM_PARAM_BLOCK_HDR
{
    /**
     * This field contains the OEM Parameter Block Signature which is
     * used by BIOS and driver software to identify that the memory location
     * contains valid OEM Parameter data.  The value must be set to
     * SCI_OEM_PARAM_SIGNATURE which is the string "ISCUOEMB" which
     * stands for Intel Storage Controller Unit OEM Block.
     */
    U8 signature[8];
    /**
     * This field contains the size in bytes of the complete OEM
     * Parameter Block, both header and payload hdr_length +
     * (num_elements * element_length).
     */
    U16 total_block_length;
    /**
     * This field contains the size in bytes of the
     * SCI_BIOS_OEM_PARAM_BLOCK_HDR. It also indicates the offset from
     * the beginning of this data structure to where the actual
     * parameter data payload begins.
     */
    U8 hdr_length;
    /**
     * This field contains the version info defining the structure
     * of the OEM Parameter block.
     */
    U8  version;
    /**
     * This field contains a value indicating the preboot initialization
     * method (Option ROM or UEFI driver) so that after OS transition,
     * the OS driver can know the preboot method. OEMs who build a single
     * flash image where the preboot method is unknown at manufacturing
     * time should set this field to SCI_PREBOOT_SOURCE_INIT.  Then
     * after the block is retrieved into host memory and under preboot
     * driver control, the OROM or UEFI driver can set this field
     * appropriately (SCI_PREBOOT_SOURCE_OROM and SCI_PREBOOT_SOURCE_EFI,
     * respectively).
     */
    U8 preboot_source;
    /**
     * This field contains the number of parameter descriptor elements
     * (i.e. controller_elements) following this header.  The number of
     * elements corresponds to the number of SCU controller units contained
     * in the platform:
     *  controller_element[0] = SCU0
     *  controller_element[1] = SCU1
     */
    U8 num_elements;
    /**
     * This field contains the size in bytes of the descriptor element(s)
     * in the block.
     */
    U16 element_length;
    /**
     * Reserve fields for future use.
     */
    U8 reserved[8];

} SCI_BIOS_OEM_PARAM_BLOCK_HDR_T;


/**
 * @struct SCIC_SDS_OEM_PARAMETERS VER 1.0
 *
 * @brief This structure delineates the various OEM parameters that must
 * be set for the Intel SAS Storage Controller Unit (SCU).
 */
typedef struct SCI_BIOS_OEM_PARAM_ELEMENT
{
    /**
     * Per SCU Controller Data
     */
    struct
    {
        /**
         * This field indicates the port configuration mode for
         * this controller:
         *   Automatic Port Configuration(APC) or
         *   Manual Port Configuration (MPC).
         *
         * APC means the Platform OEM expects SCI to configure
         * SAS Ports automatically according to the discovered SAS
         * Address pairs of the endpoints, wide and/or narrow.
         *
         * MPC means the Platform OEM manually defines wide or narrow
         * connectors by apriori assigning PHYs to SAS Ports.
         *
         * By default, the mode type is APC
         * in APC mode, if ANY of the phy mask is non-zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         * in MPC mode, if ALL of the phy masks are zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         */
        U8  mode_type;

        /**
         * This field specifies the maximum number of direct attached
         * devices the OEM will allow to have powered up simultaneously
         * on this controller.  This allows the OEM to avoid exceeding
         * power supply limits for this platform.  A value of zero
         * indicates there are no restrictions.
         */
        U8  max_number_concurrent_device_spin_up;

        /**
         * This field indicates OEM's desired default
         * Spread Spectrum Clocking (SSC) setting for Tx:
         *   enabled     = 1
         *   disabled    = 0
         */
        U8 do_enable_ssc;

        U8 reserved;

    } controller;

    /**
     * Per SAS Port data.
     */
    struct
    {
        /**
         * This field specifies the phys to be contained inside a port.
         * The bit position in the mask specifies the index of the phy
         * to be contained in the port.  Multiple bits (i.e. phys)
        * can be contained in a single port:
        *      Bit 0 = This controller's PHY index 0     (0x01)
        *      Bit 1 = This controller's PHY index 1     (0x02)
        *      Bit 2 = This controller's PHY index 2     (0x04)
        *      Bit 3 = This controller's PHY index 3     (0x08)
        *
        * Refer to the mode_type field for rules regarding APC and MPC mode.
        * General rule: For APC mode phy_mask = 0
        */
        U8 phy_mask;

    } ports[SCI_MAX_PORTS]; // Up to 4 Ports per SCU controller unit

    /**
     * Per PHY Parameter data.
     */
    struct
    {
        /**
         * This field indicates the SAS Address that will be transmitted on
         * this PHY index.  The field is defined as a union, however, the
         * OEM should use the U8 array definition when encoding it to ensure
         * correct byte ordering.
         *
         * NOTE: If using APC MODE, along with phy_mask being set to ZERO, the
         * SAS Addresses for all PHYs within a controller group SHALL be the
         * same.
         */
        union
        {
            /**
             * The array should be stored in little endian order.  For example,
             * if the desired SAS Address is 0x50010B90_0003538D, then it
             * should be stored in the following manner:
             *    array[0] = 0x90
             *    array[1] = 0x0B
             *    array[2] = 0x01
             *    array[3] = 0x50
             *    array[4] = 0x8D
             *    array[5] = 0x53
             *    array[6] = 0x03
             *    array[7] = 0x00
             */
            U8 array[8];
            /**
             * This is the typedef'd version of the SAS Address used in
             * the SCI Library.
             */
            SCI_SAS_ADDRESS_T  sci_format;

        } sas_address;

        /**
         * These are the per PHY equalization settings associated with the
         * AFE XCVR Tx Amplitude and Equalization Control Register Set
         * (0 thru 3).
         *
         * Operational Note: The following Look-Up-Table registers are engaged
         * by the AFE block after the following:
         *  - Software programs the Link Layer AFE Look Up Table Control
         *    Registers (AFE_LUTCR).
         *  - Software sets AFE XCVR Tx Control Register Tx Equalization
         *    Enable bit.
         */
        /**
         * AFE_TX_AMP_CTRL0.  This register is associated with AFE_LUTCR
         * LUTSel=00b. It contains the Tx Equalization settings that will be
         * used if a SATA 1.5Gbs or SATA 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control0;

        /**
         * AFE_TX_AMP_CTRL1.  This register is associated with AFE_LUTCR
         * LUTSel=01b. It contains the Tx Equalization settings that will
         * be used if a SATA 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control1;

        /**
         * AFE_TX_AMP_CTRL2.  This register is associated with AFE_LUTCR
         * LUTSel=10b. It contains the Tx Equalization settings that will
         * be used if a SAS 1.5Gbs or SAS 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control2;

        /**
         * AFE_TX_AMP_CTRL3.  This register is associated with AFE_LUTCR
         * LUTSel=11b. It contains the Tx Equalization settings that will
         * be used if a SAS 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control3;

    } phys[SCI_MAX_PHYS];   // 4 PHYs per SCU controller unit

} SCI_BIOS_OEM_PARAM_ELEMENT_T;

/**
 * @struct SCIC_SDS_OEM_PARAMETERS VER 1.1
 *
 * @brief This structure delineates the various OEM parameters that must
 * be set for the Intel SAS Storage Controller Unit (SCU).
 */
typedef struct SCI_BIOS_OEM_PARAM_ELEMENT_v_1_1
{
    /**
     * Per SCU Controller Data
     */
    struct
    {
        /**
         * This field indicates the port configuration mode for
         * this controller:
         *   Automatic Port Configuration(APC) or
         *   Manual Port Configuration (MPC).
         *
         * APC means the Platform OEM expects SCI to configure
         * SAS Ports automatically according to the discovered SAS
         * Address pairs of the endpoints, wide and/or narrow.
         *
         * MPC means the Platform OEM manually defines wide or narrow
         * connectors by apriori assigning PHYs to SAS Ports.
         *
         * By default, the mode type is APC
         * in APC mode, if ANY of the phy mask is non-zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         * in MPC mode, if ALL of the phy masks are zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         */
        U8  mode_type;

        /**
         * This field specifies the maximum number of direct attached
         * devices the OEM will allow to have powered up simultaneously
         * on this controller.  This allows the OEM to avoid exceeding
         * power supply limits for this platform.  A value of zero
         * indicates there are no restrictions.
         */
        U8  max_number_concurrent_device_spin_up;

        /**
         * This bitfield indicates the OEM's desired default Tx
         * Spread Spectrum Clocking (SSC) settings for SATA and SAS.
         * NOTE: Default SSC Modulation Frequency is 31.5KHz.
         *--------------------------------------------------------------------*/
        /**
         * NOTE: Max spread for SATA is +0 / -5000 PPM.
         * Down-spreading SSC (only method allowed for SATA):
         *  SATA SSC Tx Disabled                    = 0x0
         *  SATA SSC Tx at +0 / -1419 PPM Spread    = 0x2
         *  SATA SSC Tx at +0 / -2129 PPM Spread    = 0x3
         *  SATA SSC Tx at +0 / -4257 PPM Spread    = 0x6
         *  SATA SSC Tx at +0 / -4967 PPM Spread    = 0x7
        */
        U8 ssc_sata_tx_spread_level : 4;

        /**
         * SAS SSC Tx Disabled                     = 0x0
         *
         * NOTE: Max spread for SAS down-spreading +0 / -2300 PPM
         * Down-spreading SSC:
         *  SAS SSC Tx at +0 / -1419 PPM Spread     = 0x2
         *  SAS SSC Tx at +0 / -2129 PPM Spread     = 0x3
         *
         * NOTE: Max spread for SAS center-spreading +2300 / -2300 PPM
         * Center-spreading SSC:
         *  SAS SSC Tx at +1064 / -1064 PPM Spread  = 0x3
         *  SAS SSC Tx at +2129 / -2129 PPM Spread  = 0x6
         */
        U8 ssc_sas_tx_spread_level : 3;
        /**
         * NOTE: Refer to the SSC section of the SAS 2.x Specification
         * for proper setting of this field. For standard SAS Initiator
         * SAS PHY operation it should be 0 for Down-spreading.
         * SAS SSC Tx spread type:
         *  Down-spreading SSC      = 0
         *  Center-spreading SSC    = 1
         */
        U8 ssc_sas_tx_type : 1;
        /*--------------------------------------------------------------------*/

        U8 reserved;

    } controller;

    /**
     * Per SAS Port data.
     */
    struct
    {
        /**
         * This field specifies the phys to be contained inside a port.
         * The bit position in the mask specifies the index of the phy
         * to be contained in the port.  Multiple bits (i.e. phys)
        * can be contained in a single port:
        *      Bit 0 = This controller's PHY index 0     (0x01)
        *      Bit 1 = This controller's PHY index 1     (0x02)
        *      Bit 2 = This controller's PHY index 2     (0x04)
        *      Bit 3 = This controller's PHY index 3     (0x08)
        *
        * Refer to the mode_type field for rules regarding APC and MPC mode.
        * General rule: For APC mode phy_mask = 0
        */
        U8 phy_mask;

    } ports[SCI_MAX_PORTS]; // Up to 4 Ports per SCU controller unit

    /**
     * Per PHY Parameter data.
     */
    struct
    {
        /**
         * This field indicates the SAS Address that will be transmitted on
         * this PHY index.  The field is defined as a union, however, the
         * OEM should use the U8 array definition when encoding it to ensure
         * correct byte ordering.
         *
         * NOTE: If using APC MODE, along with phy_mask being set to ZERO, the
         * SAS Addresses for all PHYs within a controller group SHALL be the
         * same.
         */
        union
        {
            /**
             * The array should be stored in little endian order.  For example,
             * if the desired SAS Address is 0x50010B90_0003538D, then it
             * should be stored in the following manner:
             *    array[0] = 0x90
             *    array[1] = 0x0B
             *    array[2] = 0x01
             *    array[3] = 0x50
             *    array[4] = 0x8D
             *    array[5] = 0x53
             *    array[6] = 0x03
             *    array[7] = 0x00
             */
            U8 array[8];
            /**
             * This is the typedef'd version of the SAS Address used in
             * the SCI Library.
             */
            SCI_SAS_ADDRESS_T  sci_format;

        } sas_address;

        /**
         * These are the per PHY equalization settings associated with the
         * AFE XCVR Tx Amplitude and Equalization Control Register Set
         * (0 thru 3).
         *
         * Operational Note: The following Look-Up-Table registers are engaged
         * by the AFE block after the following:
         *  - Software programs the Link Layer AFE Look Up Table Control
         *    Registers (AFE_LUTCR).
         *  - Software sets AFE XCVR Tx Control Register Tx Equalization
         *    Enable bit.
         */
        /**
         * AFE_TX_AMP_CTRL0.  This register is associated with AFE_LUTCR
         * LUTSel=00b. It contains the Tx Equalization settings that will be
         * used if a SATA 1.5Gbs or SATA 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control0;

        /**
         * AFE_TX_AMP_CTRL1.  This register is associated with AFE_LUTCR
         * LUTSel=01b. It contains the Tx Equalization settings that will
         * be used if a SATA 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control1;

        /**
         * AFE_TX_AMP_CTRL2.  This register is associated with AFE_LUTCR
         * LUTSel=10b. It contains the Tx Equalization settings that will
         * be used if a SAS 1.5Gbs or SAS 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control2;

        /**
         * AFE_TX_AMP_CTRL3.  This register is associated with AFE_LUTCR
         * LUTSel=11b. It contains the Tx Equalization settings that will
         * be used if a SAS 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control3;

    } phys[SCI_MAX_PHYS];   // 4 PHYs per SCU controller unit

} SCI_BIOS_OEM_PARAM_ELEMENT_v_1_1_T;

/**
 * @struct SCIC_SDS_OEM_PARAMETERS VER 1.2
 *
 * @brief This structure delineates the various OEM parameters that must
 * be set for the Intel SAS Storage Controller Unit (SCU).
 */
typedef struct SCI_BIOS_OEM_PARAM_ELEMENT_v_1_2
{
    /**
     * Per SCU Controller Data
     */
    struct
    {
        /**
         * This field indicates the port configuration mode for
         * this controller:
         *   Automatic Port Configuration(APC) or
         *   Manual Port Configuration (MPC).
         *
         * APC means the Platform OEM expects SCI to configure
         * SAS Ports automatically according to the discovered SAS
         * Address pairs of the endpoints, wide and/or narrow.
         *
         * MPC means the Platform OEM manually defines wide or narrow
         * connectors by apriori assigning PHYs to SAS Ports.
         *
         * By default, the mode type is APC
         * in APC mode, if ANY of the phy mask is non-zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         * in MPC mode, if ALL of the phy masks are zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         */
        U8  mode_type;

        /**
         * This field specifies the maximum number of direct attached
         * devices the OEM will allow to have powered up simultaneously
         * on this controller.  This allows the OEM to avoid exceeding
         * power supply limits for this platform.  A value of zero
         * indicates there are no restrictions.
         */
        U8  max_number_concurrent_device_spin_up;

        /**
         * This bitfield indicates the OEM's desired default Tx
         * Spread Spectrum Clocking (SSC) settings for SATA and SAS.
         * NOTE: Default SSC Modulation Frequency is 31.5KHz.
         *--------------------------------------------------------------------*/
        /**
         * NOTE: Max spread for SATA is +0 / -5000 PPM.
         * Down-spreading SSC (only method allowed for SATA):
         *  SATA SSC Tx Disabled                    = 0x0
         *  SATA SSC Tx at +0 / -1419 PPM Spread    = 0x2
         *  SATA SSC Tx at +0 / -2129 PPM Spread    = 0x3
         *  SATA SSC Tx at +0 / -4257 PPM Spread    = 0x6
         *  SATA SSC Tx at +0 / -4967 PPM Spread    = 0x7
        */
        U8 ssc_sata_tx_spread_level : 4;

        /**
         * SAS SSC Tx Disabled                     = 0x0
         *
         * NOTE: Max spread for SAS down-spreading +0 / -2300 PPM
         * Down-spreading SSC:
         *  SAS SSC Tx at +0 / -1419 PPM Spread     = 0x2
         *  SAS SSC Tx at +0 / -2129 PPM Spread     = 0x3
         *
         * NOTE: Max spread for SAS center-spreading +2300 / -2300 PPM
         * Center-spreading SSC:
         *  SAS SSC Tx at +1064 / -1064 PPM Spread  = 0x3
         *  SAS SSC Tx at +2129 / -2129 PPM Spread  = 0x6
         */
        U8 ssc_sas_tx_spread_level : 3;
        /**
         * NOTE: Refer to the SSC section of the SAS 2.x Specification
         * for proper setting of this field. For standard SAS Initiator
         * SAS PHY operation it should be 0 for Down-spreading.
         * SAS SSC Tx spread type:
         *  Down-spreading SSC      = 0
         *  Center-spreading SSC    = 1
         */
        U8 ssc_sas_tx_type : 1;

        /**
         * This field indicates length of the SAS/SATA cable between
         * host and device.
         * This field is used make relationship between analog parameters of
         * the phy in the silicon and length of the cable.
         * Supported length: "short"- up to 3m, "long"- more than 3m
         * This is bit mask field:
         *
         * BIT:           7  6  5  4   3     2     1     0 (LSB)
         * ASSIGNMENT:   <-><-><-><-><phy3><phy2><phy1><phy0>
         *
         * For short cable corresponding bit shall be reset,
         * for long cable shall be set.
         */
        U8 long_cable_selection_mask;

    } controller;

    /**
     * Per SAS Port data.
     */
    struct
    {
        /**
         * This field specifies the phys to be contained inside a port.
         * The bit position in the mask specifies the index of the phy
         * to be contained in the port.  Multiple bits (i.e. phys)
        * can be contained in a single port:
        *      Bit 0 = This controller's PHY index 0     (0x01)
        *      Bit 1 = This controller's PHY index 1     (0x02)
        *      Bit 2 = This controller's PHY index 2     (0x04)
        *      Bit 3 = This controller's PHY index 3     (0x08)
        *
        * Refer to the mode_type field for rules regarding APC and MPC mode.
        * General rule: For APC mode phy_mask = 0
        */
        U8 phy_mask;

    } ports[SCI_MAX_PORTS]; // Up to 4 Ports per SCU controller unit

    /**
     * Per PHY Parameter data.
     */
    struct
    {
        /**
         * This field indicates the SAS Address that will be transmitted on
         * this PHY index.  The field is defined as a union, however, the
         * OEM should use the U8 array definition when encoding it to ensure
         * correct byte ordering.
         *
         * NOTE: If using APC MODE, along with phy_mask being set to ZERO, the
         * SAS Addresses for all PHYs within a controller group SHALL be the
         * same.
         */
        union
        {
            /**
             * The array should be stored in little endian order.  For example,
             * if the desired SAS Address is 0x50010B90_0003538D, then it
             * should be stored in the following manner:
             *    array[0] = 0x90
             *    array[1] = 0x0B
             *    array[2] = 0x01
             *    array[3] = 0x50
             *    array[4] = 0x8D
             *    array[5] = 0x53
             *    array[6] = 0x03
             *    array[7] = 0x00
             */
            U8 array[8];
            /**
             * This is the typedef'd version of the SAS Address used in
             * the SCI Library.
             */
            SCI_SAS_ADDRESS_T  sci_format;

        } sas_address;

        /**
         * These are the per PHY equalization settings associated with the
         * AFE XCVR Tx Amplitude and Equalization Control Register Set
         * (0 thru 3).
         *
         * Operational Note: The following Look-Up-Table registers are engaged
         * by the AFE block after the following:
         *  - Software programs the Link Layer AFE Look Up Table Control
         *    Registers (AFE_LUTCR).
         *  - Software sets AFE XCVR Tx Control Register Tx Equalization
         *    Enable bit.
         */
        /**
         * AFE_TX_AMP_CTRL0.  This register is associated with AFE_LUTCR
         * LUTSel=00b. It contains the Tx Equalization settings that will be
         * used if a SATA 1.5Gbs or SATA 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control0;

        /**
         * AFE_TX_AMP_CTRL1.  This register is associated with AFE_LUTCR
         * LUTSel=01b. It contains the Tx Equalization settings that will
         * be used if a SATA 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control1;

        /**
         * AFE_TX_AMP_CTRL2.  This register is associated with AFE_LUTCR
         * LUTSel=10b. It contains the Tx Equalization settings that will
         * be used if a SAS 1.5Gbs or SAS 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control2;

        /**
         * AFE_TX_AMP_CTRL3.  This register is associated with AFE_LUTCR
         * LUTSel=11b. It contains the Tx Equalization settings that will
         * be used if a SAS 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control3;

    } phys[SCI_MAX_PHYS];   // 4 PHYs per SCU controller unit

} SCI_BIOS_OEM_PARAM_ELEMENT_v_1_2_T;

/**
 * @struct SCIC_SDS_OEM_PARAMETERS VER 1.3
 *
 * @brief This structure delineates the various OEM parameters that must
 * be set for the Intel SAS Storage Controller Unit (SCU).
 */
typedef struct SCI_BIOS_OEM_PARAM_ELEMENT_v_1_3
{
    /**
     * Per SCU Controller Data
     */
    struct
    {
        /**
         * This field indicates the port configuration mode for
         * this controller:
         *   Automatic Port Configuration(APC) or
         *   Manual Port Configuration (MPC).
         *
         * APC means the Platform OEM expects SCI to configure
         * SAS Ports automatically according to the discovered SAS
         * Address pairs of the endpoints, wide and/or narrow.
         *
         * MPC means the Platform OEM manually defines wide or narrow
         * connectors by apriori assigning PHYs to SAS Ports.
         *
         * By default, the mode type is APC
         * in APC mode, if ANY of the phy mask is non-zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         * in MPC mode, if ALL of the phy masks are zero,
         *    SCI_FAILURE_INVALID_PARAMETER_VALUE will be returned
         *      from scic_oem_parameters_set AND the default oem
         *      configuration will be applied
         */
        U8  mode_type;

        /**
         * This field specifies the maximum number of direct attached
         * devices the OEM will allow to have powered up simultaneously
         * on this controller.  This allows the OEM to avoid exceeding
         * power supply limits for this platform.  A value of zero
         * indicates there are no restrictions.
         */
        U8  max_number_concurrent_device_spin_up;

        /**
         * This bitfield indicates the OEM's desired default Tx
         * Spread Spectrum Clocking (SSC) settings for SATA and SAS.
         * NOTE: Default SSC Modulation Frequency is 31.5KHz.
         *--------------------------------------------------------------------*/
        /**
         * NOTE: Max spread for SATA is +0 / -5000 PPM.
         * Down-spreading SSC (only method allowed for SATA):
         *  SATA SSC Tx Disabled                    = 0x0
         *  SATA SSC Tx at +0 / -1419 PPM Spread    = 0x2
         *  SATA SSC Tx at +0 / -2129 PPM Spread    = 0x3
         *  SATA SSC Tx at +0 / -4257 PPM Spread    = 0x6
         *  SATA SSC Tx at +0 / -4967 PPM Spread    = 0x7
        */
        U8 ssc_sata_tx_spread_level : 4;

        /**
         * SAS SSC Tx Disabled                     = 0x0
         *
         * NOTE: Max spread for SAS down-spreading +0 / -2300 PPM
         * Down-spreading SSC:
         *  SAS SSC Tx at +0 / -1419 PPM Spread     = 0x2
         *  SAS SSC Tx at +0 / -2129 PPM Spread     = 0x3
         *
         * NOTE: Max spread for SAS center-spreading +2300 / -2300 PPM
         * Center-spreading SSC:
         *  SAS SSC Tx at +1064 / -1064 PPM Spread  = 0x3
         *  SAS SSC Tx at +2129 / -2129 PPM Spread  = 0x6
         */
        U8 ssc_sas_tx_spread_level : 3;
        /**
         * NOTE: Refer to the SSC section of the SAS 2.x Specification
         * for proper setting of this field. For standard SAS Initiator
         * SAS PHY operation it should be 0 for Down-spreading.
         * SAS SSC Tx spread type:
         *  Down-spreading SSC      = 0
         *  Center-spreading SSC    = 1
         */
        U8 ssc_sas_tx_type : 1;

        /**
         * This field indicates length of the SAS/SATA cable between
         * host and device.
         * This field is used make relationship between analog parameters of
         * the phy in the silicon and length of the cable.
         * Supported cable attenuation levels:
         * "short"- up to 3m, "medium"-3m to 6m, and "long"- more than 6m
         * This is bit mask field:
         *
         * BIT:      (MSB) 7     6     5     4
         * ASSIGNMENT:   <phy3><phy2><phy1><phy0>  - Medium cable length assignment
         * BIT:            3     2     1     0  (LSB)
         * ASSIGNMENT:   <phy3><phy2><phy1><phy0>  - Long cable length assignment
         *
         * BITS 7-4 are set when the cable length is assigned to medium
         * BITS 3-0 are set when the cable length is assigned to long
         * The BIT positions are clear when the cable length is assigned to short
         * Setting the bits for both long and medium cable length is undefined.
         *
         * A value of 0x84 would assign
         *    phy3 - medium
         *    phy2 - long
         *    phy1 - short
         *    phy0 - short
         */
        U8 cable_selection_mask;

    } controller;

    /**
     * Per SAS Port data.
     */
    struct
    {
        /**
         * This field specifies the phys to be contained inside a port.
         * The bit position in the mask specifies the index of the phy
         * to be contained in the port.  Multiple bits (i.e. phys)
        * can be contained in a single port:
        *      Bit 0 = This controller's PHY index 0     (0x01)
        *      Bit 1 = This controller's PHY index 1     (0x02)
        *      Bit 2 = This controller's PHY index 2     (0x04)
        *      Bit 3 = This controller's PHY index 3     (0x08)
        *
        * Refer to the mode_type field for rules regarding APC and MPC mode.
        * General rule: For APC mode phy_mask = 0
        */
        U8 phy_mask;

    } ports[SCI_MAX_PORTS]; // Up to 4 Ports per SCU controller unit

    /**
     * Per PHY Parameter data.
     */
    struct
    {
        /**
         * This field indicates the SAS Address that will be transmitted on
         * this PHY index.  The field is defined as a union, however, the
         * OEM should use the U8 array definition when encoding it to ensure
         * correct byte ordering.
         *
         * NOTE: If using APC MODE, along with phy_mask being set to ZERO, the
         * SAS Addresses for all PHYs within a controller group SHALL be the
         * same.
         */
        union
        {
            /**
             * The array should be stored in little endian order.  For example,
             * if the desired SAS Address is 0x50010B90_0003538D, then it
             * should be stored in the following manner:
             *    array[0] = 0x90
             *    array[1] = 0x0B
             *    array[2] = 0x01
             *    array[3] = 0x50
             *    array[4] = 0x8D
             *    array[5] = 0x53
             *    array[6] = 0x03
             *    array[7] = 0x00
             */
            U8 array[8];
            /**
             * This is the typedef'd version of the SAS Address used in
             * the SCI Library.
             */
            SCI_SAS_ADDRESS_T  sci_format;

        } sas_address;

        /**
         * These are the per PHY equalization settings associated with the
         * AFE XCVR Tx Amplitude and Equalization Control Register Set
         * (0 thru 3).
         *
         * Operational Note: The following Look-Up-Table registers are engaged
         * by the AFE block after the following:
         *  - Software programs the Link Layer AFE Look Up Table Control
         *    Registers (AFE_LUTCR).
         *  - Software sets AFE XCVR Tx Control Register Tx Equalization
         *    Enable bit.
         */
        /**
         * AFE_TX_AMP_CTRL0.  This register is associated with AFE_LUTCR
         * LUTSel=00b. It contains the Tx Equalization settings that will be
         * used if a SATA 1.5Gbs or SATA 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control0;

        /**
         * AFE_TX_AMP_CTRL1.  This register is associated with AFE_LUTCR
         * LUTSel=01b. It contains the Tx Equalization settings that will
         * be used if a SATA 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control1;

        /**
         * AFE_TX_AMP_CTRL2.  This register is associated with AFE_LUTCR
         * LUTSel=10b. It contains the Tx Equalization settings that will
         * be used if a SAS 1.5Gbs or SAS 3.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control2;

        /**
         * AFE_TX_AMP_CTRL3.  This register is associated with AFE_LUTCR
         * LUTSel=11b. It contains the Tx Equalization settings that will
         * be used if a SAS 6.0Gbs device is direct-attached.
         */
        U32 afe_tx_amp_control3;

    } phys[SCI_MAX_PHYS];   // 4 PHYs per SCU controller unit

} SCI_BIOS_OEM_PARAM_ELEMENT_v_1_3_T;

/**
 *  @struct SCI_BIOS_OEM_PARAM_BLOCK
 *
 * @brief This structure defines the OEM Parameter block as it will be stored
 *  in the last 512 bytes of the PDR region in the SPI flash.  It must be
 *  unpacked or pack(1).
 */
typedef struct SCI_BIOS_OEM_PARAM_BLOCK
{
    /**
     * OEM Parameter Block header.
     */
    SCI_BIOS_OEM_PARAM_BLOCK_HDR_T  header;

    /**
     * Per controller element descriptor containing the controller's
     * parameter data. The prototype defines just one of these descriptors,
     * however, the actual runtime number is determined by the num_elements
     * field in the header.
     */
    SCI_BIOS_OEM_PARAM_ELEMENT_T controller_element[1];

} SCI_BIOS_OEM_PARAM_BLOCK_T;

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // _SCU_BIOS_DEFINITIONS_H_