-
Notifications
You must be signed in to change notification settings - Fork 198
/
JMicronUsbRaidDef.h
252 lines (228 loc) · 9.21 KB
/
JMicronUsbRaidDef.h
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
/*---------------------------------------------------------------------------*/
// Author : hiyohiyo
// Mail : [email protected]
// Web : https://crystalmark.info/
// License : MIT License
/*---------------------------------------------------------------------------*/
#pragma once
//-----------------------------------------------------------------------------
//
// Struct Defines
//
//-----------------------------------------------------------------------------
#define NUMBER_ATA_SMART_ATTRIBUTES 30
#pragma pack(push,1)
typedef struct _IDENTIFY_DEVICE
{
WORD GeneralConfiguration; //0
WORD LogicalCylinders; //1 Obsolete
WORD SpecificConfiguration; //2
WORD LogicalHeads; //3 Obsolete
WORD Retired1[2]; //4-5
WORD LogicalSectors; //6 Obsolete
DWORD ReservedForCompactFlash; //7-8
WORD Retired2; //9
CHAR SerialNumber[20]; //10-19
WORD Retired3; //20
WORD BufferSize; //21 Obsolete
WORD Obsolute4; //22
CHAR FirmwareRev[8]; //23-26
CHAR Model[40]; //27-46
WORD MaxNumPerInterupt; //47
WORD Reserved1; //48
WORD Capabilities1; //49
WORD Capabilities2; //50
DWORD Obsolute5; //51-52
WORD Field88and7064; //53
WORD Obsolute6[5]; //54-58
WORD MultSectorStuff; //59
DWORD TotalAddressableSectors; //60-61
WORD Obsolute7; //62
WORD MultiWordDma; //63
WORD PioMode; //64
WORD MinMultiwordDmaCycleTime; //65
WORD RecommendedMultiwordDmaCycleTime; //66
WORD MinPioCycleTimewoFlowCtrl; //67
WORD MinPioCycleTimeWithFlowCtrl; //68
WORD Reserved2[6]; //69-74
WORD QueueDepth; //75
WORD SerialAtaCapabilities; //76
WORD SerialAtaAdditionalCapabilities; //77
WORD SerialAtaFeaturesSupported; //78
WORD SerialAtaFeaturesEnabled; //79
WORD MajorVersion; //80
WORD MinorVersion; //81
WORD CommandSetSupported1; //82
WORD CommandSetSupported2; //83
WORD CommandSetSupported3; //84
WORD CommandSetEnabled1; //85
WORD CommandSetEnabled2; //86
WORD CommandSetDefault; //87
WORD UltraDmaMode; //88
WORD TimeReqForSecurityErase; //89
WORD TimeReqForEnhancedSecure; //90
WORD CurrentPowerManagement; //91
WORD MasterPasswordRevision; //92
WORD HardwareResetResult; //93
WORD AcoustricManagement; //94
WORD StreamMinRequestSize; //95
WORD StreamingTimeDma; //96
WORD StreamingAccessLatency; //97
DWORD StreamingPerformance; //98-99
ULONGLONG MaxUserLba; //100-103
WORD StremingTimePio; //104
WORD Reserved3; //105
WORD SectorSize; //106
WORD InterSeekDelay; //107
WORD IeeeOui; //108
WORD UniqueId3; //109
WORD UniqueId2; //110
WORD UniqueId1; //111
WORD Reserved4[4]; //112-115
WORD Reserved5; //116
DWORD WordsPerLogicalSector; //117-118
WORD Reserved6[8]; //119-126
WORD RemovableMediaStatus; //127
WORD SecurityStatus; //128
WORD VendorSpecific[31]; //129-159
WORD CfaPowerMode1; //160
WORD ReservedForCompactFlashAssociation[7]; //161-167
WORD DeviceNominalFormFactor; //168
WORD DataSetManagement; //169
WORD AdditionalProductIdentifier[4]; //170-173
WORD Reserved7[2]; //174-175
CHAR CurrentMediaSerialNo[60]; //176-205
WORD SctCommandTransport; //206
WORD ReservedForCeAta1[2]; //207-208
WORD AlignmentOfLogicalBlocks; //209
DWORD WriteReadVerifySectorCountMode3; //210-211
DWORD WriteReadVerifySectorCountMode2; //212-213
WORD NvCacheCapabilities; //214
DWORD NvCacheSizeLogicalBlocks; //215-216
WORD NominalMediaRotationRate; //217
WORD Reserved8; //218
WORD NvCacheOptions1; //219
WORD NvCacheOptions2; //220
WORD Reserved9; //221
WORD TransportMajorVersionNumber; //222
WORD TransportMinorVersionNumber; //223
WORD ReservedForCeAta2[10]; //224-233
WORD MinimumBlocksPerDownloadMicrocode; //234
WORD MaximumBlocksPerDownloadMicrocode; //235
WORD Reserved10[19]; //236-254
WORD IntegrityWord; //255
}IDENTIFY_DEVICE;
typedef struct _SMART_THRESHOLD
{
BYTE Id;
BYTE ThresholdValue;
BYTE Reserved[10];
} SMART_THRESHOLD;
/*
typedef struct _SMART_ATTRIBUTE
{
BYTE Id;
WORD StatusFlags;
BYTE CurrentValue;
BYTE WorstValue;
BYTE RawValue[6];
BYTE Reserved;
} SMART_ATTRIBUTE;
*/
typedef struct _SMART_READ_DATA
{
BYTE revision[2];
SMART_ATTRIBUTE attribute[NUMBER_ATA_SMART_ATTRIBUTES];
BYTE reserved[150];
} SMART_READ_DATA;
typedef struct _SMART_READ_THRESHOLD
{
BYTE revision[2];
SMART_THRESHOLD threshold[NUMBER_ATA_SMART_ATTRIBUTES];
BYTE reserved[150];
} SMART_READ_THRESHOLD;
typedef struct _BYTE512
{
BYTE b[512];
} BYTE512;
typedef union _UNION_IDENTIFY_DEVICE
{
IDENTIFY_DEVICE I;
BYTE512 B;
} UNION_IDENTIFY_DEVICE;
typedef union _UNION_SMART_ATTRIBUTE
{
SMART_READ_DATA A;
BYTE512 B;
} UNION_SMART_ATTRIBUTE;
typedef union _UNION_SMART_THRESHOLD
{
SMART_READ_THRESHOLD T;
BYTE512 B;
} UNION_SMART_THRESHOLD;
#define DISKNAME_LENGTH (40+1)
#define MODELNAME_LENGTH (20+1)
#define SERIALNUMBER_LENGTH (20+1)
#define DISK_FIRMWAREVERSION_LENGTH 9
typedef struct _NVME_PORT_40
{
uint8_t ModelName[41]; /* Model name of disk */
uint8_t SerialNumber[SERIALNUMBER_LENGTH]; /* Serial number of disk */
uint32_t SectorSize; /* 512 bytes or 4K */
uint32_t Capacity; /* Disk capacity */
uint32_t CapacityOffset; /* Disk capacity */
uint8_t DeviceState; /* Device State */
uint8_t RaidIndex; /* RAID Index */
uint8_t MemberIndex; /* Member Index */
uint8_t PortType; /* Port Type */
uint8_t PCIeSpeed; /* PCIe Speed */
uint8_t PCIeLANE; /* PCIe LANE */
uint16_t PortErrorStatus; /* NVMe port error status */
uint8_t DiskType;
} NVME_PORT_40;
typedef struct _NVME_PORT_20
{
uint8_t ModelName[21]; /* Model name of disk */
uint8_t SerialNumber[SERIALNUMBER_LENGTH]; /* Serial number of disk */
uint32_t SectorSize; /* 512 bytes or 4K */
uint32_t Capacity; /* Disk capacity */
uint32_t CapacityOffset; /* Disk capacity */
uint8_t DeviceState; /* Device State */
uint8_t RaidIndex; /* RAID Index */
uint8_t MemberIndex; /* Member Index */
uint8_t PortType; /* Port Type */
uint8_t PCIeSpeed; /* PCIe Speed */
uint8_t PCIeLANE; /* PCIe LANE */
uint16_t PortErrorStatus; /* NVMe port error status */
uint8_t DiskType;
} NVME_PORT_20;
#pragma pack(pop)
//-----------------------------------------------------------------------------
//
// Type Defines
//
//-----------------------------------------------------------------------------
// JMicron JMS56X API
typedef DWORD(WINAPI* _GetDllVersionJMS56X) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
typedef int(WINAPI* _GetControllerCountJMS56X) ();
typedef BOOL(WINAPI* _GetSmartInfoJMS56X) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* attribute, UNION_SMART_THRESHOLD* threshold);
typedef BOOL(WINAPI* _GetIdentifyInfoJMS56X) (int index, unsigned char port, UNION_IDENTIFY_DEVICE* identify);
// JMicron JMB39X API
typedef DWORD(WINAPI* _GetDllVersionJMB39X) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
typedef int(WINAPI* _GetControllerCountJMB39X) ();
typedef BOOL(WINAPI* _GetSmartInfoJMB39X) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* attribute, UNION_SMART_THRESHOLD* threshold);
typedef BOOL(WINAPI* _GetIdentifyInfoJMB39X) (int index, unsigned char port, UNION_IDENTIFY_DEVICE* identify);
// JMicron JMS586_Old API
typedef DWORD(WINAPI* _GetDllVersionJMS586_20) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
typedef int(WINAPI* _GetControllerCountJMS586_20) ();
typedef BOOL(WINAPI* _GetSmartInfoJMS586_20) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* attribute, UNION_SMART_THRESHOLD* threshold);
typedef BOOL(WINAPI* _GetIdentifyInfoJMS586_20) (int index, unsigned char port, UNION_IDENTIFY_DEVICE* identify);
typedef BOOL(WINAPI* _GetNVMePortInfoJMS586_20) (int index, unsigned char port, NVME_PORT_20* nvmePort);
typedef BOOL(WINAPI* _GetNVMeSmartInfoJMS586_20) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* smartInfo);
// JMicron JMS586_New API
typedef DWORD(WINAPI* _GetDllVersionJMS586_40) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
typedef int(WINAPI* _GetControllerCountJMS586_40) ();
typedef BOOL(WINAPI* _GetSmartInfoJMS586_40) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* attribute, UNION_SMART_THRESHOLD* threshold);
typedef BOOL(WINAPI* _GetIdentifyInfoJMS586_40) (int index, unsigned char port, UNION_IDENTIFY_DEVICE* identify);
typedef BOOL(WINAPI* _GetNVMePortInfoJMS586_40) (int index, unsigned char port, NVME_PORT_40* nvmePort);
typedef BOOL(WINAPI* _GetNVMeSmartInfoJMS586_40) (int index, unsigned char port, UNION_SMART_ATTRIBUTE* smartInfo);