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
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
/*
* (c) Copyright INTERACTIVE Systems Corporation 1986, 1988, 1990
* All rights reserved.
*/
#ifndef _SYS_DKTP_ALTSCTR_H
#define _SYS_DKTP_ALTSCTR_H
#ifdef __cplusplus
extern "C" {
#endif
/* alternate sector partition information table */
struct alts_parttbl {
uint32_t alts_sanity; /* to validate correctness */
uint32_t alts_version; /* version number */
uint32_t alts_map_base; /* disk offset of alts_partmap */
uint32_t alts_map_len; /* byte length of alts_partmap */
uint32_t alts_ent_base; /* disk offset of alts_entry */
uint32_t alts_ent_used; /* number of alternate entries used */
uint32_t alts_ent_end; /* disk offset of top of alts_entry */
uint32_t alts_resv_base; /* disk offset of alts_reserved */
uint32_t alts_pad[5]; /* reserved fields */
};
/* alternate sector remap entry table */
struct alts_ent {
uint32_t bad_start; /* starting bad sector number */
uint32_t bad_end; /* ending bad sector number */
uint32_t good_start; /* starting alternate sector to use */
};
/* size of alternate partition table structure */
#define ALTS_PARTTBL_SIZE sizeof (struct alts_parttbl)
/* size of alternate entry table structure */
#define ALTS_ENT_SIZE sizeof (struct alts_ent)
/* definition for alternate sector partition sector map */
#define ALTS_GOOD 0 /* good alternate sectors */
#define ALTS_BAD 1 /* bad alternate sectors */
/* definition for alternate sector partition id */
#define ALTS_SANITY 0xaabbccdd /* magic number to validate alts_part */
#define ALTS_VERSION1 0x01 /* version of alts_parttbl */
#define ALTS_ENT_EMPTY -1 /* empty alternate entry */
#define ALTS_MAP_UP 1 /* search forward with increasing sect# */
#define ALTS_MAP_DOWN -1 /* search backward with decreasing sect# */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_ALTSCTR_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_BBH_H
#define _SYS_DKTP_BBH_H
#include <sys/scsi/scsi_types.h>
#ifdef __cplusplus
extern "C" {
#endif
struct bbh_cookie {
lldaddr_t _ck_sector; /* sector # on device (union) */
long ck_seclen; /* number of contiguous sec */
};
#define ck_lsector _ck_sector._f
#define ck_sector _ck_sector._p._l
typedef struct bbh_cookie *bbh_cookie_t;
struct bbh_handle {
int h_totck;
int h_idx;
struct bbh_cookie *h_cktab;
};
struct bbh_obj {
opaque_t bbh_data;
struct bbh_objops *bbh_ops;
};
struct bbh_objops {
int (*bbh_init)(opaque_t);
int (*bbh_free)(struct bbh_obj *);
opaque_t (*bbh_gethandle)(opaque_t, struct buf *);
bbh_cookie_t (*bbh_htoc)(opaque_t, opaque_t);
void (*bbh_freehandle)(opaque_t, opaque_t);
void *bbh_resv[2];
};
#define BBH_GETCK_SECTOR(X, ckp) ((ckp)->ck_sector)
#define BBH_GETCK_SECLEN(X, ckp) ((ckp)->ck_seclen)
#define BBH_INIT(X) (*((struct bbh_obj *)(X))->bbh_ops->bbh_init)\
(((struct bbh_obj *)(X))->bbh_data)
#define BBH_FREE(X) (*((struct bbh_obj *)(X))->bbh_ops->bbh_free) ((X))
#define BBH_GETHANDLE(X, bp) (*((struct bbh_obj *)(X))->bbh_ops->bbh_gethandle)\
(((struct bbh_obj *)(X))->bbh_data, (bp))
#define BBH_HTOC(X, handle) (*((struct bbh_obj *)(X))->bbh_ops->bbh_htoc) \
(((struct bbh_obj *)(X))->bbh_data, (handle))
#define BBH_FREEHANDLE(X, handle) \
(*((struct bbh_obj *)(X))->bbh_ops->bbh_freehandle) \
(((struct bbh_obj *)(X))->bbh_data, (handle))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_BBH_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 2014 Garrett D'Amore <garrett@damore.org>
*
* Copyright (c) 1992 Sun Microsystems, Inc. All Rights Reserved.
*/
#ifndef _SYS_DKTP_CM_H
#define _SYS_DKTP_CM_H
#include <sys/types.h>
#ifdef _KERNEL
#include <sys/conf.h>
#include <sys/stat.h>
#include <sys/errno.h>
#include <sys/kmem.h>
#include <sys/fcntl.h>
#include <sys/open.h>
#include <sys/sysmacros.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#endif /* _KERNEL */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
#ifndef _SYS_SCSI_SCSI_H
typedef void * opaque_t;
#endif
#define PRF prom_printf
#define SET_BP_SEC(bp, X) ((bp)->b_private = (void *) (X))
#define GET_BP_SEC(bp) ((daddr_t)(bp)->b_private)
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_CM_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) 1992 Sun Microsystems, Inc. All Rights Reserved.
*/
#ifndef _SYS_DKTP_CMDEV_H
#define _SYS_DKTP_CMDEV_H
#ifdef __cplusplus
extern "C" {
#endif
#define CMDEV_TARG(devp) (devp)->sd_address.a_target
#define CMDEV_LUN(devp) (devp)->sd_address.a_lun
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_CMDEV_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_CMDK_H
#define _SYS_DKTP_CMDK_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/cmlb.h>
#include <sys/dktp/tgdk.h>
#define CMDK_UNITSHF 6
#define CMDK_MAXPART (1 << CMDK_UNITSHF)
/*
* Model number is 40 ASCII characters
* Serial number is 20 ASCII characters
*/
#define CMDK_HWIDLEN (64)
struct cmdk {
/* set during probe */
dev_info_t *dk_dip;
dev_t dk_dev;
struct tgdk_obj *dk_tgobjp; /* target disk object pointer */
/* set during attach */
cmlb_handle_t dk_cmlbhandle;
ddi_devid_t dk_devid;
kmutex_t dk_mutex; /* mutex for cmdk struct */
long dk_flag;
uint64_t dk_open_reg[OTYPCNT]; /* bit per partition: 2^6 */
ulong_t dk_open_lyr[CMDK_MAXPART]; /* OTYP_LYR cnt/partition */
uint64_t dk_open_exl; /* bit per partition: 2^6 */
struct bbh_obj dk_bbh_obj;
/*
* BBH variables
* protected by dk_bbh_mutex
*/
krwlock_t dk_bbh_mutex; /* bbh mutex */
tgdk_iob_handle dk_alts_hdl; /* iob for V_ALTSCTR */
uint32_t dk_altused; /* num entries in V_ALTSCTR */
uint32_t *dk_slc_cnt; /* entries per slice */
struct alts_ent **dk_slc_ent; /* link to remap data */
/*
* for power management
*/
kmutex_t dk_pm_mutex;
kcondvar_t dk_suspend_cv;
uint32_t dk_pm_level;
uint32_t dk_pm_is_enabled;
};
/*
* Power Management definitions
*/
#define CMDK_SPINDLE_UNINIT ((uint_t)(-1))
#define CMDK_SPINDLE_OFF 0x0
#define CMDK_SPINDLE_ON 0x1
/* common disk flags definitions */
#define CMDK_OPEN 0x1
#define CMDK_SUSPEND 0x2
#define CMDK_TGDK_OPEN 0x4
#define CMDKUNIT(dev) (getminor((dev)) >> CMDK_UNITSHF)
#define CMDKPART(dev) (getminor((dev)) & (CMDK_MAXPART - 1))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_CMDK_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) 1992,1997-1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_DKTP_CMPKT_H
#define _SYS_DKTP_CMPKT_H
#ifdef __cplusplus
extern "C" {
#endif
struct cmpkt {
opaque_t cp_objp; /* ptr to generic ctlr object */
opaque_t cp_ctl_private; /* ptr to controller private */
opaque_t cp_dev_private; /* ptr to device driver private */
int cp_scblen; /* len of status control blk */
opaque_t cp_scbp; /* status control blk */
int cp_cdblen; /* len of cmd description blk */
opaque_t cp_cdbp; /* command description blk */
long cp_reason; /* error status */
void (*cp_callback)(); /* callback function */
long cp_time; /* timeout values */
long cp_flags;
struct buf *cp_bp; /* link to buf structure */
long cp_resid; /* data bytes not transferred */
long cp_byteleft; /* remaining bytes to do */
/* for a particular disk section */
long cp_bytexfer; /* bytes xfer in this operation */
daddr_t cp_srtsec; /* starting sector number */
long cp_secleft; /* # of sectors remains */
ushort_t cp_retry; /* retry count */
ushort_t cp_resv;
void (*cp_iodone)(); /* target driver iodone() */
struct cmpkt *cp_fltpktp; /* fault recovery pkt pointer */
opaque_t cp_private;
opaque_t cp_passthru; /* pass through command ptr */
};
/* reason code for completion status */
#define CPS_SUCCESS 0 /* command completes with no err */
#define CPS_FAILURE 1 /* command fails */
#define CPS_CHKERR 2 /* command fails with status */
#define CPS_ABORTED 3 /* command aborted */
/* flags definitions */
#define CPF_NOINTR 0x0001 /* polling mode */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_CMPKT_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_DKTP_CONTROLLER_H
#define _SYS_DKTP_CONTROLLER_H
#ifdef __cplusplus
extern "C" {
#endif
struct ctl_ext {
opaque_t c_type_cookie; /* controller info */
dev_info_t *c_ctldip; /* dip to controller driver */
dev_info_t *c_devdip; /* dip to target device driver */
int c_targ; /* device target number */
int c_blksz; /* device unit size (secsz) */
};
struct ctl_obj {
opaque_t c_data;
struct ctl_objops *c_ops;
struct ctl_ext *c_ext;
struct ctl_ext c_extblk; /* extended blk defined */
/* for easy of alloc */
};
struct ctl_objops {
struct cmpkt *(*c_pktalloc)(opaque_t, int (*)(caddr_t), caddr_t);
void (*c_pktfree)(opaque_t, struct cmpkt *);
struct cmpkt *(*c_memsetup)(opaque_t, struct cmpkt *, struct buf *,
int (*)(caddr_t), caddr_t);
void (*c_memfree)(opaque_t, struct cmpkt *);
struct cmpkt *(*c_iosetup)(opaque_t, struct cmpkt *);
int (*c_transport)(opaque_t, struct cmpkt *);
int (*c_reset)(opaque_t, int);
int (*c_abort)(opaque_t, struct cmpkt *);
int (*c_getcap)(opaque_t, char *, int);
int (*c_setcap)(opaque_t, char *, int);
int (*c_ioctl)(opaque_t, int, intptr_t, int);
void *c_resv[2];
};
#define CTL_DIP_CTL(X) (((struct ctl_obj *)(X))->c_ext->c_ctldip)
#define CTL_DIP_DEV(X) (((struct ctl_obj *)(X))->c_ext->c_devdip)
#define CTL_GET_TYPE(X) (((struct ctl_obj *)(X))->c_ext->c_type_cookie)
#define CTL_GET_LKARG(X) (((struct ctl_obj *)(X))->c_ext->c_lkarg)
#define CTL_GET_TARG(X) (((struct ctl_obj *)(X))->c_ext->c_targ)
#define CTL_GET_BLKSZ(X) (((struct ctl_obj *)(X))->c_ext->c_blksz)
#define CTL_PKTALLOC(X, callback, arg) \
(*((struct ctl_obj *)(X))->c_ops->c_pktalloc) \
(((struct ctl_obj *)(X))->c_data, (callback), (arg))
#define CTL_PKTFREE(X, pktp) \
(*((struct ctl_obj *)(X))->c_ops->c_pktfree) \
(((struct ctl_obj *)(X))->c_data, (pktp))
#define CTL_MEMSETUP(X, pktp, bp, callback, arg) \
(*((struct ctl_obj *)(X))->c_ops->c_memsetup) \
(((struct ctl_obj *)(X))->c_data, (pktp), (bp), (callback), (arg))
#define CTL_MEMFREE(X, pktp) (*((struct ctl_obj *)(X))->c_ops->c_memfree) \
(((struct ctl_obj *)(X))->c_data, (pktp))
#define CTL_IOSETUP(X, pktp) (*((struct ctl_obj *)(X))->c_ops->c_iosetup) \
(((struct ctl_obj *)(X))->c_data, (pktp))
#define CTL_TRANSPORT(X, pktp) (*((struct ctl_obj *)(X))->c_ops->c_transport) \
(((struct ctl_obj *)(X))->c_data, (pktp))
#define CTL_ABORT(X, pktp) (*((struct ctl_obj *)(X))->c_ops->c_abort) \
(((struct ctl_obj *)(X))->c_data, (pktp))
#define CTL_RESET(X, level) (*((struct ctl_obj *)(X))->c_ops->c_reset) \
(((struct ctl_obj *)(X))->c_data, (level))
#define CTL_IOCTL(X, cmd, arg, flag) \
(*((struct ctl_obj *)(X))->c_ops->c_ioctl) \
(((struct ctl_obj *)(X))->c_data, (cmd), (arg), (flag))
/* transport return code */
#define CTL_SEND_SUCCESS 0
#define CTL_SEND_FAILURE 1
#define CTL_SEND_BUSY 2
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_CONTROLLER_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) 1992 Sun Microsystems, Inc. All Rights Reserved.
*/
#ifndef _SYS_DKTP_DADEV_H
#define _SYS_DKTP_DADEV_H
#include <sys/dktp/controller.h>
#include <sys/dktp/cmpkt.h>
#include <sys/dktp/gda.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_DADEV_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_DADK_H
#define _SYS_DKTP_DADK_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/dktp/tgcom.h>
struct dadk {
struct tgdk_ext *dad_extp; /* back pointer to ext data */
struct scsi_device *dad_sd; /* back pointer to SCSI_DEVICE */
struct tgdk_geom dad_logg; /* logical disk geometry */
struct tgdk_geom dad_phyg; /* physical disk geometry */
unsigned dad_rmb : 1; /* removable device */
unsigned dad_rdonly : 1; /* read only device */
unsigned dad_cdrom : 1; /* cdrom device */
unsigned dad_noflush : 1; /* flush cmd unsupported */
unsigned dad_wce : 1; /* disk write cache enabled */
unsigned dad_resv : 3;
unsigned char dad_type; /* device type */
unsigned char dad_ctype; /* controller type */
short dad_secshf;
short dad_blkshf;
opaque_t dad_bbhobjp; /* bbh object ptr */
opaque_t dad_flcobjp; /* flow control object ptr */
opaque_t dad_ctlobjp; /* controller object ptr */
struct tgcom_obj dad_com; /* com object for flowctrl */
enum dkio_state dad_iostate; /* ejected/inserted */
kmutex_t dad_mutex; /* protect dad_state */
kcondvar_t dad_state_cv; /* condition variable for state */
uchar_t dad_thread_cnt; /* reference count on removable */
/* - disk state watcher thread */
kstat_t *dad_errstats; /* error stats */
kmutex_t dad_cmd_mutex;
int dad_cmd_count;
};
#define DAD_SECSIZ dad_phyg.g_secsiz
/*
* Local definitions, for clarity of code
*/
/*
* Parameters
*/
#define DADK_BSY_TIMEOUT (drv_usectohz(5 * 1000000))
#define DADK_IO_TIME 35
#define DADK_FLUSH_CACHE_TIME 60
#define DADK_RETRY_COUNT 5
#define DADK_SILENT 1
#define PKT2DADK(pktp) ((struct dadk *)(pktp)->cp_dev_private)
/*
* packet action codes
*/
#define COMMAND_DONE 0
#define COMMAND_DONE_ERROR 1
#define QUE_COMMAND 2
#define QUE_SENSE 3
#define JUST_RETURN 4
typedef struct dadk_errstats {
kstat_named_t dadk_softerrs; /* Collecting Softerrs */
kstat_named_t dadk_harderrs; /* Collecting harderrs */
kstat_named_t dadk_transerrs; /* Collecting Transfer errs */
kstat_named_t dadk_model; /* model # of the disk */
kstat_named_t dadk_revision; /* The disk revision */
kstat_named_t dadk_serial; /* The disk serial number */
kstat_named_t dadk_capacity; /* Capacity of the disk */
kstat_named_t dadk_rq_media_err; /* Any media err seen */
kstat_named_t dadk_rq_ntrdy_err; /* Not ready errs */
kstat_named_t dadk_rq_nodev_err; /* No device errs */
kstat_named_t dadk_rq_recov_err; /* Recovered errs */
kstat_named_t dadk_rq_illrq_err; /* Illegal requests */
} dadk_errstats_t;
int dadk_init(opaque_t objp, opaque_t devp, opaque_t flcobjp,
opaque_t queobjp, opaque_t bbhobjp, void *lkarg);
int dadk_free(struct tgdk_obj *dkobjp);
int dadk_probe(opaque_t objp, int kmsflg);
int dadk_attach(opaque_t objp);
int dadk_open(opaque_t objp, int flag);
int dadk_close(opaque_t objp);
int dadk_ioctl(opaque_t objp, dev_t dev, int cmd, intptr_t arg,
int flag, cred_t *cred_p, int *rval_p);
int dadk_flushdone(struct buf *bp);
int dadk_strategy(opaque_t objp, struct buf *bp);
int dadk_setgeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
int dadk_getgeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
struct tgdk_iob *dadk_iob_alloc(opaque_t objp, daddr_t blkno,
ssize_t xfer, int kmsflg);
int dadk_iob_free(opaque_t objp, struct tgdk_iob *iobp);
caddr_t dadk_iob_htoc(opaque_t objp, struct tgdk_iob *iobp);
caddr_t dadk_iob_xfer(opaque_t objp, struct tgdk_iob *iobp, int rw);
int dadk_dump(opaque_t objp, struct buf *bp);
int dadk_getphygeom(opaque_t objp, struct tgdk_geom *dkgeom_p);
int dadk_set_bbhobj(opaque_t objp, opaque_t bbhobjp);
int dadk_check_media(opaque_t objp, int *state);
static void dadk_watch_thread(struct dadk *dadkp);
int dadk_inquiry(opaque_t objp, opaque_t *inqpp);
void dadk_cleanup(struct tgdk_obj *dkobjp);
int dadk_getcmds(opaque_t objp);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_DADK_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_DADKIO_H
#define _SYS_DKTP_DADKIO_H
#ifdef __cplusplus
extern "C" {
#endif
/* direct coupled disk driver ioctl command */
#define DIOCTL_GETGEOM 1 /* get logical disk geometry */
#define DIOCTL_GETPHYGEOM 2 /* get physical disk geometry */
#define DIOCTL_GETMODEL 3 /* get model number */
#define DIOCTL_GETSERIAL 4 /* get serial number */
#define DIOCTL_RWCMD 5 /* read/write a disk */
#define DIOCTL_GETWCE 6 /* get write cache enabled state */
#if !defined(BLKADDR_TYPE)
#define BLKADDR_TYPE
#if defined(_EXTVTOC)
typedef unsigned long blkaddr_t;
typedef unsigned int blkaddr32_t;
#else
typedef daddr_t blkaddr_t;
typedef daddr32_t blkaddr32_t;
#endif
#endif
/*
* arg structure for DIOCTL_GETMODEL and DIOCTL_GETSERIAL
* On input to the ioctl, is_size contains the size of the buffer
* pointed to by is_buf;
* On return, is_size contains the number of characters needed to
* represent the string. This may be more than the input value, in
* which case the caller can choose to
* 1. Use the truncated string as is
* 2. Allocate a buffer of is_size+1 bytes to hold the string
*/
#ifdef _SYSCALL32
typedef struct dadk_ioc_string32
{
caddr32_t is_buf; /* pointer to character array */
int is_size; /* string length */
} dadk_ioc_string32_t;
#endif /* _SYSCALL32 */
typedef struct dadk_ioc_string
{
caddr_t is_buf; /* pointer to character array */
int is_size; /* string length */
} dadk_ioc_string_t;
/* direct coupled disk driver command */
#define DCMD_READ 1 /* Read Sectors/Blocks */
#define DCMD_WRITE 2 /* Write Sectors/Blocks */
#define DCMD_FMTTRK 3 /* Format Tracks */
#define DCMD_FMTDRV 4 /* Format entire drive */
#define DCMD_RECAL 5 /* Recalibrate */
#define DCMD_SEEK 6 /* Seek to Cylinder */
#define DCMD_RDVER 7 /* Read Verify sectors on disk */
#define DCMD_GETDEF 8 /* Read manufacturers defect list */
/* cd-rom commands */
#define DCMD_LOCK 9 /* Lock door */
#define DCMD_UNLOCK 10 /* Unlock door */
#define DCMD_START_MOTOR 11 /* Start motor */
#define DCMD_STOP_MOTOR 12 /* Stop motor */
#define DCMD_EJECT 13 /* Eject medium */
#define DCMD_UPDATE_GEOM 14 /* Update geometry */
#define DCMD_GET_STATE 15 /* Get removable disk status */
#define DCMD_PAUSE 16 /* cdrom pause */
#define DCMD_RESUME 17 /* cdrom resume */
#define DCMD_PLAYTRKIND 18 /* cdrom play by track and index */
#define DCMD_PLAYMSF 19 /* cdrom play msf */
#define DCMD_SUBCHNL 20 /* cdrom sub channel */
#define DCMD_READMODE1 21 /* cdrom read mode 1 */
#define DCMD_READTOCHDR 22 /* cdrom read table of contents header */
#define DCMD_READTOCENT 23 /* cdrom read table of contents entry */
#define DCMD_READOFFSET 24 /* cdrom read offset */
#define DCMD_READMODE2 25 /* cdrom mode 2 */
#define DCMD_VOLCTRL 26 /* cdrom volume control */
/* additional disk commands */
#define DCMD_FLUSH_CACHE 27 /* flush write cache to physical medium */
/* driver error code */
#define DERR_SUCCESS 0 /* success */
#define DERR_AMNF 1 /* address mark not found */
#define DERR_TKONF 2 /* track 0 not found */
#define DERR_ABORT 3 /* aborted command */
#define DERR_DWF 4 /* write fault */
#define DERR_IDNF 5 /* ID not found */
#define DERR_BUSY 6 /* drive busy */
#define DERR_UNC 7 /* uncorrectable data error */
#define DERR_BBK 8 /* bad block detected */
#define DERR_INVCDB 9 /* invalid cdb */
#define DERR_HARD 10 /* hard device error - no retry */
/*
* atapi additional error codes
*/
#define DERR_ILI 11 /* Illegal length indication */
#define DERR_EOM 12 /* End of media detected */
#define DERR_MCR 13 /* Media change requested */
/*
* atapi (SCSI) sense key errors
*/
#define DERR_RECOVER 14 /* Recovered from error */
#define DERR_NOTREADY 15 /* Device not ready */
#define DERR_MEDIUM 16 /* Medium error */
#define DERR_HW 17 /* Hardware error */
#define DERR_ILL 18 /* Illegal request */
#define DERR_UNIT_ATTN 19 /* Unit attention */
#define DERR_DATA_PROT 20 /* Data protection */
#define DERR_MISCOMP 21 /* Miscompare */
#define DERR_ICRC 22 /* Interface CRC error -- new driver */
/* error code in ATA-4 and newer */
#define DERR_RESV 23 /* Reserved */
struct dadkio_derr {
int d_action;
int d_severity;
};
/*
* dadkio_rwcmd cmd
*/
#define DADKIO_RWCMD_READ 1 /* read command */
#define DADKIO_RWCMD_WRITE 2 /* write command */
/*
* dadkio_rwcmd flags
*/
#define DADKIO_FLAG_SILENT 0x01 /* driver should not */
/* generate any warning */
/* or error console msgs */
#define DADKIO_FLAG_RESERVED 0x02 /* reserved/not used */
#define DADKIO_ERROR_INFO_LEN 128
/*
* dadkio_status status value.
*/
struct dadkio_status {
int status;
ulong_t resid;
int failed_blk_is_valid;
blkaddr_t failed_blk;
int fru_code_is_valid;
int fru_code;
char add_error_info[DADKIO_ERROR_INFO_LEN];
};
#ifdef _SYSCALL32
struct dadkio_status32 {
int status;
uint32_t resid;
int failed_blk_is_valid;
blkaddr32_t failed_blk;
int fru_code_is_valid;
int fru_code;
char add_error_info[DADKIO_ERROR_INFO_LEN];
};
#endif /* _SYSCALL32 */
/*
* Used by read/write ioctl (DKIOCTL_RWCMD)
*/
struct dadkio_rwcmd {
int cmd;
int flags;
blkaddr_t blkaddr;
uint_t buflen;
caddr_t bufaddr;
struct dadkio_status status;
};
#ifdef _SYSCALL32
struct dadkio_rwcmd32 {
int cmd;
int flags;
blkaddr32_t blkaddr;
uint_t buflen;
caddr32_t bufaddr;
struct dadkio_status32 status;
};
#endif /* _SYSCALL32 */
/*
* dadkio_status status values
*/
#define DADKIO_STAT_NO_ERROR 0 /* cmd was successful */
#define DADKIO_STAT_NOT_READY 1 /* device not ready */
#define DADKIO_STAT_MEDIUM_ERROR 2 /* error on medium */
#define DADKIO_STAT_HARDWARE_ERROR 3 /* other hardware error */
#define DADKIO_STAT_ILLEGAL_REQUEST 4 /* illegal request */
#define DADKIO_STAT_ILLEGAL_ADDRESS 5 /* illegal block address */
#define DADKIO_STAT_WRITE_PROTECTED 6 /* device write-protected */
#define DADKIO_STAT_TIMED_OUT 7 /* no response from device */
#define DADKIO_STAT_PARITY 8 /* parity error in data */
#define DADKIO_STAT_BUS_ERROR 9 /* error on bus */
#define DADKIO_STAT_SOFT_ERROR 10 /* data recovered via ECC */
#define DADKIO_STAT_NO_RESOURCES 11 /* no resources for cmd */
#define DADKIO_STAT_NOT_FORMATTED 12 /* device is not formatted */
#define DADKIO_STAT_RESERVED 13 /* device is reserved */
#define DADKIO_STAT_NOT_SUPPORTED 14 /* feature not supported */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_DADKIO_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) 1992 Sun Microsystems, Inc. All Rights Reserved.
*/
#ifndef _SYS_DKTP_FCTYPES_H
#define _SYS_DKTP_FCTYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#define DMULT_MAXCNT 2
#define DUPLX_MAXCNT 2
#define ds_kstat ds_cmn.dsc_kstat
#define ds_mutex ds_cmn.dsc_mutex
#define ds_tgcomobjp ds_cmn.dsc_tgcomobjp
struct fc_data_cmn {
kstat_t *dsc_kstat;
kmutex_t dsc_mutex;
opaque_t dsc_tgcomobjp;
};
struct fc_data {
struct fc_data_cmn ds_cmn;
short ds_flag;
short ds_outcnt;
struct diskhd ds_tab;
opaque_t ds_queobjp;
};
#define ds_actf ds_tab.b_actf
#define ds_actl ds_tab.b_actl
#define ds_waitcnt ds_tab.b_bcount
#define ds_bp ds_actf
struct fc_que {
struct fc_que *next;
opaque_t fc_qobjp;
struct buf *fc_bp;
short fc_outcnt;
short fc_maxcnt;
};
struct duplx_data {
struct fc_data_cmn ds_cmn;
struct fc_que ds_readq;
struct fc_que ds_writeq;
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_FCTYPES_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988 AT&T */
/* All Rights Reserved */
#ifndef _SYS_DKTP_FDISK_H
#define _SYS_DKTP_FDISK_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* fdisk.h
* This file defines the structure of physical disk sector 0 for use on
* AT386 systems. The format of this sector is constrained by the ROM
* BIOS and MS-DOS conventions.
* Note that this block does not define the partitions used by the unix
* driver. The unix partitions are obtained from the VTOC.
*/
/*
* the MAX values are the maximum usable values for BIOS chs values
* The MAX_CYL value of 1022 is the maximum usable value
* the value of 1023 is a fence value,
* indicating no CHS geometry exists for the corresponding LBA value.
* HEAD range [ 0 .. MAX_HEAD ], so number of heads is (MAX_HEAD + 1)
* SECT range [ 1 .. MAX_SECT ], so number of sectors is (MAX_SECT)
*/
#define MAX_SECT (63)
#define MAX_CYL (1022)
#define MAX_HEAD (254)
/*
* BOOTSZ was reduced from 446 to 440 bytes to NOT overwrite the Windows
* Vista DISKID. Otherwise Vista won't boot from Solaris GRUB in a dual-boot
* setup.
* The actual size of mboot code is 425 bytes while that of GRUB stage1 is
* 423 bytes. So this changes does not harm them.
*/
#define BOOTSZ 440 /* size of boot code in master boot block */
#define FD_NUMPART 4 /* number of 'partitions' in fdisk table */
#define MBB_MAGIC 0xAA55 /* magic number for mboot.signature */
#define DEFAULT_INTLV 4 /* default interleave for testing tracks */
#define MINPSIZE 4 /* minimum number of cylinders in a partition */
#define TSTPAT 0xE5 /* test pattern for verifying disk */
/*
* structure to hold the fdisk partition table
*/
struct ipart {
unsigned char bootid; /* bootable or not */
unsigned char beghead; /* beginning head, sector, cylinder */
unsigned char begsect; /* begcyl is a 10-bit number. High 2 bits */
unsigned char begcyl; /* are in begsect. */
unsigned char systid; /* OS type */
unsigned char endhead; /* ending head, sector, cylinder */
unsigned char endsect; /* endcyl is a 10-bit number. High 2 bits */
unsigned char endcyl; /* are in endsect. */
uint32_t relsect; /* first sector relative to start of disk */
uint32_t numsect; /* number of sectors in partition */
};
/*
* Values for bootid.
*/
#define NOTACTIVE 0
#define ACTIVE 128
/*
* Values for systid.
*/
#define UNUSED 0 /* Empty Partition */
#define DOSOS12 1 /* DOS partition, 12-bit FAT */
#define PCIXOS 2 /* PC/IX partition */
#define DOSOS16 4 /* DOS partition, 16-bit FAT */
#define EXTDOS 5 /* EXT-DOS partition */
#define DOSHUGE 6 /* Huge DOS partition > 32MB */
#define FDISK_IFS 7 /* Installable File System (IFS): HPFS & NTFS */
#define FDISK_AIXBOOT 8 /* AIX Boot */
#define FDISK_AIXDATA 9 /* AIX Data */
#define FDISK_OS2BOOT 10 /* OS/2 Boot Manager */
#define FDISK_WINDOWS 11 /* Windows 95 FAT32 (up to 2047GB) */
#define FDISK_EXT_WIN 12 /* Windows 95 FAT32 (extended-INT13) */
#define FDISK_FAT95 14 /* DOS 16-bit FAT, LBA-mapped */
#define FDISK_EXTLBA 15 /* Extended partition, LBA-mapped */
#define DIAGPART 18 /* Diagnostic boot partition (OS independent) */
#define FDISK_LINUX 65 /* Linux */
#define FDISK_LINUXDSWAP 66 /* Linux swap (sharing disk w/ DRDOS) */
#define FDISK_LINUXDNAT 67 /* Linux native (sharing disk with DRDOS) */
#define FDISK_CPM 82 /* CP/M */
#define DOSDATA 86 /* DOS data partition */
#define OTHEROS 98 /* part. type for appl. (DB?) needs */
/* raw partition. ID was 0 but conflicted */
/* with DOS 3.3 fdisk */
#define UNIXOS 99 /* UNIX V.x partition */
#define FDISK_NOVELL2 100 /* Novell Netware 286 */
#define FDISK_NOVELL3 101 /* Novell Netware 3.x and later */
#define FDISK_QNX4 119 /* QNX 4.x */
#define FDISK_QNX42 120 /* QNX 4.x 2nd part */
#define FDISK_QNX43 121 /* QNX 4.x 3rd part */
#define SUNIXOS 130 /* Solaris UNIX partition */
#define FDISK_LINUXNAT 131 /* Linux native */
#define FDISK_NTFSVOL1 134 /* NTFS volume set 1 */
#define FDISK_NTFSVOL2 135 /* NTFS volume set 2 */
#define FDISK_BSD 165 /* BSD/386, 386BSD, NetBSD, FreeBSD, OpenBSD */
#define FDISK_NEXTSTEP 167 /* NeXTSTEP */
#define FDISK_BSDIFS 183 /* BSDI file system */
#define FDISK_BSDISWAP 184 /* BSDI swap */
#define X86BOOT 190 /* x86 Solaris boot partition */
#define SUNIXOS2 191 /* Solaris UNIX partition */
#define EFI_PMBR 238 /* EFI PMBR */
#define EFI_FS 239 /* EFI File System (System Partition) */
#define MAXDOS 65535L /* max size (sectors) for DOS partition */
/*
* structure to hold master boot block in physical sector 0 of the disk.
* Note that partitions stuff can't be directly included in the structure
* because of lameo '386 compiler alignment design.
* Alignment issues also force us to have 2 16bit entities for a single
* 32bit win_volserno. It is not used anywhere anyway.
*/
struct mboot { /* master boot block */
char bootinst[BOOTSZ];
uint16_t win_volserno_lo;
uint16_t win_volserno_hi;
uint16_t reserved;
char parts[FD_NUMPART * sizeof (struct ipart)];
ushort_t signature;
};
#if defined(__i386) || defined(__amd64)
/* Byte offset of the start of the partition table within the sector */
#define FDISK_PART_TABLE_START 446
/* Maximum number of valid partitions assumed as 32 */
#define MAX_EXT_PARTS 32
#else
#define MAX_EXT_PARTS 0
#endif /* if defined(__i386) || defined(__amd64) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_FDISK_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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_FLOWCTRL_H
#define _SYS_DKTP_FLOWCTRL_H
#ifdef __cplusplus
extern "C" {
#endif
struct flc_obj {
opaque_t flc_data;
struct flc_objops *flc_ops;
};
struct flc_objops {
int (*flc_init)(opaque_t, opaque_t, opaque_t, void *);
int (*flc_free)(struct flc_obj *);
int (*flc_enque)(opaque_t, struct buf *);
int (*flc_deque)(opaque_t, struct buf *);
int (*flc_start_kstat)(opaque_t, char *, int);
int (*flc_stop_kstat)(opaque_t);
void *flc_resv[2];
};
struct flc_obj *dsngl_create();
struct flc_obj *dmult_create();
struct flc_obj *duplx_create();
struct flc_obj *adapt_create();
#define FLC_INIT(X, tgcomobjp, queobjp, lkarg) \
(*((struct flc_obj *)(X))->flc_ops->flc_init) \
(((struct flc_obj *)(X))->flc_data, (tgcomobjp), (queobjp), (lkarg))
#define FLC_FREE(X) (*((struct flc_obj *)(X))->flc_ops->flc_free) ((X))
#define FLC_ENQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_enque) \
(((struct flc_obj *)(X))->flc_data, (bp))
#define FLC_DEQUE(X, bp) (*((struct flc_obj *)(X))->flc_ops->flc_deque) \
(((struct flc_obj *)(X))->flc_data, (bp))
#define FLC_START_KSTAT(X, devtype, instance) \
(*((struct flc_obj *)(X))->flc_ops->flc_start_kstat)\
(((struct flc_obj *)(X))->flc_data, (devtype), (instance))
#define FLC_STOP_KSTAT(X) (*((struct flc_obj *)(X))->flc_ops->flc_stop_kstat) \
(((struct flc_obj *)(X))->flc_data)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_FLOWCTRL_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_GDA_H
#define _SYS_DKTP_GDA_H
#ifdef __cplusplus
extern "C" {
#endif
#define GDA_RTYCNT 3
#define GDA_BP_PKT(bp) ((struct cmpkt *)(bp)->av_back)
#ifdef _KERNEL
extern void gda_inqfill(char *p, int l, char *s);
/*PRINTFLIKE4*/
extern void gda_log(dev_info_t *, char *, uint_t, const char *, ...)
__KPRINTFLIKE(4);
extern void gda_errmsg(struct scsi_device *, struct cmpkt *, char *,
int, daddr_t, daddr_t, char **, char **);
extern struct cmpkt *gda_pktprep(opaque_t objp, struct cmpkt *in_pktp,
opaque_t dmatoken, int (*func)(caddr_t), caddr_t arg);
extern void gda_free(opaque_t objp, struct cmpkt *pktp, struct buf *bp);
#endif /* _KERNEL */
#define GDA_GETGEOM_HEAD(X) (((X) >> 16) & 0xff)
#define GDA_GETGEOM_SEC(X) ((X) & 0xff)
#define GDA_SETGEOM(hd, sec) (((hd) << 16) | (sec))
#define GDA_KMFLAG(callback) (((callback) == DDI_DMA_SLEEP) ? \
KM_SLEEP: KM_NOSLEEP)
#define GDA_ALL 0
#define GDA_UNKNOWN 1
#define GDA_INFORMATIONAL 2
#define GDA_RECOVERED 3
#define GDA_RETRYABLE 4
#define GDA_FATAL 5
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_GDA_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) 1992 Sun Microsystems, Inc. All Rights Reserved.
*/
#ifndef _SYS_DKTP_QUETYPES_H
#define _SYS_DKTP_QUETYPES_H
#ifdef __cplusplus
extern "C" {
#endif
struct que_data {
kmutex_t q_mutex;
struct diskhd q_tab;
};
#define q_cnt q_tab.b_bcount
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_QUETYPES_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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_QUEUE_H
#define _SYS_DKTP_QUEUE_H
#ifdef __cplusplus
extern "C" {
#endif
struct que_obj {
opaque_t que_data;
struct que_objops *que_ops;
};
struct que_objops {
int (*que_init)(struct que_data *, void *);
int (*que_free)(struct que_obj *);
int (*que_ins)(struct que_data *, struct buf *);
struct buf *(*que_del)(struct que_data *);
void *que_res[2];
};
struct que_obj *qfifo_create();
struct que_obj *qmerge_create();
struct que_obj *qsort_create();
struct que_obj *qtag_create();
#define QUE_INIT(X, lkarg) (*((struct que_obj *)(X))->que_ops->que_init) \
(((struct que_obj *)(X))->que_data, (lkarg))
#define QUE_FREE(X) (*((struct que_obj *)(X))->que_ops->que_free) ((X))
#define QUE_ADD(X, bp) (*((struct que_obj *)(X))->que_ops->que_ins) \
(((struct que_obj *)(X))->que_data, (bp))
#define QUE_DEL(X) (*((struct que_obj *)(X))->que_ops->que_del) \
(((struct que_obj *)(X))->que_data)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_QUEUE_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_DKTP_TGCOM_H
#define _SYS_DKTP_TGCOM_H
#ifdef __cplusplus
extern "C" {
#endif
struct tgcom_obj {
opaque_t com_data;
struct tgcom_objops *com_ops;
};
struct tgcom_objops {
int (*com_init)(opaque_t);
int (*com_free)(struct tgcom_obj *);
int (*com_pkt)(opaque_t, struct buf *, int (*func)(caddr_t),
caddr_t);
void (*com_transport)(opaque_t, struct buf *);
void *com_resv[2];
};
#define TGCOM_INIT(X) (*((struct tgcom_obj *)(X))->com_ops->com_init)\
(((struct tgcom_obj *)(X))->com_data)
#define TGCOM_FREE(X) (*((struct tgcom_obj *)(X))->com_ops->com_free) ((X))
#define TGCOM_PKT(X, bp, cb, arg) \
(*((struct tgcom_obj *)(X))->com_ops->com_pkt) \
(((struct tgcom_obj *)(X))->com_data, (bp), (cb), (arg))
#define TGCOM_TRANSPORT(X, bp) \
(*((struct tgcom_obj *)(X))->com_ops->com_transport) \
(((struct tgcom_obj *)(X))->com_data, (bp))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_TGCOM_H */
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DKTP_TGDK_H
#define _SYS_DKTP_TGDK_H
#ifdef __cplusplus
extern "C" {
#endif
struct tgdk_ext {
unsigned tg_rmb : 1;
unsigned tg_rdonly : 1;
unsigned tg_flag : 6;
char *tg_nodetype;
char tg_ctype;
};
struct tgdk_obj {
opaque_t tg_data;
struct tgdk_objops *tg_ops;
struct tgdk_ext *tg_ext;
struct tgdk_ext tg_extblk; /* extended blk defined */
/* for easy of alloc */
};
struct tgdk_iob {
struct buf *b_bp;
daddr_t b_lblk;
ssize_t b_xfer;
daddr_t b_psec;
ssize_t b_pbytecnt;
short b_pbyteoff;
short b_flag;
};
typedef struct tgdk_iob *tgdk_iob_handle;
#define IOB_BPALLOC 0x0001
#define IOB_BPBUFALLOC 0x0002
struct tgdk_geom {
int g_cyl;
int g_acyl;
int g_head;
int g_sec;
int g_secsiz;
diskaddr_t g_cap;
};
struct tgdk_objops {
int (*tg_init)(opaque_t, opaque_t, opaque_t, opaque_t, opaque_t,
void *);
int (*tg_free)(struct tgdk_obj *);
int (*tg_probe)(opaque_t, int);
int (*tg_attach)(opaque_t);
int (*tg_open)(opaque_t, int);
int (*tg_close)(opaque_t);
int (*tg_ioctl)(opaque_t, dev_t, int, intptr_t, int, cred_t *, int *);
int (*tg_strategy)(opaque_t, struct buf *);
int (*tg_setgeom)(opaque_t, struct tgdk_geom *);
int (*tg_getgeom)(opaque_t, struct tgdk_geom *);
tgdk_iob_handle (*tg_iob_alloc)(opaque_t, daddr_t, ssize_t, int);
int (*tg_iob_free)(opaque_t, struct tgdk_iob *);
caddr_t (*tg_iob_htoc)(opaque_t, struct tgdk_iob *);
caddr_t (*tg_iob_xfer)(opaque_t, struct tgdk_iob *, int);
int (*tg_dump)(opaque_t, struct buf *);
int (*tg_getphygeom)(opaque_t, struct tgdk_geom *);
int (*tg_set_bbhobj)(opaque_t, opaque_t);
int (*tg_check_media)(opaque_t, int *);
int (*tg_inquiry)(opaque_t, opaque_t *);
void (*tg_cleanup)(struct tgdk_obj *);
void *tg_resv[1];
};
struct tgdk_obj *dadk_create();
#define TGDK_GETNODETYPE(X) (((struct tgdk_obj *)(X))->tg_ext->tg_nodetype)
#define TGDK_SETNODETYPE(X, Y) \
(((struct tgdk_obj *)(X))->tg_ext->tg_nodetype = (char *)(Y))
#define TGDK_RMB(X) (((struct tgdk_obj *)(X))->tg_ext->tg_rmb)
#define TGDK_RDONLY(X) (((struct tgdk_obj *)(X))->tg_ext->tg_rdonly)
#define TGDK_GETCTYPE(X) (((struct tgdk_obj *)(X))->tg_ext->tg_ctype)
#define TGDK_INIT(X, devp, flcobjp, queobjp, bbhobjp, lkarg) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_init) \
(((struct tgdk_obj *)(X))->tg_data, (devp), (flcobjp), \
(queobjp), (bbhobjp), (lkarg))
#define TGDK_INIT_X(X, devp, flcobjp, queobjp, bbhobjp, lkarg, cbfunc, cbarg) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_init) \
(((struct tgdk_obj *)(X))->tg_data, (devp), (flcobjp), \
(queobjp), (bbhobjp), (lkarg), (cbfunc), (cbarg))
#define TGDK_FREE(X) (*((struct tgdk_obj *)(X))->tg_ops->tg_free) ((X))
#define TGDK_PROBE(X, WAIT) (*((struct tgdk_obj *)(X))->tg_ops->tg_probe) \
(((struct tgdk_obj *)(X))->tg_data, (WAIT))
#define TGDK_ATTACH(X) (*((struct tgdk_obj *)(X))->tg_ops->tg_attach) \
(((struct tgdk_obj *)(X))->tg_data)
#define TGDK_OPEN(X, flag) (*((struct tgdk_obj *)(X))->tg_ops->tg_open) \
(((struct tgdk_obj *)(X))->tg_data, (flag))
#define TGDK_CLOSE(X) (*((struct tgdk_obj *)(X))->tg_ops->tg_close) \
(((struct tgdk_obj *)(X))->tg_data)
#define TGDK_IOCTL(X, dev, cmd, arg, flag, cred_p, rval_p) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_ioctl) \
(((struct tgdk_obj *)(X))->tg_data, (dev), (cmd), (arg), (flag), \
(cred_p), (rval_p))
#define TGDK_STRATEGY(X, bp) (*((struct tgdk_obj *)(X))->tg_ops->tg_strategy) \
(((struct tgdk_obj *)(X))->tg_data, (bp))
#define TGDK_GETGEOM(X, datap) (*((struct tgdk_obj *)(X))->tg_ops->tg_getgeom) \
(((struct tgdk_obj *)(X))->tg_data, (datap))
#define TGDK_SETGEOM(X, datap) (*((struct tgdk_obj *)(X))->tg_ops->tg_setgeom) \
(((struct tgdk_obj *)(X))->tg_data, (datap))
#define TGDK_IOB_ALLOC(X, logblk, xfer, sleep) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_iob_alloc) \
(((struct tgdk_obj *)(X))->tg_data, (logblk), (xfer), (sleep))
#define TGDK_IOB_FREE(X, datap) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_iob_free) \
(((struct tgdk_obj *)(X))->tg_data, (datap))
#define TGDK_IOB_HTOC(X, handle) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_iob_htoc) \
(((struct tgdk_obj *)(X))->tg_data, (handle))
#define TGDK_IOB_RD(X, handle) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_iob_xfer) \
(((struct tgdk_obj *)(X))->tg_data, (handle), B_READ)
#define TGDK_IOB_WR(X, handle) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_iob_xfer) \
(((struct tgdk_obj *)(X))->tg_data, (handle), B_WRITE)
#define TGDK_DUMP(X, bp) (*((struct tgdk_obj *)(X))->tg_ops->tg_dump) \
(((struct tgdk_obj *)(X))->tg_data, (bp))
#define TGDK_GETPHYGEOM(X, datap) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_getphygeom) \
(((struct tgdk_obj *)(X))->tg_data, (datap))
#define TGDK_SET_BBHOBJ(X, objp) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_set_bbhobj) \
(((struct tgdk_obj *)(X))->tg_data, (objp))
#define TGDK_CHECK_MEDIA(X, state) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_check_media) \
(((struct tgdk_obj *)(X))->tg_data, (state))
#define TGDK_INQUIRY(X, inqpp) \
(*((struct tgdk_obj *)(X))->tg_ops->tg_inquiry) \
(((struct tgdk_obj *)(X))->tg_data, (inqpp))
#define TGDK_CLEANUP(X) (*((struct tgdk_obj *)(X))->tg_ops->tg_cleanup) ((X))
#define LBLK2SEC(BLK, SHF) (daddr_t)((BLK) >> (SHF))
#define SETBPERR bioerror
#define DK_MAXRECSIZE (256<<10) /* maximum io record size */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DKTP_TGDK_H */
|