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
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_FC_H
#define _SYS_FC4_FC_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Fibre Channel Physical and Signaling Interface (FC-PH) definitions.
*
* NOTE: modifications of this file affect drivers, mpsas models, PLUTO
* firmware, SOC assembly code. Please be communicative.
*/
#define FC_PH_VERSION 0x06 /* 0x06 means 4.0 ! */
#define MAX_FRAME_SIZE 2112 /* maximum size of frame payload */
/*
* This is the standard frame header for FC-PH frames.
*/
typedef struct FC2_FRAME_HDR {
uint_t r_ctl:8, d_id:24;
uint_t reserved1:8, s_id:24;
uint_t type:8, f_ctl:24;
uint_t seq_id:8, df_ctl:8, seq_cnt:16;
ushort_t ox_id, rx_id;
uint_t ro;
}aFC2_FRAME_HDR, *FC2_FRAME_HDRptr, fc_frame_header_t;
#define WE_ARE_ORIGINATOR(fh) (fh->f_ctl & F_CTL_XCHG_CONTEXT)
#define UNSOLICITED_FRAME(fh) (fh->rx_id == 0xffff)
#define FIRST_SEQUENCE(fh) (fh->f_ctl & F_CTL_FIRST_SEQ)
#define LAST_FRAME_OF_SEQUENCE(fh) (fh->f_ctl & F_CTL_END_SEQ)
#define LAST_SEQUENCE_OF_EXCHANGE(fh) (fh->f_ctl & F_CTL_LAST_SEQ)
#define TRANSFER_INITIATIVE(fh) (fh->f_ctl & F_CTL_SEQ_INITIATIVE)
/* legal values for r_ctl */
#define R_CTL_ROUTING 0xf0 /* mask for routing bits */
#define R_CTL_INFO 0x0f /* mask for information bits */
#define R_CTL_DEVICE_DATA 0x00 /* all I/O related frames */
#define R_CTL_EXTENDED_SVC 0x20 /* extended link services (PLOGI) */
#define R_CTL_FC4_SVC 0x30 /* FC-4 link services (FCP_LOGI) */
#define R_CTL_VIDEO_BUFF 0x40 /* not yet defined */
#define R_CTL_BASIC_SVC 0x80 /* basic link services (NOP) */
#define R_CTL_LINK_CTL 0xc0 /* ACKs, etc. */
/* legal values for r_ctl: Device Data */
#define R_CTL_UNCATEGORIZED 0x00
#define R_CTL_SOLICITED_DATA 0x01
#define R_CTL_UNSOL_CONTROL 0x02
#define R_CTL_SOLICITED_CONTROL 0x03
#define R_CTL_UNSOL_DATA 0x04
#define R_CTL_XFER_RDY 0x05
#define R_CTL_COMMAND 0x06
#define R_CTL_STATUS 0x07
/* legal values for r_ctl: Basic Link Services, type 0 */
#define R_CTL_LS_NOP 0x80
#define R_CTL_LS_ABTS 0x81
#define R_CTL_LS_RMC 0x82
#define R_CTL_LS_BA_ACC 0x84
#define R_CTL_LS_BA_RJT 0x85
/* legal values for r_ctl: Extended Link Services, type 1 */
#define R_CTL_ELS_REQ 0x22
#define R_CTL_ELS_RSP 0x23
/* Extended Link Service command codes, type 1 */
#define LS_RJT 0x01000000
#define LS_ACC 0x02000000
#define LS_PLOGI 0x03000000
#define LS_FLOGI 0x04000000
#define LS_LOGO 0x05000000
#define LS_ABTX 0x06000000
#define LS_RCS 0x07000000
#define LS_RES 0x08000000
#define LS_RSS 0x09000000
#define LS_RSI 0x0a000000
#define LS_ESTS 0x0b000000
#define LS_ESTC 0x0c000000
#define LS_ADVC 0x0d000000
#define LS_RTV 0x0e000000
#define LS_RLS 0x0f000000
#define LS_ECHO 0x10000000
#define LS_TEST 0x11000000
#define LS_RRQ 0x12000000
#define LS_IDENT 0x20000000 /* vendor unique */
#define LS_DISPLAY 0x21000000 /* vendor unique */
/* legal values for r_ctl: Link Control */
#define R_CTL_ACK_1 0xc0
#define R_CTL_ACK_N 0xc1
#define R_CTL_P_RJT 0xc2
#define R_CTL_F_RJT 0xc3
#define R_CTL_P_BSY 0xc4
#define R_CTL_F_BSY_DF 0xc5
#define R_CTL_F_BSY_LC 0xc6
#define R_CTL_LCR 0xc7
/* type field definitions for Link Data frames: */
#define TYPE_BASIC_LS 0x00
#define TYPE_EXTENDED_LS 0x01
/* type field definitions for Device Data frames (from FC-PH 4.1): */
#define TYPE_IS8802 0x04
#define TYPE_IS8802_SNAP 0x05
#define TYPE_SCSI_FCP 0x08 /* we use this one */
#define TYPE_SCSI_GPP 0x09
#define TYPE_HIPP_FP 0x0a
#define TYPE_IPI3_MASTER 0x11
#define TYPE_IPI3_SLAVE 0x12
#define TYPE_IPI3_PEER 0x13
#define F_CTL_XCHG_CONTEXT 0x800000 /* 0 if SID is XCHG originator */
#define F_CTL_SEQ_CONTEXT 0x400000 /* 0 if SID is SEQ initiator */
#define F_CTL_FIRST_SEQ 0x200000 /* 1 if first sequence of XCHG */
#define F_CTL_LAST_SEQ 0x100000 /* 1 if last SEQ of XCHG */
#define F_CTL_END_SEQ 0x080000 /* 1 if last frame of a SEQ */
#define F_CTL_END_CONNECT 0x040000 /* always 0 */
#define F_CTL_CHAINED_SEQ 0x020000 /* always 0 */
#define F_CTL_SEQ_INITIATIVE 0x010000 /* when 1 xfrs SEQ initiative */
#define F_CTL_XID_REASSIGNED 0x008000 /* always 0 */
#define F_CTL_INVALIDATE_XID 0x004000 /* always 0 */
#define F_CTL_CONTINUE_SEQ 0x0000C0 /* always 0 */
#define F_CTL_ABORT_SEQ 0x000030 /* always 0 */
#define F_CTL_RO_PRESENT 0x000008 /* 1 if param field == RO */
#define F_CTL_XCHG_REASSEMBLE 0x000004 /* always 0 */
#define F_CTL_FILL_BYTES 0x000003 /* # of fill bytes in this frame */
#define F_CTL_RESERVED 0x003F00
#define F_CTL_ALWAYS_ZERO (F_CTL_RESERVED | F_CTL_XCHG_REASSEMBLE | \
F_CTL_ABORT_SEQ | F_CTL_CONTINUE_SEQ| F_CTL_INVALIDATE_XID | \
F_CTL_XID_REASSIGNED | F_CTL_CHAINED_SEQ | F_CTL_END_CONNECT)
/* Well known addresses ... */
#define FS_GENERAL_MULTICAST 0xfffff7
#define FS_WELL_KNOWN_MULTICAST 0xfffff8
#define FS_HUNT_GROUP 0xfffff9
#define FS_MANAGEMENT_SERVER 0xfffffa
#define FS_TIME_SERVER 0xfffffb
#define FS_NAME_SERVER 0xfffffc
#define FS_FABRIC_CONTROLLER 0xfffffd
#define FS_FABRIC_F_PORT 0xfffffe
#define FS_BROADCAST 0xffffff
/* Fabric Busy Reason Codes */
#define FABRIC_BUSY 0x01
#define NPORT_BUSY 0x03
/* NPort Busy Reason Codes */
#define PHYSICAL_BUSY 0x01
#define RESOURSE_BUSY 0x03
/* Reject Reason Codes */
typedef struct FC2_RJT_PARAM {
uchar_t rjt_action;
uchar_t rjt_reason;
uchar_t reserved[2];
} aFC2_RJT_PARAM;
#define INVALID_D_ID 0x01
#define INVALID_S_ID 0x02
#define NPORT_NOT_AVAIL_TEMP 0x03
#define NPORT_NOT_AVAIL_PERM 0x04
#define CLASS_NOT_SUPPORTED 0x05
#define DELIMITER_ERROR 0x06
#define TYPE_NOT_SUPPORTED 0x07
#define INVALID_LINK_CONTROL 0x08
#define INVALID_R_CTL 0x09
#define INVALID_F_CTL 0x0a
#define INVALID_OX_ID 0x0b
#define INVALID_RX_ID 0x0c
#define INVALID_SEQ_ID 0x0d
#define INVALID_DF_CTL 0x0e
#define INVALID_SEQ_CNT 0x0f
#define INVALID_PARAMETER 0x10
#define EXCHANGE_ERROR 0x11
#define PROTOCOL_ERROR 0x12
#define INCORRECT_LENGTH 0x13
#define UNEXPECTED_ACK 0x14
#define UNEXPECTED_LINK_RESP 0x15
#define LOGIN_REQUIRED 0x16
#define EXCESSIVE_SEQUENCES 0x17
#define CANT_ESTABLISH_EXCHANGE 0x18
#define SECURITY_NOT_SUPPORTED 0x19
/* BA_RJT and LS_RJT reason codes */
#define RJT_INVALID_CMD_CODE 0x01
#define RJT_LOGICAL_ERROR 0x03
#define RJT_LOGICAL_BUSY 0x05
#define RJT_PROTOCOL_ERR 0x07
#define RJT_CANT_PERFORM_RQST 0x09
#define RJT_CMD_NOT_SUPPORTED 0x0b
/*
* Frame Payloads that the SOC understands
* Transfer Ready:
*/
typedef struct Xfer_Rdy {
int seq_ro;
int burst_len;
int reserved;
} aXFER_RDY, *XFER_RDYptr;
/*
* Link Error Status Block
*/
typedef struct LA_RLS_reply {
int code;
int link_failure;
int loss_of_sync;
int loss_of_signal;
int primitive_error;
int code_violations;
int invalid_crc;
} aLA_RLS_reply, *LA_RLS_replyptr;
/*
* Login
*/
typedef struct LOGI_PAYLOAD {
uint_t code;
uchar_t common_service_params[16];
uchar_t port_name[8];
uchar_t node_name[8];
uchar_t class1_service_params[16];
uchar_t class2_service_params[16];
uchar_t class3_service_params[16];
} aLOGI_PAYLOAD, *LOGI_PAYLOADptr;
#define SP_F_PORT_LOGIN 0x10
/*
* Extended Link Service Payload
*/
/* Arbitrary upper limit for now... */
#define FC_MAX_ELS (60-4)
typedef struct ELS_payload {
union els_cmd_u {
struct {
uchar_t ls_command;
uchar_t reserved[3];
} c;
uint_t i;
} els_cmd;
uchar_t els_data[FC_MAX_ELS];
} els_payload_t;
/*
* NOTE: This dataseg definition makes this file unique
* from the Pluto fc_ph file.
*/
/*
* Data segment definition
*/
typedef struct fc_dataseg {
uint32_t fc_base; /* Address of buffer. */
uint32_t fc_count; /* Length of buffer. */
} fc_dataseg_t;
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_FC_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FC4_FC_TRANSPORT_H
#define _SYS_FC4_FC_TRANSPORT_H
#include <sys/fc4/fc.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* fc_devdata_t definitions
*
* See fc.h for TYPE field definitions
*/
typedef int fc_devdata_t;
/*
* fc_ioclass_t definitions.
*/
typedef enum {
FC_CLASS_OUTBOUND,
FC_CLASS_INBOUND,
FC_CLASS_SIMPLE,
FC_CLASS_IO_WRITE,
FC_CLASS_IO_READ,
FC_CLASS_OFFLINE,
FC_CLASS_UNSOLICITED
} fc_ioclass_t;
/*
* This data structure is used by a Fiber Channel Adaptor driver client to
* request a Fiber Channel transaction.
*/
typedef struct fc_packet {
/*
* identifies which FC device
*
* In our case it is a pointer to the
* port_status structure. This structure
* contains the physical port (0 or 1).
*/
void *fc_pkt_cookie; /* identifies which FC device */
void (*fc_pkt_comp)(struct fc_packet *);
void *fc_pkt_private;
int32_t fc_pkt_flags; /* flags */
int32_t fc_pkt_timeout; /* Max time to complete */
fc_ioclass_t fc_pkt_io_class; /* fc io class */
fc_devdata_t fc_pkt_io_devdata; /* FC IO Device Data. */
fc_dataseg_t *fc_pkt_cmd; /* Outbound packet */
fc_dataseg_t *fc_pkt_rsp; /* Inbound Packet */
fc_dataseg_t **fc_pkt_datap; /* List of Data Packets */
/*
* SOC status from soc status field in Response que.
*/
unsigned int fc_pkt_status; /* SOC Status when complete */
int fc_pkt_statistics; /* not used */
fc_frame_header_t *fc_frame_cmd, /* used for command */
*fc_frame_resp; /* used for response */
struct fc_packet *fc_pkt_next, /* Chain of FC packet reqs. */
*fc_pkt_prev;
} fc_packet_t;
/*
* Fibre channel packet flags
*/
#define FCFLAG_NOINTR 1 /* run this command without intr */
#define FCFLAG_COMPLETE 2 /* command has completed */
/*
* fc_transport() return values
*/
enum {
FC_TRANSPORT_SUCCESS, /* success */
FC_TRANSPORT_FAILURE, /* failure */
FC_TRANSPORT_TIMEOUT, /* timeout while polling */
FC_TRANSPORT_QFULL, /* queue full */
FC_TRANSPORT_UNAVAIL /* temp. unavailable, e.g., offline */
};
/*
* pkt_status return values
*/
#define FC_STATUS_OK 0
#define FC_STATUS_P_RJT 2
#define FC_STATUS_F_RJT 3
#define FC_STATUS_P_BSY 4
#define FC_STATUS_F_BSY 5
#define FC_STATUS_ERR_OFFLINE 0x11
#define FC_STATUS_TIMEOUT 0x12
#define FC_STATUS_ERR_OVERRUN 0x13
#define FC_STATUS_UNKNOWN_CQ_TYPE 0x20
#define FC_STATUS_BAD_SEG_CNT 0x21
#define FC_STATUS_MAX_XCHG_EXCEEDED 0x22
#define FC_STATUS_BAD_XID 0x23
#define FC_STATUS_XCHG_BUSY 0x24
#define FC_STATUS_BAD_POOL_ID 0x25
#define FC_STATUS_INSUFFICIENT_CQES 0x26
#define FC_STATUS_ALLOC_FAIL 0x27
#define FC_STATUS_BAD_SID 0x28
#define FC_STATUS_NO_SEQ_INIT 0x29
#define FC_STATUS_ERROR 0x80
#define FC_STATUS_ONLINE_TIMEOUT 0x81
/*
* additional pseudo-status codes for login
*/
#define FC_STATUS_LOGIN_TIMEOUT 0x80000001u
#define FC_STATUS_CQFULL 0x80000002u
#define FC_STATUS_TRANSFAIL 0x80000003u
#define FC_STATUS_RESETFAIL 0x80000004u
/*
* fc_uc_register() return values
*/
typedef void * fc_uc_cookie_t;
/*
* fc_transport() iotype parameter
*/
typedef enum {
FC_TYPE_UNCATEGORIZED,
FC_TYPE_DATA,
FC_TYPE_UNSOL_CONTROL,
FC_TYPE_SOLICITED_CONTROL,
FC_TYPE_UNSOL_DATA,
FC_TYPE_XFER_RDY,
FC_TYPE_COMMAND,
FC_TYPE_RESPONSE
} fc_iotype_t;
/*
* fc_transport() sleep parameter
*/
typedef enum {
FC_SLEEP, /* sleep on queue full */
FC_NOSLEEP /* do not sleep on queue full */
} fc_sleep_t;
/*
* State changes related to the N-port interface communicated from below
*/
typedef enum {
FC_STATE_ONLINE, /* port has gone online */
FC_STATE_OFFLINE, /* port has gone offline */
FC_STATE_RESET /* port reset, all cmds lost */
} fc_statec_t;
typedef void * fc_statec_cookie_t;
/*
* This structure is allocated by Fiber Channel Adaptor at INITCHILD time,
* and is communicated to the child by ddi_set_driver_private().
* It defines the vectors by which the child obtains soc
* driver services, and all other information the child
* may need about its parent.
*/
typedef struct fc_transport {
void *fc_cookie; /* Which FC dev. */
ddi_dma_lim_t *fc_dmalimp; /* FC ddi_dma_lim_t ptr. */
ddi_dma_attr_t *fc_dma_attrp; /* FC ddi_dma_attr_t ptr. */
ddi_iblock_cookie_t fc_iblock; /* iblock for mutexes */
kmutex_t fc_mtx; /* Locks for transport */
kcondvar_t fc_cv;
/*
* Transport a command across the interface.
*/
int (*fc_transport)(
struct fc_packet *fc,
fc_sleep_t sleep);
/*
* Reset the transport.
*/
int (*fc_reset)(
struct fc_packet *fc);
/*
* Allocate an fc_packet structure.
*/
fc_packet_t *(*fc_pkt_alloc)(
void *cookie,
fc_sleep_t sleep);
/*
* Free an fc_packet structure.
*/
void (*fc_pkt_free)(
void *cookie,
struct fc_packet *pkt);
/*
* Register a routine to handle state changes on the interface
*
* The arg parameter, along with an fc_statec_t parameter, will
* be passed to the callback routine on all state changes
* after initialization.
*/
fc_statec_cookie_t
(*fc_statec_register)(
void *cookie,
void (*callback)(void *, fc_statec_t),
void *arg);
/*
* Unregister a routine to handle state changes
*/
void (*fc_statec_unregister)(
void *cookie,
fc_statec_cookie_t statec_cookie);
/*
* Run the interface in polling mode. This allows interface
* state changes, etc. to be processed when system interrupts
* are disabled. This is used mostly for error recovery.
* Too bad Fibre Channel doesn't have a common error policy for
* all protocols so that we could do error recovery at
* the lowest level instead of having kludges like this...
*/
void (*fc_interface_poll)(
void *cookie);
/*
* Unsolicited Command Interface
*
* This interface operates with the presumption that the
* higher level driver (child) will process unsolicited
* commands that pertain to its protocol such as FCP or FCIP.
*/
/*
* Register a callback to be called in the event of an
* unsolicited command received by the soc for this child.
* No information is passed regarding the event, just that
* one occurred. The arg parameter to passed to the
* callback function as its parameter.
*/
fc_uc_cookie_t
(*fc_uc_register)(
void *cookie,
fc_devdata_t devdata,
void (*callback)(void *),
void *arg);
/*
* Unregister a callback routine
*/
void (*fc_uc_unregister)(
void *cookie,
fc_uc_cookie_t uc_cookie);
/*
* Return information about the unsolicited command
* event in pkt. The pkt must be a fully allocated
* fc_packet structure, with a valid cmd dataseg
* pointer, in which the received cmd payload will
* be placed. The length of the allocated dataseg should
* be greater than or equal to the length of the received
* command payload, otherwise the entire command cannot
* be copied into the data segment. This function
* returns -1 in the event of an error, or the
* actual length of the received command payload.
*/
int (*fc_uc_get_pkt)(
void *cookie,
struct fc_packet *pkt);
} fc_transport_t;
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_FC_TRANSPORT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_FCAL_H
#define _SYS_FC4_FCAL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Fibre Channel Physical and Signaling Interface (FC-PH) definitions.
*
* NOTE: modifications of this file affect drivers, mpsas models, PLUTO
* firmware, SOC assembly code. Please be communicative.
*/
#define FC_PH_VERSION 0x06 /* 0x06 means 4.0 ! */
#define MAX_FRAME_SIZE 2112 /* maximum size of frame payload */
/*
* This is the standard frame header for FC-PH frames.
*/
typedef struct FC2_FRAME_HDR {
uint_t r_ctl:8, d_id:24;
uint_t reserved1:8, s_id:24;
uint_t type:8, f_ctl:24;
uint_t seq_id:8, df_ctl:8, seq_cnt:16;
uint16_t ox_id, rx_id;
uint32_t ro;
}aFC2_FRAME_HDR, *FC2_FRAME_HDRptr, fc_frame_header_t;
#define WE_ARE_ORIGINATOR(fh) (fh->f_ctl & F_CTL_XCHG_CONTEXT)
#define UNSOLICITED_FRAME(fh) (fh->rx_id == 0xffff)
#define FIRST_SEQUENCE(fh) (fh->f_ctl & F_CTL_FIRST_SEQ)
#define LAST_FRAME_OF_SEQUENCE(fh) (fh->f_ctl & F_CTL_END_SEQ)
#define LAST_SEQUENCE_OF_EXCHANGE(fh) (fh->f_ctl & F_CTL_LAST_SEQ)
#define TRANSFER_INITIATIVE(fh) (fh->f_ctl & F_CTL_SEQ_INITIATIVE)
/* legal values for r_ctl */
#define R_CTL_ROUTING 0xf0 /* mask for routing bits */
#define R_CTL_INFO 0x0f /* mask for information bits */
#define R_CTL_DEVICE_DATA 0x00 /* all I/O related frames */
#define R_CTL_EXTENDED_SVC 0x20 /* extended link services (PLOGI) */
#define R_CTL_FC4_SVC 0x30 /* FC-4 link services (FCP_LOGI) */
#define R_CTL_VIDEO_BUFF 0x40 /* not yet defined */
#define R_CTL_BASIC_SVC 0x80 /* basic link services (NOP) */
#define R_CTL_LINK_CTL 0xc0 /* ACKs, etc. */
/* legal values for r_ctl: Device Data */
#define R_CTL_UNCATEGORIZED 0x00
#define R_CTL_SOLICITED_DATA 0x01
#define R_CTL_UNSOL_CONTROL 0x02
#define R_CTL_SOLICITED_CONTROL 0x03
#define R_CTL_UNSOL_DATA 0x04
#define R_CTL_XFER_RDY 0x05
#define R_CTL_COMMAND 0x06
#define R_CTL_STATUS 0x07
/* legal values for r_ctl: Basic Link Services, type 0 */
#define R_CTL_LS_NOP 0x80
#define R_CTL_LS_ABTS 0x81
#define R_CTL_LS_RMC 0x82
#define R_CTL_LS_BA_ACC 0x84
#define R_CTL_LS_BA_RJT 0x85
/* legal values for r_ctl: Extended Link Services, type 1 */
#define R_CTL_ELS_REQ 0x22
#define R_CTL_ELS_RSP 0x23
/* legal values for r_ctl: Link Control */
#define R_CTL_ACK_1 0xc0
#define R_CTL_ACK_N 0xc1
#define R_CTL_P_RJT 0xc2
#define R_CTL_F_RJT 0xc3
#define R_CTL_P_BSY 0xc4
#define R_CTL_F_BSY_DF 0xc5
#define R_CTL_F_BSY_LC 0xc6
#define R_CTL_LCR 0xc7
/* type field definitions for Link Data frames: */
#define TYPE_BASIC_LS 0x00
#define TYPE_EXTENDED_LS 0x01
/* type field definitions for Device Data frames (from FC-PH 4.1): */
#define TYPE_IS8802 0x04
#define TYPE_IS8802_SNAP 0x05
#define TYPE_SCSI_FCP 0x08 /* we use this one */
#define TYPE_SCSI_GPP 0x09
#define TYPE_HIPP_FP 0x0a
#define TYPE_IPI3_MASTER 0x11
#define TYPE_IPI3_SLAVE 0x12
#define TYPE_IPI3_PEER 0x13
#define F_CTL_XCHG_CONTEXT 0x800000 /* 0 if SID is XCHG originator */
#define F_CTL_SEQ_CONTEXT 0x400000 /* 0 if SID is SEQ initiator */
#define F_CTL_FIRST_SEQ 0x200000 /* 1 if first sequence of XCHG */
#define F_CTL_LAST_SEQ 0x100000 /* 1 if last SEQ of XCHG */
#define F_CTL_END_SEQ 0x080000 /* 1 if last frame of a SEQ */
#define F_CTL_END_CONNECT 0x040000 /* always 0 */
#define F_CTL_CHAINED_SEQ 0x020000 /* always 0 */
#define F_CTL_SEQ_INITIATIVE 0x010000 /* when 1 xfrs SEQ initiative */
#define F_CTL_XID_REASSIGNED 0x008000 /* always 0 */
#define F_CTL_INVALIDATE_XID 0x004000 /* always 0 */
#define F_CTL_CONTINUE_SEQ 0x0000C0 /* always 0 */
#define F_CTL_ABORT_SEQ 0x000030 /* always 0 */
#define F_CTL_RO_PRESENT 0x000008 /* 1 if param field == RO */
#define F_CTL_XCHG_REASSEMBLE 0x000004 /* always 0 */
#define F_CTL_FILL_BYTES 0x000003 /* # of fill bytes in this frame */
#define F_CTL_RESERVED 0x003F00
#define F_CTL_ALWAYS_ZERO (F_CTL_RESERVED | F_CTL_XCHG_REASSEMBLE | \
F_CTL_ABORT_SEQ | F_CTL_CONTINUE_SEQ| F_CTL_INVALIDATE_XID | \
F_CTL_XID_REASSIGNED | F_CTL_CHAINED_SEQ | F_CTL_END_CONNECT)
/* Well known addresses ... */
#define FS_GENERAL_MULTICAST 0xfffff7
#define FS_WELL_KNOWN_MULTICAST 0xfffff8
#define FS_HUNT_GROUP 0xfffff9
#define FS_MANAGEMENT_SERVER 0xfffffa
#define FS_TIME_SERVER 0xfffffb
#define FS_NAME_SERVER 0xfffffc
#define FS_FABRIC_CONTROLLER 0xfffffd
#define FS_FABRIC_F_PORT 0xfffffe
#define FS_BROADCAST 0xffffff
/* Fabric Busy Reason Codes */
#define FABRIC_BUSY 0x01
#define NPORT_BUSY 0x03
/* NPort Busy Reason Codes */
#define PHYSICAL_BUSY 0x01
#define RESOURSE_BUSY 0x03
/* Reject Reason Codes */
typedef struct FC2_RJT_PARAM {
uchar_t rjt_action;
uchar_t rjt_reason;
uchar_t reserved[2];
} aFC2_RJT_PARAM;
#define INVALID_D_ID 0x01
#define INVALID_S_ID 0x02
#define NPORT_NOT_AVAIL_TEMP 0x03
#define NPORT_NOT_AVAIL_PERM 0x04
#define CLASS_NOT_SUPPORTED 0x05
#define DELIMITER_ERROR 0x06
#define TYPE_NOT_SUPPORTED 0x07
#define INVALID_LINK_CONTROL 0x08
#define INVALID_R_CTL 0x09
#define INVALID_F_CTL 0x0a
#define INVALID_OX_ID 0x0b
#define INVALID_RX_ID 0x0c
#define INVALID_SEQ_ID 0x0d
#define INVALID_DF_CTL 0x0e
#define INVALID_SEQ_CNT 0x0f
#define INVALID_PARAMETER 0x10
#define EXCHANGE_ERROR 0x11
#define PROTOCOL_ERROR 0x12
#define INCORRECT_LENGTH 0x13
#define UNEXPECTED_ACK 0x14
#define UNEXPECTED_LINK_RESP 0x15
#define LOGIN_REQUIRED 0x16
#define EXCESSIVE_SEQUENCES 0x17
#define CANT_ESTABLISH_EXCHANGE 0x18
#define SECURITY_NOT_SUPPORTED 0x19
/* BA_RJT and LS_RJT reason codes */
#define RJT_INVALID_CMD_CODE 0x01
#define RJT_LOGICAL_ERROR 0x03
#define RJT_LOGICAL_BUSY 0x05
#define RJT_PROTOCOL_ERR 0x07
#define RJT_CANT_PERFORM_RQST 0x09
#define RJT_CMD_NOT_SUPPORTED 0x0b
/*
* Frame Payloads that the SOC understands
* Transfer Ready:
*/
typedef struct Xfer_Rdy {
int32_t seq_ro;
int32_t burst_len;
int32_t reserved;
} aXFER_RDY, *XFER_RDYptr;
/*
* Extended Link Service Payload
*/
/* Arbitrary upper limit for now... */
#define FC_MAX_ELS (60-4)
typedef struct ELS_payload {
union els_cmd_u {
struct {
uchar_t ls_command;
uchar_t reserved[3];
} c;
uint32_t i;
} els_cmd;
uchar_t els_data[FC_MAX_ELS];
} els_payload_t;
/*
* Data segment definition
*/
typedef struct fc_dataseg {
uint32_t fc_base; /* Address of buffer. */
uint32_t fc_count; /* Length of buffer. */
} fc_dataseg_t;
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_FCAL_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1996-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_FCAL_LINKAPP_H
#define _SYS_FC4_FCAL_LINKAPP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* linkapp.h
*
* This file contains the definitions for structures and macros
* for fiber channel link application payloads and data.
*/
/*
* Well Known Fiber Chaneel Addresses to reach the fabric for
* various services.
*/
#define MAX_FCODE_SIZE 0x2000
#define FS_GENERAL_MULTICAST 0xfffff7
#define FS_WELL_KNOWN_MULTICAST 0xfffff8
#define FS_HUNT_GROUP 0xfffff9
#define FS_MANAGEMENT_SERVER 0xfffffa
#define FS_TIME_SERVER 0xfffffb
#define FS_NAME_SERVER 0xfffffc
#define FS_FABRIC_CONTROLLER 0xfffffd
#define FS_FABRIC_F_PORT 0xfffffe
#define FS_BROADCAST 0xffffff
/*
* Link Application Opcodes.
*/
#define LA_ELS_RJT 0x01
#define LA_ELS_ACC 0x02
#define LA_ELS_PLOGI 0x03
#define LA_ELS_FLOGI 0x04
#define LA_ELS_LOGO 0x05
#define LA_ELS_ABTX 0x06
#define LA_ELS_RCS 0x07
#define LA_ELS_RES 0x08
#define LA_ELS_RSS 0x09
#define LA_ELS_RSI 0x0a
#define LA_ELS_ESTS 0x0b
#define LA_ELS_ESTC 0x0c
#define LA_ELS_ADVC 0x0d
#define LA_ELS_RTV 0x0e
#define LA_ELS_RLS 0x0f
#define LA_ELS_ECHO 0x10
#define LA_ELS_RRQ 0x12
#define LA_ELS_PRLI 0x20
#define LA_ELS_PRLO 0x21
#define LA_ELS_SCN 0x22
#define LA_ELS_TPLS 0x23
#define LA_ELS_GPRLO 0x24
#define LA_ELS_GAID 0x30
#define LA_ELS_FACT 0x31
#define LA_ELS_FDACT 0x32
#define LA_ELS_NACT 0x33
#define LA_ELS_NDACT 0x34
#define LA_ELS_QoSR 0x40
#define LA_ELS_RVCS 0x41
#define LA_ELS_PDISC 0x50
#define LA_ELS_FDISC 0x51
#define LA_ELS_ADISC 0x52
#define LA_ELS_NEW_IDENT 0xf0 /* SMCC specific */
#define LA_ELS_DISPLAY 0xf1 /* SMCC specific */
#define LA_ELS_IDENT 0x20 /* SMCC specifi, SSA compat. */
/*
* Events supported by soc+ HBA driver
*/
#define FCAL_INSERT_EVENT "SUNW,sf:DEVICE-INSERTION.1"
#define FCAL_REMOVE_EVENT "SUNW,sf:DEVICE-REMOVAL.1"
/* Basic Accept Payload. */
typedef struct la_ba_acc {
uchar_t seq_id:8;
uchar_t org_s_id[3];
ushort_t ox_id;
ushort_t rx_id;
} la_ba_acc_t;
/* Basic Reject. */
typedef struct la_ba_rjt {
uchar_t reserved;
uchar_t reason_code;
uchar_t explanation;
uchar_t vendor;
} la_ba_rjt_t;
/*
* Basic Reject Reason Codes.
*/
#define RJT_INVALID_CMD 0x01
#define RJT_LOGICAL_ERR 0x03
#define RJT_LOGICAL_BUSY 0x05
#define RJT_PROTOCOL_ERR 0x07
#define RJT_UNABLE 0x09
#define RJT_UNSUPPORTED 0x0B
#define RJT_VENDOR 0xFF
/*
* Basic Reject Explanation Codes
*/
#define RJT_NOEXPLANATION 0x00
#define RJT_INVALID_OSID 0x01
#define RJT_INVALID_OXID_RXID 0x03
#define RJT_INVALID_SEQID 0x05
#define RJT_ABORT_INACTIVE_SEQ 0x07
#define RJT_UNABLE_TO_SUPPLY 0x09
/*
* Service parameters.
*/
typedef struct common_service {
uint_t fcph;
uint_t btob_crdt;
uint_t cmn_features;
uint_t reserved;
} common_svc_t;
typedef struct service_param {
uchar_t data[16];
} svc_param_t;
/* World Wide Name formats */
typedef union la_wwn {
uchar_t raw_wwn[8];
struct {
uint_t naa_id : 4;
uint_t nport_id : 12;
uint_t wwn_hi : 16;
uint_t wwn_lo;
} w;
} la_wwn_t;
#define FC_WWN_SIZE 8
/*
* Values for naa_id
*/
#define NAA_ID_IEEE 1
#define NAA_ID_IEEE_EXTENDED 2
/* Login Payload. */
typedef struct la_els_logi {
uchar_t ls_code;
uchar_t mbz[3];
common_svc_t common_service;
la_wwn_t nport_ww_name;
la_wwn_t node_ww_name;
svc_param_t class_1;
svc_param_t class_2;
svc_param_t class_3;
uchar_t reserved[16];
uchar_t vendor_version_level[16];
} la_els_logi_t;
typedef la_els_logi_t la_els_logi_reply_t;
#define la_logi_t la_els_logi_t
#define SP_F_PORT_LOGIN 0x10
/* Read Link Error Status */
typedef struct la_els_rls {
uchar_t ls_code;
uchar_t mbz[3];
uchar_t reserved;
uchar_t nport_id[3];
} la_els_rls_t;
/* Read Link Error Status Reply */
typedef struct la_els_rls_reply {
uchar_t ls_code;
uchar_t mbz[3];
uint_t link_failure;
uint_t loss_of_sync;
uint_t loss_of_signal;
uint_t primitive;
uint_t invalid_transmission;
uint_t invalid_crc;
} la_els_rls_reply_t;
/* Logout payload. */
typedef struct la_els_logo {
uchar_t ls_code;
uchar_t mbz[3];
uchar_t reserved;
uchar_t nport_id[3];
la_wwn_t nport_ww_name;
} la_els_logo_t;
/* Logout reply payload. */
typedef la_els_logo_t la_els_logo_reply_t;
/* Reinstate recovery qualifier */
typedef struct la_els_rrq {
uchar_t ls_code;
uchar_t mbz[3];
uchar_t reserved;
uchar_t source_id[3];
ushort_t ox_id;
ushort_t rx_id;
uchar_t assoc_header[32];
} la_els_rrq_t;
/* Reinstate recovery qualifier reply */
typedef la_els_logo_t la_els_rrq_reply_t;
/* Process login */
typedef struct la_els_prli {
uchar_t ls_code;
uchar_t page_length;
ushort_t payload_length;
uchar_t service_params[16];
} la_els_prli_t;
/* Process login reply */
typedef la_els_prli_t la_els_prli_reply_t;
/* Process logout */
typedef la_els_prli_t la_els_prlo_t;
/* process logout reply */
typedef la_els_prli_t la_els_prlo_reply_t;
/* Port discovery */
typedef la_els_logi_t la_els_pdisc_t;
/* Port discovery reply */
typedef la_els_logi_reply_t la_els_pdisc_reply_t;
/* Address discovery */
typedef struct la_els_adisc {
uchar_t ls_code;
uchar_t mbz[3];
uint_t hard_address;
uchar_t port_wwn[8];
uchar_t node_wwn[8];
uint_t nport_id;
} la_els_adisc_t;
/* Address discovery reply */
typedef la_els_adisc_t la_els_adisc_reply_t;
/* Identify */
typedef struct la_els_identify {
uint_t ls_code;
uint_t byte_count;
} la_els_identify_t;
/* Identify reply */
typedef struct la_els_identify_reply {
uint_t ls_code;
uchar_t fcode[MAX_FCODE_SIZE];
} la_els_identify_reply;
/* Link Application Reject */
typedef struct la_els_rjt {
uchar_t ls_code;
uchar_t mbz[3];
uchar_t reserved;
uchar_t reason_code;
uchar_t explanation;
uchar_t vendor;
} la_els_rjt_t;
/*
* LA_RJT Reason Codes.
*/
#define LA_RJT_INVALID 0x01
#define LA_RJT_LOGICAL_ERR 0x03
#define LA_RJT_LOGICAL_BUSY 0x05
#define LA_RJT_PROTOCOL_ERR 0x07
#define LA_RJT_UNABLE_TO_PERFORM 0x09
#define LA_RJT_NOT_SUPPORTED 0x0b
#define LA_RJT_VENDOR 0xff
/*
* LA_RJT explanations
*/
#define LA_RJT_NOEXPLANATION 0x00
#define LA_RJT_OPTIONS 0x01
#define LA_RJT_INITIATOR 0x03
#define LA_RJT_RECIPIENT 0x05
#define LA_RJT_DATA_FIELD_SIZE 0x07
#define LA_RJT_CONCURRENT 0x09
#define LA_RJT_CREDIT 0x0b
#define LA_RJT_INVALID_PORT_WWNAME 0x0d
#define LA_RJT_INVALID_NODE_WWNAME 0x0e
#define LA_RJT_INVALID_COMMON_SVC 0x0f
#define LA_RJT_INVALID_ASSOC_HEADER 0x11
#define LA_RJT_ASSOC_HDR_REQD 0x13
#define LA_RJT_INVALID_ORIG_SID 0x15
#define LA_RJT_INVALID_FQXID 0x17
#define LA_RJT_REQUEST_IN_PROGRESS 0x19
#define LA_RJT_INVALID_NPORT_ID 0x1f
#define LA_RJT_ INVALID_SEQ_ID 0x21
#define LA_RJT_ABT_INVALID_XID 0x23
#define LA_RJT_ABT_INACTIVE_XID 0x25
#define LA_RJT_RRQ_REQUIRED 0x27
#define LA_RJT_INSUFFICENT 0x29
#define LA_RJT_REQUESTED_DATA 0x2a
#define LA_RJT_REQUEST_NOT_SUPPORTED 0x2c
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_FCAL_LINKAPP_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FC4_FCAL_TRANSPORT_H
#define _SYS_FC4_FCAL_TRANSPORT_H
#include <sys/fc4/fcal.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* fc_devdata_t definitions
*
* See fc.h for TYPE field definitions
*/
typedef int fc_devdata_t;
/*
* fc_ioclass_t definitions.
*/
typedef enum {
FC_CLASS_OUTBOUND,
FC_CLASS_INBOUND,
FC_CLASS_SIMPLE,
FC_CLASS_IO_WRITE,
FC_CLASS_IO_READ,
FC_CLASS_OFFLINE,
FC_CLASS_UNSOLICITED
} fc_ioclass_t;
/*
* fc_transport() sleep parameter
*/
typedef enum {
FCAL_SLEEP, /* sleep on queue full */
FCAL_NOSLEEP /* do not sleep on queue full */
} fcal_sleep_t;
typedef struct fcal_packet {
void *fcal_pkt_cookie; /* identifies which FC device */
struct fcal_packet *fcal_pkt_next;
void (*fcal_pkt_comp)(struct fcal_packet *);
void *fcal_pkt_private;
uint_t fcal_pkt_flags; /* flags */
uint_t fcal_cmd_state;
uint_t fcal_pkt_status; /* SOC Status when complete */
uint_t fcal_diag_status; /* used only for diagnostics */
union {
soc_request_t req;
longlong_t l;
} w;
#define fcal_socal_request w.req
fc_frame_header_t fcal_resp_hdr;
uint_t fcal_magic;
ushort_t fcal_ncmds;
} fcal_packet_t;
/*
* Fibre channel packet flags
*/
#define FCFLAG_NOINTR 1 /* run this command without intr */
#define FCFLAG_COMPLETE 2 /* command has completed */
#define FCFLAG_RESP_HEADER 4 /* valid response frame header */
#define FCFLAG_ABORTING 8 /* this packet is being aborted */
#define FCFLAG_ABORTED 0x10 /* the abort completed */
/*
* definitions for the cmd_state
*/
#define FCAL_CMD_IN_TRANSPORT 0x1 /* command in transport */
#define FCAL_CMD_COMPLETE 0x4 /* command complete */
#define FCAL_CMPLT_CALLED 0x10 /* Completion routine called */
#define FCALP_MAGIC 0x4750703
typedef struct fcal_transport {
void *fcal_handle; /* identifies which FC dev */
ddi_dma_lim_t *fcal_dmalimp;
ddi_iblock_cookie_t fcal_iblock;
ddi_dma_attr_t *fcal_dmaattr;
ddi_device_acc_attr_t *fcal_accattr;
caddr_t fcal_loginparms; /* from soc+ xram */
la_wwn_t fcal_n_wwn; /* node Worldwide name */
la_wwn_t fcal_p_wwn; /* port Worldwide name */
uint_t fcal_portno; /* which port */
uint_t fcal_cmdmax; /* max number of exchanges */
kmutex_t fcal_mtx;
kcondvar_t fcal_cv;
struct fcal_transport_ops *fcal_ops;
} fcal_transport_t;
typedef struct fcal_transport_ops {
uint_t (*fcal_transport)(fcal_packet_t *fcalpkt,
fcal_sleep_t sleep, int
req_q_no);
uint_t (*fcal_transport_poll)(fcal_packet_t *fcalpkt,
uint_t timeout,
int req_q_no);
uint_t (*fcal_lilp_map)(void *fcal_handle,
uint_t port,
uint32_t bufid,
uint_t poll);
uint_t (*fcal_force_lip)(void *fcal_handle,
uint_t port,
uint_t poll,
uint_t lip_req);
uint_t (*fcal_abort_cmd)(void *fcal_handle,
uint_t port,
fcal_packet_t *fcalpkt,
uint_t poll);
uint_t (*fcal_els)(void *fcal_handle,
uint_t port,
uint_t els_code,
uint_t dest,
void (*callback)(),
void *arg,
caddr_t reqpayload,
caddr_t *rsppayload,
uint_t poll);
uint_t (*fcal_bypass_dev)(void *fcal_handle,
uint_t port,
uint_t dest);
void (*fcal_force_reset)(void *fcal_handle,
uint_t port,
uint_t reset);
void (*fcal_add_ulp)(void *fcal_handle,
uint_t port,
uchar_t type,
void (*ulp_statec_callback)(),
void (*ulp_els_callback)(),
void (*ulp_data_callback)(),
void *arg);
void (*fcal_remove_ulp)(void *fcal_handle,
uint_t port,
uchar_t type,
void *arg);
void (*fcal_take_core)(void *fcal_handle);
} fcal_transport_ops_t;
/*
* additional pseudo-status codes for login
*/
#define FCAL_STATUS_LOGIN_TIMEOUT 0x80000001
#define FCAL_STATUS_CQFULL 0x80000002
#define FCAL_STATUS_TRANSFAIL 0x80000003
#define FCAL_STATUS_RESETFAIL 0x80000004
/*
* interface and transport function return values
*/
#define FCAL_SUCCESS 0x000
#define FCAL_TIMEOUT 0x001
#define FCAL_ALLOC_FAILED 0x002
#define FCAL_OLD_PORT 0x003
#define FCAL_LINK_ERROR 0x004
#define FCAL_OFFLINE 0x005
#define FCAL_ABORTED 0x006
#define FCAL_ABORT_FAILED 0x007
#define FCAL_BAD_ABORT 0x008
#define FCAL_BAD_PARAMS 0x009
#define FCAL_OVERRUN 0x00a
#define FCAL_NO_TRANSPORT 0x00b
#define FCAL_TRANSPORT_SUCCESS 0x000
#define FCAL_TRANSPORT_FAILURE 0x101
#define FCAL_BAD_PACKET 0x102
#define FCAL_TRANSPORT_UNAVAIL 0x103
#define FCAL_TRANSPORT_QFULL 0x104
#define FCAL_TRANSPORT_TIMEOUT 0x105
#define FCAL_FAILURE 0xffffffff
/*
* fc_uc_register() return values
*/
typedef void * fc_uc_cookie_t;
/*
* fc_transport() iotype parameter
*/
typedef enum {
FC_TYPE_UNCATEGORIZED,
FC_TYPE_DATA,
FC_TYPE_UNSOL_CONTROL,
FC_TYPE_SOLICITED_CONTROL,
FC_TYPE_UNSOL_DATA,
FC_TYPE_XFER_RDY,
FC_TYPE_COMMAND,
FC_TYPE_RESPONSE
} fc_iotype_t;
/*
* State changes related to the N-port interface communicated from below
*/
#define FCAL_STATE_RESET ((int)0xffffffffu)
/* port reset, all cmds lost */
#define FCAL_LILP_MAGIC 0x1107
#define FCAL_BADLILP_MAGIC 0x1105
#define FCAL_NO_LIP 0x0
#define FCAL_FORCE_LIP 0x1
typedef struct fcal_lilp_map {
ushort_t lilp_magic;
ushort_t lilp_myalpa;
uchar_t lilp_length;
uchar_t lilp_alpalist[127];
} fcal_lilp_map_t;
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_FCAL_TRANSPORT_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1998-1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_FCIO_H
#define _SYS_FC4_FCIO_H
/*
* Include any headers you depend on.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/fc4/fcal_linkapp.h>
/*
* ioctl definitions
*/
#define FIOC ('F'<<8)
#define SF_IOC (0xda << 8)
#define SFIOCGMAP (SF_IOC|1) /* Get device map */
#define SF_NUM_ENTRIES_IN_MAP 127
#define FCIO_GETMAP (FIOC|175) /* Get limited map */
#define FCIO_FORCE_LIP (FIOC|177) /* Force LIP */
#define FCIO_LINKSTATUS (FIOC|183) /* Get link status */
#define FCIO_FCODE_MCODE_VERSION (FIOC|202) /* Get code versions */
#define IFPIOCGMAP SFIOCGMAP
#define IFP_NUM_ENTRIES_IN_MAP SF_NUM_ENTRIES_IN_MAP
#define IFPIO_FORCE_LIP FCIO_FORCE_LIP
#define IFPIO_LINKSTATUS FCIO_LINKSTATUS
typedef struct sf_al_addr_pair {
uchar_t sf_al_pa;
uchar_t sf_hard_address;
uchar_t sf_inq_dtype;
uchar_t sf_node_wwn[FC_WWN_SIZE];
uchar_t sf_port_wwn[FC_WWN_SIZE];
} sf_al_addr_pair_t;
typedef struct sf_al_map {
short sf_count;
sf_al_addr_pair_t sf_addr_pair[SF_NUM_ENTRIES_IN_MAP];
sf_al_addr_pair_t sf_hba_addr;
} sf_al_map_t;
struct rls_payload {
uint_t rls_portno;
uint_t rls_linkfail;
uint_t rls_syncfail;
uint_t rls_sigfail;
uint_t rls_primitiverr;
uint_t rls_invalidword;
uint_t rls_invalidcrc;
};
struct lilpmap {
ushort_t lilp_magic;
ushort_t lilp_myalpa;
uchar_t lilp_length;
uchar_t lilp_list[127];
};
struct socal_fm_version {
uint_t fcode_ver_len;
uint_t mcode_ver_len;
uint_t prom_ver_len;
char *fcode_ver;
char *mcode_ver;
char *prom_ver;
};
/*
* kstat structures
*/
typedef struct sf_target_stats {
uint_t els_failures; /* failures on PLOGI, PRLI, ADISC etc */
uint_t timeouts;
/*
* sf detected command timeouts,
* implies an ABTS
*/
uint_t abts_failures; /* ABTS failures */
uint_t task_mgmt_failures;
/*
* SF task management(aborts,
* resets etc) failures
*/
uint_t data_ro_mismatches; /* SF_DATA RO mismatches */
uint_t dl_len_mismatches;
/*
* SF_DATA length different from
* BURST_LEN
*/
uint_t logouts_recvd;
/*
* unsolicited LOGOs recvd from
* target
*/
} sf_target_stats_t;
typedef struct sf_stats {
uint_t version; /* version of this struct, >1 */
uint_t lip_count; /* lips forced by sf */
uint_t lip_failures;
/*
* lip failures, ie, no ONLINE response
* after forcing lip
*/
uint_t cralloc_failures;
/*
* command/response block allocation
* failures
*/
uint_t ncmds; /* outstanding commands */
uint_t throttle_limit; /* current throttle limit */
uint_t cr_pool_size;
/*
* num of chunks in command/response
* pool, each chunk allows 128 packets
*/
struct sf_target_stats tstats[127]; /* per target stats */
char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */
} sf_stats_t;
/* SOCAL Host Adapter kstat structures. */
#define FC_STATUS_ENTRIES 256
struct fc_pstats {
uint_t port; /* which port 0 or 1 */
uint_t requests; /* requests issued by this soc+ */
uint_t sol_resps; /* solicited responses received */
uint_t unsol_resps; /* unsolicited responses received */
uint_t lips; /* forced loop initialization */
uint_t els_sent; /* extended link service commands issued */
uint_t els_rcvd; /* extended link service commands received */
uint_t abts; /* aborts attempted */
uint_t abts_ok; /* aborts successful */
uint_t offlines; /* changes to offline state */
uint_t onlines; /* changes to online state */
uint_t online_loops; /* changes to online-loop state */
uint_t resp_status[FC_STATUS_ENTRIES]; /* response status */
};
/*
* Fibre Channel Response codes
*/
#define FCAL_STATUS_OK 0
#define FCAL_STATUS_P_RJT 2
#define FCAL_STATUS_F_RJT 3
#define FCAL_STATUS_P_BSY 4
#define FCAL_STATUS_F_BSY 5
#define FCAL_STATUS_ONLINE 0x10
#define FCAL_STATUS_OLDPORT_ONLINE FCAL_STATUS_ONLINE
#define FCAL_STATUS_ERR_OFFLINE 0x11
#define FCAL_STATUS_TIMEOUT 0x12
#define FCAL_STATUS_ERR_OVERRUN 0x13
#define FCAL_STATUS_LOOP_ONLINE 0x14
#define FCAL_STATUS_OLD_PORT 0x15
#define FCAL_STATUS_AL_PORT 0x16
#define FCAL_STATUS_UNKNOWN_CQ_TYPE 0x20 /* unknown request type */
#define FCAL_STATUS_BAD_SEG_CNT 0x21 /* insufficient # of segments */
#define FCAL_STATUS_MAX_XCHG_EXCEEDED 0x22
#define FCAL_STATUS_BAD_XID 0x23
#define FCAL_STATUS_XCHG_BUSY 0x24
#define FCAL_STATUS_BAD_POOL_ID 0x25
#define FCAL_STATUS_INSUFFICIENT_CQES 0x26
#define FCAL_STATUS_ALLOC_FAIL 0x27
#define FCAL_STATUS_BAD_SID 0x28
#define FCAL_STATUS_NO_SEQ_INIT 0x29
#define FCAL_STATUS_BAD_DID 0x2a
#define FCAL_STATUS_ABORTED 0x30
#define FCAL_STATUS_ABORT_FAILED 0x31
#define FCAL_STATUS_DIAG_BUSY 0x32
#define FCAL_STATUS_DIAG_INVALID 0x33
#define FCAL_STATUS_INCOMPLETE_DMA_ERR 0x34
#define FCAL_STATUS_CRC_ERR 0x35
#define FCAL_STATUS_OPEN_FAIL 0x36
#define FCAL_STATUS_ERROR 0x80
#define FCAL_STATUS_ONLINE_TIMEOUT 0x81
#define FCAL_STATUS_MAX_STATUS FCAL_STATUS_CRC_ERR
typedef struct socal_stats {
uint_t version; /* version of this struct, >1 */
uint_t resets; /* chip resets */
uint_t reqq_intrs; /* request queue interrupts */
uint_t qfulls; /* request queue full encountered */
struct fc_pstats pstats[2]; /* per port kstats */
char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */
char fw_revision[MAXNAMELEN]; /* Firmware date string.\0 */
char node_wwn[17]; /* Node WWN */
char port_wwn[2][17]; /* Port WWN \0 */
uint_t parity_chk_enabled; /* != 0 if HBA checks parity. */
} socal_stats_t;
struct ifp_target_stats {
int logouts_recvd;
/*
* unsolicited LOGOs recvd from
* target
*/
int task_mgmt_failures;
int data_ro_mismatches;
int dl_len_mismatches;
};
typedef struct ifp_target_stats ifp_target_stats_t;
struct ifp_stats {
int version; /* version of this struct, >1 */
int lip_count; /* lips forced by ifp */
int ncmds; /* outstanding commands */
ifp_target_stats_t tstats[127]; /* per target stats */
char drvr_name[MAXNAMELEN]; /* Name of driver, NULL term. */
char fw_revision[MAXNAMELEN]; /* Firmware date string.\0 */
char node_wwn[17]; /* Node WWN */
char port_wwn[17]; /* Port WWN \0 */
uint_t parity_chk_enabled; /* != 0 if HBA checks parity. */
uint_t resp_status[FC_STATUS_ENTRIES]; /* response status */
};
typedef struct ifp_stats ifp_stats_t;
/*
* Defines for the QLA21xx resp_status -- this is the command completion status
*/
#define IFP_CMD_CMPLT 0x00 /* no transport errors */
#define IFP_CMD_INCOMPLETE 0x01 /* abnormal transport state */
#define IFP_CMD_DMA_DERR 0x02 /* DMA direction error */
#define IFP_CMD_TRAN_ERR 0x03 /* unspecified transport error */
#define IFP_CMD_RESET 0x04 /* reset aborted transport */
#define IFP_CMD_ABORTED 0x05 /* aborted on request */
#define IFP_CMD_TIMEOUT 0x06 /* command timed out */
#define IFP_CMD_DATA_OVR 0x07 /* data overrun--discard extra */
#define IFP_CMD_ABORT_REJECTED 0x0e /* target rejected abort msg */
#define IFP_CMD_RESET_REJECTED 0x12 /* target rejected reset msg */
#define IFP_CMD_DATA_UNDER 0x15 /* data underrun */
#define IFP_CMD_QUEUE_FULL 0x1c /* queue full SCSI status */
#define IFP_CMD_PORT_UNAVAIL 0x28 /* port unavailable */
#define IFP_CMD_PORT_LOGGED_OUT 0x29 /* port loged out */
#define IFP_CMD_PORT_CONFIG_CHANGED 0x2a /* port name changed */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FC4_FCIO_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_FCP_H
#define _SYS_FC4_FCP_H
/*
* Frame format and protocol definitions for transferring
* commands and data between a SCSI initiator and target
* using an FC4 serial link interface.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* FCP Device Data Frame Information Categories
*/
#define FCP_SCSI_DATA 0x01 /* frame contains SCSI data */
#define FCP_SCSI_CMD 0x02 /* frame contains SCSI command */
#define FCP_SCSI_RSP 0x03 /* frame contains SCSI response */
#define FCP_SCSI_XFER_RDY 0x05 /* frame contains xfer rdy block */
/*
* FCP SCSI Control structure
*/
typedef struct fcp_cntl {
uchar_t cntl_reserved_0; /* reserved */
uchar_t cntl_reserved_1 : 5, /* reserved */
cntl_qtype : 3; /* tagged queueing type */
uchar_t cntl_kill_tsk : 1, /* terminate task */
cntl_clr_aca : 1, /* clear aca */
cntl_reset : 1, /* reset */
cntl_reserved_2 : 2, /* reserved */
cntl_clr_tsk : 1, /* clear task set */
cntl_abort_tsk : 1, /* abort task set */
cntl_reserved_3 : 1; /* reserved */
uchar_t cntl_reserved_4 : 6, /* reserved */
cntl_read_data : 1, /* initiator read */
cntl_write_data : 1; /* initiator write */
} fcp_cntl_t;
/*
* FCP SCSI Control Tagged Queueing types - cntl_qtype
*/
#define FCP_QTYPE_SIMPLE 0 /* simple queueing */
#define FCP_QTYPE_HEAD_OF_Q 1 /* head of queue */
#define FCP_QTYPE_ORDERED 2 /* ordered queueing */
#define FCP_QTYPE_ACA_Q_TAG 4 /* ACA queueing */
#define FCP_QTYPE_UNTAGGED 5 /* Untagged */
/*
* FCP SCSI Entity Address
*
* ent_addr_0 is always the first and highest layer of
* the hierarchy. The depth of the hierarchy of addressing,
* up to a maximum of four layers, is arbitrary and
* device-dependent.
*/
typedef struct fcp_ent_addr {
ushort_t ent_addr_0; /* entity address 0 */
ushort_t ent_addr_1; /* entity address 1 */
ushort_t ent_addr_2; /* entity address 2 */
ushort_t ent_addr_3; /* entity address 3 */
} fcp_ent_addr_t;
/*
* Maximum size of SCSI cdb in FCP SCSI command
*/
#define FCP_CDB_SIZE 16
#define FCP_LUN_SIZE 8
/*
* FCP SCSI command payload
*/
typedef struct fcp_cmd {
fcp_ent_addr_t fcp_ent_addr; /* entity address */
fcp_cntl_t fcp_cntl; /* SCSI options */
uchar_t fcp_cdb[FCP_CDB_SIZE]; /* SCSI cdb */
int fcp_data_len; /* data length */
} fcp_cmd_t;
/*
* FCP SCSI status
*/
typedef struct fcp_status {
ushort_t reserved_0; /* reserved */
uchar_t reserved_1 : 4, /* reserved */
resid_under : 1, /* resid non-zero */
resid_over : 1, /* resid non-zero */
sense_len_set : 1, /* sense_len non-zero */
rsp_len_set : 1; /* response_len non-zero */
uchar_t scsi_status; /* status of cmd */
} fcp_status_t;
#define resid_len_set resid_over /* for pln */
/*
* FCP SCSI Response Payload
*/
typedef struct fcp_rsp {
uint_t reserved_0; /* reserved */
uint_t reserved_1; /* reserved */
union {
fcp_status_t fcp_status; /* command status */
uint_t i_fcp_status;
}fcp_u;
uint_t fcp_resid; /* resid of operation */
uint_t fcp_sense_len; /* sense data length */
uint_t fcp_response_len; /* response data length */
/*
* 'm' bytes of scsi response info follow
* 'n' bytes of scsi sense info follow
*/
} fcp_rsp_t;
#define FCP_MAX_RSP_IU_SIZE 256
/*
* FCP RSP_INFO field format
*/
struct fcp_rsp_info {
uchar_t resvd1;
uchar_t resvd2;
uchar_t resvd3;
uchar_t rsp_code;
uchar_t resvd4;
uchar_t resvd5;
uchar_t resvd6;
uchar_t resvd7;
};
/* RSP_CODE definitions */
#define FCP_NO_FAILURE 0x0
#define FCP_DL_LEN_MISMATCH 0x1
#define FCP_CMND_INVALID 0x2
#define FCP_DATA_RO_MISMATCH 0x3
#define FCP_TASK_MGMT_NOT_SUPPTD 0x4
#define FCP_TASK_MGMT_FAILED 0x5
/*
* FCP SCSI_ XFER_RDY Payload
*/
typedef struct fcp_xfer_rdy {
ulong_t fcp_seq_offset; /* relative offset */
ulong_t fcp_burst_len; /* buffer space */
ulong_t reserved; /* reserved */
} fcp_xfer_rdy_t;
/*
* FCP PRLI Payload
*/
struct fcp_prli {
uchar_t type;
uchar_t resvd1;
uint_t orig_process_assoc_valid:1;
uint_t resp_process_assoc_valid:1;
uint_t establish_image_pair:1;
uint_t resvd2:13;
uint_t orig_process_associator;
uint_t resp_process_associator;
uint_t resvd3:25;
uint_t data_overlay_allowed:1;
uint_t initiator_fn:1;
uint_t target_fn:1;
uint_t cmd_data_mixed:1;
uint_t data_resp_mixed:1;
uint_t read_xfer_rdy_disabled:1;
uint_t write_xfer_rdy_disabled:1;
};
/*
* FCP PRLI ACC Payload
*/
struct fcp_prli_acc {
uchar_t type;
uchar_t resvd1;
uint_t orig_process_assoc_valid:1;
uint_t resp_process_assoc_valid:1;
uint_t image_pair_establsihed:1;
uint_t resvd2:1;
uint_t accept_response_code:4;
uint_t resvd3:8;
uint_t orig_process_associator;
uint_t resp_process_associator;
uint_t resvd4:26;
uint_t initiator_fn:1;
uint_t target_fn:1;
uint_t cmd_data_mixed:1;
uint_t data_resp_mixed:1;
uint_t read_xfer_rdy_disabled:1;
uint_t write_xfer_rdy_disabled:1;
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FC4_FCP_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995,1997-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FC4_LINKAPP_H
#define _SYS_FC4_LINKAPP_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* linkapp.h
*
* This file contains the definitions for structures and macros
* for fiber channel link application payloads and data.
*/
/*
* Well Known Fiber Chaneel Addresses to reach the fabric for
* various services.
*/
#define FS_GENERAL_MULTICAST 0xfffff7
#define FS_WELL_KNOWN_MULTICAST 0xfffff8
#define FS_HUNT_GROUP 0xfffff9
#define FS_MANAGEMENT_SERVER 0xfffffa
#define FS_TIME_SERVER 0xfffffb
#define FS_NAME_SERVER 0xfffffc
#define FS_FABRIC_CONTROLLER 0xfffffd
#define FS_FABRIC_F_PORT 0xfffffe
#define FS_BROADCAST 0xffffff
/*
* Link Application Opcodes.
*/
#define LA_RJT 0x01000000
#define LA_ACC 0x02000000
#define LA_LOGI 0x03000000
#define LA_LOGO 0x04000000
#define LA_RLS 0x0d000000
#define LA_IDENT 0x20000000
/* Basic Accept Payload. */
typedef struct ba_acc {
uchar_t seq_id:8;
uchar_t org_s_id[3];
ushort_t ox_id;
ushort_t rx_id;
} ba_acc_t;
/* Basic Reject. */
typedef struct ba_rjt {
uchar_t reseved;
uchar_t reason_code;
uchar_t explanation;
uchar_t vendor;
} ba_rjt_t;
/*
* Basic Reject Reason Codes.
*/
#define RJT_INVALID_CMD 0x01
#define RJT_LOGICAL_ERR 0x03
#define RJT_LOGICAL_BUSY 0x05
#define RJT_PROTOCOL_ERR 0x07
#define RJT_UNABLE 0x09
#define RJT_UNSUPPORTED 0x0B
#define RJT_VENDOR 0xFF
/*
* Basic Reject Explanation Codes
*/
#define RJT_NOEXPLANATION 0x00
#define RJT_INVALID_OSID 0x01
#define RJT_INVALID_OXID_RXID 0x03
#define RJT_INVALID_SEQID 0x05
#define RJT_ABORT_INACTIVE_SEQ 0x07
#define RJT_UNABLE_TO_SUPPLY 0x09
/*
* Service parameters.
*/
typedef struct common_service {
uint_t fcph;
uint_t btob_crdt;
uint_t cmn_features;
uint_t reserved;
} common_svc_t;
typedef struct service_param {
uchar_t data[16];
} svc_param_t;
/* World Wide Name formats */
typedef union la_wwn {
uchar_t raw_wwn[8];
struct {
uint_t naa_id : 4;
uint_t nport_id : 12;
uint_t wwn_hi : 16;
uint_t wwn_lo;
} w;
} la_wwn_t;
/*
* Values for naa_id
*/
#define NAA_ID_IEEE 1
#define NAA_ID_IEEE_EXTENDED 2
/* Login Payload. */
typedef struct la_logi {
unsigned code;
common_svc_t common_service;
la_wwn_t nport_ww_name;
la_wwn_t node_ww_name;
svc_param_t class_1;
svc_param_t class_2;
svc_param_t class_3;
} la_logi_t;
#define SP_F_PORT_LOGIN 0x10
/* Read Link Error Status */
typedef struct la_rls {
unsigned code;
uchar_t reserved;
uchar_t nport_id[3];
} la_rls_t;
/* Read Link Error Status Reply */
typedef struct la_rls_reply {
unsigned code;
unsigned link_failure;
unsigned loss_of_sync;
unsigned loss_of_signal;
unsigned primitive;
unsigned invalid_transmission;
unsigned invalid_crc;
} la_rls_reply_t;
/* Logout payload. */
typedef struct la_logo {
unsigned cmd;
} la_logo_t;
/* Logout reply payload. */
typedef la_logo_t la_logo_reply_t;
/* Link Application Reject */
typedef struct la_rjt {
int code;
uchar_t reserved;
uchar_t reason_code;
uchar_t explanation;
uchar_t vendor;
} la_rjt_t;
/*
* LA_RJT Reason Codes.
*/
#define LA_RJT_INVALID 0x01
#define LA_RJT_LOGICAL_ERR 0x03
#define LA_RJT_LOGICAL_BUSY 0x05
#define LA_RJT_PROTOCOL_ERR 0x07
#define LA_RJT_UNABLE_TO_PERFORM 0x09
#define LA_RJT_NOT_SUPPORTED 0x0b
#define LA_RJT_VENDOR 0xff
/*
* LA_RJT explanations
*/
#define LA_RJT_NOEXPLANATION 0x00
#define LA_RJT_OPTIONS 0x01
#define LA_RJT_INITIATOR 0x03
#define LA_RJT_RECIPIENT 0x05
#define LA_RJT_DATA_FIELD_SIZE 0x07
#define LA_RJT_CONCURRENT 0x09
#define LA_RJT_CREDIT 0x0b
#define LA_RJT_INVALID_PORT_WWNAME 0x0d
#define LA_RJT_INVALID_NODE_WWNAME 0x0e
#define LA_RJT_INVALID_COMMON_SVC 0x0f
#define LA_RJT_INSUFFICENT 0x29
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FC4_LINKAPP_H */
|