xref: /haiku/src/add-ons/kernel/busses/scsi/usb/usb_scsi.h (revision 9ecf9d1c1d4888d341a6eac72112c72d1ae3a4cb)
1 /*
2  * Copyright (c) 2003-2005 by Siarzhuk Zharski <imker@gmx.li>
3  * Distributed under the terms of the BSD License.
4  *
5  */
6 
7 #ifndef _USB_SCSI_H_
8   #define _USB_SCSI_H_
9 
10 #ifndef _OS_H
11   #include <OS.h>
12 #endif //_OS_H
13 
14 #ifndef _USB_V3_H
15   #include "USB_v3.h"
16 #endif /* _USB_V3_H */
17 
18 #ifndef _CAM_H
19   #include <CAM.h>
20 #endif /*_CAM_H*/
21 
22 #define MODULE_NAME "usb_scsi"
23 
24 #define CONTROLLER_SCSI_BUS 0x00 /* Narrow SCSI bus. Use PI_* to alter this*/
25 #define MAX_DEVICES_COUNT   0x07 /* simulate Narrow SCSI bus - 8 devices*/
26 #define CONTROLLER_SCSI_ID  0x07 /* "controller" SCSI ID */
27 #define MAX_LUNS_COUNT      0x08
28 
29 /* transport protocol definitions - are not bitmasks */
30 #define PROTO_NONE      0x00000000
31 #define PROTO_BULK_ONLY 0x00000001
32 #define PROTO_CB        0x00000002
33 #define PROTO_CBI       0x00000003
34 
35 #define PROTO_VENDOR    0x0000000e
36 #define PROTO_MASK      0x0000000f
37 
38 #define PROTO(__value) ((__value) & PROTO_MASK)
39 
40 /* command set definitions  - are not bitmasks */
41 #define CMDSET_NONE     0x00000000
42 #define CMDSET_SCSI     0x00000010
43 #define CMDSET_UFI      0x00000020
44 #define CMDSET_ATAPI    0x00000030
45 #define CMDSET_RBC      0x00000040
46 #define CMDSET_QIC157   0x00000050
47 
48 #define CMDSET_VENDOR   0x000000e0
49 #define CMDSET_MASK     0x000000f0
50 
51 #define CMDSET(__value)((__value) & CMDSET_MASK)
52 
53 #define HAS_SET(__mask, __flag) \
54           (((__mask) & __flag) == (__flag))
55 
56 /* fixes - bitmasked */
57 #define FIX_NO_GETMAXLUN     0x00000100
58 #define FIX_FORCE_RW_TO_6    0x00000200
59 #define FIX_NO_TEST_UNIT     0x00000400
60 #define FIX_NO_INQUIRY       0x00000800
61 #define FIX_TRANS_TEST_UNIT  0x00001000
62 #define FIX_NO_PREVENT_MEDIA 0x00002000
63 #define FIX_FORCE_MS_TO_10   0x00004000
64 #define FIX_FORCE_READ_ONLY  0x00008000
65 
66 #define FIX_NONE             0x00000000
67 #define FIX_MASK             0x000fff00
68 
69 #define HAS_FIXES(__value, __fix) \
70                   HAS_SET((__value), (__fix))
71 
72 #endif /*_USB_SCSI_H_*/
73