[VFATLIB] Never touch the file system if not in interactive or RW mode.
[reactos.git] / drivers / storage / inc / rbc.h
1 /*++
2
3 Copyright (C) Microsoft Corporation, 1998 - 1999
4
5 Module Name:
6
7 rbc.h
8
9 Abstract:
10
11 These are the structures and defines used in the Reduced Block Command set
12
13 Authors:
14
15 George Chrysanthakopoulos(georgioc) - April 1998
16
17 Revision History:
18
19 Dan Knudson (DanKn), 23 Sep 1999 - updated per rev 10 of RBC spec
20
21 --*/
22 #ifndef _NTRBC_
23 #define _NTRBC_
24
25 #include "scsi.h"
26
27 //
28 // Command Descriptor Block. encapsulated under the bus/protocol specific request block
29 //
30
31 typedef union _CDB_RBC {
32
33 //
34 // format unit
35 //
36
37 struct _FORMAT_RBC {
38 UCHAR OperationCode;
39 UCHAR VendorSpecific;
40 UCHAR Increment : 1;
41 UCHAR Percent_Time : 1;
42 UCHAR Reserved1 : 1;
43 UCHAR VendorSpecific1 : 5;
44 UCHAR Reserved2[2];
45 UCHAR Control;
46 } FORMAT_RBC, *PFORMAT_RBC;
47
48 //
49 // prevent/allow medium removal
50 //
51
52 struct _MEDIA_REMOVAL_RBC {
53 UCHAR OperationCode;
54 UCHAR Reserved[3];
55
56 UCHAR Prevent : 1;
57 UCHAR Persistent : 1;
58 UCHAR Reserved3 : 6;
59
60 UCHAR Control;
61 } MEDIA_REMOVAL_RBC, *PMEDIA_REMOVAL_RBC;
62
63 //
64 // START_STOP_UNIT
65 //
66
67 struct _START_STOP_RBC {
68 UCHAR OperationCode;
69 UCHAR Immediate: 1;
70 UCHAR Reserved1 : 7;
71 UCHAR Reserved2[2];
72 UCHAR Start : 1;
73 UCHAR LoadEject : 1;
74 UCHAR Reserved3 : 2;
75 UCHAR PowerConditions : 4;
76 UCHAR Control;
77 } START_STOP_RBC, *PSTART_STOP_RBC;
78
79 struct _SYNCHRONIZE_CACHE_RBC {
80
81 UCHAR OperationCode; // 0x35
82 UCHAR Reserved[8];
83 UCHAR Control;
84
85 } SYNCHRONIZE_CACHE_RBC, *PSYNCHRONIZE_CACHE_RBC;
86
87
88 } CDB_RBC, *PCDB_RBC;
89
90
91 //
92 // START_STOP_UNIT Power Condition descriptions
93 //
94
95 #define START_STOP_RBC_POWER_CND_NO_CHANGE 0
96 #define START_STOP_RBC_POWER_CND_ACTIVE 1
97 #define START_STOP_RBC_POWER_CND_IDLE 2
98 #define START_STOP_RBC_POWER_CND_STANDBY 3
99 #define START_STOP_RBC_POWER_CND_SLEEP 5
100 #define START_STOP_RBC_POWER_CND_DEVICE_CTRL 7
101
102
103 //
104 // Mode Sense/Select page constants.
105 //
106
107 #define MODE_PAGE_RBC_DEVICE_PARAMETERS 0x06
108
109
110 //
111 // DeviceType field in inquiry Data
112 //
113
114 #define RBC_DEVICE 0x0E
115
116 //
117 // Define Device Capabilities page.
118 //
119
120 typedef struct _MODE_RBC_DEVICE_PARAMETERS_PAGE {
121 UCHAR PageCode : 6;
122 UCHAR Reserved : 1;
123 UCHAR PageSavable : 1;
124 UCHAR PageLength;
125 UCHAR WriteCacheDisable : 1;
126 UCHAR Reserved1 : 7;
127 UCHAR LogicalBlockSize[2];
128 UCHAR NumberOfLogicalBlocks[5];
129 UCHAR PowerPerformance;
130 UCHAR LockDisabled : 1;
131 UCHAR FormatDisabled : 1;
132 UCHAR WriteDisabled : 1;
133 UCHAR ReadDisabled : 1;
134 UCHAR Reserved2 : 4;
135 UCHAR Reserved3;
136
137 }MODE_RBC_DEVICE_PARAMETERS_PAGE, *PMODE_RBC_DEVICE_PARAMETERS_PAGE;
138
139 typedef struct _MODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE {
140
141 MODE_PARAMETER_HEADER Header;
142 MODE_RBC_DEVICE_PARAMETERS_PAGE Page;
143
144 }MODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE,
145 *PMODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE;
146
147
148 //
149 // unsolicited status sense code qualifier values
150 //
151
152 #define RBC_UNSOLICITED_STATUS 0x02
153 #define RBC_UNSOLICITED_SENSE_KEY 0x06
154
155 #define RBC_UNSOLICITED_SC_PWR_STATE_CHNG 0xFF
156 #define RBC_UNSOLICITED_SC_EVENT_STATUS 0xFE
157
158 #define RBC_UNSOLICITED_CLASS_ASQ_DEVICE 0x06
159 #define RBC_UNSOLICITED_CLASS_ASQ_MEDIA 0x04
160 #define RBC_UNSOLICITED_CLASS_ASQ_POWER 0x02
161
162
163
164
165 //
166 // Translation routine used to convert SCSI requests that differ from RBC
167 //
168
169 NTSTATUS
170 Rbc_Scsi_Conversion(
171 IN PSCSI_REQUEST_BLOCK Srb,
172 IN PSCSI_REQUEST_BLOCK *OriginalSrb,
173 IN PMODE_RBC_DEVICE_PARAMETERS_HEADER_AND_PAGE RbcHeaderAndPage,
174 IN BOOLEAN OutgoingRequest,
175 IN BOOLEAN RemovableMedia
176 );
177
178
179 #endif
180