1 *******************************************************************************
3 *******************************************************************************
4 ** Usage of IOP331 adapter
5 ** (All In/Out is in IOP331's view)
6 ** 1. Message 0 --> InitThread message and return code
7 ** 2. Doorbell is used for RS-232 emulation
8 ** inDoorBell : bit0 -- data in ready
9 ** (DRIVER DATA WRITE OK)
10 ** bit1 -- data out has been read
11 ** (DRIVER DATA READ OK)
12 ** outDooeBell: bit0 -- data out ready
13 ** (IOP331 DATA WRITE OK)
14 ** bit1 -- data in has been read
15 ** (IOP331 DATA READ OK)
16 ** 3. Index Memory Usage
17 ** offset 0xf00 : for RS232 out (request buffer)
18 ** offset 0xe00 : for RS232 in (scratch buffer)
19 ** offset 0xa00 : for inbound message code message_rwbuffer
20 ** (driver send to IOP331)
21 ** offset 0xa00 : for outbound message code message_rwbuffer
22 ** (IOP331 send to driver)
23 ** 4. RS-232 emulation
24 ** Currently 128 byte buffer is used
25 ** 1st uint32_t : Data length (1--124)
26 ** Byte 4--127 : Max 124 bytes of data
28 ** All SCSI Command must be sent through postQ:
29 ** (inbound queue port) Request frame must be 32 bytes aligned
30 ** #bit27--bit31 => flag for post ccb
31 ** #bit0--bit26 => real address (bit27--bit31) of post arcmsr_cdb
33 ** 0 : 256 bytes frame
34 ** 1 : 512 bytes frame
41 ** ---------------------------------------------------------------------------
42 ** (outbount queue port) Request reply
46 ** => real address (bit27--bit31) of reply arcmsr_cdb
47 ** bit31 : must be 0 (for this type of reply)
48 ** bit30 : reserved for BIOS handshake
51 ** 0 : no error, ignore AdapStatus/DevStatus/SenseData
52 ** 1 : Error, error code in AdapStatus/DevStatus/SenseData
55 ** All BIOS request is the same with request from PostQ
57 ** Request frame is sent from configuration space
58 ** offset: 0x78 : Request Frame (bit30 == 1)
59 ** offset: 0x18 : writeonly to generate
61 ** Completion of request:
62 ** (bit30 == 0, bit28==err flag)
63 ** 7. Definition of SGL entry (structure)
64 ** 8. Message1 Out - Diag Status Code (????)
65 ** 9. Message0 message code :
68 ** ->offset 0xa00 :for outbound message code message_rwbuffer
69 ** (IOP331 send to driver)
70 ** Signature 0x87974060(4)
71 ** Request len 0x00000200(4)
72 ** numbers of queue 0x00000100(4)
73 ** SDRAM Size 0x00000100(4)-->256 MB
74 ** IDE Channels 0x00000008(4)
75 ** vendor 40 bytes char
77 ** FirmVer 16 bytes char
78 ** Device Map 16 bytes char
79 ** FirmwareVersion DWORD <== Added for checking of
80 ** new firmware capability
82 ** ->offset 0xa00 :for inbound message code message_rwbuffer
83 ** (driver send to IOP331)
84 ** Signature 0x87974063(4)
85 ** UPPER32 of Request Frame (4)-->Driver Only
86 ** 0x03 : Reset (Abort all queued Command)
87 ** 0x04 : Stop Background Activity
89 ** 0x06 : Start Background Activity
90 ** (re-start if background is halted)
91 ** 0x07 : Check If Host Command Pending
92 ** (Novell May Need This Function)
93 ** 0x08 : Set controller time
94 ** ->offset 0xa00 : for inbound message code message_rwbuffer
96 ** byte 0 : 0xaa <-- signature
97 ** byte 1 : 0x55 <-- signature
99 ** byte 3 : month (1..12)
100 ** byte 4 : date (1..31)
101 ** byte 5 : hour (0..23)
102 ** byte 6 : minute (0..59)
103 ** byte 7 : second (0..59)
104 *******************************************************************************
105 *******************************************************************************
106 ** RS-232 Interface for Areca Raid Controller
107 ** The low level command interface is exclusive with VT100 terminal
108 ** --------------------------------------------------------------------
109 ** 1. Sequence of command execution
110 ** --------------------------------------------------------------------
111 ** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61)
112 ** (B) Command block : variable length of data including length,
113 ** command code, data and checksum byte
114 ** (C) Return data : variable length of data
115 ** --------------------------------------------------------------------
117 ** --------------------------------------------------------------------
118 ** (A) 1st byte : command block length (low byte)
119 ** (B) 2nd byte : command block length (high byte)
120 ** note ..command block length shouldn't > 2040 bytes,
121 ** length excludes these two bytes
122 ** (C) 3rd byte : command code
123 ** (D) 4th and following bytes : variable length data bytes
124 ** depends on command code
125 ** (E) last byte : checksum byte (sum of 1st byte until last data byte)
126 ** --------------------------------------------------------------------
127 ** 3. Command code and associated data
128 ** --------------------------------------------------------------------
129 ** The following are command code defined in raid controller Command
130 ** code 0x10--0x1? are used for system level management,
131 ** no password checking is needed and should be implemented in separate
132 ** well controlled utility and not for end user access.
133 ** Command code 0x20--0x?? always check the password,
134 ** password must be entered to enable these command.
137 ** GUI_SET_SERIAL=0x10,
141 ** GUI_CHECK_PASSWORD,
144 ** GUI_SET_ETHERNET_ADDR,
148 ** GUI_GET_HW_MONITOR,
149 ** // GUI_QUICK_CREATE=0x20, (function removed)
150 ** GUI_GET_INFO_R=0x20,
155 ** GUI_MUTE_BEEPER=0x30,
156 ** GUI_BEEPER_SETTING,
158 ** GUI_HOST_INTERFACE_MODE,
159 ** GUI_REBUILD_PRIORITY,
161 ** GUI_RESET_CONTROLLER,
162 ** GUI_COM_PORT_SETTING,
165 ** GUI_CREATE_PASS_THROUGH=0x40,
166 ** GUI_MODIFY_PASS_THROUGH,
167 ** GUI_DELETE_PASS_THROUGH,
168 ** GUI_IDENTIFY_DEVICE,
169 ** GUI_CREATE_RAIDSET=0x50,
170 ** GUI_DELETE_RAIDSET,
171 ** GUI_EXPAND_RAIDSET,
172 ** GUI_ACTIVATE_RAIDSET,
173 ** GUI_CREATE_HOT_SPARE,
174 ** GUI_DELETE_HOT_SPARE,
175 ** GUI_CREATE_VOLUME=0x60,
176 ** GUI_MODIFY_VOLUME,
177 ** GUI_DELETE_VOLUME,
178 ** GUI_START_CHECK_VOLUME,
179 ** GUI_STOP_CHECK_VOLUME
181 ** Command description :
182 ** GUI_SET_SERIAL : Set the controller serial#
184 ** byte 2 : command code 0x10
185 ** byte 3 : password length (should be 0x0f)
186 ** byte 4-0x13 : should be "ArEcATecHnoLogY"
187 ** byte 0x14--0x23 : Serial number string (must be 16 bytes)
188 ** GUI_SET_VENDOR : Set vendor string for the controller
190 ** byte 2 : command code 0x11
191 ** byte 3 : password length (should be 0x08)
192 ** byte 4-0x13 : should be "ArEcAvAr"
193 ** byte 0x14--0x3B : vendor string (must be 40 bytes)
194 ** GUI_SET_MODEL : Set the model name of the controller
196 ** byte 2 : command code 0x12
197 ** byte 3 : password length (should be 0x08)
198 ** byte 4-0x13 : should be "ArEcAvAr"
199 ** byte 0x14--0x1B : model string (must be 8 bytes)
200 ** GUI_IDENTIFY : Identify device
202 ** byte 2 : command code 0x13
203 ** return "Areca RAID Subsystem "
204 ** GUI_CHECK_PASSWORD : Verify password
206 ** byte 2 : command code 0x14
207 ** byte 3 : password length
208 ** byte 4-0x?? : user password to be checked
209 ** GUI_LOGOUT : Logout GUI (force password checking on next command)
211 ** byte 2 : command code 0x15
212 ** GUI_HTTP : HTTP interface (reserved for Http proxy service)(0x16)
214 ** GUI_SET_ETHERNET_ADDR : Set the ethernet MAC address
216 ** byte 2 : command code 0x17
217 ** byte 3 : password length (should be 0x08)
218 ** byte 4-0x13 : should be "ArEcAvAr"
219 ** byte 0x14--0x19 : Ethernet MAC address (must be 6 bytes)
220 ** GUI_SET_LOGO : Set logo in HTTP
222 ** byte 2 : command code 0x18
223 ** byte 3 : Page# (0/1/2/3) (0xff --> clear OEM logo)
224 ** byte 4/5/6/7 : 0x55/0xaa/0xa5/0x5a
225 ** byte 8 : TITLE.JPG data (each page must be 2000 bytes)
226 ** note page0 1st 2 byte must be
227 ** actual length of the JPG file
228 ** GUI_POLL_EVENT : Poll If Event Log Changed
230 ** byte 2 : command code 0x19
231 ** GUI_GET_EVENT : Read Event
233 ** byte 2 : command code 0x1a
234 ** byte 3 : Event Page (0:1st page/1/2/3:last page)
235 ** GUI_GET_HW_MONITOR : Get HW monitor data
237 ** byte 2 : command code 0x1b
238 ** byte 3 : # of FANs(example 2)
239 ** byte 4 : # of Voltage sensor(example 3)
240 ** byte 5 : # of temperature sensor(example 2)
241 ** byte 6 : # of power
242 ** byte 7/8 : Fan#0 (RPM)
244 ** byte 11/12 : Voltage#0 original value in *1000
245 ** byte 13/14 : Voltage#0 value
246 ** byte 15/16 : Voltage#1 org
247 ** byte 17/18 : Voltage#1
248 ** byte 19/20 : Voltage#2 org
249 ** byte 21/22 : Voltage#2
252 ** byte 25 : Power indicator (bit0 : power#0,
254 ** byte 26 : UPS indicator
255 ** GUI_QUICK_CREATE : Quick create raid/volume set
257 ** byte 2 : command code 0x20
258 ** byte 3/4/5/6 : raw capacity
259 ** byte 7 : raid level
260 ** byte 8 : stripe size
262 ** byte 10/11/12/13: device mask (the devices to create raid/volume)
263 ** This function is removed, application like
264 ** to implement quick create function
265 ** need to use GUI_CREATE_RAIDSET and GUI_CREATE_VOLUMESET function.
266 ** GUI_GET_INFO_R : Get Raid Set Information
268 ** byte 2 : command code 0x20
270 ** typedef struct sGUI_RAIDSET
272 ** BYTE grsRaidSetName[16];
273 ** DWORD grsCapacity;
274 ** DWORD grsCapacityX;
275 ** DWORD grsFailMask;
276 ** BYTE grsDevArray[32];
277 ** BYTE grsMemberDevices;
278 ** BYTE grsNewMemberDevices;
279 ** BYTE grsRaidState;
281 ** BYTE grsVolumeList[16];
285 ** BYTE grsFreeSegments;
286 ** DWORD grsRawStripes[8];
288 ** DWORD grsRes5; // Total to 128 bytes
289 ** DWORD grsRes6; // Total to 128 bytes
290 ** } sGUI_RAIDSET, *pGUI_RAIDSET;
291 ** GUI_GET_INFO_V : Get Volume Set Information
293 ** byte 2 : command code 0x21
294 ** byte 3 : volumeset#
295 ** typedef struct sGUI_VOLUMESET
297 ** BYTE gvsVolumeName[16]; // 16
298 ** DWORD gvsCapacity;
299 ** DWORD gvsCapacityX;
300 ** DWORD gvsFailMask;
301 ** DWORD gvsStripeSize;
302 ** DWORD gvsNewFailMask;
303 ** DWORD gvsNewStripeSize;
304 ** DWORD gvsVolumeStatus;
305 ** DWORD gvsProgress; // 32
306 ** sSCSI_ATTR gvsScsi;
307 ** BYTE gvsMemberDisks;
308 ** BYTE gvsRaidLevel; // 8
309 ** BYTE gvsNewMemberDisks;
310 ** BYTE gvsNewRaidLevel;
311 ** BYTE gvsRaidSetNumber;
312 ** BYTE gvsRes0; // 4
313 ** BYTE gvsRes1[4]; // 64 bytes
314 ** } sGUI_VOLUMESET, *pGUI_VOLUMESET;
315 ** GUI_GET_INFO_P : Get Physical Drive Information
317 ** byte 2 : command code 0x22
318 ** byte 3 : drive # (from 0 to max-channels - 1)
319 ** typedef struct sGUI_PHY_DRV
321 ** BYTE gpdModelName[40];
322 ** BYTE gpdSerialNumber[20];
323 ** BYTE gpdFirmRev[8];
324 ** DWORD gpdCapacity;
325 ** DWORD gpdCapacityX; // Reserved for expansion
326 ** BYTE gpdDeviceState;
328 ** BYTE gpdCurrentUdmaMode;
330 ** BYTE gpdDriveSelect;
331 ** BYTE gpdRaidNumber; // 0xff if not belongs to a raid set
332 ** sSCSI_ATTR gpdScsi;
333 ** BYTE gpdReserved[40]; // Total to 128 bytes
334 ** } sGUI_PHY_DRV, *pGUI_PHY_DRV;
335 ** GUI_GET_INFO_S : Get System Information
337 ** byte 2 : command code 0x23
338 ** typedef struct sCOM_ATTR
344 ** BYTE comFlowControl;
345 ** } sCOM_ATTR, *pCOM_ATTR;
346 ** typedef struct sSYSTEM_INFO
348 ** BYTE gsiVendorName[40];
349 ** BYTE gsiSerialNumber[16];
350 ** BYTE gsiFirmVersion[16];
351 ** BYTE gsiBootVersion[16];
352 ** BYTE gsiMbVersion[16];
353 ** BYTE gsiModelName[8];
354 ** BYTE gsiLocalIp[4];
355 ** BYTE gsiCurrentIp[4];
356 ** DWORD gsiTimeTick;
357 ** DWORD gsiCpuSpeed;
361 ** DWORD gsiMemorySize;
362 ** DWORD gsiMemorySpeed;
364 ** BYTE gsiMacAddress[6];
367 ** BYTE gsiChannelUsage;
368 ** BYTE gsiMaxAtaMode;
369 ** BYTE gsiSdramEcc; // 1:if ECC enabled
370 ** BYTE gsiRebuildPriority;
371 ** sCOM_ATTR gsiComA; // 5 bytes
372 ** sCOM_ATTR gsiComB; // 5 bytes
373 ** BYTE gsiIdeChannels;
374 ** BYTE gsiScsiHostChannels;
375 ** BYTE gsiIdeHostChannels;
376 ** BYTE gsiMaxVolumeSet;
377 ** BYTE gsiMaxRaidSet;
378 ** BYTE gsiEtherPort; // 1:if ether net port supported
379 ** BYTE gsiRaid6Engine; // 1:Raid6 engine supported
381 ** } sSYSTEM_INFO, *pSYSTEM_INFO;
382 ** GUI_CLEAR_EVENT : Clear System Event
384 ** byte 2 : command code 0x24
385 ** GUI_MUTE_BEEPER : Mute current beeper
387 ** byte 2 : command code 0x30
388 ** GUI_BEEPER_SETTING : Disable beeper
390 ** byte 2 : command code 0x31
391 ** byte 3 : 0->disable, 1->enable
392 ** GUI_SET_PASSWORD : Change password
394 ** byte 2 : command code 0x32
395 ** byte 3 : pass word length ( must <= 15 )
396 ** byte 4 : password (must be alpha-numerical)
397 ** GUI_HOST_INTERFACE_MODE : Set host interface mode
399 ** byte 2 : command code 0x33
400 ** byte 3 : 0->Independent, 1->cluster
401 ** GUI_REBUILD_PRIORITY : Set rebuild priority
403 ** byte 2 : command code 0x34
404 ** byte 3 : 0/1/2/3 (low->high)
405 ** GUI_MAX_ATA_MODE : Set maximum ATA mode to be used
407 ** byte 2 : command code 0x35
408 ** byte 3 : 0/1/2/3 (133/100/66/33)
409 ** GUI_RESET_CONTROLLER : Reset Controller
411 ** byte 2 : command code 0x36
412 ** *Response with VT100 screen (discard it)
413 ** GUI_COM_PORT_SETTING : COM port setting
415 ** byte 2 : command code 0x37
416 ** byte 3 : 0->COMA (term port),
417 ** 1->COMB (debug port)
418 ** byte 4 : 0/1/2/3/4/5/6/7
419 ** (1200/2400/4800/9600/19200/38400/57600/115200)
421 ** (0:7 bit, 1:8 bit : must be 8 bit)
422 ** byte 6 : stop bit (0:1, 1:2 stop bits)
423 ** byte 7 : parity (0:none, 1:off, 2:even)
424 ** byte 8 : flow control
425 ** (0:none, 1:xon/xoff, 2:hardware => must use none)
426 ** GUI_NO_OPERATION : No operation
428 ** byte 2 : command code 0x38
429 ** GUI_DHCP_IP : Set DHCP option and local IP address
431 ** byte 2 : command code 0x39
432 ** byte 3 : 0:dhcp disabled, 1:dhcp enabled
433 ** byte 4/5/6/7 : IP address
434 ** GUI_CREATE_PASS_THROUGH : Create pass through disk
436 ** byte 2 : command code 0x40
438 ** byte 4 : scsi channel (0/1)
439 ** byte 5 : scsi id (0-->15)
440 ** byte 6 : scsi lun (0-->7)
441 ** byte 7 : tagged queue (1 : enabled)
442 ** byte 8 : cache mode (1 : enabled)
443 ** byte 9 : max speed (0/1/2/3/4,
444 ** async/20/40/80/160 for scsi)
445 ** (0/1/2/3/4, 33/66/100/133/150 for ide )
446 ** GUI_MODIFY_PASS_THROUGH : Modify pass through disk
448 ** byte 2 : command code 0x41
450 ** byte 4 : scsi channel (0/1)
451 ** byte 5 : scsi id (0-->15)
452 ** byte 6 : scsi lun (0-->7)
453 ** byte 7 : tagged queue (1 : enabled)
454 ** byte 8 : cache mode (1 : enabled)
455 ** byte 9 : max speed (0/1/2/3/4,
456 ** async/20/40/80/160 for scsi)
457 ** (0/1/2/3/4, 33/66/100/133/150 for ide )
458 ** GUI_DELETE_PASS_THROUGH : Delete pass through disk
460 ** byte 2 : command code 0x42
461 ** byte 3 : device# to be deleted
462 ** GUI_IDENTIFY_DEVICE : Identify Device
464 ** byte 2 : command code 0x43
465 ** byte 3 : Flash Method
466 ** (0:flash selected, 1:flash not selected)
467 ** byte 4/5/6/7 : IDE device mask to be flashed
468 ** note .... no response data available
469 ** GUI_CREATE_RAIDSET : Create Raid Set
471 ** byte 2 : command code 0x50
472 ** byte 3/4/5/6 : device mask
473 ** byte 7-22 : raidset name (if byte 7 == 0:use default)
474 ** GUI_DELETE_RAIDSET : Delete Raid Set
476 ** byte 2 : command code 0x51
478 ** GUI_EXPAND_RAIDSET : Expand Raid Set
480 ** byte 2 : command code 0x52
482 ** byte 4/5/6/7 : device mask for expansion
483 ** byte 8/9/10 : (8:0 no change, 1 change, 0xff:terminate,
485 ** 10:new stripe size
486 ** 0/1/2/3/4/5->4/8/16/32/64/128K )
487 ** byte 11/12/13 : repeat for each volume in the raidset
488 ** GUI_ACTIVATE_RAIDSET : Activate incomplete raid set
490 ** byte 2 : command code 0x53
492 ** GUI_CREATE_HOT_SPARE : Create hot spare disk
494 ** byte 2 : command code 0x54
495 ** byte 3/4/5/6 : device mask for hot spare creation
496 ** GUI_DELETE_HOT_SPARE : Delete hot spare disk
498 ** byte 2 : command code 0x55
499 ** byte 3/4/5/6 : device mask for hot spare deletion
500 ** GUI_CREATE_VOLUME : Create volume set
502 ** byte 2 : command code 0x60
504 ** byte 4-19 : volume set name
505 ** (if byte4 == 0, use default)
506 ** byte 20-27 : volume capacity (blocks)
507 ** byte 28 : raid level
508 ** byte 29 : stripe size
509 ** (0/1/2/3/4/5->4/8/16/32/64/128K)
513 ** byte 33 : 1 enable tag
514 ** byte 34 : 1 enable cache
516 ** (0/1/2/3/4->async/20/40/80/160 for scsi)
517 ** (0/1/2/3/4->33/66/100/133/150 for IDE )
518 ** byte 36 : 1 to select quick init
520 ** GUI_MODIFY_VOLUME : Modify volume Set
522 ** byte 2 : command code 0x61
523 ** byte 3 : volumeset#
524 ** byte 4-19 : new volume set name
525 ** (if byte4 == 0, not change)
526 ** byte 20-27 : new volume capacity (reserved)
527 ** byte 28 : new raid level
528 ** byte 29 : new stripe size
529 ** (0/1/2/3/4/5->4/8/16/32/64/128K)
530 ** byte 30 : new channel
533 ** byte 33 : 1 enable tag
534 ** byte 34 : 1 enable cache
536 ** (0/1/2/3/4->async/20/40/80/160 for scsi)
537 ** (0/1/2/3/4->33/66/100/133/150 for IDE )
538 ** GUI_DELETE_VOLUME : Delete volume set
540 ** byte 2 : command code 0x62
541 ** byte 3 : volumeset#
542 ** GUI_START_CHECK_VOLUME : Start volume consistency check
544 ** byte 2 : command code 0x63
545 ** byte 3 : volumeset#
546 ** GUI_STOP_CHECK_VOLUME : Stop volume consistency check
548 ** byte 2 : command code 0x64
549 ** ---------------------------------------------------------------------
551 ** ---------------------------------------------------------------------
552 ** (A) Header : 3 bytes sequence (0x5E, 0x01, 0x61)
553 ** (B) Length : 2 bytes
554 ** (low byte 1st, excludes length and checksum byte)
555 ** (C) status or data :
556 ** <1> If length == 1 ==> 1 byte status code
557 ** #define GUI_OK 0x41
558 ** #define GUI_RAIDSET_NOT_NORMAL 0x42
559 ** #define GUI_VOLUMESET_NOT_NORMAL 0x43
560 ** #define GUI_NO_RAIDSET 0x44
561 ** #define GUI_NO_VOLUMESET 0x45
562 ** #define GUI_NO_PHYSICAL_DRIVE 0x46
563 ** #define GUI_PARAMETER_ERROR 0x47
564 ** #define GUI_UNSUPPORTED_COMMAND 0x48
565 ** #define GUI_DISK_CONFIG_CHANGED 0x49
566 ** #define GUI_INVALID_PASSWORD 0x4a
567 ** #define GUI_NO_DISK_SPACE 0x4b
568 ** #define GUI_CHECKSUM_ERROR 0x4c
569 ** #define GUI_PASSWORD_REQUIRED 0x4d
570 ** <2> If length > 1 ==>
571 ** data block returned from controller
572 ** and the contents depends on the command code
573 ** (E) Checksum : checksum of length and status or data byte
574 **************************************************************************