Files @ 2ee8c8344ccb
Branch filter:

Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public/generic/release/scsi/vmkapi_scsi_types.h

unknown
ESXi-6.0-U1a
   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
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
/***************************************************************************
 * Copyright 2004 - 2012 VMware, Inc.  All rights reserved.
 ***************************************************************************/

/*
 * @VMKAPIMOD_LICENSE@
 */

/*
 ***********************************************************************
 * SCSI-specific types                                            */ /**
 * \addtogroup SCSI
 * @{
 *
 * \defgroup SCSItypes SCSI Types
 * @{
 ***********************************************************************
 */

#ifndef _VMKAPI_SCSI_TYPES_H_
#define _VMKAPI_SCSI_TYPES_H_

/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */

#include "core/vmkapi_dma.h"
#include "scsi/vmkapi_scsi_ext.h"
#include "scsi/vmkapi_scsi_mgmt_types.h"

#define VMK_SECTOR_SIZE 512

/**
 * \brief SCSI second-level lun id.
 */
typedef vmk_uint64 vmk_ScsiSecondLevelId;

/**
 * \brief Invalid SCSI second-level lun id.
 */
#define VMK_SCSI_INVALID_SECONDLEVEL_ID   ((vmk_ScsiSecondLevelId)-1)

/**
 * \brief configured SCSI system limits
 */
typedef struct vmk_ScsiSystemLimits {
   vmk_uint32     maxDevices;
   vmk_uint32     maxPaths;
   vmk_VA   pad[3];
} vmk_ScsiSystemLimits;

/**
 * \brief Fixed format sense data structure maintained in each SCSI device
 * SPC 3 r23, Section 4.5.3 table 26
 *
 * NB: The "valid" bit in the data structure does NOT tell whether the sense is
 * actually valid and thus the name is really badly chosen (even though it is
 * the official name from the SCSI II specification).  The SCSI II spec.
 * states "A valid bit of zero indicates that the information field is not as
 * defined in this International Standard".  we have seen that many tape drives
 * are capable of returning sense without this bit set
 */
typedef struct vmk_ScsiSenseData {
   /** \brief error type and format of sense data (see SPC 3 r23, Sec. 4.5.1) */
   vmk_uint8 error         :7,
/** \brief sense data is for "current command" */
#define VMK_SCSI_SENSE_ERROR_CURCMD  0x70
/** \brief sense data is for an earlier command */
#define VMK_SCSI_SENSE_ERROR_PREVCMD 0x71
   /** \brief set to one indicates the 'info' field is valid */
             valid         :1;
   /** \brief obsolete */
   vmk_uint8 segment;
   /** \brief generic information describing the error or exception condition */
   vmk_uint8 key           :4,
                           :1,
   /** \brief see above spc section */
             ili           :1,
   /** \brief see above spc section */
             eom           :1,
   /** \brief see above spc section */
             filmrk        :1;
   /** \brief see above spc section */
   vmk_uint8 info[4];
   /** \brief see above spc section */
   vmk_uint8 optLen;
   /** \brief see above spc section */
   vmk_uint8 cmdInfo[4];
   /** \brief further information about to the condition reported in 'key' */
   vmk_uint8 asc;
   /** \brief detailed information about to the additional sense code in 'asc' */
   vmk_uint8 ascq;
   /** \brief Field Replacable Unit code (see SPC 3 r23, 4.5.2.5) */
   vmk_uint8 fru;
   /** \brief Sense-key specific fields (see SPC 3 r23, 4.5.2.4) */
   vmk_uint8 bitpos        :3,
             bpv           :1,
                           :2,
             cd            :1,
   /** \brief Set to indicate sense-key specific fields are valid */
             sksv          :1;
   /** \brief field indicates which byte of the CDB or param data was in error */
   vmk_uint16 epos;

   /**
    * \brief may contain vendor specific data further defining exception cond.
    *
    * Some vendors want to return additional data which
    * requires a sense buffer of up to 64 bytes.
    *
    * See SPC 3 r23, Section 4.5
    */
   vmk_uint8 additional[46];
} VMK_ATTRIBUTE_PACKED vmk_ScsiSenseData;

/*
 * Default SCSI fixed format sense data structure without any additional data.
 */

typedef struct vmk_ScsiSenseDataSimple {
   union {
      struct {
         /** \brief error type and format of sense data (see SPC 3 r23,
          *         Sec. 4.5.1)
          */
         vmk_uint8 error         :7,
         /** \brief set to one indicates the 'info' field is valid */
                   valid         :1;
         /** \brief obsolete */
         vmk_uint8 segment;
         /** \brief generic information describing the error or exception
          *         condition
          */
         vmk_uint8 key           :4,
                                 :1,
         /** \brief see above spc section */
                   ili           :1,
         /** \brief see above spc section */
                   eom           :1,
         /** \brief see above spc section */
                   filmrk        :1;
         /** \brief see above spc section */
         vmk_uint8 info[4];
         /** \brief see above spc section */
         vmk_uint8 optLen;
         /** \brief see above spc section */
         vmk_uint8 cmdInfo[4];
         /** \brief further information about to the condition reported in
          *         'key'
          */
         vmk_uint8 asc;
         /** \brief detailed information about to the additional sense code
          *         in 'asc'
          */
         vmk_uint8 ascq;
         /** \brief Field Replacable Unit code (see SPC 3 r23, 4.5.2.5) */
         vmk_uint8 fru;
         /** \brief Sense-key specific fields (see SPC 3 r23, 4.5.2.4) */
         vmk_uint8 bitpos        :3,
                   bpv           :1,
                                 :2,
                   cd            :1,
         /** \brief Set to indicate sense-key specific fields are valid */
                   sksv          :1;
         /** \brief field indicates which byte of the CDB or param data was in
          *         error
          */
         vmk_uint16 epos;
      } VMK_ATTRIBUTE_PACKED fixed; /* fixed format sense data */
      struct {
         vmk_uint8 error         :7,
                                 :1;
         vmk_uint8 key           :4,
                                 :4;
         vmk_uint8 asc;
         vmk_uint8 ascq;
         vmk_uint8 reserved[3];
         vmk_uint8 optLen;
         vmk_uint8 additional[10];
      } VMK_ATTRIBUTE_PACKED descriptor; /* descriptor format sense data */
      struct {
         vmk_uint8 senseData[18];
      } VMK_ATTRIBUTE_PACKED byte; /* byte-stream sense data */
   } format;
} vmk_ScsiSenseDataSimple;

/**
 * \brief Description Type field
 *  SPC 4 r33, Section 4.5.2.1 table 27
 */
#define VMK_SCSI_SENSE_DESCRIPTOR_TYPE_INFORMATION                    0x0
#define VMK_SCSI_SENSE_DESCRIPTOR_TYPE_COMMAND_SPECIFIC_INFIRMATION   0x1
#define VMK_SCSI_SENSE_DESCRIPTOR_TYPE_SENSE_KEY_SPECIFIC             0x2
#define VMK_SCSI_SENSE_DESCRIPTOR_TYPE_FIELD_REPLACABLE_UNIT          0x3
#define VMK_SCSI_SENSE_DESCRIPTOR_TYPE_ATA_STATUS_RETURN              0x9

/**
 * \brief SCSI Device event handler callback entry
 *
 * This function is called when a registered device
 * event occurs. This function can consume the event
 * or ignore it.
 * 
 * \note  This function must not block.
 *
 * \param[in]  clientData  Client specific data.
 * \param[in]  parm        Parameter of the callback handler.
 * \param[in]  eventType   Type of the event which occured.
 *
 */
typedef void (*vmk_ScsiEventHandlerCbk) (vmk_AddrCookie clientData,
                                         vmk_AddrCookie parm,
                                         vmk_uint32 eventType);

/*
 * Commands
 */

/**
 * \brief SCSI command ID
 */

typedef struct vmk_ScsiCommandId {
   /** \brief unique token of originator of cmd */
   void                        *initiator;
   /** \brief unique serial of cmd */
   vmk_uint64                serialNumber;
} vmk_ScsiCommandId;

struct vmk_ScsiCommand;

typedef void (*vmk_ScsiCommandDoneCbk)(struct vmk_ScsiCommand *cmd);

/**
 * \brief Flag definitions for vmk_ScsiCommand.flags field.
 *
 */
typedef enum {
   /**
    * \brief Command requests Use of Head-of-Q tag.
    *
    * This instructs the lower level drivers to issue this command
    * with Head-of-Queue tag if full task management model is
    * supported by the target else it can be ignored. This is a
    * best-effort flag and its effectiveness is determined by
    * how it is implemented by the underlying driver/devices.
    *
    * \note This is a SCSI target flag and is not used to prioritize
    * I/Os in the internal queues, use
    * VMK_SCSI_COMMAND_FLAGS_USE_PRIORITY_QUEUE for the latter.
    */
   VMK_SCSI_COMMAND_FLAGS_ISSUE_WITH_HEAD_OF_Q_TAG = 0x00020000,
   /**
    * \brief Command requests Use of ORDERED tag.
    *
    * This instructs the lower level drivers to issue this command
    * with ORDERED tag if tagged queuing is being used. If tagged
    * queuing is not in effect for the target, it can be ignored.
    * This is a best-effort flag and its effectiveness is determined
    * by how it is implemented by the underlying driver/devices.
    */
   VMK_SCSI_COMMAND_FLAGS_ISSUE_WITH_ORDERED_TAG  = 0x00010000,
   /**
    * \brief Command is reservation sensitive.
    *
    * If a command has the VMK_SCSI_COMMAND_FLAGS_RESERVATION_SENSITIVE
    * flag set, the plugin should _not_ retry the IO upon failure.
    */
   VMK_SCSI_COMMAND_FLAGS_RESERVATION_SENSITIVE   = 0x00008000,
   /**
    * \brief Command was issued to probe if a device supports it.
    *
    * This should be treated as hint for plugins to not log if these
    * IOs fail with a "not supported" SCSI error status.
    */
   VMK_SCSI_COMMAND_FLAGS_PROBE_FOR_SUPPORT       = 0x00002000,
   /**
    * \brief IO is treated as high priority on internal queues.
    *
    * \note This is not used by drivers/devices to prioritize the
    * I/O at the target. For this use
    * VMK_SCSI_COMMAND_FLAGS_ISSUE_WITH_HEAD_OF_Q_TAG.
    */
   VMK_SCSI_COMMAND_FLAGS_USE_PRIORITY_QUEUE      = 0x00001000,
   /**
    * \brief Fail IO with "no-connect" if device is all-paths-dead.
    *
    * Instructs an MP Plugin to fail the I/O with a
    * VMK_SCSI_HOST_NO_CONNECT host status if it finds that a
    * vmk_ScsiDevice is in an all-paths-dead condition.
    *
    * Normally an MP Plugin should keep retrying the I/O until a path
    * becomes available or it receives a task management abort or
    * reset request.
    */
   VMK_SCSI_COMMAND_FLAGS_NO_CONNECT_IF_APD       = 0x00000800,
   /**
    * \brief Command is issued by a VM that is a guest cluster node.
    *
    * A Cluster may use SCSI reservation as a mechanism to determine
    * node membership. As a result, a VM cluster is particularly
    * sensitive to RESERVATION CONFLICT command status.
    *
    * The MP Plugin must ensure that the VM never sees incorrect
    * reservation conflicts - e.g. reservation conflicts that arise
    * during failover as paths are switched. Further, it must ensure
    * that I/Os are never retried on (correct) reservation
    * conflicts. So, the guest should see all genuine reservation
    * conflicts from the device (e.g. ones caused by the other nodes
    * in the VM cluster), but not any other ones.
    */
   VMK_SCSI_COMMAND_FLAGS_VM_CLUSTER              = 0x00000400,
   /**
    * \brief Indicator of a swap IO that is used to swap memory to disk.
    *
    * The swap IOs help relieve memory pressure on the system.
    * So system should identify them and prioritize them if possible.
    */
   VMK_SCSI_COMMAND_FLAGS_SWAP_IO                 = 0x00000200,
} /** \cond nodoc */ VMK_ATTRIBUTE_PACKED VMK_ATTRIBUTE_ALIGN(1) /* \endcond*/
vmk_ScsiCommandFlags;


/**
 * \brief T10 SCSI target protection types
 *
 * These protection types are also known as DIF (Data Integrity Field)
 * device protection types.
 *
 * SBC 3 r35, Section 4.22.
 */
typedef enum vmk_ScsiTargetProtTypes {
   /** \brief See above sbc section */
   VMK_SCSI_TARGET_PROT_TYPE_0 = 0,
   /** \brief See above sbc section */
   VMK_SCSI_TARGET_PROT_TYPE_1,
   /** \brief See above sbc section */
   VMK_SCSI_TARGET_PROT_TYPE_2,
   /** \brief See above sbc section */
   VMK_SCSI_TARGET_PROT_TYPE_3,
   /** \brief Count of protection types */
   VMK_SCSI_TARGET_PROT_TYPE_MAX,
} vmk_ScsiTargetProtTypes;


/**
 * \brief SCSI command protection operation types
 *
 *  The protection operation types are a power of 2 in order to support
 *  bi-directional commands that can have data flow in both directions
 *  in the same SCSI command.
 */
typedef enum vmk_ScsiCommandProtOps {
   /**
    * \brief Normal protection for a SCSI command.
    *
    * No extra protection is given for a SCSI command than what is normally
    * provided by the transport.
    */
   VMK_SCSI_COMMAND_PROT_NORMAL = (1 << 0),
   /**
    * \brief Protection enabled from HBA to OS for READ SCSI commands.
    *
    * For adapters that do not support target device protection type, this
    * protection type indicates protection is enabled from HBA to OS only.
    * The HBA generates protection data for READ SCSI commands.
    */
   VMK_SCSI_COMMAND_PROT_READ_INSERT = (1 << 1),
   /**
    * \brief Protection enabled from HBA to OS for WRITE SCSI commands.
    *
    * For adapters that do not support target protection type, this type
    * indicates protection data is enabled from HBA to OS for WRITE commands.
    * The HBA strips off the protection data before sending it to the target.
    */
   VMK_SCSI_COMMAND_PROT_WRITE_STRIP = (1 << 2),
   /**
    * \brief Protection enabled from HBA to target for READ SCSI commands.
    *
    * For adapters that do not support DIX, this type indicates protection data
    * is enabled from HBA to target for READ commands. The HBA strips off
    * protection data in the SCSI command and hands it to the storage stack.
    */
   VMK_SCSI_COMMAND_PROT_READ_STRIP = (1 << 3),
   /**
    * \brief Protection enabled from HBA to target for WRITE SCSI commands.
    *
    * For adapters that do not support DIX, this type indicates protection data
    * is enabled from HBA to target only for WRITE commands. The HBA adds
    * protection data and sends it to the target.
    */
   VMK_SCSI_COMMAND_PROT_WRITE_INSERT = (1 << 4),
   /**
    * \brief No change in protection for READ SCSI commands.
    *
    * This type indicates full support of protection data from OS to the target.
    */
   VMK_SCSI_COMMAND_PROT_READ_PASS = (1 << 5),
   /**
    * \brief No change in protection for WRITE SCSI commands.
    *
    * This type indicates full support of protection data from OS to the target.
    */
   VMK_SCSI_COMMAND_PROT_WRITE_PASS = (1 << 6),
   /** \brief Count of SCSI command protection operations */
   VMK_SCSI_COMMAND_PROT_MAX = (1 << 7),
} vmk_ScsiCommandProtOps;


/**
 * \brief Mask of all valid SCSI command protection operation types.
 */
#define VMK_SCSI_COMMAND_PROT_ALL_VALID (VMK_SCSI_COMMAND_PROT_MAX - 1)

#define VMK_SCSI_MAX_CDB_LEN        16
#define VMK_SCSI_MAX_SENSE_DATA_LEN 64

/**
 * \brief SCSI command structure
 */
typedef struct vmk_ScsiCommand {
   /** \brief Command completion callback for async IO. */
   vmk_ScsiCommandDoneCbk       done;
   /** \brief Command completion callback argument for async IO. */
   void                         *doneData;
   /**
    * \brief Scatter/gather array representing the machine-address ranges
    *        associated with the IO buffer.
    */
   vmk_SgArray                  *sgArray;
   /** \brief Hint indicating the direction of data transfer */
   vmk_ScsiCommandDirection     dataDirection;
   /** \brief Command flags, see above */
   vmk_uint32                   flags;
   /** \brief Hint indicating whether a cmd is a read IO */
   vmk_Bool                     isReadCdb;
   /** \brief Hint indicating whether a cmd is a write IO */
   vmk_Bool                     isWriteCdb;
   /** \brief Reserved */
   vmk_uint8                    reserved1[2];
   /**
    * \brief Minimum data transfer length.
    *
    * Must be <= vmk_SgGetDataLen(sgArray).
    */
   vmk_ByteCountSmall           requiredDataLen;
   /** \brief WorldId of the world on behalf of whom cmd is issued. */
   vmk_uint32                   worldId;
   /**
    * \brief Number of blocks to be transferred.
    *
    * Only valid for when isReadCdb or isWriteCdb are set.
    */
   vmk_uint32                   lbc;
   /**
    * \brief address of first block to be xfer'd
    *
    * Only valid for isReadCdb or isWriteCdb.
    */
   vmk_uint64                   lba;
   /**
    * \brief Number of milliseconds since system boot before
    *        the command times out.
    *
    *   0 indicates the cmd will not be timed out.
    *
    *   A nonzero value indicates the system time beyond which the storage
    *   framework will issue an abort task management request and fail
    *   the IO with a timeout status.
    */
   vmk_uint64                   absTimeoutMs;
   /** \brief Unique tag for this command. */
   vmk_ScsiCommandId            cmdId;
   /** \brief SCSI command descriptor block. */
   vmk_uint8                    cdb[VMK_SCSI_MAX_CDB_LEN];
   /**
    * \brief Number of valid bytes in cdb.
    *
    *  Must be <= VMK_SCSI_MAX_CDB_LEN
    */
   vmk_ByteCountSmall           cdbLen;
   /** \brief Command completion status. */
   vmk_ScsiCmdStatus            status;
   /** \brief Number of bytes transferred to or from the data buffer. */
   vmk_ByteCountSmall           bytesXferred;

   /**
    * \deprecated Do not use in Native Drivers
    * \brief Worldlet ID that submitted the command, if any.
    */
   vmk_WorldletID               worldletId;
   /**
    * \brief Scatter/gather array representing the IO-address ranges
    *        associated with the IO buffer.
    *
    * \note Sometimes this will be the same as sgArray but other
    *       times it will be different. Do not rely on the contents
    *       of sgIOArray and sgArray being identical.
    */
   vmk_SgArray                  *sgIOArray;
   /**
    * \brief SCSI sense data.
    *
    * \deprecated This structure member is being deprecated.
    * Consumers of this field should rely on the APIs
    * vmk_ScsiCmd{Get,Set,Clear}SenseData() and
    * vmk_ScsiGetSupportedCmdSenseDataSize().
    *
    * Only valid if vmk_ScsiCmdStatusIsCheck(cmd->status).
    * Do not add any fields below this member.
    */
   vmk_ScsiSenseData            senseData;
   /** \brief Reserved. */
   vmk_VA                 reserved2[2];
} vmk_ScsiCommand;

/**
 * \brief SCSI task management action
 */
typedef enum {
   VMK_SCSI_TASKMGMT_ACTION_IGNORE          = 0,
   VMK_SCSI_TASKMGMT_ACTION_ABORT           = 1,
} vmk_ScsiTaskMgmtAction;

/**
 * \brief Used to abort all commands, regardless of initiator and s/n
 */
#define VMK_SCSI_TASKMGMT_ANY_INITIATOR (void*)0xA11

/**
 * \brief SCSI task management
 */
typedef struct vmk_ScsiTaskMgmt {
   /** \brief magic */
   vmk_uint32               magic;
   /** \brief task mgmt type */
   vmk_ScsiTaskMgmtType     type;
   /** \brief command status */
   vmk_ScsiCmdStatus        status;
   /** \brief cmdId of the cmd to abort.  cmdId.serialNumber is only
    * applicable for VMK_SCSI_TASKMGMT_ABORT and ignored for all
    * other vmk_ScsiTaskMgmtType values.  cmdId.initiator is only
    * applicable for VMK_SCSI_TASKMGMT_ABORT and
    * VMK_SCSI_TASKMGMT_VIRT_RESET, ignored for all other
    * vmk_ScsiTaskMgmtType values
    */
   vmk_ScsiCommandId        cmdId;
   /** \brief worldId of the cmd(s) to abort.  only applicable for
    * VMK_SCSI_TASKMGMT_ABORT and VMK_SCSI_TASKMGMT_VIRT_RESET, ignored
    * for all other vmk_ScsiTaskMgmtType values
    */
   vmk_uint32               worldId;
} vmk_ScsiTaskMgmt;

/*
 * SCSI Adapter
 */

/**
 * \brief Don't care value for 'hostMaxSectors'.
 */
#define VMK_SCSI_HOST_MAX_SECTORS_IGNORE 0xFFFF

/**
 * \brief actions the 'discover' function can execute
 */
typedef enum vmk_ScanAction {
   /** Create a path to the named LUN */
   VMK_SCSI_SCAN_CREATE_PATH,
   /** Keep a previously created path to the named LUN */
   VMK_SCSI_SCAN_CONFIGURE_PATH,
   /** Destroy the path to the named LUN */
   VMK_SCSI_SCAN_DESTROY_PATH,
} vmk_ScanAction;

/**
 * \brief bitmasks for adapter events
 *
 * Events are bit fields because users can
 * wait for multiple events
 *
 */
typedef enum vmk_ScsiAdapterEvents {
   VMK_SCSI_ADAPTER_EVENT_FC_LOOP_UP                = 0x00000001,
   VMK_SCSI_ADAPTER_EVENT_FC_LOOP_DOWN              = 0x00000002,
   VMK_SCSI_ADAPTER_EVENT_FC_RSCN                   = 0x00000004,
   VMK_SCSI_ADAPTER_EVENT_FC_NEW_TARGET             = 0x00000008,
   VMK_SCSI_ADAPTER_EVENT_FC_REMOVED_TARGET         = 0x00000010,
   VMK_SCSI_ADAPTER_EVENT_FC_NEW_VPORT              = 0x00000020,
   VMK_SCSI_ADAPTER_EVENT_FC_REMOVED_VPORT          = 0x00000040,
   VMK_SCSI_ADAPTER_EVENT_HOT_PLUG_ADD              = 0x00000080,
   VMK_SCSI_ADAPTER_EVENT_HOT_PLUG_REMOVE           = 0x00000100,
   VMK_SCSI_ADAPTER_EVENT_FC_TARGET_SCAN_DONE       = 0x00000200,
} vmk_ScsiAdapterEvents;

   /** \brief Event handler callback entry */
typedef void (*vmk_EventHandlerCbk) (void *clientData, vmk_uint32 eventType);

/**
 * \brief bitmasks for flags field of SCSI adapter
 *
 * Through this flags, give vmkernel information how handle the adapter.
 *
 */
typedef enum vmk_ScsiAdapterFlags {
   /** \deprecated Legacy from Console-OS based shared block adapters */
   VMK_SCSI_ADAPTER_FLAG_BLOCK                   = 0x00000001,
   /**
    * \deprecated Do not use in Native Drivers
    * This adapter is an NPIV VPORT */
   VMK_SCSI_ADAPTER_FLAG_NPIV_VPORT              = 0x00000002,
   /** Do not scan when registering this adapter */
   VMK_SCSI_ADAPTER_FLAG_REGISTER_WITHOUT_SCAN   = 0x00000004,
   /** Do not scan periodically */
   VMK_SCSI_ADAPTER_FLAG_NO_PERIODIC_SCAN        = 0x00000008,
   /** Ok to probe periodically, but no adapter rescan */
   VMK_SCSI_ADAPTER_FLAG_NO_ADAPTER_RESCAN       = 0x00000010,
   /**
    * \deprecated Do not use in Native Drivers
    * This adapter is a Legacy NPIV VPORT */
   VMK_SCSI_ADAPTER_FLAG_NPIV_LEGACY_VPORT       = 0x00000020,
} vmk_ScsiAdapterFlags;


/**
 * \brief bitmask for supported guard types
 *
 * Used to set default guard type for SCSI Adapter and is used by the OS to
 * determine guard type to be used for SCSI commands.
 */
typedef enum vmk_ScsiGuardTypes {
   /** \brief Supports T10 CRC checksumming */
   VMK_SCSI_GUARD_CRC = (1 << 0),
   /** \brief Supports IP checksumming */
   VMK_SCSI_GUARD_IP  = (1 << 1),
   /** \brief Max value of guard type */
   VMK_SCSI_GUARD_MAX = (1 << 2),
} vmk_ScsiGuardTypes;

/**
 * \brief Mask of all valid SCSI DIX Guard Types.
 */
#define VMK_SCSI_GUARD_TYPE_ALL_VALID  (VMK_SCSI_GUARD_MAX - 1)

/**
 * \brief bitmasks for SCSI data protection types
 *
 * Used to set supported protection types for SCSI adapter.
 */
typedef enum vmk_ScsiProtTypes {
   /** \brief Type 1 Protection */
   VMK_SCSI_TYPE1_PROT = (1 << 0),
   /** \brief Type 2 Protection */
   VMK_SCSI_TYPE2_PROT = (1 << 1),
   /** \brief Type 3 Protection */
   VMK_SCSI_TYPE3_PROT = (1 << 2),
   /** \brief DIX with Type 0 Protection */
   VMK_SCSI_DIX_TYPE0_PROT = (1 << 3),
   /** \brief DIX with Type 1 Protection */
   VMK_SCSI_DIX_TYPE1_PROT = (1 << 4),
   /** \brief DIX with Type 2 Protection */
   VMK_SCSI_DIX_TYPE2_PROT = (1 << 5),
   /** \brief DIX with Type 3 Protection */
   VMK_SCSI_DIX_TYPE3_PROT = (1 << 6),
   /** \brief Max value of protection types  */
   VMK_SCSI_PROT_TYPE_MAX = (1 << 7),
} vmk_ScsiProtTypes;


/**
 * \brief Mask of all valid SCSI Data Protection Types.
 */
#define VMK_SCSI_PROT_TYPE_ALL_VALID \
               (VMK_SCSI_PROT_TYPE_MAX - 1)


/**
 * \brief Adapter capabilities mask
 *
 * Capabilities of a SCSI adapter. The driver can set capability with a call
 * to vmk_ScsiAdapterSetCapabilities().
 */
typedef vmk_uint32 vmk_ScsiAdapterCapabilitiesMask;

/**
 * \brief bitmasks for SCSI adapter capabilities
 *
 * Used to set capabilities of SCSI adapter.
 */
typedef enum vmk_ScsiAdapterCapabilities {
   /** \brief Supports second-level addressing */
   VMK_SCSI_ADAPTER_CAP_SECONDLEVEL_ADDRESSING = (1 << 0),
   /** \brief Supports data integrity */
   VMK_SCSI_ADAPTER_CAP_DATA_INTEGRITY         = (1 << 1),
   /** \brief Driver provides own completion worlds */
   VMK_SCSI_ADAPTER_CAP_DRIVER_COMPL_WORLDS    = (1 << 2),
   /** \brief Max value of adapter capabilities */
   VMK_SCSI_ADAPTER_CAP_MAX = (1 << 3),
} vmk_ScsiAdapterCapabilities;


/**
 * \brief Mask of all valid SCSI Adapter capabilities.
 */
#define VMK_SCSI_ADAPTER_CAP_ALL_VALID (VMK_SCSI_ADAPTER_CAP_MAX - 1)

/*
 ***********************************************************************
 * vmk_ScsiAdapterCommand --                                      */ /**
 *
 * \brief Queue a SCSI command on the adapter and LUN specified.
 *
 * Perform the command passed in 'cmd' on the adapter passed in
 * 'clientData' on the LUN passed in 'deviceData'.
 *
 * \note Required function pointer
 *
 * \param[in]  clientData  Handle to the adapter to perform the
 *                         comand on.
 * \param[in]  cmd         Pointer to the command to execute.
 * \param[in]  deviceData  Pointer to deviceData returned by 'discover'
 *                         Create path.
 *
 * \retval VMK_WOULD_BLOCK cmd not queued because of Queue Depth limit
 *                         or device was quiesced.
 * \retval VMK_NO_MEMORY   Out of memory.
 * \retval VMK_OK          Success - cmd queued or will be completed
 *                         with error.
 *
 ***********************************************************************
 */
typedef VMK_ReturnStatus (*vmk_ScsiAdapterCommand)(void *clientData,
                                                   struct vmk_ScsiCommand *cmd,
                                                   void *deviceData);

/*
 ***********************************************************************
 * vmk_ScsiAdapterTaskMgmt --                                     */ /**
 *
 * \brief Perform a SCSI task management command on the adapter and
 *        LUN specified.
 *
 * Perform the task management command passed in 'taskMgmt' on the
 * adapter passed in 'clientData' (if applicable) and on the LUN
 * passed in 'deviceData'.
 *
 * \note Required function pointer
 *
 * \param[in]  clientData  Handle to the adapter to perform the task
 *                         management action on.
 * \param[in]  taskMgmt    Pointer to the task management command to
 *                         be executed.
 * \param[in]  deviceData  Pointer to deviceData returned by 'discover'
 *                         Create.
 *
 * \retval VMK_FAILURE   Task management command failed.
 * \retval VMK_NO_MEMORY Out of memory.
 * \retval VMK_OK        Success.
 *
 ***********************************************************************
 */
typedef VMK_ReturnStatus (*vmk_ScsiAdapterTaskMgmt)(
                          void *clientData,
                          struct vmk_ScsiTaskMgmt *taskMgmt,
                          void *deviceData);

/*
 ***********************************************************************
 * vmk_ScsiAdapterDumpCommand --                                  */ /**
 *
 * \brief Queue a SCSI command during a core dump on the adapter
 *        and LUN specified.
 *
 * Perform the command passed in 'cmd' on the adapter passed in
 * 'clientData' on the LUN passed in 'deviceData' during a core dump.
 *
 * \note Required function pointer
 *
 * \note Please see the description of system dumps in the VMkernel
 *       fundamentals guide.
 *
 * \param[in]  clientData  Handle to the adapter to perform the discover
 *                         action on.
 * \param[in]  cmd         Pointer to the command to execut.
 * \param[in]  deviceData  Pointer to deviceData returned by 'discover'
 *                         Create.
 *
 * \note No one else can issue commands to this device anymore though
 *       the ordinary 'command' entry point.
 *
 * \retval VMK_WOULD_BLOCK cmd not queued because of Queue Depth limit
 *                         or device was quiesced.
 * \retval VMK_BUSY      Command cannot be executed, error handler active.
 * \retval VMK_FAILURE   Command cannot be executed.
 * \retval VMK_NO_MEMORY Out of memory.
 * \retval VMK_OK        Success - cmd queued or will be completed
 *                       with error.
 *
 ***********************************************************************
 */
typedef VMK_ReturnStatus (*vmk_ScsiAdapterDumpCommand)(
                          void *clientData,
                          vmk_ScsiCommand *cmd,
                          void *deviceData);

/*
 ***********************************************************************
 * vmk_ScsiAdapterDumpQueue --                                    */ /**
 *
 * \brief Log the current adapter queue.
 *
 * \note Required function pointer
 *
 * \param[in]  clientData  Handle to the adapter.
 *
 ***********************************************************************
 */
typedef void (*vmk_ScsiAdapterDumpQueue)(void *clientData);

/*
 ***********************************************************************
 * vmk_ScsiAdapterDumpPollHandler --                              */ /**
 *
 * \brief Run the adapter's poll handler, called on the dump device
 *        during a system dump.
 *
 * \note Required function pointer
 *
 * \note Please see the description of system dumps in the VMkernel
 *       fundamentals guide.
 *
 * \param[in]  clientData  Handle to the adapter.
 *
 * \param[in]  dumpPollHandlerData Argument passed to dumpPollHandler
 *
 ***********************************************************************
 */
typedef void (*vmk_ScsiAdapterDumpPollHandler)(void *clientData);


/*
 ***********************************************************************
 * vmk_ScsiAdapterDiscover --                                     */ /**
 *
 * \brief Perform the discovery action specified
 *
 * The driver should perform the action specified in 'action' for the
 * LUN described by 'channel', 'targetId' and 'lunId'.
 * The pointer passed in 'deviceData' points to a void * to place or
 * use the driver private data structure pointer that is used as a
 * handle to the LUN.
 *
 * \note Required function pointer
 *
 * \note This function is allowed to block in the driver.
 *
 * \param[in]  clientData     Handle to the adapter.
 * \param[in]  action         One of the vmk_ScanAction enums declared above
 *                            can be create, configure or destroy.
 * \param[in]  channel        The channel to perform the action on.
 * \param[in]  targetId       The target Id to perform the action on.
 * \param[in]  lunId          The LUN Id to perform the action on.
 * \param[in,out]  deviceData Pointer to where the deviceData pointer
 *                            is placed for create and destroy
 *
 * \note *deviceData is the private data structure the driver returns
 *       to represent the channel/targetId/lunId created. This pointer is
 *       used by the VMkernel as a handle for performance reasons in
 *       various other function pointer calls to represent the path
 *       to the LUN to be acted on.
 *
 * \note Return values for Create (VMK_SCSI_SCAN_CREATE_PATH)
 * \retval VMK_NO_CONNECT  The targetId does not exist or a target error
 *                         occured.
 * \retval VMK_NO_MEMORY   Out of memory (not enough to create path).
 * \retval VMK_EXISTS      Path with specified channel/targetId/lunId
 *                         already exists - *deviceData returned for
 *                         existing path
 * \retval VMK_OK          Success - *deviceData returned for newly
 *                         created path
 *
 * \note Return values for Configure (VMK_SCSI_SCAN_CONFIGURE_PATH)
 * \retval VMK_FAILURE     Path cannot be configured
 * \retval VMK_NOT_FOUND   Path cannot be found
 * \retval VMK_OK          Success - *deviceData not changed
 *
 * \note Return values for Destroy (VMK_SCSI_SCAN_DESTROY_PATH)
 * \retval VMK_FAILURE     Path cannot be destroyed
 * \retval VMK_OK          Success - *deviceData will be written with NULL
 *
 ***********************************************************************
 */
typedef VMK_ReturnStatus (*vmk_ScsiAdapterDiscover)(
                          void *clientData,
                          vmk_ScanAction action,
                          int channel,
                          int targetId,
                          int lunId,
                          void **deviceData);

/*
 ***********************************************************************
 * vmk_ScsiAdapterModifyDeviceQueueDepth --                       */ /**
 *
 * \brief Modify path queue depth on LUN specified if possible.
 *
 * \param[in]  clientData  Handle to the adapter.
 * \param[in]  qDepth      New queue depth to set.
 * \param[in]  deviceData  LUN pointer returned by 'discover' Create.
 *
 * \note Optional function pointer
 *
 * \retval Returns the new queue depth in effect, which could be
 *         lower than the depth actually requested if the driver
 *         cannot honor the requested (higher) queue depth.
 * \retval Returns 0 if not a valid path.
 *
 ***********************************************************************
 */
typedef int (*vmk_ScsiAdapterModifyDeviceQueueDepth)(
             void *clientData,
             int qDepth,
             void *deviceData);


/*
 ***********************************************************************
 * vmk_ScsiAdapterQueryDeviceQueueDepth --                        */ /**
 *
 * \brief Return the current path queue depth on LUN specified.
 *
 * \note Required function pointer
 *
 * \param[in]  clientData  Handle to the adapter.
 * \param[in]  deviceData  LUN pointer returned by 'discover' Create.
 *
 * \retval Returns the current queue depth for the path.
 * \retval Returns 0 if not a valid path.
 *
 ***********************************************************************
 */
typedef int (*vmk_ScsiAdapterQueryDeviceQueueDepth)(
             void *clientData,
             void *deviceData);


/*
 ***********************************************************************
 * vmk_ScsiAdapterCheckTarget --                                  */ /**
 *
 * \brief Check if the specified target exists on the adapter and
 *        channel specified.
 *
 * \note Required function pointer for SAN drivers, optional
 *       for all others.
 *
 * \note If checkTarget returns VMK_FAILURE, we will not call
 *       discover to create paths.
 *
 * \param[in]  clientData  Handle to the adapter.
 * \param[in]  channel     The channel to check for target on.
 * \param[in]  targetId    The target Id to check.
 *
 * \retval VMK_FAILURE   Target does not exist
 * \retval VMK_OK        Success - target exists
 *
 ***********************************************************************
 */
typedef VMK_ReturnStatus (*vmk_ScsiAdapterCheckTarget)(
                          void *clientData,
                          int channel,
                          int targetId);

/*
 ***********************************************************************
 * vmk_ScsiAdapterNotifyIOAllowed --                              */ /**
 *
 * \brief Callback to notify when IO is allowed to adapter
 *
 * \note Optional function pointer
 *
 * \note The Native Driver must assume IO is not possible until a
 *       "VMK_TRUE" is notified through this API.
 *
 * \note This function is not allowed to block in the driver.
 *
 * \note Passes VMK_TRUE or VMK_FALSE on these conditions:
 *       VMK_TRUE -  When logical device registration is complete and
 *                   when unquiescing the logical device.
 *       VMK_FALSE - When logical device quiesce is complete and when
 *                   deviceForget is complete.
 *
 * \param[in] logicalDevice  Handle to the logical device.
 * \param[in] ioAllowed      VMK_TRUE if IO is allowed, VMK_FALSE if IO
 *                           not allowed.
 *
 ***********************************************************************
 */
typedef void (*vmk_ScsiAdapterNotifyIOAllowed)(
              vmk_Device logicalDevice,
              vmk_Bool ioAllowed);


/**
 * \brief main data structure for SCSI adapter
 *
 * The discover() entrypoint passes back a deviceData.
 * This deviceData must be able to completely identify
 * the channel:target:lun of the device as it's the only
 * thing that will be passed back once it's set by the
 * discover() entrypoint.
 */
typedef struct vmk_ScsiAdapter {
   /**
    * \deprecated Do not use in Native Drivers
    * \brief DMA constraints for this adapter.
    * \note See 'engine' field below for more information.
    */
   vmk_DMAConstraints constraints;
   /** \brief Device for this adapter. */
   vmk_Device device;
   /** \brief max # of blocks per i/o */
   int                  hostMaxSectors;
   /** \brief Pointer to the total queue depth for the adapter */
   vmk_uint32           *qDepthPtr;

   /** \brief Issue a SCSI command to the specified device */
   vmk_ScsiAdapterCommand command;

   /** \brief Issue a SCSI task management */
   vmk_ScsiAdapterTaskMgmt taskMgmt;

   /** \brief Issue a SCSI command during a core dump */
   vmk_ScsiAdapterDumpCommand dumpCommand;

   /**
    * \deprecated Do not use in Native Drivers
    * \brief Perform a close on the adapter specified.
    */
   void (*close)(void *clientData);

   /**
    * \deprecated Do not use in Native Drivers
    * \brief proc handler for the given SCSI host adapter.
    */
   VMK_ReturnStatus (*procInfo)(
      void* clientData,
      char* buf,
      vmk_ByteCountSmall offset,
      vmk_ByteCountSmall count,
      vmk_ByteCountSmall* nbytes,
      int isWrite);

   /** \brief Log the current adapter queue */
   vmk_ScsiAdapterDumpQueue dumpQueue;

   /** \brief Run the adapter's poll handler, called on the dump device
    *         during a system dump. */
   vmk_ScsiAdapterDumpPollHandler dumpPollHandler;

   /** \brief Passed as the argument to dumpPollHandler() */
   void *dumpPollHandlerData;

   /**
    * \deprecated Do not use in Native Drivers
    * \brief driver specific ioctl
    */
   VMK_ReturnStatus (*ioctl)(
      void *clientData,
      void *deviceData,
      vmk_uint32 fileFlags,
      vmk_uint32 cmd,
      vmk_VA userArgsPtr,
      vmk_IoctlCallerSize callerSize,
      vmk_int32 *drvErr);

   /** \brief discover & destroy a device */
   vmk_ScsiAdapterDiscover discover;

   /**
    * \deprecated Do not use in Native Drivers
    * \brief send NPIV specific commands to a device
    */
   VMK_ReturnStatus (*vportop)(
      void *clientData,
      vmk_uint32 cmd,
      void *arg);

   /**
    * \deprecated Do not use in Native Drivers
    * \brief scan a single LUN on a vport
    */
   VMK_ReturnStatus (*vportDiscover)(
      void *clientData,
      vmk_ScanAction action,
      int ctlr,
      int devNum,
      int lun,
      struct vmk_ScsiAdapter **vmkAdapter,
      void **deviceData);

   /** \brief try changing the path queue depth */
   vmk_ScsiAdapterModifyDeviceQueueDepth modifyDeviceQueueDepth;

   /** \brief query the path queue depth */
   vmk_ScsiAdapterQueryDeviceQueueDepth queryDeviceQueueDepth;

   /** \brief checks if a target exists */
   vmk_ScsiAdapterCheckTarget checkTarget;

   /** \brief SCSI target id of adapter, or -1 if n/a */
   int                  targetId;
   /** \brief adapter flags, see vmk_ScsiAdapterFlags above */
   vmk_uint32           flags;
   int                  reserved;
   /** \brief id of module running this adapter */
   vmk_ModuleID         moduleID;
   /** \brief adapter creator's private convenience scratch data ptr
     *
     * \note clientData is a pointer to a private structure provided
     *       by the driver for use as 'handle' to represent an
     *       adapter for many function calls.
     */
   void                 *clientData;
   /** \brief # of channels */
   int                  channels;
   /** \brief # of targets per channel */
   int                  maxTargets;
   /** \brief max # of logical units per target */
   int                  maxLUNs;
   /** \brief Unique adapter number. Set by vmk_ScsiAllocateAdapter. */
   vmk_uint16           hostNum;
   /** \brief adapter support physical address extensions? */
   vmk_Bool             paeCapable;
   /** \brief max len of SCSI cmds adapter can accept */
   vmk_uint8            maxCmdLen;
   /** \brief adapter name */
   vmk_Name             name;
   /** \brief driver name */
   vmk_Name             driverName;
   /**
    * \deprecated Do not use in Native Drivers
    * \brief /proc directory */
   vmk_Name             procName;
   /** \brief transport specific mgmtAdapter hooks */
   vmk_SCSITransportMgmt mgmtAdapter;
   /** \brief notify when IO is allowed/disallowed */
   vmk_ScsiAdapterNotifyIOAllowed notifyIOAllowed;
   /*
    * \brief DMA Engine created by driver
    *
    * \note Native Drivers must create and pass a DMA Engine for use by the
    *       PSA stack for SCSI IO. The vmk_DMAConstraints are embedded
    *       in the 'engine' at creation time.
    */
   vmk_DMAEngine engine;
} vmk_ScsiAdapter;

/*
 * Physical Path
 */

#define VMK_SCSI_PATH_ANY_ADAPTER        "*"
#define VMK_SCSI_PATH_ANY_CHANNEL        ~0
#define VMK_SCSI_PATH_ANY_TARGET         ~0
#define VMK_SCSI_PATH_ANY_LUN            ~0

typedef enum {
   VMK_SCSI_PLUGIN_STATE_ENABLED,
   VMK_SCSI_PLUGIN_STATE_DISABLING,
   VMK_SCSI_PLUGIN_STATE_DISABLED,
   VMK_SCSI_PLUGIN_STATE_CLAIM_PATHS,
} vmk_ScsiPluginState;

/**
 * \deprecated Do not use in Native Drivers
 * \brief Opaque handle for Completion Objects, provided by lower layer.
 */
typedef vmk_AddrCookie vmk_ScsiCompletionHandle;

/**
 * \deprecated Do not use in Native Drivers
 * \brief Completion Object information passed by the vmkLinux module.
 */
typedef struct vmk_ScsiCompObjectInfo {
   /** \brief Completion Object Handle assigned by the lower layer. */
   vmk_ScsiCompletionHandle completionHandle;
   /** \brief Worldlet - if any - associated with the completion object. */
   vmk_Worldlet  completionWorldlet;
   vmk_uint8     infoPad[8];
} vmk_ScsiCompObjectInfo;

/**
 * \brief Format of INQUIRY request block.
 * SPC 3 r23, Section 6.4.1 table 80
 */
typedef struct vmk_ScsiInquiryCmd {
   /** \brief see above spc section */
   vmk_uint8 opcode;
   /** \brief see above spc section */
   vmk_uint8 evpd  :1,
   /** \brief see above spc section */
         cmddt :1,
   /** \brief see above spc section */
         resv12:3,
   /** \brief see above spc section */
         lun   :3;
   /** \brief see above spc section */
   vmk_uint8 pagecode;
   /** \brief see above spc section */
   vmk_uint16 length;
   /** \brief see above spc section */
   vmk_uint8 ctrl;
} VMK_ATTRIBUTE_PACKED vmk_ScsiInquiryCmd;

/**
 * \brief Format of INQUIRY response block.
 * SPC 3 r23, Section 6.4.2 table 81
 */
typedef struct vmk_ScsiInquiryResponse {
   /** \brief see above spc section */
   vmk_uint8 devclass    :5,
   /** \brief see above spc section */
         pqual             :3;
#define VMK_SCSI_PQUAL_CONNECTED     0  // device described is connected to the LUN
#define VMK_SCSI_PQUAL_NOTCONNECTED  1  // target supports such a device, but none is connected
#define VMK_SCSI_PQUAL_NODEVICE      3  // target does not support a physical device for this LUN
   /** \brief see above spc section */
   vmk_uint8    :7,
   /** \brief see above spc section */
         rmb:1;
   /** \brief see above spc section */
   vmk_uint8 ansi             :3,
#define VMK_SCSI_ANSI_SCSI1      0x0   // device supports SCSI-1
#define VMK_SCSI_ANSI_CCS        0x1   // device supports the CCS
#define VMK_SCSI_ANSI_SCSI2      0x2   // device supports SCSI-2
#define VMK_SCSI_ANSI_SCSI3_SPC  0x3   // device supports SCSI-3 version SPC
#define VMK_SCSI_ANSI_SCSI3_SPC2 0x4   // device supports SCSI-3 version SPC-2
#define VMK_SCSI_ANSI_SCSI3_SPC3 0x5   // device supports SCSI-3 version SPC-3
#define VMK_SCSI_ANSI_SCSI3_SPC4 0x6   // device supports SCSI-3 version SPC-4
   /** \brief see above spc section */
         ecma             :3,
   /** \brief see above spc section */
         iso             :2;
   /** \brief see above spc section */
   vmk_uint8 dataformat  :4,
   /** \brief see above spc section */
                     :1,
   /** \brief see above spc section */
         naca             :1,
   /** \brief see above spc section */
         tio             :1,
   /** \brief see above spc section */
         aen             :1;
   /** \brief see above spc section */
   vmk_uint8 optlen;
   /** \brief see above spc section */
   vmk_uint8         protect   :1,
   /** \brief see above spc section */
         rsrv              :2,
   /** \brief see above spc section */
          tpcp              :1,
   /** \brief see above spc section */
         tpgs        :2,
   /** \brief see above spc section */
         acc             :1,
   /** \brief see above spc section */
         sccs             :1;
#define VMK_SCSI_TPGS_NONE                       0x0
#define VMK_SCSI_TPGS_IMPLICIT_ONLY              0x1
#define VMK_SCSI_TPGS_IMPLICIT                   VMK_SCSI_TPGS_IMPLICIT_ONLY
#define VMK_SCSI_TPGS_EXPLICIT_ONLY              0x2
#define VMK_SCSI_TPGS_EXPLICIT                   VMK_SCSI_TPGS_EXPLICIT_ONLY
#define VMK_SCSI_TPGS_BOTH_IMPLICIT_AND_EXPLICIT 0x3
#define VMK_SCSI_TPGS_BOTH                       VMK_SCSI_TPGS_BOTH_IMPLICIT_AND_EXPLICIT
   /** \brief see above spc section */
   vmk_uint8 adr16             :1,
   /** \brief see above spc section */
         adr32             :1,
   /** \brief see above spc section */
         arq             :1,
   /** \brief see above spc section */
         mchngr             :1,
   /** \brief see above spc section */
         dualp             :1,
   /** \brief see above spc section */
         port             :1,
   /** \brief see above spc section */
                     :2;
   /** \brief see above spc section */
   vmk_uint8 sftr             :1,
   /** \brief see above spc section */
         que             :1,
   /** \brief see above spc section */
         trndis             :1,
   /** \brief see above spc section */
         link             :1,
   /** \brief see above spc section */
         sync             :1,
   /** \brief see above spc section */
         w16             :1,
   /** \brief see above spc section */
         w32             :1,
   /** \brief see above spc section */
         rel             :1;
   /** \brief see above spc section */
   vmk_uint8 manufacturer[8];
   /** \brief see above spc section */
   vmk_uint8 product[16];
   /** \brief see above spc section */
   vmk_uint8 revision[4];
   /** \brief see above spc section */
   vmk_uint8 vendor1[20];
   /** \brief see above spc section */
   vmk_uint8 reserved[40];
} vmk_ScsiInquiryResponse;

#define VMK_SCSI_STANDARD_INQUIRY_MIN_LENGTH 36

/**
 * \brief Format of INQUIRY EVPD responses
 * SPC 3 r23, Section 7.6
 */
typedef struct vmk_ScsiInquiryVPDResponse {
   /** \brief see above spc section */
   vmk_uint8 devclass    :5,
   /** \brief see above spc section */
             pqual       :3;
   /** \brief see above spc section */
   vmk_uint8 pageCode;
   /** \brief see above spc section */
   vmk_uint8 reserved;
   /** \brief see above spc section */
   vmk_uint8 payloadLen;
   /** \brief see above spc section */
   vmk_uint8 payload[0];
} VMK_ATTRIBUTE_PACKED VMK_ATTRIBUTE_ALIGN(1) vmk_ScsiInquiryVPDResponse;

/**
 * \brief Format of INQUIRY EVPD Page 83 response
 *  SPC 3 r23, Section 7.6.3.1 table 294
 */
typedef struct vmk_ScsiInquiryVPD83Response {
   /** \brief see above spc section */
   vmk_uint8 devclass    :5,
   /** \brief see above spc section */
             pqual       :3;
   /** \brief see above spc section */
   vmk_uint8 pageCode;
   /** \brief see above spc section */
   vmk_uint16 payloadLen;
   /** \brief see above spc section */
   vmk_uint8 payload[0];
} VMK_ATTRIBUTE_PACKED VMK_ATTRIBUTE_ALIGN(1) vmk_ScsiInquiryVPD83Response;

/**
 * \brief Format of INQUIRY EVPD Page 83 response id descriptor
 *  SPC 3 r23, Section 7.6.3.1 table 295
 */
typedef struct vmk_ScsiInquiryVPD83IdDesc {
   /** \brief see above spc section */
   vmk_uint8 codeSet     :4,
   /** \brief see above spc section */
             protocolId  :4;
#define VMK_SCSI_EVPD83_ID_VENDOR        (0x0)
#define VMK_SCSI_EVPD83_ID_T10           (0x1)
#define VMK_SCSI_EVPD83_ID_EUI           (0x2)
#define VMK_SCSI_EVPD83_ID_NAA           (0x3)
#define VMK_SCSI_EVPD83_ID_RTP           (0x4)
#define VMK_SCSI_EVPD83_ID_TPG           (0x5)
#define VMK_SCSI_EVPD83_ID_LUG           (0x6)
#define VMK_SCSI_EVPD83_ID_MD5           (0x7)
#define VMK_SCSI_EVPD83_ID_SCSINAME      (0x8)
   /** \brief see above spc section */
   vmk_uint8 idType      :4,
#define VMK_SCSI_EVPD83_ASSOCIATION_LU   (0x0)
#define VMK_SCSI_EVPD83_ASSOCIATION_PORT (0x1)
#define VMK_SCSI_EVPD83_ASSOCIATION_DEV  (0x2)
   /** \brief see above spc section */
             association :2,
   /** \brief see above spc section */
             reserved1   :1,
   /** \brief see above spc section */
             piv         :1;
   /** \brief see above spc section */
   vmk_uint8 reserved2;
   /** \brief see above spc section */
   vmk_uint8 idLen;
   /** \brief see above spc section */
   vmk_uint8 id[0];
} VMK_ATTRIBUTE_PACKED VMK_ATTRIBUTE_ALIGN(1) vmk_ScsiInquiryVPD83IdDesc;

#define VMK_SCSI_EVPD83_NAA_EXTENDED     (0x2)
#define VMK_SCSI_EVPD83_NAA_REGISTERED   (0x5)
#define VMK_SCSI_EVPD83_NAA_REG_EXT      (0x6)

/**
 * \brief Format of INQUIRY EVPD Page 86 response
 * SPC 4 r33, Section 7.8.8 page 650
 */
typedef struct vmk_ScsiInquiryVPD86Response {
   /** \brief see above spc section */
   vmk_uint8  devClass      :5,
   /** \brief see above spc section */
              pQual         :3;
   /** \brief see above spc section */
   vmk_uint8  pageCode;
   /** \brief see above spc section */
   vmk_uint16 pageLength;
   /** \brief see above spc section */
   vmk_uint8  refChk        :1,
   /** \brief see above spc section */
              appChk        :1,
   /** \brief see above spc section */
              grdChk        :1,
   /** \brief see above spc section */
              spt           :3,
   /** \brief see above spc section */
              actUcode      :2;
   /** \brief see above spc section */
   vmk_uint8  simSup        :1,
   /** \brief see above spc section */
              ordSup        :1,
   /** \brief see above spc section */
              headSup       :1,
   /** \brief see above spc section */
              priorSup      :1,
   /** \brief see above spc section */
              groupSup      :1,
   /** \brief see above spc section */
              uaskSup       :1,
   /** \brief see above spc section */
              res1          :2;
   /** \brief see above spc section */
   vmk_uint8  vSup          :1,
   /** \brief see above spc section */
              nvSup         :1,
   /** \brief see above spc section */
              crdSup        :1,
   /** \brief see above spc section */
              wuSup         :1,
   /** \brief see above spc section */
              res2          :4;
   /** \brief see above spc section */
   vmk_uint8  luiClr        :1,
   /** \brief see above spc section */
              res3          :3,
   /** \brief see above spc section */
              piiSup        :1,
   /** \brief see above spc section */
              res4          :3;
   /** \brief see above spc section */
   vmk_uint8  cbcs          :1,
   /** \brief see above spc section */
              res5          :3,
   /** \brief see above spc section */
              rSup          :1,
   /** \brief see above spc section */
              res6          :3;
   /** \brief see above spc section */
   vmk_uint8  multiUcode    :4,
   /** \brief see above spc section */
              res7          :4;
   /** \brief see above spc section */
   vmk_uint16 extSelfTestMins;
   /** \brief see above spc section */
   vmk_uint8  depLU         :1,
   /** \brief see above spc section */
              supLU         :1,
   /** \brief see above spc section */
              res8          :3,
   /** \brief see above spc section */
              vsaSup        :1,
   /** \brief see above spc section */
              hraSup        :1,
   /** \brief see above spc section */
              poaSup        :1;
   /** \brief see above spc section */
   vmk_uint8  maxSenseDataLen;
   /*
    * Reserved bytes - 14 - 63
    */
   vmk_uint8  res9[50];
} VMK_ATTRIBUTE_PACKED VMK_ATTRIBUTE_ALIGN(1) vmk_ScsiInquiryVPD86Response;

/**
 * \brief NAA IEEE Registered Extended identification field foramt
 * SPC 3 r23:
 * Section 7.6.3.6.4 table 309.
 */
typedef struct vmk_ScsiNAARegExtendedIdField {
   vmk_uint8 companyIdMSB :4,
             NAA          :4;
   vmk_uint16 companyIdMiddleBytes;
   vmk_uint8 vendorSpecIdMSB :4,
             companyIdLSB    :4;
   vmk_uint32 vendorSpecIdLSB;
   vmk_uint64 vendorSpecIdExt;
} __attribute__((packed,aligned(1))) vmk_ScsiNAARegExtendedIdField;

/**
 * \brief Format of the 6 byte version of MODE SELECT
 * SPC 3 r23, Section 6.9.1 table 97
 */
typedef struct vmk_ScsiModeSenseCmd {
   /** \brief see above spc section */
   vmk_uint8    opcode;
   /** \brief see above spc section */
   vmk_uint8          :3,
   /** \brief see above spc section */
            dbd          :1,
                  :1,
   /** \brief see above spc section */
            lun          :3;
   /** \brief see above spc section */
   vmk_uint8    page          :6,
#define VMK_SCSI_MS_PAGE_VENDOR   0x00     // vendor-specific (ALL)
#define VMK_SCSI_MS_PAGE_RWERROR  0x01     // read/write error (DISK/TAPE/CDROM/OPTICAL)
#define VMK_SCSI_MS_PAGE_CONNECT  0x02     // disconnect/connect (ALL)
#define VMK_SCSI_MS_PAGE_FORMAT   0x03     // format (DISK)
#define VMK_SCSI_MS_PAGE_PARALLEL 0x03     // parallel interface (PRINTER)
#define VMK_SCSI_MS_PAGE_UNITS    0x03     // measurement units (SCANNER)
#define VMK_SCSI_MS_PAGE_GEOMETRY 0x04     // rigid disk geometry (DISK)
#define VMK_SCSI_MS_PAGE_SERIAL   0x04     // serial interface (PRINTER)
#define VMK_SCSI_MS_PAGE_FLEXIBLE 0x05     // flexible disk geometry (DISK)
#define VMK_SCSI_MS_PAGE_PRINTER  0x05     // printer operations (PRINTER)
#define VMK_SCSI_MS_PAGE_OPTICAL  0x06     // optical memory (OPTICAL)
#define VMK_SCSI_MS_PAGE_VERIFY   0x07     // verification error (DISK/CDROM/OPTICAL)
#define VMK_SCSI_MS_PAGE_CACHE    0x08     // cache (DISK/CDROM/OPTICAL)
#define VMK_SCSI_MS_PAGE_PERIPH   0x09     // peripheral device (ALL)
#define VMK_SCSI_MS_PAGE_CONTROL  0x0a     // control mode (ALL)
#define VMK_SCSI_MS_PAGE_MEDIUM   0x0b     // medium type (DISK/CDROM/OPTICAL)
#define VMK_SCSI_MS_PAGE_NOTCH    0x0c     // notch partitions (DISK)
#define VMK_SCSI_MS_PAGE_CDROM    0x0d     // CD-ROM (CDROM)
#define VMK_SCSI_MS_PAGE_CDAUDIO  0x0e     // CD-ROM audio (CDROM)
#define VMK_SCSI_MS_PAGE_COMPRESS 0x0f     // data compression (TAPE)
#define VMK_SCSI_MS_PAGE_CONFIG   0x10     // device configuration (TAPE)
#define VMK_SCSI_MS_PAGE_EXCEPT   0x1c     // informal exception (ALL:SCSI-3)
#define VMK_SCSI_MS_PAGE_CDCAPS   0x2a     // CD-ROM capabilities and mechanical status (CDROM)
// more defined...
#define VMK_SCSI_MS_PAGE_ALL      0x3f     // all available pages (ALL)
   /** \brief see above spc section */
            pcf          :2;
#define VMK_SCSI_MS_PCF_CURRENT   0x00     // current values
#define VMK_SCSI_MS_PCF_VOLATILE  0x01     // changeable values
#define VMK_SCSI_MS_PCF_DEFAULT   0x02     // default values
#define VMK_SCSI_MS_PCF_SAVED     0x03     // saved values
   /** \brief see above spc section */
   vmk_uint8    subpage;
   /** \brief see above spc section */
   vmk_uint8    length;
   /** \brief see above spc section */
   vmk_uint8    ctrl;
} vmk_ScsiModeSenseCmd;

/**
 * \brief Format of READ_CAPACITY(10) response block.
 * SBC 2 r16, section 5.10.1 table 34
 */
typedef struct {
   /** \brief see above sbc section */
   vmk_uint32 lbn;
   /** \brief see above sbc section */
   vmk_uint32 blocksize;
} vmk_ScsiReadCapacityResponse;

/*
 * Format of REPORT TARGET PORT GROUPS request and response blocks.
 */


/**
 * \brief target port group command for SCSI report
 * SPC 3 r23, section 6.25 table 162
 */
typedef struct vmk_ScsiReportTargetPortGroupsCmd {
   /** \brief see above spc section */
   vmk_uint8    opcode;
   /** \brief see above spc section */
   vmk_uint8    svc:5,
#define VMK_SCSI_RTPGC_SVC    0xA
   /** \brief see above spc section */
                res1:3;
   /** \brief see above spc section */
   vmk_uint8    reserved1[4];
   /** \brief see above spc section */
   vmk_uint32   length;
   /** \brief see above spc section */
   vmk_uint8    reserved2;
   /** \brief see above spc section */
   vmk_uint8    ctrl;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReportTargetPortGroupsCmd;

/**
 * \brief target port group response for SCSI report
 * SPC 3 r23, section 6.25 table 163
 */
typedef struct vmk_ScsiReportTargetPortGroupsResponse {
   /** \brief see above spc section */
   vmk_uint32   length;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReportTargetPortGroupsResponse;

/**
 * \brief target port group descriptor for SCSI report
 * SPC 3 r23, section 6.25 table 164
 */
typedef struct  vmk_ScsiReportTargetPortGroupDescriptor {
   /** \brief see above spc section */
   vmk_uint8   aas:4,
   /** \brief see above spc section */
               res1:3,
   /** \brief see above spc section */
               pref:1;
#define VMK_SCSI_TPGD_AAS_AO      0x00 //!< active/optimized
#define VMK_SCSI_TPGD_AAS_ANO     0x01 //!< active/nonoptomized
#define VMK_SCSI_TPGD_AAS_STBY    0x02 //!< standby
#define VMK_SCSI_TPGD_AAS_UNAVAIL 0x03 //!< unavailable
#define VMK_SCSI_TPGD_AAS_TRANS   0x0F //!< transitioning
   /** \brief see above spc section */
   vmk_uint8   aosup:1,
   /** \brief see above spc section */
               ansup:1,
   /** \brief see above spc section */
               ssup:1,
   /** \brief see above spc section */
               usup:1,
   /** \brief see above spc section */
               res2:3,
   /** \brief see above spc section */
               tsup:1;
   /** \brief see above spc section */
   vmk_uint16 targetPortGroup;
   /** \brief see above spc section */
   vmk_uint8  reserved1;
#define VMK_SCSI_TPGD_STAT_NONE 0x00 //!< no status available
#define VMK_SCSI_TPGD_STAT_EXP  0x01 //!< state altered by SET command
#define VMK_SCSI_TPGD_STAT_IMP  0x02 //!< state altered by implicit behavior
   /** \brief see above spc section */
   vmk_uint8  status;
   /** \brief see above spc section */
   vmk_uint8  vendorSpec;
   /** \brief see above spc section */
   vmk_uint8  targetPortCount;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReportTargetPortGroupDescriptor;

/**
 * \brief SCSI target port descriptor format
 * SPC 3 r23, section 6.25 table 167
 */
typedef struct vmk_ScsiReportTargetPortDescriptor {
   /** \brief see above spc section */
   vmk_uint16  obsolete;
   /** \brief see above spc section */
   vmk_uint16  relativeTargetPortId;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReportTargetPortDescriptor;

/**
 * \brief set target port groups command
 * SPC 3 r23, Section 6.31 table 178
 */
typedef struct vmk_ScsiSetTargetPortGroupsCmd{
   /** \brief see above spc section */
   vmk_uint8    opcode;
   /** \brief see above spc section */
   vmk_uint8    svc:5,
#define VMK_SCSI_STPGC_SVC    0xA
   /** \brief see above spc section */
      res1:3;
   /** \brief see above spc section */
   vmk_uint8    reserved1[4];
   /** \brief see above spc section */
   vmk_uint32   length;
   /** \brief see above spc section */
   vmk_uint8    reserved2;
   /** \brief see above spc section */
   vmk_uint8    ctrl;
} VMK_ATTRIBUTE_PACKED vmk_ScsiSetTargetPortGroupsCmd;

#define SCSI_STPG_PARAM_LIST_OFFSET 4

/**
 * \brief set target port group descriptor
 * SPC 3 r23, Section 6.31 table 180
 */
typedef struct vmk_ScsiSetTargetPortGroupDescriptor{
   /** \brief see above spc section */
   vmk_uint8  aas:4,
   /** \brief see above spc section */
      res1:4;
   /** \brief see above spc section */
   vmk_uint8  reserved1;
   /** \brief see above spc section */
   vmk_uint16 targetPortGroup;
} VMK_ATTRIBUTE_PACKED vmk_ScsiSetTargetPortGroupDescriptor;


/**
 * \brief parameter header of module sense for SCSI
 * SPC 3 r23, Section 7.4.3 table 239
 */
typedef struct vmk_Scsi4ByteModeSenseParameterHeader {
   /** \brief see above spc section */
   vmk_uint8   modeDataLength;
   /** \brief see above spc section */
   vmk_uint8   mediumType;
   /** \brief see above spc section */
   vmk_uint8   reserved1:4,
   /** \brief see above spc section */
               dpofua:1,
   /** \brief see above spc section */
               reserved2:2,
   /** \brief see above spc section */
               wp:1;
   /** \brief see above spc section */
   vmk_uint8   blockDescriptorLength;
} VMK_ATTRIBUTE_PACKED vmk_Scsi4ByteModeSenseParameterHeader;

/**
 * \brief block descriptor for SCSI mode sense
 * SPC 3 r23, Section 7.4.4.1 table 241
 */
typedef struct vmk_ScsiModeSenseBlockDescriptor {
   /** \brief see above spc section */
   vmk_uint8   densityCode;
   /** \brief see above spc section */
   vmk_uint8   numberOfBlocks[3];
   /** \brief see above spc section */
   vmk_uint8   reserved1;
   /** \brief see above spc section */
   vmk_uint8   blockLength[3];
} VMK_ATTRIBUTE_PACKED vmk_ScsiModeSenseBlockDescriptor;


/**
 * \brief Format of READ/WRITE (6) request.
 * SBC 2 r16, Section 5.5 table 26 & 5.24 table 61
 */
typedef struct vmk_ScsiReadWrite6Cmd {
   /** \brief see above sbc section */
   vmk_uint32 opcode:8,
   /** \brief see above sbc section */
              lun:3,
   /** \brief see above sbc section */
              lbn:21;
   /** \brief see above sbc section */
   vmk_uint8  length;
   /** \brief see above sbc section */
   vmk_uint8  control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadWrite6Cmd;

/**
 * \brief Format of READ/WRITE (10) request.
 * SBC 2 r16, Section 5.6 table 28 & 5.25 table 62
 */
typedef struct vmk_ScsiReadWrite10Cmd {
   /** \brief see above sbc section */
   vmk_uint8 opcode;
   /** \brief see above sbc section */
   vmk_uint8 rel   :1,
                   :2,
   /** \brief see above sbc section */
             flua  :1,
   /** \brief see above sbc section */
             dpo   :1,
   /** \brief see above sbc section */
             lun   :3;
   /** \brief see above sbc section */
   vmk_uint32 lbn;
   /** \brief see above sbc section */
   vmk_uint8 reserved;
   /** \brief see above sbc section */
   vmk_uint16 length;
   /** \brief see above sbc section */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadWrite10Cmd;

/**
 * \brief Format of READ/WRITE (12) request.
 * SBC 2 r16, Section 5.7 table 31 & 5.26 table 65
 */
typedef struct vmk_ScsiReadWrite12Cmd {
   /** \brief see above sbc section */
   vmk_uint8 opcode;
   /** \brief see above sbc section */
   vmk_uint8 rel   :1,
                   :2,
   /** \brief see above sbc section */
             flua  :1,
   /** \brief see above sbc section */
             dpo   :1,
   /** \brief see above sbc section */
             lun   :3;
   /** \brief see above sbc section */
   vmk_uint32 lbn;
   /** \brief see above sbc section */
   vmk_uint32 length;
   /** \brief see above sbc section */
   vmk_uint8 reserved;
   /** \brief see above sbc section */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadWrite12Cmd;

/**
 * \brief Format of READ/WRITE (16) request.
 * SBC 2 r16, Section 5.8 table 32 & 5.27 table 66
 */
typedef struct vmk_ScsiReadWrite16Cmd {
   /** \brief see above sbc section */
   vmk_uint8 opcode;
   /** \brief see above sbc section */
   vmk_uint8 rel   :1,
                   :2,
   /** \brief see above sbc section */
             flua  :1,
   /** \brief see above sbc section */
             dpo   :1,
                   :3;
   /** \brief see above sbc section */
   vmk_uint64 lbn;
   /** \brief see above sbc section */
   vmk_uint32 length;
   /** \brief see above sbc section */
   vmk_uint8 reserved;
   /** \brief see above sbc section */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadWrite16Cmd;

/**
 * \brief Scsi page types for inquiry data
 */
typedef enum {
   VMK_SCSI_INQ_TYPE_STD    = 1,
   VMK_SCSI_INQ_TYPE_EVPD80 = 2,
   VMK_SCSI_INQ_TYPE_EVPD83 = 3,
   VMK_SCSI_INQ_TYPE_EVPD86 = 4,
} vmk_ScsiInqType;

/**
 * \brief Persistent Reserve Out Command
 * SPC 3 r23, Section 6.12.1 (Table 112)
 */
typedef struct vmk_ScsiPersistentReserveOutCmd {
   /** \brief see above spc section */
   vmk_uint8  opcode;
   /** \brief see above spc section */
   vmk_uint8  serviceAction :5,
   /** \brief see above spc section */
              reserved      :3;
   /** \brief see above spc section */
   vmk_uint8  type          :4,
   /** \brief see above spc section */
              scope         :4;
   /** \brief see above spc section */
   vmk_uint8  reserved1[2];
   /** \brief see above spc section */
   vmk_uint32 parameterListLength;
   /** \brief see above spc section */
   vmk_uint8  control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiPersistentReserveOutCmd;

/**
 * \brief Persistent Reserve Out parameter List.
 * SPC 3 r23, Section 6.12.3 (Table 114)
 */
typedef struct vmk_ScsiPersistentReserveOutPList {
   /** \brief see above spc section */
   vmk_uint64 reservationKey;
   /** \brief see above spc section */
   vmk_uint64 serviceActionResKey;
   /** \brief see above spc section */
   vmk_uint8  obsolete1[4];
   /** \brief see above spc section */
   vmk_uint8  aptpl          :1,
   /** \brief see above spc section */
              reserved1      :1,
   /** \brief see above spc section */
              all_tg_pt      :1,
   /** \brief see above spc section */
              spec_i_pt      :1,
   /** \brief see above spc section */
              reserved2      :4;
   /** \brief see above spc section */
   vmk_uint8  reserved3;
   /** \brief see above spc section */
   vmk_uint8  obsolete2[2];
} VMK_ATTRIBUTE_PACKED vmk_ScsiPersistentReserveOutPList;

/**
 * \brief Persistent Reserve In Command
 * SPC 3 r23, Section 6.11.1 (Table 101)
 */
typedef struct vmk_ScsiPersistentReserveInCmd {
   /** \brief see above spc section */
   vmk_uint8  opcode;
   /** \brief see above spc section */
   vmk_uint8  serviceAction :5,
   /** \brief see above spc section */
              reserved      :3;
   /** \brief see above spc section */
   vmk_uint8  reserved1[5];
   /** \brief see above spc section */
   vmk_uint16 allocationLength;
   /** \brief see above spc section */
   vmk_uint8  control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiPersistentReserveInCmd;

/**
 * \brief Persistent read reservation response
 * SPC 3 r23, Section 6.11.3.4 (Table 105)
 */
typedef struct vmk_ScsiReadReservationResp {
   /** \brief see above spc section */
   vmk_uint32 prGeneration;
   /** \brief see above spc section */
   vmk_uint32 additionalLength;
   /** \brief see above spc section */
   vmk_uint64 reservationKey;
   /** \brief see above spc section */
   vmk_uint8  obsolete[4];
   /** \brief see above spc section */
   vmk_uint8  reserved;
   /** \brief see above spc section */
   vmk_uint8  type      :4,
   /** \brief see above spc section */
              scope     :4;
   /** \brief see above spc section */
   vmk_uint8 obsolete1[2];
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadReservationResp;

/**
 * \brief Extended copy (XCOPY) command
 * SPC 3 r23, Section 6.3.1 table 50
 */
typedef struct vmk_ScsiExtendedCopyCmd {
   /** \brief see above spc section */
   vmk_uint8 opcode;
   /** \brief see above spc section */
   vmk_uint8 reserved1[9];
   /** \brief see above spc section */
   vmk_uint32 parameterListLength;
   /** \brief see above spc section */
   vmk_uint8 reserved2;
   /** \brief see above spc section */
   vmk_uint8 control;
} __attribute__ ((packed)) vmk_ScsiExtendedCopyCmd;

/**
 * \brief Extended copy parameter list header
 * SPC 3 r23, Section 6.3.1 table 51
 */
typedef struct vmk_ScsiExtendedCopyParamListHeader {
   /** \brief see above spc section */
   vmk_uint8	listID;
   /** \brief see above spc section */
   vmk_uint8	priority:3,
   /** \brief see above spc section */
                reserved1:1,
   /** \brief see above spc section */
                NRCR:1,
   /** \brief see above spc section */
                STR:1,
   /** \brief see above spc section */
                reserved2:2;
   /** \brief see above spc section */
   vmk_uint16	targetDescriptorListLength;
   /** \brief see above spc section */
   vmk_uint8	reserved3[4];
   /** \brief see above spc section */
   vmk_uint32	segmentDescriptorListLength;
   /** \brief see above spc section */
   vmk_uint32	inlineDataLength;
} __attribute__ ((packed,aligned(1))) vmk_ScsiExtendedCopyParamListHeader;

/**
 * \brief Identification descriptor target
 *        descriptor for the extended copy command
 * SPC 3 r23, Section 6.3.6.2 table 56
 */
typedef struct vmk_ScsiIdDescriptorTargetDescriptor {
   /** \brief see above spc section */
   vmk_uint8	descTypeCode;
   /** \brief see above spc section */
   vmk_uint8	peripheralDeviceType:5,
   /** \brief see above spc section */
                nul:1,
   /** \brief see above spc section */
                luIdType:2;
   /** \brief see above spc section */
   vmk_uint16	relativeInitiatorPortId;
   /** \brief see above spc section */
   vmk_uint8 codeSet     :4,
   /** \brief see above spc section */
             reserved1   :4;
   /** \brief see above spc section */
   vmk_uint8 idType      :4,
   /** \brief see above spc section */
             association :2,
   /** \brief see above spc section */
             reserved2   :2;
   /** \brief see above spc section */
   vmk_uint8 reserved3;
   /** \brief see above spc section */
   vmk_uint8 idLen;
   /** \brief see above spc section */
   vmk_uint8    varLenId[20];
   /** \brief see above spc section */
   vmk_uint8	devTypeSpecParams[4];
} __attribute__ ((packed,aligned(1))) vmk_ScsiIdDescriptorTargetDescriptor;


/**
 * \brief Device type specific target descriptor parameters for block
 *        device types, for the extended copy command
 * SPC 3 r23, Section 6.3.6.4 table 58
 */
typedef struct vmk_ScsiBlockDeviceSpecTargetDescParams {
   /** \brief see above spc section */
   vmk_uint8	reserved1:2;
   /** \brief see above spc section */
   vmk_uint8	PAD:1;
   /** \brief see above spc section */
   vmk_uint8	reserved2:5;
   /** \brief see above spc section */
   vmk_uint8	blockSize[3];
} __attribute__ ((packed,aligned(1))) vmk_ScsiBlockDeviceSpecTargetDescParams;


/**
 * \brief Block device to block device segment descriptor
 *        for the extended copy command
 * SPC 3 r23, Section 6.3.7.5 table 66
 */
typedef struct vmk_ScsiBlockToBlockSegmentDescriptor {
   /** \brief see above spc section */
   vmk_uint8	descriptorTypeCode;
   /** \brief see above spc section */
   vmk_uint8	CAT:1,
   /** \brief see above spc section */
                DC:1,
   /** \brief see above spc section */
                reserved1:6;
   /** \brief see above spc section */
   vmk_uint16	descriptorLength;
   /** \brief see above spc section */
   vmk_uint16	srcTargetDescriptorIndex;
   /** \brief see above spc section */
   vmk_uint16	dstTargetDescriptorIndex;
   /** \brief see above spc section */
   vmk_uint8	reserved2[2];
   /** \brief see above spc section */
   vmk_uint16	numBlocks;
   /** \brief see above spc section */
   vmk_uint64	srcLBA;
   /** \brief see above spc section */
   vmk_uint64	dstLBA;
} __attribute__ ((packed,aligned(1))) vmk_ScsiBlockToBlockSegmentDescriptor;

/**
 * \brief Format of REQUEST SENSE block.
 * SPC 3 r23, Section 6.27 table 170
 */
typedef struct vmk_ScsiRequestSenseCommand {
   /** \brief Operation Code (03h) */
   vmk_uint8 opcode;
   /** \brief DESC */
   vmk_uint8 desc:1,
   /** \brief Reserved */
             resv1:4,
   /** \brief Reserved in SPC3R23, and ignored */
             lun:3;
   /** \brief Reserved */
   vmk_uint8  resv2;
   /** \brief Reserved */
   vmk_uint8 resv3;
   /** \brief Allocation Length */
   vmk_uint8  len;
   /** \brief Control */
   vmk_uint8  control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiRequestSenseCommand;

/**
 * \brief Format of MODE SELECT   block.
 * SPC 3 r23, Section 6.7 table 94
 */
typedef struct vmk_ScsiModeSelectCommand {
   /** \brief Operation Code (15h) */
   vmk_uint8 opcode;
   /** \brief Save Pages */
   vmk_uint8 sp:1,
   /** \brief Reserved */
             resv11:3,
   /** \brief Page Format */
             pf:1,
   /** \brief Actually, reserved */
             lun:3;
   /** \brief Reserved */
   vmk_uint8 resv2;
   /** \brief Reserved */
   vmk_uint8 resv3;
   /** \brief Allocation Length */
   vmk_uint8 len;
   /** \brief Control */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiModeSelectCommand;

/**
 * \brief Format of REPORT LUNS   block.
 * SPC 3 r23, Section 6.21 table 147
 */
typedef struct vmk_ScsiReportLunsCommand {
   /** \brief Operation Code (A0h) */
   vmk_uint8 opcode;
   /** \brief Reserved */
   vmk_uint8 resv1;
   /** \brief SELECT REPORT */
   vmk_uint8 selectReport;
   /** \brief Reserved */
   vmk_uint8 resv2;
   /** \brief Reserved */
   vmk_uint8 resv3;
   /** \brief Reserved */
   vmk_uint8 resv4;
   /** \brief Allocation Length */
   vmk_uint32 len;
   /** \brief Reserved */
   vmk_uint8 resv5;
   /** \brief Control */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReportLunsCommand;

/**
 * \brief Format of READ CAPACITY 10 byte  block.
 * SBC 3 r18, Section 5.12.1 table 45
 */
typedef struct vmk_ScsiReadCap10Command {
   /** \brief Operation Code (25h) */
   vmk_uint8 opcode;
   /** \brief Obsolete */
   vmk_uint8 obs:1,
             resv1:7;
   /** \brief Logical Block Address */
   vmk_uint32 lba;
   vmk_uint8 resv2;
   vmk_uint8 resv3;
   /** \brief PMI */
   vmk_uint8 pmi:1,
             resv4:7;
   /** \brief Control */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadCap10Command;

/**
 * \brief Format of READ CAPACITY 16 byte  block.
 * SBC 3 r18, Section 5.13.1 table 47
 */
typedef struct vmk_ScsiReadCap16Command {
   /** \brief Operation Code (9eh) */
   vmk_uint8 opcode;
   /** \brief Service Action (10h) */
   vmk_uint8 sa:5,
             resv1:3;
   /** \brief Logical Block Address */
   vmk_uint64 lba;
   /** \brief Allocation Length */
   vmk_uint32 len;
   vmk_uint8 pmi:1,
             resv2:7;
   /** \brief Control */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadCap16Command;

/**
 * \brief Format of READ BUFFER   block.
 * SPC 3 r23, Section 6.15 table 126
 */
typedef struct vmk_ScsiReadBufferCommand {
   /** \brief Operation Code (3Ch) */
   vmk_uint8 opcode;
   /** \brief Mode */
   vmk_uint8 mode:5,
   /** \brief Reserved */
             resv1:3;
   /** \brief BUFFER ID */
   vmk_uint8 bufferId;
   /** \brief BUFFER OFFSET - MSB */
   vmk_uint8 msbbo;
   /** \brief BUFFER OFFSET - MID */
   vmk_uint8 midbo;
   /** \brief BUFFER OFFSET - LSB */
   vmk_uint8 lsbbo;
   /** \brief Allocation Length MSB */
   vmk_uint8 msblen;
   /** \brief Allocation Length MID */
   vmk_uint8 midlen;
   /** \brief Allocation Length LSB */
   vmk_uint8 lsblen;
   /** \brief Control */
   vmk_uint8 control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiReadBufferCommand;

/**
 * \brief WRITE LONG (16) Command
 * SBC 2 r16, Secion 5.34 table 73
 */
typedef struct vmk_ScsiWriteLong16 {
   /** \brief Operation Code (9fh) */
   vmk_uint8 opcode;
   /** \brief service action (11h) */
   vmk_uint8  serviceAction :5,
   /** \brief reserved */
              reserved1     :3;
   /** \brief see above sbc section */
   vmk_uint64 lba;
   /** \brief see above sbc section */
   vmk_uint8  reserved2[2];
   /** \brief see above sbc section */
   vmk_uint16 transferLength;
   /** \brief see above sbc section */
   vmk_uint8 corrct     : 1,
             reserved3  : 7;
   /** \brief see above sbc section */
   vmk_uint8  control;
} VMK_ATTRIBUTE_PACKED vmk_ScsiWriteLong16;

#endif  /* _VMKAPI_SCSI_TYPES_H_ */
/** @} */
/** @} */